Wolfram (2,3) universality in Lean

9. T8: the composition🔗

9.1. Orientation🔗

Smith/Universality.lean composes T7 (the chapter on the machine reduction) with T4 (the chapter on Conjecture 0) into Smith.wolfram23_universal_ic, stated in full in the overview. This chapter records how the composition is made, what the decoder is, how the initial condition IC tm c n is written down without running anything, and which of the referee's objections the statement answers and which it does not.

9.2. The decoder🔗

Definition9.2.1
Group: The decoder of T8 and the composition of T7 with T4 into the proof of the headline theorem. (3)
Group member previews
Preview
Lemma 9.2.2
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 1
Used by 2
Reverse dependency previews
Preview
Lemma 9.2.2
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

undbl takes a list of bits to an optional list of bits: the empty list to some [], a one-element list to none, and a :: b :: rest to undbl rest with a put in front when a = b, to none otherwise. It is the partial inverse of the doubling Definition 4.3.1: it inverts dbl on doubled words and returns none elsewhere.

Lean code for Definition9.2.1●1 definition
  • complete
    def Smith.undbl : List Bool → Option (List Bool)
    def Smith.undbl :
      List Bool → Option (List Bool)
    The inverse of `dbl` on doubled words; `none` on any other word. 
Lemma9.2.2
Group: The decoder of T8 and the composition of T7 with T4 into the proof of the headline theorem. (3)
Group member previews
Preview
Definition 9.2.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

For every list of bits w, Definition 9.2.1 of Definition 4.3.1 w is some w.

Lean code for Lemma9.2.2●1 theorem
  • theoremdefined in Smith/Universality.lean
    complete
    theorem Smith.undbl_dbl (w : List Bool) : Smith.undbl (Smith.dbl w) = some w
    theorem Smith.undbl_dbl (w : List Bool) :
      Smith.undbl (Smith.dbl w) = some w
Proof for Lemma 9.2.2
uses 0

Induction on w: dbl (a :: w) is a :: a :: dbl w, whose first two entries agree, so undbl strips the pair and recurses.

Definition9.2.3
Group: The decoder of T8 and the composition of T7 with T4 into the proof of the headline theorem. (3)
Group member previews
Preview
Definition 9.2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 3
Statement dependency previews
Preview
Definition 3.5.8
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
Used by 3
Reverse dependency previews
Preview
Theorem 1.2.1
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

decodeTM S N b takes a wolfram23 configuration to an optional machine configuration, the composite of three decoders: Definition 8.4.1 with block width N and band b reads the doubled cyclic tag word off the wolfram23 tape (the chapter on Conjecture 0); Definition 9.2.1 undoubles it; Definition 3.5.8 with S states reads the machine configuration off the cyclic tag word, taken as a cyclic tag configuration with phase 0 (the chapter on the machine reduction), up to trailing blanks. If any stage fails the result is none.

Lean code for Definition9.2.3●1 definition
  • complete
    def Smith.decodeTM (S N b : ℕ) (cfg : BiTM.Config) : Option BiTM.Config
    def Smith.decodeTM (S N b : ℕ)
      (cfg : BiTM.Config) : Option BiTM.Config
    The decoder of the wolfram23 tape for a machine with states below `S`:
    the doubled cyclic tag word (`decodeW23`, blocks of width `N`, band `b`),
    undoubled, read as a configuration of the machine (`decodeCTS`). 

decodeTM S N b is a fixed function of (S, N, b) and of the cells from the head up to the first 0 to its right; it does not see the machine, the input or the run.

9.3. The tag bounds🔗

Definition9.3.1
Group: The tag side of the closed-form initial condition: the Cocke-Minsky tag system runs for ever, and its time for n machine steps has a closed-form bound ( <missing> ). (3)
Group member previews
Preview
Lemma 9.3.2
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Theorem 3.3.15
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
Used by 3
Reverse dependency previews
Preview
Lemma 9.3.2
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

rawStep tm c is the step of the machine with the halting state 0 treated as an ordinary state (row 0 of the table, which Definition 3.4.12 keeps in range); rawRun tm c n is its n-th iterate. roundLen tm c is the number of tag steps the Cocke-Minsky tag system takes for one raw step from c (the round lengths of Theorem 3.3.15), and tagTime tm c n their sum over the first n raw steps.

Lean code for Definition9.3.1●4 definitions
  • complete
    def TagSystem.rawStep (tm : TM.Machine) (c : BiTM.Config) : BiTM.Config
    def TagSystem.rawStep (tm : TM.Machine)
      (c : BiTM.Config) : BiTM.Config
    The step of the machine with the halting state treated as an ordinary
    state: the one `BiTM.step` takes in every other state. 
  • complete
    def TagSystem.rawRun (tm : TM.Machine) (c : BiTM.Config) : ℕ → BiTM.Config
    def TagSystem.rawRun (tm : TM.Machine)
      (c : BiTM.Config) : ℕ → BiTM.Config
    The raw run. 
  • complete
    def TagSystem.roundLen (tm : TM.Machine) (c : BiTM.Config) : ℕ
    def TagSystem.roundLen (tm : TM.Machine)
      (c : BiTM.Config) : ℕ
    The number of tag steps of the round that carries out a raw step: three
    rounds for a move to the right, five for a move to the left, in the
    halves `m = val left` and `N = head + 2 val right` of the word. 
  • complete
    def TagSystem.tagTime (tm : TM.Machine) (c : BiTM.Config) : ℕ → ℕ
    def TagSystem.tagTime (tm : TM.Machine)
      (c : BiTM.Config) : ℕ → ℕ
    The tag time of `n` raw steps: the sum of their round lengths. 
Lemma9.3.2
Group: The tag side of the closed-form initial condition: the Cocke-Minsky tag system runs for ever, and its time for n machine steps has a closed-form bound ( <missing> ). (3)
Group member previews
Preview
Definition 9.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 2
Statement dependency previews
Preview
Definition 2.3.4
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
Used by 2
Reverse dependency previews
Preview
Theorem 1.2.1
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

While the machine runs, the raw run is its run: if BiTM.nSteps tm c n = some c' (Definition 2.3.4) then rawRun tm c n = c' (Definition 9.3.1). Raw steps keep a configuration valid with its state in range.

Lean code for Lemma9.3.2●3 theorems
  • theoremdefined in TagSystem/TagBounds.lean
    complete
    theorem TagSystem.rawRun_eq (tm : TM.Machine) (c : BiTM.Config) (n : ℕ)
      (c' : BiTM.Config) (h : BiTM.nSteps tm c n = some c') :
      TagSystem.rawRun tm c n = c'
    theorem TagSystem.rawRun_eq (tm : TM.Machine)
      (c : BiTM.Config) (n : ℕ)
      (c' : BiTM.Config)
      (h : BiTM.nSteps tm c n = some c') :
      TagSystem.rawRun tm c n = c'
    The raw run agrees with the machine's run as long as the machine runs. 
  • theoremdefined in TagSystem/TagBounds.lean
    complete
    theorem TagSystem.step_eq_rawStep (tm : TM.Machine) (c : BiTM.Config)
      (hq : c.state ≠ 0) : BiTM.step tm c = some (TagSystem.rawStep tm c)
    theorem TagSystem.step_eq_rawStep
      (tm : TM.Machine) (c : BiTM.Config)
      (hq : c.state ≠ 0) :
      BiTM.step tm c =
        some (TagSystem.rawStep tm c)
  • theoremdefined in TagSystem/TagBounds.lean
    complete
    theorem TagSystem.rawRun_valid (tm : TM.Machine) (hwf : TagSystem.WF tm)
      (c : BiTM.Config) (hv : TagSystem.ValidCfg c)
      (hst : c.state < tm.numStates) (n : ℕ) :
      TagSystem.ValidCfg (TagSystem.rawRun tm c n) ∧
        (TagSystem.rawRun tm c n).state < tm.numStates
    theorem TagSystem.rawRun_valid (tm : TM.Machine)
      (hwf : TagSystem.WF tm)
      (c : BiTM.Config)
      (hv : TagSystem.ValidCfg c)
      (hst : c.state < tm.numStates) (n : ℕ) :
      TagSystem.ValidCfg
          (TagSystem.rawRun tm c n) ∧
        (TagSystem.rawRun tm c n).state <
          tm.numStates
Proof for Lemma 9.3.2

Outside state 0, Definition 2.3.3 is some (rawStep tm c) (step_eq_rawStep); induction on n.

Lemma9.3.3
Group: The tag side of the closed-form initial condition: the Cocke-Minsky tag system runs for ever, and its time for n machine steps has a closed-form bound ( <missing> ). (3)
Group member previews
Preview
Definition 9.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 3
Statement dependency previews
Preview
Definition 3.3.5
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
Used by 2
Reverse dependency previews
Preview
Theorem 1.2.1
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

From the word of a valid configuration c with state in range, the tag system Definition 3.4.6 reaches, after tagTime tm c n steps (Definition 9.3.1), the word (Definition 3.3.5) of rawRun tm c n. In particular the tag run is defined for every number of steps (tag_run_total): it does not stop when the machine halts.

Lean code for Lemma9.3.3●3 theorems
  • theoremdefined in TagSystem/TagBounds.lean
    complete
    theorem TagSystem.tag_rawRun (tm : TM.Machine) (hwf : TagSystem.WF tm)
      (c : BiTM.Config) (hv : TagSystem.ValidCfg c)
      (hst : c.state < tm.numStates) (n : ℕ) :
      TagSystem.nStepsP (TagSystem.prod tm) (TagSystem.word c)
          (TagSystem.tagTime tm c n) =
        some (TagSystem.word (TagSystem.rawRun tm c n))
    theorem TagSystem.tag_rawRun (tm : TM.Machine)
      (hwf : TagSystem.WF tm)
      (c : BiTM.Config)
      (hv : TagSystem.ValidCfg c)
      (hst : c.state < tm.numStates) (n : ℕ) :
      TagSystem.nStepsP (TagSystem.prod tm)
          (TagSystem.word c)
          (TagSystem.tagTime tm c n) =
        some
          (TagSystem.word
            (TagSystem.rawRun tm c n))
    At tag time `tagTime c n` the tag run is at the word of the `n`-th raw
    configuration. 
  • theoremdefined in TagSystem/TagBounds.lean
    complete
    theorem TagSystem.raw_step_tag (tm : TM.Machine) (c : BiTM.Config)
      (hv : TagSystem.ValidCfg c)
      (hb : (tm.transition c.state c.head).write < 2) :
      TagSystem.nStepsP (TagSystem.prod tm) (TagSystem.word c)
          (TagSystem.roundLen tm c) =
        some (TagSystem.word (TagSystem.rawStep tm c))
    theorem TagSystem.raw_step_tag (tm : TM.Machine)
      (c : BiTM.Config)
      (hv : TagSystem.ValidCfg c)
      (hb :
        (tm.transition c.state c.head).write <
          2) :
      TagSystem.nStepsP (TagSystem.prod tm)
          (TagSystem.word c)
          (TagSystem.roundLen tm c) =
        some
          (TagSystem.word
            (TagSystem.rawStep tm c))
    The tag system carries out a raw step in `roundLen` steps, in every
    state (`tm_step_tag` without `q != 0`). 
  • theoremdefined in TagSystem/TagBounds.lean
    complete
    theorem TagSystem.tag_run_total (tm : TM.Machine) (hwf : TagSystem.WF tm)
      (c : BiTM.Config) (hv : TagSystem.ValidCfg c)
      (hst : c.state < tm.numStates) (t : ℕ) :
      ∃ w,
        TagSystem.nStepsP (TagSystem.prod tm) (TagSystem.word c) t = some w
    theorem TagSystem.tag_run_total (tm : TM.Machine)
      (hwf : TagSystem.WF tm)
      (c : BiTM.Config)
      (hv : TagSystem.ValidCfg c)
      (hst : c.state < tm.numStates) (t : ℕ) :
      ∃ w,
        TagSystem.nStepsP (TagSystem.prod tm)
            (TagSystem.word c) t =
          some w
    The tag run from the word of a valid configuration is defined for every
    number of steps. 
Proof for Lemma 9.3.3

The round lemmas of the machine reduction are stated for any state; only Theorem 3.3.15 needs q != 0, to unfold BiTM.step. raw_step_tag is the same composition of rounds for the raw step, whatever the state, in roundLen tag steps; induction on n.

Lemma9.3.4
Group: The tag side of the closed-form initial condition: the Cocke-Minsky tag system runs for ever, and its time for n machine steps has a closed-form bound ( <missing> ). (3)
Group member previews
Preview
Definition 9.3.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
uses 0
Used by 3
Reverse dependency previews
Preview
Theorem 1.2.1
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

For a valid configuration c with state in range, with sz c the number of explicit tape cells, tagTime tm c n <= n * 15 * 2 ^ (sz c + n).

Lean code for Lemma9.3.4●3 declarations
  • theoremdefined in TagSystem/TagBounds.lean
    complete
    theorem TagSystem.tagTime_le (tm : TM.Machine) (hwf : TagSystem.WF tm)
      (c : BiTM.Config) (hv : TagSystem.ValidCfg c)
      (hst : c.state < tm.numStates) (n : ℕ) :
      TagSystem.tagTime tm c n ≤ n * 15 * 2 ^ (TagSystem.sz c + n)
    theorem TagSystem.tagTime_le (tm : TM.Machine)
      (hwf : TagSystem.WF tm)
      (c : BiTM.Config)
      (hv : TagSystem.ValidCfg c)
      (hst : c.state < tm.numStates) (n : ℕ) :
      TagSystem.tagTime tm c n ≤
        n * 15 * 2 ^ (TagSystem.sz c + n)
    The tag time of `n` raw steps from a valid configuration, bounded by the
    size of the configuration and `n` alone. 
  • theoremdefined in TagSystem/TagBounds.lean
    complete
    theorem TagSystem.roundLen_le (tm : TM.Machine) (c : BiTM.Config)
      (hv : TagSystem.ValidCfg c) :
      TagSystem.roundLen tm c ≤ 15 * 2 ^ TagSystem.sz c
    theorem TagSystem.roundLen_le (tm : TM.Machine)
      (c : BiTM.Config)
      (hv : TagSystem.ValidCfg c) :
      TagSystem.roundLen tm c ≤
        15 * 2 ^ TagSystem.sz c
  • complete
    def TagSystem.sz (c : BiTM.Config) : ℕ
    def TagSystem.sz (c : BiTM.Config) : ℕ
    The number of explicit cells of a configuration off the head. 
Proof for Lemma 9.3.4
uses 0

A round costs at most five passes over the tag word, whose halves are the numbers val left and head + 2 val right, below 2 ^ sz c and 2 ^ (sz c + 1) (val_lt_two_pow), so roundLen c <= 15 * 2 ^ sz c; a raw step grows the tape by at most one cell (sz_rawStep), so the i-th raw configuration has sz <= sz c + i; sum over i < n.

9.4. The closed-form initial condition🔗

Definition9.4.1
Group: The decoder of T8 and the composition of T7 with T4 into the proof of the headline theorem. (3)
Group member previews
Preview
Definition 9.2.1
Loading preview
Group member preview content is loaded from the rendered-fragment cache.
Statement uses 5
Statement dependency previews
Preview
Definition 3.4.6
Loading preview
Statement dependency preview content is loaded from the rendered-fragment cache.
Used by 2
Reverse dependency previews
Preview
Theorem 1.2.1
Loading preview
Reverse dependency preview content is loaded from the rendered-fragment cache.
✓L∃∀N

ctsOf tm is the cyclic tag system Definition 3.4.8 of the tag system Definition 3.4.6 tm S of T7, with S = tm.numStates. The budget is icN c n = n * 15 * 2 ^ (sz c + n) cycles, the bound of Lemma 9.3.4; icProg tm c n is the System 5 program Definition 4.4.9 (ctsOf tm) (ctsOfCfg S c) (icN c n). The initial condition is IC tm c n = icStart (icProg tm c n) (Definition 8.6.1), with the width exponent ICw tm c n = icW (icProg tm c n) and the band ICb tm c n = icBand (icProg tm c n). Every part is an encoder applied to tm, c and n, or an arithmetic expression in the sizes of their outputs.

Lean code for Definition9.4.1●6 definitions
  • complete
    def Smith.IC (tm : TM.Machine) (c : BiTM.Config) (n : ℕ) : BiTM.Config
    def Smith.IC (tm : TM.Machine)
      (c : BiTM.Config) (n : ℕ) : BiTM.Config
    The closed-form initial condition for `n` steps of `tm` from `c`: every
    part of it (the tag system, the cyclic tag system, the System 5 program
    with `icN c n` cycles, the System 4 tape, the parity blocks of width
    `2 ^ ICw tm c n`) is computed from `tm`, `c` and `n` by the encoders
    and the closed-form parameters, without running any system. 
  • complete
    def Smith.ICw (tm : TM.Machine) (c : BiTM.Config) (n : ℕ) : ℕ
    def Smith.ICw (tm : TM.Machine)
      (c : BiTM.Config) (n : ℕ) : ℕ
    The width exponent of the parity blocks of `IC tm c n`. 
  • complete
    def Smith.ICb (tm : TM.Machine) (c : BiTM.Config) (n : ℕ) : ℕ
    def Smith.ICb (tm : TM.Machine)
      (c : BiTM.Config) (n : ℕ) : ℕ
    The band of the decoder for `IC tm c n`. 
  • complete
    def Smith.icN (c : BiTM.Config) (n : ℕ) : ℕ
    def Smith.icN (c : BiTM.Config) (n : ℕ) : ℕ
    The budget of the closed-form initial condition: a bound on the tag time
    of `n` machine steps from `c` (`tagTime_le`), in cycles of the cyclic
    tag system, one cycle per tag step. 
  • complete
    def Smith.icProg (tm : TM.Machine) (c : BiTM.Config) (n : ℕ) :
      BiTM.System5Config
    def Smith.icProg (tm : TM.Machine)
      (c : BiTM.Config) (n : ℕ) :
      BiTM.System5Config
    The System 5 program of the closed-form initial condition. 
  • complete
    def Smith.ctsOf (tm : TM.Machine) : TagSystem.CTS
    def Smith.ctsOf (tm : TM.Machine) :
      TagSystem.CTS
    The cyclic tag system of T7 for the machine `tm`. 

9.5. The composition🔗

The statement of the headline theorem is in the overview; its proof is the composition below.

Proof for Theorem 1.2.1
Proof uses 14
Proof dependency previews
Preview
Lemma 3.4.9
Loading preview
Proof dependency preview content is loaded from the rendered-fragment cache.

Write S for tm.numStates, K = 1 + 84 S, N = icN c n, and c_i for the i-th configuration of the run, BiTM.nSteps tm c i = some c_i.

The tag run from word c is defined for every number of steps (Lemma 9.3.3). The cyclic tag system ctsOf tm has 2 K appendants (Lemma 3.4.9) and makes exactly one cycle of them per tag step (Lemma 3.4.11): after 2 K t cyclic tag steps from Definition 3.4.14 S c its configuration encodes the tag word at time t (cts_run_tag). So the cyclic tag run lasts the budget of N cycles, and its last word is nonempty because the tag run goes on one step further, which needs a word of at least two symbols.

So T4 in closed form, Theorem 8.2.1, applies to ctsOf tm, ctsOfCfg S c and N; its tape icStart (icProg tm c n) is IC tm c n (Definition 9.4.1) and its width and band are ICw and ICb. It returns a schedule times' on the cyclic tag steps and the exit time T. The schedule of T8 is times i = times' (2 K tagTime tm c i): tagTime is strictly increasing (tagTime_strictMono) and tagTime tm c i <= tagTime tm c n <= N (Lemma 9.3.4), so the times are strictly increasing on [0, n] and at most T.

At cyclic tag time 2 K tagTime tm c i the tag word is word (rawRun tm c i) (Lemma 9.3.3), and rawRun tm c i = c_i (Lemma 9.3.2), so the cyclic tag configuration is ctsOfCfg S c_i. The decoders compose: Definition 8.4.1 returns Definition 4.3.1 of its data, undbl returns the data (Lemma 9.2.2), and decodeCTS returns canon c_i (Theorem 3.5.9, for a valid configuration with state below S, rawRun_valid). So Definition 9.2.3 S (2^w) b of the wolfram23 configuration at time times i is some (canon c_i) (Definition 3.5.7). The validity of the start, its state A, the confinement clause and the exit clause are those of conjecture0_closed, unchanged.

9.6. What the statement answers, and what it leaves open🔗

Answered by the statement as it stands:

  • The decoder is fixed and position-relative, and it is a left inverse of the encoders only at the scheduled times by the theorem; it is not a table lookup into tm or c.

  • The times are strictly increasing, the machine configurations are those of the given run (BiTM.nSteps tm c i = some ci), and confinement and exit are stated and proved.

  • No axiom beyond propext, Classical.choice, Quot.sound; no sorry; no native_decide in the cone.

Left open by the statement (the chapter on open items):

  • One tape per machine, configuration and budget n. The standard notion of universality asks for one encoding of (M, x) independent of the running time; the infinite form (the chapter on the infinite form, Smith.wolfram23_infinite_ic) gives it: one right-infinite tape ITape tm c per (M, x) with the whole run decodable.

  • The precomputed-tape objection (the conclusion template alone is met by a machine that only moves right over a tape on which the configurations have been laid out in advance) is answered by the closed form: the tape is the definition IC tm c n (or ITape tm c), which writes down encodings of the machine's description and evaluates closed-form bounds, and never runs the machine or the emulating systems. No theorem bounds the size of the tape or the cost of computing it; it is exponential in n and in the size of c, through the budget icN c n, and the System 5 bound icT5 is exponential again in the number of rules.

  • Binary machines only.

  • Decoding up to canon, at existential times, with nothing said about other times.

9.7. Notes and caveats🔗

  • No regression vector runs decodeTM on encoder output and gets a configuration back: with ICw the block width is far beyond decide, and a positive instance on a rendered tape needs the doubled encoding of a configuration word, at least 2 * 4 * (1 + 84 S) bits, hence a block of width at least 2^13 for S = 2, whose rendering builds its parity rows by iteration. undbl is covered by undbl_dbl and by the vectors of Vectors/TMToCTSVectors.lean (it inverts dbl, rejects an odd word and a word that is not doubled); decodeW23 by the D9 vectors of Vectors/SmithVectors.lean; decodeCTS, and the last two stages of decodeTM on the doubled encoding of a configuration, by Vectors/TMToCTSVectors.lean. On the D9 positive tape decodeTM returns none because the word there has odd length (one symbol); on the D10 tape it passes undbl with the word 0, which decodeCTS 2 rejects (Vectors/SmithVectors.lean D10). A hand-picked positive instance for decodeTM is still wanted (the chapter on open items).

9.8. Depends on🔗

This chapter depends on the modules Smith.Universality and TagSystem.TagBounds, and through them on the chapter on the machine reduction (T7: TagSystem.tm_step_tag, TagSystem.cts_of_tag, TagSystem.decodeCTS_word) and the chapter on Conjecture 0 (T4: Smith.conjecture0_closed, Smith.icStart, Smith.decodeW23).