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.exists_runPath_seq: run paths compose, and the composed path visits only cells that the two paths visit.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
- tm₀.seq tm₁ = tm₀.combine tm₁ (Turing.MultiTapeTM.handOver tm₁.q₀) (Option.map Sum.inr) (Sum.inl tm₀.q₀)
Instances For
Sequential composition of runs. A run path of tm₀ to a halted configuration and a run path
of tm₁ started where tm₀ halted combine into a run path of seq: the first path up to its first
halted configuration, followed by the second. It takes at most as many steps as the two paths
together, and visits only cells that they visit.
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.