Helper Lemmas for TM → Grammar Construction #
This file contains the detailed helper lemmas needed to prove the correctness
of the tmToGrammar construction.
Encoding TM configurations as sentential forms #
A TM0 configuration ⟨q, tape⟩ together with an "original input track" is encoded
as a sentential form of the grammar. The encoding represents a finite window of the
tape as a sequence of cell/headCell nonterminals flanked by boundary markers.
A "two-track tape segment" encodes a finite portion of the TM tape along with the original input at each position.
leftCells are the cells to the left of the head (in order from left to right).
headState is the TM state at the head position.
headOrig is the original input at the head position.
headCur is the current tape content at the head position.
rightCells are the cells to the right of the head (in order from left to right).
Each cell is a pair (original, current).
Instances For
Encode a TwoTrackConfig as a sentential form of the grammar.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The initial two-track configuration for input w. The head is at the leftmost
position (or on blank for empty input).
Equations
Instances For
Phase 1: Generation #
The grammar derives the encoding of the initial configuration from [start]:
- S → leftBound · genMore · rightBound
- Repeatedly: genMore → genMore · cell(tᵢ) (adding cells right-to-left)
- genMore → headCell(q₀, t₁) (or headCell(q₀, none, none) for empty input)
Phase 3: Cleanup #
After the TM halts, the grammar converts all nonterminals to terminals.
Encode the "halted" configuration: all cells converted to haltCells.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Extract the original input from a list of originals (keep only some values).
Equations
- extractInput originals = List.filterMap id originals
Instances For
Rule membership helpers #
A rule from the generation rules is in the grammar.
A rule from the simulation rules is in the grammar.
A rule from the cleanup rules is in the grammar.
Get the originals from a TwoTrackConfig.
Equations
Instances For
Phase 2: Simulation #
The simulation phase shows that each TM0 step can be mirrored by a grammar derivation step on the encoded sentential form.
Compute the next TwoTrackConfig after one TM0 step. Returns none if the TM halts.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Phase 2.5: Halt conversion #
When the TM halts, convert the two-track encoding to the halted encoding.
Composing all phases #
Correspondence between TM0.Cfg and TwoTrackConfig #
A TwoTrackConfig corresponds to a TM0.Cfg if the head state, head symbol, and tape contents match (with the tape being blank beyond the TwoTrackConfig window).