A finite stack program for deterministic multi-tape machines #
The input uses a pair of binary stacks and a flag for the left boundary. Each two-sided work
tape uses two stacks over Option Bool, with its current cell in finite control. Output is
accumulated in reverse order. A separate cleanup phase empties all auxiliary stacks before
reversing the output and resetting the control to Mathlib's canonical haltList convention.
Main definitions #
Turing.TM2.selectList,Turing.TM2.select: finite case analysis in a TM2 statement.Turing.MultiTapeTM.ToTM2.machine: the finite-alphabet stack machine.Turing.MultiTapeTM.ToTM2.program: its running, cleanup and output-reversal phases.
References #
Finite case analysis compiles an arbitrary table on finite control to a fixed statement.
Instances For
Work stacks store blank cells explicitly; the input and output alphabets are binary.
Instances For
All unbounded data live on stacks. symbol and busy are scratch registers.
- state : Option State
The source state, or
nonewhen its final action has executed. - atLeft : Bool
Whether the bounded input head is at the blank before the word.
The current cell on each work tape.
A scratch register for input movement and output reversal.
- busy : Bool
Whether the current cleanup round found a nonempty auxiliary stack.
Instances For
Initial finite control, also restored before halting.
Instances For
A statement over the compiler's stack alphabets, phases and finite control.
Instances For
Stacks discarded before output reversal.
Instances For
A cleanup round either reduces auxiliary storage or advances to output reversal.