Sequencing effectful machines #
The first machine's halting transition transfers control to the second, retaining every tape and communication channel. The transition-choice mechanism only needs to support mapping its actions. Execution commutes with this mapping when the choice interpreter does; in particular, deterministic choices and sampling a supplied coin have this property.
Two actual halting bounds add even when stopping times depend on random choices or oracle answers. The distributional theorem retains the final configuration and private interpreter state. This is sequencing on shared tapes: supplying fresh encoded input and clean communication state is a separate obligation of a higher-level composition compiler.
Main definitions #
Turing.MultiTapeMachine.seq: sequential composition, with no extra handoff instruction.
Main results #
Turing.MultiTapeMachine.Sequential.runConfigFrom_right: after handoff the continuation's complete program is unchanged, up to embedding its control states.Turing.MultiTapeMachine.run_interpret_runConfigFrom_seq: the joint distribution of a sequential run is the monadic composition of the two phases.Turing.MultiTapeMachine.interpret_runConfigFrom_seq_list: exact List bind, including repeated equal configurations, under the two phase halting bounds.Turing.MultiTapeMachine.toTM_seq: the deterministic compiler is exactly upstream'sseq.
References #
Adapted from MultiTape/Oracle/Sequential.lean on the cslib crypto branch at
5ff69ca93402e7c947208dc56396d6d86203ccd8 to the common machine and typed program interface.
Embed the first phase, dispatching its halt to the continuation's initial state.
Instances For
Start the continuation on the complete tape and communication state left by the first phase.
Instances For
Transfer control when the first machine halts, retaining all tapes and oracle channels.
Instances For
While the first phase is active, one instruction mirrors its complete program.
After handoff, the continuation runs its unchanged program in right states.
In the deterministic effect-free case, this is exactly upstream's sequential compiler.
List interpretation of sequencing is exact list bind, retaining repeated equal endpoints. The phase bounds are actual halting bounds. Excluding stuck branches is a separate obligation, since an empty interpreted choice has no endpoints.
Sequential halting bounds add even when the first stopping time depends on random choices. The equality retains the final configuration and the interpreter's private state.
A deterministic preparation phase hands its exact restored configuration to the continuation.
Observing only the output gives the usual monadic sequencing law under the same bounds.