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

Semantics of weak_collatz_75 (WeakCollatz75)

Links blank-tape halting of the 75-state machine weakCollatz75 (halts_weakCollatz75_iff_bounded_cycle) to:

    Constructive nontrivial cycle existence (halts_weakCollatz75_iff_exists_cycle, zero Classical.choice): via a constructive finite-pigeonhole reduction on the cycle maximum M showing that any positive cycle terras^[k] x = x outside {1, 2} has a member M ≥ 3 whose period j satisfies 1 ≤ j ≤ M - 2 ≤ M;

    Constructive Böhm–Sontacchi (1978) Diophantine cycle equation (halts_weakCollatz75_iff_bohmSontacchi, zero Classical.choice): connecting halting directly to (2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x) (the #1 audited paper on ccchallenge.org);

    Tao's Weak Collatz Conjecture (halts_weakCollatz75_iff_not_weakCollatz): Halts weakCollatz75 ↔ ¬ WeakCollatzConjecture.

@[expose] public sectionnamespace ConjectureMachines.WeakCollatz75private def findEq (f : ℕ → ℕ) (target : ℕ) : ℕ → Option ℕ | 0 => if f 0 = target then some 0 else none | r + 1 => match findEq f target r with | some i => some i | none => if f (r + 1) = target then some (r + 1) else noneprivate theorem findEq_some_spec (f : ℕ → ℕ) (target r i : ℕ) (h : findEq f target r = some i) : i ≤ r ∧ f i = target := f:ℕ → ℕtarget:ℕr:ℕi:ℕh:findEq f target r = some i⊢ i ≤ r ∧ f i = target induction r generalizing i with f:ℕ → ℕtarget:ℕi:ℕh:findEq f target 0 = some i⊢ i ≤ 0 ∧ f i = target f:ℕ → ℕtarget:ℕi:ℕh:(if f 0 = target then some 0 else none) = some i⊢ i ≤ 0 ∧ f i = target f:ℕ → ℕtarget:ℕi:ℕh0:f 0 = targeth:some 0 = some i⊢ i ≤ 0 ∧ f i = target f:ℕ → ℕtarget:ℕi:ℕh0:f 0 = targeth:some 0 = some i⊢ i ≤ 0 ∧ f i = target f:ℕ → ℕtarget:ℕi:ℕh0:f 0 = targethi:0 = i⊢ i ≤ 0 ∧ f i = target f:ℕ → ℕtarget:ℕh0:f 0 = target⊢ 0 ≤ 0 ∧ f 0 = target All goals completed! 🐙 f:ℕ → ℕtarget:ℕr:ℕih:∀ (i : ℕ), findEq f target r = some i → i ≤ r ∧ f i = targeti:ℕh:findEq f target (r + 1) = some i⊢ i ≤ r + 1 ∧ f i = target f:ℕ → ℕtarget:ℕr:ℕih:∀ (i : ℕ), findEq f target r = some i → i ≤ r ∧ f i = targeti:ℕh:(match findEq f target r with | some i => some i | none => if f (r + 1) = target then some (r + 1) else none) = some i⊢ i ≤ r + 1 ∧ f i = target cases hprev : findEq f target r with f:ℕ → ℕtarget:ℕr:ℕih:∀ (i : ℕ), findEq f target r = some i → i ≤ r ∧ f i = targeti:ℕh:(match findEq f target r with | some i => some i | none => if f (r + 1) = target then some (r + 1) else none) = some ij:ℕhprev:findEq f target r = some j⊢ i ≤ r + 1 ∧ f i = target f:ℕ → ℕtarget:ℕr:ℕih:∀ (i : ℕ), findEq f target r = some i → i ≤ r ∧ f i = targeti:ℕj:ℕh:(match some j with | some i => some i | none => if f (r + 1) = target then some (r + 1) else none) = some ihprev:findEq f target r = some j⊢ i ≤ r + 1 ∧ f i = target f:ℕ → ℕtarget:ℕr:ℕih:∀ (i : ℕ), findEq f target r = some i → i ≤ r ∧ f i = targeti:ℕj:ℕhprev:findEq f target r = some jhij:j = i⊢ i ≤ r + 1 ∧ f i = target f:ℕ → ℕtarget:ℕr:ℕih:∀ (i : ℕ), findEq f target r = some i → i ≤ r ∧ f i = targetj:ℕhprev:findEq f target r = some j⊢ j ≤ r + 1 ∧ f j = target f:ℕ → ℕtarget:ℕr:ℕih:∀ (i : ℕ), findEq f target r = some i → i ≤ r ∧ f i = targetj:ℕhprev:findEq f target r = some jhjr:j ≤ rhfj:f j = target⊢ j ≤ r + 1 ∧ f j = target exact ⟨f:ℕ → ℕtarget:ℕr:ℕih:∀ (i : ℕ), findEq f target r = some i → i ≤ r ∧ f i = targetj:ℕhprev:findEq f target r = some jhjr:j ≤ rhfj:f j = target⊢ j ≤ r + 1 All goals completed! 🐙, hfj⟩ f:ℕ → ℕtarget:ℕr:ℕih:∀ (i : ℕ), findEq f target r = some i → i ≤ r ∧ f i = targeti:ℕh:(match findEq f target r with | some i => some i | none => if f (r + 1) = target then some (r + 1) else none) = some ihprev:findEq f target r = none⊢ i ≤ r + 1 ∧ f i = target f:ℕ → ℕtarget:ℕr:ℕih:∀ (i : ℕ), findEq f target r = some i → i ≤ r ∧ f i = targeti:ℕh:(match none with | some i => some i | none => if f (r + 1) = target then some (r + 1) else none) = some ihprev:findEq f target r = none⊢ i ≤ r + 1 ∧ f i = target f:ℕ → ℕtarget:ℕr:ℕih:∀ (i : ℕ), findEq f target r = some i → i ≤ r ∧ f i = targeti:ℕhprev:findEq f target r = nonehr1:f (r + 1) = targeth:(match none with | some i => some i | none => some (r + 1)) = some i⊢ i ≤ r + 1 ∧ f i = target f:ℕ → ℕtarget:ℕr:ℕih:∀ (i : ℕ), findEq f target r = some i → i ≤ r ∧ f i = targeti:ℕhprev:findEq f target r = nonehr1:f (r + 1) = targeth:(match none with | some i => some i | none => some (r + 1)) = some i⊢ i ≤ r + 1 ∧ f i = target f:ℕ → ℕtarget:ℕr:ℕih:∀ (i : ℕ), findEq f target r = some i → i ≤ r ∧ f i = targeti:ℕhprev:findEq f target r = nonehr1:f (r + 1) = targethi:r + 1 = i⊢ i ≤ r + 1 ∧ f i = target f:ℕ → ℕtarget:ℕr:ℕih:∀ (i : ℕ), findEq f target r = some i → i ≤ r ∧ f i = targethprev:findEq f target r = nonehr1:f (r + 1) = target⊢ r + 1 ≤ r + 1 ∧ f (r + 1) = target All goals completed! 🐙private theorem findEq_none_spec (f : ℕ → ℕ) (target r : ℕ) (h : findEq f target r = none) : ∀ i : ℕ, i ≤ r → f i ≠ target := f:ℕ → ℕtarget:ℕr:ℕh:findEq f target r = none⊢ ∀ i ≤ r, f i ≠ target induction r with f:ℕ → ℕtarget:ℕh:findEq f target 0 = none⊢ ∀ i ≤ 0, f i ≠ target f:ℕ → ℕtarget:ℕh:(if f 0 = target then some 0 else none) = none⊢ ∀ i ≤ 0, f i ≠ target f:ℕ → ℕtarget:ℕh:(if f 0 = target then some 0 else none) = nonei:ℕhi:i ≤ 0⊢ f i ≠ target f:ℕ → ℕtarget:ℕh:(if f 0 = target then some 0 else none) = nonei:ℕhi:i ≤ 0hi0:i = 0⊢ f i ≠ target f:ℕ → ℕtarget:ℕh:(if f 0 = target then some 0 else none) = nonehi:0 ≤ 0⊢ f 0 ≠ target f:ℕ → ℕtarget:ℕhi:0 ≤ 0h0:¬f 0 = targeth:none = none⊢ f 0 ≠ target All goals completed! 🐙 f:ℕ → ℕtarget:ℕr:ℕih:findEq f target r = none → ∀ i ≤ r, f i ≠ targeth:findEq f target (r + 1) = none⊢ ∀ i ≤ r + 1, f i ≠ target f:ℕ → ℕtarget:ℕr:ℕih:findEq f target r = none → ∀ i ≤ r, f i ≠ targeth:(match findEq f target r with | some i => some i | none => if f (r + 1) = target then some (r + 1) else none) = none⊢ ∀ i ≤ r + 1, f i ≠ target cases hprev : findEq f target r with f:ℕ → ℕtarget:ℕr:ℕih:findEq f target r = none → ∀ i ≤ r, f i ≠ targeth:(match findEq f target r with | some i => some i | none => if f (r + 1) = target then some (r + 1) else none) = nonej:ℕhprev:findEq f target r = some j⊢ ∀ i ≤ r + 1, f i ≠ target f:ℕ → ℕtarget:ℕr:ℕih:findEq f target r = none → ∀ i ≤ r, f i ≠ targetj:ℕh:(match some j with | some i => some i | none => if f (r + 1) = target then some (r + 1) else none) = nonehprev:findEq f target r = some j⊢ ∀ i ≤ r + 1, f i ≠ target All goals completed! 🐙 f:ℕ → ℕtarget:ℕr:ℕih:findEq f target r = none → ∀ i ≤ r, f i ≠ targeth:(match findEq f target r with | some i => some i | none => if f (r + 1) = target then some (r + 1) else none) = nonehprev:findEq f target r = none⊢ ∀ i ≤ r + 1, f i ≠ target f:ℕ → ℕtarget:ℕr:ℕih:findEq f target r = none → ∀ i ≤ r, f i ≠ targeth:(match none with | some i => some i | none => if f (r + 1) = target then some (r + 1) else none) = nonehprev:findEq f target r = none⊢ ∀ i ≤ r + 1, f i ≠ target f:ℕ → ℕtarget:ℕr:ℕih:findEq f target r = none → ∀ i ≤ r, f i ≠ targethprev:findEq f target r = nonehr1:¬f (r + 1) = targeth:(match none with | some i => some i | none => none) = none⊢ ∀ i ≤ r + 1, f i ≠ target f:ℕ → ℕtarget:ℕr:ℕih:findEq f target r = none → ∀ i ≤ r, f i ≠ targethprev:findEq f target r = nonehr1:¬f (r + 1) = targeth:(match none with | some i => some i | none => none) = nonei:ℕhi:i ≤ r + 1⊢ f i ≠ target f:ℕ → ℕtarget:ℕr:ℕih:findEq f target r = none → ∀ i ≤ r, f i ≠ targethprev:findEq f target r = nonehr1:¬f (r + 1) = targeth:(match none with | some i => some i | none => none) = nonei:ℕhi:i ≤ r + 1hlt:i < r + 1⊢ f i ≠ targetf:ℕ → ℕtarget:ℕr:ℕih:findEq f target r = none → ∀ i ≤ r, f i ≠ targethprev:findEq f target r = nonehr1:¬f (r + 1) = targeth:(match none with | some i => some i | none => none) = nonei:ℕhi:i ≤ r + 1hge:i ≥ r + 1⊢ f i ≠ target f:ℕ → ℕtarget:ℕr:ℕih:findEq f target r = none → ∀ i ≤ r, f i ≠ targethprev:findEq f target r = nonehr1:¬f (r + 1) = targeth:(match none with | some i => some i | none => none) = nonei:ℕhi:i ≤ r + 1hlt:i < r + 1⊢ f i ≠ target exact ih hprev i (f:ℕ → ℕtarget:ℕr:ℕih:findEq f target r = none → ∀ i ≤ r, f i ≠ targethprev:findEq f target r = nonehr1:¬f (r + 1) = targeth:(match none with | some i => some i | none => none) = nonei:ℕhi:i ≤ r + 1hlt:i < r + 1⊢ i ≤ r All goals completed! 🐙) f:ℕ → ℕtarget:ℕr:ℕih:findEq f target r = none → ∀ i ≤ r, f i ≠ targethprev:findEq f target r = nonehr1:¬f (r + 1) = targeth:(match none with | some i => some i | none => none) = nonei:ℕhi:i ≤ r + 1hge:i ≥ r + 1⊢ f i ≠ target f:ℕ → ℕtarget:ℕr:ℕih:findEq f target r = none → ∀ i ≤ r, f i ≠ targethprev:findEq f target r = nonehr1:¬f (r + 1) = targeth:(match none with | some i => some i | none => none) = nonei:ℕhi:i ≤ r + 1hge:i ≥ r + 1hieq:i = r + 1⊢ f i ≠ target f:ℕ → ℕtarget:ℕr:ℕih:findEq f target r = none → ∀ i ≤ r, f i ≠ targethprev:findEq f target r = nonehr1:¬f (r + 1) = targeth:(match none with | some i => some i | none => none) = nonehi:r + 1 ≤ r + 1hge:r + 1 ≥ r + 1⊢ f (r + 1) ≠ target All goals completed! 🐙

Constructive finite pigeonhole principle on ℕ (zero Classical.choice).

theorem nat_pigeonhole_constructive (N : ℕ) : ∀ f : ℕ → ℕ, (∀ i : ℕ, i ≤ N + 1 → f i < N + 1) → ∃ a b : ℕ, a < b ∧ b ≤ N + 1 ∧ f a = f b := N:ℕ⊢ ∀ (f : ℕ → ℕ), (∀ i ≤ N + 1, f i < N + 1) → ∃ a b, a < b ∧ b ≤ N + 1 ∧ f a = f b induction N with ⊢ ∀ (f : ℕ → ℕ), (∀ i ≤ 0 + 1, f i < 0 + 1) → ∃ a b, a < b ∧ b ≤ 0 + 1 ∧ f a = f b f:ℕ → ℕhf:∀ i ≤ 0 + 1, f i < 0 + 1⊢ ∃ a b, a < b ∧ b ≤ 0 + 1 ∧ f a = f b f:ℕ → ℕhf:∀ i ≤ 0 + 1, f i < 0 + 1h0:f 0 < 1⊢ ∃ a b, a < b ∧ b ≤ 0 + 1 ∧ f a = f b f:ℕ → ℕhf:∀ i ≤ 0 + 1, f i < 0 + 1h0:f 0 < 1h1:f 1 < 1⊢ ∃ a b, a < b ∧ b ≤ 0 + 1 ∧ f a = f b exact ⟨0, 1, f:ℕ → ℕhf:∀ i ≤ 0 + 1, f i < 0 + 1h0:f 0 < 1h1:f 1 < 1⊢ 0 < 1 All goals completed! 🐙, f:ℕ → ℕhf:∀ i ≤ 0 + 1, f i < 0 + 1h0:f 0 < 1h1:f 1 < 1⊢ 1 ≤ 0 + 1 All goals completed! 🐙, f:ℕ → ℕhf:∀ i ≤ 0 + 1, f i < 0 + 1h0:f 0 < 1h1:f 1 < 1⊢ f 0 = f 1 All goals completed! 🐙⟩ m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f b⊢ ∀ (f : ℕ → ℕ), (∀ i ≤ m + 1 + 1, f i < m + 1 + 1) → ∃ a b, a < b ∧ b ≤ m + 1 + 1 ∧ f a = f b m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1⊢ ∃ a b, a < b ∧ b ≤ m + 1 + 1 ∧ f a = f b cases hfind : findEq f (f (m + 2)) (m + 1) with m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1i:ℕhfind:findEq f (f (m + 2)) (m + 1) = some i⊢ ∃ a b, a < b ∧ b ≤ m + 1 + 1 ∧ f a = f b m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1i:ℕhfind:findEq f (f (m + 2)) (m + 1) = some ihi_le:i ≤ m + 1hfi:f i = f (m + 2)⊢ ∃ a b, a < b ∧ b ≤ m + 1 + 1 ∧ f a = f b exact ⟨i, m + 2, m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1i:ℕhfind:findEq f (f (m + 2)) (m + 1) = some ihi_le:i ≤ m + 1hfi:f i = f (m + 2)⊢ i < m + 2 All goals completed! 🐙, m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1i:ℕhfind:findEq f (f (m + 2)) (m + 1) = some ihi_le:i ≤ m + 1hfi:f i = f (m + 2)⊢ m + 2 ≤ m + 1 + 1 All goals completed! 🐙, hfi⟩ m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = none⊢ ∃ a b, a < b ∧ b ≤ m + 1 + 1 ∧ f a = f b m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)⊢ ∃ a b, a < b ∧ b ≤ m + 1 + 1 ∧ f a = f b m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)g:ℕ → ℕ := fun i ↦ if f i < f (m + 2) then f i else f i - 1⊢ ∃ a b, a < b ∧ b ≤ m + 1 + 1 ∧ f a = f b m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)g:ℕ → ℕ := fun i ↦ if f i < f (m + 2) then f i else f i - 1hg_lt:∀ i ≤ m + 1, g i < m + 1⊢ ∃ a b, a < b ∧ b ≤ m + 1 + 1 ∧ f a = f b m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)g:ℕ → ℕ := fun i ↦ if f i < f (m + 2) then f i else f i - 1hg_lt:∀ i ≤ m + 1, g i < m + 1a:ℕb:ℕhab:a < bhb_le:b ≤ m + 1hgab:g a = g b⊢ ∃ a b, a < b ∧ b ≤ m + 1 + 1 ∧ f a = f b refine ⟨a, b, hab, m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)g:ℕ → ℕ := fun i ↦ if f i < f (m + 2) then f i else f i - 1hg_lt:∀ i ≤ m + 1, g i < m + 1a:ℕb:ℕhab:a < bhb_le:b ≤ m + 1hgab:g a = g b⊢ b ≤ m + 1 + 1 All goals completed! 🐙, ?_⟩ m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)g:ℕ → ℕ := fun i ↦ if f i < f (m + 2) then f i else f i - 1hg_lt:∀ i ≤ m + 1, g i < m + 1a:ℕb:ℕhab:a < bhb_le:b ≤ m + 1hgab:g a = g bhfa_ne:f a ≠ f (m + 2)⊢ f a = f b m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)g:ℕ → ℕ := fun i ↦ if f i < f (m + 2) then f i else f i - 1hg_lt:∀ i ≤ m + 1, g i < m + 1a:ℕb:ℕhab:a < bhb_le:b ≤ m + 1hgab:g a = g bhfa_ne:f a ≠ f (m + 2)hfb_ne:f b ≠ f (m + 2)⊢ f a = f b m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)g:ℕ → ℕ := fun i ↦ if f i < f (m + 2) then f i else f i - 1hg_lt:∀ i ≤ m + 1, g i < m + 1a:ℕb:ℕhab:a < bhb_le:b ≤ m + 1hgab:(if f a < f (m + 2) then f a else f a - 1) = if f b < f (m + 2) then f b else f b - 1hfa_ne:f a ≠ f (m + 2)hfb_ne:f b ≠ f (m + 2)⊢ f a = f b m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)g:ℕ → ℕ := fun i ↦ if f i < f (m + 2) then f i else f i - 1hg_lt:∀ i ≤ m + 1, g i < m + 1a:ℕb:ℕhab:a < bhb_le:b ≤ m + 1hfa_ne:f a ≠ f (m + 2)hfb_ne:f b ≠ f (m + 2)ha_lt:f a < f (m + 2)hb_lt:f b < f (m + 2)hgab:f a = f b⊢ f a = f bm:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)g:ℕ → ℕ := fun i ↦ if f i < f (m + 2) then f i else f i - 1hg_lt:∀ i ≤ m + 1, g i < m + 1a:ℕb:ℕhab:a < bhb_le:b ≤ m + 1hfa_ne:f a ≠ f (m + 2)hfb_ne:f b ≠ f (m + 2)ha_lt:f a < f (m + 2)hb_lt:¬f b < f (m + 2)hgab:f a = f b - 1⊢ f a = f bm:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)g:ℕ → ℕ := fun i ↦ if f i < f (m + 2) then f i else f i - 1hg_lt:∀ i ≤ m + 1, g i < m + 1a:ℕb:ℕhab:a < bhb_le:b ≤ m + 1hfa_ne:f a ≠ f (m + 2)hfb_ne:f b ≠ f (m + 2)ha_lt:¬f a < f (m + 2)hb_lt2:f b < f (m + 2)hgab:f a - 1 = f b⊢ f a = f bm:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)g:ℕ → ℕ := fun i ↦ if f i < f (m + 2) then f i else f i - 1hg_lt:∀ i ≤ m + 1, g i < m + 1a:ℕb:ℕhab:a < bhb_le:b ≤ m + 1hfa_ne:f a ≠ f (m + 2)hfb_ne:f b ≠ f (m + 2)ha_lt:¬f a < f (m + 2)hb_lt2:¬f b < f (m + 2)hgab:f a - 1 = f b - 1⊢ f a = f b m:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)g:ℕ → ℕ := fun i ↦ if f i < f (m + 2) then f i else f i - 1hg_lt:∀ i ≤ m + 1, g i < m + 1a:ℕb:ℕhab:a < bhb_le:b ≤ m + 1hfa_ne:f a ≠ f (m + 2)hfb_ne:f b ≠ f (m + 2)ha_lt:f a < f (m + 2)hb_lt:f b < f (m + 2)hgab:f a = f b⊢ f a = f bm:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)g:ℕ → ℕ := fun i ↦ if f i < f (m + 2) then f i else f i - 1hg_lt:∀ i ≤ m + 1, g i < m + 1a:ℕb:ℕhab:a < bhb_le:b ≤ m + 1hfa_ne:f a ≠ f (m + 2)hfb_ne:f b ≠ f (m + 2)ha_lt:f a < f (m + 2)hb_lt:¬f b < f (m + 2)hgab:f a = f b - 1⊢ f a = f bm:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)g:ℕ → ℕ := fun i ↦ if f i < f (m + 2) then f i else f i - 1hg_lt:∀ i ≤ m + 1, g i < m + 1a:ℕb:ℕhab:a < bhb_le:b ≤ m + 1hfa_ne:f a ≠ f (m + 2)hfb_ne:f b ≠ f (m + 2)ha_lt:¬f a < f (m + 2)hb_lt2:f b < f (m + 2)hgab:f a - 1 = f b⊢ f a = f bm:ℕih:∀ (f : ℕ → ℕ), (∀ i ≤ m + 1, f i < m + 1) → ∃ a b, a < b ∧ b ≤ m + 1 ∧ f a = f bf:ℕ → ℕhf:∀ i ≤ m + 1 + 1, f i < m + 1 + 1hfind:findEq f (f (m + 2)) (m + 1) = nonehne:∀ i ≤ m + 1, f i ≠ f (m + 2)g:ℕ → ℕ := fun i ↦ if f i < f (m + 2) then f i else f i - 1hg_lt:∀ i ≤ m + 1, g i < m + 1a:ℕb:ℕhab:a < bhb_le:b ≤ m + 1hfa_ne:f a ≠ f (m + 2)hfb_ne:f b ≠ f (m + 2)ha_lt:¬f a < f (m + 2)hb_lt2:¬f b < f (m + 2)hgab:f a - 1 = f b - 1⊢ f a = f b All goals completed! 🐙private theorem terras_le_two_inv (z : ℕ) (hz : z ≤ 2) : terras z ≤ 2 := z:ℕhz:z ≤ 2⊢ terras z ≤ 2 z:ℕhz:z ≤ 2⊢ (if z % 2 = 0 then z / 2 else (3 * z + 1) / 2) ≤ 2 z:ℕhz:z ≤ 2h✝:z % 2 = 0⊢ z / 2 ≤ 2z:ℕhz:z ≤ 2h✝:¬z % 2 = 0⊢ (3 * z + 1) / 2 ≤ 2 z:ℕhz:z ≤ 2h✝:z % 2 = 0⊢ z / 2 ≤ 2z:ℕhz:z ≤ 2h✝:¬z % 2 = 0⊢ (3 * z + 1) / 2 ≤ 2 All goals completed! 🐙private theorem terras_iterate_le_two (t z : ℕ) (hz : z ≤ 2) : terras^[t] z ≤ 2 := t:ℕz:ℕhz:z ≤ 2⊢ terras^[t] z ≤ 2 induction t generalizing z with z:ℕhz:z ≤ 2⊢ terras^[0] z ≤ 2 All goals completed! 🐙 t:ℕih:∀ z ≤ 2, terras^[t] z ≤ 2z:ℕhz:z ≤ 2⊢ terras^[t + 1] z ≤ 2 t:ℕih:∀ z ≤ 2, terras^[t] z ≤ 2z:ℕhz:z ≤ 2⊢ terras^[t] (terras z) ≤ 2 All goals completed! 🐙private theorem terras_iterate_mul_period (m k x : ℕ) (hcyc : terras^[k] x = x) : terras^[m * k] x = x := m:ℕk:ℕx:ℕhcyc:terras^[k] x = x⊢ terras^[m * k] x = x induction m with k:ℕx:ℕhcyc:terras^[k] x = x⊢ terras^[0 * k] x = x k:ℕx:ℕhcyc:terras^[k] x = x⊢ terras^[0] x = x; All goals completed! 🐙 k:ℕx:ℕhcyc:terras^[k] x = xm:ℕih:terras^[m * k] x = x⊢ terras^[(m + 1) * k] x = x All goals completed! 🐙private theorem terras_orbit_ge_three {x k : ℕ} (hx3 : 3 ≤ x) (hk1 : 1 ≤ k) (hcyc : terras^[k] x = x) (i : ℕ) : 3 ≤ terras^[i] x := x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xi:ℕ⊢ 3 ≤ terras^[i] x x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xi:ℕhge:3 ≤ terras^[i] x⊢ 3 ≤ terras^[i] xx:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xi:ℕhge:¬3 ≤ terras^[i] x⊢ 3 ≤ terras^[i] x x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xi:ℕhge:3 ≤ terras^[i] x⊢ 3 ≤ terras^[i] x All goals completed! 🐙 x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xi:ℕhge:¬3 ≤ terras^[i] x⊢ 3 ≤ terras^[i] x x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xi:ℕhge:¬3 ≤ terras^[i] x⊢ False x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xi:ℕhge:¬3 ≤ terras^[i] xhle2:terras^[i] x ≤ 2⊢ False x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xi:ℕhge:¬3 ≤ terras^[i] xhle2:terras^[i] x ≤ 2hik:i ≤ i * k⊢ False x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xi:ℕhge:¬3 ≤ terras^[i] xhle2:terras^[i] x ≤ 2hik:i ≤ i * khsplit:i * k = i * k - i + i⊢ False x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xi:ℕhge:¬3 ≤ terras^[i] xhle2:terras^[i] x ≤ 2hik:i ≤ i * khsplit:i * k = i * k - i + ihx_eq:terras^[i * k] x = x⊢ False x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xi:ℕhge:¬3 ≤ terras^[i] xhle2:terras^[i] x ≤ 2hik:i ≤ i * khsplit:i * k = i * k - i + ihx_eq:terras^[i * k - i] (terras^[i] x) = x⊢ False x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xi:ℕhge:¬3 ≤ terras^[i] xhle2:terras^[i] x ≤ 2hik:i ≤ i * khsplit:i * k = i * k - i + ihx_eq:terras^[i * k - i] (terras^[i] x) = xhx_le2:terras^[i * k - i] (terras^[i] x) ≤ 2⊢ False All goals completed! 🐙private def orbitMax (x : ℕ) : ℕ → ℕ | 0 => x | r + 1 => max (orbitMax x r) (terras^[r + 1] x)private theorem orbitMax_spec (x r : ℕ) : (∃ i : ℕ, i ≤ r ∧ terras^[i] x = orbitMax x r) ∧ (∀ i : ℕ, i ≤ r → terras^[i] x ≤ orbitMax x r) := x:ℕr:ℕ⊢ (∃ i ≤ r, terras^[i] x = orbitMax x r) ∧ ∀ i ≤ r, terras^[i] x ≤ orbitMax x r induction r with x:ℕ⊢ (∃ i ≤ 0, terras^[i] x = orbitMax x 0) ∧ ∀ i ≤ 0, terras^[i] x ≤ orbitMax x 0 x:ℕ⊢ ∀ i ≤ 0, terras^[i] x ≤ orbitMax x 0 x:ℕi:ℕhi:i ≤ 0⊢ terras^[i] x ≤ orbitMax x 0 x:ℕi:ℕhi:i ≤ 0hi0:i = 0⊢ terras^[i] x ≤ orbitMax x 0 x:ℕhi:0 ≤ 0⊢ terras^[0] x ≤ orbitMax x 0 All goals completed! 🐙 x:ℕr:ℕih:(∃ i ≤ r, terras^[i] x = orbitMax x r) ∧ ∀ i ≤ r, terras^[i] x ≤ orbitMax x r⊢ (∃ i ≤ r + 1, terras^[i] x = orbitMax x (r + 1)) ∧ ∀ i ≤ r + 1, terras^[i] x ≤ orbitMax x (r + 1) x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x r⊢ (∃ i ≤ r + 1, terras^[i] x = orbitMax x (r + 1)) ∧ ∀ i ≤ r + 1, terras^[i] x ≤ orbitMax x (r + 1) x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x r⊢ (∃ i ≤ r + 1, terras^[i] x = max (orbitMax x r) (terras^[r + 1] x)) ∧ ∀ i ≤ r + 1, terras^[i] x ≤ max (orbitMax x r) (terras^[r + 1] x) x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x r⊢ ∃ i ≤ r + 1, terras^[i] x = max (orbitMax x r) (terras^[r + 1] x)x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x r⊢ ∀ i ≤ r + 1, terras^[i] x ≤ max (orbitMax x r) (terras^[r + 1] x) x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x r⊢ ∃ i ≤ r + 1, terras^[i] x = max (orbitMax x r) (terras^[r + 1] x) x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x rhcmp:orbitMax x r ≤ terras^[r + 1] x⊢ ∃ i ≤ r + 1, terras^[i] x = max (orbitMax x r) (terras^[r + 1] x)x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x rhcmp:¬orbitMax x r ≤ terras^[r + 1] x⊢ ∃ i ≤ r + 1, terras^[i] x = max (orbitMax x r) (terras^[r + 1] x) x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x rhcmp:orbitMax x r ≤ terras^[r + 1] x⊢ ∃ i ≤ r + 1, terras^[i] x = max (orbitMax x r) (terras^[r + 1] x) All goals completed! 🐙 x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x rhcmp:¬orbitMax x r ≤ terras^[r + 1] x⊢ ∃ i ≤ r + 1, terras^[i] x = max (orbitMax x r) (terras^[r + 1] x) x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x rhcmp:¬orbitMax x r ≤ terras^[r + 1] xhle':terras^[r + 1] x ≤ orbitMax x r⊢ ∃ i ≤ r + 1, terras^[i] x = max (orbitMax x r) (terras^[r + 1] x) exact ⟨i0, x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x rhcmp:¬orbitMax x r ≤ terras^[r + 1] xhle':terras^[r + 1] x ≤ orbitMax x r⊢ i0 ≤ r + 1 All goals completed! 🐙, x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x rhcmp:¬orbitMax x r ≤ terras^[r + 1] xhle':terras^[r + 1] x ≤ orbitMax x r⊢ terras^[i0] x = max (orbitMax x r) (terras^[r + 1] x) All goals completed! 🐙⟩ x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x r⊢ ∀ i ≤ r + 1, terras^[i] x ≤ max (orbitMax x r) (terras^[r + 1] x) x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x ri:ℕhi:i ≤ r + 1⊢ terras^[i] x ≤ max (orbitMax x r) (terras^[r + 1] x) x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x ri:ℕhi:i ≤ r + 1hlt:i < r + 1⊢ terras^[i] x ≤ max (orbitMax x r) (terras^[r + 1] x)x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x ri:ℕhi:i ≤ r + 1hge:i ≥ r + 1⊢ terras^[i] x ≤ max (orbitMax x r) (terras^[r + 1] x) x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x ri:ℕhi:i ≤ r + 1hlt:i < r + 1⊢ terras^[i] x ≤ max (orbitMax x r) (terras^[r + 1] x) exact le_trans (hle i (x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x ri:ℕhi:i ≤ r + 1hlt:i < r + 1⊢ i ≤ r All goals completed! 🐙)) (Nat.le_max_left _ _) x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x ri:ℕhi:i ≤ r + 1hge:i ≥ r + 1⊢ terras^[i] x ≤ max (orbitMax x r) (terras^[r + 1] x) x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x ri:ℕhi:i ≤ r + 1hge:i ≥ r + 1hieq:i = r + 1⊢ terras^[i] x ≤ max (orbitMax x r) (terras^[r + 1] x) x:ℕr:ℕhle:∀ i ≤ r, terras^[i] x ≤ orbitMax x ri0:ℕhi0_le:i0 ≤ rhi0_eq:terras^[i0] x = orbitMax x rhi:r + 1 ≤ r + 1hge:r + 1 ≥ r + 1⊢ terras^[r + 1] x ≤ max (orbitMax x r) (terras^[r + 1] x) All goals completed! 🐙

Constructive extraction of the cycle maximum M ≥ 3 and bounded period 1 ≤ j ≤ M - 2 from any nontrivial positive cycle of terras (zero Classical.choice).

theorem exists_bounded_cycle_max {x k : ℕ} (hx3 : 3 ≤ x) (hk1 : 1 ≤ k) (hcyc : terras^[k] x = x) : ∃ M j : ℕ, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ t : ℕ, 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ (∃ i : ℕ, i < k ∧ terras^[i] x = M) := x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = x⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = M⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = MhM3:3 ≤ M⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = MhM3:3 ≤ MhM_cyc:terras^[k] M = M⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = MhM3:3 ≤ MhM_cyc:terras^[k] M = MhM_iter_le:∀ (t : ℕ), terras^[t] M ≤ M⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = MhM3:3 ≤ MhM_cyc:terras^[k] M = MhM_iter_le:∀ (t : ℕ), terras^[t] M ≤ MN:ℕ := M - 3⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = MhM3:3 ≤ MhM_cyc:terras^[k] M = MhM_iter_le:∀ (t : ℕ), terras^[t] M ≤ MN:ℕ := M - 3f:ℕ → ℕ := fun t ↦ terras^[t] M - 3⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = MhM3:3 ≤ MhM_cyc:terras^[k] M = MhM_iter_le:∀ (t : ℕ), terras^[t] M ≤ MN:ℕ := M - 3f:ℕ → ℕ := fun t ↦ terras^[t] M - 3hf_lt:∀ t ≤ N + 1, f t < N + 1⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = MhM3:3 ≤ MhM_cyc:terras^[k] M = MhM_iter_le:∀ (t : ℕ), terras^[t] M ≤ MN:ℕ := M - 3f:ℕ → ℕ := fun t ↦ terras^[t] M - 3hf_lt:∀ t ≤ N + 1, f t < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f b⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = MhM3:3 ≤ MhM_cyc:terras^[k] M = MhM_iter_le:∀ (t : ℕ), terras^[t] M ≤ MN:ℕ := M - 3f:ℕ → ℕ := fun t ↦ terras^[t] M - 3hf_lt:∀ t ≤ N + 1, f t < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_ge3:3 ≤ terras^[a] M⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = MhM3:3 ≤ MhM_cyc:terras^[k] M = MhM_iter_le:∀ (t : ℕ), terras^[t] M ≤ MN:ℕ := M - 3f:ℕ → ℕ := fun t ↦ terras^[t] M - 3hf_lt:∀ t ≤ N + 1, f t < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_ge3:3 ≤ terras^[a] Mhb_ge3:3 ≤ terras^[b] M⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = MhM3:3 ≤ MhM_cyc:terras^[k] M = MhM_iter_le:∀ (t : ℕ), terras^[t] M ≤ MN:ℕ := M - 3f:ℕ → ℕ := fun t ↦ terras^[t] M - 3hf_lt:∀ t ≤ N + 1, f t < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_ge3:3 ≤ terras^[a] Mhb_ge3:3 ≤ terras^[b] Mhab_eq:terras^[a] M = terras^[b] M⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = MhM3:3 ≤ MhM_cyc:terras^[k] M = MhM_iter_le:∀ (t : ℕ), terras^[t] M ≤ MN:ℕ := M - 3f:ℕ → ℕ := fun t ↦ terras^[t] M - 3hf_lt:∀ t ≤ N + 1, f t < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_ge3:3 ≤ terras^[a] Mhb_ge3:3 ≤ terras^[b] Mhab_eq:terras^[a] M = terras^[b] Mj:ℕ := b - a⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = MhM3:3 ≤ MhM_cyc:terras^[k] M = MhM_iter_le:∀ (t : ℕ), terras^[t] M ≤ MN:ℕ := M - 3f:ℕ → ℕ := fun t ↦ terras^[t] M - 3hf_lt:∀ t ≤ N + 1, f t < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_ge3:3 ≤ terras^[a] Mhb_ge3:3 ≤ terras^[b] Mhab_eq:terras^[a] M = terras^[b] Mj:ℕ := b - ahj_pos:1 ≤ j⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = MhM3:3 ≤ MhM_cyc:terras^[k] M = MhM_iter_le:∀ (t : ℕ), terras^[t] M ≤ MN:ℕ := M - 3f:ℕ → ℕ := fun t ↦ terras^[t] M - 3hf_lt:∀ t ≤ N + 1, f t < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_ge3:3 ≤ terras^[a] Mhb_ge3:3 ≤ terras^[b] Mhab_eq:terras^[a] M = terras^[b] Mj:ℕ := b - ahj_pos:1 ≤ jhj_le:j ≤ M - 2⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = MhM3:3 ≤ MhM_cyc:terras^[k] M = MhM_iter_le:∀ (t : ℕ), terras^[t] M ≤ MN:ℕ := M - 3f:ℕ → ℕ := fun t ↦ terras^[t] M - 3hf_lt:∀ t ≤ N + 1, f t < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_ge3:3 ≤ terras^[a] Mhb_ge3:3 ≤ terras^[b] Mhab_eq:terras^[a] M = terras^[b] Mj:ℕ := b - ahj_pos:1 ≤ jhj_le:j ≤ M - 2hj_cyc:terras^[j] M = M⊢ ∃ M j, 3 ≤ M ∧ 1 ≤ j ∧ j ≤ M - 2 ∧ terras^[j] M = M ∧ (∀ (t : ℕ), 3 ≤ terras^[t] M ∧ terras^[t] M ≤ M) ∧ ∃ i < k, terras^[i] x = M exact ⟨M, j, hM3, hj_pos, hj_le, hj_cyc, fun t => ⟨terras_orbit_ge_three hM3 hk1 hM_cyc t, hM_iter_le t⟩, ⟨i0, x:ℕk:ℕhx3:3 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xM:ℕ := orbitMax x (k - 1)h_le_M:∀ i ≤ k - 1, terras^[i] x ≤ orbitMax x (k - 1)i0:ℕhi0_le:i0 ≤ k - 1hi0_eq:terras^[i0] x = orbitMax x (k - 1)hi0_M:terras^[i0] x = MhM3:3 ≤ MhM_cyc:terras^[k] M = MhM_iter_le:∀ (t : ℕ), terras^[t] M ≤ MN:ℕ := M - 3f:ℕ → ℕ := fun t ↦ terras^[t] M - 3hf_lt:∀ t ≤ N + 1, f t < N + 1a:ℕb:ℕhab:a < bhb_le:b ≤ N + 1hfab:f a = f bha_ge3:3 ≤ terras^[a] Mhb_ge3:3 ≤ terras^[b] Mhab_eq:terras^[a] M = terras^[b] Mj:ℕ := b - ahj_pos:1 ≤ jhj_le:j ≤ M - 2hj_cyc:terras^[j] M = M⊢ i0 < k All goals completed! 🐙, hi0_M⟩⟩private theorem bounded_cycle_iff_exists_cycle : (∃ x j : ℕ, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x) ↔ (∃ x k : ℕ, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2) := ⊢ (∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x) ↔ ∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2 ⊢ (∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x) → ∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2⊢ (∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2) → ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x ⊢ (∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x) → ∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2 x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhcyc:terras^[j] x = x⊢ ∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2 exact ⟨x, j, x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhcyc:terras^[j] x = x⊢ 1 ≤ x All goals completed! 🐙, hj1, hcyc, x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhcyc:terras^[j] x = x⊢ x ≠ 1 All goals completed! 🐙, x:ℕj:ℕhx3:3 ≤ xhj1:1 ≤ jleft✝:j ≤ xhcyc:terras^[j] x = x⊢ x ≠ 2 All goals completed! 🐙⟩ ⊢ (∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2) → ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x x:ℕk:ℕhx1:1 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xhxne1:x ≠ 1hxne2:x ≠ 2⊢ ∃ x j, 3 ≤ x ∧ 1 ≤ j ∧ j ≤ x ∧ terras^[j] x = x rcases exists_bounded_cycle_max (x:ℕk:ℕhx1:1 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xhxne1:x ≠ 1hxne2:x ≠ 2⊢ 3 ≤ x All goals completed! 🐙) hk1 hcyc with ⟨M, j, hM3, hj1, hjM, hj_cyc, -, -⟩ exact ⟨M, j, hM3, hj1, x:ℕk:ℕhx1:1 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xhxne1:x ≠ 1hxne2:x ≠ 2M:ℕj:ℕhM3:3 ≤ Mhj1:1 ≤ jhjM:j ≤ M - 2hj_cyc:terras^[j] M = M⊢ j ≤ M All goals completed! 🐙, hj_cyc⟩

Constructive equivalence between weakCollatz75 blank-tape halting and the existence of a nontrivial positive cycle of terras.

theorem halts_weakCollatz75_iff_exists_cycle : ConjectureMachines.Halts weakCollatz75 ↔ ∃ x k : ℕ, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2 := ⊢ ConjectureMachines.Halts weakCollatz75 ↔ ∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2 All goals completed! 🐙private theorem two_pow_pos (n : ℕ) : 0 < 2 ^ n := n:ℕ⊢ 0 < 2 ^ n induction n with ⊢ 0 < 2 ^ 0 All goals completed! 🐙 n:ℕih:0 < 2 ^ n⊢ 0 < 2 ^ (n + 1) n:ℕih:0 < 2 ^ n⊢ 0 < 2 ^ n * 2; All goals completed! 🐙private theorem three_pow_pos (n : ℕ) : 0 < 3 ^ n := n:ℕ⊢ 0 < 3 ^ n induction n with ⊢ 0 < 3 ^ 0 All goals completed! 🐙 n:ℕih:0 < 3 ^ n⊢ 0 < 3 ^ (n + 1) n:ℕih:0 < 3 ^ n⊢ 0 < 3 ^ n * 3; All goals completed! 🐙private theorem collatzCycleNum_eq_zero_iff (v : List ℕ) (hv : ∀ d ∈ v, d ≤ 1) : collatzCycleNum v = 0 ↔ v.sum = 0 := v:List ℕhv:∀ d ∈ v, d ≤ 1⊢ collatzCycleNum v = 0 ↔ v.sum = 0 induction v with hv:∀ d ∈ [], d ≤ 1⊢ collatzCycleNum [] = 0 ↔ [].sum = 0 All goals completed! 🐙 b:ℕrest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hv:∀ d ∈ b :: rest, d ≤ 1⊢ collatzCycleNum (b :: rest) = 0 ↔ (b :: rest).sum = 0 b:ℕrest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hv:∀ d ∈ b :: rest, d ≤ 1hb:b ≤ 1⊢ collatzCycleNum (b :: rest) = 0 ↔ (b :: rest).sum = 0 b:ℕrest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hv:∀ d ∈ b :: rest, d ≤ 1hb:b ≤ 1hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0⊢ collatzCycleNum (b :: rest) = 0 ↔ (b :: rest).sum = 0 b:ℕrest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hv:∀ d ∈ b :: rest, d ≤ 1hb:b ≤ 1hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0⊢ (if b = 0 then 2 * collatzCycleNum rest else 3 ^ rest.sum + 2 * collatzCycleNum rest) = 0 ↔ b + rest.sum = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 0 :: rest, d ≤ 1hb:0 ≤ 1⊢ (if 0 = 0 then 2 * collatzCycleNum rest else 3 ^ rest.sum + 2 * collatzCycleNum rest) = 0 ↔ 0 + rest.sum = 0b:ℕrest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hv:∀ d ∈ b :: rest, d ≤ 1hb:b ≤ 1hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hb_pos:b > 0⊢ (if b = 0 then 2 * collatzCycleNum rest else 3 ^ rest.sum + 2 * collatzCycleNum rest) = 0 ↔ b + rest.sum = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 0 :: rest, d ≤ 1hb:0 ≤ 1⊢ (if 0 = 0 then 2 * collatzCycleNum rest else 3 ^ rest.sum + 2 * collatzCycleNum rest) = 0 ↔ 0 + rest.sum = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 0 :: rest, d ≤ 1hb:0 ≤ 1⊢ 2 * collatzCycleNum rest = 0 ↔ rest.sum = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 0 :: rest, d ≤ 1hb:0 ≤ 1⊢ 2 * collatzCycleNum rest = 0 → rest.sum = 0rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 0 :: rest, d ≤ 1hb:0 ≤ 1⊢ rest.sum = 0 → 2 * collatzCycleNum rest = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 0 :: rest, d ≤ 1hb:0 ≤ 1⊢ 2 * collatzCycleNum rest = 0 → rest.sum = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 0 :: rest, d ≤ 1hb:0 ≤ 1h2:2 * collatzCycleNum rest = 0⊢ rest.sum = 0 exact hrest.mp (rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 0 :: rest, d ≤ 1hb:0 ≤ 1h2:2 * collatzCycleNum rest = 0⊢ collatzCycleNum rest = 0 All goals completed! 🐙) rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 0 :: rest, d ≤ 1hb:0 ≤ 1⊢ rest.sum = 0 → 2 * collatzCycleNum rest = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 0 :: rest, d ≤ 1hb:0 ≤ 1hs:rest.sum = 0⊢ 2 * collatzCycleNum rest = 0 All goals completed! 🐙 b:ℕrest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hv:∀ d ∈ b :: rest, d ≤ 1hb:b ≤ 1hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hb_pos:b > 0⊢ (if b = 0 then 2 * collatzCycleNum rest else 3 ^ rest.sum + 2 * collatzCycleNum rest) = 0 ↔ b + rest.sum = 0 b:ℕrest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hv:∀ d ∈ b :: rest, d ≤ 1hb:b ≤ 1hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hb_pos:b > 0hb1:b = 1⊢ (if b = 0 then 2 * collatzCycleNum rest else 3 ^ rest.sum + 2 * collatzCycleNum rest) = 0 ↔ b + rest.sum = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 1 :: rest, d ≤ 1hb:1 ≤ 1hb_pos:1 > 0⊢ (if 1 = 0 then 2 * collatzCycleNum rest else 3 ^ rest.sum + 2 * collatzCycleNum rest) = 0 ↔ 1 + rest.sum = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 1 :: rest, d ≤ 1hb:1 ≤ 1hb_pos:1 > 0h1ne0:¬1 = 0⊢ (if 1 = 0 then 2 * collatzCycleNum rest else 3 ^ rest.sum + 2 * collatzCycleNum rest) = 0 ↔ 1 + rest.sum = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 1 :: rest, d ≤ 1hb:1 ≤ 1hb_pos:1 > 0h1ne0:¬1 = 0⊢ 3 ^ rest.sum + 2 * collatzCycleNum rest = 0 ↔ 1 + rest.sum = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 1 :: rest, d ≤ 1hb:1 ≤ 1hb_pos:1 > 0h1ne0:¬1 = 0h3:0 < 3 ^ rest.sum⊢ 3 ^ rest.sum + 2 * collatzCycleNum rest = 0 ↔ 1 + rest.sum = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 1 :: rest, d ≤ 1hb:1 ≤ 1hb_pos:1 > 0h1ne0:¬1 = 0h3:0 < 3 ^ rest.sum⊢ 3 ^ rest.sum + 2 * collatzCycleNum rest = 0 ↔ 1 + rest.sum = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 1 :: rest, d ≤ 1hb:1 ≤ 1hb_pos:1 > 0h1ne0:¬1 = 0h3:0 < 3 ^ rest.sum⊢ 3 ^ rest.sum + 2 * collatzCycleNum rest = 0 → 1 + rest.sum = 0rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 1 :: rest, d ≤ 1hb:1 ≤ 1hb_pos:1 > 0h1ne0:¬1 = 0h3:0 < 3 ^ rest.sum⊢ 1 + rest.sum = 0 → 3 ^ rest.sum + 2 * collatzCycleNum rest = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 1 :: rest, d ≤ 1hb:1 ≤ 1hb_pos:1 > 0h1ne0:¬1 = 0h3:0 < 3 ^ rest.sum⊢ 3 ^ rest.sum + 2 * collatzCycleNum rest = 0 → 1 + rest.sum = 0rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 1 :: rest, d ≤ 1hb:1 ≤ 1hb_pos:1 > 0h1ne0:¬1 = 0h3:0 < 3 ^ rest.sum⊢ 1 + rest.sum = 0 → 3 ^ rest.sum + 2 * collatzCycleNum rest = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 1 :: rest, d ≤ 1hb:1 ≤ 1hb_pos:1 > 0h1ne0:¬1 = 0h3:0 < 3 ^ rest.sumh:1 + rest.sum = 0⊢ 3 ^ rest.sum + 2 * collatzCycleNum rest = 0 rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 1 :: rest, d ≤ 1hb:1 ≤ 1hb_pos:1 > 0h1ne0:¬1 = 0h3:0 < 3 ^ rest.sumh:3 ^ rest.sum + 2 * collatzCycleNum rest = 0⊢ 1 + rest.sum = 0rest:List ℕih:(∀ d ∈ rest, d ≤ 1) → (collatzCycleNum rest = 0 ↔ rest.sum = 0)hrest:collatzCycleNum rest = 0 ↔ rest.sum = 0hv:∀ d ∈ 1 :: rest, d ≤ 1hb:1 ≤ 1hb_pos:1 > 0h1ne0:¬1 = 0h3:0 < 3 ^ rest.sumh:1 + rest.sum = 0⊢ 3 ^ rest.sum + 2 * collatzCycleNum rest = 0 All goals completed! 🐙private theorem terrasParityWord_digits_le_one (n x d : ℕ) (hd : d ∈ terrasParityWord n x) : d ≤ 1 := n:ℕx:ℕd:ℕhd:d ∈ terrasParityWord n x⊢ d ≤ 1 induction n generalizing x with d:ℕx:ℕhd:d ∈ terrasParityWord 0 x⊢ d ≤ 1 All goals completed! 🐙 d:ℕn:ℕih:∀ (x : ℕ), d ∈ terrasParityWord n x → d ≤ 1x:ℕhd:d ∈ terrasParityWord (n + 1) x⊢ d ≤ 1 d:ℕn:ℕih:∀ (x : ℕ), d ∈ terrasParityWord n x → d ≤ 1x:ℕhd:d ∈ x % 2 :: terrasParityWord n (terras x)⊢ d ≤ 1 d:ℕn:ℕih:∀ (x : ℕ), d ∈ terrasParityWord n x → d ≤ 1x:ℕhd:d = x % 2 ∨ d ∈ terrasParityWord n (terras x)⊢ d ≤ 1 n:ℕx:ℕih:∀ (x_1 : ℕ), x % 2 ∈ terrasParityWord n x_1 → x % 2 ≤ 1⊢ x % 2 ≤ 1d:ℕn:ℕih:∀ (x : ℕ), d ∈ terrasParityWord n x → d ≤ 1x:ℕhtail:d ∈ terrasParityWord n (terras x)⊢ d ≤ 1 n:ℕx:ℕih:∀ (x_1 : ℕ), x % 2 ∈ terrasParityWord n x_1 → x % 2 ≤ 1⊢ x % 2 ≤ 1 All goals completed! 🐙 d:ℕn:ℕih:∀ (x : ℕ), d ∈ terrasParityWord n x → d ≤ 1x:ℕhtail:d ∈ terrasParityWord n (terras x)⊢ d ≤ 1 All goals completed! 🐙private theorem two_pow_mul_terras_iterate_eq (n x : ℕ) : 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x) := n:ℕx:ℕ⊢ 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x) induction n generalizing x with x:ℕ⊢ 2 ^ 0 * terras^[0] x = 3 ^ (terrasParityWord 0 x).sum * x + collatzCycleNum (terrasParityWord 0 x) All goals completed! 🐙 n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕ⊢ 2 ^ (n + 1) * terras^[n + 1] x = 3 ^ (terrasParityWord (n + 1) x).sum * x + collatzCycleNum (terrasParityWord (n + 1) x) n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕ⊢ 2 ^ (n + 1) * terras^[n] (terras x) = 3 ^ (terrasParityWord (n + 1) x).sum * x + collatzCycleNum (terrasParityWord (n + 1) x) n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕ⊢ 2 ^ (n + 1) * terras^[n] (terras x) = 3 ^ (x % 2 + (terrasParityWord n (terras x)).sum) * x + if x % 2 = 0 then 2 * collatzCycleNum (terrasParityWord n (terras x)) else 3 ^ (terrasParityWord n (terras x)).sum + 2 * collatzCycleNum (terrasParityWord n (terras x)) n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)⊢ 2 ^ (n + 1) * terras^[n] (terras x) = 3 ^ (x % 2 + (terrasParityWord n (terras x)).sum) * x + if x % 2 = 0 then 2 * collatzCycleNum (terrasParityWord n (terras x)) else 3 ^ (terrasParityWord n (terras x)).sum + 2 * collatzCycleNum (terrasParityWord n (terras x)) n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum rest⊢ 2 ^ (n + 1) * terras^[n] (terras x) = 3 ^ (x % 2 + (terrasParityWord n (terras x)).sum) * x + if x % 2 = 0 then 2 * collatzCycleNum (terrasParityWord n (terras x)) else 3 ^ (terrasParityWord n (terras x)).sum + 2 * collatzCycleNum (terrasParityWord n (terras x)) n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthev:x % 2 = 0⊢ 2 ^ (n + 1) * terras^[n] (terras x) = 3 ^ (x % 2 + (terrasParityWord n (terras x)).sum) * x + if x % 2 = 0 then 2 * collatzCycleNum (terrasParityWord n (terras x)) else 3 ^ (terrasParityWord n (terras x)).sum + 2 * collatzCycleNum (terrasParityWord n (terras x))n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthodd:x % 2 = 1⊢ 2 ^ (n + 1) * terras^[n] (terras x) = 3 ^ (x % 2 + (terrasParityWord n (terras x)).sum) * x + if x % 2 = 0 then 2 * collatzCycleNum (terrasParityWord n (terras x)) else 3 ^ (terrasParityWord n (terras x)).sum + 2 * collatzCycleNum (terrasParityWord n (terras x)) n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthev:x % 2 = 0⊢ 2 ^ (n + 1) * terras^[n] (terras x) = 3 ^ (x % 2 + (terrasParityWord n (terras x)).sum) * x + if x % 2 = 0 then 2 * collatzCycleNum (terrasParityWord n (terras x)) else 3 ^ (terrasParityWord n (terras x)).sum + 2 * collatzCycleNum (terrasParityWord n (terras x)) n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthev:x % 2 = 0h2tx:2 * terras x = x⊢ 2 ^ (n + 1) * terras^[n] (terras x) = 3 ^ (x % 2 + (terrasParityWord n (terras x)).sum) * x + if x % 2 = 0 then 2 * collatzCycleNum (terrasParityWord n (terras x)) else 3 ^ (terrasParityWord n (terras x)).sum + 2 * collatzCycleNum (terrasParityWord n (terras x)) n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthev:x % 2 = 0h2tx:2 * terras x = x⊢ 2 ^ (n + 1) * terras^[n] (terras x) = 3 ^ (terrasParityWord n (terras x)).sum * x + 2 * collatzCycleNum (terrasParityWord n (terras x)) calc 2 ^ (n + 1) * terras^[n] (terras x) = 2 * (2 ^ n * terras^[n] (terras x)) := n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthev:x % 2 = 0h2tx:2 * terras x = x⊢ 2 ^ (n + 1) * terras^[n] (terras x) = 2 * (2 ^ n * terras^[n] (terras x)) All goals completed! 🐙 _ = 2 * (3 ^ rest.sum * terras x + collatzCycleNum rest) := n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthev:x % 2 = 0h2tx:2 * terras x = x⊢ 2 * (2 ^ n * terras^[n] (terras x)) = 2 * (3 ^ rest.sum * terras x + collatzCycleNum rest) All goals completed! 🐙 _ = 3 ^ rest.sum * (2 * terras x) + 2 * collatzCycleNum rest := n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthev:x % 2 = 0h2tx:2 * terras x = x⊢ 2 * (3 ^ rest.sum * terras x + collatzCycleNum rest) = 3 ^ rest.sum * (2 * terras x) + 2 * collatzCycleNum rest All goals completed! 🐙 _ = 3 ^ rest.sum * x + 2 * collatzCycleNum rest := n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthev:x % 2 = 0h2tx:2 * terras x = x⊢ 3 ^ rest.sum * (2 * terras x) + 2 * collatzCycleNum rest = 3 ^ rest.sum * x + 2 * collatzCycleNum rest All goals completed! 🐙 n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthodd:x % 2 = 1⊢ 2 ^ (n + 1) * terras^[n] (terras x) = 3 ^ (x % 2 + (terrasParityWord n (terras x)).sum) * x + if x % 2 = 0 then 2 * collatzCycleNum (terrasParityWord n (terras x)) else 3 ^ (terrasParityWord n (terras x)).sum + 2 * collatzCycleNum (terrasParityWord n (terras x)) n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthodd:x % 2 = 1h2tx:2 * terras x = 3 * x + 1⊢ 2 ^ (n + 1) * terras^[n] (terras x) = 3 ^ (x % 2 + (terrasParityWord n (terras x)).sum) * x + if x % 2 = 0 then 2 * collatzCycleNum (terrasParityWord n (terras x)) else 3 ^ (terrasParityWord n (terras x)).sum + 2 * collatzCycleNum (terrasParityWord n (terras x)) n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthodd:x % 2 = 1h2tx:2 * terras x = 3 * x + 1h1ne0:¬1 = 0⊢ 2 ^ (n + 1) * terras^[n] (terras x) = 3 ^ (x % 2 + (terrasParityWord n (terras x)).sum) * x + if x % 2 = 0 then 2 * collatzCycleNum (terrasParityWord n (terras x)) else 3 ^ (terrasParityWord n (terras x)).sum + 2 * collatzCycleNum (terrasParityWord n (terras x)) n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthodd:x % 2 = 1h2tx:2 * terras x = 3 * x + 1h1ne0:¬1 = 0⊢ 2 ^ (n + 1) * terras^[n] (terras x) = 3 ^ (1 + (terrasParityWord n (terras x)).sum) * x + (3 ^ (terrasParityWord n (terras x)).sum + 2 * collatzCycleNum (terrasParityWord n (terras x))) calc 2 ^ (n + 1) * terras^[n] (terras x) = 2 * (2 ^ n * terras^[n] (terras x)) := n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthodd:x % 2 = 1h2tx:2 * terras x = 3 * x + 1h1ne0:¬1 = 0⊢ 2 ^ (n + 1) * terras^[n] (terras x) = 2 * (2 ^ n * terras^[n] (terras x)) All goals completed! 🐙 _ = 2 * (3 ^ rest.sum * terras x + collatzCycleNum rest) := n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthodd:x % 2 = 1h2tx:2 * terras x = 3 * x + 1h1ne0:¬1 = 0⊢ 2 * (2 ^ n * terras^[n] (terras x)) = 2 * (3 ^ rest.sum * terras x + collatzCycleNum rest) All goals completed! 🐙 _ = 3 ^ rest.sum * (2 * terras x) + 2 * collatzCycleNum rest := n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthodd:x % 2 = 1h2tx:2 * terras x = 3 * x + 1h1ne0:¬1 = 0⊢ 2 * (3 ^ rest.sum * terras x + collatzCycleNum rest) = 3 ^ rest.sum * (2 * terras x) + 2 * collatzCycleNum rest All goals completed! 🐙 _ = 3 ^ rest.sum * (3 * x + 1) + 2 * collatzCycleNum rest := n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthodd:x % 2 = 1h2tx:2 * terras x = 3 * x + 1h1ne0:¬1 = 0⊢ 3 ^ rest.sum * (2 * terras x) + 2 * collatzCycleNum rest = 3 ^ rest.sum * (3 * x + 1) + 2 * collatzCycleNum rest All goals completed! 🐙 _ = 3 ^ (1 + rest.sum) * x + (3 ^ rest.sum + 2 * collatzCycleNum rest) := n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthodd:x % 2 = 1h2tx:2 * terras x = 3 * x + 1h1ne0:¬1 = 0⊢ 3 ^ rest.sum * (3 * x + 1) + 2 * collatzCycleNum rest = 3 ^ (1 + rest.sum) * x + (3 ^ rest.sum + 2 * collatzCycleNum rest) n:ℕih:∀ (x : ℕ), 2 ^ n * terras^[n] x = 3 ^ (terrasParityWord n x).sum * x + collatzCycleNum (terrasParityWord n x)x:ℕrest:List ℕ := terrasParityWord n (terras x)hrec:2 ^ n * terras^[n] (terras x) = 3 ^ rest.sum * terras x + collatzCycleNum resthodd:x % 2 = 1h2tx:2 * terras x = 3 * x + 1h1ne0:¬1 = 0⊢ 3 ^ rest.sum * (3 * x + 1) + 2 * collatzCycleNum rest = 3 ^ rest.sum * 3 * x + (3 ^ rest.sum + 2 * collatzCycleNum rest); All goals completed! 🐙private theorem terras_cycle_iff_bohmSontacchi {x n : ℕ} (hx : 1 ≤ x) (hn : 1 ≤ n) : terras^[n] x = x ↔ (3 ^ (terrasParityWord n x).sum < 2 ^ n ∧ (2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x)) := x:ℕn:ℕhx:1 ≤ xhn:1 ≤ n⊢ terras^[n] x = x ↔ 3 ^ (terrasParityWord n x).sum < 2 ^ n ∧ (2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x) x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n x⊢ terras^[n] x = x ↔ 3 ^ (terrasParityWord n x).sum < 2 ^ n ∧ (2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x) x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sum⊢ terras^[n] x = x ↔ 3 ^ (terrasParityWord n x).sum < 2 ^ n ∧ (2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x) x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sum⊢ terras^[n] x = x ↔ 3 ^ k < 2 ^ n ∧ (2 ^ n - 3 ^ k) * x = collatzCycleNum v x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sumhid:2 ^ n * terras^[n] x = 3 ^ k * x + collatzCycleNum v⊢ terras^[n] x = x ↔ 3 ^ k < 2 ^ n ∧ (2 ^ n - 3 ^ k) * x = collatzCycleNum v x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sumhid:2 ^ n * terras^[n] x = 3 ^ k * x + collatzCycleNum vhzero:collatzCycleNum v = 0 ↔ v.sum = 0⊢ terras^[n] x = x ↔ 3 ^ k < 2 ^ n ∧ (2 ^ n - 3 ^ k) * x = collatzCycleNum v x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sumhid:2 ^ n * terras^[n] x = 3 ^ k * x + collatzCycleNum vhzero:collatzCycleNum v = 0 ↔ v.sum = 0⊢ terras^[n] x = x → 3 ^ k < 2 ^ n ∧ (2 ^ n - 3 ^ k) * x = collatzCycleNum vx:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sumhid:2 ^ n * terras^[n] x = 3 ^ k * x + collatzCycleNum vhzero:collatzCycleNum v = 0 ↔ v.sum = 0⊢ 3 ^ k < 2 ^ n ∧ (2 ^ n - 3 ^ k) * x = collatzCycleNum v → terras^[n] x = x x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sumhid:2 ^ n * terras^[n] x = 3 ^ k * x + collatzCycleNum vhzero:collatzCycleNum v = 0 ↔ v.sum = 0⊢ terras^[n] x = x → 3 ^ k < 2 ^ n ∧ (2 ^ n - 3 ^ k) * x = collatzCycleNum v x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sumhid:2 ^ n * terras^[n] x = 3 ^ k * x + collatzCycleNum vhzero:collatzCycleNum v = 0 ↔ v.sum = 0hcyc:terras^[n] x = x⊢ 3 ^ k < 2 ^ n ∧ (2 ^ n - 3 ^ k) * x = collatzCycleNum v x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sumhid:2 ^ n * terras^[n] x = 3 ^ k * x + collatzCycleNum vhzero:collatzCycleNum v = 0 ↔ v.sum = 0hcyc:terras^[n] x = xhid_cyc:2 ^ n * x = 3 ^ k * x + collatzCycleNum v⊢ 3 ^ k < 2 ^ n ∧ (2 ^ n - 3 ^ k) * x = collatzCycleNum v x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sumhid:2 ^ n * terras^[n] x = 3 ^ k * x + collatzCycleNum vhzero:collatzCycleNum v = 0 ↔ v.sum = 0hcyc:terras^[n] x = xhid_cyc:2 ^ n * x = 3 ^ k * x + collatzCycleNum vhnum_pos:0 < collatzCycleNum v⊢ 3 ^ k < 2 ^ n ∧ (2 ^ n - 3 ^ k) * x = collatzCycleNum v x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sumhid:2 ^ n * terras^[n] x = 3 ^ k * x + collatzCycleNum vhzero:collatzCycleNum v = 0 ↔ v.sum = 0hcyc:terras^[n] x = xhid_cyc:2 ^ n * x = 3 ^ k * x + collatzCycleNum vhnum_pos:0 < collatzCycleNum vhlt_pow:3 ^ k < 2 ^ n⊢ 3 ^ k < 2 ^ n ∧ (2 ^ n - 3 ^ k) * x = collatzCycleNum v x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sumhid:2 ^ n * terras^[n] x = 3 ^ k * x + collatzCycleNum vhzero:collatzCycleNum v = 0 ↔ v.sum = 0hcyc:terras^[n] x = xhid_cyc:2 ^ n * x = 3 ^ k * x + collatzCycleNum vhnum_pos:0 < collatzCycleNum vhlt_pow:3 ^ k < 2 ^ nhprod:(2 ^ n - 3 ^ k) * x = collatzCycleNum v⊢ 3 ^ k < 2 ^ n ∧ (2 ^ n - 3 ^ k) * x = collatzCycleNum v All goals completed! 🐙 x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sumhid:2 ^ n * terras^[n] x = 3 ^ k * x + collatzCycleNum vhzero:collatzCycleNum v = 0 ↔ v.sum = 0⊢ 3 ^ k < 2 ^ n ∧ (2 ^ n - 3 ^ k) * x = collatzCycleNum v → terras^[n] x = x x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sumhid:2 ^ n * terras^[n] x = 3 ^ k * x + collatzCycleNum vhzero:collatzCycleNum v = 0 ↔ v.sum = 0hlt_pow:3 ^ k < 2 ^ nhprod:(2 ^ n - 3 ^ k) * x = collatzCycleNum v⊢ terras^[n] x = x x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sumhid:2 ^ n * terras^[n] x = 3 ^ k * x + collatzCycleNum vhzero:collatzCycleNum v = 0 ↔ v.sum = 0hlt_pow:3 ^ k < 2 ^ nhprod:(2 ^ n - 3 ^ k) * x = collatzCycleNum vhsub:(2 ^ n - 3 ^ k) * x + 3 ^ k * x = 2 ^ n * x⊢ terras^[n] x = x x:ℕn:ℕhx:1 ≤ xhn:1 ≤ nv:List ℕ := terrasParityWord n xk:ℕ := v.sumhid:2 ^ n * terras^[n] x = 3 ^ k * x + collatzCycleNum vhzero:collatzCycleNum v = 0 ↔ v.sum = 0hlt_pow:3 ^ k < 2 ^ nhprod:(2 ^ n - 3 ^ k) * x = collatzCycleNum vhsub:(2 ^ n - 3 ^ k) * x + 3 ^ k * x = 2 ^ n * xh2nx:2 ^ n * terras^[n] x = 2 ^ n * x⊢ terras^[n] x = x All goals completed! 🐙

Constructive equivalence between weakCollatz75 blank-tape halting and the Böhm–Sontacchi (1978) Diophantine cycle equation on x ≥ 3 (zero Classical.choice).

theorem halts_weakCollatz75_iff_bohmSontacchi : ConjectureMachines.Halts weakCollatz75 ↔ ∃ x n : ℕ, 3 ≤ x ∧ 1 ≤ n ∧ 3 ^ (terrasParityWord n x).sum < 2 ^ n ∧ (2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x) := ⊢ ConjectureMachines.Halts weakCollatz75 ↔ ∃ x n, 3 ≤ x ∧ 1 ≤ n ∧ 3 ^ (terrasParityWord n x).sum < 2 ^ n ∧ (2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x) ⊢ (∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2) ↔ ∃ x n, 3 ≤ x ∧ 1 ≤ n ∧ 3 ^ (terrasParityWord n x).sum < 2 ^ n ∧ (2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x) ⊢ (∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2) → ∃ x n, 3 ≤ x ∧ 1 ≤ n ∧ 3 ^ (terrasParityWord n x).sum < 2 ^ n ∧ (2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x)⊢ (∃ x n, 3 ≤ x ∧ 1 ≤ n ∧ 3 ^ (terrasParityWord n x).sum < 2 ^ n ∧ (2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x)) → ∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2 ⊢ (∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2) → ∃ x n, 3 ≤ x ∧ 1 ≤ n ∧ 3 ^ (terrasParityWord n x).sum < 2 ^ n ∧ (2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x) x:ℕn:ℕhx1:1 ≤ xhn1:1 ≤ nhcyc:terras^[n] x = xhxne1:x ≠ 1hxne2:x ≠ 2⊢ ∃ x n, 3 ≤ x ∧ 1 ≤ n ∧ 3 ^ (terrasParityWord n x).sum < 2 ^ n ∧ (2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x) x:ℕn:ℕhx1:1 ≤ xhn1:1 ≤ nhcyc:terras^[n] x = xhxne1:x ≠ 1hxne2:x ≠ 2hlt:3 ^ (terrasParityWord n x).sum < 2 ^ nhprod:(2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x)⊢ ∃ x n, 3 ≤ x ∧ 1 ≤ n ∧ 3 ^ (terrasParityWord n x).sum < 2 ^ n ∧ (2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x) exact ⟨x, n, x:ℕn:ℕhx1:1 ≤ xhn1:1 ≤ nhcyc:terras^[n] x = xhxne1:x ≠ 1hxne2:x ≠ 2hlt:3 ^ (terrasParityWord n x).sum < 2 ^ nhprod:(2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x)⊢ 3 ≤ x All goals completed! 🐙, hn1, hlt, hprod⟩ ⊢ (∃ x n, 3 ≤ x ∧ 1 ≤ n ∧ 3 ^ (terrasParityWord n x).sum < 2 ^ n ∧ (2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x)) → ∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2 x:ℕn:ℕhx3:3 ≤ xhn1:1 ≤ nhlt:3 ^ (terrasParityWord n x).sum < 2 ^ nhprod:(2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x)⊢ ∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2 x:ℕn:ℕhx3:3 ≤ xhn1:1 ≤ nhlt:3 ^ (terrasParityWord n x).sum < 2 ^ nhprod:(2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x)hcyc:terras^[n] x = x⊢ ∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2 exact ⟨x, n, x:ℕn:ℕhx3:3 ≤ xhn1:1 ≤ nhlt:3 ^ (terrasParityWord n x).sum < 2 ^ nhprod:(2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x)hcyc:terras^[n] x = x⊢ 1 ≤ x All goals completed! 🐙, hn1, hcyc, x:ℕn:ℕhx3:3 ≤ xhn1:1 ≤ nhlt:3 ^ (terrasParityWord n x).sum < 2 ^ nhprod:(2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x)hcyc:terras^[n] x = x⊢ x ≠ 1 All goals completed! 🐙, x:ℕn:ℕhx3:3 ≤ xhn1:1 ≤ nhlt:3 ^ (terrasParityWord n x).sum < 2 ^ nhprod:(2 ^ n - 3 ^ (terrasParityWord n x).sum) * x = collatzCycleNum (terrasParityWord n x)hcyc:terras^[n] x = x⊢ x ≠ 2 All goals completed! 🐙⟩

The 75-state machine weakCollatz75 halts on the blank tape if and only if Tao's Weak Collatz Conjecture is false.

theorem halts_weakCollatz75_iff_not_weakCollatz : ConjectureMachines.Halts weakCollatz75 ↔ ¬ WeakCollatzConjecture := ⊢ ConjectureMachines.Halts weakCollatz75 ↔ ¬WeakCollatzConjecture ⊢ (∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2) ↔ ¬WeakCollatzConjecture ⊢ (∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2) → ¬WeakCollatzConjecture⊢ ¬WeakCollatzConjecture → ∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2 ⊢ (∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2) → ¬WeakCollatzConjecture x:ℕk:ℕhx1:1 ≤ xhk1:1 ≤ khcyc:terras^[k] x = xhxne1:x ≠ 1hxne2:x ≠ 2hW:WeakCollatzConjecture⊢ False k:ℕhk1:1 ≤ khW:WeakCollatzConjecturehx1:1 ≤ 1hcyc:terras^[k] 1 = 1hxne1:1 ≠ 1hxne2:1 ≠ 2⊢ Falsek:ℕhk1:1 ≤ khW:WeakCollatzConjecturehx1:1 ≤ 2hcyc:terras^[k] 2 = 2hxne1:2 ≠ 1hxne2:2 ≠ 2⊢ False k:ℕhk1:1 ≤ khW:WeakCollatzConjecturehx1:1 ≤ 1hcyc:terras^[k] 1 = 1hxne1:1 ≠ 1hxne2:1 ≠ 2⊢ Falsek:ℕhk1:1 ≤ khW:WeakCollatzConjecturehx1:1 ≤ 2hcyc:terras^[k] 2 = 2hxne1:2 ≠ 1hxne2:2 ≠ 2⊢ False All goals completed! 🐙 ⊢ ¬WeakCollatzConjecture → ∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2 hnotW:¬WeakCollatzConjecture⊢ ∃ x k, 1 ≤ x ∧ 1 ≤ k ∧ terras^[k] x = x ∧ x ≠ 1 ∧ x ≠ 2 All goals completed! 🐙end ConjectureMachines.WeakCollatz75