2. The machine model
2.1. Orientation
Two machine types appear in the development. BiTM (BiTM/Basic.lean) is the
ordinary Turing machine on a two-way tape with implicit blanks; Wolfram's machine
and the simulated machines of
the chapter on the machine reduction are both BiTM
machines. The lookahead machine type LMachine
(Smith/Lookahead.lean) reads the active cell and its right neighbour and may
rewrite both; Smith's Systems 1 to 3 need it (p. 4-5), and System 0 is Wolfram's
machine written in it. The bridge Smith.toBi (Smith/Wolfram23Bridge.lean)
carries System 0 runs to BiTM.wolfram23 runs.
2.2. Shared definitions
TM/Defs.lean holds three definitions. States and symbols are natural numbers;
state 0 is the halt state; numStates and numSymbols are documentation, never
read by the step function.
A direction of head movement: L (left) or R (right).
Lean code for Definition2.2.1●1 definition
Associated Lean declarations
-
TM.Dir[complete]
-
TM.Dir[complete]
-
inductivedefined in TM/Defs.leancomplete
inductive TM.Dir : Type
inductive TM.Dir : Type
Direction of head movement
Constructors
TM.Dir.L : TM.Dir
TM.Dir.R : TM.Dir
A transition rule: the next state nextState, the symbol write to write, and
the direction dir (Definition 2.2.1) to move. States and symbols are natural
numbers.
Lean code for Definition2.2.2●1 definition
Associated Lean declarations
-
TM.Rule[complete]
-
TM.Rule[complete]
-
structuredefined in TM/Defs.leancomplete
structure TM.Rule : Type
structure TM.Rule : Type
A transition rule: (nextState, writeSymbol, direction)
Fields
nextState : ℕ
write : ℕ
dir : TM.Dir
A deterministic Turing machine: numStates, numSymbols, and
transition : Nat → Nat → Rule, the rule (Definition 2.2.2) for a state and a
read symbol. State 0 is the halt state; numStates and numSymbols are
documentation, never read by the step function.
Lean code for Definition2.2.3●1 definition
Associated Lean declarations
-
TM.Machine[complete]
-
TM.Machine[complete]
-
structuredefined in TM/Defs.leancomplete
structure TM.Machine : Type
structure TM.Machine : Type
A deterministic Turing machine. The transition function maps (state, readSymbol) -> Rule. States are 0..numStates-1, symbols are 0..numSymbols-1. State 0 is the halt state.
Fields
numStates : ℕ
numSymbols : ℕ
transition : ℕ → ℕ → TM.Rule
2.3. BiTM: configurations, steps, runs
A configuration (state, left, head, right): the state, the cells left of the
head nearest first, the head cell, and the cells right of the head nearest
first. Cells are natural numbers, implicitly 0 beyond the two lists. State 0
means halted.
Lean code for Definition2.3.1●1 definition
Associated Lean declarations
-
BiTM.Config[complete]
-
BiTM.Config[complete]
-
structuredefined in BiTM/Basic.leancomplete
structure BiTM.Config : Type
structure BiTM.Config : Type
Configuration of a bi-infinite tape TM. ``` left: cells to the left of head (closest first), implicitly 0 beyond head: current cell symbol right: cells to the right of head (closest first), implicitly 0 beyond ``` State 0 = halted.
Fields
state : ℕ
left : List ℕ
head : ℕ
right : List ℕ
Reads a list of cells: its first cell and the rest, or 0 and the empty list beyond its end.
Lean code for Definition2.3.2●1 definition
Associated Lean declarations
-
BiTM.readHead[complete]
-
BiTM.readHead[complete]
-
defdefined in BiTM/Basic.leancomplete
def BiTM.readHead (l : List ℕ) : ℕ × List ℕ
def BiTM.readHead (l : List ℕ) : ℕ × List ℕ
Read from a list, returning 0 (blank) if beyond bounds
One step of a machine (Definition 2.2.3) on a configuration
(Definition 2.3.1): none in state 0, and otherwise the rule
(Definition 2.2.2) for the state and the head cell is applied. Moving left
(Definition 2.2.1) pops left into the head by Definition 2.3.2 and
pushes the written symbol onto right; moving right symmetrically pops right
into the head and pushes the written symbol onto left.
Lean code for Definition2.3.3●1 definition
Associated Lean declarations
-
BiTM.step[complete]
-
BiTM.step[complete]
-
defdefined in BiTM/Basic.leancomplete
def BiTM.step (tm : TM.Machine) (cfg : BiTM.Config) : Option BiTM.Config
def BiTM.step (tm : TM.Machine) (cfg : BiTM.Config) : Option BiTM.Config
Single step of a bi-infinite tape TM. Returns none if already halted.
n iterations of Definition 2.3.3, none as soon as a step is stuck.
Lean code for Definition2.3.4●1 definition
Associated Lean declarations
-
BiTM.nSteps[complete]
-
BiTM.nSteps[complete]
-
defdefined in BiTM/Basic.leancomplete
def BiTM.nSteps (tm : TM.Machine) (cfg : BiTM.Config) : ℕ → Option BiTM.Config
def BiTM.nSteps (tm : TM.Machine) (cfg : BiTM.Config) : ℕ → Option BiTM.Config
Run for exactly n steps without checking halting. Returns none if the machine halts before n steps.
The number of explicit cells of a configuration (Definition 2.3.1),
left.length + 1 + right.length. Defined in Smith/Wolfram23Bridge.lean.
Lean code for Definition2.3.5●1 definition
Associated Lean declarations
-
Smith.biSize[complete]
-
Smith.biSize[complete]
-
defdefined in Smith/Wolfram23Bridge.leancomplete
def Smith.biSize (cfg : BiTM.Config) : ℕ
def Smith.biSize (cfg : BiTM.Config) : ℕ
The number of explicit cells of a `BiTM.Config`.
A step of any machine (Definition 2.3.3) never decreases
Definition 2.3.5: if BiTM.step tm cfg = some cfg' then
biSize cfg <= biSize cfg'.
Lean code for Lemma2.3.6●1 theorem
Associated Lean declarations
-
Smith.biSize_step[complete]
-
Smith.biSize_step[complete]
-
theoremdefined in Smith/Wolfram23Bridge.leancomplete
theorem Smith.biSize_step (tm : TM.Machine) (cfg cfg' : BiTM.Config) (h : BiTM.step tm cfg = some cfg') : Smith.biSize cfg ≤ Smith.biSize cfg'
theorem Smith.biSize_step (tm : TM.Machine) (cfg cfg' : BiTM.Config) (h : BiTM.step tm cfg = some cfg') : Smith.biSize cfg ≤ Smith.biSize cfg'
Every step of a `BiTM` machine keeps or grows the explicit tape.
Case on the direction of the rule. A move pops one cell from one side of the zipper and pushes one cell onto the other side, so the count is unchanged when the popped side is nonempty; when it is empty, Definition 2.3.2 returns the implicit blank 0 and nothing is popped, so the count grows by one.
So a step never decreases biSize, and a step onto an implicit blank increases
it by one. This is how "the head stays on the initial tape" is formalized in
the chapter on Conjecture 0 and
the chapter on the composition: biSize constant.
2.4. Wolfram's machine
Wolfram's machine as a Definition 2.2.3: numStates := 3 (0 is halt, 1 is
A, 2 is B), numSymbols := 3 (the symbols 0, 1, 2), and the six rules
(Definition 2.2.2) A,0 -> 1,R,B, A,1 -> 2,L,A, A,2 -> 1,L,A,
B,0 -> 2,L,A, B,1 -> 2,R,B, B,2 -> 0,R,A, each read as the state and the
symbol before, then the written symbol, the move and the new state. Every other
(state, symbol) pair goes to state 0, writes 0 and moves right; that row is
unused.
Lean code for Definition2.4.1●1 definition
Associated Lean declarations
-
BiTM.wolfram23[complete]
-
BiTM.wolfram23[complete]
-
defdefined in BiTM/Basic.leancomplete
def BiTM.wolfram23 : TM.Machine
def BiTM.wolfram23 : TM.Machine
Wolfram's 2-state 3-symbol Turing machine (machine 596440). Proven universal by Alex Smith (2007). ``` States: 1 = A, 2 = B (0 = halt, never reached by this machine) Symbols: 0, 1, 2 ``` Transition table: ``` +--------+---------+---------+---------+ | | sym 0 | sym 1 | sym 2 | +--------+---------+---------+---------+ | A (1) | 1,R,B | 2,L,A | 1,L,A | | B (2) | 2,L,A | 2,R,B | 0,R,A | +--------+---------+---------+---------+ ```
Wolfram's table, in the form of his own presentation: each entry is the symbol written, the move and the new state.
state | symbol 0 | symbol 1 | symbol 2 |
|---|---|---|---|
A (1) |
|
|
|
B (2) |
|
|
|
Entry by entry this is Wolfram's rule 596440 as published (A0 -> 1RB,
A1 -> 2LA, A2 -> 1LA, B0 -> 2LA, B1 -> 2RB, B2 -> 0RA) and Smith's
System 0 table on p. 3, whose four rows read: before (symbol, state), after
(symbol, new active position and state); all six entries agree with both
sources and with the p. 47 trace. State 0 is
never entered from states 1 and 2, so the halt row is dead.
A configuration (Definition 2.3.1) is valid for wolfram23 when its state
is 1 or 2, its head cell is below 3, and every cell of left and of right is
below 3.
Lean code for Definition2.4.2●1 definition
Associated Lean declarations
-
BiTM.IsValidWolfram23Cfg[complete]
-
BiTM.IsValidWolfram23Cfg[complete]
-
defdefined in BiTM/Wolfram23Valid.leancomplete
def BiTM.IsValidWolfram23Cfg (cfg : BiTM.Config) : Prop
def BiTM.IsValidWolfram23Cfg (cfg : BiTM.Config) : Prop
A valid wolfram23 config: active state, in-range head, and all tape values `< 3` on both sides.
From a valid configuration (Definition 2.4.2) the step
(Definition 2.3.3) of Definition 2.4.1 is some cfg' with cfg'
valid: the machine does not halt and does not leave the alphabet.
Lean code for Lemma2.4.3●1 theorem
Associated Lean declarations
-
BiTM.step_wolfram23_preserves_valid[complete]
-
BiTM.step_wolfram23_preserves_valid[complete]
-
theoremdefined in BiTM/Wolfram23Valid.leancomplete
theorem BiTM.step_wolfram23_preserves_valid (cfg : BiTM.Config) (h : BiTM.IsValidWolfram23Cfg cfg) : ∃ cfg', BiTM.step BiTM.wolfram23 cfg = some cfg' ∧ BiTM.IsValidWolfram23Cfg cfg'
theorem BiTM.step_wolfram23_preserves_valid (cfg : BiTM.Config) (h : BiTM.IsValidWolfram23Cfg cfg) : ∃ cfg', BiTM.step BiTM.wolfram23 cfg = some cfg' ∧ BiTM.IsValidWolfram23Cfg cfg'
Wolfram23's step preserves `IsValidWolfram23Cfg`.
The state is nonzero, so the step is some. For a state 1 or 2 and a head cell
below 3 the six rules give a next state 1 or 2 and a written symbol below 3
(BiTM.wolfram23_nextState_in_range, BiTM.wolfram23_write_in_range, by
decide on the six cases). In either direction the cell that
Definition 2.3.2 pops into the head is a cell of the old tape or the
blank 0, and the cell pushed onto the other side is the written symbol, so the
head and both lists stay below 3.
From a valid configuration (Definition 2.4.2) every run of
n steps (Definition 2.3.4) of Definition 2.4.1 is some cfg'
with cfg' valid: the machine never halts and never leaves the alphabet.
Lean code for Lemma2.4.4●1 theorem
Associated Lean declarations
-
BiTM.nSteps_wolfram23_preserves_valid[complete]
-
BiTM.nSteps_wolfram23_preserves_valid[complete]
-
theoremdefined in BiTM/Wolfram23Valid.leancomplete
theorem BiTM.nSteps_wolfram23_preserves_valid (cfg : BiTM.Config) (h : BiTM.IsValidWolfram23Cfg cfg) (n : ℕ) : ∃ cfg', BiTM.nSteps BiTM.wolfram23 cfg n = some cfg' ∧ BiTM.IsValidWolfram23Cfg cfg'
theorem BiTM.nSteps_wolfram23_preserves_valid (cfg : BiTM.Config) (h : BiTM.IsValidWolfram23Cfg cfg) (n : ℕ) : ∃ cfg', BiTM.nSteps BiTM.wolfram23 cfg n = some cfg' ∧ BiTM.IsValidWolfram23Cfg cfg'
Wolfram23 nSteps preserves `IsValidWolfram23Cfg` for any `n`.
Induction on n, with Lemma 2.4.3 for each
step.
2.5. The lookahead machine type
The states A, B, C of Systems 0 to 3.
Lean code for Definition2.5.1●1 definition
Associated Lean declarations
-
Smith.LState[complete]
-
Smith.LState[complete]
-
inductivedefined in Smith/Lookahead.leancomplete
inductive Smith.LState : Type
inductive Smith.LState : Type
The states A, B, C of Systems 0 to 3.
Constructors
Smith.LState.A : Smith.LState
Smith.LState.B : Smith.LState
Smith.LState.C : Smith.LState
A rule: one st a d rewrites the active cell to a, and two st a b d
rewrites the active cell to a and its right neighbour to b; in both shapes
the state becomes st (Definition 2.5.1) and the head moves by one in
the direction d (Definition 2.2.1). Symbols are Fin 3.
Lean code for Definition2.5.2●1 definition
Associated Lean declarations
-
Smith.LRule[complete]
-
Smith.LRule[complete]
-
inductivedefined in Smith/Lookahead.leancomplete
inductive Smith.LRule : Type
inductive Smith.LRule : Type
A rule: rewrite the active cell (`one`) or the active cell and its right neighbour (`two`), change state, move by one.
Constructors
Smith.LRule.one (st : Smith.LState) (a : Fin 3) (d : TM.Dir) : Smith.LRule
Smith.LRule.two (st : Smith.LState) (a b : Fin 3) (d : TM.Dir) : Smith.LRule
A lookahead machine: a function trans from the state (Definition 2.5.1),
the active cell and its right neighbour (0 when there is none) to a rule
(Definition 2.5.2), a one-cell rule (rewrite the active cell) or a
two-cell rule (rewrite both), with a move. These are the two rule shapes of
Smith's sys0-3.pl (p. 45).
Lean code for Definition2.5.3●1 definition
Associated Lean declarations
-
Smith.LMachine[complete]
-
Smith.LMachine[complete]
-
structuredefined in Smith/Lookahead.leancomplete
structure Smith.LMachine : Type
structure Smith.LMachine : Type
A lookahead machine: the rule for a state, the active symbol and the right neighbour (`0` when there is none).
Fields
trans : Smith.LState → Fin 3 → Fin 3 → Smith.LRule
A configuration, the zipper (left, head, right, state) with left nearest
first and a state in Definition 2.5.1, like BiTM.Config
(Definition 2.3.1) but over Fin 3. LConfig.toList is the tape read
left to right and LConfig.pos the index of the head on it.
Lean code for Definition2.5.4●1 definition
Associated Lean declarations
-
Smith.LConfig[complete]
-
Smith.LConfig[complete]
-
structuredefined in Smith/Lookahead.leancomplete
structure Smith.LConfig : Type
structure Smith.LConfig : Type
A configuration: cells left of the head nearest first, the head cell, cells right of the head nearest first, and the state.
Fields
left : List (Fin 3)
head : Fin 3
right : List (Fin 3)
state : Smith.LState
One step of a machine (Definition 2.5.3) on a configuration
(Definition 2.5.4): the rule (Definition 2.5.2) for the state, the
head cell and the right neighbour (0 when right is empty) is applied,
rewriting the cell or cells it read and moving the head. The tape is finite and
never extended: the result is none when the move would leave either end of
the tape, and none for a two-cell rule with no right neighbour.
Lean code for Definition2.5.5●1 definition
Associated Lean declarations
-
Smith.lstep[complete]
-
Smith.lstep[complete]
-
defdefined in Smith/Lookahead.leancomplete
def Smith.lstep (M : Smith.LMachine) (c : Smith.LConfig) : Option Smith.LConfig
def Smith.lstep (M : Smith.LMachine) (c : Smith.LConfig) : Option Smith.LConfig
One step.
n iterations of Definition 2.5.5, none as soon as a step is none.
It is the nSteps of the step system Smith.lsys M whose step is lstep M
(Definition 4.2.2).
Lean code for Definition2.5.6●1 definition
Associated Lean declarations
-
Smith.lnSteps[complete]
-
Smith.lnSteps[complete]
-
defdefined in Smith/Lookahead.leancomplete
def Smith.lnSteps (M : Smith.LMachine) (c : Smith.LConfig) (n : ℕ) : Option Smith.LConfig
def Smith.lnSteps (M : Smith.LMachine) (c : Smith.LConfig) (n : ℕ) : Option Smith.LConfig
`n` steps.
Runs concatenate: lnSteps M c (n + m) (Definition 2.5.6) is the run of
m steps from the result of the run of n steps, and none when either is
none.
Lean code for Lemma2.5.7●1 theorem
Associated Lean declarations
-
Smith.lnSteps_add[complete]
-
Smith.lnSteps_add[complete]
-
theoremdefined in Smith/Lookahead.leancomplete
theorem Smith.lnSteps_add (M : Smith.LMachine) (c : Smith.LConfig) (n m : ℕ) : Smith.lnSteps M c (n + m) = (Smith.lnSteps M c n).bind fun c' => Smith.lnSteps M c' m
theorem Smith.lnSteps_add (M : Smith.LMachine) (c : Smith.LConfig) (n m : ℕ) : Smith.lnSteps M c (n + m) = (Smith.lnSteps M c n).bind fun c' => Smith.lnSteps M c' m
This is StepSys.nSteps_add of Smith/Simulation.lean for the step system
lsys M.
The exit to the right of a configuration (Definition 2.5.4) under a
machine (Definition 2.5.3): when a one-cell rule at the last cell
moves right, the state it enters and the tape after its write; none
otherwise. It records one-cell exits only and is used only by the p. 47 check.
Lean code for Definition2.5.8●1 definition
Associated Lean declarations
-
Smith.exitRight[complete]
-
Smith.exitRight[complete]
-
defdefined in Smith/Lookahead.leancomplete
def Smith.exitRight (M : Smith.LMachine) (c : Smith.LConfig) : Option (Smith.LState × List (Fin 3))
def Smith.exitRight (M : Smith.LMachine) (c : Smith.LConfig) : Option (Smith.LState × List (Fin 3))
The exit to the right: from `c`, a one-cell rule moving right at the last cell leaves the tape in state `st'` after writing `a'`; the result is that state and the final tape. `none` when `c` does not exit.
The four tables are transcribed from p. 45 (the chapter on Systems 3 to 0 for the relabelings between them).
System 0, Wolfram's table as a lookahead machine (Definition 2.5.3),
with one-cell rules only: A0 -> B1>, A1 -> A2<, A2 -> A1<, B0 -> A2<,
B1 -> B2>, B2 -> A0> (the new state, the written symbol, the move). The
rows for state C, never reached, are dead.
Lean code for Definition2.5.9●1 definition
Associated Lean declarations
-
Smith.sys0[complete]
-
Smith.sys0[complete]
-
defdefined in Smith/Lookahead.leancomplete
def Smith.sys0 : Smith.LMachine
def Smith.sys0 : Smith.LMachine
System 0, Wolfram's (2,3) machine: `A0 -> B1>, B0 -> A2<, A1 -> A2<, B1 -> B2>, A2 -> A1<, B2 -> A0>`.
System 1 (Definition 2.5.3): System 0 with B2 replaced by the three
two-cell rules B20 -> A00>, B21 -> B12>, B22 -> B11>.
Lean code for Definition2.5.10●1 definition
Associated Lean declarations
-
Smith.sys1[complete]
-
Smith.sys1[complete]
-
defdefined in Smith/Lookahead.leancomplete
def Smith.sys1 : Smith.LMachine
def Smith.sys1 : Smith.LMachine
System 1: System 0 with `B2` replaced by the lookahead rules `B20 -> A00>, B21 -> B12>, B22 -> B11>`.
System 2 (Definition 2.5.3): the table of p. 45 with the third state
C, entered by the two-cell rules on B21 and B22.
Lean code for Definition2.5.11●1 definition
Associated Lean declarations
-
Smith.sys2[complete]
-
Smith.sys2[complete]
-
defdefined in Smith/Lookahead.leancomplete
def Smith.sys2 : Smith.LMachine
def Smith.sys2 : Smith.LMachine
System 2.
System 3 (Definition 2.5.3): the table of p. 45, a relabeling of System 2 with state C.
Lean code for Definition2.5.12●1 definition
Associated Lean declarations
-
Smith.sys3[complete]
-
Smith.sys3[complete]
-
defdefined in Smith/Lookahead.leancomplete
def Smith.sys3 : Smith.LMachine
def Smith.sys3 : Smith.LMachine
System 3.
Its thirteen rows, the rule being the new state, the written symbols and the
move; a one-cell rule ignores the neighbour, written - below, and a two-cell
rule writes the head cell and the neighbour.
state | head | neighbour | rule |
|---|---|---|---|
A | 0 |
|
|
A | 1 |
|
|
A | 2 |
|
|
B | 0 |
|
|
B | 1 |
|
|
B | 2 | 0 |
|
B | 2 | 1 |
|
B | 2 | 2 |
|
C | 0 |
|
|
C | 1 | 0 |
|
C | 1 | 1 |
|
C | 1 | 2 |
|
C | 2 |
|
|
A machine (Definition 2.5.3) has this property when a one-cell rule
(Definition 2.5.2) does not depend on the neighbour: if trans st a b is
a one-cell rule then trans st a b' = trans st a b for every b'.
Lean code for Definition2.5.13●1 definition
Associated Lean declarations
-
Smith.LMachine.OneIgnoresNeighbour[complete]
-
Smith.LMachine.OneIgnoresNeighbour[complete]
-
defdefined in Smith/Lookahead.leancomplete
def Smith.LMachine.OneIgnoresNeighbour (M : Smith.LMachine) : Prop
def Smith.LMachine.OneIgnoresNeighbour (M : Smith.LMachine) : Prop
A `one` rule does not read the neighbour.
Every table satisfies OneIgnoresNeighbour, checked by decide
(Smith.sys0_one, Smith.sys1_one, Smith.sys2_one, Smith.sys3_one).
The 28 tapes of the sys0-3.pl 0 N 00A00000 trace of p. 47. The trace is
reproduced tape for tape by decide: from 00A00000 (Smith.cfgP47, the head
on the third of seven cells in state A) the run of Definition 2.5.9 gives
the 27 tapes with the head on the tape (Smith.tapes); after 26 steps the head
is on the last cell in state B; the 27th step leaves the tape
(Definition 2.5.6 is none); and Definition 2.5.8 gives
state B and the 28th line, the tape after the last write. The leftmost visit of
the run, cell 0 in state A after 12 steps, is checked as well.
Lean code for Definition2.5.14●1 definition
Associated Lean declarations
-
Smith.traceP47[complete]
-
Smith.traceP47[complete]
-
defdefined in Smith/Lookahead.leancomplete
def Smith.traceP47 : List (List (Fin 3))
def Smith.traceP47 : List (List (Fin 3))
The tapes of the `sys0-3.pl 0 N 00A00000` trace, p. 47.
2.6. The bridge to wolfram23
Reads a System 0 configuration (Definition 2.5.4) as a BiTM.Config
(Definition 2.3.1): A is state 1, B is state 2, C is state 3 (never
reached from A or B; Smith.stateNat), the symbols by Fin.val, and the
zipper is the same zipper.
Lean code for Definition2.6.1●1 definition
Associated Lean declarations
-
Smith.toBi[complete]
-
Smith.toBi[complete]
-
defdefined in Smith/Wolfram23Bridge.leancomplete
def Smith.toBi (c : Smith.LConfig) : BiTM.Config
def Smith.toBi (c : Smith.LConfig) : BiTM.Config
A System 0 configuration as a `wolfram23` configuration.
Reads a BiTM.Config (Definition 2.3.1) as a System 0 configuration
(Definition 2.5.4): the cells by Smith.toFin (reduction modulo 3),
the state A when the state is 1 and B otherwise.
Lean code for Definition2.6.2●1 definition
Associated Lean declarations
-
Smith.ofBi[complete]
-
Smith.ofBi[complete]
-
defdefined in Smith/Wolfram23Bridge.leancomplete
def Smith.ofBi (cfg : BiTM.Config) : Smith.LConfig
def Smith.ofBi (cfg : BiTM.Config) : Smith.LConfig
The inverse of `toBi` on valid configurations.
On valid configurations (Definition 2.4.2)
Definition 2.6.2 is the inverse of Definition 2.6.1:
toBi (ofBi cfg) = cfg.
Lean code for Lemma2.6.3●1 theorem
Associated Lean declarations
-
Smith.toBi_ofBi[complete]
-
Smith.toBi_ofBi[complete]
-
theoremdefined in Smith/Wolfram23Bridge.leancomplete
theorem Smith.toBi_ofBi (cfg : BiTM.Config) (hv : BiTM.IsValidWolfram23Cfg cfg) : Smith.toBi (Smith.ofBi cfg) = cfg
theorem Smith.toBi_ofBi (cfg : BiTM.Config) (hv : BiTM.IsValidWolfram23Cfg cfg) : Smith.toBi (Smith.ofBi cfg) = cfg
A cell below 3 is unchanged by reduction modulo 3 followed by Fin.val
(Smith.map_val_toFin for the two lists), and a state 1 or 2 goes to A or B
and back to 1 or 2.
For a System 0 configuration c not in state C, if lstep sys0 c = some c'
(Definition 2.5.5, Definition 2.5.9) then
BiTM.step wolfram23 (toBi c) = some (toBi c') (Definition 2.3.3,
Definition 2.4.1, Definition 2.6.1): a System 0 step is a
wolfram23 step.
Lean code for Theorem2.6.4●1 theorem
Associated Lean declarations
-
Smith.toBi_step[complete]
-
Smith.toBi_step[complete]
-
theoremdefined in Smith/Wolfram23Bridge.leancomplete
theorem Smith.toBi_step (c c' : Smith.LConfig) (hst : c.state ≠ Smith.LState.C) (h : Smith.lstep Smith.sys0 c = some c') : BiTM.step BiTM.wolfram23 (Smith.toBi c) = some (Smith.toBi c')
theorem Smith.toBi_step (c c' : Smith.LConfig) (hst : c.state ≠ Smith.LState.C) (h : Smith.lstep Smith.sys0 c = some c') : BiTM.step BiTM.wolfram23 (Smith.toBi c) = some (Smith.toBi c')
A System 0 step is a `wolfram23` step.
Case analysis on the state, the head symbol and whether each side of the zipper
is empty. In every case the rule of sys0 is the matching entry of wolfram23
and the zipper moves the same way on both sides; simp with the definitions
unfolded closes each case.
For a System 0 configuration c not in state C, if lstep sys0 c = none
(Definition 2.5.5, Definition 2.5.9) then
BiTM.step wolfram23 (toBi c) (Definition 2.3.3, Definition 2.4.1,
Definition 2.6.1) is some cfg' with
biSize cfg' = biSize (toBi c) + 1 (Definition 2.3.5): where System 0
is stuck, wolfram23 steps onto an implicit blank and the explicit tape grows by
one cell.
Lean code for Theorem2.6.5●1 theorem
Associated Lean declarations
-
Smith.toBi_exit[complete]
-
Smith.toBi_exit[complete]
-
theoremdefined in Smith/Wolfram23Bridge.leancomplete
theorem Smith.toBi_exit (c : Smith.LConfig) (hst : c.state ≠ Smith.LState.C) (h : Smith.lstep Smith.sys0 c = none) : ∃ cfg', BiTM.step BiTM.wolfram23 (Smith.toBi c) = some cfg' ∧ Smith.biSize cfg' = Smith.biSize (Smith.toBi c) + 1
theorem Smith.toBi_exit (c : Smith.LConfig) (hst : c.state ≠ Smith.LState.C) (h : Smith.lstep Smith.sys0 c = none) : ∃ cfg', BiTM.step BiTM.wolfram23 (Smith.toBi c) = some cfg' ∧ Smith.biSize cfg' = Smith.biSize (Smith.toBi c) + 1
Where System 0 leaves its tape, `wolfram23` steps onto a blank and its explicit tape grows by one cell.
The same case analysis. sys0 has one-cell rules only, so lstep is none
exactly when the move leaves the finite tape; on that side toBi c has the
empty list, so BiTM.step reads the implicit blank 0 by BiTM.readHead and
pushes the written symbol onto the other side, one explicit cell more.
For a System 0 configuration c not in state C, if lnSteps sys0 c n = some c'
(Definition 2.5.6, Definition 2.5.9) then
BiTM.nSteps wolfram23 (toBi c) n = some (toBi c') (Definition 2.3.4,
Definition 2.4.1, Definition 2.6.1) and c' is not in state C:
a System 0 run is a wolfram23 run.
Lean code for Theorem2.6.6●1 theorem
Associated Lean declarations
-
Smith.toBi_run[complete]
-
Smith.toBi_run[complete]
-
theoremdefined in Smith/Wolfram23Bridge.leancomplete
theorem Smith.toBi_run (c : Smith.LConfig) (hst : c.state ≠ Smith.LState.C) (n : ℕ) (c' : Smith.LConfig) (h : Smith.lnSteps Smith.sys0 c n = some c') : BiTM.nSteps BiTM.wolfram23 (Smith.toBi c) n = some (Smith.toBi c') ∧ c'.state ≠ Smith.LState.C
theorem Smith.toBi_run (c : Smith.LConfig) (hst : c.state ≠ Smith.LState.C) (n : ℕ) (c' : Smith.LConfig) (h : Smith.lnSteps Smith.sys0 c n = some c') : BiTM.nSteps BiTM.wolfram23 (Smith.toBi c) n = some (Smith.toBi c') ∧ c'.state ≠ Smith.LState.C
A System 0 run is a `wolfram23` run.
Induction on n. System 0 never enters state C from A or B
(Smith.sys0_state), so Theorem 2.6.4 applies at every step.
A System 0 step is a wolfram23 step; where System 0 is stuck (the head would
leave the finite tape) wolfram23 steps onto an implicit blank and the explicit
tape grows by one. This is the only place the finite zipper meets the implicit
blanks, and it is where the exit condition of
the chapter on Conjecture 0 and
the chapter on the composition comes from. The exit step
itself, as a BiTM step, is the following computation; it lives in
Smith/Conjecture0.lean.
The exit step of Definition 2.4.1 (Definition 2.3.3): from state 2
(B) on a 2 with nothing explicit to the right, the step writes 0, moves right
onto the implicit blank and enters state 1 (A):
BiTM.step wolfram23 ⟨2, L, 2, []⟩ = some ⟨1, 0 :: L, 0, []⟩.
Lean code for Lemma2.6.7●1 theorem
Associated Lean declarations
-
Smith.wolfram23_exit_step[complete]
-
Smith.wolfram23_exit_step[complete]
-
theoremdefined in Smith/Conjecture0.leancomplete
theorem Smith.wolfram23_exit_step (L : List ℕ) : BiTM.step BiTM.wolfram23 { state := 2, left := L, head := 2, right := [] } = some { state := 1, left := 0 :: L, head := 0, right := [] }
theorem Smith.wolfram23_exit_step (L : List ℕ) : BiTM.step BiTM.wolfram23 { state := 2, left := L, head := 2, right := [] } = some { state := 1, left := 0 :: L, head := 0, right := [] }
The exit step of wolfram23: `B2 -> 0, R, A` onto the implicit blank right of the tape (TM23Proof.pdf p. 4: "if that cell is a 0 it becomes active in state A").
By computation (rfl): the rule B2 -> 0RA and BiTM.readHead [].
2.7. Notes and caveats
-
Direction conventions are consistent across
TM.Dir,BiTM.stepandlstep:Lpops fromleft,Rpops fromright. The review checked this. -
LMachinepasses0as the neighbour at the right end butlstepdiscards any two-cell result there. So at the end of the System 4 emulation (System 3 head on the closing 1 in state C, the chapter on Conjecture 0)lstep sys3andexitRight sys3are bothnone; the exit that the theorems report is realized after relabeling, by theBiTMstepSmith.wolfram23_exit_step(B2 -> 0RAonto the implicit blank). The Lookahead header says so;exitRightrecords one-cell exits only and is used only by the p. 47 check. -
Two branches of
BiTM.System4.step(the chapter on System 5 to System 4) and none of the machine model here deviate from Smith's Perl programs; the machine model is faithful.
2.8. Depends on
The modules of this chapter are TM.Defs, BiTM.Basic, BiTM.Wolfram23Valid,
Smith.Lookahead and Smith.Wolfram23Bridge; Smith.wolfram23_exit_step is
in Smith.Conjecture0. Smith.lnSteps is built on the step-system calculus of
Smith/Simulation.lean
(the chapter on cyclic tag to System 5). The results
at the end of Smith/Wolfram23Bridge.lean on the head
leaving every finite tape (Smith.wolfram23_leaves,
Smith.wolfram23_not_periodic) and the length bookkeeping Smith.lnSteps_length
are described in the chapter on Systems 3 to 0 and
the chapter on Conjecture 0.