Wolfram (2,3) universality in Lean

4. T1: from a cyclic tag system to System 5🔗

4.1. Orientation🔗

System 5 (p. 16-17, system5.pl p. 30-32) is Smith's first abstraction: a bag of integers and a list of rules, each rule a list of integers. Every step decrements the bag and increments the rules; when a 0 appears in the bag it is removed and the first rule is XOR-merged into the bag (BiTM.System5.step, BiTM.xorMerge). Smith's Conjecture 5 says a System 5 program emulates a cyclic tag system for an arbitrary number of steps. The formal T1 is Smith.conjecture5_finite and its rule-counting variant Smith.conjecture5_finite_exact.

This chapter also introduces the simulation calculus shared by every link.

4.2. The simulation calculus🔗

Smith/Simulation.lean. A step system is a partial step function, and nSteps iterates it.

Definition4.2.1
Group: The emulation calculus of the Simulation module, shared by every link of the chain: step systems, forward simulation, schedules and fuel. (6)
Group member previews
Preview
Definition 4.2.2
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 3
Reverse dependency previews
Preview
Definition 4.2.2
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

A step system on a type S is a partial step function step : S → Option S; none marks the stuck states.

Lean code for Definition4.2.1●1 definition
  • structure(1 field)defined in Smith/Simulation.lean
    complete
    structure Smith.StepSys.{u} (S : Type u) : Type u
    structure Smith.StepSys.{u} (S : Type u) : Type u
    A deterministic partial step system: a state type together with a step
    function whose value is `none` exactly on the stuck states. 
    step : S → Option S
    One step; `none` means the system is stuck. 
Definition4.2.2
Group: The emulation calculus of the Simulation module, shared by every link of the chain: step systems, forward simulation, schedules and fuel. (6)
Group member previews
Preview
Definition 4.2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 3
Reverse dependency previews
Preview
Definition 2.5.6
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

M.nSteps s n iterates the step of a step system M (Definition 4.2.1) n times from s; it is none as soon as one step is stuck.

Lean code for Definition4.2.2●1 definition
  • defdefined in Smith/Simulation.lean
    complete
    def Smith.StepSys.nSteps.{u} {S : Type u} (M : Smith.StepSys S) (s : S) :
      ℕ → Option S
    def Smith.StepSys.nSteps.{u} {S : Type u}
      (M : Smith.StepSys S) (s : S) :
      ℕ → Option S
    `n` iterations of the step function; `none` as soon as one step is stuck. 
Definition4.2.3
Group: The emulation calculus of the Simulation module, shared by every link of the chain: step systems, forward simulation, schedules and fuel. (6)
Group member previews
Preview
Definition 4.2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 4.2.1
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
Used by 13
Reverse dependency previews
Preview
Theorem 3.4.15
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

A forward simulation from a step system MS to a step system MT (Definition 4.2.1) along a relation R between their states: whenever R s t and MS.step s = some s', there are k with 1 <= k and t' with MT.nSteps t k = some t' (Definition 4.2.2) and R s' t'. One source step is matched by a run of at least one target step that re-establishes the relation.

Lean code for Definition4.2.3●1 definition
  • defdefined in Smith/Simulation.lean
    complete
    def Smith.ForwardSim.{u, v} {S : Type u} {T : Type v} (MS : Smith.StepSys S)
      (MT : Smith.StepSys T) (R : S → T → Prop) : Prop
    def Smith.ForwardSim.{u, v} {S : Type u}
      {T : Type v} (MS : Smith.StepSys S)
      (MT : Smith.StepSys T)
      (R : S → T → Prop) : Prop
    Forward simulation: every source step is matched by a run of at least
    one target step that re-establishes the relation.  The clause
    `1 <= k` is what forbids the trivial witness in which the target stands
    still while the source moves.
    
    That clause is all the predicate itself rules out: a relation that
    ignores the source (`fun _ _ => True`) is a `ForwardSim` for any target
    that never gets stuck.  The content of each emulation theorem is in the
    relation being the graph of a (partial) decoder, with the decoders and
    the size and exit clauses stated in the theorems themselves (PLAN.md
    section 6). 
Lemma4.2.4
Group: The emulation calculus of the Simulation module, shared by every link of the chain: step systems, forward simulation, schedules and fuel. (6)
Group member previews
Preview
Definition 4.2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 4
Reverse dependency previews
Preview
Theorem 4.6.1
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

Forward simulations (Definition 4.2.3) compose along relational composition: from ForwardSim MS MT R and ForwardSim MT MU R' follows ForwardSim MS MU (Rcomp R R'), where Rcomp R R' s u says that some t has R s t and R' t u.

Lean code for Lemma4.2.4●1 theorem
  • theoremdefined in Smith/Simulation.lean
    complete
    theorem Smith.ForwardSim_comp.{u, v, w} {S : Type u} {T : Type v} {U : Type w}
      {MS : Smith.StepSys S} {MT : Smith.StepSys T} {MU : Smith.StepSys U}
      {R : S → T → Prop} {R' : T → U → Prop} (h : Smith.ForwardSim MS MT R)
      (h' : Smith.ForwardSim MT MU R') :
      Smith.ForwardSim MS MU (Smith.Rcomp R R')
    theorem Smith.ForwardSim_comp.{u, v, w}
      {S : Type u} {T : Type v} {U : Type w}
      {MS : Smith.StepSys S}
      {MT : Smith.StepSys T}
      {MU : Smith.StepSys U}
      {R : S → T → Prop} {R' : T → U → Prop}
      (h : Smith.ForwardSim MS MT R)
      (h' : Smith.ForwardSim MT MU R') :
      Smith.ForwardSim MS MU
        (Smith.Rcomp R R')
    Composition of two forward simulations along the relational composite. 
Proof for Lemma 4.2.4
uses 0

The first simulation matches a source step by k >= 1 steps of MT; the weak lifting Smith.ForwardSim_nSteps_weak of the second matches those k steps by at least k steps of MU that end in the composite relation.

Definition4.2.5
Group: The emulation calculus of the Simulation module, shared by every link of the chain: step systems, forward simulation, schedules and fuel. (6)
Group member previews
Preview
Definition 4.2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 2
Reverse dependency previews
Preview
Lemma 4.2.6
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

A schedule times : Nat → Nat witnessing that MT tracks n steps of MS through R from s and t: times 0 = 0; times j < times (j + 1) for every j < n; and for every j <= n both runs are defined, MS.nSteps s j = some sj and MT.nSteps t (times j) = some tj (Definition 4.2.2), with R sj tj. The target times are strictly increasing, times 0 = 0 < times 1 < ..., with the relation holding at each.

Lean code for Definition4.2.5●1 definition
  • defdefined in Smith/Simulation.lean
    complete
    def Smith.IsSimSchedule.{u, v} {S : Type u} {T : Type v}
      (MS : Smith.StepSys S) (MT : Smith.StepSys T) (R : S → T → Prop)
      (s : S) (t : T) (n : ℕ) (times : ℕ → ℕ) : Prop
    def Smith.IsSimSchedule.{u, v} {S : Type u}
      {T : Type v} (MS : Smith.StepSys S)
      (MT : Smith.StepSys T)
      (R : S → T → Prop) (s : S) (t : T)
      (n : ℕ) (times : ℕ → ℕ) : Prop
    A schedule of target times witnessing that `MT` tracks `n` steps of `MS`
    through `R`: it starts at time 0, is strictly increasing on `[0, n]`
    (so the target really moves at every source step), and at each source
    time `j <= n` both runs are defined and related. 
Lemma4.2.6
Group: The emulation calculus of the Simulation module, shared by every link of the chain: step systems, forward simulation, schedules and fuel. (6)
Group member previews
Preview
Definition 4.2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 4.2.3
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
Used by 4
Reverse dependency previews
Preview
Theorem 3.5.10
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

A forward simulation (Definition 4.2.3) lifts to a run of n source steps: from R s t and MS.nSteps s n = some s' there is a schedule times with IsSimSchedule MS MT R s t n times (Definition 4.2.5).

Lean code for Lemma4.2.6●1 theorem
  • theoremdefined in Smith/Simulation.lean
    complete
    theorem Smith.ForwardSim_nSteps.{u, v} {S : Type u} {T : Type v}
      {MS : Smith.StepSys S} {MT : Smith.StepSys T} {R : S → T → Prop}
      (h : Smith.ForwardSim MS MT R) (n : ℕ) (s : S) (t : T) (hR : R s t)
      (s' : S) (hn : MS.nSteps s n = some s') :
      ∃ times, Smith.IsSimSchedule MS MT R s t n times
    theorem Smith.ForwardSim_nSteps.{u, v}
      {S : Type u} {T : Type v}
      {MS : Smith.StepSys S}
      {MT : Smith.StepSys T}
      {R : S → T → Prop}
      (h : Smith.ForwardSim MS MT R) (n : ℕ)
      (s : S) (t : T) (hR : R s t) (s' : S)
      (hn : MS.nSteps s n = some s') :
      ∃ times,
        Smith.IsSimSchedule MS MT R s t n
          times
    Lifting to `n` source steps, strong form: an explicit strictly
    increasing schedule of target times. 
Proof for Lemma 4.2.6
uses 0

Induction on n: the schedule of the first n steps is extended by the k >= 1 target steps that the simulation supplies for the last source step.

Definition4.2.7
Group: The emulation calculus of the Simulation module, shared by every link of the chain: step systems, forward simulation, schedules and fuel. (6)
Group member previews
Preview
Definition 4.2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 5
Reverse dependency previews
Preview
Lemma 4.3.4
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

The fuelled system of a step system M (Definition 4.2.1): its states are pairs of a state of M and a step count, one step of M costs one unit of fuel, and at fuel 0 the system is stuck. Budgets live in the source system through fueled: ForwardSim quantifies over every source step, so a relation that carries a finite budget cannot satisfy it once the budget runs out, the source stepping on while the target is exhausted; fueled makes the budget part of the source system instead of part of the relation.

Lean code for Definition4.2.7●1 definition
  • defdefined in Smith/Simulation.lean
    complete
    def Smith.fueled.{u} {S : Type u} (M : Smith.StepSys S) :
      Smith.StepSys (S × ℕ)
    def Smith.fueled.{u} {S : Type u}
      (M : Smith.StepSys S) :
      Smith.StepSys (S × ℕ)
    The fuelled system: a state together with a step budget.  One step
    consumes one unit of fuel; at fuel 0 the system is stuck. 

The relations of this chapter and of the two following ones (the chapter on System 5 to System 4 and the chapter on System 4 to System 3) are indexed by the remaining fuel.

The clause 1 <= k forbids a target that stands still. It does not by itself make a simulation meaningful: a relation that ignores the source is a ForwardSim for any target that never gets stuck. The content of each link is in its relation, which is a decoder graph or an encoding invariant, and the headline conclusions are stated as decoder equalities. docs/PLAN.md section 6 and the docstring of ForwardSim in Smith/Simulation.lean say this.

4.3. Doubling🔗

Smith emulates the doubled cyclic tag system (p. 18).

Definition4.3.1
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.2
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 10
Reverse dependency previews
Preview
Theorem 1.2.1
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

dbl w repeats every bit of a binary word w: dbl (b :: w) = b :: b :: dbl w.

Lean code for Definition4.3.1●1 definition
  • defdefined in Smith/Doubling.lean
    complete
    def Smith.dbl : List Bool → List Bool
    def Smith.dbl : List Bool → List Bool
    Each bit of a binary word twice. 
Definition4.3.2
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 7
Reverse dependency previews
Preview
Lemma 4.3.4
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

double C is the doubled cyclic tag system of C (a TagSystem.CTS): its appendants are the doubled appendants (Definition 4.3.1), each followed by a blank appendant, so it has twice as many appendants as C.

Lean code for Definition4.3.2●1 definition
  • defdefined in Smith/Doubling.lean
    complete
    def Smith.double (C : TagSystem.CTS) : TagSystem.CTS
    def Smith.double (C : TagSystem.CTS) :
      TagSystem.CTS
    The doubled cyclic tag system. 
Definition4.3.3
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 4
Reverse dependency previews
Preview
Lemma 4.3.4
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

dblCfg c doubles a cyclic tag configuration: the working string becomes dbl c.data (Definition 4.3.1) and the phase becomes 2 * c.phase.

Lean code for Definition4.3.3●1 definition
  • defdefined in Smith/Doubling.lean
    complete
    def Smith.dblCfg (c : TagSystem.CTSConfig) : TagSystem.CTSConfig
    def Smith.dblCfg (c : TagSystem.CTSConfig) :
      TagSystem.CTSConfig
    The doubled configuration: doubled working string, doubled phase. 
Lemma4.3.4
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 4
Statement dependency previews
Preview
Definition 4.2.3
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
Used by 2
Reverse dependency previews
Preview
Theorem 4.6.1
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

One original step is two doubled steps: the relation q = (dblCfg p.1, 2 * p.2) (Definition 4.3.3) is a forward simulation (Definition 4.2.3) from the fuelled (Definition 4.2.7) cyclic tag system C to the fuelled doubled system double C (Definition 4.3.2). It is stated on fueled systems so that one unit of original budget is two appendants.

Lean code for Lemma4.3.4●1 theorem
  • theoremdefined in Smith/Doubling.lean
    complete
    theorem Smith.double_forwardSim_fueled (C : TagSystem.CTS) :
      Smith.ForwardSim (Smith.fueled (Smith.ctsSys C))
        (Smith.fueled (Smith.ctsSys (Smith.double C))) fun p q =>
        q = (Smith.dblCfg p.1, 2 * p.2)
    theorem Smith.double_forwardSim_fueled
      (C : TagSystem.CTS) :
      Smith.ForwardSim
        (Smith.fueled (Smith.ctsSys C))
        (Smith.fueled
          (Smith.ctsSys (Smith.double C)))
        fun p q =>
        q = (Smith.dblCfg p.1, 2 * p.2)
    Link A between the fuelled systems: one step of the original with fuel
    `n + 1` is two steps of the doubled system with fuel `2 * (n + 1)`.  The
    fuel makes the finite budget a counter of the source system, so
    `ForwardSim` applies even though the budget runs out (PLAN.md M1 notes,
    the statement-shape decision of M2). 
Proof for Lemma 4.3.4
uses 0

By Smith.double_nSteps_two: two steps of the doubled system from dblCfg c are one step of C from c, the halting case included (the doubled working string is empty exactly when the original one is). The functional relation is lifted to the fuelled systems by Smith.ForwardSim_fueled_of_fun.

4.4. The relation🔗

Definition4.4.1
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 4
Reverse dependency previews
Preview
Definition 4.4.2
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

The gap between the two bag integers of one bit of the working string: 1 for a 0 bit and 2 for a 1 bit (p. 19).

Lean code for Definition4.4.1●1 definition
  • defdefined in Smith/Represents.lean
    complete
    def Smith.gap (b : Bool) : ℤ
    def Smith.gap (b : Bool) : ℤ
    The gap between the two bag integers of one bit of the working string:
    1 for a `0`, 2 for a `1` (TM23Proof.pdf p. 19). 
Definition4.4.2
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 3
Reverse dependency previews
Preview
Definition 4.4.6
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

pairsOf w a is the bag of a working string w given the lower integer of each bit: the i-th bit contributes a i and a i + gap (w i) (Definition 4.4.1).

Lean code for Definition4.4.2●1 definition
  • defdefined in Smith/Represents.lean
    complete
    def Smith.pairsOf : List Bool → List ℤ → List ℤ
    def Smith.pairsOf :
      List Bool → List ℤ → List ℤ
    The bag of a working string, given the lower integer of each bit.
    The `i`-th bit contributes `a i` and `a i + gap (w i)`. 
Definition4.4.3
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 3
Reverse dependency previews
Preview
Definition 4.4.6
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

pairsAsc lo w a says that the starts a are strictly increasing and leave room for the gaps (Definition 4.4.1): lo is below the first start, and the pair of one bit ends strictly below the start of the next. It is Bool-valued, hence decidable, and it is false when w and a differ in length.

Lean code for Definition4.4.3●1 definition
  • defdefined in Smith/Represents.lean
    complete
    def Smith.pairsAsc : ℤ → List Bool → List ℤ → Bool
    def Smith.pairsAsc :
      ℤ → List Bool → List ℤ → Bool
    The starts are strictly increasing and leave room for the gaps: `lo` is
    below the first start, and the pair of one bit ends strictly below the
    start of the next.  Bool-valued, hence decidable. 
Definition4.4.4
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 2
Reverse dependency previews
Preview
Definition 4.4.6
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

appendantsFrom C phase n lists the appendants a cyclic tag system C reads at the n consecutive phases starting at phase.

Lean code for Definition4.4.4●1 definition
  • defdefined in Smith/Represents.lean
    complete
    def Smith.appendantsFrom (C : TagSystem.CTS) (phase : ℕ) :
      ℕ → List (List Bool)
    def Smith.appendantsFrom (C : TagSystem.CTS)
      (phase : ℕ) : ℕ → List (List Bool)
    The appendants a cyclic tag system reads at the `n` consecutive phases
    starting at `phase`. 
Definition4.4.5
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 3
Reverse dependency previews
Preview
Definition 4.4.6
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

ruleBlocks ws i lays out the rule pairs of a list ws of (doubled) appendants from the counter i, threading the counter: two System 5 rules per appendant, the pair encodePaired w i of p. 19 read two bits at a time (a pair of 0s contributes i, i + 1 to the second rule and advances the counter by 4, a pair of 1s contributes i, i + 3 and advances it by 6), with r1 = r2 + 2 elementwise. It returns the rules and the counter after them.

Lean code for Definition4.4.5●1 definition
  • defdefined in Smith/Represents.lean
    complete
    def Smith.ruleBlocks : List (List Bool) → ℤ → List (List ℤ) × ℤ
    def Smith.ruleBlocks :
      List (List Bool) → ℤ → List (List ℤ) × ℤ
    The rule pairs of a list of (doubled) appendants, threading the rule
    counter: two System 5 rules per appendant. 
Definition4.4.6
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 4
Statement dependency previews
Preview
Definition 4.4.2
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
Used by 11
Reverse dependency previews
Preview
Lemma 4.4.10
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

Represents s C c budget relates a System 5 configuration s (BiTM.System5Config, a bag and a rule list) to a configuration c of a cyclic tag system C with a budget of appendants. The bag clause: there are starts a with pairsAsc 0 c.data a (Definition 4.4.3) such that s.bag is a permutation of pairsOf c.data a (Definition 4.4.2). The rules clause: there are a counter i and a tail rest such that x + 3 <= i for every x in the bag and s.rules = (ruleBlocks (appendantsFrom C c.phase budget) i).1 ++ rest (Definition 4.4.5, Definition 4.4.4).

Lean code for Definition4.4.6●1 definition
  • defdefined in Smith/Represents.lean
    complete
    def Smith.Represents (s : BiTM.System5Config) (C : TagSystem.CTS)
      (c : TagSystem.CTSConfig) (budget : ℕ) : Prop
    def Smith.Represents (s : BiTM.System5Config)
      (C : TagSystem.CTS)
      (c : TagSystem.CTSConfig) (budget : ℕ) :
      Prop
    `Represents s C c budget`: the System 5 configuration `s` is a
    canonically spaced acceptable initial condition (TM23Proof.pdf p. 19)
    for the DOUBLED cyclic tag system `C` in configuration `c`, good for at
    least `budget` further appendants.
    
    Clause one: the bag is a permutation of the pairs of some strictly
    increasing list of starts, one pair per bit of the working string, with
    a gap of 1 for a `0` and of 2 for a `1`, all above 0.
    
    Clause two: the rule list starts with the rule pairs of the `budget`
    appendants the system reads from the current phase onward, encoded from
    some counter `i` that sits at least 3 above every bag element, followed
    by an arbitrary unconstrained tail.  Existential in `i` and in the tail,
    so the clause survives a uniform increment of the rules and the dropping
    of consumed rule groups.
    
    Clause two pins the canonical `cy2s5.pl` spacing and is therefore a
    strict sub-relation of Smith's p. 19 condition, which allows any spacing
    of at least 3; see the fidelity note in the file header.  `C` must be a
    doubled system for the clause to be meaningful. 

This is Smith's "acceptable initial condition" of p. 19, not equality with the encoder output. The bag is, up to permutation, a list of pairs (x, x + gap b) with gap 1 for a 0 bit and 2 for a 1 bit, one pair per bit of the working string, at strictly increasing starts. The rules begin with the canonical blocks of the next budget appendants from the current phase, two rules per appendant with r1 = r2 + 2, laid out from a counter i at least 3 above every bag element, followed by anything (rest). Both clauses are relations, existential in the starts, the counter and the tail, which is what lets the relation survive a System 5 step. Doubling is a precondition: encodePaired reads an appendant two bits at a time and drops a trailing odd bit, so the rules clause is meaningful only for C = double C0, and every statement about Represents is over a doubled system.

Definition4.4.7
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 8
Reverse dependency previews
Preview
Definition 4.4.8
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

xorMerge xs ys merges two integer lists under parity semantics: each y of ys in turn is removed from the bag if it is present and added if it is not.

Lean code for Definition4.4.7●1 definition
  • defdefined in BiTM/XorMerge.lean
    complete
    def BiTM.xorMerge (xs ys : List ℤ) : List ℤ
    def BiTM.xorMerge (xs ys : List ℤ) : List ℤ
    XOR-merge two multisets under parity semantics: fold `xorInsert`. 
Definition4.4.8
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 7
Reverse dependency previews
Preview
Lemma 4.5.1
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

One step of System 5 (system5.pl, p. 30): every bag element is decremented and every rule element incremented. If the bag or the rule list is empty the step is none. If a 0 now appears in the bag, it is removed, and the first rule is XOR-merged into the bag (Definition 4.4.7) and dropped from the rule list; otherwise the step is the pure decrement. BiTM.System5.nSteps iterates it.

Lean code for Definition4.4.8●1 definition
  • defdefined in BiTM/System5.lean
    complete
    def BiTM.System5.step (cfg : BiTM.System5Config) : Option BiTM.System5Config
    def BiTM.System5.step
      (cfg : BiTM.System5Config) :
      Option BiTM.System5Config
    One step of System 5 per `TM23Proof.pdf` p. 30, `system5.pl`.
    Returns `none` when the system halts (bag empty or no rules left). 
Definition4.4.9
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 7
Reverse dependency previews
Preview
Lemma 4.4.10
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

The encoder, Smith's cy2s5.pl (p. 28-29). ctsToSystem5 C cfg N has as bag the working string of cfg doubled bit by bit into pairs from the counter 1, and as rules N full cycles over the appendants of C starting at the appendant the next step of C reads, each original appendant as a block of four System 5 rules (the two rules of its doubled appendant and the two empty rules of the blank appendant that follows it).

Lean code for Definition4.4.9●1 definition
  • defdefined in BiTM/CTSToSystem5.lean
    complete
    def BiTM.ctsToSystem5 (cts : TagSystem.CTS) (cfg : TagSystem.CTSConfig)
      (n : ℕ) : BiTM.System5Config
    def BiTM.ctsToSystem5 (cts : TagSystem.CTS)
      (cfg : TagSystem.CTSConfig) (n : ℕ) :
      BiTM.System5Config
    The CTS to System 5 encoder: working string as bag, `n` cycles of
    appendants as rules. 
Lemma4.4.10
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 4
Statement dependency previews
Preview
Definition 4.3.2
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
Used by 2
Reverse dependency previews
Preview
Theorem 4.6.2
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

The encoder output represents the doubled system: ctsToSystem5 C cfg N (Definition 4.4.9) satisfies Represents (Definition 4.4.6) with the doubled system double C (Definition 4.3.2), the doubled configuration dblCfg cfg (Definition 4.3.3) and the budget 2 * (C.appendants.length * N), the number of appendants of the doubled system times the number of cycles, with rest = []. Neither 1 <= N nor a nonempty working string is needed.

Lean code for Lemma4.4.10●1 theorem
  • theoremdefined in Smith/Represents.lean
    complete
    theorem Smith.ctsToSystem5_represents (C : TagSystem.CTS)
      (cfg : TagSystem.CTSConfig) (N : ℕ) :
      Smith.Represents (BiTM.ctsToSystem5 C cfg N) (Smith.double C)
        (Smith.dblCfg cfg) (2 * (C.appendants.length * N))
    theorem Smith.ctsToSystem5_represents
      (C : TagSystem.CTS)
      (cfg : TagSystem.CTSConfig) (N : ℕ) :
      Smith.Represents
        (BiTM.ctsToSystem5 C cfg N)
        (Smith.double C) (Smith.dblCfg cfg)
        (2 * (C.appendants.length * N))
    The canonical `cy2s5.pl` encoder output represents the doubled system.
    The budget is `2 * |appendants| * N`, the number of appendants of the
    doubled system times the number of full cycles the encoder emitted.
    
    Stronger than the form quoted in PLAN.md section 2: neither `1 <= N` nor
    `cfg.data <> []` is needed.  With those two hypotheses the relation is
    additionally non-degenerate, see `ctsToSystem5_represents_nontrivial`. 
Proof for Lemma 4.4.10
Proof uses 4
Proof dependency previews
Preview
Definition 4.4.2
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

The bag of the encoder is pairsOf (dbl cfg.data) at the starts the Perl counter produces from 1 (Definition 4.4.2, Definition 4.4.3), and its rules are the canonical blocks of the rotated appendant list from the counter after the working string plus 2 (Definition 4.4.5, Definition 4.4.4), a counter that is at least 3 above every bag integer, with the empty tail.

4.5. The step lemmas🔗

Smith/Conjecture5.lean proves the per-step lemma in the two cases of the head bit: one step of a doubled cyclic tag system is emulated by x + gap b steps of System 5, where x is the smallest bag integer and b the leading bit of the working string (p. 19-20). In both cases the first x - 1 steps are pure decrements and step x pops the first rule of the leading pair, which lands above the whole bag and is therefore appended.

Lemma4.5.1
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 4.4.6
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 1✓L∃∀N

The 0-head case. If s represents (Definition 4.4.6) the configuration with working string false :: w at phase p with budget n + 1, then there are k and a bag element x >= 1 below every bag element with k = x + 1, and System5.nSteps s k (Definition 4.4.8) is some s' that represents the configuration with working string w at phase (p + 1) % C.appendants.length with budget n, with exactly two rules fewer: s'.rules.length + 2 = s.rules.length.

Lean code for Lemma4.5.1●1 theorem
  • theoremdefined in Smith/Conjecture5.lean
    complete
    theorem Smith.represents_step_false_time (C : TagSystem.CTS) (w : List Bool)
      (p n : ℕ) (s : BiTM.System5Config)
      (h :
        Smith.Represents s C { data := false :: w, phase := p } (n + 1)) :
      ∃ k x,
        1 ≤ x ∧
          ↑k = x + 1 ∧
            x ∈ s.bag ∧
              (∀ (y : ℤ), y ∈ s.bag → x ≤ y) ∧
                ∃ s',
                  BiTM.System5.nSteps s k = some s' ∧
                    Smith.Represents s' C
                        { data := w,
                          phase := (p + 1) % C.appendants.length }
                        n ∧
                      s'.rules.length + 2 = s.rules.length
    theorem Smith.represents_step_false_time
      (C : TagSystem.CTS) (w : List Bool)
      (p n : ℕ) (s : BiTM.System5Config)
      (h :
        Smith.Represents s C
          { data := false :: w, phase := p }
          (n + 1)) :
      ∃ k x,
        1 ≤ x ∧
          ↑k = x + 1 ∧
            x ∈ s.bag ∧
              (∀ (y : ℤ), y ∈ s.bag → x ≤ y) ∧
                ∃ s',
                  BiTM.System5.nSteps s k =
                      some s' ∧
                    Smith.Represents s' C
                        { data := w,
                          phase :=
                            (p + 1) %
                              C.appendants.length }
                        n ∧
                      s'.rules.length + 2 =
                        s.rules.length
    One step of a doubled cyclic tag system whose working string begins with
    a `0` is emulated by `x + 1` steps of System 5, where `x` is the
    smallest bag integer.  The budget drops by one appendant and the phase
    advances by one, reduced modulo the number of appendants exactly as
    `CTS.step` reduces it.
    
    The time-pinned form: the step count is named, and `x` is exhibited as a
    bag element below every bag element, which is what fixes the schedule of
    the `ForwardSim` lifting. 
Proof for Lemma 4.5.1
Proof uses 2
Proof dependency previews
Preview
Definition 4.4.5
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

The bag's minimum x reaches 0 after x decrements and pops the first rule of the leading pair, which lands above the whole bag and is appended by xorMerge (Definition 4.4.7). The pair's second element pops the second rule one step later, and r1 = r2 + 2 (Definition 4.4.5) makes the two contributions cancel under xorMerge, so the bag is the rest of the old bag shifted down by x + 1, and the rule list is the remaining blocks in the same canonical layout from the counter shifted up by x + 1. The decomposition of Represents at a nonempty working string is Smith.Represents_cons_decomp; the run up to and including the first pop is Smith.System5_run_to_first_pop.

Lemma4.5.2
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 3
Statement dependency previews
Preview
Definition 4.3.1
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 1✓L∃∀N

The 1-head case. If the appendant of C at phase p is a doubled word dbl a (Definition 4.3.1) and s represents (Definition 4.4.6) the configuration with working string true :: w at phase p with budget n + 1, then there are k and a bag element x >= 1 below every bag element with k = x + 2, and System5.nSteps s k (Definition 4.4.8) is some s' that represents the configuration with working string w ++ dbl a at phase (p + 1) % C.appendants.length with budget n, again with s'.rules.length + 2 = s.rules.length.

Lean code for Lemma4.5.2●1 theorem
  • theoremdefined in Smith/Conjecture5.lean
    complete
    theorem Smith.represents_step_true_time (C : TagSystem.CTS) (w : List Bool)
      (p n : ℕ) (s : BiTM.System5Config) (a : List Bool)
      (happ : C.currentAppendant p = Smith.dbl a)
      (h : Smith.Represents s C { data := true :: w, phase := p } (n + 1)) :
      ∃ k x,
        1 ≤ x ∧
          ↑k = x + 2 ∧
            x ∈ s.bag ∧
              (∀ (y : ℤ), y ∈ s.bag → x ≤ y) ∧
                ∃ s',
                  BiTM.System5.nSteps s k = some s' ∧
                    Smith.Represents s' C
                        { data := w ++ Smith.dbl a,
                          phase := (p + 1) % C.appendants.length }
                        n ∧
                      s'.rules.length + 2 = s.rules.length
    theorem Smith.represents_step_true_time
      (C : TagSystem.CTS) (w : List Bool)
      (p n : ℕ) (s : BiTM.System5Config)
      (a : List Bool)
      (happ :
        C.currentAppendant p = Smith.dbl a)
      (h :
        Smith.Represents s C
          { data := true :: w, phase := p }
          (n + 1)) :
      ∃ k x,
        1 ≤ x ∧
          ↑k = x + 2 ∧
            x ∈ s.bag ∧
              (∀ (y : ℤ), y ∈ s.bag → x ≤ y) ∧
                ∃ s',
                  BiTM.System5.nSteps s k =
                      some s' ∧
                    Smith.Represents s' C
                        {
                          data :=
                            w ++ Smith.dbl a,
                          phase :=
                            (p + 1) %
                              C.appendants.length }
                        n ∧
                      s'.rules.length + 2 =
                        s.rules.length
    One step of a doubled cyclic tag system whose working string begins with
    a `1` is emulated by `x + 2` steps of System 5, where `x` is the
    smallest bag integer.  The appendant must be a doubled word, which is
    what `double_currentAppendant_dbl` supplies for a doubled system.
    
    The time-pinned form: the step count is named, and `x` is exhibited as a
    bag element below every bag element. 
Proof for Lemma 4.5.2
Proof uses 3
Proof dependency previews
Preview
Definition 4.4.7
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

Pops at x and x + 2, with a pure decrement in between. The two pops deposit the second rule's integers shifted by x and by x + 2; no two integers of a second rule are exactly 2 apart (Smith.encodePaired_snd_no_gap_two), so the two blocks are disjoint under xorMerge (Definition 4.4.7) and both survive, and together they are the canonical pairs of the doubled appendant (Lemma 4.5.3, Lemma 4.5.4). The new bag is the old one minus the consumed pair, shifted down by x + 2, followed by the pairs of the appended appendant, exactly as CTS.step appends it; the threshold x + 3 <= i is met with equality.

Lemma4.5.3
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0used by 1✓L∃∀N

Four blocks regroup: (A ++ X) ++ (B ++ Y) is a permutation of (A ++ B) ++ (X ++ Y). What the two pops deposit interleaved is what the canonical layout lists in one piece.

Lean code for Lemma4.5.3●1 theorem
  • theoremdefined in Smith/Conjecture5.lean
    complete
    theorem Smith.perm_append_shuffle (A X B Y : List ℤ) :
      (A ++ X ++ (B ++ Y)).Perm (A ++ B ++ (X ++ Y))
    theorem Smith.perm_append_shuffle
      (A X B Y : List ℤ) :
      (A ++ X ++ (B ++ Y)).Perm
        (A ++ B ++ (X ++ Y))
    Four blocks regroup: what the two pops deposit interleaved is what the
    canonical layout lists in one piece. 
Proof for Lemma 4.5.3
uses 0

Associativity of ++ and List.perm_append_comm for the middle two blocks.

Lemma4.5.4
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 1✓L∃∀N

The two shifted copies of the second rule of an appendant's encoding (BiTM.encodeAppendant a i), shifted by m and by m + 2, are together a permutation of the bag the working-string encoder of Definition 4.4.9 builds for the word a from the counter i + m (BiTM.ctsConfigToSystem5BagAux).

Lean code for Lemma4.5.4●1 theorem
  • theoremdefined in Smith/Conjecture5.lean
    complete
    theorem Smith.encodeAppendant_snd_bag_perm (a : List Bool) (i m : ℤ) :
      (List.map (fun x => x + m) (BiTM.encodeAppendant a i).2.1 ++
            List.map (fun x => x + (m + 2))
              (BiTM.encodeAppendant a i).2.1).Perm
        (BiTM.ctsConfigToSystem5BagAux a (i + m))
    theorem Smith.encodeAppendant_snd_bag_perm
      (a : List Bool) (i m : ℤ) :
      (List.map (fun x => x + m)
              (BiTM.encodeAppendant a
                    i).2.1 ++
            List.map (fun x => x + (m + 2))
              (BiTM.encodeAppendant a
                    i).2.1).Perm
        (BiTM.ctsConfigToSystem5BagAux a
          (i + m))
    The two shifted copies of the second rule of an appendant pair, the one
    the first pop left in the bag and the one the second pop adds, are
    together the canonical bag of that appendant. 
Proof for Lemma 4.5.4
uses 0

Induction on the word a, unfolding BiTM.encodeAppendant and BiTM.ctsConfigToSystem5BagAux one symbol at a time; the two shifted copies of each pair land where the working-string encoder puts them, up to the order of the list.

Both lemmas pin the step count (k = x + gap b) and, since milestone M6, also return that exactly two rules were consumed.

Lemma4.5.5
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 4.3.1
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 1✓L∃∀N

Every appendant of a doubled system double C (Definition 4.3.2) is a doubled word dbl a (Definition 4.3.1): the doubled appendant of C at an even phase, the blank appendant at an odd phase.

Lean code for Lemma4.5.5●1 theorem
  • theoremdefined in Smith/Conjecture5.lean
    complete
    theorem Smith.double_currentAppendant_dbl (C : TagSystem.CTS) (p : ℕ) :
      ∃ a, (Smith.double C).currentAppendant p = Smith.dbl a
    theorem Smith.double_currentAppendant_dbl
      (C : TagSystem.CTS) (p : ℕ) :
      ∃ a,
        (Smith.double C).currentAppendant p =
          Smith.dbl a
    Every appendant of a doubled system is a doubled word: the doubled
    appendant at an even phase, the blank one at an odd phase. 
Proof for Lemma 4.5.5
uses 0

By the definition of double: its appendant list alternates the doubled appendants of C with blank appendants, and both are doubled words (dbl a and dbl []).

Lemma4.5.6
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 3
Statement dependency previews
Preview
Definition 4.3.2
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
Used by 2
Reverse dependency previews
Preview
Theorem 4.6.1
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

Both cases at once, over a doubled system. If c.data is nonempty and s represents (Definition 4.4.6) c in double C0 (Definition 4.3.2) with budget n + 1, then for some k >= 1 the run System5.nSteps s k (Definition 4.4.8) is some s', the step (double C0).step c is some c', s' represents c' with budget n, and s'.rules.length + 2 = s.rules.length.

Lean code for Lemma4.5.6●1 theorem
  • theoremdefined in Smith/Conjecture5.lean
    complete
    theorem Smith.represents_step_double (C0 : TagSystem.CTS)
      (c : TagSystem.CTSConfig) (n : ℕ) (s : BiTM.System5Config)
      (hne : c.data ≠ [])
      (h : Smith.Represents s (Smith.double C0) c (n + 1)) :
      ∃ k,
        1 ≤ k ∧
          ∃ s',
            BiTM.System5.nSteps s k = some s' ∧
              ∃ c',
                (Smith.double C0).step c = some c' ∧
                  Smith.Represents s' (Smith.double C0) c' n ∧
                    s'.rules.length + 2 = s.rules.length
    theorem Smith.represents_step_double
      (C0 : TagSystem.CTS)
      (c : TagSystem.CTSConfig) (n : ℕ)
      (s : BiTM.System5Config)
      (hne : c.data ≠ [])
      (h :
        Smith.Represents s (Smith.double C0) c
          (n + 1)) :
      ∃ k,
        1 ≤ k ∧
          ∃ s',
            BiTM.System5.nSteps s k =
                some s' ∧
              ∃ c',
                (Smith.double C0).step c =
                    some c' ∧
                  Smith.Represents s'
                      (Smith.double C0) c' n ∧
                    s'.rules.length + 2 =
                      s.rules.length
    The per-step lemma of link B, both head bits at once: a System 5
    configuration representing a doubled cyclic tag system at a nonempty
    working string runs for at least one step into a configuration
    representing the cyclic tag step of that configuration, with one
    appendant less of budget.
    
    The hypothesis that the system is doubled is used exactly once, through
    `double_currentAppendant_dbl`: the 1-head case needs the appendant it
    appends to be a doubled word. 
Proof for Lemma 4.5.6
Proof uses 4
Proof dependency previews
Preview
Definition 4.4.1
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

Case on the head bit: Lemma 4.5.1 for a 0 and Lemma 4.5.2 for a 1, whose hypothesis that the appendant appended is dbl a for some a is supplied by Lemma 4.5.5, the one place the doubling is used. The step count is x + gap b (Definition 4.4.1), at least 1 since x >= 1.

4.6. Formal statements🔗

Theorem4.6.1
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 6
Statement dependency previews
Preview
Definition 4.2.3
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 1✓L∃∀N

For every cyclic tag system C0, the relation between a fuelled (Definition 4.2.7) cyclic tag state (c, f) and a System 5 configuration s that says s represents (Definition 4.4.6) the doubled configuration dblCfg c (Definition 4.3.3) in double C0 (Definition 4.3.2) with budget 2 * f is a forward simulation (Definition 4.2.3) from the fuelled system of C0 to System 5 (Definition 4.4.8).

Lean code for Theorem4.6.1●1 theorem
  • theoremdefined in Smith/ConjectureFive.lean
    complete
    theorem Smith.cts_system5_forwardSim (C0 : TagSystem.CTS) :
      Smith.ForwardSim (Smith.fueled (Smith.ctsSys C0)) Smith.system5Sys
        fun p s =>
        Smith.Represents s (Smith.double C0) (Smith.dblCfg p.1) (2 * p.2)
    theorem Smith.cts_system5_forwardSim
      (C0 : TagSystem.CTS) :
      Smith.ForwardSim
        (Smith.fueled (Smith.ctsSys C0))
        Smith.system5Sys fun p s =>
        Smith.Represents s (Smith.double C0)
          (Smith.dblCfg p.1) (2 * p.2)
    T1 for the original, undoubled cyclic tag system: `Represents` composed
    with the doubling of `Smith.Doubling`.  One original step is two doubled
    steps, so one unit of original fuel is two appendants of budget. 
Proof for Theorem 4.6.1
Proof uses 3
Proof dependency previews
Preview
Lemma 4.2.4
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

Lemma 4.2.4 of the doubling link Lemma 4.3.4 with the forward simulation from the fuelled doubled system into System 5 that Lemma 4.5.6 gives (Smith.represents_forwardSim, one unit of fuel per appendant of budget); the composite relation is read in its unpacked form by Smith.ForwardSim_congr.

Theorem4.6.2
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 5
Statement dependency previews
Preview
Definition 4.3.2
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
Used by 2
Reverse dependency previews
Preview
Corollary 4.6.7
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

T1, the finite form of Conjecture 5. For a cyclic tag system C0, a configuration cfg, a budget N and a run C0.nSteps cfg n = some c' of n steps with n <= C0.appendants.length * N, there is a schedule times with times 0 = 0 and times j < times (j + 1) for every j < n, such that for every j <= n there are the j-th cyclic tag configuration cj and a System 5 configuration sj reached from ctsToSystem5 C0 cfg N (Definition 4.4.9) in times j steps (Definition 4.4.8) with sj representing (Definition 4.4.6) dblCfg cj (Definition 4.3.3) in double C0 (Definition 4.3.2) with budget 2 * (C0.appendants.length * N - j).

Lean code for Theorem4.6.2●1 theorem
  • theoremdefined in Smith/ConjectureFive.lean
    complete
    theorem Smith.conjecture5_finite (C0 : TagSystem.CTS)
      (cfg : TagSystem.CTSConfig) (N n : ℕ)
      (hn : n ≤ C0.appendants.length * N) (c' : TagSystem.CTSConfig)
      (hrun : C0.nSteps cfg n = some c') :
      ∃ times,
        times 0 = 0 ∧
          (∀ (j : ℕ), j < n → times j < times (j + 1)) ∧
            ∀ (j : ℕ),
              j ≤ n →
                ∃ cj sj,
                  C0.nSteps cfg j = some cj ∧
                    BiTM.System5.nSteps (BiTM.ctsToSystem5 C0 cfg N)
                          (times j) =
                        some sj ∧
                      Smith.Represents sj (Smith.double C0)
                        (Smith.dblCfg cj)
                        (2 * (C0.appendants.length * N - j))
    theorem Smith.conjecture5_finite
      (C0 : TagSystem.CTS)
      (cfg : TagSystem.CTSConfig) (N n : ℕ)
      (hn : n ≤ C0.appendants.length * N)
      (c' : TagSystem.CTSConfig)
      (hrun : C0.nSteps cfg n = some c') :
      ∃ times,
        times 0 = 0 ∧
          (∀ (j : ℕ),
              j < n →
                times j < times (j + 1)) ∧
            ∀ (j : ℕ),
              j ≤ n →
                ∃ cj sj,
                  C0.nSteps cfg j = some cj ∧
                    BiTM.System5.nSteps
                          (BiTM.ctsToSystem5
                            C0 cfg N)
                          (times j) =
                        some sj ∧
                      Smith.Represents sj
                        (Smith.double C0)
                        (Smith.dblCfg cj)
                        (2 *
                          (C0.appendants.length *
                              N -
                            j))
    T1, the finite form of Conjecture 5 (PLAN.md section 2).  For every
    cyclic tag system `C0`, initial configuration `cfg` and budget `N`, the
    System 5 program `ctsToSystem5 C0 cfg N` emulates `C0` for every number
    of steps `n` the budget affords: there are strictly increasing times
    `times 0 = 0 < times 1 < ... < times n` such that after `times j` System
    5 steps the configuration represents the `j`-th cyclic tag
    configuration of the DOUBLED system, with `j` appendant pairs of budget
    consumed.
    
    `Represents` is Smith's p. 19 "acceptable initial condition" relation
    (in the canonical `cy2s5.pl` spacing, see the fidelity note of
    `Smith.Represents`), not equality with the encoder output. 
Proof for Theorem 4.6.2
Proof uses 4
Proof dependency previews
Preview
Definition 4.2.5
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

Lemma 4.2.6 applied to Theorem 4.6.1 from the initial pair (cfg, C0.appendants.length * N) and ctsToSystem5 C0 cfg N, related by Lemma 4.4.10. The run of the fuelled system is the run of C0 with the fuel counting down, so the schedule (Definition 4.2.5) unpacks to the three clauses.

Definition4.6.3
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 1✓L∃∀N

RepresentsExact s C c b is Represents s C c b (Definition 4.4.6) together with s.rules.length = 2 * b: the rule list is exactly two rules per appendant of budget long.

Lean code for Definition4.6.3●1 definition
  • complete
    def Smith.RepresentsExact (s : BiTM.System5Config) (C : TagSystem.CTS)
      (c : TagSystem.CTSConfig) (b : ℕ) : Prop
    def Smith.RepresentsExact
      (s : BiTM.System5Config)
      (C : TagSystem.CTS)
      (c : TagSystem.CTSConfig) (b : ℕ) : Prop
    `Represents` with the rule list exactly two rules per appendant of
    budget long. 
Theorem4.6.4
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1used by 1✓L∃∀N

T1 with the rule count. Under the hypotheses of Theorem 4.6.2, a schedule with the same three clauses and, at every scheduled time, in addition sj.rules.length = 2 * (2 * (C0.appendants.length * N - j)), that is RepresentsExact (Definition 4.6.3) at the remaining budget. At the end of the budget the rule list is empty.

Lean code for Theorem4.6.4●1 theorem
  • theoremdefined in Smith/ConjectureFive.lean
    complete
    theorem Smith.conjecture5_finite_exact (C0 : TagSystem.CTS)
      (cfg : TagSystem.CTSConfig) (N n : ℕ)
      (hn : n ≤ C0.appendants.length * N) (c' : TagSystem.CTSConfig)
      (hrun : C0.nSteps cfg n = some c') :
      ∃ times,
        times 0 = 0 ∧
          (∀ (j : ℕ), j < n → times j < times (j + 1)) ∧
            ∀ (j : ℕ),
              j ≤ n →
                ∃ cj sj,
                  C0.nSteps cfg j = some cj ∧
                    BiTM.System5.nSteps (BiTM.ctsToSystem5 C0 cfg N)
                          (times j) =
                        some sj ∧
                      Smith.Represents sj (Smith.double C0)
                          (Smith.dblCfg cj)
                          (2 * (C0.appendants.length * N - j)) ∧
                        sj.rules.length =
                          2 * (2 * (C0.appendants.length * N - j))
    theorem Smith.conjecture5_finite_exact
      (C0 : TagSystem.CTS)
      (cfg : TagSystem.CTSConfig) (N n : ℕ)
      (hn : n ≤ C0.appendants.length * N)
      (c' : TagSystem.CTSConfig)
      (hrun : C0.nSteps cfg n = some c') :
      ∃ times,
        times 0 = 0 ∧
          (∀ (j : ℕ),
              j < n →
                times j < times (j + 1)) ∧
            ∀ (j : ℕ),
              j ≤ n →
                ∃ cj sj,
                  C0.nSteps cfg j = some cj ∧
                    BiTM.System5.nSteps
                          (BiTM.ctsToSystem5
                            C0 cfg N)
                          (times j) =
                        some sj ∧
                      Smith.Represents sj
                          (Smith.double C0)
                          (Smith.dblCfg cj)
                          (2 *
                            (C0.appendants.length *
                                N -
                              j)) ∧
                        sj.rules.length =
                          2 *
                            (2 *
                              (C0.appendants.length *
                                  N -
                                j))
    T1 with the rule count: the schedule of `conjecture5_finite`, and at
    every scheduled time the rule list is exactly twice the remaining
    budget long; at the end of the budget it is empty. 
Proof for Theorem 4.6.4
Proof uses 4
Proof dependency previews
Preview
Lemma 4.2.6
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

The same lifting (Lemma 4.2.6) of the exact relation. The per-step lemma (Lemma 4.5.6) pops exactly two rules per appendant, so RepresentsExact is a forward simulation from the fuelled doubled system (Smith.represents_exact_forwardSim), composed with Lemma 4.3.4 into Smith.cts_system5_exact_forwardSim; and the encoder output has two rules per appendant of budget (Smith.ctsToSystem5_representsExact, from Lemma 4.4.10).

The exact variant is what T4 needs: at the end of the budget the rule list is empty, which is the terminal event of the System 4 emulation (the chapter on System 5 to System 4). Represents alone leaves the rules beyond the budget unconstrained.

Definition4.6.5
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 5
Reverse dependency previews
Preview
Lemma 4.6.6
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

The decoder of this link: sort the bag, then read it two integers at a time from the bound 0, a gap of 1 for a 0 bit and of 2 for a 1 bit (Definition 4.4.1); none on an odd-length bag, on a start not above the previous pair, or on a gap that is neither 1 nor 2.

Lean code for Definition4.6.5●1 definition
  • defdefined in Smith/System5Runs.lean
    complete
    def Smith.decodeBag (bag : List ℤ) : Option (List Bool)
    def Smith.decodeBag (bag : List ℤ) :
      Option (List Bool)
    The decoder of a System 5 bag: sort, then read pairs from the bound 0. 
Lemma4.6.6
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 4.4.6
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 1✓L∃∀N

A represented bag decodes to the working string it represents: from Represents s C c b (Definition 4.4.6) follows decodeBag s.bag = some c.data (Definition 4.6.5).

Lean code for Lemma4.6.6●1 theorem
  • theoremdefined in Smith/System5Runs.lean
    complete
    theorem Smith.Represents_decode (s : BiTM.System5Config) (C : TagSystem.CTS)
      (c : TagSystem.CTSConfig) (b : ℕ) (h : Smith.Represents s C c b) :
      Smith.decodeBag s.bag = some c.data
    theorem Smith.Represents_decode
      (s : BiTM.System5Config)
      (C : TagSystem.CTS)
      (c : TagSystem.CTSConfig) (b : ℕ)
      (h : Smith.Represents s C c b) :
      Smith.decodeBag s.bag = some c.data
    A represented bag decodes to the working string it represents. 
Proof for Lemma 4.6.6
Proof uses 2
Proof dependency previews
Preview
Definition 4.4.2
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

The bag is a permutation of pairsOf c.data a (Definition 4.4.2) for starts with pairsAsc 0 c.data a (Definition 4.4.3), a sorted list, so sorting the bag returns it, and the pair reader inverts pairsOf on ascending starts (Smith.decodeBag_of_perm).

Corollary4.6.7
Group: T1: System 5 emulates a doubled cyclic tag system. The encoder, the relation, the per-step lemmas and the finite form of Conjecture 5. (26)
Group member previews
Preview
Definition 4.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 4.3.1
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
used by 0✓L∃∀N

T1 in decoded form. Under the hypotheses of Theorem 4.6.2, a schedule with the same two clock clauses such that at every scheduled time decodeBag sj.bag = some (dbl cj.data) (Definition 4.6.5, Definition 4.3.1): the System 5 bag decodes to the doubled working string of the j-th cyclic tag configuration, with no existential over the pair starts left in the conclusion.

Lean code for Corollary4.6.7●1 theorem
  • theoremdefined in Smith/ConjectureFive.lean
    complete
    theorem Smith.conjecture5_decode (C0 : TagSystem.CTS)
      (cfg : TagSystem.CTSConfig) (N n : ℕ)
      (hn : n ≤ C0.appendants.length * N) (c' : TagSystem.CTSConfig)
      (hrun : C0.nSteps cfg n = some c') :
      ∃ times,
        times 0 = 0 ∧
          (∀ (j : ℕ), j < n → times j < times (j + 1)) ∧
            ∀ (j : ℕ),
              j ≤ n →
                ∃ cj sj,
                  C0.nSteps cfg j = some cj ∧
                    BiTM.System5.nSteps (BiTM.ctsToSystem5 C0 cfg N)
                          (times j) =
                        some sj ∧
                      Smith.decodeBag sj.bag = some (Smith.dbl cj.data)
    theorem Smith.conjecture5_decode
      (C0 : TagSystem.CTS)
      (cfg : TagSystem.CTSConfig) (N n : ℕ)
      (hn : n ≤ C0.appendants.length * N)
      (c' : TagSystem.CTSConfig)
      (hrun : C0.nSteps cfg n = some c') :
      ∃ times,
        times 0 = 0 ∧
          (∀ (j : ℕ),
              j < n →
                times j < times (j + 1)) ∧
            ∀ (j : ℕ),
              j ≤ n →
                ∃ cj sj,
                  C0.nSteps cfg j = some cj ∧
                    BiTM.System5.nSteps
                          (BiTM.ctsToSystem5
                            C0 cfg N)
                          (times j) =
                        some sj ∧
                      Smith.decodeBag sj.bag =
                        some
                          (Smith.dbl cj.data)
    The decoded form of T1: at every scheduled time the System 5 bag
    decodes, through `decodeBag` of `Smith.System5Runs`, to the doubled
    working string of the cyclic tag configuration at that step.  So the
    System 5 run reproduces the working strings of the cyclic tag run, with
    no existential over the pair starts left in the conclusion. 
Proof for Corollary 4.6.7
Proof uses 2
Proof dependency previews
Preview
Theorem 4.6.2
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

Theorem 4.6.2 and Lemma 4.6.6 at each scheduled time.

Represents is functional in the working string: one bag represents at most one string, whatever the cyclic tag system, the phase and the budget (Smith.Represents_data_unique).

4.7. Notes and caveats🔗

  • The times are pinned by pop events in the step lemmas (the run lasts x + gap b steps), but conjecture5_finite exposes only the existential schedule. The schedule is at least as fast as the source clock, n <= times n (Smith.conjecture5_times_ge), so it is not the degenerate constant one.

  • The rules clause of Represents pins the canonical cy2s5.pl spacing (consecutive rule pairs laid down contiguously, the counter advanced by 4 per doubled 0 and 6 per doubled 1), so the Lean relation is a strict sub-relation of Smith's p. 19 condition, which allows any spacing of at least 3. It is contained in Smith's, since the canonical layout meets each of his bounds with equality; the containment is strict, and the hand-built p. 19 program is the witness (Smith.pdf19, in the relation at budget 2 and out of it at budget 3). The restriction is adequate for T1 because the canonical layout is what the encoder emits and what one System 5 step re-establishes; relaxing it is not needed downstream.

  • System5.step is none when the bag or the rule list is empty. The review ran Smith's system5.pl and found the Lean and Perl runs agree step for step on the p. 31 example (36 iterations); the difference from Smith's prose about the terminal step is routed around on the System 4 side (Smith.repS4_terminal, the chapter on System 5 to System 4).

  • The p. 29 program (cy2s5.pl 3 01 1 10) is run through both step cases by decide in Smith/Conjecture5.lean and Vectors/SmithVectors.lean (D1 to D3).

4.8. Depends on🔗

The modules of this chapter are Smith.Simulation, Smith.Doubling, Smith.Represents, Smith.System5Runs, Smith.Conjecture5, Smith.ConjectureFive, BiTM.System5, BiTM.CTSToSystem5, BiTM.XorMerge and TagSystem.Basic. The cyclic tag systems themselves (TagSystem.CTS, TagSystem.CTSConfig, TagSystem.CTS.step, TagSystem.CTS.nSteps) are those of TagSystem/Basic.lean, the target of the chapter on the machine reduction. Nothing in this chapter depends on a node of another chapter. Downstream, Smith.conjecture4_cts of the chapter on System 5 to System 4 consumes Smith.conjecture5_finite, Smith.system4_emulation and Smith.conjecture0_finite of the chapter on Conjecture 0 consume Smith.conjecture5_finite_exact, and the decoders of the chapters on Conjecture 0 and on the infinite form (Smith.decodeW23, Smith.decodeTM) end in Smith.decodeBag.