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.WeakCollatz75
WeakCollatz41 (weak_collatz_41)
The 41-state, 2-symbol Turing machine weak_collatz_41 compresses weak_collatz_75 (75 → 41
states, -34 states / -45.33%) while constructively preserving blank-tape halting equivalence:
it halts on the blank tape if and only if there exist x ≥ 3 and 1 ≤ j ≤ x with
terras^[j] x = x (halts_weakCollatz41_iff_bounded_cycle), and hence if and only if
weak_collatz_75 halts (candidate_equivalent, proved without Classical.choice).
Notice why Tao's Weak Collatz Conjecture (absence of nontrivial positive cycles) is the exact
blank-tape halting (\Sigma_1^0) half of the Collatz problem: existence of a divergent trajectory
(\exists x,\; \forall k,\; T^k(x) \neq 1) is \Sigma_2^0 and cannot be semi-decided by blank-tape
halting without an oracle, whereas existence of a nontrivial cycle
(\exists x \ge 3,\; \exists j \ge 1,\; T^j(x) = x) is \Sigma_1^0.
Compression Ideas (75 → 41 states)
At canonical checkpoint stageCfg c x y (c ≥ 1, x ≥ 3, y ≥ 1), the tape holds
0^∞ 1^c 0 1^x 0 [1] 1^(y - 1) 0^∞ in state 12 with single-zero delimiters and
zero unbounded blank gaps:
Adjacent 1^x 0 1^y Layout & Left-End Counter Decrement: placing 1^c on the outer left
(1^c 0 1^x 0 1^y instead of 1^x 00 1^c 0^(g + 2) 1^y) makes 1^x and 1^z directly
adjacent during comparison and lets counter decrements erase the leftmost 1 of 1^c into 0^∞
without creating a growing 0^(g + 2) gap.
In-Place Zero-Gap terras Engine (states 12–22): moves a single 0-hole right across
1^y while peeling 1s from the right end; even y = 2k + 2 finishes directly as 1^(k + 1)
when the right suffix vanishes into 0^∞, while odd y = 2k + 1 reverses the hole leftward to
expand 1^k into 1^(3k + 2) in place.
Local 2p Comparison & Unified Restoration (states 0, 1, 20, 22, 23–31): compares
1^x 0 1^z in place as 1^u 0 1^v 0 1^(2p) (u + p = x, v + p = z) without ever sweeping
across 1^c or 1^(2p), halting at (25, 0) iff u = v = 0, and otherwise restoring
1^x 0 1^z via a single shared reverse loop for both z < x and z > x.
Right-to-Left 1-Pass Triple-Build & 6-Step Boot (states 0–11, 34–40): builds all three
blocks 1^A 0 1^A 0 1^A from 1^A in a single pass rather than two sequential copy passes, and
uses the sole remaining 0-transition (1, 0) for a 6-step blank-tape entry into
tripleCfg 0 3, achieving 81/81 active transition coverage (82/82 cells including halt).
@[expose] public sectionnamespace ConjectureMachines.WeakCollatz41open Turing (Dir)open StateTransitionopen ErdosTernary15 (B0 B0_cons_zero nSteps nSteps_zero nSteps_succ nSteps_reaches
nSteps_bind_eq step_one reaches_imp_nSteps nSteps_eq_none_of_step_none)open ErdosTernary14 (ones ones_succ' ones_add)local notation "mkL" => ErdosTernary15.Tape.mkL
75-state Weak Collatz reference machine (weak_collatz_75).
abbrev reference : BundledMachine 2 := Machines.weakCollatz75.bundle
41-state Weak Collatz candidate machine (weak_collatz_41).
abbrev candidate : BundledMachine 2 := Machines.weakCollatz41.bundle
The candidate as a Machine 41 2.
abbrev weakCollatz41 : Machine 41 2 := Machines.weakCollatz41private 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 41} {a b : Fin 2}
(h : weakCollatz41.transition q a = some (b, .right, q'))
(L R : ListBlank (Fin 2)) :
step weakCollatz41 ⟨q, ⟨a, L, R⟩⟩ = some ⟨q', Tape.mk' (L.cons b) R⟩ := q:Fin 41q':Fin 41a:Fin 2b:Fin 2h:weakCollatz41.transition q a = some (b, Dir.right, q')L:ListBlank (Fin 2)R:ListBlank (Fin 2)⊢ step weakCollatz41 { state := q, tape := { head := a, left := L, right := R } } =
some { state := q', tape := Tape.mk' (ListBlank.cons b L) R }
q:Fin 41q':Fin 41a:Fin 2b:Fin 2h:weakCollatz41.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 41} {a b : Fin 2}
(h : weakCollatz41.transition q a = some (b, .left, q'))
(L R : ListBlank (Fin 2)) :
step weakCollatz41 ⟨q, ⟨a, L, R⟩⟩ = some ⟨q', mkL L (R.cons b)⟩ := q:Fin 41q':Fin 41a:Fin 2b:Fin 2h:weakCollatz41.transition q a = some (b, Dir.left, q')L:ListBlank (Fin 2)R:ListBlank (Fin 2)⊢ step weakCollatz41 { state := q, tape := { head := a, left := L, right := R } } =
some { state := q', tape := mkL L (ListBlank.cons b R) }
q:Fin 41q':Fin 41a:Fin 2b:Fin 2h:weakCollatz41.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 weakCollatz41 ⟨0, ⟨0, L, R⟩⟩ = some ⟨1, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr0_1 (L R) : step weakCollatz41 ⟨0, ⟨1, L, R⟩⟩ = some ⟨0, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr1_0 (L R) :
step weakCollatz41 ⟨1, ⟨0, L, R⟩⟩ = some ⟨35, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr1_1 (L R) :
step weakCollatz41 ⟨1, ⟨1, L, R⟩⟩ = some ⟨30, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr2_0 (L R) : step weakCollatz41 ⟨2, ⟨0, L, R⟩⟩ = some ⟨34, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr2_1 (L R) :
step weakCollatz41 ⟨2, ⟨1, L, R⟩⟩ = some ⟨3, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr3_0 (L R) :
step weakCollatz41 ⟨3, ⟨0, L, R⟩⟩ = some ⟨4, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr3_1 (L R) :
step weakCollatz41 ⟨3, ⟨1, L, R⟩⟩ = some ⟨35, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr4_0 (L R) :
step weakCollatz41 ⟨4, ⟨0, L, R⟩⟩ = some ⟨5, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr4_1 (L R) :
step weakCollatz41 ⟨4, ⟨1, L, R⟩⟩ = some ⟨4, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr5_0 (L R) : step weakCollatz41 ⟨5, ⟨0, L, R⟩⟩ = some ⟨6, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr5_1 (L R) :
step weakCollatz41 ⟨5, ⟨1, L, R⟩⟩ = some ⟨5, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr6_0 (L R) : step weakCollatz41 ⟨6, ⟨0, L, R⟩⟩ = some ⟨7, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr6_1 (L R) : step weakCollatz41 ⟨6, ⟨1, L, R⟩⟩ = some ⟨6, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr7_0 (L R) : step weakCollatz41 ⟨7, ⟨0, L, R⟩⟩ = some ⟨8, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr7_1 (L R) : step weakCollatz41 ⟨7, ⟨1, L, R⟩⟩ = some ⟨7, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr8_0 (L R) : step weakCollatz41 ⟨8, ⟨0, L, R⟩⟩ = some ⟨9, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr8_1 (L R) : step weakCollatz41 ⟨8, ⟨1, L, R⟩⟩ = some ⟨8, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr9_0 (L R) :
step weakCollatz41 ⟨9, ⟨0, L, R⟩⟩ = some ⟨10, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr9_1 (L R) : step weakCollatz41 ⟨9, ⟨1, L, R⟩⟩ = some ⟨9, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr10_0 (L R) :
step weakCollatz41 ⟨10, ⟨0, L, R⟩⟩ = some ⟨11, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr10_1 (L R) :
step weakCollatz41 ⟨10, ⟨1, L, R⟩⟩ = some ⟨10, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr11_0 (L R) : step weakCollatz41 ⟨11, ⟨0, L, R⟩⟩ = some ⟨2, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr11_1 (L R) :
step weakCollatz41 ⟨11, ⟨1, L, R⟩⟩ = some ⟨11, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr12_0 (L R) :
step weakCollatz41 ⟨12, ⟨0, L, R⟩⟩ = some ⟨19, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr12_1 (L R) :
step weakCollatz41 ⟨12, ⟨1, L, R⟩⟩ = some ⟨13, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr13_0 (L R) : step weakCollatz41 ⟨13, ⟨0, L, R⟩⟩ = some ⟨24, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr13_1 (L R) :
step weakCollatz41 ⟨13, ⟨1, L, R⟩⟩ = some ⟨14, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr14_0 (L R) : step weakCollatz41 ⟨14, ⟨0, L, R⟩⟩ = some ⟨15, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr14_1 (L R) :
step weakCollatz41 ⟨14, ⟨1, L, R⟩⟩ = some ⟨14, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr15_0 (L R) : step weakCollatz41 ⟨15, ⟨0, L, R⟩⟩ = some ⟨23, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr15_1 (L R) : step weakCollatz41 ⟨15, ⟨1, L, R⟩⟩ = some ⟨16, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr16_0 (L R) :
step weakCollatz41 ⟨16, ⟨0, L, R⟩⟩ = some ⟨20, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr16_1 (L R) : step weakCollatz41 ⟨16, ⟨1, L, R⟩⟩ = some ⟨17, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr17_0 (L R) :
step weakCollatz41 ⟨17, ⟨0, L, R⟩⟩ = some ⟨13, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr17_1 (L R) : step weakCollatz41 ⟨17, ⟨1, L, R⟩⟩ = some ⟨17, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr18_0 (L R) :
step weakCollatz41 ⟨18, ⟨0, L, R⟩⟩ = some ⟨22, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr18_1 (L R) :
step weakCollatz41 ⟨18, ⟨1, L, R⟩⟩ = some ⟨12, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr19_0 (L R) :
step weakCollatz41 ⟨19, ⟨0, L, R⟩⟩ = some ⟨20, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr19_1 (L R) :
step weakCollatz41 ⟨19, ⟨1, L, R⟩⟩ = some ⟨19, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr20_0 (L R) : step weakCollatz41 ⟨20, ⟨0, L, R⟩⟩ = some ⟨21, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr20_1 (L R) : step weakCollatz41 ⟨20, ⟨1, L, R⟩⟩ = some ⟨22, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr21_0 (L R) : step weakCollatz41 ⟨21, ⟨0, L, R⟩⟩ = some ⟨18, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr21_1 (L R) : step weakCollatz41 ⟨21, ⟨1, L, R⟩⟩ = some ⟨21, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr22_0 (L R) : step weakCollatz41 ⟨22, ⟨0, L, R⟩⟩ = some ⟨24, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr22_1 (L R) : step weakCollatz41 ⟨22, ⟨1, L, R⟩⟩ = some ⟨23, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr23_0 (L R) : step weakCollatz41 ⟨23, ⟨0, L, R⟩⟩ = some ⟨25, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr23_1 (L R) : step weakCollatz41 ⟨23, ⟨1, L, R⟩⟩ = some ⟨24, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr24_0 (L R) : step weakCollatz41 ⟨24, ⟨0, L, R⟩⟩ = some ⟨27, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr24_1 (L R) : step weakCollatz41 ⟨24, ⟨1, L, R⟩⟩ = some ⟨24, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr25_0 (L R : ListBlank (Fin 2)) : step weakCollatz41 ⟨25, ⟨0, L, R⟩⟩ = none := rflprivate theorem tr25_1 (L R) :
step weakCollatz41 ⟨25, ⟨1, L, R⟩⟩ = some ⟨26, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr26_0 (L R) :
step weakCollatz41 ⟨26, ⟨0, L, R⟩⟩ = some ⟨30, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr26_1 (L R) : step weakCollatz41 ⟨26, ⟨1, L, R⟩⟩ = some ⟨32, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr27_0 (L R) :
step weakCollatz41 ⟨27, ⟨0, L, R⟩⟩ = some ⟨26, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr27_1 (L R) :
step weakCollatz41 ⟨27, ⟨1, L, R⟩⟩ = some ⟨28, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr28_0 (L R) :
step weakCollatz41 ⟨28, ⟨0, L, R⟩⟩ = some ⟨29, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr28_1 (L R) : step weakCollatz41 ⟨28, ⟨1, L, R⟩⟩ = some ⟨0, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr29_0 (L R) : step weakCollatz41 ⟨29, ⟨0, L, R⟩⟩ = some ⟨20, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr29_1 (L R) :
step weakCollatz41 ⟨29, ⟨1, L, R⟩⟩ = some ⟨29, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr30_0 (L R) :
step weakCollatz41 ⟨30, ⟨0, L, R⟩⟩ = some ⟨31, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr30_1 (L R) :
step weakCollatz41 ⟨30, ⟨1, L, R⟩⟩ = some ⟨30, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr31_0 (L R) : step weakCollatz41 ⟨31, ⟨0, L, R⟩⟩ = some ⟨26, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr31_1 (L R) :
step weakCollatz41 ⟨31, ⟨1, L, R⟩⟩ = some ⟨28, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr32_0 (L R) : step weakCollatz41 ⟨32, ⟨0, L, R⟩⟩ = some ⟨33, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr32_1 (L R) : step weakCollatz41 ⟨32, ⟨1, L, R⟩⟩ = some ⟨32, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr33_0 (L R) : step weakCollatz41 ⟨33, ⟨0, L, R⟩⟩ = some ⟨34, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr33_1 (L R) : step weakCollatz41 ⟨33, ⟨1, L, R⟩⟩ = some ⟨33, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr34_0 (L R) :
step weakCollatz41 ⟨34, ⟨0, L, R⟩⟩ = some ⟨3, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr34_1 (L R) : step weakCollatz41 ⟨34, ⟨1, L, R⟩⟩ = some ⟨34, mkL L (R.cons 1)⟩ :=
stepL rfl L Rprivate theorem tr35_0 (L R) :
step weakCollatz41 ⟨35, ⟨0, L, R⟩⟩ = some ⟨38, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr35_1 (L R) :
step weakCollatz41 ⟨35, ⟨1, L, R⟩⟩ = some ⟨36, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr36_0 (L R) :
step weakCollatz41 ⟨36, ⟨0, L, R⟩⟩ = some ⟨37, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr36_1 (L R) :
step weakCollatz41 ⟨36, ⟨1, L, R⟩⟩ = some ⟨36, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr37_0 (L R) :
step weakCollatz41 ⟨37, ⟨0, L, R⟩⟩ = some ⟨12, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr37_1 (L R) :
step weakCollatz41 ⟨37, ⟨1, L, R⟩⟩ = some ⟨37, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr38_0 (L R) :
step weakCollatz41 ⟨38, ⟨0, L, R⟩⟩ = some ⟨39, Tape.mk' (L.cons 0) R⟩ := stepR rfl L Rprivate theorem tr38_1 (L R) :
step weakCollatz41 ⟨38, ⟨1, L, R⟩⟩ = some ⟨38, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr39_0 (L R) : step weakCollatz41 ⟨39, ⟨0, L, R⟩⟩ = some ⟨40, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr39_1 (L R) :
step weakCollatz41 ⟨39, ⟨1, L, R⟩⟩ = some ⟨39, Tape.mk' (L.cons 1) R⟩ := stepR rfl L Rprivate theorem tr40_0 (L R) : step weakCollatz41 ⟨40, ⟨0, L, R⟩⟩ = some ⟨2, mkL L (R.cons 0)⟩ :=
stepL rfl L Rprivate theorem tr40_1 (L R) : step weakCollatz41 ⟨40, ⟨1, L, R⟩⟩ = some ⟨40, mkL L (R.cons 0)⟩ :=
stepL rfl L RSweep & Reachability Combinators
private def reachPos (c₁ c₂ : Cfg 41 2) : Prop :=
∃ s : ℕ, 1 ≤ s ∧ nSteps weakCollatz41 s c₁ = some c₂private theorem reachPos_step {c₁ c₂ : Cfg 41 2}
(h : step weakCollatz41 c₁ = some c₂) : reachPos c₁ c₂ :=
⟨1, le_rfl, step_one h⟩private theorem reachPos_trans {c₁ c₂ c₃ : Cfg 41 2}
(h₁ : reachPos c₁ c₂) (h₂ : reachPos c₂ c₃) : reachPos c₁ c₃ := c₁:Cfg 41 2c₂:Cfg 41 2c₃:Cfg 41 2h₁:reachPos c₁ c₂h₂:reachPos c₂ c₃⊢ reachPos c₁ c₃
c₁:Cfg 41 2c₂:Cfg 41 2c₃:Cfg 41 2h₂:reachPos c₂ c₃s₁:ℕhs₁:1 ≤ s₁heq₁:nSteps weakCollatz41 s₁ c₁ = some c₂⊢ reachPos c₁ c₃
c₁:Cfg 41 2c₂:Cfg 41 2c₃:Cfg 41 2s₁:ℕhs₁:1 ≤ s₁heq₁:nSteps weakCollatz41 s₁ c₁ = some c₂s₂:ℕhs₂:1 ≤ s₂heq₂:nSteps weakCollatz41 s₂ c₂ = some c₃⊢ reachPos c₁ c₃
exact ⟨s₁ + s₂, c₁:Cfg 41 2c₂:Cfg 41 2c₃:Cfg 41 2s₁:ℕhs₁:1 ≤ s₁heq₁:nSteps weakCollatz41 s₁ c₁ = some c₂s₂:ℕhs₂:1 ≤ s₂heq₂:nSteps weakCollatz41 s₂ c₂ = some c₃⊢ 1 ≤ s₁ + s₂ All goals completed! 🐙, nSteps_bind_eq heq₁ heq₂⟩private theorem step_then_reachPos {c₁ c₂ c₃ : Cfg 41 2}
(h₁ : step weakCollatz41 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 41 2}
(h₁ : nSteps weakCollatz41 k c₁ = some c₂) (h₂ : reachPos c₂ c₃) : reachPos c₁ c₃ := k:ℕc₁:Cfg 41 2c₂:Cfg 41 2c₃:Cfg 41 2h₁:nSteps weakCollatz41 k c₁ = some c₂h₂:reachPos c₂ c₃⊢ reachPos c₁ c₃
k:ℕc₁:Cfg 41 2c₂:Cfg 41 2c₃:Cfg 41 2h₁:nSteps weakCollatz41 k c₁ = some c₂s:ℕhs:1 ≤ sheq:nSteps weakCollatz41 s c₂ = some c₃⊢ reachPos c₁ c₃
exact ⟨k + s, k:ℕc₁:Cfg 41 2c₂:Cfg 41 2c₃:Cfg 41 2h₁:nSteps weakCollatz41 k c₁ = some c₂s:ℕhs:1 ≤ sheq:nSteps weakCollatz41 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 41 2}
(h₁ : reachPos c₁ c₂) (h₂ : nSteps weakCollatz41 k c₂ = some c₃) : reachPos c₁ c₃ := k:ℕc₁:Cfg 41 2c₂:Cfg 41 2c₃:Cfg 41 2h₁:reachPos c₁ c₂h₂:nSteps weakCollatz41 k c₂ = some c₃⊢ reachPos c₁ c₃
k:ℕc₁:Cfg 41 2c₂:Cfg 41 2c₃:Cfg 41 2h₂:nSteps weakCollatz41 k c₂ = some c₃s:ℕhs:1 ≤ sheq:nSteps weakCollatz41 s c₁ = some c₂⊢ reachPos c₁ c₃
exact ⟨s + k, k:ℕc₁:Cfg 41 2c₂:Cfg 41 2c₃:Cfg 41 2h₂:nSteps weakCollatz41 k c₂ = some c₃s:ℕhs:1 ≤ sheq:nSteps weakCollatz41 s c₁ = some c₂⊢ 1 ≤ s + k All goals completed! 🐙, nSteps_bind_eq heq h₂⟩private theorem sweep1R {q : Fin 41}
(h : ∀ L R, step weakCollatz41 ⟨q, ⟨1, L, R⟩⟩ = some ⟨q, Tape.mk' (L.cons 1) R⟩)
(k : ℕ) (L R : ListBlank (Fin 2)) :
nSteps weakCollatz41 k ⟨q, Tape.mk' L (ones k R)⟩ = some ⟨q, Tape.mk' (ones k L) R⟩ := q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { 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 weakCollatz41 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 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { 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 weakCollatz41 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 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { 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 weakCollatz41 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 weakCollatz41 (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 41}
(h : ∀ L R, step weakCollatz41 ⟨q, ⟨1, L, R⟩⟩ = some ⟨q, mkL L (R.cons 1)⟩)
(k : ℕ) (L R : ListBlank (Fin 2)) :
nSteps weakCollatz41 k ⟨q, mkL (ones k L) R⟩ = some ⟨q, mkL L (ones k R)⟩ := by q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { 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 weakCollatz41 k { state := q, tape := mkL (ones k L) R } = some { state := q, tape := mkL L (ones k R) }
induction k generalizing R with
| zero => zero q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { 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 weakCollatz41 0 { state := q, tape := mkL (ones 0 L) R } = some { state := q, tape := mkL L (ones 0 R) } rfl All goals completed! 🐙
| succ k ih => succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { 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 weakCollatz41 k { state := q, tape := mkL (ones k L) R } = some { state := q, tape := mkL L (ones k R) }R:ListBlank (Fin 2)⊢ nSteps weakCollatz41 (k + 1) { state := q, tape := mkL (ones (k + 1) L) R } =
some { state := q, tape := mkL L (ones (k + 1) R) }
rw [nSteps_succ, succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { 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 weakCollatz41 k { state := q, tape := mkL (ones k L) R } = some { state := q, tape := mkL L (ones k R) }R:ListBlank (Fin 2)⊢ (step weakCollatz41 { state := q, tape := mkL (ones (k + 1) L) R }).bind (nSteps weakCollatz41 k) =
some { state := q, tape := mkL L (ones (k + 1) R) } ones_succ, succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { 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 weakCollatz41 k { state := q, tape := mkL (ones k L) R } = some { state := q, tape := mkL L (ones k R) }R:ListBlank (Fin 2)⊢ (step weakCollatz41 { state := q, tape := mkL (ListBlank.cons 1 (ones k L)) R }).bind (nSteps weakCollatz41 k) =
some { state := q, tape := mkL L (ones (k + 1) R) } ErdosTernary15.Tape.mkL_cons, succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { 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 weakCollatz41 k { state := q, tape := mkL (ones k L) R } = some { state := q, tape := mkL L (ones k R) }R:ListBlank (Fin 2)⊢ (step weakCollatz41 { state := q, tape := { head := 1, left := ones k L, right := R } }).bind (nSteps weakCollatz41 k) =
some { state := q, tape := mkL L (ones (k + 1) R) } h, succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { 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 weakCollatz41 k { state := q, tape := mkL (ones k L) R } = some { state := q, tape := mkL L (ones k R) }R:ListBlank (Fin 2)⊢ (some { state := q, tape := mkL (ones k L) (ListBlank.cons 1 R) }).bind (nSteps weakCollatz41 k) =
some { state := q, tape := mkL L (ones (k + 1) R) } Option.bind_some, succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { 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 weakCollatz41 k { state := q, tape := mkL (ones k L) R } = some { state := q, tape := mkL L (ones k R) }R:ListBlank (Fin 2)⊢ nSteps weakCollatz41 k { state := q, tape := mkL (ones k L) (ListBlank.cons 1 R) } =
some { state := q, tape := mkL L (ones (k + 1) R) } ih, succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { 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 weakCollatz41 k { state := q, tape := mkL (ones k L) R } = some { state := q, tape := mkL L (ones k R) }R:ListBlank (Fin 2)⊢ some { state := q, tape := mkL L (ones k (ListBlank.cons 1 R)) } = some { state := q, tape := mkL L (ones (k + 1) R) } ones_succ' succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { 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 weakCollatz41 k { state := q, tape := mkL (ones k L) R } = some { state := q, tape := mkL L (ones k R) }R:ListBlank (Fin 2)⊢ some { state := q, tape := mkL L (ones k (ListBlank.cons 1 R)) } =
some { state := q, tape := mkL L (ones k (ListBlank.cons 1 R)) }] All goals completed! 🐙private theorem erase1L {q : Fin 41}
(h : ∀ L R, step weakCollatz41 ⟨q, ⟨1, L, R⟩⟩ = some ⟨q, mkL L (R.cons 0)⟩)
(k : ℕ) (L : ListBlank (Fin 2)) :
nSteps weakCollatz41 k ⟨q, mkL (ones k L) B0⟩ = some ⟨q, mkL L B0⟩ := by q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { state := q, tape := { head := 1, left := L, right := R } } =
some { state := q, tape := mkL L (ListBlank.cons 0 R) }k:ℕL:ListBlank (Fin 2)⊢ nSteps weakCollatz41 k { state := q, tape := mkL (ones k L) B0 } = some { state := q, tape := mkL L B0 }
induction k with
| zero => zero q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { state := q, tape := { head := 1, left := L, right := R } } =
some { state := q, tape := mkL L (ListBlank.cons 0 R) }L:ListBlank (Fin 2)⊢ nSteps weakCollatz41 0 { state := q, tape := mkL (ones 0 L) B0 } = some { state := q, tape := mkL L B0 } rfl All goals completed! 🐙
| succ k ih => succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { state := q, tape := { head := 1, left := L, right := R } } =
some { state := q, tape := mkL L (ListBlank.cons 0 R) }L:ListBlank (Fin 2)k:ℕih:nSteps weakCollatz41 k { state := q, tape := mkL (ones k L) B0 } = some { state := q, tape := mkL L B0 }⊢ nSteps weakCollatz41 (k + 1) { state := q, tape := mkL (ones (k + 1) L) B0 } = some { state := q, tape := mkL L B0 }
rw [nSteps_succ, succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { state := q, tape := { head := 1, left := L, right := R } } =
some { state := q, tape := mkL L (ListBlank.cons 0 R) }L:ListBlank (Fin 2)k:ℕih:nSteps weakCollatz41 k { state := q, tape := mkL (ones k L) B0 } = some { state := q, tape := mkL L B0 }⊢ (step weakCollatz41 { state := q, tape := mkL (ones (k + 1) L) B0 }).bind (nSteps weakCollatz41 k) =
some { state := q, tape := mkL L B0 } ones_succ, succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { state := q, tape := { head := 1, left := L, right := R } } =
some { state := q, tape := mkL L (ListBlank.cons 0 R) }L:ListBlank (Fin 2)k:ℕih:nSteps weakCollatz41 k { state := q, tape := mkL (ones k L) B0 } = some { state := q, tape := mkL L B0 }⊢ (step weakCollatz41 { state := q, tape := mkL (ListBlank.cons 1 (ones k L)) B0 }).bind (nSteps weakCollatz41 k) =
some { state := q, tape := mkL L B0 } ErdosTernary15.Tape.mkL_cons, succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { state := q, tape := { head := 1, left := L, right := R } } =
some { state := q, tape := mkL L (ListBlank.cons 0 R) }L:ListBlank (Fin 2)k:ℕih:nSteps weakCollatz41 k { state := q, tape := mkL (ones k L) B0 } = some { state := q, tape := mkL L B0 }⊢ (step weakCollatz41 { state := q, tape := { head := 1, left := ones k L, right := B0 } }).bind
(nSteps weakCollatz41 k) =
some { state := q, tape := mkL L B0 } h, succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { state := q, tape := { head := 1, left := L, right := R } } =
some { state := q, tape := mkL L (ListBlank.cons 0 R) }L:ListBlank (Fin 2)k:ℕih:nSteps weakCollatz41 k { state := q, tape := mkL (ones k L) B0 } = some { state := q, tape := mkL L B0 }⊢ (some { state := q, tape := mkL (ones k L) (ListBlank.cons 0 B0) }).bind (nSteps weakCollatz41 k) =
some { state := q, tape := mkL L B0 } B0_cons_zero, succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { state := q, tape := { head := 1, left := L, right := R } } =
some { state := q, tape := mkL L (ListBlank.cons 0 R) }L:ListBlank (Fin 2)k:ℕih:nSteps weakCollatz41 k { state := q, tape := mkL (ones k L) B0 } = some { state := q, tape := mkL L B0 }⊢ (some { state := q, tape := mkL (ones k L) B0 }).bind (nSteps weakCollatz41 k) = some { state := q, tape := mkL L B0 } Option.bind_some, succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { state := q, tape := { head := 1, left := L, right := R } } =
some { state := q, tape := mkL L (ListBlank.cons 0 R) }L:ListBlank (Fin 2)k:ℕih:nSteps weakCollatz41 k { state := q, tape := mkL (ones k L) B0 } = some { state := q, tape := mkL L B0 }⊢ nSteps weakCollatz41 k { state := q, tape := mkL (ones k L) B0 } = some { state := q, tape := mkL L B0 } ih succ q:Fin 41h:∀ (L R : ListBlank (Fin 2)),
step weakCollatz41 { state := q, tape := { head := 1, left := L, right := R } } =
some { state := q, tape := mkL L (ListBlank.cons 0 R) }L:ListBlank (Fin 2)k:ℕih:nSteps weakCollatz41 k { state := q, tape := mkL (ones k L) B0 } = some { state := q, tape := mkL L B0 }⊢ some { state := q, tape := mkL L B0 } = some { state := q, tape := mkL L B0 }] All goals completed! 🐙Canonical Stage Checkpoint & 1-Pass Triple-Build
private def baseCX (c x : ℕ) : ListBlank (Fin 2) :=
ones x ((ones c B0).cons 0)
Canonical stage checkpoint: 0^∞ 1^c 0 1^x 0 [1] 1^(y - 1) 0^∞ in state 12.
private def stageCfg (c x y : ℕ) : Cfg 41 2 :=
⟨12, Tape.mk' ((baseCX c x).cons 0) (ones y B0)⟩private def tripleCfg (p rem : ℕ) : Cfg 41 2 :=
⟨2, mkL (ones rem ((ones p B0).cons 0)) ((ones p ((ones p B0).cons 0)).cons 0)⟩private theorem boot_to_triple : reachPos init (tripleCfg 0 3) := by ⊢ reachPos init (tripleCfg 0 3)
refine ⟨6, by ⊢ 1 ≤ 6 decide All goals completed! 🐙, ?_⟩
change nSteps weakCollatz41 6 ⟨0, ⟨0, B0, B0⟩⟩ = some (tripleCfg 0 3) ⊢ nSteps weakCollatz41 6 { state := 0, tape := { head := 0, left := B0, right := B0 } } = some (tripleCfg 0 3)
simp only [tripleCfg, ones_succ, ones_zero, nSteps_succ, nSteps_zero, Option.bind_some,
tr0_0, tr1_0, tr35_0, tr38_0, tr39_0, tr40_0,
ErdosTernary15.Tape.mkL_cons, ErdosTernary15.Tape.mk'_B0, B0_cons_zero] All goals completed! 🐙private theorem triple_step (p rem : ℕ) :
reachPos (tripleCfg p (rem + 1)) (tripleCfg (p + 1) rem) := by p:ℕrem:ℕ⊢ reachPos (tripleCfg p (rem + 1)) (tripleCfg (p + 1) rem)
unfold tripleCfg p:ℕrem:ℕ⊢ reachPos
{ state := 2,
tape :=
mkL (ones (rem + 1) (ListBlank.cons 0 (ones p B0))) (ListBlank.cons 0 (ones p (ListBlank.cons 0 (ones p B0)))) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
let Lp := (ones p B0).cons 0 p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)⊢ reachPos
{ state := 2,
tape :=
mkL (ones (rem + 1) (ListBlank.cons 0 (ones p B0))) (ListBlank.cons 0 (ones p (ListBlank.cons 0 (ones p B0)))) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
let Rp := (ones p Lp).cons 0 p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 2,
tape :=
mkL (ones (rem + 1) (ListBlank.cons 0 (ones p B0))) (ListBlank.cons 0 (ones p (ListBlank.cons 0 (ones p B0)))) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
change reachPos ⟨2, mkL (ones (rem + 1) Lp) Rp⟩ _ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos { state := 2, tape := mkL (ones (rem + 1) Lp) Rp }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
rw [ones_succ rem Lp, p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos { state := 2, tape := mkL (ListBlank.cons 1 (ones rem Lp)) Rp }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) } ErdosTernary15.Tape.mkL_cons p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos { state := 2, tape := { head := 1, left := ones rem Lp, right := Rp } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }] p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos { state := 2, tape := { head := 1, left := ones rem Lp, right := Rp } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine step_then_reachPos (tr2_1 _ _) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos { state := 3, tape := Tape.mk' (ListBlank.cons 0 (ones rem Lp)) Rp }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
dsimp only [Rp] p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos { state := 3, tape := Tape.mk' (ListBlank.cons 0 (ones rem Lp)) (ListBlank.cons 0 (ones p Lp)) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
rw [ErdosTernary15.Tape.mk'_cons p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos { state := 3, tape := { head := 0, left := ListBlank.cons 0 (ones rem Lp), right := ones p Lp } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }] p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos { state := 3, tape := { head := 0, left := ListBlank.cons 0 (ones rem Lp), right := ones p Lp } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine step_then_reachPos (tr3_0 _ _) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos { state := 4, tape := Tape.mk' (ListBlank.cons 1 (ListBlank.cons 0 (ones rem Lp))) (ones p Lp) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
change reachPos ⟨4, Tape.mk' (ones 1 ((ones rem Lp).cons 0)) (ones p Lp)⟩ _ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos { state := 4, tape := Tape.mk' (ones 1 (ListBlank.cons 0 (ones rem Lp))) (ones p Lp) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine nSteps_then_reachPos (sweep1R tr4_1 p _ Lp) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos { state := 4, tape := Tape.mk' (ones p (ones 1 (ListBlank.cons 0 (ones rem Lp)))) Lp }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
rw [← ones_add p 1 ((ones rem Lp).cons 0) p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos { state := 4, tape := Tape.mk' (ones (p + 1) (ListBlank.cons 0 (ones rem Lp))) Lp }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }] p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos { state := 4, tape := Tape.mk' (ones (p + 1) (ListBlank.cons 0 (ones rem Lp))) Lp }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
dsimp only [Lp] p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 4,
tape :=
Tape.mk' (ones (p + 1) (ListBlank.cons 0 (ones rem (ListBlank.cons 0 (ones p B0)))))
(ListBlank.cons 0 (ones p B0)) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
rw [ErdosTernary15.Tape.mk'_cons p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 4,
tape :=
{ head := 0, left := ones (p + 1) (ListBlank.cons 0 (ones rem (ListBlank.cons 0 (ones p B0)))),
right := ones p B0 } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }] p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 4,
tape :=
{ head := 0, left := ones (p + 1) (ListBlank.cons 0 (ones rem (ListBlank.cons 0 (ones p B0)))),
right := ones p B0 } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine step_then_reachPos (tr4_0 _ _) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 5,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones rem (ListBlank.cons 0 (ones p B0))))))
(ones p B0) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine nSteps_then_reachPos (sweep1R tr5_1 p _ B0) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 5,
tape :=
Tape.mk' (ones p (ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones rem (ListBlank.cons 0 (ones p B0)))))))
B0 }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
rw [ErdosTernary15.Tape.mk'_B0 p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 5,
tape :=
{ head := 0,
left := ones p (ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones rem (ListBlank.cons 0 (ones p B0)))))),
right := B0 } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }] p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 5,
tape :=
{ head := 0,
left := ones p (ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones rem (ListBlank.cons 0 (ones p B0)))))),
right := B0 } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine step_then_reachPos (tr5_0 _ _) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 6,
tape :=
mkL (ones p (ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones rem (ListBlank.cons 0 (ones p B0)))))))
(ListBlank.cons 1 B0) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
change reachPos ⟨6, mkL (ones p _) (ones 1 B0)⟩ _ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 6,
tape :=
mkL (ones p (ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones rem (ListBlank.cons 0 (ones p B0)))))))
(ones 1 B0) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine nSteps_then_reachPos (sweep1L tr6_1 p _ _) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 6,
tape :=
mkL (ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones rem (ListBlank.cons 0 (ones p B0))))))
(ones p (ones 1 B0)) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
rw [← ones_add p 1 B0, p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 6,
tape :=
mkL (ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones rem (ListBlank.cons 0 (ones p B0))))))
(ones (p + 1) B0) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) } ErdosTernary15.Tape.mkL_cons p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 6,
tape :=
{ head := 0, left := ones (p + 1) (ListBlank.cons 0 (ones rem (ListBlank.cons 0 (ones p B0)))),
right := ones (p + 1) B0 } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }] p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 6,
tape :=
{ head := 0, left := ones (p + 1) (ListBlank.cons 0 (ones rem (ListBlank.cons 0 (ones p B0)))),
right := ones (p + 1) B0 } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine step_then_reachPos (tr6_0 _ _) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 7,
tape :=
mkL (ones (p + 1) (ListBlank.cons 0 (ones rem (ListBlank.cons 0 (ones p B0)))))
(ListBlank.cons 0 (ones (p + 1) B0)) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine nSteps_then_reachPos (sweep1L tr7_1 (p + 1) _ _) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 7,
tape :=
mkL (ListBlank.cons 0 (ones rem (ListBlank.cons 0 (ones p B0))))
(ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0))) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
rw [ErdosTernary15.Tape.mkL_cons p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 7,
tape :=
{ head := 0, left := ones rem (ListBlank.cons 0 (ones p B0)),
right := ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)) } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }] p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 7,
tape :=
{ head := 0, left := ones rem (ListBlank.cons 0 (ones p B0)),
right := ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)) } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine step_then_reachPos (tr7_0 _ _) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)⊢ reachPos
{ state := 8,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones p B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
let Rn := (ones (p + 1) ((ones (p + 1) B0).cons 0)).cons 0 p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos
{ state := 8,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones p B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
change reachPos ⟨8, mkL (ones rem ((ones p B0).cons 0)) Rn⟩ _ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 8, tape := mkL (ones rem (ListBlank.cons 0 (ones p B0))) Rn }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine nSteps_then_reachPos (sweep1L tr8_1 rem _ Rn) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 8, tape := mkL (ListBlank.cons 0 (ones p B0)) (ones rem Rn) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
rw [ErdosTernary15.Tape.mkL_cons p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 8, tape := { head := 0, left := ones p B0, right := ones rem Rn } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }] p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 8, tape := { head := 0, left := ones p B0, right := ones rem Rn } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine step_then_reachPos (tr8_0 _ _) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 9, tape := mkL (ones p B0) (ListBlank.cons 0 (ones rem Rn)) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine nSteps_then_reachPos (sweep1L tr9_1 p B0 _) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 9, tape := mkL B0 (ones p (ListBlank.cons 0 (ones rem Rn))) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
rw [mkL_B0 p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 9, tape := { head := 0, left := B0, right := ones p (ListBlank.cons 0 (ones rem Rn)) } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }] p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 9, tape := { head := 0, left := B0, right := ones p (ListBlank.cons 0 (ones rem Rn)) } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine step_then_reachPos (tr9_0 _ _) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 10, tape := Tape.mk' (ListBlank.cons 1 B0) (ones p (ListBlank.cons 0 (ones rem Rn))) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
change reachPos ⟨10, Tape.mk' (ones 1 B0) (ones p ((ones rem Rn).cons 0))⟩ _ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 10, tape := Tape.mk' (ones 1 B0) (ones p (ListBlank.cons 0 (ones rem Rn))) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine nSteps_then_reachPos (sweep1R tr10_1 p _ _) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 10, tape := Tape.mk' (ones p (ones 1 B0)) (ListBlank.cons 0 (ones rem Rn)) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
rw [← ones_add p 1 B0, p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 10, tape := Tape.mk' (ones (p + 1) B0) (ListBlank.cons 0 (ones rem Rn)) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) } ErdosTernary15.Tape.mk'_cons p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 10, tape := { head := 0, left := ones (p + 1) B0, right := ones rem Rn } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }] p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 10, tape := { head := 0, left := ones (p + 1) B0, right := ones rem Rn } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine step_then_reachPos (tr10_0 _ _) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 11, tape := Tape.mk' (ListBlank.cons 0 (ones (p + 1) B0)) (ones rem Rn) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
refine nSteps_then_reachPos (sweep1R tr11_1 rem _ Rn) ?_ p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos { state := 11, tape := Tape.mk' (ones rem (ListBlank.cons 0 (ones (p + 1) B0))) Rn }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
dsimp only [Rn] p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos
{ state := 11,
tape :=
Tape.mk' (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
rw [ErdosTernary15.Tape.mk'_cons p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos
{ state := 11,
tape :=
{ head := 0, left := ones rem (ListBlank.cons 0 (ones (p + 1) B0)),
right := ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)) } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }] p:ℕrem:ℕLp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p B0)Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones p Lp)Rn:ListBlank (Fin 2) := ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))⊢ reachPos
{ state := 11,
tape :=
{ head := 0, left := ones rem (ListBlank.cons 0 (ones (p + 1) B0)),
right := ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)) } }
{ state := 2,
tape :=
mkL (ones rem (ListBlank.cons 0 (ones (p + 1) B0)))
(ListBlank.cons 0 (ones (p + 1) (ListBlank.cons 0 (ones (p + 1) B0)))) }
exact reachPos_step (tr11_0 _ _) All goals completed! 🐙private theorem triple_many (p rem : ℕ) :
rem = 0 ∨ reachPos (tripleCfg p rem) (tripleCfg (p + rem) 0) := by p:ℕrem:ℕ⊢ rem = 0 ∨ reachPos (tripleCfg p rem) (tripleCfg (p + rem) 0)
induction rem generalizing p with
| zero => zero p:ℕ⊢ 0 = 0 ∨ reachPos (tripleCfg p 0) (tripleCfg (p + 0) 0) exact Or.inl rfl All goals completed! 🐙
| succ rem ih => succ rem:ℕih:∀ (p : ℕ), rem = 0 ∨ reachPos (tripleCfg p rem) (tripleCfg (p + rem) 0)p:ℕ⊢ rem + 1 = 0 ∨ reachPos (tripleCfg p (rem + 1)) (tripleCfg (p + (rem + 1)) 0)
refine Or.inr ?_ succ rem:ℕih:∀ (p : ℕ), rem = 0 ∨ reachPos (tripleCfg p rem) (tripleCfg (p + rem) 0)p:ℕ⊢ reachPos (tripleCfg p (rem + 1)) (tripleCfg (p + (rem + 1)) 0)
rcases ih (p + 1) with rfl | hrest succ.inl p:ℕih:∀ (p : ℕ), 0 = 0 ∨ reachPos (tripleCfg p 0) (tripleCfg (p + 0) 0)⊢ reachPos (tripleCfg p (0 + 1)) (tripleCfg (p + (0 + 1)) 0)succ.inr rem:ℕih:∀ (p : ℕ), rem = 0 ∨ reachPos (tripleCfg p rem) (tripleCfg (p + rem) 0)p:ℕhrest:reachPos (tripleCfg (p + 1) rem) (tripleCfg (p + 1 + rem) 0)⊢ reachPos (tripleCfg p (rem + 1)) (tripleCfg (p + (rem + 1)) 0)
· succ.inl p:ℕih:∀ (p : ℕ), 0 = 0 ∨ reachPos (tripleCfg p 0) (tripleCfg (p + 0) 0)⊢ reachPos (tripleCfg p (0 + 1)) (tripleCfg (p + (0 + 1)) 0) rw [Nat.add_zero succ.inl p:ℕih:∀ (p : ℕ), 0 = 0 ∨ reachPos (tripleCfg p 0) (tripleCfg (p + 0) 0)⊢ reachPos (tripleCfg p 1) (tripleCfg (p + 1) 0)] succ.inl p:ℕih:∀ (p : ℕ), 0 = 0 ∨ reachPos (tripleCfg p 0) (tripleCfg (p + 0) 0)⊢ reachPos (tripleCfg p 1) (tripleCfg (p + 1) 0)
exact triple_step p 0 All goals completed! 🐙
· succ.inr rem:ℕih:∀ (p : ℕ), rem = 0 ∨ reachPos (tripleCfg p rem) (tripleCfg (p + rem) 0)p:ℕhrest:reachPos (tripleCfg (p + 1) rem) (tripleCfg (p + 1 + rem) 0)⊢ reachPos (tripleCfg p (rem + 1)) (tripleCfg (p + (rem + 1)) 0) rw [show p + (rem + 1) = (p + 1) + rem by p:ℕrem:ℕ⊢ rem = 0 ∨ reachPos (tripleCfg p rem) (tripleCfg (p + rem) 0) omega All goals completed! 🐙] succ.inr rem:ℕih:∀ (p : ℕ), rem = 0 ∨ reachPos (tripleCfg p rem) (tripleCfg (p + rem) 0)p:ℕhrest:reachPos (tripleCfg (p + 1) rem) (tripleCfg (p + 1 + rem) 0)⊢ reachPos (tripleCfg p (rem + 1)) (tripleCfg (p + 1 + rem) 0)
exact reachPos_trans (triple_step p rem) hrest All goals completed! 🐙private theorem triple_finish (a : ℕ) :
reachPos (tripleCfg (a + 2) 0) (stageCfg (a + 2) (a + 2) (a + 2)) := by a:ℕ⊢ reachPos (tripleCfg (a + 2) 0) (stageCfg (a + 2) (a + 2) (a + 2))
let A := a + 2 a:ℕA:ℕ := a + 2⊢ reachPos (tripleCfg (a + 2) 0) (stageCfg (a + 2) (a + 2) (a + 2))
unfold tripleCfg stageCfg baseCX a:ℕA:ℕ := a + 2⊢ reachPos
{ state := 2,
tape :=
mkL (ones 0 (ListBlank.cons 0 (ones (a + 2) B0)))
(ListBlank.cons 0 (ones (a + 2) (ListBlank.cons 0 (ones (a + 2) B0)))) }
{ state := 12,
tape := Tape.mk' (ListBlank.cons 0 (ones (a + 2) (ListBlank.cons 0 (ones (a + 2) B0)))) (ones (a + 2) B0) }
change reachPos ⟨2, mkL (ones 0 ((ones A B0).cons 0)) ((ones A ((ones A B0).cons 0)).cons 0)⟩
⟨12, Tape.mk' ((ones A ((ones A B0).cons 0)).cons 0) (ones A B0)⟩ a:ℕA:ℕ := a + 2⊢ reachPos
{ state := 2,
tape := mkL (ones 0 (ListBlank.cons 0 (ones A B0))) (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
rw [ones_zero, a:ℕA:ℕ := a + 2⊢ reachPos
{ state := 2, tape := mkL (ListBlank.cons 0 (ones A B0)) (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) } ErdosTernary15.Tape.mkL_cons a:ℕA:ℕ := a + 2⊢ reachPos
{ state := 2,
tape := { head := 0, left := ones A B0, right := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0))) } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }] a:ℕA:ℕ := a + 2⊢ reachPos
{ state := 2,
tape := { head := 0, left := ones A B0, right := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0))) } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
refine step_then_reachPos (tr2_0 _ _) ?_ a:ℕA:ℕ := a + 2⊢ reachPos
{ state := 34, tape := mkL (ones A B0) (ListBlank.cons 1 (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0))))) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
let Rtail := ((ones A ((ones A B0).cons 0)).cons 0) a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos
{ state := 34, tape := mkL (ones A B0) (ListBlank.cons 1 (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0))))) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
change reachPos ⟨34, mkL (ones A B0) (ones 1 Rtail)⟩ _ a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 34, tape := mkL (ones A B0) (ones 1 Rtail) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
refine nSteps_then_reachPos (sweep1L tr34_1 A B0 _) ?_ a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 34, tape := mkL B0 (ones A (ones 1 Rtail)) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
rw [← ones_add A 1 Rtail, a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 34, tape := mkL B0 (ones (A + 1) Rtail) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) } mkL_B0 a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 34, tape := { head := 0, left := B0, right := ones (A + 1) Rtail } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }] a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 34, tape := { head := 0, left := B0, right := ones (A + 1) Rtail } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
refine step_then_reachPos (tr34_0 _ _) ?_ a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 3, tape := Tape.mk' (ListBlank.cons 0 B0) (ones (A + 1) Rtail) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
rw [B0_cons_zero, a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 3, tape := Tape.mk' B0 (ones (A + 1) Rtail) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) } show A + 1 = A.succ from rfl, a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 3, tape := Tape.mk' B0 (ones A.succ Rtail) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) } ones_succ A Rtail, a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 3, tape := Tape.mk' B0 (ListBlank.cons 1 (ones A Rtail)) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) } ErdosTernary15.Tape.mk'_cons a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 3, tape := { head := 1, left := B0, right := ones A Rtail } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }] a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 3, tape := { head := 1, left := B0, right := ones A Rtail } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
refine step_then_reachPos (tr3_1 _ _) ?_ a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 35, tape := Tape.mk' (ListBlank.cons 0 B0) (ones A Rtail) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
rw [B0_cons_zero, a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 35, tape := Tape.mk' B0 (ones A Rtail) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) } show A = (a + 1) + 1 from rfl, a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 35, tape := Tape.mk' B0 (ones (a + 1 + 1) Rtail) }
{ state := 12,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (a + 1 + 1) (ListBlank.cons 0 (ones (a + 1 + 1) B0)))) (ones (a + 1 + 1) B0) } ones_succ (a + 1) Rtail, a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 35, tape := Tape.mk' B0 (ListBlank.cons 1 (ones (a + 1) Rtail)) }
{ state := 12,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (a + 1 + 1) (ListBlank.cons 0 (ones (a + 1 + 1) B0)))) (ones (a + 1 + 1) B0) }
ErdosTernary15.Tape.mk'_cons a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 35, tape := { head := 1, left := B0, right := ones (a + 1) Rtail } }
{ state := 12,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (a + 1 + 1) (ListBlank.cons 0 (ones (a + 1 + 1) B0)))) (ones (a + 1 + 1) B0) }] a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 35, tape := { head := 1, left := B0, right := ones (a + 1) Rtail } }
{ state := 12,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (a + 1 + 1) (ListBlank.cons 0 (ones (a + 1 + 1) B0)))) (ones (a + 1 + 1) B0) }
refine step_then_reachPos (tr35_1 _ _) ?_ a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 36, tape := Tape.mk' (ListBlank.cons 1 B0) (ones (a + 1) Rtail) }
{ state := 12,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (a + 1 + 1) (ListBlank.cons 0 (ones (a + 1 + 1) B0)))) (ones (a + 1 + 1) B0) }
change reachPos ⟨36, Tape.mk' (ones 1 B0) (ones (a + 1) Rtail)⟩ _ a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 36, tape := Tape.mk' (ones 1 B0) (ones (a + 1) Rtail) }
{ state := 12,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (a + 1 + 1) (ListBlank.cons 0 (ones (a + 1 + 1) B0)))) (ones (a + 1 + 1) B0) }
refine nSteps_then_reachPos (sweep1R tr36_1 (a + 1) _ Rtail) ?_ a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 36, tape := Tape.mk' (ones (a + 1) (ones 1 B0)) Rtail }
{ state := 12,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (a + 1 + 1) (ListBlank.cons 0 (ones (a + 1 + 1) B0)))) (ones (a + 1 + 1) B0) }
rw [← ones_add (a + 1) 1 B0, a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 36, tape := Tape.mk' (ones (a + 1 + 1) B0) Rtail }
{ state := 12,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (a + 1 + 1) (ListBlank.cons 0 (ones (a + 1 + 1) B0)))) (ones (a + 1 + 1) B0) } show (a + 1) + 1 = A from rfl a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 36, tape := Tape.mk' (ones A B0) Rtail }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }] a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 36, tape := Tape.mk' (ones A B0) Rtail }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
dsimp only [Rtail] a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 36, tape := Tape.mk' (ones A B0) (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
rw [ErdosTernary15.Tape.mk'_cons a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 36, tape := { head := 0, left := ones A B0, right := ones A (ListBlank.cons 0 (ones A B0)) } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }] a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 36, tape := { head := 0, left := ones A B0, right := ones A (ListBlank.cons 0 (ones A B0)) } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
refine step_then_reachPos (tr36_0 _ _) ?_ a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 37, tape := Tape.mk' (ListBlank.cons 0 (ones A B0)) (ones A (ListBlank.cons 0 (ones A B0))) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
refine nSteps_then_reachPos (sweep1R tr37_1 A _ ((ones A B0).cons 0)) ?_ a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 37, tape := Tape.mk' (ones A (ListBlank.cons 0 (ones A B0))) (ListBlank.cons 0 (ones A B0)) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
rw [ErdosTernary15.Tape.mk'_cons a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 37, tape := { head := 0, left := ones A (ListBlank.cons 0 (ones A B0)), right := ones A B0 } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }] a:ℕA:ℕ := a + 2Rtail:ListBlank (Fin 2) := ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))⊢ reachPos { state := 37, tape := { head := 0, left := ones A (ListBlank.cons 0 (ones A B0)), right := ones A B0 } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones A (ListBlank.cons 0 (ones A B0)))) (ones A B0) }
exact reachPos_step (tr37_0 _ _) All goals completed! 🐙private theorem triple_from_zero (a : ℕ) :
reachPos (tripleCfg 0 (a + 2)) (stageCfg (a + 2) (a + 2) (a + 2)) := by a:ℕ⊢ reachPos (tripleCfg 0 (a + 2)) (stageCfg (a + 2) (a + 2) (a + 2))
rcases triple_many 0 (a + 2) with h0 | hmany inl a:ℕh0:a + 2 = 0⊢ reachPos (tripleCfg 0 (a + 2)) (stageCfg (a + 2) (a + 2) (a + 2))inr a:ℕhmany:reachPos (tripleCfg 0 (a + 2)) (tripleCfg (0 + (a + 2)) 0)⊢ reachPos (tripleCfg 0 (a + 2)) (stageCfg (a + 2) (a + 2) (a + 2))
· inl a:ℕh0:a + 2 = 0⊢ reachPos (tripleCfg 0 (a + 2)) (stageCfg (a + 2) (a + 2) (a + 2)) exfalso inl a:ℕh0:a + 2 = 0⊢ False; omega All goals completed! 🐙
· inr a:ℕhmany:reachPos (tripleCfg 0 (a + 2)) (tripleCfg (0 + (a + 2)) 0)⊢ reachPos (tripleCfg 0 (a + 2)) (stageCfg (a + 2) (a + 2) (a + 2)) rw [Nat.zero_add inr a:ℕhmany:reachPos (tripleCfg 0 (a + 2)) (tripleCfg (a + 2) 0)⊢ reachPos (tripleCfg 0 (a + 2)) (stageCfg (a + 2) (a + 2) (a + 2))] at hmany inr a:ℕhmany:reachPos (tripleCfg 0 (a + 2)) (tripleCfg (a + 2) 0)⊢ reachPos (tripleCfg 0 (a + 2)) (stageCfg (a + 2) (a + 2) (a + 2))
exact reachPos_trans hmany (triple_finish a) All goals completed! 🐙private theorem init_reaches_stage3 : reachPos init (stageCfg 3 3 3) :=
reachPos_trans boot_to_triple (triple_from_zero 1)
Zero-Gap In-Place terras Evaluation
private def evenCfg (L0 : ListBlank (Fin 2)) (a b : ℕ) : Cfg 41 2 :=
⟨14, Tape.mk' ((ones a L0).cons 0) (ones b B0)⟩private theorem even_step (L0 : ListBlank (Fin 2)) (a b : ℕ) :
reachPos (evenCfg L0 a (b + 2)) (evenCfg L0 (a + 1) b) := by L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos (evenCfg L0 a (b + 2)) (evenCfg L0 (a + 1) b)
unfold evenCfg L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones a L0)) (ones (b + 2) B0) }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }
refine nSteps_then_reachPos (sweep1R tr14_1 (b + 2) _ B0) ?_ L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 14, tape := Tape.mk' (ones (b + 2) (ListBlank.cons 0 (ones a L0))) B0 }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }
rw [ErdosTernary15.Tape.mk'_B0 L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 14, tape := { head := 0, left := ones (b + 2) (ListBlank.cons 0 (ones a L0)), right := B0 } }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }] L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 14, tape := { head := 0, left := ones (b + 2) (ListBlank.cons 0 (ones a L0)), right := B0 } }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }
refine step_then_reachPos (tr14_0 _ _) ?_ L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 15, tape := mkL (ones (b + 2) (ListBlank.cons 0 (ones a L0))) (ListBlank.cons 0 B0) }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }
rw [B0_cons_zero, L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 15, tape := mkL (ones (b + 2) (ListBlank.cons 0 (ones a L0))) B0 }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } ones_succ (b + 1) _, L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 15, tape := mkL (ListBlank.cons 1 (ones (b + 1) (ListBlank.cons 0 (ones a L0)))) B0 }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } ErdosTernary15.Tape.mkL_cons L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 15, tape := { head := 1, left := ones (b + 1) (ListBlank.cons 0 (ones a L0)), right := B0 } }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }] L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 15, tape := { head := 1, left := ones (b + 1) (ListBlank.cons 0 (ones a L0)), right := B0 } }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }
refine step_then_reachPos (tr15_1 _ _) ?_ L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 16, tape := mkL (ones (b + 1) (ListBlank.cons 0 (ones a L0))) (ListBlank.cons 0 B0) }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }
rw [B0_cons_zero, L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 16, tape := mkL (ones (b + 1) (ListBlank.cons 0 (ones a L0))) B0 }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } ones_succ b _, L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 16, tape := mkL (ListBlank.cons 1 (ones b (ListBlank.cons 0 (ones a L0)))) B0 }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } ErdosTernary15.Tape.mkL_cons L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 16, tape := { head := 1, left := ones b (ListBlank.cons 0 (ones a L0)), right := B0 } }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }] L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 16, tape := { head := 1, left := ones b (ListBlank.cons 0 (ones a L0)), right := B0 } }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }
refine step_then_reachPos (tr16_1 _ _) ?_ L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 17, tape := mkL (ones b (ListBlank.cons 0 (ones a L0))) (ListBlank.cons 1 B0) }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }
change reachPos ⟨17, mkL (ones b ((ones a L0).cons 0)) (ones 1 B0)⟩ _ L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 17, tape := mkL (ones b (ListBlank.cons 0 (ones a L0))) (ones 1 B0) }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }
refine nSteps_then_reachPos (sweep1L tr17_1 b _ _) ?_ L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 17, tape := mkL (ListBlank.cons 0 (ones a L0)) (ones b (ones 1 B0)) }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }
rw [← ones_add b 1 B0, L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 17, tape := mkL (ListBlank.cons 0 (ones a L0)) (ones (b + 1) B0) }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } ErdosTernary15.Tape.mkL_cons L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 17, tape := { head := 0, left := ones a L0, right := ones (b + 1) B0 } }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }] L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 17, tape := { head := 0, left := ones a L0, right := ones (b + 1) B0 } }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }
refine step_then_reachPos (tr17_0 _ _) ?_ L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 13, tape := Tape.mk' (ListBlank.cons 1 (ones a L0)) (ones (b + 1) B0) }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }
rw [← ones_succ a L0, L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 13, tape := Tape.mk' (ones (a + 1) L0) (ones (b + 1) B0) }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } ones_succ b B0, L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 13, tape := Tape.mk' (ones (a + 1) L0) (ListBlank.cons 1 (ones b B0)) }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) } ErdosTernary15.Tape.mk'_cons L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 13, tape := { head := 1, left := ones (a + 1) L0, right := ones b B0 } }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }] L0:ListBlank (Fin 2)a:ℕb:ℕ⊢ reachPos { state := 13, tape := { head := 1, left := ones (a + 1) L0, right := ones b B0 } }
{ state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (a + 1) L0)) (ones b B0) }
exact reachPos_step (tr13_1 _ _) All goals completed! 🐙private theorem even_many (L0 : ListBlank (Fin 2)) (a k r : ℕ) :
k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r) := by L0:ListBlank (Fin 2)a:ℕk:ℕr:ℕ⊢ k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r)
induction k generalizing a with
| zero => zero L0:ListBlank (Fin 2)r:ℕa:ℕ⊢ 0 = 0 ∨ reachPos (evenCfg L0 a (2 * 0 + r)) (evenCfg L0 (a + 0) r) exact Or.inl rfl All goals completed! 🐙
| succ k ih => succ L0:ListBlank (Fin 2)r:ℕk:ℕih:∀ (a : ℕ), k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r)a:ℕ⊢ k + 1 = 0 ∨ reachPos (evenCfg L0 a (2 * (k + 1) + r)) (evenCfg L0 (a + (k + 1)) r)
refine Or.inr ?_ succ L0:ListBlank (Fin 2)r:ℕk:ℕih:∀ (a : ℕ), k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r)a:ℕ⊢ reachPos (evenCfg L0 a (2 * (k + 1) + r)) (evenCfg L0 (a + (k + 1)) r)
rw [show 2 * (k + 1) + r = (2 * k + r) + 2 by L0:ListBlank (Fin 2)a:ℕk:ℕr:ℕ⊢ k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r) omega All goals completed! 🐙] succ L0:ListBlank (Fin 2)r:ℕk:ℕih:∀ (a : ℕ), k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r)a:ℕ⊢ reachPos (evenCfg L0 a (2 * k + r + 2)) (evenCfg L0 (a + (k + 1)) r)
rcases ih (a + 1) with rfl | hrest succ.inl L0:ListBlank (Fin 2)r:ℕa:ℕih:∀ (a : ℕ), 0 = 0 ∨ reachPos (evenCfg L0 a (2 * 0 + r)) (evenCfg L0 (a + 0) r)⊢ reachPos (evenCfg L0 a (2 * 0 + r + 2)) (evenCfg L0 (a + (0 + 1)) r)succ.inr L0:ListBlank (Fin 2)r:ℕk:ℕih:∀ (a : ℕ), k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r)a:ℕhrest:reachPos (evenCfg L0 (a + 1) (2 * k + r)) (evenCfg L0 (a + 1 + k) r)⊢ reachPos (evenCfg L0 a (2 * k + r + 2)) (evenCfg L0 (a + (k + 1)) r)
· succ.inl L0:ListBlank (Fin 2)r:ℕa:ℕih:∀ (a : ℕ), 0 = 0 ∨ reachPos (evenCfg L0 a (2 * 0 + r)) (evenCfg L0 (a + 0) r)⊢ reachPos (evenCfg L0 a (2 * 0 + r + 2)) (evenCfg L0 (a + (0 + 1)) r) rw [Nat.mul_zero, succ.inl L0:ListBlank (Fin 2)r:ℕa:ℕih:∀ (a : ℕ), 0 = 0 ∨ reachPos (evenCfg L0 a (2 * 0 + r)) (evenCfg L0 (a + 0) r)⊢ reachPos (evenCfg L0 a (0 + r + 2)) (evenCfg L0 (a + (0 + 1)) r) Nat.zero_add, succ.inl L0:ListBlank (Fin 2)r:ℕa:ℕih:∀ (a : ℕ), 0 = 0 ∨ reachPos (evenCfg L0 a (2 * 0 + r)) (evenCfg L0 (a + 0) r)⊢ reachPos (evenCfg L0 a (r + 2)) (evenCfg L0 (a + (0 + 1)) r) Nat.zero_add succ.inl L0:ListBlank (Fin 2)r:ℕa:ℕih:∀ (a : ℕ), 0 = 0 ∨ reachPos (evenCfg L0 a (2 * 0 + r)) (evenCfg L0 (a + 0) r)⊢ reachPos (evenCfg L0 a (r + 2)) (evenCfg L0 (a + 1) r)] succ.inl L0:ListBlank (Fin 2)r:ℕa:ℕih:∀ (a : ℕ), 0 = 0 ∨ reachPos (evenCfg L0 a (2 * 0 + r)) (evenCfg L0 (a + 0) r)⊢ reachPos (evenCfg L0 a (r + 2)) (evenCfg L0 (a + 1) r)
exact even_step L0 a r All goals completed! 🐙
· succ.inr L0:ListBlank (Fin 2)r:ℕk:ℕih:∀ (a : ℕ), k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r)a:ℕhrest:reachPos (evenCfg L0 (a + 1) (2 * k + r)) (evenCfg L0 (a + 1 + k) r)⊢ reachPos (evenCfg L0 a (2 * k + r + 2)) (evenCfg L0 (a + (k + 1)) r) rw [show a + (k + 1) = (a + 1) + k by L0:ListBlank (Fin 2)a:ℕk:ℕr:ℕ⊢ k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r) omega All goals completed! 🐙] succ.inr L0:ListBlank (Fin 2)r:ℕk:ℕih:∀ (a : ℕ), k = 0 ∨ reachPos (evenCfg L0 a (2 * k + r)) (evenCfg L0 (a + k) r)a:ℕhrest:reachPos (evenCfg L0 (a + 1) (2 * k + r)) (evenCfg L0 (a + 1 + k) r)⊢ reachPos (evenCfg L0 a (2 * k + r + 2)) (evenCfg L0 (a + 1 + k) r)
exact reachPos_trans (even_step L0 a (2 * k + r)) hrest All goals completed! 🐙private def oddCfg (L0 : ListBlank (Fin 2)) (m r : ℕ) : Cfg 41 2 :=
⟨18, mkL (ones m L0) ((ones r B0).cons 0)⟩private theorem odd_step (L0 : ListBlank (Fin 2)) (m r : ℕ) :
reachPos (oddCfg L0 (m + 1) r) (oddCfg L0 m (r + 3)) := by L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos (oddCfg L0 (m + 1) r) (oddCfg L0 m (r + 3))
unfold oddCfg L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 18, tape := mkL (ones (m + 1) L0) (ListBlank.cons 0 (ones r B0)) }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }
rw [ones_succ m L0, L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 18, tape := mkL (ListBlank.cons 1 (ones m L0)) (ListBlank.cons 0 (ones r B0)) }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } ErdosTernary15.Tape.mkL_cons L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 18, tape := { head := 1, left := ones m L0, right := ListBlank.cons 0 (ones r B0) } }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }] L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 18, tape := { head := 1, left := ones m L0, right := ListBlank.cons 0 (ones r B0) } }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }
refine step_then_reachPos (tr18_1 _ _) ?_ L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones m L0)) (ListBlank.cons 0 (ones r B0)) }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }
rw [ErdosTernary15.Tape.mk'_cons L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 12, tape := { head := 0, left := ListBlank.cons 0 (ones m L0), right := ones r B0 } }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }] L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 12, tape := { head := 0, left := ListBlank.cons 0 (ones m L0), right := ones r B0 } }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }
refine step_then_reachPos (tr12_0 _ _) ?_ L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 19, tape := Tape.mk' (ListBlank.cons 1 (ListBlank.cons 0 (ones m L0))) (ones r B0) }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }
change reachPos ⟨19, Tape.mk' (ones 1 ((ones m L0).cons 0)) (ones r B0)⟩ _ L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 19, tape := Tape.mk' (ones 1 (ListBlank.cons 0 (ones m L0))) (ones r B0) }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }
refine nSteps_then_reachPos (sweep1R tr19_1 r _ B0) ?_ L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 19, tape := Tape.mk' (ones r (ones 1 (ListBlank.cons 0 (ones m L0)))) B0 }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }
rw [← ones_add r 1 ((ones m L0).cons 0), L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 19, tape := Tape.mk' (ones (r + 1) (ListBlank.cons 0 (ones m L0))) B0 }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } ErdosTernary15.Tape.mk'_B0 L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 19, tape := { head := 0, left := ones (r + 1) (ListBlank.cons 0 (ones m L0)), right := B0 } }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }] L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 19, tape := { head := 0, left := ones (r + 1) (ListBlank.cons 0 (ones m L0)), right := B0 } }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }
refine step_then_reachPos (tr19_0 _ _) ?_ L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 20, tape := Tape.mk' (ListBlank.cons 1 (ones (r + 1) (ListBlank.cons 0 (ones m L0)))) B0 }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }
rw [← ones_succ (r + 1) _, L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 20, tape := Tape.mk' (ones (r + 1 + 1) (ListBlank.cons 0 (ones m L0))) B0 }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } ErdosTernary15.Tape.mk'_B0 L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 20, tape := { head := 0, left := ones (r + 1 + 1) (ListBlank.cons 0 (ones m L0)), right := B0 } }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }] L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 20, tape := { head := 0, left := ones (r + 1 + 1) (ListBlank.cons 0 (ones m L0)), right := B0 } }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }
refine step_then_reachPos (tr20_0 _ _) ?_ L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 21, tape := mkL (ones (r + 1 + 1) (ListBlank.cons 0 (ones m L0))) (ListBlank.cons 1 B0) }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }
change reachPos ⟨21, mkL (ones (r + 2) ((ones m L0).cons 0)) (ones 1 B0)⟩ _ L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 21, tape := mkL (ones (r + 2) (ListBlank.cons 0 (ones m L0))) (ones 1 B0) }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }
refine nSteps_then_reachPos (sweep1L tr21_1 (r + 2) _ _) ?_ L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 21, tape := mkL (ListBlank.cons 0 (ones m L0)) (ones (r + 2) (ones 1 B0)) }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }
rw [← ones_add (r + 2) 1 B0, L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 21, tape := mkL (ListBlank.cons 0 (ones m L0)) (ones (r + 2 + 1) B0) }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) } show r + 2 + 1 = r + 3 by L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos (oddCfg L0 (m + 1) r) (oddCfg L0 m (r + 3)) omega All goals completed! 🐙, ErdosTernary15.Tape.mkL_cons L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 21, tape := { head := 0, left := ones m L0, right := ones (r + 3) B0 } }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }] L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ reachPos { state := 21, tape := { head := 0, left := ones m L0, right := ones (r + 3) B0 } }
{ state := 18, tape := mkL (ones m L0) (ListBlank.cons 0 (ones (r + 3) B0)) }
exact reachPos_step (tr21_0 _ _) All goals completed! 🐙private theorem odd_many (L0 : ListBlank (Fin 2)) (m r : ℕ) :
m = 0 ∨ reachPos (oddCfg L0 m r) (oddCfg L0 0 (r + 3 * m)) := by L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ m = 0 ∨ reachPos (oddCfg L0 m r) (oddCfg L0 0 (r + 3 * m))
induction m generalizing r with
| zero => zero L0:ListBlank (Fin 2)r:ℕ⊢ 0 = 0 ∨ reachPos (oddCfg L0 0 r) (oddCfg L0 0 (r + 3 * 0)) exact Or.inl rfl All goals completed! 🐙
| succ m ih => succ L0:ListBlank (Fin 2)m:ℕih:∀ (r : ℕ), m = 0 ∨ reachPos (oddCfg L0 m r) (oddCfg L0 0 (r + 3 * m))r:ℕ⊢ m + 1 = 0 ∨ reachPos (oddCfg L0 (m + 1) r) (oddCfg L0 0 (r + 3 * (m + 1)))
refine Or.inr ?_ succ L0:ListBlank (Fin 2)m:ℕih:∀ (r : ℕ), m = 0 ∨ reachPos (oddCfg L0 m r) (oddCfg L0 0 (r + 3 * m))r:ℕ⊢ reachPos (oddCfg L0 (m + 1) r) (oddCfg L0 0 (r + 3 * (m + 1)))
rcases ih (r + 3) with rfl | hrest succ.inl L0:ListBlank (Fin 2)r:ℕih:∀ (r : ℕ), 0 = 0 ∨ reachPos (oddCfg L0 0 r) (oddCfg L0 0 (r + 3 * 0))⊢ reachPos (oddCfg L0 (0 + 1) r) (oddCfg L0 0 (r + 3 * (0 + 1)))succ.inr L0:ListBlank (Fin 2)m:ℕih:∀ (r : ℕ), m = 0 ∨ reachPos (oddCfg L0 m r) (oddCfg L0 0 (r + 3 * m))r:ℕhrest:reachPos (oddCfg L0 m (r + 3)) (oddCfg L0 0 (r + 3 + 3 * m))⊢ reachPos (oddCfg L0 (m + 1) r) (oddCfg L0 0 (r + 3 * (m + 1)))
· succ.inl L0:ListBlank (Fin 2)r:ℕih:∀ (r : ℕ), 0 = 0 ∨ reachPos (oddCfg L0 0 r) (oddCfg L0 0 (r + 3 * 0))⊢ reachPos (oddCfg L0 (0 + 1) r) (oddCfg L0 0 (r + 3 * (0 + 1))) rw [Nat.zero_add, succ.inl L0:ListBlank (Fin 2)r:ℕih:∀ (r : ℕ), 0 = 0 ∨ reachPos (oddCfg L0 0 r) (oddCfg L0 0 (r + 3 * 0))⊢ reachPos (oddCfg L0 1 r) (oddCfg L0 0 (r + 3 * 1)) Nat.mul_one succ.inl L0:ListBlank (Fin 2)r:ℕih:∀ (r : ℕ), 0 = 0 ∨ reachPos (oddCfg L0 0 r) (oddCfg L0 0 (r + 3 * 0))⊢ reachPos (oddCfg L0 1 r) (oddCfg L0 0 (r + 3))] succ.inl L0:ListBlank (Fin 2)r:ℕih:∀ (r : ℕ), 0 = 0 ∨ reachPos (oddCfg L0 0 r) (oddCfg L0 0 (r + 3 * 0))⊢ reachPos (oddCfg L0 1 r) (oddCfg L0 0 (r + 3))
exact odd_step L0 0 r All goals completed! 🐙
· succ.inr L0:ListBlank (Fin 2)m:ℕih:∀ (r : ℕ), m = 0 ∨ reachPos (oddCfg L0 m r) (oddCfg L0 0 (r + 3 * m))r:ℕhrest:reachPos (oddCfg L0 m (r + 3)) (oddCfg L0 0 (r + 3 + 3 * m))⊢ reachPos (oddCfg L0 (m + 1) r) (oddCfg L0 0 (r + 3 * (m + 1))) rw [show r + 3 * (m + 1) = r + 3 + 3 * m by L0:ListBlank (Fin 2)m:ℕr:ℕ⊢ m = 0 ∨ reachPos (oddCfg L0 m r) (oddCfg L0 0 (r + 3 * m)) omega All goals completed! 🐙] succ.inr L0:ListBlank (Fin 2)m:ℕih:∀ (r : ℕ), m = 0 ∨ reachPos (oddCfg L0 m r) (oddCfg L0 0 (r + 3 * m))r:ℕhrest:reachPos (oddCfg L0 m (r + 3)) (oddCfg L0 0 (r + 3 + 3 * m))⊢ reachPos (oddCfg L0 (m + 1) r) (oddCfg L0 0 (r + 3 + 3 * m))
exact reachPos_trans (odd_step L0 m r) hrest All goals completed! 🐙private theorem terras_pos_of_pos {y : ℕ} (hy : 1 ≤ y) : 1 ≤ terras y := by y:ℕhy:1 ≤ y⊢ 1 ≤ terras y
unfold terras y:ℕhy:1 ≤ y⊢ 1 ≤ if y % 2 = 0 then y / 2 else (3 * y + 1) / 2
split_ifs pos y:ℕhy:1 ≤ yh✝:y % 2 = 0⊢ 1 ≤ y / 2neg y:ℕhy:1 ≤ yh✝:¬y % 2 = 0⊢ 1 ≤ (3 * y + 1) / 2 <;> pos y:ℕhy:1 ≤ yh✝:y % 2 = 0⊢ 1 ≤ y / 2neg y:ℕhy:1 ≤ yh✝:¬y % 2 = 0⊢ 1 ≤ (3 * y + 1) / 2 omega All goals completed! 🐙private theorem terras_eval (c x y : ℕ) (hy : 1 ≤ y) :
reachPos (stageCfg c x y) ⟨24, mkL ((baseCX c x).cons 0) (ones (terras y) B0)⟩ := by c:ℕx:ℕy:ℕhy:1 ≤ y⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }
let L0 := (baseCX c x).cons 0 c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }
rcases Nat.mod_two_eq_zero_or_one y with hev | hodd inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }
· inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) } let k := y / 2 - 1 inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }
have hy_eq : y = 2 * k + 2 := by dsimp [k] c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1⊢ y = 2 * (y / 2 - 1) + 2; omega inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }
have hty : terras y = k + 1 := by unfold terras c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2⊢ (if y % 2 = 0 then y / 2 else (3 * y + 1) / 2) = k + 1; simp [hev] c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2⊢ y / 2 = k + 1; dsimp [k] c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2⊢ y / 2 = y / 2 - 1 + 1; omega inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }
rw [hty, inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (k + 1) B0) } hy_eq inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos (stageCfg c x (2 * k + 2)) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (k + 1) B0) }] inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos (stageCfg c x (2 * k + 2)) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (k + 1) B0) }
unfold stageCfg inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 12, tape := Tape.mk' (ListBlank.cons 0 (baseCX c x)) (ones (2 * k + 2) B0) }
{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (k + 1) B0) }
change reachPos ⟨12, Tape.mk' L0 (ones (2 * k + 2) B0)⟩ ⟨24, mkL L0 (ones (k + 1) B0)⟩ inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 12, tape := Tape.mk' L0 (ones (2 * k + 2) B0) } { state := 24, tape := mkL L0 (ones (k + 1) B0) }
rw [show 2 * k + 2 = (2 * k + 1) + 1 by c:ℕx:ℕy:ℕhy:1 ≤ y⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) } omega All goals completed! 🐙, ones_succ (2 * k + 1) B0, inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 12, tape := Tape.mk' L0 (ListBlank.cons 1 (ones (2 * k + 1) B0)) }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }
ErdosTernary15.Tape.mk'_cons inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 12, tape := { head := 1, left := L0, right := ones (2 * k + 1) B0 } }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }] inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 12, tape := { head := 1, left := L0, right := ones (2 * k + 1) B0 } }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }
refine step_then_reachPos (tr12_1 _ _) ?_ inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 13, tape := Tape.mk' (ListBlank.cons 1 L0) (ones (2 * k + 1) B0) }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }
rw [ones_succ (2 * k) B0, inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 13, tape := Tape.mk' (ListBlank.cons 1 L0) (ListBlank.cons 1 (ones (2 * k) B0)) }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) } ErdosTernary15.Tape.mk'_cons inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 13, tape := { head := 1, left := ListBlank.cons 1 L0, right := ones (2 * k) B0 } }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }] inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 13, tape := { head := 1, left := ListBlank.cons 1 L0, right := ones (2 * k) B0 } }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }
refine step_then_reachPos (tr13_1 _ _) ?_ inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 14, tape := Tape.mk' (ListBlank.cons 0 (ListBlank.cons 1 L0)) (ones (2 * k) B0) }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }
change reachPos (evenCfg L0 1 (2 * k + 0)) _ inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos (evenCfg L0 1 (2 * k + 0)) { state := 24, tape := mkL L0 (ones (k + 1) B0) }
have hev_end : reachPos (evenCfg L0 (k + 1) 0) ⟨24, mkL L0 (ones (k + 1) B0)⟩ := by c:ℕx:ℕy:ℕhy:1 ≤ y⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }
unfold evenCfg c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (k + 1) L0)) (ones 0 B0) }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }
rw [ones_zero, c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (k + 1) L0)) B0 }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) } ErdosTernary15.Tape.mk'_B0 c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 14, tape := { head := 0, left := ListBlank.cons 0 (ones (k + 1) L0), right := B0 } }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }] c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 14, tape := { head := 0, left := ListBlank.cons 0 (ones (k + 1) L0), right := B0 } }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }
refine step_then_reachPos (tr14_0 _ _) ?_ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 15, tape := mkL (ListBlank.cons 0 (ones (k + 1) L0)) (ListBlank.cons 0 B0) }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }
rw [B0_cons_zero, c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 15, tape := mkL (ListBlank.cons 0 (ones (k + 1) L0)) B0 }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) } ErdosTernary15.Tape.mkL_cons c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 15, tape := { head := 0, left := ones (k + 1) L0, right := B0 } }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }] c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 15, tape := { head := 0, left := ones (k + 1) L0, right := B0 } }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }
refine step_then_reachPos (tr15_0 _ _) ?_ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 23, tape := mkL (ones (k + 1) L0) (ListBlank.cons 0 B0) }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }
rw [B0_cons_zero, c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 23, tape := mkL (ones (k + 1) L0) B0 } { state := 24, tape := mkL L0 (ones (k + 1) B0) } ones_succ k L0, c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 23, tape := mkL (ListBlank.cons 1 (ones k L0)) B0 }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) } ErdosTernary15.Tape.mkL_cons c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 23, tape := { head := 1, left := ones k L0, right := B0 } }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }] c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1⊢ reachPos { state := 23, tape := { head := 1, left := ones k L0, right := B0 } }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }
have h23 : reachPos ⟨23, ⟨1, ones k L0, B0⟩⟩ ⟨24, mkL (ones k L0) (ones 1 B0)⟩ :=
reachPos_step (tr23_1 (ones k L0) B0) c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1h23:reachPos { state := 23, tape := { head := 1, left := ones k L0, right := B0 } }
{ state := 24, tape := mkL (ones k L0) (ones 1 B0) }⊢ reachPos { state := 23, tape := { head := 1, left := ones k L0, right := B0 } }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }
have hsw := sweep1L tr24_1 k L0 (ones 1 B0) c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1h23:reachPos { state := 23, tape := { head := 1, left := ones k L0, right := B0 } }
{ state := 24, tape := mkL (ones k L0) (ones 1 B0) }hsw:nSteps weakCollatz41 k { state := 24, tape := mkL (ones k L0) (ones 1 B0) } =
some { state := 24, tape := mkL L0 (ones k (ones 1 B0)) }⊢ reachPos { state := 23, tape := { head := 1, left := ones k L0, right := B0 } }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }
rw [← ones_add k 1 B0 c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1h23:reachPos { state := 23, tape := { head := 1, left := ones k L0, right := B0 } }
{ state := 24, tape := mkL (ones k L0) (ones 1 B0) }hsw:nSteps weakCollatz41 k { state := 24, tape := mkL (ones k L0) (ones 1 B0) } =
some { state := 24, tape := mkL L0 (ones (k + 1) B0) }⊢ reachPos { state := 23, tape := { head := 1, left := ones k L0, right := B0 } }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }] at hsw c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1h23:reachPos { state := 23, tape := { head := 1, left := ones k L0, right := B0 } }
{ state := 24, tape := mkL (ones k L0) (ones 1 B0) }hsw:nSteps weakCollatz41 k { state := 24, tape := mkL (ones k L0) (ones 1 B0) } =
some { state := 24, tape := mkL L0 (ones (k + 1) B0) }⊢ reachPos { state := 23, tape := { head := 1, left := ones k L0, right := B0 } }
{ state := 24, tape := mkL L0 (ones (k + 1) B0) }
exact reachPos_then_nSteps h23 hsw inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1hev_end:reachPos (evenCfg L0 (k + 1) 0) { state := 24, tape := mkL L0 (ones (k + 1) B0) }⊢ reachPos (evenCfg L0 1 (2 * k + 0)) { state := 24, tape := mkL L0 (ones (k + 1) B0) }
rcases even_many L0 1 k 0 with hk0 | hmany inl.inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1hev_end:reachPos (evenCfg L0 (k + 1) 0) { state := 24, tape := mkL L0 (ones (k + 1) B0) }hk0:k = 0⊢ reachPos (evenCfg L0 1 (2 * k + 0)) { state := 24, tape := mkL L0 (ones (k + 1) B0) }inl.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1hev_end:reachPos (evenCfg L0 (k + 1) 0) { state := 24, tape := mkL L0 (ones (k + 1) B0) }hmany:reachPos (evenCfg L0 1 (2 * k + 0)) (evenCfg L0 (1 + k) 0)⊢ reachPos (evenCfg L0 1 (2 * k + 0)) { state := 24, tape := mkL L0 (ones (k + 1) B0) }
· inl.inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1hev_end:reachPos (evenCfg L0 (k + 1) 0) { state := 24, tape := mkL L0 (ones (k + 1) B0) }hk0:k = 0⊢ reachPos (evenCfg L0 1 (2 * k + 0)) { state := 24, tape := mkL L0 (ones (k + 1) B0) } rw [hk0 inl.inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1hev_end:reachPos (evenCfg L0 (0 + 1) 0) { state := 24, tape := mkL L0 (ones (0 + 1) B0) }hk0:k = 0⊢ reachPos (evenCfg L0 1 (2 * 0 + 0)) { state := 24, tape := mkL L0 (ones (0 + 1) B0) }] at hev_end ⊢ inl.inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1hev_end:reachPos (evenCfg L0 (0 + 1) 0) { state := 24, tape := mkL L0 (ones (0 + 1) B0) }hk0:k = 0⊢ reachPos (evenCfg L0 1 (2 * 0 + 0)) { state := 24, tape := mkL L0 (ones (0 + 1) B0) }
exact hev_end All goals completed! 🐙
· inl.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1hev_end:reachPos (evenCfg L0 (k + 1) 0) { state := 24, tape := mkL L0 (ones (k + 1) B0) }hmany:reachPos (evenCfg L0 1 (2 * k + 0)) (evenCfg L0 (1 + k) 0)⊢ reachPos (evenCfg L0 1 (2 * k + 0)) { state := 24, tape := mkL L0 (ones (k + 1) B0) } rw [show 1 + k = k + 1 by c:ℕx:ℕy:ℕhy:1 ≤ y⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) } omega All goals completed! 🐙] at hmany inl.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hev:y % 2 = 0k:ℕ := y / 2 - 1hy_eq:y = 2 * k + 2hty:terras y = k + 1hev_end:reachPos (evenCfg L0 (k + 1) 0) { state := 24, tape := mkL L0 (ones (k + 1) B0) }hmany:reachPos (evenCfg L0 1 (2 * k + 0)) (evenCfg L0 (k + 1) 0)⊢ reachPos (evenCfg L0 1 (2 * k + 0)) { state := 24, tape := mkL L0 (ones (k + 1) B0) }
exact reachPos_trans hmany hev_end All goals completed! 🐙
· inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) } let k := y / 2 inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }
have hy_eq : y = 2 * k + 1 := by dsimp [k] c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2⊢ y = 2 * (y / 2) + 1; omega inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }
have hty : terras y = 3 * k + 2 := by
unfold terras c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1⊢ (if y % 2 = 0 then y / 2 else (3 * y + 1) / 2) = 3 * k + 2
have hne : ¬ (y % 2 = 0) := by c:ℕx:ℕy:ℕhy:1 ≤ y⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) } omega c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hne:¬y % 2 = 0⊢ (if y % 2 = 0 then y / 2 else (3 * y + 1) / 2) = 3 * k + 2
simp [hne] c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hne:¬y % 2 = 0⊢ (3 * y + 1) / 2 = 3 * k + 2; dsimp [k] c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hne:¬y % 2 = 0⊢ (3 * y + 1) / 2 = 3 * (y / 2) + 2; omega inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }
rw [hty, inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * k + 2) B0) } hy_eq inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos (stageCfg c x (2 * k + 1)) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * k + 2) B0) }] inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos (stageCfg c x (2 * k + 1)) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * k + 2) B0) }
cases k with
| zero => inr.zero c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos (stageCfg c x (2 * 0 + 1)) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * 0 + 2) B0) }
rw [Nat.mul_zero, inr.zero c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos (stageCfg c x (0 + 1)) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (0 + 2) B0) } Nat.zero_add inr.zero c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos (stageCfg c x 1) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (0 + 2) B0) }] inr.zero c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos (stageCfg c x 1) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (0 + 2) B0) }
unfold stageCfg inr.zero c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos { state := 12, tape := Tape.mk' (ListBlank.cons 0 (baseCX c x)) (ones 1 B0) }
{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (0 + 2) B0) }
change reachPos ⟨12, Tape.mk' L0 (ones 1 B0)⟩ ⟨24, mkL L0 (ones 2 B0)⟩ inr.zero c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos { state := 12, tape := Tape.mk' L0 (ones 1 B0) } { state := 24, tape := mkL L0 (ones 2 B0) }
rw [ones_succ 0 B0, inr.zero c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos { state := 12, tape := Tape.mk' L0 (ListBlank.cons 1 (ones 0 B0)) } { state := 24, tape := mkL L0 (ones 2 B0) } ones_zero, inr.zero c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos { state := 12, tape := Tape.mk' L0 (ListBlank.cons 1 B0) } { state := 24, tape := mkL L0 (ones 2 B0) } ErdosTernary15.Tape.mk'_cons inr.zero c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos { state := 12, tape := { head := 1, left := L0, right := B0 } } { state := 24, tape := mkL L0 (ones 2 B0) }] inr.zero c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos { state := 12, tape := { head := 1, left := L0, right := B0 } } { state := 24, tape := mkL L0 (ones 2 B0) }
refine step_then_reachPos (tr12_1 _ _) ?_ inr.zero c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos { state := 13, tape := Tape.mk' (ListBlank.cons 1 L0) B0 } { state := 24, tape := mkL L0 (ones 2 B0) }
rw [ErdosTernary15.Tape.mk'_B0 inr.zero c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos { state := 13, tape := { head := 0, left := ListBlank.cons 1 L0, right := B0 } }
{ state := 24, tape := mkL L0 (ones 2 B0) }] inr.zero c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2⊢ reachPos { state := 13, tape := { head := 0, left := ListBlank.cons 1 L0, right := B0 } }
{ state := 24, tape := mkL L0 (ones 2 B0) }
have h13 : reachPos ⟨13, ⟨0, ones 1 L0, B0⟩⟩ ⟨24, mkL (ones 1 L0) (ones 1 B0)⟩ :=
reachPos_step (tr13_0 (ones 1 L0) B0) inr.zero c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2h13:reachPos { state := 13, tape := { head := 0, left := ones 1 L0, right := B0 } }
{ state := 24, tape := mkL (ones 1 L0) (ones 1 B0) }⊢ reachPos { state := 13, tape := { head := 0, left := ListBlank.cons 1 L0, right := B0 } }
{ state := 24, tape := mkL L0 (ones 2 B0) }
have hsw : nSteps weakCollatz41 1 ⟨24, mkL (ones 1 L0) (ones 1 B0)⟩ =
some ⟨24, mkL L0 (ones 2 B0)⟩ := sweep1L tr24_1 1 L0 (ones 1 B0) inr.zero c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2h13:reachPos { state := 13, tape := { head := 0, left := ones 1 L0, right := B0 } }
{ state := 24, tape := mkL (ones 1 L0) (ones 1 B0) }hsw:nSteps weakCollatz41 1 { state := 24, tape := mkL (ones 1 L0) (ones 1 B0) } =
some { state := 24, tape := mkL L0 (ones 2 B0) }⊢ reachPos { state := 13, tape := { head := 0, left := ListBlank.cons 1 L0, right := B0 } }
{ state := 24, tape := mkL L0 (ones 2 B0) }
exact reachPos_then_nSteps h13 hsw All goals completed! 🐙
| succ k' => inr.succ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos (stageCfg c x (2 * (k' + 1) + 1))
{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * (k' + 1) + 2) B0) }
unfold stageCfg inr.succ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 12, tape := Tape.mk' (ListBlank.cons 0 (baseCX c x)) (ones (2 * (k' + 1) + 1) B0) }
{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * (k' + 1) + 2) B0) }
change reachPos ⟨12, Tape.mk' L0 (ones (2 * (k' + 1) + 1) B0)⟩
⟨24, mkL L0 (ones (3 * (k' + 1) + 2) B0)⟩ inr.succ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 12, tape := Tape.mk' L0 (ones (2 * (k' + 1) + 1) B0) }
{ state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }
rw [show 2 * (k' + 1) + 1 = (2 * k' + 2) + 1 by c:ℕx:ℕy:ℕhy:1 ≤ y⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) } omega All goals completed! 🐙,
ones_succ (2 * k' + 2) B0, inr.succ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 12, tape := Tape.mk' L0 (ListBlank.cons 1 (ones (2 * k' + 2) B0)) }
{ state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } ErdosTernary15.Tape.mk'_cons inr.succ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 12, tape := { head := 1, left := L0, right := ones (2 * k' + 2) B0 } }
{ state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }] inr.succ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 12, tape := { head := 1, left := L0, right := ones (2 * k' + 2) B0 } }
{ state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }
refine step_then_reachPos (tr12_1 _ _) ?_ inr.succ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 13, tape := Tape.mk' (ListBlank.cons 1 L0) (ones (2 * k' + 2) B0) }
{ state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }
rw [show 2 * k' + 2 = (2 * k' + 1) + 1 by c:ℕx:ℕy:ℕhy:1 ≤ y⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) } omega All goals completed! 🐙,
ones_succ (2 * k' + 1) B0, inr.succ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 13, tape := Tape.mk' (ListBlank.cons 1 L0) (ListBlank.cons 1 (ones (2 * k' + 1) B0)) }
{ state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } ErdosTernary15.Tape.mk'_cons inr.succ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 13, tape := { head := 1, left := ListBlank.cons 1 L0, right := ones (2 * k' + 1) B0 } }
{ state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }] inr.succ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 13, tape := { head := 1, left := ListBlank.cons 1 L0, right := ones (2 * k' + 1) B0 } }
{ state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }
refine step_then_reachPos (tr13_1 _ _) ?_ inr.succ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 14, tape := Tape.mk' (ListBlank.cons 0 (ListBlank.cons 1 L0)) (ones (2 * k' + 1) B0) }
{ state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }
change reachPos (evenCfg L0 1 (2 * k' + 1)) _ inr.succ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos (evenCfg L0 1 (2 * k' + 1)) { state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }
have hto_odd : reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1) := by c:ℕx:ℕy:ℕhy:1 ≤ y⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }
unfold evenCfg oddCfg c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 14, tape := Tape.mk' (ListBlank.cons 0 (ones (k' + 1) L0)) (ones 1 B0) }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }
refine nSteps_then_reachPos (sweep1R tr14_1 1 _ B0) ?_ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 14, tape := Tape.mk' (ones 1 (ListBlank.cons 0 (ones (k' + 1) L0))) B0 }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }
rw [ErdosTernary15.Tape.mk'_B0 c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 14, tape := { head := 0, left := ones 1 (ListBlank.cons 0 (ones (k' + 1) L0)), right := B0 } }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }] c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 14, tape := { head := 0, left := ones 1 (ListBlank.cons 0 (ones (k' + 1) L0)), right := B0 } }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }
refine step_then_reachPos (tr14_0 _ _) ?_ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 15, tape := mkL (ones 1 (ListBlank.cons 0 (ones (k' + 1) L0))) (ListBlank.cons 0 B0) }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }
rw [B0_cons_zero, c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 15, tape := mkL (ones 1 (ListBlank.cons 0 (ones (k' + 1) L0))) B0 }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) } ones_succ 0 _, c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 15, tape := mkL (ListBlank.cons 1 (ones 0 (ListBlank.cons 0 (ones (k' + 1) L0)))) B0 }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) } ErdosTernary15.Tape.mkL_cons c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 15, tape := { head := 1, left := ones 0 (ListBlank.cons 0 (ones (k' + 1) L0)), right := B0 } }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }] c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 15, tape := { head := 1, left := ones 0 (ListBlank.cons 0 (ones (k' + 1) L0)), right := B0 } }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }
refine step_then_reachPos (tr15_1 _ _) ?_ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 16, tape := mkL (ones 0 (ListBlank.cons 0 (ones (k' + 1) L0))) (ListBlank.cons 0 B0) }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }
rw [B0_cons_zero, c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 16, tape := mkL (ones 0 (ListBlank.cons 0 (ones (k' + 1) L0))) B0 }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) } ones_zero, c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 16, tape := mkL (ListBlank.cons 0 (ones (k' + 1) L0)) B0 }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) } ErdosTernary15.Tape.mkL_cons c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 16, tape := { head := 0, left := ones (k' + 1) L0, right := B0 } }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }] c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 16, tape := { head := 0, left := ones (k' + 1) L0, right := B0 } }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }
refine step_then_reachPos (tr16_0 _ _) ?_ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 20, tape := Tape.mk' (ListBlank.cons 0 (ones (k' + 1) L0)) B0 }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }
rw [ErdosTernary15.Tape.mk'_B0 c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 20, tape := { head := 0, left := ListBlank.cons 0 (ones (k' + 1) L0), right := B0 } }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }] c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 20, tape := { head := 0, left := ListBlank.cons 0 (ones (k' + 1) L0), right := B0 } }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }
refine step_then_reachPos (tr20_0 _ _) ?_ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 21, tape := mkL (ListBlank.cons 0 (ones (k' + 1) L0)) (ListBlank.cons 1 B0) }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }
rw [ErdosTernary15.Tape.mkL_cons c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 21, tape := { head := 0, left := ones (k' + 1) L0, right := ListBlank.cons 1 B0 } }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }] c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕ⊢ reachPos { state := 21, tape := { head := 0, left := ones (k' + 1) L0, right := ListBlank.cons 1 B0 } }
{ state := 18, tape := mkL (ones (k' + 1) L0) (ListBlank.cons 0 (ones 1 B0)) }
exact reachPos_step (tr21_0 _ _) inr.succ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)⊢ reachPos (evenCfg L0 1 (2 * k' + 1)) { state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }
have hev_part : reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1) := by c:ℕx:ℕy:ℕhy:1 ≤ y⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }
rcases even_many L0 1 k' 1 with rfl | hmany inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2hto_odd:reachPos (evenCfg L0 (0 + 1) 1) (oddCfg L0 (0 + 1) 1)⊢ reachPos (evenCfg L0 1 (2 * 0 + 1)) (oddCfg L0 (0 + 1) 1)inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hmany:reachPos (evenCfg L0 1 (2 * k' + 1)) (evenCfg L0 (1 + k') 1)⊢ reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)
· inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2hto_odd:reachPos (evenCfg L0 (0 + 1) 1) (oddCfg L0 (0 + 1) 1)⊢ reachPos (evenCfg L0 1 (2 * 0 + 1)) (oddCfg L0 (0 + 1) 1) exact hto_odd All goals completed! 🐙
· inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hmany:reachPos (evenCfg L0 1 (2 * k' + 1)) (evenCfg L0 (1 + k') 1)⊢ reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1) rw [show 1 + k' = k' + 1 by c:ℕx:ℕy:ℕhy:1 ≤ y⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) } omega All goals completed! 🐙] at hmany inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hmany:reachPos (evenCfg L0 1 (2 * k' + 1)) (evenCfg L0 (k' + 1) 1)⊢ reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)
exact reachPos_trans hmany hto_odd inr.succ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)⊢ reachPos (evenCfg L0 1 (2 * k' + 1)) { state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }
refine reachPos_trans hev_part ?_ inr.succ c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)⊢ reachPos (oddCfg L0 (k' + 1) 1) { state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }
rcases odd_many L0 (k' + 1) 1 with h0 | hmany inr.succ.inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)h0:k' + 1 = 0⊢ reachPos (oddCfg L0 (k' + 1) 1) { state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }inr.succ.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos (oddCfg L0 (k' + 1) 1) { state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }
· inr.succ.inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)h0:k' + 1 = 0⊢ reachPos (oddCfg L0 (k' + 1) 1) { state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } exfalso inr.succ.inl c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)h0:k' + 1 = 0⊢ False; omega All goals completed! 🐙
· inr.succ.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos (oddCfg L0 (k' + 1) 1) { state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) } refine reachPos_trans hmany ?_ inr.succ.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos (oddCfg L0 0 (1 + 3 * (k' + 1))) { state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }
unfold oddCfg inr.succ.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos { state := 18, tape := mkL (ones 0 L0) (ListBlank.cons 0 (ones (1 + 3 * (k' + 1)) B0)) }
{ state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }
rw [ones_zero inr.succ.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos { state := 18, tape := mkL L0 (ListBlank.cons 0 (ones (1 + 3 * (k' + 1)) B0)) }
{ state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }] inr.succ.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos { state := 18, tape := mkL L0 (ListBlank.cons 0 (ones (1 + 3 * (k' + 1)) B0)) }
{ state := 24, tape := mkL L0 (ones (3 * (k' + 1) + 2) B0) }
dsimp only [L0] inr.succ.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos { state := 18, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ListBlank.cons 0 (ones (1 + 3 * (k' + 1)) B0)) }
{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * (k' + 1) + 2) B0) }
rw [ErdosTernary15.Tape.mkL_cons inr.succ.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos
{ state := 18, tape := { head := 0, left := baseCX c x, right := ListBlank.cons 0 (ones (1 + 3 * (k' + 1)) B0) } }
{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * (k' + 1) + 2) B0) }] inr.succ.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos
{ state := 18, tape := { head := 0, left := baseCX c x, right := ListBlank.cons 0 (ones (1 + 3 * (k' + 1)) B0) } }
{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * (k' + 1) + 2) B0) }
refine step_then_reachPos (tr18_0 _ _) ?_ inr.succ.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos
{ state := 22, tape := Tape.mk' (ListBlank.cons 0 (baseCX c x)) (ListBlank.cons 0 (ones (1 + 3 * (k' + 1)) B0)) }
{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * (k' + 1) + 2) B0) }
rw [ErdosTernary15.Tape.mk'_cons inr.succ.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos
{ state := 22, tape := { head := 0, left := ListBlank.cons 0 (baseCX c x), right := ones (1 + 3 * (k' + 1)) B0 } }
{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * (k' + 1) + 2) B0) }] inr.succ.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))⊢ reachPos
{ state := 22, tape := { head := 0, left := ListBlank.cons 0 (baseCX c x), right := ones (1 + 3 * (k' + 1)) B0 } }
{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * (k' + 1) + 2) B0) }
have hstep := tr22_0 ((baseCX c x).cons 0) (ones (1 + 3 * (k' + 1)) B0) inr.succ.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))hstep:step weakCollatz41
{ state := 22, tape := { head := 0, left := ListBlank.cons 0 (baseCX c x), right := ones (1 + 3 * (k' + 1)) B0 } } =
some { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ListBlank.cons 1 (ones (1 + 3 * (k' + 1)) B0)) }⊢ reachPos
{ state := 22, tape := { head := 0, left := ListBlank.cons 0 (baseCX c x), right := ones (1 + 3 * (k' + 1)) B0 } }
{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * (k' + 1) + 2) B0) }
rw [← ones_succ (1 + 3 * (k' + 1)) B0, inr.succ.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))hstep:step weakCollatz41
{ state := 22, tape := { head := 0, left := ListBlank.cons 0 (baseCX c x), right := ones (1 + 3 * (k' + 1)) B0 } } =
some { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (1 + 3 * (k' + 1) + 1) B0) }⊢ reachPos
{ state := 22, tape := { head := 0, left := ListBlank.cons 0 (baseCX c x), right := ones (1 + 3 * (k' + 1)) B0 } }
{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * (k' + 1) + 2) B0) }
show 1 + 3 * (k' + 1) + 1 = 3 * (k' + 1) + 2 by c:ℕx:ℕy:ℕhy:1 ≤ y⊢ reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) } omega All goals completed! 🐙] at hstep inr.succ.inr c:ℕx:ℕy:ℕhy:1 ≤ yL0:ListBlank (Fin 2) := ListBlank.cons 0 (baseCX c x)hodd:y % 2 = 1k:ℕ := y / 2hy_eq:y = 2 * k + 1hty:terras y = 3 * k + 2k':ℕhto_odd:reachPos (evenCfg L0 (k' + 1) 1) (oddCfg L0 (k' + 1) 1)hev_part:reachPos (evenCfg L0 1 (2 * k' + 1)) (oddCfg L0 (k' + 1) 1)hmany:reachPos (oddCfg L0 (k' + 1) 1) (oddCfg L0 0 (1 + 3 * (k' + 1)))hstep:step weakCollatz41
{ state := 22, tape := { head := 0, left := ListBlank.cons 0 (baseCX c x), right := ones (1 + 3 * (k' + 1)) B0 } } =
some { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * (k' + 1) + 2) B0) }⊢ reachPos
{ state := 22, tape := { head := 0, left := ListBlank.cons 0 (baseCX c x), right := ones (1 + 3 * (k' + 1)) B0 } }
{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (3 * (k' + 1) + 2) B0) }
exact reachPos_step hstep All goals completed! 🐙Adjacent Comparison, Cycle Halt & Unified Restoration
private def cmpCfg (c u v p : ℕ) : Cfg 41 2 :=
⟨23, mkL (ones v ((ones u ((ones c B0).cons 0)).cons 0)) ((ones (2 * p) B0).cons 0)⟩private theorem cmpFrom24 (c u v p : ℕ) :
reachPos ⟨24, mkL ((ones (u + 1) ((ones c B0).cons 0)).cons 0)
(ones (v + 1) ((ones (2 * p) B0).cons 0))⟩
(cmpCfg c u v (p + 1)) := by c:ℕu:ℕv:ℕp:ℕ⊢ reachPos
{ state := 24,
tape :=
mkL (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0))))
(ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) }
(cmpCfg c u v (p + 1))
let Lc := (ones c B0).cons 0 c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)⊢ reachPos
{ state := 24,
tape :=
mkL (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0))))
(ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) }
(cmpCfg c u v (p + 1))
let Lu := (ones u Lc).cons 0 c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 24,
tape :=
mkL (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0))))
(ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) }
(cmpCfg c u v (p + 1))
rw [ErdosTernary15.Tape.mkL_cons c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 24,
tape :=
{ head := 0, left := ones (u + 1) (ListBlank.cons 0 (ones c B0)),
right := ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)) } }
(cmpCfg c u v (p + 1))] c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 24,
tape :=
{ head := 0, left := ones (u + 1) (ListBlank.cons 0 (ones c B0)),
right := ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)) } }
(cmpCfg c u v (p + 1))
refine step_then_reachPos (tr24_0 _ _) ?_ c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 27,
tape :=
mkL (ones (u + 1) (ListBlank.cons 0 (ones c B0)))
(ListBlank.cons 0 (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)))) }
(cmpCfg c u v (p + 1))
rw [ones_succ u Lc, c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 27,
tape := mkL (ListBlank.cons 1 (ones u Lc)) (ListBlank.cons 0 (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)))) }
(cmpCfg c u v (p + 1)) ErdosTernary15.Tape.mkL_cons c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 27,
tape :=
{ head := 1, left := ones u Lc, right := ListBlank.cons 0 (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) } }
(cmpCfg c u v (p + 1))] c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 27,
tape :=
{ head := 1, left := ones u Lc, right := ListBlank.cons 0 (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) } }
(cmpCfg c u v (p + 1))
refine step_then_reachPos (tr27_1 _ _) ?_ c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 28,
tape :=
Tape.mk' (ListBlank.cons 0 (ones u Lc)) (ListBlank.cons 0 (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)))) }
(cmpCfg c u v (p + 1))
rw [ErdosTernary15.Tape.mk'_cons c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 28,
tape :=
{ head := 0, left := ListBlank.cons 0 (ones u Lc), right := ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)) } }
(cmpCfg c u v (p + 1))] c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 28,
tape :=
{ head := 0, left := ListBlank.cons 0 (ones u Lc), right := ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)) } }
(cmpCfg c u v (p + 1))
refine step_then_reachPos (tr28_0 _ _) ?_ c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 29,
tape :=
Tape.mk' (ListBlank.cons 1 (ListBlank.cons 0 (ones u Lc))) (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) }
(cmpCfg c u v (p + 1))
change reachPos ⟨29, Tape.mk' (ones 1 Lu) (ones (v + 1) ((ones (2 * p) B0).cons 0))⟩ _ c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 29, tape := Tape.mk' (ones 1 Lu) (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) }
(cmpCfg c u v (p + 1))
refine nSteps_then_reachPos (sweep1R tr29_1 (v + 1) (ones 1 Lu) _) ?_ c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 29, tape := Tape.mk' (ones (v + 1) (ones 1 Lu)) (ListBlank.cons 0 (ones (2 * p) B0)) }
(cmpCfg c u v (p + 1))
rw [← ones_add (v + 1) 1 Lu, c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 29, tape := Tape.mk' (ones (v + 1 + 1) Lu) (ListBlank.cons 0 (ones (2 * p) B0)) }
(cmpCfg c u v (p + 1)) show v + 1 + 1 = v + 2 by c:ℕu:ℕv:ℕp:ℕ⊢ reachPos
{ state := 24,
tape :=
mkL (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0))))
(ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) }
(cmpCfg c u v (p + 1)) omega All goals completed! 🐙, ErdosTernary15.Tape.mk'_cons c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 29, tape := { head := 0, left := ones (v + 2) Lu, right := ones (2 * p) B0 } }
(cmpCfg c u v (p + 1))] c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 29, tape := { head := 0, left := ones (v + 2) Lu, right := ones (2 * p) B0 } }
(cmpCfg c u v (p + 1))
refine step_then_reachPos (tr29_0 _ _) ?_ c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 20, tape := mkL (ones (v + 2) Lu) (ListBlank.cons 1 (ones (2 * p) B0)) } (cmpCfg c u v (p + 1))
rw [show (ones (2 * p) B0).cons 1 = ones (2 * p + 1) B0 from rfl, c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 20, tape := mkL (ones (v + 2) Lu) (ones (2 * p + 1) B0) } (cmpCfg c u v (p + 1))
show v + 2 = (v + 1) + 1 by c:ℕu:ℕv:ℕp:ℕ⊢ reachPos
{ state := 24,
tape :=
mkL (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0))))
(ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) }
(cmpCfg c u v (p + 1)) omega All goals completed! 🐙, ones_succ (v + 1) Lu, c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 20, tape := mkL (ListBlank.cons 1 (ones (v + 1) Lu)) (ones (2 * p + 1) B0) } (cmpCfg c u v (p + 1)) ErdosTernary15.Tape.mkL_cons c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 20, tape := { head := 1, left := ones (v + 1) Lu, right := ones (2 * p + 1) B0 } }
(cmpCfg c u v (p + 1))] c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 20, tape := { head := 1, left := ones (v + 1) Lu, right := ones (2 * p + 1) B0 } }
(cmpCfg c u v (p + 1))
refine step_then_reachPos (tr20_1 _ _) ?_ c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 22, tape := mkL (ones (v + 1) Lu) (ListBlank.cons 1 (ones (2 * p + 1) B0)) } (cmpCfg c u v (p + 1))
rw [← ones_succ (2 * p + 1) B0, c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 22, tape := mkL (ones (v + 1) Lu) (ones (2 * p + 1 + 1) B0) } (cmpCfg c u v (p + 1)) ones_succ v Lu, c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 22, tape := mkL (ListBlank.cons 1 (ones v Lu)) (ones (2 * p + 1 + 1) B0) } (cmpCfg c u v (p + 1)) ErdosTernary15.Tape.mkL_cons c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 22, tape := { head := 1, left := ones v Lu, right := ones (2 * p + 1 + 1) B0 } }
(cmpCfg c u v (p + 1))] c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 22, tape := { head := 1, left := ones v Lu, right := ones (2 * p + 1 + 1) B0 } }
(cmpCfg c u v (p + 1))
have h22 := tr22_1 (ones v Lu) (ones (2 * p + 2) B0) c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)h22:step weakCollatz41 { state := 22, tape := { head := 1, left := ones v Lu, right := ones (2 * p + 2) B0 } } =
some { state := 23, tape := mkL (ones v Lu) (ListBlank.cons 0 (ones (2 * p + 2) B0)) }⊢ reachPos { state := 22, tape := { head := 1, left := ones v Lu, right := ones (2 * p + 1 + 1) B0 } }
(cmpCfg c u v (p + 1))
rw [show 2 * p + 2 = 2 * (p + 1) by c:ℕu:ℕv:ℕp:ℕ⊢ reachPos
{ state := 24,
tape :=
mkL (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0))))
(ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) }
(cmpCfg c u v (p + 1)) omega All goals completed! 🐙] at h22 c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)h22:step weakCollatz41 { state := 22, tape := { head := 1, left := ones v Lu, right := ones (2 * (p + 1)) B0 } } =
some { state := 23, tape := mkL (ones v Lu) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }⊢ reachPos { state := 22, tape := { head := 1, left := ones v Lu, right := ones (2 * p + 1 + 1) B0 } }
(cmpCfg c u v (p + 1))
exact reachPos_step h22 All goals completed! 🐙private theorem terras_to_cmp1 (c x y : ℕ) (hx : 3 ≤ x) (hy : 1 ≤ y) :
reachPos (stageCfg c x y) (cmpCfg c (x - 1) (terras y - 1) 1) := by c:ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ y⊢ reachPos (stageCfg c x y) (cmpCfg c (x - 1) (terras y - 1) 1)
have hz : 1 ≤ terras y := terras_pos_of_pos hy c:ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhz:1 ≤ terras y⊢ reachPos (stageCfg c x y) (cmpCfg c (x - 1) (terras y - 1) 1)
have heval := terras_eval c x y hy c:ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhz:1 ≤ terras yheval:reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }⊢ reachPos (stageCfg c x y) (cmpCfg c (x - 1) (terras y - 1) 1)
have htarget : (⟨24, mkL ((baseCX c x).cons 0) (ones (terras y) B0)⟩ : Cfg 41 2) =
⟨24, mkL ((ones ((x - 1) + 1) ((ones c B0).cons 0)).cons 0)
(ones ((terras y - 1) + 1) ((ones (2 * 0) B0).cons 0))⟩ := by
unfold baseCX c:ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhz:1 ≤ terras yheval:reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }⊢ { state := 24, tape := mkL (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones c B0)))) (ones (terras y) B0) } =
{ state := 24,
tape :=
mkL (ListBlank.cons 0 (ones (x - 1 + 1) (ListBlank.cons 0 (ones c B0))))
(ones (terras y - 1 + 1) (ListBlank.cons 0 (ones (2 * 0) B0))) }
rw [show (x - 1) + 1 = x by c:ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ y⊢ reachPos (stageCfg c x y) (cmpCfg c (x - 1) (terras y - 1) 1) omega All goals completed! 🐙, show (terras y - 1) + 1 = terras y by c:ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ y⊢ reachPos (stageCfg c x y) (cmpCfg c (x - 1) (terras y - 1) 1) omega All goals completed! 🐙,
Nat.mul_zero, c:ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhz:1 ≤ terras yheval:reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }⊢ { state := 24, tape := mkL (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones c B0)))) (ones (terras y) B0) } =
{ state := 24,
tape :=
mkL (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones c B0)))) (ones (terras y) (ListBlank.cons 0 (ones 0 B0))) } ones_zero, c:ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhz:1 ≤ terras yheval:reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }⊢ { state := 24, tape := mkL (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones c B0)))) (ones (terras y) B0) } =
{ state := 24,
tape := mkL (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones c B0)))) (ones (terras y) (ListBlank.cons 0 B0)) } B0_cons_zero c:ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhz:1 ≤ terras yheval:reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }⊢ { state := 24, tape := mkL (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones c B0)))) (ones (terras y) B0) } =
{ state := 24, tape := mkL (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones c B0)))) (ones (terras y) B0) }] c:ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhz:1 ≤ terras yheval:reachPos (stageCfg c x y) { state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) }htarget:{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) } =
{ state := 24,
tape :=
mkL (ListBlank.cons 0 (ones (x - 1 + 1) (ListBlank.cons 0 (ones c B0))))
(ones (terras y - 1 + 1) (ListBlank.cons 0 (ones (2 * 0) B0))) }⊢ reachPos (stageCfg c x y) (cmpCfg c (x - 1) (terras y - 1) 1)
rw [htarget c:ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhz:1 ≤ terras yheval:reachPos (stageCfg c x y)
{ state := 24,
tape :=
mkL (ListBlank.cons 0 (ones (x - 1 + 1) (ListBlank.cons 0 (ones c B0))))
(ones (terras y - 1 + 1) (ListBlank.cons 0 (ones (2 * 0) B0))) }htarget:{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) } =
{ state := 24,
tape :=
mkL (ListBlank.cons 0 (ones (x - 1 + 1) (ListBlank.cons 0 (ones c B0))))
(ones (terras y - 1 + 1) (ListBlank.cons 0 (ones (2 * 0) B0))) }⊢ reachPos (stageCfg c x y) (cmpCfg c (x - 1) (terras y - 1) 1)] at heval c:ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhz:1 ≤ terras yheval:reachPos (stageCfg c x y)
{ state := 24,
tape :=
mkL (ListBlank.cons 0 (ones (x - 1 + 1) (ListBlank.cons 0 (ones c B0))))
(ones (terras y - 1 + 1) (ListBlank.cons 0 (ones (2 * 0) B0))) }htarget:{ state := 24, tape := mkL (ListBlank.cons 0 (baseCX c x)) (ones (terras y) B0) } =
{ state := 24,
tape :=
mkL (ListBlank.cons 0 (ones (x - 1 + 1) (ListBlank.cons 0 (ones c B0))))
(ones (terras y - 1 + 1) (ListBlank.cons 0 (ones (2 * 0) B0))) }⊢ reachPos (stageCfg c x y) (cmpCfg c (x - 1) (terras y - 1) 1)
exact reachPos_trans heval (cmpFrom24 c (x - 1) (terras y - 1) 0) All goals completed! 🐙private theorem cmp_step (c u v p : ℕ) :
reachPos (cmpCfg c (u + 1) (v + 1) p) (cmpCfg c u v (p + 1)) := by c:ℕu:ℕv:ℕp:ℕ⊢ reachPos (cmpCfg c (u + 1) (v + 1) p) (cmpCfg c u v (p + 1))
unfold cmpCfg c:ℕu:ℕv:ℕp:ℕ⊢ reachPos
{ state := 23,
tape :=
mkL (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
{ state := 23,
tape :=
mkL (ones v (ListBlank.cons 0 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }
let Lu1 := (ones (u + 1) ((ones c B0).cons 0)).cons 0 c:ℕu:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))⊢ reachPos
{ state := 23,
tape :=
mkL (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
{ state := 23,
tape :=
mkL (ones v (ListBlank.cons 0 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }
let Rp := (ones (2 * p) B0).cons 0 c:ℕu:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos
{ state := 23,
tape :=
mkL (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
{ state := 23,
tape :=
mkL (ones v (ListBlank.cons 0 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }
change reachPos ⟨23, mkL (ones (v + 1) Lu1) Rp⟩ _ c:ℕu:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 23, tape := mkL (ones (v + 1) Lu1) Rp }
{ state := 23,
tape :=
mkL (ones v (ListBlank.cons 0 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }
rw [ones_succ v Lu1, c:ℕu:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 23, tape := mkL (ListBlank.cons 1 (ones v Lu1)) Rp }
{ state := 23,
tape :=
mkL (ones v (ListBlank.cons 0 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * (p + 1)) B0)) } ErdosTernary15.Tape.mkL_cons c:ℕu:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 23, tape := { head := 1, left := ones v Lu1, right := Rp } }
{ state := 23,
tape :=
mkL (ones v (ListBlank.cons 0 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }] c:ℕu:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 23, tape := { head := 1, left := ones v Lu1, right := Rp } }
{ state := 23,
tape :=
mkL (ones v (ListBlank.cons 0 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }
refine step_then_reachPos (tr23_1 _ _) ?_ c:ℕu:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 24, tape := mkL (ones v Lu1) (ListBlank.cons 1 Rp) }
{ state := 23,
tape :=
mkL (ones v (ListBlank.cons 0 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }
change reachPos ⟨24, mkL (ones v Lu1) (ones 1 Rp)⟩ _ c:ℕu:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 24, tape := mkL (ones v Lu1) (ones 1 Rp) }
{ state := 23,
tape :=
mkL (ones v (ListBlank.cons 0 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }
refine nSteps_then_reachPos (sweep1L tr24_1 v Lu1 (ones 1 Rp)) ?_ c:ℕu:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 24, tape := mkL Lu1 (ones v (ones 1 Rp)) }
{ state := 23,
tape :=
mkL (ones v (ListBlank.cons 0 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }
rw [← ones_add v 1 Rp c:ℕu:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 24, tape := mkL Lu1 (ones (v + 1) Rp) }
{ state := 23,
tape :=
mkL (ones v (ListBlank.cons 0 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }] c:ℕu:ℕv:ℕp:ℕLu1:ListBlank (Fin 2) := ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 24, tape := mkL Lu1 (ones (v + 1) Rp) }
{ state := 23,
tape :=
mkL (ones v (ListBlank.cons 0 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }
exact cmpFrom24 c u v p All goals completed! 🐙private theorem cmp_many (c u v p k : ℕ) :
k = 0 ∨ reachPos (cmpCfg c (u + k) (v + k) p) (cmpCfg c u v (p + k)) := by c:ℕu:ℕv:ℕp:ℕk:ℕ⊢ k = 0 ∨ reachPos (cmpCfg c (u + k) (v + k) p) (cmpCfg c u v (p + k))
induction k generalizing u v p with
| zero => zero c:ℕu:ℕv:ℕp:ℕ⊢ 0 = 0 ∨ reachPos (cmpCfg c (u + 0) (v + 0) p) (cmpCfg c u v (p + 0)) exact Or.inl rfl All goals completed! 🐙
| succ k ih => succ c:ℕk:ℕih:∀ (u v p : ℕ), k = 0 ∨ reachPos (cmpCfg c (u + k) (v + k) p) (cmpCfg c u v (p + k))u:ℕv:ℕp:ℕ⊢ k + 1 = 0 ∨ reachPos (cmpCfg c (u + (k + 1)) (v + (k + 1)) p) (cmpCfg c u v (p + (k + 1)))
refine Or.inr ?_ succ c:ℕk:ℕih:∀ (u v p : ℕ), k = 0 ∨ reachPos (cmpCfg c (u + k) (v + k) p) (cmpCfg c u v (p + k))u:ℕv:ℕp:ℕ⊢ reachPos (cmpCfg c (u + (k + 1)) (v + (k + 1)) p) (cmpCfg c u v (p + (k + 1)))
rw [show u + (k + 1) = (u + k) + 1 by c:ℕu:ℕv:ℕp:ℕk:ℕ⊢ k = 0 ∨ reachPos (cmpCfg c (u + k) (v + k) p) (cmpCfg c u v (p + k)) omega All goals completed! 🐙, show v + (k + 1) = (v + k) + 1 by c:ℕu:ℕv:ℕp:ℕk:ℕ⊢ k = 0 ∨ reachPos (cmpCfg c (u + k) (v + k) p) (cmpCfg c u v (p + k)) omega All goals completed! 🐙] succ c:ℕk:ℕih:∀ (u v p : ℕ), k = 0 ∨ reachPos (cmpCfg c (u + k) (v + k) p) (cmpCfg c u v (p + k))u:ℕv:ℕp:ℕ⊢ reachPos (cmpCfg c (u + k + 1) (v + k + 1) p) (cmpCfg c u v (p + (k + 1)))
rcases ih u v (p + 1) with rfl | hrest succ.inl c:ℕu:ℕv:ℕp:ℕih:∀ (u v p : ℕ), 0 = 0 ∨ reachPos (cmpCfg c (u + 0) (v + 0) p) (cmpCfg c u v (p + 0))⊢ reachPos (cmpCfg c (u + 0 + 1) (v + 0 + 1) p) (cmpCfg c u v (p + (0 + 1)))succ.inr c:ℕk:ℕih:∀ (u v p : ℕ), k = 0 ∨ reachPos (cmpCfg c (u + k) (v + k) p) (cmpCfg c u v (p + k))u:ℕv:ℕp:ℕhrest:reachPos (cmpCfg c (u + k) (v + k) (p + 1)) (cmpCfg c u v (p + 1 + k))⊢ reachPos (cmpCfg c (u + k + 1) (v + k + 1) p) (cmpCfg c u v (p + (k + 1)))
· succ.inl c:ℕu:ℕv:ℕp:ℕih:∀ (u v p : ℕ), 0 = 0 ∨ reachPos (cmpCfg c (u + 0) (v + 0) p) (cmpCfg c u v (p + 0))⊢ reachPos (cmpCfg c (u + 0 + 1) (v + 0 + 1) p) (cmpCfg c u v (p + (0 + 1))) rw [Nat.add_zero succ.inl c:ℕu:ℕv:ℕp:ℕih:∀ (u v p : ℕ), 0 = 0 ∨ reachPos (cmpCfg c (u + 0) (v + 0) p) (cmpCfg c u v (p + 0))⊢ reachPos (cmpCfg c (u + 1) (v + 0 + 1) p) (cmpCfg c u v (p + (0 + 1)))] succ.inl c:ℕu:ℕv:ℕp:ℕih:∀ (u v p : ℕ), 0 = 0 ∨ reachPos (cmpCfg c (u + 0) (v + 0) p) (cmpCfg c u v (p + 0))⊢ reachPos (cmpCfg c (u + 1) (v + 0 + 1) p) (cmpCfg c u v (p + (0 + 1)))
exact cmp_step c u v p All goals completed! 🐙
· succ.inr c:ℕk:ℕih:∀ (u v p : ℕ), k = 0 ∨ reachPos (cmpCfg c (u + k) (v + k) p) (cmpCfg c u v (p + k))u:ℕv:ℕp:ℕhrest:reachPos (cmpCfg c (u + k) (v + k) (p + 1)) (cmpCfg c u v (p + 1 + k))⊢ reachPos (cmpCfg c (u + k + 1) (v + k + 1) p) (cmpCfg c u v (p + (k + 1))) rw [show p + 1 + k = p + (k + 1) by c:ℕu:ℕv:ℕp:ℕk:ℕ⊢ k = 0 ∨ reachPos (cmpCfg c (u + k) (v + k) p) (cmpCfg c u v (p + k)) omega All goals completed! 🐙] at hrest succ.inr c:ℕk:ℕih:∀ (u v p : ℕ), k = 0 ∨ reachPos (cmpCfg c (u + k) (v + k) p) (cmpCfg c u v (p + k))u:ℕv:ℕp:ℕhrest:reachPos (cmpCfg c (u + k) (v + k) (p + 1)) (cmpCfg c u v (p + (k + 1)))⊢ reachPos (cmpCfg c (u + k + 1) (v + k + 1) p) (cmpCfg c u v (p + (k + 1)))
exact reachPos_trans (cmp_step c (u + k) (v + k) p) hrest All goals completed! 🐙private theorem cmp_halt_eq (c p : ℕ) :
∃ s cfg, nSteps weakCollatz41 s (cmpCfg c 0 0 p) = some cfg ∧
step weakCollatz41 cfg = none := by c:ℕp:ℕ⊢ ∃ s cfg, nSteps weakCollatz41 s (cmpCfg c 0 0 p) = some cfg ∧ step weakCollatz41 cfg = none
unfold cmpCfg c:ℕp:ℕ⊢ ∃ s cfg,
nSteps weakCollatz41 s
{ state := 23,
tape :=
mkL (ones 0 (ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) } =
some cfg ∧
step weakCollatz41 cfg = none
rw [ones_zero, c:ℕp:ℕ⊢ ∃ s cfg,
nSteps weakCollatz41 s
{ state := 23,
tape :=
mkL (ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))) (ListBlank.cons 0 (ones (2 * p) B0)) } =
some cfg ∧
step weakCollatz41 cfg = none ones_zero, c:ℕp:ℕ⊢ ∃ s cfg,
nSteps weakCollatz41 s
{ state := 23,
tape := mkL (ListBlank.cons 0 (ListBlank.cons 0 (ones c B0))) (ListBlank.cons 0 (ones (2 * p) B0)) } =
some cfg ∧
step weakCollatz41 cfg = none ErdosTernary15.Tape.mkL_cons c:ℕp:ℕ⊢ ∃ s cfg,
nSteps weakCollatz41 s
{ state := 23,
tape := { head := 0, left := ListBlank.cons 0 (ones c B0), right := ListBlank.cons 0 (ones (2 * p) B0) } } =
some cfg ∧
step weakCollatz41 cfg = none] c:ℕp:ℕ⊢ ∃ s cfg,
nSteps weakCollatz41 s
{ state := 23,
tape := { head := 0, left := ListBlank.cons 0 (ones c B0), right := ListBlank.cons 0 (ones (2 * p) B0) } } =
some cfg ∧
step weakCollatz41 cfg = none
have h1 := tr23_0 (((ones c B0).cons 0)) ((ones (2 * p) B0).cons 0) c:ℕp:ℕh1:step weakCollatz41
{ state := 23,
tape := { head := 0, left := ListBlank.cons 0 (ones c B0), right := ListBlank.cons 0 (ones (2 * p) B0) } } =
some
{ state := 25, tape := mkL (ListBlank.cons 0 (ones c B0)) (ListBlank.cons 0 (ListBlank.cons 0 (ones (2 * p) B0))) }⊢ ∃ s cfg,
nSteps weakCollatz41 s
{ state := 23,
tape := { head := 0, left := ListBlank.cons 0 (ones c B0), right := ListBlank.cons 0 (ones (2 * p) B0) } } =
some cfg ∧
step weakCollatz41 cfg = none
rw [ErdosTernary15.Tape.mkL_cons c:ℕp:ℕh1:step weakCollatz41
{ state := 23,
tape := { head := 0, left := ListBlank.cons 0 (ones c B0), right := ListBlank.cons 0 (ones (2 * p) B0) } } =
some
{ state := 25,
tape := { head := 0, left := ones c B0, right := ListBlank.cons 0 (ListBlank.cons 0 (ones (2 * p) B0)) } }⊢ ∃ s cfg,
nSteps weakCollatz41 s
{ state := 23,
tape := { head := 0, left := ListBlank.cons 0 (ones c B0), right := ListBlank.cons 0 (ones (2 * p) B0) } } =
some cfg ∧
step weakCollatz41 cfg = none] at h1 c:ℕp:ℕh1:step weakCollatz41
{ state := 23,
tape := { head := 0, left := ListBlank.cons 0 (ones c B0), right := ListBlank.cons 0 (ones (2 * p) B0) } } =
some
{ state := 25,
tape := { head := 0, left := ones c B0, right := ListBlank.cons 0 (ListBlank.cons 0 (ones (2 * p) B0)) } }⊢ ∃ s cfg,
nSteps weakCollatz41 s
{ state := 23,
tape := { head := 0, left := ListBlank.cons 0 (ones c B0), right := ListBlank.cons 0 (ones (2 * p) B0) } } =
some cfg ∧
step weakCollatz41 cfg = none
exact ⟨1, _, step_one h1, tr25_0 _ _⟩ All goals completed! 🐙private def restCfg (c u v p : ℕ) : Cfg 41 2 :=
⟨30, Tape.mk' (ones v ((ones u ((ones c B0).cons 0)).cons 0)) ((ones (2 * p) B0).cons 0)⟩private theorem cmp_lt_to_rest (c u p : ℕ) :
reachPos (cmpCfg c (u + 1) 0 p) (restCfg c (u + 1) 0 p) := by c:ℕu:ℕp:ℕ⊢ reachPos (cmpCfg c (u + 1) 0 p) (restCfg c (u + 1) 0 p)
unfold cmpCfg restCfg c:ℕu:ℕp:ℕ⊢ reachPos
{ state := 23,
tape :=
mkL (ones 0 (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
{ state := 30,
tape :=
Tape.mk' (ones 0 (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
rw [ones_zero, c:ℕu:ℕp:ℕ⊢ reachPos
{ state := 23,
tape := mkL (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))) (ListBlank.cons 0 (ones (2 * p) B0)) }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))) (ListBlank.cons 0 (ones (2 * p) B0)) } ErdosTernary15.Tape.mkL_cons c:ℕu:ℕp:ℕ⊢ reachPos
{ state := 23,
tape :=
{ head := 0, left := ones (u + 1) (ListBlank.cons 0 (ones c B0)), right := ListBlank.cons 0 (ones (2 * p) B0) } }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))) (ListBlank.cons 0 (ones (2 * p) B0)) }] c:ℕu:ℕp:ℕ⊢ reachPos
{ state := 23,
tape :=
{ head := 0, left := ones (u + 1) (ListBlank.cons 0 (ones c B0)), right := ListBlank.cons 0 (ones (2 * p) B0) } }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))) (ListBlank.cons 0 (ones (2 * p) B0)) }
refine step_then_reachPos (tr23_0 _ _) ?_ c:ℕu:ℕp:ℕ⊢ reachPos
{ state := 25,
tape := mkL (ones (u + 1) (ListBlank.cons 0 (ones c B0))) (ListBlank.cons 0 (ListBlank.cons 0 (ones (2 * p) B0))) }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))) (ListBlank.cons 0 (ones (2 * p) B0)) }
rw [ones_succ u _, c:ℕu:ℕp:ℕ⊢ reachPos
{ state := 25,
tape :=
mkL (ListBlank.cons 1 (ones u (ListBlank.cons 0 (ones c B0))))
(ListBlank.cons 0 (ListBlank.cons 0 (ones (2 * p) B0))) }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 0 (ListBlank.cons 1 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) } ErdosTernary15.Tape.mkL_cons c:ℕu:ℕp:ℕ⊢ reachPos
{ state := 25,
tape :=
{ head := 1, left := ones u (ListBlank.cons 0 (ones c B0)),
right := ListBlank.cons 0 (ListBlank.cons 0 (ones (2 * p) B0)) } }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 0 (ListBlank.cons 1 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }] c:ℕu:ℕp:ℕ⊢ reachPos
{ state := 25,
tape :=
{ head := 1, left := ones u (ListBlank.cons 0 (ones c B0)),
right := ListBlank.cons 0 (ListBlank.cons 0 (ones (2 * p) B0)) } }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 0 (ListBlank.cons 1 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
refine step_then_reachPos (tr25_1 _ _) ?_ c:ℕu:ℕp:ℕ⊢ reachPos
{ state := 26,
tape :=
Tape.mk' (ListBlank.cons 1 (ones u (ListBlank.cons 0 (ones c B0))))
(ListBlank.cons 0 (ListBlank.cons 0 (ones (2 * p) B0))) }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 0 (ListBlank.cons 1 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
rw [← ones_succ u _, c:ℕu:ℕp:ℕ⊢ reachPos
{ state := 26,
tape :=
Tape.mk' (ones (u + 1) (ListBlank.cons 0 (ones c B0))) (ListBlank.cons 0 (ListBlank.cons 0 (ones (2 * p) B0))) }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))) (ListBlank.cons 0 (ones (2 * p) B0)) } ErdosTernary15.Tape.mk'_cons c:ℕu:ℕp:ℕ⊢ reachPos
{ state := 26,
tape :=
{ head := 0, left := ones (u + 1) (ListBlank.cons 0 (ones c B0)), right := ListBlank.cons 0 (ones (2 * p) B0) } }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))) (ListBlank.cons 0 (ones (2 * p) B0)) }] c:ℕu:ℕp:ℕ⊢ reachPos
{ state := 26,
tape :=
{ head := 0, left := ones (u + 1) (ListBlank.cons 0 (ones c B0)), right := ListBlank.cons 0 (ones (2 * p) B0) } }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))) (ListBlank.cons 0 (ones (2 * p) B0)) }
exact reachPos_step (tr26_0 _ _) All goals completed! 🐙private theorem cmp_gt_to_rest (c v p : ℕ) :
reachPos (cmpCfg c 0 (v + 1) p) (restCfg c 0 (v + 1) p) := by c:ℕv:ℕp:ℕ⊢ reachPos (cmpCfg c 0 (v + 1) p) (restCfg c 0 (v + 1) p)
unfold cmpCfg restCfg c:ℕv:ℕp:ℕ⊢ reachPos
{ state := 23,
tape :=
mkL (ones (v + 1) (ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
let L0 := (ones 0 ((ones c B0).cons 0)).cons 0 c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))⊢ reachPos
{ state := 23,
tape :=
mkL (ones (v + 1) (ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
let Rp := (ones (2 * p) B0).cons 0 c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos
{ state := 23,
tape :=
mkL (ones (v + 1) (ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
change reachPos ⟨23, mkL (ones (v + 1) L0) Rp⟩ _ c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 23, tape := mkL (ones (v + 1) L0) Rp }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
rw [ones_succ v L0, c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 23, tape := mkL (ListBlank.cons 1 (ones v L0)) Rp }
{ state := 30, tape := Tape.mk' (ListBlank.cons 1 (ones v L0)) (ListBlank.cons 0 (ones (2 * p) B0)) } ErdosTernary15.Tape.mkL_cons c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 23, tape := { head := 1, left := ones v L0, right := Rp } }
{ state := 30, tape := Tape.mk' (ListBlank.cons 1 (ones v L0)) (ListBlank.cons 0 (ones (2 * p) B0)) }] c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 23, tape := { head := 1, left := ones v L0, right := Rp } }
{ state := 30, tape := Tape.mk' (ListBlank.cons 1 (ones v L0)) (ListBlank.cons 0 (ones (2 * p) B0)) }
refine step_then_reachPos (tr23_1 _ _) ?_ c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 24, tape := mkL (ones v L0) (ListBlank.cons 1 Rp) }
{ state := 30, tape := Tape.mk' (ListBlank.cons 1 (ones v L0)) (ListBlank.cons 0 (ones (2 * p) B0)) }
change reachPos ⟨24, mkL (ones v L0) (ones 1 Rp)⟩ _ c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 24, tape := mkL (ones v L0) (ones 1 Rp) }
{ state := 30, tape := Tape.mk' (ListBlank.cons 1 (ones v L0)) (ListBlank.cons 0 (ones (2 * p) B0)) }
refine nSteps_then_reachPos (sweep1L tr24_1 v L0 (ones 1 Rp)) ?_ c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 24, tape := mkL L0 (ones v (ones 1 Rp)) }
{ state := 30, tape := Tape.mk' (ListBlank.cons 1 (ones v L0)) (ListBlank.cons 0 (ones (2 * p) B0)) }
rw [← ones_add v 1 Rp c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 24, tape := mkL L0 (ones (v + 1) Rp) }
{ state := 30, tape := Tape.mk' (ListBlank.cons 1 (ones v L0)) (ListBlank.cons 0 (ones (2 * p) B0)) }] c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 24, tape := mkL L0 (ones (v + 1) Rp) }
{ state := 30, tape := Tape.mk' (ListBlank.cons 1 (ones v L0)) (ListBlank.cons 0 (ones (2 * p) B0)) }
dsimp only [L0] c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 24, tape := mkL (ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))) (ones (v + 1) Rp) }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 1 (ones v (ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0))))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
rw [ones_zero, c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 24, tape := mkL (ListBlank.cons 0 (ListBlank.cons 0 (ones c B0))) (ones (v + 1) Rp) }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 1 (ones v (ListBlank.cons 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) } ErdosTernary15.Tape.mkL_cons c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 24, tape := { head := 0, left := ListBlank.cons 0 (ones c B0), right := ones (v + 1) Rp } }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 1 (ones v (ListBlank.cons 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }] c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 24, tape := { head := 0, left := ListBlank.cons 0 (ones c B0), right := ones (v + 1) Rp } }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 1 (ones v (ListBlank.cons 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
refine step_then_reachPos (tr24_0 _ _) ?_ c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 27, tape := mkL (ListBlank.cons 0 (ones c B0)) (ListBlank.cons 0 (ones (v + 1) Rp)) }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 1 (ones v (ListBlank.cons 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
rw [ErdosTernary15.Tape.mkL_cons c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 27, tape := { head := 0, left := ones c B0, right := ListBlank.cons 0 (ones (v + 1) Rp) } }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 1 (ones v (ListBlank.cons 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }] c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 27, tape := { head := 0, left := ones c B0, right := ListBlank.cons 0 (ones (v + 1) Rp) } }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 1 (ones v (ListBlank.cons 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
refine step_then_reachPos (tr27_0 _ _) ?_ c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 26, tape := Tape.mk' (ListBlank.cons 0 (ones c B0)) (ListBlank.cons 0 (ones (v + 1) Rp)) }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 1 (ones v (ListBlank.cons 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
rw [ErdosTernary15.Tape.mk'_cons c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 26, tape := { head := 0, left := ListBlank.cons 0 (ones c B0), right := ones (v + 1) Rp } }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 1 (ones v (ListBlank.cons 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }] c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)⊢ reachPos { state := 26, tape := { head := 0, left := ListBlank.cons 0 (ones c B0), right := ones (v + 1) Rp } }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 1 (ones v (ListBlank.cons 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
have h26 : reachPos ⟨26, ⟨0, (ones c B0).cons 0, ones (v + 1) Rp⟩⟩
⟨30, Tape.mk' (((ones c B0).cons 0).cons 0) (ones (v + 1) Rp)⟩ :=
reachPos_step (tr26_0 ((ones c B0).cons 0) (ones (v + 1) Rp)) c:ℕv:ℕp:ℕL0:ListBlank (Fin 2) := ListBlank.cons 0 (ones 0 (ListBlank.cons 0 (ones c B0)))Rp:ListBlank (Fin 2) := ListBlank.cons 0 (ones (2 * p) B0)h26:reachPos { state := 26, tape := { head := 0, left := ListBlank.cons 0 (ones c B0), right := ones (v + 1) Rp } }
{ state := 30, tape := Tape.mk' (ListBlank.cons 0 (ListBlank.cons 0 (ones c B0))) (ones (v + 1) Rp) }⊢ reachPos { state := 26, tape := { head := 0, left := ListBlank.cons 0 (ones c B0), right := ones (v + 1) Rp } }
{ state := 30,
tape :=
Tape.mk' (ListBlank.cons 1 (ones v (ListBlank.cons 0 (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
exact reachPos_then_nSteps h26 (sweep1R tr30_1 (v + 1) (((ones c B0).cons 0).cons 0) Rp) All goals completed! 🐙private theorem rest_step (c u v p : ℕ) :
reachPos (restCfg c u v (p + 1)) (restCfg c (u + 1) (v + 1) p) := by c:ℕu:ℕv:ℕp:ℕ⊢ reachPos (restCfg c u v (p + 1)) (restCfg c (u + 1) (v + 1) p)
unfold restCfg c:ℕu:ℕv:ℕp:ℕ⊢ reachPos
{ state := 30,
tape :=
Tape.mk' (ones v (ListBlank.cons 0 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
let Lc := (ones c B0).cons 0 c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)⊢ reachPos
{ state := 30,
tape :=
Tape.mk' (ones v (ListBlank.cons 0 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
let Lu := (ones u Lc).cons 0 c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 30,
tape :=
Tape.mk' (ones v (ListBlank.cons 0 (ones u (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
change reachPos ⟨30, Tape.mk' (ones v Lu) ((ones (2 * (p + 1)) B0).cons 0)⟩ _ c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 30, tape := Tape.mk' (ones v Lu) (ListBlank.cons 0 (ones (2 * (p + 1)) B0)) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
rw [ErdosTernary15.Tape.mk'_cons c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 30, tape := { head := 0, left := ones v Lu, right := ones (2 * (p + 1)) B0 } }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }] c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 30, tape := { head := 0, left := ones v Lu, right := ones (2 * (p + 1)) B0 } }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
refine step_then_reachPos (tr30_0 _ _) ?_ c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 31, tape := Tape.mk' (ListBlank.cons 1 (ones v Lu)) (ones (2 * (p + 1)) B0) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
rw [show (ones v Lu).cons 1 = ones (v + 1) Lu from rfl, c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 31, tape := Tape.mk' (ones (v + 1) Lu) (ones (2 * (p + 1)) B0) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
show 2 * (p + 1) = (2 * p + 1) + 1 by c:ℕu:ℕv:ℕp:ℕ⊢ reachPos (restCfg c u v (p + 1)) (restCfg c (u + 1) (v + 1) p) omega All goals completed! 🐙, ones_succ (2 * p + 1) B0, c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 31, tape := Tape.mk' (ones (v + 1) Lu) (ListBlank.cons 1 (ones (2 * p + 1) B0)) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
ErdosTernary15.Tape.mk'_cons c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 31, tape := { head := 1, left := ones (v + 1) Lu, right := ones (2 * p + 1) B0 } }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }] c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 31, tape := { head := 1, left := ones (v + 1) Lu, right := ones (2 * p + 1) B0 } }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
refine step_then_reachPos (tr31_1 _ _) ?_ c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 28, tape := Tape.mk' (ListBlank.cons 1 (ones (v + 1) Lu)) (ones (2 * p + 1) B0) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
rw [show (ones (v + 1) Lu).cons 1 = ones (v + 2) Lu from rfl, c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 28, tape := Tape.mk' (ones (v + 2) Lu) (ones (2 * p + 1) B0) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
ones_succ (2 * p) B0, c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 28, tape := Tape.mk' (ones (v + 2) Lu) (ListBlank.cons 1 (ones (2 * p) B0)) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) } ErdosTernary15.Tape.mk'_cons c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 28, tape := { head := 1, left := ones (v + 2) Lu, right := ones (2 * p) B0 } }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }] c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 28, tape := { head := 1, left := ones (v + 2) Lu, right := ones (2 * p) B0 } }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
refine step_then_reachPos (tr28_1 _ _) ?_ c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 0, tape := mkL (ones (v + 2) Lu) (ListBlank.cons 0 (ones (2 * p) B0)) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
refine nSteps_then_reachPos (sweep1L tr0_1 (v + 2) Lu _) ?_ c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 0, tape := mkL Lu (ones (v + 2) (ListBlank.cons 0 (ones (2 * p) B0))) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
dsimp only [Lu] c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 0, tape := mkL (ListBlank.cons 0 (ones u Lc)) (ones (v + 2) (ListBlank.cons 0 (ones (2 * p) B0))) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
rw [ErdosTernary15.Tape.mkL_cons c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 0, tape := { head := 0, left := ones u Lc, right := ones (v + 2) (ListBlank.cons 0 (ones (2 * p) B0)) } }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }] c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 0, tape := { head := 0, left := ones u Lc, right := ones (v + 2) (ListBlank.cons 0 (ones (2 * p) B0)) } }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
refine step_then_reachPos (tr0_0 _ _) ?_ c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 1, tape := Tape.mk' (ListBlank.cons 1 (ones u Lc)) (ones (v + 2) (ListBlank.cons 0 (ones (2 * p) B0))) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
rw [← ones_succ u Lc, c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos { state := 1, tape := Tape.mk' (ones (u + 1) Lc) (ones (v + 2) (ListBlank.cons 0 (ones (2 * p) B0))) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) } show v + 2 = (v + 1) + 1 by c:ℕu:ℕv:ℕp:ℕ⊢ reachPos (restCfg c u v (p + 1)) (restCfg c (u + 1) (v + 1) p) omega All goals completed! 🐙, ones_succ (v + 1) _, c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 1,
tape := Tape.mk' (ones (u + 1) Lc) (ListBlank.cons 1 (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)))) }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
ErdosTernary15.Tape.mk'_cons c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 1,
tape := { head := 1, left := ones (u + 1) Lc, right := ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)) } }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }] c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)⊢ reachPos
{ state := 1,
tape := { head := 1, left := ones (u + 1) Lc, right := ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)) } }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
have h1 : reachPos ⟨1, ⟨1, ones (u + 1) Lc, ones (v + 1) ((ones (2 * p) B0).cons 0)⟩⟩
⟨30, Tape.mk' ((ones (u + 1) Lc).cons 0) (ones (v + 1) ((ones (2 * p) B0).cons 0))⟩ :=
reachPos_step (tr1_1 (ones (u + 1) Lc) (ones (v + 1) ((ones (2 * p) B0).cons 0))) c:ℕu:ℕv:ℕp:ℕLc:ListBlank (Fin 2) := ListBlank.cons 0 (ones c B0)Lu:ListBlank (Fin 2) := ListBlank.cons 0 (ones u Lc)h1:reachPos
{ state := 1,
tape := { head := 1, left := ones (u + 1) Lc, right := ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)) } }
{ state := 30,
tape := Tape.mk' (ListBlank.cons 0 (ones (u + 1) Lc)) (ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0))) }⊢ reachPos
{ state := 1,
tape := { head := 1, left := ones (u + 1) Lc, right := ones (v + 1) (ListBlank.cons 0 (ones (2 * p) B0)) } }
{ state := 30,
tape :=
Tape.mk' (ones (v + 1) (ListBlank.cons 0 (ones (u + 1) (ListBlank.cons 0 (ones c B0)))))
(ListBlank.cons 0 (ones (2 * p) B0)) }
exact reachPos_then_nSteps h1
(sweep1R tr30_1 (v + 1) ((ones (u + 1) Lc).cons 0) ((ones (2 * p) B0).cons 0)) All goals completed! 🐙private theorem rest_many (c u v p k : ℕ) :
k = 0 ∨ reachPos (restCfg c u v (p + k)) (restCfg c (u + k) (v + k) p) := by c:ℕu:ℕv:ℕp:ℕk:ℕ⊢ k = 0 ∨ reachPos (restCfg c u v (p + k)) (restCfg c (u + k) (v + k) p)
induction k generalizing u v with
| zero => zero c:ℕp:ℕu:ℕv:ℕ⊢ 0 = 0 ∨ reachPos (restCfg c u v (p + 0)) (restCfg c (u + 0) (v + 0) p) exact Or.inl rfl All goals completed! 🐙
| succ k ih => succ c:ℕp:ℕk:ℕih:∀ (u v : ℕ), k = 0 ∨ reachPos (restCfg c u v (p + k)) (restCfg c (u + k) (v + k) p)u:ℕv:ℕ⊢ k + 1 = 0 ∨ reachPos (restCfg c u v (p + (k + 1))) (restCfg c (u + (k + 1)) (v + (k + 1)) p)
refine Or.inr ?_ succ c:ℕp:ℕk:ℕih:∀ (u v : ℕ), k = 0 ∨ reachPos (restCfg c u v (p + k)) (restCfg c (u + k) (v + k) p)u:ℕv:ℕ⊢ reachPos (restCfg c u v (p + (k + 1))) (restCfg c (u + (k + 1)) (v + (k + 1)) p)
rw [show p + (k + 1) = (p + k) + 1 by c:ℕu:ℕv:ℕp:ℕk:ℕ⊢ k = 0 ∨ reachPos (restCfg c u v (p + k)) (restCfg c (u + k) (v + k) p) omega All goals completed! 🐙] succ c:ℕp:ℕk:ℕih:∀ (u v : ℕ), k = 0 ∨ reachPos (restCfg c u v (p + k)) (restCfg c (u + k) (v + k) p)u:ℕv:ℕ⊢ reachPos (restCfg c u v (p + k + 1)) (restCfg c (u + (k + 1)) (v + (k + 1)) p)
have hfirst := rest_step c u v (p + k) succ c:ℕp:ℕk:ℕih:∀ (u v : ℕ), k = 0 ∨ reachPos (restCfg c u v (p + k)) (restCfg c (u + k) (v + k) p)u:ℕv:ℕhfirst:reachPos (restCfg c u v (p + k + 1)) (restCfg c (u + 1) (v + 1) (p + k))⊢ reachPos (restCfg c u v (p + k + 1)) (restCfg c (u + (k + 1)) (v + (k + 1)) p)
rcases ih (u + 1) (v + 1) with rfl | hrest succ.inl c:ℕp:ℕu:ℕv:ℕih:∀ (u v : ℕ), 0 = 0 ∨ reachPos (restCfg c u v (p + 0)) (restCfg c (u + 0) (v + 0) p)hfirst:reachPos (restCfg c u v (p + 0 + 1)) (restCfg c (u + 1) (v + 1) (p + 0))⊢ reachPos (restCfg c u v (p + 0 + 1)) (restCfg c (u + (0 + 1)) (v + (0 + 1)) p)succ.inr c:ℕp:ℕk:ℕih:∀ (u v : ℕ), k = 0 ∨ reachPos (restCfg c u v (p + k)) (restCfg c (u + k) (v + k) p)u:ℕv:ℕhfirst:reachPos (restCfg c u v (p + k + 1)) (restCfg c (u + 1) (v + 1) (p + k))hrest:reachPos (restCfg c (u + 1) (v + 1) (p + k)) (restCfg c (u + 1 + k) (v + 1 + k) p)⊢ reachPos (restCfg c u v (p + k + 1)) (restCfg c (u + (k + 1)) (v + (k + 1)) p)
· succ.inl c:ℕp:ℕu:ℕv:ℕih:∀ (u v : ℕ), 0 = 0 ∨ reachPos (restCfg c u v (p + 0)) (restCfg c (u + 0) (v + 0) p)hfirst:reachPos (restCfg c u v (p + 0 + 1)) (restCfg c (u + 1) (v + 1) (p + 0))⊢ reachPos (restCfg c u v (p + 0 + 1)) (restCfg c (u + (0 + 1)) (v + (0 + 1)) p) rw [Nat.add_zero succ.inl c:ℕp:ℕu:ℕv:ℕih:∀ (u v : ℕ), 0 = 0 ∨ reachPos (restCfg c u v (p + 0)) (restCfg c (u + 0) (v + 0) p)hfirst:reachPos (restCfg c u v (p + 0 + 1)) (restCfg c (u + 1) (v + 1) (p + 0))⊢ reachPos (restCfg c u v (p + 1)) (restCfg c (u + (0 + 1)) (v + (0 + 1)) p)] succ.inl c:ℕp:ℕu:ℕv:ℕih:∀ (u v : ℕ), 0 = 0 ∨ reachPos (restCfg c u v (p + 0)) (restCfg c (u + 0) (v + 0) p)hfirst:reachPos (restCfg c u v (p + 0 + 1)) (restCfg c (u + 1) (v + 1) (p + 0))⊢ reachPos (restCfg c u v (p + 1)) (restCfg c (u + (0 + 1)) (v + (0 + 1)) p)
exact hfirst All goals completed! 🐙
· succ.inr c:ℕp:ℕk:ℕih:∀ (u v : ℕ), k = 0 ∨ reachPos (restCfg c u v (p + k)) (restCfg c (u + k) (v + k) p)u:ℕv:ℕhfirst:reachPos (restCfg c u v (p + k + 1)) (restCfg c (u + 1) (v + 1) (p + k))hrest:reachPos (restCfg c (u + 1) (v + 1) (p + k)) (restCfg c (u + 1 + k) (v + 1 + k) p)⊢ reachPos (restCfg c u v (p + k + 1)) (restCfg c (u + (k + 1)) (v + (k + 1)) p) rw [show u + (k + 1) = u + 1 + k by c:ℕu:ℕv:ℕp:ℕk:ℕ⊢ k = 0 ∨ reachPos (restCfg c u v (p + k)) (restCfg c (u + k) (v + k) p) omega All goals completed! 🐙, show v + (k + 1) = v + 1 + k by c:ℕu:ℕv:ℕp:ℕk:ℕ⊢ k = 0 ∨ reachPos (restCfg c u v (p + k)) (restCfg c (u + k) (v + k) p) omega All goals completed! 🐙] succ.inr c:ℕp:ℕk:ℕih:∀ (u v : ℕ), k = 0 ∨ reachPos (restCfg c u v (p + k)) (restCfg c (u + k) (v + k) p)u:ℕv:ℕhfirst:reachPos (restCfg c u v (p + k + 1)) (restCfg c (u + 1) (v + 1) (p + k))hrest:reachPos (restCfg c (u + 1) (v + 1) (p + k)) (restCfg c (u + 1 + k) (v + 1 + k) p)⊢ reachPos (restCfg c u v (p + k + 1)) (restCfg c (u + 1 + k) (v + 1 + k) p)
exact reachPos_trans hfirst hrest All goals completed! 🐙Counter Decrement, Stage Advance & Halting Equivalence
private def postDecCfg (c' x z : ℕ) : Cfg 41 2 :=
⟨35, Tape.mk' B0 (ones c' ((ones x ((ones z B0).cons 0)).cons 0))⟩private theorem rest_exit (c' x z : ℕ) :
reachPos (restCfg (c' + 1) x z 0) (postDecCfg c' x z) := by c':ℕx:ℕz:ℕ⊢ reachPos (restCfg (c' + 1) x z 0) (postDecCfg c' x z)
unfold restCfg postDecCfg c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 30,
tape :=
Tape.mk' (ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0)))))
(ListBlank.cons 0 (ones (2 * 0) B0)) }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
rw [Nat.mul_zero, c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 30,
tape :=
Tape.mk' (ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0)))))
(ListBlank.cons 0 (ones 0 B0)) }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) } ones_zero, c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 30,
tape := Tape.mk' (ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0))))) (ListBlank.cons 0 B0) }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) } B0_cons_zero, c':ℕx:ℕz:ℕ⊢ reachPos { state := 30, tape := Tape.mk' (ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0))))) B0 }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) } ErdosTernary15.Tape.mk'_B0 c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 30,
tape :=
{ head := 0, left := ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0)))), right := B0 } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }] c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 30,
tape :=
{ head := 0, left := ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0)))), right := B0 } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
refine step_then_reachPos (tr30_0 _ _) ?_ c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 31,
tape := Tape.mk' (ListBlank.cons 1 (ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0)))))) B0 }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
rw [ErdosTernary15.Tape.mk'_B0 c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 31,
tape :=
{ head := 0, left := ListBlank.cons 1 (ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0))))),
right := B0 } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }] c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 31,
tape :=
{ head := 0, left := ListBlank.cons 1 (ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0))))),
right := B0 } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
refine step_then_reachPos (tr31_0 _ _) ?_ c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 26,
tape :=
mkL (ListBlank.cons 1 (ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0))))))
(ListBlank.cons 0 B0) }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
rw [B0_cons_zero, c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 26,
tape := mkL (ListBlank.cons 1 (ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0)))))) B0 }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) } ErdosTernary15.Tape.mkL_cons c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 26,
tape :=
{ head := 1, left := ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0)))), right := B0 } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }] c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 26,
tape :=
{ head := 1, left := ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0)))), right := B0 } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
refine step_then_reachPos (tr26_1 _ _) ?_ c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 32,
tape := mkL (ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0))))) (ListBlank.cons 0 B0) }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
rw [B0_cons_zero c':ℕx:ℕz:ℕ⊢ reachPos { state := 32, tape := mkL (ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0))))) B0 }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }] c':ℕx:ℕz:ℕ⊢ reachPos { state := 32, tape := mkL (ones z (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0))))) B0 }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
refine nSteps_then_reachPos (sweep1L tr32_1 z _ B0) ?_ c':ℕx:ℕz:ℕ⊢ reachPos { state := 32, tape := mkL (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c' + 1) B0)))) (ones z B0) }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
rw [ErdosTernary15.Tape.mkL_cons c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 32, tape := { head := 0, left := ones x (ListBlank.cons 0 (ones (c' + 1) B0)), right := ones z B0 } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }] c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 32, tape := { head := 0, left := ones x (ListBlank.cons 0 (ones (c' + 1) B0)), right := ones z B0 } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
refine step_then_reachPos (tr32_0 _ _) ?_ c':ℕx:ℕz:ℕ⊢ reachPos { state := 33, tape := mkL (ones x (ListBlank.cons 0 (ones (c' + 1) B0))) (ListBlank.cons 0 (ones z B0)) }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
refine nSteps_then_reachPos (sweep1L tr33_1 x _ _) ?_ c':ℕx:ℕz:ℕ⊢ reachPos { state := 33, tape := mkL (ListBlank.cons 0 (ones (c' + 1) B0)) (ones x (ListBlank.cons 0 (ones z B0))) }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
rw [ErdosTernary15.Tape.mkL_cons c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 33, tape := { head := 0, left := ones (c' + 1) B0, right := ones x (ListBlank.cons 0 (ones z B0)) } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }] c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 33, tape := { head := 0, left := ones (c' + 1) B0, right := ones x (ListBlank.cons 0 (ones z B0)) } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
refine step_then_reachPos (tr33_0 _ _) ?_ c':ℕx:ℕz:ℕ⊢ reachPos { state := 34, tape := mkL (ones (c' + 1) B0) (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
refine nSteps_then_reachPos (sweep1L tr34_1 (c' + 1) B0 _) ?_ c':ℕx:ℕz:ℕ⊢ reachPos { state := 34, tape := mkL B0 (ones (c' + 1) (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
rw [mkL_B0 c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 34,
tape :=
{ head := 0, left := B0, right := ones (c' + 1) (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }] c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 34,
tape :=
{ head := 0, left := B0, right := ones (c' + 1) (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
refine step_then_reachPos (tr34_0 _ _) ?_ c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 3,
tape := Tape.mk' (ListBlank.cons 0 B0) (ones (c' + 1) (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
rw [B0_cons_zero, c':ℕx:ℕz:ℕ⊢ reachPos { state := 3, tape := Tape.mk' B0 (ones (c' + 1) (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) } ones_succ c' _, c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 3,
tape := Tape.mk' B0 (ListBlank.cons 1 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))))) }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) } ErdosTernary15.Tape.mk'_cons c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 3,
tape := { head := 1, left := B0, right := ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }] c':ℕx:ℕz:ℕ⊢ reachPos
{ state := 3,
tape := { head := 1, left := B0, right := ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
have h3 := tr3_1 B0 (ones c' ((ones x ((ones z B0).cons 0)).cons 0)) c':ℕx:ℕz:ℕh3:step weakCollatz41
{ state := 3,
tape := { head := 1, left := B0, right := ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) } } =
some
{ state := 35,
tape := Tape.mk' (ListBlank.cons 0 B0) (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }⊢ reachPos
{ state := 3,
tape := { head := 1, left := B0, right := ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
rw [B0_cons_zero c':ℕx:ℕz:ℕh3:step weakCollatz41
{ state := 3,
tape := { head := 1, left := B0, right := ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) } } =
some { state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }⊢ reachPos
{ state := 3,
tape := { head := 1, left := B0, right := ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }] at h3 c':ℕx:ℕz:ℕh3:step weakCollatz41
{ state := 3,
tape := { head := 1, left := B0, right := ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) } } =
some { state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }⊢ reachPos
{ state := 3,
tape := { head := 1, left := B0, right := ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) } }
{ state := 35, tape := Tape.mk' B0 (ones c' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
exact reachPos_step h3 All goals completed! 🐙private theorem postDec_continue (c'' x z : ℕ) :
reachPos (postDecCfg (c'' + 1) x z) (stageCfg (c'' + 1) x z) := by c'':ℕx:ℕz:ℕ⊢ reachPos (postDecCfg (c'' + 1) x z) (stageCfg (c'' + 1) x z)
unfold postDecCfg stageCfg baseCX c'':ℕx:ℕz:ℕ⊢ reachPos
{ state := 35, tape := Tape.mk' B0 (ones (c'' + 1) (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c'' + 1) B0)))) (ones z B0) }
rw [ones_succ c'' _, c'':ℕx:ℕz:ℕ⊢ reachPos
{ state := 35,
tape := Tape.mk' B0 (ListBlank.cons 1 (ones c'' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))))) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c'' + 1) B0)))) (ones z B0) } ErdosTernary15.Tape.mk'_cons c'':ℕx:ℕz:ℕ⊢ reachPos
{ state := 35,
tape := { head := 1, left := B0, right := ones c'' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c'' + 1) B0)))) (ones z B0) }] c'':ℕx:ℕz:ℕ⊢ reachPos
{ state := 35,
tape := { head := 1, left := B0, right := ones c'' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c'' + 1) B0)))) (ones z B0) }
refine step_then_reachPos (tr35_1 _ _) ?_ c'':ℕx:ℕz:ℕ⊢ reachPos
{ state := 36,
tape := Tape.mk' (ListBlank.cons 1 B0) (ones c'' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c'' + 1) B0)))) (ones z B0) }
change reachPos ⟨36, Tape.mk' (ones 1 B0) (ones c'' ((ones x ((ones z B0).cons 0)).cons 0))⟩ _ c'':ℕx:ℕz:ℕ⊢ reachPos
{ state := 36, tape := Tape.mk' (ones 1 B0) (ones c'' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c'' + 1) B0)))) (ones z B0) }
refine nSteps_then_reachPos (sweep1R tr36_1 c'' _ _) ?_ c'':ℕx:ℕz:ℕ⊢ reachPos
{ state := 36, tape := Tape.mk' (ones c'' (ones 1 B0)) (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c'' + 1) B0)))) (ones z B0) }
rw [← ones_add c'' 1 B0, c'':ℕx:ℕz:ℕ⊢ reachPos
{ state := 36, tape := Tape.mk' (ones (c'' + 1) B0) (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c'' + 1) B0)))) (ones z B0) } ErdosTernary15.Tape.mk'_cons c'':ℕx:ℕz:ℕ⊢ reachPos
{ state := 36, tape := { head := 0, left := ones (c'' + 1) B0, right := ones x (ListBlank.cons 0 (ones z B0)) } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c'' + 1) B0)))) (ones z B0) }] c'':ℕx:ℕz:ℕ⊢ reachPos
{ state := 36, tape := { head := 0, left := ones (c'' + 1) B0, right := ones x (ListBlank.cons 0 (ones z B0)) } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c'' + 1) B0)))) (ones z B0) }
refine step_then_reachPos (tr36_0 _ _) ?_ c'':ℕx:ℕz:ℕ⊢ reachPos
{ state := 37, tape := Tape.mk' (ListBlank.cons 0 (ones (c'' + 1) B0)) (ones x (ListBlank.cons 0 (ones z B0))) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c'' + 1) B0)))) (ones z B0) }
refine nSteps_then_reachPos (sweep1R tr37_1 x _ _) ?_ c'':ℕx:ℕz:ℕ⊢ reachPos
{ state := 37, tape := Tape.mk' (ones x (ListBlank.cons 0 (ones (c'' + 1) B0))) (ListBlank.cons 0 (ones z B0)) }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c'' + 1) B0)))) (ones z B0) }
rw [ErdosTernary15.Tape.mk'_cons c'':ℕx:ℕz:ℕ⊢ reachPos
{ state := 37, tape := { head := 0, left := ones x (ListBlank.cons 0 (ones (c'' + 1) B0)), right := ones z B0 } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c'' + 1) B0)))) (ones z B0) }] c'':ℕx:ℕz:ℕ⊢ reachPos
{ state := 37, tape := { head := 0, left := ones x (ListBlank.cons 0 (ones (c'' + 1) B0)), right := ones z B0 } }
{ state := 12, tape := Tape.mk' (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones (c'' + 1) B0)))) (ones z B0) }
exact reachPos_step (tr37_0 _ _) All goals completed! 🐙private theorem postDec_advance (x z : ℕ) (hx : 3 ≤ x) :
reachPos (postDecCfg 0 x z) (stageCfg (x + 1) (x + 1) (x + 1)) := by x:ℕz:ℕhx:3 ≤ x⊢ reachPos (postDecCfg 0 x z) (stageCfg (x + 1) (x + 1) (x + 1))
unfold postDecCfg x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 35, tape := Tape.mk' B0 (ones 0 (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0))))) }
(stageCfg (x + 1) (x + 1) (x + 1))
rw [ones_zero, x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 35, tape := Tape.mk' B0 (ListBlank.cons 0 (ones x (ListBlank.cons 0 (ones z B0)))) }
(stageCfg (x + 1) (x + 1) (x + 1)) ErdosTernary15.Tape.mk'_cons x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 35, tape := { head := 0, left := B0, right := ones x (ListBlank.cons 0 (ones z B0)) } }
(stageCfg (x + 1) (x + 1) (x + 1))] x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 35, tape := { head := 0, left := B0, right := ones x (ListBlank.cons 0 (ones z B0)) } }
(stageCfg (x + 1) (x + 1) (x + 1))
refine step_then_reachPos (tr35_0 _ _) ?_ x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 38, tape := Tape.mk' (ListBlank.cons 1 B0) (ones x (ListBlank.cons 0 (ones z B0))) }
(stageCfg (x + 1) (x + 1) (x + 1))
change reachPos ⟨38, Tape.mk' (ones 1 B0) (ones x ((ones z B0).cons 0))⟩ _ x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 38, tape := Tape.mk' (ones 1 B0) (ones x (ListBlank.cons 0 (ones z B0))) }
(stageCfg (x + 1) (x + 1) (x + 1))
refine nSteps_then_reachPos (sweep1R tr38_1 x _ _) ?_ x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 38, tape := Tape.mk' (ones x (ones 1 B0)) (ListBlank.cons 0 (ones z B0)) }
(stageCfg (x + 1) (x + 1) (x + 1))
rw [← ones_add x 1 B0, x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 38, tape := Tape.mk' (ones (x + 1) B0) (ListBlank.cons 0 (ones z B0)) }
(stageCfg (x + 1) (x + 1) (x + 1)) ErdosTernary15.Tape.mk'_cons x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 38, tape := { head := 0, left := ones (x + 1) B0, right := ones z B0 } }
(stageCfg (x + 1) (x + 1) (x + 1))] x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 38, tape := { head := 0, left := ones (x + 1) B0, right := ones z B0 } }
(stageCfg (x + 1) (x + 1) (x + 1))
refine step_then_reachPos (tr38_0 _ _) ?_ x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 39, tape := Tape.mk' (ListBlank.cons 0 (ones (x + 1) B0)) (ones z B0) }
(stageCfg (x + 1) (x + 1) (x + 1))
refine nSteps_then_reachPos (sweep1R tr39_1 z _ B0) ?_ x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 39, tape := Tape.mk' (ones z (ListBlank.cons 0 (ones (x + 1) B0))) B0 }
(stageCfg (x + 1) (x + 1) (x + 1))
rw [ErdosTernary15.Tape.mk'_B0 x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 39, tape := { head := 0, left := ones z (ListBlank.cons 0 (ones (x + 1) B0)), right := B0 } }
(stageCfg (x + 1) (x + 1) (x + 1))] x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 39, tape := { head := 0, left := ones z (ListBlank.cons 0 (ones (x + 1) B0)), right := B0 } }
(stageCfg (x + 1) (x + 1) (x + 1))
refine step_then_reachPos (tr39_0 _ _) ?_ x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 40, tape := mkL (ones z (ListBlank.cons 0 (ones (x + 1) B0))) (ListBlank.cons 0 B0) }
(stageCfg (x + 1) (x + 1) (x + 1))
rw [B0_cons_zero x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 40, tape := mkL (ones z (ListBlank.cons 0 (ones (x + 1) B0))) B0 }
(stageCfg (x + 1) (x + 1) (x + 1))] x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 40, tape := mkL (ones z (ListBlank.cons 0 (ones (x + 1) B0))) B0 }
(stageCfg (x + 1) (x + 1) (x + 1))
refine nSteps_then_reachPos (erase1L tr40_1 z ((ones (x + 1) B0).cons 0)) ?_ x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 40, tape := mkL (ListBlank.cons 0 (ones (x + 1) B0)) B0 } (stageCfg (x + 1) (x + 1) (x + 1))
rw [ErdosTernary15.Tape.mkL_cons x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 40, tape := { head := 0, left := ones (x + 1) B0, right := B0 } } (stageCfg (x + 1) (x + 1) (x + 1))] x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 40, tape := { head := 0, left := ones (x + 1) B0, right := B0 } } (stageCfg (x + 1) (x + 1) (x + 1))
refine step_then_reachPos (tr40_0 _ _) ?_ x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 2, tape := mkL (ones (x + 1) B0) (ListBlank.cons 0 B0) } (stageCfg (x + 1) (x + 1) (x + 1))
rw [B0_cons_zero x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 2, tape := mkL (ones (x + 1) B0) B0 } (stageCfg (x + 1) (x + 1) (x + 1))] x:ℕz:ℕhx:3 ≤ x⊢ reachPos { state := 2, tape := mkL (ones (x + 1) B0) B0 } (stageCfg (x + 1) (x + 1) (x + 1))
have htr : (⟨2, mkL (ones (x + 1) B0) B0⟩ : Cfg 41 2) = tripleCfg 0 (x + 1) := by x:ℕz:ℕhx:3 ≤ x⊢ reachPos (postDecCfg 0 x z) (stageCfg (x + 1) (x + 1) (x + 1))
simp only [tripleCfg, ones_zero, B0_cons_zero] x:ℕz:ℕhx:3 ≤ xhtr:{ state := 2, tape := mkL (ones (x + 1) B0) B0 } = tripleCfg 0 (x + 1)⊢ reachPos { state := 2, tape := mkL (ones (x + 1) B0) B0 } (stageCfg (x + 1) (x + 1) (x + 1))
rw [htr x:ℕz:ℕhx:3 ≤ xhtr:{ state := 2, tape := mkL (ones (x + 1) B0) B0 } = tripleCfg 0 (x + 1)⊢ reachPos (tripleCfg 0 (x + 1)) (stageCfg (x + 1) (x + 1) (x + 1))] x:ℕz:ℕhx:3 ≤ xhtr:{ state := 2, tape := mkL (ones (x + 1) B0) B0 } = tripleCfg 0 (x + 1)⊢ reachPos (tripleCfg 0 (x + 1)) (stageCfg (x + 1) (x + 1) (x + 1))
have hfin := triple_from_zero (x - 1) x:ℕz:ℕhx:3 ≤ xhtr:{ state := 2, tape := mkL (ones (x + 1) B0) B0 } = tripleCfg 0 (x + 1)hfin:reachPos (tripleCfg 0 (x - 1 + 2)) (stageCfg (x - 1 + 2) (x - 1 + 2) (x - 1 + 2))⊢ reachPos (tripleCfg 0 (x + 1)) (stageCfg (x + 1) (x + 1) (x + 1))
rw [show (x - 1) + 2 = x + 1 by x:ℕz:ℕhx:3 ≤ x⊢ reachPos (postDecCfg 0 x z) (stageCfg (x + 1) (x + 1) (x + 1)) omega All goals completed! 🐙] at hfin x:ℕz:ℕhx:3 ≤ xhtr:{ state := 2, tape := mkL (ones (x + 1) B0) B0 } = tripleCfg 0 (x + 1)hfin:reachPos (tripleCfg 0 (x + 1)) (stageCfg (x + 1) (x + 1) (x + 1))⊢ reachPos (tripleCfg 0 (x + 1)) (stageCfg (x + 1) (x + 1) (x + 1))
exact hfin All goals completed! 🐙private theorem stage_round_halt (c x y : ℕ) (_hc : 1 ≤ c) (hx : 3 ≤ x) (hy : 1 ≤ y)
(hhit : terras y = x) :
∃ s cfg, nSteps weakCollatz41 s (stageCfg c x y) = some cfg ∧
step weakCollatz41 cfg = none := by c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = x⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg c x y) = some cfg ∧ step weakCollatz41 cfg = none
have hcmp1 := terras_to_cmp1 c x y hx hy c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg c x y) (cmpCfg c (x - 1) (terras y - 1) 1)⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg c x y) = some cfg ∧ step weakCollatz41 cfg = none
rw [hhit c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg c x y) (cmpCfg c (x - 1) (x - 1) 1)⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg c x y) = some cfg ∧ step weakCollatz41 cfg = none] at hcmp1 c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg c x y) (cmpCfg c (x - 1) (x - 1) 1)⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg c x y) = some cfg ∧ step weakCollatz41 cfg = none
have hmany : reachPos (cmpCfg c (x - 1) (x - 1) 1) (cmpCfg c 0 0 x) := by
have heq := cmp_many c 0 0 1 (x - 1) c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg c x y) (cmpCfg c (x - 1) (x - 1) 1)heq:x - 1 = 0 ∨ reachPos (cmpCfg c (0 + (x - 1)) (0 + (x - 1)) 1) (cmpCfg c 0 0 (1 + (x - 1)))⊢ reachPos (cmpCfg c (x - 1) (x - 1) 1) (cmpCfg c 0 0 x)
rcases heq with h0 | hp inl c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg c x y) (cmpCfg c (x - 1) (x - 1) 1)h0:x - 1 = 0⊢ reachPos (cmpCfg c (x - 1) (x - 1) 1) (cmpCfg c 0 0 x)inr c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg c x y) (cmpCfg c (x - 1) (x - 1) 1)hp:reachPos (cmpCfg c (0 + (x - 1)) (0 + (x - 1)) 1) (cmpCfg c 0 0 (1 + (x - 1)))⊢ reachPos (cmpCfg c (x - 1) (x - 1) 1) (cmpCfg c 0 0 x)
· inl c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg c x y) (cmpCfg c (x - 1) (x - 1) 1)h0:x - 1 = 0⊢ reachPos (cmpCfg c (x - 1) (x - 1) 1) (cmpCfg c 0 0 x) exfalso inl c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg c x y) (cmpCfg c (x - 1) (x - 1) 1)h0:x - 1 = 0⊢ False; omega All goals completed! 🐙
· inr c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg c x y) (cmpCfg c (x - 1) (x - 1) 1)hp:reachPos (cmpCfg c (0 + (x - 1)) (0 + (x - 1)) 1) (cmpCfg c 0 0 (1 + (x - 1)))⊢ reachPos (cmpCfg c (x - 1) (x - 1) 1) (cmpCfg c 0 0 x) rw [Nat.zero_add, inr c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg c x y) (cmpCfg c (x - 1) (x - 1) 1)hp:reachPos (cmpCfg c (x - 1) (x - 1) 1) (cmpCfg c 0 0 (1 + (x - 1)))⊢ reachPos (cmpCfg c (x - 1) (x - 1) 1) (cmpCfg c 0 0 x) show 1 + (x - 1) = x by c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = x⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg c x y) = some cfg ∧ step weakCollatz41 cfg = none omega All goals completed! 🐙] at hp inr c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg c x y) (cmpCfg c (x - 1) (x - 1) 1)hp:reachPos (cmpCfg c (x - 1) (x - 1) 1) (cmpCfg c 0 0 x)⊢ reachPos (cmpCfg c (x - 1) (x - 1) 1) (cmpCfg c 0 0 x)
exact hp c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg c x y) (cmpCfg c (x - 1) (x - 1) 1)hmany:reachPos (cmpCfg c (x - 1) (x - 1) 1) (cmpCfg c 0 0 x)⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg c x y) = some cfg ∧ step weakCollatz41 cfg = none
obtain ⟨s₁, _, hs₁⟩ := reachPos_trans hcmp1 hmany c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg c x y) (cmpCfg c (x - 1) (x - 1) 1)hmany:reachPos (cmpCfg c (x - 1) (x - 1) 1) (cmpCfg c 0 0 x)s₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz41 s₁ (stageCfg c x y) = some (cmpCfg c 0 0 x)⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg c x y) = some cfg ∧ step weakCollatz41 cfg = none
obtain ⟨s₂, cfg, hs₂, hnone⟩ := cmp_halt_eq c x c:ℕx:ℕy:ℕ_hc:1 ≤ chx:3 ≤ xhy:1 ≤ yhhit:terras y = xhcmp1:reachPos (stageCfg c x y) (cmpCfg c (x - 1) (x - 1) 1)hmany:reachPos (cmpCfg c (x - 1) (x - 1) 1) (cmpCfg c 0 0 x)s₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz41 s₁ (stageCfg c x y) = some (cmpCfg c 0 0 x)s₂:ℕcfg:Cfg 41 2hs₂:nSteps weakCollatz41 s₂ (cmpCfg c 0 0 x) = some cfghnone:step weakCollatz41 cfg = none⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg c x y) = some cfg ∧ step weakCollatz41 cfg = none
exact ⟨s₁ + s₂, cfg, nSteps_bind_eq hs₁ hs₂, hnone⟩ All goals completed! 🐙private theorem stage_round_mismatch (c' x y : ℕ) (hx : 3 ≤ x) (hy : 1 ≤ y)
(hne : terras y ≠ x) :
reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y)) := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y))
let z := terras y c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras y⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y))
have hz : 1 ≤ z := terras_pos_of_pos hy c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ z⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y))
refine reachPos_trans (terras_to_cmp1 (c' + 1) x y hx hy) ?_ c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ z⊢ reachPos (cmpCfg (c' + 1) (x - 1) (terras y - 1) 1) (postDecCfg c' x (terras y))
have hto_rest0 : reachPos (cmpCfg (c' + 1) (x - 1) (z - 1) 1) (restCfg (c' + 1) x z 0) := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y))
rcases Nat.lt_or_ge z x with hlt | hge inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < x⊢ reachPos (cmpCfg (c' + 1) (x - 1) (z - 1) 1) (restCfg (c' + 1) x z 0)inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ x⊢ reachPos (cmpCfg (c' + 1) (x - 1) (z - 1) 1) (restCfg (c' + 1) x z 0)
· inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < x⊢ reachPos (cmpCfg (c' + 1) (x - 1) (z - 1) 1) (restCfg (c' + 1) x z 0) let q := z - 1 inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1⊢ reachPos (cmpCfg (c' + 1) (x - 1) (z - 1) 1) (restCfg (c' + 1) x z 0)
let uRem := x - z - 1 inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1⊢ reachPos (cmpCfg (c' + 1) (x - 1) (z - 1) 1) (restCfg (c' + 1) x z 0)
have hsub_x : x - 1 = (uRem + 1) + q := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y)) dsimp [uRem, q] c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1⊢ x - 1 = x - z - 1 + 1 + (z - 1); omega inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + q⊢ reachPos (cmpCfg (c' + 1) (x - 1) (z - 1) 1) (restCfg (c' + 1) x z 0)
have hsub_z : z - 1 = 0 + q := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y)) dsimp [q] c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + q⊢ z - 1 = 0 + (z - 1); omega inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + q⊢ reachPos (cmpCfg (c' + 1) (x - 1) (z - 1) 1) (restCfg (c' + 1) x z 0)
rw [hsub_x, inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + q⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (z - 1) 1) (restCfg (c' + 1) x z 0) hsub_z inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + q⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) x z 0)] inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + q⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) x z 0)
have hmid : reachPos (cmpCfg (c' + 1) ((uRem + 1) + q) (0 + q) 1)
(restCfg (c' + 1) (uRem + 1) 0 (q + 1)) := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y))
rcases cmp_many (c' + 1) (uRem + 1) 0 1 q with hq0 | hp inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhq0:q = 0⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhp:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (cmpCfg (c' + 1) (uRem + 1) 0 (1 + q))⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))
· inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhq0:q = 0⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) rw [hq0, inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhq0:q = 0⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + 0) (0 + 0) 1) (restCfg (c' + 1) (uRem + 1) 0 (0 + 1)) Nat.add_zero, inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhq0:q = 0⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + 0) (0 + 0) 1) (restCfg (c' + 1) (uRem + 1) 0 (0 + 1)) Nat.add_zero inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhq0:q = 0⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + 0) (0 + 0) 1) (restCfg (c' + 1) (uRem + 1) 0 (0 + 1))] inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhq0:q = 0⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + 0) (0 + 0) 1) (restCfg (c' + 1) (uRem + 1) 0 (0 + 1))
exact cmp_lt_to_rest (c' + 1) uRem 1 All goals completed! 🐙
· inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhp:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (cmpCfg (c' + 1) (uRem + 1) 0 (1 + q))⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) rw [show 1 + q = q + 1 by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y)) omega All goals completed! 🐙] at hp inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhp:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (cmpCfg (c' + 1) (uRem + 1) 0 (q + 1))⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))
exact reachPos_trans hp (cmp_lt_to_rest (c' + 1) uRem (q + 1)) inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) x z 0)
rcases rest_many (c' + 1) (uRem + 1) 0 0 (q + 1) with h0 | hrm inl.inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))h0:q + 1 = 0⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) x z 0)inl.inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (c' + 1) (uRem + 1) 0 (0 + (q + 1))) (restCfg (c' + 1) (uRem + 1 + (q + 1)) (0 + (q + 1)) 0)⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) x z 0)
· inl.inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))h0:q + 1 = 0⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) x z 0) exfalso inl.inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))h0:q + 1 = 0⊢ False; omega All goals completed! 🐙
· inl.inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (c' + 1) (uRem + 1) 0 (0 + (q + 1))) (restCfg (c' + 1) (uRem + 1 + (q + 1)) (0 + (q + 1)) 0)⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) x z 0) have hrm' : reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x z 0) := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y))
have heq1 : 0 + (q + 1) = q + 1 := Nat.zero_add (q + 1) c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (c' + 1) (uRem + 1) 0 (0 + (q + 1))) (restCfg (c' + 1) (uRem + 1 + (q + 1)) (0 + (q + 1)) 0)heq1:0 + (q + 1) = q + 1⊢ reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x z 0)
have heq2 : uRem + 1 + (q + 1) = x := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y)) dsimp [uRem, q] c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (c' + 1) (uRem + 1) 0 (0 + (q + 1))) (restCfg (c' + 1) (uRem + 1 + (q + 1)) (0 + (q + 1)) 0)heq1:0 + (q + 1) = q + 1⊢ x - z - 1 + 1 + (z - 1 + 1) = x; omega c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (c' + 1) (uRem + 1) 0 (0 + (q + 1))) (restCfg (c' + 1) (uRem + 1 + (q + 1)) (0 + (q + 1)) 0)heq1:0 + (q + 1) = q + 1heq2:uRem + 1 + (q + 1) = x⊢ reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x z 0)
have heq3 : q + 1 = z := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y)) dsimp [q] c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (c' + 1) (uRem + 1) 0 (0 + (q + 1))) (restCfg (c' + 1) (uRem + 1 + (q + 1)) (0 + (q + 1)) 0)heq1:0 + (q + 1) = q + 1heq2:uRem + 1 + (q + 1) = x⊢ z - 1 + 1 = z; omega c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (c' + 1) (uRem + 1) 0 (0 + (q + 1))) (restCfg (c' + 1) (uRem + 1 + (q + 1)) (0 + (q + 1)) 0)heq1:0 + (q + 1) = q + 1heq2:uRem + 1 + (q + 1) = xheq3:q + 1 = z⊢ reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x z 0)
rw [heq1, c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) (uRem + 1 + (q + 1)) (q + 1) 0)heq1:0 + (q + 1) = q + 1heq2:uRem + 1 + (q + 1) = xheq3:q + 1 = z⊢ reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x z 0) heq2 c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x (q + 1) 0)heq1:0 + (q + 1) = q + 1heq2:uRem + 1 + (q + 1) = xheq3:q + 1 = z⊢ reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x z 0)] at hrm c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x (q + 1) 0)heq1:0 + (q + 1) = q + 1heq2:uRem + 1 + (q + 1) = xheq3:q + 1 = z⊢ reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x z 0)
have hfin_eq : restCfg (c' + 1) x (q + 1) 0 = restCfg (c' + 1) x z 0 := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y)) rw [heq3 c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x (q + 1) 0)heq1:0 + (q + 1) = q + 1heq2:uRem + 1 + (q + 1) = xheq3:q + 1 = z⊢ restCfg (c' + 1) x z 0 = restCfg (c' + 1) x z 0] c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x (q + 1) 0)heq1:0 + (q + 1) = q + 1heq2:uRem + 1 + (q + 1) = xheq3:q + 1 = zhfin_eq:restCfg (c' + 1) x (q + 1) 0 = restCfg (c' + 1) x z 0⊢ reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x z 0)
rw [← hfin_eq c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x (q + 1) 0)heq1:0 + (q + 1) = q + 1heq2:uRem + 1 + (q + 1) = xheq3:q + 1 = zhfin_eq:restCfg (c' + 1) x (q + 1) 0 = restCfg (c' + 1) x z 0⊢ reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x (q + 1) 0)] c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x (q + 1) 0)heq1:0 + (q + 1) = q + 1heq2:uRem + 1 + (q + 1) = xheq3:q + 1 = zhfin_eq:restCfg (c' + 1) x (q + 1) 0 = restCfg (c' + 1) x z 0⊢ reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x (q + 1) 0)
exact hrm inl.inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhlt:z < xq:ℕ := z - 1uRem:ℕ := x - z - 1hsub_x:x - 1 = uRem + 1 + qhsub_z:z - 1 = 0 + qhmid:reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) (uRem + 1) 0 (q + 1))hrm:reachPos (restCfg (c' + 1) (uRem + 1) 0 (0 + (q + 1))) (restCfg (c' + 1) (uRem + 1 + (q + 1)) (0 + (q + 1)) 0)hrm':reachPos (restCfg (c' + 1) (uRem + 1) 0 (q + 1)) (restCfg (c' + 1) x z 0)⊢ reachPos (cmpCfg (c' + 1) (uRem + 1 + q) (0 + q) 1) (restCfg (c' + 1) x z 0)
exact reachPos_trans hmid hrm' All goals completed! 🐙
· inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ x⊢ reachPos (cmpCfg (c' + 1) (x - 1) (z - 1) 1) (restCfg (c' + 1) x z 0) have hgt : x < z := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y)) omega inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < z⊢ reachPos (cmpCfg (c' + 1) (x - 1) (z - 1) 1) (restCfg (c' + 1) x z 0)
let q := x - 1 inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1⊢ reachPos (cmpCfg (c' + 1) (x - 1) (z - 1) 1) (restCfg (c' + 1) x z 0)
let vRem := z - x - 1 inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1⊢ reachPos (cmpCfg (c' + 1) (x - 1) (z - 1) 1) (restCfg (c' + 1) x z 0)
have hsub_x : x - 1 = 0 + q := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y)) dsimp [q] c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1⊢ x - 1 = 0 + (x - 1); omega inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + q⊢ reachPos (cmpCfg (c' + 1) (x - 1) (z - 1) 1) (restCfg (c' + 1) x z 0)
have hsub_z : z - 1 = (vRem + 1) + q := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y)) dsimp [vRem, q] c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + q⊢ z - 1 = z - x - 1 + 1 + (x - 1); omega inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + q⊢ reachPos (cmpCfg (c' + 1) (x - 1) (z - 1) 1) (restCfg (c' + 1) x z 0)
rw [hsub_x, inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + q⊢ reachPos (cmpCfg (c' + 1) (0 + q) (z - 1) 1) (restCfg (c' + 1) x z 0) hsub_z inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + q⊢ reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) x z 0)] inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + q⊢ reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) x z 0)
have hmid : reachPos (cmpCfg (c' + 1) (0 + q) ((vRem + 1) + q) 1)
(restCfg (c' + 1) 0 (vRem + 1) (q + 1)) := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y))
rcases cmp_many (c' + 1) 0 (vRem + 1) 1 q with hq0 | hp inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhq0:q = 0⊢ reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhp:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (cmpCfg (c' + 1) 0 (vRem + 1) (1 + q))⊢ reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))
· inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhq0:q = 0⊢ reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) exfalso inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhq0:q = 0⊢ False; dsimp [q] at hq0 inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhq0:x - 1 = 0⊢ False; omega All goals completed! 🐙
· inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhp:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (cmpCfg (c' + 1) 0 (vRem + 1) (1 + q))⊢ reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) rw [show 1 + q = q + 1 by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y)) omega All goals completed! 🐙] at hp inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhp:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (cmpCfg (c' + 1) 0 (vRem + 1) (q + 1))⊢ reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))
exact reachPos_trans hp (cmp_gt_to_rest (c' + 1) vRem (q + 1)) inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))⊢ reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) x z 0)
rcases rest_many (c' + 1) 0 (vRem + 1) 0 (q + 1) with h0 | hrm inr.inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))h0:q + 1 = 0⊢ reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) x z 0)inr.inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))hrm:reachPos (restCfg (c' + 1) 0 (vRem + 1) (0 + (q + 1))) (restCfg (c' + 1) (0 + (q + 1)) (vRem + 1 + (q + 1)) 0)⊢ reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) x z 0)
· inr.inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))h0:q + 1 = 0⊢ reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) x z 0) exfalso inr.inl c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))h0:q + 1 = 0⊢ False; omega All goals completed! 🐙
· inr.inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))hrm:reachPos (restCfg (c' + 1) 0 (vRem + 1) (0 + (q + 1))) (restCfg (c' + 1) (0 + (q + 1)) (vRem + 1 + (q + 1)) 0)⊢ reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) x z 0) have hrm' : reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) x z 0) := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y))
have heq1 : 0 + (q + 1) = q + 1 := Nat.zero_add (q + 1) c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))hrm:reachPos (restCfg (c' + 1) 0 (vRem + 1) (0 + (q + 1))) (restCfg (c' + 1) (0 + (q + 1)) (vRem + 1 + (q + 1)) 0)heq1:0 + (q + 1) = q + 1⊢ reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) x z 0)
have heq2 : vRem + 1 + (q + 1) = z := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y)) dsimp [vRem, q] c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))hrm:reachPos (restCfg (c' + 1) 0 (vRem + 1) (0 + (q + 1))) (restCfg (c' + 1) (0 + (q + 1)) (vRem + 1 + (q + 1)) 0)heq1:0 + (q + 1) = q + 1⊢ z - x - 1 + 1 + (x - 1 + 1) = z; omega c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))hrm:reachPos (restCfg (c' + 1) 0 (vRem + 1) (0 + (q + 1))) (restCfg (c' + 1) (0 + (q + 1)) (vRem + 1 + (q + 1)) 0)heq1:0 + (q + 1) = q + 1heq2:vRem + 1 + (q + 1) = z⊢ reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) x z 0)
have heq3 : q + 1 = x := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y)) dsimp [q] c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))hrm:reachPos (restCfg (c' + 1) 0 (vRem + 1) (0 + (q + 1))) (restCfg (c' + 1) (0 + (q + 1)) (vRem + 1 + (q + 1)) 0)heq1:0 + (q + 1) = q + 1heq2:vRem + 1 + (q + 1) = z⊢ x - 1 + 1 = x; omega c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))hrm:reachPos (restCfg (c' + 1) 0 (vRem + 1) (0 + (q + 1))) (restCfg (c' + 1) (0 + (q + 1)) (vRem + 1 + (q + 1)) 0)heq1:0 + (q + 1) = q + 1heq2:vRem + 1 + (q + 1) = zheq3:q + 1 = x⊢ reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) x z 0)
rw [heq1, c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))hrm:reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) (q + 1) (vRem + 1 + (q + 1)) 0)heq1:0 + (q + 1) = q + 1heq2:vRem + 1 + (q + 1) = zheq3:q + 1 = x⊢ reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) x z 0) heq2 c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))hrm:reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) (q + 1) z 0)heq1:0 + (q + 1) = q + 1heq2:vRem + 1 + (q + 1) = zheq3:q + 1 = x⊢ reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) x z 0)] at hrm c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))hrm:reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) (q + 1) z 0)heq1:0 + (q + 1) = q + 1heq2:vRem + 1 + (q + 1) = zheq3:q + 1 = x⊢ reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) x z 0)
have hfin_eq : restCfg (c' + 1) (q + 1) z 0 = restCfg (c' + 1) x z 0 := by c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ x⊢ reachPos (stageCfg (c' + 1) x y) (postDecCfg c' x (terras y)) rw [heq3 c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))hrm:reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) (q + 1) z 0)heq1:0 + (q + 1) = q + 1heq2:vRem + 1 + (q + 1) = zheq3:q + 1 = x⊢ restCfg (c' + 1) x z 0 = restCfg (c' + 1) x z 0] c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))hrm:reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) (q + 1) z 0)heq1:0 + (q + 1) = q + 1heq2:vRem + 1 + (q + 1) = zheq3:q + 1 = xhfin_eq:restCfg (c' + 1) (q + 1) z 0 = restCfg (c' + 1) x z 0⊢ reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) x z 0)
rw [← hfin_eq c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))hrm:reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) (q + 1) z 0)heq1:0 + (q + 1) = q + 1heq2:vRem + 1 + (q + 1) = zheq3:q + 1 = xhfin_eq:restCfg (c' + 1) (q + 1) z 0 = restCfg (c' + 1) x z 0⊢ reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) (q + 1) z 0)] c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))hrm:reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) (q + 1) z 0)heq1:0 + (q + 1) = q + 1heq2:vRem + 1 + (q + 1) = zheq3:q + 1 = xhfin_eq:restCfg (c' + 1) (q + 1) z 0 = restCfg (c' + 1) x z 0⊢ reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) (q + 1) z 0)
exact hrm inr.inr c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhge:z ≥ xhgt:x < zq:ℕ := x - 1vRem:ℕ := z - x - 1hsub_x:x - 1 = 0 + qhsub_z:z - 1 = vRem + 1 + qhmid:reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) 0 (vRem + 1) (q + 1))hrm:reachPos (restCfg (c' + 1) 0 (vRem + 1) (0 + (q + 1))) (restCfg (c' + 1) (0 + (q + 1)) (vRem + 1 + (q + 1)) 0)hrm':reachPos (restCfg (c' + 1) 0 (vRem + 1) (q + 1)) (restCfg (c' + 1) x z 0)⊢ reachPos (cmpCfg (c' + 1) (0 + q) (vRem + 1 + q) 1) (restCfg (c' + 1) x z 0)
exact reachPos_trans hmid hrm' c':ℕx:ℕy:ℕhx:3 ≤ xhy:1 ≤ yhne:terras y ≠ xz:ℕ := terras yhz:1 ≤ zhto_rest0:reachPos (cmpCfg (c' + 1) (x - 1) (z - 1) 1) (restCfg (c' + 1) x z 0)⊢ reachPos (cmpCfg (c' + 1) (x - 1) (terras y - 1) 1) (postDecCfg c' x (terras y))
exact reachPos_trans hto_rest0 (rest_exit c' x z) All goals completed! 🐙private theorem terras_iterate_pos {y : ℕ} (hy : 1 ≤ y) (m : ℕ) : 1 ≤ terras^[m] y := by y:ℕhy:1 ≤ ym:ℕ⊢ 1 ≤ terras^[m] y
induction m generalizing y with
| zero => zero y:ℕhy:1 ≤ y⊢ 1 ≤ terras^[0] y exact hy All goals completed! 🐙
| succ m ih => succ m:ℕih:∀ {y : ℕ}, 1 ≤ y → 1 ≤ terras^[m] yy:ℕhy:1 ≤ y⊢ 1 ≤ terras^[m + 1] y
rw [Function.iterate_succ_apply succ m:ℕih:∀ {y : ℕ}, 1 ≤ y → 1 ≤ terras^[m] yy:ℕhy:1 ≤ y⊢ 1 ≤ terras^[m] (terras y)] succ m:ℕih:∀ {y : ℕ}, 1 ≤ y → 1 ≤ terras^[m] yy:ℕhy:1 ≤ y⊢ 1 ≤ terras^[m] (terras y)
exact ih (terras_pos_of_pos hy) All goals completed! 🐙private def StageClear (x m : ℕ) : Prop :=
∀ j : ℕ, 1 ≤ j → j ≤ m → terras^[j] x ≠ xprivate theorem stage_within_reach (x : ℕ) (hx : 3 ≤ x) (m : ℕ) (hm : m < x)
(hcl : StageClear x m) :
m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x)) := by x:ℕhx:3 ≤ xm:ℕhm:m < xhcl:StageClear x m⊢ m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))
induction m with
| zero => zero x:ℕhx:3 ≤ xhm:0 < xhcl:StageClear x 0⊢ 0 = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - 0) x (terras^[0] x)) exact Or.inl rfl All goals completed! 🐙
| succ m ih => succ x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)⊢ m + 1 = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - (m + 1)) x (terras^[m + 1] x))
refine Or.inr ?_ succ x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)⊢ reachPos (stageCfg x x x) (stageCfg (x - (m + 1)) x (terras^[m + 1] x))
rcases ih (by x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)⊢ m < x omega All goals completed! 🐙) (fun j hj1 hjm => hcl j hj1 (by x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)j:ℕhj1:1 ≤ jhjm:j ≤ m⊢ j ≤ m + 1 omega All goals completed! 🐙)) with rfl | hprev
· succ.inl x:ℕhx:3 ≤ xih:0 < x → StageClear x 0 → 0 = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - 0) x (terras^[0] x))hm:0 + 1 < xhcl:StageClear x (0 + 1)⊢ reachPos (stageCfg x x x) (stageCfg (x - (0 + 1)) x (terras^[0 + 1] x)) have hne1 : terras x ≠ x := hcl 1 le_rfl le_rfl succ.inl x:ℕhx:3 ≤ xih:0 < x → StageClear x 0 → 0 = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - 0) x (terras^[0] x))hm:0 + 1 < xhcl:StageClear x (0 + 1)hne1:terras x ≠ x⊢ reachPos (stageCfg x x x) (stageCfg (x - (0 + 1)) x (terras^[0 + 1] x))
have hchk := stage_round_mismatch (x - 1) x x hx (by x:ℕhx:3 ≤ xih:0 < x → StageClear x 0 → 0 = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - 0) x (terras^[0] x))hm:0 + 1 < xhcl:StageClear x (0 + 1)hne1:terras x ≠ x⊢ 1 ≤ x omega All goals completed! 🐙) hne1 succ.inl x:ℕhx:3 ≤ xih:0 < x → StageClear x 0 → 0 = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - 0) x (terras^[0] x))hm:0 + 1 < xhcl:StageClear x (0 + 1)hne1:terras x ≠ xhchk:reachPos (stageCfg (x - 1 + 1) x x) (postDecCfg (x - 1) x (terras x))⊢ reachPos (stageCfg x x x) (stageCfg (x - (0 + 1)) x (terras^[0 + 1] x))
rw [show x - 1 + 1 = x by x:ℕhx:3 ≤ xm:ℕhm:m < xhcl:StageClear x m⊢ m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x)) omega All goals completed! 🐙] at hchk succ.inl x:ℕhx:3 ≤ xih:0 < x → StageClear x 0 → 0 = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - 0) x (terras^[0] x))hm:0 + 1 < xhcl:StageClear x (0 + 1)hne1:terras x ≠ xhchk:reachPos (stageCfg x x x) (postDecCfg (x - 1) x (terras x))⊢ reachPos (stageCfg x x x) (stageCfg (x - (0 + 1)) x (terras^[0 + 1] x))
have hcont := postDec_continue (x - 2) x (terras x) succ.inl x:ℕhx:3 ≤ xih:0 < x → StageClear x 0 → 0 = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - 0) x (terras^[0] x))hm:0 + 1 < xhcl:StageClear x (0 + 1)hne1:terras x ≠ xhchk:reachPos (stageCfg x x x) (postDecCfg (x - 1) x (terras x))hcont:reachPos (postDecCfg (x - 2 + 1) x (terras x)) (stageCfg (x - 2 + 1) x (terras x))⊢ reachPos (stageCfg x x x) (stageCfg (x - (0 + 1)) x (terras^[0 + 1] x))
rw [show x - 2 + 1 = x - 1 by x:ℕhx:3 ≤ xm:ℕhm:m < xhcl:StageClear x m⊢ m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x)) omega All goals completed! 🐙] at hcont succ.inl x:ℕhx:3 ≤ xih:0 < x → StageClear x 0 → 0 = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - 0) x (terras^[0] x))hm:0 + 1 < xhcl:StageClear x (0 + 1)hne1:terras x ≠ xhchk:reachPos (stageCfg x x x) (postDecCfg (x - 1) x (terras x))hcont:reachPos (postDecCfg (x - 1) x (terras x)) (stageCfg (x - 1) x (terras x))⊢ reachPos (stageCfg x x x) (stageCfg (x - (0 + 1)) x (terras^[0 + 1] x))
rw [Nat.sub_one, succ.inl x:ℕhx:3 ≤ xih:0 < x → StageClear x 0 → 0 = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - 0) x (terras^[0] x))hm:0 + 1 < xhcl:StageClear x (0 + 1)hne1:terras x ≠ xhchk:reachPos (stageCfg x x x) (postDecCfg (x - 1) x (terras x))hcont:reachPos (postDecCfg (x - 1) x (terras x)) (stageCfg (x - 1) x (terras x))⊢ reachPos (stageCfg x x x) (stageCfg x.pred x (terras^[0 + 1] x)) Function.iterate_one succ.inl x:ℕhx:3 ≤ xih:0 < x → StageClear x 0 → 0 = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - 0) x (terras^[0] x))hm:0 + 1 < xhcl:StageClear x (0 + 1)hne1:terras x ≠ xhchk:reachPos (stageCfg x x x) (postDecCfg (x - 1) x (terras x))hcont:reachPos (postDecCfg (x - 1) x (terras x)) (stageCfg (x - 1) x (terras x))⊢ reachPos (stageCfg x x x) (stageCfg x.pred x (terras x))] succ.inl x:ℕhx:3 ≤ xih:0 < x → StageClear x 0 → 0 = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - 0) x (terras^[0] x))hm:0 + 1 < xhcl:StageClear x (0 + 1)hne1:terras x ≠ xhchk:reachPos (stageCfg x x x) (postDecCfg (x - 1) x (terras x))hcont:reachPos (postDecCfg (x - 1) x (terras x)) (stageCfg (x - 1) x (terras x))⊢ reachPos (stageCfg x x x) (stageCfg x.pred x (terras x))
exact reachPos_trans hchk hcont All goals completed! 🐙
· succ.inr x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))⊢ reachPos (stageCfg x x x) (stageCfg (x - (m + 1)) x (terras^[m + 1] x)) have hne : terras (terras^[m] x) ≠ x := by x:ℕhx:3 ≤ xm:ℕhm:m < xhcl:StageClear x m⊢ m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))
have hit : terras (terras^[m] x) = terras^[m + 1] x :=
(Function.iterate_succ_apply' terras m x).symm x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hit:terras (terras^[m] x) = terras^[m + 1] x⊢ terras (terras^[m] x) ≠ x
rw [hit x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hit:terras (terras^[m] x) = terras^[m + 1] x⊢ terras^[m + 1] x ≠ x] x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hit:terras (terras^[m] x) = terras^[m + 1] x⊢ terras^[m + 1] x ≠ x
exact hcl (m + 1) (by x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hit:terras (terras^[m] x) = terras^[m + 1] x⊢ 1 ≤ m + 1 omega All goals completed! 🐙) le_rfl succ.inr x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hne:terras (terras^[m] x) ≠ x⊢ reachPos (stageCfg x x x) (stageCfg (x - (m + 1)) x (terras^[m + 1] x))
have hy_pos : 1 ≤ terras^[m] x := terras_iterate_pos (by x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hne:terras (terras^[m] x) ≠ x⊢ 1 ≤ x omega All goals completed! 🐙) m succ.inr x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hne:terras (terras^[m] x) ≠ xhy_pos:1 ≤ terras^[m] x⊢ reachPos (stageCfg x x x) (stageCfg (x - (m + 1)) x (terras^[m + 1] x))
have hxm_eq : x - m = (x - (m + 1)) + 1 := by x:ℕhx:3 ≤ xm:ℕhm:m < xhcl:StageClear x m⊢ m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x)) omega succ.inr x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hne:terras (terras^[m] x) ≠ xhy_pos:1 ≤ terras^[m] xhxm_eq:x - m = x - (m + 1) + 1⊢ reachPos (stageCfg x x x) (stageCfg (x - (m + 1)) x (terras^[m + 1] x))
have hxm1_eq : x - (m + 1) = (x - (m + 2)) + 1 := by x:ℕhx:3 ≤ xm:ℕhm:m < xhcl:StageClear x m⊢ m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x)) omega succ.inr x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hne:terras (terras^[m] x) ≠ xhy_pos:1 ≤ terras^[m] xhxm_eq:x - m = x - (m + 1) + 1hxm1_eq:x - (m + 1) = x - (m + 2) + 1⊢ reachPos (stageCfg x x x) (stageCfg (x - (m + 1)) x (terras^[m + 1] x))
rw [hxm_eq succ.inr x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - (m + 1) + 1) x (terras^[m] x))hne:terras (terras^[m] x) ≠ xhy_pos:1 ≤ terras^[m] xhxm_eq:x - m = x - (m + 1) + 1hxm1_eq:x - (m + 1) = x - (m + 2) + 1⊢ reachPos (stageCfg x x x) (stageCfg (x - (m + 1)) x (terras^[m + 1] x))] at hprev succ.inr x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - (m + 1) + 1) x (terras^[m] x))hne:terras (terras^[m] x) ≠ xhy_pos:1 ≤ terras^[m] xhxm_eq:x - m = x - (m + 1) + 1hxm1_eq:x - (m + 1) = x - (m + 2) + 1⊢ reachPos (stageCfg x x x) (stageCfg (x - (m + 1)) x (terras^[m + 1] x))
have hchk := stage_round_mismatch (x - (m + 1)) x (terras^[m] x) hx hy_pos hne succ.inr x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - (m + 1) + 1) x (terras^[m] x))hne:terras (terras^[m] x) ≠ xhy_pos:1 ≤ terras^[m] xhxm_eq:x - m = x - (m + 1) + 1hxm1_eq:x - (m + 1) = x - (m + 2) + 1hchk:reachPos (stageCfg (x - (m + 1) + 1) x (terras^[m] x)) (postDecCfg (x - (m + 1)) x (terras (terras^[m] x)))⊢ reachPos (stageCfg x x x) (stageCfg (x - (m + 1)) x (terras^[m + 1] x))
rw [hxm1_eq succ.inr x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - (m + 2) + 1 + 1) x (terras^[m] x))hne:terras (terras^[m] x) ≠ xhy_pos:1 ≤ terras^[m] xhxm_eq:x - m = x - (m + 1) + 1hxm1_eq:x - (m + 1) = x - (m + 2) + 1hchk:reachPos (stageCfg (x - (m + 2) + 1 + 1) x (terras^[m] x)) (postDecCfg (x - (m + 2) + 1) x (terras (terras^[m] x)))⊢ reachPos (stageCfg x x x) (stageCfg (x - (m + 2) + 1) x (terras^[m + 1] x))] at hprev hchk ⊢ succ.inr x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - (m + 2) + 1 + 1) x (terras^[m] x))hne:terras (terras^[m] x) ≠ xhy_pos:1 ≤ terras^[m] xhxm_eq:x - m = x - (m + 1) + 1hxm1_eq:x - (m + 1) = x - (m + 2) + 1hchk:reachPos (stageCfg (x - (m + 2) + 1 + 1) x (terras^[m] x)) (postDecCfg (x - (m + 2) + 1) x (terras (terras^[m] x)))⊢ reachPos (stageCfg x x x) (stageCfg (x - (m + 2) + 1) x (terras^[m + 1] x))
have hcont := postDec_continue (x - (m + 2)) x (terras (terras^[m] x)) succ.inr x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - (m + 2) + 1 + 1) x (terras^[m] x))hne:terras (terras^[m] x) ≠ xhy_pos:1 ≤ terras^[m] xhxm_eq:x - m = x - (m + 1) + 1hxm1_eq:x - (m + 1) = x - (m + 2) + 1hchk:reachPos (stageCfg (x - (m + 2) + 1 + 1) x (terras^[m] x)) (postDecCfg (x - (m + 2) + 1) x (terras (terras^[m] x)))hcont:reachPos (postDecCfg (x - (m + 2) + 1) x (terras (terras^[m] x))) (stageCfg (x - (m + 2) + 1) x (terras (terras^[m] x)))⊢ reachPos (stageCfg x x x) (stageCfg (x - (m + 2) + 1) x (terras^[m + 1] x))
rw [Function.iterate_succ_apply' succ.inr x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - (m + 2) + 1 + 1) x (terras^[m] x))hne:terras (terras^[m] x) ≠ xhy_pos:1 ≤ terras^[m] xhxm_eq:x - m = x - (m + 1) + 1hxm1_eq:x - (m + 1) = x - (m + 2) + 1hchk:reachPos (stageCfg (x - (m + 2) + 1 + 1) x (terras^[m] x)) (postDecCfg (x - (m + 2) + 1) x (terras (terras^[m] x)))hcont:reachPos (postDecCfg (x - (m + 2) + 1) x (terras (terras^[m] x))) (stageCfg (x - (m + 2) + 1) x (terras (terras^[m] x)))⊢ reachPos (stageCfg x x x) (stageCfg (x - (m + 2) + 1) x (terras (terras^[m] x)))] succ.inr x:ℕhx:3 ≤ xm:ℕih:m < x → StageClear x m → m = 0 ∨ reachPos (stageCfg x x x) (stageCfg (x - m) x (terras^[m] x))hm:m + 1 < xhcl:StageClear x (m + 1)hprev:reachPos (stageCfg x x x) (stageCfg (x - (m + 2) + 1 + 1) x (terras^[m] x))hne:terras (terras^[m] x) ≠ xhy_pos:1 ≤ terras^[m] xhxm_eq:x - m = x - (m + 1) + 1hxm1_eq:x - (m + 1) = x - (m + 2) + 1hchk:reachPos (stageCfg (x - (m + 2) + 1 + 1) x (terras^[m] x)) (postDecCfg (x - (m + 2) + 1) x (terras (terras^[m] x)))hcont:reachPos (postDecCfg (x - (m + 2) + 1) x (terras (terras^[m] x))) (stageCfg (x - (m + 2) + 1) x (terras (terras^[m] x)))⊢ reachPos (stageCfg x x x) (stageCfg (x - (m + 2) + 1) x (terras (terras^[m] x)))
exact reachPos_trans hprev (reachPos_trans hchk hcont) All goals completed! 🐙private theorem stage_full_advance (x : ℕ) (hx : 3 ≤ x) (hcl : StageClear x x) :
reachPos (stageCfg x x x) (stageCfg (x + 1) (x + 1) (x + 1)) := by x:ℕhx:3 ≤ xhcl:StageClear x x⊢ reachPos (stageCfg x x x) (stageCfg (x + 1) (x + 1) (x + 1))
rcases stage_within_reach x hx (x - 1) (by x:ℕhx:3 ≤ xhcl:StageClear x x⊢ x - 1 < x omega All goals completed! 🐙)
(fun j hj1 hjm => hcl j hj1 (by x:ℕhx:3 ≤ xhcl:StageClear x xj:ℕhj1:1 ≤ jhjm:j ≤ x - 1⊢ j ≤ x omega All goals completed! 🐙)) with h0 | hprev
· inl x:ℕhx:3 ≤ xhcl:StageClear x xh0:x - 1 = 0⊢ reachPos (stageCfg x x x) (stageCfg (x + 1) (x + 1) (x + 1)) exfalso inl x:ℕhx:3 ≤ xhcl:StageClear x xh0:x - 1 = 0⊢ False; omega All goals completed! 🐙
· inr x:ℕhx:3 ≤ xhcl:StageClear x xhprev:reachPos (stageCfg x x x) (stageCfg (x - (x - 1)) x (terras^[x - 1] x))⊢ reachPos (stageCfg x x x) (stageCfg (x + 1) (x + 1) (x + 1)) rw [show x - (x - 1) = 1 by omega All goals completed! 🐙] at hprev inr x:ℕhx:3 ≤ xhcl:StageClear x xhprev:reachPos (stageCfg x x x) (stageCfg 1 x (terras^[x - 1] x))⊢ reachPos (stageCfg x x x) (stageCfg (x + 1) (x + 1) (x + 1))
have hne : terras (terras^[x - 1] x) ≠ x := by
have hit : terras (terras^[x - 1] x) = terras^[x] x := by x:ℕhx:3 ≤ xhcl:StageClear x x⊢ reachPos (stageCfg x x x) (stageCfg (x + 1) (x + 1) (x + 1))
rw [← Function.iterate_succ_apply' terras (x - 1) x, x:ℕhx:3 ≤ xhcl:StageClear x xhprev:reachPos (stageCfg x x x) (stageCfg 1 x (terras^[x - 1] x))⊢ terras^[(x - 1).succ] x = terras^[x] x show (x - 1).succ = x by x:ℕhx:3 ≤ xhcl:StageClear x x⊢ reachPos (stageCfg x x x) (stageCfg (x + 1) (x + 1) (x + 1)) omega All goals completed! 🐙] x:ℕhx:3 ≤ xhcl:StageClear x xhprev:reachPos (stageCfg x x x) (stageCfg 1 x (terras^[x - 1] x))hit:terras (terras^[x - 1] x) = terras^[x] x⊢ terras (terras^[x - 1] x) ≠ x
rw [hit x:ℕhx:3 ≤ xhcl:StageClear x xhprev:reachPos (stageCfg x x x) (stageCfg 1 x (terras^[x - 1] x))hit:terras (terras^[x - 1] x) = terras^[x] x⊢ terras^[x] x ≠ x] x:ℕhx:3 ≤ xhcl:StageClear x xhprev:reachPos (stageCfg x x x) (stageCfg 1 x (terras^[x - 1] x))hit:terras (terras^[x - 1] x) = terras^[x] x⊢ terras^[x] x ≠ x
exact hcl x (by x:ℕhx:3 ≤ xhcl:StageClear x xhprev:reachPos (stageCfg x x x) (stageCfg 1 x (terras^[x - 1] x))hit:terras (terras^[x - 1] x) = terras^[x] x⊢ 1 ≤ x omega All goals completed! 🐙) le_rfl inr x:ℕhx:3 ≤ xhcl:StageClear x xhprev:reachPos (stageCfg x x x) (stageCfg 1 x (terras^[x - 1] x))hne:terras (terras^[x - 1] x) ≠ x⊢ reachPos (stageCfg x x x) (stageCfg (x + 1) (x + 1) (x + 1))
have hy_pos : 1 ≤ terras^[x - 1] x := terras_iterate_pos (by x:ℕhx:3 ≤ xhcl:StageClear x xhprev:reachPos (stageCfg x x x) (stageCfg 1 x (terras^[x - 1] x))hne:terras (terras^[x - 1] x) ≠ x⊢ 1 ≤ x omega All goals completed! 🐙) (x - 1) inr x:ℕhx:3 ≤ xhcl:StageClear x xhprev:reachPos (stageCfg x x x) (stageCfg 1 x (terras^[x - 1] x))hne:terras (terras^[x - 1] x) ≠ xhy_pos:1 ≤ terras^[x - 1] x⊢ reachPos (stageCfg x x x) (stageCfg (x + 1) (x + 1) (x + 1))
have hchk := stage_round_mismatch 0 x (terras^[x - 1] x) hx hy_pos hne inr x:ℕhx:3 ≤ xhcl:StageClear x xhprev:reachPos (stageCfg x x x) (stageCfg 1 x (terras^[x - 1] x))hne:terras (terras^[x - 1] x) ≠ xhy_pos:1 ≤ terras^[x - 1] xhchk:reachPos (stageCfg (0 + 1) x (terras^[x - 1] x)) (postDecCfg 0 x (terras (terras^[x - 1] x)))⊢ reachPos (stageCfg x x x) (stageCfg (x + 1) (x + 1) (x + 1))
exact reachPos_trans hprev (reachPos_trans hchk (postDec_advance x _ hx)) All goals completed! 🐙private theorem stage_first_hit_halt (x j : ℕ) (hx : 3 ≤ x) (hj1 : 1 ≤ j) (hjx : j ≤ x)
(hcl : StageClear x (j - 1)) (hhit : terras^[j] x = x) :
∃ s cfg, nSteps weakCollatz41 s (stageCfg x x x) = some cfg ∧
step weakCollatz41 cfg = none := by x:ℕj:ℕhx:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhcl:StageClear x (j - 1)hhit:terras^[j] x = x⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg x x x) = some cfg ∧ step weakCollatz41 cfg = none
rcases Nat.eq_or_lt_of_le hj1 with rfl | hj_gt1 inl x:ℕhx:3 ≤ xhj1:1 ≤ 1hjx:1 ≤ xhcl:StageClear x (1 - 1)hhit:terras^[1] x = x⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg x x x) = some cfg ∧ step weakCollatz41 cfg = noneinr x:ℕj:ℕhx:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhcl:StageClear x (j - 1)hhit:terras^[j] x = xhj_gt1:1 < j⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg x x x) = some cfg ∧ step weakCollatz41 cfg = none
· inl x:ℕhx:3 ≤ xhj1:1 ≤ 1hjx:1 ≤ xhcl:StageClear x (1 - 1)hhit:terras^[1] x = x⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg x x x) = some cfg ∧ step weakCollatz41 cfg = none exact stage_round_halt x x x (by x:ℕhx:3 ≤ xhj1:1 ≤ 1hjx:1 ≤ xhcl:StageClear x (1 - 1)hhit:terras^[1] x = x⊢ 1 ≤ x omega All goals completed! 🐙) hx (by x:ℕhx:3 ≤ xhj1:1 ≤ 1hjx:1 ≤ xhcl:StageClear x (1 - 1)hhit:terras^[1] x = x⊢ 1 ≤ x omega All goals completed! 🐙) hhit
· inr x:ℕj:ℕhx:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhcl:StageClear x (j - 1)hhit:terras^[j] x = xhj_gt1:1 < j⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg x x x) = some cfg ∧ step weakCollatz41 cfg = none rcases stage_within_reach x hx (j - 1) (by x:ℕj:ℕhx:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhcl:StageClear x (j - 1)hhit:terras^[j] x = xhj_gt1:1 < j⊢ j - 1 < x omega All goals completed! 🐙) hcl with h0 | hprev
· inr.inl x:ℕj:ℕhx:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhcl:StageClear x (j - 1)hhit:terras^[j] x = xhj_gt1:1 < jh0:j - 1 = 0⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg x x x) = some cfg ∧ step weakCollatz41 cfg = none exfalso inr.inl x:ℕj:ℕhx:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhcl:StageClear x (j - 1)hhit:terras^[j] x = xhj_gt1:1 < jh0:j - 1 = 0⊢ False; omega All goals completed! 🐙
· inr.inr x:ℕj:ℕhx:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhcl:StageClear x (j - 1)hhit:terras^[j] x = xhj_gt1:1 < jhprev:reachPos (stageCfg x x x) (stageCfg (x - (j - 1)) x (terras^[j - 1] x))⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg x x x) = some cfg ∧ step weakCollatz41 cfg = none obtain ⟨s₁, _, hs₁⟩ := hprev inr.inr x:ℕj:ℕhx:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhcl:StageClear x (j - 1)hhit:terras^[j] x = xhj_gt1:1 < js₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz41 s₁ (stageCfg x x x) = some (stageCfg (x - (j - 1)) x (terras^[j - 1] x))⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg x x x) = some cfg ∧ step weakCollatz41 cfg = none
have hhit' : terras (terras^[j - 1] x) = x := by
rw [← Function.iterate_succ_apply' terras (j - 1) x, x:ℕj:ℕhx:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhcl:StageClear x (j - 1)hhit:terras^[j] x = xhj_gt1:1 < js₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz41 s₁ (stageCfg x x x) = some (stageCfg (x - (j - 1)) x (terras^[j - 1] x))⊢ terras^[(j - 1).succ] x = x show (j - 1).succ = j by x:ℕj:ℕhx:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhcl:StageClear x (j - 1)hhit:terras^[j] x = x⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg x x x) = some cfg ∧ step weakCollatz41 cfg = none omega All goals completed! 🐙] x:ℕj:ℕhx:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhcl:StageClear x (j - 1)hhit:terras^[j] x = xhj_gt1:1 < js₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz41 s₁ (stageCfg x x x) = some (stageCfg (x - (j - 1)) x (terras^[j - 1] x))⊢ terras^[j] x = x
exact hhit inr.inr x:ℕj:ℕhx:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhcl:StageClear x (j - 1)hhit:terras^[j] x = xhj_gt1:1 < js₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz41 s₁ (stageCfg x x x) = some (stageCfg (x - (j - 1)) x (terras^[j - 1] x))hhit':terras (terras^[j - 1] x) = x⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg x x x) = some cfg ∧ step weakCollatz41 cfg = none
obtain ⟨s₂, cfg, hs₂, hnone⟩ := stage_round_halt (x - (j - 1)) x (terras^[j - 1] x)
(by x:ℕj:ℕhx:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhcl:StageClear x (j - 1)hhit:terras^[j] x = xhj_gt1:1 < js₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz41 s₁ (stageCfg x x x) = some (stageCfg (x - (j - 1)) x (terras^[j - 1] x))hhit':terras (terras^[j - 1] x) = x⊢ 1 ≤ x - (j - 1) omega All goals completed! 🐙) hx (terras_iterate_pos (by x:ℕj:ℕhx:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhcl:StageClear x (j - 1)hhit:terras^[j] x = xhj_gt1:1 < js₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz41 s₁ (stageCfg x x x) = some (stageCfg (x - (j - 1)) x (terras^[j - 1] x))hhit':terras (terras^[j - 1] x) = x⊢ 1 ≤ x omega All goals completed! 🐙) (j - 1)) hhit' inr.inr x:ℕj:ℕhx:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhcl:StageClear x (j - 1)hhit:terras^[j] x = xhj_gt1:1 < js₁:ℕleft✝:1 ≤ s₁hs₁:nSteps weakCollatz41 s₁ (stageCfg x x x) = some (stageCfg (x - (j - 1)) x (terras^[j - 1] x))hhit':terras (terras^[j - 1] x) = xs₂:ℕcfg:Cfg 41 2hs₂:nSteps weakCollatz41 s₂ (stageCfg (x - (j - 1)) x (terras^[j - 1] x)) = some cfghnone:step weakCollatz41 cfg = none⊢ ∃ s cfg, nSteps weakCollatz41 s (stageCfg x x x) = some cfg ∧ step weakCollatz41 cfg = none
exact ⟨s₁ + s₂, cfg, nSteps_bind_eq hs₁ hs₂, hnone⟩ All goals completed! 🐙private theorem stageClear_or_first_hit (x m : ℕ) :
StageClear x m ∨ ∃ j : ℕ, 1 ≤ j ∧ j ≤ m ∧ StageClear x (j - 1) ∧ terras^[j] x = x := by x:ℕm:ℕ⊢ StageClear x m ∨ ∃ j, 1 ≤ j ∧ j ≤ m ∧ StageClear x (j - 1) ∧ terras^[j] x = x
induction m with
| zero => zero x:ℕ⊢ StageClear x 0 ∨ ∃ j, 1 ≤ j ∧ j ≤ 0 ∧ StageClear x (j - 1) ∧ terras^[j] x = x exact Or.inl fun j hj1 hj0 => absurd (le_trans hj1 hj0) (by x:ℕj:ℕhj1:1 ≤ jhj0:j ≤ 0⊢ ¬1 ≤ 0 decide All goals completed! 🐙)
| succ m ih => succ x:ℕm:ℕih:StageClear x m ∨ ∃ j, 1 ≤ j ∧ j ≤ m ∧ StageClear x (j - 1) ∧ terras^[j] x = x⊢ StageClear x (m + 1) ∨ ∃ j, 1 ≤ j ∧ j ≤ m + 1 ∧ StageClear x (j - 1) ∧ terras^[j] x = x
rcases ih with hcl | ⟨j, hj1, hjm, hcj, hhit⟩ succ.inl x:ℕm:ℕhcl:StageClear x m⊢ StageClear x (m + 1) ∨ ∃ j, 1 ≤ j ∧ j ≤ m + 1 ∧ StageClear x (j - 1) ∧ terras^[j] x = xsucc.inr x:ℕm:ℕj:ℕhj1:1 ≤ jhjm:j ≤ mhcj:StageClear x (j - 1)hhit:terras^[j] x = x⊢ StageClear x (m + 1) ∨ ∃ j, 1 ≤ j ∧ j ≤ m + 1 ∧ StageClear x (j - 1) ∧ terras^[j] x = x
· succ.inl x:ℕm:ℕhcl:StageClear x m⊢ StageClear x (m + 1) ∨ ∃ j, 1 ≤ j ∧ j ≤ m + 1 ∧ StageClear x (j - 1) ∧ terras^[j] x = x by_cases hhit : terras^[m + 1] x = x pos x:ℕm:ℕhcl:StageClear x mhhit:terras^[m + 1] x = x⊢ StageClear x (m + 1) ∨ ∃ j, 1 ≤ j ∧ j ≤ m + 1 ∧ StageClear x (j - 1) ∧ terras^[j] x = xneg x:ℕm:ℕhcl:StageClear x mhhit:¬terras^[m + 1] x = x⊢ StageClear x (m + 1) ∨ ∃ j, 1 ≤ j ∧ j ≤ m + 1 ∧ StageClear x (j - 1) ∧ terras^[j] x = x
· pos x:ℕm:ℕhcl:StageClear x mhhit:terras^[m + 1] x = x⊢ StageClear x (m + 1) ∨ ∃ j, 1 ≤ j ∧ j ≤ m + 1 ∧ StageClear x (j - 1) ∧ terras^[j] x = x exact Or.inr ⟨m + 1, by x:ℕm:ℕhcl:StageClear x mhhit:terras^[m + 1] x = x⊢ 1 ≤ m + 1 omega All goals completed! 🐙, le_rfl, hcl, hhit⟩
· neg x:ℕm:ℕhcl:StageClear x mhhit:¬terras^[m + 1] x = x⊢ StageClear x (m + 1) ∨ ∃ j, 1 ≤ j ∧ j ≤ m + 1 ∧ StageClear x (j - 1) ∧ terras^[j] x = x refine Or.inl fun j hj1 hjm1 => ?_ neg x:ℕm:ℕhcl:StageClear x mhhit:¬terras^[m + 1] x = xj:ℕhj1:1 ≤ jhjm1:j ≤ m + 1⊢ terras^[j] x ≠ x
rcases Nat.lt_or_ge j (m + 1) with hlt | hge neg.inl x:ℕm:ℕhcl:StageClear x mhhit:¬terras^[m + 1] x = xj:ℕhj1:1 ≤ jhjm1:j ≤ m + 1hlt:j < m + 1⊢ terras^[j] x ≠ xneg.inr x:ℕm:ℕhcl:StageClear x mhhit:¬terras^[m + 1] x = xj:ℕhj1:1 ≤ jhjm1:j ≤ m + 1hge:j ≥ m + 1⊢ terras^[j] x ≠ x
· neg.inl x:ℕm:ℕhcl:StageClear x mhhit:¬terras^[m + 1] x = xj:ℕhj1:1 ≤ jhjm1:j ≤ m + 1hlt:j < m + 1⊢ terras^[j] x ≠ x exact hcl j hj1 (by x:ℕm:ℕhcl:StageClear x mhhit:¬terras^[m + 1] x = xj:ℕhj1:1 ≤ jhjm1:j ≤ m + 1hlt:j < m + 1⊢ j ≤ m omega All goals completed! 🐙)
· neg.inr x:ℕm:ℕhcl:StageClear x mhhit:¬terras^[m + 1] x = xj:ℕhj1:1 ≤ jhjm1:j ≤ m + 1hge:j ≥ m + 1⊢ terras^[j] x ≠ x rw [show j = m + 1 by x:ℕm:ℕ⊢ StageClear x m ∨ ∃ j, 1 ≤ j ∧ j ≤ m ∧ StageClear x (j - 1) ∧ terras^[j] x = x omega All goals completed! 🐙] neg.inr x:ℕm:ℕhcl:StageClear x mhhit:¬terras^[m + 1] x = xj:ℕhj1:1 ≤ jhjm1:j ≤ m + 1hge:j ≥ m + 1⊢ terras^[m + 1] x ≠ x; exact hhit All goals completed! 🐙
· succ.inr x:ℕm:ℕj:ℕhj1:1 ≤ jhjm:j ≤ mhcj:StageClear x (j - 1)hhit:terras^[j] x = x⊢ StageClear x (m + 1) ∨ ∃ j, 1 ≤ j ∧ j ≤ m + 1 ∧ StageClear x (j - 1) ∧ terras^[j] x = x exact Or.inr ⟨j, hj1, by x:ℕm:ℕj:ℕhj1:1 ≤ jhjm:j ≤ mhcj:StageClear x (j - 1)hhit:terras^[j] x = x⊢ j ≤ m + 1 omega All goals completed! 🐙, hcj, hhit⟩private def AllClear (X : ℕ) : Prop :=
∀ x : ℕ, 3 ≤ x → x ≤ X → StageClear x xprivate theorem allClear_or_first_witness (X : ℕ) :
AllClear X ∨
∃ x j : ℕ, 3 ≤ x ∧ x ≤ X ∧ 1 ≤ j ∧ j ≤ x ∧
AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = x := by X:ℕ⊢ AllClear X ∨ ∃ x j, 3 ≤ x ∧ x ≤ X ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = x
induction X with
| zero => zero ⊢ AllClear 0 ∨ ∃ x j, 3 ≤ x ∧ x ≤ 0 ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = x exact Or.inl fun x hx3 hx0 => absurd (le_trans hx3 hx0) (by x:ℕhx3:3 ≤ xhx0:x ≤ 0⊢ ¬3 ≤ 0 decide All goals completed! 🐙)
| succ X ih => succ X:ℕih:AllClear X ∨ ∃ x j, 3 ≤ x ∧ x ≤ X ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = x⊢ AllClear (X + 1) ∨ ∃ x j, 3 ≤ x ∧ x ≤ X + 1 ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = x
rcases ih with hAll | ⟨x, j, hx3, hxX, hj1, hjx, hAllX, hStg, hhit⟩ succ.inl X:ℕhAll:AllClear X⊢ AllClear (X + 1) ∨ ∃ x j, 3 ≤ x ∧ x ≤ X + 1 ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = xsucc.inr X:ℕx:ℕj:ℕhx3:3 ≤ xhxX:x ≤ Xhj1:1 ≤ jhjx:j ≤ xhAllX:AllClear (x - 1)hStg:StageClear x (j - 1)hhit:terras^[j] x = x⊢ AllClear (X + 1) ∨ ∃ x j, 3 ≤ x ∧ x ≤ X + 1 ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = x
· succ.inl X:ℕhAll:AllClear X⊢ AllClear (X + 1) ∨ ∃ x j, 3 ≤ x ∧ x ≤ X + 1 ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = x by_cases hx3 : 3 ≤ X + 1 pos X:ℕhAll:AllClear Xhx3:3 ≤ X + 1⊢ AllClear (X + 1) ∨ ∃ x j, 3 ≤ x ∧ x ≤ X + 1 ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = xneg X:ℕhAll:AllClear Xhx3:¬3 ≤ X + 1⊢ AllClear (X + 1) ∨ ∃ x j, 3 ≤ x ∧ x ≤ X + 1 ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = x
· pos X:ℕhAll:AllClear Xhx3:3 ≤ X + 1⊢ AllClear (X + 1) ∨ ∃ x j, 3 ≤ x ∧ x ≤ X + 1 ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = x rcases stageClear_or_first_hit (X + 1) (X + 1) with hStg | ⟨j, hj1, hjx, hcj, hhit⟩ pos.inl X:ℕhAll:AllClear Xhx3:3 ≤ X + 1hStg:StageClear (X + 1) (X + 1)⊢ AllClear (X + 1) ∨ ∃ x j, 3 ≤ x ∧ x ≤ X + 1 ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = xpos.inr X:ℕhAll:AllClear Xhx3:3 ≤ X + 1j:ℕhj1:1 ≤ jhjx:j ≤ X + 1hcj:StageClear (X + 1) (j - 1)hhit:terras^[j] (X + 1) = X + 1⊢ AllClear (X + 1) ∨ ∃ x j, 3 ≤ x ∧ x ≤ X + 1 ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = x
· pos.inl X:ℕhAll:AllClear Xhx3:3 ≤ X + 1hStg:StageClear (X + 1) (X + 1)⊢ AllClear (X + 1) ∨ ∃ x j, 3 ≤ x ∧ x ≤ X + 1 ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = x refine Or.inl fun x hx_ge3 hx_le => ?_ pos.inl X:ℕhAll:AllClear Xhx3:3 ≤ X + 1hStg:StageClear (X + 1) (X + 1)x:ℕhx_ge3:3 ≤ xhx_le:x ≤ X + 1⊢ StageClear x x
rcases Nat.lt_or_ge x (X + 1) with hlt | hge pos.inl.inl X:ℕhAll:AllClear Xhx3:3 ≤ X + 1hStg:StageClear (X + 1) (X + 1)x:ℕhx_ge3:3 ≤ xhx_le:x ≤ X + 1hlt:x < X + 1⊢ StageClear x xpos.inl.inr X:ℕhAll:AllClear Xhx3:3 ≤ X + 1hStg:StageClear (X + 1) (X + 1)x:ℕhx_ge3:3 ≤ xhx_le:x ≤ X + 1hge:x ≥ X + 1⊢ StageClear x x
· pos.inl.inl X:ℕhAll:AllClear Xhx3:3 ≤ X + 1hStg:StageClear (X + 1) (X + 1)x:ℕhx_ge3:3 ≤ xhx_le:x ≤ X + 1hlt:x < X + 1⊢ StageClear x x exact hAll x hx_ge3 (by X:ℕhAll:AllClear Xhx3:3 ≤ X + 1hStg:StageClear (X + 1) (X + 1)x:ℕhx_ge3:3 ≤ xhx_le:x ≤ X + 1hlt:x < X + 1⊢ x ≤ X omega All goals completed! 🐙)
· pos.inl.inr X:ℕhAll:AllClear Xhx3:3 ≤ X + 1hStg:StageClear (X + 1) (X + 1)x:ℕhx_ge3:3 ≤ xhx_le:x ≤ X + 1hge:x ≥ X + 1⊢ StageClear x x rw [show x = X + 1 by X:ℕ⊢ AllClear X ∨ ∃ x j, 3 ≤ x ∧ x ≤ X ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = x omega All goals completed! 🐙] pos.inl.inr X:ℕhAll:AllClear Xhx3:3 ≤ X + 1hStg:StageClear (X + 1) (X + 1)x:ℕhx_ge3:3 ≤ xhx_le:x ≤ X + 1hge:x ≥ X + 1⊢ StageClear (X + 1) (X + 1); exact hStg All goals completed! 🐙
· pos.inr X:ℕhAll:AllClear Xhx3:3 ≤ X + 1j:ℕhj1:1 ≤ jhjx:j ≤ X + 1hcj:StageClear (X + 1) (j - 1)hhit:terras^[j] (X + 1) = X + 1⊢ AllClear (X + 1) ∨ ∃ x j, 3 ≤ x ∧ x ≤ X + 1 ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = x exact Or.inr ⟨X + 1, j, hx3, le_rfl, hj1, hjx, hAll, hcj, hhit⟩ All goals completed! 🐙
· neg X:ℕhAll:AllClear Xhx3:¬3 ≤ X + 1⊢ AllClear (X + 1) ∨ ∃ x j, 3 ≤ x ∧ x ≤ X + 1 ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = x exact Or.inl fun x hx_ge3 hx_le => absurd (le_trans hx_ge3 hx_le) hx3 All goals completed! 🐙
· succ.inr X:ℕx:ℕj:ℕhx3:3 ≤ xhxX:x ≤ Xhj1:1 ≤ jhjx:j ≤ xhAllX:AllClear (x - 1)hStg:StageClear x (j - 1)hhit:terras^[j] x = x⊢ AllClear (X + 1) ∨ ∃ x j, 3 ≤ x ∧ x ≤ X + 1 ∧ 1 ≤ j ∧ j ≤ x ∧ AllClear (x - 1) ∧ StageClear x (j - 1) ∧ terras^[j] x = x exact Or.inr ⟨x, j, hx3, by X:ℕx:ℕj:ℕhx3:3 ≤ xhxX:x ≤ Xhj1:1 ≤ jhjx:j ≤ xhAllX:AllClear (x - 1)hStg:StageClear x (j - 1)hhit:terras^[j] x = x⊢ x ≤ X + 1 omega All goals completed! 🐙, hj1, hjx, hAllX, hStg, hhit⟩private theorem reach_stage_from_init (X : ℕ) (hX : 3 ≤ X) (hAll : AllClear (X - 1)) :
∃ s : ℕ, X - 2 ≤ s ∧ nSteps weakCollatz41 s init = some (stageCfg X X X) := by X:ℕhX:3 ≤ XhAll:AllClear (X - 1)⊢ ∃ s, X - 2 ≤ s ∧ nSteps weakCollatz41 s init = some (stageCfg X X X)
induction X, hX using Nat.le_induction with
| base => base X:ℕhAll:AllClear (3 - 1)⊢ ∃ s, 3 - 2 ≤ s ∧ nSteps weakCollatz41 s init = some (stageCfg 3 3 3)
obtain ⟨s, hs1, hs⟩ := init_reaches_stage3 base X:ℕhAll:AllClear (3 - 1)s:ℕhs1:1 ≤ shs:nSteps weakCollatz41 s init = some (stageCfg 3 3 3)⊢ ∃ s, 3 - 2 ≤ s ∧ nSteps weakCollatz41 s init = some (stageCfg 3 3 3)
exact ⟨s, by X:ℕhAll:AllClear (3 - 1)s:ℕhs1:1 ≤ shs:nSteps weakCollatz41 s init = some (stageCfg 3 3 3)⊢ 3 - 2 ≤ s omega All goals completed! 🐙, hs⟩
| succ X hX ih => succ X✝:ℕX:ℕhX:3 ≤ Xih:AllClear (X - 1) → ∃ s, X - 2 ≤ s ∧ nSteps weakCollatz41 s init = some (stageCfg X X X)hAll:AllClear (X + 1 - 1)⊢ ∃ s, X + 1 - 2 ≤ s ∧ nSteps weakCollatz41 s init = some (stageCfg (X + 1) (X + 1) (X + 1))
obtain ⟨s₁, hs₁_ge, hs₁⟩ := ih fun x hx3 hx_le => hAll x hx3 (by X✝:ℕX:ℕhX:3 ≤ Xih:AllClear (X - 1) → ∃ s, X - 2 ≤ s ∧ nSteps weakCollatz41 s init = some (stageCfg X X X)hAll:AllClear (X + 1 - 1)x:ℕhx3:3 ≤ xhx_le:x ≤ X - 1⊢ x ≤ X + 1 - 1 omega All goals completed! 🐙) succ X✝:ℕX:ℕhX:3 ≤ Xih:AllClear (X - 1) → ∃ s, X - 2 ≤ s ∧ nSteps weakCollatz41 s init = some (stageCfg X X X)hAll:AllClear (X + 1 - 1)s₁:ℕhs₁_ge:X - 2 ≤ s₁hs₁:nSteps weakCollatz41 s₁ init = some (stageCfg X X X)⊢ ∃ s, X + 1 - 2 ≤ s ∧ nSteps weakCollatz41 s init = some (stageCfg (X + 1) (X + 1) (X + 1))
have hclX : StageClear X X := hAll X hX (by X✝:ℕX:ℕhX:3 ≤ Xih:AllClear (X - 1) → ∃ s, X - 2 ≤ s ∧ nSteps weakCollatz41 s init = some (stageCfg X X X)hAll:AllClear (X + 1 - 1)s₁:ℕhs₁_ge:X - 2 ≤ s₁hs₁:nSteps weakCollatz41 s₁ init = some (stageCfg X X X)⊢ X ≤ X + 1 - 1 omega All goals completed! 🐙) succ X✝:ℕX:ℕhX:3 ≤ Xih:AllClear (X - 1) → ∃ s, X - 2 ≤ s ∧ nSteps weakCollatz41 s init = some (stageCfg X X X)hAll:AllClear (X + 1 - 1)s₁:ℕhs₁_ge:X - 2 ≤ s₁hs₁:nSteps weakCollatz41 s₁ init = some (stageCfg X X X)hclX:StageClear X X⊢ ∃ s, X + 1 - 2 ≤ s ∧ nSteps weakCollatz41 s init = some (stageCfg (X + 1) (X + 1) (X + 1))
obtain ⟨s₂, hs₂_pos, hs₂⟩ := stage_full_advance X hX hclX succ X✝:ℕX:ℕhX:3 ≤ Xih:AllClear (X - 1) → ∃ s, X - 2 ≤ s ∧ nSteps weakCollatz41 s init = some (stageCfg X X X)hAll:AllClear (X + 1 - 1)s₁:ℕhs₁_ge:X - 2 ≤ s₁hs₁:nSteps weakCollatz41 s₁ init = some (stageCfg X X X)hclX:StageClear X Xs₂:ℕhs₂_pos:1 ≤ s₂hs₂:nSteps weakCollatz41 s₂ (stageCfg X X X) = some (stageCfg (X + 1) (X + 1) (X + 1))⊢ ∃ s, X + 1 - 2 ≤ s ∧ nSteps weakCollatz41 s init = some (stageCfg (X + 1) (X + 1) (X + 1))
exact ⟨s₁ + s₂, by X✝:ℕX:ℕhX:3 ≤ Xih:AllClear (X - 1) → ∃ s, X - 2 ≤ s ∧ nSteps weakCollatz41 s init = some (stageCfg X X X)hAll:AllClear (X + 1 - 1)s₁:ℕhs₁_ge:X - 2 ≤ s₁hs₁:nSteps weakCollatz41 s₁ init = some (stageCfg X X X)hclX:StageClear X Xs₂:ℕhs₂_pos:1 ≤ s₂hs₂:nSteps weakCollatz41 s₂ (stageCfg X X X) = some (stageCfg (X + 1) (X + 1) (X + 1))⊢ X + 1 - 2 ≤ s₁ + s₂ omega All goals completed! 🐙, nSteps_bind_eq hs₁ hs₂⟩
The 41-state machine weakCollatz41 (weak_collatz_41) 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_weakCollatz41_iff_bounded_cycle :
ConjectureMachines.Halts weakCollatz41 ↔
∃ x j : ℕ, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x := by ⊢ ConjectureMachines.Halts weakCollatz41 ↔ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x
unfold ConjectureMachines.Halts ⊢ (eval (step weakCollatz41) init).Dom ↔ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x
constructor mp ⊢ (eval (step weakCollatz41) init).Dom → ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = xmpr ⊢ (∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x) → (eval (step weakCollatz41) init).Dom
· mp ⊢ (eval (step weakCollatz41) init).Dom → ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x intro hdom mp hdom:(eval (step weakCollatz41) init).Dom⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x
rw [Part.dom_iff_mem mp hdom:∃ y, y ∈ eval (step weakCollatz41) init⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x] at hdom mp hdom:∃ y, y ∈ eval (step weakCollatz41) init⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x
obtain ⟨b, hb⟩ := hdom mp b:Cfg 41 2hb:b ∈ eval (step weakCollatz41) init⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x
rw [mem_eval' mp b:Cfg 41 2hb:Reaches (step weakCollatz41) init b ∧ step weakCollatz41 b = none⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x] at hb mp b:Cfg 41 2hb:Reaches (step weakCollatz41) init b ∧ step weakCollatz41 b = none⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x
obtain ⟨hreach, hnone⟩ := hb mp b:Cfg 41 2hreach:Reaches (step weakCollatz41) init bhnone:step weakCollatz41 b = none⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x
obtain ⟨k, hk⟩ := reaches_imp_nSteps hreach mp b:Cfg 41 2hreach:Reaches (step weakCollatz41) init bhnone:step weakCollatz41 b = nonek:ℕhk:nSteps weakCollatz41 k init = some b⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x
rcases allClear_or_first_witness (k + 3) with hAll | ⟨x, j, hx3, -, hj1, hjx, -, -, hhit⟩ mp.inl b:Cfg 41 2hreach:Reaches (step weakCollatz41) init bhnone:step weakCollatz41 b = nonek:ℕhk:nSteps weakCollatz41 k init = some bhAll:AllClear (k + 3)⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = xmp.inr b:Cfg 41 2hreach:Reaches (step weakCollatz41) init bhnone:step weakCollatz41 b = nonek:ℕhk:nSteps weakCollatz41 k init = some bx:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhhit:terras^[j] x = x⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x
· mp.inl b:Cfg 41 2hreach:Reaches (step weakCollatz41) init bhnone:step weakCollatz41 b = nonek:ℕhk:nSteps weakCollatz41 k init = some bhAll:AllClear (k + 3)⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x obtain ⟨s, hks, hs⟩ := reach_stage_from_init (k + 3) (by b:Cfg 41 2hreach:Reaches (step weakCollatz41) init bhnone:step weakCollatz41 b = nonek:ℕhk:nSteps weakCollatz41 k init = some bhAll:AllClear (k + 3)⊢ 3 ≤ k + 3 omega All goals completed! 🐙)
(fun x hx3 hx_le => hAll x hx3 (by b:Cfg 41 2hreach:Reaches (step weakCollatz41) init bhnone:step weakCollatz41 b = nonek:ℕhk:nSteps weakCollatz41 k init = some bhAll:AllClear (k + 3)x:ℕhx3:3 ≤ xhx_le:x ≤ k + 3 - 1⊢ x ≤ k + 3 omega All goals completed! 🐙)) mp.inl b:Cfg 41 2hreach:Reaches (step weakCollatz41) init bhnone:step weakCollatz41 b = nonek:ℕhk:nSteps weakCollatz41 k init = some bhAll:AllClear (k + 3)s:ℕhks:k + 3 - 2 ≤ shs:nSteps weakCollatz41 s init = some (stageCfg (k + 3) (k + 3) (k + 3))⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x
rw [nSteps_eq_none_of_step_none s hk hnone (by b:Cfg 41 2hreach:Reaches (step weakCollatz41) init bhnone:step weakCollatz41 b = nonek:ℕhk:nSteps weakCollatz41 k init = some bhAll:AllClear (k + 3)s:ℕhks:k + 3 - 2 ≤ shs:nSteps weakCollatz41 s init = some (stageCfg (k + 3) (k + 3) (k + 3))⊢ k < s omega All goals completed! 🐙)] at hs mp.inl b:Cfg 41 2hreach:Reaches (step weakCollatz41) init bhnone:step weakCollatz41 b = nonek:ℕhk:nSteps weakCollatz41 k init = some bhAll:AllClear (k + 3)s:ℕhks:k + 3 - 2 ≤ shs:none = some (stageCfg (k + 3) (k + 3) (k + 3))⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x
cases hs All goals completed! 🐙
· mp.inr b:Cfg 41 2hreach:Reaches (step weakCollatz41) init bhnone:step weakCollatz41 b = nonek:ℕhk:nSteps weakCollatz41 k init = some bx:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhhit:terras^[j] x = x⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x exact ⟨x, j, hx3, hj1, hjx, hhit⟩ All goals completed! 🐙
· mpr ⊢ (∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x) → (eval (step weakCollatz41) init).Dom rintro ⟨x, j, hx3, hj1, hjx, hhit⟩ mpr x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhhit:terras^[j] x = x⊢ (eval (step weakCollatz41) init).Dom
rcases allClear_or_first_witness x with
hAll | ⟨x₀, j₀, hx₀3, -, hj₀1, hj₀x, hAll₀, hStg₀, hhit₀⟩ mpr.inl x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhhit:terras^[j] x = xhAll:AllClear x⊢ (eval (step weakCollatz41) init).Dommpr.inr x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhhit:terras^[j] x = xx₀:ℕj₀:ℕhx₀3:3 ≤ x₀hj₀1:1 ≤ j₀hj₀x:j₀ ≤ x₀hAll₀:AllClear (x₀ - 1)hStg₀:StageClear x₀ (j₀ - 1)hhit₀:terras^[j₀] x₀ = x₀⊢ (eval (step weakCollatz41) init).Dom
· mpr.inl x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhhit:terras^[j] x = xhAll:AllClear x⊢ (eval (step weakCollatz41) init).Dom exfalso mpr.inl x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhhit:terras^[j] x = xhAll:AllClear x⊢ False
exact hAll x hx3 le_rfl j hj1 hjx hhit All goals completed! 🐙
· mpr.inr x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhhit:terras^[j] x = xx₀:ℕj₀:ℕhx₀3:3 ≤ x₀hj₀1:1 ≤ j₀hj₀x:j₀ ≤ x₀hAll₀:AllClear (x₀ - 1)hStg₀:StageClear x₀ (j₀ - 1)hhit₀:terras^[j₀] x₀ = x₀⊢ (eval (step weakCollatz41) init).Dom obtain ⟨s₁, -, hs₁⟩ := reach_stage_from_init x₀ hx₀3 hAll₀ mpr.inr x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhhit:terras^[j] x = xx₀:ℕj₀:ℕhx₀3:3 ≤ x₀hj₀1:1 ≤ j₀hj₀x:j₀ ≤ x₀hAll₀:AllClear (x₀ - 1)hStg₀:StageClear x₀ (j₀ - 1)hhit₀:terras^[j₀] x₀ = x₀s₁:ℕhs₁:nSteps weakCollatz41 s₁ init = some (stageCfg x₀ x₀ x₀)⊢ (eval (step weakCollatz41) init).Dom
obtain ⟨s₂, cfg, hs₂, hnone⟩ := stage_first_hit_halt x₀ j₀ hx₀3 hj₀1 hj₀x hStg₀ hhit₀ mpr.inr x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhhit:terras^[j] x = xx₀:ℕj₀:ℕhx₀3:3 ≤ x₀hj₀1:1 ≤ j₀hj₀x:j₀ ≤ x₀hAll₀:AllClear (x₀ - 1)hStg₀:StageClear x₀ (j₀ - 1)hhit₀:terras^[j₀] x₀ = x₀s₁:ℕhs₁:nSteps weakCollatz41 s₁ init = some (stageCfg x₀ x₀ x₀)s₂:ℕcfg:Cfg 41 2hs₂:nSteps weakCollatz41 s₂ (stageCfg x₀ x₀ x₀) = some cfghnone:step weakCollatz41 cfg = none⊢ (eval (step weakCollatz41) init).Dom
rw [Part.dom_iff_mem mpr.inr x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhhit:terras^[j] x = xx₀:ℕj₀:ℕhx₀3:3 ≤ x₀hj₀1:1 ≤ j₀hj₀x:j₀ ≤ x₀hAll₀:AllClear (x₀ - 1)hStg₀:StageClear x₀ (j₀ - 1)hhit₀:terras^[j₀] x₀ = x₀s₁:ℕhs₁:nSteps weakCollatz41 s₁ init = some (stageCfg x₀ x₀ x₀)s₂:ℕcfg:Cfg 41 2hs₂:nSteps weakCollatz41 s₂ (stageCfg x₀ x₀ x₀) = some cfghnone:step weakCollatz41 cfg = none⊢ ∃ y, y ∈ eval (step weakCollatz41) init] mpr.inr x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jhjx:j ≤ xhhit:terras^[j] x = xx₀:ℕj₀:ℕhx₀3:3 ≤ x₀hj₀1:1 ≤ j₀hj₀x:j₀ ≤ x₀hAll₀:AllClear (x₀ - 1)hStg₀:StageClear x₀ (j₀ - 1)hhit₀:terras^[j₀] x₀ = x₀s₁:ℕhs₁:nSteps weakCollatz41 s₁ init = some (stageCfg x₀ x₀ x₀)s₂:ℕcfg:Cfg 41 2hs₂:nSteps weakCollatz41 s₂ (stageCfg x₀ x₀ x₀) = some cfghnone:step weakCollatz41 cfg = none⊢ ∃ y, y ∈ eval (step weakCollatz41) init
exact ⟨cfg, mem_eval'.mpr ⟨nSteps_reaches (nSteps_bind_eq hs₁ hs₂), hnone⟩⟩ All goals completed! 🐙
The 41-state candidate machine halts on the blank tape if and only if the 75-state reference
machine does (constructive, zero Classical.choice).
theorem candidate_equivalent : Halts candidate ↔ Halts reference :=
halts_weakCollatz41_iff_bounded_cycle.trans
WeakCollatz75.halts_weakCollatz75_iff_bounded_cycle.symm
The candidate has 34 fewer states than the 75-state reference (41 < 75).
theorem candidate_fewer_states : candidate.states < reference.states := by ⊢ candidate.states < reference.states
decide +kernel All goals completed! 🐙end ConjectureMachines.WeakCollatz41