Imports
/- Copyright (c) 2026 Google LLC. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. -/ module public import Cryptids.WeakCollatz41 public import Cryptids.Semantics.WeakCollatz75

WeakCollatz27 (weak_collatz_27)

The 27-state, 2-symbol Turing machine weak_collatz_27 compresses weak_collatz_41 (41 → 27 states, -14 states / -34.15%; 75 → 41 → 27 overall, -48 states / -64.00%) while constructively preserving blank-tape halting equivalence (candidate_equivalent, proved without Classical.choice).

Compression Ideas (41 → 27 states)

At canonical checkpoint stageCfg x y (x ≥ 1, y ≥ 1), the tape holds only two unary blocks 0^∞ 1^x 0 [1] 1^(y - 1) 0^∞ in state 24, with no step-counter block 1^c:

    Zero-Counter Cycle-Maximum Dovetailing: Instead of maintaining and copying a third unary counter block 1^c (tripleCfg + postDecCfg = 19 states in weak_collatz_41), stage x aborts and advances to x + 1 whenever y = 1 (exiting the trivial {1, 2} basin) or terras y > x (exceeding the candidate cycle maximum). Constructive finite pigeonhole shows:

      Every nontrivial cycle C attains a maximum M = max C ≥ 3 whose orbit stays inside [3, M] (3 ≤ terras^[t] M ≤ M for all t) and returns in 1 ≤ j ≤ M - 2 steps, so the smallest such cycle maximum halts;

      Conversely, if stage x ≥ 3 stayed inside [2, x - 1] for x rounds without hitting 1, its iterates would repeat a periodic point u ≥ 3 (u = 2 hits 1 next) whose entire cycle lies below x, contradicting absence of an earlier halting cycle maximum, even if divergent Collatz trajectories existed.

    Shared restCfg Stage-Advance Splitter: Both abort paths (y = 1 via 3-state doubler dblCfg, and z > x via rightward 0^∞ erasure of 1^(z - x) onto the 1^(2x) block already built during cmpCfg) feed 0^∞ [0] 1^(2(x + 1)) 0^∞ directly into restCfg 0 0 (x + 1), splitting 1^(2(x + 1)) into stageCfg (x + 1) (x + 1) with zero copy states.

    Zero-State Blank-Tape Warm-Up (53/53 Active Transitions Visited): Starting in state 0 on the blank tape enters restCfg 0 0 1 in 5 steps and naturally steps through stageCfg 1 1 (t = 18) and stageCfg 2 2 (t = 56, where 2 ↦ 1 ≠ 2 aborts at y = 1) into stageCfg 3 3 (t = 148) without dedicated boot states, visiting all 53 non-halting cells by step 507.

@[expose] public sectionnamespace ConjectureMachines.WeakCollatz27open Turing (Dir)open StateTransitionopen ErdosTernary15 (B0 B0_cons_zero nSteps nSteps_zero nSteps_succ nSteps_reaches nSteps_bind_eq step_one reaches_imp_nSteps nSteps_eq_none_of_step_none)open ErdosTernary14 (ones ones_succ' ones_add)local notation "mkL" => ErdosTernary15.Tape.mkL

41-state Weak Collatz reference machine (weak_collatz_41).

abbrev reference : BundledMachine 2 := Machines.weakCollatz41.bundle

27-state Weak Collatz candidate machine (weak_collatz_27).

abbrev candidate : BundledMachine 2 := Machines.weakCollatz27.bundle

The candidate as a Machine 27 2.

abbrev weakCollatz27 : Machine 27 2 := Machines.weakCollatz27private theorem mkL_B0 (R : ListBlank (Fin 2)) : mkL B0 R = ⟨0, B0, R⟩ := rflprivate theorem ones_zero (X : ListBlank (Fin 2)) : ones 0 X = X := rflprivate theorem ones_succ (k : ℕ) (X : ListBlank (Fin 2)) : ones (k + 1) X = (ones k X).cons 1 := rflprivate theorem stepR {q q' : Fin 27} {a b : Fin 2} (h : weakCollatz27.transition q a = some (b, .right, q')) (L R : ListBlank (Fin 2)) : step weakCollatz27 ⟨q, ⟨a, L, R⟩⟩ = some ⟨q', Tape.mk' (L.cons b) R⟩ := q:Fin 27q':Fin 27a:Fin 2b:Fin 2h:weakCollatz27.transition q a = some (b, Dir.right, q')L:ListBlank (Fin 2)R:ListBlank (Fin 2)⊢ step weakCollatz27 { state := q, tape := { head := a, left := L, right := R } } = some { state := q', tape := Tape.mk' (ListBlank.cons b L) R } q:Fin 27q':Fin 27a:Fin 2b:Fin 2h:weakCollatz27.transition q a = some (b, Dir.right, q')L:ListBlank (Fin 2)R:ListBlank (Fin 2)⊢ some { state := q', tape := Tape.move Dir.right (Tape.write b { head := a, left := L, right := R }) } = some { state := q', tape := Tape.mk' (ListBlank.cons b L) R }; All goals completed! 🐙private theorem stepL {q q' : Fin 27} {a b : Fin 2} (h : weakCollatz27.transition q a = some (b, .left, q')) (L R : ListBlank (Fin 2)) : step weakCollatz27 ⟨q, ⟨a, L, R⟩⟩ = some ⟨q', mkL L (R.cons b)⟩ := q:Fin 27q':Fin 27a:Fin 2b:Fin 2h:weakCollatz27.transition q a = some (b, Dir.left, q')L:ListBlank (Fin 2)R:ListBlank (Fin 2)⊢ step weakCollatz27 { state := q, tape := { head := a, left := L, right := R } } = some { state := q', tape := mkL L (ListBlank.cons b R) } q:Fin 27q':Fin 27a:Fin 2b:Fin 2h:weakCollatz27.transition q a = some (b, Dir.left, q')L:ListBlank (Fin 2)R:ListBlank (Fin 2)⊢ some { state := q', tape := Tape.move Dir.left (Tape.write b { head := a, left := L, right := R }) } = some { state := q', tape := mkL L (ListBlank.cons b R) }; All goals completed! 🐙

Transition Table

private theorem tr0_0 (L R) : step weakCollatz27 ⟨0, ⟨0, L, R⟩⟩ = some ⟨2, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr0_1 (L R) : step weakCollatz27 ⟨0, ⟨1, L, R⟩⟩ = some ⟨0, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr1_0 (L R) : step weakCollatz27 ⟨1, ⟨0, L, R⟩⟩ = some ⟨5, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr1_1 (L R) : step weakCollatz27 ⟨1, ⟨1, L, R⟩⟩ = some ⟨0, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr2_0 (L R) : step weakCollatz27 ⟨2, ⟨0, L, R⟩⟩ = some ⟨3, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr2_1 (L R) : step weakCollatz27 ⟨2, ⟨1, L, R⟩⟩ = some ⟨2, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr3_0 (L R) : step weakCollatz27 ⟨3, ⟨0, L, R⟩⟩ = some ⟨1, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr3_1 (L R) : step weakCollatz27 ⟨3, ⟨1, L, R⟩⟩ = some ⟨3, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr4_0 (L R) : step weakCollatz27 ⟨4, ⟨0, L, R⟩⟩ = some ⟨22, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr4_1 (L R) : step weakCollatz27 ⟨4, ⟨1, L, R⟩⟩ = some ⟨4, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr5_0 (L R) : step weakCollatz27 ⟨5, ⟨0, L, R⟩⟩ = some ⟨6, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr5_1 (L R) : step weakCollatz27 ⟨5, ⟨1, L, R⟩⟩ = some ⟨5, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr6_0 (L R) : step weakCollatz27 ⟨6, ⟨0, L, R⟩⟩ = some ⟨19, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr6_1 (L R) : step weakCollatz27 ⟨6, ⟨1, L, R⟩⟩ = some ⟨23, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr7_0 (L R) : step weakCollatz27 ⟨7, ⟨0, L, R⟩⟩ = some ⟨24, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr7_1 (L R) : step weakCollatz27 ⟨7, ⟨1, L, R⟩⟩ = some ⟨7, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr8_0 (L R) : step weakCollatz27 ⟨8, ⟨0, L, R⟩⟩ = some ⟨3, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr8_1 (L R) : step weakCollatz27 ⟨8, ⟨1, L, R⟩⟩ = some ⟨9, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr9_0 (L R) : step weakCollatz27 ⟨9, ⟨0, L, R⟩⟩ = some ⟨10, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr9_1 (L R) : step weakCollatz27 ⟨9, ⟨1, L, R⟩⟩ = some ⟨9, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr10_0 (L R) : step weakCollatz27 ⟨10, ⟨0, L, R⟩⟩ = some ⟨16, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr10_1 (L R) : step weakCollatz27 ⟨10, ⟨1, L, R⟩⟩ = some ⟨11, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr11_0 (L R) : step weakCollatz27 ⟨11, ⟨0, L, R⟩⟩ = some ⟨25, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr11_1 (L R) : step weakCollatz27 ⟨11, ⟨1, L, R⟩⟩ = some ⟨12, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr12_0 (L R) : step weakCollatz27 ⟨12, ⟨0, L, R⟩⟩ = some ⟨8, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr12_1 (L R) : step weakCollatz27 ⟨12, ⟨1, L, R⟩⟩ = some ⟨12, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr13_0 (L R) : step weakCollatz27 ⟨13, ⟨0, L, R⟩⟩ = some ⟨26, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr13_1 (L R) : step weakCollatz27 ⟨13, ⟨1, L, R⟩⟩ = some ⟨24, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr14_0 (L R) : step weakCollatz27 ⟨14, ⟨0, L, R⟩⟩ = some ⟨25, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr14_1 (L R) : step weakCollatz27 ⟨14, ⟨1, L, R⟩⟩ = some ⟨14, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr15_0 (L R) : step weakCollatz27 ⟨15, ⟨0, L, R⟩⟩ = some ⟨13, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr15_1 (L R) : step weakCollatz27 ⟨15, ⟨1, L, R⟩⟩ = some ⟨15, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr16_0 (L R) : step weakCollatz27 ⟨16, ⟨0, L, R⟩⟩ = some ⟨18, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr16_1 (L R) : step weakCollatz27 ⟨16, ⟨1, L, R⟩⟩ = some ⟨17, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr17_0 (L R) : step weakCollatz27 ⟨17, ⟨0, L, R⟩⟩ = some ⟨20, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr17_1 (L R) : step weakCollatz27 ⟨17, ⟨1, L, R⟩⟩ = some ⟨17, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr18_0 (L R : ListBlank (Fin 2)) : step weakCollatz27 ⟨18, ⟨0, L, R⟩⟩ = none := rflprivate theorem tr18_1 (L R) : step weakCollatz27 ⟨18, ⟨1, L, R⟩⟩ = some ⟨19, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr19_0 (L R) : step weakCollatz27 ⟨19, ⟨0, L, R⟩⟩ = some ⟨5, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr19_1 (L R) : step weakCollatz27 ⟨19, ⟨1, L, R⟩⟩ = some ⟨7, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr20_0 (L R) : step weakCollatz27 ⟨20, ⟨0, L, R⟩⟩ = some ⟨22, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr20_1 (L R) : step weakCollatz27 ⟨20, ⟨1, L, R⟩⟩ = some ⟨23, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr21_0 (L R) : step weakCollatz27 ⟨21, ⟨0, L, R⟩⟩ = some ⟨25, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr21_1 (L R) : step weakCollatz27 ⟨21, ⟨1, L, R⟩⟩ = some ⟨21, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr22_0 (L R) : step weakCollatz27 ⟨22, ⟨0, L, R⟩⟩ = some ⟨0, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr22_1 (L R) : step weakCollatz27 ⟨22, ⟨1, L, R⟩⟩ = some ⟨5, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr23_0 (L R) : step weakCollatz27 ⟨23, ⟨0, L, R⟩⟩ = some ⟨21, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr23_1 (L R) : step weakCollatz27 ⟨23, ⟨1, L, R⟩⟩ = some ⟨4, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr24_0 (L R) : step weakCollatz27 ⟨24, ⟨0, L, R⟩⟩ = some ⟨14, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr24_1 (L R) : step weakCollatz27 ⟨24, ⟨1, L, R⟩⟩ = some ⟨8, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr25_0 (L R) : step weakCollatz27 ⟨25, ⟨0, L, R⟩⟩ = some ⟨15, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr25_1 (L R) : step weakCollatz27 ⟨25, ⟨1, L, R⟩⟩ = some ⟨26, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr26_0 (L R) : step weakCollatz27 ⟨26, ⟨0, L, R⟩⟩ = some ⟨17, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr26_1 (L R) : step weakCollatz27 ⟨26, ⟨1, L, R⟩⟩ = some ⟨16, mkL L (R.cons 0)⟩ := stepL rfl L R

Sweep & Reachability Combinators

private def reachPos (c₁ c₂ : Cfg 27 2) : Prop := ∃ s : ℕ, 1 ≤ s ∧ nSteps weakCollatz27 s c₁ = some c₂private theorem reachPos_step {c₁ c₂ : Cfg 27 2} (h : step weakCollatz27 c₁ = some c₂) : reachPos c₁ c₂ := ⟨1, le_rfl, step_one h⟩private theorem reachPos_trans {c₁ c₂ c₃ : Cfg 27 2} (h₁ : reachPos c₁ c₂) (h₂ : reachPos c₂ c₃) : reachPos c₁ c₃ := c₁:Cfg 27 2c₂:Cfg 27 2c₃:Cfg 27 2h₁:reachPos c₁ c₂h₂:reachPos c₂ c₃⊢ reachPos c₁ c₃ c₁:Cfg 27 2c₂:Cfg 27 2c₃:Cfg 27 2h₂:reachPos c₂ c₃s₁:ℕhs₁:1 ≤ s₁heq₁:nSteps weakCollatz27 s₁ c₁ = some c₂⊢ reachPos c₁ c₃ c₁:Cfg 27 2c₂:Cfg 27 2c₃:Cfg 27 2s₁:ℕhs₁:1 ≤ s₁heq₁:nSteps weakCollatz27 s₁ c₁ = some c₂s₂:ℕhs₂:1 ≤ s₂heq₂:nSteps weakCollatz27 s₂ c₂ = some c₃⊢ reachPos c₁ c₃ exact ⟨s₁ + s₂, c₁:Cfg 27 2c₂:Cfg 27 2c₃:Cfg 27 2s₁:ℕhs₁:1 ≤ s₁heq₁:nSteps weakCollatz27 s₁ c₁ = some c₂s₂:ℕhs₂:1 ≤ s₂heq₂:nSteps weakCollatz27 s₂ c₂ = some c₃⊢ 1 ≤ s₁ + s₂ All goals completed! 🐙, nSteps_bind_eq heq₁ heq₂⟩private theorem step_then_reachPos {c₁ c₂ c₃ : Cfg 27 2} (h₁ : step weakCollatz27 c₁ = some c₂) (h₂ : reachPos c₂ c₃) : reachPos c₁ c₃ := reachPos_trans (reachPos_step h₁) h₂private theorem nSteps_then_reachPos {k : ℕ} {c₁ c₂ c₃ : Cfg 27 2} (h₁ : nSteps weakCollatz27 k c₁ = some c₂) (h₂ : reachPos c₂ c₃) : reachPos c₁ c₃ := k:ℕc₁:Cfg 27 2c₂:Cfg 27 2c₃:Cfg 27 2h₁:nSteps weakCollatz27 k c₁ = some c₂h₂:reachPos c₂ c₃⊢ reachPos c₁ c₃ k:ℕc₁:Cfg 27 2c₂:Cfg 27 2c₃:Cfg 27 2h₁:nSteps weakCollatz27 k c₁ = some c₂s:ℕhs:1 ≤ sheq:nSteps weakCollatz27 s c₂ = some c₃⊢ reachPos c₁ c₃ exact ⟨k + s, k:ℕc₁:Cfg 27 2c₂:Cfg 27 2c₃:Cfg 27 2h₁:nSteps weakCollatz27 k c₁ = some c₂s:ℕhs:1 ≤ sheq:nSteps weakCollatz27 s c₂ = some c₃⊢ 1 ≤ k + s All goals completed! 🐙, nSteps_bind_eq h₁ heq⟩private theorem reachPos_then_nSteps {k : ℕ} {c₁ c₂ c₃ : Cfg 27 2} (h₁ : reachPos c₁ c₂) (h₂ : nSteps weakCollatz27 k c₂ = some c₃) : reachPos c₁ c₃ := k:ℕc₁:Cfg 27 2c₂:Cfg 27 2c₃:Cfg 27 2h₁:reachPos c₁ c₂h₂:nSteps weakCollatz27 k c₂ = some c₃⊢ reachPos c₁ c₃ k:ℕc₁:Cfg 27 2c₂:Cfg 27 2c₃:Cfg 27 2h₂:nSteps weakCollatz27 k c₂ = some c₃s:ℕhs:1 ≤ sheq:nSteps weakCollatz27 s c₁ = some c₂⊢ reachPos c₁ c₃ exact ⟨s + k, k:ℕc₁:Cfg 27 2c₂:Cfg 27 2c₃:Cfg 27 2h₂:nSteps weakCollatz27 k c₂ = some c₃s:ℕhs:1 ≤ sheq:nSteps weakCollatz27 s c₁ = some c₂⊢ 1 ≤ s + k All goals completed! 🐙, nSteps_bind_eq heq h₂⟩private theorem sweep1R {q : Fin 27} (h : ∀ L R, step weakCollatz27 ⟨q, ⟨1, L, R⟩⟩ = some ⟨q, Tape.mk' (L.cons 1) R⟩) (k : ℕ) (L R : ListBlank (Fin 2)) : nSteps weakCollatz27 k ⟨q, Tape.mk' L (ones k R)⟩ = some ⟨q, Tape.mk' (ones k L) R⟩ := q:Fin 27h:∀ (L R : ListBlank (Fin 2)), step weakCollatz27 { state := q, tape := { head := 1, left := L, right := R } } = some { state := q, tape := Tape.mk' (ListBlank.cons 1 L) R }k:ℕL:ListBlank (Fin 2)R:ListBlank (Fin 2)⊢ nSteps weakCollatz27 k { state := q, tape := Tape.mk' L (ones k R) } = some { state := q, tape := Tape.mk' (ones k L) R } induction k generalizing L with q:Fin 27h:∀ (L R : ListBlank (Fin 2)), step weakCollatz27 { state := q, tape := { head := 1, left := L, right := R } } = some { state := q, tape := Tape.mk' (ListBlank.cons 1 L) R }R:ListBlank (Fin 2)L:ListBlank (Fin 2)⊢ nSteps weakCollatz27 0 { state := q, tape := Tape.mk' L (ones 0 R) } = some { state := q, tape := Tape.mk' (ones 0 L) R } All goals completed! 🐙 q:Fin 27h:∀ (L R : ListBlank (Fin 2)), step weakCollatz27 { state := q, tape := { head := 1, left := L, right := R } } = some { state := q, tape := Tape.mk' (ListBlank.cons 1 L) R }R:ListBlank (Fin 2)k:ℕih:∀ (L : ListBlank (Fin 2)), nSteps weakCollatz27 k { state := q, tape := Tape.mk' L (ones k R) } = some { state := q, tape := Tape.mk' (ones k L) R }L:ListBlank (Fin 2)⊢ nSteps weakCollatz27 (k + 1) { state := q, tape := Tape.mk' L (ones (k + 1) R) } = some { state := q, tape := Tape.mk' (ones (k + 1) L) R } All goals completed! 🐙private theorem sweep1L {q : Fin 27} (h : ∀ L R, step weakCollatz27 ⟨q, ⟨1, L, R⟩⟩ = some ⟨q, mkL L (R.cons 1)⟩) (k : ℕ) (L R : ListBlank (Fin 2)) : nSteps weakCollatz27 k ⟨q, mkL (ones k L) R⟩ = some ⟨q, mkL L (ones k R)⟩ := q:Fin 27h:∀ (L R : ListBlank (Fin 2)), step weakCollatz27 { state := q, tape := { head := 1, left := L, right := R } } = some { state := q, tape := mkL L (ListBlank.cons 1 R) }k:ℕL:ListBlank (Fin 2)R:ListBlank (Fin 2)⊢ nSteps weakCollatz27 k { state := q, tape := mkL (ones k L) R } = some { state := q, tape := mkL L (ones k R) } induction k generalizing R with q:Fin 27h:∀ (L R : ListBlank (Fin 2)), step weakCollatz27 { state := q, tape := { head := 1, left := L, right := R } } = some { state := q, tape := mkL L (ListBlank.cons 1 R) }L:ListBlank (Fin 2)R:ListBlank (Fin 2)⊢ nSteps weakCollatz27 0 { state := q, tape := mkL (ones 0 L) R } = some { state := q, tape := mkL L (ones 0 R) } All goals completed! 🐙 q:Fin 27h:∀ (L R : ListBlank (Fin 2)), step weakCollatz27 { state := q, tape := { head := 1, left := L, right := R } } = some { state := q, tape := mkL L (ListBlank.cons 1 R) }L:ListBlank (Fin 2)k:ℕih:∀ (R : ListBlank (Fin 2)), nSteps weakCollatz27 k { state := q, tape := mkL (ones k L) R } = some { state := q, tape := mkL L (ones k R) }R:ListBlank (Fin 2)⊢ nSteps weakCollatz27 (k + 1) { state := q, tape := mkL (ones (k + 1) L) R } = some { state := q, tape := mkL L (ones (k + 1) R) } All goals completed! 🐙private theorem erase1R {q : Fin 27} (h : ∀ L R, step weakCollatz27 ⟨q, ⟨1, L, R⟩⟩ = some ⟨q, Tape.mk' (L.cons 0) R⟩) (k : ℕ) (R : ListBlank (Fin 2)) : nSteps weakCollatz27 k ⟨q, Tape.mk' B0 (ones k R)⟩ = some ⟨q, Tape.mk' B0 R⟩ := q:Fin 27h:∀ (L R : ListBlank (Fin 2)), step weakCollatz27 { state := q, tape := { head := 1, left := L, right := R } } = some { state := q, tape := Tape.mk' (ListBlank.cons 0 L) R }k:ℕR:ListBlank (Fin 2)⊢ nSteps weakCollatz27 k { state := q, tape := Tape.mk' B0 (ones k R) } = some { state := q, tape := Tape.mk' B0 R } induction k with q:Fin 27h:∀ (L R : ListBlank (Fin 2)), step weakCollatz27 { state := q, tape := { head := 1, left := L, right := R } } = some { state := q, tape := Tape.mk' (ListBlank.cons 0 L) R }R:ListBlank (Fin 2)⊢ nSteps weakCollatz27 0 { state := q, tape := Tape.mk' B0 (ones 0 R) } = some { state := q, tape := Tape.mk' B0 R } All goals completed! 🐙 q:Fin 27h:∀ (L R : ListBlank (Fin 2)), step weakCollatz27 { state := q, tape := { head := 1, left := L, right := R } } = some { state := q, tape := Tape.mk' (ListBlank.cons 0 L) R }R:ListBlank (Fin 2)k:ℕih:nSteps weakCollatz27 k { state := q, tape := Tape.mk' B0 (ones k R) } = some { state := q, tape := Tape.mk' B0 R }⊢ nSteps weakCollatz27 (k + 1) { state := q, tape := Tape.mk' B0 (ones (k + 1) R) } = some { state := q, tape := Tape.mk' B0 R } All goals completed! 🐙

Canonical 2-Block Checkpoint, Restoration Splitter & Doubler

Canonical stage checkpoint: 0^∞ 1^x 0 [1] 1^(y - 1) 0^∞ in state 24.

private def stageCfg (x y : ℕ) : Cfg 27 2 := ⟨24, Tape.mk' ((ones x B0).cons 0) (ones y B0)⟩

Restoration / even-block splitter configuration: 0^∞ 1^u 0 1^v [0] 1^(2p) 0^∞ in state 5.

private def restCfg (u v p : ℕ) : Cfg 27 2 := ⟨5, Tape.mk' (ones v ((ones u B0).cons 0)) ((ones (2 * p) B0).cons 0)⟩private theorem rest_step (u v p : ℕ) : reachPos (restCfg u v (p + 1)) (restCfg (u + 1) (v + 1) p) := u:ℕv:ℕp:ℕ⊢ reachPos (restCfg u v (p + 1)) (restCfg (u + 1) (v + 1) p) u:ℕv:ℕp:ℕ⊢ reachPos { state := 5, tape := Tape.mk' (ones v (ListBlank.cons 0 (ones u B0))) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } { state := 5, tape := Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 5, tape := Tape.mk' (ones v (ListBlank.cons 0 (ones u B0))) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } { state := 5, tape := Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 5, tape := Tape.mk' (ones v Lu) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } { state := 5, tape := Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 5, tape := { head := 0, left := ones v Lu, right := ones (2 * (p + 1)) B0 } } { state := 5, tape := Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 6, tape := Tape.mk' (ListBlank.cons 1 (ones v Lu)) (ones (2 * (p + 1)) B0) } { state := 5, tape := Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 6, tape := { head := 1, left := ones (v + 1) Lu, right := ones (2 * p + 1) B0 } } { state := 5, tape := Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 23, tape := Tape.mk' (ListBlank.cons 1 (ones (v + 1) Lu)) (ones (2 * p + 1) B0) } { state := 5, tape := Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 23, tape := { head := 1, left := ones (v + 2) Lu, right := ones (2 * p) B0 } } { state := 5, tape := Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 4, tape := mkL (ones (v + 2) Lu) (ListBlank.cons 0 (ones (2 * p) B0)) } { state := 5, tape := Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 4, tape := mkL Lu (ones (v + 2) (ListBlank.cons 0 (ones (2 * p) B0))) } { state := 5, tape := Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 4, tape := mkL (ListBlank.cons 0 (ones u B0)) (ones (v + 2) (ListBlank.cons 0 (ones (2 * p) B0))) } { state := 5, tape := Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 4, tape := { head := 0, left := ones u B0, right := ones (v + 2) (ListBlank.cons 0 (ones (2 * p) B0)) } } { state := 5, tape := Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 22, tape := Tape.mk' (ListBlank.cons 1 (ones u B0)) (ones (v + 2) (ListBlank.cons 0 (ones (2 * p) B0))) } { state := 5, tape := Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 22, tape := { head := 1, left := ones (u + 1) B0, right := ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)) } } { state := 5, tape := Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)h22:reachPos { state := 22, tape := { head := 1, left := ones (u + 1) B0, right := ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)) } } { state := 5, tape := Tape.mk' (ListBlank.cons 0 (ones (u + 1) B0)) (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) }⊢ reachPos { state := 22, tape := { head := 1, left := ones (u + 1) B0, right := ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)) } } { state := 5, tape := Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } All goals completed! 🐙private theorem rest_many (u v p k : ℕ) : k = 0 ∨ reachPos (restCfg u v (p + k)) (restCfg (u + k) (v + k) p) := u:ℕv:ℕp:ℕk:ℕ⊢ k = 0 ∨ reachPos (restCfg u v (p + k)) (restCfg (u + k) (v + k) p) induction k generalizing u v with p:ℕu:ℕv:ℕ⊢ 0 = 0 ∨ reachPos (restCfg u v (p + 0)) (restCfg (u + 0) (v + 0) p) All goals completed! 🐙 p:ℕk:ℕih:∀ (u v : ℕ), k = 0 ∨ reachPos (restCfg u v (p + k)) (restCfg (u + k) (v + k) p)u:ℕv:ℕ⊢ k + 1 = 0 ∨ reachPos (restCfg u v (p + (k + 1))) (restCfg (u + (k + 1)) (v + (k + 1)) p) p:ℕk:ℕih:∀ (u v : ℕ), k = 0 ∨ reachPos (restCfg u v (p + k)) (restCfg (u + k) (v + k) p)u:ℕv:ℕ⊢ reachPos (restCfg u v (p + (k + 1))) (restCfg (u + (k + 1)) (v + (k + 1)) p) p:ℕk:ℕih:∀ (u v : ℕ), k = 0 ∨ reachPos (restCfg u v (p + k)) (restCfg (u + k) (v + k) p)u:ℕv:ℕ⊢ reachPos (restCfg u v (p + k + 1)) (restCfg (u + (k + 1)) (v + (k + 1)) p) p:ℕk:ℕih:∀ (u v : ℕ), k = 0 ∨ reachPos (restCfg u v (p + k)) (restCfg (u + k) (v + k) p)u:ℕv:ℕhfirst:reachPos (restCfg u v (p + k + 1)) (restCfg (u + 1) (v + 1) (p + k))⊢ reachPos (restCfg u v (p + k + 1)) (restCfg (u + (k + 1)) (v + (k + 1)) p) p:ℕu:ℕv:ℕih:∀ (u v : ℕ), 0 = 0 ∨ reachPos (restCfg u v (p + 0)) (restCfg (u + 0) (v + 0) p)hfirst:reachPos (restCfg u v (p + 0 + 1)) (restCfg (u + 1) (v + 1) (p + 0))⊢ reachPos (restCfg u v (p + 0 + 1)) (restCfg (u + (0 + 1)) (v + (0 + 1)) p)p:ℕk:ℕih:∀ (u v : ℕ), k = 0 ∨ reachPos (restCfg u v (p + k)) (restCfg (u + k) (v + k) p)u:ℕv:ℕhfirst:reachPos (restCfg u v (p + k + 1)) (restCfg (u + 1) (v + 1) (p + k))hrest:reachPos (restCfg (u + 1) (v + 1) (p + k)) (restCfg (u + 1 + k) (v + 1 + k) p)⊢ reachPos (restCfg u v (p + k + 1)) (restCfg (u + (k + 1)) (v + (k + 1)) p) p:ℕu:ℕv:ℕih:∀ (u v : ℕ), 0 = 0 ∨ reachPos (restCfg u v (p + 0)) (restCfg (u + 0) (v + 0) p)hfirst:reachPos (restCfg u v (p + 0 + 1)) (restCfg (u + 1) (v + 1) (p + 0))⊢ reachPos (restCfg u v (p + 0 + 1)) (restCfg (u + (0 + 1)) (v + (0 + 1)) p) p:ℕu:ℕv:ℕih:∀ (u v : ℕ), 0 = 0 ∨ reachPos (restCfg u v (p + 0)) (restCfg (u + 0) (v + 0) p)hfirst:reachPos (restCfg u v (p + 0 + 1)) (restCfg (u + 1) (v + 1) (p + 0))⊢ reachPos (restCfg u v (p + 1)) (restCfg (u + (0 + 1)) (v + (0 + 1)) p) All goals completed! 🐙 p:ℕk:ℕih:∀ (u v : ℕ), k = 0 ∨ reachPos (restCfg u v (p + k)) (restCfg (u + k) (v + k) p)u:ℕv:ℕhfirst:reachPos (restCfg u v (p + k + 1)) (restCfg (u + 1) (v + 1) (p + k))hrest:reachPos (restCfg (u + 1) (v + 1) (p + k)) (restCfg (u + 1 + k) (v + 1 + k) p)⊢ reachPos (restCfg u v (p + k + 1)) (restCfg (u + (k + 1)) (v + (k + 1)) p) p:ℕk:ℕih:∀ (u v : ℕ), k = 0 ∨ reachPos (restCfg u v (p + k)) (restCfg (u + k) (v + k) p)u:ℕv:ℕhfirst:reachPos (restCfg u v (p + k + 1)) (restCfg (u + 1) (v + 1) (p + k))hrest:reachPos (restCfg (u + 1) (v + 1) (p + k)) (restCfg (u + 1 + k) (v + 1 + k) p)⊢ reachPos (restCfg u v (p + k + 1)) (restCfg (u + 1 + k) (v + 1 + k) p) All goals completed! 🐙private theorem rest_exit (x z : ℕ) : reachPos (restCfg x z 0) (stageCfg x z) := x:ℕz:ℕ⊢ reachPos (restCfg x z 0) (stageCfg x z) x:ℕz:ℕ⊢ reachPos { state := 5, tape := Tape.mk' (ones z (ListBlank.cons 0 (ones x B0))) (ListBlank.cons 0 (ones (2 * 0) B0)) } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones x B0)) (ones z B0) } x:ℕz:ℕLx:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)⊢ reachPos { state := 5, tape := Tape.mk' (ones z (ListBlank.cons 0 (ones x B0))) (ListBlank.cons 0 (ones (2 * 0) B0)) } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones x B0)) (ones z B0) } x:ℕz:ℕLx:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)⊢ reachPos { state := 5, tape := Tape.mk' (ones z Lx) (ListBlank.cons 0 (ones (2 * 0) B0)) } { state := 24, tape := Tape.mk' Lx (ones z B0) } x:ℕz:ℕLx:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)⊢ reachPos { state := 5, tape := { head := 0, left := ones z Lx, right := B0 } } { state := 24, tape := Tape.mk' Lx (ones z B0) } x:ℕz:ℕLx:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)⊢ reachPos { state := 6, tape := Tape.mk' (ListBlank.cons 1 (ones z Lx)) B0 } { state := 24, tape := Tape.mk' Lx (ones z B0) } x:ℕz:ℕLx:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)⊢ reachPos { state := 6, tape := { head := 0, left := ListBlank.cons 1 (ones z Lx), right := B0 } } { state := 24, tape := Tape.mk' Lx (ones z B0) } x:ℕz:ℕLx:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)⊢ reachPos { state := 19, tape := mkL (ListBlank.cons 1 (ones z Lx)) (ListBlank.cons 0 B0) } { state := 24, tape := Tape.mk' Lx (ones z B0) } x:ℕz:ℕLx:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)⊢ reachPos { state := 19, tape := { head := 1, left := ones z Lx, right := B0 } } { state := 24, tape := Tape.mk' Lx (ones z B0) } x:ℕz:ℕLx:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)⊢ reachPos { state := 7, tape := mkL (ones z Lx) (ListBlank.cons 0 B0) } { state := 24, tape := Tape.mk' Lx (ones z B0) } x:ℕz:ℕLx:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)⊢ reachPos { state := 7, tape := mkL (ones z Lx) B0 } { state := 24, tape := Tape.mk' Lx (ones z B0) } x:ℕz:ℕLx:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)⊢ reachPos { state := 7, tape := mkL Lx (ones z B0) } { state := 24, tape := Tape.mk' Lx (ones z B0) } x:ℕz:ℕLx:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)⊢ reachPos { state := 7, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones z B0) } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones x B0)) (ones z B0) } x:ℕz:ℕLx:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)⊢ reachPos { state := 7, tape := { head := 0, left := ones x B0, right := ones z B0 } } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones x B0)) (ones z B0) } All goals completed! 🐙private theorem rest_from_zero (A : ℕ) (hA : 1 ≤ A) : reachPos (restCfg 0 0 A) (stageCfg A A) := A:ℕhA:1 ≤ A⊢ reachPos (restCfg 0 0 A) (stageCfg A A) hA:1 ≤ 0⊢ reachPos (restCfg 0 0 0) (stageCfg 0 0)A:ℕhA:1 ≤ Ahmany:reachPos (restCfg 0 0 (0 + A)) (restCfg (0 + A) (0 + A) 0)⊢ reachPos (restCfg 0 0 A) (stageCfg A A) hA:1 ≤ 0⊢ reachPos (restCfg 0 0 0) (stageCfg 0 0) hA:1 ≤ 0⊢ False; All goals completed! 🐙 A:ℕhA:1 ≤ Ahmany:reachPos (restCfg 0 0 (0 + A)) (restCfg (0 + A) (0 + A) 0)⊢ reachPos (restCfg 0 0 A) (stageCfg A A) A:ℕhA:1 ≤ Ahmany:reachPos (restCfg 0 0 A) (restCfg A A 0)⊢ reachPos (restCfg 0 0 A) (stageCfg A A) All goals completed! 🐙private def dblCfg (m p : ℕ) : Cfg 27 2 := ⟨1, mkL (ones m B0) ((ones (2 * p) B0).cons 0)⟩private theorem dbl_step (m p : ℕ) : reachPos (dblCfg (m + 1) p) (dblCfg m (p + 1)) := m:ℕp:ℕ⊢ reachPos (dblCfg (m + 1) p) (dblCfg m (p + 1)) m:ℕp:ℕ⊢ reachPos { state := 1, tape := mkL (ones (m + 1) B0) (ListBlank.cons 0 (ones (2 * p) B0)) } { state := 1, tape := mkL (ones m B0) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } m:ℕp:ℕ⊢ reachPos { state := 1, tape := { head := 1, left := ones m B0, right := ListBlank.cons 0 (ones (2 * p) B0) } } { state := 1, tape := mkL (ones m B0) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } m:ℕp:ℕ⊢ reachPos { state := 0, tape := Tape.mk' (ListBlank.cons 0 (ones m B0)) (ListBlank.cons 0 (ones (2 * p) B0)) } { state := 1, tape := mkL (ones m B0) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } m:ℕp:ℕ⊢ reachPos { state := 0, tape := { head := 0, left := ListBlank.cons 0 (ones m B0), right := ones (2 * p) B0 } } { state := 1, tape := mkL (ones m B0) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } m:ℕp:ℕ⊢ reachPos { state := 2, tape := Tape.mk' (ListBlank.cons 1 (ListBlank.cons 0 (ones m B0))) (ones (2 * p) B0) } { state := 1, tape := mkL (ones m B0) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } m:ℕp:ℕ⊢ reachPos { state := 2, tape := Tape.mk' (ones 1 (ListBlank.cons 0 (ones m B0))) (ones (2 * p) B0) } { state := 1, tape := mkL (ones m B0) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } m:ℕp:ℕ⊢ reachPos { state := 2, tape := Tape.mk' (ones (2 * p) (ones 1 (ListBlank.cons 0 (ones m B0)))) B0 } { state := 1, tape := mkL (ones m B0) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } m:ℕp:ℕ⊢ reachPos { state := 2, tape := { head := 0, left := ones (2 * p + 1) (ListBlank.cons 0 (ones m B0)), right := B0 } } { state := 1, tape := mkL (ones m B0) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } m:ℕp:ℕ⊢ reachPos { state := 3, tape := mkL (ones (2 * p + 1) (ListBlank.cons 0 (ones m B0))) (ListBlank.cons 1 B0) } { state := 1, tape := mkL (ones m B0) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } m:ℕp:ℕ⊢ reachPos { state := 3, tape := mkL (ones (2 * p + 1) (ListBlank.cons 0 (ones m B0))) (ones 1 B0) } { state := 1, tape := mkL (ones m B0) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } m:ℕp:ℕ⊢ reachPos { state := 3, tape := mkL (ListBlank.cons 0 (ones m B0)) (ones (2 * p + 1) (ones 1 B0)) } { state := 1, tape := mkL (ones m B0) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } m:ℕp:ℕ⊢ reachPos { state := 3, tape := { head := 0, left := ones m B0, right := ones (2 * (p + 1)) B0 } } { state := 1, tape := mkL (ones m B0) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } All goals completed! 🐙private theorem dbl_many (m p : ℕ) : m = 0 ∨ reachPos (dblCfg m p) (dblCfg 0 (p + m)) := m:ℕp:ℕ⊢ m = 0 ∨ reachPos (dblCfg m p) (dblCfg 0 (p + m)) induction m generalizing p with p:ℕ⊢ 0 = 0 ∨ reachPos (dblCfg 0 p) (dblCfg 0 (p + 0)) All goals completed! 🐙 m:ℕih:∀ (p : ℕ), m = 0 ∨ reachPos (dblCfg m p) (dblCfg 0 (p + m))p:ℕ⊢ m + 1 = 0 ∨ reachPos (dblCfg (m + 1) p) (dblCfg 0 (p + (m + 1))) m:ℕih:∀ (p : ℕ), m = 0 ∨ reachPos (dblCfg m p) (dblCfg 0 (p + m))p:ℕ⊢ reachPos (dblCfg (m + 1) p) (dblCfg 0 (p + (m + 1))) p:ℕih:∀ (p : ℕ), 0 = 0 ∨ reachPos (dblCfg 0 p) (dblCfg 0 (p + 0))⊢ reachPos (dblCfg (0 + 1) p) (dblCfg 0 (p + (0 + 1)))m:ℕih:∀ (p : ℕ), m = 0 ∨ reachPos (dblCfg m p) (dblCfg 0 (p + m))p:ℕhrest:reachPos (dblCfg m (p + 1)) (dblCfg 0 (p + 1 + m))⊢ reachPos (dblCfg (m + 1) p) (dblCfg 0 (p + (m + 1))) p:ℕih:∀ (p : ℕ), 0 = 0 ∨ reachPos (dblCfg 0 p) (dblCfg 0 (p + 0))⊢ reachPos (dblCfg (0 + 1) p) (dblCfg 0 (p + (0 + 1))) p:ℕih:∀ (p : ℕ), 0 = 0 ∨ reachPos (dblCfg 0 p) (dblCfg 0 (p + 0))⊢ reachPos (dblCfg 1 p) (dblCfg 0 (p + 1)) All goals completed! 🐙 m:ℕih:∀ (p : ℕ), m = 0 ∨ reachPos (dblCfg m p) (dblCfg 0 (p + m))p:ℕhrest:reachPos (dblCfg m (p + 1)) (dblCfg 0 (p + 1 + m))⊢ reachPos (dblCfg (m + 1) p) (dblCfg 0 (p + (m + 1))) m:ℕih:∀ (p : ℕ), m = 0 ∨ reachPos (dblCfg m p) (dblCfg 0 (p + m))p:ℕhrest:reachPos (dblCfg m (p + 1)) (dblCfg 0 (p + 1 + m))⊢ reachPos (dblCfg (m + 1) p) (dblCfg 0 (p + 1 + m)) All goals completed! 🐙private theorem stage_y1_advance (x : ℕ) (hx : 1 ≤ x) : reachPos (stageCfg x 1) (stageCfg (x + 1) (x + 1)) := x:ℕhx:1 ≤ x⊢ reachPos (stageCfg x 1) (stageCfg (x + 1) (x + 1)) x:ℕhx:1 ≤ x⊢ reachPos { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones x B0)) (ones 1 B0) } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ x⊢ reachPos { state := 24, tape := { head := 1, left := ListBlank.cons 0 (ones x B0), right := B0 } } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ x⊢ reachPos { state := 8, tape := Tape.mk' (ListBlank.cons 1 (ListBlank.cons 0 (ones x B0))) B0 } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ x⊢ reachPos { state := 8, tape := { head := 0, left := ListBlank.cons 1 (ListBlank.cons 0 (ones x B0)), right := B0 } } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ x⊢ reachPos { state := 3, tape := mkL (ListBlank.cons 1 (ListBlank.cons 0 (ones x B0))) (ListBlank.cons 1 B0) } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ x⊢ reachPos { state := 3, tape := mkL (ones 1 (ListBlank.cons 0 (ones x B0))) (ones 1 B0) } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ x⊢ reachPos { state := 3, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones 1 (ones 1 B0)) } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ x⊢ reachPos { state := 3, tape := { head := 0, left := ones x B0, right := ones (2 * 1) B0 } } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ x⊢ reachPos { state := 1, tape := mkL (ones x B0) (ListBlank.cons 0 (ones (2 * 1) B0)) } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ x⊢ reachPos (dblCfg x 1) { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } hx:1 ≤ 0⊢ reachPos (dblCfg 0 1) { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (0 + 1) B0)) (ones (0 + 1) B0) }x:ℕhx:1 ≤ xhmany:reachPos (dblCfg x 1) (dblCfg 0 (1 + x))⊢ reachPos (dblCfg x 1) { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } hx:1 ≤ 0⊢ reachPos (dblCfg 0 1) { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (0 + 1) B0)) (ones (0 + 1) B0) } hx:1 ≤ 0⊢ False; All goals completed! 🐙 x:ℕhx:1 ≤ xhmany:reachPos (dblCfg x 1) (dblCfg 0 (1 + x))⊢ reachPos (dblCfg x 1) { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ xhmany:reachPos (dblCfg x 1) (dblCfg 0 (x + 1))⊢ reachPos (dblCfg x 1) { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ xhmany:reachPos (dblCfg x 1) (dblCfg 0 (x + 1))⊢ reachPos (dblCfg 0 (x + 1)) { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ xhmany:reachPos (dblCfg x 1) (dblCfg 0 (x + 1))⊢ reachPos { state := 1, tape := mkL (ones 0 B0) (ListBlank.cons 0 (ones (2 * (x + 1)) B0)) } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ xhmany:reachPos (dblCfg x 1) (dblCfg 0 (x + 1))⊢ reachPos { state := 1, tape := { head := 0, left := B0, right := ListBlank.cons 0 (ones (2 * (x + 1)) B0) } } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ xhmany:reachPos (dblCfg x 1) (dblCfg 0 (x + 1))⊢ reachPos { state := 5, tape := Tape.mk' (ListBlank.cons 0 B0) (ListBlank.cons 0 (ones (2 * (x + 1)) B0)) } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ xhmany:reachPos (dblCfg x 1) (dblCfg 0 (x + 1))hrest_eq:{ state := 5, tape := Tape.mk' (ListBlank.cons 0 B0) (ListBlank.cons 0 (ones (2 * (x + 1)) B0)) } = restCfg 0 0 (x + 1)⊢ reachPos { state := 5, tape := Tape.mk' (ListBlank.cons 0 B0) (ListBlank.cons 0 (ones (2 * (x + 1)) B0)) } { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } x:ℕhx:1 ≤ xhmany:reachPos (dblCfg x 1) (dblCfg 0 (x + 1))hrest_eq:{ state := 5, tape := Tape.mk' (ListBlank.cons 0 B0) (ListBlank.cons 0 (ones (2 * (x + 1)) B0)) } = restCfg 0 0 (x + 1)⊢ reachPos (restCfg 0 0 (x + 1)) { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones (x + 1) B0) } exact rest_from_zero (x + 1) (x:ℕhx:1 ≤ xhmany:reachPos (dblCfg x 1) (dblCfg 0 (x + 1))hrest_eq:{ state := 5, tape := Tape.mk' (ListBlank.cons 0 B0) (ListBlank.cons 0 (ones (2 * (x + 1)) B0)) } = restCfg 0 0 (x + 1)⊢ 1 ≤ x + 1 All goals completed! 🐙)

Zero-Gap In-Place terras Evaluation (y ≥ 2)

private def evenCfg (L0 : ListBlank (Fin 2)) (a b : ℕ) : Cfg 27 2 := ⟨9, Tape.mk' ((ones a L0).cons 0) (ones b B0)⟩private theorem even_step (L0 : ListBlank (Fin 2)) (a b : ℕ) : reachPos (evenCfg L0 a (b + 2)) (evenCfg L0 (a + 1) b) := L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos (evenCfg L0 a (b + 2)) (evenCfg L0 (a + 1) b) L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ones a L0)) (ones (b + 2) B0) } { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 9, tape := Tape.mk' (ones (b + 2) (ListBlank.cons 0 (ones a L0))) B0 } { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 9, tape := { head := 0, left := ones (b + 2) (ListBlank.cons 0 (ones a L0)), right := B0 } } { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 10, tape := mkL (ones (b + 2) (ListBlank.cons 0 (ones a L0))) (ListBlank.cons 0 B0) } { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 10, tape := { head := 1, left := ones (b + 1) (ListBlank.cons 0 (ones a L0)), right := B0 } } { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 11, tape := mkL (ones (b + 1) (ListBlank.cons 0 (ones a L0))) (ListBlank.cons 0 B0) } { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 11, tape := { head := 1, left := ones b (ListBlank.cons 0 (ones a L0)), right := B0 } } { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 12, tape := mkL (ones b (ListBlank.cons 0 (ones a L0))) (ListBlank.cons 1 B0) } { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 12, tape := mkL (ones b (ListBlank.cons 0 (ones a L0))) (ones 1 B0) } { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 12, tape := mkL (ListBlank.cons 0 (ones a L0)) (ones b (ones 1 B0)) } { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 12, tape := { head := 0, left := ones a L0, right := ones (b + 1) B0 } } { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 8, tape := Tape.mk' (ListBlank.cons 1 (ones a L0)) (ones (b + 1) B0) } { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 8, tape := { head := 1, left := ones (a + 1) L0, right := ones b B0 } } { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } All goals completed! 🐙private theorem even_many (L0 : ListBlank (Fin 2)) (a k r : ℕ) : k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r) := L0:ListBlank (Fin 2)a:ℕk:ℕr:ℕ⊢ k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r) induction k generalizing a with L0:ListBlank (Fin 2)r:ℕa:ℕ⊢ 0 = 0 ∨ reachPos (evenCfg L0 a (2 * 0 + r)) (evenCfg L0 (a + 0) r) All goals completed! 🐙 L0:ListBlank (Fin 2)r:ℕk:ℕih:∀ (a : ℕ), k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r)a:ℕ⊢ k + 1 = 0 ∨ reachPos (evenCfg L0 a (2 * (k + 1) + r)) (evenCfg L0 (a + (k + 1)) r) L0:ListBlank (Fin 2)r:ℕk:ℕih:∀ (a : ℕ), k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r)a:ℕ⊢ reachPos (evenCfg L0 a (2 * (k + 1) + r)) (evenCfg L0 (a + (k + 1)) r) L0:ListBlank (Fin 2)r:ℕk:ℕih:∀ (a : ℕ), k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r)a:ℕ⊢ reachPos (evenCfg L0 a (2 * k + r + 2)) (evenCfg L0 (a + (k + 1)) r) L0:ListBlank (Fin 2)r:ℕa:ℕih:∀ (a : ℕ), 0 = 0 ∨ reachPos (evenCfg L0 a (2 * 0 + r)) (evenCfg L0 (a + 0) r)⊢ reachPos (evenCfg L0 a (2 * 0 + r + 2)) (evenCfg L0 (a + (0 + 1)) r)L0:ListBlank (Fin 2)r:ℕk:ℕih:∀ (a : ℕ), k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r)a:ℕhrest:reachPos (evenCfg L0 (a + 1) (2 * k + r)) (evenCfg L0 (a + 1 + k) r)⊢ reachPos (evenCfg L0 a (2 * k + r + 2)) (evenCfg L0 (a + (k + 1)) r) L0:ListBlank (Fin 2)r:ℕa:ℕih:∀ (a : ℕ), 0 = 0 ∨ reachPos (evenCfg L0 a (2 * 0 + r)) (evenCfg L0 (a + 0) r)⊢ reachPos (evenCfg L0 a (2 * 0 + r + 2)) (evenCfg L0 (a + (0 + 1)) r) L0:ListBlank (Fin 2)r:ℕa:ℕih:∀ (a : ℕ), 0 = 0 ∨ reachPos (evenCfg L0 a (2 * 0 + r)) (evenCfg L0 (a + 0) r)⊢ reachPos (evenCfg L0 a (r + 2)) (evenCfg L0 (a + 1) r) All goals completed! 🐙 L0:ListBlank (Fin 2)r:ℕk:ℕih:∀ (a : ℕ), k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r)a:ℕhrest:reachPos (evenCfg L0 (a + 1) (2 * k + r)) (evenCfg L0 (a + 1 + k) r)⊢ reachPos (evenCfg L0 a (2 * k + r + 2)) (evenCfg L0 (a + (k + 1)) r) L0:ListBlank (Fin 2)r:ℕk:ℕih:∀ (a : ℕ), k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r)a:ℕhrest:reachPos (evenCfg L0 (a + 1) (2 * k + r)) (evenCfg L0 (a + 1 + k) r)⊢ reachPos (evenCfg L0 a (2 * k + r + 2)) (evenCfg L0 (a + 1 + k) r) All goals completed! 🐙private def oddCfg (L0 : ListBlank (Fin 2)) (m r : ℕ) : Cfg 27 2 := ⟨13, mkL (ones m L0) ((ones r B0).cons 0)⟩private theorem odd_step (L0 : ListBlank (Fin 2)) (m r : ℕ) : reachPos (oddCfg L0 (m + 1) r) (oddCfg L0 m (r + 3)) := L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos (oddCfg L0 (m + 1) r) (oddCfg L0 m (r + 3)) L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 13, tape := mkL (ones (m + 1) L0) (ListBlank.cons 0 (ones r B0)) } { state := 13, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 13, tape := { head := 1, left := ones m L0, right := ListBlank.cons 0 (ones r B0) } } { state := 13, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones m L0)) (ListBlank.cons 0 (ones r B0)) } { state := 13, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 24, tape := { head := 0, left := ListBlank.cons 0 (ones m L0), right := ones r B0 } } { state := 13, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 14, tape := Tape.mk' (ListBlank.cons 1 (ListBlank.cons 0 (ones m L0))) (ones r B0) } { state := 13, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 14, tape := Tape.mk' (ones 1 (ListBlank.cons 0 (ones m L0))) (ones r B0) } { state := 13, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 14, tape := Tape.mk' (ones r (ones 1 (ListBlank.cons 0 (ones m L0)))) B0 } { state := 13, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 14, tape := { head := 0, left := ones (r + 1) (ListBlank.cons 0 (ones m L0)), right := B0 } } { state := 13, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 25, tape := Tape.mk' (ListBlank.cons 1 (ones (r + 1) (ListBlank.cons 0 (ones m L0)))) B0 } { state := 13, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 25, tape := { head := 0, left := ones (r + 1 + 1) (ListBlank.cons 0 (ones m L0)), right := B0 } } { state := 13, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 15, tape := mkL (ones (r + 1 + 1) (ListBlank.cons 0 (ones m L0))) (ListBlank.cons 1 B0) } { state := 13, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 15, tape := mkL (ones (r + 2) (ListBlank.cons 0 (ones m L0))) (ones 1 B0) } { state := 13, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 15, tape := mkL (ListBlank.cons 0 (ones m L0)) (ones (r + 2) (ones 1 B0)) } { state := 13, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 15, tape := { head := 0, left := ones m L0, right := ones (r + 3) B0 } } { state := 13, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } All goals completed! 🐙private theorem odd_many (L0 : ListBlank (Fin 2)) (m r : ℕ) : m = 0 ∨ reachPos (oddCfg L0 m r) (oddCfg L0 0 (r + 3 * m)) := L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ m = 0 ∨ reachPos (oddCfg L0 m r) (oddCfg L0 0 (r + 3 * m)) induction m generalizing r with L0:ListBlank (Fin 2)r:ℕ⊢ 0 = 0 ∨ reachPos (oddCfg L0 0 r) (oddCfg L0 0 (r + 3 * 0)) All goals completed! 🐙 L0:ListBlank (Fin 2)m:ℕih:∀ (r : ℕ), m = 0 ∨ reachPos (oddCfg L0 m r) (oddCfg L0 0 (r + 3 * m))r:ℕ⊢ m + 1 = 0 ∨ reachPos (oddCfg L0 (m + 1) r) (oddCfg L0 0 (r + 3 * (m + 1))) L0:ListBlank (Fin 2)m:ℕih:∀ (r : ℕ), m = 0 ∨ reachPos (oddCfg L0 m r) (oddCfg L0 0 (r + 3 * m))r:ℕ⊢ reachPos (oddCfg L0 (m + 1) r) (oddCfg L0 0 (r + 3 * (m + 1))) L0:ListBlank (Fin 2)r:ℕih:∀ (r : ℕ), 0 = 0 ∨ reachPos (oddCfg L0 0 r) (oddCfg L0 0 (r + 3 * 0))⊢ reachPos (oddCfg L0 (0 + 1) r) (oddCfg L0 0 (r + 3 * (0 + 1)))L0:ListBlank (Fin 2)m:ℕih:∀ (r : ℕ), m = 0 ∨ reachPos (oddCfg L0 m r) (oddCfg L0 0 (r + 3 * m))r:ℕhrest:reachPos (oddCfg L0 m (r + 3)) (oddCfg L0 0 (r + 3 + 3 * m))⊢ reachPos (oddCfg L0 (m + 1) r) (oddCfg L0 0 (r + 3 * (m + 1))) L0:ListBlank (Fin 2)r:ℕih:∀ (r : ℕ), 0 = 0 ∨ reachPos (oddCfg L0 0 r) (oddCfg L0 0 (r + 3 * 0))⊢ reachPos (oddCfg L0 (0 + 1) r) (oddCfg L0 0 (r + 3 * (0 + 1))) L0:ListBlank (Fin 2)r:ℕih:∀ (r : ℕ), 0 = 0 ∨ reachPos (oddCfg L0 0 r) (oddCfg L0 0 (r + 3 * 0))⊢ reachPos (oddCfg L0 1 r) (oddCfg L0 0 (r + 3)) All goals completed! 🐙 L0:ListBlank (Fin 2)m:ℕih:∀ (r : ℕ), m = 0 ∨ reachPos (oddCfg L0 m r) (oddCfg L0 0 (r + 3 * m))r:ℕhrest:reachPos (oddCfg L0 m (r + 3)) (oddCfg L0 0 (r + 3 + 3 * m))⊢ reachPos (oddCfg L0 (m + 1) r) (oddCfg L0 0 (r + 3 * (m + 1))) L0:ListBlank (Fin 2)m:ℕih:∀ (r : ℕ), m = 0 ∨ reachPos (oddCfg L0 m r) (oddCfg L0 0 (r + 3 * m))r:ℕhrest:reachPos (oddCfg L0 m (r + 3)) (oddCfg L0 0 (r + 3 + 3 * m))⊢ reachPos (oddCfg L0 (m + 1) r) (oddCfg L0 0 (r + 3 + 3 * m)) All goals completed! 🐙private theorem terras_pos_of_pos {y : ℕ} (hy : 1 ≤ y) : 1 ≤ terras y := y:ℕhy:1 ≤ y⊢ 1 ≤ terras y y:ℕhy:1 ≤ y⊢ 1 ≤ if y % 2 = 0 then y / 2 else (3 * y + 1) / 2 y:ℕhy:1 ≤ yh✝:y % 2 = 0⊢ 1 ≤ y / 2y:ℕhy:1 ≤ yh✝:¬y % 2 = 0⊢ 1 ≤ (3 * y + 1) / 2 y:ℕhy:1 ≤ yh✝:y % 2 = 0⊢ 1 ≤ y / 2y:ℕhy:1 ≤ yh✝:¬y % 2 = 0⊢ 1 ≤ (3 * y + 1) / 2 All goals completed! 🐙private theorem terras_eval (x y : ℕ) (hy : 2 ≤ y) : reachPos (stageCfg x y) ⟨17, mkL ((ones x B0).cons 0) (ones (terras y) B0)⟩ := x:ℕy:ℕhy:2 ≤ y⊢ reachPos (stageCfg x y) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)⊢ reachPos (stageCfg x y) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0⊢ reachPos (stageCfg x y) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) }x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1⊢ reachPos (stageCfg x y) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0⊢ reachPos (stageCfg x y) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1⊢ reachPos (stageCfg x y) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2⊢ reachPos (stageCfg x y) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos (stageCfg x y) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos (stageCfg x (2 * k + 2)) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (k + 1) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones x B0)) (ones (2 * k + 2) B0) } { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (k + 1) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 24, tape := Tape.mk' L0 (ones (2 * k + 2) B0) } { state := 17, tape := mkL L0 (ones (k + 1) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 24, tape := { head := 1, left := L0, right := ones (2 * k + 1) B0 } } { state := 17, tape := mkL L0 (ones (k + 1) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 8, tape := Tape.mk' (ListBlank.cons 1 L0) (ones (2 * k + 1) B0) } { state := 17, tape := mkL L0 (ones (k + 1) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 8, tape := { head := 1, left := ListBlank.cons 1 L0, right := ones (2 * k) B0 } } { state := 17, tape := mkL L0 (ones (k + 1) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ListBlank.cons 1 L0)) (ones (2 * k) B0) } { state := 17, tape := mkL L0 (ones (k + 1) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos (evenCfg L0 1 (2 * k + 0)) { state := 17, tape := mkL L0 (ones (k + 1) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1hev_end:reachPos (evenCfg L0 (k + 1) 0) { state := 17, tape := mkL L0 (ones (k + 1) B0) }⊢ reachPos (evenCfg L0 1 (2 * k + 0)) { state := 17, tape := mkL L0 (ones (k + 1) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1hev_end:reachPos (evenCfg L0 (k + 1) 0) { state := 17, tape := mkL L0 (ones (k + 1) B0) }hk0:k = 0⊢ reachPos (evenCfg L0 1 (2 * k + 0)) { state := 17, tape := mkL L0 (ones (k + 1) B0) }x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1hev_end:reachPos (evenCfg L0 (k + 1) 0) { state := 17, tape := mkL L0 (ones (k + 1) B0) }hmany:reachPos (evenCfg L0 1 (2 * k + 0)) (evenCfg L0 (1 + k) 0)⊢ reachPos (evenCfg L0 1 (2 * k + 0)) { state := 17, tape := mkL L0 (ones (k + 1) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1hev_end:reachPos (evenCfg L0 (k + 1) 0) { state := 17, tape := mkL L0 (ones (k + 1) B0) }hk0:k = 0⊢ reachPos (evenCfg L0 1 (2 * k + 0)) { state := 17, tape := mkL L0 (ones (k + 1) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1hev_end:reachPos (evenCfg L0 (0 + 1) 0) { state := 17, tape := mkL L0 (ones (0 + 1) B0) }hk0:k = 0⊢ reachPos (evenCfg L0 1 (2 * 0 + 0)) { state := 17, tape := mkL L0 (ones (0 + 1) B0) } All goals completed! 🐙 x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1hev_end:reachPos (evenCfg L0 (k + 1) 0) { state := 17, tape := mkL L0 (ones (k + 1) B0) }hmany:reachPos (evenCfg L0 1 (2 * k + 0)) (evenCfg L0 (1 + k) 0)⊢ reachPos (evenCfg L0 1 (2 * k + 0)) { state := 17, tape := mkL L0 (ones (k + 1) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1hev_end:reachPos (evenCfg L0 (k + 1) 0) { state := 17, tape := mkL L0 (ones (k + 1) B0) }hmany:reachPos (evenCfg L0 1 (2 * k + 0)) (evenCfg L0 (k + 1) 0)⊢ reachPos (evenCfg L0 1 (2 * k + 0)) { state := 17, tape := mkL L0 (ones (k + 1) B0) } All goals completed! 🐙 x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1⊢ reachPos (stageCfg x y) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1⊢ reachPos (stageCfg x y) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1⊢ reachPos (stageCfg x y) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2⊢ reachPos (stageCfg x y) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2⊢ reachPos (stageCfg x (2 * (k' + 1) + 1)) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2⊢ reachPos { state := 24, tape := Tape.mk' (ListBlank.cons 0 (ones x B0)) (ones (2 * (k' + 1) + 1) B0) } { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2⊢ reachPos { state := 24, tape := Tape.mk' L0 (ones (2 * (k' + 1) + 1) B0) } { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2⊢ reachPos { state := 24, tape := { head := 1, left := L0, right := ones (2 * k' + 2) B0 } } { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2⊢ reachPos { state := 8, tape := Tape.mk' (ListBlank.cons 1 L0) (ones (2 * k' + 2) B0) } { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2⊢ reachPos { state := 8, tape := { head := 1, left := ListBlank.cons 1 L0, right := ones (2 * k' + 1) B0 } } { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2⊢ reachPos { state := 9, tape := Tape.mk' (ListBlank.cons 0 (ListBlank.cons 1 L0)) (ones (2 * k' + 1) B0) } { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2⊢ reachPos (evenCfg L0 1 (2 * k' + 1)) { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)⊢ reachPos (evenCfg L0 1 (2 * k' + 1)) { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)⊢ reachPos (evenCfg L0 1 (2 * k' + 1)) { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)⊢ reachPos (oddCfg L0 (k' + 1) 1) { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)h0:k' + 1 = 0⊢ reachPos (oddCfg L0 (k' + 1) 1) { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos (oddCfg L0 (k' + 1) 1) { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)h0:k' + 1 = 0⊢ reachPos (oddCfg L0 (k' + 1) 1) { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)h0:k' + 1 = 0⊢ False; All goals completed! 🐙 x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos (oddCfg L0 (k' + 1) 1) { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos (oddCfg L0 0 (1 + 3 * (k' + 1))) { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos { state := 13, tape := mkL (ones 0 L0) (ListBlank.cons 0 (ones (1 + 3 * (k' + 1)) B0)) } { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos { state := 13, tape := mkL L0 (ListBlank.cons 0 (ones (1 + 3 * (k' + 1)) B0)) } { state := 17, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos { state := 13, tape := mkL (ListBlank.cons 0 (ones x B0)) (ListBlank.cons 0 (ones (1 + 3 * (k' + 1)) B0)) } { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos { state := 13, tape := { head := 0, left := ones x B0, right := ListBlank.cons 0 (ones (1 + 3 * (k' + 1)) B0) } } { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos { state := 26, tape := Tape.mk' (ListBlank.cons 0 (ones x B0)) (ListBlank.cons 0 (ones (1 + 3 * (k' + 1)) B0)) } { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos { state := 26, tape := { head := 0, left := ListBlank.cons 0 (ones x B0), right := ones (1 + 3 * (k' + 1)) B0 } } { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))hstep:step weakCollatz27 { state := 26, tape := { head := 0, left := ListBlank.cons 0 (ones x B0), right := ones (1 + 3 * (k' + 1)) B0 } } = some { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ListBlank.cons 1 (ones (1 + 3 * (k' + 1)) B0)) }⊢ reachPos { state := 26, tape := { head := 0, left := ListBlank.cons 0 (ones x B0), right := ones (1 + 3 * (k' + 1)) B0 } } { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (3 * (k' + 1) + 2) B0) } x:ℕy:ℕhy:2 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones x B0)hodd:y % 2 = 1k':ℕ := y / 2 - 1hy_eq:y = 2 * (k' + 1) + 1hty:terras y = 3 * (k' + 1) + 2hto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))hstep:step weakCollatz27 { state := 26, tape := { head := 0, left := ListBlank.cons 0 (ones x B0), right := ones (1 + 3 * (k' + 1)) B0 } } = some { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (3 * (k' + 1) + 2) B0) }⊢ reachPos { state := 26, tape := { head := 0, left := ListBlank.cons 0 (ones x B0), right := ones (1 + 3 * (k' + 1)) B0 } } { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (3 * (k' + 1) + 2) B0) } All goals completed! 🐙

Local 2p Comparison, Cycle Halt & z > x Stage Advance

private def cmpCfg (u v p : ℕ) : Cfg 27 2 := ⟨16, mkL (ones v ((ones u B0).cons 0)) ((ones (2 * p) B0).cons 0)⟩private theorem cmpFrom17 (u v p : ℕ) : reachPos ⟨17, mkL ((ones (u + 1) B0).cons 0) (ones (v + 1) ((ones (2 * p) B0).cons 0))⟩ (cmpCfg u v (p + 1)) := u:ℕv:ℕp:ℕ⊢ reachPos { state := 17, tape := mkL (ListBlank.cons 0 (ones (u + 1) B0)) (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 17, tape := mkL (ListBlank.cons 0 (ones (u + 1) B0)) (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 17, tape := { head := 0, left := ones (u + 1) B0, right := ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)) } } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 20, tape := mkL (ones (u + 1) B0) (ListBlank.cons 0 (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)))) } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 20, tape := { head := 1, left := ones u B0, right := ListBlank.cons 0 (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) } } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 23, tape := Tape.mk' (ListBlank.cons 0 (ones u B0)) (ListBlank.cons 0 (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)))) } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 23, tape := { head := 0, left := ListBlank.cons 0 (ones u B0), right := ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)) } } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 21, tape := Tape.mk' (ListBlank.cons 1 (ListBlank.cons 0 (ones u B0))) (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 21, tape := Tape.mk' (ones 1 Lu) (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 21, tape := Tape.mk' (ones (v + 1) (ones 1 Lu)) (ListBlank.cons 0 (ones (2 * p) B0)) } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 21, tape := { head := 0, left := ones (v + 2) Lu, right := ones (2 * p) B0 } } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 25, tape := mkL (ones (v + 2) Lu) (ListBlank.cons 1 (ones (2 * p) B0)) } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 25, tape := { head := 1, left := ones (v + 1) Lu, right := ones (2 * p + 1) B0 } } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 26, tape := mkL (ones (v + 1) Lu) (ListBlank.cons 1 (ones (2 * p + 1) B0)) } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)⊢ reachPos { state := 26, tape := { head := 1, left := ones v Lu, right := ones (2 * p + 1 + 1) B0 } } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)h26:step weakCollatz27 { state := 26, tape := { head := 1, left := ones v Lu, right := ones (2 * p + 2) B0 } } = some { state := 16, tape := mkL (ones v Lu) (ListBlank.cons 0 (ones (2 * p + 2) B0)) }⊢ reachPos { state := 26, tape := { head := 1, left := ones v Lu, right := ones (2 * p + 1 + 1) B0 } } (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕLu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u B0)h26:step weakCollatz27 { state := 26, tape := { head := 1, left := ones v Lu, right := ones (2 * (p + 1)) B0 } } = some { state := 16, tape := mkL (ones v Lu) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }⊢ reachPos { state := 26, tape := { head := 1, left := ones v Lu, right := ones (2 * p + 1 + 1) B0 } } (cmpCfg u v (p + 1)) All goals completed! 🐙private theorem terras_to_cmp1 (x y : ℕ) (hx : 2 ≤ x) (hy : 2 ≤ y) : reachPos (stageCfg x y) (cmpCfg (x - 1) (terras y - 1) 1) := x:ℕy:ℕhx:2 ≤ xhy:2 ≤ y⊢ reachPos (stageCfg x y) (cmpCfg (x - 1) (terras y - 1) 1) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhz:1 ≤ terras y⊢ reachPos (stageCfg x y) (cmpCfg (x - 1) (terras y - 1) 1) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhz:1 ≤ terras yheval:reachPos (stageCfg x y) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) }⊢ reachPos (stageCfg x y) (cmpCfg (x - 1) (terras y - 1) 1) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhz:1 ≤ terras yheval:reachPos (stageCfg x y) { state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) }htarget:{ state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) } = { state := 17, tape := mkL (ListBlank.cons 0 (ones (x - 1 + 1) B0)) (ones (terras y - 1 + 1) (ListBlank.cons 0 (ones (2 * 0) B0))) }⊢ reachPos (stageCfg x y) (cmpCfg (x - 1) (terras y - 1) 1) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhz:1 ≤ terras yheval:reachPos (stageCfg x y) { state := 17, tape := mkL (ListBlank.cons 0 (ones (x - 1 + 1) B0)) (ones (terras y - 1 + 1) (ListBlank.cons 0 (ones (2 * 0) B0))) }htarget:{ state := 17, tape := mkL (ListBlank.cons 0 (ones x B0)) (ones (terras y) B0) } = { state := 17, tape := mkL (ListBlank.cons 0 (ones (x - 1 + 1) B0)) (ones (terras y - 1 + 1) (ListBlank.cons 0 (ones (2 * 0) B0))) }⊢ reachPos (stageCfg x y) (cmpCfg (x - 1) (terras y - 1) 1) All goals completed! 🐙private theorem cmp_step (u v p : ℕ) : reachPos (cmpCfg (u + 1) (v + 1) p) (cmpCfg u v (p + 1)) := u:ℕv:ℕp:ℕ⊢ reachPos (cmpCfg (u + 1) (v + 1) p) (cmpCfg u v (p + 1)) u:ℕv:ℕp:ℕ⊢ reachPos { state := 16, tape := mkL (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } { state := 16, tape := mkL (ones v (ListBlank.cons 0 (ones u B0))) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } u:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) B0)⊢ reachPos { state := 16, tape := mkL (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } { state := 16, tape := mkL (ones v (ListBlank.cons 0 (ones u B0))) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } u:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 16, tape := mkL (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } { state := 16, tape := mkL (ones v (ListBlank.cons 0 (ones u B0))) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } u:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 16, tape := mkL (ones (v + 1) Lu1) Rp } { state := 16, tape := mkL (ones v (ListBlank.cons 0 (ones u B0))) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } u:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 16, tape := { head := 1, left := ones v Lu1, right := Rp } } { state := 16, tape := mkL (ones v (ListBlank.cons 0 (ones u B0))) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } u:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 17, tape := mkL (ones v Lu1) (ListBlank.cons 1 Rp) } { state := 16, tape := mkL (ones v (ListBlank.cons 0 (ones u B0))) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } u:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 17, tape := mkL (ones v Lu1) (ones 1 Rp) } { state := 16, tape := mkL (ones v (ListBlank.cons 0 (ones u B0))) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } u:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 17, tape := mkL Lu1 (ones v (ones 1 Rp)) } { state := 16, tape := mkL (ones v (ListBlank.cons 0 (ones u B0))) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } u:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 17, tape := mkL Lu1 (ones (v + 1) Rp) } { state := 16, tape := mkL (ones v (ListBlank.cons 0 (ones u B0))) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } All goals completed! 🐙private theorem cmp_many (u v p k : ℕ) : k = 0 ∨ reachPos (cmpCfg (u + k) (v + k) p) (cmpCfg u v (p + k)) := u:ℕv:ℕp:ℕk:ℕ⊢ k = 0 ∨ reachPos (cmpCfg (u + k) (v + k) p) (cmpCfg u v (p + k)) induction k generalizing u v p with u:ℕv:ℕp:ℕ⊢ 0 = 0 ∨ reachPos (cmpCfg (u + 0) (v + 0) p) (cmpCfg u v (p + 0)) All goals completed! 🐙 k:ℕih:∀ (u v p : ℕ), k = 0 ∨ reachPos (cmpCfg (u + k) (v + k) p) (cmpCfg u v (p + k))u:ℕv:ℕp:ℕ⊢ k + 1 = 0 ∨ reachPos (cmpCfg (u + (k + 1)) (v + (k + 1)) p) (cmpCfg u v (p + (k + 1))) k:ℕih:∀ (u v p : ℕ), k = 0 ∨ reachPos (cmpCfg (u + k) (v + k) p) (cmpCfg u v (p + k))u:ℕv:ℕp:ℕ⊢ reachPos (cmpCfg (u + (k + 1)) (v + (k + 1)) p) (cmpCfg u v (p + (k + 1))) k:ℕih:∀ (u v p : ℕ), k = 0 ∨ reachPos (cmpCfg (u + k) (v + k) p) (cmpCfg u v (p + k))u:ℕv:ℕp:ℕ⊢ reachPos (cmpCfg (u + k + 1) (v + k + 1) p) (cmpCfg u v (p + (k + 1))) u:ℕv:ℕp:ℕih:∀ (u v p : ℕ), 0 = 0 ∨ reachPos (cmpCfg (u + 0) (v + 0) p) (cmpCfg u v (p + 0))⊢ reachPos (cmpCfg (u + 0 + 1) (v + 0 + 1) p) (cmpCfg u v (p + (0 + 1)))k:ℕih:∀ (u v p : ℕ), k = 0 ∨ reachPos (cmpCfg (u + k) (v + k) p) (cmpCfg u v (p + k))u:ℕv:ℕp:ℕhrest:reachPos (cmpCfg (u + k) (v + k) (p + 1)) (cmpCfg u v (p + 1 + k))⊢ reachPos (cmpCfg (u + k + 1) (v + k + 1) p) (cmpCfg u v (p + (k + 1))) u:ℕv:ℕp:ℕih:∀ (u v p : ℕ), 0 = 0 ∨ reachPos (cmpCfg (u + 0) (v + 0) p) (cmpCfg u v (p + 0))⊢ reachPos (cmpCfg (u + 0 + 1) (v + 0 + 1) p) (cmpCfg u v (p + (0 + 1))) u:ℕv:ℕp:ℕih:∀ (u v p : ℕ), 0 = 0 ∨ reachPos (cmpCfg (u + 0) (v + 0) p) (cmpCfg u v (p + 0))⊢ reachPos (cmpCfg (u + 1) (v + 0 + 1) p) (cmpCfg u v (p + (0 + 1))) All goals completed! 🐙 k:ℕih:∀ (u v p : ℕ), k = 0 ∨ reachPos (cmpCfg (u + k) (v + k) p) (cmpCfg u v (p + k))u:ℕv:ℕp:ℕhrest:reachPos (cmpCfg (u + k) (v + k) (p + 1)) (cmpCfg u v (p + 1 + k))⊢ reachPos (cmpCfg (u + k + 1) (v + k + 1) p) (cmpCfg u v (p + (k + 1))) k:ℕih:∀ (u v p : ℕ), k = 0 ∨ reachPos (cmpCfg (u + k) (v + k) p) (cmpCfg u v (p + k))u:ℕv:ℕp:ℕhrest:reachPos (cmpCfg (u + k) (v + k) (p + 1)) (cmpCfg u v (p + (k + 1)))⊢ reachPos (cmpCfg (u + k + 1) (v + k + 1) p) (cmpCfg u v (p + (k + 1))) All goals completed! 🐙private theorem cmp_halt_eq (p : ℕ) : ∃ s cfg, nSteps weakCollatz27 s (cmpCfg 0 0 p) = some cfg ∧ step weakCollatz27 cfg = none := p:ℕ⊢ ∃ s cfg, nSteps weakCollatz27 s (cmpCfg 0 0 p) = some cfg ∧ step weakCollatz27 cfg = none p:ℕ⊢ ∃ s cfg, nSteps weakCollatz27 s { state := 16, tape := mkL (ones 0 (ListBlank.cons 0 (ones 0 B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } = some cfg ∧ step weakCollatz27 cfg = none p:ℕ⊢ ∃ s cfg, nSteps weakCollatz27 s { state := 16, tape := { head := 0, left := B0, right := ListBlank.cons 0 (ones (2 * p) B0) } } = some cfg ∧ step weakCollatz27 cfg = none p:ℕh1:step weakCollatz27 { state := 16, tape := { head := 0, left := B0, right := ListBlank.cons 0 (ones (2 * p) B0) } } = some { state := 18, tape := mkL B0 (ListBlank.cons 0 (ListBlank.cons 0 (ones (2 * p) B0))) }⊢ ∃ s cfg, nSteps weakCollatz27 s { state := 16, tape := { head := 0, left := B0, right := ListBlank.cons 0 (ones (2 * p) B0) } } = some cfg ∧ step weakCollatz27 cfg = none p:ℕh1:step weakCollatz27 { state := 16, tape := { head := 0, left := B0, right := ListBlank.cons 0 (ones (2 * p) B0) } } = some { state := 18, tape := { head := 0, left := B0, right := ListBlank.cons 0 (ListBlank.cons 0 (ones (2 * p) B0)) } }⊢ ∃ s cfg, nSteps weakCollatz27 s { state := 16, tape := { head := 0, left := B0, right := ListBlank.cons 0 (ones (2 * p) B0) } } = some cfg ∧ step weakCollatz27 cfg = none All goals completed! 🐙private theorem cmp_lt_to_rest (u p : ℕ) : reachPos (cmpCfg (u + 1) 0 p) (restCfg (u + 1) 0 p) := u:ℕp:ℕ⊢ reachPos (cmpCfg (u + 1) 0 p) (restCfg (u + 1) 0 p) u:ℕp:ℕ⊢ reachPos { state := 16, tape := mkL (ones 0 (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } { state := 5, tape := Tape.mk' (ones 0 (ListBlank.cons 0 (ones (u + 1) B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕp:ℕ⊢ reachPos { state := 16, tape := { head := 0, left := ones (u + 1) B0, right := ListBlank.cons 0 (ones (2 * p) B0) } } { state := 5, tape := Tape.mk' (ListBlank.cons 0 (ones (u + 1) B0)) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕp:ℕ⊢ reachPos { state := 18, tape := mkL (ones (u + 1) B0) (ListBlank.cons 0 (ListBlank.cons 0 (ones (2 * p) B0))) } { state := 5, tape := Tape.mk' (ListBlank.cons 0 (ones (u + 1) B0)) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕp:ℕ⊢ reachPos { state := 18, tape := { head := 1, left := ones u B0, right := ListBlank.cons 0 (ListBlank.cons 0 (ones (2 * p) B0)) } } { state := 5, tape := Tape.mk' (ListBlank.cons 0 (ListBlank.cons 1 (ones u B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕp:ℕ⊢ reachPos { state := 19, tape := Tape.mk' (ListBlank.cons 1 (ones u B0)) (ListBlank.cons 0 (ListBlank.cons 0 (ones (2 * p) B0))) } { state := 5, tape := Tape.mk' (ListBlank.cons 0 (ListBlank.cons 1 (ones u B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } u:ℕp:ℕ⊢ reachPos { state := 19, tape := { head := 0, left := ones (u + 1) B0, right := ListBlank.cons 0 (ones (2 * p) B0) } } { state := 5, tape := Tape.mk' (ListBlank.cons 0 (ones (u + 1) B0)) (ListBlank.cons 0 (ones (2 * p) B0)) } All goals completed! 🐙private theorem cmp_gt_advance (v x : ℕ) (hx : 1 ≤ x) : reachPos (cmpCfg 0 (v + 1) x) (stageCfg (x + 1) (x + 1)) := v:ℕx:ℕhx:1 ≤ x⊢ reachPos (cmpCfg 0 (v + 1) x) (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ x⊢ reachPos { state := 16, tape := mkL (ones (v + 1) (ListBlank.cons 0 (ones 0 B0))) (ListBlank.cons 0 (ones (2 * x) B0)) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 16, tape := mkL (ones (v + 1) (ListBlank.cons 0 (ones 0 B0))) (ListBlank.cons 0 (ones (2 * x) B0)) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 16, tape := mkL (ones (v + 1) (ListBlank.cons 0 (ones 0 B0))) Rx } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 16, tape := { head := 1, left := ones v B0, right := Rx } } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 17, tape := mkL (ones v B0) (ListBlank.cons 1 Rx) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 17, tape := mkL (ones v B0) (ones 1 Rx) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 17, tape := mkL B0 (ones v (ones 1 Rx)) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 17, tape := { head := 0, left := B0, right := ones (v + 1) Rx } } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 20, tape := mkL B0 (ListBlank.cons 0 (ones (v + 1) Rx)) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 20, tape := { head := 0, left := B0, right := ListBlank.cons 0 (ones (v + 1) Rx) } } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 22, tape := Tape.mk' (ListBlank.cons 0 B0) (ListBlank.cons 0 (ones (v + 1) Rx)) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 22, tape := { head := 0, left := B0, right := ones (v + 1) Rx } } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 0, tape := Tape.mk' (ListBlank.cons 0 B0) (ones (v + 1) Rx) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 0, tape := Tape.mk' B0 (ones (v + 1) Rx) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 0, tape := Tape.mk' B0 Rx } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 0, tape := Tape.mk' B0 (ListBlank.cons 0 (ones (2 * x) B0)) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 0, tape := { head := 0, left := B0, right := ones (2 * x) B0 } } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 2, tape := Tape.mk' (ListBlank.cons 1 B0) (ones (2 * x) B0) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 2, tape := Tape.mk' (ones 1 B0) (ones (2 * x) B0) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 2, tape := Tape.mk' (ones (2 * x) (ones 1 B0)) B0 } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 2, tape := { head := 0, left := ones (2 * x + 1) B0, right := B0 } } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 3, tape := mkL (ones (2 * x + 1) B0) (ListBlank.cons 1 B0) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 3, tape := mkL (ones (2 * x + 1) B0) (ones 1 B0) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 3, tape := mkL B0 (ones (2 * x + 1) (ones 1 B0)) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 3, tape := { head := 0, left := B0, right := ones (2 * (x + 1)) B0 } } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 1, tape := mkL B0 (ListBlank.cons 0 (ones (2 * (x + 1)) B0)) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 1, tape := { head := 0, left := B0, right := ListBlank.cons 0 (ones (2 * (x + 1)) B0) } } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)⊢ reachPos { state := 5, tape := Tape.mk' (ListBlank.cons 0 B0) (ListBlank.cons 0 (ones (2 * (x + 1)) B0)) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)hrest_eq:{ state := 5, tape := Tape.mk' (ListBlank.cons 0 B0) (ListBlank.cons 0 (ones (2 * (x + 1)) B0)) } = restCfg 0 0 (x + 1)⊢ reachPos { state := 5, tape := Tape.mk' (ListBlank.cons 0 B0) (ListBlank.cons 0 (ones (2 * (x + 1)) B0)) } (stageCfg (x + 1) (x + 1)) v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)hrest_eq:{ state := 5, tape := Tape.mk' (ListBlank.cons 0 B0) (ListBlank.cons 0 (ones (2 * (x + 1)) B0)) } = restCfg 0 0 (x + 1)⊢ reachPos (restCfg 0 0 (x + 1)) (stageCfg (x + 1) (x + 1)) exact rest_from_zero (x + 1) (v:ℕx:ℕhx:1 ≤ xRx:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * x) B0)hrest_eq:{ state := 5, tape := Tape.mk' (ListBlank.cons 0 B0) (ListBlank.cons 0 (ones (2 * (x + 1)) B0)) } = restCfg 0 0 (x + 1)⊢ 1 ≤ x + 1 All goals completed! 🐙)

Blank-Tape Warm-Up & Round Outcomes

private theorem stage_round_halt (x y : ℕ) (hx : 3 ≤ x) (hy : 2 ≤ y) (hhit : terras y = x) : ∃ s cfg, nSteps weakCollatz27 s (stageCfg x y) = some cfg ∧ step weakCollatz27 cfg = none := x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhhit:terras y = x⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x y) = some cfg ∧ step weakCollatz27 cfg = none x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg x y) (cmpCfg (x - 1) (terras y - 1) 1)⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x y) = some cfg ∧ step weakCollatz27 cfg = none x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg x y) (cmpCfg (x - 1) (x - 1) 1)⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x y) = some cfg ∧ step weakCollatz27 cfg = none x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg x y) (cmpCfg (x - 1) (x - 1) 1)hmany:reachPos (cmpCfg (x - 1) (x - 1) 1) (cmpCfg 0 0 x)⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x y) = some cfg ∧ step weakCollatz27 cfg = none x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg x y) (cmpCfg (x - 1) (x - 1) 1)hmany:reachPos (cmpCfg (x - 1) (x - 1) 1) (cmpCfg 0 0 x)s₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz27 s₁ (stageCfg x y) = some (cmpCfg 0 0 x)⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x y) = some cfg ∧ step weakCollatz27 cfg = none x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg x y) (cmpCfg (x - 1) (x - 1) 1)hmany:reachPos (cmpCfg (x - 1) (x - 1) 1) (cmpCfg 0 0 x)s₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz27 s₁ (stageCfg x y) = some (cmpCfg 0 0 x)s₂:ℕcfg:Cfg 27 2hs₂:nSteps weakCollatz27 s₂ (cmpCfg 0 0 x) = some cfghnone:step weakCollatz27 cfg = none⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x y) = some cfg ∧ step weakCollatz27 cfg = none All goals completed! 🐙private theorem stage_round_lt (x y : ℕ) (hx : 2 ≤ x) (hy : 2 ≤ y) (hlt : terras y < x) : reachPos (stageCfg x y) (stageCfg x (terras y)) := x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < x⊢ reachPos (stageCfg x y) (stageCfg x (terras y)) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < xz:ℕ := terras y⊢ reachPos (stageCfg x y) (stageCfg x (terras y)) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < xz:ℕ := terras yhz:1 ≤ z⊢ reachPos (stageCfg x y) (stageCfg x (terras y)) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < xz:ℕ := terras yhz:1 ≤ z⊢ reachPos (cmpCfg (x - 1) (terras y - 1) 1) (stageCfg x (terras y)) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < xz:ℕ := terras yhz:1 ≤ zq:ℕ := z - 1⊢ reachPos (cmpCfg (x - 1) (terras y - 1) 1) (stageCfg x (terras y)) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < xz:ℕ := terras yhz:1 ≤ zq:ℕ := z - 1uRem:ℕ := x - z - 1⊢ reachPos (cmpCfg (x - 1) (terras y - 1) 1) (stageCfg x (terras y)) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < xz:ℕ := terras yhz:1 ≤ zq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + q⊢ reachPos (cmpCfg (x - 1) (terras y - 1) 1) (stageCfg x (terras y)) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < xz:ℕ := terras yhz:1 ≤ zq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + q⊢ reachPos (cmpCfg (x - 1) (terras y - 1) 1) (stageCfg x (terras y)) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < xz:ℕ := terras yhz:1 ≤ zq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + q⊢ reachPos (cmpCfg (uRem + 1 + q) (0 + q) 1) (stageCfg x (terras y)) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < xz:ℕ := terras yhz:1 ≤ zq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (uRem + 1 + q) (0 + q) 1) (restCfg (uRem + 1) 0 (q + 1))⊢ reachPos (cmpCfg (uRem + 1 + q) (0 + q) 1) (stageCfg x (terras y)) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < xz:ℕ := terras yhz:1 ≤ zq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (uRem + 1 + q) (0 + q) 1) (restCfg (uRem + 1) 0 (q + 1))h0:q + 1 = 0⊢ reachPos (cmpCfg (uRem + 1 + q) (0 + q) 1) (stageCfg x (terras y))x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < xz:ℕ := terras yhz:1 ≤ zq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (uRem + 1 + q) (0 + q) 1) (restCfg (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (uRem + 1) 0 (0 + (q + 1))) (restCfg (uRem + 1 + (q + 1)) (0 + (q + 1)) 0)⊢ reachPos (cmpCfg (uRem + 1 + q) (0 + q) 1) (stageCfg x (terras y)) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < xz:ℕ := terras yhz:1 ≤ zq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (uRem + 1 + q) (0 + q) 1) (restCfg (uRem + 1) 0 (q + 1))h0:q + 1 = 0⊢ reachPos (cmpCfg (uRem + 1 + q) (0 + q) 1) (stageCfg x (terras y)) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < xz:ℕ := terras yhz:1 ≤ zq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (uRem + 1 + q) (0 + q) 1) (restCfg (uRem + 1) 0 (q + 1))h0:q + 1 = 0⊢ False; All goals completed! 🐙 x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < xz:ℕ := terras yhz:1 ≤ zq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (uRem + 1 + q) (0 + q) 1) (restCfg (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (uRem + 1) 0 (0 + (q + 1))) (restCfg (uRem + 1 + (q + 1)) (0 + (q + 1)) 0)⊢ reachPos (cmpCfg (uRem + 1 + q) (0 + q) 1) (stageCfg x (terras y)) x:ℕy:ℕhx:2 ≤ xhy:2 ≤ yhlt:terras y < xz:ℕ := terras yhz:1 ≤ zq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (uRem + 1 + q) (0 + q) 1) (restCfg (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (uRem + 1) 0 (0 + (q + 1))) (restCfg (uRem + 1 + (q + 1)) (0 + (q + 1)) 0)hrm':reachPos (restCfg (uRem + 1) 0 (q + 1)) (restCfg x z 0)⊢ reachPos (cmpCfg (uRem + 1 + q) (0 + q) 1) (stageCfg x (terras y)) All goals completed! 🐙private theorem stage_round_gt (x y : ℕ) (hx : 3 ≤ x) (hy : 2 ≤ y) (hgt : x < terras y) : reachPos (stageCfg x y) (stageCfg (x + 1) (x + 1)) := x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras y⊢ reachPos (stageCfg x y) (stageCfg (x + 1) (x + 1)) x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras yz:ℕ := terras y⊢ reachPos (stageCfg x y) (stageCfg (x + 1) (x + 1)) refine reachPos_trans (terras_to_cmp1 x y (x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras yz:ℕ := terras y⊢ 2 ≤ x All goals completed! 🐙) hy) ?_ x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras yz:ℕ := terras yq:ℕ := x - 1⊢ reachPos (cmpCfg (x - 1) (terras y - 1) 1) (stageCfg (x + 1) (x + 1)) x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras yz:ℕ := terras yq:ℕ := x - 1vRem:ℕ := z - x - 1⊢ reachPos (cmpCfg (x - 1) (terras y - 1) 1) (stageCfg (x + 1) (x + 1)) x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras yz:ℕ := terras yq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + q⊢ reachPos (cmpCfg (x - 1) (terras y - 1) 1) (stageCfg (x + 1) (x + 1)) x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras yz:ℕ := terras yq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + q⊢ reachPos (cmpCfg (x - 1) (terras y - 1) 1) (stageCfg (x + 1) (x + 1)) x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras yz:ℕ := terras yq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + q⊢ reachPos (cmpCfg (0 + q) (vRem + 1 + q) 1) (stageCfg (x + 1) (x + 1)) x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras yz:ℕ := terras yq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhq0:q = 0⊢ reachPos (cmpCfg (0 + q) (vRem + 1 + q) 1) (stageCfg (x + 1) (x + 1))x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras yz:ℕ := terras yq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhp:reachPos (cmpCfg (0 + q) (vRem + 1 + q) 1) (cmpCfg 0 (vRem + 1) (1 + q))⊢ reachPos (cmpCfg (0 + q) (vRem + 1 + q) 1) (stageCfg (x + 1) (x + 1)) x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras yz:ℕ := terras yq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhq0:q = 0⊢ reachPos (cmpCfg (0 + q) (vRem + 1 + q) 1) (stageCfg (x + 1) (x + 1)) x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras yz:ℕ := terras yq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhq0:q = 0⊢ False; x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras yz:ℕ := terras yq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhq0:x - 1 = 0⊢ False; All goals completed! 🐙 x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras yz:ℕ := terras yq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhp:reachPos (cmpCfg (0 + q) (vRem + 1 + q) 1) (cmpCfg 0 (vRem + 1) (1 + q))⊢ reachPos (cmpCfg (0 + q) (vRem + 1 + q) 1) (stageCfg (x + 1) (x + 1)) x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras yz:ℕ := terras yq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhp:reachPos (cmpCfg (0 + q) (vRem + 1 + q) 1) (cmpCfg 0 (vRem + 1) x)⊢ reachPos (cmpCfg (0 + q) (vRem + 1 + q) 1) (stageCfg (x + 1) (x + 1)) exact reachPos_trans hp (cmp_gt_advance vRem x (x:ℕy:ℕhx:3 ≤ xhy:2 ≤ yhgt:x < terras yz:ℕ := terras yq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhp:reachPos (cmpCfg (0 + q) (vRem + 1 + q) 1) (cmpCfg 0 (vRem + 1) x)⊢ 1 ≤ x All goals completed! 🐙))private theorem boot_to_rest1 : reachPos init (restCfg 0 0 1) := ⊢ reachPos init (restCfg 0 0 1) refine ⟨5, ⊢ 1 ≤ 5 All goals completed! 🐙, ?_⟩ ⊢ nSteps weakCollatz27 5 { state := 0, tape := { head := 0, left := B0, right := B0 } } = some (restCfg 0 0 1) All goals completed! 🐙private theorem init_reaches_stage3 : reachPos init (stageCfg 3 3) := ⊢ reachPos init (stageCfg 3 3) h1:reachPos init (stageCfg 1 1)⊢ reachPos init (stageCfg 3 3) h1:reachPos init (stageCfg 1 1)h2:reachPos (stageCfg 1 1) (stageCfg 2 2)⊢ reachPos init (stageCfg 3 3) h1:reachPos init (stageCfg 1 1)h2:reachPos (stageCfg 1 1) (stageCfg 2 2)ht2:terras 2 = 1⊢ reachPos init (stageCfg 3 3) h1:reachPos init (stageCfg 1 1)h2:reachPos (stageCfg 1 1) (stageCfg 2 2)ht2:terras 2 = 1h21:reachPos (stageCfg 2 2) (stageCfg 2 1)⊢ reachPos init (stageCfg 3 3) h1:reachPos init (stageCfg 1 1)h2:reachPos (stageCfg 1 1) (stageCfg 2 2)ht2:terras 2 = 1h21:reachPos (stageCfg 2 2) (stageCfg 2 1)h3:reachPos (stageCfg 2 1) (stageCfg 3 3)⊢ reachPos init (stageCfg 3 3) All goals completed! 🐙

Cycle-Maximum Dovetailing & Halting Equivalence

private theorem terras_iterate_pos {y : ℕ} (hy : 1 ≤ y) (m : ℕ) : 1 ≤ terras^[m] y := y:ℕhy:1 ≤ ym:ℕ⊢ 1 ≤ terras^[m] y induction m generalizing y with y:ℕhy:1 ≤ y⊢ 1 ≤ terras^[0] y All goals completed! 🐙 m:ℕih:∀ {y : ℕ}, 1 ≤ y → 1 ≤ terras^[m] yy:ℕhy:1 ≤ y⊢ 1 ≤ terras^[m + 1] y m:ℕih:∀ {y : ℕ}, 1 ≤ y → 1 ≤ terras^[m] yy:ℕhy:1 ≤ y⊢ 1 ≤ terras^[m] (terras y) All goals completed! 🐙private def StepContinues (x t : ℕ) : Prop := 2 ≤ terras^[t] x ∧ terras^[t] x < xprivate def StayIn (x m : ℕ) : Prop := ∀ t : ℕ, 1 ≤ t → t ≤ m → StepContinues x tprivate theorem stayIn_or_first_exit (x m : ℕ) : StayIn x m ∨ ∃ t : ℕ, 1 ≤ t ∧ t ≤ m ∧ StayIn x (t - 1) ∧ ¬ StepContinues x t := x:ℕm:ℕ⊢ StayIn x m ∨ ∃ t, 1 ≤ t ∧ t ≤ m ∧ StayIn x (t - 1) ∧ ¬StepContinues x t induction m with x:ℕ⊢ StayIn x 0 ∨ ∃ t, 1 ≤ t ∧ t ≤ 0 ∧ StayIn x (t - 1) ∧ ¬StepContinues x t exact Or.inl fun t ht1 ht0 => absurd (le_trans ht1 ht0) (x:ℕt:ℕht1:1 ≤ tht0:t ≤ 0⊢ ¬1 ≤ 0 All goals completed! 🐙) x:ℕm:ℕih:StayIn x m ∨ ∃ t, 1 ≤ t ∧ t ≤ m ∧ StayIn x (t - 1) ∧ ¬StepContinues x t⊢ StayIn x (m + 1) ∨ ∃ t, 1 ≤ t ∧ t ≤ m + 1 ∧ StayIn x (t - 1) ∧ ¬StepContinues x t x:ℕm:ℕhstay:StayIn x m⊢ StayIn x (m + 1) ∨ ∃ t, 1 ≤ t ∧ t ≤ m + 1 ∧ StayIn x (t - 1) ∧ ¬StepContinues x tx:ℕm:ℕt:ℕht1:1 ≤ thtm:t ≤ mhprev:StayIn x (t - 1)hexit:¬StepContinues x t⊢ StayIn x (m + 1) ∨ ∃ t, 1 ≤ t ∧ t ≤ m + 1 ∧ StayIn x (t - 1) ∧ ¬StepContinues x t x:ℕm:ℕhstay:StayIn x m⊢ StayIn x (m + 1) ∨ ∃ t, 1 ≤ t ∧ t ≤ m + 1 ∧ StayIn x (t - 1) ∧ ¬StepContinues x t x:ℕm:ℕhstay:StayIn x mhstep:2 ≤ terras^[m + 1] x ∧ terras^[m + 1] x < x⊢ StayIn x (m + 1) ∨ ∃ t, 1 ≤ t ∧ t ≤ m + 1 ∧ StayIn x (t - 1) ∧ ¬StepContinues x tx:ℕm:ℕhstay:StayIn x mhstep:¬(2 ≤ terras^[m + 1] x ∧ terras^[m + 1] x < x)⊢ StayIn x (m + 1) ∨ ∃ t, 1 ≤ t ∧ t ≤ m + 1 ∧ StayIn x (t - 1) ∧ ¬StepContinues x t x:ℕm:ℕhstay:StayIn x mhstep:2 ≤ terras^[m + 1] x ∧ terras^[m + 1] x < x⊢ StayIn x (m + 1) ∨ ∃ t, 1 ≤ t ∧ t ≤ m + 1 ∧ StayIn x (t - 1) ∧ ¬StepContinues x t x:ℕm:ℕhstay:StayIn x mhstep:2 ≤ terras^[m + 1] x ∧ terras^[m + 1] x < xt:ℕht1:1 ≤ thtm1:t ≤ m + 1⊢ StepContinues x t x:ℕm:ℕhstay:StayIn x mhstep:2 ≤ terras^[m + 1] x ∧ terras^[m + 1] x < xt:ℕht1:1 ≤ thtm1:t ≤ m + 1hlt:t < m + 1⊢ StepContinues x tx:ℕm:ℕhstay:StayIn x mhstep:2 ≤ terras^[m + 1] x ∧ terras^[m + 1] x < xt:ℕht1:1 ≤ thtm1:t ≤ m + 1hge:t ≥ m + 1⊢ StepContinues x t x:ℕm:ℕhstay:StayIn x mhstep:2 ≤ terras^[m + 1] x ∧ terras^[m + 1] x < xt:ℕht1:1 ≤ thtm1:t ≤ m + 1hlt:t < m + 1⊢ StepContinues x t exact hstay t ht1 (x:ℕm:ℕhstay:StayIn x mhstep:2 ≤ terras^[m + 1] x ∧ terras^[m + 1] x < xt:ℕht1:1 ≤ thtm1:t ≤ m + 1hlt:t < m + 1⊢ t ≤ m All goals completed! 🐙) x:ℕm:ℕhstay:StayIn x mhstep:2 ≤ terras^[m + 1] x ∧ terras^[m + 1] x < xt:ℕht1:1 ≤ thtm1:t ≤ m + 1hge:t ≥ m + 1⊢ StepContinues x t x:ℕm:ℕhstay:StayIn x mhstep:2 ≤ terras^[m + 1] x ∧ terras^[m + 1] x < xt:ℕht1:1 ≤ thtm1:t ≤ m + 1hge:t ≥ m + 1⊢ StepContinues x (m + 1); All goals completed! 🐙 x:ℕm:ℕhstay:StayIn x mhstep:¬(2 ≤ terras^[m + 1] x ∧ terras^[m + 1] x < x)⊢ StayIn x (m + 1) ∨ ∃ t, 1 ≤ t ∧ t ≤ m + 1 ∧ StayIn x (t - 1) ∧ ¬StepContinues x t exact Or.inr ⟨m + 1, x:ℕm:ℕhstay:StayIn x mhstep:¬(2 ≤ terras^[m + 1] x ∧ terras^[m + 1] x < x)⊢ 1 ≤ m + 1 All goals completed! 🐙, le_rfl, hstay, hstep⟩ x:ℕm:ℕt:ℕht1:1 ≤ thtm:t ≤ mhprev:StayIn x (t - 1)hexit:¬StepContinues x t⊢ StayIn x (m + 1) ∨ ∃ t, 1 ≤ t ∧ t ≤ m + 1 ∧ StayIn x (t - 1) ∧ ¬StepContinues x t exact Or.inr ⟨t, ht1, x:ℕm:ℕt:ℕht1:1 ≤ thtm:t ≤ mhprev:StayIn x (t - 1)hexit:¬StepContinues x t⊢ t ≤ m + 1 All goals completed! 🐙, hprev, hexit⟩private theorem stage_stay_reach (x : ℕ) (hx : 3 ≤ x) (m : ℕ) (hstay : StayIn x m) : m = 0 ∨ (1 ≤ m ∧ reachPos (stageCfg x x) (stageCfg x (terras^[m] x))) := x:ℕhx:3 ≤ xm:ℕhstay:StayIn x m⊢ m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x x) (stageCfg x (terras^[m] x)) induction m with x:ℕhx:3 ≤ xhstay:StayIn x 0⊢ 0 = 0 ∨ 1 ≤ 0 ∧ reachPos (stageCfg x x) (stageCfg x (terras^[0] x)) All goals completed! 🐙 x:ℕhx:3 ≤ xm:ℕih:StayIn x m → m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x x) (stageCfg x (terras^[m] x))hstay:StayIn x (m + 1)⊢ m + 1 = 0 ∨ 1 ≤ m + 1 ∧ reachPos (stageCfg x x) (stageCfg x (terras^[m + 1] x)) refine Or.inr ⟨x:ℕhx:3 ≤ xm:ℕih:StayIn x m → m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x x) (stageCfg x (terras^[m] x))hstay:StayIn x (m + 1)⊢ 1 ≤ m + 1 All goals completed! 🐙, ?_⟩ x:ℕhx:3 ≤ xm:ℕih:StayIn x m → m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x x) (stageCfg x (terras^[m] x))hstay:StayIn x (m + 1)hstep:StepContinues x (m + 1)⊢ reachPos (stageCfg x x) (stageCfg x (terras^[m + 1] x)) rcases ih (fun t ht1 htm => hstay t ht1 (x:ℕhx:3 ≤ xm:ℕih:StayIn x m → m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x x) (stageCfg x (terras^[m] x))hstay:StayIn x (m + 1)hstep:StepContinues x (m + 1)t:ℕht1:1 ≤ thtm:t ≤ m⊢ t ≤ m + 1 All goals completed! 🐙)) with rfl | ⟨hm1, hprev⟩ x:ℕhx:3 ≤ xih:StayIn x 0 → 0 = 0 ∨ 1 ≤ 0 ∧ reachPos (stageCfg x x) (stageCfg x (terras^[0] x))hstay:StayIn x (0 + 1)hstep:StepContinues x (0 + 1)⊢ reachPos (stageCfg x x) (stageCfg x (terras^[0 + 1] x)) x:ℕhx:3 ≤ xih:StayIn x 0 → 0 = 0 ∨ 1 ≤ 0 ∧ reachPos (stageCfg x x) (stageCfg x (terras^[0] x))hstay:StayIn x (0 + 1)hstep:StepContinues x (0 + 1)hlt1:terras x < x⊢ reachPos (stageCfg x x) (stageCfg x (terras^[0 + 1] x)) x:ℕhx:3 ≤ xih:StayIn x 0 → 0 = 0 ∨ 1 ≤ 0 ∧ reachPos (stageCfg x x) (stageCfg x (terras^[0] x))hstay:StayIn x (0 + 1)hstep:StepContinues x (0 + 1)hlt1:terras x < x⊢ reachPos (stageCfg x x) (stageCfg x (terras x)) exact stage_round_lt x x (x:ℕhx:3 ≤ xih:StayIn x 0 → 0 = 0 ∨ 1 ≤ 0 ∧ reachPos (stageCfg x x) (stageCfg x (terras^[0] x))hstay:StayIn x (0 + 1)hstep:StepContinues x (0 + 1)hlt1:terras x < x⊢ 2 ≤ x All goals completed! 🐙) (x:ℕhx:3 ≤ xih:StayIn x 0 → 0 = 0 ∨ 1 ≤ 0 ∧ reachPos (stageCfg x x) (stageCfg x (terras^[0] x))hstay:StayIn x (0 + 1)hstep:StepContinues x (0 + 1)hlt1:terras x < x⊢ 2 ≤ x All goals completed! 🐙) hlt1 x:ℕhx:3 ≤ xm:ℕih:StayIn x m → m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x x) (stageCfg x (terras^[m] x))hstay:StayIn x (m + 1)hstep:StepContinues x (m + 1)hm1:1 ≤ mhprev:reachPos (stageCfg x x) (stageCfg x (terras^[m] x))⊢ reachPos (stageCfg x x) (stageCfg x (terras^[m + 1] x)) x:ℕhx:3 ≤ xm:ℕih:StayIn x m → m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x x) (stageCfg x (terras^[m] x))hstay:StayIn x (m + 1)hstep:StepContinues x (m + 1)hm1:1 ≤ mhprev:reachPos (stageCfg x x) (stageCfg x (terras^[m] x))hym:2 ≤ terras^[m] x⊢ reachPos (stageCfg x x) (stageCfg x (terras^[m + 1] x)) x:ℕhx:3 ≤ xm:ℕih:StayIn x m → m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x x) (stageCfg x (terras^[m] x))hstay:StayIn x (m + 1)hstep:StepContinues x (m + 1)hm1:1 ≤ mhprev:reachPos (stageCfg x x) (stageCfg x (terras^[m] x))hym:2 ≤ terras^[m] xhlt:terras (terras^[m] x) < x⊢ reachPos (stageCfg x x) (stageCfg x (terras^[m + 1] x)) x:ℕhx:3 ≤ xm:ℕih:StayIn x m → m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x x) (stageCfg x (terras^[m] x))hstay:StayIn x (m + 1)hstep:StepContinues x (m + 1)hm1:1 ≤ mhprev:reachPos (stageCfg x x) (stageCfg x (terras^[m] x))hym:2 ≤ terras^[m] xhlt:terras (terras^[m] x) < x⊢ reachPos (stageCfg x x) (stageCfg x (terras (terras^[m] x))) exact reachPos_trans hprev (stage_round_lt x (terras^[m] x) (x:ℕhx:3 ≤ xm:ℕih:StayIn x m → m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x x) (stageCfg x (terras^[m] x))hstay:StayIn x (m + 1)hstep:StepContinues x (m + 1)hm1:1 ≤ mhprev:reachPos (stageCfg x x) (stageCfg x (terras^[m] x))hym:2 ≤ terras^[m] xhlt:terras (terras^[m] x) < x⊢ 2 ≤ x All goals completed! 🐙) hym hlt)private def StageHalts (x : ℕ) : Prop := ∃ t : ℕ, 1 ≤ t ∧ t ≤ x ∧ StayIn x (t - 1) ∧ terras^[t] x = xprivate theorem stageHalts_decidable (x : ℕ) : StageHalts x ∨ ¬ StageHalts x := x:ℕ⊢ StageHalts x ∨ ¬StageHalts x x:ℕhstay:StayIn x x⊢ StageHalts x ∨ ¬StageHalts xx:ℕt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x t⊢ StageHalts x ∨ ¬StageHalts x x:ℕhstay:StayIn x x⊢ StageHalts x ∨ ¬StageHalts x x:ℕhstay:StayIn x x⊢ ¬StageHalts x x:ℕhstay:StayIn x xt:ℕht1:1 ≤ thtx:t ≤ xleft✝:StayIn x (t - 1)hhit:terras^[t] x = x⊢ False x:ℕhstay:StayIn x xt:ℕht1:1 ≤ thtx:t ≤ xleft✝:StayIn x (t - 1)hhit:terras^[t] x = xhlt:terras^[t] x < x⊢ False All goals completed! 🐙 x:ℕt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x t⊢ StageHalts x ∨ ¬StageHalts x x:ℕt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thhit:terras^[t] x = x⊢ StageHalts x ∨ ¬StageHalts xx:ℕt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thhit:¬terras^[t] x = x⊢ StageHalts x ∨ ¬StageHalts x x:ℕt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thhit:terras^[t] x = x⊢ StageHalts x ∨ ¬StageHalts x All goals completed! 🐙 x:ℕt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thhit:¬terras^[t] x = x⊢ StageHalts x ∨ ¬StageHalts x x:ℕt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thhit:¬terras^[t] x = x⊢ ¬StageHalts x x:ℕt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thhit:¬terras^[t] x = xt':ℕht'1:1 ≤ t'ht'x:t' ≤ xhprev':StayIn x (t' - 1)hhit':terras^[t'] x = x⊢ False x:ℕt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thhit:¬terras^[t] x = xt':ℕht'1:1 ≤ t'ht'x:t' ≤ xhprev':StayIn x (t' - 1)hhit':terras^[t'] x = xhlt:t' < t⊢ Falsex:ℕt':ℕht'1:1 ≤ t'ht'x:t' ≤ xhprev':StayIn x (t' - 1)hhit':terras^[t'] x = xht1:1 ≤ t'htx:t' ≤ xhprev:StayIn x (t' - 1)hexit:¬StepContinues x t'hhit:¬terras^[t'] x = x⊢ Falsex:ℕt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thhit:¬terras^[t] x = xt':ℕht'1:1 ≤ t'ht'x:t' ≤ xhprev':StayIn x (t' - 1)hhit':terras^[t'] x = xhgt:t < t'⊢ False x:ℕt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thhit:¬terras^[t] x = xt':ℕht'1:1 ≤ t'ht'x:t' ≤ xhprev':StayIn x (t' - 1)hhit':terras^[t'] x = xhlt:t' < t⊢ False x:ℕt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thhit:¬terras^[t] x = xt':ℕht'1:1 ≤ t'ht'x:t' ≤ xhprev':StayIn x (t' - 1)hhit':terras^[t'] x = xhlt:t' < thlt_x:terras^[t'] x < x⊢ False All goals completed! 🐙 x:ℕt':ℕht'1:1 ≤ t'ht'x:t' ≤ xhprev':StayIn x (t' - 1)hhit':terras^[t'] x = xht1:1 ≤ t'htx:t' ≤ xhprev:StayIn x (t' - 1)hexit:¬StepContinues x t'hhit:¬terras^[t'] x = x⊢ False All goals completed! 🐙 x:ℕt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thhit:¬terras^[t] x = xt':ℕht'1:1 ≤ t'ht'x:t' ≤ xhprev':StayIn x (t' - 1)hhit':terras^[t'] x = xhgt:t < t'⊢ False x:ℕt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thhit:¬terras^[t] x = xt':ℕht'1:1 ≤ t'ht'x:t' ≤ xhprev':StayIn x (t' - 1)hhit':terras^[t'] x = xhgt:t < t'hcont:StepContinues x t⊢ False All goals completed! 🐙private theorem stageHalts_of_cycle_max {M j : ℕ} (_hM3 : 3 ≤ M) (hj1 : 1 ≤ j) (hjM : j ≤ M) (hcyc : terras^[j] M = M) (hbnd : ∀ t : ℕ, 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) : StageHalts M := M:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M⊢ StageHalts M M:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mhstay:StayIn M j⊢ StageHalts MM:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mt:ℕht1:1 ≤ thtj:t ≤ jhprev:StayIn M (t - 1)hexit:¬StepContinues M t⊢ StageHalts M M:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mhstay:StayIn M j⊢ StageHalts M M:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mhstay:StayIn M j⊢ False M:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mhstay:StayIn M jhlt:terras^[j] M < M⊢ False All goals completed! 🐙 M:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mt:ℕht1:1 ≤ thtj:t ≤ jhprev:StayIn M (t - 1)hexit:¬StepContinues M t⊢ StageHalts M refine ⟨t, ht1, M:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mt:ℕht1:1 ≤ thtj:t ≤ jhprev:StayIn M (t - 1)hexit:¬StepContinues M t⊢ t ≤ M All goals completed! 🐙, hprev, ?_⟩ M:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mt:ℕht1:1 ≤ thtj:t ≤ jhprev:StayIn M (t - 1)hexit:¬StepContinues M tht_bnd:3 ≤ terras^[t] M ∧ terras^[t] M ≤ M⊢ terras^[t] M = M M:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mt:ℕht1:1 ≤ thtj:t ≤ jhprev:StayIn M (t - 1)hexit:¬StepContinues M tht_bnd:3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mhhit:terras^[t] M = M⊢ terras^[t] M = MM:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mt:ℕht1:1 ≤ thtj:t ≤ jhprev:StayIn M (t - 1)hexit:¬StepContinues M tht_bnd:3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mhhit:¬terras^[t] M = M⊢ terras^[t] M = M M:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mt:ℕht1:1 ≤ thtj:t ≤ jhprev:StayIn M (t - 1)hexit:¬StepContinues M tht_bnd:3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mhhit:terras^[t] M = M⊢ terras^[t] M = M All goals completed! 🐙 M:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mt:ℕht1:1 ≤ thtj:t ≤ jhprev:StayIn M (t - 1)hexit:¬StepContinues M tht_bnd:3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mhhit:¬terras^[t] M = M⊢ terras^[t] M = M M:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mt:ℕht1:1 ≤ thtj:t ≤ jhprev:StayIn M (t - 1)hexit:¬StepContinues M tht_bnd:3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mhhit:¬terras^[t] M = M⊢ False exact hexit ⟨M:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mt:ℕht1:1 ≤ thtj:t ≤ jhprev:StayIn M (t - 1)hexit:¬StepContinues M tht_bnd:3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mhhit:¬terras^[t] M = M⊢ 2 ≤ terras^[t] M All goals completed! 🐙, M:ℕj:ℕ_hM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ Mhcyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mt:ℕht1:1 ≤ thtj:t ≤ jhprev:StayIn M (t - 1)hexit:¬StepContinues M tht_bnd:3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mhhit:¬terras^[t] M = M⊢ terras^[t] M < M All goals completed! 🐙⟩private def NoStageHalts (X : ℕ) : Prop := ∀ w : ℕ, 3 ≤ w → w ≤ X → ¬ StageHalts wprivate theorem noStageHalts_or_first (X : ℕ) : NoStageHalts X ∨ ∃ w : ℕ, 3 ≤ w ∧ w ≤ X ∧ NoStageHalts (w - 1) ∧ StageHalts w := X:ℕ⊢ NoStageHalts X ∨ ∃ w, 3 ≤ w ∧ w ≤ X ∧ NoStageHalts (w - 1) ∧ StageHalts w induction X with ⊢ NoStageHalts 0 ∨ ∃ w, 3 ≤ w ∧ w ≤ 0 ∧ NoStageHalts (w - 1) ∧ StageHalts w exact Or.inl fun w hw3 hw0 => absurd (le_trans hw3 hw0) (w:ℕhw3:3 ≤ whw0:w ≤ 0⊢ ¬3 ≤ 0 All goals completed! 🐙) X:ℕih:NoStageHalts X ∨ ∃ w, 3 ≤ w ∧ w ≤ X ∧ NoStageHalts (w - 1) ∧ StageHalts w⊢ NoStageHalts (X + 1) ∨ ∃ w, 3 ≤ w ∧ w ≤ X + 1 ∧ NoStageHalts (w - 1) ∧ StageHalts w X:ℕhno:NoStageHalts X⊢ NoStageHalts (X + 1) ∨ ∃ w, 3 ≤ w ∧ w ≤ X + 1 ∧ NoStageHalts (w - 1) ∧ StageHalts wX:ℕw:ℕhw3:3 ≤ whwX:w ≤ Xhprev:NoStageHalts (w - 1)hhalt:StageHalts w⊢ NoStageHalts (X + 1) ∨ ∃ w, 3 ≤ w ∧ w ≤ X + 1 ∧ NoStageHalts (w - 1) ∧ StageHalts w X:ℕhno:NoStageHalts X⊢ NoStageHalts (X + 1) ∨ ∃ w, 3 ≤ w ∧ w ≤ X + 1 ∧ NoStageHalts (w - 1) ∧ StageHalts w X:ℕhno:NoStageHalts Xhw3:3 ≤ X + 1⊢ NoStageHalts (X + 1) ∨ ∃ w, 3 ≤ w ∧ w ≤ X + 1 ∧ NoStageHalts (w - 1) ∧ StageHalts wX:ℕhno:NoStageHalts Xhw3:¬3 ≤ X + 1⊢ NoStageHalts (X + 1) ∨ ∃ w, 3 ≤ w ∧ w ≤ X + 1 ∧ NoStageHalts (w - 1) ∧ StageHalts w X:ℕhno:NoStageHalts Xhw3:3 ≤ X + 1⊢ NoStageHalts (X + 1) ∨ ∃ w, 3 ≤ w ∧ w ≤ X + 1 ∧ NoStageHalts (w - 1) ∧ StageHalts w X:ℕhno:NoStageHalts Xhw3:3 ≤ X + 1hhalt:StageHalts (X + 1)⊢ NoStageHalts (X + 1) ∨ ∃ w, 3 ≤ w ∧ w ≤ X + 1 ∧ NoStageHalts (w - 1) ∧ StageHalts wX:ℕhno:NoStageHalts Xhw3:3 ≤ X + 1hnhalt:¬StageHalts (X + 1)⊢ NoStageHalts (X + 1) ∨ ∃ w, 3 ≤ w ∧ w ≤ X + 1 ∧ NoStageHalts (w - 1) ∧ StageHalts w X:ℕhno:NoStageHalts Xhw3:3 ≤ X + 1hhalt:StageHalts (X + 1)⊢ NoStageHalts (X + 1) ∨ ∃ w, 3 ≤ w ∧ w ≤ X + 1 ∧ NoStageHalts (w - 1) ∧ StageHalts w All goals completed! 🐙 X:ℕhno:NoStageHalts Xhw3:3 ≤ X + 1hnhalt:¬StageHalts (X + 1)⊢ NoStageHalts (X + 1) ∨ ∃ w, 3 ≤ w ∧ w ≤ X + 1 ∧ NoStageHalts (w - 1) ∧ StageHalts w X:ℕhno:NoStageHalts Xhw3:3 ≤ X + 1hnhalt:¬StageHalts (X + 1)w:ℕhw_ge3:3 ≤ whw_le:w ≤ X + 1⊢ ¬StageHalts w X:ℕhno:NoStageHalts Xhw3:3 ≤ X + 1hnhalt:¬StageHalts (X + 1)w:ℕhw_ge3:3 ≤ whw_le:w ≤ X + 1hlt:w < X + 1⊢ ¬StageHalts wX:ℕhno:NoStageHalts Xhw3:3 ≤ X + 1hnhalt:¬StageHalts (X + 1)w:ℕhw_ge3:3 ≤ whw_le:w ≤ X + 1hge:w ≥ X + 1⊢ ¬StageHalts w X:ℕhno:NoStageHalts Xhw3:3 ≤ X + 1hnhalt:¬StageHalts (X + 1)w:ℕhw_ge3:3 ≤ whw_le:w ≤ X + 1hlt:w < X + 1⊢ ¬StageHalts w exact hno w hw_ge3 (X:ℕhno:NoStageHalts Xhw3:3 ≤ X + 1hnhalt:¬StageHalts (X + 1)w:ℕhw_ge3:3 ≤ whw_le:w ≤ X + 1hlt:w < X + 1⊢ w ≤ X All goals completed! 🐙) X:ℕhno:NoStageHalts Xhw3:3 ≤ X + 1hnhalt:¬StageHalts (X + 1)w:ℕhw_ge3:3 ≤ whw_le:w ≤ X + 1hge:w ≥ X + 1⊢ ¬StageHalts w X:ℕhno:NoStageHalts Xhw3:3 ≤ X + 1hnhalt:¬StageHalts (X + 1)w:ℕhw_ge3:3 ≤ whw_le:w ≤ X + 1hge:w ≥ X + 1⊢ ¬StageHalts (X + 1); All goals completed! 🐙 X:ℕhno:NoStageHalts Xhw3:¬3 ≤ X + 1⊢ NoStageHalts (X + 1) ∨ ∃ w, 3 ≤ w ∧ w ≤ X + 1 ∧ NoStageHalts (w - 1) ∧ StageHalts w All goals completed! 🐙 X:ℕw:ℕhw3:3 ≤ whwX:w ≤ Xhprev:NoStageHalts (w - 1)hhalt:StageHalts w⊢ NoStageHalts (X + 1) ∨ ∃ w, 3 ≤ w ∧ w ≤ X + 1 ∧ NoStageHalts (w - 1) ∧ StageHalts w exact Or.inr ⟨w, hw3, X:ℕw:ℕhw3:3 ≤ whwX:w ≤ Xhprev:NoStageHalts (w - 1)hhalt:StageHalts w⊢ w ≤ X + 1 All goals completed! 🐙, hprev, hhalt⟩private theorem not_stayIn_self_of_noStageHalts {x : ℕ} (hx : 3 ≤ x) (hno : NoStageHalts (x - 1)) : ¬ StayIn x x := x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)⊢ ¬StayIn x x x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x x⊢ False x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3⊢ False x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3f:ℕ → ℕ := fun i ↦ terras^[i + 1] x - 2⊢ False x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3f:ℕ → ℕ := fun i ↦ terras^[i + 1] x - 2hf_lt:∀ i ≤ N + 1, f i < N + 1⊢ False x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3f:ℕ → ℕ := fun i ↦ terras^[i + 1] x - 2hf_lt:∀ i ≤ N + 1, f i < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f b⊢ False x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3f:ℕ → ℕ := fun i ↦ terras^[i + 1] x - 2hf_lt:∀ i ≤ N + 1, f i < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_step:StepContinues x (a + 1)⊢ False x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3f:ℕ → ℕ := fun i ↦ terras^[i + 1] x - 2hf_lt:∀ i ≤ N + 1, f i < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_step:StepContinues x (a + 1)hb_step:StepContinues x (b + 1)⊢ False x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3f:ℕ → ℕ := fun i ↦ terras^[i + 1] x - 2hf_lt:∀ i ≤ N + 1, f i < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_step:StepContinues x (a + 1)hb_step:StepContinues x (b + 1)hab_eq:terras^[a + 1] x = terras^[b + 1] x⊢ False x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3f:ℕ → ℕ := fun i ↦ terras^[i + 1] x - 2hf_lt:∀ i ≤ N + 1, f i < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_step:StepContinues x (a + 1)hb_step:StepContinues x (b + 1)hab_eq:terras^[a + 1] x = terras^[b + 1] xu:ℕ := terras^[a + 1] x⊢ False x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3f:ℕ → ℕ := fun i ↦ terras^[i + 1] x - 2hf_lt:∀ i ≤ N + 1, f i < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_step:StepContinues x (a + 1)hb_step:StepContinues x (b + 1)hab_eq:terras^[a + 1] x = terras^[b + 1] xu:ℕ := terras^[a + 1] xhu3:3 ≤ u⊢ False x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3f:ℕ → ℕ := fun i ↦ terras^[i + 1] x - 2hf_lt:∀ i ≤ N + 1, f i < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_step:StepContinues x (a + 1)hb_step:StepContinues x (b + 1)hab_eq:terras^[a + 1] x = terras^[b + 1] xu:ℕ := terras^[a + 1] xhu3:3 ≤ uk:ℕ := b - a⊢ False x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3f:ℕ → ℕ := fun i ↦ terras^[i + 1] x - 2hf_lt:∀ i ≤ N + 1, f i < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_step:StepContinues x (a + 1)hb_step:StepContinues x (b + 1)hab_eq:terras^[a + 1] x = terras^[b + 1] xu:ℕ := terras^[a + 1] xhu3:3 ≤ uk:ℕ := b - ahk1:1 ≤ k⊢ False x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3f:ℕ → ℕ := fun i ↦ terras^[i + 1] x - 2hf_lt:∀ i ≤ N + 1, f i < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_step:StepContinues x (a + 1)hb_step:StepContinues x (b + 1)hab_eq:terras^[a + 1] x = terras^[b + 1] xu:ℕ := terras^[a + 1] xhu3:3 ≤ uk:ℕ := b - ahk1:1 ≤ khu_cyc:terras^[k] u = u⊢ False x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3f:ℕ → ℕ := fun i ↦ terras^[i + 1] x - 2hf_lt:∀ i ≤ N + 1, f i < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_step:StepContinues x (a + 1)hb_step:StepContinues x (b + 1)hab_eq:terras^[a + 1] x = terras^[b + 1] xu:ℕ := terras^[a + 1] xhu3:3 ≤ uk:ℕ := b - ahk1:1 ≤ khu_cyc:terras^[k] u = uM:ℕj:ℕhM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ M - 2hj_cyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mi:ℕhik:i < khi_M:terras^[i] u = M⊢ False x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3f:ℕ → ℕ := fun i ↦ terras^[i + 1] x - 2hf_lt:∀ i ≤ N + 1, f i < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_step:StepContinues x (a + 1)hb_step:StepContinues x (b + 1)hab_eq:terras^[a + 1] x = terras^[b + 1] xu:ℕ := terras^[a + 1] xhu3:3 ≤ uk:ℕ := b - ahk1:1 ≤ khu_cyc:terras^[k] u = uM:ℕj:ℕhM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ M - 2hj_cyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mi:ℕhik:i < khi_M:terras^[i] u = MhM_lt_x:M < x⊢ False x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3f:ℕ → ℕ := fun i ↦ terras^[i + 1] x - 2hf_lt:∀ i ≤ N + 1, f i < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_step:StepContinues x (a + 1)hb_step:StepContinues x (b + 1)hab_eq:terras^[a + 1] x = terras^[b + 1] xu:ℕ := terras^[a + 1] xhu3:3 ≤ uk:ℕ := b - ahk1:1 ≤ khu_cyc:terras^[k] u = uM:ℕj:ℕhM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ M - 2hj_cyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mi:ℕhik:i < khi_M:terras^[i] u = MhM_lt_x:M < xhM_halts:StageHalts M⊢ False exact hno M hM3 (x:ℕhx:3 ≤ xhno:NoStageHalts (x - 1)hstay:StayIn x xN:ℕ := x - 3f:ℕ → ℕ := fun i ↦ terras^[i + 1] x - 2hf_lt:∀ i ≤ N + 1, f i < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_step:StepContinues x (a + 1)hb_step:StepContinues x (b + 1)hab_eq:terras^[a + 1] x = terras^[b + 1] xu:ℕ := terras^[a + 1] xhu3:3 ≤ uk:ℕ := b - ahk1:1 ≤ khu_cyc:terras^[k] u = uM:ℕj:ℕhM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ M - 2hj_cyc:terras^[j] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ Mi:ℕhik:i < khi_M:terras^[i] u = MhM_lt_x:M < xhM_halts:StageHalts M⊢ M ≤ x - 1 All goals completed! 🐙) hM_haltsprivate theorem stage_advance_of_noStageHalts (x : ℕ) (hx : 3 ≤ x) (hno : NoStageHalts x) : reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) := x:ℕhx:3 ≤ xhno:NoStageHalts x⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xhstay:StayIn x x⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1))x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x t⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xhstay:StayIn x x⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xhstay:StayIn x x⊢ False exact not_stayIn_self_of_noStageHalts hx (fun w hw3 hwx => hno w hw3 (x:ℕhx:3 ≤ xhno:NoStageHalts xhstay:StayIn x xw:ℕhw3:3 ≤ whwx:w ≤ x - 1⊢ w ≤ x All goals completed! 🐙)) hstay x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x t⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts x⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ x⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] x⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xhor:terras^[t] x = 1 ∨ x < terras^[t] x⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xhor:terras^[t] x = 1 ∨ x < terras^[t] xht0:t - 1 = 0⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1))x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xhor:terras^[t] x = 1 ∨ x < terras^[t] xht1_pos:1 ≤ t - 1hreach_prev:reachPos (stageCfg x x) (stageCfg x (terras^[t - 1] x))⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xhor:terras^[t] x = 1 ∨ x < terras^[t] xht0:t - 1 = 0⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xhor:terras^[t] x = 1 ∨ x < terras^[t] xht0:t - 1 = 0ht_eq1:t = 1⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xhnot_halt:¬StageHalts xht1:1 ≤ 1htx:1 ≤ xhprev:StayIn x (1 - 1)hexit:¬StepContinues x 1hne_x:terras^[1] x ≠ xht_pos:1 ≤ terras^[1] xhor:terras^[1] x = 1 ∨ x < terras^[1] xht0:1 - 1 = 0⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xhnot_halt:¬StageHalts xht1:1 ≤ 1htx:1 ≤ xhprev:StayIn x (1 - 1)hexit:¬StepContinues x 1hne_x:terras^[1] x ≠ xht_pos:1 ≤ terras^[1] xhor:terras x = 1 ∨ x < terras xht0:1 - 1 = 0⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xhnot_halt:¬StageHalts xht1:1 ≤ 1htx:1 ≤ xhprev:StayIn x (1 - 1)hexit:¬StepContinues x 1hne_x:terras^[1] x ≠ xht_pos:1 ≤ terras^[1] xht0:1 - 1 = 0h1:terras x = 1⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1))x:ℕhx:3 ≤ xhno:NoStageHalts xhnot_halt:¬StageHalts xht1:1 ≤ 1htx:1 ≤ xhprev:StayIn x (1 - 1)hexit:¬StepContinues x 1hne_x:terras^[1] x ≠ xht_pos:1 ≤ terras^[1] xht0:1 - 1 = 0hgt:x < terras x⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xhnot_halt:¬StageHalts xht1:1 ≤ 1htx:1 ≤ xhprev:StayIn x (1 - 1)hexit:¬StepContinues x 1hne_x:terras^[1] x ≠ xht_pos:1 ≤ terras^[1] xht0:1 - 1 = 0h1:terras x = 1⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xhnot_halt:¬StageHalts xht1:1 ≤ 1htx:1 ≤ xhprev:StayIn x (1 - 1)hexit:¬StepContinues x 1hne_x:terras^[1] x ≠ xht_pos:1 ≤ terras^[1] xht0:1 - 1 = 0h1:terras x = 1hlt:reachPos (stageCfg x x) (stageCfg x (terras x))⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xhnot_halt:¬StageHalts xht1:1 ≤ 1htx:1 ≤ xhprev:StayIn x (1 - 1)hexit:¬StepContinues x 1hne_x:terras^[1] x ≠ xht_pos:1 ≤ terras^[1] xht0:1 - 1 = 0h1:terras x = 1hlt:reachPos (stageCfg x x) (stageCfg x 1)⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) exact reachPos_trans hlt (stage_y1_advance x (x:ℕhx:3 ≤ xhno:NoStageHalts xhnot_halt:¬StageHalts xht1:1 ≤ 1htx:1 ≤ xhprev:StayIn x (1 - 1)hexit:¬StepContinues x 1hne_x:terras^[1] x ≠ xht_pos:1 ≤ terras^[1] xht0:1 - 1 = 0h1:terras x = 1hlt:reachPos (stageCfg x x) (stageCfg x 1)⊢ 1 ≤ x All goals completed! 🐙)) x:ℕhx:3 ≤ xhno:NoStageHalts xhnot_halt:¬StageHalts xht1:1 ≤ 1htx:1 ≤ xhprev:StayIn x (1 - 1)hexit:¬StepContinues x 1hne_x:terras^[1] x ≠ xht_pos:1 ≤ terras^[1] xht0:1 - 1 = 0hgt:x < terras x⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) exact stage_round_gt x x hx (x:ℕhx:3 ≤ xhno:NoStageHalts xhnot_halt:¬StageHalts xht1:1 ≤ 1htx:1 ≤ xhprev:StayIn x (1 - 1)hexit:¬StepContinues x 1hne_x:terras^[1] x ≠ xht_pos:1 ≤ terras^[1] xht0:1 - 1 = 0hgt:x < terras x⊢ 2 ≤ x All goals completed! 🐙) hgt x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xhor:terras^[t] x = 1 ∨ x < terras^[t] xht1_pos:1 ≤ t - 1hreach_prev:reachPos (stageCfg x x) (stageCfg x (terras^[t - 1] x))⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xhor:terras^[t] x = 1 ∨ x < terras^[t] xht1_pos:1 ≤ t - 1hreach_prev:reachPos (stageCfg x x) (stageCfg x (terras^[t - 1] x))hy_prev:2 ≤ terras^[t - 1] x⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xhor:terras^[t] x = 1 ∨ x < terras^[t] xht1_pos:1 ≤ t - 1hreach_prev:reachPos (stageCfg x x) (stageCfg x (terras^[t - 1] x))hy_prev:2 ≤ terras^[t - 1] xhnext:terras (terras^[t - 1] x) = terras^[t] x⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xht1_pos:1 ≤ t - 1hreach_prev:reachPos (stageCfg x x) (stageCfg x (terras^[t - 1] x))hy_prev:2 ≤ terras^[t - 1] xhnext:terras (terras^[t - 1] x) = terras^[t] xh1:terras^[t] x = 1⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1))x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xht1_pos:1 ≤ t - 1hreach_prev:reachPos (stageCfg x x) (stageCfg x (terras^[t - 1] x))hy_prev:2 ≤ terras^[t - 1] xhnext:terras (terras^[t - 1] x) = terras^[t] xhgt:x < terras^[t] x⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xht1_pos:1 ≤ t - 1hreach_prev:reachPos (stageCfg x x) (stageCfg x (terras^[t - 1] x))hy_prev:2 ≤ terras^[t - 1] xhnext:terras (terras^[t - 1] x) = terras^[t] xh1:terras^[t] x = 1⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xht1_pos:1 ≤ t - 1hreach_prev:reachPos (stageCfg x x) (stageCfg x (terras^[t - 1] x))hy_prev:2 ≤ terras^[t - 1] xhnext:terras (terras^[t - 1] x) = terras^[t] xh1:terras^[t] x = 1hlt:reachPos (stageCfg x (terras^[t - 1] x)) (stageCfg x (terras (terras^[t - 1] x)))⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xht1_pos:1 ≤ t - 1hreach_prev:reachPos (stageCfg x x) (stageCfg x (terras^[t - 1] x))hy_prev:2 ≤ terras^[t - 1] xhnext:terras (terras^[t - 1] x) = terras^[t] xh1:terras^[t] x = 1hlt:reachPos (stageCfg x (terras^[t - 1] x)) (stageCfg x 1)⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) exact reachPos_trans hreach_prev (reachPos_trans hlt (stage_y1_advance x (x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xht1_pos:1 ≤ t - 1hreach_prev:reachPos (stageCfg x x) (stageCfg x (terras^[t - 1] x))hy_prev:2 ≤ terras^[t - 1] xhnext:terras (terras^[t - 1] x) = terras^[t] xh1:terras^[t] x = 1hlt:reachPos (stageCfg x (terras^[t - 1] x)) (stageCfg x 1)⊢ 1 ≤ x All goals completed! 🐙))) x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xht1_pos:1 ≤ t - 1hreach_prev:reachPos (stageCfg x x) (stageCfg x (terras^[t - 1] x))hy_prev:2 ≤ terras^[t - 1] xhnext:terras (terras^[t - 1] x) = terras^[t] xhgt:x < terras^[t] x⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x thnot_halt:¬StageHalts xhne_x:terras^[t] x ≠ xht_pos:1 ≤ terras^[t] xht1_pos:1 ≤ t - 1hreach_prev:reachPos (stageCfg x x) (stageCfg x (terras^[t - 1] x))hy_prev:2 ≤ terras^[t - 1] xhnext:terras (terras^[t - 1] x) = terras^[t] xhgt:x < terras (terras^[t - 1] x)⊢ reachPos (stageCfg x x) (stageCfg (x + 1) (x + 1)) All goals completed! 🐙private theorem reach_stage_from_init (X : ℕ) (hX : 3 ≤ X) (hno : NoStageHalts (X - 1)) : ∃ s : ℕ, X - 2 ≤ s ∧ nSteps weakCollatz27 s init = some (stageCfg X X) := X:ℕhX:3 ≤ Xhno:NoStageHalts (X - 1)⊢ ∃ s, X - 2 ≤ s ∧ nSteps weakCollatz27 s init = some (stageCfg X X) induction X, hX using Nat.le_induction with X:ℕhno:NoStageHalts (3 - 1)⊢ ∃ s, 3 - 2 ≤ s ∧ nSteps weakCollatz27 s init = some (stageCfg 3 3) X:ℕhno:NoStageHalts (3 - 1)s:ℕhs1:1 ≤ shs:nSteps weakCollatz27 s init = some (stageCfg 3 3)⊢ ∃ s, 3 - 2 ≤ s ∧ nSteps weakCollatz27 s init = some (stageCfg 3 3) exact ⟨s, X:ℕhno:NoStageHalts (3 - 1)s:ℕhs1:1 ≤ shs:nSteps weakCollatz27 s init = some (stageCfg 3 3)⊢ 3 - 2 ≤ s All goals completed! 🐙, hs⟩ X✝:ℕX:ℕhX:3 ≤ Xih:NoStageHalts (X - 1) → ∃ s, X - 2 ≤ s ∧ nSteps weakCollatz27 s init = some (stageCfg X X)hno:NoStageHalts (X + 1 - 1)⊢ ∃ s, X + 1 - 2 ≤ s ∧ nSteps weakCollatz27 s init = some (stageCfg (X + 1) (X + 1)) X✝:ℕX:ℕhX:3 ≤ Xih:NoStageHalts (X - 1) → ∃ s, X - 2 ≤ s ∧ nSteps weakCollatz27 s init = some (stageCfg X X)hno:NoStageHalts (X + 1 - 1)s₁:ℕhs₁_ge:X - 2 ≤ s₁hs₁:nSteps weakCollatz27 s₁ init = some (stageCfg X X)⊢ ∃ s, X + 1 - 2 ≤ s ∧ nSteps weakCollatz27 s init = some (stageCfg (X + 1) (X + 1)) X✝:ℕX:ℕhX:3 ≤ Xih:NoStageHalts (X - 1) → ∃ s, X - 2 ≤ s ∧ nSteps weakCollatz27 s init = some (stageCfg X X)hno:NoStageHalts (X + 1 - 1)s₁:ℕhs₁_ge:X - 2 ≤ s₁hs₁:nSteps weakCollatz27 s₁ init = some (stageCfg X X)s₂:ℕhs₂_pos:1 ≤ s₂hs₂:nSteps weakCollatz27 s₂ (stageCfg X X) = some (stageCfg (X + 1) (X + 1))⊢ ∃ s, X + 1 - 2 ≤ s ∧ nSteps weakCollatz27 s init = some (stageCfg (X + 1) (X + 1)) exact ⟨s₁ + s₂, X✝:ℕX:ℕhX:3 ≤ Xih:NoStageHalts (X - 1) → ∃ s, X - 2 ≤ s ∧ nSteps weakCollatz27 s init = some (stageCfg X X)hno:NoStageHalts (X + 1 - 1)s₁:ℕhs₁_ge:X - 2 ≤ s₁hs₁:nSteps weakCollatz27 s₁ init = some (stageCfg X X)s₂:ℕhs₂_pos:1 ≤ s₂hs₂:nSteps weakCollatz27 s₂ (stageCfg X X) = some (stageCfg (X + 1) (X + 1))⊢ X + 1 - 2 ≤ s₁ + s₂ All goals completed! 🐙, nSteps_bind_eq hs₁ hs₂⟩private theorem stage_halt_of_stageHalts (x : ℕ) (hx : 3 ≤ x) (hhalt : StageHalts x) : ∃ s cfg, nSteps weakCollatz27 s (stageCfg x x) = some cfg ∧ step weakCollatz27 cfg = none := x:ℕhx:3 ≤ xhhalt:StageHalts x⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x x) = some cfg ∧ step weakCollatz27 cfg = none x:ℕhx:3 ≤ xt:ℕht1:1 ≤ tleft✝:t ≤ xhprev:StayIn x (t - 1)hhit:terras^[t] x = x⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x x) = some cfg ∧ step weakCollatz27 cfg = none x:ℕhx:3 ≤ xt:ℕht1:1 ≤ tleft✝:t ≤ xhprev:StayIn x (t - 1)hhit:terras^[t] x = xht0:t - 1 = 0⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x x) = some cfg ∧ step weakCollatz27 cfg = nonex:ℕhx:3 ≤ xt:ℕht1:1 ≤ tleft✝:t ≤ xhprev:StayIn x (t - 1)hhit:terras^[t] x = xht1_pos:1 ≤ t - 1hreach_prev:reachPos (stageCfg x x) (stageCfg x (terras^[t - 1] x))⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x x) = some cfg ∧ step weakCollatz27 cfg = none x:ℕhx:3 ≤ xt:ℕht1:1 ≤ tleft✝:t ≤ xhprev:StayIn x (t - 1)hhit:terras^[t] x = xht0:t - 1 = 0⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x x) = some cfg ∧ step weakCollatz27 cfg = none x:ℕhx:3 ≤ xt:ℕht1:1 ≤ tleft✝:t ≤ xhprev:StayIn x (t - 1)hhit:terras^[t] x = xht0:t - 1 = 0ht_eq1:t = 1⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x x) = some cfg ∧ step weakCollatz27 cfg = none x:ℕhx:3 ≤ xht1:1 ≤ 1left✝:1 ≤ xhprev:StayIn x (1 - 1)hhit:terras^[1] x = xht0:1 - 1 = 0⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x x) = some cfg ∧ step weakCollatz27 cfg = none x:ℕhx:3 ≤ xht1:1 ≤ 1left✝:1 ≤ xhprev:StayIn x (1 - 1)hhit:terras x = xht0:1 - 1 = 0⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x x) = some cfg ∧ step weakCollatz27 cfg = none exact stage_round_halt x x hx (x:ℕhx:3 ≤ xht1:1 ≤ 1left✝:1 ≤ xhprev:StayIn x (1 - 1)hhit:terras x = xht0:1 - 1 = 0⊢ 2 ≤ x All goals completed! 🐙) hhit x:ℕhx:3 ≤ xt:ℕht1:1 ≤ tleft✝:t ≤ xhprev:StayIn x (t - 1)hhit:terras^[t] x = xht1_pos:1 ≤ t - 1hreach_prev:reachPos (stageCfg x x) (stageCfg x (terras^[t - 1] x))⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x x) = some cfg ∧ step weakCollatz27 cfg = none x:ℕhx:3 ≤ xt:ℕht1:1 ≤ tleft✝¹:t ≤ xhprev:StayIn x (t - 1)hhit:terras^[t] x = xht1_pos:1 ≤ t - 1s₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz27 s₁ (stageCfg x x) = some (stageCfg x (terras^[t - 1] x))⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x x) = some cfg ∧ step weakCollatz27 cfg = none x:ℕhx:3 ≤ xt:ℕht1:1 ≤ tleft✝¹:t ≤ xhprev:StayIn x (t - 1)hhit:terras^[t] x = xht1_pos:1 ≤ t - 1s₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz27 s₁ (stageCfg x x) = some (stageCfg x (terras^[t - 1] x))hy_prev:2 ≤ terras^[t - 1] x⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x x) = some cfg ∧ step weakCollatz27 cfg = none x:ℕhx:3 ≤ xt:ℕht1:1 ≤ tleft✝¹:t ≤ xhprev:StayIn x (t - 1)hhit:terras^[t] x = xht1_pos:1 ≤ t - 1s₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz27 s₁ (stageCfg x x) = some (stageCfg x (terras^[t - 1] x))hy_prev:2 ≤ terras^[t - 1] xhhit':terras (terras^[t - 1] x) = x⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x x) = some cfg ∧ step weakCollatz27 cfg = none x:ℕhx:3 ≤ xt:ℕht1:1 ≤ tleft✝¹:t ≤ xhprev:StayIn x (t - 1)hhit:terras^[t] x = xht1_pos:1 ≤ t - 1s₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz27 s₁ (stageCfg x x) = some (stageCfg x (terras^[t - 1] x))hy_prev:2 ≤ terras^[t - 1] xhhit':terras (terras^[t - 1] x) = xs₂:ℕcfg:Cfg 27 2hs₂:nSteps weakCollatz27 s₂ (stageCfg x (terras^[t - 1] x)) = some cfghnone:step weakCollatz27 cfg = none⊢ ∃ s cfg, nSteps weakCollatz27 s (stageCfg x x) = some cfg ∧ step weakCollatz27 cfg = none All goals completed! 🐙

The 27-state machine weakCollatz27 (weak_collatz_27) halts on the blank tape if and only if there exist x ≥ 3 and 1 ≤ j ≤ x with terras^[j] x = x (constructive, zero Classical.choice).

theorem halts_weakCollatz27_iff_bounded_cycle : ConjectureMachines.Halts weakCollatz27 ↔ ∃ x j : ℕ, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x := ⊢ ConjectureMachines.Halts weakCollatz27 ↔ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x ⊢ (eval (step weakCollatz27) init).Dom ↔ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x ⊢ (eval (step weakCollatz27) init).Dom → ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x⊢ (∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x) → (eval (step weakCollatz27) init).Dom ⊢ (eval (step weakCollatz27) init).Dom → ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x hdom:(eval (step weakCollatz27) init).Dom⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x hdom:∃ y, y ∈ eval (step weakCollatz27) init⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x b:Cfg 27 2hb:b ∈ eval (step weakCollatz27) init⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x b:Cfg 27 2hb:Reaches (step weakCollatz27) init b ∧ step weakCollatz27 b = none⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x b:Cfg 27 2hreach:Reaches (step weakCollatz27) init bhnone:step weakCollatz27 b = none⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x b:Cfg 27 2hreach:Reaches (step weakCollatz27) init bhnone:step weakCollatz27 b = nonek:ℕhk:nSteps weakCollatz27 k init = some b⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x b:Cfg 27 2hreach:Reaches (step weakCollatz27) init bhnone:step weakCollatz27 b = nonek:ℕhk:nSteps weakCollatz27 k init = some bhno:NoStageHalts (k + 3)⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = xb:Cfg 27 2hreach:Reaches (step weakCollatz27) init bhnone:step weakCollatz27 b = nonek:ℕhk:nSteps weakCollatz27 k init = some bw:ℕhw3:3 ≤ wt:ℕht1:1 ≤ thtw:t ≤ whhit:terras^[t] w = w⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x b:Cfg 27 2hreach:Reaches (step weakCollatz27) init bhnone:step weakCollatz27 b = nonek:ℕhk:nSteps weakCollatz27 k init = some bhno:NoStageHalts (k + 3)⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x b:Cfg 27 2hreach:Reaches (step weakCollatz27) init bhnone:step weakCollatz27 b = nonek:ℕhk:nSteps weakCollatz27 k init = some bhno:NoStageHalts (k + 3)s:ℕhks:k + 3 - 2 ≤ shs:nSteps weakCollatz27 s init = some (stageCfg (k + 3) (k + 3))⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x b:Cfg 27 2hreach:Reaches (step weakCollatz27) init bhnone:step weakCollatz27 b = nonek:ℕhk:nSteps weakCollatz27 k init = some bhno:NoStageHalts (k + 3)s:ℕhks:k + 3 - 2 ≤ shs:none = some (stageCfg (k + 3) (k + 3))⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x All goals completed! 🐙 b:Cfg 27 2hreach:Reaches (step weakCollatz27) init bhnone:step weakCollatz27 b = nonek:ℕhk:nSteps weakCollatz27 k init = some bw:ℕhw3:3 ≤ wt:ℕht1:1 ≤ thtw:t ≤ whhit:terras^[t] w = w⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x All goals completed! 🐙 ⊢ (∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x) → (eval (step weakCollatz27) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = x⊢ (eval (step weakCollatz27) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jMhjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M⊢ (eval (step weakCollatz27) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jMhjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts M⊢ (eval (step weakCollatz27) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jMhjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts Mhno:NoStageHalts M⊢ (eval (step weakCollatz27) init).Domx:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jMhjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts Mw₀:ℕhw₀3:3 ≤ w₀hprev₀:NoStageHalts (w₀ - 1)hhalt₀:StageHalts w₀⊢ (eval (step weakCollatz27) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jMhjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts Mhno:NoStageHalts M⊢ (eval (step weakCollatz27) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jMhjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts Mhno:NoStageHalts M⊢ False All goals completed! 🐙 x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jMhjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts Mw₀:ℕhw₀3:3 ≤ w₀hprev₀:NoStageHalts (w₀ - 1)hhalt₀:StageHalts w₀⊢ (eval (step weakCollatz27) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jMhjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts Mw₀:ℕhw₀3:3 ≤ w₀hprev₀:NoStageHalts (w₀ - 1)hhalt₀:StageHalts w₀s₁:ℕhs₁:nSteps weakCollatz27 s₁ init = some (stageCfg w₀ w₀)⊢ (eval (step weakCollatz27) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jMhjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts Mw₀:ℕhw₀3:3 ≤ w₀hprev₀:NoStageHalts (w₀ - 1)hhalt₀:StageHalts w₀s₁:ℕhs₁:nSteps weakCollatz27 s₁ init = some (stageCfg w₀ w₀)s₂:ℕcfg:Cfg 27 2hs₂:nSteps weakCollatz27 s₂ (stageCfg w₀ w₀) = some cfghnone:step weakCollatz27 cfg = none⊢ (eval (step weakCollatz27) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jMhjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts Mw₀:ℕhw₀3:3 ≤ w₀hprev₀:NoStageHalts (w₀ - 1)hhalt₀:StageHalts w₀s₁:ℕhs₁:nSteps weakCollatz27 s₁ init = some (stageCfg w₀ w₀)s₂:ℕcfg:Cfg 27 2hs₂:nSteps weakCollatz27 s₂ (stageCfg w₀ w₀) = some cfghnone:step weakCollatz27 cfg = none⊢ ∃ y, y ∈ eval (step weakCollatz27) init All goals completed! 🐙

The 27-state candidate machine halts on the blank tape if and only if the 41-state reference machine does (constructive, zero Classical.choice).

theorem candidate_equivalent : Halts candidate ↔ Halts reference := halts_weakCollatz27_iff_bounded_cycle.trans WeakCollatz41.halts_weakCollatz41_iff_bounded_cycle.symm

The candidate has 14 fewer states than the 41-state reference (27 < 41).

theorem candidate_fewer_states : candidate.states < reference.states := ⊢ candidate.states < reference.states All goals completed! 🐙end ConjectureMachines.WeakCollatz27