TM0 Sequential Composition #
This file defines sequential composition of TM0 machines and proves that the composed machine halts iff M₁ halts and M₂ halts on M₁'s output tape.
Main definitions #
TM0Seq.compose— compose two TM0 machines sequentiallyTM0Seq.evalCfg— evaluate a TM0 returning the full configTM0Seq.compose_phase2_respects— phase 2 bisimulationTM0Seq.compose_dom_iff— full correctness theorem
Architecture #
The composed machine compose M₁ M₂ uses states Λ₁ ⊕ Λ₂:
- In
Sum.inl q₁states: runs M₁. When M₁ halts, immediately tries M₂'s first step. - In
Sum.inr q₂states: runs M₂.
The key correctness theorem says: if M₁ always halts on input l and
produces output tape Tape.mk₁ l', then the composed machine halts on l
iff M₂ halts on l'.
Evaluate a TM0 machine and return the full output configuration
(state + tape), rather than just the tape as TM0.eval does.
Equations
- TM0Seq.evalCfg M l = Turing.eval (Turing.TM0.step M) (Turing.TM0.init l)
Instances For
evalCfg has the same Dom as TM0.eval.
Evaluate a TM0 from an arbitrary configuration.
Equations
- TM0Seq.evalFromCfg M cfg = Turing.eval (Turing.TM0.step M) cfg
Instances For
evalFromCfg from the initial config equals evalCfg.
Sequential composition of TM0 machines.
When M₁ halts (returns none), we immediately invoke M₂ from its default state
on the current tape symbol.
Equations
Instances For
Phase 2 preserves Dom: evalFromCfg of M₂ from ⟨default, T⟩ halts iff
the composed machine from ⟨Sum.inr default, T⟩ halts.
Correctness of sequential composition.
If M₁ halts on input l, then the composed machine halts on l iff
M₂ halts on M₁'s output tape.