5. T2: from System 5 to System 4
5.1. Orientation
System 4 (TM23Proof.pdf p. 16-18, system4.pl p. 33-35) is a tape of elements, each a
finite set of integers or a star, with a head and three states A, B and C. Five rules
(BiTM.System4.step): in state A on a set the head moves left, turning round into
state B at the left end (rule 1); in state A on a star the star is deleted and the
state becomes B (rule 2); in state B or C on a set the set is decremented, the 0
removed and the state toggled if it was there, and the head moves right (rule 3); in
state B on a star the star is deleted and the head moves left into state A (rule 4);
in state C on a star the head moves onto the set to its right and toggles 1 in it
(rule 5). Smith's Conjecture 4 says a System 4 tape emulates a System 5 program. The
formal T2 is Smith.conjecture4_finite in Smith/Conjecture4.lean, on top of the run
lemmas of Smith/System4Runs.lean.
One step of System 4 on a configuration, which is a list of elements (each a star or
a set of integers, held as a List Int read modulo 2 as in System 5), the index of
the active element and a state A, B or C: the five rules above, dispatched on the
state and on the kind of the active element. The result is none when the active
index is past the end of the tape (the halt) and in two branches that an encoder tape
never reaches (the notes below). BiTM.System4.nSteps iterates it.
Lean code for Definition5.1.1●1 definition
Associated Lean declarations
-
BiTM.System4.step[complete]
-
BiTM.System4.step[complete]
-
defdefined in BiTM/System4.leancomplete
def BiTM.System4.step (cfg : BiTM.System4Config) : Option BiTM.System4Config
def BiTM.System4.step (cfg : BiTM.System4Config) : Option BiTM.System4Config
One step of System 4 per `TM23Proof.pdf` p. 34, `system4.pl`. Five rules dispatched on (state, kind of elems[active]). Returns `none` if `active >= elems.length` (halt).
5.2. The encoder and the relation
BiTM.system5ToSystem4 s f is s52s4.pl: the bag as one set of the even integers
2e - 2 (BiTM.encodeBag), then f pairs (star, empty set), then one block per
rule: star, the rule set 0..3f toggled at 2k + f + 3 for each entry k, 2f
pairs, star, the all-integers set 0..3f, 2f - 2 pairs (Smith.encBlock,
Smith.encRuleSet, Smith.rulePos). docs/REVIEW.md section 4.3 records two stars
the old transcription had dropped; Smith.system5ToSystem4_eq is the encoder as the
case t = 0 of the parametrized blocks.
The bag of a System 5 configuration as one System 4 set: each entry e is sent to
2e - 2 and folded in with BiTM.xorInsert, so that an entry contributed twice
cancels, as the hash of s52s4.pl does. It is the Definition 4.4.7 of the
mapped bag into the empty set (BiTM.encodeBag_eq_xorMerge) and is Nodup
(BiTM.encodeBag_nodup).
Lean code for Definition5.2.1●1 definition
Associated Lean declarations
-
BiTM.encodeBag[complete]
-
BiTM.encodeBag[complete]
-
defdefined in BiTM/System5ToSystem4.leancomplete
def BiTM.encodeBag (bag : List ℤ) : List ℤ
def BiTM.encodeBag (bag : List ℤ) : List ℤ
Encode the bag as a System 4 set. `s52s4.pl` builds a hash and deletes a key whose count reaches 2, so an entry contributed twice cancels; the fold with `xorInsert` reproduces that parity semantics.
rulePos f t k = 2k + f + 3 - t: the System 4 integer that stands for the System 5
rule entry k after t units of the running parameter of p. 17. A System 5 step
increases k by 1 while the tape integer is fixed, so t grows by 2 per step
(Smith.rulePos_shift).
Lean code for Definition5.2.2●1 definition
Associated Lean declarations
-
Smith.rulePos[complete]
-
Smith.rulePos[complete]
-
defdefined in Smith/Conjecture4.leancomplete
def Smith.rulePos (f t : ℕ) (k : ℤ) : ℤ
def Smith.rulePos (f t : ℕ) (k : ℤ) : ℤ
The System 4 integer that stands for the System 5 rule entry `k` after `t` units of the running parameter of p. 17: `k` is increased by 1 per System 5 step while the tape integer is fixed, and `t` grows by 2.
The rule set of a rule block at parameter t: all of 0..3f (BiTM.allInts (3f + 1))
toggled, by Definition 4.4.7, at Definition 5.2.2 f t k for every
entry k of the rule.
Lean code for Definition5.2.3●1 definition
Associated Lean declarations
-
Smith.encRuleSet[complete]
-
Smith.encRuleSet[complete]
-
defdefined in Smith/Conjecture4.leancomplete
def Smith.encRuleSet (r : List ℤ) (f t : ℕ) : List ℤ
def Smith.encRuleSet (r : List ℤ) (f t : ℕ) : List ℤ
The rule set of a rule block: `0..3f` toggled at the positions of the rule entries.
One rule block at parameter t: a star, the set Definition 5.2.3 r f t,
2f star/empty pairs (BiTM.starredEmptyPairs), a star, the all-integers set
0..3f, and 2f - 2 star/empty pairs; 8f elements for f >= 1. Smith.encBlocks
is the concatenation of the blocks of a rule list. One System 5 step adds 1 to every
rule entry and 2 to t and leaves the blocks unchanged (Smith.encBlocks_shift).
Lean code for Definition5.2.4●2 definitions
Associated Lean declarations
-
Smith.encBlock[complete]
-
Smith.encBlocks[complete]
-
Smith.encBlock[complete] -
Smith.encBlocks[complete]
-
defdefined in Smith/Conjecture4.leancomplete
def Smith.encBlock (r : List ℤ) (f t : ℕ) : List BiTM.System4Elem
def Smith.encBlock (r : List ℤ) (f t : ℕ) : List BiTM.System4Elem
One rule block: star, rule set, `2f` pairs, star, all integers, `2f - 2` pairs.
-
defdefined in Smith/Conjecture4.leancomplete
def Smith.encBlocks (rules : List (List ℤ)) (f t : ℕ) : List BiTM.System4Elem
def Smith.encBlocks (rules : List (List ℤ)) (f t : ℕ) : List BiTM.System4Elem
The rule blocks of a rule list.
The encoder s52s4.pl, token for token with the Perl: state A, active index 0, and
the tape Definition 5.2.1 of the bag as one set, then f star/empty pairs,
then one block per rule (star, the rule set 0..3f toggled at 2k + f + 3 for each
entry k, 2f pairs, star, the all-integers set 0..3f, 2f - 2 pairs). The two
stars that open the rule set and the all-integers set are the ones docs/REVIEW.md
section 4.3 found missing from the old transcription; without them the System 4 run
is observably different (the module header of BiTM/System5ToSystem4.lean).
Lean code for Definition5.2.5●1 definition
Associated Lean declarations
-
BiTM.system5ToSystem4[complete]
-
BiTM.system5ToSystem4[complete]
-
defdefined in BiTM/System5ToSystem4.leancomplete
def BiTM.system5ToSystem4 (cfg : BiTM.System5Config) (f : ℕ) : BiTM.System4Config
def BiTM.system5ToSystem4 (cfg : BiTM.System5Config) (f : ℕ) : BiTM.System4Config
Full System 5 -> System 4 encoder per `s52s4.pl`.
Definition 5.2.5 s f is the tape of the one-set block
[encodeBag s.bag], then f star/empty pairs, then Definition 5.2.4 blocks
of s.rules at t = 0, with the head at 0 in state A: the encoder is the case t = 0
of the parametrized blocks.
Lean code for Lemma5.2.6●1 theorem
Associated Lean declarations
-
Smith.system5ToSystem4_eq[complete]
-
Smith.system5ToSystem4_eq[complete]
-
theoremdefined in Smith/Conjecture4.leancomplete
theorem Smith.system5ToSystem4_eq (s : BiTM.System5Config) (f : ℕ) : BiTM.system5ToSystem4 s f = { elems := Smith.sets [BiTM.encodeBag s.bag] ++ BiTM.starredEmptyPairs f ++ Smith.encBlocks s.rules f 0, active := 0, state := BiTM.System4State.A }
theorem Smith.system5ToSystem4_eq (s : BiTM.System5Config) (f : ℕ) : BiTM.system5ToSystem4 s f = { elems := Smith.sets [BiTM.encodeBag s.bag] ++ BiTM.starredEmptyPairs f ++ Smith.encBlocks s.rules f 0, active := 0, state := BiTM.System4State.A }
The encoder output is the case `t = 0`, with the bag as a one-set block.
By unfolding. The per-rule encoder BiTM.encodeS5RuleToS4Elems r f is encBlock r f 0
because 2k + f + 3 is Definition 5.2.2 f 0 k (Smith.encodeS5RuleToS4Elems_eq).
Parity membership: parMem x K is true when x lies in an odd number of the sets of
the block K. This is membership in the symmetric difference of the block, Smith's
"one big merged set" of p. 16: in the conglomerate the parity counts, not the
individual sets. Decrementing every set of K (Smith.decr) shifts the parity set by
one (Smith.parMem_map_decr).
Lean code for Definition5.2.7●1 definition
Associated Lean declarations
-
Smith.parMem[complete]
-
Smith.parMem[complete]
-
defdefined in Smith/System4Runs.leancomplete
def Smith.parMem (x : ℤ) : List (List ℤ) → Bool
def Smith.parMem (x : ℤ) : List (List ℤ) → Bool
Parity membership: `x` lies in an odd number of the sets of `K`. This is membership in the symmetric difference of the block, the "one big merged set" of TM23Proof.pdf p. 16.
RepS4 c s f j h is Smith's "condition during execution" of p. 17 after j System 5
steps with h steps of budget left. There is a nonempty block K of sets, each
Nodup and made of nonnegative integers, such that:
-
cis the tapesets K, thenf - 2jstar/empty pairs, then the rule blocks Definition 5.2.4 ofs.rulesat running parametert = 2j, with the head at the left end in state A; -
2j + 2h < f; -
below the band: for every
x >= 0withx + 2j + 2 < 2f, Definition 5.2.7x Kagrees with "someein the bag hasx = 2e - 2"; -
the bag is
Nodupand every entryehas1 <= eande + j < f; -
every rule is
Nodupand every entrykhas0 <= kandk + j + 2h < f.
The block K is the bag "conglomerate", whose symmetric difference is what counts.
The parity set of K agrees with the encoded bag below the band 2f - 2j - 2; above
the band it is unconstrained, because the all-integers sets leave debris there that
never reaches the head within the budget. The budget bounds the rule entries so that
every integer popped into the bag stays under the band. The encoder tape
Definition 5.2.5 s f stands in the relation at j = 0 for every
budget h the bounds afford (Smith.system5ToSystem4_repS4).
Lean code for Definition5.2.8●1 definition
Associated Lean declarations
-
Smith.RepS4[complete]
-
Smith.RepS4[complete]
-
defdefined in Smith/Conjecture4.leancomplete
def Smith.RepS4 (c : BiTM.System4Config) (s : BiTM.System5Config) (f j h : ℕ) : Prop
def Smith.RepS4 (c : BiTM.System4Config) (s : BiTM.System5Config) (f j h : ℕ) : Prop
The condition during execution of TM23Proof.pdf p. 17, after `j` System 5 steps with `h` steps of budget left. See the module header.
5.3. The two step cases
Smith/System4Runs.lean proves the runs. The focus lemmas state each rule on a tape
L ++ e :: R with the head on e, at index L.length.
Rule 1 away from the left end: on L ++ set s :: R with L nonempty, in state A, the
head moves to L.length - 1 and stays in A (Definition 5.1.1). At the
left end the head turns round into state B (Smith.step_setA_zero).
Lean code for Lemma5.3.1●1 theorem
Associated Lean declarations
-
Smith.step_setA[complete]
-
Smith.step_setA[complete]
-
theoremdefined in Smith/System4Runs.leancomplete
theorem Smith.step_setA (L : List BiTM.System4Elem) (s : List ℤ) (R : List BiTM.System4Elem) (hL : L ≠ []) : BiTM.System4.step { elems := L ++ BiTM.System4Elem.set s :: R, active := L.length, state := BiTM.System4State.A } = some { elems := L ++ BiTM.System4Elem.set s :: R, active := L.length - 1, state := BiTM.System4State.A }
theorem Smith.step_setA (L : List BiTM.System4Elem) (s : List ℤ) (R : List BiTM.System4Elem) (hL : L ≠ []) : BiTM.System4.step { elems := L ++ BiTM.System4Elem.set s :: R, active := L.length, state := BiTM.System4State.A } = some { elems := L ++ BiTM.System4Elem.set s :: R, active := L.length - 1, state := BiTM.System4State.A }
Rule 1 away from the left end: a set in state A moves the head left.
Unfolding System4.step at index L.length of L ++ set s :: R: the rule for a set in state A moves left when the index is positive.
Rule 2: on L ++ star :: R in state A the star is deleted and the head stays at
L.length, now on what was to the right of the star, in state B
(Definition 5.1.1).
Lean code for Lemma5.3.2●1 theorem
Associated Lean declarations
-
Smith.step_starA[complete]
-
Smith.step_starA[complete]
-
theoremdefined in Smith/System4Runs.leancomplete
theorem Smith.step_starA (L R : List BiTM.System4Elem) : BiTM.System4.step { elems := L ++ BiTM.System4Elem.star :: R, active := L.length, state := BiTM.System4State.A } = some { elems := L ++ R, active := L.length, state := BiTM.System4State.B }
theorem Smith.step_starA (L R : List BiTM.System4Elem) : BiTM.System4.step { elems := L ++ BiTM.System4Elem.star :: R, active := L.length, state := BiTM.System4State.A } = some { elems := L ++ R, active := L.length, state := BiTM.System4State.B }
Rule 2: a star in state A is deleted, the head stays on what was to its right, state B.
Unfolding System4.step at index L.length of L ++ star :: R: the rule for a star in state A erases it and enters state B.
Rule 3 in state B: on L ++ set s :: R the set becomes decrementSet s (every
integer decremented, the 0 removed), the head moves to L.length + 1, and the state
is C if 0 was in s and B otherwise (Definition 5.1.1). Smith.step_setC
is the same in state C with B and C exchanged; Smith.step_setBC states both at once
with the flipped state.
Lean code for Lemma5.3.3●1 theorem
Associated Lean declarations
-
Smith.step_setB[complete]
-
Smith.step_setB[complete]
-
theoremdefined in Smith/System4Runs.leancomplete
theorem Smith.step_setB (L : List BiTM.System4Elem) (s : List ℤ) (R : List BiTM.System4Elem) : BiTM.System4.step { elems := L ++ BiTM.System4Elem.set s :: R, active := L.length, state := BiTM.System4State.B } = some { elems := L ++ BiTM.System4Elem.set (BiTM.decrementSet s).1 :: R, active := L.length + 1, state := if 0 ∈ s then BiTM.System4State.C else BiTM.System4State.B }
theorem Smith.step_setB (L : List BiTM.System4Elem) (s : List ℤ) (R : List BiTM.System4Elem) : BiTM.System4.step { elems := L ++ BiTM.System4Elem.set s :: R, active := L.length, state := BiTM.System4State.B } = some { elems := L ++ BiTM.System4Elem.set (BiTM.decrementSet s).1 :: R, active := L.length + 1, state := if 0 ∈ s then BiTM.System4State.C else BiTM.System4State.B }
Rule 3 in state B.
Unfolding System4.step at index L.length of L ++ set s :: R in state B: the rule for a set decrements it, moves right, and toggles the state exactly when 0 was present.
Rule 4: on L ++ star :: R with L nonempty, in state B, the star is deleted and the
head moves to L.length - 1 in state A (Definition 5.1.1).
Lean code for Lemma5.3.4●1 theorem
Associated Lean declarations
-
Smith.step_starB[complete]
-
Smith.step_starB[complete]
-
theoremdefined in Smith/System4Runs.leancomplete
theorem Smith.step_starB (L R : List BiTM.System4Elem) (hL : L ≠ []) : BiTM.System4.step { elems := L ++ BiTM.System4Elem.star :: R, active := L.length, state := BiTM.System4State.B } = some { elems := L ++ R, active := L.length - 1, state := BiTM.System4State.A }
theorem Smith.step_starB (L R : List BiTM.System4Elem) (hL : L ≠ []) : BiTM.System4.step { elems := L ++ BiTM.System4Elem.star :: R, active := L.length, state := BiTM.System4State.B } = some { elems := L ++ R, active := L.length - 1, state := BiTM.System4State.A }
Rule 4: a star in state B is deleted, the head moves left, state A.
Unfolding System4.step at index L.length of L ++ star :: R in state B with L nonempty: the rule for a star in state B erases it, moves left and enters state A.
Rule 5: on L ++ star :: set s :: R in state C the head moves to L.length + 1, onto
the set, which becomes xorInsert 1 s, and stays in C (Definition 5.1.1).
Lean code for Lemma5.3.5●1 theorem
Associated Lean declarations
-
Smith.step_starC[complete]
-
Smith.step_starC[complete]
-
theoremdefined in Smith/System4Runs.leancomplete
theorem Smith.step_starC (L : List BiTM.System4Elem) (s : List ℤ) (R : List BiTM.System4Elem) : BiTM.System4.step { elems := L ++ BiTM.System4Elem.star :: BiTM.System4Elem.set s :: R, active := L.length, state := BiTM.System4State.C } = some { elems := L ++ BiTM.System4Elem.star :: BiTM.System4Elem.set (BiTM.xorInsert 1 s) :: R, active := L.length + 1, state := BiTM.System4State.C }
theorem Smith.step_starC (L : List BiTM.System4Elem) (s : List ℤ) (R : List BiTM.System4Elem) : BiTM.System4.step { elems := L ++ BiTM.System4Elem.star :: BiTM.System4Elem.set s :: R, active := L.length, state := BiTM.System4State.C } = some { elems := L ++ BiTM.System4Elem.star :: BiTM.System4Elem.set (BiTM.xorInsert 1 s) :: R, active := L.length + 1, state := BiTM.System4State.C }
Rule 5: a star in state C moves the head onto the set to its right and toggles `1` there.
Unfolding System4.step at index L.length of L ++ star :: set s :: R in state C: the rule for a star in state C toggles 1 in the next set and moves onto it.
On top of them, with an arbitrary context on both sides:
A sweep: on L ++ sets K ++ R with the head on the first set of K, in state B or C,
K.length steps take the head to the element after the block, with every set of K
decremented (Smith.decr) and the state flipped once per set that contained a 0,
that is, flipped by Definition 5.2.7 0 K.
Lean code for Lemma5.3.6●1 theorem
Associated Lean declarations
-
Smith.sweep[complete]
-
Smith.sweep[complete]
-
theoremdefined in Smith/System4Runs.leancomplete
theorem Smith.sweep (L : List BiTM.System4Elem) (K : List (List ℤ)) (R : List BiTM.System4Elem) (st : BiTM.System4State) (hst : st ≠ BiTM.System4State.A) : BiTM.System4.nSteps { elems := L ++ Smith.sets K ++ R, active := L.length, state := st } K.length = some { elems := L ++ Smith.sets (List.map Smith.decr K) ++ R, active := L.length + K.length, state := Smith.flip (Smith.parMem 0 K) st }
theorem Smith.sweep (L : List BiTM.System4Elem) (K : List (List ℤ)) (R : List BiTM.System4Elem) (st : BiTM.System4State) (hst : st ≠ BiTM.System4State.A) : BiTM.System4.nSteps { elems := L ++ Smith.sets K ++ R, active := L.length, state := st } K.length = some { elems := L ++ Smith.sets (List.map Smith.decr K) ++ R, active := L.length + K.length, state := Smith.flip (Smith.parMem 0 K) st }
A sweep: in state B or C the head crosses a block of adjacent sets left to right, decrementing each, and ends on the element after the block in the state flipped once per set that contained a `0`.
Induction on K, one application of rule 3 (Lemma 5.3.3, through
Smith.step_setBC) per set.
In state A the head walks left across a block of adjacent sets: from index
L.length + k inside sets K (with k < K.length), k steps bring it to
L.length, still in state A.
Lean code for Lemma5.3.7●1 theorem
Associated Lean declarations
-
Smith.moveLeft[complete]
-
Smith.moveLeft[complete]
-
theoremdefined in Smith/System4Runs.leancomplete
theorem Smith.moveLeft (L : List BiTM.System4Elem) (K : List (List ℤ)) (R : List BiTM.System4Elem) (k : ℕ) (hk : k < K.length) : BiTM.System4.nSteps { elems := L ++ Smith.sets K ++ R, active := L.length + k, state := BiTM.System4State.A } k = some { elems := L ++ Smith.sets K ++ R, active := L.length, state := BiTM.System4State.A }
theorem Smith.moveLeft (L : List BiTM.System4Elem) (K : List (List ℤ)) (R : List BiTM.System4Elem) (k : ℕ) (hk : k < K.length) : BiTM.System4.nSteps { elems := L ++ Smith.sets K ++ R, active := L.length + k, state := BiTM.System4State.A } k = some { elems := L ++ Smith.sets K ++ R, active := L.length, state := BiTM.System4State.A }
In state A the head walks left across a block of adjacent sets.
Induction on K with Lemma 5.3.1.
From the right end of the leftmost block sets K (nonempty), in state A, K.length
steps bring the head to the left end of the tape and turn it round into state B.
Smith.turnFrom starts from any position inside the block.
Lean code for Lemma5.3.8●1 theorem
Associated Lean declarations
-
Smith.turn[complete]
-
Smith.turn[complete]
-
theoremdefined in Smith/System4Runs.leancomplete
theorem Smith.turn (K : List (List ℤ)) (R : List BiTM.System4Elem) (hK : K ≠ []) : BiTM.System4.nSteps { elems := Smith.sets K ++ R, active := K.length - 1, state := BiTM.System4State.A } K.length = some { elems := Smith.sets K ++ R, active := 0, state := BiTM.System4State.B }
theorem Smith.turn (K : List (List ℤ)) (R : List BiTM.System4Elem) (hK : K ≠ []) : BiTM.System4.nSteps { elems := Smith.sets K ++ R, active := K.length - 1, state := BiTM.System4State.A } K.length = some { elems := Smith.sets K ++ R, active := 0, state := BiTM.System4State.B }
From the right end of the leftmost block the head returns to the left end of the tape and turns round into state B.
Lemma 5.3.7 to index 0, then rule 1 at the left end
(Smith.step_setA_zero).
The C-phase: in state C the head runs through g star/empty pairs in 2g steps,
toggling 1 into each empty set and decrementing it, so that every pair * {} becomes
* {0} (Smith.starredZeroPairs); the head ends after the last pair, still in state C.
Lean code for Lemma5.3.9●1 theorem
Associated Lean declarations
-
Smith.cPhase[complete]
-
Smith.cPhase[complete]
-
theoremdefined in Smith/System4Runs.leancomplete
theorem Smith.cPhase (L : List BiTM.System4Elem) (g : ℕ) (R : List BiTM.System4Elem) : BiTM.System4.nSteps { elems := L ++ BiTM.starredEmptyPairs g ++ R, active := L.length, state := BiTM.System4State.C } (2 * g) = some { elems := L ++ Smith.starredZeroPairs g ++ R, active := L.length + 2 * g, state := BiTM.System4State.C }
theorem Smith.cPhase (L : List BiTM.System4Elem) (g : ℕ) (R : List BiTM.System4Elem) : BiTM.System4.nSteps { elems := L ++ BiTM.starredEmptyPairs g ++ R, active := L.length, state := BiTM.System4State.C } (2 * g) = some { elems := L ++ Smith.starredZeroPairs g ++ R, active := L.length + 2 * g, state := BiTM.System4State.C }
The C-phase: in state C the head runs through `g` star/empty pairs, turning every empty set into `{0}`, two steps per pair.
Induction on g: Lemma 5.3.5 toggles 1 into the empty set, and rule 3
in state C (Smith.step_setC) decrements it to {0} and moves on, the state
unchanged since the set held no 0.
5.3.1. The D-step
A System 5 step without a pop (1 not in the bag) is a D-step: two sweeps over the
conglomerate, one star removed and one empty set merged into it each time, t up by 2.
The D-step run (p. 17, "the bag didn't contain a 0"). From the tape sets K0, then
g >= 2 star/empty pairs, then a rest R', with the head at the left end in state A,
K0 nonempty, and 0 in the parity set of neither K0 nor its decrement,
4 K0.length + 4 steps lead to the tape whose leftmost block is K0 decremented
twice followed by two empty sets, then g - 2 pairs, then R', with the head at the
left end in state A: two stars are gone and their two empty sets have joined the
conglomerate.
Lean code for Lemma5.3.1.1●1 theorem
Associated Lean declarations
-
Smith.dStep[complete]
-
Smith.dStep[complete]
-
theoremdefined in Smith/System4Runs.leancomplete
theorem Smith.dStep (K0 : List (List ℤ)) (g : ℕ) (R' : List BiTM.System4Elem) (hK0 : K0 ≠ []) (hg : 2 ≤ g) (h0 : Smith.parMem 0 K0 = false) (h1 : Smith.parMem 0 (List.map Smith.decr K0) = false) : BiTM.System4.nSteps { elems := Smith.sets K0 ++ BiTM.starredEmptyPairs g ++ R', active := 0, state := BiTM.System4State.A } (4 * K0.length + 4) = some { elems := Smith.sets (List.map Smith.decr (List.map Smith.decr K0) ++ [[], []]) ++ BiTM.starredEmptyPairs (g - 2) ++ R', active := 0, state := BiTM.System4State.A }
theorem Smith.dStep (K0 : List (List ℤ)) (g : ℕ) (R' : List BiTM.System4Elem) (hK0 : K0 ≠ []) (hg : 2 ≤ g) (h0 : Smith.parMem 0 K0 = false) (h1 : Smith.parMem 0 (List.map Smith.decr K0) = false) : BiTM.System4.nSteps { elems := Smith.sets K0 ++ BiTM.starredEmptyPairs g ++ R', active := 0, state := BiTM.System4State.A } (4 * K0.length + 4) = some { elems := Smith.sets (List.map Smith.decr (List.map Smith.decr K0) ++ [[], []]) ++ BiTM.starredEmptyPairs (g - 2) ++ R', active := 0, state := BiTM.System4State.A }
A D-step (TM23Proof.pdf p. 17, "the bag didn't contain a 0"): two sweeps of the leftmost block, each followed by the deletion of the next star, which merges an empty set into the block.
Lemma 5.3.8 into state B, Lemma 5.3.6 the block (the state stays B
since Definition 5.2.7 0 K0 is false), delete the next star with
Lemma 5.3.4, which merges the empty set behind it into the block, turn
again (Smith.turnFrom), sweep again, delete the next star, and walk back to the left
end (Lemma 5.3.7).
If Definition 5.2.8 c s f j (h + 1) holds and 1 is not in the bag of s, then
some k >= 1 System 4 steps lead from c to a c' with RepS4 c' s' f (j + 1) h,
where s' is the System 5 step without a pop: the bag decremented and every rule
entry incremented.
Lean code for Theorem5.3.1.2●1 theorem
Associated Lean declarations
-
Smith.repS4_dStep[complete]
-
Smith.repS4_dStep[complete]
-
theoremdefined in Smith/Conjecture4.leancomplete
theorem Smith.repS4_dStep (c : BiTM.System4Config) (s : BiTM.System5Config) (f j h : ℕ) (hrep : Smith.RepS4 c s f j (h + 1)) (h1 : 1 ∉ s.bag) : ∃ k, 1 ≤ k ∧ ∃ c', BiTM.System4.nSteps c k = some c' ∧ Smith.RepS4 c' { bag := List.map (fun x => x - 1) s.bag, rules := List.map (fun r => List.map (fun x => x + 1) r) s.rules } f (j + 1) h
theorem Smith.repS4_dStep (c : BiTM.System4Config) (s : BiTM.System5Config) (f j h : ℕ) (hrep : Smith.RepS4 c s f j (h + 1)) (h1 : 1 ∉ s.bag) : ∃ k, 1 ≤ k ∧ ∃ c', BiTM.System4.nSteps c k = some c' ∧ Smith.RepS4 c' { bag := List.map (fun x => x - 1) s.bag, rules := List.map (fun r => List.map (fun x => x + 1) r) s.rules } f (j + 1) h
A System 5 step without a pop (`1` is not in the bag) is matched by the D-step run of `Smith.System4Runs`.
Lemma 5.3.1.1 with K0 the conglomerate and g = f - 2j >= 2. The parity of
0 in K0 is false by the band clause, since 1 is not in the bag; the parity of 0 in
the decremented block is that of 1 in K0 (Smith.parMem_map_decr), which is odd and
so never 2e - 2. The new conglomerate is K0 decremented twice with two empty sets
appended; its parity set below the new band 2f - 2(j + 1) - 2 is the old one shifted
by 2, the encoding of the decremented bag; the pairs are f - 2(j + 1); and the rule
blocks at t = 2j are the blocks of the incremented rules at t = 2j + 2
(Smith.encBlocks_shift). The bounds are arithmetic.
5.3.2. The P-step
A step with a pop is a P-step: the sweep leaves the conglomerate in state C, the head
crosses the pairs toggling 1s, enters the rule block, and two nested loops sweep the
rule set and the all-integers set back into the conglomerate; the XOR of the two
cancels everything except the entries of the rule at their shifted positions, which is
xorMerge of the rule into the bag. The relation is re-established with j + 1.
Macro A, the arrival at a rule block in state C (p. 17). With the head on a set Z
just left of star :: set Rs :: (m star/empty pairs) ++ R', m >= 2, 0 in
xorInsert 1 Rs and 0 not in its decrement, 8 steps cross the star with a toggle of
1, decrement the set twice, delete the star on either side of it and merge one empty
set on the right: the tape becomes the block of four sets Z, Rs toggled at 1 and
decremented twice, and two empty sets, followed by m - 2 pairs and R', with the
head on the first empty set (one place left of the right end of the block) in state A.
Lean code for Lemma5.3.2.1●1 theorem
Associated Lean declarations
-
Smith.preLoop[complete]
-
Smith.preLoop[complete]
-
theoremdefined in Smith/System4Runs.leancomplete
theorem Smith.preLoop (L0 : List BiTM.System4Elem) (Z Rs : List ℤ) (m : ℕ) (R' : List BiTM.System4Elem) (hm : 2 ≤ m) (h0 : 0 ∈ BiTM.xorInsert 1 Rs) (h1 : 0 ∉ Smith.decr (BiTM.xorInsert 1 Rs)) : BiTM.System4.nSteps { elems := L0 ++ BiTM.System4Elem.set Z :: BiTM.System4Elem.star :: BiTM.System4Elem.set Rs :: (BiTM.starredEmptyPairs m ++ R'), active := L0.length + 1, state := BiTM.System4State.C } 8 = some { elems := L0 ++ Smith.sets [Z, Smith.decr (Smith.decr (BiTM.xorInsert 1 Rs)), [], []] ++ BiTM.starredEmptyPairs (m - 2) ++ R', active := L0.length + 2, state := BiTM.System4State.A }
theorem Smith.preLoop (L0 : List BiTM.System4Elem) (Z Rs : List ℤ) (m : ℕ) (R' : List BiTM.System4Elem) (hm : 2 ≤ m) (h0 : 0 ∈ BiTM.xorInsert 1 Rs) (h1 : 0 ∉ Smith.decr (BiTM.xorInsert 1 Rs)) : BiTM.System4.nSteps { elems := L0 ++ BiTM.System4Elem.set Z :: BiTM.System4Elem.star :: BiTM.System4Elem.set Rs :: (BiTM.starredEmptyPairs m ++ R'), active := L0.length + 1, state := BiTM.System4State.C } 8 = some { elems := L0 ++ Smith.sets [Z, Smith.decr (Smith.decr (BiTM.xorInsert 1 Rs)), [], []] ++ BiTM.starredEmptyPairs (m - 2) ++ R', active := L0.length + 2, state := BiTM.System4State.A }
Macro A, the arrival at a rule block in state C (p. 17): the star is crossed with a toggle of `1`, the set is decremented twice, the star on either side of it is deleted, and one empty set is merged on the right.
Eight focus steps: rule 5 (Lemma 5.3.5), rule 3 in C on the toggled
set (Smith.step_setC, which flips to B because the 0 is there), rule 4 on the star
right of it (Lemma 5.3.4), rule 1 back onto the opening star
(Lemma 5.3.1), rule 2 deleting it (Lemma 5.3.2), rule 3
in B on the set (no 0 now, Lemma 5.3.3) and on the empty set behind it,
and rule 4 on the next star.
Macro B, one iteration of the loop (p. 17). The tape during the loop (Smith.loopCfg)
is a context L0, n star/{0} pairs, a star, a block K of at least two sets, m
star/empty pairs and a rest, with the head one place left of the right end of K in
state A. With n >= 1, m >= 1 and 0 not in the parity set of K, 2 K.length + 1
steps give the same shape with n - 1 and m - 1, the block now {0}, then K
decremented, then an empty set.
Lean code for Lemma5.3.2.2●1 theorem
Associated Lean declarations
-
Smith.loopIter[complete]
-
Smith.loopIter[complete]
-
theoremdefined in Smith/System4Runs.leancomplete
theorem Smith.loopIter (L0 : List BiTM.System4Elem) (n : ℕ) (K : List (List ℤ)) (m : ℕ) (R' : List BiTM.System4Elem) (hn : 1 ≤ n) (hm : 1 ≤ m) (hK : 2 ≤ K.length) (hpar : Smith.parMem 0 K = false) : BiTM.System4.nSteps (Smith.loopCfg L0 n K m R') (2 * K.length + 1) = some (Smith.loopCfg L0 (n - 1) ([0] :: List.map Smith.decr K ++ [[]]) (m - 1) R')
theorem Smith.loopIter (L0 : List BiTM.System4Elem) (n : ℕ) (K : List (List ℤ)) (m : ℕ) (R' : List BiTM.System4Elem) (hn : 1 ≤ n) (hm : 1 ≤ m) (hK : 2 ≤ K.length) (hpar : Smith.parMem 0 K = false) : BiTM.System4.nSteps (Smith.loopCfg L0 n K m R') (2 * K.length + 1) = some (Smith.loopCfg L0 (n - 1) ([0] :: List.map Smith.decr K ++ [[]]) (m - 1) R')
Macro B, one iteration of the loop (p. 17): the head walks left over the block, deletes the star to its left (merging a `{0}`), sweeps the block in state B, deletes the star to its right (merging an empty set).
Walk left over the block (Lemma 5.3.7), rule 1 onto the star to its left
(Lemma 5.3.1), rule 2 deleting it (Lemma 5.3.2), which
merges the {0} before it into the block, Lemma 5.3.6 the block in state B,
and rule 4 on the star to its right (Lemma 5.3.4), which merges the
empty set behind it.
The loop, n iterations. The block during the loop is Smith.loopK i R: a {0}
merged from the padding, i empty sets, the set R, and i + 2 empty sets. From the
loop shape with n star/{0} pairs, n <= m, and the block loopK i R such that
R decremented i' times contains 0 for every i' < n, some number of steps reaches
the loop shape with no {0} pairs left, the block loopK (i + n) of R decremented
n times, and m - n pairs.
Lean code for Lemma5.3.2.3●1 theorem
Associated Lean declarations
-
Smith.loopRun[complete]
-
Smith.loopRun[complete]
-
theoremdefined in Smith/System4Runs.leancomplete
theorem Smith.loopRun (L0 : List BiTM.System4Elem) (n i : ℕ) (R : List ℤ) (m : ℕ) (R' : List BiTM.System4Elem) (hm : n ≤ m) (hR : ∀ i' < n, 0 ∈ Smith.decrN i' R) : ∃ k, BiTM.System4.nSteps (Smith.loopCfg L0 n (Smith.loopK i R) m R') k = some (Smith.loopCfg L0 0 (Smith.loopK (i + n) (Smith.decrN n R)) (m - n) R')
theorem Smith.loopRun (L0 : List BiTM.System4Elem) (n i : ℕ) (R : List ℤ) (m : ℕ) (R' : List BiTM.System4Elem) (hm : n ≤ m) (hR : ∀ i' < n, 0 ∈ Smith.decrN i' R) : ∃ k, BiTM.System4.nSteps (Smith.loopCfg L0 n (Smith.loopK i R) m R') k = some (Smith.loopCfg L0 0 (Smith.loopK (i + n) (Smith.decrN n R)) (m - n) R')
The loop, `n` iterations.
Induction on n with Lemma 5.3.2.2; the parity of 0 in loopK i R is
membership of 0 in the current decrement of R.
Macro C, the last pass of the loop (p. 17, "the last star is going to be removed to
its left"). From the loop shape with context sets K0 (K0 nonempty), no {0}
pairs, a block K of at least two sets with 0 not in its parity set, and m >= 1
pairs, 3 K.length + K0.length steps merge the block with the leftmost block: the
tape is sets (K0 ++ K decremented ++ [{}]), then m - 1 pairs, with the head at the
left end in state A.
Lean code for Lemma5.3.2.4●1 theorem
Associated Lean declarations
-
Smith.finalPass[complete]
-
Smith.finalPass[complete]
-
theoremdefined in Smith/System4Runs.leancomplete
theorem Smith.finalPass (K0 K : List (List ℤ)) (m : ℕ) (R' : List BiTM.System4Elem) (hK0 : K0 ≠ []) (hK : 2 ≤ K.length) (hm : 1 ≤ m) (hpar : Smith.parMem 0 K = false) : BiTM.System4.nSteps (Smith.loopCfg (Smith.sets K0) 0 K m R') (3 * K.length + K0.length) = some { elems := Smith.sets (K0 ++ List.map Smith.decr K ++ [[]]) ++ BiTM.starredEmptyPairs (m - 1) ++ R', active := 0, state := BiTM.System4State.A }
theorem Smith.finalPass (K0 K : List (List ℤ)) (m : ℕ) (R' : List BiTM.System4Elem) (hK0 : K0 ≠ []) (hK : 2 ≤ K.length) (hm : 1 ≤ m) (hpar : Smith.parMem 0 K = false) : BiTM.System4.nSteps (Smith.loopCfg (Smith.sets K0) 0 K m R') (3 * K.length + K0.length) = some { elems := Smith.sets (K0 ++ List.map Smith.decr K ++ [[]]) ++ BiTM.starredEmptyPairs (m - 1) ++ R', active := 0, state := BiTM.System4State.A }
Macro C, the last pass of the loop (p. 17, "the last star is going to be removed to its left"): the block merges with the leftmost block, and the head returns to the left end of the tape.
As one loop iteration (Lemma 5.3.7, Lemma 5.3.1, Lemma 5.3.2, Lemma 5.3.6, Lemma 5.3.4), but the star deleted on the left was the last one between the two blocks, so they merge, and the head then walks back to the left end of the tape.
A pop phase (p. 17-18; both halves of the zero case have this shape). From the left
end in state A, with a 0 in the parity set of the nonempty conglomerate K0, then
g >= 1 star/empty pairs, then star :: set S, then m >= g + 2 pairs and a rest:
some k >= 1 steps lead to the tape whose leftmost block is K0 decremented, then
the loop block loopK (g - 1) of S toggled at 1 and decremented g + 1 times, all
decremented once more, then an empty set, followed by m - g - 2 pairs, with the head
at the left end in state A. The hypotheses ask that 0 be in xorInsert 1 S, not in
its first decrement, and in its decrements at each round of the loop and at the last
pass.
Lean code for Lemma5.3.2.5●1 theorem
Associated Lean declarations
-
Smith.popPhase[complete]
-
Smith.popPhase[complete]
-
theoremdefined in Smith/System4Runs.leancomplete
theorem Smith.popPhase (K0 : List (List ℤ)) (g : ℕ) (S : List ℤ) (m : ℕ) (R' : List BiTM.System4Elem) (hK0 : K0 ≠ []) (hg : 1 ≤ g) (hm : g + 2 ≤ m) (hpar : Smith.parMem 0 K0 = true) (h0 : 0 ∈ BiTM.xorInsert 1 S) (h1 : 0 ∉ Smith.decr (BiTM.xorInsert 1 S)) (hloop : ∀ i < g - 1, 0 ∈ Smith.decrN (i + 2) (BiTM.xorInsert 1 S)) (hlast : 0 ∈ Smith.decrN (g + 1) (BiTM.xorInsert 1 S)) : ∃ k, 1 ≤ k ∧ BiTM.System4.nSteps { elems := Smith.sets K0 ++ BiTM.starredEmptyPairs g ++ BiTM.System4Elem.star :: BiTM.System4Elem.set S :: BiTM.starredEmptyPairs m ++ R', active := 0, state := BiTM.System4State.A } k = some { elems := Smith.sets (List.map Smith.decr K0 ++ List.map Smith.decr (Smith.loopK (g - 1) (Smith.decrN (g + 1) (BiTM.xorInsert 1 S))) ++ [[]]) ++ BiTM.starredEmptyPairs (m - g - 2) ++ R', active := 0, state := BiTM.System4State.A }
theorem Smith.popPhase (K0 : List (List ℤ)) (g : ℕ) (S : List ℤ) (m : ℕ) (R' : List BiTM.System4Elem) (hK0 : K0 ≠ []) (hg : 1 ≤ g) (hm : g + 2 ≤ m) (hpar : Smith.parMem 0 K0 = true) (h0 : 0 ∈ BiTM.xorInsert 1 S) (h1 : 0 ∉ Smith.decr (BiTM.xorInsert 1 S)) (hloop : ∀ i < g - 1, 0 ∈ Smith.decrN (i + 2) (BiTM.xorInsert 1 S)) (hlast : 0 ∈ Smith.decrN (g + 1) (BiTM.xorInsert 1 S)) : ∃ k, 1 ≤ k ∧ BiTM.System4.nSteps { elems := Smith.sets K0 ++ BiTM.starredEmptyPairs g ++ BiTM.System4Elem.star :: BiTM.System4Elem.set S :: BiTM.starredEmptyPairs m ++ R', active := 0, state := BiTM.System4State.A } k = some { elems := Smith.sets (List.map Smith.decr K0 ++ List.map Smith.decr (Smith.loopK (g - 1) (Smith.decrN (g + 1) (BiTM.xorInsert 1 S))) ++ [[]]) ++ BiTM.starredEmptyPairs (m - g - 2) ++ R', active := 0, state := BiTM.System4State.A }
A pop phase (p. 17-18, both halves of the zero case have this shape): from the left end in state A with a `0` in the merged leftmost block, the head sweeps into state C, converts the `g` padding pairs to `{0}`, runs the pre-loop at the block `* S`, loops `g - 1` times, and merges everything into one block on the last pass.
Lemma 5.3.8 into B, Lemma 5.3.6 into C (the parity of 0 in K0 is
true), the C-phase across the g pairs (Lemma 5.3.9), the pre-loop at the
block * S (Lemma 5.3.2.1), the loop g - 1 times
(Lemma 5.3.2.3), and the last pass (Lemma 5.3.2.4).
If Definition 5.2.8 c s f j (h + 1) holds, the rules of s are r :: rest and
1 is in the bag, then some k >= 1 System 4 steps lead from c to a c' with
RepS4 c' s' f (j + 1) h, where s' is the System 5 step with a pop: the bag
decremented with its 0 erased and the incremented rule r merged in by
Definition 4.4.7, and the rules rest, incremented.
Lean code for Theorem5.3.2.6●1 theorem
Associated Lean declarations
-
Smith.repS4_pStep[complete]
-
Smith.repS4_pStep[complete]
-
theoremdefined in Smith/Conjecture4.leancomplete
theorem Smith.repS4_pStep (c : BiTM.System4Config) (s : BiTM.System5Config) (f j h : ℕ) (r : List ℤ) (rest : List (List ℤ)) (hrep : Smith.RepS4 c s f j (h + 1)) (hr : s.rules = r :: rest) (h1 : 1 ∈ s.bag) : ∃ k, 1 ≤ k ∧ ∃ c', BiTM.System4.nSteps c k = some c' ∧ Smith.RepS4 c' { bag := BiTM.xorMerge ((List.map (fun x => x - 1) s.bag).erase 0) (List.map (fun x => x + 1) r), rules := List.map (fun r => List.map (fun x => x + 1) r) rest } f (j + 1) h
theorem Smith.repS4_pStep (c : BiTM.System4Config) (s : BiTM.System5Config) (f j h : ℕ) (r : List ℤ) (rest : List (List ℤ)) (hrep : Smith.RepS4 c s f j (h + 1)) (hr : s.rules = r :: rest) (h1 : 1 ∈ s.bag) : ∃ k, 1 ≤ k ∧ ∃ c', BiTM.System4.nSteps c k = some c' ∧ Smith.RepS4 c' { bag := BiTM.xorMerge ((List.map (fun x => x - 1) s.bag).erase 0) (List.map (fun x => x + 1) r), rules := List.map (fun r => List.map (fun x => x + 1) r) rest } f (j + 1) h
A System 5 step with a pop (`1` is in the bag) is matched by two pop phases of `Smith.System4Runs`, one at the rule set and one at the all-integers set.
Two pop phases (Lemma 5.3.2.5), one at the rule set
Definition 5.2.3 r f (2j) and one at the all-integers set of the first
rule block Definition 5.2.4. Below the band, the parity of the two merged
sets is the XOR of 0..3f toggled at the shifted rule positions with 0..3f itself,
which is the rule entries at their positions Definition 5.2.2; merged into the
decremented conglomerate by Definition 5.2.7 this is the xorMerge of the rule
into the bag. The 2f and 2f - 2 pairs inside the block and the f - 2j pairs
before it supply the padding the two phases consume, leaving f - 2(j + 1) pairs;
the remaining blocks at t = 2j are the incremented rules at t = 2j + 2
(Smith.encBlocks_shift). The budget clause k + j + 2h < f on the rule entries keeps
every merged position under the new band.
5.3.3. The exit in state C
When the rules are exhausted and 1 is in the bag, the pop attempt finds no rule block: the head sweeps the conglomerate in state C, crosses the remaining pairs, and leaves the tape to the right in state C. This is the exit that the finite form of Conjecture 0 needs (the chapter on Conjecture 0).
If Definition 5.2.8 c s f j h holds with an empty rule list, 1 in the bag and
j + 1 < f, then after some k System 4 steps from c the configuration c' is in
state C with its active index equal to the length of its tape, and
Definition 5.1.1 c' is none: the head has run off the right end of the
tape in state C, the exit condition of Conjecture 4 (p. 10 and p. 18).
Lean code for Theorem5.3.3.1●1 theorem
Associated Lean declarations
-
Smith.repS4_exit[complete]
-
Smith.repS4_exit[complete]
-
theoremdefined in Smith/Conjecture4.leancomplete
theorem Smith.repS4_exit (c : BiTM.System4Config) (s : BiTM.System5Config) (f j h : ℕ) (hrep : Smith.RepS4 c s f j h) (hr : s.rules = []) (h1 : 1 ∈ s.bag) (hjf : j + 1 < f) : ∃ k c', BiTM.System4.nSteps c k = some c' ∧ c'.state = BiTM.System4State.C ∧ c'.active = c'.elems.length ∧ BiTM.System4.step c' = none
theorem Smith.repS4_exit (c : BiTM.System4Config) (s : BiTM.System5Config) (f j h : ℕ) (hrep : Smith.RepS4 c s f j h) (hr : s.rules = []) (h1 : 1 ∈ s.bag) (hjf : j + 1 < f) : ∃ k c', BiTM.System4.nSteps c k = some c' ∧ c'.state = BiTM.System4State.C ∧ c'.active = c'.elems.length ∧ BiTM.System4.step c' = none
When the System 5 program attempts a pop with no rule left (`1` in the bag, empty rule list), the System 4 head runs off the right end of the tape in state C: the exit condition of Conjecture 4 (TM23Proof.pdf p. 10 and p. 18).
With no rule block the tape is the conglomerate followed by f - 2j pairs. Rule 1 at
the left end turns the head into B; Lemma 5.3.6 crosses the conglomerate and
flips to C, since 1 in the bag puts 0 in the parity set; the C-phase
(Lemma 5.3.9) crosses all the pairs, and the head stands past the end of
the tape, where the step is none.
The exit without 1 in the bag yet (in Smith/Conjecture0.lean). If
Definition 5.2.8 c s f j (h + M) holds with an empty rule list and some bag
entry at most M + 1, then after some k steps the configuration is in state C past
the right end of its tape with the step none, as in Theorem 5.3.3.1.
Lean code for Theorem5.3.3.2●1 theorem
Associated Lean declarations
-
Smith.repS4_terminal[complete]
-
Smith.repS4_terminal[complete]
-
theoremdefined in Smith/Conjecture0.leancomplete
theorem Smith.repS4_terminal (M : ℕ) (c : BiTM.System4Config) (s : BiTM.System5Config) (f j h : ℕ) : Smith.RepS4 c s f j (h + M) → s.rules = [] → (∃ e ∈ s.bag, e ≤ ↑M + 1) → ∃ k c', BiTM.System4.nSteps c k = some c' ∧ c'.state = BiTM.System4State.C ∧ c'.active = c'.elems.length ∧ BiTM.System4.step c' = none
theorem Smith.repS4_terminal (M : ℕ) (c : BiTM.System4Config) (s : BiTM.System5Config) (f j h : ℕ) : Smith.RepS4 c s f j (h + M) → s.rules = [] → (∃ e ∈ s.bag, e ≤ ↑M + 1) → ∃ k c', BiTM.System4.nSteps c k = some c' ∧ c'.state = BiTM.System4State.C ∧ c'.active = c'.elems.length ∧ BiTM.System4.step c' = none
Once the System 5 rules are exhausted, System 4 decrements until 1 is in the bag and then exits in state C past the right end of its tape. `M + 1` bounds some bag element, so the decrements are at most `M`.
Induction on M. If 1 is in the bag, Theorem 5.3.3.1 (the bag bound
e + j < f gives j + 1 < f). Otherwise one D-step (Theorem 5.3.1.2)
decrements the bag, the bounded entry drops to at most M, and the induction
hypothesis applies with one unit of budget less.
5.4. Formal statements
T2 as a Definition 4.2.3: for every f and h0, the Definition 4.2.7
System 5 (one step of Definition 4.4.8 per unit of fuel) is forward
simulated by System 4 under the relation that ties a fueled configuration (s, n) to
a System 4 configuration c when n <= h0 and Definition 5.2.8
c s f (h0 - n) n: the budget is the fuel, and the step count j of RepS4 is the
fuel spent from h0.
Lean code for Theorem5.4.1●1 theorem
Associated Lean declarations
-
Smith.repS4_forwardSim[complete]
-
Smith.repS4_forwardSim[complete]
-
theoremdefined in Smith/Conjecture4.leancomplete
theorem Smith.repS4_forwardSim (f h0 : ℕ) : Smith.ForwardSim (Smith.fueled Smith.system5Sys) Smith.system4Sys fun p c => p.2 ≤ h0 ∧ Smith.RepS4 c p.1 f (h0 - p.2) p.2
theorem Smith.repS4_forwardSim (f h0 : ℕ) : Smith.ForwardSim (Smith.fueled Smith.system5Sys) Smith.system4Sys fun p c => p.2 ≤ h0 ∧ Smith.RepS4 c p.1 f (h0 - p.2) p.2
T2 as a `ForwardSim`: the budget is the fuel of the source System 5, and the step count `j` of `RepS4` is the fuel spent from `h0`.
A fueled step with fuel h + 1 is a System 5 step, which is some exactly when the
bag and the rule list are nonempty (BiTM.System5_step_some_iff). If 1 is in the bag
the step is the explicit pop (BiTM.System5_step_explicit_pop) and
Theorem 5.3.2.6 supplies the k >= 1 System 4 steps; otherwise it is the
pure decrement (BiTM.System5_step_pure_decrement) and Theorem 5.3.1.2
does.
T2, the finite form of "Conjecture 5 implies Conjecture 4". For a System 5
configuration s with a Nodup bag of entries 1 <= e < f, Nodup rules whose
entries satisfy 0 <= k and k + 2h < f, and 2h < f, and for a run of n <= h
System 5 steps from s, there are System 4 times times 0 = 0 < times 1 < ... < times n
at which the tape Definition 5.2.5 s f stands in the relation
Definition 5.2.8 _ si f i (h - i) to the i-th System 5 configuration si.
Lean code for Theorem5.4.2●1 theorem
Associated Lean declarations
-
Smith.conjecture4_finite[complete]
-
Smith.conjecture4_finite[complete]
-
theoremdefined in Smith/Conjecture4.leancomplete
theorem Smith.conjecture4_finite (s : BiTM.System5Config) (f h n : ℕ) (hbag : s.bag.Nodup) (hbag1 : ∀ e ∈ s.bag, 1 ≤ e ∧ e < ↑f) (hrules : ∀ r ∈ s.rules, r.Nodup ∧ ∀ k ∈ r, 0 ≤ k ∧ k + 2 * ↑h < ↑f) (hf : 2 * h < f) (hn : n ≤ h) (s' : BiTM.System5Config) (hrun : BiTM.System5.nSteps s n = some s') : ∃ times, times 0 = 0 ∧ (∀ i < n, times i < times (i + 1)) ∧ ∀ i ≤ n, ∃ si ci, BiTM.System5.nSteps s i = some si ∧ BiTM.System4.nSteps (BiTM.system5ToSystem4 s f) (times i) = some ci ∧ Smith.RepS4 ci si f i (h - i)
theorem Smith.conjecture4_finite (s : BiTM.System5Config) (f h n : ℕ) (hbag : s.bag.Nodup) (hbag1 : ∀ e ∈ s.bag, 1 ≤ e ∧ e < ↑f) (hrules : ∀ r ∈ s.rules, r.Nodup ∧ ∀ k ∈ r, 0 ≤ k ∧ k + 2 * ↑h < ↑f) (hf : 2 * h < f) (hn : n ≤ h) (s' : BiTM.System5Config) (hrun : BiTM.System5.nSteps s n = some s') : ∃ times, times 0 = 0 ∧ (∀ i < n, times i < times (i + 1)) ∧ ∀ i ≤ n, ∃ si ci, BiTM.System5.nSteps s i = some si ∧ BiTM.System4.nSteps (BiTM.system5ToSystem4 s f) (times i) = some ci ∧ Smith.RepS4 ci si f i (h - i)
T2, the finite form of "Conjecture 5 implies Conjecture 4" (PLAN.md section 2). For a System 5 program whose integers are bounded in terms of the parameter `f` and the budget `h` as `system5ToSystem4_repS4` requires, the System 4 tape `system5ToSystem4 s f` tracks every System 5 run of `n <= h` steps: there are strictly increasing System 4 times `times 0 = 0 < times 1 < ... < times n` at which the tape stands in the relation `RepS4` to the `i`-th System 5 configuration.
Smith.ForwardSim_nSteps applied to Theorem 5.4.1 f h, from the
initial relation Smith.system5ToSystem4_repS4 at fuel h, along the fueled run of
n <= h steps (Smith.fueled_nSteps).
The decoder of the link reads the parity set of the leading conglomerate below a band
and maps x to x / 2 + 1, returning none if an odd integer is set.
decodeS4 c b: take the integers 0 <= x < b in the parity set
(Definition 5.2.7) of the leftmost block of adjacent sets of the tape
(Smith.leadSets c.elems); if they are all even, return them mapped through
x / 2 + 1, otherwise none.
Lean code for Definition5.4.3●2 definitions
Associated Lean declarations
-
Smith.decodeS4[complete]
-
Smith.leadSets[complete]
-
Smith.decodeS4[complete] -
Smith.leadSets[complete]
-
defdefined in Smith/Conjecture4.leancomplete
def Smith.decodeS4 (c : BiTM.System4Config) (b : ℕ) : Option (List ℤ)
def Smith.decodeS4 (c : BiTM.System4Config) (b : ℕ) : Option (List ℤ)
The decoder of link C: the parity set of the leftmost block below the band `b`, read as System 5 integers through `x |-> x / 2 + 1`; `none` if an odd integer is set, which never happens at a scheduled time.
-
defdefined in Smith/Conjecture4.leancomplete
def Smith.leadSets : List BiTM.System4Elem → List (List ℤ)
def Smith.leadSets : List BiTM.System4Elem → List (List ℤ)
The leftmost block of adjacent sets of a tape.
If Definition 5.2.8 c s f j h holds, then Definition 5.4.3
c (2f - 2j - 2) is some l with l a permutation of the bag of s: at a scheduled
time the decoder reads the System 5 bag, up to order.
Lean code for Theorem5.4.4●1 theorem
Associated Lean declarations
-
Smith.RepS4_decode[complete]
-
Smith.RepS4_decode[complete]
-
theoremdefined in Smith/Conjecture4.leancomplete
theorem Smith.RepS4_decode (c : BiTM.System4Config) (s : BiTM.System5Config) (f j h : ℕ) (hrep : Smith.RepS4 c s f j h) : ∃ l, Smith.decodeS4 c (2 * f - 2 * j - 2) = some l ∧ l.Perm s.bag
theorem Smith.RepS4_decode (c : BiTM.System4Config) (s : BiTM.System5Config) (f j h : ℕ) (hrep : Smith.RepS4 c s f j h) : ∃ l, Smith.decodeS4 c (2 * f - 2 * j - 2) = some l ∧ l.Perm s.bag
At a scheduled time the decoder reads the System 5 bag, up to order.
The leading block of the tape is the conglomerate K (Smith.leadSets_sets, since the
element after it is a star). Below the band the parity clause of the relation says the
parity set is exactly the 2e - 2 for e in the bag, all even and below the band by
the bag bound; x / 2 + 1 inverts e to 2e - 2, and the bag is Nodup, so the
result lists the bag in some order.
Smith.conjecture4_cts and Smith.conjecture4_cts_exists_f compose T1 and T2: the
System 4 tape of the cy2s5.pl output tracks the cyclic tag run for every large
enough f.
Links B and C composed. For a cyclic tag system C0, a configuration cfg, a period
count N, and a run of n <= C0.appendants.length * N steps of C0 from cfg,
there is an L (the number of System 5 steps the run takes) such that for every f
above every bag entry of Definition 4.4.9 C0 cfg N, with k + 2L < f for
every rule entry k and 2L < f, there are strictly increasing System 4 times from
times 0 = 0 at which, for i <= n: the i-th cyclic tag configuration ci exists;
some m System 5 steps reach an si that Definition 4.4.6 the doubled
configuration dblCfg ci of Definition 4.3.2 C0 with the remaining
budget 2 (C0.appendants.length * N - i); and the tape
Definition 5.2.5 (ctsToSystem5 C0 cfg N) f after times i steps
stands in Definition 5.2.8 _ si f m (L - m).
Lean code for Theorem5.4.5●1 theorem
Associated Lean declarations
-
Smith.conjecture4_cts[complete]
-
Smith.conjecture4_cts[complete]
-
theoremdefined in Smith/Conjecture4.leancomplete
theorem Smith.conjecture4_cts (C0 : TagSystem.CTS) (cfg : TagSystem.CTSConfig) (N n : ℕ) (hn : n ≤ C0.appendants.length * N) (c' : TagSystem.CTSConfig) (hrun : C0.nSteps cfg n = some c') : ∃ L, ∀ (f : ℕ), (∀ e ∈ (BiTM.ctsToSystem5 C0 cfg N).bag, e < ↑f) → (∀ r ∈ (BiTM.ctsToSystem5 C0 cfg N).rules, ∀ k ∈ r, k + 2 * ↑L < ↑f) → 2 * L < f → ∃ times, times 0 = 0 ∧ (∀ i < n, times i < times (i + 1)) ∧ ∀ i ≤ n, ∃ ci si c4i m, C0.nSteps cfg i = some ci ∧ BiTM.System5.nSteps (BiTM.ctsToSystem5 C0 cfg N) m = some si ∧ Smith.Represents si (Smith.double C0) (Smith.dblCfg ci) (2 * (C0.appendants.length * N - i)) ∧ BiTM.System4.nSteps (BiTM.system5ToSystem4 (BiTM.ctsToSystem5 C0 cfg N) f) (times i) = some c4i ∧ Smith.RepS4 c4i si f m (L - m)
theorem Smith.conjecture4_cts (C0 : TagSystem.CTS) (cfg : TagSystem.CTSConfig) (N n : ℕ) (hn : n ≤ C0.appendants.length * N) (c' : TagSystem.CTSConfig) (hrun : C0.nSteps cfg n = some c') : ∃ L, ∀ (f : ℕ), (∀ e ∈ (BiTM.ctsToSystem5 C0 cfg N).bag, e < ↑f) → (∀ r ∈ (BiTM.ctsToSystem5 C0 cfg N).rules, ∀ k ∈ r, k + 2 * ↑L < ↑f) → 2 * L < f → ∃ times, times 0 = 0 ∧ (∀ i < n, times i < times (i + 1)) ∧ ∀ i ≤ n, ∃ ci si c4i m, C0.nSteps cfg i = some ci ∧ BiTM.System5.nSteps (BiTM.ctsToSystem5 C0 cfg N) m = some si ∧ Smith.Represents si (Smith.double C0) (Smith.dblCfg ci) (2 * (C0.appendants.length * N - i)) ∧ BiTM.System4.nSteps (BiTM.system5ToSystem4 (BiTM.ctsToSystem5 C0 cfg N) f) (times i) = some c4i ∧ Smith.RepS4 c4i si f m (L - m)
T1 and T2 composed (links B and C): the System 4 tape of the System 5 program `cy2s5.pl` emits for a cyclic tag system tracks the cyclic tag run. `L` is the number of System 5 steps the cyclic tag run of `n` steps takes; for every `f` above the bounds `system5ToSystem4_repS4` requires there is a strictly increasing schedule of System 4 times at which the tape stands in `RepS4` to a System 5 configuration that in turn `Represents` the cyclic tag configuration.
Theorem 4.6.2 gives the System 5 schedule t5 and the
representation; L is t5 n. The bag entries of ctsToSystem5 are at least 1 and
the rule entries at least 3 and Nodup (BiTM.ctsToSystem5_bag_ge_one,
BiTM.ctsToSystem5_rules_ge_three, BiTM.ctsToSystem5_rules_nodup), so
Theorem 5.4.2 applies with budget L and gives the System 4
schedule t4; the composed times are t4 (t5 i), strictly increasing since both
schedules are (Smith.strictMono_of_succ).
The parameter f can always be chosen: under the hypotheses of
Theorem 5.4.5 there are L and f0 such that every f >= f0
admits the schedule and the relations of that theorem.
Lean code for Theorem5.4.6●1 theorem
Associated Lean declarations
-
Smith.conjecture4_cts_exists_f[complete]
-
Smith.conjecture4_cts_exists_f[complete]
-
theoremdefined in Smith/Conjecture4.leancomplete
theorem Smith.conjecture4_cts_exists_f (C0 : TagSystem.CTS) (cfg : TagSystem.CTSConfig) (N n : ℕ) (hn : n ≤ C0.appendants.length * N) (c' : TagSystem.CTSConfig) (hrun : C0.nSteps cfg n = some c') : ∃ L f0, ∀ (f : ℕ), f0 ≤ f → ∃ times, times 0 = 0 ∧ (∀ i < n, times i < times (i + 1)) ∧ ∀ i ≤ n, ∃ ci si c4i m, C0.nSteps cfg i = some ci ∧ BiTM.System5.nSteps (BiTM.ctsToSystem5 C0 cfg N) m = some si ∧ Smith.Represents si (Smith.double C0) (Smith.dblCfg ci) (2 * (C0.appendants.length * N - i)) ∧ BiTM.System4.nSteps (BiTM.system5ToSystem4 (BiTM.ctsToSystem5 C0 cfg N) f) (times i) = some c4i ∧ Smith.RepS4 c4i si f m (L - m)
theorem Smith.conjecture4_cts_exists_f (C0 : TagSystem.CTS) (cfg : TagSystem.CTSConfig) (N n : ℕ) (hn : n ≤ C0.appendants.length * N) (c' : TagSystem.CTSConfig) (hrun : C0.nSteps cfg n = some c') : ∃ L f0, ∀ (f : ℕ), f0 ≤ f → ∃ times, times 0 = 0 ∧ (∀ i < n, times i < times (i + 1)) ∧ ∀ i ≤ n, ∃ ci si c4i m, C0.nSteps cfg i = some ci ∧ BiTM.System5.nSteps (BiTM.ctsToSystem5 C0 cfg N) m = some si ∧ Smith.Represents si (Smith.double C0) (Smith.dblCfg ci) (2 * (C0.appendants.length * N - i)) ∧ BiTM.System4.nSteps (BiTM.system5ToSystem4 (BiTM.ctsToSystem5 C0 cfg N) f) (times i) = some c4i ∧ Smith.RepS4 c4i si f m (L - m)
The parameter `f` can always be chosen: above the largest integer of the System 5 program plus twice the System 5 run length.
Every list of integers is bounded (Smith.exists_int_bound); take f0 above the
largest integer of the System 5 program plus twice the System 5 run length L, and
apply Theorem 5.4.5.
5.5. Notes and caveats
The finish-time bound. Smith's T2 (p. 20-21) computes f from an a priori bound
finishTime P <= 3^(n-1) M on the System 5 run. That bound is not formalized:
Smith.conjecture4_finite takes the System 5 run length h as its budget and
requires k + 2h < f on the rule entries and 2h < f, a differently shaped
condition. The closed-form initial condition of the chapter on
Conjecture 0 bounds that run length by Smith.System5.run_bound instead, a coarser
bound than Smith's that plays the same role.
Two branches of BiTM.System4.step differ from system4.pl: rule 5 with the star
last returns none (the Perl autovivifies a set past the end), and rule 4 at index 0
returns none (the Perl reads the last element). Neither is reachable from an
encoder tape.
A System 4 tape is well formed when its leftmost element is a set, no two stars are
adjacent, and every set is Nodup. s52s4.pl emits exactly such tapes; rule 5 of
Definition 5.1.1 is only defined on them, and the parity reading of the
sets needs the Nodup clause. Every step preserves well-formedness
(BiTM.System4_step_wellFormed, BiTM.System4_nSteps_wellFormed): rules 1 and 3 do
not move stars, rules 2 and 4 delete a star whose two neighbours are not stars, rule 5
only rewrites a set, and a star is never deleted at index 0.
Lean code for Definition5.5.1●1 definition
Associated Lean declarations
-
BiTM.System4Config.WellFormed[complete]
-
BiTM.System4Config.WellFormed[complete]
-
defdefined in BiTM/System4.leancomplete
def BiTM.System4Config.WellFormed (cfg : BiTM.System4Config) : Prop
def BiTM.System4Config.WellFormed (cfg : BiTM.System4Config) : Prop
A well-formed System 4 tape: the leftmost element is a set, no two stars are adjacent, and every set has no duplicates. `s52s4.pl` emits exactly such tapes; rule 5 (star in state C) is only defined on them, and the parity semantics of the sets needs the `Nodup` clause.
Well-formedness rules out rule 4 at index 0, whose leftmost element would be a star.
Rule 5 with the star last needs, besides, that the last element of the tape is a set,
which holds of the encoder tape (Smith.system5ToSystem4_last_set, with
Smith.system5ToSystem4_wellFormed, in the chapter on Conjecture 0)
and which no rule disturbs, since no rule deletes a set.
The D4/D5/D7 vectors of Vectors/SmithVectors.lean run the p. 33 tape for 1904 System 4
steps and read the System 5 bag off it with Smith.decodeS4 at the scheduled times,
with negative instances at unscheduled times.
5.6. Depends on
The modules of this chapter are BiTM/System4.lean, BiTM/System5ToSystem4.lean,
Smith/System4Runs.lean and Smith/Conjecture4.lean, with Smith.repS4_terminal in
Smith/Conjecture0.lean. The chapter builds on
the chapter on cyclic tag to System 5 for the simulation
calculus (Smith.ForwardSim, Smith.fueled), the System 5 step, BiTM.xorMerge and,
for the composed statements, Smith.conjecture5_finite, BiTM.ctsToSystem5 and
Smith.Represents.