A bounded input zipper for the TM2 compiler #
The left stack is reversed and the right stack includes the symbol under the head. A separate flag distinguishes the left boundary from the first input symbol. An empty right stack with the flag unset represents the right boundary, including the initial position on empty input.
Main definitions #
Turing.MultiTapeTM.ToTM2.Input: the two stacks and the left-boundary flag.Turing.MultiTapeTM.ToTM2.Input.Represents: agreement with a native input and head position.
Main results #
Turing.MultiTapeTM.ToTM2.Input.represents_init: initialization represents native position one.Turing.MultiTapeTM.ToTM2.Input.Represents.read_eq_inputSymbol: reads agree with native reads.Turing.MultiTapeTM.ToTM2.Input.Represents.move: moves agree, including boundary clamping.
A read-only input tape represented by two stacks and a left-boundary flag.
- left : List Symbol
Input symbols strictly to the left of the head, in reverse order.
- right : List Symbol
Input symbols from the head onward, in input order.
- atLeft : Bool
Whether the head is at the blank before the input.
Instances For
Start at native position one, also when the input is empty.
Instances For
Read the current input symbol, or a blank at either boundary.
Instances For
Move left, stopping at the blank before the input.
Instances For
Move right, stopping at the blank after the input.
Instances For
The stacks reconstruct the input and locate the head at the native bounded position.
The two stacks hold exactly the original input.
No symbols precede the left boundary.
Native positions count the left boundary as zero.
Instances For
Initialization agrees with the native initial head position, including on empty input.
A zipper read agrees with indexing the original input at the native head position.
A zipper read agrees with the input symbol of any represented native configuration.
Moving left preserves the representation, with clamping at the left boundary.
Moving right preserves the representation, with clamping at the right boundary.
Each zipper move simulates the corresponding native bounded head move.