Sequential composition of machines on shared tapes #
seq tm₀ tm₁ behaves like tm₀ until tm₀ would halt, at which point it continues as tm₁,
started in its initial state on the tapes as tm₀ left them. The state space is
State₀ ⊕ State₁, and the halting transition of the first phase is mapped to the initial state
of the second, so the handoff costs no extra step.
At the specification level this is transformsTapes_seq: transformations compose, with the time
and space bounds adding. The postcondition of TransformsTapes is what makes the proof direct:
the first machine halts in a full wordsCfg, which is exactly a starting configuration for the
second.
Main results #
Turing.MultiTapeTM.seq: the composed machine.Turing.MultiTapeTM.HaltsAt.runFrom_seq: oncetm₀halts,seqmirrorstm₁.Turing.MultiTapeTM.runFrom_seq: runs compose; each machine only has to have halted by the end of its time bound.Turing.MultiTapeTM.forgetState_runFrom_seq: invariants of the state-free part of a configuration compose, which bounds the space of the composed run.Turing.MultiTapeTM.transformsTapes_seq: transformations compose, bounds adding.
The sequential composition of tm₀ and tm₁: it behaves like tm₀ until tm₀ would halt,
at which point it switches to the initial state of tm₁ and behaves like tm₁. The switch is
folded into the halting transition of tm₀, so it costs no step.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A configuration of the first phase: a configuration of tm₀, with a halted state mapped to
the initial state of the second phase. Under this map, the whole first phase of seq mirrors the
run of tm₀, including its halting step.
Equations
- Turing.MultiTapeTM.Sequential.leftCfg tm₁ cfg = Turing.Cfg.mapState (fun (st : Option State₀) => some (st.elim (Sum.inr tm₁.q₀) Sum.inl)) cfg
Instances For
The second phase of seq mirrors the run of tm₁.
While tm₀ is running, seq mirrors it.
A halted configuration of the first phase is the start of the second phase.
If tm₀ halts at step u, then from step u on seq mirrors tm₁, started where tm₀
halted.
Sequential composition of runs. If tm₀ has halted in mid by step t₀, and tm₁,
started where tm₀ halted, has halted in fin by step t₁, then the composed machine has halted
in fin by step t₀ + t₁. Each machine may halt earlier than its bound; in particular tm₀ need
not be running at every step before t₀.
Invariants of a sequential run. If tm₀ has halted in mid by step t₀, then a property
of the state-free part of a configuration holds throughout the run of the composed machine if it
holds before step t₀ of the run of tm₀ and throughout the run of tm₁ started where tm₀
halted.
Sequential composition of transformations. If the postcondition of the first transformation implies the precondition of the second, the composed machine performs the two transformations one after the other, with the time and space bounds adding and the emitted words concatenating.