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.WeakCollatz17 public import Cryptids.Semantics.WeakCollatz75

WeakCollatz16 (weak_collatz_16)

The 16-state, 2-symbol Turing machine weak_collatz_16 compresses weak_collatz_17 (17 → 16 states, -1 state / -5.88%; 75 → 41 → 27 → 17 → 16 overall, -59 states / -78.67%) while constructively preserving blank-tape halting equivalence (candidate_equivalent, proved without Classical.choice).

Compression Ideas (17 → 16 states)

In weak_collatz_17, incrementing the candidate stage by +1 (x ↦ x + 1) required a dedicated trim/entry state (state 9) to erase the extra 1 written by O_SL before GT_SW filled the separator 0 on z > x aborts. weak_collatz_16 eliminates that state completely by exploiting the parity of cycle maxima:

    Evenness of Nontrivial Cycle Maxima (even_of_stageHalts): Every nontrivial terras cycle maximum M = max C ≥ 3 is even (M = 2m, m ≥ 2), because an odd value 2m + 1 ≥ 3 steps to terras (2m + 1) = 3m + 2 > 2m + 1. Enumerating only even candidate stages x = 2, 4, 6, ... (x ↦ x + 2 on stage abort) is therefore constructively sound and complete.

    Trim-Free +2 Stage Advance: Under the popcount conservation law d + y = x at roundCfg d y (0^∞ 1^d [0] 1^y 0^∞ in state 1), O_SL (state 9) increases popcount to x + 1, and jumping directly from P1/P2 (states 10/11) to GT_SW (state 3) fills the single separator 0 with 1, merging directly into 1^(x + 2) (stageCfg (x + 2)) with zero trim state. Likewise, y = 1 bounces through 8 → 7 → 5 → 9 → 10 → 3 → 1 to advance 1^x ↦ 1^(x + 2).

    Zero-State Blank-Tape Boot: Starting in state 0 (T2, 0R8 1R4) on the all-blank tape enters stageCfg 2 at t = 9 and stageCfg 4 at t = 39 (31/31 active transitions visited by step 1,576).

@[expose] public sectionnamespace ConjectureMachines.WeakCollatz16open Turing (Dir)open StateTransitionopen ErdosTernary15 (B0 B0_cons_zero nSteps 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

17-state Weak Collatz reference machine (weak_collatz_17).

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

16-state Weak Collatz candidate machine (weak_collatz_16).

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

The candidate as a Machine 16 2.

abbrev weakCollatz16 : Machine 16 2 := Machines.weakCollatz16private 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 16} {a b : Fin 2} (h : weakCollatz16.transition q a = some (b, .right, q')) (L R : ListBlank (Fin 2)) : step weakCollatz16 ⟨q, ⟨a, L, R⟩⟩ = some ⟨q', Tape.mk' (L.cons b) R⟩ := q:Fin 16q':Fin 16a:Fin 2b:Fin 2h:weakCollatz16.transition q a = some (b, Dir.right, q')L:ListBlank (Fin 2)R:ListBlank (Fin 2)⊢ step weakCollatz16 { state := q, tape := { head := a, left := L, right := R } } = some { state := q', tape := Tape.mk' (ListBlank.cons b L) R } q:Fin 16q':Fin 16a:Fin 2b:Fin 2h:weakCollatz16.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 16} {a b : Fin 2} (h : weakCollatz16.transition q a = some (b, .left, q')) (L R : ListBlank (Fin 2)) : step weakCollatz16 ⟨q, ⟨a, L, R⟩⟩ = some ⟨q', mkL L (R.cons b)⟩ := q:Fin 16q':Fin 16a:Fin 2b:Fin 2h:weakCollatz16.transition q a = some (b, Dir.left, q')L:ListBlank (Fin 2)R:ListBlank (Fin 2)⊢ step weakCollatz16 { state := q, tape := { head := a, left := L, right := R } } = some { state := q', tape := mkL L (ListBlank.cons b R) } q:Fin 16q':Fin 16a:Fin 2b:Fin 2h:weakCollatz16.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 weakCollatz16 ⟨0, ⟨0, L, R⟩⟩ = some ⟨8, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr0_1 (L R) : step weakCollatz16 ⟨0, ⟨1, L, R⟩⟩ = some ⟨4, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr1_0 (L R) : step weakCollatz16 ⟨1, ⟨0, L, R⟩⟩ = some ⟨2, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr1_1 (L R) : step weakCollatz16 ⟨1, ⟨1, L, R⟩⟩ = some ⟨1, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr2_0 (L R) : step weakCollatz16 ⟨2, ⟨0, L, R⟩⟩ = some ⟨7, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr2_1 (L R) : step weakCollatz16 ⟨2, ⟨1, L, R⟩⟩ = some ⟨0, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr3_0 (L R) : step weakCollatz16 ⟨3, ⟨0, L, R⟩⟩ = some ⟨1, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr3_1 (L R) : step weakCollatz16 ⟨3, ⟨1, L, R⟩⟩ = some ⟨3, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr4_0 (L R) : step weakCollatz16 ⟨4, ⟨0, L, R⟩⟩ = some ⟨5, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr4_1 (L R) : step weakCollatz16 ⟨4, ⟨1, L, R⟩⟩ = some ⟨4, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr5_0 (L R) : step weakCollatz16 ⟨5, ⟨0, L, R⟩⟩ = some ⟨9, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr5_1 (L R) : step weakCollatz16 ⟨5, ⟨1, L, R⟩⟩ = some ⟨6, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr6_0 (L R) : step weakCollatz16 ⟨6, ⟨0, L, R⟩⟩ = some ⟨2, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr6_1 (L R) : step weakCollatz16 ⟨6, ⟨1, L, R⟩⟩ = some ⟨14, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr7_0 (L R) : step weakCollatz16 ⟨7, ⟨0, L, R⟩⟩ = some ⟨5, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr7_1 (L R) : step weakCollatz16 ⟨7, ⟨1, L, R⟩⟩ = some ⟨7, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr8_0 (L R) : step weakCollatz16 ⟨8, ⟨0, L, R⟩⟩ = some ⟨7, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr8_1 (L R) : step weakCollatz16 ⟨8, ⟨1, L, R⟩⟩ = some ⟨5, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr9_0 (L R) : step weakCollatz16 ⟨9, ⟨0, L, R⟩⟩ = some ⟨10, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr9_1 (L R) : step weakCollatz16 ⟨9, ⟨1, L, R⟩⟩ = some ⟨9, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr10_0 (L R) : step weakCollatz16 ⟨10, ⟨0, L, R⟩⟩ = some ⟨3, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr10_1 (L R) : step weakCollatz16 ⟨10, ⟨1, L, R⟩⟩ = some ⟨11, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr11_0 (L R) : step weakCollatz16 ⟨11, ⟨0, L, R⟩⟩ = some ⟨3, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr11_1 (L R) : step weakCollatz16 ⟨11, ⟨1, L, R⟩⟩ = some ⟨12, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr12_0 (L R) : step weakCollatz16 ⟨12, ⟨0, L, R⟩⟩ = some ⟨13, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr12_1 (L R) : step weakCollatz16 ⟨12, ⟨1, L, R⟩⟩ = some ⟨12, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr13_0 (L R) : step weakCollatz16 ⟨13, ⟨0, L, R⟩⟩ = some ⟨5, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr13_1 (L R) : step weakCollatz16 ⟨13, ⟨1, L, R⟩⟩ = some ⟨9, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr14_0 (L R) : step weakCollatz16 ⟨14, ⟨0, L, R⟩⟩ = some ⟨15, mkL L (R.cons 0)⟩ := stepL rfl L Rprivate theorem tr14_1 (L R) : step weakCollatz16 ⟨14, ⟨1, L, R⟩⟩ = some ⟨14, mkL L (R.cons 1)⟩ := stepL rfl L Rprivate theorem tr15_0 (L R : ListBlank (Fin 2)) : step weakCollatz16 ⟨15, ⟨0, L, R⟩⟩ = none := rflprivate theorem tr15_1 (L R) : step weakCollatz16 ⟨15, ⟨1, L, R⟩⟩ = some ⟨1, Tape.mk' (L.cons 1) R⟩ := stepR rfl L R

Sweep & Reachability Combinators

private def reachPos (c₁ c₂ : Cfg 16 2) : Prop := ∃ s : ℕ, 1 ≤ s ∧ nSteps weakCollatz16 s c₁ = some c₂private theorem reachPos_step {c₁ c₂ : Cfg 16 2} (h : step weakCollatz16 c₁ = some c₂) : reachPos c₁ c₂ := ⟨1, le_rfl, step_one h⟩private theorem reachPos_trans {c₁ c₂ c₃ : Cfg 16 2} (h₁ : reachPos c₁ c₂) (h₂ : reachPos c₂ c₃) : reachPos c₁ c₃ := c₁:Cfg 16 2c₂:Cfg 16 2c₃:Cfg 16 2h₁:reachPos c₁ c₂h₂:reachPos c₂ c₃⊢ reachPos c₁ c₃ c₁:Cfg 16 2c₂:Cfg 16 2c₃:Cfg 16 2h₂:reachPos c₂ c₃s₁:ℕhs₁:1 ≤ s₁heq₁:nSteps weakCollatz16 s₁ c₁ = some c₂⊢ reachPos c₁ c₃ c₁:Cfg 16 2c₂:Cfg 16 2c₃:Cfg 16 2s₁:ℕhs₁:1 ≤ s₁heq₁:nSteps weakCollatz16 s₁ c₁ = some c₂s₂:ℕhs₂:1 ≤ s₂heq₂:nSteps weakCollatz16 s₂ c₂ = some c₃⊢ reachPos c₁ c₃ exact ⟨s₁ + s₂, c₁:Cfg 16 2c₂:Cfg 16 2c₃:Cfg 16 2s₁:ℕhs₁:1 ≤ s₁heq₁:nSteps weakCollatz16 s₁ c₁ = some c₂s₂:ℕhs₂:1 ≤ s₂heq₂:nSteps weakCollatz16 s₂ c₂ = some c₃⊢ 1 ≤ s₁ + s₂ All goals completed! 🐙, nSteps_bind_eq heq₁ heq₂⟩private theorem step_then_reachPos {c₁ c₂ c₃ : Cfg 16 2} (h₁ : step weakCollatz16 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 16 2} (h₁ : nSteps weakCollatz16 k c₁ = some c₂) (h₂ : reachPos c₂ c₃) : reachPos c₁ c₃ := k:ℕc₁:Cfg 16 2c₂:Cfg 16 2c₃:Cfg 16 2h₁:nSteps weakCollatz16 k c₁ = some c₂h₂:reachPos c₂ c₃⊢ reachPos c₁ c₃ k:ℕc₁:Cfg 16 2c₂:Cfg 16 2c₃:Cfg 16 2h₁:nSteps weakCollatz16 k c₁ = some c₂s:ℕhs:1 ≤ sheq:nSteps weakCollatz16 s c₂ = some c₃⊢ reachPos c₁ c₃ exact ⟨k + s, k:ℕc₁:Cfg 16 2c₂:Cfg 16 2c₃:Cfg 16 2h₁:nSteps weakCollatz16 k c₁ = some c₂s:ℕhs:1 ≤ sheq:nSteps weakCollatz16 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 16 2} (h₁ : reachPos c₁ c₂) (h₂ : nSteps weakCollatz16 k c₂ = some c₃) : reachPos c₁ c₃ := k:ℕc₁:Cfg 16 2c₂:Cfg 16 2c₃:Cfg 16 2h₁:reachPos c₁ c₂h₂:nSteps weakCollatz16 k c₂ = some c₃⊢ reachPos c₁ c₃ k:ℕc₁:Cfg 16 2c₂:Cfg 16 2c₃:Cfg 16 2h₂:nSteps weakCollatz16 k c₂ = some c₃s:ℕhs:1 ≤ sheq:nSteps weakCollatz16 s c₁ = some c₂⊢ reachPos c₁ c₃ exact ⟨s + k, k:ℕc₁:Cfg 16 2c₂:Cfg 16 2c₃:Cfg 16 2h₂:nSteps weakCollatz16 k c₂ = some c₃s:ℕhs:1 ≤ sheq:nSteps weakCollatz16 s c₁ = some c₂⊢ 1 ≤ s + k All goals completed! 🐙, nSteps_bind_eq heq h₂⟩private theorem sweep1R {q : Fin 16} (h : ∀ L R, step weakCollatz16 ⟨q, ⟨1, L, R⟩⟩ = some ⟨q, Tape.mk' (L.cons 1) R⟩) (k : ℕ) (L R : ListBlank (Fin 2)) : nSteps weakCollatz16 k ⟨q, Tape.mk' L (ones k R)⟩ = some ⟨q, Tape.mk' (ones k L) R⟩ := q:Fin 16h:∀ (L R : ListBlank (Fin 2)), step weakCollatz16 { 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 weakCollatz16 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 16h:∀ (L R : ListBlank (Fin 2)), step weakCollatz16 { 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 weakCollatz16 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 16h:∀ (L R : ListBlank (Fin 2)), step weakCollatz16 { 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 weakCollatz16 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 weakCollatz16 (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 16} (h : ∀ L R, step weakCollatz16 ⟨q, ⟨1, L, R⟩⟩ = some ⟨q, mkL L (R.cons 1)⟩) (k : ℕ) (L R : ListBlank (Fin 2)) : nSteps weakCollatz16 k ⟨q, mkL (ones k L) R⟩ = some ⟨q, mkL L (ones k R)⟩ := q:Fin 16h:∀ (L R : ListBlank (Fin 2)), step weakCollatz16 { 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 weakCollatz16 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 16h:∀ (L R : ListBlank (Fin 2)), step weakCollatz16 { 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 weakCollatz16 0 { state := q, tape := mkL (ones 0 L) R } = some { state := q, tape := mkL L (ones 0 R) } All goals completed! 🐙 q:Fin 16h:∀ (L R : ListBlank (Fin 2)), step weakCollatz16 { 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 weakCollatz16 k { state := q, tape := mkL (ones k L) R } = some { state := q, tape := mkL L (ones k R) }R:ListBlank (Fin 2)⊢ nSteps weakCollatz16 (k + 1) { state := q, tape := mkL (ones (k + 1) L) R } = some { state := q, tape := mkL L (ones (k + 1) R) } All goals completed! 🐙

Conservation-Law Checkpoints & Inward Parity Squeeze

Canonical round checkpoint (d + y = x): 0^∞ 1^d [0] 1^y 0^∞ in state 1.

private def roundCfg (d y : ℕ) : Cfg 16 2 := ⟨1, ⟨0, ones d B0, ones y B0⟩⟩

Canonical stage start (d = 0, y = x): 0^∞ [0] 1^x 0^∞ in state 1.

private def stageCfg (x : ℕ) : Cfg 16 2 := roundCfg 0 x

Inward parity-squeeze configuration (d + b + a = x): 0^∞ 1^d [0] 1^b 0 1^a 0^∞ in state 1 (at a = 0, (ones 0 B0).cons 0 = B0, coinciding with roundCfg d b).

private def sqzCfg (d b a : ℕ) : Cfg 16 2 := ⟨1, ⟨0, ones d B0, ones b ((ones a B0).cons 0)⟩⟩private theorem roundCfg_eq_sqzCfg (d y : ℕ) : roundCfg d y = sqzCfg d y 0 := d:ℕy:ℕ⊢ roundCfg d y = sqzCfg d y 0 All goals completed! 🐙private theorem sqz_to_eback (d b a : ℕ) : reachPos (sqzCfg d (b + 2) a) ⟨6, mkL (ones b ((ones (d + 1) B0).cons 0)) ((ones (a + 1) B0).cons 0)⟩ := d:ℕb:ℕa:ℕ⊢ reachPos (sqzCfg d (b + 2) a) { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕ⊢ reachPos { state := 1, tape := { head := 0, left := ones d B0, right := ones (b + 2) (ListBlank.cons 0 (ones a B0)) } } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕRa:ListBlank (Fin 2) := ListBlank.cons 0 (ones a B0)⊢ reachPos { state := 1, tape := { head := 0, left := ones d B0, right := ones (b + 2) (ListBlank.cons 0 (ones a B0)) } } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕRa:ListBlank (Fin 2) := ListBlank.cons 0 (ones a B0)⊢ reachPos { state := 1, tape := { head := 0, left := ones d B0, right := ones (b + 2) Ra } } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕRa:ListBlank (Fin 2) := ListBlank.cons 0 (ones a B0)⊢ reachPos { state := 2, tape := Tape.mk' (ListBlank.cons 1 (ones d B0)) (ones (b + 2) Ra) } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕRa:ListBlank (Fin 2) := ListBlank.cons 0 (ones a B0)⊢ reachPos { state := 2, tape := { head := 1, left := ones (d + 1) B0, right := ones (b + 1) Ra } } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕRa:ListBlank (Fin 2) := ListBlank.cons 0 (ones a B0)⊢ reachPos { state := 0, tape := Tape.mk' (ListBlank.cons 0 (ones (d + 1) B0)) (ones (b + 1) Ra) } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕRa:ListBlank (Fin 2) := ListBlank.cons 0 (ones a B0)⊢ reachPos { state := 0, tape := { head := 1, left := ListBlank.cons 0 (ones (d + 1) B0), right := ones b Ra } } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕRa:ListBlank (Fin 2) := ListBlank.cons 0 (ones a B0)⊢ reachPos { state := 4, tape := Tape.mk' (ListBlank.cons 1 (ListBlank.cons 0 (ones (d + 1) B0))) (ones b Ra) } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕRa:ListBlank (Fin 2) := ListBlank.cons 0 (ones a B0)Ld:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 4, tape := Tape.mk' (ListBlank.cons 1 (ListBlank.cons 0 (ones (d + 1) B0))) (ones b Ra) } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕRa:ListBlank (Fin 2) := ListBlank.cons 0 (ones a B0)Ld:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 4, tape := Tape.mk' (ones 1 Ld) (ones b Ra) } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕRa:ListBlank (Fin 2) := ListBlank.cons 0 (ones a B0)Ld:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 4, tape := Tape.mk' (ones b (ones 1 Ld)) Ra } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕRa:ListBlank (Fin 2) := ListBlank.cons 0 (ones a B0)Ld:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 4, tape := Tape.mk' (ones (b + 1) Ld) Ra } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕRa:ListBlank (Fin 2) := ListBlank.cons 0 (ones a B0)Ld:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 4, tape := Tape.mk' (ones (b + 1) Ld) (ListBlank.cons 0 (ones a B0)) } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕRa:ListBlank (Fin 2) := ListBlank.cons 0 (ones a B0)Ld:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 4, tape := { head := 0, left := ones (b + 1) Ld, right := ones a B0 } } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕRa:ListBlank (Fin 2) := ListBlank.cons 0 (ones a B0)Ld:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 5, tape := mkL (ones (b + 1) Ld) (ListBlank.cons 1 (ones a B0)) } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } d:ℕb:ℕa:ℕRa:ListBlank (Fin 2) := ListBlank.cons 0 (ones a B0)Ld:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 5, tape := { head := 1, left := ones b Ld, right := ones (a + 1) B0 } } { state := 6, tape := mkL (ones b (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } All goals completed! 🐙private theorem eback_to_haltchk (L : ListBlank (Fin 2)) (m : ℕ) : reachPos ⟨6, ⟨1, ones m (L.cons 0), B0⟩⟩ ⟨15, mkL L ((ones (m + 1) B0).cons 0)⟩ := L:ListBlank (Fin 2)m:ℕ⊢ reachPos { state := 6, tape := { head := 1, left := ones m (ListBlank.cons 0 L), right := B0 } } { state := 15, tape := mkL L (ListBlank.cons 0 (ones (m + 1) B0)) } L:ListBlank (Fin 2)m:ℕ⊢ reachPos { state := 14, tape := mkL (ones m (ListBlank.cons 0 L)) (ListBlank.cons 1 B0) } { state := 15, tape := mkL L (ListBlank.cons 0 (ones (m + 1) B0)) } L:ListBlank (Fin 2)m:ℕ⊢ reachPos { state := 14, tape := mkL (ones m (ListBlank.cons 0 L)) (ones 1 B0) } { state := 15, tape := mkL L (ListBlank.cons 0 (ones (m + 1) B0)) } L:ListBlank (Fin 2)m:ℕ⊢ reachPos { state := 14, tape := mkL (ListBlank.cons 0 L) (ones m (ones 1 B0)) } { state := 15, tape := mkL L (ListBlank.cons 0 (ones (m + 1) B0)) } L:ListBlank (Fin 2)m:ℕ⊢ reachPos { state := 14, tape := { head := 0, left := L, right := ones (m + 1) B0 } } { state := 15, tape := mkL L (ListBlank.cons 0 (ones (m + 1) B0)) } All goals completed! 🐙private theorem sqz_step (d b₀ a : ℕ) : reachPos (sqzCfg d (b₀ + 3) a) (sqzCfg (d + 1) (b₀ + 1) (a + 1)) := d:ℕb₀:ℕa:ℕ⊢ reachPos (sqzCfg d (b₀ + 3) a) (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕ⊢ reachPos (sqzCfg d (b₀ + 1 + 2) a) (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕ⊢ reachPos { state := 6, tape := mkL (ones (b₀ + 1) (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 6, tape := mkL (ones (b₀ + 1) (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)Ra1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (a + 1) B0)⊢ reachPos { state := 6, tape := mkL (ones (b₀ + 1) (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)Ra1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (a + 1) B0)⊢ reachPos { state := 6, tape := mkL (ones (b₀ + 1) Ld) Ra1 } (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)Ra1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (a + 1) B0)⊢ reachPos { state := 6, tape := { head := 1, left := ones b₀ Ld, right := Ra1 } } (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)Ra1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (a + 1) B0)⊢ reachPos { state := 14, tape := mkL (ones b₀ Ld) (ListBlank.cons 1 Ra1) } (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)Ra1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (a + 1) B0)⊢ reachPos { state := 14, tape := mkL (ones b₀ Ld) (ones 1 Ra1) } (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)Ra1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (a + 1) B0)⊢ reachPos { state := 14, tape := mkL Ld (ones b₀ (ones 1 Ra1)) } (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)Ra1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (a + 1) B0)⊢ reachPos { state := 14, tape := mkL Ld (ones (b₀ + 1) Ra1) } (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)Ra1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (a + 1) B0)⊢ reachPos { state := 14, tape := mkL (ListBlank.cons 0 (ones (d + 1) B0)) (ones (b₀ + 1) Ra1) } (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)Ra1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (a + 1) B0)⊢ reachPos { state := 14, tape := { head := 0, left := ones (d + 1) B0, right := ones (b₀ + 1) Ra1 } } (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)Ra1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (a + 1) B0)⊢ reachPos { state := 15, tape := mkL (ones (d + 1) B0) (ListBlank.cons 0 (ones (b₀ + 1) Ra1)) } (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)Ra1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (a + 1) B0)⊢ reachPos { state := 15, tape := { head := 1, left := ones d B0, right := ListBlank.cons 0 (ones (b₀ + 1) Ra1) } } (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)Ra1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (a + 1) B0)h15:step weakCollatz16 { state := 15, tape := { head := 1, left := ones d B0, right := ListBlank.cons 0 (ones (b₀ + 1) Ra1) } } = some { state := 1, tape := Tape.mk' (ListBlank.cons 1 (ones d B0)) (ListBlank.cons 0 (ones (b₀ + 1) Ra1)) }⊢ reachPos { state := 15, tape := { head := 1, left := ones d B0, right := ListBlank.cons 0 (ones (b₀ + 1) Ra1) } } (sqzCfg (d + 1) (b₀ + 1) (a + 1)) d:ℕb₀:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)Ra1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (a + 1) B0)h15:step weakCollatz16 { state := 15, tape := { head := 1, left := ones d B0, right := ListBlank.cons 0 (ones (b₀ + 1) Ra1) } } = some { state := 1, tape := { head := 0, left := ones (d + 1) B0, right := ones (b₀ + 1) Ra1 } }⊢ reachPos { state := 15, tape := { head := 1, left := ones d B0, right := ListBlank.cons 0 (ones (b₀ + 1) Ra1) } } (sqzCfg (d + 1) (b₀ + 1) (a + 1)) All goals completed! 🐙private theorem sqz_many (d b₀ a k : ℕ) : ∃ s : ℕ, nSteps weakCollatz16 s (sqzCfg d ((b₀ + 1) + 2 * k) a) = some (sqzCfg (d + k) (b₀ + 1) (a + k)) := d:ℕb₀:ℕa:ℕk:ℕ⊢ ∃ s, nSteps weakCollatz16 s (sqzCfg d (b₀ + 1 + 2 * k) a) = some (sqzCfg (d + k) (b₀ + 1) (a + k)) induction k generalizing d a with b₀:ℕd:ℕa:ℕ⊢ ∃ s, nSteps weakCollatz16 s (sqzCfg d (b₀ + 1 + 2 * 0) a) = some (sqzCfg (d + 0) (b₀ + 1) (a + 0)) b₀:ℕd:ℕa:ℕ⊢ ∃ s, nSteps weakCollatz16 s (sqzCfg d (b₀ + 1) a) = some (sqzCfg d (b₀ + 1) a) All goals completed! 🐙 b₀:ℕk:ℕih:∀ (d a : ℕ), ∃ s, nSteps weakCollatz16 s (sqzCfg d (b₀ + 1 + 2 * k) a) = some (sqzCfg (d + k) (b₀ + 1) (a + k))d:ℕa:ℕ⊢ ∃ s, nSteps weakCollatz16 s (sqzCfg d (b₀ + 1 + 2 * (k + 1)) a) = some (sqzCfg (d + (k + 1)) (b₀ + 1) (a + (k + 1))) b₀:ℕk:ℕih:∀ (d a : ℕ), ∃ s, nSteps weakCollatz16 s (sqzCfg d (b₀ + 1 + 2 * k) a) = some (sqzCfg (d + k) (b₀ + 1) (a + k))d:ℕa:ℕ⊢ ∃ s, nSteps weakCollatz16 s (sqzCfg d (b₀ + 2 * k + 3) a) = some (sqzCfg (d + (k + 1)) (b₀ + 1) (a + (k + 1))) b₀:ℕk:ℕih:∀ (d a : ℕ), ∃ s, nSteps weakCollatz16 s (sqzCfg d (b₀ + 1 + 2 * k) a) = some (sqzCfg (d + k) (b₀ + 1) (a + k))d:ℕa:ℕs₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ (sqzCfg d (b₀ + 2 * k + 3) a) = some (sqzCfg (d + 1) (b₀ + 2 * k + 1) (a + 1))⊢ ∃ s, nSteps weakCollatz16 s (sqzCfg d (b₀ + 2 * k + 3) a) = some (sqzCfg (d + (k + 1)) (b₀ + 1) (a + (k + 1))) b₀:ℕk:ℕih:∀ (d a : ℕ), ∃ s, nSteps weakCollatz16 s (sqzCfg d (b₀ + 1 + 2 * k) a) = some (sqzCfg (d + k) (b₀ + 1) (a + k))d:ℕa:ℕs₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ (sqzCfg d (b₀ + 2 * k + 3) a) = some (sqzCfg (d + 1) (b₀ + 1 + 2 * k) (a + 1))⊢ ∃ s, nSteps weakCollatz16 s (sqzCfg d (b₀ + 2 * k + 3) a) = some (sqzCfg (d + (k + 1)) (b₀ + 1) (a + (k + 1))) b₀:ℕk:ℕih:∀ (d a : ℕ), ∃ s, nSteps weakCollatz16 s (sqzCfg d (b₀ + 1 + 2 * k) a) = some (sqzCfg (d + k) (b₀ + 1) (a + k))d:ℕa:ℕs₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ (sqzCfg d (b₀ + 2 * k + 3) a) = some (sqzCfg (d + 1) (b₀ + 1 + 2 * k) (a + 1))s₂:ℕhs₂:nSteps weakCollatz16 s₂ (sqzCfg (d + 1) (b₀ + 1 + 2 * k) (a + 1)) = some (sqzCfg (d + 1 + k) (b₀ + 1) (a + 1 + k))⊢ ∃ s, nSteps weakCollatz16 s (sqzCfg d (b₀ + 2 * k + 3) a) = some (sqzCfg (d + (k + 1)) (b₀ + 1) (a + (k + 1))) b₀:ℕk:ℕih:∀ (d a : ℕ), ∃ s, nSteps weakCollatz16 s (sqzCfg d (b₀ + 1 + 2 * k) a) = some (sqzCfg (d + k) (b₀ + 1) (a + k))d:ℕa:ℕs₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ (sqzCfg d (b₀ + 2 * k + 3) a) = some (sqzCfg (d + 1) (b₀ + 1 + 2 * k) (a + 1))s₂:ℕhs₂:nSteps weakCollatz16 s₂ (sqzCfg (d + 1) (b₀ + 1 + 2 * k) (a + 1)) = some (sqzCfg (d + (k + 1)) (b₀ + 1) (a + (k + 1)))⊢ ∃ s, nSteps weakCollatz16 s (sqzCfg d (b₀ + 2 * k + 3) a) = some (sqzCfg (d + (k + 1)) (b₀ + 1) (a + (k + 1))) All goals completed! 🐙private theorem sqz_even_exit (d a : ℕ) : reachPos (sqzCfg d 2 a) (roundCfg (d + 1) (a + 1)) := d:ℕa:ℕ⊢ reachPos (sqzCfg d 2 a) (roundCfg (d + 1) (a + 1)) d:ℕa:ℕ⊢ reachPos { state := 6, tape := mkL (ones 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (a + 1) B0)) } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕ⊢ reachPos { state := 6, tape := { head := 0, left := ones (d + 1) B0, right := ListBlank.cons 0 (ones (a + 1) B0) } } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕ⊢ reachPos { state := 2, tape := Tape.mk' (ListBlank.cons 0 (ones (d + 1) B0)) (ListBlank.cons 0 (ones (a + 1) B0)) } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕ⊢ reachPos { state := 2, tape := { head := 0, left := ListBlank.cons 0 (ones (d + 1) B0), right := ones (a + 1) B0 } } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕ⊢ reachPos { state := 7, tape := Tape.mk' (ListBlank.cons 1 (ListBlank.cons 0 (ones (d + 1) B0))) (ones (a + 1) B0) } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 7, tape := Tape.mk' (ListBlank.cons 1 (ListBlank.cons 0 (ones (d + 1) B0))) (ones (a + 1) B0) } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 7, tape := Tape.mk' (ones 1 Ld) (ones (a + 1) B0) } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 7, tape := Tape.mk' (ones (a + 1) (ones 1 Ld)) B0 } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 7, tape := { head := 0, left := ones (a + 1 + 1) Ld, right := B0 } } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 5, tape := mkL (ones (a + 1 + 1) Ld) (ListBlank.cons 0 B0) } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 5, tape := { head := 1, left := ones (a + 1) Ld, right := B0 } } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 6, tape := mkL (ones (a + 1) Ld) (ListBlank.cons 0 B0) } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 6, tape := { head := 1, left := ones a Ld, right := B0 } } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 15, tape := mkL (ones (d + 1) B0) (ListBlank.cons 0 (ones (a + 1) B0)) } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)⊢ reachPos { state := 15, tape := { head := 1, left := ones d B0, right := ListBlank.cons 0 (ones (a + 1) B0) } } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)h15:step weakCollatz16 { state := 15, tape := { head := 1, left := ones d B0, right := ListBlank.cons 0 (ones (a + 1) B0) } } = some { state := 1, tape := Tape.mk' (ListBlank.cons 1 (ones d B0)) (ListBlank.cons 0 (ones (a + 1) B0)) }⊢ reachPos { state := 15, tape := { head := 1, left := ones d B0, right := ListBlank.cons 0 (ones (a + 1) B0) } } (roundCfg (d + 1) (a + 1)) d:ℕa:ℕLd:ListBlank (Fin 2) := ListBlank.cons 0 (ones (d + 1) B0)h15:step weakCollatz16 { state := 15, tape := { head := 1, left := ones d B0, right := ListBlank.cons 0 (ones (a + 1) B0) } } = some { state := 1, tape := { head := 0, left := ones (d + 1) B0, right := ones (a + 1) B0 } }⊢ reachPos { state := 15, tape := { head := 1, left := ones d B0, right := ListBlank.cons 0 (ones (a + 1) B0) } } (roundCfg (d + 1) (a + 1)) All goals completed! 🐙private theorem round_even (d k : ℕ) : reachPos (roundCfg d (2 * k + 2)) (roundCfg (d + k + 1) (k + 1)) := d:ℕk:ℕ⊢ reachPos (roundCfg d (2 * k + 2)) (roundCfg (d + k + 1) (k + 1)) d:ℕk:ℕ⊢ reachPos (sqzCfg d (1 + 1 + 2 * k) 0) (roundCfg (d + k + 1) (k + 1)) d:ℕk:ℕs:ℕhs:nSteps weakCollatz16 s (sqzCfg d (1 + 1 + 2 * k) 0) = some (sqzCfg (d + k) (1 + 1) (0 + k))⊢ reachPos (sqzCfg d (1 + 1 + 2 * k) 0) (roundCfg (d + k + 1) (k + 1)) d:ℕk:ℕs:ℕhs:nSteps weakCollatz16 s (sqzCfg d (1 + 1 + 2 * k) 0) = some (sqzCfg (d + k) (1 + 1) k)⊢ reachPos (sqzCfg d (1 + 1 + 2 * k) 0) (roundCfg (d + k + 1) (k + 1)) All goals completed! 🐙private theorem gt_merge (p m : ℕ) : reachPos ⟨3, Tape.mk' B0 (ones p ((ones m B0).cons 0))⟩ (stageCfg (p + m + 1)) := p:ℕm:ℕ⊢ reachPos { state := 3, tape := Tape.mk' B0 (ones p (ListBlank.cons 0 (ones m B0))) } (stageCfg (p + m + 1)) p:ℕm:ℕ⊢ reachPos { state := 3, tape := Tape.mk' B0 (ones p (ListBlank.cons 0 (ones m B0))) } { state := 1, tape := { head := 0, left := ones 0 B0, right := ones (p + m + 1) B0 } } p:ℕm:ℕ⊢ reachPos { state := 3, tape := Tape.mk' (ones p B0) (ListBlank.cons 0 (ones m B0)) } { state := 1, tape := { head := 0, left := ones 0 B0, right := ones (p + m + 1) B0 } } p:ℕm:ℕ⊢ reachPos { state := 3, tape := { head := 0, left := ones p B0, right := ones m B0 } } { state := 1, tape := { head := 0, left := ones 0 B0, right := ones (p + m + 1) B0 } } p:ℕm:ℕh3:reachPos { state := 3, tape := { head := 0, left := ones p B0, right := ones m B0 } } { state := 1, tape := mkL (ones p B0) (ones (m + 1) B0) }⊢ reachPos { state := 3, tape := { head := 0, left := ones p B0, right := ones m B0 } } { state := 1, tape := { head := 0, left := ones 0 B0, right := ones (p + m + 1) B0 } } p:ℕm:ℕh3:reachPos { state := 3, tape := { head := 0, left := ones p B0, right := ones m B0 } } { state := 1, tape := mkL (ones p B0) (ones (m + 1) B0) }hsw:nSteps weakCollatz16 p { state := 1, tape := mkL (ones p B0) (ones (m + 1) B0) } = some { state := 1, tape := mkL B0 (ones p (ones (m + 1) B0)) }⊢ reachPos { state := 3, tape := { head := 0, left := ones p B0, right := ones m B0 } } { state := 1, tape := { head := 0, left := ones 0 B0, right := ones (p + m + 1) B0 } } p:ℕm:ℕh3:reachPos { state := 3, tape := { head := 0, left := ones p B0, right := ones m B0 } } { state := 1, tape := mkL (ones p B0) (ones (m + 1) B0) }hsw:nSteps weakCollatz16 p { state := 1, tape := mkL (ones p B0) (ones (m + 1) B0) } = some { state := 1, tape := { head := 0, left := B0, right := ones (p + m + 1) B0 } }⊢ reachPos { state := 3, tape := { head := 0, left := ones p B0, right := ones m B0 } } { state := 1, tape := { head := 0, left := ones 0 B0, right := ones (p + m + 1) B0 } } All goals completed! 🐙private theorem round_y1 (d : ℕ) : reachPos (roundCfg d 1) (stageCfg (d + 3)) := d:ℕ⊢ reachPos (roundCfg d 1) (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 1, tape := { head := 0, left := ones d B0, right := ones 1 B0 } } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 2, tape := Tape.mk' (ListBlank.cons 1 (ones d B0)) (ones 1 B0) } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 2, tape := { head := 1, left := ones (d + 1) B0, right := B0 } } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 0, tape := Tape.mk' (ListBlank.cons 0 (ones (d + 1) B0)) B0 } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 0, tape := { head := 0, left := ListBlank.cons 0 (ones (d + 1) B0), right := B0 } } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 8, tape := Tape.mk' (ListBlank.cons 0 (ListBlank.cons 0 (ones (d + 1) B0))) B0 } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 8, tape := { head := 0, left := ListBlank.cons 0 (ListBlank.cons 0 (ones (d + 1) B0)), right := B0 } } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 7, tape := mkL (ListBlank.cons 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 B0) } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 7, tape := { head := 0, left := ListBlank.cons 0 (ones (d + 1) B0), right := B0 } } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 5, tape := mkL (ListBlank.cons 0 (ones (d + 1) B0)) (ListBlank.cons 0 B0) } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 5, tape := { head := 0, left := ones (d + 1) B0, right := B0 } } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 9, tape := mkL (ones (d + 1) B0) (ListBlank.cons 0 B0) } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 9, tape := mkL (ones (d + 1) B0) B0 } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 9, tape := mkL B0 (ones (d + 1) B0) } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 9, tape := { head := 0, left := B0, right := ones (d + 1) B0 } } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 10, tape := mkL B0 (ListBlank.cons 1 (ones (d + 1) B0)) } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 10, tape := { head := 0, left := B0, right := ones (d + 1 + 1) B0 } } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 3, tape := Tape.mk' (ListBlank.cons 0 B0) (ones (d + 1 + 1) B0) } (stageCfg (d + 3)) d:ℕ⊢ reachPos { state := 3, tape := Tape.mk' B0 (ones (d + 1 + 1) B0) } (stageCfg (d + 3)) d:ℕhgt:reachPos { state := 3, tape := Tape.mk' B0 (ones (d + 2) (ListBlank.cons 0 (ones 0 B0))) } (stageCfg (d + 2 + 0 + 1))⊢ reachPos { state := 3, tape := Tape.mk' B0 (ones (d + 1 + 1) B0) } (stageCfg (d + 3)) d:ℕhgt:reachPos { state := 3, tape := Tape.mk' B0 (ones (d + 2) B0) } (stageCfg (d + 3))⊢ reachPos { state := 3, tape := Tape.mk' B0 (ones (d + 1 + 1) B0) } (stageCfg (d + 3)) All goals completed! 🐙

Odd 3k + 2 Conservation Loop, Trim-Free +2 Merge & z = x Halt

Odd conservation configuration (L + r + m = x): 0^∞ 1^L 0 1^(r - 1) [1] 0 1^m 0^∞ in state 9 (for r = 0, 0^∞ 1^L [0] 0 1^m 0^∞).

private def oddCfg (L r m : ℕ) : Cfg 16 2 := ⟨9, mkL (ones r ((ones L B0).cons 0)) ((ones m B0).cons 0)⟩private theorem sqz_odd_enter (d k' : ℕ) : reachPos (sqzCfg d 1 (k' + 1)) (oddCfg (d + 1) 0 (k' + 1)) := d:ℕk':ℕ⊢ reachPos (sqzCfg d 1 (k' + 1)) (oddCfg (d + 1) 0 (k' + 1)) d:ℕk':ℕ⊢ reachPos { state := 1, tape := { head := 0, left := ones d B0, right := ones 1 (ListBlank.cons 0 (ones (k' + 1) B0)) } } { state := 9, tape := mkL (ones 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (k' + 1) B0)) } d:ℕk':ℕRk:ListBlank (Fin 2) := ListBlank.cons 0 (ones (k' + 1) B0)⊢ reachPos { state := 1, tape := { head := 0, left := ones d B0, right := ones 1 (ListBlank.cons 0 (ones (k' + 1) B0)) } } { state := 9, tape := mkL (ones 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (k' + 1) B0)) } d:ℕk':ℕRk:ListBlank (Fin 2) := ListBlank.cons 0 (ones (k' + 1) B0)⊢ reachPos { state := 1, tape := { head := 0, left := ones d B0, right := ones 1 Rk } } { state := 9, tape := mkL (ones 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (k' + 1) B0)) } d:ℕk':ℕRk:ListBlank (Fin 2) := ListBlank.cons 0 (ones (k' + 1) B0)⊢ reachPos { state := 2, tape := Tape.mk' (ListBlank.cons 1 (ones d B0)) (ones 1 Rk) } { state := 9, tape := mkL (ones 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (k' + 1) B0)) } d:ℕk':ℕRk:ListBlank (Fin 2) := ListBlank.cons 0 (ones (k' + 1) B0)⊢ reachPos { state := 2, tape := { head := 1, left := ones (d + 1) B0, right := Rk } } { state := 9, tape := mkL (ones 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (k' + 1) B0)) } d:ℕk':ℕRk:ListBlank (Fin 2) := ListBlank.cons 0 (ones (k' + 1) B0)⊢ reachPos { state := 0, tape := Tape.mk' (ListBlank.cons 0 (ones (d + 1) B0)) Rk } { state := 9, tape := mkL (ones 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (k' + 1) B0)) } d:ℕk':ℕRk:ListBlank (Fin 2) := ListBlank.cons 0 (ones (k' + 1) B0)⊢ reachPos { state := 0, tape := Tape.mk' (ListBlank.cons 0 (ones (d + 1) B0)) (ListBlank.cons 0 (ones (k' + 1) B0)) } { state := 9, tape := mkL (ones 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (k' + 1) B0)) } d:ℕk':ℕRk:ListBlank (Fin 2) := ListBlank.cons 0 (ones (k' + 1) B0)⊢ reachPos { state := 0, tape := { head := 0, left := ListBlank.cons 0 (ones (d + 1) B0), right := ones (k' + 1) B0 } } { state := 9, tape := mkL (ones 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (k' + 1) B0)) } d:ℕk':ℕRk:ListBlank (Fin 2) := ListBlank.cons 0 (ones (k' + 1) B0)⊢ reachPos { state := 8, tape := Tape.mk' (ListBlank.cons 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ones (k' + 1) B0) } { state := 9, tape := mkL (ones 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (k' + 1) B0)) } d:ℕk':ℕRk:ListBlank (Fin 2) := ListBlank.cons 0 (ones (k' + 1) B0)⊢ reachPos { state := 8, tape := { head := 1, left := ListBlank.cons 0 (ListBlank.cons 0 (ones (d + 1) B0)), right := ones k' B0 } } { state := 9, tape := mkL (ones 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ListBlank.cons 1 (ones k' B0))) } d:ℕk':ℕRk:ListBlank (Fin 2) := ListBlank.cons 0 (ones (k' + 1) B0)⊢ reachPos { state := 5, tape := mkL (ListBlank.cons 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 1 (ones k' B0)) } { state := 9, tape := mkL (ones 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ListBlank.cons 1 (ones k' B0))) } d:ℕk':ℕRk:ListBlank (Fin 2) := ListBlank.cons 0 (ones (k' + 1) B0)⊢ reachPos { state := 5, tape := { head := 0, left := ListBlank.cons 0 (ones (d + 1) B0), right := ones (k' + 1) B0 } } { state := 9, tape := mkL (ones 0 (ListBlank.cons 0 (ones (d + 1) B0))) (ListBlank.cons 0 (ones (k' + 1) B0)) } All goals completed! 🐙private theorem odd_peel_to_13 (L r m : ℕ) : reachPos (oddCfg (L + 2) r m) ⟨13, Tape.mk' (ones (r + 3) ((ones L B0).cons 0)) (ones m B0)⟩ := L:ℕr:ℕm:ℕ⊢ reachPos (oddCfg (L + 2) r m) { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕ⊢ reachPos { state := 9, tape := mkL (ones r (ListBlank.cons 0 (ones (L + 2) B0))) (ListBlank.cons 0 (ones m B0)) } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)⊢ reachPos { state := 9, tape := mkL (ones r (ListBlank.cons 0 (ones (L + 2) B0))) (ListBlank.cons 0 (ones m B0)) } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 9, tape := mkL (ones r (ListBlank.cons 0 (ones (L + 2) B0))) (ListBlank.cons 0 (ones m B0)) } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 9, tape := mkL (ones r LL2) Rm } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 9, tape := mkL LL2 (ones r Rm) } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 9, tape := mkL (ListBlank.cons 0 (ones (L + 2) B0)) (ones r Rm) } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 9, tape := { head := 0, left := ones (L + 2) B0, right := ones r Rm } } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 10, tape := mkL (ones (L + 2) B0) (ListBlank.cons 1 (ones r Rm)) } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 10, tape := { head := 1, left := ones (L + 1) B0, right := ones (r + 1) Rm } } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 11, tape := mkL (ones (L + 1) B0) (ListBlank.cons 1 (ones (r + 1) Rm)) } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 11, tape := { head := 1, left := ones L B0, right := ones (r + 1 + 1) Rm } } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones L B0)) (ones (r + 1 + 1) Rm) } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)LL:ListBlank (Fin 2) := ListBlank.cons 0 (ones L B0)⊢ reachPos { state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones L B0)) (ones (r + 1 + 1) Rm) } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)LL:ListBlank (Fin 2) := ListBlank.cons 0 (ones L B0)⊢ reachPos { state := 12, tape := Tape.mk' LL (ones (r + 2) Rm) } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)LL:ListBlank (Fin 2) := ListBlank.cons 0 (ones L B0)⊢ reachPos { state := 12, tape := Tape.mk' (ones (r + 2) LL) Rm } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)LL:ListBlank (Fin 2) := ListBlank.cons 0 (ones L B0)⊢ reachPos { state := 12, tape := Tape.mk' (ones (r + 2) LL) (ListBlank.cons 0 (ones m B0)) } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)LL:ListBlank (Fin 2) := ListBlank.cons 0 (ones L B0)⊢ reachPos { state := 12, tape := { head := 0, left := ones (r + 2) LL, right := ones m B0 } } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)LL:ListBlank (Fin 2) := ListBlank.cons 0 (ones L B0)h12:step weakCollatz16 { state := 12, tape := { head := 0, left := ones (r + 2) LL, right := ones m B0 } } = some { state := 13, tape := Tape.mk' (ListBlank.cons 1 (ones (r + 2) LL)) (ones m B0) }⊢ reachPos { state := 12, tape := { head := 0, left := ones (r + 2) LL, right := ones m B0 } } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } L:ℕr:ℕm:ℕLL2:ListBlank (Fin 2) := ListBlank.cons 0 (ones (L + 2) B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)LL:ListBlank (Fin 2) := ListBlank.cons 0 (ones L B0)h12:step weakCollatz16 { state := 12, tape := { head := 0, left := ones (r + 2) LL, right := ones m B0 } } = some { state := 13, tape := Tape.mk' (ones (r + 2 + 1) LL) (ones m B0) }⊢ reachPos { state := 12, tape := { head := 0, left := ones (r + 2) LL, right := ones m B0 } } { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones m B0) } All goals completed! 🐙private theorem odd_pass (L r m : ℕ) : reachPos (oddCfg (L + 2) r (m + 1)) (oddCfg L (r + 3) m) := L:ℕr:ℕm:ℕ⊢ reachPos (oddCfg (L + 2) r (m + 1)) (oddCfg L (r + 3) m) L:ℕr:ℕm:ℕ⊢ reachPos { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones (m + 1) B0) } (oddCfg L (r + 3) m) L:ℕr:ℕm:ℕ⊢ reachPos { state := 13, tape := { head := 1, left := ones (r + 3) (ListBlank.cons 0 (ones L B0)), right := ones m B0 } } (oddCfg L (r + 3) m) All goals completed! 🐙private theorem odd_many (L r m j : ℕ) : ∃ s : ℕ, nSteps weakCollatz16 s (oddCfg (L + 2 * j) r (m + j)) = some (oddCfg L (r + 3 * j) m) := L:ℕr:ℕm:ℕj:ℕ⊢ ∃ s, nSteps weakCollatz16 s (oddCfg (L + 2 * j) r (m + j)) = some (oddCfg L (r + 3 * j) m) induction j generalizing L r with m:ℕL:ℕr:ℕ⊢ ∃ s, nSteps weakCollatz16 s (oddCfg (L + 2 * 0) r (m + 0)) = some (oddCfg L (r + 3 * 0) m) m:ℕL:ℕr:ℕ⊢ ∃ s, nSteps weakCollatz16 s (oddCfg L r m) = some (oddCfg L r m) All goals completed! 🐙 m:ℕj:ℕih:∀ (L r : ℕ), ∃ s, nSteps weakCollatz16 s (oddCfg (L + 2 * j) r (m + j)) = some (oddCfg L (r + 3 * j) m)L:ℕr:ℕ⊢ ∃ s, nSteps weakCollatz16 s (oddCfg (L + 2 * (j + 1)) r (m + (j + 1))) = some (oddCfg L (r + 3 * (j + 1)) m) m:ℕj:ℕih:∀ (L r : ℕ), ∃ s, nSteps weakCollatz16 s (oddCfg (L + 2 * j) r (m + j)) = some (oddCfg L (r + 3 * j) m)L:ℕr:ℕ⊢ ∃ s, nSteps weakCollatz16 s (oddCfg (L + 2 * j + 2) r (m + j + 1)) = some (oddCfg L (r + 3 * (j + 1)) m) m:ℕj:ℕih:∀ (L r : ℕ), ∃ s, nSteps weakCollatz16 s (oddCfg (L + 2 * j) r (m + j)) = some (oddCfg L (r + 3 * j) m)L:ℕr:ℕs₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ (oddCfg (L + 2 * j + 2) r (m + j + 1)) = some (oddCfg (L + 2 * j) (r + 3) (m + j))⊢ ∃ s, nSteps weakCollatz16 s (oddCfg (L + 2 * j + 2) r (m + j + 1)) = some (oddCfg L (r + 3 * (j + 1)) m) m:ℕj:ℕih:∀ (L r : ℕ), ∃ s, nSteps weakCollatz16 s (oddCfg (L + 2 * j) r (m + j)) = some (oddCfg L (r + 3 * j) m)L:ℕr:ℕs₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ (oddCfg (L + 2 * j + 2) r (m + j + 1)) = some (oddCfg (L + 2 * j) (r + 3) (m + j))s₂:ℕhs₂:nSteps weakCollatz16 s₂ (oddCfg (L + 2 * j) (r + 3) (m + j)) = some (oddCfg L (r + 3 + 3 * j) m)⊢ ∃ s, nSteps weakCollatz16 s (oddCfg (L + 2 * j + 2) r (m + j + 1)) = some (oddCfg L (r + 3 * (j + 1)) m) m:ℕj:ℕih:∀ (L r : ℕ), ∃ s, nSteps weakCollatz16 s (oddCfg (L + 2 * j) r (m + j)) = some (oddCfg L (r + 3 * j) m)L:ℕr:ℕs₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ (oddCfg (L + 2 * j + 2) r (m + j + 1)) = some (oddCfg (L + 2 * j) (r + 3) (m + j))s₂:ℕhs₂:nSteps weakCollatz16 s₂ (oddCfg (L + 2 * j) (r + 3) (m + j)) = some (oddCfg L (r + 3 * (j + 1)) m)⊢ ∃ s, nSteps weakCollatz16 s (oddCfg (L + 2 * j + 2) r (m + j + 1)) = some (oddCfg L (r + 3 * (j + 1)) m) All goals completed! 🐙private theorem odd_done_to_15 (L r : ℕ) : reachPos (oddCfg (L + 2) r 0) ⟨15, mkL (ones L B0) ((ones (r + 2) B0).cons 0)⟩ := L:ℕr:ℕ⊢ reachPos (oddCfg (L + 2) r 0) { state := 15, tape := mkL (ones L B0) (ListBlank.cons 0 (ones (r + 2) B0)) } L:ℕr:ℕ⊢ reachPos { state := 13, tape := Tape.mk' (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ones 0 B0) } { state := 15, tape := mkL (ones L B0) (ListBlank.cons 0 (ones (r + 2) B0)) } L:ℕr:ℕ⊢ reachPos { state := 13, tape := { head := 0, left := ones (r + 3) (ListBlank.cons 0 (ones L B0)), right := B0 } } { state := 15, tape := mkL (ones L B0) (ListBlank.cons 0 (ones (r + 2) B0)) } L:ℕr:ℕ⊢ reachPos { state := 5, tape := mkL (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ListBlank.cons 0 B0) } { state := 15, tape := mkL (ones L B0) (ListBlank.cons 0 (ones (r + 2) B0)) } L:ℕr:ℕLL:ListBlank (Fin 2) := ListBlank.cons 0 (ones L B0)⊢ reachPos { state := 5, tape := mkL (ones (r + 3) (ListBlank.cons 0 (ones L B0))) (ListBlank.cons 0 B0) } { state := 15, tape := mkL (ones L B0) (ListBlank.cons 0 (ones (r + 2) B0)) } L:ℕr:ℕLL:ListBlank (Fin 2) := ListBlank.cons 0 (ones L B0)⊢ reachPos { state := 5, tape := { head := 1, left := ones (r + 2) LL, right := B0 } } { state := 15, tape := mkL (ones L B0) (ListBlank.cons 0 (ones (r + 2) B0)) } L:ℕr:ℕLL:ListBlank (Fin 2) := ListBlank.cons 0 (ones L B0)⊢ reachPos { state := 6, tape := mkL (ones (r + 2) LL) (ListBlank.cons 0 B0) } { state := 15, tape := mkL (ones L B0) (ListBlank.cons 0 (ones (r + 2) B0)) } L:ℕr:ℕLL:ListBlank (Fin 2) := ListBlank.cons 0 (ones L B0)⊢ reachPos { state := 6, tape := { head := 1, left := ones (r + 1) LL, right := B0 } } { state := 15, tape := mkL (ones L B0) (ListBlank.cons 0 (ones (r + 1 + 1) B0)) } All goals completed! 🐙private theorem odd_done_lt (d' r : ℕ) : reachPos (oddCfg (d' + 3) r 0) (roundCfg (d' + 1) (r + 2)) := d':ℕr:ℕ⊢ reachPos (oddCfg (d' + 3) r 0) (roundCfg (d' + 1) (r + 2)) d':ℕr:ℕ⊢ reachPos (oddCfg (d' + 1 + 2) r 0) (roundCfg (d' + 1) (r + 2)) d':ℕr:ℕ⊢ reachPos { state := 15, tape := mkL (ones (d' + 1) B0) (ListBlank.cons 0 (ones (r + 2) B0)) } (roundCfg (d' + 1) (r + 2)) d':ℕr:ℕ⊢ reachPos { state := 15, tape := { head := 1, left := ones d' B0, right := ListBlank.cons 0 (ones (r + 2) B0) } } (roundCfg (d' + 1) (r + 2)) d':ℕr:ℕh15:step weakCollatz16 { state := 15, tape := { head := 1, left := ones d' B0, right := ListBlank.cons 0 (ones (r + 2) B0) } } = some { state := 1, tape := Tape.mk' (ListBlank.cons 1 (ones d' B0)) (ListBlank.cons 0 (ones (r + 2) B0)) }⊢ reachPos { state := 15, tape := { head := 1, left := ones d' B0, right := ListBlank.cons 0 (ones (r + 2) B0) } } (roundCfg (d' + 1) (r + 2)) d':ℕr:ℕh15:step weakCollatz16 { state := 15, tape := { head := 1, left := ones d' B0, right := ListBlank.cons 0 (ones (r + 2) B0) } } = some { state := 1, tape := { head := 0, left := ones (d' + 1) B0, right := ones (r + 2) B0 } }⊢ reachPos { state := 15, tape := { head := 1, left := ones d' B0, right := ListBlank.cons 0 (ones (r + 2) B0) } } (roundCfg (d' + 1) (r + 2)) All goals completed! 🐙private theorem odd_done_halt (r : ℕ) : ∃ s cfg, nSteps weakCollatz16 s (oddCfg 2 r 0) = some cfg ∧ step weakCollatz16 cfg = none := r:ℕ⊢ ∃ s cfg, nSteps weakCollatz16 s (oddCfg 2 r 0) = some cfg ∧ step weakCollatz16 cfg = none r:ℕs:ℕleft✝:1 ≤ shs:nSteps weakCollatz16 s (oddCfg (0 + 2) r 0) = some { state := 15, tape := mkL (ones 0 B0) (ListBlank.cons 0 (ones (r + 2) B0)) }⊢ ∃ s cfg, nSteps weakCollatz16 s (oddCfg 2 r 0) = some cfg ∧ step weakCollatz16 cfg = none r:ℕs:ℕleft✝:1 ≤ shs:nSteps weakCollatz16 s (oddCfg (0 + 2) r 0) = some { state := 15, tape := { head := 0, left := B0, right := ListBlank.cons 0 (ones (r + 2) B0) } }⊢ ∃ s cfg, nSteps weakCollatz16 s (oddCfg 2 r 0) = some cfg ∧ step weakCollatz16 cfg = none All goals completed! 🐙private theorem odd_abort_L0 (r m : ℕ) : reachPos (oddCfg 0 r m) (stageCfg (r + m + 2)) := r:ℕm:ℕ⊢ reachPos (oddCfg 0 r m) (stageCfg (r + m + 2)) r:ℕm:ℕ⊢ reachPos { state := 9, tape := mkL (ones r (ListBlank.cons 0 (ones 0 B0))) (ListBlank.cons 0 (ones m B0)) } (stageCfg (r + m + 2)) r:ℕm:ℕ⊢ reachPos { state := 9, tape := mkL (ones r B0) (ListBlank.cons 0 (ones m B0)) } (stageCfg (r + m + 2)) r:ℕm:ℕRm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 9, tape := mkL (ones r B0) (ListBlank.cons 0 (ones m B0)) } (stageCfg (r + m + 2)) r:ℕm:ℕRm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 9, tape := mkL (ones r B0) Rm } (stageCfg (r + m + 2)) r:ℕm:ℕRm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 9, tape := mkL B0 (ones r Rm) } (stageCfg (r + m + 2)) r:ℕm:ℕRm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 9, tape := { head := 0, left := B0, right := ones r Rm } } (stageCfg (r + m + 2)) r:ℕm:ℕRm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 10, tape := mkL B0 (ListBlank.cons 1 (ones r Rm)) } (stageCfg (r + m + 2)) r:ℕm:ℕRm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 10, tape := { head := 0, left := B0, right := ones (r + 1) Rm } } (stageCfg (r + m + 2)) r:ℕm:ℕRm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 3, tape := Tape.mk' (ListBlank.cons 0 B0) (ones (r + 1) Rm) } (stageCfg (r + m + 2)) r:ℕm:ℕRm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 3, tape := Tape.mk' B0 (ones (r + 1) Rm) } (stageCfg (r + 1 + m + 1)) All goals completed! 🐙private theorem odd_abort_L1 (r m : ℕ) : reachPos (oddCfg 1 r m) (stageCfg (1 + r + m + 2)) := r:ℕm:ℕ⊢ reachPos (oddCfg 1 r m) (stageCfg (1 + r + m + 2)) r:ℕm:ℕ⊢ reachPos { state := 9, tape := mkL (ones r (ListBlank.cons 0 (ones 1 B0))) (ListBlank.cons 0 (ones m B0)) } (stageCfg (1 + r + m + 2)) r:ℕm:ℕL1:ListBlank (Fin 2) := ListBlank.cons 0 (ones 1 B0)⊢ reachPos { state := 9, tape := mkL (ones r (ListBlank.cons 0 (ones 1 B0))) (ListBlank.cons 0 (ones m B0)) } (stageCfg (1 + r + m + 2)) r:ℕm:ℕL1:ListBlank (Fin 2) := ListBlank.cons 0 (ones 1 B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 9, tape := mkL (ones r (ListBlank.cons 0 (ones 1 B0))) (ListBlank.cons 0 (ones m B0)) } (stageCfg (1 + r + m + 2)) r:ℕm:ℕL1:ListBlank (Fin 2) := ListBlank.cons 0 (ones 1 B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 9, tape := mkL (ones r L1) Rm } (stageCfg (1 + r + m + 2)) r:ℕm:ℕL1:ListBlank (Fin 2) := ListBlank.cons 0 (ones 1 B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 9, tape := mkL L1 (ones r Rm) } (stageCfg (1 + r + m + 2)) r:ℕm:ℕL1:ListBlank (Fin 2) := ListBlank.cons 0 (ones 1 B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 9, tape := mkL (ListBlank.cons 0 (ones 1 B0)) (ones r Rm) } (stageCfg (1 + r + m + 2)) r:ℕm:ℕL1:ListBlank (Fin 2) := ListBlank.cons 0 (ones 1 B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 9, tape := { head := 0, left := ones 1 B0, right := ones r Rm } } (stageCfg (1 + r + m + 2)) r:ℕm:ℕL1:ListBlank (Fin 2) := ListBlank.cons 0 (ones 1 B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 10, tape := mkL (ones 1 B0) (ListBlank.cons 1 (ones r Rm)) } (stageCfg (1 + r + m + 2)) r:ℕm:ℕL1:ListBlank (Fin 2) := ListBlank.cons 0 (ones 1 B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 10, tape := { head := 1, left := B0, right := ones (r + 1) Rm } } (stageCfg (1 + r + m + 2)) r:ℕm:ℕL1:ListBlank (Fin 2) := ListBlank.cons 0 (ones 1 B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 11, tape := mkL B0 (ListBlank.cons 1 (ones (r + 1) Rm)) } (stageCfg (1 + r + m + 2)) r:ℕm:ℕL1:ListBlank (Fin 2) := ListBlank.cons 0 (ones 1 B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 11, tape := { head := 0, left := B0, right := ones (r + 1 + 1) Rm } } (stageCfg (1 + r + m + 2)) r:ℕm:ℕL1:ListBlank (Fin 2) := ListBlank.cons 0 (ones 1 B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 3, tape := Tape.mk' (ListBlank.cons 0 B0) (ones (r + 1 + 1) Rm) } (stageCfg (1 + r + m + 2)) r:ℕm:ℕL1:ListBlank (Fin 2) := ListBlank.cons 0 (ones 1 B0)Rm:ListBlank (Fin 2) := ListBlank.cons 0 (ones m B0)⊢ reachPos { state := 3, tape := Tape.mk' B0 (ones (r + 1 + 1) Rm) } (stageCfg (r + 2 + m + 1)) All goals completed! 🐙

Round Dispatch (z < x, z > x, z = x, y = 1) & Blank-Tape Boot

private theorem round_to_odd (d k : ℕ) (hk : 1 ≤ k) : reachPos (roundCfg d (2 * k + 1)) (oddCfg (d + k + 1) 0 k) := d:ℕk:ℕhk:1 ≤ k⊢ reachPos (roundCfg d (2 * k + 1)) (oddCfg (d + k + 1) 0 k) d:ℕk:ℕhk:1 ≤ k⊢ reachPos (sqzCfg d (0 + 1 + 2 * k) 0) (oddCfg (d + k + 1) 0 k) d:ℕk:ℕhk:1 ≤ ks:ℕhs:nSteps weakCollatz16 s (sqzCfg d (0 + 1 + 2 * k) 0) = some (sqzCfg (d + k) (0 + 1) (0 + k))⊢ reachPos (sqzCfg d (0 + 1 + 2 * k) 0) (oddCfg (d + k + 1) 0 k) d:ℕk:ℕhk:1 ≤ ks:ℕhs:nSteps weakCollatz16 s (sqzCfg d (0 + 1 + 2 * k) 0) = some (sqzCfg (d + k) (0 + 1) (0 + k))hsqz:sqzCfg (d + k) (0 + 1) (0 + k) = sqzCfg (d + k) 1 (k - 1 + 1)⊢ reachPos (sqzCfg d (0 + 1 + 2 * k) 0) (oddCfg (d + k + 1) 0 k) d:ℕk:ℕhk:1 ≤ ks:ℕhs:nSteps weakCollatz16 s (sqzCfg d (0 + 1 + 2 * k) 0) = some (sqzCfg (d + k) 1 (k - 1 + 1))hsqz:sqzCfg (d + k) (0 + 1) (0 + k) = sqzCfg (d + k) 1 (k - 1 + 1)⊢ reachPos (sqzCfg d (0 + 1 + 2 * k) 0) (oddCfg (d + k + 1) 0 k) d:ℕk:ℕhk:1 ≤ ks:ℕhs:nSteps weakCollatz16 s (sqzCfg d (0 + 1 + 2 * k) 0) = some (sqzCfg (d + k) 1 (k - 1 + 1))hsqz:sqzCfg (d + k) (0 + 1) (0 + k) = sqzCfg (d + k) 1 (k - 1 + 1)hent:reachPos (sqzCfg (d + k) 1 (k - 1 + 1)) (oddCfg (d + k + 1) 0 (k - 1 + 1))⊢ reachPos (sqzCfg d (0 + 1 + 2 * k) 0) (oddCfg (d + k + 1) 0 k) d:ℕk:ℕhk:1 ≤ ks:ℕhs:nSteps weakCollatz16 s (sqzCfg d (0 + 1 + 2 * k) 0) = some (sqzCfg (d + k) 1 (k - 1 + 1))hsqz:sqzCfg (d + k) (0 + 1) (0 + k) = sqzCfg (d + k) 1 (k - 1 + 1)hent:reachPos (sqzCfg (d + k) 1 (k - 1 + 1)) (oddCfg (d + k + 1) 0 (k - 1 + 1))hodd:oddCfg (d + k + 1) 0 (k - 1 + 1) = oddCfg (d + k + 1) 0 k⊢ reachPos (sqzCfg d (0 + 1 + 2 * k) 0) (oddCfg (d + k + 1) 0 k) d:ℕk:ℕhk:1 ≤ ks:ℕhs:nSteps weakCollatz16 s (sqzCfg d (0 + 1 + 2 * k) 0) = some (sqzCfg (d + k) 1 (k - 1 + 1))hsqz:sqzCfg (d + k) (0 + 1) (0 + k) = sqzCfg (d + k) 1 (k - 1 + 1)hent:reachPos (sqzCfg (d + k) 1 (k - 1 + 1)) (oddCfg (d + k + 1) 0 k)hodd:oddCfg (d + k + 1) 0 (k - 1 + 1) = oddCfg (d + k + 1) 0 k⊢ reachPos (sqzCfg d (0 + 1 + 2 * k) 0) (oddCfg (d + k + 1) 0 k) All goals completed! 🐙private theorem even_or_odd_constructive (y : ℕ) : ∃ m : ℕ, y = 2 * m ∨ y = 2 * m + 1 := ⟨y / 2, y:ℕ⊢ y = 2 * (y / 2) ∨ y = 2 * (y / 2) + 1 All goals completed! 🐙⟩private theorem stage_round_lt (x y : ℕ) (hy2 : 2 ≤ y) (hyle : y ≤ x) (hlt : terras y < x) : reachPos (roundCfg (x - y) y) (roundCfg (x - terras y) (terras y)) := x:ℕy:ℕhy2:2 ≤ yhyle:y ≤ xhlt:terras y < x⊢ reachPos (roundCfg (x - y) y) (roundCfg (x - terras y) (terras y)) x:ℕm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhlt:terras (2 * m) < x⊢ reachPos (roundCfg (x - 2 * m) (2 * m)) (roundCfg (x - terras (2 * m)) (terras (2 * m)))x:ℕm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhlt:terras (2 * m + 1) < x⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (roundCfg (x - terras (2 * m + 1)) (terras (2 * m + 1))) x:ℕm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhlt:terras (2 * m) < x⊢ reachPos (roundCfg (x - 2 * m) (2 * m)) (roundCfg (x - terras (2 * m)) (terras (2 * m))) x:ℕm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhlt:terras (2 * m) < xhm1:1 ≤ m⊢ reachPos (roundCfg (x - 2 * m) (2 * m)) (roundCfg (x - terras (2 * m)) (terras (2 * m))) x:ℕm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhlt:terras (2 * m) < xhm1:1 ≤ mhte:terras (2 * m) = m⊢ reachPos (roundCfg (x - 2 * m) (2 * m)) (roundCfg (x - terras (2 * m)) (terras (2 * m))) x:ℕm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhlt:terras (2 * m) < xhm1:1 ≤ mhte:terras (2 * m) = m⊢ reachPos (roundCfg (x - 2 * m) (2 * m)) (roundCfg (x - m) m) x:ℕm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhlt:terras (2 * m) < xhm1:1 ≤ mhte:terras (2 * m) = mk:ℕ := m - 1⊢ reachPos (roundCfg (x - 2 * m) (2 * m)) (roundCfg (x - m) m) x:ℕm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhlt:terras (2 * m) < xhm1:1 ≤ mhte:terras (2 * m) = mk:ℕ := m - 1hy_eq:2 * m = 2 * k + 2⊢ reachPos (roundCfg (x - 2 * m) (2 * m)) (roundCfg (x - m) m) x:ℕm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhlt:terras (2 * m) < xhm1:1 ≤ mhte:terras (2 * m) = mk:ℕ := m - 1hy_eq:2 * m = 2 * k + 2⊢ reachPos (roundCfg (x - (2 * k + 2)) (2 * k + 2)) (roundCfg (x - m) m) x:ℕm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhlt:terras (2 * m) < xhm1:1 ≤ mhte:terras (2 * m) = mk:ℕ := m - 1hy_eq:2 * m = 2 * k + 2hrev:reachPos (roundCfg (x - (2 * k + 2)) (2 * k + 2)) (roundCfg (x - (2 * k + 2) + k + 1) (k + 1))⊢ reachPos (roundCfg (x - (2 * k + 2)) (2 * k + 2)) (roundCfg (x - m) m) x:ℕm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhlt:terras (2 * m) < xhm1:1 ≤ mhte:terras (2 * m) = mk:ℕ := m - 1hy_eq:2 * m = 2 * k + 2hrev:reachPos (roundCfg (x - (2 * k + 2)) (2 * k + 2)) (roundCfg (x - (2 * k + 2) + k + 1) (k + 1))hd_eq:x - (2 * k + 2) + k + 1 = x - m⊢ reachPos (roundCfg (x - (2 * k + 2)) (2 * k + 2)) (roundCfg (x - m) m) x:ℕm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhlt:terras (2 * m) < xhm1:1 ≤ mhte:terras (2 * m) = mk:ℕ := m - 1hy_eq:2 * m = 2 * k + 2hrev:reachPos (roundCfg (x - (2 * k + 2)) (2 * k + 2)) (roundCfg (x - (2 * k + 2) + k + 1) (k + 1))hd_eq:x - (2 * k + 2) + k + 1 = x - mhk_eq:k + 1 = m⊢ reachPos (roundCfg (x - (2 * k + 2)) (2 * k + 2)) (roundCfg (x - m) m) x:ℕm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhlt:terras (2 * m) < xhm1:1 ≤ mhte:terras (2 * m) = mk:ℕ := m - 1hy_eq:2 * m = 2 * k + 2hrev:reachPos (roundCfg (x - (2 * k + 2)) (2 * k + 2)) (roundCfg (x - m) m)hd_eq:x - (2 * k + 2) + k + 1 = x - mhk_eq:k + 1 = m⊢ reachPos (roundCfg (x - (2 * k + 2)) (2 * k + 2)) (roundCfg (x - m) m) All goals completed! 🐙 x:ℕm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhlt:terras (2 * m + 1) < x⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (roundCfg (x - terras (2 * m + 1)) (terras (2 * m + 1))) x:ℕm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhlt:terras (2 * m + 1) < xhm1:1 ≤ m⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (roundCfg (x - terras (2 * m + 1)) (terras (2 * m + 1))) x:ℕm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhlt:terras (2 * m + 1) < xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (roundCfg (x - terras (2 * m + 1)) (terras (2 * m + 1))) x:ℕm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhlt:3 * m + 2 < xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (roundCfg (x - (3 * m + 2)) (3 * m + 2)) x:ℕm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhlt:3 * m + 2 < xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2h1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg (x - (2 * m + 1) + m + 1) 0 m)⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (roundCfg (x - (3 * m + 2)) (3 * m + 2)) x:ℕm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhlt:3 * m + 2 < xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2h1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg (x - (2 * m + 1) + m + 1) 0 m)d':ℕ := x - (3 * m + 2) - 1⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (roundCfg (x - (3 * m + 2)) (3 * m + 2)) x:ℕm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhlt:3 * m + 2 < xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2h1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg (x - (2 * m + 1) + m + 1) 0 m)d':ℕ := x - (3 * m + 2) - 1hL:x - (2 * m + 1) + m + 1 = d' + 3 + 2 * m⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (roundCfg (x - (3 * m + 2)) (3 * m + 2)) x:ℕm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhlt:3 * m + 2 < xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2d':ℕ := x - (3 * m + 2) - 1h1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg (d' + 3 + 2 * m) 0 m)hL:x - (2 * m + 1) + m + 1 = d' + 3 + 2 * m⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (roundCfg (x - (3 * m + 2)) (3 * m + 2)) x:ℕm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhlt:3 * m + 2 < xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2d':ℕ := x - (3 * m + 2) - 1h1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg (d' + 3 + 2 * m) 0 m)hL:x - (2 * m + 1) + m + 1 = d' + 3 + 2 * ms:ℕhs:nSteps weakCollatz16 s (oddCfg (d' + 3 + 2 * m) 0 (0 + m)) = some (oddCfg (d' + 3) (0 + 3 * m) 0)⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (roundCfg (x - (3 * m + 2)) (3 * m + 2)) x:ℕm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhlt:3 * m + 2 < xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2d':ℕ := x - (3 * m + 2) - 1h1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg (d' + 3 + 2 * m) 0 m)hL:x - (2 * m + 1) + m + 1 = d' + 3 + 2 * ms:ℕhs:nSteps weakCollatz16 s (oddCfg (d' + 3 + 2 * m) 0 m) = some (oddCfg (d' + 3) (3 * m) 0)⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (roundCfg (x - (3 * m + 2)) (3 * m + 2)) x:ℕm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhlt:3 * m + 2 < xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2d':ℕ := x - (3 * m + 2) - 1h1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg (d' + 3 + 2 * m) 0 m)hL:x - (2 * m + 1) + m + 1 = d' + 3 + 2 * ms:ℕhs:nSteps weakCollatz16 s (oddCfg (d' + 3 + 2 * m) 0 m) = some (oddCfg (d' + 3) (3 * m) 0)hfin:reachPos (oddCfg (d' + 3) (3 * m) 0) (roundCfg (d' + 1) (3 * m + 2))⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (roundCfg (x - (3 * m + 2)) (3 * m + 2)) x:ℕm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhlt:3 * m + 2 < xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2d':ℕ := x - (3 * m + 2) - 1h1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg (d' + 3 + 2 * m) 0 m)hL:x - (2 * m + 1) + m + 1 = d' + 3 + 2 * ms:ℕhs:nSteps weakCollatz16 s (oddCfg (d' + 3 + 2 * m) 0 m) = some (oddCfg (d' + 3) (3 * m) 0)hfin:reachPos (oddCfg (d' + 3) (3 * m) 0) (roundCfg (x - (3 * m + 2)) (3 * m + 2))⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (roundCfg (x - (3 * m + 2)) (3 * m + 2)) All goals completed! 🐙private theorem stage_round_gt (x y : ℕ) (hx : 3 ≤ x) (hy2 : 2 ≤ y) (hyle : y ≤ x) (hgt : x < terras y) : reachPos (roundCfg (x - y) y) (stageCfg (x + 2)) := x:ℕy:ℕhx:3 ≤ xhy2:2 ≤ yhyle:y ≤ xhgt:x < terras y⊢ reachPos (roundCfg (x - y) y) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhgt:x < terras (2 * m)⊢ reachPos (roundCfg (x - 2 * m) (2 * m)) (stageCfg (x + 2))x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < terras (2 * m + 1)⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhgt:x < terras (2 * m)⊢ reachPos (roundCfg (x - 2 * m) (2 * m)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhgt:x < terras (2 * m)⊢ False x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xhgt:x < terras (2 * m)hte:terras (2 * m) = m⊢ False All goals completed! 🐙 x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < terras (2 * m + 1)⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < terras (2 * m + 1)hm1:1 ≤ m⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < terras (2 * m + 1)hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2h1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg (x - (2 * m + 1) + m + 1) 0 m)⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2h1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg (x - (2 * m + 1) + m + 1) 0 m)L₀:ℕ := x - m⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2h1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg (x - (2 * m + 1) + m + 1) 0 m)L₀:ℕ := x - mhL₀_eq:x - (2 * m + 1) + m + 1 = L₀⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ m⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * j⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + j⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg (rem + 2 * j) 0 (m - j + j)) = some (oddCfg rem (0 + 3 * j) (m - j))⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg (rem + 2 * j) 0 (m - j + j)) = some (oddCfg rem (0 + 3 * j) (m - j))hin:oddCfg (rem + 2 * j) 0 (m - j + j) = oddCfg L₀ 0 m⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg L₀ 0 m) = some (oddCfg rem (3 * j) (m - j))hin:oddCfg (rem + 2 * j) 0 (m - j + j) = oddCfg L₀ 0 m⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg L₀ 0 m) = some (oddCfg rem (3 * j) (m - j))hin:oddCfg (rem + 2 * j) 0 (m - j + j) = oddCfg L₀ 0 mhrem01:rem = 0 ∨ rem = 1⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg L₀ 0 m) = some (oddCfg rem (3 * j) (m - j))hin:oddCfg (rem + 2 * j) 0 (m - j + j) = oddCfg L₀ 0 mhrem0:rem = 0⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2))x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg L₀ 0 m) = some (oddCfg rem (3 * j) (m - j))hin:oddCfg (rem + 2 * j) 0 (m - j + j) = oddCfg L₀ 0 mhrem1:rem = 1⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg L₀ 0 m) = some (oddCfg rem (3 * j) (m - j))hin:oddCfg (rem + 2 * j) 0 (m - j + j) = oddCfg L₀ 0 mhrem0:rem = 0⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg L₀ 0 m) = some (oddCfg 0 (3 * j) (m - j))hin:oddCfg (rem + 2 * j) 0 (m - j + j) = oddCfg L₀ 0 mhrem0:rem = 0⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg L₀ 0 m) = some (oddCfg 0 (3 * j) (m - j))hin:oddCfg (rem + 2 * j) 0 (m - j + j) = oddCfg L₀ 0 mhrem0:rem = 0hab:reachPos (oddCfg 0 (3 * j) (m - j)) (stageCfg (3 * j + (m - j) + 2))⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg L₀ 0 m) = some (oddCfg 0 (3 * j) (m - j))hin:oddCfg (rem + 2 * j) 0 (m - j + j) = oddCfg L₀ 0 mhrem0:rem = 0hab:reachPos (oddCfg 0 (3 * j) (m - j)) (stageCfg (3 * j + (m - j) + 2))hsum:3 * j + (m - j) + 2 = x + 2⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg L₀ 0 m) = some (oddCfg 0 (3 * j) (m - j))hin:oddCfg (rem + 2 * j) 0 (m - j + j) = oddCfg L₀ 0 mhrem0:rem = 0hab:reachPos (oddCfg 0 (3 * j) (m - j)) (stageCfg (x + 2))hsum:3 * j + (m - j) + 2 = x + 2⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) All goals completed! 🐙 x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg L₀ 0 m) = some (oddCfg rem (3 * j) (m - j))hin:oddCfg (rem + 2 * j) 0 (m - j + j) = oddCfg L₀ 0 mhrem1:rem = 1⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg L₀ 0 m) = some (oddCfg 1 (3 * j) (m - j))hin:oddCfg (rem + 2 * j) 0 (m - j + j) = oddCfg L₀ 0 mhrem1:rem = 1⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg L₀ 0 m) = some (oddCfg 1 (3 * j) (m - j))hin:oddCfg (rem + 2 * j) 0 (m - j + j) = oddCfg L₀ 0 mhrem1:rem = 1hab:reachPos (oddCfg 1 (3 * j) (m - j)) (stageCfg (1 + 3 * j + (m - j) + 2))⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg L₀ 0 m) = some (oddCfg 1 (3 * j) (m - j))hin:oddCfg (rem + 2 * j) 0 (m - j + j) = oddCfg L₀ 0 mhrem1:rem = 1hab:reachPos (oddCfg 1 (3 * j) (m - j)) (stageCfg (1 + 3 * j + (m - j) + 2))hsum:1 + 3 * j + (m - j) + 2 = x + 2⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xhgt:x < 3 * m + 2hm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2L₀:ℕ := x - mh1:reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (oddCfg L₀ 0 m)hL₀_eq:x - (2 * m + 1) + m + 1 = L₀j:ℕ := L₀ / 2rem:ℕ := L₀ % 2hj_le:j ≤ mhL_split:L₀ = rem + 2 * jhm_split:m = m - j + js:ℕhs:nSteps weakCollatz16 s (oddCfg L₀ 0 m) = some (oddCfg 1 (3 * j) (m - j))hin:oddCfg (rem + 2 * j) 0 (m - j + j) = oddCfg L₀ 0 mhrem1:rem = 1hab:reachPos (oddCfg 1 (3 * j) (m - j)) (stageCfg (x + 2))hsum:1 + 3 * j + (m - j) + 2 = x + 2⊢ reachPos (roundCfg (x - (2 * m + 1)) (2 * m + 1)) (stageCfg (x + 2)) All goals completed! 🐙private theorem stage_round_halt (x y : ℕ) (hx : 3 ≤ x) (hy2 : 2 ≤ y) (hyle : y ≤ x) (heq : terras y = x) : ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - y) y) = some cfg ∧ step weakCollatz16 cfg = none := x:ℕy:ℕhx:3 ≤ xhy2:2 ≤ yhyle:y ≤ xheq:terras y = x⊢ ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - y) y) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xheq:terras (2 * m) = x⊢ ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - 2 * m) (2 * m)) = some cfg ∧ step weakCollatz16 cfg = nonex:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xheq:terras (2 * m + 1) = x⊢ ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xheq:terras (2 * m) = x⊢ ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - 2 * m) (2 * m)) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xheq:terras (2 * m) = x⊢ False x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * mhyle:2 * m ≤ xheq:terras (2 * m) = xhte:terras (2 * m) = m⊢ False All goals completed! 🐙 x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xheq:terras (2 * m + 1) = x⊢ ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xheq:terras (2 * m + 1) = xhm1:1 ≤ m⊢ ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xheq:terras (2 * m + 1) = xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2⊢ ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xheq:3 * m + 2 = xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2⊢ ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xheq:3 * m + 2 = xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2s₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some (oddCfg (x - (2 * m + 1) + m + 1) 0 m)⊢ ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xheq:3 * m + 2 = xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2s₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some (oddCfg (x - (2 * m + 1) + m + 1) 0 m)hL:x - (2 * m + 1) + m + 1 = 2 + 2 * m⊢ ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xheq:3 * m + 2 = xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2s₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some (oddCfg (2 + 2 * m) 0 m)hL:x - (2 * m + 1) + m + 1 = 2 + 2 * m⊢ ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xheq:3 * m + 2 = xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2s₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some (oddCfg (2 + 2 * m) 0 m)hL:x - (2 * m + 1) + m + 1 = 2 + 2 * ms₂:ℕhs₂:nSteps weakCollatz16 s₂ (oddCfg (2 + 2 * m) 0 (0 + m)) = some (oddCfg 2 (0 + 3 * m) 0)⊢ ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xheq:3 * m + 2 = xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2s₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some (oddCfg (2 + 2 * m) 0 m)hL:x - (2 * m + 1) + m + 1 = 2 + 2 * ms₂:ℕhs₂:nSteps weakCollatz16 s₂ (oddCfg (2 + 2 * m) 0 m) = some (oddCfg 2 (3 * m) 0)⊢ ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xm:ℕhy2:2 ≤ 2 * m + 1hyle:2 * m + 1 ≤ xheq:3 * m + 2 = xhm1:1 ≤ mhto:terras (2 * m + 1) = 3 * m + 2s₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some (oddCfg (2 + 2 * m) 0 m)hL:x - (2 * m + 1) + m + 1 = 2 + 2 * ms₂:ℕhs₂:nSteps weakCollatz16 s₂ (oddCfg (2 + 2 * m) 0 m) = some (oddCfg 2 (3 * m) 0)s₃:ℕcfg:Cfg 16 2hs₃:nSteps weakCollatz16 s₃ (oddCfg 2 (3 * m) 0) = some cfghnone:step weakCollatz16 cfg = none⊢ ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - (2 * m + 1)) (2 * m + 1)) = some cfg ∧ step weakCollatz16 cfg = none All goals completed! 🐙private theorem stage_y1_advance (x : ℕ) (hx : 1 ≤ x) : reachPos (roundCfg (x - 1) 1) (stageCfg (x + 2)) := x:ℕhx:1 ≤ x⊢ reachPos (roundCfg (x - 1) 1) (stageCfg (x + 2)) x:ℕhx:1 ≤ xh:reachPos (roundCfg (x - 1) 1) (stageCfg (x - 1 + 3))⊢ reachPos (roundCfg (x - 1) 1) (stageCfg (x + 2)) x:ℕhx:1 ≤ xh:reachPos (roundCfg (x - 1) 1) (stageCfg (x + 2))⊢ reachPos (roundCfg (x - 1) 1) (stageCfg (x + 2)) All goals completed! 🐙private theorem init_reaches_stage2 : reachPos init (stageCfg 2) := ⊢ reachPos init (stageCfg 2) ⊢ reachPos { state := 0, tape := { head := 0, left := B0, right := B0 } } (stageCfg 2) ⊢ reachPos { state := 8, tape := Tape.mk' (ListBlank.cons 0 B0) B0 } (stageCfg 2) ⊢ reachPos { state := 8, tape := { head := 0, left := B0, right := B0 } } (stageCfg 2) ⊢ reachPos { state := 7, tape := mkL B0 (ListBlank.cons 0 B0) } (stageCfg 2) ⊢ reachPos { state := 7, tape := { head := 0, left := B0, right := B0 } } (stageCfg 2) ⊢ reachPos { state := 5, tape := mkL B0 (ListBlank.cons 0 B0) } (stageCfg 2) ⊢ reachPos { state := 5, tape := { head := 0, left := B0, right := B0 } } (stageCfg 2) ⊢ reachPos { state := 9, tape := mkL B0 (ListBlank.cons 0 B0) } (stageCfg 2) ⊢ reachPos { state := 9, tape := { head := 0, left := B0, right := B0 } } (stageCfg 2) ⊢ reachPos { state := 10, tape := mkL B0 (ListBlank.cons 1 B0) } (stageCfg 2) h1:ListBlank.cons 1 B0 = ones 1 B0⊢ reachPos { state := 10, tape := mkL B0 (ListBlank.cons 1 B0) } (stageCfg 2) h1:ListBlank.cons 1 B0 = ones 1 B0⊢ reachPos { state := 10, tape := { head := 0, left := B0, right := ones 1 B0 } } (stageCfg 2) h1:ListBlank.cons 1 B0 = ones 1 B0⊢ reachPos { state := 3, tape := Tape.mk' (ListBlank.cons 0 B0) (ones 1 B0) } (stageCfg 2) h1:ListBlank.cons 1 B0 = ones 1 B0⊢ reachPos { state := 3, tape := Tape.mk' B0 (ones 1 B0) } (stageCfg 2) h1:ListBlank.cons 1 B0 = ones 1 B0hgt:reachPos { state := 3, tape := Tape.mk' B0 (ones 1 (ListBlank.cons 0 (ones 0 B0))) } (stageCfg (1 + 0 + 1))⊢ reachPos { state := 3, tape := Tape.mk' B0 (ones 1 B0) } (stageCfg 2) h1:ListBlank.cons 1 B0 = ones 1 B0hgt:reachPos { state := 3, tape := Tape.mk' B0 (ones 1 B0) } (stageCfg (1 + 0 + 1))⊢ reachPos { state := 3, tape := Tape.mk' B0 (ones 1 B0) } (stageCfg 2) All goals completed! 🐙private theorem init_reaches_stage4 : reachPos init (stageCfg 4) := reachPos_trans init_reaches_stage2 (reachPos_trans (round_even 0 0) (round_y1 1))

Even-Stage Cycle-Maximum Dovetailing & Halting Equivalence

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_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) (roundCfg (x - terras^[m] x) (terras^[m] x))) := x:ℕhx:3 ≤ xm:ℕhstay:StayIn x m⊢ m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x) (roundCfg (x - terras^[m] x) (terras^[m] x)) induction m with x:ℕhx:3 ≤ xhstay:StayIn x 0⊢ 0 = 0 ∨ 1 ≤ 0 ∧ reachPos (stageCfg x) (roundCfg (x - terras^[0] x) (terras^[0] x)) All goals completed! 🐙 x:ℕhx:3 ≤ xm:ℕih:StayIn x m → m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x) (roundCfg (x - terras^[m] x) (terras^[m] x))hstay:StayIn x (m + 1)⊢ m + 1 = 0 ∨ 1 ≤ m + 1 ∧ reachPos (stageCfg x) (roundCfg (x - terras^[m + 1] x) (terras^[m + 1] x)) refine Or.inr ⟨x:ℕhx:3 ≤ xm:ℕih:StayIn x m → m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x) (roundCfg (x - terras^[m] 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) (roundCfg (x - terras^[m] x) (terras^[m] x))hstay:StayIn x (m + 1)hstep:StepContinues x (m + 1)⊢ reachPos (stageCfg x) (roundCfg (x - terras^[m + 1] 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) (roundCfg (x - terras^[m] 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) (roundCfg (x - terras^[0] x) (terras^[0] x))hstay:StayIn x (0 + 1)hstep:StepContinues x (0 + 1)⊢ reachPos (stageCfg x) (roundCfg (x - terras^[0 + 1] x) (terras^[0 + 1] x)) x:ℕhx:3 ≤ xih:StayIn x 0 → 0 = 0 ∨ 1 ≤ 0 ∧ reachPos (stageCfg x) (roundCfg (x - terras^[0] x) (terras^[0] x))hstay:StayIn x (0 + 1)hstep:StepContinues x (0 + 1)hlt1:terras x < x⊢ reachPos (stageCfg x) (roundCfg (x - terras^[0 + 1] x) (terras^[0 + 1] x)) x:ℕhx:3 ≤ xih:StayIn x 0 → 0 = 0 ∨ 1 ≤ 0 ∧ reachPos (stageCfg x) (roundCfg (x - terras^[0] x) (terras^[0] x))hstay:StayIn x (0 + 1)hstep:StepContinues x (0 + 1)hlt1:terras x < x⊢ reachPos (stageCfg x) (roundCfg (x - terras x) (terras x)) x:ℕhx:3 ≤ xih:StayIn x 0 → 0 = 0 ∨ 1 ≤ 0 ∧ reachPos (stageCfg x) (roundCfg (x - terras^[0] x) (terras^[0] x))hstay:StayIn x (0 + 1)hstep:StepContinues x (0 + 1)hlt1:terras x < xh0:stageCfg x = roundCfg (x - x) x⊢ reachPos (stageCfg x) (roundCfg (x - terras x) (terras x)) x:ℕhx:3 ≤ xih:StayIn x 0 → 0 = 0 ∨ 1 ≤ 0 ∧ reachPos (stageCfg x) (roundCfg (x - terras^[0] x) (terras^[0] x))hstay:StayIn x (0 + 1)hstep:StepContinues x (0 + 1)hlt1:terras x < xh0:stageCfg x = roundCfg (x - x) x⊢ reachPos (roundCfg (x - x) x) (roundCfg (x - terras x) (terras x)) exact stage_round_lt x x (x:ℕhx:3 ≤ xih:StayIn x 0 → 0 = 0 ∨ 1 ≤ 0 ∧ reachPos (stageCfg x) (roundCfg (x - terras^[0] x) (terras^[0] x))hstay:StayIn x (0 + 1)hstep:StepContinues x (0 + 1)hlt1:terras x < xh0:stageCfg x = roundCfg (x - x) x⊢ 2 ≤ x All goals completed! 🐙) le_rfl hlt1 x:ℕhx:3 ≤ xm:ℕih:StayIn x m → m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x) (roundCfg (x - terras^[m] x) (terras^[m] x))hstay:StayIn x (m + 1)hstep:StepContinues x (m + 1)hm1:1 ≤ mhprev:reachPos (stageCfg x) (roundCfg (x - terras^[m] x) (terras^[m] x))⊢ reachPos (stageCfg x) (roundCfg (x - terras^[m + 1] x) (terras^[m + 1] x)) x:ℕhx:3 ≤ xm:ℕih:StayIn x m → m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x) (roundCfg (x - terras^[m] x) (terras^[m] x))hstay:StayIn x (m + 1)hstep:StepContinues x (m + 1)hm1:1 ≤ mhprev:reachPos (stageCfg x) (roundCfg (x - terras^[m] x) (terras^[m] x))hym:StepContinues x m⊢ reachPos (stageCfg x) (roundCfg (x - terras^[m + 1] x) (terras^[m + 1] x)) x:ℕhx:3 ≤ xm:ℕih:StayIn x m → m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x) (roundCfg (x - terras^[m] x) (terras^[m] x))hstay:StayIn x (m + 1)hstep:StepContinues x (m + 1)hm1:1 ≤ mhprev:reachPos (stageCfg x) (roundCfg (x - terras^[m] x) (terras^[m] x))hym:StepContinues x mhlt:terras (terras^[m] x) < x⊢ reachPos (stageCfg x) (roundCfg (x - terras^[m + 1] x) (terras^[m + 1] x)) x:ℕhx:3 ≤ xm:ℕih:StayIn x m → m = 0 ∨ 1 ≤ m ∧ reachPos (stageCfg x) (roundCfg (x - terras^[m] x) (terras^[m] x))hstay:StayIn x (m + 1)hstep:StepContinues x (m + 1)hm1:1 ≤ mhprev:reachPos (stageCfg x) (roundCfg (x - terras^[m] x) (terras^[m] x))hym:StepContinues x mhlt:terras (terras^[m] x) < x⊢ reachPos (stageCfg x) (roundCfg (x - terras (terras^[m] x)) (terras (terras^[m] x))) All goals completed! 🐙private def StageHalts (x : ℕ) : Prop := ∃ t : ℕ, 1 ≤ t ∧ t ≤ x ∧ StayIn x (t - 1) ∧ terras^[t] x = xprivate theorem even_of_stageHalts {w : ℕ} (hw3 : 3 ≤ w) (hh : StageHalts w) : ∃ m : ℕ, 2 ≤ m ∧ w = 2 * m := w:ℕhw3:3 ≤ whh:StageHalts w⊢ ∃ m, 2 ≤ m ∧ w = 2 * m w:ℕhw3:3 ≤ wt:ℕht1:1 ≤ tleft✝:t ≤ whprev:StayIn w (t - 1)hhit:terras^[t] w = w⊢ ∃ m, 2 ≤ m ∧ w = 2 * m t:ℕht1:1 ≤ tm:ℕhw3:3 ≤ 2 * mleft✝:t ≤ 2 * mhprev:StayIn (2 * m) (t - 1)hhit:terras^[t] (2 * m) = 2 * m⊢ ∃ m_1, 2 ≤ m_1 ∧ 2 * m = 2 * m_1t:ℕht1:1 ≤ tm:ℕhw3:3 ≤ 2 * m + 1left✝:t ≤ 2 * m + 1hprev:StayIn (2 * m + 1) (t - 1)hhit:terras^[t] (2 * m + 1) = 2 * m + 1⊢ ∃ m_1, 2 ≤ m_1 ∧ 2 * m + 1 = 2 * m_1 t:ℕht1:1 ≤ tm:ℕhw3:3 ≤ 2 * mleft✝:t ≤ 2 * mhprev:StayIn (2 * m) (t - 1)hhit:terras^[t] (2 * m) = 2 * m⊢ ∃ m_1, 2 ≤ m_1 ∧ 2 * m = 2 * m_1 exact ⟨m, t:ℕht1:1 ≤ tm:ℕhw3:3 ≤ 2 * mleft✝:t ≤ 2 * mhprev:StayIn (2 * m) (t - 1)hhit:terras^[t] (2 * m) = 2 * m⊢ 2 ≤ m All goals completed! 🐙, rfl⟩ t:ℕht1:1 ≤ tm:ℕhw3:3 ≤ 2 * m + 1left✝:t ≤ 2 * m + 1hprev:StayIn (2 * m + 1) (t - 1)hhit:terras^[t] (2 * m + 1) = 2 * m + 1⊢ ∃ m_1, 2 ≤ m_1 ∧ 2 * m + 1 = 2 * m_1 t:ℕht1:1 ≤ tm:ℕhw3:3 ≤ 2 * m + 1left✝:t ≤ 2 * m + 1hprev:StayIn (2 * m + 1) (t - 1)hhit:terras^[t] (2 * m + 1) = 2 * m + 1⊢ False t:ℕht1:1 ≤ tm:ℕhw3:3 ≤ 2 * m + 1left✝:t ≤ 2 * m + 1hprev:StayIn (2 * m + 1) (t - 1)hhit:terras^[t] (2 * m + 1) = 2 * m + 1hto:terras (2 * m + 1) = 3 * m + 2⊢ False t:ℕht1:1 ≤ tm:ℕhw3:3 ≤ 2 * m + 1left✝:t ≤ 2 * m + 1hprev:StayIn (2 * m + 1) (t - 1)hhit:terras^[t] (2 * m + 1) = 2 * m + 1hto:terras (2 * m + 1) = 3 * m + 2ht_eq1:t = 1⊢ Falset:ℕht1:1 ≤ tm:ℕhw3:3 ≤ 2 * m + 1left✝:t ≤ 2 * m + 1hprev:StayIn (2 * m + 1) (t - 1)hhit:terras^[t] (2 * m + 1) = 2 * m + 1hto:terras (2 * m + 1) = 3 * m + 2ht_eq1:¬t = 1⊢ False t:ℕht1:1 ≤ tm:ℕhw3:3 ≤ 2 * m + 1left✝:t ≤ 2 * m + 1hprev:StayIn (2 * m + 1) (t - 1)hhit:terras^[t] (2 * m + 1) = 2 * m + 1hto:terras (2 * m + 1) = 3 * m + 2ht_eq1:t = 1⊢ False m:ℕhw3:3 ≤ 2 * m + 1hto:terras (2 * m + 1) = 3 * m + 2ht1:1 ≤ 1left✝:1 ≤ 2 * m + 1hprev:StayIn (2 * m + 1) (1 - 1)hhit:terras^[1] (2 * m + 1) = 2 * m + 1⊢ False m:ℕhw3:3 ≤ 2 * m + 1hto:terras (2 * m + 1) = 3 * m + 2ht1:1 ≤ 1left✝:1 ≤ 2 * m + 1hprev:StayIn (2 * m + 1) (1 - 1)hhit:3 * m + 2 = 2 * m + 1⊢ False All goals completed! 🐙 t:ℕht1:1 ≤ tm:ℕhw3:3 ≤ 2 * m + 1left✝:t ≤ 2 * m + 1hprev:StayIn (2 * m + 1) (t - 1)hhit:terras^[t] (2 * m + 1) = 2 * m + 1hto:terras (2 * m + 1) = 3 * m + 2ht_eq1:¬t = 1⊢ False t:ℕht1:1 ≤ tm:ℕhw3:3 ≤ 2 * m + 1left✝:t ≤ 2 * m + 1hprev:StayIn (2 * m + 1) (t - 1)hhit:terras^[t] (2 * m + 1) = 2 * m + 1hto:terras (2 * m + 1) = 3 * m + 2ht_eq1:¬t = 1hs1:StepContinues (2 * m + 1) 1⊢ False t:ℕht1:1 ≤ tm:ℕhw3:3 ≤ 2 * m + 1left✝:t ≤ 2 * m + 1hprev:StayIn (2 * m + 1) (t - 1)hhit:terras^[t] (2 * m + 1) = 2 * m + 1hto:terras (2 * m + 1) = 3 * m + 2ht_eq1:¬t = 1hs1:StepContinues (2 * m + 1) 1hlt1:terras (2 * m + 1) < 2 * m + 1⊢ False All goals completed! 🐙private 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) (stageCfg (x + 2)) := x:ℕhx:3 ≤ xhno:NoStageHalts x⊢ reachPos (stageCfg x) (stageCfg (x + 2)) x:ℕhx:3 ≤ xhno:NoStageHalts xhstay:StayIn x x⊢ reachPos (stageCfg x) (stageCfg (x + 2))x:ℕhx:3 ≤ xhno:NoStageHalts xt:ℕht1:1 ≤ thtx:t ≤ xhprev:StayIn x (t - 1)hexit:¬StepContinues x t⊢ reachPos (stageCfg x) (stageCfg (x + 2)) x:ℕhx:3 ≤ xhno:NoStageHalts xhstay:StayIn x x⊢ reachPos (stageCfg x) (stageCfg (x + 2)) 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) (stageCfg (x + 2)) 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) (stageCfg (x + 2)) 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) (stageCfg (x + 2)) 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) (stageCfg (x + 2)) 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) (stageCfg (x + 2)) 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) (stageCfg (x + 2))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) (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))⊢ reachPos (stageCfg x) (stageCfg (x + 2)) 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) (stageCfg (x + 2)) 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) (stageCfg (x + 2)) 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) (stageCfg (x + 2)) 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) (stageCfg (x + 2)) 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 = 0h0:stageCfg x = roundCfg (x - x) x⊢ reachPos (stageCfg x) (stageCfg (x + 2)) 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 = 0h0:stageCfg x = roundCfg (x - x) x⊢ reachPos (roundCfg (x - x) x) (stageCfg (x + 2)) 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 = 0h0:stageCfg x = roundCfg (x - x) xh1:terras x = 1⊢ reachPos (roundCfg (x - x) x) (stageCfg (x + 2))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 = 0h0:stageCfg x = roundCfg (x - x) xhgt:x < terras x⊢ reachPos (roundCfg (x - x) x) (stageCfg (x + 2)) 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 = 0h0:stageCfg x = roundCfg (x - x) xh1:terras x = 1⊢ reachPos (roundCfg (x - x) x) (stageCfg (x + 2)) 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 = 0h0:stageCfg x = roundCfg (x - x) xh1:terras x = 1hlt:reachPos (roundCfg (x - x) x) (roundCfg (x - terras x) (terras x))⊢ reachPos (roundCfg (x - x) x) (stageCfg (x + 2)) 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 = 0h0:stageCfg x = roundCfg (x - x) xh1:terras x = 1hlt:reachPos (roundCfg (x - x) x) (roundCfg (x - 1) 1)⊢ reachPos (roundCfg (x - x) x) (stageCfg (x + 2)) 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 = 0h0:stageCfg x = roundCfg (x - x) xh1:terras x = 1hlt:reachPos (roundCfg (x - x) x) (roundCfg (x - 1) 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 = 0h0:stageCfg x = roundCfg (x - x) xhgt:x < terras x⊢ reachPos (roundCfg (x - x) x) (stageCfg (x + 2)) 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 = 0h0:stageCfg x = roundCfg (x - x) xhgt:x < terras x⊢ 2 ≤ x All goals completed! 🐙) le_rfl 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) (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))⊢ reachPos (stageCfg x) (stageCfg (x + 2)) 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) (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))hy_prev:StepContinues x (t - 1)⊢ reachPos (stageCfg x) (stageCfg (x + 2)) 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) (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))hy_prev:StepContinues x (t - 1)hnext:terras (terras^[t - 1] x) = terras^[t] x⊢ reachPos (stageCfg x) (stageCfg (x + 2)) 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) (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))hy_prev:StepContinues x (t - 1)hnext:terras (terras^[t - 1] x) = terras^[t] xh1:terras^[t] x = 1⊢ reachPos (stageCfg x) (stageCfg (x + 2))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) (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))hy_prev:StepContinues x (t - 1)hnext:terras (terras^[t - 1] x) = terras^[t] xhgt:x < terras^[t] x⊢ reachPos (stageCfg x) (stageCfg (x + 2)) 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) (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))hy_prev:StepContinues x (t - 1)hnext:terras (terras^[t - 1] x) = terras^[t] xh1:terras^[t] x = 1⊢ reachPos (stageCfg x) (stageCfg (x + 2)) 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) (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))hy_prev:StepContinues x (t - 1)hnext:terras (terras^[t - 1] x) = terras^[t] xh1:terras^[t] x = 1hlt:reachPos (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x)) (roundCfg (x - terras (terras^[t - 1] x)) (terras (terras^[t - 1] x)))⊢ reachPos (stageCfg x) (stageCfg (x + 2)) 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) (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))hy_prev:StepContinues x (t - 1)hnext:terras (terras^[t - 1] x) = terras^[t] xh1:terras^[t] x = 1hlt:reachPos (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x)) (roundCfg (x - 1) 1)⊢ reachPos (stageCfg x) (stageCfg (x + 2)) 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) (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))hy_prev:StepContinues x (t - 1)hnext:terras (terras^[t - 1] x) = terras^[t] xh1:terras^[t] x = 1hlt:reachPos (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x)) (roundCfg (x - 1) 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) (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))hy_prev:StepContinues x (t - 1)hnext:terras (terras^[t - 1] x) = terras^[t] xhgt:x < terras^[t] x⊢ reachPos (stageCfg x) (stageCfg (x + 2)) 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) (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))hy_prev:StepContinues x (t - 1)hnext:terras (terras^[t - 1] x) = terras^[t] xhgt:x < terras (terras^[t - 1] x)⊢ reachPos (stageCfg x) (stageCfg (x + 2)) All goals completed! 🐙private theorem reach_even_stage_from_init (m : ℕ) (hm : 2 ≤ m) (hno : NoStageHalts (2 * m - 1)) : ∃ s : ℕ, m - 1 ≤ s ∧ nSteps weakCollatz16 s init = some (stageCfg (2 * m)) := m:ℕhm:2 ≤ mhno:NoStageHalts (2 * m - 1)⊢ ∃ s, m - 1 ≤ s ∧ nSteps weakCollatz16 s init = some (stageCfg (2 * m)) induction m, hm using Nat.le_induction with m:ℕhno:NoStageHalts (2 * 2 - 1)⊢ ∃ s, 2 - 1 ≤ s ∧ nSteps weakCollatz16 s init = some (stageCfg (2 * 2)) m:ℕhno:NoStageHalts (2 * 2 - 1)s:ℕhs1:1 ≤ shs:nSteps weakCollatz16 s init = some (stageCfg 4)⊢ ∃ s, 2 - 1 ≤ s ∧ nSteps weakCollatz16 s init = some (stageCfg (2 * 2)) exact ⟨s, m:ℕhno:NoStageHalts (2 * 2 - 1)s:ℕhs1:1 ≤ shs:nSteps weakCollatz16 s init = some (stageCfg 4)⊢ 2 - 1 ≤ s All goals completed! 🐙, hs⟩ m✝:ℕm:ℕhm:2 ≤ mih:NoStageHalts (2 * m - 1) → ∃ s, m - 1 ≤ s ∧ nSteps weakCollatz16 s init = some (stageCfg (2 * m))hno:NoStageHalts (2 * (m + 1) - 1)⊢ ∃ s, m + 1 - 1 ≤ s ∧ nSteps weakCollatz16 s init = some (stageCfg (2 * (m + 1))) m✝:ℕm:ℕhm:2 ≤ mih:NoStageHalts (2 * m - 1) → ∃ s, m - 1 ≤ s ∧ nSteps weakCollatz16 s init = some (stageCfg (2 * m))hno:NoStageHalts (2 * (m + 1) - 1)s₁:ℕhs₁_ge:m - 1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ init = some (stageCfg (2 * m))⊢ ∃ s, m + 1 - 1 ≤ s ∧ nSteps weakCollatz16 s init = some (stageCfg (2 * (m + 1))) m✝:ℕm:ℕhm:2 ≤ mih:NoStageHalts (2 * m - 1) → ∃ s, m - 1 ≤ s ∧ nSteps weakCollatz16 s init = some (stageCfg (2 * m))hno:NoStageHalts (2 * (m + 1) - 1)s₁:ℕhs₁_ge:m - 1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ init = some (stageCfg (2 * m))s₂:ℕhs₂_pos:1 ≤ s₂hs₂:nSteps weakCollatz16 s₂ (stageCfg (2 * m)) = some (stageCfg (2 * m + 2))⊢ ∃ s, m + 1 - 1 ≤ s ∧ nSteps weakCollatz16 s init = some (stageCfg (2 * (m + 1))) m✝:ℕm:ℕhm:2 ≤ mih:NoStageHalts (2 * m - 1) → ∃ s, m - 1 ≤ s ∧ nSteps weakCollatz16 s init = some (stageCfg (2 * m))hno:NoStageHalts (2 * (m + 1) - 1)s₁:ℕhs₁_ge:m - 1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ init = some (stageCfg (2 * m))s₂:ℕhs₂_pos:1 ≤ s₂hs₂:nSteps weakCollatz16 s₂ (stageCfg (2 * m)) = some (stageCfg (2 * (m + 1)))⊢ ∃ s, m + 1 - 1 ≤ s ∧ nSteps weakCollatz16 s init = some (stageCfg (2 * (m + 1))) exact ⟨s₁ + s₂, m✝:ℕm:ℕhm:2 ≤ mih:NoStageHalts (2 * m - 1) → ∃ s, m - 1 ≤ s ∧ nSteps weakCollatz16 s init = some (stageCfg (2 * m))hno:NoStageHalts (2 * (m + 1) - 1)s₁:ℕhs₁_ge:m - 1 ≤ s₁hs₁:nSteps weakCollatz16 s₁ init = some (stageCfg (2 * m))s₂:ℕhs₂_pos:1 ≤ s₂hs₂:nSteps weakCollatz16 s₂ (stageCfg (2 * m)) = some (stageCfg (2 * (m + 1)))⊢ m + 1 - 1 ≤ 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 weakCollatz16 s (stageCfg x) = some cfg ∧ step weakCollatz16 cfg = none := x:ℕhx:3 ≤ xhhalt:StageHalts x⊢ ∃ s cfg, nSteps weakCollatz16 s (stageCfg x) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xt:ℕht1:1 ≤ tleft✝:t ≤ xhprev:StayIn x (t - 1)hhit:terras^[t] x = x⊢ ∃ s cfg, nSteps weakCollatz16 s (stageCfg x) = some cfg ∧ step weakCollatz16 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 weakCollatz16 s (stageCfg x) = some cfg ∧ step weakCollatz16 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) (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))⊢ ∃ s cfg, nSteps weakCollatz16 s (stageCfg x) = some cfg ∧ step weakCollatz16 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 weakCollatz16 s (stageCfg x) = some cfg ∧ step weakCollatz16 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 weakCollatz16 s (stageCfg x) = some cfg ∧ step weakCollatz16 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 weakCollatz16 s (stageCfg x) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xht1:1 ≤ 1left✝:1 ≤ xhprev:StayIn x (1 - 1)hhit:terras x = xht0:1 - 1 = 0⊢ ∃ s cfg, nSteps weakCollatz16 s (stageCfg x) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xht1:1 ≤ 1left✝:1 ≤ xhprev:StayIn x (1 - 1)hhit:terras x = xht0:1 - 1 = 0h0:stageCfg x = roundCfg (x - x) x⊢ ∃ s cfg, nSteps weakCollatz16 s (stageCfg x) = some cfg ∧ step weakCollatz16 cfg = none x:ℕhx:3 ≤ xht1:1 ≤ 1left✝:1 ≤ xhprev:StayIn x (1 - 1)hhit:terras x = xht0:1 - 1 = 0h0:stageCfg x = roundCfg (x - x) x⊢ ∃ s cfg, nSteps weakCollatz16 s (roundCfg (x - x) x) = some cfg ∧ step weakCollatz16 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 = 0h0:stageCfg x = roundCfg (x - x) x⊢ 2 ≤ x All goals completed! 🐙) le_rfl 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) (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))⊢ ∃ s cfg, nSteps weakCollatz16 s (stageCfg x) = some cfg ∧ step weakCollatz16 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 weakCollatz16 s₁ (stageCfg x) = some (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))⊢ ∃ s cfg, nSteps weakCollatz16 s (stageCfg x) = some cfg ∧ step weakCollatz16 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 weakCollatz16 s₁ (stageCfg x) = some (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))hy_prev:StepContinues x (t - 1)⊢ ∃ s cfg, nSteps weakCollatz16 s (stageCfg x) = some cfg ∧ step weakCollatz16 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 weakCollatz16 s₁ (stageCfg x) = some (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))hy_prev:StepContinues x (t - 1)hhit':terras (terras^[t - 1] x) = x⊢ ∃ s cfg, nSteps weakCollatz16 s (stageCfg x) = some cfg ∧ step weakCollatz16 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 weakCollatz16 s₁ (stageCfg x) = some (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x))hy_prev:StepContinues x (t - 1)hhit':terras (terras^[t - 1] x) = xs₂:ℕcfg:Cfg 16 2hs₂:nSteps weakCollatz16 s₂ (roundCfg (x - terras^[t - 1] x) (terras^[t - 1] x)) = some cfghnone:step weakCollatz16 cfg = none⊢ ∃ s cfg, nSteps weakCollatz16 s (stageCfg x) = some cfg ∧ step weakCollatz16 cfg = none All goals completed! 🐙

The 16-state machine weakCollatz16 (weak_collatz_16) 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_weakCollatz16_iff_bounded_cycle : ConjectureMachines.Halts weakCollatz16 ↔ ∃ x j : ℕ, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x := ⊢ ConjectureMachines.Halts weakCollatz16 ↔ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x ⊢ (eval (step weakCollatz16) init).Dom ↔ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x ⊢ (eval (step weakCollatz16) 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 weakCollatz16) init).Dom ⊢ (eval (step weakCollatz16) init).Dom → ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x hdom:(eval (step weakCollatz16) init).Dom⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x hdom:∃ y, y ∈ eval (step weakCollatz16) init⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x b:Cfg 16 2hb:b ∈ eval (step weakCollatz16) init⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x b:Cfg 16 2hb:Reaches (step weakCollatz16) init b ∧ step weakCollatz16 b = none⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x b:Cfg 16 2hreach:Reaches (step weakCollatz16) init bhnone:step weakCollatz16 b = none⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x b:Cfg 16 2hreach:Reaches (step weakCollatz16) init bhnone:step weakCollatz16 b = nonek:ℕhk:nSteps weakCollatz16 k init = some b⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x b:Cfg 16 2hreach:Reaches (step weakCollatz16) init bhnone:step weakCollatz16 b = nonek:ℕhk:nSteps weakCollatz16 k init = some bhno:NoStageHalts (2 * (k + 2) - 1)⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = xb:Cfg 16 2hreach:Reaches (step weakCollatz16) init bhnone:step weakCollatz16 b = nonek:ℕhk:nSteps weakCollatz16 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 16 2hreach:Reaches (step weakCollatz16) init bhnone:step weakCollatz16 b = nonek:ℕhk:nSteps weakCollatz16 k init = some bhno:NoStageHalts (2 * (k + 2) - 1)⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x b:Cfg 16 2hreach:Reaches (step weakCollatz16) init bhnone:step weakCollatz16 b = nonek:ℕhk:nSteps weakCollatz16 k init = some bhno:NoStageHalts (2 * (k + 2) - 1)s:ℕhks:k + 2 - 1 ≤ shs:nSteps weakCollatz16 s init = some (stageCfg (2 * (k + 2)))⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x b:Cfg 16 2hreach:Reaches (step weakCollatz16) init bhnone:step weakCollatz16 b = nonek:ℕhk:nSteps weakCollatz16 k init = some bhno:NoStageHalts (2 * (k + 2) - 1)s:ℕhks:k + 2 - 1 ≤ shs:none = some (stageCfg (2 * (k + 2)))⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x All goals completed! 🐙 b:Cfg 16 2hreach:Reaches (step weakCollatz16) init bhnone:step weakCollatz16 b = nonek:ℕhk:nSteps weakCollatz16 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 weakCollatz16) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = x⊢ (eval (step weakCollatz16) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jM_hjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M⊢ (eval (step weakCollatz16) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jM_hjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts M⊢ (eval (step weakCollatz16) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jM_hjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts Mhno:NoStageHalts M⊢ (eval (step weakCollatz16) init).Domx:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jM_hjMM: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 weakCollatz16) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jM_hjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts Mhno:NoStageHalts M⊢ (eval (step weakCollatz16) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jM_hjMM: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 ≤ jM_hjMM: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 weakCollatz16) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jM_hjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts Mm₀:ℕhm₀2:2 ≤ m₀hw₀3:3 ≤ 2 * m₀hprev₀:NoStageHalts (2 * m₀ - 1)hhalt₀:StageHalts (2 * m₀)⊢ (eval (step weakCollatz16) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jM_hjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts Mm₀:ℕhm₀2:2 ≤ m₀hw₀3:3 ≤ 2 * m₀hprev₀:NoStageHalts (2 * m₀ - 1)hhalt₀:StageHalts (2 * m₀)s₁:ℕhs₁:nSteps weakCollatz16 s₁ init = some (stageCfg (2 * m₀))⊢ (eval (step weakCollatz16) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jM_hjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts Mm₀:ℕhm₀2:2 ≤ m₀hw₀3:3 ≤ 2 * m₀hprev₀:NoStageHalts (2 * m₀ - 1)hhalt₀:StageHalts (2 * m₀)s₁:ℕhs₁:nSteps weakCollatz16 s₁ init = some (stageCfg (2 * m₀))s₂:ℕcfg:Cfg 16 2hs₂:nSteps weakCollatz16 s₂ (stageCfg (2 * m₀)) = some cfghnone:step weakCollatz16 cfg = none⊢ (eval (step weakCollatz16) init).Dom x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhhit:terras^[j] x = xM:ℕjM:ℕhM3:3 ≤ MhjM1:1 ≤ jM_hjMM:jM ≤ M - 2hjM_cyc:terras^[jM] M = Mhbnd:∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ MhM_halts:StageHalts Mm₀:ℕhm₀2:2 ≤ m₀hw₀3:3 ≤ 2 * m₀hprev₀:NoStageHalts (2 * m₀ - 1)hhalt₀:StageHalts (2 * m₀)s₁:ℕhs₁:nSteps weakCollatz16 s₁ init = some (stageCfg (2 * m₀))s₂:ℕcfg:Cfg 16 2hs₂:nSteps weakCollatz16 s₂ (stageCfg (2 * m₀)) = some cfghnone:step weakCollatz16 cfg = none⊢ ∃ y, y ∈ eval (step weakCollatz16) init All goals completed! 🐙

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

theorem candidate_equivalent : Halts candidate ↔ Halts reference := halts_weakCollatz16_iff_bounded_cycle.trans WeakCollatz17.halts_weakCollatz17_iff_bounded_cycle.symm

The candidate has 1 fewer state than the 17-state reference (16 < 17).

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