Long horizon. Determining the exact value for six-state machines would show the precise limit of how long such small halting programs can run. Knowledge itself.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101import FormalConjectures.Wikipedia.BusyBeaver
namespace Submission
open Turing
theorem loop_right {Γ Λ : Type} [Inhabited Γ] [Inhabited Λ]
(M : Turing.BusyBeaver.Machine Γ Λ) (s : Γ)
(h : M default default = some (some default, ⟨s, Dir.right⟩)) :
∀ n, ∃ T : Tape Γ, M.multiStep (Turing.BusyBeaver.Machine.init []) n = some ⟨some default, T⟩ ∧
T.head = default ∧ T.right = ListBlank.mk [] := by
intro n
induction n with
| zero => exact ⟨Tape.mk₁ [], rfl, rfl, rfl⟩
| succ n ih =>
obtain ⟨T, hT, h1, h2⟩ := ih
refine ⟨(T.write s).move Dir.right, ?_, ?_, ?_⟩
· rw [Turing.BusyBeaver.Machine.multiStep_succ, hT]
simp only [Option.bind_some, Turing.BusyBeaver.Machine.step, h1, h]
try rfl
· obtain ⟨a, L, R⟩ := T
simp only at h2
subst h2
rfl
· obtain ⟨a, L, R⟩ := T
simp only at h2
subst h2
rfl
theorem loop_left {Γ Λ : Type} [Inhabited Γ] [Inhabited Λ]
(M : Turing.BusyBeaver.Machine Γ Λ) (s : Γ)
(h : M default default = some (some default, ⟨s, Dir.left⟩)) :
∀ n, ∃ T : Tape Γ, M.multiStep (Turing.BusyBeaver.Machine.init []) n = some ⟨some default, T⟩ ∧
T.head = default ∧ T.left = ListBlank.mk [] := by
intro n
induction n with
| zero => exact ⟨Tape.mk₁ [], rfl, rfl, rfl⟩
| succ n ih =>
obtain ⟨T, hT, h1, h2⟩ := ih
refine ⟨(T.write s).move Dir.left, ?_, ?_, ?_⟩
· rw [Turing.BusyBeaver.Machine.multiStep_succ, hT]
simp only [Option.bind_some, Turing.BusyBeaver.Machine.step, h1, h]
try rfl
· obtain ⟨a, L, R⟩ := T
simp only at h2
subst h2
rfl
· obtain ⟨a, L, R⟩ := T
simp only at h2
subst h2
rfl
theorem key {Γ Λ : Type} [Inhabited Γ] [Inhabited Λ] [Subsingleton Λ]
(M : Turing.BusyBeaver.Machine Γ Λ) (hM : M.IsHalting) :
M.HaltsAfter (Turing.BusyBeaver.Machine.init []) 1 := by
have hh : (Tape.mk₁ ([] : List Γ)).head = default := rfl
unfold Turing.BusyBeaver.Machine.HaltsAfter
rw [Turing.BusyBeaver.Machine.multiStep_succ, Turing.BusyBeaver.Machine.multiStep_one]
rcases h : M default default with _ | ⟨_ | q', s, d⟩
· simp [Turing.BusyBeaver.Machine.init, Turing.BusyBeaver.Machine.step, hh, h]
· simp [Turing.BusyBeaver.Machine.init, Turing.BusyBeaver.Machine.step, hh, h]
· exfalso
obtain rfl : q' = default := Subsingleton.elim _ _
obtain ⟨n, hn⟩ := (Turing.BusyBeaver.Machine.isHalting_iff_exists_haltsAt M).mp hM
unfold Turing.BusyBeaver.Machine.HaltsAfter at hn
cases d
· obtain ⟨T, hT, -, -⟩ := loop_left M s h (n + 1)
rw [hT] at hn
exact Option.some_ne_none _ hn
· obtain ⟨T, hT, -, -⟩ := loop_right M s h (n + 1)
rw [hT] at hn
exact Option.some_ne_none _ hn
theorem hub : ∀ N : ℕ, (∃ C : BusyBeaver.Candidate 1, C.M.haltingNumber = (N : ENat)) → N ≤ 1 := by
rintro N ⟨C, hC⟩
haveI : Subsingleton C.Λ := Fintype.card_le_one_iff_subsingleton.mp C.Λ_card.le
have hle : C.M.haltingNumber ≤ ((1 : ℕ) : ENat) := by
unfold Turing.BusyBeaver.Machine.haltingNumber
exact sInf_le ⟨1, key C.M C.M_isHalting, rfl⟩
rw [hC] at hle
exact_mod_cast hle
def W : BusyBeaver.Candidate 1 where
Γ := Bool
Λ := Unit
Γ_fintype := inferInstance
Γ_card := Fintype.card_bool
Γ_inhabited := inferInstance
Λ_fintype := inferInstance
Λ_card := Fintype.card_unit
Λ_inhabited := inferInstance
M := fun _ _ => some (none, ⟨false, Dir.right⟩)
M_isHalting := (Turing.BusyBeaver.Machine.isHalting_iff_exists_haltsAt _).mpr ⟨1, rfl⟩
theorem h1 : ∃ C : BusyBeaver.Candidate 1, C.M.haltingNumber = ((1 : ℕ) : ENat) :=
⟨W, Turing.BusyBeaver.Machine.haltingNumber_def W.M 1 ⟨_, rfl⟩ rfl⟩
theorem solution : type_of% @BusyBeaver.BB_1 := by
unfold BusyBeaver.BB
apply le_antisymm
· exact csSup_le ⟨1, h1⟩ (fun N hN => hub N hN)
· exact le_csSup ⟨1, fun N hN => hub N hN⟩ h1
end Submission
Check it yourself
Project
formal-conjectures
Commit
f606af160664c5a10952e9a957b100a1cd45bbeb
Lean
leanprover/lean4:v4.33.1
Mathlib
0df444a360eaa60ab8c11dca51a86af692955474
With Git and Elan installed, put the download in a fresh working directory and run this there. Use a disposable environment. Lean prints the axioms at the end. The checker allows propext, Classical.choice, and Quot.sound.
(
set -eu
proof="$PWD/eb62d6ff-00a5-44f4-a01f-119ffb46eb07.lean"
git clone https://github.com/google-deepmind/formal-conjectures.git formal-conjectures
git -C formal-conjectures checkout --detach f606af160664c5a10952e9a957b100a1cd45bbeb
cd formal-conjectures
elan toolchain install leanprover/lean4:v4.33.1
lake +leanprover/lean4:v4.33.1 exe cache get
lake +leanprover/lean4:v4.33.1 build '+FormalConjectures.Wikipedia.BusyBeaver'
check_dir="$(mktemp -d)"
trap 'rm -f "$check_dir/Check.lean"; rmdir "$check_dir"' EXIT
printf "%s\n" "import Lean" > "$check_dir/Check.lean"
cat "$proof" >> "$check_dir/Check.lean"
cat >> "$check_dir/Check.lean" <<'SOLVE_CHECK'
example : type_of% @_root_.BusyBeaver.BB_1 := @_root_.Submission.solution
#print axioms Submission.solution
SOLVE_CHECK
lake +leanprover/lean4:v4.33.1 env lean "$check_dir/Check.lean"
)
Download the receipt verifier and public key. Run python3 verify-proof.py certificate.json eb62d6ff-00a5-44f4-a01f-119ffb46eb07.lean proof-key.pem with OpenSSL 3.