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.ErdosTernary15 public import Cryptids.Propositions

Semantics of the Erdős Ternary Turing Machine (erdos_ternary_15)

This file proves that the 15-state Turing machine erdosTernary15 (erdos_ternary_15) halts on the blank tape if and only if Erdős's ternary conjecture is false (i.e., there exists n > 8 such that the base-3 expansion of 2 ^ n has no digit 2).

Cryptids.ErdosTernary15 proves Halts erdosTernary15 ↔ ∃ n, 8 < n ∧ 2 ∉ pw n without Classical.choice, where pw n is the digit list of 2 ^ n computed by repeated doubling. This file identifies pw n with Mathlib's Nat.digits 3 (2 ^ n), whose definition and lemmas use Classical.choice. The negated form ¬ ErdosTernaryConjecture also uses Markov's Principle (not_forall), as for ¬ GoldbachConjecture.

Provenance and Attribution

@[expose] public sectionnamespace ConjectureMachines.ErdosTernary15

Doubling with carry c ≤ 1 on base-3 digit lists agrees with Nat.digits.

theorem dbl_digits (x c : ℕ) (hc : c ≤ 1) : dbl (Nat.digits 3 x) c = Nat.digits 3 (2 * x + c) := x:ℕc:ℕhc:c ≤ 1⊢ dbl (Nat.digits 3 x) c = Nat.digits 3 (2 * x + c) induction x using Nat.strong_induction_on generalizing c with x:ℕih:∀ m < x, ∀ c ≤ 1, dbl (Nat.digits 3 m) c = Nat.digits 3 (2 * m + c)c:ℕhc:c ≤ 1⊢ dbl (Nat.digits 3 x) c = Nat.digits 3 (2 * x + c) c:ℕhc:c ≤ 1ih:∀ m < 0, ∀ c ≤ 1, dbl (Nat.digits 3 m) c = Nat.digits 3 (2 * m + c)⊢ dbl (Nat.digits 3 0) c = Nat.digits 3 (2 * 0 + c)x:ℕih:∀ m < x, ∀ c ≤ 1, dbl (Nat.digits 3 m) c = Nat.digits 3 (2 * m + c)c:ℕhc:c ≤ 1hx:x > 0⊢ dbl (Nat.digits 3 x) c = Nat.digits 3 (2 * x + c) c:ℕhc:c ≤ 1ih:∀ m < 0, ∀ c ≤ 1, dbl (Nat.digits 3 m) c = Nat.digits 3 (2 * m + c)⊢ dbl (Nat.digits 3 0) c = Nat.digits 3 (2 * 0 + c) ih:∀ m < 0, ∀ c ≤ 1, dbl (Nat.digits 3 m) c = Nat.digits 3 (2 * m + c)hc:0 ≤ 1⊢ dbl (Nat.digits 3 0) 0 = Nat.digits 3 (2 * 0 + 0)ih:∀ m < 0, ∀ c ≤ 1, dbl (Nat.digits 3 m) c = Nat.digits 3 (2 * m + c)hc:1 ≤ 1⊢ dbl (Nat.digits 3 0) 1 = Nat.digits 3 (2 * 0 + 1) ih:∀ m < 0, ∀ c ≤ 1, dbl (Nat.digits 3 m) c = Nat.digits 3 (2 * m + c)hc:0 ≤ 1⊢ dbl (Nat.digits 3 0) 0 = Nat.digits 3 (2 * 0 + 0) All goals completed! 🐙 ih:∀ m < 0, ∀ c ≤ 1, dbl (Nat.digits 3 m) c = Nat.digits 3 (2 * m + c)hc:1 ≤ 1⊢ dbl (Nat.digits 3 0) 1 = Nat.digits 3 (2 * 0 + 1) All goals completed! 🐙 x:ℕih:∀ m < x, ∀ c ≤ 1, dbl (Nat.digits 3 m) c = Nat.digits 3 (2 * m + c)c:ℕhc:c ≤ 1hx:x > 0⊢ dbl (Nat.digits 3 x) c = Nat.digits 3 (2 * x + c) x:ℕih:∀ m < x, ∀ c ≤ 1, dbl (Nat.digits 3 m) c = Nat.digits 3 (2 * m + c)c:ℕhc:c ≤ 1hx:x > 0⊢ (2 * (x % 3) + c) % 3 :: Nat.digits 3 (2 * (x / 3) + (2 * (x % 3) + c) / 3) = (2 * x + c) % 3 :: Nat.digits 3 ((2 * x + c) / 3) x:ℕih:∀ m < x, ∀ c ≤ 1, dbl (Nat.digits 3 m) c = Nat.digits 3 (2 * m + c)c:ℕhc:c ≤ 1hx:x > 0e₁:(2 * (x % 3) + c) % 3 = (2 * x + c) % 3⊢ (2 * (x % 3) + c) % 3 :: Nat.digits 3 (2 * (x / 3) + (2 * (x % 3) + c) / 3) = (2 * x + c) % 3 :: Nat.digits 3 ((2 * x + c) / 3) x:ℕih:∀ m < x, ∀ c ≤ 1, dbl (Nat.digits 3 m) c = Nat.digits 3 (2 * m + c)c:ℕhc:c ≤ 1hx:x > 0e₁:(2 * (x % 3) + c) % 3 = (2 * x + c) % 3e₂:2 * (x / 3) + (2 * (x % 3) + c) / 3 = (2 * x + c) / 3⊢ (2 * (x % 3) + c) % 3 :: Nat.digits 3 (2 * (x / 3) + (2 * (x % 3) + c) / 3) = (2 * x + c) % 3 :: Nat.digits 3 ((2 * x + c) / 3) All goals completed! 🐙

pw n is the list of base-3 digits of 2 ^ n, least significant first.

theorem pw_eq (n : ℕ) : pw n = Nat.digits 3 (2 ^ n) := n:ℕ⊢ pw n = Nat.digits 3 (2 ^ n) induction n with ⊢ pw 0 = Nat.digits 3 (2 ^ 0) All goals completed! 🐙 n:ℕih:pw n = Nat.digits 3 (2 ^ n)⊢ pw (n + 1) = Nat.digits 3 (2 ^ (n + 1)) All goals completed! 🐙

The 15-state machine erdosTernary15 (erdos_ternary_15) halts on the blank tape if and only if some power 2 ^ n with n > 8 has no digit 2 in base 3.

theorem halts_erdosTernary15_iff_exists_counterexample : ConjectureMachines.Halts erdosTernary15 ↔ ∃ n : ℕ, 8 < n ∧ 2 ∉ Nat.digits 3 (2 ^ n) := ⊢ ConjectureMachines.Halts erdosTernary15 ↔ ∃ n, 8 < n ∧ 2 ∉ Nat.digits 3 (2 ^ n) ⊢ ConjectureMachines.Halts erdosTernary15 ↔ ∃ n, 8 < n ∧ 2 ∉ pw n All goals completed! 🐙

The 15-state machine erdosTernary15 (erdos_ternary_15) halts on the blank tape if and only if Erdős's ternary conjecture is false.

theorem halts_erdosTernary15_iff_not_erdosTernary : ConjectureMachines.Halts erdosTernary15 ↔ ¬ ErdosTernaryConjecture := ⊢ ConjectureMachines.Halts erdosTernary15 ↔ ¬ErdosTernaryConjecture ⊢ (∃ n, 8 < n ∧ 2 ∉ Nat.digits 3 (2 ^ n)) ↔ ¬ErdosTernaryConjecture All goals completed! 🐙end ConjectureMachines.ErdosTernary15