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

Basic Lemmas for BusyBeaver Turing Machines (BusyBeaver.Basic)

Foundational lemmas for reasoning about BusyBeaver.Machine execution, multi-step reachability (multiStep, ReachesIn, ReachesStar, ReachesPlus), halting/non-halting invariants (HaltsFrom, NeverHaltsFrom), finite block repetition (l ^ n), and directed-head tape configurations (Cfg.headRight, Cfg.headLeft).

@[expose] public sectionnamespace BusyBeaveropen Turingvariable {Γ Λ : Type*} [Inhabited Γ] [Inhabited Λ]

Multi-Step Execution (multiStep)

@[simp] theorem step_none (M : Machine Γ Λ) (T : Tape Γ) : step M ⟨none, T⟩ = none := rfl@[simp] theorem multiStep_zero (M : Machine Γ Λ) (c : Cfg Γ Λ) : multiStep M c 0 = some c := rfl@[simp] theorem multiStep_one (M : Machine Γ Λ) (c : Cfg Γ Λ) : multiStep M c 1 = step M c := rflprivate theorem iterate_bind_step_none (M : Machine Γ Λ) (n : ℕ) : (Option.bind · (step M))^[n] none = none := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λn:ℕ⊢ (fun x ↦ x.bind (step M))^[n] none = none induction n with Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λ⊢ (fun x ↦ x.bind (step M))^[0] none = none All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λn:ℕih:(fun x ↦ x.bind (step M))^[n] none = none⊢ (fun x ↦ x.bind (step M))^[n + 1] none = none All goals completed! 🐙

Split multiStep at the first step: n + 1 steps from c is one step from c followed by n steps.

theorem multiStep_succ (M : Machine Γ Λ) (c : Cfg Γ Λ) (n : ℕ) : multiStep M c (n + 1) = (step M c).bind (fun c' => multiStep M c' n) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λn:ℕ⊢ multiStep M c (n + 1) = (step M c).bind fun c' ↦ multiStep M c' n Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λn:ℕ⊢ (fun x ↦ x.bind (step M))^[n + 1] (some c) = (step M c).bind fun c' ↦ (fun x ↦ x.bind (step M))^[n] (some c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λn:ℕ⊢ (fun x ↦ x.bind (step M))^[n] ((some c).bind (step M)) = (step M c).bind fun c' ↦ (fun x ↦ x.bind (step M))^[n] (some c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λn:ℕh:step M c = none⊢ (fun x ↦ x.bind (step M))^[n] ((some c).bind (step M)) = none.bind fun c' ↦ (fun x ↦ x.bind (step M))^[n] (some c')Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λn:ℕc':Cfg Γ Λh:c [M]⊢ c'⊢ (fun x ↦ x.bind (step M))^[n] ((some c).bind (step M)) = (some c').bind fun c' ↦ (fun x ↦ x.bind (step M))^[n] (some c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λn:ℕh:step M c = none⊢ (fun x ↦ x.bind (step M))^[n] ((some c).bind (step M)) = none.bind fun c' ↦ (fun x ↦ x.bind (step M))^[n] (some c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λn:ℕh:step M c = none⊢ (fun x ↦ x.bind (step M))^[n] (step M c) = none.bind fun c' ↦ (fun x ↦ x.bind (step M))^[n] (some c') All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λn:ℕc':Cfg Γ Λh:c [M]⊢ c'⊢ (fun x ↦ x.bind (step M))^[n] ((some c).bind (step M)) = (some c').bind fun c' ↦ (fun x ↦ x.bind (step M))^[n] (some c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λn:ℕc':Cfg Γ Λh:c [M]⊢ c'⊢ (fun x ↦ x.bind (step M))^[n] (step M c) = (some c').bind fun c' ↦ (fun x ↦ x.bind (step M))^[n] (some c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λn:ℕc':Cfg Γ Λh:c [M]⊢ c'⊢ (fun x ↦ x.bind (step M))^[n] (some c') = (some c').bind fun c' ↦ (fun x ↦ x.bind (step M))^[n] (some c') All goals completed! 🐙

Split multiStep at the last step: n + 1 steps from c is n steps from c followed by one step.

theorem multiStep_succ' (M : Machine Γ Λ) (c : Cfg Γ Λ) (n : ℕ) : multiStep M c (n + 1) = (multiStep M c n).bind (step M) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λn:ℕ⊢ multiStep M c (n + 1) = (multiStep M c n).bind (step M) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λn:ℕ⊢ (fun x ↦ x.bind (step M))^[n + 1] (some c) = ((fun x ↦ x.bind (step M))^[n] (some c)).bind (step M) All goals completed! 🐙theorem multiStep_of_step {M : Machine Γ Λ} {c c' : Cfg Γ Λ} (h : step M c = some c') (n : ℕ) : multiStep M c (n + 1) = multiStep M c' n := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λc':Cfg Γ Λh:c [M]⊢ c'n:ℕ⊢ multiStep M c (n + 1) = multiStep M c' n All goals completed! 🐙theorem multiStep_of_step_eq_none {M : Machine Γ Λ} {c : Cfg Γ Λ} (h : step M c = none) (n : ℕ) : multiStep M c (n + 1) = none := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λh:step M c = nonen:ℕ⊢ multiStep M c (n + 1) = none All goals completed! 🐙

Addition law for multiStep: m + n steps is m steps followed by n steps.

theorem multiStep_add (M : Machine Γ Λ) (c : Cfg Γ Λ) (m n : ℕ) : multiStep M c (m + n) = (multiStep M c m).bind (fun c' => multiStep M c' n) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λm:ℕn:ℕ⊢ multiStep M c (m + n) = (multiStep M c m).bind fun c' ↦ multiStep M c' n Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λm:ℕn:ℕ⊢ (fun x ↦ x.bind (step M))^[m + n] (some c) = ((fun x ↦ x.bind (step M))^[m] (some c)).bind fun c' ↦ (fun x ↦ x.bind (step M))^[n] (some c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λm:ℕn:ℕ⊢ (fun x ↦ x.bind (step M))^[n] ((fun x ↦ x.bind (step M))^[m] (some c)) = ((fun x ↦ x.bind (step M))^[m] (some c)).bind fun c' ↦ (fun x ↦ x.bind (step M))^[n] (some c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λm:ℕn:ℕh:(fun x ↦ x.bind (step M))^[m] (some c) = none⊢ (fun x ↦ x.bind (step M))^[n] none = none.bind fun c' ↦ (fun x ↦ x.bind (step M))^[n] (some c')Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λm:ℕn:ℕc':Cfg Γ Λh:(fun x ↦ x.bind (step M))^[m] (some c) = some c'⊢ (fun x ↦ x.bind (step M))^[n] (some c') = (some c').bind fun c' ↦ (fun x ↦ x.bind (step M))^[n] (some c') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λm:ℕn:ℕh:(fun x ↦ x.bind (step M))^[m] (some c) = none⊢ (fun x ↦ x.bind (step M))^[n] none = none.bind fun c' ↦ (fun x ↦ x.bind (step M))^[n] (some c') All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λm:ℕn:ℕc':Cfg Γ Λh:(fun x ↦ x.bind (step M))^[m] (some c) = some c'⊢ (fun x ↦ x.bind (step M))^[n] (some c') = (some c').bind fun c' ↦ (fun x ↦ x.bind (step M))^[n] (some c') All goals completed! 🐙theorem multiStep_trans {M : Machine Γ Λ} {c₁ c₂ c₃ : Cfg Γ Λ} {m n : ℕ} (h₁ : multiStep M c₁ m = some c₂) (h₂ : multiStep M c₂ n = some c₃) : multiStep M c₁ (m + n) = some c₃ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λm:ℕn:ℕh₁:c₁ [M]⊢^{m} c₂h₂:c₂ [M]⊢^{n} c₃⊢ c₁ [M]⊢^{m + n} c₃ All goals completed! 🐙

Exact, Reflexive-Transitive, and Positive Reachability

@[simp] theorem ReachesIn.zero (M : Machine Γ Λ) (c : Cfg Γ Λ) : ReachesIn M 0 c c := rfltheorem ReachesIn.single {M : Machine Γ Λ} {c₁ c₂ : Cfg Γ Λ} (h : step M c₁ = some c₂) : ReachesIn M 1 c₁ c₂ := htheorem ReachesIn.step_left {M : Machine Γ Λ} {c₁ c₂ c₃ : Cfg Γ Λ} {n : ℕ} (h₁ : step M c₁ = some c₂) (h₂ : ReachesIn M n c₂ c₃) : ReachesIn M (n + 1) c₁ c₃ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λn:ℕh₁:c₁ [M]⊢ c₂h₂:ReachesIn M n c₂ c₃⊢ ReachesIn M (n + 1) c₁ c₃ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λn:ℕh₁:c₁ [M]⊢ c₂h₂:c₂ [M]⊢^{n} c₃⊢ c₁ [M]⊢^{n + 1} c₃ All goals completed! 🐙theorem ReachesIn.step_right {M : Machine Γ Λ} {c₁ c₂ c₃ : Cfg Γ Λ} {n : ℕ} (h₁ : ReachesIn M n c₁ c₂) (h₂ : step M c₂ = some c₃) : ReachesIn M (n + 1) c₁ c₃ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λn:ℕh₁:ReachesIn M n c₁ c₂h₂:c₂ [M]⊢ c₃⊢ ReachesIn M (n + 1) c₁ c₃ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λn:ℕh₁:c₁ [M]⊢^{n} c₂h₂:c₂ [M]⊢ c₃⊢ c₁ [M]⊢^{n + 1} c₃ All goals completed! 🐙theorem ReachesIn.trans {M : Machine Γ Λ} {c₁ c₂ c₃ : Cfg Γ Λ} {m n : ℕ} (h₁ : ReachesIn M m c₁ c₂) (h₂ : ReachesIn M n c₂ c₃) : ReachesIn M (m + n) c₁ c₃ := multiStep_trans h₁ h₂theorem ReachesIn.to_star {M : Machine Γ Λ} {n : ℕ} {c₁ c₂ : Cfg Γ Λ} (h : ReachesIn M n c₁ c₂) : ReachesStar M c₁ c₂ := ⟨n, h⟩theorem ReachesIn.to_plus {M : Machine Γ Λ} {n : ℕ} {c₁ c₂ : Cfg Γ Λ} (hn : n > 0) (h : ReachesIn M n c₁ c₂) : ReachesPlus M c₁ c₂ := ⟨n, hn, h⟩@[refl, simp] theorem ReachesStar.refl (M : Machine Γ Λ) (c : Cfg Γ Λ) : ReachesStar M c c := ⟨0, rfl⟩theorem ReachesStar.single {M : Machine Γ Λ} {c₁ c₂ : Cfg Γ Λ} (h : step M c₁ = some c₂) : ReachesStar M c₁ c₂ := ⟨1, h⟩theorem ReachesStar.head {M : Machine Γ Λ} {c₁ c₂ c₃ : Cfg Γ Λ} (h₁ : step M c₁ = some c₂) (h₂ : ReachesStar M c₂ c₃) : ReachesStar M c₁ c₃ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₁:c₁ [M]⊢ c₂h₂:c₂ [M]⊢* c₃⊢ c₁ [M]⊢* c₃ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₁:c₁ [M]⊢ c₂n:ℕhn:c₂ [M]⊢^{n} c₃⊢ c₁ [M]⊢* c₃ All goals completed! 🐙theorem ReachesStar.tail {M : Machine Γ Λ} {c₁ c₂ c₃ : Cfg Γ Λ} (h₁ : ReachesStar M c₁ c₂) (h₂ : step M c₂ = some c₃) : ReachesStar M c₁ c₃ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₁:c₁ [M]⊢* c₂h₂:c₂ [M]⊢ c₃⊢ c₁ [M]⊢* c₃ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₂:c₂ [M]⊢ c₃n:ℕhn:c₁ [M]⊢^{n} c₂⊢ c₁ [M]⊢* c₃ All goals completed! 🐙theorem ReachesStar.trans {M : Machine Γ Λ} {c₁ c₂ c₃ : Cfg Γ Λ} (h₁ : ReachesStar M c₁ c₂) (h₂ : ReachesStar M c₂ c₃) : ReachesStar M c₁ c₃ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₁:c₁ [M]⊢* c₂h₂:c₂ [M]⊢* c₃⊢ c₁ [M]⊢* c₃ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₂:c₂ [M]⊢* c₃m:ℕhm:c₁ [M]⊢^{m} c₂⊢ c₁ [M]⊢* c₃ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λm:ℕhm:c₁ [M]⊢^{m} c₂n:ℕhn:c₂ [M]⊢^{n} c₃⊢ c₁ [M]⊢* c₃ All goals completed! 🐙theorem ReachesPlus.single {M : Machine Γ Λ} {c₁ c₂ : Cfg Γ Λ} (h : step M c₁ = some c₂) : ReachesPlus M c₁ c₂ := ⟨1, Nat.one_pos, h⟩theorem ReachesPlus.to_star {M : Machine Γ Λ} {c₁ c₂ : Cfg Γ Λ} (h : ReachesPlus M c₁ c₂) : ReachesStar M c₁ c₂ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λh:c₁ [M]⊢⁺ c₂⊢ c₁ [M]⊢* c₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λn:ℕleft✝:n > 0hn:c₁ [M]⊢^{n} c₂⊢ c₁ [M]⊢* c₂ All goals completed! 🐙theorem ReachesPlus.head {M : Machine Γ Λ} {c₁ c₂ c₃ : Cfg Γ Λ} (h₁ : step M c₁ = some c₂) (h₂ : ReachesStar M c₂ c₃) : ReachesPlus M c₁ c₃ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₁:c₁ [M]⊢ c₂h₂:c₂ [M]⊢* c₃⊢ c₁ [M]⊢⁺ c₃ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₁:c₁ [M]⊢ c₂n:ℕhn:c₂ [M]⊢^{n} c₃⊢ c₁ [M]⊢⁺ c₃ All goals completed! 🐙theorem ReachesPlus.tail {M : Machine Γ Λ} {c₁ c₂ c₃ : Cfg Γ Λ} (h₁ : ReachesStar M c₁ c₂) (h₂ : step M c₂ = some c₃) : ReachesPlus M c₁ c₃ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₁:c₁ [M]⊢* c₂h₂:c₂ [M]⊢ c₃⊢ c₁ [M]⊢⁺ c₃ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₂:c₂ [M]⊢ c₃n:ℕhn:c₁ [M]⊢^{n} c₂⊢ c₁ [M]⊢⁺ c₃ All goals completed! 🐙theorem ReachesPlus.trans {M : Machine Γ Λ} {c₁ c₂ c₃ : Cfg Γ Λ} (h₁ : ReachesPlus M c₁ c₂) (h₂ : ReachesPlus M c₂ c₃) : ReachesPlus M c₁ c₃ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₁:c₁ [M]⊢⁺ c₂h₂:c₂ [M]⊢⁺ c₃⊢ c₁ [M]⊢⁺ c₃ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₂:c₂ [M]⊢⁺ c₃m:ℕhm_pos:m > 0hm:c₁ [M]⊢^{m} c₂⊢ c₁ [M]⊢⁺ c₃ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λm:ℕhm_pos:m > 0hm:c₁ [M]⊢^{m} c₂n:ℕhn_pos:n > 0hn:c₂ [M]⊢^{n} c₃⊢ c₁ [M]⊢⁺ c₃ All goals completed! 🐙theorem ReachesPlus.trans_star {M : Machine Γ Λ} {c₁ c₂ c₃ : Cfg Γ Λ} (h₁ : ReachesPlus M c₁ c₂) (h₂ : ReachesStar M c₂ c₃) : ReachesPlus M c₁ c₃ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₁:c₁ [M]⊢⁺ c₂h₂:c₂ [M]⊢* c₃⊢ c₁ [M]⊢⁺ c₃ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₂:c₂ [M]⊢* c₃m:ℕhm_pos:m > 0hm:c₁ [M]⊢^{m} c₂⊢ c₁ [M]⊢⁺ c₃ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λm:ℕhm_pos:m > 0hm:c₁ [M]⊢^{m} c₂n:ℕhn:c₂ [M]⊢^{n} c₃⊢ c₁ [M]⊢⁺ c₃ All goals completed! 🐙theorem ReachesStar.trans_plus {M : Machine Γ Λ} {c₁ c₂ c₃ : Cfg Γ Λ} (h₁ : ReachesStar M c₁ c₂) (h₂ : ReachesPlus M c₂ c₃) : ReachesPlus M c₁ c₃ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₁:c₁ [M]⊢* c₂h₂:c₂ [M]⊢⁺ c₃⊢ c₁ [M]⊢⁺ c₃ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₂:c₂ [M]⊢⁺ c₃m:ℕhm:c₁ [M]⊢^{m} c₂⊢ c₁ [M]⊢⁺ c₃ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λm:ℕhm:c₁ [M]⊢^{m} c₂n:ℕhn_pos:n > 0hn:c₂ [M]⊢^{n} c₃⊢ c₁ [M]⊢⁺ c₃ All goals completed! 🐙theorem ReachesPlus.of_star_ne {M : Machine Γ Λ} {c₁ c₂ : Cfg Γ Λ} (h : ReachesStar M c₁ c₂) (hne : c₁ ≠ c₂) : ReachesPlus M c₁ c₂ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λh:c₁ [M]⊢* c₂hne:c₁ ≠ c₂⊢ c₁ [M]⊢⁺ c₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λhne:c₁ ≠ c₂n:ℕhn:c₁ [M]⊢^{n} c₂⊢ c₁ [M]⊢⁺ c₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λhne:c₁ ≠ c₂hn:c₁ [M]⊢^{0} c₂⊢ c₁ [M]⊢⁺ c₂Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λhne:c₁ ≠ c₂n:ℕhn:c₁ [M]⊢^{n + 1} c₂⊢ c₁ [M]⊢⁺ c₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λhne:c₁ ≠ c₂hn:c₁ [M]⊢^{0} c₂⊢ c₁ [M]⊢⁺ c₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λhne:c₁ ≠ c₂hn:c₁ = c₂⊢ c₁ [M]⊢⁺ c₂ All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λhne:c₁ ≠ c₂n:ℕhn:c₁ [M]⊢^{n + 1} c₂⊢ c₁ [M]⊢⁺ c₂ All goals completed! 🐙instance (M : Machine Γ Λ) : Trans (ReachesStar M) (ReachesStar M) (ReachesStar M) := ⟨ReachesStar.trans⟩instance (M : Machine Γ Λ) : Trans (ReachesPlus M) (ReachesPlus M) (ReachesPlus M) := ⟨ReachesPlus.trans⟩instance (M : Machine Γ Λ) : Trans (ReachesPlus M) (ReachesStar M) (ReachesPlus M) := ⟨ReachesPlus.trans_star⟩instance (M : Machine Γ Λ) : Trans (ReachesStar M) (ReachesPlus M) (ReachesPlus M) := ⟨ReachesStar.trans_plus⟩

Reachability Aliases for Proof Modules

abbrev stepStar_trans := @ReachesStar.transabbrev stepPlus_stepStar := @ReachesPlus.to_starabbrev stepPlus_trans := @ReachesPlus.transabbrev stepPlus_stepStar_stepPlus := @ReachesPlus.trans_starabbrev stepStar_stepPlus_stepPlus := @ReachesStar.trans_plusabbrev stepPlus_stepStar_trans := @ReachesPlus.trans_starabbrev stepStar_stepPlus_trans := @ReachesStar.trans_plusabbrev stepPlus_to_stepStar := @ReachesPlus.to_starabbrev stepStar_of_multiStep := @ReachesIn.to_starabbrev stepStar_refl := @ReachesStar.refltheorem step_multiStep (M : Machine Γ Λ) (c₁ c₂ : Cfg Γ Λ) (h : step M c₁ = some c₂) : c₁ [M]⊢^{1} c₂ := htheorem step_stepStar (M : Machine Γ Λ) (c₁ c₂ : Cfg Γ Λ) (h : step M c₁ = some c₂) : c₁ [M]⊢* c₂ := ⟨1, h⟩theorem step_stepPlus (M : Machine Γ Λ) (c₁ c₂ : Cfg Γ Λ) (h : step M c₁ = some c₂) : c₁ [M]⊢⁺ c₂ := ⟨1, Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λh:c₁ [M]⊢ c₂⊢ 1 > 0 All goals completed! 🐙, h⟩theorem step_stepStar_stepPlus {M : Machine Γ Λ} {c₁ c₂ c₃ : Cfg Γ Λ} (h₁ : c₁ [M]⊢ c₂) (h₂ : c₂ [M]⊢* c₃) : c₁ [M]⊢⁺ c₃ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₁:c₁ [M]⊢ c₂h₂:c₂ [M]⊢* c₃⊢ c₁ [M]⊢⁺ c₃ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₁:c₁ [M]⊢ c₂m:ℕhm:c₂ [M]⊢^{m} c₃⊢ c₁ [M]⊢⁺ c₃ exact ⟨1 + m, Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λc₃:Cfg Γ Λh₁:c₁ [M]⊢ c₂m:ℕhm:c₂ [M]⊢^{m} c₃⊢ 1 + m > 0 All goals completed! 🐙, multiStep_trans h₁ hm⟩

Halting and Non-Halting Invariants

M eventually reaches a halting configuration starting from c.

def HaltsFrom (M : Machine Γ Λ) (c : Cfg Γ Λ) : Prop := ∃ cfg : Cfg Γ Λ, ReachesStar M c cfg ∧ (step M cfg).isNone

Every configuration reachable by M from c has a well-defined successor.

def NeverHaltsFrom (M : Machine Γ Λ) (c : Cfg Γ Λ) : Prop := ∀ cfg : Cfg Γ Λ, ReachesStar M c cfg → (step M cfg).isSome@[simp] theorem isHalt_iff_haltsFrom_init (M : Machine Γ Λ) : IsHalt M ↔ HaltsFrom M (init []) := Iff.rfl@[simp] theorem isNotHalt_iff_neverHaltsFrom_init (M : Machine Γ Λ) : IsNotHalt M ↔ NeverHaltsFrom M (init []) := Iff.rfltheorem HaltsFrom.of_reachesStar {M : Machine Γ Λ} {c₁ c₂ : Cfg Γ Λ} (h₁ : ReachesStar M c₁ c₂) (h₂ : HaltsFrom M c₂) : HaltsFrom M c₁ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λh₁:c₁ [M]⊢* c₂h₂:HaltsFrom M c₂⊢ HaltsFrom M c₁ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λh₁:c₁ [M]⊢* c₂cfg:Cfg Γ Λhreach:c₂ [M]⊢* cfghnone:(step M cfg).isNone = true⊢ HaltsFrom M c₁ All goals completed! 🐙theorem NeverHaltsFrom.of_reachesStar {M : Machine Γ Λ} {c₁ c₂ : Cfg Γ Λ} (h₁ : ReachesStar M c₁ c₂) (h₂ : NeverHaltsFrom M c₁) : NeverHaltsFrom M c₂ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λh₁:c₁ [M]⊢* c₂h₂:NeverHaltsFrom M c₁⊢ NeverHaltsFrom M c₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λh₁:c₁ [M]⊢* c₂h₂:NeverHaltsFrom M c₁cfg:Cfg Γ Λhreach:c₂ [M]⊢* cfg⊢ (step M cfg).isSome = true All goals completed! 🐙theorem multiStep_eq_none_of_isNone {M : Machine Γ Λ} {c cfg : Cfg Γ Λ} {k d : ℕ} (hk : multiStep M c k = some cfg) (hnone : (step M cfg).isNone) (hd : d > 0) : multiStep M c (k + d) = none := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λcfg:Cfg Γ Λk:ℕd:ℕhk:c [M]⊢^{k} cfghnone:(step M cfg).isNone = truehd:d > 0⊢ multiStep M c (k + d) = none Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λcfg:Cfg Γ Λk:ℕhk:c [M]⊢^{k} cfghnone:(step M cfg).isNone = truem:ℕhd:m + Nat.succ 0 > 0⊢ multiStep M c (k + (m + Nat.succ 0)) = none Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λc:Cfg Γ Λcfg:Cfg Γ Λk:ℕhk:c [M]⊢^{k} cfghnone:(step M cfg).isNone = truem:ℕhd:m + Nat.succ 0 > 0⊢ step M cfg = none All goals completed! 🐙

If P is a configuration invariant starting at c₀ such that every P-configuration steps in ReachesPlus (n > 0 steps) to another P-configuration, then M never halts from c₀.

theorem NeverHaltsFrom.of_reachesPlus_invariant {M : Machine Γ Λ} {P : Cfg Γ Λ → Prop} (hstep : ∀ c, P c → ∃ c', ReachesPlus M c c' ∧ P c') {c₀ : Cfg Γ Λ} (h₀ : P c₀) : NeverHaltsFrom M c₀ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Prophstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'c₀:Cfg Γ Λh₀:P c₀⊢ NeverHaltsFrom M c₀ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Prophstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'c₀:Cfg Γ Λh₀:P c₀h_unbounded:∀ (k : ℕ), ∃ N ≥ k, ∃ c', (c₀ [M]⊢^{N} c') ∧ P c'⊢ NeverHaltsFrom M c₀ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Prophstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'c₀:Cfg Γ Λh₀:P c₀h_unbounded:∀ (k : ℕ), ∃ N ≥ k, ∃ c', (c₀ [M]⊢^{N} c') ∧ P c'cfg:Cfg Γ Λk:ℕhk:c₀ [M]⊢^{k} cfg⊢ (step M cfg).isSome = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Prophstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'c₀:Cfg Γ Λh₀:P c₀h_unbounded:∀ (k : ℕ), ∃ N ≥ k, ∃ c', (c₀ [M]⊢^{N} c') ∧ P c'cfg:Cfg Γ Λk:ℕhk:c₀ [M]⊢^{k} cfghstep_cfg:step M cfg = none⊢ none.isSome = trueΓ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Prophstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'c₀:Cfg Γ Λh₀:P c₀h_unbounded:∀ (k : ℕ), ∃ N ≥ k, ∃ c', (c₀ [M]⊢^{N} c') ∧ P c'cfg:Cfg Γ Λk:ℕhk:c₀ [M]⊢^{k} cfgval✝:Cfg Γ Λhstep_cfg:cfg [M]⊢ val✝⊢ (some val✝).isSome = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Prophstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'c₀:Cfg Γ Λh₀:P c₀h_unbounded:∀ (k : ℕ), ∃ N ≥ k, ∃ c', (c₀ [M]⊢^{N} c') ∧ P c'cfg:Cfg Γ Λk:ℕhk:c₀ [M]⊢^{k} cfghstep_cfg:step M cfg = none⊢ none.isSome = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Prophstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'c₀:Cfg Γ Λh₀:P c₀h_unbounded:∀ (k : ℕ), ∃ N ≥ k, ∃ c', (c₀ [M]⊢^{N} c') ∧ P c'cfg:Cfg Γ Λk:ℕhk:c₀ [M]⊢^{k} cfghstep_cfg:step M cfg = noneN:ℕhNk:N ≥ k + 1c':Cfg Γ ΛhmsN:c₀ [M]⊢^{N} c'right✝:P c'⊢ none.isSome = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Prophstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'c₀:Cfg Γ Λh₀:P c₀h_unbounded:∀ (k : ℕ), ∃ N ≥ k, ∃ c', (c₀ [M]⊢^{N} c') ∧ P c'cfg:Cfg Γ Λk:ℕhk:c₀ [M]⊢^{k} cfghstep_cfg:step M cfg = noneN:ℕhNk:N ≥ k + 1c':Cfg Γ ΛhmsN:c₀ [M]⊢^{N} c'right✝:P c'hnone:(step M cfg).isNone = true⊢ none.isSome = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Prophstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'c₀:Cfg Γ Λh₀:P c₀h_unbounded:∀ (k : ℕ), ∃ N ≥ k, ∃ c', (c₀ [M]⊢^{N} c') ∧ P c'cfg:Cfg Γ Λk:ℕhk:c₀ [M]⊢^{k} cfghstep_cfg:step M cfg = noneN:ℕhNk:N ≥ k + 1c':Cfg Γ ΛhmsN:c₀ [M]⊢^{N} c'right✝:P c'hnone:(step M cfg).isNone = truehnoneN:multiStep M c₀ N = none⊢ none.isSome = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Prophstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'c₀:Cfg Γ Λh₀:P c₀h_unbounded:∀ (k : ℕ), ∃ N ≥ k, ∃ c', (c₀ [M]⊢^{N} c') ∧ P c'cfg:Cfg Γ Λk:ℕhk:c₀ [M]⊢^{k} cfghstep_cfg:step M cfg = noneN:ℕhNk:N ≥ k + 1c':Cfg Γ ΛhmsN:none = some c'right✝:P c'hnone:(step M cfg).isNone = truehnoneN:multiStep M c₀ N = none⊢ none.isSome = true All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Prophstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'c₀:Cfg Γ Λh₀:P c₀h_unbounded:∀ (k : ℕ), ∃ N ≥ k, ∃ c', (c₀ [M]⊢^{N} c') ∧ P c'cfg:Cfg Γ Λk:ℕhk:c₀ [M]⊢^{k} cfgval✝:Cfg Γ Λhstep_cfg:cfg [M]⊢ val✝⊢ (some val✝).isSome = true All goals completed! 🐙

If M reaches an invariant P from init [] that is closed under ReachesPlus, then IsNotHalt M.

theorem IsNotHalt.of_reachesPlus_invariant {M : Machine Γ Λ} {P : Cfg Γ Λ → Prop} {c₀ : Cfg Γ Λ} (hinit : ReachesStar M (init []) c₀) (h₀ : P c₀) (hstep : ∀ c, P c → ∃ c', ReachesPlus M c c' ∧ P c') : IsNotHalt M := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λhinit:init [] [M]⊢* c₀h₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'⊢ IsNotHalt M Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λhinit:init [] [M]⊢* c₀h₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀⊢ IsNotHalt M Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λh₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀k₀:ℕhk₀:init [] [M]⊢^{k₀} c₀⊢ IsNotHalt M Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λh₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀k₀:ℕhk₀:init [] [M]⊢^{k₀} c₀cfg:Cfg Γ Λk:ℕhk:init [] [M]⊢^{k} cfg⊢ (step M cfg).isSome = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λh₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀k₀:ℕhk₀:init [] [M]⊢^{k₀} c₀cfg:Cfg Γ Λk:ℕhk:init [] [M]⊢^{k} cfghlt:k < k₀⊢ (step M cfg).isSome = trueΓ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λh₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀k₀:ℕhk₀:init [] [M]⊢^{k₀} c₀cfg:Cfg Γ Λk:ℕhk:init [] [M]⊢^{k} cfghge:k ≥ k₀⊢ (step M cfg).isSome = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λh₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀k₀:ℕhk₀:init [] [M]⊢^{k₀} c₀cfg:Cfg Γ Λk:ℕhk:init [] [M]⊢^{k} cfghlt:k < k₀⊢ (step M cfg).isSome = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λh₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀k₀:ℕhk₀:init [] [M]⊢^{k₀} c₀cfg:Cfg Γ Λk:ℕhk:init [] [M]⊢^{k} cfghlt:k < k₀hstep_cfg:step M cfg = none⊢ none.isSome = trueΓ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λh₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀k₀:ℕhk₀:init [] [M]⊢^{k₀} c₀cfg:Cfg Γ Λk:ℕhk:init [] [M]⊢^{k} cfghlt:k < k₀val✝:Cfg Γ Λhstep_cfg:cfg [M]⊢ val✝⊢ (some val✝).isSome = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λh₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀k₀:ℕhk₀:init [] [M]⊢^{k₀} c₀cfg:Cfg Γ Λk:ℕhk:init [] [M]⊢^{k} cfghlt:k < k₀hstep_cfg:step M cfg = none⊢ none.isSome = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λh₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀k₀:ℕhk₀:init [] [M]⊢^{k₀} c₀cfg:Cfg Γ Λk:ℕhk:init [] [M]⊢^{k} cfghlt:k < k₀hstep_cfg:step M cfg = nonehnone:(step M cfg).isNone = true⊢ none.isSome = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λh₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀k₀:ℕhk₀:init [] [M]⊢^{k₀} c₀cfg:Cfg Γ Λk:ℕhk:init [] [M]⊢^{k} cfghlt:k < k₀hstep_cfg:step M cfg = nonehnone:(step M cfg).isNone = truehnone_k₀:multiStep M (init []) k₀ = none⊢ none.isSome = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λh₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀k₀:ℕhk₀:none = some c₀cfg:Cfg Γ Λk:ℕhk:init [] [M]⊢^{k} cfghlt:k < k₀hstep_cfg:step M cfg = nonehnone:(step M cfg).isNone = truehnone_k₀:multiStep M (init []) k₀ = none⊢ none.isSome = true All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λh₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀k₀:ℕhk₀:init [] [M]⊢^{k₀} c₀cfg:Cfg Γ Λk:ℕhk:init [] [M]⊢^{k} cfghlt:k < k₀val✝:Cfg Γ Λhstep_cfg:cfg [M]⊢ val✝⊢ (some val✝).isSome = true All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λh₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀k₀:ℕhk₀:init [] [M]⊢^{k₀} c₀cfg:Cfg Γ Λk:ℕhk:init [] [M]⊢^{k} cfghge:k ≥ k₀⊢ (step M cfg).isSome = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λh₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀k₀:ℕhk₀:init [] [M]⊢^{k₀} c₀cfg:Cfg Γ Λk:ℕhk:init [] [M]⊢^{k} cfghge:k ≥ k₀hsplit:k = k₀ + (k - k₀)⊢ (step M cfg).isSome = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛP:Cfg Γ Λ → Propc₀:Cfg Γ Λh₀:P c₀hstep:∀ (c : Cfg Γ Λ), P c → ∃ c', (c [M]⊢⁺ c') ∧ P c'h_never_c₀:NeverHaltsFrom M c₀k₀:ℕhk₀:init [] [M]⊢^{k₀} c₀cfg:Cfg Γ Λk:ℕhk:c₀ [M]⊢^{k - k₀} cfghge:k ≥ k₀hsplit:k = k₀ + (k - k₀)⊢ (step M cfg).isSome = true All goals completed! 🐙

Finite Block Repetition (l ^ n)

section ListPowomit [Inhabited Γ]@[simp] theorem list_pow_zero (l : List Γ) : l ^ (0 : ℕ) = [] := rfl@[simp] theorem list_pow_one (l : List Γ) : l ^ (1 : ℕ) = l := Γ:Type u_1l:List Γ⊢ l ^ 1 = l All goals completed! 🐙theorem list_pow_succ (l : List Γ) (n : ℕ) : l ^ (n + 1) = l ++ l ^ n := rfltheorem list_pow_add (l : List Γ) (m n : ℕ) : l ^ (m + n) = l ^ m ++ l ^ n := Γ:Type u_1l:List Γm:ℕn:ℕ⊢ l ^ (m + n) = l ^ m ++ l ^ n Γ:Type u_1l:List Γm:ℕn:ℕ⊢ (List.replicate (m + n) l).flatten = (List.replicate m l).flatten ++ (List.replicate n l).flatten All goals completed! 🐙theorem list_pow_succ' (l : List Γ) (n : ℕ) : l ^ (n + 1) = l ^ n ++ l := Γ:Type u_1l:List Γn:ℕ⊢ l ^ (n + 1) = l ^ n ++ l All goals completed! 🐙theorem list_pow_add_comm (l : List Γ) (m n : ℕ) : l ^ m ++ l ^ n = l ^ n ++ l ^ m := Γ:Type u_1l:List Γm:ℕn:ℕ⊢ l ^ m ++ l ^ n = l ^ n ++ l ^ m All goals completed! 🐙@[simp] theorem nil_pow (n : ℕ) : ([] : List Γ) ^ n = [] := Γ:Type u_1n:ℕ⊢ [] ^ n = [] induction n with Γ:Type u_1⊢ [] ^ 0 = [] All goals completed! 🐙 Γ:Type u_1n:ℕih:[] ^ n = []⊢ [] ^ (n + 1) = [] All goals completed! 🐙theorem singleton_pow (a : Γ) (n : ℕ) : ([a] : List Γ) ^ n = List.replicate n a := Γ:Type u_1a:Γn:ℕ⊢ [a] ^ n = List.replicate n a induction n with Γ:Type u_1a:Γ⊢ [a] ^ 0 = List.replicate 0 a All goals completed! 🐙 Γ:Type u_1a:Γn:ℕih:[a] ^ n = List.replicate n a⊢ [a] ^ (n + 1) = List.replicate (n + 1) a All goals completed! 🐙theorem list_pow_mul (l : List Γ) (m n : ℕ) : l ^ (m * n) = (l ^ m) ^ n := Γ:Type u_1l:List Γm:ℕn:ℕ⊢ l ^ (m * n) = (l ^ m) ^ n induction n with Γ:Type u_1l:List Γm:ℕ⊢ l ^ (m * 0) = (l ^ m) ^ 0 All goals completed! 🐙 Γ:Type u_1l:List Γm:ℕn:ℕih:l ^ (m * n) = (l ^ m) ^ n⊢ l ^ (m * (n + 1)) = (l ^ m) ^ (n + 1) All goals completed! 🐙theorem pair_pow_eq_singleton_pow_two_mul (a : Γ) (k : ℕ) : ([a, a] : List Γ) ^ k = ([a] : List Γ) ^ (2 * k) := Γ:Type u_1a:Γk:ℕ⊢ [a, a] ^ k = [a] ^ (2 * k) induction k with Γ:Type u_1a:Γ⊢ [a, a] ^ 0 = [a] ^ (2 * 0) All goals completed! 🐙 Γ:Type u_1a:Γk:ℕih:[a, a] ^ k = [a] ^ (2 * k)⊢ [a, a] ^ (k + 1) = [a] ^ (2 * (k + 1)) Γ:Type u_1a:Γk:ℕih:[a, a] ^ k = [a] ^ (2 * k)⊢ [a] ^ (2 * k) ++ [a, a] ^ 1 = [a] ^ (2 * k) ++ [a] ^ 2 All goals completed! 🐙theorem one_pow_two_mul (k : ℕ) : ([1, 1] : List (Fin 2)) ^ k = ([1] : List (Fin 2)) ^ (2 * k) := pair_pow_eq_singleton_pow_two_mul 1 ktheorem nat_even_or_odd_two_mul (n : ℕ) : (∃ k, n = 2 * k) ∨ (∃ k, n = 2 * k + 1) := n:ℕ⊢ (∃ k, n = 2 * k) ∨ ∃ k, n = 2 * k + 1 induction n with ⊢ (∃ k, 0 = 2 * k) ∨ ∃ k, 0 = 2 * k + 1 All goals completed! 🐙 n:ℕih:(∃ k, n = 2 * k) ∨ ∃ k, n = 2 * k + 1⊢ (∃ k, n + 1 = 2 * k) ∨ ∃ k, n + 1 = 2 * k + 1 k:ℕ⊢ (∃ k_1, 2 * k + 1 = 2 * k_1) ∨ ∃ k_1, 2 * k + 1 = 2 * k_1 + 1k:ℕ⊢ (∃ k_1, 2 * k + 1 + 1 = 2 * k_1) ∨ ∃ k_1, 2 * k + 1 + 1 = 2 * k_1 + 1 k:ℕ⊢ (∃ k_1, 2 * k + 1 = 2 * k_1) ∨ ∃ k_1, 2 * k + 1 = 2 * k_1 + 1 All goals completed! 🐙 k:ℕ⊢ (∃ k_1, 2 * k + 1 + 1 = 2 * k_1) ∨ ∃ k_1, 2 * k + 1 + 1 = 2 * k_1 + 1 exact Or.inl ⟨k + 1, k:ℕ⊢ 2 * k + 1 + 1 = 2 * (k + 1) All goals completed! 🐙⟩end ListPow

Half-Tape (ListBlank) & Directed-Head (Cfg.headRight / Cfg.headLeft) Lemmas

@[simp] theorem ListBlank.mk_nil : ListBlank.mk ([] : List Γ) = default := rfl@[simp] theorem ListBlank.head_default : (default : ListBlank Γ).head = default := rfl@[simp] theorem ListBlank.head_default_fin {n : ℕ} [NeZero n] : (default : ListBlank (Fin n)).head = 0 := rfl@[simp] theorem ListBlank.tail_default : (default : ListBlank Γ).tail = default := Quotient.sound' (Or.inl ⟨0, rfl⟩)@[simp] theorem ListBlank.cons_default_default : ListBlank.cons (default : Γ) (default : ListBlank Γ) = default := Γ:Type u_1inst✝:Inhabited Γ⊢ default >> default = default All goals completed! 🐙@[simp] theorem ListBlank.cons_zero_default {n : ℕ} [NeZero n] : ListBlank.cons (0 : Fin n) (default : ListBlank (Fin n)) = default := ListBlank.cons_default_defaulttheorem ListBlank.default_eq_append_default : (default : ListBlank Γ) = ListBlank.append [default] default := Γ:Type u_1inst✝:Inhabited Γ⊢ default = [default] +> default All goals completed! 🐙theorem ListBlank.default_eq_append_zero {n : ℕ} [NeZero n] : (default : ListBlank (Fin n)) = ListBlank.append [0] default := n:ℕinst✝:NeZero n⊢ default = [0] +> default All goals completed! 🐙@[simp] theorem ListBlank.append_nil (L : ListBlank Γ) : ListBlank.append ([] : List Γ) L = L := rfl@[simp] theorem ListBlank.append_cons (a : Γ) (l : List Γ) (L : ListBlank Γ) : ListBlank.append (a :: l) L = ListBlank.cons a (ListBlank.append l L) := rfltheorem ListBlank.append_append (s : ListBlank Γ) (l₁ l₂ : List Γ) : ListBlank.append l₂ (ListBlank.append l₁ s) = ListBlank.append (l₂ ++ l₁) s := (ListBlank.append_assoc l₂ l₁ s).symmtheorem ListBlank.append_comm_of_comm {l₁ l₂ : List Γ} (h : l₁ ++ l₂ = l₂ ++ l₁) (s : ListBlank Γ) : ListBlank.append l₂ (ListBlank.append l₁ s) = ListBlank.append l₁ (ListBlank.append l₂ s) := Γ:Type u_1inst✝:Inhabited Γl₁:List Γl₂:List Γh:l₁ ++ l₂ = l₂ ++ l₁s:ListBlank Γ⊢ l₂ +> l₁ +> s = l₁ +> l₂ +> s All goals completed! 🐙theorem ListBlank.append_pow_comm (u : List Γ) (k : ℕ) (s : ListBlank Γ) : ListBlank.append (u ^ k) (ListBlank.append u s) = ListBlank.append u (ListBlank.append (u ^ k) s) := Γ:Type u_1inst✝:Inhabited Γu:List Γk:ℕs:ListBlank Γ⊢ u ^ k +> u +> s = u +> u ^ k +> s Γ:Type u_1inst✝:Inhabited Γu:List Γk:ℕs:ListBlank Γ⊢ u ++ u ^ k = u ^ k ++ u All goals completed! 🐙theorem swap_single_pair_pow (a : Γ) (k : ℕ) (s : ListBlank Γ) : ListBlank.append (([a, a] : List Γ) ^ k) (ListBlank.append [a] s) = ListBlank.append [a] (ListBlank.append (([a, a] : List Γ) ^ k) s) := Γ:Type u_1inst✝:Inhabited Γa:Γk:ℕs:ListBlank Γ⊢ [a, a] ^ k +> [a] +> s = [a] +> [a, a] ^ k +> s All goals completed! 🐙theorem swap_1_11_pow (k : ℕ) (s : ListBlank (Fin 2)) : ListBlank.append (([1, 1] : List (Fin 2)) ^ k) (ListBlank.append [1] s) = ListBlank.append [1] (ListBlank.append (([1, 1] : List (Fin 2)) ^ k) s) := swap_single_pair_pow 1 k stheorem ListBlank.append_pow_succ (l : List Γ) (n : ℕ) (L : ListBlank Γ) : ListBlank.append (l ^ (n + 1)) L = ListBlank.append l (ListBlank.append (l ^ n) L) := Γ:Type u_1inst✝:Inhabited Γl:List Γn:ℕL:ListBlank Γ⊢ l ^ (n + 1) +> L = l +> l ^ n +> L All goals completed! 🐙theorem ListBlank.append_pow_add (l : List Γ) (m n : ℕ) (L : ListBlank Γ) : ListBlank.append (l ^ (m + n)) L = ListBlank.append (l ^ m) (ListBlank.append (l ^ n) L) := Γ:Type u_1inst✝:Inhabited Γl:List Γm:ℕn:ℕL:ListBlank Γ⊢ l ^ (m + n) +> L = l ^ m +> l ^ n +> L All goals completed! 🐙theorem append_10_pow_one (k : ℕ) (s : ListBlank (Fin 2)) : ListBlank.append (([1, 0] : List (Fin 2)) ^ k) (ListBlank.append [1] s) = ListBlank.append [1] (ListBlank.append (([0, 1] : List (Fin 2)) ^ k) s) := k:ℕs:ListBlank (Fin 2)⊢ [1, 0] ^ k +> [1] +> s = [1] +> [0, 1] ^ k +> s induction k generalizing s with s:ListBlank (Fin 2)⊢ [1, 0] ^ 0 +> [1] +> s = [1] +> [0, 1] ^ 0 +> s All goals completed! 🐙 k:ℕih:∀ (s : ListBlank (Fin 2)), [1, 0] ^ k +> [1] +> s = [1] +> [0, 1] ^ k +> ss:ListBlank (Fin 2)⊢ [1, 0] ^ (k + 1) +> [1] +> s = [1] +> [0, 1] ^ (k + 1) +> s k:ℕih:∀ (s : ListBlank (Fin 2)), [1, 0] ^ k +> [1] +> s = [1] +> [0, 1] ^ k +> ss:ListBlank (Fin 2)⊢ [1, 0] +> [1] +> [0, 1] ^ k +> s = [1] +> [0, 1] +> [0, 1] ^ k +> s All goals completed! 🐙theorem append_01_pow_zero (k : ℕ) (s : ListBlank (Fin 2)) : ListBlank.append (([0, 1] : List (Fin 2)) ^ k) (ListBlank.append [0] s) = ListBlank.append [0] (ListBlank.append (([1, 0] : List (Fin 2)) ^ k) s) := k:ℕs:ListBlank (Fin 2)⊢ [0, 1] ^ k +> [0] +> s = [0] +> [1, 0] ^ k +> s induction k generalizing s with s:ListBlank (Fin 2)⊢ [0, 1] ^ 0 +> [0] +> s = [0] +> [1, 0] ^ 0 +> s All goals completed! 🐙 k:ℕih:∀ (s : ListBlank (Fin 2)), [0, 1] ^ k +> [0] +> s = [0] +> [1, 0] ^ k +> ss:ListBlank (Fin 2)⊢ [0, 1] ^ (k + 1) +> [0] +> s = [0] +> [1, 0] ^ (k + 1) +> s k:ℕih:∀ (s : ListBlank (Fin 2)), [0, 1] ^ k +> [0] +> s = [0] +> [1, 0] ^ k +> ss:ListBlank (Fin 2)⊢ [0, 1] +> [0] +> [1, 0] ^ k +> s = [0] +> [1, 0] +> [1, 0] ^ k +> s All goals completed! 🐙theorem append_zero_10_pow_one (k : ℕ) (s : ListBlank (Fin 2)) : ListBlank.append [0] (ListBlank.append (([1, 0] : List (Fin 2)) ^ k) (ListBlank.append [1] s)) = ListBlank.append (([0, 1] : List (Fin 2)) ^ k) (ListBlank.append [0, 1] s) := k:ℕs:ListBlank (Fin 2)⊢ [0] +> [1, 0] ^ k +> [1] +> s = [0, 1] ^ k +> [0, 1] +> s k:ℕs:ListBlank (Fin 2)⊢ [0] +> [1] +> [0, 1] ^ k +> s = [0, 1] ^ k +> [0, 1] +> s k:ℕs:ListBlank (Fin 2)⊢ [0, 1] +> [0, 1] ^ k +> s = [0, 1] ^ k +> [0, 1] +> s All goals completed! 🐙theorem append_zero_10_pow_one_succ (k : ℕ) (s : ListBlank (Fin 2)) : ListBlank.append [0] (ListBlank.append (([1, 0] : List (Fin 2)) ^ k) (ListBlank.append [1] s)) = ListBlank.append (([0, 1] : List (Fin 2)) ^ (k + 1)) s := k:ℕs:ListBlank (Fin 2)⊢ [0] +> [1, 0] ^ k +> [1] +> s = [0, 1] ^ (k + 1) +> s k:ℕs:ListBlank (Fin 2)⊢ [0] +> [1] +> [0, 1] ^ k +> s = [0, 1] +> [0, 1] ^ k +> s All goals completed! 🐙

Standard List, ListBlank, and Power Lemmas

Common List and ListBlank lemmas used across official proofs.

theorem pow_zero_list {α : Type*} (u : List α) : u ^ (0 : ℕ) = [] := rfltheorem pow_succ_list {α : Type*} (u : List α) (n : ℕ) : u ^ (n + 1) = u ++ u ^ n := rfltheorem nil_append_list {α : Type*} (l : List α) : ([] : List α) ++ l = l := rfltheorem cons_append_list {α : Type*} (x : α) (xs ys : List α) : (x :: xs) ++ ys = x :: (xs ++ ys) := rfltheorem append_nil_list {α : Type*} (l : List α) : l ++ [] = l := List.append_nil ltheorem listblank_append_nil {α : Type*} [Inhabited α] (b : ListBlank α) : ([] : List α) +> b = b := rfltheorem listblank_append_cons {α : Type*} [Inhabited α] (x : α) (xs : List α) (b : ListBlank α) : (x :: xs) +> b = x >> (xs +> b) := rfltheorem default_head : (default : ListBlank (Fin 2)).head = 0 := rfltheorem default_tail : (default : ListBlank (Fin 2)).tail = default := rfltheorem zero_cons_default : (0 : Fin 2) >> default = default := ListBlank.cons_zero_defaulttheorem init_nil : (init ([] : List (Fin 2))) = ⟨some (0 : Fin 6), ⟨0, default, default⟩⟩ := rfltheorem listblank_append_right_assoc {α : Type*} [Inhabited α] (l₁ l₂ : List α) (s : ListBlank α) : (l₁ ++ l₂) +> s = l₁ +> (l₂ +> s) := α:Type u_3inst✝:Inhabited αl₁:List αl₂:List αs:ListBlank α⊢ (l₁ ++ l₂) +> s = l₁ +> l₂ +> s induction l₁ with α:Type u_3inst✝:Inhabited αl₂:List αs:ListBlank α⊢ ([] ++ l₂) +> s = [] +> l₂ +> s All goals completed! 🐙 α:Type u_3inst✝:Inhabited αl₂:List αs:ListBlank αx:αxs:List αih:(xs ++ l₂) +> s = xs +> l₂ +> s⊢ (x :: xs ++ l₂) +> s = (x :: xs) +> l₂ +> s All goals completed! 🐙theorem listblank_append_append {α : Type*} [Inhabited α] (s : ListBlank α) (l₁ l₂ : List α) : (s <+ l₁) <+ l₂ = s <+ (l₂ ++ l₁) := ListBlank.append_append s l₁ l₂theorem list_pow_append_one {α : Type*} (u : List α) (k : ℕ) : u ^ k ++ u = u ^ (k + 1) := (list_pow_succ' u k).symmtheorem pow_append_pow {α : Type*} [Inhabited α] (u : List α) (n m : ℕ) (T : ListBlank α) : (u ^ n) +> ((u ^ m) +> T) = (u ^ (n + m)) +> T := α:Type u_3inst✝:Inhabited αu:List αn:ℕm:ℕT:ListBlank α⊢ u ^ n +> u ^ m +> T = u ^ (n + m) +> T All goals completed! 🐙theorem ones_append_cons_one (n : ℕ) (T : ListBlank (Fin 2)) : (([1] : List (Fin 2)) ^ n) +> ((1 : Fin 2) >> T) = (1 : Fin 2) >> ((([1] : List (Fin 2)) ^ n) +> T) := n:ℕT:ListBlank (Fin 2)⊢ [1] ^ n +> 1 >> T = 1 >> [1] ^ n +> T induction n with T:ListBlank (Fin 2)⊢ [1] ^ 0 +> 1 >> T = 1 >> [1] ^ 0 +> T All goals completed! 🐙 T:ListBlank (Fin 2)k:ℕih:[1] ^ k +> 1 >> T = 1 >> [1] ^ k +> T⊢ [1] ^ (k + 1) +> 1 >> T = 1 >> [1] ^ (k + 1) +> T All goals completed! 🐙theorem zeros_append_cons_zero (n : ℕ) (T : ListBlank (Fin 2)) : (([0] : List (Fin 2)) ^ n) +> ((0 : Fin 2) >> T) = (0 : Fin 2) >> ((([0] : List (Fin 2)) ^ n) +> T) := n:ℕT:ListBlank (Fin 2)⊢ [0] ^ n +> 0 >> T = 0 >> [0] ^ n +> T induction n with T:ListBlank (Fin 2)⊢ [0] ^ 0 +> 0 >> T = 0 >> [0] ^ 0 +> T All goals completed! 🐙 T:ListBlank (Fin 2)k:ℕih:[0] ^ k +> 0 >> T = 0 >> [0] ^ k +> T⊢ [0] ^ (k + 1) +> 0 >> T = 0 >> [0] ^ (k + 1) +> T All goals completed! 🐙theorem zeros_append_default (n : ℕ) : (([0] : List (Fin 2)) ^ n) +> (default : ListBlank (Fin 2)) = default := n:ℕ⊢ [0] ^ n +> default = default induction n with ⊢ [0] ^ 0 +> default = default All goals completed! 🐙 k:ℕih:[0] ^ k +> default = default⊢ [0] ^ (k + 1) +> default = default All goals completed! 🐙theorem listblank_eq_one_cons_tail {Z : ListBlank (Fin 2)} (hZ : Z.head = 1) : Z = (1 : Fin 2) >> Z.tail := Z:ListBlank (Fin 2)hZ:Z.head = 1⊢ Z = 1 >> Z.tail All goals completed! 🐙theorem init_nil_eq_headRight : (init ([] : List Γ) : Cfg Γ Λ) = Cfg.headRight default default default := rfltheorem init_nil_eq_headLeft : (init ([] : List Γ) : Cfg Γ Λ) = Cfg.headLeft default default default := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited Λ⊢ init [] = Cfg.headLeft default default default All goals completed! 🐙omit [Inhabited Λ] in theorem Cfg.headRight_cons (q : Λ) (a : Γ) (l r : ListBlank Γ) : Cfg.headRight q l (ListBlank.cons a r) = Cfg.headLeft q (ListBlank.cons a l) r := Γ:Type u_1Λ:Type u_2inst✝:Inhabited Γq:Λa:Γl:ListBlank Γr:ListBlank Γ⊢ headRight q l (a >> r) = headLeft q (a >> l) r All goals completed! 🐙omit [Inhabited Λ] in theorem Cfg.headLeft_cons (q : Λ) (a : Γ) (l r : ListBlank Γ) : Cfg.headLeft q (ListBlank.cons a l) r = Cfg.headRight q l (ListBlank.cons a r) := Γ:Type u_1Λ:Type u_2inst✝:Inhabited Γq:Λa:Γl:ListBlank Γr:ListBlank Γ⊢ headLeft q (a >> l) r = headRight q l (a >> r) All goals completed! 🐙theorem step_headRight_right {M : Machine Γ Λ} {q q' : Λ} {a b : Γ} (hM : M q a = some (some q', Stmt.write b Dir.right)) (l r : ListBlank Γ) : step M (Cfg.headRight q l (ListBlank.cons a r)) = some (Cfg.headRight q' (ListBlank.cons b l) r) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λq:Λq':Λa:Γb:ΓhM:M q a = some (some q', { symbol := b, dir := Dir.right })l:ListBlank Γr:ListBlank Γ⊢ Cfg.headRight q l (a >> r) [M]⊢ Cfg.headRight q' (b >> l) r All goals completed! 🐙theorem step_headRight_left {M : Machine Γ Λ} {q q' : Λ} {a b : Γ} (hM : M q a = some (some q', Stmt.write b Dir.left)) (l r : ListBlank Γ) : step M (Cfg.headRight q l (ListBlank.cons a r)) = some (Cfg.headLeft q' l (ListBlank.cons b r)) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λq:Λq':Λa:Γb:ΓhM:M q a = some (some q', { symbol := b, dir := Dir.left })l:ListBlank Γr:ListBlank Γ⊢ Cfg.headRight q l (a >> r) [M]⊢ Cfg.headLeft q' l (b >> r) All goals completed! 🐙theorem step_headLeft_right {M : Machine Γ Λ} {q q' : Λ} {a b : Γ} (hM : M q a = some (some q', Stmt.write b Dir.right)) (l r : ListBlank Γ) : step M (Cfg.headLeft q (ListBlank.cons a l) r) = some (Cfg.headRight q' (ListBlank.cons b l) r) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λq:Λq':Λa:Γb:ΓhM:M q a = some (some q', { symbol := b, dir := Dir.right })l:ListBlank Γr:ListBlank Γ⊢ Cfg.headLeft q (a >> l) r [M]⊢ Cfg.headRight q' (b >> l) r All goals completed! 🐙theorem step_headLeft_left {M : Machine Γ Λ} {q q' : Λ} {a b : Γ} (hM : M q a = some (some q', Stmt.write b Dir.left)) (l r : ListBlank Γ) : step M (Cfg.headLeft q (ListBlank.cons a l) r) = some (Cfg.headLeft q' l (ListBlank.cons b r)) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λq:Λq':Λa:Γb:ΓhM:M q a = some (some q', { symbol := b, dir := Dir.left })l:ListBlank Γr:ListBlank Γ⊢ Cfg.headLeft q (a >> l) r [M]⊢ Cfg.headLeft q' l (b >> r) All goals completed! 🐙theorem step_headRight_none {M : Machine Γ Λ} {q : Λ} {a : Γ} (hM : M q a = none) (l r : ListBlank Γ) : step M (Cfg.headRight q l (ListBlank.cons a r)) = none := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λq:Λa:ΓhM:M q a = nonel:ListBlank Γr:ListBlank Γ⊢ step M (Cfg.headRight q l (a >> r)) = none All goals completed! 🐙theorem step_headLeft_none {M : Machine Γ Λ} {q : Λ} {a : Γ} (hM : M q a = none) (l r : ListBlank Γ) : step M (Cfg.headLeft q (ListBlank.cons a l) r) = none := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λq:Λa:ΓhM:M q a = nonel:ListBlank Γr:ListBlank Γ⊢ step M (Cfg.headLeft q (a >> l) r) = none All goals completed! 🐙theorem step_headRight_default_right {M : Machine Γ Λ} {q q' : Λ} {b : Γ} (hM : M q default = some (some q', Stmt.write b Dir.right)) (l : ListBlank Γ) : step M (Cfg.headRight q l default) = some (Cfg.headRight q' (ListBlank.cons b l) default) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λq:Λq':Λb:ΓhM:M q default = some (some q', { symbol := b, dir := Dir.right })l:ListBlank Γ⊢ Cfg.headRight q l default [M]⊢ Cfg.headRight q' (b >> l) default All goals completed! 🐙theorem step_headRight_default_left {M : Machine Γ Λ} {q q' : Λ} {b : Γ} (hM : M q default = some (some q', Stmt.write b Dir.left)) (l : ListBlank Γ) : step M (Cfg.headRight q l default) = some (Cfg.headLeft q' l (ListBlank.cons b default)) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λq:Λq':Λb:ΓhM:M q default = some (some q', { symbol := b, dir := Dir.left })l:ListBlank Γ⊢ Cfg.headRight q l default [M]⊢ Cfg.headLeft q' l (b >> default) All goals completed! 🐙theorem step_headLeft_default_right {M : Machine Γ Λ} {q q' : Λ} {b : Γ} (hM : M q default = some (some q', Stmt.write b Dir.right)) (r : ListBlank Γ) : step M (Cfg.headLeft q default r) = some (Cfg.headRight q' (ListBlank.cons b default) r) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λq:Λq':Λb:ΓhM:M q default = some (some q', { symbol := b, dir := Dir.right })r:ListBlank Γ⊢ Cfg.headLeft q default r [M]⊢ Cfg.headRight q' (b >> default) r All goals completed! 🐙theorem step_headLeft_default_left {M : Machine Γ Λ} {q q' : Λ} {b : Γ} (hM : M q default = some (some q', Stmt.write b Dir.left)) (r : ListBlank Γ) : step M (Cfg.headLeft q default r) = some (Cfg.headLeft q' default (ListBlank.cons b r)) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λq:Λq':Λb:ΓhM:M q default = some (some q', { symbol := b, dir := Dir.left })r:ListBlank Γ⊢ Cfg.headLeft q default r [M]⊢ Cfg.headLeft q' default (b >> r) All goals completed! 🐙

Tape Pattern Evaluation (evalTapeExpr, evalTapePattern)

@[simp] theorem evalTapeExpr_default (vars : ℕ → ℕ) : evalTapeExpr (TapeExpr.default : TapeExpr Γ) vars = default := rfl@[simp] theorem evalTapeExpr_sym (a : Γ) (rest : TapeExpr Γ) (vars : ℕ → ℕ) : evalTapeExpr (.sym a rest) vars = ListBlank.cons a (evalTapeExpr rest vars) := rfl@[simp] theorem evalTapeExpr_rep (blk : List Γ) (v : ℕ) (rest : TapeExpr Γ) (vars : ℕ → ℕ) : evalTapeExpr (.rep blk v rest) vars = ListBlank.append (blk ^ vars v) (evalTapeExpr rest vars) := rfl@[simp] theorem evalTapePattern_some (q : Λ) (l r : TapeExpr Γ) (vars : ℕ → ℕ) : evalTapePattern ⟨l, some q, r⟩ vars = Cfg.headRight q (evalTapeExpr l vars) (evalTapeExpr r vars) := rfl

Configuration cfg advances in ReachesPlus either to a member of ps or to a halting configuration of M.

def StepsToClosed (M : Machine Γ Λ) (ps : TapePatternSet Γ Λ) (cfg : Cfg Γ Λ) : Prop := ∃ cfg', ReachesPlus M cfg cfg' ∧ (IsInPatternSet ps cfg' ∨ (step M cfg').isNone)theorem StepsToClosed.of_reachesPlus {M : Machine Γ Λ} {ps : TapePatternSet Γ Λ} {c₁ c₂ : Cfg Γ Λ} (h : ReachesPlus M c₁ c₂) (hc₂ : StepsToClosed M ps c₂) : StepsToClosed M ps c₁ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λps:TapePatternSet Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λh:c₁ [M]⊢⁺ c₂hc₂:StepsToClosed M ps c₂⊢ StepsToClosed M ps c₁ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λps:TapePatternSet Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λh:c₁ [M]⊢⁺ c₂cfg':Cfg Γ Λh':c₂ [M]⊢⁺ cfg'h_end:IsInPatternSet ps cfg' ∨ (step M cfg').isNone = true⊢ StepsToClosed M ps c₁ All goals completed! 🐙theorem StepsToClosed.of_reachesStar {M : Machine Γ Λ} {ps : TapePatternSet Γ Λ} {c₁ c₂ : Cfg Γ Λ} (h : ReachesStar M c₁ c₂) (hc₂ : StepsToClosed M ps c₂) : StepsToClosed M ps c₁ := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λps:TapePatternSet Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λh:c₁ [M]⊢* c₂hc₂:StepsToClosed M ps c₂⊢ StepsToClosed M ps c₁ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ Λps:TapePatternSet Γ Λc₁:Cfg Γ Λc₂:Cfg Γ Λh:c₁ [M]⊢* c₂cfg':Cfg Γ Λh':c₂ [M]⊢⁺ cfg'h_end:IsInPatternSet ps cfg' ∨ (step M cfg').isNone = true⊢ StepsToClosed M ps c₁ All goals completed! 🐙theorem StepsToClosed.of_isInPatternSet {M : Machine Γ Λ} {ps : TapePatternSet Γ Λ} {c₁ c₂ : Cfg Γ Λ} (h : ReachesPlus M c₁ c₂) (hc₂ : IsInPatternSet ps c₂) : StepsToClosed M ps c₁ := ⟨c₂, h, Or.inl hc₂⟩theorem StepsToClosed.of_halting {M : Machine Γ Λ} {ps : TapePatternSet Γ Λ} {c₁ c₂ : Cfg Γ Λ} (h : ReachesPlus M c₁ c₂) (hc₂ : (step M c₂).isNone) : StepsToClosed M ps c₁ := ⟨c₂, h, Or.inr hc₂⟩

Collatz-Like Acceleration (CollatzHalts, IsValidAcceleration)

theorem CollatzHalts.of_next_eq_none {S : Type*} {next : S → Option S} {s : S} (h : next s = none) : CollatzHalts next s := ⟨1, S:Type u_3next:S → Option Ss:Sh:next s = none⊢ ((fun x ↦ x.bind next)^[1] (some s)).isNone = true All goals completed! 🐙⟩theorem CollatzHalts.of_next_eq_some {S : Type*} {next : S → Option S} {s s' : S} (h : next s = some s') (h' : CollatzHalts next s') : CollatzHalts next s := S:Type u_3next:S → Option Ss:Ss':Sh:next s = some s'h':CollatzHalts next s'⊢ CollatzHalts next s S:Type u_3next:S → Option Ss:Ss':Sh:next s = some s'n:ℕhn:((fun x ↦ x.bind next)^[n] (some s')).isNone = true⊢ CollatzHalts next s S:Type u_3next:S → Option Ss:Ss':Sh:next s = some s'n:ℕhn:((fun x ↦ x.bind next)^[n] (some s')).isNone = true⊢ ((fun x ↦ x.bind next)^[n + 1] (some s)).isNone = true S:Type u_3next:S → Option Ss:Ss':Sh:next s = some s'n:ℕhn:((fun x ↦ x.bind next)^[n] (some s')).isNone = true⊢ ((fun x ↦ x.bind next)^[n] ((some s).bind next)).isNone = true All goals completed! 🐙theorem IsValidAcceleration.haltsFrom_of_collatzHalts {M : Machine Γ Λ} {S : Type*} {start : S} {encode : S → Cfg Γ Λ} {next : S → Option S} (h : IsValidAcceleration M start encode next) {s : S} (hs : CollatzHalts next s) : HaltsFrom M (encode s) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts:Shs:CollatzHalts next s⊢ HaltsFrom M (encode s) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts:Sn:ℕhn:((fun x ↦ x.bind next)^[n] (some s)).isNone = true⊢ HaltsFrom M (encode s) induction n generalizing s with Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts:Shn:((fun x ↦ x.bind next)^[0] (some s)).isNone = true⊢ HaltsFrom M (encode s) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nextn:ℕih:∀ {s : S}, ((fun x ↦ x.bind next)^[n] (some s)).isNone = true → HaltsFrom M (encode s)s:Shn:((fun x ↦ x.bind next)^[n + 1] (some s)).isNone = true⊢ HaltsFrom M (encode s) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nextn:ℕih:∀ {s : S}, ((fun x ↦ x.bind next)^[n] (some s)).isNone = true → HaltsFrom M (encode s)s:Shn:((fun x ↦ x.bind next)^[n] ((some s).bind next)).isNone = true⊢ HaltsFrom M (encode s) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nextn:ℕih:∀ {s : S}, ((fun x ↦ x.bind next)^[n] (some s)).isNone = true → HaltsFrom M (encode s)s:Shn:((fun x ↦ x.bind next)^[n] ((some s).bind next)).isNone = truehnext:next s = none⊢ HaltsFrom M (encode s)Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nextn:ℕih:∀ {s : S}, ((fun x ↦ x.bind next)^[n] (some s)).isNone = true → HaltsFrom M (encode s)s:Shn:((fun x ↦ x.bind next)^[n] ((some s).bind next)).isNone = trues':Shnext:next s = some s'⊢ HaltsFrom M (encode s) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nextn:ℕih:∀ {s : S}, ((fun x ↦ x.bind next)^[n] (some s)).isNone = true → HaltsFrom M (encode s)s:Shn:((fun x ↦ x.bind next)^[n] ((some s).bind next)).isNone = truehnext:next s = none⊢ HaltsFrom M (encode s) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nextn:ℕih:∀ {s : S}, ((fun x ↦ x.bind next)^[n] (some s)).isNone = true → HaltsFrom M (encode s)s:Shn:((fun x ↦ x.bind next)^[n] ((some s).bind next)).isNone = trues':Shnext:next s = some s'⊢ HaltsFrom M (encode s) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nextn:ℕih:∀ {s : S}, ((fun x ↦ x.bind next)^[n] (some s)).isNone = true → HaltsFrom M (encode s)s:Shn:((fun x ↦ x.bind next)^[n] ((some s).bind next)).isNone = trues':Shnext:next s = some s'⊢ ((fun x ↦ x.bind next)^[n] (some s')).isNone = true All goals completed! 🐙

A valid Collatz-like acceleration of M preserves and reflects halting: M halts from the blank tape if and only if the accelerated transition function next halts from start.

theorem IsValidAcceleration.isHalt_iff {M : Machine Γ Λ} {S : Type*} {start : S} {encode : S → Cfg Γ Λ} {next : S → Option S} (h : IsValidAcceleration M start encode next) : IsHalt M ↔ CollatzHalts next start := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode next⊢ IsHalt M ↔ CollatzHalts next start Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode next⊢ IsHalt M → CollatzHalts next startΓ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode next⊢ CollatzHalts next start → IsHalt M Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode next⊢ IsHalt M → CollatzHalts next start Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexth_halt:IsHalt M⊢ CollatzHalts next start Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexth_halt:IsHalt Mh_not_collatz:¬CollatzHalts next start⊢ False Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexth_halt:IsHalt Mh_not_collatz:¬CollatzHalts next starth_not_halt:IsNotHalt M⊢ False Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexth_not_collatz:¬CollatzHalts next starth_not_halt:IsNotHalt Mcfg:Cfg Γ Λhreach:init [] [M]⊢* cfghnone:(step M cfg).isNone = true⊢ False Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexth_not_collatz:¬CollatzHalts next starth_not_halt:IsNotHalt Mcfg:Cfg Γ Λhreach:init [] [M]⊢* cfghnone:(step M cfg).isNone = truehsome:(step M cfg).isSome = true⊢ False Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexth_not_collatz:¬CollatzHalts next starth_not_halt:IsNotHalt Mcfg:Cfg Γ Λhreach:init [] [M]⊢* cfghnone:step M cfg = nonehsome:(step M cfg).isSome = true⊢ False All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode next⊢ CollatzHalts next start → IsHalt M Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexth_collatz:CollatzHalts next start⊢ IsHalt M All goals completed! 🐙

Standard 6-State Labels (SixState)

Standard control state labels A..F (0..5 : Fin 6) for 6-state Busy Beaver machines.

namespace SixState

State A (0 : Fin 6), the initial state.

abbrev A : Fin 6 := 0

State B (1 : Fin 6).

abbrev B : Fin 6 := 1

State C (2 : Fin 6).

abbrev C : Fin 6 := 2

State D (3 : Fin 6).

abbrev D : Fin 6 := 3

State E (4 : Fin 6).

abbrev E : Fin 6 := 4

State F (5 : Fin 6).

abbrev F : Fin 6 := 5end SixState

Standard 3-State Labels (ThreeState)

Standard control state labels A..C (0..2 : Fin 3) for 3-state Busy Beaver machines.

namespace ThreeState

State A (0 : Fin 3), the initial state.

abbrev A : Fin 3 := 0

State B (1 : Fin 3).

abbrev B : Fin 3 := 1

State C (2 : Fin 3).

abbrev C : Fin 3 := 2end ThreeState

Concrete Step Execution Tactics (bb_refl, bb_step, bb_steps, bb_halt)

Close a reflexive ReachesStar goal after normalizing directed-head configurations and ListBlank prefixes.

macro "bb_refl" : tactic => `(tactic| ( try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', List.cons_append, List.nil_append, List.append_nil, ListBlank.mk_nil, ListBlank.append, ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default, ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_default_default, ListBlank.cons_zero_default] exact ReachesStar.refl _ _))

Execute one concrete BusyBeaver.step on a ReachesPlus or ReachesStar goal and normalize the resulting tape configuration.

macro "bb_step" : tactic => `(tactic| ( first | refine ReachesPlus.head (by try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', List.cons_append, List.nil_append, List.append_nil, ListBlank.mk_nil, ListBlank.append, ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default, ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_default_default, ListBlank.cons_zero_default] rfl) ?_ | refine ReachesStar.head (by try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', List.cons_append, List.nil_append, List.append_nil, ListBlank.mk_nil, ListBlank.append, ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default, ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_default_default, ListBlank.cons_zero_default] rfl) ?_ try simp only [Tape.write, Tape.move, ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default, ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_default_default, ListBlank.cons_zero_default]))

Repeatedly step a ReachesPlus or ReachesStar goal until it closes by reflexivity (bb_refl) or reaches a symbolic head symbol.

macro "bb_steps" : tactic => `(tactic| repeat (first | bb_refl | bb_step))

Close a (step M cfg).isNone halting goal after normalizing directed-head configurations and ListBlank prefixes.

macro "bb_halt" : tactic => `(tactic| ( try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', List.cons_append, List.nil_append, List.append_nil, ListBlank.mk_nil, ListBlank.append, ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default, ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_default_default, ListBlank.cons_zero_default] rfl))

Directed-Head and Reachability Notations

(Defined in BusyBeaver.Defs)

Additional Half-Tape Power Lemmas

Reversed addition law for repeated block appendages on a ListBlank.

theorem ListBlank.append_pow_add_rev (s : ListBlank Γ) (u : List Γ) (m n : ℕ) : ListBlank.append (u ^ (m + n)) s = ListBlank.append (u ^ n) (ListBlank.append (u ^ m) s) := Γ:Type u_1inst✝:Inhabited Γs:ListBlank Γu:List Γm:ℕn:ℕ⊢ u ^ (m + n) +> s = u ^ n +> u ^ m +> s All goals completed! 🐙

Absorb one trailing copy of u into u ^ k on a ListBlank.

theorem ListBlank.append_pow_succ' (u : List Γ) (k : ℕ) (r : ListBlank Γ) : ListBlank.append (u ^ k) (ListBlank.append u r) = ListBlank.append (u ^ (k + 1)) r := Γ:Type u_1inst✝:Inhabited Γu:List Γk:ℕr:ListBlank Γ⊢ u ^ k +> u +> r = u ^ (k + 1) +> r All goals completed! 🐙

Shift [0, 1] ^ c on the blank half-tape into 0 :: [1, 0] ^ c.

theorem default_append_01_pow (c : ℕ) : ListBlank.append (([0, 1] : List (Fin 2)) ^ c) default = ListBlank.cons 0 (ListBlank.append (([1, 0] : List (Fin 2)) ^ c) default) := c:ℕ⊢ [0, 1] ^ c +> default = 0 >> [1, 0] ^ c +> default conv_lhs => c:ℕ| [0, 1] ^ c +> [0] +> default All goals completed! 🐙

Construct IsValidAcceleration from an initial reachability proof and a unified step theorem dispatching on next s.

theorem IsValidAcceleration.of_step {M : Machine Γ Λ} {S : Type*} {start : S} {encode : S → Cfg Γ Λ} {next : S → Option S} (h_init : ReachesStar M (init []) (encode start)) (h_step : ∀ s, match next s with | some s' => ReachesPlus M (encode s) (encode s') | none => ∃ cfg', ReachesStar M (encode s) cfg' ∧ (step M cfg').isNone) : IsValidAcceleration M start encode next where init_reaches := h_init step_some s s' h := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh_init:init [] [M]⊢* encode starth_step:∀ (s : S), match next s with | some s' => encode s [M]⊢⁺ encode s' | none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = trues:Ss':Sh:next s = some s'⊢ encode s [M]⊢⁺ encode s' Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh_init:init [] [M]⊢* encode starth_step:∀ (s : S), match next s with | some s' => encode s [M]⊢⁺ encode s' | none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = trues:Ss':Sh:next s = some s'hs:match next s with | some s' => encode s [M]⊢⁺ encode s' | none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true⊢ encode s [M]⊢⁺ encode s' Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh_init:init [] [M]⊢* encode starth_step:∀ (s : S), match next s with | some s' => encode s [M]⊢⁺ encode s' | none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = trues:Ss':Sh:next s = some s'hs:match some s' with | some s' => encode s [M]⊢⁺ encode s' | none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true⊢ encode s [M]⊢⁺ encode s' All goals completed! 🐙 step_none s h := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh_init:init [] [M]⊢* encode starth_step:∀ (s : S), match next s with | some s' => encode s [M]⊢⁺ encode s' | none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = trues:Sh:next s = none⊢ ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh_init:init [] [M]⊢* encode starth_step:∀ (s : S), match next s with | some s' => encode s [M]⊢⁺ encode s' | none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = trues:Sh:next s = nonehs:match next s with | some s' => encode s [M]⊢⁺ encode s' | none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true⊢ ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sh_init:init [] [M]⊢* encode starth_step:∀ (s : S), match next s with | some s' => encode s [M]⊢⁺ encode s' | none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = trues:Sh:next s = nonehs:match none with | some s' => encode s [M]⊢⁺ encode s' | none => ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true⊢ ∃ cfg', (encode s [M]⊢* cfg') ∧ (step M cfg').isNone = true All goals completed! 🐙

Derive IsClosedPatternSet M ps from a valid acceleration IsValidAcceleration M start encode next whose image encode characterizes ps and whose halting states step in ReachesPlus to a halting configuration.

theorem IsValidAcceleration.isClosedPatternSet {M : Machine Γ Λ} {S : Type*} {start : S} {encode : S → Cfg Γ Λ} {next : S → Option S} {ps : TapePatternSet Γ Λ} (h : IsValidAcceleration M start encode next) (h_in : ∀ s, IsInPatternSet ps (encode s)) (h_of_in : ∀ cfg, IsInPatternSet ps cfg → ∃ s, cfg = encode s) (h_halt_plus : ∀ s, next s = none → ∃ cfg', ReachesPlus M (encode s) cfg' ∧ (step M cfg').isNone) : IsClosedPatternSet M ps := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:TapePatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = true⊢ IsClosedPatternSet M ps Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:TapePatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = truecfg:Cfg Γ Λhcfg:IsInPatternSet ps cfg⊢ ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInPatternSet ps cfg' ∨ (step M cfg').isNone = true) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:TapePatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trues:Shcfg:IsInPatternSet ps (encode s)⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (IsInPatternSet ps cfg' ∨ (step M cfg').isNone = true) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:TapePatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trues:Shcfg:IsInPatternSet ps (encode s)hnext:next s = none⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (IsInPatternSet ps cfg' ∨ (step M cfg').isNone = true)Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:TapePatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trues:Shcfg:IsInPatternSet ps (encode s)s':Shnext:next s = some s'⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (IsInPatternSet ps cfg' ∨ (step M cfg').isNone = true) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:TapePatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trues:Shcfg:IsInPatternSet ps (encode s)hnext:next s = none⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (IsInPatternSet ps cfg' ∨ (step M cfg').isNone = true) Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:TapePatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trues:Shcfg:IsInPatternSet ps (encode s)hnext:next s = nonecfg':Cfg Γ Λhplus:encode s [M]⊢⁺ cfg'hnone:(step M cfg').isNone = true⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (IsInPatternSet ps cfg' ∨ (step M cfg').isNone = true) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:TapePatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trues:Shcfg:IsInPatternSet ps (encode s)s':Shnext:next s = some s'⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (IsInPatternSet ps cfg' ∨ (step M cfg').isNone = true) All goals completed! 🐙

Derive IsClosedStackPatternSet M ps from a valid acceleration IsValidAcceleration M start encode next whose image encode characterizes a well-formed ps and whose halting states step in ReachesPlus to a halting configuration.

theorem IsValidAcceleration.isClosedStackPatternSet [DecidableEq Γ] {M : Machine Γ Λ} {S : Type*} {start : S} {encode : S → Cfg Γ Λ} {next : S → Option S} {ps : StackPatternSet Γ Λ} (h : IsValidAcceleration M start encode next) (h_in : ∀ s, IsInStackPatternSet ps (encode s)) (h_of_in : ∀ cfg, IsInStackPatternSet ps cfg → ∃ s, cfg = encode s) (h_halt_plus : ∀ s, next s = none → ∃ cfg', ReachesPlus M (encode s) cfg' ∧ (step M cfg').isNone) (h_wf : IsWellFormedStackPatternSet ps := by rfl) : IsClosedStackPatternSet M ps := Γ:Type u_1Λ:Type u_2inst✝²:Inhabited Γinst✝¹:Inhabited Λinst✝:DecidableEq ΓM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:StackPatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInStackPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInStackPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trueh_wf:IsWellFormedStackPatternSet ps⊢ IsClosedStackPatternSet M ps Γ:Type u_1Λ:Type u_2inst✝²:Inhabited Γinst✝¹:Inhabited Λinst✝:DecidableEq ΓM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:StackPatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInStackPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInStackPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trueh_wf:IsWellFormedStackPatternSet pscfg:Cfg Γ Λhcfg:IsInStackPatternSet ps cfg⊢ ∃ cfg', (cfg [M]⊢⁺ cfg') ∧ (IsInStackPatternSet ps cfg' ∨ (step M cfg').isNone = true) Γ:Type u_1Λ:Type u_2inst✝²:Inhabited Γinst✝¹:Inhabited Λinst✝:DecidableEq ΓM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:StackPatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInStackPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInStackPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trueh_wf:IsWellFormedStackPatternSet pss:Shcfg:IsInStackPatternSet ps (encode s)⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (IsInStackPatternSet ps cfg' ∨ (step M cfg').isNone = true) Γ:Type u_1Λ:Type u_2inst✝²:Inhabited Γinst✝¹:Inhabited Λinst✝:DecidableEq ΓM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:StackPatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInStackPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInStackPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trueh_wf:IsWellFormedStackPatternSet pss:Shcfg:IsInStackPatternSet ps (encode s)hnext:next s = none⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (IsInStackPatternSet ps cfg' ∨ (step M cfg').isNone = true)Γ:Type u_1Λ:Type u_2inst✝²:Inhabited Γinst✝¹:Inhabited Λinst✝:DecidableEq ΓM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:StackPatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInStackPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInStackPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trueh_wf:IsWellFormedStackPatternSet pss:Shcfg:IsInStackPatternSet ps (encode s)s':Shnext:next s = some s'⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (IsInStackPatternSet ps cfg' ∨ (step M cfg').isNone = true) Γ:Type u_1Λ:Type u_2inst✝²:Inhabited Γinst✝¹:Inhabited Λinst✝:DecidableEq ΓM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:StackPatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInStackPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInStackPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trueh_wf:IsWellFormedStackPatternSet pss:Shcfg:IsInStackPatternSet ps (encode s)hnext:next s = none⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (IsInStackPatternSet ps cfg' ∨ (step M cfg').isNone = true) Γ:Type u_1Λ:Type u_2inst✝²:Inhabited Γinst✝¹:Inhabited Λinst✝:DecidableEq ΓM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:StackPatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInStackPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInStackPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trueh_wf:IsWellFormedStackPatternSet pss:Shcfg:IsInStackPatternSet ps (encode s)hnext:next s = nonecfg':Cfg Γ Λhplus:encode s [M]⊢⁺ cfg'hnone:(step M cfg').isNone = true⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (IsInStackPatternSet ps cfg' ∨ (step M cfg').isNone = true) All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝²:Inhabited Γinst✝¹:Inhabited Λinst✝:DecidableEq ΓM:Machine Γ ΛS:Type u_3start:Sencode:S → Cfg Γ Λnext:S → Option Sps:StackPatternSet Γ Λh:IsValidAcceleration M start encode nexth_in:∀ (s : S), IsInStackPatternSet ps (encode s)h_of_in:∀ (cfg : Cfg Γ Λ), IsInStackPatternSet ps cfg → ∃ s, cfg = encode sh_halt_plus:∀ (s : S), next s = none → ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (step M cfg').isNone = trueh_wf:IsWellFormedStackPatternSet pss:Shcfg:IsInStackPatternSet ps (encode s)s':Shnext:next s = some s'⊢ ∃ cfg', (encode s [M]⊢⁺ cfg') ∧ (IsInStackPatternSet ps cfg' ∨ (step M cfg').isNone = true) All goals completed! 🐙omit [Inhabited Γ] in private theorem evalStackSeg_two_word_of_bool (a₀ a₁ : Γ) (w : List Bool) : (((w.map fun b => if b then 1 else 0).map fun d => ([[a₀], [a₁]] : List (List Γ)).getD d []).flatten) = w.map (fun b => if b then a₁ else a₀) := Γ:Type u_1a₀:Γa₁:Γw:List Bool⊢ (List.map (fun d ↦ [[a₀], [a₁]].getD d []) (List.map (fun b ↦ if b = true then 1 else 0) w)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w induction w with Γ:Type u_1a₀:Γa₁:Γ⊢ (List.map (fun d ↦ [[a₀], [a₁]].getD d []) (List.map (fun b ↦ if b = true then 1 else 0) [])).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) [] All goals completed! 🐙 Γ:Type u_1a₀:Γa₁:Γb:Boolrest:List Boolih:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) (List.map (fun b ↦ if b = true then 1 else 0) rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) rest⊢ (List.map (fun d ↦ [[a₀], [a₁]].getD d []) (List.map (fun b ↦ if b = true then 1 else 0) (b :: rest))).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) (b :: rest) Γ:Type u_1a₀:Γa₁:Γrest:List Boolih:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) (List.map (fun b ↦ if b = true then 1 else 0) rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) rest⊢ (List.map (fun d ↦ [[a₀], [a₁]].getD d []) (List.map (fun b ↦ if b = true then 1 else 0) (false :: rest))).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) (false :: rest)Γ:Type u_1a₀:Γa₁:Γrest:List Boolih:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) (List.map (fun b ↦ if b = true then 1 else 0) rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) rest⊢ (List.map (fun d ↦ [[a₀], [a₁]].getD d []) (List.map (fun b ↦ if b = true then 1 else 0) (true :: rest))).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) (true :: rest) Γ:Type u_1a₀:Γa₁:Γrest:List Boolih:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) (List.map (fun b ↦ if b = true then 1 else 0) rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) rest⊢ (List.map (fun d ↦ [[a₀], [a₁]].getD d []) (List.map (fun b ↦ if b = true then 1 else 0) (false :: rest))).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) (false :: rest)Γ:Type u_1a₀:Γa₁:Γrest:List Boolih:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) (List.map (fun b ↦ if b = true then 1 else 0) rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) rest⊢ (List.map (fun d ↦ [[a₀], [a₁]].getD d []) (List.map (fun b ↦ if b = true then 1 else 0) (true :: rest))).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) (true :: rest) All goals completed! 🐙omit [Inhabited Γ] in private theorem exists_bool_of_evalStackSeg_two_word (a₀ a₁ : Γ) (ds : List ℕ) : ∃ w : List Bool, ((ds.map fun d => ([[a₀], [a₁]] : List (List Γ)).getD d []).flatten) = w.map (fun b => if b then a₁ else a₀) := Γ:Type u_1a₀:Γa₁:Γds:List ℕ⊢ ∃ w, (List.map (fun d ↦ [[a₀], [a₁]].getD d []) ds).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w induction ds with Γ:Type u_1a₀:Γa₁:Γ⊢ ∃ w, (List.map (fun d ↦ [[a₀], [a₁]].getD d []) []).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w All goals completed! 🐙 Γ:Type u_1a₀:Γa₁:Γd:ℕrest:List ℕih:∃ w, (List.map (fun d ↦ [[a₀], [a₁]].getD d []) rest).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w⊢ ∃ w, (List.map (fun d ↦ [[a₀], [a₁]].getD d []) (d :: rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w Γ:Type u_1a₀:Γa₁:Γd:ℕrest:List ℕw:List Boolhw:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) rest).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w⊢ ∃ w, (List.map (fun d ↦ [[a₀], [a₁]].getD d []) (d :: rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w Γ:Type u_1a₀:Γa₁:Γrest:List ℕw:List Boolhw:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) rest).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w⊢ ∃ w, (List.map (fun d ↦ [[a₀], [a₁]].getD d []) (0 :: rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) wΓ:Type u_1a₀:Γa₁:Γrest:List ℕw:List Boolhw:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) rest).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w⊢ ∃ w, (List.map (fun d ↦ [[a₀], [a₁]].getD d []) ((0 + 1) :: rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) wΓ:Type u_1a₀:Γa₁:Γrest:List ℕw:List Boolhw:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) rest).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) wd:ℕ⊢ ∃ w, (List.map (fun d ↦ [[a₀], [a₁]].getD d []) ((d + 1 + 1) :: rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w Γ:Type u_1a₀:Γa₁:Γrest:List ℕw:List Boolhw:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) rest).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w⊢ ∃ w, (List.map (fun d ↦ [[a₀], [a₁]].getD d []) (0 :: rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w Γ:Type u_1a₀:Γa₁:Γrest:List ℕw:List Boolhw:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) rest).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w⊢ (List.map (fun d ↦ [[a₀], [a₁]].getD d []) (0 :: rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) (false :: w) All goals completed! 🐙 Γ:Type u_1a₀:Γa₁:Γrest:List ℕw:List Boolhw:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) rest).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w⊢ ∃ w, (List.map (fun d ↦ [[a₀], [a₁]].getD d []) ((0 + 1) :: rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w Γ:Type u_1a₀:Γa₁:Γrest:List ℕw:List Boolhw:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) rest).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w⊢ (List.map (fun d ↦ [[a₀], [a₁]].getD d []) ((0 + 1) :: rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) (true :: w) All goals completed! 🐙 Γ:Type u_1a₀:Γa₁:Γrest:List ℕw:List Boolhw:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) rest).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) wd:ℕ⊢ ∃ w, (List.map (fun d ↦ [[a₀], [a₁]].getD d []) ((d + 1 + 1) :: rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w Γ:Type u_1a₀:Γa₁:Γrest:List ℕw:List Boolhw:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) rest).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) wd:ℕ⊢ (List.map (fun d ↦ [[a₀], [a₁]].getD d []) ((d + 1 + 1) :: rest)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w All goals completed! 🐙

Characterize a single two-symbol .word [[a₀], [a₁]] 0 StackExpr as the image of a List Bool word w mapped by fun b => if b then a₁ else a₀.

theorem exists_evalStackExpr_single_word_iff (a₀ a₁ : Γ) (s : ListBlank Γ) : (∃ (vars : ℕ → ℕ) (stks : ℕ → List ℕ), s = evalStackExpr [.word [[a₀], [a₁]] 0] vars stks) ↔ ∃ w : List Bool, s = ListBlank.append (w.map (fun b => if b then a₁ else a₀)) default := Γ:Type u_1inst✝:Inhabited Γa₀:Γa₁:Γs:ListBlank Γ⊢ (∃ vars stks, s = evalStackExpr [StackSeg.word [[a₀], [a₁]] 0] vars stks) ↔ ∃ w, s = List.map (fun b ↦ if b = true then a₁ else a₀) w +> default Γ:Type u_1inst✝:Inhabited Γa₀:Γa₁:Γs:ListBlank Γ⊢ (∃ vars stks, s = evalStackExpr [StackSeg.word [[a₀], [a₁]] 0] vars stks) → ∃ w, s = List.map (fun b ↦ if b = true then a₁ else a₀) w +> defaultΓ:Type u_1inst✝:Inhabited Γa₀:Γa₁:Γs:ListBlank Γ⊢ (∃ w, s = List.map (fun b ↦ if b = true then a₁ else a₀) w +> default) → ∃ vars stks, s = evalStackExpr [StackSeg.word [[a₀], [a₁]] 0] vars stks Γ:Type u_1inst✝:Inhabited Γa₀:Γa₁:Γs:ListBlank Γ⊢ (∃ vars stks, s = evalStackExpr [StackSeg.word [[a₀], [a₁]] 0] vars stks) → ∃ w, s = List.map (fun b ↦ if b = true then a₁ else a₀) w +> default Γ:Type u_1inst✝:Inhabited Γa₀:Γa₁:Γvars:ℕ → ℕstks:ℕ → List ℕ⊢ ∃ w, evalStackExpr [StackSeg.word [[a₀], [a₁]] 0] vars stks = List.map (fun b ↦ if b = true then a₁ else a₀) w +> default Γ:Type u_1inst✝:Inhabited Γa₀:Γa₁:Γvars:ℕ → ℕstks:ℕ → List ℕw:List Boolhw:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) (stks 0)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w⊢ ∃ w, evalStackExpr [StackSeg.word [[a₀], [a₁]] 0] vars stks = List.map (fun b ↦ if b = true then a₁ else a₀) w +> default Γ:Type u_1inst✝:Inhabited Γa₀:Γa₁:Γvars:ℕ → ℕstks:ℕ → List ℕw:List Boolhw:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) (stks 0)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w⊢ evalStackExpr [StackSeg.word [[a₀], [a₁]] 0] vars stks = List.map (fun b ↦ if b = true then a₁ else a₀) w +> default Γ:Type u_1inst✝:Inhabited Γa₀:Γa₁:Γvars:ℕ → ℕstks:ℕ → List ℕw:List Boolhw:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) (stks 0)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w⊢ (List.map (fun d ↦ [[a₀], [a₁]].getD d []) (stks 0)).flatten +> default = List.map (fun b ↦ if b = true then a₁ else a₀) w +> default All goals completed! 🐙 Γ:Type u_1inst✝:Inhabited Γa₀:Γa₁:Γs:ListBlank Γ⊢ (∃ w, s = List.map (fun b ↦ if b = true then a₁ else a₀) w +> default) → ∃ vars stks, s = evalStackExpr [StackSeg.word [[a₀], [a₁]] 0] vars stks Γ:Type u_1inst✝:Inhabited Γa₀:Γa₁:Γw:List Bool⊢ ∃ vars stks, List.map (fun b ↦ if b = true then a₁ else a₀) w +> default = evalStackExpr [StackSeg.word [[a₀], [a₁]] 0] vars stks Γ:Type u_1inst✝:Inhabited Γa₀:Γa₁:Γw:List Bool⊢ List.map (fun b ↦ if b = true then a₁ else a₀) w +> default = evalStackExpr [StackSeg.word [[a₀], [a₁]] 0] (fun x ↦ 0) fun x ↦ List.map (fun b ↦ if b = true then 1 else 0) w Γ:Type u_1inst✝:Inhabited Γa₀:Γa₁:Γw:List Boolhw:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) (List.map (fun b ↦ if b = true then 1 else 0) w)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w⊢ List.map (fun b ↦ if b = true then a₁ else a₀) w +> default = evalStackExpr [StackSeg.word [[a₀], [a₁]] 0] (fun x ↦ 0) fun x ↦ List.map (fun b ↦ if b = true then 1 else 0) w Γ:Type u_1inst✝:Inhabited Γa₀:Γa₁:Γw:List Boolhw:(List.map (fun d ↦ [[a₀], [a₁]].getD d []) (List.map (fun b ↦ if b = true then 1 else 0) w)).flatten = List.map (fun b ↦ if b = true then a₁ else a₀) w⊢ List.map (fun b ↦ if b = true then a₁ else a₀) w +> default = (List.map (fun d ↦ [[a₀], [a₁]].getD d []) (List.map (fun b ↦ if b = true then 1 else 0) w)).flatten +> default All goals completed! 🐙

Higher-Level Acceleration Reduction (CollatzReachesStar, CollatzStepsTo)

Any two valid Collatz-like accelerations of the same machine M have equivalent halting problems.

theorem IsValidAcceleration.collatzHalts_iff {M : Machine Γ Λ} {S₁ S₂ : Type*} {start₁ : S₁} {encode₁ : S₁ → Cfg Γ Λ} {next₁ : S₁ → Option S₁} {start₂ : S₂} {encode₂ : S₂ → Cfg Γ Λ} {next₂ : S₂ → Option S₂} (h₁ : IsValidAcceleration M start₁ encode₁ next₁) (h₂ : IsValidAcceleration M start₂ encode₂ next₂) : CollatzHalts next₁ start₁ ↔ CollatzHalts next₂ start₂ := h₁.isHalt_iff.symm.trans h₂.isHalt_iff

next reaches s₂ from s₁ in n steps.

def CollatzReachesIn {S : Type*} (next : S → Option S) (n : ℕ) (s₁ s₂ : S) : Prop := (Option.bind · next)^[n] (some s₁) = some s₂

next reaches s₂ from s₁ in zero or more steps.

def CollatzReachesStar {S : Type*} (next : S → Option S) (s₁ s₂ : S) : Prop := ∃ n : ℕ, CollatzReachesIn next n s₁ s₂

next reaches s₂ from s₁ in one or more steps.

def CollatzReachesPlus {S : Type*} (next : S → Option S) (s₁ s₂ : S) : Prop := ∃ n : ℕ, n > 0 ∧ CollatzReachesIn next n s₁ s₂

next from s either reaches s' in one or more steps (some s') or halts (none).

def CollatzStepsTo {S : Type*} (next : S → Option S) (s : S) : Option S → Prop | some s' => CollatzReachesPlus next s s' | none => CollatzHalts next s@[simp] private theorem iterate_bind_none {S : Type*} (next : S → Option S) (n : ℕ) : (Option.bind · next)^[n] none = none := S:Type u_3next:S → Option Sn:ℕ⊢ (fun x ↦ x.bind next)^[n] none = none induction n with S:Type u_3next:S → Option S⊢ (fun x ↦ x.bind next)^[0] none = none All goals completed! 🐙 S:Type u_3next:S → Option Sn:ℕih:(fun x ↦ x.bind next)^[n] none = none⊢ (fun x ↦ x.bind next)^[n + 1] none = none All goals completed! 🐙variable {S : Type*}private theorem CollatzReachesIn.head {next : S → Option S} {n : ℕ} {s₁ s₂ s₃ : S} (h₁ : next s₁ = some s₂) (h₂ : CollatzReachesIn next n s₂ s₃) : CollatzReachesIn next (n + 1) s₁ s₃ := S:Type u_3next:S → Option Sn:ℕs₁:Ss₂:Ss₃:Sh₁:next s₁ = some s₂h₂:CollatzReachesIn next n s₂ s₃⊢ CollatzReachesIn next (n + 1) s₁ s₃ S:Type u_3next:S → Option Sn:ℕs₁:Ss₂:Ss₃:Sh₁:next s₁ = some s₂h₂:(fun x ↦ x.bind next)^[n] (some s₂) = some s₃⊢ (fun x ↦ x.bind next)^[n + 1] (some s₁) = some s₃ S:Type u_3next:S → Option Sn:ℕs₁:Ss₂:Ss₃:Sh₁:next s₁ = some s₂h₂:(fun x ↦ x.bind next)^[n] (some s₂) = some s₃⊢ (fun x ↦ x.bind next)^[n] ((some s₁).bind next) = some s₃ All goals completed! 🐙private theorem CollatzReachesIn.trans {next : S → Option S} {m n : ℕ} {s₁ s₂ s₃ : S} (h₁ : CollatzReachesIn next m s₁ s₂) (h₂ : CollatzReachesIn next n s₂ s₃) : CollatzReachesIn next (m + n) s₁ s₃ := S:Type u_3next:S → Option Sm:ℕn:ℕs₁:Ss₂:Ss₃:Sh₁:CollatzReachesIn next m s₁ s₂h₂:CollatzReachesIn next n s₂ s₃⊢ CollatzReachesIn next (m + n) s₁ s₃ S:Type u_3next:S → Option Sm:ℕn:ℕs₁:Ss₂:Ss₃:Sh₁:(fun x ↦ x.bind next)^[m] (some s₁) = some s₂h₂:(fun x ↦ x.bind next)^[n] (some s₂) = some s₃⊢ (fun x ↦ x.bind next)^[m + n] (some s₁) = some s₃ All goals completed! 🐙theorem CollatzReachesStar.refl (next : S → Option S) (s : S) : CollatzReachesStar next s s := ⟨0, rfl⟩theorem CollatzReachesStar.head {next : S → Option S} {s₁ s₂ s₃ : S} (h₁ : next s₁ = some s₂) (h₂ : CollatzReachesStar next s₂ s₃) : CollatzReachesStar next s₁ s₃ := let ⟨n, hn⟩ := h₂ ⟨n + 1, CollatzReachesIn.head h₁ hn⟩theorem CollatzReachesStar.single {next : S → Option S} {s₁ s₂ : S} (h : next s₁ = some s₂) : CollatzReachesStar next s₁ s₂ := CollatzReachesStar.head h (CollatzReachesStar.refl next s₂)theorem CollatzReachesPlus.single {next : S → Option S} {s₁ s₂ : S} (h : next s₁ = some s₂) : CollatzReachesPlus next s₁ s₂ := ⟨1, Nat.succ_pos 0, CollatzReachesIn.head h rfl⟩theorem CollatzReachesPlus.to_star {next : S → Option S} {s₁ s₂ : S} (h : CollatzReachesPlus next s₁ s₂) : CollatzReachesStar next s₁ s₂ := let ⟨n, _, hn⟩ := h ⟨n, hn⟩theorem CollatzReachesPlus.head {next : S → Option S} {s₁ s₂ s₃ : S} (h₁ : next s₁ = some s₂) (h₂ : CollatzReachesStar next s₂ s₃) : CollatzReachesPlus next s₁ s₃ := let ⟨n, hn⟩ := h₂ ⟨n + 1, Nat.succ_pos n, CollatzReachesIn.head h₁ hn⟩private theorem CollatzReachesStar.trans_plus {next : S → Option S} {s₁ s₂ s₃ : S} (h₁ : CollatzReachesStar next s₁ s₂) (h₂ : CollatzReachesPlus next s₂ s₃) : CollatzReachesPlus next s₁ s₃ := let ⟨m, hm⟩ := h₁ let ⟨n, hn_pos, hn⟩ := h₂ ⟨m + n, Nat.add_pos_right m hn_pos, hm.trans hn⟩private theorem CollatzHalts.of_reachesStar {next : S → Option S} {s₁ s₂ : S} (h₁ : CollatzReachesStar next s₁ s₂) (h₂ : CollatzHalts next s₂) : CollatzHalts next s₁ := S:Type u_3next:S → Option Ss₁:Ss₂:Sh₁:CollatzReachesStar next s₁ s₂h₂:CollatzHalts next s₂⊢ CollatzHalts next s₁ S:Type u_3next:S → Option Ss₁:Ss₂:Sh₂:CollatzHalts next s₂m:ℕhm:CollatzReachesIn next m s₁ s₂⊢ CollatzHalts next s₁ S:Type u_3next:S → Option Ss₁:Ss₂:Sm:ℕhm:CollatzReachesIn next m s₁ s₂n:ℕhn:((fun x ↦ x.bind next)^[n] (some s₂)).isNone = true⊢ CollatzHalts next s₁ S:Type u_3next:S → Option Ss₁:Ss₂:Sm:ℕhm:CollatzReachesIn next m s₁ s₂n:ℕhn:((fun x ↦ x.bind next)^[n] (some s₂)).isNone = true⊢ ((fun x ↦ x.bind next)^[m + n] (some s₁)).isNone = true S:Type u_3next:S → Option Ss₁:Ss₂:Sm:ℕhm:(fun x ↦ x.bind next)^[m] (some s₁) = some s₂n:ℕhn:((fun x ↦ x.bind next)^[n] (some s₂)).isNone = true⊢ ((fun x ↦ x.bind next)^[m + n] (some s₁)).isNone = true All goals completed! 🐙theorem CollatzStepsTo.of_eq {next : S → Option S} {s : S} {res : Option S} (h : next s = res) : CollatzStepsTo next s res := S:Type u_3next:S → Option Ss:Sres:Option Sh:next s = res⊢ CollatzStepsTo next s res S:Type u_3next:S → Option Ss:Sh:next s = none⊢ CollatzStepsTo next s noneS:Type u_3next:S → Option Ss:Ss':Sh:next s = some s'⊢ CollatzStepsTo next s (some s') S:Type u_3next:S → Option Ss:Sh:next s = none⊢ CollatzStepsTo next s none All goals completed! 🐙 S:Type u_3next:S → Option Ss:Ss':Sh:next s = some s'⊢ CollatzStepsTo next s (some s') All goals completed! 🐙theorem CollatzStepsTo.head {next : S → Option S} {s₁ s₂ : S} {res : Option S} (h₁ : next s₁ = some s₂) (h₂ : CollatzStepsTo next s₂ res) : CollatzStepsTo next s₁ res := S:Type u_3next:S → Option Ss₁:Ss₂:Sres:Option Sh₁:next s₁ = some s₂h₂:CollatzStepsTo next s₂ res⊢ CollatzStepsTo next s₁ res S:Type u_3next:S → Option Ss₁:Ss₂:Sh₁:next s₁ = some s₂h₂:CollatzStepsTo next s₂ none⊢ CollatzStepsTo next s₁ noneS:Type u_3next:S → Option Ss₁:Ss₂:Sh₁:next s₁ = some s₂s':Sh₂:CollatzStepsTo next s₂ (some s')⊢ CollatzStepsTo next s₁ (some s') S:Type u_3next:S → Option Ss₁:Ss₂:Sh₁:next s₁ = some s₂h₂:CollatzStepsTo next s₂ none⊢ CollatzStepsTo next s₁ none All goals completed! 🐙 S:Type u_3next:S → Option Ss₁:Ss₂:Sh₁:next s₁ = some s₂s':Sh₂:CollatzStepsTo next s₂ (some s')⊢ CollatzStepsTo next s₁ (some s') All goals completed! 🐙theorem CollatzStepsTo.of_reachesStar {next : S → Option S} {s₁ s₂ : S} {res : Option S} (h₁ : CollatzReachesStar next s₁ s₂) (h₂ : CollatzStepsTo next s₂ res) : CollatzStepsTo next s₁ res := S:Type u_3next:S → Option Ss₁:Ss₂:Sres:Option Sh₁:CollatzReachesStar next s₁ s₂h₂:CollatzStepsTo next s₂ res⊢ CollatzStepsTo next s₁ res S:Type u_3next:S → Option Ss₁:Ss₂:Sh₁:CollatzReachesStar next s₁ s₂h₂:CollatzStepsTo next s₂ none⊢ CollatzStepsTo next s₁ noneS:Type u_3next:S → Option Ss₁:Ss₂:Sh₁:CollatzReachesStar next s₁ s₂s':Sh₂:CollatzStepsTo next s₂ (some s')⊢ CollatzStepsTo next s₁ (some s') S:Type u_3next:S → Option Ss₁:Ss₂:Sh₁:CollatzReachesStar next s₁ s₂h₂:CollatzStepsTo next s₂ none⊢ CollatzStepsTo next s₁ none All goals completed! 🐙 S:Type u_3next:S → Option Ss₁:Ss₂:Sh₁:CollatzReachesStar next s₁ s₂s':Sh₂:CollatzStepsTo next s₂ (some s')⊢ CollatzStepsTo next s₁ (some s') All goals completed! 🐙private theorem IsValidAcceleration.reachesStar_of_collatzReachesIn {M : Machine Γ Λ} {S : Type*} {start : S} {encode : S → Cfg Γ Λ} {next : S → Option S} (h : IsValidAcceleration M start encode next) {n : ℕ} {s₁ s₂ : S} (hs : CollatzReachesIn next n s₁ s₂) : ReachesStar M (encode s₁) (encode s₂) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nextn:ℕs₁:Ss₂:Shs:CollatzReachesIn next n s₁ s₂⊢ encode s₁ [M]⊢* encode s₂ induction n generalizing s₁ with Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₂:Ss₁:Shs:CollatzReachesIn next 0 s₁ s₂⊢ encode s₁ [M]⊢* encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₂:Ss₁:Shs:(fun x ↦ x.bind next)^[0] (some s₁) = some s₂⊢ encode s₁ [M]⊢* encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₂:Ss₁:Shs:s₁ = s₂⊢ encode s₁ [M]⊢* encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:S⊢ encode s₁ [M]⊢* encode s₁ All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₂:Sn:ℕih:∀ {s₁ : S}, CollatzReachesIn next n s₁ s₂ → encode s₁ [M]⊢* encode s₂s₁:Shs:CollatzReachesIn next (n + 1) s₁ s₂⊢ encode s₁ [M]⊢* encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₂:Sn:ℕih:∀ {s₁ : S}, CollatzReachesIn next n s₁ s₂ → encode s₁ [M]⊢* encode s₂s₁:Shs:(fun x ↦ x.bind next)^[n + 1] (some s₁) = some s₂⊢ encode s₁ [M]⊢* encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₂:Sn:ℕih:∀ {s₁ : S}, CollatzReachesIn next n s₁ s₂ → encode s₁ [M]⊢* encode s₂s₁:Shs:(fun x ↦ x.bind next)^[n] ((some s₁).bind next) = some s₂⊢ encode s₁ [M]⊢* encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₂:Sn:ℕih:∀ {s₁ : S}, CollatzReachesIn next n s₁ s₂ → encode s₁ [M]⊢* encode s₂s₁:Shs:(fun x ↦ x.bind next)^[n] ((some s₁).bind next) = some s₂hnext:next s₁ = none⊢ encode s₁ [M]⊢* encode s₂Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₂:Sn:ℕih:∀ {s₁ : S}, CollatzReachesIn next n s₁ s₂ → encode s₁ [M]⊢* encode s₂s₁:Shs:(fun x ↦ x.bind next)^[n] ((some s₁).bind next) = some s₂s':Shnext:next s₁ = some s'⊢ encode s₁ [M]⊢* encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₂:Sn:ℕih:∀ {s₁ : S}, CollatzReachesIn next n s₁ s₂ → encode s₁ [M]⊢* encode s₂s₁:Shs:(fun x ↦ x.bind next)^[n] ((some s₁).bind next) = some s₂hnext:next s₁ = none⊢ encode s₁ [M]⊢* encode s₂ All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₂:Sn:ℕih:∀ {s₁ : S}, CollatzReachesIn next n s₁ s₂ → encode s₁ [M]⊢* encode s₂s₁:Shs:(fun x ↦ x.bind next)^[n] ((some s₁).bind next) = some s₂s':Shnext:next s₁ = some s'⊢ encode s₁ [M]⊢* encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₂:Sn:ℕih:∀ {s₁ : S}, CollatzReachesIn next n s₁ s₂ → encode s₁ [M]⊢* encode s₂s₁:Shs:(fun x ↦ x.bind next)^[n] ((some s₁).bind next) = some s₂s':Shnext:next s₁ = some s'⊢ CollatzReachesIn next n s' s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₂:Sn:ℕih:∀ {s₁ : S}, CollatzReachesIn next n s₁ s₂ → encode s₁ [M]⊢* encode s₂s₁:Shs:(fun x ↦ x.bind next)^[n] ((some s₁).bind next) = some s₂s':Shnext:next s₁ = some s'⊢ (fun x ↦ x.bind next)^[n] (some s') = some s₂ All goals completed! 🐙private theorem IsValidAcceleration.reachesStar_of_collatzReachesStar {M : Machine Γ Λ} {S : Type*} {start : S} {encode : S → Cfg Γ Λ} {next : S → Option S} (h : IsValidAcceleration M start encode next) {s₁ s₂ : S} (hs : CollatzReachesStar next s₁ s₂) : ReachesStar M (encode s₁) (encode s₂) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Shs:CollatzReachesStar next s₁ s₂⊢ encode s₁ [M]⊢* encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Sn:ℕhn:CollatzReachesIn next n s₁ s₂⊢ encode s₁ [M]⊢* encode s₂ All goals completed! 🐙private theorem IsValidAcceleration.reachesPlus_of_collatzReachesPlus {M : Machine Γ Λ} {S : Type*} {start : S} {encode : S → Cfg Γ Λ} {next : S → Option S} (h : IsValidAcceleration M start encode next) {s₁ s₂ : S} (hs : CollatzReachesPlus next s₁ s₂) : ReachesPlus M (encode s₁) (encode s₂) := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Shs:CollatzReachesPlus next s₁ s₂⊢ encode s₁ [M]⊢⁺ encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Sn:ℕhn_pos:n > 0hn:CollatzReachesIn next n s₁ s₂⊢ encode s₁ [M]⊢⁺ encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Shn_pos:0 > 0hn:CollatzReachesIn next 0 s₁ s₂⊢ encode s₁ [M]⊢⁺ encode s₂Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Sn:ℕhn_pos:n + 1 > 0hn:CollatzReachesIn next (n + 1) s₁ s₂⊢ encode s₁ [M]⊢⁺ encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Shn_pos:0 > 0hn:CollatzReachesIn next 0 s₁ s₂⊢ encode s₁ [M]⊢⁺ encode s₂ All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Sn:ℕhn_pos:n + 1 > 0hn:CollatzReachesIn next (n + 1) s₁ s₂⊢ encode s₁ [M]⊢⁺ encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Sn:ℕhn_pos:n + 1 > 0hn:(fun x ↦ x.bind next)^[n + 1] (some s₁) = some s₂⊢ encode s₁ [M]⊢⁺ encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Sn:ℕhn_pos:n + 1 > 0hn:(fun x ↦ x.bind next)^[n] ((some s₁).bind next) = some s₂⊢ encode s₁ [M]⊢⁺ encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Sn:ℕhn_pos:n + 1 > 0hn:(fun x ↦ x.bind next)^[n] ((some s₁).bind next) = some s₂hnext:next s₁ = none⊢ encode s₁ [M]⊢⁺ encode s₂Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Sn:ℕhn_pos:n + 1 > 0hn:(fun x ↦ x.bind next)^[n] ((some s₁).bind next) = some s₂s':Shnext:next s₁ = some s'⊢ encode s₁ [M]⊢⁺ encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Sn:ℕhn_pos:n + 1 > 0hn:(fun x ↦ x.bind next)^[n] ((some s₁).bind next) = some s₂hnext:next s₁ = none⊢ encode s₁ [M]⊢⁺ encode s₂ All goals completed! 🐙 Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Sn:ℕhn_pos:n + 1 > 0hn:(fun x ↦ x.bind next)^[n] ((some s₁).bind next) = some s₂s':Shnext:next s₁ = some s'⊢ encode s₁ [M]⊢⁺ encode s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Sn:ℕhn_pos:n + 1 > 0hn:(fun x ↦ x.bind next)^[n] ((some s₁).bind next) = some s₂s':Shnext:next s₁ = some s'⊢ CollatzReachesIn next n s' s₂ Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4start:Sencode:S → Cfg Γ Λnext:S → Option Sh:IsValidAcceleration M start encode nexts₁:Ss₂:Sn:ℕhn_pos:n + 1 > 0hn:(fun x ↦ x.bind next)^[n] ((some s₁).bind next) = some s₂s':Shnext:next s₁ = some s'⊢ (fun x ↦ x.bind next)^[n] (some s') = some s₂ All goals completed! 🐙

Construct a higher-level IsValidAcceleration from a base IsValidAcceleration by showing that start reaches embed highLevelStart under next and each step of highLevelNext is simulated by one or more steps of next.

theorem IsValidAcceleration.of_collatz {M : Machine Γ Λ} {S H : Type*} {start : S} {encode : S → Cfg Γ Λ} {next : S → Option S} {highLevelStart : H} {embed : H → S} {highLevelNext : H → Option H} (h : IsValidAcceleration M start encode next) (h_init : CollatzReachesStar next start (embed highLevelStart)) (h_step : ∀ u, CollatzStepsTo next (embed u) ((highLevelNext u).map embed)) : IsValidAcceleration M highLevelStart (fun u => encode (embed u)) highLevelNext where init_reaches := h.init_reaches.trans (h.reachesStar_of_collatzReachesStar h_init) step_some u u' hu := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4H:Type u_5start:Sencode:S → Cfg Γ Λnext:S → Option ShighLevelStart:Hembed:H → ShighLevelNext:H → Option Hh:IsValidAcceleration M start encode nexth_init:CollatzReachesStar next start (embed highLevelStart)h_step:∀ (u : H), CollatzStepsTo next (embed u) (Option.map embed (highLevelNext u))u:Hu':Hhu:highLevelNext u = some u'⊢ encode (embed u) [M]⊢⁺ encode (embed u') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4H:Type u_5start:Sencode:S → Cfg Γ Λnext:S → Option ShighLevelStart:Hembed:H → ShighLevelNext:H → Option Hh:IsValidAcceleration M start encode nexth_init:CollatzReachesStar next start (embed highLevelStart)h_step:∀ (u : H), CollatzStepsTo next (embed u) (Option.map embed (highLevelNext u))u:Hu':Hhu:highLevelNext u = some u'hs:CollatzStepsTo next (embed u) (Option.map embed (highLevelNext u))⊢ encode (embed u) [M]⊢⁺ encode (embed u') Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4H:Type u_5start:Sencode:S → Cfg Γ Λnext:S → Option ShighLevelStart:Hembed:H → ShighLevelNext:H → Option Hh:IsValidAcceleration M start encode nexth_init:CollatzReachesStar next start (embed highLevelStart)h_step:∀ (u : H), CollatzStepsTo next (embed u) (Option.map embed (highLevelNext u))u:Hu':Hhu:highLevelNext u = some u'hs:CollatzStepsTo next (embed u) (some (embed u'))⊢ encode (embed u) [M]⊢⁺ encode (embed u') All goals completed! 🐙 step_none u hu := Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4H:Type u_5start:Sencode:S → Cfg Γ Λnext:S → Option ShighLevelStart:Hembed:H → ShighLevelNext:H → Option Hh:IsValidAcceleration M start encode nexth_init:CollatzReachesStar next start (embed highLevelStart)h_step:∀ (u : H), CollatzStepsTo next (embed u) (Option.map embed (highLevelNext u))u:Hhu:highLevelNext u = none⊢ ∃ cfg', (encode (embed u) [M]⊢* cfg') ∧ (step M cfg').isNone = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4H:Type u_5start:Sencode:S → Cfg Γ Λnext:S → Option ShighLevelStart:Hembed:H → ShighLevelNext:H → Option Hh:IsValidAcceleration M start encode nexth_init:CollatzReachesStar next start (embed highLevelStart)h_step:∀ (u : H), CollatzStepsTo next (embed u) (Option.map embed (highLevelNext u))u:Hhu:highLevelNext u = nonehs:CollatzStepsTo next (embed u) (Option.map embed (highLevelNext u))⊢ ∃ cfg', (encode (embed u) [M]⊢* cfg') ∧ (step M cfg').isNone = true Γ:Type u_1Λ:Type u_2inst✝¹:Inhabited Γinst✝:Inhabited ΛM:Machine Γ ΛS:Type u_4H:Type u_5start:Sencode:S → Cfg Γ Λnext:S → Option ShighLevelStart:Hembed:H → ShighLevelNext:H → Option Hh:IsValidAcceleration M start encode nexth_init:CollatzReachesStar next start (embed highLevelStart)h_step:∀ (u : H), CollatzStepsTo next (embed u) (Option.map embed (highLevelNext u))u:Hhu:highLevelNext u = nonehs:CollatzStepsTo next (embed u) none⊢ ∃ cfg', (encode (embed u) [M]⊢* cfg') ∧ (step M cfg').isNone = true All goals completed! 🐙end BusyBeaver