From 7cd63066ed89261f21059723c2f8a50898bcb10b Mon Sep 17 00:00:00 2001 From: Tom Zahavy Date: Thu, 29 Oct 2026 08:31:57 +0000 Subject: [PATCH 1/6] Add BB(6) hardness classification: BusyBeaver.BB6.Hardness and per-machine Hardness sections Record why the hardest BB(6) holdouts are hard, in the bbchallenge cryptid vocabulary (halting trigger RW/RES/EQ/POW, growth regime, shield, heuristic hazard from exact accelerated simulation of the certified rules), for the 33-class hard core: Problems 1-5, the shielded single-base exponential cascades and the Collatz-like stacked cryptids S2-S5, plus the resolved case S1 (1RB1LA_0RC1RD_1LC0LA_1LE1RE_0RB0LF_---0LD), which the community proved halting (busycoq CubicMachines.v, TM49) in line with its critical hazard. - New docstring-only module BusyBeaver/BB6/Hardness.lean (rendered on the docs site), imported from BusyBeaver.lean. - A '## Hardness' section appended to the module docstring of the 27 hard-core machines present in BusyBeaver/BB6 and BusyBeaver/BB6/Accelerations. - README pointers; the 1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---1LC row now records the busycoq Eqv_RegularPairs.v equivalence with its ---0LA sibling. No theorem statements change; comparator configuration untouched. --- BusyBeaver.lean | 1 + ...LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.lean | 20 + ...RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.lean | 19 + ...LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.lean | 20 + ...LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean | 19 + ...LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean | 19 + ...RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.lean | 18 + ...HH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.lean | 17 + ...HH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean | 17 + BusyBeaver/BB6/Accelerations/README.md | 2 + BusyBeaver/BB6/Hardness.lean | 504 ++++++++++++++++++ ...LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.lean | 20 + ...LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean | 19 + ...LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean | 18 + ...LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean | 19 + ...LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.lean | 19 + ...RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.lean | 19 + ...RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.lean | 18 + ...LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.lean | 21 + ...LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.lean | 18 + ...LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.lean | 18 + ...LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.lean | 19 + ...LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean | 17 + ...RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.lean | 19 + ...RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.lean | 19 + ...RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.lean | 17 + ...RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.lean | 20 + ...RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.lean | 19 + ...RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean | 17 + ...RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.lean | 18 + BusyBeaver/BB6/README.md | 4 +- 31 files changed, 1013 insertions(+), 1 deletion(-) create mode 100644 BusyBeaver/BB6/Hardness.lean diff --git a/BusyBeaver.lean b/BusyBeaver.lean index 2ecf1bfb..83868929 100644 --- a/BusyBeaver.lean +++ b/BusyBeaver.lean @@ -11,6 +11,7 @@ public import BusyBeaver.Cert public import BusyBeaver.WordRLE public import BusyBeaver.AffRLE public import BusyBeaver.ElabRLE +public import BusyBeaver.BB6.Hardness public import BusyBeaver.BB6.M_1RB0LB_1LC0RE_1LA1LD_0LCHHH_0RB0RF_1RE1RB public import BusyBeaver.BB6.M_1RB0LC_0LC0RF_1RD1LC_0RA1LE_HHH0LD_1LF1LA public import BusyBeaver.BB6.M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA diff --git a/BusyBeaver/BB6/Accelerations/M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.lean b/BusyBeaver/BB6/Accelerations/M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.lean index e22a0de2..945ce478 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.lean @@ -37,6 +37,26 @@ Start: C(0, [0], [1]), reached after 19 raw TM steps Restricting to the Poincaré return section $R = [0]$ eliminates the right stack completely, yielding a single-stack transition system $C_{\mathrm{HL}}(a, L) := C(a, L, [0])$ starting at $C_{\mathrm{HL}}(3, [0])$. + + +## Hardness + +*Hardness class:* Problem S4 — trigger **POW (power-of-two bottom exposure)**, growth +mass-conserving ($\Delta M = 0$), log-depth tower, shield partial (`ValidStack660` kills $C([],R)$). + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* 21 exposures in $3\times10^6$ steps ($1292\to646\to323$, $94000\to\dots\to5875$), odd +parts $\ge323$; negligible residual hazard, no invariant known + +*Simulated horizon:* $3\times10^6$ macro-steps (exact); pumping test: 13 perturbed configurations, 0 +halts + +*Why it is hard:* Single-Pass Drainage Law $b_{i+1} = a_{i+1}+q_i+1$, $q_{k-1} = 2^m-1$, $u = 2^m$ + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.lean b/BusyBeaver/BB6/Accelerations/M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.lean index 32fb1cbd..b057f812 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.lean @@ -45,6 +45,25 @@ Start: F(1, 0, [], 0, []), reached after 16 raw TM steps Contracting every intermediate $C$-chain via structural recursion on $L$ (`exitC`) eliminates state $C$ completely, yielding a single-constructor high-level transition system $F_{\mathrm{HL}}(a, b, L, r, R)$ starting at $F_{\mathrm{HL}}(1, 0, [], 0, [])$. + + +## Hardness + +*Hardness class:* Problem S3 — trigger **EQ (depth-two gate)**, growth —, shield partial +(`ValidStack129` kills $\mathrm{CR}\,[]\,R$ and all $0::0::L$ states). + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting (weak race). + +*Hazard:* 232 depth-two visits in $10^7$ steps, $a\in\lbrace 3,4,7,9,11,15 \rbrace$ on 8 of them +($a=1$ halts); $\approx2$ expected halts, 0 observed + +*Simulated horizon:* $10^7$ macro-steps (exact) + +*Why it is hard:* two-mode halving sweeper; halts iff $L$ drains to $[1,0]$ in $\mathrm{CR}$ + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.lean b/BusyBeaver/BB6/Accelerations/M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.lean index 1b7fe691..422557a3 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.lean @@ -43,6 +43,26 @@ Start: D(1, 0, [], []), reached after 7 raw TM steps Restricting to the $R = []$ return section and contracting intermediate $E$ and $D(\dots, 0 :: R)$ chains (`runE`) eliminates both state $E$ and the right stack $R$, yielding a single-stack system $D_{\mathrm{HL}}(a, b, L) := D(a, b, L, [])$ starting at $D_{\mathrm{HL}}(1, 0, [])$. + + +## Hardness + +*Hardness class:* Problem S2 — trigger **POW (bottom funnel $x+2 = 2^k$)**, growth power-law regime, +shield partial (`ValidStack391`: mode $D$ never halts). + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting (clean race). + +*Hazard:* 318 bottom reaches in $10^7$ steps ($29\to73\to204$ per decade), $x$ spread over +$10^3$–$10^4$; residual hazard $\approx0.2$; near-misses $251, 513, 514, 61, 132$ + +*Simulated horizon:* $10^7$ macro-steps (exact); pumping test: 72 perturbed configurations, 0 halts +in $10^5$ steps + +*Why it is hard:* rung-by-rung halving with carry on $\mathrm{List}(\mathbb N)$ + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean b/BusyBeaver/BB6/Accelerations/M_1RB1LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean index 90d58cd7..69c8d3fd 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB1LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB1LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean @@ -18,6 +18,25 @@ Formal `HasStackReduction` proof for the 6-state, 2-symbol Busy Beaver machine Each half-tape stack encodes unary blocks $1^{a + 1}$ separated by single zeros (`encStack`), ordered from the tape head outward. Starting from `init []`, the machine enters a closed 2-mode (`D`, `FR`) 2nd-order digit-stack system in 3 raw steps. + + +## Hardness + +*Hardness class:* Problem S5 — trigger **POW (Mersenne bottom rung $2^k-1$)**, growth —, shield +partial (`ValidStack549` kills the empty-stack halt). + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting, slowly critical. + +*Hazard:* 846 exposures in $10^7$ steps ($14\to35\to90\to275$ fresh starts per decade), +$\approx0.05$ expected halts per decade; near-misses $4,13,61,65,252,513,1020,1027$ + +*Simulated horizon:* $10^7$ macro-steps (exact) + +*Why it is hard:* the community's *Sweeper* re-measured; two-mode halving sweeper + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean b/BusyBeaver/BB6/Accelerations/M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean index 6254a375..4583e427 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean @@ -18,6 +18,25 @@ Formal `HasStackReduction` proof for the 6-state, 2-symbol Busy Beaver machine Each half-tape stack encodes unary blocks $1^{3a + 2}$ separated by single zeros, ordered from the tape head outward. Starting from `init []`, the machine enters a closed 2-mode (`SweepR`, `CarryD`) 2nd-order digit-stack system in 14 raw steps. + + +## Hardness + +*Hardness class:* Wiki stack — trigger **era-recursive (3-case bottom-extension recurrence)**, +growth doubly-exponential era lengths ($T_0..T_3 = 1, 2, 8, 256$), shield none closed (all-even +$R$ + $L.\mathrm{last}=0$ refuted across eras). + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting (wiki cryptid). + +*Hazard:* not quantified; perturbed all-even seeds halt in Era 2/3 (`rec_59_bottom_extension`) + +*Simulated horizon:* pumping test: 46 perturbed configurations, 0 halts in $10^5$ steps + +*Why it is hard:* exact 3-case composition theorem verified on all 1,024 stacks of weight $\le10$ + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.lean b/BusyBeaver/BB6/Accelerations/M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.lean index cde7c758..08ca23b3 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.lean @@ -41,6 +41,24 @@ Start: C(3, [0], []), reached after 19 raw TM steps Restricting to the Poincaré return section $R = []$ eliminates the right stack completely, yielding a single-stack transition system $C_{\mathrm{HL}}(a, L) := C(a, L, [])$ starting at $C_{\mathrm{HL}}(3, [0])$. + + +## Hardness + +*Hardness class:* Problem S4 — trigger **POW**, growth mass-conserving sandpile, shield partial +(`ValidStack680` kills $C([],R)$; strict digit positivity at `mode_C`). + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* as #660 + +*Simulated horizon:* family-level + +*Why it is hard:* E1 pair of #480 + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.lean b/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.lean index c5d6ca21..98ce44b2 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.lean @@ -42,6 +42,23 @@ CR(a + 2, b, L, d + 1, R) -> CR(d + 1, a + 1, b :: L, r, R') where (r, R') Start: CR(0, 0, [], 0, []), reached after 5 raw TM steps ``` + + +## Hardness + +*Hardness class:* S5 sibling — trigger **POW**, growth —, shield partial. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* E1 Group 39 with #549 (same table, different seed); not separately measured + +*Simulated horizon:* family-level + +*Why it is hard:* see #549 + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean b/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean index fdca4346..22b494b1 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean @@ -14,6 +14,23 @@ public import BusyBeaver.Bridge Formal `HasStackReduction` proof for the 6-state, 2-symbol Busy Beaver holdout `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` (https://wiki.bbchallenge.org/wiki/1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA). + + +## Hardness + +*Hardness class:* Wiki stack — trigger **—**, growth —, shield —. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* wiki cryptid family +(E1 group #85/#285/#490/#500). + +*Hazard:* not re-measured + +*Simulated horizon:* — + +*Why it is hard:* `IsStackCryptid` closure proved + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/README.md b/BusyBeaver/BB6/Accelerations/README.md index d84ee6c1..fcc0ed3f 100644 --- a/BusyBeaver/BB6/Accelerations/README.md +++ b/BusyBeaver/BB6/Accelerations/README.md @@ -5,6 +5,8 @@ This directory contains formal Lean 4 specifications and kernel-verified reducti 1. **9 Community-Documented `bbchallenge` Wiki Machines** formalized under the three structural reduction predicates defined in [`BusyBeaver/Defs.lean`](../../Defs.lean)—`HasStackReduction` (6 machines), `HasOdometerReduction` (2 machines: Beaver Math Olympiad Problems 10 and 11), and `HasTransducerReduction` (1 machine: *Bell eats counter*). 2. **20 Open `BB(6)` Acceleration Problems** certified via `IsValidAcceleration` and `IsHalt target ↔ CollatzHalts next start` (with [`1RB1LD_0RC0LF_1LD1RE_0LA0RB_0RD1RB_0LD---`](./M_1RB1LD_0RC0LF_1LD1RE_0LA0RB_0RD1RB_0LDHHH.lean) additionally proved under `HasOdometerReduction`). Each open problem states a self-contained initial state $s_0$ (`start`) and accelerated transition map $T$ (`next`) over finite sequences and non-negative integers: the corresponding Turing machine halts from the blank tape if and only if iterating $T$ from $s_0$ eventually reaches $\mathrm{Halt}$ (`none`). For **13** of the 20 machines, we additionally prove a **higher-level Poincaré / epoch acceleration** $(s_{0,\mathrm{HL}}, T_{\mathrm{HL}})$ (`HighLevelState`, `highLevelStart`, `highLevelEncode`, `highLevelNext`, `is_valid_highLevel_acceleration`, `isHalt_iff_highLevel_acceleration`, `acceleration_iff_highLevel_acceleration`) that eliminates an entire stack, mixed-radix odometer, or auxiliary mode by restricting to a canonical return section or contracting full multi-bounce epochs. +> **Hardness.** The Collatz-like stacked cryptids among these machines (`#391`, `#129`, `#660`/`#680`, `#549`, `#80`, `#33`, `#85`) are classified, with heuristic hazards and the resolved case `#72`, in [`../Hardness.lean`](../Hardness.lean) (`BusyBeaver.BB6.Hardness`). + ## Structural Reduction Predicates ([`BusyBeaver/Defs.lean`](../../Defs.lean)) | Predicate | Dynamical Family | diff --git a/BusyBeaver/BB6/Hardness.lean b/BusyBeaver/BB6/Hardness.lean new file mode 100644 index 00000000..65471a93 --- /dev/null +++ b/BusyBeaver/BB6/Hardness.lean @@ -0,0 +1,504 @@ +/- +Copyright (c) 2026 Google LLC. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +-/ +module + +public import BusyBeaver.Basic + +/-! +# Hardness of the BB(6) Holdouts: the Cryptid Core + +This page records *why* the hardest BB(6) holdouts are hard, in the vocabulary the `bbchallenge` +community uses for [Cryptids](https://wiki.bbchallenge.org/wiki/Cryptids) (Antihydra, Space Needle, +Lucy's Moonlight), applied uniformly to the machines formalized in this repository. Every reduction +cited here is kernel-verified (`HasCollatzReduction`, `HasStackReduction`, `IsValidAcceleration`); +every hazard statement is a *heuristic* computed from the certified rules by exact accelerated +simulation and is marked as such. The full dossiers, with reproduction commands, accompany the arXiv +report; this page is the summary. + +## 1. The hardness vocabulary + +A cryptid's halting condition is decided by a **residue sequence** (parities, base-3 digits, 2-adic +valuations) that passes every statistical test for randomness. Three facts classify a machine: + +* **Halting trigger** — how residues become a halting event: **RW** (gambler's ruin: a long run of + residues must go wrong; Hydra/Antihydra), **RES** (one residue at an era reset; Lucy's Moonlight), + **EQ**/**POW** (two independently evolving quantities must coincide exactly, or a value must be an + exact power of two / Mersenne number; Space Needle). +* **Growth regime** — linear, exponential, or tetrational mass; it fixes the decay of the per-test + hazard $p_t$: geometric (RW), constant (RES), or $\sim m/W_t$ for a target of $m$ values in a + window of width $W_t$ (EQ/POW). +* **Shield** — an inductive invariant (parity lock, mod-3 head, digit bound) that disables halting + arms on all (*full*), almost all (*leaky*) or some (*partial*) steps. + +The verdict follows the Borel–Cantelli bookkeeping of the community's *probviously*: +$\sum_t p_t < \infty$ gives probviously non-halting with the tail as residual probability; +$\sum_t p_t = \infty$ gives probviously halting; two decided sinks give the *undecided type*. **A +critical ($\sum 1/t$) hazard is a prediction that the machine halts within computational reach** — +see the calibration case below. + +## 2. The core + +Thirty-three classes of the 2026-10-24 holdout list (623 classes) are hard in this sense: the five +first-order problems of the report, the shielded single-base exponential cascades, and the +Collatz-like stacked cryptids. Eight were known to the community before our campaign; the rest are +new. Problem S1 (`#72`) is listed last because the community has since **proved that it halts**. + +### Problems 1-5 (first-order, this campaign) + +* `1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LF---_0RA1LA` + ([#330](./M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.lean)) (ours): Problem 1; Tetrational + Hydra-Reset (Racheline / ShiftOv6). Trigger RES + competing sinks; growth tetrational + ($10 \uparrow\uparrow k$, $N_7 \approx 2.86\times10^{771}$); shield none. undecided type (second + known after Racheline's #424). Status: `is_cryptid`; `HasCollatzReduction`; open (on the + 2026-10-24 holdout list). +* `1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_---0RE` + ([#183](./M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.lean)) (ours): Problem 2; Single-Base + Exponential Cascade. Trigger EQ (shrinking target) with leaky parity shield; growth linear (mass + $2k+c$, drift $+2$/cycle); shield leaky (odd-$c$ regime blocks the coincidence). probviously + non-halting. Status: `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). +* `1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_---0RE` + ([#352](./M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.lean)) (ours): Problem 2; Single-Base + Exponential Cascade. Trigger EQ with leaky parity shield; growth linear ($2^n$ fuel bursts, + intermittent resets); shield leaky. probviously non-halting. Status: `is_cryptid`; + `HasCollatzReduction`; open (on the 2026-10-24 holdout list). +* `1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_---0RE` + ([#530](./M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.lean)) (ours): Problem 2; Single-Base + Exponential Cascade. Trigger EQ with leaky parity shield; growth linear; shield leaky. probviously + non-halting. Status: `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). +* `1RB0LF_1RC1RA_0RD0RB_1LE---_0LA1LE_1RD1LA` + ([#429](./M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.lean)) (ours): Problem 3; Single-Base + Exponential Cascade. Trigger EQ, critical; growth linear ($2v+w \approx 43.66\,T$); shield none + (parity flips every step). probviously halting, but only at $\sim 10^{110}$ steps. Status: + `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). +* `1RB1LF_0RC1RD_1LA1LD_1LE0RA_---1LC_0LA1LA` + ([#184](./M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.lean)) (ours): Problem 4; Single-Base + Exponential Cascade. Trigger EQ (2-wide window at turnaround); growth exponential + ($\gamma\approx1.4246$ per era, base 3); shield none. probviously non-halting. Status: + `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). +* `1RB1RB_1LC0RE_---1LD_0RA1LB_1RA1LF_0LE1LE` + ([#724](./M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.lean)) (ours): Problem 4; Single-Base + Exponential Cascade. Trigger EQ (2-wide window); growth exponential ($\gamma\approx1.4589$ per + era); shield none. probviously non-halting. Status: `is_cryptid`; `HasCollatzReduction`; open (on + the 2026-10-24 holdout list). +* `1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_---1RA` + ([#73](./M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.lean)) (ours): Problem 5; Tetrational + Hydra-Reset (Racheline / ShiftOv6). Trigger EQ (rebound trap); growth exponential + ($\gamma\approx1.9538$ per era); shield none. probviously non-halting. Status: `is_cryptid`; + `HasCollatzReduction`; open (on the 2026-10-24 holdout list). + +### Shielded single-base exponential cascades + +* `1RB0LF_1LC0LD_1RD1LB_---1RE_0RA1RE_1LA0LE` + ([#79](./M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean)) (ours): Cascade; Single-Base + Exponential Cascade. Trigger EQ; growth super-exponential (two-stage $2^n$ doubling tower); shield + none. probviously non-halting. Status: `is_cryptid`; `HasCollatzReduction`; open (on the + 2026-10-24 holdout list). +* `1RB1LF_1RC1RF_0LD1RE_---1LC_0RB1RE_1LA0LE` + ([#116](./M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean)) (wiki): Cascade; Single-Base + Exponential Cascade. Trigger EQ; growth exponential; shield see family. wiki rediscovery + (RobinCodes *Next Steps* list). Status: `is_cryptid`, `is_stack_cryptid`; `HasCollatzReduction`; + open (on the 2026-10-24 holdout list). +* `1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_---1RD` + ([#153](./M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.lean)) (ours): Cascade; Single-Base + Exponential Cascade. Trigger EQ; growth exponential (two-base: $2^n$ doubling then $4^n$ + quadrupling, $\times2.3917$ per launch); shield none. probviously non-halting. Status: + `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). +* `1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_---0RD` + ([#464](./M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.lean)) (ours): Cascade; Single-Base + Exponential Cascade. Trigger EQ; growth exponential ($4^n$ inner cascades, $(4/3)^k$ sweeps); + shield partial (odd-$a$ invariant kills 2 of 4 halting rules and 12 of 34 rules). probviously + non-halting. Status: `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). +* `1RB0RE_1LC0RA_1RF0RD_---1LE_0LB1LE_1LE1RC` + ([#590](./M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.lean)) (ours): Cascade; Single-Base + Exponential Cascade. Trigger EQ; growth super-exponential; shield none. probviously non-halting. + Status: `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). +* `1RB1RF_1LC---_1LE1RD_1RA0RC_0LF0LA_0LD0RB` + ([#614](./M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.lean)) (ours): Cascade; Single-Base + Exponential Cascade. Trigger EQ ($2^n$ remainder coincidence); growth exponential ($\times1.4069$ + per cascade); shield partial ($a\ge1$ kills `rule_1_halt`). probviously non-halting. Status: + `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). +* `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---0LA` + ([#623](./M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean)) (ours): Cascade; Single-Base + Exponential Cascade. Trigger EQ; growth exponential (4-counter $3^n$ cascade); shield full + (odd-$a_H$ parity shield blocks every `closes_H_mid` halt). probviously non-halting; strong + `IsDoesNotHalt` candidate. Status: `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 + holdout list). +* `1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_---0RE` + ([#644](./M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.lean)) (ours): Cascade; Single-Base + Exponential Cascade. Trigger EQ (second-order coincidence); growth exponential ($2^n$ cascade); + shield partial (even-$c$ parity shield blocks 99.8% of visits). probviously non-halting. Status: + `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). +* `1RB1RF_1LC1LF_0RE1LD_0LB1LD_---1RC_1RA0RD` + ([#688](./M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean)) (wiki): Cascade; Single-Base + Exponential Cascade. Trigger EQ; growth exponential; shield see family. wiki rediscovery + (RobinCodes *Next Steps* list). Status: `is_cryptid`, `is_stack_cryptid`; `HasCollatzReduction`; + open (on the 2026-10-24 holdout list). +* `1RB1RC_1LC1LC_1RE0LD_1LB1RF_---1RA_0RD1RD` + ([#693](./M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.lean)) (ours): Cascade; Single-Base + Exponential Cascade. Trigger EQ; growth exponential ($\times1.2402$ per step); shield none. + probviously non-halting. Status: `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 + holdout list). +* `1RB0LF_1LC1RA_0RE0RD_---1LE_1LF1RC_1LC1LA` + ([#746](./M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean)) (ours): Cascade; Single-Base + Exponential Cascade. Trigger EQ; growth exponential ($2^n$ cascade + base-$3/2$ underflow drain); + shield partial (exact even-$c$ invariant). probviously non-halting. Status: `is_cryptid`; + `HasCollatzReduction`; open (on the 2026-10-24 holdout list). + +### Collatz-like stacked cryptids (S2-S5 and their siblings) + +* `1RB1LA_1LA0RC_1RD1RC_1LE0RC_---0LF_1LE0LA` + ([#391](./Accelerations/M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.lean)) (ours): Problem S2; + Unary-Binary Bounded Stack Counter. Trigger POW (bottom funnel $x+2 = 2^k$); growth power-law + regime; shield partial (`ValidStack391`: mode $D$ never halts). probviously non-halting (clean + race). Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). +* `1RB0RB_1RC0LE_1LD1LA_---0LC_1RF1LE_1RA0RA` + ([#129](./Accelerations/M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.lean)) (ours): Problem S3; + Halving Tower (2-Adic Stack). Trigger EQ (depth-two gate); growth —; shield partial + (`ValidStack129` kills $\mathrm{CR}\,[]\,R$ and all $0::0::L$ states). probviously non-halting + (weak race). Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). +* `1RB0LD_1LC1RD_0LE1LA_0RB1RD_---0LF_1RA1LF` + ([#660](./Accelerations/M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.lean)) (ours): Problem S4; + Halving Tower (2-Adic Stack). Trigger POW (power-of-two bottom exposure); growth mass-conserving + ($\Delta M = 0$), log-depth tower; shield partial (`ValidStack660` kills $C([],R)$). probviously + non-halting. Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). +* `1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RA---_1RB1LF` + ([bbchallenge](https://bbchallenge.org/1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RA---_1RB1LF)) (ours): Problem + S4; Halving Tower (2-Adic Stack). Trigger POW; growth mass-conserving sandpile; shield partial. + probviously non-halting. Status: `is_stack_cryptid`; open (on the 2026-10-24 holdout list). +* `1RB1RC_1LC0LE_1RD1RC_1LB0RA_---0LF_1RD1LF` + ([bbchallenge](https://bbchallenge.org/1RB1RC_1LC0LE_1RD1RC_1LB0RA_---0LF_1RD1LF)) (ours): Problem + S4; Halving Tower (2-Adic Stack). Trigger POW; growth mass-conserving sandpile; shield partial. + probviously non-halting. Status: `is_stack_cryptid`; open (on the 2026-10-24 holdout list). +* `1RB1RA_1RC1LB_1LD0RA_---0LE_1LC0LF_1RE0LB` + ([#680](./Accelerations/M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.lean)) (ours): Problem S4; + Halving Tower (2-Adic Stack). Trigger POW; growth mass-conserving sandpile; shield partial + (`ValidStack680` kills $C([],R)$; strict digit positivity at `mode_C`). probviously non-halting. + Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). +* `1RB0LC_1LC0RE_1LD1LC_1LA1RD_---0RF_0LB0RD` + ([bbchallenge](https://bbchallenge.org/1RB0LC_1LC0RE_1LD1LC_1LA1RD_---0RF_0LB0RD)) (ours): S4 + sibling; Halving Tower (2-Adic Stack). Trigger POW; growth mass-conserving sandpile; shield + partial (strict digit positivity blocks the sole $d=0$ halt). probviously non-halting. Status: + `is_stack_cryptid`; open (on the 2026-10-24 holdout list). +* `1RB1LA_1RC0RF_1RD---_0LE1RB_---0LA_1LD1RF` + ([#549](./Accelerations/M_1RB1LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean)) (wiki): Problem S5; + Halving Tower (2-Adic Stack). Trigger POW (Mersenne bottom rung $2^k-1$); growth —; shield partial + (`ValidStack549` kills the empty-stack halt). probviously non-halting, slowly critical. Status: + `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). +* `1RB---_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA` + ([#80](./Accelerations/M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.lean)) (ours): S5 sibling; + Halving Tower (2-Adic Stack). Trigger POW; growth —; shield partial. probviously non-halting. + Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). + +### Wiki stack families + +* `1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_---0LB` + ([#33](./Accelerations/M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean)) (wiki): Wiki stack; + 2nd-Order Stride-k Digit-Stack. Trigger era-recursive (3-case bottom-extension recurrence); growth + doubly-exponential era lengths ($T_0..T_3 = 1, 2, 8, 256$); shield none closed (all-even $R$ + + $L.\mathrm{last}=0$ refuted across eras). probviously non-halting (wiki cryptid). Status: + `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). +* `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` + ([#85](./Accelerations/M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean)) (wiki): Wiki stack; + Unary-Binary Bounded Stack Counter. Trigger —; growth —; shield —. wiki cryptid family (E1 group + #85/#285/#490/#500). Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout + list). +* `1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---` + ([bbchallenge](https://bbchallenge.org/1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---)) (wiki): Wiki + stack; Unary-Binary Bounded Stack Counter. Trigger —; growth —; shield —. E1 sibling of #85. + Status: `is_stack_cryptid`; open (on the 2026-10-24 holdout list). +* `1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LE---` + ([bbchallenge](https://bbchallenge.org/1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LE---)) (wiki): Wiki + stack; Unary-Binary Bounded Stack Counter. Trigger —; growth —; shield —. E1 sibling of #85. + Status: `is_stack_cryptid`; open (on the 2026-10-24 holdout list). +* `1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---` + ([bbchallenge](https://bbchallenge.org/1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---)) (wiki): Wiki + stack; Unary-Binary Bounded Stack Counter. Trigger —; growth —; shield —. E1 sibling of #85. + Status: `is_stack_cryptid`; open (on the 2026-10-24 holdout list). + +### Resolved by the community + +* `1RB1LA_0RC1RD_1LC0LA_1LE1RE_0RB0LF_---0LD` + ([bbchallenge](https://bbchallenge.org/1RB1LA_0RC1RD_1LC0LA_1LE1RE_0RB0LF_---0LD)) (ours): Problem + S1 (resolved: halts); Unary-Binary Bounded Stack Counter. Trigger POW (Mersenne-minus-2 funnel + $c+2=2^r$ at $L=[]$); growth power-law ($\propto t^{1/2}$); shield partial (`inv_126_R_shape`). + **HALTS** — busycoq `CubicMachines.v` (TM49), certified accelerated simulation; our dossier said + "critical, $0.4$–$0.9$ expected halts per decade". Status: `is_stack_cryptid`; decided HALTING + (busycoq). + +## 3. Per-machine hazard statements + +### `1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LF---_0RA1LA` (#330, Problem 1) + +* **Hazard:** from $S_6(N_7)$: $P(\mathrm{HALT}) = 6.80\%$ vs. + $P(\text{translated cycler } R_1(n)\mapsto R_1(n+5)) = 93.20\%$, decided at step $\sim 10^{771}$ +* **Simulated horizon:** exact trajectory to $N_7$; the deciding residue is a digit of a + $10^{771}$-digit number +* **Why it is hard / what a proof needs:** base-$31/10$ Erdős–Graham floor recurrence inside a + tetration tower; not computable, not provable with current tools + +### `1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_---0RE` (#183, Problem 2) + +* **Hazard:** $P(\text{halt}) \approx 6\times10^{-5}$, hazard $\propto 1/T$ squared by the shield to + $\sum t^{-2} < \infty$ +* **Simulated horizon:** $7\times10^{16}$ TM steps (exact accelerated rules) +* **Why it is hard / what a proof needs:** intermittent piecewise-Möbius ratio map + $\rho\mapsto(\rho-1)/2$ or $2\rho/(1-\rho)$; coincidence $c_0-2k_0=6$ only in the rare even-source + regime + +### `1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_---0RE` (#352, Problem 2) + +* **Hazard:** $P(\text{halt}) \approx 1.2\times10^{-4}$ ($\propto 1/T$) +* **Simulated horizon:** $10^{16}$ TM steps +* **Why it is hard / what a proof needs:** structural sibling of #183 on `D1(a, b, w)`; boundary + coincidence $w_{\text{rem}} = 2a+7$ in the even-source branch + +### `1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_---0RE` (#530, Problem 2) + +* **Hazard:** $P(\text{halt}) \approx 1.2\times10^{-4}$ ($\propto 1/T$) +* **Simulated horizon:** $10^{16}$ TM steps +* **Why it is hard / what a proof needs:** third sibling of #183/#352 with reset offset $+2$ + +### `1RB0LF_1RC1RA_0RD0RB_1LE---_0LA1LE_1RD1LA` (#429, Problem 3) + +* **Hazard:** per-turnaround hazard $q\approx 2.5\times10^{-7}$, $\sum_t 0.00885/t = \infty$ + (divergent Borel–Cantelli boundary); $\approx 2\%$ per decade +* **Simulated horizon:** $2.16\times10^{17}$ TM steps, no halt +* **Why it is hard / what a proof needs:** 1-D harmonic-series shrinking target; halting iff + $w_t = 2v_t + 8$ at a turnaround + +### `1RB1LF_0RC1RD_1LA1LD_1LE0RA_---1LC_0LA1LA` (#184, Problem 4) + +* **Hazard:** $P(\text{halt}) \approx 1.6\times10^{-31}$ after 200 eras, geometric tail +* **Simulated horizon:** 200 eras (exact) +* **Why it is hard / what a proof needs:** base-3 `exp3_step_C_odd/even` cascade coupled to the + Euclidean-like reflection $(a,b)\mapsto(b-a,3a)$; sits between Baker–Wüstholz and + $\times2,\times3$ rigidity + +### `1RB1RB_1LC0RE_---1LD_0RA1LB_1RA1LF_0LE1LE` (#724, Problem 4) + +* **Hazard:** $P(\text{halt}) \approx 8.6\times10^{-34}$ after 200 eras +* **Simulated horizon:** 200 eras (exact) +* **Why it is hard / what a proof needs:** the 669-pattern CTL proof collapses to the 4-rule + 2-counter hub `D(a, c)`: structural twin of #184 (different orbit) + +### `1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_---1RA` (#73, Problem 5) + +* **Hazard:** $P(\text{halt}) \approx 10^{-380.6}$ +* **Simulated horizon:** $> 3.22\times10^{762}$ TM steps +* **Why it is hard / what a proof needs:** odd-$c$ Antihydra rounds $k\mapsto\tfrac32 k+2$ + ((3/2)^{\nu_2(k+4)} 2-adic bursts, the expanding dual of Tao's Syracuse step) alternating with + even-$c$ subtraction drains; halts iff $c_j - 2k_j \in \lbrace -4,+2 \rbrace$ + +### `1RB0LF_1LC0LD_1RD1LB_---1RE_0RA1RE_1LA0LE` (#79, Cascade) + +* **Hazard:** $P(\text{halt}) \ll 10^{-600}$ +* **Simulated horizon:** $> 3.46\times10^{1204}$ TM steps in 12 cascades +* **Why it is hard / what a proof needs:** coupled outer `D1` and inner `Modd` $2^n$ cascades; halts + iff $D_1(2,u,0)$ + +### `1RB1LF_1RC1RF_0LD1RE_---1LC_0RB1RE_1LA0LE` (#116, Cascade) + +* **Hazard:** not re-measured in our dossiers +* **Simulated horizon:** — +* **Why it is hard / what a proof needs:** 1st-order collapse of a false stack (`Valid3Counter116`) +* **Wiki:** + +### `1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_---1RD` (#153, Cascade) + +* **Hazard:** $P(\text{halt}) \approx 4.4\times10^{-207}$ +* **Simulated horizon:** $1.51\times10^{415}$ TM steps +* **Why it is hard / what a proof needs:** halts iff $d_j = b_j + 2$ at $A(0,b_j,0,d_j)$ + +### `1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_---0RD` (#464, Cascade) + +* **Hazard:** $P(\text{halt}) \lesssim 10^{-5}$ per era +* **Simulated horizon:** exact rule simulation (see dossier) +* **Why it is hard / what a proof needs:** remaining halts `rule_4/12_halt` need $c_{\text{rem}}=1$: + a $(4/3)^k$ Mahler-type residue problem + +### `1RB0RE_1LC0RA_1RF0RD_---1LE_0LB1LE_1LE1RC` (#590, Cascade) + +* **Hazard:** $P(\text{halt}) \ll 10^{-600}$ +* **Simulated horizon:** $> 3.46\times10^{1204}$ TM steps in 12 cascades +* **Why it is hard / what a proof needs:** E1 sibling of #79 with identical rules from $D_1(1,0,0)$ + (candidate exact equivalence) + +### `1RB1RF_1LC---_1LE1RD_1RA0RC_0LF0LA_0LD0RB` (#614, Cascade) + +* **Hazard:** $P(\text{halt}) \approx 1.7\times10^{-3422}$ after 23,083 cascades +* **Simulated horizon:** 23,083 cascades (exact) +* **Why it is hard / what a proof needs:** `rule_8_halt` requires $P_2(a,0,2)$ at a cascade + turnaround + +### `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---0LA` (#623, Cascade) + +* **Hazard:** $P(\text{halt}) < 10^{-73}$; $756/756$ entries into $H_{\text{mid}}$ have odd $a_H$ +* **Simulated horizon:** $1.5\times10^{72}$ raw $D$-visits (exact) +* **Why it is hard / what a proof needs:** shares the exact orbit of #568 from $D(11,0,1,0)$; + busycoq `Eqv_RegularPairs.v` proves #568 ≡ #623 + +### `1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_---0RE` (#644, Cascade) + +* **Hazard:** $P(\text{halt}) \lesssim 10^{-6}$ (convergent $\sum m^{-2}$ tail) +* **Simulated horizon:** exact rule simulation (see dossier) +* **Why it is hard / what a proof needs:** halting requires both $c = 2b-4$ and + $c_{\text{odd}} = 2^{k+3}-2k-5$ + +### `1RB1RF_1LC1LF_0RE1LD_0LB1LD_---1RC_1RA0RD` (#688, Cascade) + +* **Hazard:** not re-measured in our dossiers +* **Simulated horizon:** — +* **Why it is hard / what a proof needs:** E1 pair of #116 +* **Wiki:** + +### `1RB1RC_1LC1LC_1RE0LD_1LB1RF_---1RA_0RD1RD` (#693, Cascade) + +* **Hazard:** $P(\text{halt}) < 10^{-600}$ (2,001 bits in 6,444 steps) +* **Simulated horizon:** 6,444 macro-steps (exact) +* **Why it is hard / what a proof needs:** alternating parity hubs with diagonal drain + $\min(v_1,v_2)$; halts iff $|v_1-v_2|\in\lbrace 0,1 \rbrace$ with $v_1\ge v_2$ + +### `1RB0LF_1LC1RA_0RE0RD_---1LE_1LF1RC_1LC1LA` (#746, Cascade) + +* **Hazard:** $P(\text{halt}) \approx 10^{-294}$ after 1,253 cascades +* **Simulated horizon:** 1,253 cascades (exact) +* **Why it is hard / what a proof needs:** halting iff the $(3/2)^m$ underflow map lands in the + target set $\lbrace 4\cdot2^n - n - 6 \rbrace$ + +### `1RB1LA_1LA0RC_1RD1RC_1LE0RC_---0LF_1LE0LA` (#391, Problem S2) + +* **Hazard:** 318 bottom reaches in $10^7$ steps ($29\to73\to204$ per decade), $x$ spread over + $10^3$–$10^4$; residual hazard $\approx0.2$; near-misses $251, 513, 514, 61, 132$ +* **Simulated horizon:** $10^7$ macro-steps (exact); pumping test: 72 perturbed configurations, 0 + halts in $10^5$ steps +* **Why it is hard / what a proof needs:** rung-by-rung halving with carry on + $\mathrm{List}(\mathbb N)$ + +### `1RB0RB_1RC0LE_1LD1LA_---0LC_1RF1LE_1RA0RA` (#129, Problem S3) + +* **Hazard:** 232 depth-two visits in $10^7$ steps, $a\in\lbrace 3,4,7,9,11,15 \rbrace$ on 8 of them + ($a=1$ halts); $\approx2$ expected halts, 0 observed +* **Simulated horizon:** $10^7$ macro-steps (exact) +* **Why it is hard / what a proof needs:** two-mode halving sweeper; halts iff $L$ drains to $[1,0]$ + in $\mathrm{CR}$ + +### `1RB0LD_1LC1RD_0LE1LA_0RB1RD_---0LF_1RA1LF` (#660, Problem S4) + +* **Hazard:** 21 exposures in $3\times10^6$ steps ($1292\to646\to323$, $94000\to\dots\to5875$), odd + parts $\ge323$; negligible residual hazard, no invariant known +* **Simulated horizon:** $3\times10^6$ macro-steps (exact); pumping test: 13 perturbed + configurations, 0 halts +* **Why it is hard / what a proof needs:** Single-Pass Drainage Law $b_{i+1} = a_{i+1}+q_i+1$, + $q_{k-1} = 2^m-1$, $u = 2^m$ + +### `1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RA---_1RB1LF` (#659, Problem S4) + +* **Hazard:** as #660 (same sandpile law); E3 macro twin of #209; busycoq `Eqv_*` merges #96 into + this class +* **Simulated horizon:** family-level +* **Why it is hard / what a proof needs:** see #660 + +### `1RB1RC_1LC0LE_1RD1RC_1LB0RA_---0LF_1RD1LF` (#209, Problem S4) + +* **Hazard:** as #660; E3 macro twin of #659 +* **Simulated horizon:** family-level +* **Why it is hard / what a proof needs:** see #660 + +### `1RB1RA_1RC1LB_1LD0RA_---0LE_1LC0LF_1RE0LB` (#680, Problem S4) + +* **Hazard:** as #660 +* **Simulated horizon:** family-level +* **Why it is hard / what a proof needs:** E1 pair of #480 + +### `1RB0LC_1LC0RE_1LD1LC_1LA1RD_---0RF_0LB0RD` (#480, S4 sibling) + +* **Hazard:** as #660/#680 +* **Simulated horizon:** family-level +* **Why it is hard / what a proof needs:** E1 pair of #680 (different seed) + +### `1RB1LA_1RC0RF_1RD---_0LE1RB_---0LA_1LD1RF` (#549, Problem S5) + +* **Hazard:** 846 exposures in $10^7$ steps ($14\to35\to90\to275$ fresh starts per decade), + $\approx0.05$ expected halts per decade; near-misses $4,13,61,65,252,513,1020,1027$ +* **Simulated horizon:** $10^7$ macro-steps (exact) +* **Why it is hard / what a proof needs:** the community's *Sweeper* re-measured; two-mode halving + sweeper +* **Wiki:** + +### `1RB---_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA` (#80, S5 sibling) + +* **Hazard:** E1 Group 39 with #549 (same table, different seed); not separately measured +* **Simulated horizon:** family-level +* **Why it is hard / what a proof needs:** see #549 + +### `1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_---0LB` (#33, Wiki stack) + +* **Hazard:** not quantified; perturbed all-even seeds halt in Era 2/3 (`rec_59_bottom_extension`) +* **Simulated horizon:** pumping test: 46 perturbed configurations, 0 halts in $10^5$ steps +* **Why it is hard / what a proof needs:** exact 3-case composition theorem verified on all 1,024 + stacks of weight $\le10$ +* **Wiki:** + +### `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` (#85, Wiki stack) + +* **Hazard:** not re-measured +* **Simulated horizon:** — +* **Why it is hard / what a proof needs:** `IsStackCryptid` closure proved +* **Wiki:** + +### `1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---` (#285, Wiki stack) + +* **Hazard:** not re-measured +* **Simulated horizon:** — +* **Why it is hard / what a proof needs:** `IsStackCryptid` closure proved +* **Wiki:** + +### `1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LE---` (#490, Wiki stack) + +* **Hazard:** not re-measured +* **Simulated horizon:** — +* **Why it is hard / what a proof needs:** `IsStackCryptid` closure proved +* **Wiki:** + +### `1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---` (#500, Wiki stack) + +* **Hazard:** not re-measured +* **Simulated horizon:** — +* **Why it is hard / what a proof needs:** `IsStackCryptid` closure proved +* **Wiki:** + +### `1RB1LA_0RC1RD_1LC0LA_1LE1RE_0RB0LF_---0LD` (#72, Problem S1 (resolved: halts)) + +* **Hazard:** $3.3\times10^7$ gate visits in $8.4\times10^{14}$ hub steps, 0 hits vs. $\approx6$ + expected; the halt occurs after $5.59\times10^8$ accelerated steps and $2.19\times10^8$ + empty-stack returns ($\approx0.8$ decades beyond the dossier) +* **Simulated horizon:** halt found (see busycoq) +* **Why it is hard / what a proof needs:** calibration case for the hazard model: the only S-problem + with a divergent hazard is the one that halted +* **busycoq:** CubicMachines.v + +## 4. Calibration: the one that halted + +`1RB1LA_0RC1RD_1LC0LA_1LE1RE_0RB0LF_---0LD` (#72, Problem S1) was the only stacked problem with a +*critical*, log-divergent hazard ($\approx 0.4$–$0.9$ expected halts per decade of empty-stack +returns after $3.3\times10^7$ returns). The `bbchallenge` community then proved that it halts +(busycoq [`CubicMachines.v`](https://github.com/ccz181078/busycoq/blob/BB6/verify/CubicMachines.v), +module `TM49`, a certified accelerated simulation); re-running their abstract step function, the +halt occurs after $5.59\times10^8$ accelerated steps and $2.19\times10^8$ empty-stack returns, about +$0.8$ decades beyond the dossier's horizon. The taxonomy singled out the right machine; the +procedural lesson is that a machine with an $O(1)$ per-decade hazard must be simulated at least an +order of magnitude further before it is called an open problem. + +## 5. What is *not* evidence of hardness + +A shield that holds along the simulated trajectory is not a shield. Among machines once described as +"shielded" in our census, `#787`, `#495`, `#767`, `#151`, `#269` and `#334` were later proved +**halting** by the community (busycoq `CubicMachines.v`, `PR_SOMDC23Halt.v`, `SOMDCv10.v`). Only +inductive invariants, closed on all abstract states, count; the pumping test (extend a run of +identical digits, or shift a large digit by the modulus, and see whether the machine halts) is the +cheap way to tell a shape-based shield from a value-dependent survival, and it correctly flags the +exponential stack ladders and halving towers as value-dependent. + +-/ diff --git a/BusyBeaver/BB6/M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.lean b/BusyBeaver/BB6/M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.lean index 33e7767f..37da6a41 100644 --- a/BusyBeaver/BB6/M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.lean +++ b/BusyBeaver/BB6/M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.lean @@ -43,6 +43,26 @@ T(E(p, k, c)) = \begin{cases} & \text{if } c \equiv 0 \pmod 2,\ c \ge 2k + 2,\ k \ge 1. \end{cases} $$ + + +## Hardness + +*Hardness class:* Problem 5 — trigger **EQ (rebound trap)**, growth exponential +($\gamma\approx1.9538$ per era), shield none. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* $P(\text{halt}) \approx 10^{-380.6}$ + +*Simulated horizon:* $> 3.22\times10^{762}$ TM steps + +*Why it is hard:* odd-$c$ Antihydra rounds $k\mapsto\tfrac32 k+2$ ((3/2)^{\nu_2(k+4)} 2-adic bursts, +the expanding dual of Tao's Syracuse step) alternating with even-$c$ subtraction drains; halts iff +$c_j - 2k_j \in \lbrace -4,+2 \rbrace$ + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean b/BusyBeaver/BB6/M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean index 70510e8d..92350d5a 100644 --- a/BusyBeaver/BB6/M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean +++ b/BusyBeaver/BB6/M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean @@ -63,6 +63,25 @@ T_{\mathrm{HL}}(D(a, d)) = \begin{cases} \text{Halt} & \text{otherwise } (A(d+1-a, a, 2a+5) = \text{Halt}). \end{cases} $$ + + +## Hardness + +*Hardness class:* Cascade — trigger **EQ**, growth exponential (4-counter $3^n$ cascade), shield +full (odd-$a_H$ parity shield blocks every `closes_H_mid` halt). + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting; strong `IsDoesNotHalt` candidate. + +*Hazard:* $P(\text{halt}) < 10^{-73}$; $756/756$ entries into $H_{\text{mid}}$ have odd $a_H$ + +*Simulated horizon:* $1.5\times10^{72}$ raw $D$-visits (exact) + +*Why it is hard:* shares the exact orbit of #568 from $D(11,0,1,0)$; busycoq `Eqv_RegularPairs.v` +proves #568 ≡ #623 + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean b/BusyBeaver/BB6/M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean index e7161e1f..03274386 100644 --- a/BusyBeaver/BB6/M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean +++ b/BusyBeaver/BB6/M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean @@ -44,6 +44,24 @@ F(m, p, n, c) = \begin{cases} F(m-1, p-n-2, 2n+3, c) & \text{if } m \ge 2 \text{ and } p \ge n+2. \end{cases} $$ + + +## Hardness + +*Hardness class:* Cascade — trigger **EQ**, growth super-exponential (two-stage $2^n$ doubling +tower), shield none. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* $P(\text{halt}) \ll 10^{-600}$ + +*Simulated horizon:* $> 3.46\times10^{1204}$ TM steps in 12 cascades + +*Why it is hard:* coupled outer `D1` and inner `Modd` $2^n$ cascades; halts iff $D_1(2,u,0)$ + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean b/BusyBeaver/BB6/M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean index b69a90f7..3615b773 100644 --- a/BusyBeaver/BB6/M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean +++ b/BusyBeaver/BB6/M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean @@ -30,6 +30,25 @@ T(C(a, b)) = \begin{cases} & \text{if } a \ge 1,\ b = 2k+1,\ 1 \le k \le a. \end{cases} $$ + + +## Hardness + +*Hardness class:* Cascade — trigger **EQ**, growth exponential ($2^n$ cascade + base-$3/2$ underflow +drain), shield partial (exact even-$c$ invariant). + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* $P(\text{halt}) \approx 10^{-294}$ after 1,253 cascades + +*Simulated horizon:* 1,253 cascades (exact) + +*Why it is hard:* halting iff the $(3/2)^m$ underflow map lands in the target set +$\lbrace 4\cdot2^n - n - 6 \rbrace$ + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.lean b/BusyBeaver/BB6/M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.lean index c813facb..6b8d67d3 100644 --- a/BusyBeaver/BB6/M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.lean +++ b/BusyBeaver/BB6/M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.lean @@ -35,6 +35,25 @@ T(J(u, w)) = \begin{cases} J(d+3, 2w) & \text{if } w = 2m+1 < 2u \text{ and } d \ge 3 \text{ is odd}. \end{cases} $$ + + +## Hardness + +*Hardness class:* Problem 3 — trigger **EQ, critical**, growth linear ($2v+w \approx 43.66\,T$), +shield none (parity flips every step). + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +halting, but only at $\sim 10^{110}$ steps. + +*Hazard:* per-turnaround hazard $q\approx 2.5\times10^{-7}$, $\sum_t 0.00885/t = \infty$ (divergent +Borel–Cantelli boundary); $\approx 2\%$ per decade + +*Simulated horizon:* $2.16\times10^{17}$ TM steps, no halt + +*Why it is hard:* 1-D harmonic-series shrinking target; halting iff $w_t = 2v_t + 8$ at a turnaround + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.lean b/BusyBeaver/BB6/M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.lean index fadb3aa6..7215b08e 100644 --- a/BusyBeaver/BB6/M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.lean +++ b/BusyBeaver/BB6/M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.lean @@ -54,6 +54,25 @@ map $T$, writing $k = 3q + r$ with $r \in \lbrace 0, 1, 2 \rbrace$ and $d = c - S(0, 4q + 4p + 8, d - p - 4) & \text{if } d \ge p + 4. \end{cases} $$ + + +## Hardness + +*Hardness class:* Cascade — trigger **EQ**, growth exponential ($4^n$ inner cascades, $(4/3)^k$ +sweeps), shield partial (odd-$a$ invariant kills 2 of 4 halting rules and 12 of 34 rules). + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* $P(\text{halt}) \lesssim 10^{-5}$ per era + +*Simulated horizon:* exact rule simulation (see dossier) + +*Why it is hard:* remaining halts `rule_4/12_halt` need $c_{\text{rem}}=1$: a $(4/3)^k$ Mahler-type +residue problem + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.lean b/BusyBeaver/BB6/M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.lean index c4258801..95b6acb1 100644 --- a/BusyBeaver/BB6/M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.lean +++ b/BusyBeaver/BB6/M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.lean @@ -44,6 +44,24 @@ F(m, p, n, c) = \begin{cases} F(m-1, p-n-2, 2n+3, c) & \text{if } m \ge 2 \text{ and } p \ge n+2. \end{cases} $$ + + +## Hardness + +*Hardness class:* Cascade — trigger **EQ**, growth super-exponential, shield none. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* $P(\text{halt}) \ll 10^{-600}$ + +*Simulated horizon:* $> 3.46\times10^{1204}$ TM steps in 12 cascades + +*Why it is hard:* E1 sibling of #79 with identical rules from $D_1(1,0,0)$ (candidate exact +equivalence) + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.lean b/BusyBeaver/BB6/M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.lean index bdfb0a8c..5863a198 100644 --- a/BusyBeaver/BB6/M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.lean +++ b/BusyBeaver/BB6/M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.lean @@ -95,6 +95,27 @@ $$ R_1(31q+45)\bigr)_r. \end{aligned} $$ + + +## Hardness + +*Hardness class:* Problem 1 — trigger **RES + competing sinks**, growth tetrational +($10 \uparrow\uparrow k$, $N_7 \approx 2.86\times10^{771}$), shield none. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* undecided type +(second known after Racheline's #424). + +*Hazard:* from $S_6(N_7)$: $P(\mathrm{HALT}) = 6.80\%$ vs. +$P(\text{translated cycler } R_1(n)\mapsto R_1(n+5)) = 93.20\%$, decided at step $\sim 10^{771}$ + +*Simulated horizon:* exact trajectory to $N_7$; the deciding residue is a digit of a +$10^{771}$-digit number + +*Why it is hard:* base-$31/10$ Erdős–Graham floor recurrence inside a tetration tower; not +computable, not provable with current tools + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.lean b/BusyBeaver/BB6/M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.lean index 5cc93239..1dbf3388 100644 --- a/BusyBeaver/BB6/M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.lean +++ b/BusyBeaver/BB6/M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.lean @@ -56,6 +56,24 @@ T_{\mathrm{HL}}(C(b, d + 2)) &= \begin{cases} \end{cases} \end{aligned} $$ + + +## Hardness + +*Hardness class:* Cascade — trigger **EQ**, growth exponential (two-base: $2^n$ doubling then $4^n$ +quadrupling, $\times2.3917$ per launch), shield none. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* $P(\text{halt}) \approx 4.4\times10^{-207}$ + +*Simulated horizon:* $1.51\times10^{415}$ TM steps + +*Why it is hard:* halts iff $d_j = b_j + 2$ at $A(0,b_j,0,d_j)$ + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.lean b/BusyBeaver/BB6/M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.lean index 3e9196b7..b7fbb0f6 100644 --- a/BusyBeaver/BB6/M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.lean +++ b/BusyBeaver/BB6/M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.lean @@ -30,6 +30,24 @@ T(E(b, d)) = \begin{cases} E(2b+4, c-2b-7) & \text{if } b \le m \text{ and } c - 2b \ge 7. \end{cases} $$ + + +## Hardness + +*Hardness class:* Cascade — trigger **EQ (second-order coincidence)**, growth exponential ($2^n$ +cascade), shield partial (even-$c$ parity shield blocks 99.8% of visits). + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* $P(\text{halt}) \lesssim 10^{-6}$ (convergent $\sum m^{-2}$ tail) + +*Simulated horizon:* exact rule simulation (see dossier) + +*Why it is hard:* halting requires both $c = 2b-4$ and $c_{\text{odd}} = 2^{k+3}-2k-5$ + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.lean b/BusyBeaver/BB6/M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.lean index 63a88f46..1177e677 100644 --- a/BusyBeaver/BB6/M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.lean +++ b/BusyBeaver/BB6/M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.lean @@ -30,6 +30,25 @@ T(C(a, b)) = \begin{cases} C(a-k-1, 6k+9) & \text{if } b = 2k+1,\ a \ge k+2. \end{cases} $$ + + +## Hardness + +*Hardness class:* Problem 4 — trigger **EQ (2-wide window at turnaround)**, growth exponential +($\gamma\approx1.4246$ per era, base 3), shield none. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* $P(\text{halt}) \approx 1.6\times10^{-31}$ after 200 eras, geometric tail + +*Simulated horizon:* 200 eras (exact) + +*Why it is hard:* base-3 `exp3_step_C_odd/even` cascade coupled to the Euclidean-like reflection +$(a,b)\mapsto(b-a,3a)$; sits between Baker–Wüstholz and $\times2,\times3$ rigidity + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean b/BusyBeaver/BB6/M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean index 22009af2..eb2af095 100644 --- a/BusyBeaver/BB6/M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean +++ b/BusyBeaver/BB6/M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean @@ -159,6 +159,23 @@ $$ \end{cases} \end{aligned} $$ + + +## Hardness + +*Hardness class:* Cascade — trigger **EQ**, growth exponential, shield see family. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* wiki rediscovery +(RobinCodes *Next Steps* list). + +*Hazard:* not re-measured in our dossiers + +*Simulated horizon:* — + +*Why it is hard:* 1st-order collapse of a false stack (`Valid3Counter116`) + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.lean b/BusyBeaver/BB6/M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.lean index ccb62e15..34d4fa48 100644 --- a/BusyBeaver/BB6/M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.lean +++ b/BusyBeaver/BB6/M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.lean @@ -37,6 +37,25 @@ T(D_p(a, b)) = \begin{cases} D_{1-p}(b-a-3, 3a+2p+5) & \text{if } b \ge a+3. \end{cases} $$ + + +## Hardness + +*Hardness class:* Problem 4 — trigger **EQ (2-wide window)**, growth exponential +($\gamma\approx1.4589$ per era), shield none. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* $P(\text{halt}) \approx 8.6\times10^{-34}$ after 200 eras + +*Simulated horizon:* 200 eras (exact) + +*Why it is hard:* the 669-pattern CTL proof collapses to the 4-rule 2-counter hub `D(a, c)`: +structural twin of #184 (different orbit) + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.lean b/BusyBeaver/BB6/M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.lean index 223fb3e4..afd2459a 100644 --- a/BusyBeaver/BB6/M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.lean +++ b/BusyBeaver/BB6/M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.lean @@ -30,6 +30,25 @@ T(C(a, c)) = \begin{cases} C(6d + 3(a \bmod 2) + 5, k + 2 - d) & \text{if } c = d + 2 \text{ and } d \le k + 2. \end{cases} $$ + + +## Hardness + +*Hardness class:* Cascade — trigger **EQ**, growth exponential ($\times1.2402$ per step), shield +none. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* $P(\text{halt}) < 10^{-600}$ (2,001 bits in 6,444 steps) + +*Simulated horizon:* 6,444 macro-steps (exact) + +*Why it is hard:* alternating parity hubs with diagonal drain $\min(v_1,v_2)$; halts iff +$|v_1-v_2|\in\lbrace 0,1 \rbrace$ with $v_1\ge v_2$ + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.lean b/BusyBeaver/BB6/M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.lean index 6deeb60e..bb4babf4 100644 --- a/BusyBeaver/BB6/M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.lean +++ b/BusyBeaver/BB6/M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.lean @@ -44,6 +44,23 @@ E(a, w) = \begin{cases} E(2a + 4, w - 2a - 6) & \text{if } w \ge 2a + 6. \end{cases} $$ + + +## Hardness + +*Hardness class:* Problem 2 — trigger **EQ with leaky parity shield**, growth linear, shield leaky. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* $P(\text{halt}) \approx 1.2\times10^{-4}$ ($\propto 1/T$) + +*Simulated horizon:* $10^{16}$ TM steps + +*Why it is hard:* third sibling of #183/#352 with reset offset $+2$ + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.lean b/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.lean index a6480bbe..81ebfe17 100644 --- a/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.lean +++ b/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.lean @@ -40,6 +40,26 @@ G(k, c) = \begin{cases} G(k - \lfloor c/2 \rfloor - 1, 2c+3) & \text{if } c < 2k. \end{cases} $$ + + +## Hardness + +*Hardness class:* Problem 2 — trigger **EQ (shrinking target) with leaky parity shield**, growth +linear (mass $2k+c$, drift $+2$/cycle), shield leaky (odd-$c$ regime blocks the coincidence). + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* $P(\text{halt}) \approx 6\times10^{-5}$, hazard $\propto 1/T$ squared by the shield to +$\sum t^{-2} < \infty$ + +*Simulated horizon:* $7\times10^{16}$ TM steps (exact accelerated rules) + +*Why it is hard:* intermittent piecewise-Möbius ratio map $\rho\mapsto(\rho-1)/2$ or +$2\rho/(1-\rho)$; coincidence $c_0-2k_0=6$ only in the rare even-source regime + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.lean b/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.lean index 511e78db..2af84c89 100644 --- a/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.lean +++ b/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.lean @@ -47,6 +47,25 @@ J_1(a, w) = \begin{cases} J_1(2a + 4, w - 2a - 6) & \text{if } w \ge 2a + 6. \end{cases} $$ + + +## Hardness + +*Hardness class:* Problem 2 — trigger **EQ with leaky parity shield**, growth linear ($2^n$ fuel +bursts, intermittent resets), shield leaky. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* $P(\text{halt}) \approx 1.2\times10^{-4}$ ($\propto 1/T$) + +*Simulated horizon:* $10^{16}$ TM steps + +*Why it is hard:* structural sibling of #183 on `D1(a, b, w)`; boundary coincidence +$w_{\text{rem}} = 2a+7$ in the even-source branch + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean b/BusyBeaver/BB6/M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean index f7d7c3d7..4e0ec9f3 100644 --- a/BusyBeaver/BB6/M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean +++ b/BusyBeaver/BB6/M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean @@ -43,6 +43,23 @@ E(a, b + 1, c + 2) --> E(a + 2, b, c) E(a, b + 2, 0) --> E(0, b, 2a + 7) E(a, b + 2, 1) --> E(0, b, 2a + 5) ``` + + +## Hardness + +*Hardness class:* Cascade — trigger **EQ**, growth exponential, shield see family. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* wiki rediscovery +(RobinCodes *Next Steps* list). + +*Hazard:* not re-measured in our dossiers + +*Simulated horizon:* — + +*Why it is hard:* E1 pair of #116 + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.lean b/BusyBeaver/BB6/M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.lean index 23eed44f..de3d83ed 100644 --- a/BusyBeaver/BB6/M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.lean +++ b/BusyBeaver/BB6/M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.lean @@ -30,6 +30,24 @@ T(P(b, c)) = \begin{cases} P(0, 4c+6) & \text{if } b < 3c+1 \le 3b+1 \text{ and } b - c \text{ is even}. \end{cases} $$ + + +## Hardness + +*Hardness class:* Cascade — trigger **EQ ($2^n$ remainder coincidence)**, growth exponential +($\times1.4069$ per cascade), shield partial ($a\ge1$ kills `rule_1_halt`). + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* $P(\text{halt}) \approx 1.7\times10^{-3422}$ after 23,083 cascades + +*Simulated horizon:* 23,083 cascades (exact) + +*Why it is hard:* `rule_8_halt` requires $P_2(a,0,2)$ at a cascade turnaround + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + -/ @[expose] public section diff --git a/BusyBeaver/BB6/README.md b/BusyBeaver/BB6/README.md index bab47002..e4192e96 100644 --- a/BusyBeaver/BB6/README.md +++ b/BusyBeaver/BB6/README.md @@ -6,6 +6,8 @@ The A6 module exports a closed blank-tape `IsNotHalt` proof using a checked entry certificate and a universal return family; it has a separate [proof guide](../../artifacts/a6/README.md). +> **Hardness.** Why the hardest of these holdouts are hard (halting trigger, growth regime, shields, heuristic hazards, and the calibration case `#72` that the community proved halting) is recorded in [`Hardness.lean`](./Hardness.lean) (rendered on the docs site as `BusyBeaver.BB6.Hardness`); each machine in that core also carries a `## Hardness` section in its module docstring. + ## Formalized `BB(6)` Machines | Machine (`bbchallenge` RLE) | States | Symbols | Proved Properties | Wiki / Notes | Lean 4 Proof | @@ -21,7 +23,7 @@ entry certificate and a universal return family; it has a separate | `1RB0LD_1RC1RA_1LD0RB_1LE1LA_1RF0RC_---1RE` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB0LD_1RC1RA_1LD0RB_1LE1LA_1RF0RC_---1RE) | [`M_1RB0LD_1RC1RA_1LD0RB_1LE1LA_1RF0RC_HHH1RE.lean`](./M_1RB0LD_1RC1RA_1LD0RB_1LE1LA_1RF0RC_HHH1RE.lean) | | `1RB0LD_1RC1RF_1LA0RA_0LA0LE_1LD1LA_0RB---` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB0LD_1RC1RF_1LA0RA_0LA0LE_1LD1LA_0RB---) | [`M_1RB0LD_1RC1RF_1LA0RA_0LA0LE_1LD1LA_0RBHHH.lean`](./M_1RB0LD_1RC1RF_1LA0RA_0LA0LE_1LD1LA_0RBHHH.lean) | | `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---0LA` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | — | [`M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean`](./M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean) | -| `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---1LC` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | — | [`M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.lean`](./M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.lean) | +| `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---1LC` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | equivalent to `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---0LA` (same orbit after two macro-steps; busycoq [`Eqv_RegularPairs.v`](https://github.com/ccz181078/busycoq/blob/BB6/verify/Eqv_RegularPairs.v)) | [`M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.lean`](./M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.lean) | | `1RB0LE_1LC1RA_1RA1LD_0LC0LA_0RE1RF_0RC---` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | [Wiki (`User:RobinCodes/Next_Steps`)](https://wiki.bbchallenge.org/wiki/User:RobinCodes/Next_Steps) | [`M_1RB0LE_1LC1RA_1RA1LD_0LC0LA_0RE1RF_0RCHHH.lean`](./M_1RB0LE_1LC1RA_1RA1LD_0LC0LA_0RE1RF_0RCHHH.lean) | | `1RB0LF_1LC0LD_1RD1LB_---1RE_0RA1RE_1LA0LE` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | — | [`M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean`](./M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean) | | `1RB0LF_1LC1RA_0RE0RD_---1LE_1LF1RC_1LC1LA` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | — | [`M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean`](./M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean) | From 645f48f6b26326ff0ecb706764feee545aaf8665 Mon Sep 17 00:00:00 2001 From: Tom Zahavy Date: Thu, 29 Oct 2026 09:16:57 +0000 Subject: [PATCH 2/6] Add HasStackReduction proofs for the three other start states of 1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA The wiki treats 1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA and its restarts from states C, D and E (1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---, 1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LE---, 1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---) as one probviously halting cryptid. The three new modules are the state relabelling (and, for the state-D restart, left/right mirror) of the existing proof, each with its own blank-tape entry lemma. Hardness.lean now records the community's hazard analysis for this family and points to the BMO Problem 11 odometer family counted as hard by the solvability census. --- BusyBeaver.lean | 3 + ...LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean | 1176 ++++++++++++++++ ...RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean | 1178 +++++++++++++++++ ...LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean | 4 +- ...RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean | 1177 ++++++++++++++++ ...HH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean | 31 +- BusyBeaver/BB6/Accelerations/README.md | 3 + BusyBeaver/BB6/Hardness.lean | 78 +- ...LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean | 4 +- ...RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean | 4 +- BusyBeaverChallenge.lean | 30 + comparator/busy_beaver.json | 5 +- 12 files changed, 3652 insertions(+), 41 deletions(-) create mode 100644 BusyBeaver/BB6/Accelerations/M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean create mode 100644 BusyBeaver/BB6/Accelerations/M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean create mode 100644 BusyBeaver/BB6/Accelerations/M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean diff --git a/BusyBeaver.lean b/BusyBeaver.lean index 83868929..3295a1ed 100644 --- a/BusyBeaver.lean +++ b/BusyBeaver.lean @@ -68,6 +68,7 @@ public import BusyBeaver.BB6.M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB public import BusyBeaver.BB6.M_1RBHHH_1RC1LE_0RD0RF_0RE0LA_1LF0LB_1LA1LD public import BusyBeaver.BB6.Accelerations.Stack public import BusyBeaver.BB6.Accelerations.M_1RB0LB_0RC0LD_1LD1RE_0LA0RF_0RD1RF_0RCHHH +public import BusyBeaver.BB6.Accelerations.M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH public import BusyBeaver.BB6.Accelerations.M_1RB0LD_0RCHHH_0LD0RF_1LE1LD_0LA0RD_0RB1RA public import BusyBeaver.BB6.Accelerations.M_1RB0LD_0RCHHH_1LD0RF_0LE0RA_0RA1LF_0LA1LB public import BusyBeaver.BB6.Accelerations.M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF @@ -76,6 +77,7 @@ public import BusyBeaver.BB6.Accelerations.M_1RB0LE_1LB1RC_0RF0RD_1RE0LA_1LA1RE_ public import BusyBeaver.BB6.Accelerations.M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA public import BusyBeaver.BB6.Accelerations.M_1RB0RE_0RC1RE_1RD1LE_0LEHHH_1RA1LF_1RF0LC public import BusyBeaver.BB6.Accelerations.M_1RB0RE_0RCHHH_1LD1LE_1LE1LD_1RF0LC_1RA1RF +public import BusyBeaver.BB6.Accelerations.M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH public import BusyBeaver.BB6.Accelerations.M_1RB0RE_1RC1RE_1LD1LC_0RB0LC_1RF0RB_HHH1RA public import BusyBeaver.BB6.Accelerations.M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA public import BusyBeaver.BB6.Accelerations.M_1RB1LA_1LC0RE_HHH0LD_1RE0LF_1RA1RE_1LA0LB @@ -87,6 +89,7 @@ public import BusyBeaver.BB6.Accelerations.M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_ public import BusyBeaver.BB6.Accelerations.M_1RB1LF_0RC0RB_0LD1RB_1LE0LB_0LA1LC_0LBHHH public import BusyBeaver.BB6.Accelerations.M_1RB1RA_1LC0RC_HHH0LD_0LE0RF_1RE0RA_0LF1LB public import BusyBeaver.BB6.Accelerations.M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB +public import BusyBeaver.BB6.Accelerations.M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH public import BusyBeaver.BB6.Accelerations.M_1RB1RE_1LC0RA_HHH1LD_1LA0LF_0LB0LC_1RB0LB public import BusyBeaver.BB6.Accelerations.M_1RB1RE_1LC0RC_1RA1LD_1RB0LA_0LC1RF_HHH1RD public import BusyBeaver.BB6.Accelerations.M_1RB1RE_1LC1LB_1LE0LD_1LE1LC_0RF1RA_HHH1RA diff --git a/BusyBeaver/BB6/Accelerations/M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean b/BusyBeaver/BB6/Accelerations/M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean new file mode 100644 index 00000000..a4497b2a --- /dev/null +++ b/BusyBeaver/BB6/Accelerations/M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean @@ -0,0 +1,1176 @@ +/- +Copyright (c) 2026 Google LLC. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +-/ +module + +public import BusyBeaver.Basic +public import BusyBeaver.BB6.Accelerations.Stack +public import BusyBeaver.Bridge + +/-! +# Busy Beaver Holdout `1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---` + +Formal `HasStackReduction` proof for the 6-state, 2-symbol Busy Beaver holdout +`1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---` +(https://wiki.bbchallenge.org/wiki/1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---, which redirects to the +wiki page of `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`). + +This machine is the transition table of `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` restarted from +its state `E` and brought to tree normal form: reading its states `A`, `B`, `C`, `D`, `E`, `F` as +the states `E`, `C`, `D`, `B`, `F`, `A` of that machine, the two transition tables coincide, so both +machines run the same closed pair-stack system. The proof below is the mechanical relabelling of the +proof in +[`1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`](./M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean); +only the blank-tape entry lemma `init_reaches_nontrivial` is specific to this start state. + + +## Hardness + +*Hardness class:* Wiki stack — trigger **as #85 (same table, started from its state `E`)**, growth +as #85, shield as #85. + +*Verdict (heuristic; community analysis, see the wiki page):* same dynamics as +`1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` (#85) (wiki: the start states `E` and `F` share one +trajectory). + +*Hazard:* as #85 (community estimate) + +*Simulated horizon:* as #85 + +*Why it is hard:* the proof is the state relabelling of the #85 proof with its own blank-tape entry +(11 raw steps) + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + +-/ + +@[expose] public section + +namespace BusyBeaver.M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH + +open SixState Turing Stack + +/-- The `(6, 2)` Turing machine in `ConjectureMachines.Machine` form. -/ +def machine : ConjectureMachines.Machine 6 2 := + load_rle_machine% "1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---" + +/-- The `(6, 2)` Turing machine in `BusyBeaver.Machine` form. -/ +abbrev target : Machine (Fin 2) (Fin 6) := + machine.toBB + +/-! ## Local Step Tactics and Pair-Stack Encodings -/ + +local macro "normalize" : tactic => `(tactic| ( + try simp only [ListBlank.append_cons, ListBlank.append_nil, + ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, + ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, + List.nil_append, List.cons_append, zeros_append_default, + Nat.mul_zero, Nat.mul_add, Nat.mul_one])) + +local macro "normalize_at" h:ident : tactic => `(tactic| ( + try simp only [ListBlank.append_cons, ListBlank.append_nil, + ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, + ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, + List.nil_append, List.cons_append, zeros_append_default, + Nat.mul_zero, Nat.mul_add, Nat.mul_one] at $h:ident)) + +local macro "step" : tactic => `(tactic| ( + try refine ReachesPlus.to_star ?_ + try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, + list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, + zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one] + refine ReachesPlus.head (by rfl) ?_ + simp only [Tape.move, Tape.write, + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, + list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, + zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one])) + +private def encRight : List (ℕ × ℕ) → ListBlank (Fin 2) + | [] => default + | (a, b) :: L => (encRight L <+ (([0] : List (Fin 2)) ^ (1 + b % 1))) <+ + (([1] : List (Fin 2)) ^ (1 * a + 1)) + +private def encLeft : List (ℕ × ℕ) → ListBlank (Fin 2) + | [] => default + | (d, b) :: R => (([1] : List (Fin 2)) ^ (1 * d + 1)) +> ((([0] : List (Fin 2)) ^ (1 + b % 1)) +> + encLeft R) + +@[simp] private theorem encRight_nil : encRight [] = default := rfl + +@[simp] private theorem encRight_cons (a b : ℕ) (L : List (ℕ × ℕ)) : + encRight ((a, b) :: L) = (encRight L <+ (([0] : List (Fin 2)) ^ (1 + b % 1))) <+ + (([1] : List (Fin 2)) ^ (1 * a + 1)) := rfl + +@[simp] private theorem encLeft_nil : encLeft [] = default := rfl + +@[simp] private theorem encLeft_cons (d b : ℕ) (R : List (ℕ × ℕ)) : + encLeft ((d, b) :: R) = (([1] : List (Fin 2)) ^ (1 * d + 1)) +> + ((([0] : List (Fin 2)) ^ (1 + b % 1)) +> encLeft R) := rfl + +private theorem encRight_mod1 (a b : ℕ) (L : List (ℕ × ℕ)) : + encRight ((a, b) :: L) = encRight ((a, b % 1) :: L) := by + simp only [encRight_cons, Nat.mod_mod] + +private theorem encRight_succ (a b : ℕ) (L : List (ℕ × ℕ)) : + encRight ((a + 1, b) :: L) = (1 : Fin 2) >> encRight ((a, b) :: L) := by + simp only [encRight_cons] + rw [show 1 * (a + 1) + 1 = 1 + (1 * a + 1) by omega, list_pow_add, ListBlank.append_assoc] + rfl + +private theorem encRight_d0_s0 (L : List (ℕ × ℕ)) : + encRight ((0, 0) :: L) = (1 : Fin 2) >> (0 : Fin 2) >> encRight L := rfl + +private theorem encRight_d1_s0 (L : List (ℕ × ℕ)) : + encRight ((1, 0) :: L) = (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> encRight L := rfl + +private theorem encRight_run_s0 (a : ℕ) (L : List (ℕ × ℕ)) : + encRight ((a, 0) :: L) = (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> + encRight L) := by + induction a with + | zero => rfl + | succ k ih => rw [encRight_succ, ih]; normalize + +private theorem encLeft_mod1 (a b : ℕ) (R : List (ℕ × ℕ)) : + encLeft ((a, b) :: R) = encLeft ((a, b % 1) :: R) := by + simp only [encLeft_cons, Nat.mod_mod] + +private theorem encLeft_succ (a b : ℕ) (R : List (ℕ × ℕ)) : + encLeft ((a + 1, b) :: R) = (1 : Fin 2) >> encLeft ((a, b) :: R) := by + simp only [encLeft_cons] + rw [show 1 * (a + 1) + 1 = 1 + (1 * a + 1) by omega, list_pow_add, ListBlank.append_assoc] + rfl + +private theorem encLeft_d0_s0 (R : List (ℕ × ℕ)) : + encLeft ((0, 0) :: R) = (1 : Fin 2) >> (0 : Fin 2) >> encLeft R := rfl + +private theorem encLeft_d1_s0 (R : List (ℕ × ℕ)) : + encLeft ((1, 0) :: R) = (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> encLeft R := rfl + +private theorem encLeft_run_s0 (a : ℕ) (R : List (ℕ × ℕ)) : + encLeft ((a, 0) :: R) = (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> + encLeft R) := by + induction a with + | zero => rfl + | succ k ih => rw [encLeft_succ, ih]; normalize + +@[simp] private theorem encRight_cons_one (L : List (ℕ × ℕ)) : + (1 : Fin 2) >> encRight L = encRight (bumpPairHead L) := by + rcases L with _ | ⟨⟨a, b⟩, L'⟩ + · simp [bumpPairHead, encRight] + · exact (encRight_succ a b L').symm + +@[simp] private theorem encLeft_cons_one (R : List (ℕ × ℕ)) : + (1 : Fin 2) >> encLeft R = encLeft (bumpPairHead R) := by + rcases R with _ | ⟨⟨a, b⟩, R'⟩ + · simp [bumpPairHead, encLeft] + · exact (encLeft_succ a b R').symm + +local macro "finish" : tactic => `(tactic| ( + refine ⟨0, ?_⟩ + try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', + encLeft_nil, encRight_nil, ListBlank.append_cons, ListBlank.append_nil, + ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, + ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, + List.nil_append, List.cons_append, zeros_append_default, + Nat.mul_zero, Nat.mul_add, Nat.mul_one] + simp only [encLeft_cons_one, encRight_cons_one, multiStep_zero] + try rfl)) + +local macro "execute" n:num : tactic => `(tactic| ( + iterate $n step + finish)) + +private def cfg_BR_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := + (encLeft R) {{B}}> (encRight L) + +private def cfg_AL_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := + (encLeft R) <{{A}} (encRight L) + +private def cfg_CL_0_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := + (encLeft R) <{{C}} ([0] +> encRight L) + +private def cfg_CR_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := + (encLeft R) {{C}}> (encRight L) + +private inductive StackMode + | BR_n_n + | AL_n_n + | CL_0_n + | CR_n_n + deriving DecidableEq + +private def evalStackCfg : StackMode → List (ℕ × ℕ) → List (ℕ × ℕ) → Cfg (Fin 2) (Fin 6) + | .BR_n_n, L, R => cfg_BR_n_n R L + | .AL_n_n, L, R => cfg_AL_n_n R L + | .CL_0_n, L, R => cfg_CL_0_n R L + | .CR_n_n, L, R => cfg_CR_n_n R L + +private def IsInStackSystem (cfg : Cfg (Fin 2) (Fin 6)) : Prop := + ∃ m L R, cfg = evalStackCfg m L R + +/-! ## Inner Token System -/ + +private def encTokens : List ℕ → List (ℕ × ℕ) → ListBlank (Fin 2) + | [], R3 => encLeft R3 + | k :: K, R3 => (([1] : List (Fin 2)) ^ k) +> ((0 : Fin 2) >> encTokens K R3) + +@[simp] private theorem encTokens_nil (R3 : List (ℕ × ℕ)) : encTokens [] R3 = encLeft R3 := rfl + +@[simp] private theorem encTokens_zero (K : List ℕ) (R3 : List (ℕ × ℕ)) : + encTokens (0 :: K) R3 = (0 : Fin 2) >> encTokens K R3 := rfl + +@[simp] private theorem encTokens_succ (k : ℕ) (K : List ℕ) (R3 : List (ℕ × ℕ)) : + encTokens ((k + 1) :: K) R3 = (1 : Fin 2) >> encTokens (k :: K) R3 := by + simp only [encTokens, list_pow_succ, List.cons_append, List.nil_append, ListBlank.append_cons] + +private def encRightNat : List ℕ → ListBlank (Fin 2) + | [] => default + | a :: L => (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> encRightNat L) + +@[simp] private theorem encRightNat_nil : encRightNat [] = default := rfl + +@[simp] private theorem encRightNat_zero (L : List ℕ) : + encRightNat (0 :: L) = (1 : Fin 2) >> (0 : Fin 2) >> encRightNat L := rfl + +@[simp] private theorem encRightNat_succ (a : ℕ) (L : List ℕ) : + encRightNat ((a + 1) :: L) = (1 : Fin 2) >> encRightNat (a :: L) := by + simp only [encRightNat, list_pow_succ, List.cons_append, List.nil_append, ListBlank.append_cons] + +private theorem encRight_eq_nat (L : List (ℕ × ℕ)) : encRight L = encRightNat (L.map Prod.fst) := by + induction L with + | nil => rfl + | cons p L ih => + rcases p with ⟨a, b⟩ + rw [encRight_mod1 a b L, Nat.mod_one b, encRight_run_s0 a L, ih] + rfl + +private theorem encRightNat_eq (L : List ℕ) : encRightNat L = encRight (L.map (fun x => (x, 0))) := + by + induction L with + | nil => rfl + | cons a L ih => + simp only [List.map_cons, encRightNat, ih, encRight_run_s0] + +@[simp] private theorem encRightNat_cons_one (L : List ℕ) : + (1 : Fin 2) >> encRightNat L = encRightNat (bumpHead L) := by + rcases L with _ | ⟨a, L'⟩ + · simp [bumpHead, encRightNat] + · simp [bumpHead] + +local macro "tstep" : tactic => `(tactic| ( + try refine ReachesPlus.to_star ?_ + try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', + encTokens_nil, encTokens_zero, encTokens_succ, + encRightNat_nil, encRightNat_zero, encRightNat_succ, + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, + list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, + zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one] + refine ReachesPlus.head (by rfl) ?_ + simp only [Tape.move, Tape.write, encTokens_nil, encTokens_zero, encTokens_succ, + encRightNat_nil, encRightNat_zero, encRightNat_succ, + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, + list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, + zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one])) + +local macro "tfinish" : tactic => `(tactic| ( + refine ⟨0, ?_⟩ + try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', + encTokens_nil, encTokens_zero, encTokens_succ, + encRightNat_nil, encRightNat_zero, encRightNat_succ, encLeft_nil, encRight_nil, + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, + list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, + zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one] + simp only [encRightNat_cons_one, encLeft_cons_one, encRight_cons_one, multiStep_zero] + try rfl)) + +local macro "texecute" n:num : tactic => `(tactic| ( + iterate $n tstep + tfinish)) + +private def tok_BR (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := + (encTokens K R3) {{B}}> (encRightNat L) + +private def tok_CR (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := + (encTokens K R3) {{C}}> (encRightNat L) + +private def tok_AL (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := + (encTokens K R3) <{{A}} (encRightNat L) + +private theorem tok_AL_exit_zero (R3 : List (ℕ × ℕ)) (L : List ℕ) : + (tok_AL [0] R3 L) [target]⊢⁺ cfg_BR_n_n (L.map (fun x => (x, 0))) (bumpPairHead R3) := by + unfold tok_AL cfg_BR_n_n + rw [← encRightNat_eq L] + texecute 1 + +private theorem tok_AL_0_cons (k1 : ℕ) (K2 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : + (tok_AL (0 :: k1 :: K2) R3 L) [target]⊢⁺ tok_BR ((k1 + 1) :: K2) R3 L := by + unfold tok_AL tok_BR; texecute 1 + +private theorem tok_AL_1 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : + (tok_AL (1 :: K1) R3 L) [target]⊢⁺ tok_AL K1 R3 (0 :: L) := by + unfold tok_AL; texecute 2 + +private theorem tok_AL_2 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : + (tok_AL (2 :: K1) R3 (0 :: L)) [target]⊢⁺ tok_AL K1 R3 (0 :: 1 :: L) := by + unfold tok_AL; texecute 7 + +private theorem tok_AL_add3 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : + (tok_AL ((k + 3) :: K1) R3 L) [target]⊢⁺ tok_CR (2 :: k :: K1) R3 L := by + unfold tok_AL tok_CR; texecute 5 + +private theorem tok_CR_nil_8 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_CR (2 :: K1) R3 []) [target]⊢⁺ tok_AL K1 R3 [0, 1] := by + unfold tok_CR tok_AL; texecute 8 + +private theorem tok_CR_zero (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L1 : List ℕ) : + (tok_CR (2 :: K1) R3 (0 :: L1)) [target]⊢⁺ tok_CR (2 :: 1 :: K1) R3 L1 := by + unfold tok_CR; texecute 4 + +private theorem tok_CR_1_nil_28 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_CR (2 :: K1) R3 [1]) [target]⊢⁺ tok_AL (1 :: K1) R3 [0, 0, 0, 1] := by + unfold tok_CR tok_AL; texecute 28 + +private theorem tok_CR_succ (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L1 : List ℕ) : + (tok_CR (2 :: K1) R3 ((a + 1) :: L1)) [target]⊢⁺ tok_BR (1 :: 1 :: K1) R3 (a :: L1) := by + unfold tok_CR tok_BR; texecute 3 + +private theorem tok_BR_1_nil_9 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_BR (1 :: K1) R3 []) [target]⊢⁺ tok_AL K1 R3 [0, 1] := by + unfold tok_BR tok_AL; texecute 9 + +private theorem tok_BR_add2_nil_21 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_BR ((k + 2) :: K1) R3 []) [target]⊢⁺ tok_AL (k :: K1) R3 [0, 0, 1] := by + unfold tok_BR tok_AL; texecute 21 + +private theorem tok_BR_zero (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L1 : List ℕ) : + (tok_BR (k :: K1) R3 (0 :: L1)) [target]⊢⁺ tok_BR ((k + 2) :: K1) R3 L1 := by + unfold tok_BR; texecute 2 + +private theorem tok_BR_1_nil_33 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_BR (k :: K1) R3 [1]) [target]⊢⁺ tok_AL (k :: K1) R3 [0, 0, 0, 1] := by + unfold tok_BR tok_AL; texecute 33 + +private theorem tok_BR_1_0 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L2 : List ℕ) : + (tok_BR (k :: K1) R3 (1 :: 0 :: L2)) [target]⊢⁺ tok_BR (1 :: (k + 3) :: K1) R3 L2 := by + unfold tok_BR; texecute 5 + +private theorem tok_BR_1_1_nil_25 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_BR (k :: K1) R3 [1, 1]) [target]⊢⁺ tok_AL (k :: K1) R3 [0, 0, 1] := by + unfold tok_BR tok_AL; texecute 25 + +private theorem tok_BR_1_1_cons_25 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (c : ℕ) (L3 : List ℕ) : + (tok_BR (k :: K1) R3 (1 :: 1 :: c :: L3)) [target]⊢⁺ + tok_AL (k :: K1) R3 (0 :: 0 :: (c + 2) :: L3) := by + unfold tok_BR tok_AL; texecute 25 + +private theorem tok_BR_1_add2 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L2 : List ℕ) : + (tok_BR (k :: K1) R3 (1 :: (a + 2) :: L2)) [target]⊢⁺ tok_CR (2 :: 1 :: k :: K1) R3 (a :: L2) := + by + unfold tok_BR tok_CR; texecute 15 + +private theorem tok_BR_add2_halts (K : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L1 : List ℕ) : + ∃ cfg_, ((tok_BR K R3 ((a + 2) :: L1)) [target]⊢⁺ cfg_) ∧ + (step target cfg_).isNone := by + refine ⟨((1 : Fin 2) >> (1 : Fin 2) >> encTokens K R3) {{F}}> (encRightNat (a :: L1)), ?_, + by simp only [encRightNat]; bb_halt⟩ + unfold tok_BR; texecute 2 + +/-! ## Weight and Lexicographic Measure -/ + +@[simp] +private def predNat : ℕ → ℕ + | 0 => 0 + | a + 1 => a + +@[simp] +private def wtL : List ℕ → ℕ + | [] => 0 + | [a] => predNat a + | a :: b :: L => a + wtL (b :: L) + +@[simp] private theorem predNat_succ (a : ℕ) : predNat (a + 1) = a := rfl + +@[simp] private theorem wtL_single (a : ℕ) : wtL [a] = predNat a := rfl + +@[simp] private theorem wtL_cons_cons (a b : ℕ) (L : List ℕ) : wtL (a :: b :: L) = + a + wtL (b :: L) := rfl + +@[simp] private theorem wtL_zero_cons (L : List ℕ) : wtL (0 :: L) = wtL L := by + rcases L with _ | ⟨b, L'⟩ + · rfl + · exact Nat.zero_add (wtL (b :: L')) + +private theorem wtL_1_1_cons (c : ℕ) (L3 : List ℕ) : wtL ((c + 2) :: L3) ≤ wtL (1 :: 1 :: c :: L3) + := by + rcases L3 with _ | ⟨d, L4⟩ + · rcases c with _ | c' + · decide + · simp only [wtL_cons_cons, wtL_single, predNat_succ]; omega + · simp only [wtL_cons_cons]; omega + +private theorem wtL_1_add2 (b : ℕ) (L2 : List ℕ) : wtL (b :: L2) + 2 ≤ wtL (1 :: (b + 2) :: L2) := + by + rcases L2 with _ | ⟨d, L3⟩ + · rcases b with _ | b' + · decide + · simp only [wtL_cons_cons, wtL_single, predNat_succ]; omega + · simp only [wtL_cons_cons]; omega + +@[simp] +private def sumL : List ℕ → ℕ + | [] => 0 + | a :: L => a + sumL L + +@[simp] +private def countNonOne : List ℕ → ℕ + | [] => 0 + | 0 :: K => 1 + countNonOne K + | 1 :: K => countNonOne K + | (_ + 2) :: K => 1 + countNonOne K + +@[simp] private theorem countNonOne_zero (K : List ℕ) : countNonOne (0 :: K) = 1 + countNonOne K := + rfl + +@[simp] private theorem countNonOne_one (K : List ℕ) : countNonOne (1 :: K) = countNonOne K := rfl + +@[simp] private theorem countNonOne_add2 (k : ℕ) (K : List ℕ) : countNonOne ((k + 2) :: K) = + 1 + countNonOne K := rfl + +private theorem countNonOne_cons_le (k : ℕ) (K : List ℕ) : countNonOne (k :: K) ≤ 1 + countNonOne K + := by + rcases k with _ | _ | k' + · exact Nat.le_refl _ + · exact Nat.le_add_left _ 1 + · exact Nat.le_refl _ + +private theorem le_countNonOne_cons (k : ℕ) (K : List ℕ) : countNonOne K ≤ countNonOne (k :: K) := + by + rcases k with _ | _ | k' + · exact Nat.le_add_left _ 1 + · exact Nat.le_refl _ + · exact Nat.le_add_left _ 1 + +@[simp] +private def scores : List ℕ → List (ℕ × ℕ) + | [] => [] + | 0 :: K => scores K ++ [(K.length, 0)] + | 1 :: K => scores K + | (k + 2) :: K => scores K ++ [(K.length, k + 2)] + +@[simp] private theorem scores_zero (K : List ℕ) : scores (0 :: K) = scores K ++ [(K.length, 0)] := + rfl + +@[simp] private theorem scores_one (K : List ℕ) : scores (1 :: K) = scores K := rfl + +@[simp] private theorem scores_add2 (k : ℕ) (K : List ℕ) : scores ((k + 2) :: K) = scores K ++ + [(K.length, k + 2)] := rfl + +private theorem scores_cons_ext (k : ℕ) (K : List ℕ) : ∃ ext, scores (k :: K) = scores K ++ ext := + by + rcases k with _ | _ | k' + · exact ⟨[(K.length, 0)], rfl⟩ + · exact ⟨[], (List.append_nil (scores K)).symm⟩ + · exact ⟨[(K.length, k' + 2)], rfl⟩ + +private theorem scores_length (K : List ℕ) : (scores K).length = countNonOne K := by + induction K with + | nil => rfl + | cons k K ih => + rcases k with _ | _ | k' + · simp only [scores_zero, countNonOne_zero, List.length_append, List.length_singleton, + ih]; omega + · exact ih + · dsimp only [scores, countNonOne] + rw [List.length_append, List.length_singleton, ih] + omega + +private def PairLt (p q : ℕ × ℕ) : Prop := + p.1 < q.1 ∨ (p.1 = q.1 ∧ p.2 < q.2) + +private inductive BoundedLex : ℕ → List (ℕ × ℕ) → List (ℕ × ℕ) → Prop + | head {m : ℕ} {x y : ℕ × ℕ} {xs ys : List (ℕ × ℕ)} : + PairLt x y → BoundedLex (m + 1) (x :: xs) (y :: ys) + | cons {m : ℕ} {z : ℕ × ℕ} {xs ys : List (ℕ × ℕ)} : + BoundedLex m xs ys → BoundedLex (m + 1) (z :: xs) (z :: ys) + +private theorem boundedLex_append (P : List (ℕ × ℕ)) {m : ℕ} {x y : ℕ × ℕ} (rest ext : List (ℕ × ℕ)) + (hxy : PairLt x y) (hlen : P.length < m) : + BoundedLex m (P ++ (x :: ext)) (P ++ (y :: rest)) := by + induction P generalizing m with + | nil => + rcases m with _ | m' + · omega + · exact BoundedLex.head hxy + | cons z P' ih => + rcases m with _ | m' + · simp at hlen + · simp only [List.cons_append] + exact BoundedLex.cons (ih (by simp at hlen; omega)) + +private theorem boundedLex_acc_snd (m a : ℕ) + (ih_m : ∀ xs, Acc (BoundedLex m) xs) + (ih_a : ∀ a' < a, ∀ b ys, Acc (BoundedLex (m + 1)) ((a', b) :: ys)) + (n : ℕ) : + ∀ b ≤ n, ∀ ys, Acc (BoundedLex (m + 1)) ((a, b) :: ys) := by + induction n with + | zero => + intro b hb ys + have hb0 : b = 0 := by omega + subst hb0 + induction (ih_m ys) with + | intro ys _ ih_ys => + refine Acc.intro ((a, 0) :: ys) (fun zs h => ?_) + cases h with + | @head _ x _ xs _ hlt => + rcases x with ⟨a', b'⟩ + rcases hlt with ha' | ⟨rfl, hb'⟩ + · exact ih_a a' ha' b' xs + · dsimp at hb'; omega + | cons hsub => exact ih_ys _ hsub + | succ n ih_n => + intro b hb ys + rcases Nat.of_le_succ hb with hle | rfl + · exact ih_n b hle ys + · induction (ih_m ys) with + | intro ys _ ih_ys => + refine Acc.intro ((a, n + 1) :: ys) (fun zs h => ?_) + cases h with + | @head _ x _ xs _ hlt => + rcases x with ⟨a', b'⟩ + rcases hlt with ha' | ⟨rfl, hb'⟩ + · exact ih_a a' ha' b' xs + · dsimp at hb'; exact ih_n b' (by omega) xs + | cons hsub => exact ih_ys _ hsub + +private theorem boundedLex_acc_fst (m : ℕ) (ih_m : ∀ xs, Acc (BoundedLex m) xs) (n : ℕ) : + ∀ a ≤ n, ∀ b ys, Acc (BoundedLex (m + 1)) ((a, b) :: ys) := by + induction n with + | zero => + intro a ha b ys + have ha0 : a = 0 := by omega + subst ha0 + exact boundedLex_acc_snd m 0 ih_m (fun _ hlt => by omega) b b (Nat.le_refl b) ys + | succ n ih_n => + intro a ha b ys + rcases Nat.of_le_succ ha with hle | rfl + · exact ih_n a hle b ys + · exact boundedLex_acc_snd m (n + 1) ih_m (fun a' hlt => ih_n a' (by omega)) b b (Nat.le_refl b) + ys + +private theorem boundedLex_acc (m : ℕ) (xs : List (ℕ × ℕ)) : Acc (BoundedLex m) xs := by + induction m generalizing xs with + | zero => exact Acc.intro xs (fun _ h => nomatch h) + | succ m ih_m => + rcases xs with _ | ⟨⟨a, b⟩, ys⟩ + · exact Acc.intro [] (fun _ h => nomatch h) + · exact boundedLex_acc_fst m ih_m a a (Nat.le_refl a) b ys + +/-! ## Bounce Lemmas for `BR` and `CR` -/ + +private theorem bounce_len (R3 : List (ℕ × ℕ)) (n : ℕ) : + ∀ (L : List ℕ), 2 * sumL L + L.length ≤ n → + (∀ (k0 : ℕ) (K_acc : List ℕ), + (∃ cfg_, ((tok_BR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ + (∃ K_out L_out, ((tok_BR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ + tok_AL K_out R3 (0 :: L_out)) ∧ + (∃ ext, scores K_out = scores K_acc ++ ext) ∧ + (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∨ + (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + 1 + wtL L ∧ + (k0 ≠ 0 → ∃ d ext, scores K_out = scores K_acc ++ ((K_acc.length, d) :: ext)))))) ∧ + (∀ (K_acc : List ℕ), + (∃ cfg_, ((tok_CR (2 :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ + (∃ K_out L_out, ((tok_CR (2 :: K_acc) R3 L) [target]⊢⁺ tok_AL K_out R3 (0 :: L_out)) ∧ + countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∧ + (∃ ext, scores K_out = scores K_acc ++ ext))) := by + induction n with + | zero => + intro L hlen + rcases L with _ | ⟨a, L1⟩ + · refine ⟨fun k0 K_acc => ?_, fun K_acc => ?_⟩ + · rcases k0 with _ | k' + · refine Or.inr ⟨K_acc, [1], tok_BR_1_nil_9 K_acc R3, ⟨[], by simp⟩, Or.inl (by simp)⟩ + · rcases k' with _ | m + · refine Or.inr ⟨0 :: K_acc, [0, 1], tok_BR_add2_nil_21 0 K_acc R3, ⟨[(K_acc.length, 0)], + by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨0, [], by simp⟩⟩⟩ + · rcases m with _ | m' + · refine Or.inr ⟨1 :: K_acc, [0, 1], tok_BR_add2_nil_21 1 K_acc R3, ⟨[], by simp⟩, + Or.inl (by simp)⟩ + · refine Or.inr ⟨(m' + 2) :: K_acc, [0, 1], tok_BR_add2_nil_21 (m' + 2) K_acc R3, + ⟨[(K_acc.length, m' + 2)], by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨m' + 2, [], + by simp⟩⟩⟩ + · exact Or.inr ⟨K_acc, [1], tok_CR_nil_8 K_acc R3, by simp, ⟨[], by simp⟩⟩ + · simp at hlen + | succ n ih_n => + intro L hlen + rcases Nat.of_le_succ hlen with hle | heq + · exact ih_n L hle + · refine ⟨fun k0 K_acc => ?_, fun K_acc => ?_⟩ + · rcases L with _ | ⟨a, L1⟩ + · simp at heq + · rcases a with _ | _ | a' + · have hstep1 := tok_BR_zero (k0 + 1) K_acc R3 L1 + rcases (ih_n L1 (by simp at heq ⊢; omega)).1 (k0 + 2) K_acc with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hext, hbr⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, hext, ?_⟩ + rcases hbr with hlt | ⟨hle, hd⟩ + · exact Or.inl (by simpa using hlt) + · exact Or.inr ⟨by simpa using hle, fun _ => hd (by omega)⟩ + · rcases L1 with _ | ⟨b, L2⟩ + · rcases k0 with _ | k' + · refine Or.inr ⟨1 :: K_acc, [0, 0, 1], tok_BR_1_nil_33 1 K_acc R3, ⟨[], by simp⟩, + Or.inl (by simp)⟩ + · refine Or.inr ⟨(k' + 2) :: K_acc, [0, 0, 1], tok_BR_1_nil_33 (k' + 2) K_acc R3, + ⟨[(K_acc.length, k' + 2)], by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨k' + 2, [], + by simp⟩⟩⟩ + · rcases b with _ | _ | b' + · have hstep1 := tok_BR_1_0 (k0 + 1) K_acc R3 L2 + rcases (ih_n L2 (by simp at heq ⊢; omega)).1 0 ((k0 + 4) :: K_acc) with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · have hsc' : scores K_out = scores K_acc ++ ((K_acc.length, k0 + 4) :: ext) := by + simpa [scores_add2 (k0 + 2) K_acc, List.append_assoc] using hsc + refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ⟨(K_acc.length, + k0 + 4) :: ext, hsc'⟩, ?_⟩ + have hwt : wtL ((0 + 1) :: 0 :: L2) = 1 + wtL L2 := by simp + have hcnt : countNonOne ((k0 + 4) :: K_acc) = 1 + countNonOne K_acc := + countNonOne_add2 (k0 + 2) K_acc + rcases hbr with hlt | ⟨hle, _⟩ + · exact Or.inl (by omega) + · exact Or.inr ⟨by omega, fun _ => ⟨k0 + 4, ext, hsc'⟩⟩ + · rcases L2 with _ | ⟨c, L3⟩ + · have hstep := tok_BR_1_1_nil_25 (k0 + 1) K_acc R3 + have hcnt := countNonOne_cons_le (k0 + 1) K_acc + refine Or.inr ⟨(k0 + 1) :: K_acc, [0, 1], hstep, scores_cons_ext (k0 + 1) K_acc, + Or.inl ?_⟩ + simp at hcnt ⊢; omega + · have hstep := tok_BR_1_1_cons_25 (k0 + 1) K_acc R3 c L3 + have hwt : wtL ((c + 2) :: L3) ≤ wtL ((0 + 1) :: (0 + 1) :: c :: L3) := + wtL_1_1_cons c L3 + rcases k0 with _ | k' + · refine Or.inr ⟨1 :: K_acc, 0 :: (c + 2) :: L3, hstep, ⟨[], by simp⟩, Or.inl ?_⟩ + simp only [countNonOne_one, wtL_zero_cons]; omega + · refine Or.inr ⟨(k' + 2) :: K_acc, 0 :: (c + 2) :: L3, hstep, ⟨[(K_acc.length, + k' + 2)], by simp⟩, Or.inr ⟨?_, fun _ => ⟨k' + 2, [], by simp⟩⟩⟩ + simp only [countNonOne_add2, wtL_zero_cons]; omega + · have hstep1 := tok_BR_1_add2 (k0 + 1) K_acc R3 b' L2 + rcases (ih_n (b' :: L2) (by simp at heq ⊢; omega)).2 (1 :: (k0 + 1) :: K_acc) with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · obtain ⟨ext0, hsc0⟩ := scores_cons_ext (k0 + 1) K_acc + have hcnt := countNonOne_cons_le (k0 + 1) K_acc + have hwt : wtL (b' :: L2) + 2 ≤ wtL ((0 + 1) :: (b' + 1 + 1) :: L2) := + wtL_1_add2 b' L2 + refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ⟨ext0 ++ ext, + by simp [hsc, hsc0, List.append_assoc]⟩, Or.inl ?_⟩ + simp only [countNonOne_one] at hle + omega + · exact Or.inl (tok_BR_add2_halts ((k0 + 1) :: K_acc) R3 a' L1) + · rcases L with _ | ⟨a, L1⟩ + · simp at heq + · rcases a with _ | a' + · have hstep1 := tok_CR_zero K_acc R3 L1 + rcases (ih_n L1 (by simp at heq ⊢; omega)).2 (1 :: K_acc) with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · exact Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, by simpa using hle, ⟨ext, + by simpa using hsc⟩⟩ + · rcases L1 with _ | ⟨b, L2⟩ + · rcases a' with _ | a'' + · exact Or.inr ⟨1 :: K_acc, [0, 0, 1], tok_CR_1_nil_28 K_acc R3, by simp, ⟨[], + by simp⟩⟩ + · have hstep1 := tok_CR_succ K_acc R3 (a'' + 1) [] + rcases (ih_n [a'' + 1] (by simp at heq ⊢; omega)).1 0 (1 :: K_acc) with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ?_, ⟨ext, + by simpa using hsc⟩⟩ + rcases hbr with hlt | ⟨hle, _⟩ + · simp at hlt ⊢; omega + · simp at hle ⊢; omega + · have hstep1 := tok_CR_succ K_acc R3 a' (b :: L2) + rcases (ih_n (a' :: b :: L2) (by simp at heq ⊢; omega)).1 0 (1 :: K_acc) with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ?_, ⟨ext, + by simpa using hsc⟩⟩ + rcases hbr with hlt | ⟨hle, _⟩ + · simp at hlt ⊢; omega + · simp at hle ⊢; omega + +private theorem bounce_BR (R3 : List (ℕ × ℕ)) (k0 : ℕ) (K_acc : List ℕ) (L : List ℕ) : + (∃ cfg_, ((tok_BR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ + (∃ K_out L_out, ((tok_BR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ tok_AL K_out R3 (0 :: L_out)) ∧ + (∃ ext, scores K_out = scores K_acc ++ ext) ∧ + (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∨ + (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + 1 + wtL L ∧ + (k0 ≠ 0 → ∃ d ext, scores K_out = scores K_acc ++ ((K_acc.length, d) :: ext))))) := + (bounce_len R3 (2 * sumL L + L.length) L (Nat.le_refl _)).1 k0 K_acc + +private theorem bounce_CR (R3 : List (ℕ × ℕ)) (K_acc : List ℕ) (L : List ℕ) : + (∃ cfg_, ((tok_CR (2 :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ + (∃ K_out L_out, ((tok_CR (2 :: K_acc) R3 L) [target]⊢⁺ tok_AL K_out R3 (0 :: L_out)) ∧ + countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∧ + (∃ ext, scores K_out = scores K_acc ++ ext)) := + (bounce_len R3 (2 * sumL L + L.length) L (Nat.le_refl _)).2 K_acc + +/-! ## Token System Termination -/ + +private theorem bl_step_macro_len (R3 : List (ℕ × ℕ)) (n : ℕ) : + ∀ (K : List ℕ), K.length ≤ n → ∀ (L : List ℕ), + (∃ cfg_, ((tok_AL K R3 (0 :: L)) [target]⊢* cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone)) ∨ + (∃ K' L', ((tok_AL K R3 (0 :: L)) [target]⊢⁺ tok_AL K' R3 (0 :: L')) ∧ + countNonOne K' + wtL L' < countNonOne K + wtL L) ∨ + (∃ K' L' P x y rest ext, ((tok_AL K R3 (0 :: L)) [target]⊢⁺ tok_AL K' R3 (0 :: L')) ∧ + countNonOne K' + wtL L' = countNonOne K + wtL L ∧ PairLt x y ∧ + scores K = P ++ (y :: rest) ∧ scores K' = P ++ (x :: ext)) := by + induction n with + | zero => + intro K hlen L + cases K with + | nil => + refine Or.inl ⟨cfg_AL_n_n ((0 :: L).map (fun x => (x, 0))) R3, ⟨0, ?_⟩, + Or.inl ⟨.AL_n_n, R3, (0 :: L).map (fun x => (x, 0)), rfl⟩⟩ + unfold tok_AL cfg_AL_n_n + rw [encTokens_nil, encRightNat_eq] + rfl + | cons _ _ => simp at hlen + | succ n ih_n => + intro K hlen L + rcases K with _ | ⟨k1, K1⟩ + · refine Or.inl ⟨cfg_AL_n_n ((0 :: L).map (fun x => (x, 0))) R3, ⟨0, ?_⟩, + Or.inl ⟨.AL_n_n, R3, (0 :: L).map (fun x => (x, 0)), rfl⟩⟩ + unfold tok_AL cfg_AL_n_n + rw [encTokens_nil, encRightNat_eq] + rfl + · rcases k1 with _ | _ | _ | k' + · rcases K1 with _ | ⟨k2, K2⟩ + · exact Or.inl ⟨cfg_BR_n_n ((0 :: L).map (fun x => (x, 0))) (bumpPairHead R3), + ReachesPlus.to_star (tok_AL_exit_zero R3 (0 :: L)), + Or.inl ⟨.BR_n_n, bumpPairHead R3, (0 :: L).map (fun x => (x, 0)), rfl⟩⟩ + · have hstep1 := + ReachesPlus.trans (tok_AL_0_cons k2 K2 R3 (0 :: L)) (tok_BR_zero (k2 + 1) K2 R3 L) + rcases bounce_BR R3 (k2 + 2) K2 L with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, _, hbr⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans hstep1 hstep2), Or.inr hhalt⟩ + · have hstep := ReachesPlus.trans hstep1 hstep2 + rcases hbr with hlt | ⟨hle, hd⟩ + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + have hcnt := le_countNonOne_cons k2 K2 + simp only [countNonOne_zero]; omega + · rcases k2 with _ | _ | k2' + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [countNonOne_zero]; omega + · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [Nat.zero_add, countNonOne_zero, countNonOne_one]; omega + · obtain ⟨d, ext, hsc_out⟩ := hd (by omega) + refine Or.inr (Or.inr ⟨K_out, L_out, scores K2, (K2.length, d), ((1 :: K2).length, + 0), + [], ext, hstep, by simp only [Nat.zero_add, countNonOne_zero, + countNonOne_one]; omega, + Or.inl (by simp), by simp, hsc_out⟩) + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [countNonOne_zero, countNonOne_add2]; omega + · have hstep1 := tok_AL_1 K1 R3 (0 :: L) + rcases ih_n K1 (by simp at hlen; omega) (0 :: L) with + ⟨cfg_, hstep2, hsys⟩ | + ⟨K', L', hstep2, hlt⟩ | + ⟨K', L', P, x, y, rest, ext, hstep2, heq, hxy, hsc1, hsc2⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep1 hstep2), hsys⟩ + · refine Or.inr (Or.inl ⟨K', L', ReachesPlus.trans hstep1 hstep2, ?_⟩) + simpa using hlt + · refine Or.inr (Or.inr ⟨K', L', P, x, y, rest, ext, ReachesPlus.trans hstep1 hstep2, + by simpa using heq, hxy, by simpa using hsc1, hsc2⟩) + · have hstep1 := tok_AL_2 K1 R3 L + rcases L with _ | ⟨a, L1⟩ + · refine Or.inr (Or.inl ⟨K1, [1], hstep1, ?_⟩) + simp + · have hwt1 : wtL (1 :: a :: L1) = 1 + wtL (a :: L1) := by simp + rcases ih_n K1 (by simp at hlen; omega) (1 :: a :: L1) with + ⟨cfg_, hstep2, hsys⟩ | + ⟨K', L', hstep2, hlt⟩ | + ⟨K', L', P, x, y, rest, ext, hstep2, heq, hxy, hsc1, hsc2⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep1 hstep2), hsys⟩ + · refine Or.inr (Or.inl ⟨K', L', ReachesPlus.trans hstep1 hstep2, ?_⟩) + simp only [countNonOne_add2 0 K1]; omega + · refine Or.inr (Or.inr ⟨K', L', P, x, y, rest ++ [(K1.length, 2)], ext, + ReachesPlus.trans hstep1 hstep2, by simp only [countNonOne_add2 0 K1]; omega, + hxy, by simp [hsc1, List.append_assoc], hsc2⟩) + · have hstep1 := + ReachesPlus.trans (tok_AL_add3 k' K1 R3 (0 :: L)) (tok_CR_zero (k' :: K1) R3 L) + rcases bounce_CR R3 (1 :: k' :: K1) L with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans hstep1 hstep2), Or.inr hhalt⟩ + · have hstep := ReachesPlus.trans hstep1 hstep2 + simp only [countNonOne_one, scores_one] at hle hsc + rcases k' with _ | _ | k'' + · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [countNonOne_zero, countNonOne_add2] at hlt' ⊢; omega + · refine Or.inr (Or.inr ⟨K_out, L_out, scores K1, (K1.length, 0), (K1.length, 3), + [], ext, hstep, by simp only [countNonOne_zero, countNonOne_add2] at heq' ⊢; omega, + Or.inr ⟨rfl, by simp⟩, by simp, + by simpa [List.append_assoc] using hsc⟩) + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [Nat.zero_add, countNonOne_one, countNonOne_add2] at hle ⊢; omega + · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [countNonOne_add2] at hlt' ⊢; omega + · refine Or.inr (Or.inr ⟨K_out, L_out, scores K1, (K1.length, k'' + 2), (K1.length, + k'' + 5), + [], ext, hstep, by simp only [countNonOne_add2] at heq' ⊢; omega, + Or.inr ⟨rfl, by simp⟩, by simp, + by simpa [List.append_assoc] using hsc⟩) + +private theorem bl_terminates_acc (R3 : List (ℕ × ℕ)) (m : ℕ) + (ih_m : ∀ (K : List ℕ) (L : List ℕ), + countNonOne K + wtL L < m → + ∃ cfg_, ((tok_AL K R3 (0 :: L)) [target]⊢* cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone)) + (S : List (ℕ × ℕ)) (hacc : Acc (BoundedLex m) S) : + ∀ (K : List ℕ) (L : List ℕ), + scores K = S → countNonOne K + wtL L = m → + ∃ cfg_, ((tok_AL K R3 (0 :: L)) [target]⊢* cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + induction hacc with + | intro S _ ih_acc => + intro K L hS hm + rcases bl_step_macro_len R3 K.length K (Nat.le_refl K.length) L with + ⟨cfg_, hstep, hsys⟩ | + ⟨K', L', hstep, hlt⟩ | + ⟨K', L', P, x, y, rest, ext, hstep, heq, hxy, hsc1, hsc2⟩ + · exact ⟨cfg_, hstep, hsys⟩ + · obtain ⟨cfg_, hstep2, hsys⟩ := ih_m K' L' (by omega) + exact ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep hstep2), hsys⟩ + · have hlenP : P.length < m := by + have hlenK := scores_length K + rw [hsc1, List.length_append, List.length_cons] at hlenK + omega + have hlex : BoundedLex m (scores K') S := by + rw [← hS, hsc1, hsc2] + exact boundedLex_append P rest ext hxy hlenP + obtain ⟨cfg_, hstep2, hsys⟩ := ih_acc (scores K') hlex K' L' rfl (by omega) + exact ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep hstep2), hsys⟩ + +private theorem bl_terminates_le (R3 : List (ℕ × ℕ)) (n : ℕ) : + ∀ (m : ℕ), m ≤ n → ∀ (K : List ℕ) (L : List ℕ), + countNonOne K + wtL L = m → + ∃ cfg_, ((tok_AL K R3 (0 :: L)) [target]⊢* cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + induction n with + | zero => + intro m hm K L hM + have hm0 : m = 0 := by omega + subst hm0 + exact bl_terminates_acc R3 0 (fun _ _ hlt => by omega) (scores K) (boundedLex_acc 0 (scores K)) + K L rfl hM + | succ n ih_n => + intro m hm K L hM + rcases Nat.of_le_succ hm with hle | rfl + · exact ih_n m hle K L hM + · refine bl_terminates_acc R3 (n + 1) (fun K' L' hlt => ?_) + (scores K) (boundedLex_acc (n + 1) (scores K)) K L rfl hM + exact ih_n (countNonOne K' + wtL L') (by omega) K' L' rfl + +private theorem tok_CR_2_0_closed (R3 : List (ℕ × ℕ)) (L : List ℕ) : + ∃ cfg_, ((tok_CR [2, 0] R3 L) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases bounce_CR R3 [0] L with ⟨cfg_, hstep, hhalt⟩ | ⟨K_out, L_out, hstep, _, _⟩ + · exact ⟨cfg_, hstep, Or.inr hhalt⟩ + · obtain ⟨cfg_, hstep2, hsys⟩ := bl_terminates_le R3 (countNonOne K_out + wtL L_out) + (countNonOne K_out + wtL L_out) (Nat.le_refl _) K_out L_out rfl + exact ⟨cfg_, ReachesPlus.trans_star hstep hstep2, hsys⟩ + +private theorem tok_BR_1_0_closed (R3 : List (ℕ × ℕ)) (L : List ℕ) : + ∃ cfg_, ((tok_BR [1, 0] R3 L) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases bounce_BR R3 0 [0] L with ⟨cfg_, hstep, hhalt⟩ | ⟨K_out, L_out, hstep, _, _⟩ + · exact ⟨cfg_, hstep, Or.inr hhalt⟩ + · obtain ⟨cfg_, hstep2, hsys⟩ := bl_terminates_le R3 (countNonOne K_out + wtL L_out) + (countNonOne K_out + wtL L_out) (Nat.le_refl _) K_out L_out rfl + exact ⟨cfg_, ReachesPlus.trans_star hstep hstep2, hsys⟩ + +/-! ## Mode Closure Theorems -/ + +private theorem mode_BR_n_n_closed (L R : List (ℕ × ℕ)) : + ∃ cfg_, ((cfg_BR_n_n L R) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases L with _ | ⟨⟨a1, b2⟩, L3⟩ + · refine ⟨cfg_AL_n_n [(0, 0)] (bumpPairHead R), ?_, Or.inl ⟨.AL_n_n, bumpPairHead R, [(0, 0)], + rfl⟩⟩ + unfold cfg_BR_n_n cfg_AL_n_n + rw [encRight_d0_s0 [], ← encLeft_cons_one R] + execute 2 + · rcases a1 with _ | a5 + · refine ⟨cfg_BR_n_n L3 (bumpPairHead (bumpPairHead R)), ?_, Or.inl ⟨.BR_n_n, + bumpPairHead (bumpPairHead R), L3, rfl⟩⟩ + unfold cfg_BR_n_n + rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, + ← encLeft_cons_one (bumpPairHead R), ← encLeft_cons_one R] + execute 2 + · rcases a5 with _ | a14 + · rcases L3 with _ | ⟨⟨a6, b7⟩, L8⟩ + · refine ⟨cfg_AL_n_n [(0, 0)] ((0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R))), ?_, + Or.inl ⟨.AL_n_n, (0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R)), [(0, 0)], rfl⟩⟩ + unfold cfg_BR_n_n cfg_AL_n_n + rw [encRight_mod1 1 b2 [], Nat.mod_one b2, encRight_d1_s0 [], encRight_d0_s0 [], + encLeft_d0_s0 (bumpPairHead (bumpPairHead (bumpPairHead R))), + ← encLeft_cons_one (bumpPairHead (bumpPairHead R)), + ← encLeft_cons_one (bumpPairHead R), ← encLeft_cons_one R] + execute 6 + · rcases a6 with _ | a10 + · refine ⟨cfg_BR_n_n L8 ((0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R))), ?_, + Or.inl ⟨.BR_n_n, (0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R)), L8, rfl⟩⟩ + unfold cfg_BR_n_n + rw [encRight_mod1 1 b2 ((0, b7) :: L8), Nat.mod_one b2, encRight_d1_s0 ((0, b7) :: L8), + encRight_mod1 0 b7 L8, Nat.mod_one b7, encRight_d0_s0 L8, + encLeft_d0_s0 (bumpPairHead (bumpPairHead (bumpPairHead R))), + ← encLeft_cons_one (bumpPairHead (bumpPairHead R)), + ← encLeft_cons_one (bumpPairHead R), ← encLeft_cons_one R] + execute 5 + · rcases a10 with _ | a11 + · refine ⟨cfg_AL_n_n (bumpPairHead L8) ((1, 0) :: (0, 0) :: R), ?_, Or.inl ⟨.AL_n_n, (1, + 0) :: (0, 0) :: R, bumpPairHead L8, rfl⟩⟩ + unfold cfg_BR_n_n cfg_AL_n_n + rw [encRight_mod1 1 b2 ((1, b7) :: L8), Nat.mod_one b2, + encRight_d1_s0 ((1, b7) :: L8), encRight_mod1 1 b7 L8, Nat.mod_one b7, + encRight_d1_s0 L8, ← encRight_cons_one L8, encLeft_d1_s0 ((0, 0) :: R), + encLeft_d0_s0 R] + execute 16 + · refine ⟨cfg_CR_n_n ((a11, 0) :: L8) ((1, 0) :: (0, 0) :: R), ?_, Or.inl ⟨.CR_n_n, (1, + 0) :: (0, 0) :: R, (a11, 0) :: L8, rfl⟩⟩ + unfold cfg_BR_n_n cfg_CR_n_n + rw [encRight_mod1 1 b2 ((a11 + 2, b7) :: L8), Nat.mod_one b2, + encRight_d1_s0 ((a11 + 2, b7) :: L8), encRight_mod1 (a11 + 2) b7 L8, + Nat.mod_one b7, encRight_succ (a11 + 1) 0 L8, encRight_succ a11 0 L8, + encRight_run_s0 a11 L8, encLeft_d1_s0 ((0, 0) :: R), encLeft_d0_s0 R] + execute 15 + · refine ⟨((1 : Fin 2) >> (1 : Fin 2) >> encLeft R) {{F}}> (encRight ((a14, 0) :: L3)), ?_, + Or.inr (by rw [encRight_run_s0]; bb_halt)⟩ + unfold cfg_BR_n_n + rw [encRight_mod1 (a14 + 2) b2 L3, Nat.mod_one b2, encRight_succ (a14 + 1) 0 L3, + encRight_succ a14 0 L3] + execute 2 + +private theorem mode_AL_n_n_closed (L R : List (ℕ × ℕ)) : + ∃ cfg_, ((cfg_AL_n_n L R) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases R with _ | ⟨⟨r1, b2⟩, R3⟩ + · refine ⟨cfg_BR_n_n L [(0, 0)], ?_, Or.inl ⟨.BR_n_n, [(0, 0)], L, rfl⟩⟩ + unfold cfg_AL_n_n cfg_BR_n_n + rw [encLeft_d0_s0 []] + execute 1 + · rcases r1 with _ | r5 + · refine ⟨cfg_AL_n_n ((0, 0) :: L) R3, ?_, Or.inl ⟨.AL_n_n, R3, (0, 0) :: L, rfl⟩⟩ + unfold cfg_AL_n_n + rw [encLeft_mod1 0 b2 R3, Nat.mod_one b2, encLeft_d0_s0 R3, encRight_d0_s0 L] + execute 2 + · refine ⟨cfg_CL_0_n L ((r5, 0) :: R3), ?_, Or.inl ⟨.CL_0_n, (r5, 0) :: R3, L, rfl⟩⟩ + unfold cfg_AL_n_n cfg_CL_0_n + rw [encLeft_mod1 (r5 + 1) b2 R3, Nat.mod_one b2, encLeft_succ r5 0 R3, encLeft_run_s0 r5 R3] + execute 1 + +private theorem mode_CL_0_n_closed (L R : List (ℕ × ℕ)) : + ∃ cfg_, ((cfg_CL_0_n L R) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases R with _ | ⟨⟨r1, b2⟩, R3⟩ + · refine ⟨cfg_BR_n_n L [(2, 0)], ?_, Or.inl ⟨.BR_n_n, [(2, 0)], L, rfl⟩⟩ + unfold cfg_CL_0_n cfg_BR_n_n + rw [encLeft_succ 1 0 [], encLeft_d1_s0 []] + execute 4 + · rcases r1 with _ | _ | r5 + · refine ⟨cfg_AL_n_n ((0, 0) :: bumpPairHead L) R3, ?_, Or.inl ⟨.AL_n_n, R3, (0, + 0) :: bumpPairHead L, rfl⟩⟩ + unfold cfg_CL_0_n cfg_AL_n_n + rw [encLeft_mod1 0 b2 R3, Nat.mod_one b2, encLeft_d0_s0 R3, encRight_d0_s0 (bumpPairHead L), + ← encRight_cons_one L] + execute 6 + · obtain ⟨cfg_, hstep2, hsys⟩ := tok_CR_2_0_closed R3 (L.map Prod.fst) + refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ + unfold cfg_CL_0_n tok_CR + rw [encLeft_mod1 1 b2 R3, Nat.mod_one b2, encLeft_d1_s0 R3, encRight_eq_nat L, + encTokens_succ, encTokens_succ, encTokens_zero, encTokens_zero, encTokens_nil] + texecute 4 + · refine ⟨cfg_CR_n_n L ((1, 0) :: (r5, 0) :: R3), ?_, Or.inl ⟨.CR_n_n, (1, 0) :: (r5, 0) :: R3, + L, rfl⟩⟩ + unfold cfg_CL_0_n cfg_CR_n_n + rw [encLeft_mod1 (r5 + 2) b2 R3, Nat.mod_one b2, encLeft_succ (r5 + 1) 0 R3, + encLeft_succ r5 0 R3, encLeft_run_s0 r5 R3, encLeft_d1_s0 ((r5, 0) :: R3), + encLeft_run_s0 r5 R3] + execute 4 + +private theorem mode_CR_n_n_closed (L R : List (ℕ × ℕ)) : + ∃ cfg_, ((cfg_CR_n_n L R) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases L with _ | ⟨⟨a1, b2⟩, L3⟩ + · refine ⟨cfg_AL_n_n [(0, 0)] R, ?_, Or.inl ⟨.AL_n_n, R, [(0, 0)], rfl⟩⟩ + unfold cfg_CR_n_n cfg_AL_n_n + rw [encRight_d0_s0 []] + execute 1 + · rcases R with _ | ⟨⟨r1, b4⟩, R3⟩ + · rcases a1 with _ | a5 + · refine ⟨cfg_AL_n_n (bumpPairHead L3) [(0, 0)], ?_, Or.inl ⟨.AL_n_n, [(0, 0)], + bumpPairHead L3, rfl⟩⟩ + unfold cfg_CR_n_n cfg_AL_n_n + rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, ← encRight_cons_one L3, + encLeft_d0_s0 []] + execute 4 + · refine ⟨cfg_CR_n_n ((a5, 0) :: L3) [(0, 0)], ?_, Or.inl ⟨.CR_n_n, [(0, 0)], (a5, 0) :: L3, + rfl⟩⟩ + unfold cfg_CR_n_n + rw [encRight_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encRight_succ a5 0 L3, + encRight_run_s0 a5 L3, encLeft_d0_s0 []] + execute 3 + · rcases r1 with _ | r5 + · rcases a1 with _ | a5 + · obtain ⟨cfg_, hstep2, hsys⟩ := tok_CR_2_0_closed R3 (L3.map Prod.fst) + refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ + unfold cfg_CR_n_n tok_CR + rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, encLeft_mod1 0 b4 R3, + Nat.mod_one b4, encLeft_d0_s0 R3, encRight_eq_nat L3, encTokens_succ, encTokens_succ, + encTokens_zero, encTokens_zero, encTokens_nil] + texecute 4 + · obtain ⟨cfg_, hstep2, hsys⟩ := tok_BR_1_0_closed R3 (a5 :: L3.map Prod.fst) + refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ + unfold cfg_CR_n_n tok_BR + rw [encRight_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encRight_succ a5 0 L3, + encRight_run_s0 a5 L3, encLeft_mod1 0 b4 R3, Nat.mod_one b4, encLeft_d0_s0 R3, + encRight_eq_nat L3, encTokens_succ, encTokens_zero, encTokens_zero, encTokens_nil] + change (((1 : Fin 2) >> (0 : Fin 2) >> encLeft R3) {{C}}> ((1 : Fin 2) >> + encRightNat (a5 :: List.map Prod.fst L3))) [target]⊢⁺ (((1 : Fin 2) >> (0 : Fin 2) >> + (0 : Fin 2) >> encLeft R3) {{B}}> (encRightNat (a5 :: List.map Prod.fst L3))) + texecute 3 + · rcases a1 with _ | a5 + · refine ⟨cfg_CR_n_n L3 ((1, 0) :: (r5, 0) :: R3), ?_, Or.inl ⟨.CR_n_n, (1, 0) :: (r5, + 0) :: R3, L3, rfl⟩⟩ + unfold cfg_CR_n_n + rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, + encLeft_mod1 (r5 + 1) b4 R3, Nat.mod_one b4, encLeft_succ r5 0 R3, + encLeft_run_s0 r5 R3, encLeft_d1_s0 ((r5, 0) :: R3), encLeft_run_s0 r5 R3] + execute 4 + · refine ⟨cfg_BR_n_n ((a5, 0) :: L3) ((0, 0) :: (r5, 0) :: R3), ?_, Or.inl ⟨.BR_n_n, (0, + 0) :: (r5, 0) :: R3, (a5, 0) :: L3, rfl⟩⟩ + unfold cfg_CR_n_n cfg_BR_n_n + rw [encRight_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encRight_succ a5 0 L3, + encRight_run_s0 a5 L3, encLeft_mod1 (r5 + 1) b4 R3, Nat.mod_one b4, + encLeft_succ r5 0 R3, encLeft_run_s0 r5 R3, encLeft_d0_s0 ((r5, 0) :: R3), + encLeft_run_s0 r5 R3] + execute 3 + +private theorem stack_system_closed (cfg : Cfg (Fin 2) (Fin 6)) (h : IsInStackSystem cfg) : + ∃ cfg_, (cfg [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases h with ⟨m, R, L, rfl⟩ + cases m with + | BR_n_n => exact mode_BR_n_n_closed L R + | AL_n_n => exact mode_AL_n_n_closed L R + | CL_0_n => exact mode_CL_0_n_closed L R + | CR_n_n => exact mode_CR_n_n_closed L R + +private theorem init_reaches_nontrivial : + (init []) [target]⊢⁺ evalStackCfg .BR_n_n [(0, 0)] [(0, 0), (1, 0)] := by + have hL : encLeft [(0, 0)] = (1 : Fin 2) >> (0 : Fin 2) >> default := rfl + have hR : encRight [(0, 0), (1, 0)] = + (1 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default := rfl + dsimp only [evalStackCfg, cfg_BR_n_n] + rw [hL, hR] + execute 11 + +private theorem step_AL_transfer (z : ℕ × ℕ) (L R : List (ℕ × ℕ)) : + (evalStackCfg .AL_n_n ((0, 0) :: z :: L) R) [target]⊢⁺ + evalStackCfg .AL_n_n (z :: L) ((0, 0) :: R) := by + dsimp only [evalStackCfg, cfg_AL_n_n] + rw [encLeft_d0_s0 (z :: L), encRight_d0_s0 R] + execute 2 + +private theorem encRight_head (a b : ℕ) (L : List (ℕ × ℕ)) : + (encRight ((a, b) :: L)).head = 1 := by + rw [encRight_cons, show 1 * a + 1 = (1 * a + 0) + 1 by omega, list_pow_succ, List.cons_append] + simp only [ListBlank.append_cons, ListBlank.head_cons] + +private theorem encRight_not_surjective : + ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ L : List (ℕ × ℕ), encRight L ≠ t := by + refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ + intro L h + rcases L with _ | ⟨⟨a, b⟩, L'⟩ + · have h1 := congrArg (fun s => s.head) h + simp at h1 + · rw [encRight_mod1] at h + have hb0 : b % 1 = 0 := Nat.mod_one b + rw [hb0, encRight_run_s0] at h + rcases a with _ | a' + · rcases L' with _ | ⟨⟨a', b'⟩, L''⟩ + · have h2 := congrArg (fun s => s.tail.tail.tail.head) h + simp at h2 + · have h1 := congrArg (fun s => s.tail.tail.head) h + normalize_at h1 + rw [encRight_head a' b' L''] at h1; contradiction + · have h1 := congrArg (fun s => s.tail.head) h + normalize_at h1 + contradiction + +private theorem encLeft_head (a b : ℕ) (R : List (ℕ × ℕ)) : + (encLeft ((a, b) :: R)).head = 1 := by + rw [encLeft_cons, show 1 * a + 1 = (1 * a + 0) + 1 by omega, list_pow_succ, List.cons_append] + simp only [ListBlank.append_cons, ListBlank.head_cons] + +private theorem encLeft_not_surjective : + ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ R : List (ℕ × ℕ), encLeft R ≠ t := by + refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ + intro R h + rcases R with _ | ⟨⟨a, b⟩, R'⟩ + · have h1 := congrArg (fun s => s.head) h + simp at h1 + · rw [encLeft_mod1] at h + have hb0 : b % 1 = 0 := Nat.mod_one b + rw [hb0, encLeft_run_s0] at h + rcases a with _ | a' + · rcases R' with _ | ⟨⟨a', b'⟩, L''⟩ + · have h2 := congrArg (fun s => s.tail.tail.tail.head) h + simp at h2 + · have h1 := congrArg (fun s => s.tail.tail.head) h + normalize_at h1 + rw [encLeft_head a' b' L''] at h1; contradiction + · have h1 := congrArg (fun s => s.tail.head) h + normalize_at h1 + contradiction + +private theorem valid_stack_modes : IsValidStackModes encLeft encRight evalStackCfg := by + intro m + cases m with + | BR_n_n => exact ⟨B, .id [], .id [], by decide, by decide, Or.inr (Or.inr (fun _ _ => rfl))⟩ + | AL_n_n => exact ⟨A, .id [], .id [], by decide, by decide, Or.inr (Or.inl (fun _ _ => rfl))⟩ + | CL_0_n => exact ⟨C, .id [], .id [0], by decide, by decide, Or.inr (Or.inl (fun _ _ => rfl))⟩ + | CR_n_n => exact ⟨C, .id [], .id [], by decide, by decide, Or.inr (Or.inr (fun _ _ => rfl))⟩ + + +/-! ## Stack Reduction Witness -/ + +/-- `target` reduces to a closed 2nd-order digit-stack transition system. -/ +theorem has_stack_reduction : HasStackReduction target := by + refine ⟨StackMode, 1, 0, encLeft, encRight, evalStackCfg, IsInStackSystem, + Or.inl ⟨rfl, rfl⟩, rfl, rfl, + encLeft_head, encRight_head, encLeft_not_surjective, encRight_not_surjective, + ⟨1, 1, 1, 1, 1, 1, 1, 1, by decide, by decide, by decide, by decide, by decide, + by decide, by decide, by decide, by decide, by decide, + fun _ _ _ => rfl, fun _ _ _ => rfl⟩, + ⟨[.BR_n_n, .AL_n_n, .CL_0_n, .CR_n_n], by decide, by intro m; cases m <;> decide⟩, + valid_stack_modes, + fun _ => Iff.rfl, + fun m L R => ⟨m, L, R, rfl⟩, + ⟨.BR_n_n, [(0, 0)], [(0, 0), (1, 0)], init_reaches_nontrivial, + by decide, ⟨(1, 0), by decide, by decide⟩⟩, + Or.inl ⟨.AL_n_n, .AL_n_n, (0, 0), id, ((0, 0) :: ·), + fun _ => Nat.le_succ _, step_AL_transfer⟩, + stack_system_closed⟩ + +end BusyBeaver.M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH diff --git a/BusyBeaver/BB6/Accelerations/M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean b/BusyBeaver/BB6/Accelerations/M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean new file mode 100644 index 00000000..2c0d789e --- /dev/null +++ b/BusyBeaver/BB6/Accelerations/M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean @@ -0,0 +1,1178 @@ +/- +Copyright (c) 2026 Google LLC. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +-/ +module + +public import BusyBeaver.Basic +public import BusyBeaver.BB6.Accelerations.Stack +public import BusyBeaver.Bridge + +/-! +# Busy Beaver Holdout `1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LE---` + +Formal `HasStackReduction` proof for the 6-state, 2-symbol Busy Beaver holdout +`1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LE---` +(https://wiki.bbchallenge.org/wiki/1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LE---, which redirects to the +wiki page of `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`). + +This machine is the transition table of `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` restarted from +its state `D` and brought to tree normal form: reading its states `A`, `B`, `C`, `D`, `E`, `F` as +the states `D`, `E`, `C`, `F`, `B`, `A` of that machine and mirroring the tape left/right, the two +transition tables coincide, so both machines run the same closed pair-stack system. The proof below +is the mechanical relabelling and mirroring of the proof in +[`1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`](./M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean); +only the blank-tape entry lemma `init_reaches_nontrivial` is specific to this start state. + + +## Hardness + +*Hardness class:* Wiki stack — trigger **as #85 (same table, started from its state `D`, +mirrored)**, growth as #85, shield as #85. + +*Verdict (heuristic; community analysis, see the wiki page):* same dynamics as +`1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` (#85); this is the start state analysed by @-d on the +wiki (halting path of length 108, $\approx 235{,}000$ right-side words explored). + +*Hazard:* as #85 (community estimate) + +*Simulated horizon:* as #85 + +*Why it is hard:* the proof is the relabelling and left/right mirror of the #85 proof with its own +blank-tape entry (7 raw steps) + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + +-/ + +@[expose] public section + +namespace BusyBeaver.M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH + +open SixState Turing Stack + +/-- The `(6, 2)` Turing machine in `ConjectureMachines.Machine` form. -/ +def machine : ConjectureMachines.Machine 6 2 := + load_rle_machine% "1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LE---" + +/-- The `(6, 2)` Turing machine in `BusyBeaver.Machine` form. -/ +abbrev target : Machine (Fin 2) (Fin 6) := + machine.toBB + +/-! ## Local Step Tactics and Pair-Stack Encodings -/ + +local macro "normalize" : tactic => `(tactic| ( + try simp only [ListBlank.append_cons, ListBlank.append_nil, + ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, + ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, + List.nil_append, List.cons_append, zeros_append_default, + Nat.mul_zero, Nat.mul_add, Nat.mul_one])) + +local macro "normalize_at" h:ident : tactic => `(tactic| ( + try simp only [ListBlank.append_cons, ListBlank.append_nil, + ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, + ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, + List.nil_append, List.cons_append, zeros_append_default, + Nat.mul_zero, Nat.mul_add, Nat.mul_one] at $h:ident)) + +local macro "step" : tactic => `(tactic| ( + try refine ReachesPlus.to_star ?_ + try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, + list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, + zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one] + refine ReachesPlus.head (by rfl) ?_ + simp only [Tape.move, Tape.write, + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, + list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, + zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one])) + +private def encLeft : List (ℕ × ℕ) → ListBlank (Fin 2) + | [] => default + | (a, b) :: L => (encLeft L <+ (([0] : List (Fin 2)) ^ (1 + b % 1))) <+ + (([1] : List (Fin 2)) ^ (1 * a + 1)) + +private def encRight : List (ℕ × ℕ) → ListBlank (Fin 2) + | [] => default + | (d, b) :: R => (([1] : List (Fin 2)) ^ (1 * d + 1)) +> ((([0] : List (Fin 2)) ^ (1 + b % 1)) +> + encRight R) + +@[simp] private theorem encLeft_nil : encLeft [] = default := rfl + +@[simp] private theorem encLeft_cons (a b : ℕ) (L : List (ℕ × ℕ)) : + encLeft ((a, b) :: L) = (encLeft L <+ (([0] : List (Fin 2)) ^ (1 + b % 1))) <+ + (([1] : List (Fin 2)) ^ (1 * a + 1)) := rfl + +@[simp] private theorem encRight_nil : encRight [] = default := rfl + +@[simp] private theorem encRight_cons (d b : ℕ) (R : List (ℕ × ℕ)) : + encRight ((d, b) :: R) = (([1] : List (Fin 2)) ^ (1 * d + 1)) +> + ((([0] : List (Fin 2)) ^ (1 + b % 1)) +> encRight R) := rfl + +private theorem encLeft_mod1 (a b : ℕ) (L : List (ℕ × ℕ)) : + encLeft ((a, b) :: L) = encLeft ((a, b % 1) :: L) := by + simp only [encLeft_cons, Nat.mod_mod] + +private theorem encLeft_succ (a b : ℕ) (L : List (ℕ × ℕ)) : + encLeft ((a + 1, b) :: L) = (1 : Fin 2) >> encLeft ((a, b) :: L) := by + simp only [encLeft_cons] + rw [show 1 * (a + 1) + 1 = 1 + (1 * a + 1) by omega, list_pow_add, ListBlank.append_assoc] + rfl + +private theorem encLeft_d0_s0 (L : List (ℕ × ℕ)) : + encLeft ((0, 0) :: L) = (1 : Fin 2) >> (0 : Fin 2) >> encLeft L := rfl + +private theorem encLeft_d1_s0 (L : List (ℕ × ℕ)) : + encLeft ((1, 0) :: L) = (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> encLeft L := rfl + +private theorem encLeft_run_s0 (a : ℕ) (L : List (ℕ × ℕ)) : + encLeft ((a, 0) :: L) = (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> + encLeft L) := by + induction a with + | zero => rfl + | succ k ih => rw [encLeft_succ, ih]; normalize + +private theorem encRight_mod1 (a b : ℕ) (R : List (ℕ × ℕ)) : + encRight ((a, b) :: R) = encRight ((a, b % 1) :: R) := by + simp only [encRight_cons, Nat.mod_mod] + +private theorem encRight_succ (a b : ℕ) (R : List (ℕ × ℕ)) : + encRight ((a + 1, b) :: R) = (1 : Fin 2) >> encRight ((a, b) :: R) := by + simp only [encRight_cons] + rw [show 1 * (a + 1) + 1 = 1 + (1 * a + 1) by omega, list_pow_add, ListBlank.append_assoc] + rfl + +private theorem encRight_d0_s0 (R : List (ℕ × ℕ)) : + encRight ((0, 0) :: R) = (1 : Fin 2) >> (0 : Fin 2) >> encRight R := rfl + +private theorem encRight_d1_s0 (R : List (ℕ × ℕ)) : + encRight ((1, 0) :: R) = (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> encRight R := rfl + +private theorem encRight_run_s0 (a : ℕ) (R : List (ℕ × ℕ)) : + encRight ((a, 0) :: R) = (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> + encRight R) := by + induction a with + | zero => rfl + | succ k ih => rw [encRight_succ, ih]; normalize + +@[simp] private theorem encLeft_cons_one (L : List (ℕ × ℕ)) : + (1 : Fin 2) >> encLeft L = encLeft (bumpPairHead L) := by + rcases L with _ | ⟨⟨a, b⟩, L'⟩ + · simp [bumpPairHead, encLeft] + · exact (encLeft_succ a b L').symm + +@[simp] private theorem encRight_cons_one (R : List (ℕ × ℕ)) : + (1 : Fin 2) >> encRight R = encRight (bumpPairHead R) := by + rcases R with _ | ⟨⟨a, b⟩, R'⟩ + · simp [bumpPairHead, encRight] + · exact (encRight_succ a b R').symm + +local macro "finish" : tactic => `(tactic| ( + refine ⟨0, ?_⟩ + try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', + encRight_nil, encLeft_nil, ListBlank.append_cons, ListBlank.append_nil, + ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, + ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, + List.nil_append, List.cons_append, zeros_append_default, + Nat.mul_zero, Nat.mul_add, Nat.mul_one] + simp only [encRight_cons_one, encLeft_cons_one, multiStep_zero] + try rfl)) + +local macro "execute" n:num : tactic => `(tactic| ( + iterate $n step + finish)) + +private def cfg_CL_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := + (encLeft L) <{{C}} (encRight R) + +private def cfg_BR_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := + (encLeft L) {{B}}> (encRight R) + +private def cfg_AR_0_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := + ([0] +> encLeft L) {{A}}> (encRight R) + +private def cfg_AL_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := + (encLeft L) <{{A}} (encRight R) + +private inductive StackMode + | CL_n_n + | BR_n_n + | AR_0_n + | AL_n_n + deriving DecidableEq + +private def evalStackCfg : StackMode → List (ℕ × ℕ) → List (ℕ × ℕ) → Cfg (Fin 2) (Fin 6) + | .CL_n_n, L, R => cfg_CL_n_n L R + | .BR_n_n, L, R => cfg_BR_n_n L R + | .AR_0_n, L, R => cfg_AR_0_n L R + | .AL_n_n, L, R => cfg_AL_n_n L R + +private def IsInStackSystem (cfg : Cfg (Fin 2) (Fin 6)) : Prop := + ∃ m L R, cfg = evalStackCfg m L R + +/-! ## Inner Token System -/ + +private def encTokens : List ℕ → List (ℕ × ℕ) → ListBlank (Fin 2) + | [], R3 => encRight R3 + | k :: K, R3 => (([1] : List (Fin 2)) ^ k) +> ((0 : Fin 2) >> encTokens K R3) + +@[simp] private theorem encTokens_nil (R3 : List (ℕ × ℕ)) : encTokens [] R3 = encRight R3 := rfl + +@[simp] private theorem encTokens_zero (K : List ℕ) (R3 : List (ℕ × ℕ)) : + encTokens (0 :: K) R3 = (0 : Fin 2) >> encTokens K R3 := rfl + +@[simp] private theorem encTokens_succ (k : ℕ) (K : List ℕ) (R3 : List (ℕ × ℕ)) : + encTokens ((k + 1) :: K) R3 = (1 : Fin 2) >> encTokens (k :: K) R3 := by + simp only [encTokens, list_pow_succ, List.cons_append, List.nil_append, ListBlank.append_cons] + +private def encLeftNat : List ℕ → ListBlank (Fin 2) + | [] => default + | a :: L => (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> encLeftNat L) + +@[simp] private theorem encLeftNat_nil : encLeftNat [] = default := rfl + +@[simp] private theorem encLeftNat_zero (L : List ℕ) : + encLeftNat (0 :: L) = (1 : Fin 2) >> (0 : Fin 2) >> encLeftNat L := rfl + +@[simp] private theorem encLeftNat_succ (a : ℕ) (L : List ℕ) : + encLeftNat ((a + 1) :: L) = (1 : Fin 2) >> encLeftNat (a :: L) := by + simp only [encLeftNat, list_pow_succ, List.cons_append, List.nil_append, ListBlank.append_cons] + +private theorem encLeft_eq_nat (L : List (ℕ × ℕ)) : encLeft L = encLeftNat (L.map Prod.fst) := by + induction L with + | nil => rfl + | cons p L ih => + rcases p with ⟨a, b⟩ + rw [encLeft_mod1 a b L, Nat.mod_one b, encLeft_run_s0 a L, ih] + rfl + +private theorem encLeftNat_eq (L : List ℕ) : encLeftNat L = encLeft (L.map (fun x => (x, 0))) := + by + induction L with + | nil => rfl + | cons a L ih => + simp only [List.map_cons, encLeftNat, ih, encLeft_run_s0] + +@[simp] private theorem encLeftNat_cons_one (L : List ℕ) : + (1 : Fin 2) >> encLeftNat L = encLeftNat (bumpHead L) := by + rcases L with _ | ⟨a, L'⟩ + · simp [bumpHead, encLeftNat] + · simp [bumpHead] + +local macro "tstep" : tactic => `(tactic| ( + try refine ReachesPlus.to_star ?_ + try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', + encTokens_nil, encTokens_zero, encTokens_succ, + encLeftNat_nil, encLeftNat_zero, encLeftNat_succ, + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, + list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, + zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one] + refine ReachesPlus.head (by rfl) ?_ + simp only [Tape.move, Tape.write, encTokens_nil, encTokens_zero, encTokens_succ, + encLeftNat_nil, encLeftNat_zero, encLeftNat_succ, + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, + list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, + zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one])) + +local macro "tfinish" : tactic => `(tactic| ( + refine ⟨0, ?_⟩ + try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', + encTokens_nil, encTokens_zero, encTokens_succ, + encLeftNat_nil, encLeftNat_zero, encLeftNat_succ, encRight_nil, encLeft_nil, + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, + list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, + zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one] + simp only [encLeftNat_cons_one, encRight_cons_one, encLeft_cons_one, multiStep_zero] + try rfl)) + +local macro "texecute" n:num : tactic => `(tactic| ( + iterate $n tstep + tfinish)) + +private def tok_CL (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := + (encLeftNat L) <{{C}} (encTokens K R3) + +private def tok_AL (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := + (encLeftNat L) <{{A}} (encTokens K R3) + +private def tok_BR (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := + (encLeftNat L) {{B}}> (encTokens K R3) + +private theorem tok_BR_exit_zero (R3 : List (ℕ × ℕ)) (L : List ℕ) : + (tok_BR [0] R3 L) [target]⊢⁺ cfg_CL_n_n (L.map (fun x => (x, 0))) (bumpPairHead R3) := by + unfold tok_BR cfg_CL_n_n + rw [← encLeftNat_eq L] + texecute 1 + +private theorem tok_BR_0_cons (k1 : ℕ) (K2 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : + (tok_BR (0 :: k1 :: K2) R3 L) [target]⊢⁺ tok_CL ((k1 + 1) :: K2) R3 L := by + unfold tok_BR tok_CL; texecute 1 + +private theorem tok_BR_1 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : + (tok_BR (1 :: K1) R3 L) [target]⊢⁺ tok_BR K1 R3 (0 :: L) := by + unfold tok_BR; texecute 2 + +private theorem tok_BR_2 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : + (tok_BR (2 :: K1) R3 (0 :: L)) [target]⊢⁺ tok_BR K1 R3 (0 :: 1 :: L) := by + unfold tok_BR; texecute 7 + +private theorem tok_BR_add3 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : + (tok_BR ((k + 3) :: K1) R3 L) [target]⊢⁺ tok_AL (2 :: k :: K1) R3 L := by + unfold tok_BR tok_AL; texecute 5 + +private theorem tok_AL_nil_8 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_AL (2 :: K1) R3 []) [target]⊢⁺ tok_BR K1 R3 [0, 1] := by + unfold tok_AL tok_BR; texecute 8 + +private theorem tok_AL_zero (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L1 : List ℕ) : + (tok_AL (2 :: K1) R3 (0 :: L1)) [target]⊢⁺ tok_AL (2 :: 1 :: K1) R3 L1 := by + unfold tok_AL; texecute 4 + +private theorem tok_AL_1_nil_28 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_AL (2 :: K1) R3 [1]) [target]⊢⁺ tok_BR (1 :: K1) R3 [0, 0, 0, 1] := by + unfold tok_AL tok_BR; texecute 28 + +private theorem tok_AL_succ (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L1 : List ℕ) : + (tok_AL (2 :: K1) R3 ((a + 1) :: L1)) [target]⊢⁺ tok_CL (1 :: 1 :: K1) R3 (a :: L1) := by + unfold tok_AL tok_CL; texecute 3 + +private theorem tok_CL_1_nil_9 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_CL (1 :: K1) R3 []) [target]⊢⁺ tok_BR K1 R3 [0, 1] := by + unfold tok_CL tok_BR; texecute 9 + +private theorem tok_CL_add2_nil_21 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_CL ((k + 2) :: K1) R3 []) [target]⊢⁺ tok_BR (k :: K1) R3 [0, 0, 1] := by + unfold tok_CL tok_BR; texecute 21 + +private theorem tok_CL_zero (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L1 : List ℕ) : + (tok_CL (k :: K1) R3 (0 :: L1)) [target]⊢⁺ tok_CL ((k + 2) :: K1) R3 L1 := by + unfold tok_CL; texecute 2 + +private theorem tok_CL_1_nil_33 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_CL (k :: K1) R3 [1]) [target]⊢⁺ tok_BR (k :: K1) R3 [0, 0, 0, 1] := by + unfold tok_CL tok_BR; texecute 33 + +private theorem tok_CL_1_0 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L2 : List ℕ) : + (tok_CL (k :: K1) R3 (1 :: 0 :: L2)) [target]⊢⁺ tok_CL (1 :: (k + 3) :: K1) R3 L2 := by + unfold tok_CL; texecute 5 + +private theorem tok_CL_1_1_nil_25 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_CL (k :: K1) R3 [1, 1]) [target]⊢⁺ tok_BR (k :: K1) R3 [0, 0, 1] := by + unfold tok_CL tok_BR; texecute 25 + +private theorem tok_CL_1_1_cons_25 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (c : ℕ) (L3 : List ℕ) : + (tok_CL (k :: K1) R3 (1 :: 1 :: c :: L3)) [target]⊢⁺ + tok_BR (k :: K1) R3 (0 :: 0 :: (c + 2) :: L3) := by + unfold tok_CL tok_BR; texecute 25 + +private theorem tok_CL_1_add2 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L2 : List ℕ) : + (tok_CL (k :: K1) R3 (1 :: (a + 2) :: L2)) [target]⊢⁺ tok_AL (2 :: 1 :: k :: K1) R3 (a :: L2) := + by + unfold tok_CL tok_AL; texecute 15 + +private theorem tok_CL_add2_halts (K : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L1 : List ℕ) : + ∃ cfg_, ((tok_CL K R3 ((a + 2) :: L1)) [target]⊢⁺ cfg_) ∧ + (step target cfg_).isNone := by + refine ⟨(encLeftNat (a :: L1)) <{{F}} ((1 : Fin 2) >> (1 : Fin 2) >> encTokens K R3), ?_, + by simp only [encLeftNat]; bb_halt⟩ + unfold tok_CL; texecute 2 + +/-! ## Weight and Lexicographic Measure -/ + +@[simp] +private def predNat : ℕ → ℕ + | 0 => 0 + | a + 1 => a + +@[simp] +private def wtL : List ℕ → ℕ + | [] => 0 + | [a] => predNat a + | a :: b :: L => a + wtL (b :: L) + +@[simp] private theorem predNat_succ (a : ℕ) : predNat (a + 1) = a := rfl + +@[simp] private theorem wtL_single (a : ℕ) : wtL [a] = predNat a := rfl + +@[simp] private theorem wtL_cons_cons (a b : ℕ) (L : List ℕ) : wtL (a :: b :: L) = + a + wtL (b :: L) := rfl + +@[simp] private theorem wtL_zero_cons (L : List ℕ) : wtL (0 :: L) = wtL L := by + rcases L with _ | ⟨b, L'⟩ + · rfl + · exact Nat.zero_add (wtL (b :: L')) + +private theorem wtL_1_1_cons (c : ℕ) (L3 : List ℕ) : wtL ((c + 2) :: L3) ≤ wtL (1 :: 1 :: c :: L3) + := by + rcases L3 with _ | ⟨d, L4⟩ + · rcases c with _ | c' + · decide + · simp only [wtL_cons_cons, wtL_single, predNat_succ]; omega + · simp only [wtL_cons_cons]; omega + +private theorem wtL_1_add2 (b : ℕ) (L2 : List ℕ) : wtL (b :: L2) + 2 ≤ wtL (1 :: (b + 2) :: L2) := + by + rcases L2 with _ | ⟨d, L3⟩ + · rcases b with _ | b' + · decide + · simp only [wtL_cons_cons, wtL_single, predNat_succ]; omega + · simp only [wtL_cons_cons]; omega + +@[simp] +private def sumL : List ℕ → ℕ + | [] => 0 + | a :: L => a + sumL L + +@[simp] +private def countNonOne : List ℕ → ℕ + | [] => 0 + | 0 :: K => 1 + countNonOne K + | 1 :: K => countNonOne K + | (_ + 2) :: K => 1 + countNonOne K + +@[simp] private theorem countNonOne_zero (K : List ℕ) : countNonOne (0 :: K) = 1 + countNonOne K := + rfl + +@[simp] private theorem countNonOne_one (K : List ℕ) : countNonOne (1 :: K) = countNonOne K := rfl + +@[simp] private theorem countNonOne_add2 (k : ℕ) (K : List ℕ) : countNonOne ((k + 2) :: K) = + 1 + countNonOne K := rfl + +private theorem countNonOne_cons_le (k : ℕ) (K : List ℕ) : countNonOne (k :: K) ≤ 1 + countNonOne K + := by + rcases k with _ | _ | k' + · exact Nat.le_refl _ + · exact Nat.le_add_left _ 1 + · exact Nat.le_refl _ + +private theorem le_countNonOne_cons (k : ℕ) (K : List ℕ) : countNonOne K ≤ countNonOne (k :: K) := + by + rcases k with _ | _ | k' + · exact Nat.le_add_left _ 1 + · exact Nat.le_refl _ + · exact Nat.le_add_left _ 1 + +@[simp] +private def scores : List ℕ → List (ℕ × ℕ) + | [] => [] + | 0 :: K => scores K ++ [(K.length, 0)] + | 1 :: K => scores K + | (k + 2) :: K => scores K ++ [(K.length, k + 2)] + +@[simp] private theorem scores_zero (K : List ℕ) : scores (0 :: K) = scores K ++ [(K.length, 0)] := + rfl + +@[simp] private theorem scores_one (K : List ℕ) : scores (1 :: K) = scores K := rfl + +@[simp] private theorem scores_add2 (k : ℕ) (K : List ℕ) : scores ((k + 2) :: K) = scores K ++ + [(K.length, k + 2)] := rfl + +private theorem scores_cons_ext (k : ℕ) (K : List ℕ) : ∃ ext, scores (k :: K) = scores K ++ ext := + by + rcases k with _ | _ | k' + · exact ⟨[(K.length, 0)], rfl⟩ + · exact ⟨[], (List.append_nil (scores K)).symm⟩ + · exact ⟨[(K.length, k' + 2)], rfl⟩ + +private theorem scores_length (K : List ℕ) : (scores K).length = countNonOne K := by + induction K with + | nil => rfl + | cons k K ih => + rcases k with _ | _ | k' + · simp only [scores_zero, countNonOne_zero, List.length_append, List.length_singleton, + ih]; omega + · exact ih + · dsimp only [scores, countNonOne] + rw [List.length_append, List.length_singleton, ih] + omega + +private def PairLt (p q : ℕ × ℕ) : Prop := + p.1 < q.1 ∨ (p.1 = q.1 ∧ p.2 < q.2) + +private inductive BoundedLex : ℕ → List (ℕ × ℕ) → List (ℕ × ℕ) → Prop + | head {m : ℕ} {x y : ℕ × ℕ} {xs ys : List (ℕ × ℕ)} : + PairLt x y → BoundedLex (m + 1) (x :: xs) (y :: ys) + | cons {m : ℕ} {z : ℕ × ℕ} {xs ys : List (ℕ × ℕ)} : + BoundedLex m xs ys → BoundedLex (m + 1) (z :: xs) (z :: ys) + +private theorem boundedLex_append (P : List (ℕ × ℕ)) {m : ℕ} {x y : ℕ × ℕ} (rest ext : List (ℕ × ℕ)) + (hxy : PairLt x y) (hlen : P.length < m) : + BoundedLex m (P ++ (x :: ext)) (P ++ (y :: rest)) := by + induction P generalizing m with + | nil => + rcases m with _ | m' + · omega + · exact BoundedLex.head hxy + | cons z P' ih => + rcases m with _ | m' + · simp at hlen + · simp only [List.cons_append] + exact BoundedLex.cons (ih (by simp at hlen; omega)) + +private theorem boundedLex_acc_snd (m a : ℕ) + (ih_m : ∀ xs, Acc (BoundedLex m) xs) + (ih_a : ∀ a' < a, ∀ b ys, Acc (BoundedLex (m + 1)) ((a', b) :: ys)) + (n : ℕ) : + ∀ b ≤ n, ∀ ys, Acc (BoundedLex (m + 1)) ((a, b) :: ys) := by + induction n with + | zero => + intro b hb ys + have hb0 : b = 0 := by omega + subst hb0 + induction (ih_m ys) with + | intro ys _ ih_ys => + refine Acc.intro ((a, 0) :: ys) (fun zs h => ?_) + cases h with + | @head _ x _ xs _ hlt => + rcases x with ⟨a', b'⟩ + rcases hlt with ha' | ⟨rfl, hb'⟩ + · exact ih_a a' ha' b' xs + · dsimp at hb'; omega + | cons hsub => exact ih_ys _ hsub + | succ n ih_n => + intro b hb ys + rcases Nat.of_le_succ hb with hle | rfl + · exact ih_n b hle ys + · induction (ih_m ys) with + | intro ys _ ih_ys => + refine Acc.intro ((a, n + 1) :: ys) (fun zs h => ?_) + cases h with + | @head _ x _ xs _ hlt => + rcases x with ⟨a', b'⟩ + rcases hlt with ha' | ⟨rfl, hb'⟩ + · exact ih_a a' ha' b' xs + · dsimp at hb'; exact ih_n b' (by omega) xs + | cons hsub => exact ih_ys _ hsub + +private theorem boundedLex_acc_fst (m : ℕ) (ih_m : ∀ xs, Acc (BoundedLex m) xs) (n : ℕ) : + ∀ a ≤ n, ∀ b ys, Acc (BoundedLex (m + 1)) ((a, b) :: ys) := by + induction n with + | zero => + intro a ha b ys + have ha0 : a = 0 := by omega + subst ha0 + exact boundedLex_acc_snd m 0 ih_m (fun _ hlt => by omega) b b (Nat.le_refl b) ys + | succ n ih_n => + intro a ha b ys + rcases Nat.of_le_succ ha with hle | rfl + · exact ih_n a hle b ys + · exact boundedLex_acc_snd m (n + 1) ih_m (fun a' hlt => ih_n a' (by omega)) b b (Nat.le_refl b) + ys + +private theorem boundedLex_acc (m : ℕ) (xs : List (ℕ × ℕ)) : Acc (BoundedLex m) xs := by + induction m generalizing xs with + | zero => exact Acc.intro xs (fun _ h => nomatch h) + | succ m ih_m => + rcases xs with _ | ⟨⟨a, b⟩, ys⟩ + · exact Acc.intro [] (fun _ h => nomatch h) + · exact boundedLex_acc_fst m ih_m a a (Nat.le_refl a) b ys + +/-! ## Bounce Lemmas for `CL` and `AL` -/ + +private theorem bounce_len (R3 : List (ℕ × ℕ)) (n : ℕ) : + ∀ (L : List ℕ), 2 * sumL L + L.length ≤ n → + (∀ (k0 : ℕ) (K_acc : List ℕ), + (∃ cfg_, ((tok_CL ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ + (∃ K_out L_out, ((tok_CL ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ + tok_BR K_out R3 (0 :: L_out)) ∧ + (∃ ext, scores K_out = scores K_acc ++ ext) ∧ + (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∨ + (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + 1 + wtL L ∧ + (k0 ≠ 0 → ∃ d ext, scores K_out = scores K_acc ++ ((K_acc.length, d) :: ext)))))) ∧ + (∀ (K_acc : List ℕ), + (∃ cfg_, ((tok_AL (2 :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ + (∃ K_out L_out, ((tok_AL (2 :: K_acc) R3 L) [target]⊢⁺ tok_BR K_out R3 (0 :: L_out)) ∧ + countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∧ + (∃ ext, scores K_out = scores K_acc ++ ext))) := by + induction n with + | zero => + intro L hlen + rcases L with _ | ⟨a, L1⟩ + · refine ⟨fun k0 K_acc => ?_, fun K_acc => ?_⟩ + · rcases k0 with _ | k' + · refine Or.inr ⟨K_acc, [1], tok_CL_1_nil_9 K_acc R3, ⟨[], by simp⟩, Or.inl (by simp)⟩ + · rcases k' with _ | m + · refine Or.inr ⟨0 :: K_acc, [0, 1], tok_CL_add2_nil_21 0 K_acc R3, ⟨[(K_acc.length, 0)], + by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨0, [], by simp⟩⟩⟩ + · rcases m with _ | m' + · refine Or.inr ⟨1 :: K_acc, [0, 1], tok_CL_add2_nil_21 1 K_acc R3, ⟨[], by simp⟩, + Or.inl (by simp)⟩ + · refine Or.inr ⟨(m' + 2) :: K_acc, [0, 1], tok_CL_add2_nil_21 (m' + 2) K_acc R3, + ⟨[(K_acc.length, m' + 2)], by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨m' + 2, [], + by simp⟩⟩⟩ + · exact Or.inr ⟨K_acc, [1], tok_AL_nil_8 K_acc R3, by simp, ⟨[], by simp⟩⟩ + · simp at hlen + | succ n ih_n => + intro L hlen + rcases Nat.of_le_succ hlen with hle | heq + · exact ih_n L hle + · refine ⟨fun k0 K_acc => ?_, fun K_acc => ?_⟩ + · rcases L with _ | ⟨a, L1⟩ + · simp at heq + · rcases a with _ | _ | a' + · have hstep1 := tok_CL_zero (k0 + 1) K_acc R3 L1 + rcases (ih_n L1 (by simp at heq ⊢; omega)).1 (k0 + 2) K_acc with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hext, hbr⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, hext, ?_⟩ + rcases hbr with hlt | ⟨hle, hd⟩ + · exact Or.inl (by simpa using hlt) + · exact Or.inr ⟨by simpa using hle, fun _ => hd (by omega)⟩ + · rcases L1 with _ | ⟨b, L2⟩ + · rcases k0 with _ | k' + · refine Or.inr ⟨1 :: K_acc, [0, 0, 1], tok_CL_1_nil_33 1 K_acc R3, ⟨[], by simp⟩, + Or.inl (by simp)⟩ + · refine Or.inr ⟨(k' + 2) :: K_acc, [0, 0, 1], tok_CL_1_nil_33 (k' + 2) K_acc R3, + ⟨[(K_acc.length, k' + 2)], by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨k' + 2, [], + by simp⟩⟩⟩ + · rcases b with _ | _ | b' + · have hstep1 := tok_CL_1_0 (k0 + 1) K_acc R3 L2 + rcases (ih_n L2 (by simp at heq ⊢; omega)).1 0 ((k0 + 4) :: K_acc) with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · have hsc' : scores K_out = scores K_acc ++ ((K_acc.length, k0 + 4) :: ext) := by + simpa [scores_add2 (k0 + 2) K_acc, List.append_assoc] using hsc + refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ⟨(K_acc.length, + k0 + 4) :: ext, hsc'⟩, ?_⟩ + have hwt : wtL ((0 + 1) :: 0 :: L2) = 1 + wtL L2 := by simp + have hcnt : countNonOne ((k0 + 4) :: K_acc) = 1 + countNonOne K_acc := + countNonOne_add2 (k0 + 2) K_acc + rcases hbr with hlt | ⟨hle, _⟩ + · exact Or.inl (by omega) + · exact Or.inr ⟨by omega, fun _ => ⟨k0 + 4, ext, hsc'⟩⟩ + · rcases L2 with _ | ⟨c, L3⟩ + · have hstep := tok_CL_1_1_nil_25 (k0 + 1) K_acc R3 + have hcnt := countNonOne_cons_le (k0 + 1) K_acc + refine Or.inr ⟨(k0 + 1) :: K_acc, [0, 1], hstep, scores_cons_ext (k0 + 1) K_acc, + Or.inl ?_⟩ + simp at hcnt ⊢; omega + · have hstep := tok_CL_1_1_cons_25 (k0 + 1) K_acc R3 c L3 + have hwt : wtL ((c + 2) :: L3) ≤ wtL ((0 + 1) :: (0 + 1) :: c :: L3) := + wtL_1_1_cons c L3 + rcases k0 with _ | k' + · refine Or.inr ⟨1 :: K_acc, 0 :: (c + 2) :: L3, hstep, ⟨[], by simp⟩, Or.inl ?_⟩ + simp only [countNonOne_one, wtL_zero_cons]; omega + · refine Or.inr ⟨(k' + 2) :: K_acc, 0 :: (c + 2) :: L3, hstep, ⟨[(K_acc.length, + k' + 2)], by simp⟩, Or.inr ⟨?_, fun _ => ⟨k' + 2, [], by simp⟩⟩⟩ + simp only [countNonOne_add2, wtL_zero_cons]; omega + · have hstep1 := tok_CL_1_add2 (k0 + 1) K_acc R3 b' L2 + rcases (ih_n (b' :: L2) (by simp at heq ⊢; omega)).2 (1 :: (k0 + 1) :: K_acc) with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · obtain ⟨ext0, hsc0⟩ := scores_cons_ext (k0 + 1) K_acc + have hcnt := countNonOne_cons_le (k0 + 1) K_acc + have hwt : wtL (b' :: L2) + 2 ≤ wtL ((0 + 1) :: (b' + 1 + 1) :: L2) := + wtL_1_add2 b' L2 + refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ⟨ext0 ++ ext, + by simp [hsc, hsc0, List.append_assoc]⟩, Or.inl ?_⟩ + simp only [countNonOne_one] at hle + omega + · exact Or.inl (tok_CL_add2_halts ((k0 + 1) :: K_acc) R3 a' L1) + · rcases L with _ | ⟨a, L1⟩ + · simp at heq + · rcases a with _ | a' + · have hstep1 := tok_AL_zero K_acc R3 L1 + rcases (ih_n L1 (by simp at heq ⊢; omega)).2 (1 :: K_acc) with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · exact Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, by simpa using hle, ⟨ext, + by simpa using hsc⟩⟩ + · rcases L1 with _ | ⟨b, L2⟩ + · rcases a' with _ | a'' + · exact Or.inr ⟨1 :: K_acc, [0, 0, 1], tok_AL_1_nil_28 K_acc R3, by simp, ⟨[], + by simp⟩⟩ + · have hstep1 := tok_AL_succ K_acc R3 (a'' + 1) [] + rcases (ih_n [a'' + 1] (by simp at heq ⊢; omega)).1 0 (1 :: K_acc) with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ?_, ⟨ext, + by simpa using hsc⟩⟩ + rcases hbr with hlt | ⟨hle, _⟩ + · simp at hlt ⊢; omega + · simp at hle ⊢; omega + · have hstep1 := tok_AL_succ K_acc R3 a' (b :: L2) + rcases (ih_n (a' :: b :: L2) (by simp at heq ⊢; omega)).1 0 (1 :: K_acc) with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ?_, ⟨ext, + by simpa using hsc⟩⟩ + rcases hbr with hlt | ⟨hle, _⟩ + · simp at hlt ⊢; omega + · simp at hle ⊢; omega + +private theorem bounce_CL (R3 : List (ℕ × ℕ)) (k0 : ℕ) (K_acc : List ℕ) (L : List ℕ) : + (∃ cfg_, ((tok_CL ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ + (∃ K_out L_out, ((tok_CL ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ tok_BR K_out R3 (0 :: L_out)) ∧ + (∃ ext, scores K_out = scores K_acc ++ ext) ∧ + (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∨ + (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + 1 + wtL L ∧ + (k0 ≠ 0 → ∃ d ext, scores K_out = scores K_acc ++ ((K_acc.length, d) :: ext))))) := + (bounce_len R3 (2 * sumL L + L.length) L (Nat.le_refl _)).1 k0 K_acc + +private theorem bounce_AL (R3 : List (ℕ × ℕ)) (K_acc : List ℕ) (L : List ℕ) : + (∃ cfg_, ((tok_AL (2 :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ + (∃ K_out L_out, ((tok_AL (2 :: K_acc) R3 L) [target]⊢⁺ tok_BR K_out R3 (0 :: L_out)) ∧ + countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∧ + (∃ ext, scores K_out = scores K_acc ++ ext)) := + (bounce_len R3 (2 * sumL L + L.length) L (Nat.le_refl _)).2 K_acc + +/-! ## Token System Termination -/ + +private theorem bl_step_macro_len (R3 : List (ℕ × ℕ)) (n : ℕ) : + ∀ (K : List ℕ), K.length ≤ n → ∀ (L : List ℕ), + (∃ cfg_, ((tok_BR K R3 (0 :: L)) [target]⊢* cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone)) ∨ + (∃ K' L', ((tok_BR K R3 (0 :: L)) [target]⊢⁺ tok_BR K' R3 (0 :: L')) ∧ + countNonOne K' + wtL L' < countNonOne K + wtL L) ∨ + (∃ K' L' P x y rest ext, ((tok_BR K R3 (0 :: L)) [target]⊢⁺ tok_BR K' R3 (0 :: L')) ∧ + countNonOne K' + wtL L' = countNonOne K + wtL L ∧ PairLt x y ∧ + scores K = P ++ (y :: rest) ∧ scores K' = P ++ (x :: ext)) := by + induction n with + | zero => + intro K hlen L + cases K with + | nil => + refine Or.inl ⟨cfg_BR_n_n ((0 :: L).map (fun x => (x, 0))) R3, ⟨0, ?_⟩, + Or.inl ⟨.BR_n_n, (0 :: L).map (fun x => (x, 0)), R3, rfl⟩⟩ + unfold tok_BR cfg_BR_n_n + rw [encTokens_nil, encLeftNat_eq] + rfl + | cons _ _ => simp at hlen + | succ n ih_n => + intro K hlen L + rcases K with _ | ⟨k1, K1⟩ + · refine Or.inl ⟨cfg_BR_n_n ((0 :: L).map (fun x => (x, 0))) R3, ⟨0, ?_⟩, + Or.inl ⟨.BR_n_n, (0 :: L).map (fun x => (x, 0)), R3, rfl⟩⟩ + unfold tok_BR cfg_BR_n_n + rw [encTokens_nil, encLeftNat_eq] + rfl + · rcases k1 with _ | _ | _ | k' + · rcases K1 with _ | ⟨k2, K2⟩ + · exact Or.inl ⟨cfg_CL_n_n ((0 :: L).map (fun x => (x, 0))) (bumpPairHead R3), + ReachesPlus.to_star (tok_BR_exit_zero R3 (0 :: L)), + Or.inl ⟨.CL_n_n, (0 :: L).map (fun x => (x, 0)), bumpPairHead R3, rfl⟩⟩ + · have hstep1 := + ReachesPlus.trans (tok_BR_0_cons k2 K2 R3 (0 :: L)) (tok_CL_zero (k2 + 1) K2 R3 L) + rcases bounce_CL R3 (k2 + 2) K2 L with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, _, hbr⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans hstep1 hstep2), Or.inr hhalt⟩ + · have hstep := ReachesPlus.trans hstep1 hstep2 + rcases hbr with hlt | ⟨hle, hd⟩ + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + have hcnt := le_countNonOne_cons k2 K2 + simp only [countNonOne_zero]; omega + · rcases k2 with _ | _ | k2' + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [countNonOne_zero]; omega + · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [Nat.zero_add, countNonOne_zero, countNonOne_one]; omega + · obtain ⟨d, ext, hsc_out⟩ := hd (by omega) + refine Or.inr (Or.inr ⟨K_out, L_out, scores K2, (K2.length, d), ((1 :: K2).length, + 0), + [], ext, hstep, by simp only [Nat.zero_add, countNonOne_zero, + countNonOne_one]; omega, + Or.inl (by simp), by simp, hsc_out⟩) + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [countNonOne_zero, countNonOne_add2]; omega + · have hstep1 := tok_BR_1 K1 R3 (0 :: L) + rcases ih_n K1 (by simp at hlen; omega) (0 :: L) with + ⟨cfg_, hstep2, hsys⟩ | + ⟨K', L', hstep2, hlt⟩ | + ⟨K', L', P, x, y, rest, ext, hstep2, heq, hxy, hsc1, hsc2⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep1 hstep2), hsys⟩ + · refine Or.inr (Or.inl ⟨K', L', ReachesPlus.trans hstep1 hstep2, ?_⟩) + simpa using hlt + · refine Or.inr (Or.inr ⟨K', L', P, x, y, rest, ext, ReachesPlus.trans hstep1 hstep2, + by simpa using heq, hxy, by simpa using hsc1, hsc2⟩) + · have hstep1 := tok_BR_2 K1 R3 L + rcases L with _ | ⟨a, L1⟩ + · refine Or.inr (Or.inl ⟨K1, [1], hstep1, ?_⟩) + simp + · have hwt1 : wtL (1 :: a :: L1) = 1 + wtL (a :: L1) := by simp + rcases ih_n K1 (by simp at hlen; omega) (1 :: a :: L1) with + ⟨cfg_, hstep2, hsys⟩ | + ⟨K', L', hstep2, hlt⟩ | + ⟨K', L', P, x, y, rest, ext, hstep2, heq, hxy, hsc1, hsc2⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep1 hstep2), hsys⟩ + · refine Or.inr (Or.inl ⟨K', L', ReachesPlus.trans hstep1 hstep2, ?_⟩) + simp only [countNonOne_add2 0 K1]; omega + · refine Or.inr (Or.inr ⟨K', L', P, x, y, rest ++ [(K1.length, 2)], ext, + ReachesPlus.trans hstep1 hstep2, by simp only [countNonOne_add2 0 K1]; omega, + hxy, by simp [hsc1, List.append_assoc], hsc2⟩) + · have hstep1 := + ReachesPlus.trans (tok_BR_add3 k' K1 R3 (0 :: L)) (tok_AL_zero (k' :: K1) R3 L) + rcases bounce_AL R3 (1 :: k' :: K1) L with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans hstep1 hstep2), Or.inr hhalt⟩ + · have hstep := ReachesPlus.trans hstep1 hstep2 + simp only [countNonOne_one, scores_one] at hle hsc + rcases k' with _ | _ | k'' + · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [countNonOne_zero, countNonOne_add2] at hlt' ⊢; omega + · refine Or.inr (Or.inr ⟨K_out, L_out, scores K1, (K1.length, 0), (K1.length, 3), + [], ext, hstep, by simp only [countNonOne_zero, countNonOne_add2] at heq' ⊢; omega, + Or.inr ⟨rfl, by simp⟩, by simp, + by simpa [List.append_assoc] using hsc⟩) + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [Nat.zero_add, countNonOne_one, countNonOne_add2] at hle ⊢; omega + · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [countNonOne_add2] at hlt' ⊢; omega + · refine Or.inr (Or.inr ⟨K_out, L_out, scores K1, (K1.length, k'' + 2), (K1.length, + k'' + 5), + [], ext, hstep, by simp only [countNonOne_add2] at heq' ⊢; omega, + Or.inr ⟨rfl, by simp⟩, by simp, + by simpa [List.append_assoc] using hsc⟩) + +private theorem bl_terminates_acc (R3 : List (ℕ × ℕ)) (m : ℕ) + (ih_m : ∀ (K : List ℕ) (L : List ℕ), + countNonOne K + wtL L < m → + ∃ cfg_, ((tok_BR K R3 (0 :: L)) [target]⊢* cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone)) + (S : List (ℕ × ℕ)) (hacc : Acc (BoundedLex m) S) : + ∀ (K : List ℕ) (L : List ℕ), + scores K = S → countNonOne K + wtL L = m → + ∃ cfg_, ((tok_BR K R3 (0 :: L)) [target]⊢* cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + induction hacc with + | intro S _ ih_acc => + intro K L hS hm + rcases bl_step_macro_len R3 K.length K (Nat.le_refl K.length) L with + ⟨cfg_, hstep, hsys⟩ | + ⟨K', L', hstep, hlt⟩ | + ⟨K', L', P, x, y, rest, ext, hstep, heq, hxy, hsc1, hsc2⟩ + · exact ⟨cfg_, hstep, hsys⟩ + · obtain ⟨cfg_, hstep2, hsys⟩ := ih_m K' L' (by omega) + exact ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep hstep2), hsys⟩ + · have hlenP : P.length < m := by + have hlenK := scores_length K + rw [hsc1, List.length_append, List.length_cons] at hlenK + omega + have hlex : BoundedLex m (scores K') S := by + rw [← hS, hsc1, hsc2] + exact boundedLex_append P rest ext hxy hlenP + obtain ⟨cfg_, hstep2, hsys⟩ := ih_acc (scores K') hlex K' L' rfl (by omega) + exact ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep hstep2), hsys⟩ + +private theorem bl_terminates_le (R3 : List (ℕ × ℕ)) (n : ℕ) : + ∀ (m : ℕ), m ≤ n → ∀ (K : List ℕ) (L : List ℕ), + countNonOne K + wtL L = m → + ∃ cfg_, ((tok_BR K R3 (0 :: L)) [target]⊢* cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + induction n with + | zero => + intro m hm K L hM + have hm0 : m = 0 := by omega + subst hm0 + exact bl_terminates_acc R3 0 (fun _ _ hlt => by omega) (scores K) (boundedLex_acc 0 (scores K)) + K L rfl hM + | succ n ih_n => + intro m hm K L hM + rcases Nat.of_le_succ hm with hle | rfl + · exact ih_n m hle K L hM + · refine bl_terminates_acc R3 (n + 1) (fun K' L' hlt => ?_) + (scores K) (boundedLex_acc (n + 1) (scores K)) K L rfl hM + exact ih_n (countNonOne K' + wtL L') (by omega) K' L' rfl + +private theorem tok_AL_2_0_closed (R3 : List (ℕ × ℕ)) (L : List ℕ) : + ∃ cfg_, ((tok_AL [2, 0] R3 L) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases bounce_AL R3 [0] L with ⟨cfg_, hstep, hhalt⟩ | ⟨K_out, L_out, hstep, _, _⟩ + · exact ⟨cfg_, hstep, Or.inr hhalt⟩ + · obtain ⟨cfg_, hstep2, hsys⟩ := bl_terminates_le R3 (countNonOne K_out + wtL L_out) + (countNonOne K_out + wtL L_out) (Nat.le_refl _) K_out L_out rfl + exact ⟨cfg_, ReachesPlus.trans_star hstep hstep2, hsys⟩ + +private theorem tok_CL_1_0_closed (R3 : List (ℕ × ℕ)) (L : List ℕ) : + ∃ cfg_, ((tok_CL [1, 0] R3 L) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases bounce_CL R3 0 [0] L with ⟨cfg_, hstep, hhalt⟩ | ⟨K_out, L_out, hstep, _, _⟩ + · exact ⟨cfg_, hstep, Or.inr hhalt⟩ + · obtain ⟨cfg_, hstep2, hsys⟩ := bl_terminates_le R3 (countNonOne K_out + wtL L_out) + (countNonOne K_out + wtL L_out) (Nat.le_refl _) K_out L_out rfl + exact ⟨cfg_, ReachesPlus.trans_star hstep hstep2, hsys⟩ + +/-! ## Mode Closure Theorems -/ + +private theorem mode_CL_n_n_closed (L R : List (ℕ × ℕ)) : + ∃ cfg_, ((cfg_CL_n_n L R) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases L with _ | ⟨⟨a1, b2⟩, L3⟩ + · refine ⟨cfg_BR_n_n [(0, 0)] (bumpPairHead R), ?_, + Or.inl ⟨.BR_n_n, [(0, 0)], bumpPairHead R, rfl⟩⟩ + unfold cfg_CL_n_n cfg_BR_n_n + rw [encLeft_d0_s0 [], ← encRight_cons_one R] + execute 2 + · rcases a1 with _ | a5 + · refine ⟨cfg_CL_n_n L3 (bumpPairHead (bumpPairHead R)), ?_, + Or.inl ⟨.CL_n_n, L3, bumpPairHead (bumpPairHead R), rfl⟩⟩ + unfold cfg_CL_n_n + rw [encLeft_mod1 0 b2 L3, Nat.mod_one b2, encLeft_d0_s0 L3, + ← encRight_cons_one (bumpPairHead R), ← encRight_cons_one R] + execute 2 + · rcases a5 with _ | a14 + · rcases L3 with _ | ⟨⟨a6, b7⟩, L8⟩ + · refine ⟨cfg_BR_n_n [(0, 0)] ((0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R))), ?_, + Or.inl ⟨.BR_n_n, [(0, 0)], (0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R)), rfl⟩⟩ + unfold cfg_CL_n_n cfg_BR_n_n + rw [encLeft_mod1 1 b2 [], Nat.mod_one b2, encLeft_d1_s0 [], encLeft_d0_s0 [], + encRight_d0_s0 (bumpPairHead (bumpPairHead (bumpPairHead R))), + ← encRight_cons_one (bumpPairHead (bumpPairHead R)), + ← encRight_cons_one (bumpPairHead R), ← encRight_cons_one R] + execute 6 + · rcases a6 with _ | a10 + · refine ⟨cfg_CL_n_n L8 ((0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R))), ?_, + Or.inl ⟨.CL_n_n, L8, (0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R)), rfl⟩⟩ + unfold cfg_CL_n_n + rw [encLeft_mod1 1 b2 ((0, b7) :: L8), Nat.mod_one b2, encLeft_d1_s0 ((0, b7) :: L8), + encLeft_mod1 0 b7 L8, Nat.mod_one b7, encLeft_d0_s0 L8, + encRight_d0_s0 (bumpPairHead (bumpPairHead (bumpPairHead R))), + ← encRight_cons_one (bumpPairHead (bumpPairHead R)), + ← encRight_cons_one (bumpPairHead R), ← encRight_cons_one R] + execute 5 + · rcases a10 with _ | a11 + · refine ⟨cfg_BR_n_n (bumpPairHead L8) ((1, 0) :: (0, 0) :: R), ?_, + Or.inl ⟨.BR_n_n, bumpPairHead L8, (1, 0) :: (0, 0) :: R, rfl⟩⟩ + unfold cfg_CL_n_n cfg_BR_n_n + rw [encLeft_mod1 1 b2 ((1, b7) :: L8), Nat.mod_one b2, + encLeft_d1_s0 ((1, b7) :: L8), encLeft_mod1 1 b7 L8, Nat.mod_one b7, + encLeft_d1_s0 L8, ← encLeft_cons_one L8, encRight_d1_s0 ((0, 0) :: R), + encRight_d0_s0 R] + execute 16 + · refine ⟨cfg_AL_n_n ((a11, 0) :: L8) ((1, 0) :: (0, 0) :: R), ?_, + Or.inl ⟨.AL_n_n, (a11, 0) :: L8, (1, 0) :: (0, 0) :: R, rfl⟩⟩ + unfold cfg_CL_n_n cfg_AL_n_n + rw [encLeft_mod1 1 b2 ((a11 + 2, b7) :: L8), Nat.mod_one b2, + encLeft_d1_s0 ((a11 + 2, b7) :: L8), encLeft_mod1 (a11 + 2) b7 L8, + Nat.mod_one b7, encLeft_succ (a11 + 1) 0 L8, encLeft_succ a11 0 L8, + encLeft_run_s0 a11 L8, encRight_d1_s0 ((0, 0) :: R), encRight_d0_s0 R] + execute 15 + · refine ⟨(encLeft ((a14, 0) :: L3)) <{{F}} ((1 : Fin 2) >> (1 : Fin 2) >> encRight R), ?_, + Or.inr (by rw [encLeft_run_s0]; bb_halt)⟩ + unfold cfg_CL_n_n + rw [encLeft_mod1 (a14 + 2) b2 L3, Nat.mod_one b2, encLeft_succ (a14 + 1) 0 L3, + encLeft_succ a14 0 L3] + execute 2 + +private theorem mode_BR_n_n_closed (L R : List (ℕ × ℕ)) : + ∃ cfg_, ((cfg_BR_n_n L R) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases R with _ | ⟨⟨r1, b2⟩, R3⟩ + · refine ⟨cfg_CL_n_n L [(0, 0)], ?_, Or.inl ⟨.CL_n_n, L, [(0, 0)], rfl⟩⟩ + unfold cfg_BR_n_n cfg_CL_n_n + rw [encRight_d0_s0 []] + execute 1 + · rcases r1 with _ | r5 + · refine ⟨cfg_BR_n_n ((0, 0) :: L) R3, ?_, Or.inl ⟨.BR_n_n, (0, 0) :: L, R3, rfl⟩⟩ + unfold cfg_BR_n_n + rw [encRight_mod1 0 b2 R3, Nat.mod_one b2, encRight_d0_s0 R3, encLeft_d0_s0 L] + execute 2 + · refine ⟨cfg_AR_0_n L ((r5, 0) :: R3), ?_, Or.inl ⟨.AR_0_n, L, (r5, 0) :: R3, rfl⟩⟩ + unfold cfg_BR_n_n cfg_AR_0_n + rw [encRight_mod1 (r5 + 1) b2 R3, Nat.mod_one b2, encRight_succ r5 0 R3, + encRight_run_s0 r5 R3] + execute 1 + +private theorem mode_AR_0_n_closed (L R : List (ℕ × ℕ)) : + ∃ cfg_, ((cfg_AR_0_n L R) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases R with _ | ⟨⟨r1, b2⟩, R3⟩ + · refine ⟨cfg_CL_n_n L [(2, 0)], ?_, Or.inl ⟨.CL_n_n, L, [(2, 0)], rfl⟩⟩ + unfold cfg_AR_0_n cfg_CL_n_n + rw [encRight_succ 1 0 [], encRight_d1_s0 []] + execute 4 + · rcases r1 with _ | _ | r5 + · refine ⟨cfg_BR_n_n ((0, 0) :: bumpPairHead L) R3, ?_, Or.inl ⟨.BR_n_n, (0, + 0) :: bumpPairHead L, R3, rfl⟩⟩ + unfold cfg_AR_0_n cfg_BR_n_n + rw [encRight_mod1 0 b2 R3, Nat.mod_one b2, encRight_d0_s0 R3, encLeft_d0_s0 (bumpPairHead L), + ← encLeft_cons_one L] + execute 6 + · obtain ⟨cfg_, hstep2, hsys⟩ := tok_AL_2_0_closed R3 (L.map Prod.fst) + refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ + unfold cfg_AR_0_n tok_AL + rw [encRight_mod1 1 b2 R3, Nat.mod_one b2, encRight_d1_s0 R3, encLeft_eq_nat L, + encTokens_succ, encTokens_succ, encTokens_zero, encTokens_zero, encTokens_nil] + texecute 4 + · refine ⟨cfg_AL_n_n L ((1, 0) :: (r5, 0) :: R3), ?_, + Or.inl ⟨.AL_n_n, L, (1, 0) :: (r5, 0) :: R3, rfl⟩⟩ + unfold cfg_AR_0_n cfg_AL_n_n + rw [encRight_mod1 (r5 + 2) b2 R3, Nat.mod_one b2, encRight_succ (r5 + 1) 0 R3, + encRight_succ r5 0 R3, encRight_run_s0 r5 R3, encRight_d1_s0 ((r5, 0) :: R3), + encRight_run_s0 r5 R3] + execute 4 + +private theorem mode_AL_n_n_closed (L R : List (ℕ × ℕ)) : + ∃ cfg_, ((cfg_AL_n_n L R) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases L with _ | ⟨⟨a1, b2⟩, L3⟩ + · refine ⟨cfg_BR_n_n [(0, 0)] R, ?_, Or.inl ⟨.BR_n_n, [(0, 0)], R, rfl⟩⟩ + unfold cfg_AL_n_n cfg_BR_n_n + rw [encLeft_d0_s0 []] + execute 1 + · rcases R with _ | ⟨⟨r1, b4⟩, R3⟩ + · rcases a1 with _ | a5 + · refine ⟨cfg_BR_n_n (bumpPairHead L3) [(0, 0)], ?_, + Or.inl ⟨.BR_n_n, bumpPairHead L3, [(0, 0)], rfl⟩⟩ + unfold cfg_AL_n_n cfg_BR_n_n + rw [encLeft_mod1 0 b2 L3, Nat.mod_one b2, encLeft_d0_s0 L3, ← encLeft_cons_one L3, + encRight_d0_s0 []] + execute 4 + · refine ⟨cfg_AL_n_n ((a5, 0) :: L3) [(0, 0)], ?_, + Or.inl ⟨.AL_n_n, (a5, 0) :: L3, [(0, 0)], rfl⟩⟩ + unfold cfg_AL_n_n + rw [encLeft_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encLeft_succ a5 0 L3, + encLeft_run_s0 a5 L3, encRight_d0_s0 []] + execute 3 + · rcases r1 with _ | r5 + · rcases a1 with _ | a5 + · obtain ⟨cfg_, hstep2, hsys⟩ := tok_AL_2_0_closed R3 (L3.map Prod.fst) + refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ + unfold cfg_AL_n_n tok_AL + rw [encLeft_mod1 0 b2 L3, Nat.mod_one b2, encLeft_d0_s0 L3, encRight_mod1 0 b4 R3, + Nat.mod_one b4, encRight_d0_s0 R3, encLeft_eq_nat L3, encTokens_succ, encTokens_succ, + encTokens_zero, encTokens_zero, encTokens_nil] + texecute 4 + · obtain ⟨cfg_, hstep2, hsys⟩ := tok_CL_1_0_closed R3 (a5 :: L3.map Prod.fst) + refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ + unfold cfg_AL_n_n tok_CL + rw [encLeft_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encLeft_succ a5 0 L3, + encLeft_run_s0 a5 L3, encRight_mod1 0 b4 R3, Nat.mod_one b4, encRight_d0_s0 R3, + encLeft_eq_nat L3, encTokens_succ, encTokens_zero, encTokens_zero, encTokens_nil] + change (((1 : Fin 2) >> encLeftNat (a5 :: List.map Prod.fst L3)) <{{A}} + ((1 : Fin 2) >> (0 : Fin 2) >> encRight R3)) [target]⊢⁺ + ((encLeftNat (a5 :: List.map Prod.fst L3)) <{{C}} + ((1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> encRight R3)) + texecute 3 + · rcases a1 with _ | a5 + · refine ⟨cfg_AL_n_n L3 ((1, 0) :: (r5, 0) :: R3), ?_, + Or.inl ⟨.AL_n_n, L3, (1, 0) :: (r5, 0) :: R3, rfl⟩⟩ + unfold cfg_AL_n_n + rw [encLeft_mod1 0 b2 L3, Nat.mod_one b2, encLeft_d0_s0 L3, + encRight_mod1 (r5 + 1) b4 R3, Nat.mod_one b4, encRight_succ r5 0 R3, + encRight_run_s0 r5 R3, encRight_d1_s0 ((r5, 0) :: R3), encRight_run_s0 r5 R3] + execute 4 + · refine ⟨cfg_CL_n_n ((a5, 0) :: L3) ((0, 0) :: (r5, 0) :: R3), ?_, + Or.inl ⟨.CL_n_n, (a5, 0) :: L3, (0, 0) :: (r5, 0) :: R3, rfl⟩⟩ + unfold cfg_AL_n_n cfg_CL_n_n + rw [encLeft_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encLeft_succ a5 0 L3, + encLeft_run_s0 a5 L3, encRight_mod1 (r5 + 1) b4 R3, Nat.mod_one b4, + encRight_succ r5 0 R3, encRight_run_s0 r5 R3, encRight_d0_s0 ((r5, 0) :: R3), + encRight_run_s0 r5 R3] + execute 3 + +private theorem stack_system_closed (cfg : Cfg (Fin 2) (Fin 6)) (h : IsInStackSystem cfg) : + ∃ cfg_, (cfg [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases h with ⟨m, L, R, rfl⟩ + cases m with + | CL_n_n => exact mode_CL_n_n_closed L R + | BR_n_n => exact mode_BR_n_n_closed L R + | AR_0_n => exact mode_AR_0_n_closed L R + | AL_n_n => exact mode_AL_n_n_closed L R + +private theorem init_reaches_nontrivial : + (init []) [target]⊢⁺ evalStackCfg .AL_n_n [(0, 0), (0, 0)] [(1, 0)] := by + have hL : encLeft [(0, 0), (0, 0)] = + (1 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default := rfl + have hR : encRight [(1, 0)] = (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default := rfl + dsimp only [evalStackCfg, cfg_AL_n_n] + rw [hL, hR] + execute 7 + +private theorem step_BR_transfer (z : ℕ × ℕ) (L R : List (ℕ × ℕ)) : + (evalStackCfg .BR_n_n L ((0, 0) :: z :: R)) [target]⊢⁺ + evalStackCfg .BR_n_n ((0, 0) :: L) (z :: R) := by + dsimp only [evalStackCfg, cfg_BR_n_n] + rw [encRight_d0_s0 (z :: R), encLeft_d0_s0 L] + execute 2 + +private theorem encLeft_head (a b : ℕ) (L : List (ℕ × ℕ)) : + (encLeft ((a, b) :: L)).head = 1 := by + rw [encLeft_cons, show 1 * a + 1 = (1 * a + 0) + 1 by omega, list_pow_succ, List.cons_append] + simp only [ListBlank.append_cons, ListBlank.head_cons] + +private theorem encLeft_not_surjective : + ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ L : List (ℕ × ℕ), encLeft L ≠ t := by + refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ + intro L h + rcases L with _ | ⟨⟨a, b⟩, L'⟩ + · have h1 := congrArg (fun s => s.head) h + simp at h1 + · rw [encLeft_mod1] at h + have hb0 : b % 1 = 0 := Nat.mod_one b + rw [hb0, encLeft_run_s0] at h + rcases a with _ | a' + · rcases L' with _ | ⟨⟨a', b'⟩, L''⟩ + · have h2 := congrArg (fun s => s.tail.tail.tail.head) h + simp at h2 + · have h1 := congrArg (fun s => s.tail.tail.head) h + normalize_at h1 + rw [encLeft_head a' b' L''] at h1; contradiction + · have h1 := congrArg (fun s => s.tail.head) h + normalize_at h1 + contradiction + +private theorem encRight_head (a b : ℕ) (R : List (ℕ × ℕ)) : + (encRight ((a, b) :: R)).head = 1 := by + rw [encRight_cons, show 1 * a + 1 = (1 * a + 0) + 1 by omega, list_pow_succ, List.cons_append] + simp only [ListBlank.append_cons, ListBlank.head_cons] + +private theorem encRight_not_surjective : + ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ R : List (ℕ × ℕ), encRight R ≠ t := by + refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ + intro R h + rcases R with _ | ⟨⟨a, b⟩, R'⟩ + · have h1 := congrArg (fun s => s.head) h + simp at h1 + · rw [encRight_mod1] at h + have hb0 : b % 1 = 0 := Nat.mod_one b + rw [hb0, encRight_run_s0] at h + rcases a with _ | a' + · rcases R' with _ | ⟨⟨a', b'⟩, L''⟩ + · have h2 := congrArg (fun s => s.tail.tail.tail.head) h + simp at h2 + · have h1 := congrArg (fun s => s.tail.tail.head) h + normalize_at h1 + rw [encRight_head a' b' L''] at h1; contradiction + · have h1 := congrArg (fun s => s.tail.head) h + normalize_at h1 + contradiction + +private theorem valid_stack_modes : IsValidStackModes encLeft encRight evalStackCfg := by + intro m + cases m with + | CL_n_n => exact ⟨C, .id [], .id [], by decide, by decide, Or.inr (Or.inl (fun _ _ => rfl))⟩ + | BR_n_n => exact ⟨B, .id [], .id [], by decide, by decide, Or.inr (Or.inr (fun _ _ => rfl))⟩ + | AR_0_n => exact ⟨A, .id [0], .id [], by decide, by decide, Or.inr (Or.inr (fun _ _ => rfl))⟩ + | AL_n_n => exact ⟨A, .id [], .id [], by decide, by decide, Or.inr (Or.inl (fun _ _ => rfl))⟩ + + +/-! ## Stack Reduction Witness -/ + +/-- `target` reduces to a closed 2nd-order digit-stack transition system. -/ +theorem has_stack_reduction : HasStackReduction target := by + refine ⟨StackMode, 1, 0, encLeft, encRight, evalStackCfg, IsInStackSystem, + Or.inl ⟨rfl, rfl⟩, rfl, rfl, + encLeft_head, encRight_head, encLeft_not_surjective, encRight_not_surjective, + ⟨1, 1, 1, 1, 1, 1, 1, 1, by decide, by decide, by decide, by decide, by decide, + by decide, by decide, by decide, by decide, by decide, + fun _ _ _ => rfl, fun _ _ _ => rfl⟩, + ⟨[.CL_n_n, .BR_n_n, .AR_0_n, .AL_n_n], by decide, by intro m; cases m <;> decide⟩, + valid_stack_modes, + fun _ => Iff.rfl, + fun m L R => ⟨m, L, R, rfl⟩, + ⟨.AL_n_n, [(0, 0), (0, 0)], [(1, 0)], init_reaches_nontrivial, + by decide, ⟨(1, 0), by decide, by decide⟩⟩, + Or.inr ⟨.BR_n_n, .BR_n_n, (0, 0), id, ((0, 0) :: ·), + fun _ => Nat.le_succ _, step_BR_transfer⟩, + stack_system_closed⟩ + +end BusyBeaver.M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean b/BusyBeaver/BB6/Accelerations/M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean index 4583e427..38926209 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean @@ -26,8 +26,8 @@ tape head outward. Starting from `init []`, the machine enters a closed 2-mode ( growth doubly-exponential era lengths ($T_0..T_3 = 1, 2, 8, 256$), shield none closed (all-even $R$ + $L.\mathrm{last}=0$ refuted across eras). -*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously -non-halting (wiki cryptid). +*Verdict (heuristic; community analysis, see the wiki page):* probviously non-halting (wiki +cryptid). *Hazard:* not quantified; perturbed all-even seeds halt in Era 2/3 (`rec_59_bottom_extension`) diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean b/BusyBeaver/BB6/Accelerations/M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean new file mode 100644 index 00000000..cea3d822 --- /dev/null +++ b/BusyBeaver/BB6/Accelerations/M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean @@ -0,0 +1,1177 @@ +/- +Copyright (c) 2026 Google LLC. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +-/ +module + +public import BusyBeaver.Basic +public import BusyBeaver.BB6.Accelerations.Stack +public import BusyBeaver.Bridge + +/-! +# Busy Beaver Holdout `1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---` + +Formal `HasStackReduction` proof for the 6-state, 2-symbol Busy Beaver holdout +`1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---` +(https://wiki.bbchallenge.org/wiki/1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---, which redirects to the +wiki page of `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`). + +This machine is the transition table of `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` restarted from +its state `C` and brought to tree normal form: reading its states `A`, `B`, `C`, `D`, `E`, `F` as +the states `C`, `D`, `E`, `F`, `B`, `A` of that machine, the two transition tables coincide, so both +machines run the same closed pair-stack system. The proof below is the mechanical relabelling of the +proof in +[`1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`](./M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean); +only the blank-tape entry lemma `init_reaches_nontrivial` is specific to this start state. + + +## Hardness + +*Hardness class:* Wiki stack — trigger **as #85 (same table, started from its state `C`)**, growth +as #85, shield as #85. + +*Verdict (heuristic; community analysis, see the wiki page):* same dynamics as +`1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` (#85) (wiki: "when the TM starts on any starting state, +it exhibits the same probviously halting behaviour"). + +*Hazard:* as #85 (community estimate) + +*Simulated horizon:* as #85 + +*Why it is hard:* the proof is the state relabelling of the #85 proof with its own blank-tape entry +(12 raw steps) + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + +-/ + +@[expose] public section + +namespace BusyBeaver.M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH + +open SixState Turing Stack + +/-- The `(6, 2)` Turing machine in `ConjectureMachines.Machine` form. -/ +def machine : ConjectureMachines.Machine 6 2 := + load_rle_machine% "1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---" + +/-- The `(6, 2)` Turing machine in `BusyBeaver.Machine` form. -/ +abbrev target : Machine (Fin 2) (Fin 6) := + machine.toBB + +/-! ## Local Step Tactics and Pair-Stack Encodings -/ + +local macro "normalize" : tactic => `(tactic| ( + try simp only [ListBlank.append_cons, ListBlank.append_nil, + ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, + ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, + List.nil_append, List.cons_append, zeros_append_default, + Nat.mul_zero, Nat.mul_add, Nat.mul_one])) + +local macro "normalize_at" h:ident : tactic => `(tactic| ( + try simp only [ListBlank.append_cons, ListBlank.append_nil, + ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, + ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, + List.nil_append, List.cons_append, zeros_append_default, + Nat.mul_zero, Nat.mul_add, Nat.mul_one] at $h:ident)) + +local macro "step" : tactic => `(tactic| ( + try refine ReachesPlus.to_star ?_ + try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, + list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, + zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one] + refine ReachesPlus.head (by rfl) ?_ + simp only [Tape.move, Tape.write, + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, + list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, + zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one])) + +private def encRight : List (ℕ × ℕ) → ListBlank (Fin 2) + | [] => default + | (a, b) :: L => (encRight L <+ (([0] : List (Fin 2)) ^ (1 + b % 1))) <+ + (([1] : List (Fin 2)) ^ (1 * a + 1)) + +private def encLeft : List (ℕ × ℕ) → ListBlank (Fin 2) + | [] => default + | (d, b) :: R => (([1] : List (Fin 2)) ^ (1 * d + 1)) +> ((([0] : List (Fin 2)) ^ (1 + b % 1)) +> + encLeft R) + +@[simp] private theorem encRight_nil : encRight [] = default := rfl + +@[simp] private theorem encRight_cons (a b : ℕ) (L : List (ℕ × ℕ)) : + encRight ((a, b) :: L) = (encRight L <+ (([0] : List (Fin 2)) ^ (1 + b % 1))) <+ + (([1] : List (Fin 2)) ^ (1 * a + 1)) := rfl + +@[simp] private theorem encLeft_nil : encLeft [] = default := rfl + +@[simp] private theorem encLeft_cons (d b : ℕ) (R : List (ℕ × ℕ)) : + encLeft ((d, b) :: R) = (([1] : List (Fin 2)) ^ (1 * d + 1)) +> + ((([0] : List (Fin 2)) ^ (1 + b % 1)) +> encLeft R) := rfl + +private theorem encRight_mod1 (a b : ℕ) (L : List (ℕ × ℕ)) : + encRight ((a, b) :: L) = encRight ((a, b % 1) :: L) := by + simp only [encRight_cons, Nat.mod_mod] + +private theorem encRight_succ (a b : ℕ) (L : List (ℕ × ℕ)) : + encRight ((a + 1, b) :: L) = (1 : Fin 2) >> encRight ((a, b) :: L) := by + simp only [encRight_cons] + rw [show 1 * (a + 1) + 1 = 1 + (1 * a + 1) by omega, list_pow_add, ListBlank.append_assoc] + rfl + +private theorem encRight_d0_s0 (L : List (ℕ × ℕ)) : + encRight ((0, 0) :: L) = (1 : Fin 2) >> (0 : Fin 2) >> encRight L := rfl + +private theorem encRight_d1_s0 (L : List (ℕ × ℕ)) : + encRight ((1, 0) :: L) = (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> encRight L := rfl + +private theorem encRight_run_s0 (a : ℕ) (L : List (ℕ × ℕ)) : + encRight ((a, 0) :: L) = (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> + encRight L) := by + induction a with + | zero => rfl + | succ k ih => rw [encRight_succ, ih]; normalize + +private theorem encLeft_mod1 (a b : ℕ) (R : List (ℕ × ℕ)) : + encLeft ((a, b) :: R) = encLeft ((a, b % 1) :: R) := by + simp only [encLeft_cons, Nat.mod_mod] + +private theorem encLeft_succ (a b : ℕ) (R : List (ℕ × ℕ)) : + encLeft ((a + 1, b) :: R) = (1 : Fin 2) >> encLeft ((a, b) :: R) := by + simp only [encLeft_cons] + rw [show 1 * (a + 1) + 1 = 1 + (1 * a + 1) by omega, list_pow_add, ListBlank.append_assoc] + rfl + +private theorem encLeft_d0_s0 (R : List (ℕ × ℕ)) : + encLeft ((0, 0) :: R) = (1 : Fin 2) >> (0 : Fin 2) >> encLeft R := rfl + +private theorem encLeft_d1_s0 (R : List (ℕ × ℕ)) : + encLeft ((1, 0) :: R) = (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> encLeft R := rfl + +private theorem encLeft_run_s0 (a : ℕ) (R : List (ℕ × ℕ)) : + encLeft ((a, 0) :: R) = (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> + encLeft R) := by + induction a with + | zero => rfl + | succ k ih => rw [encLeft_succ, ih]; normalize + +@[simp] private theorem encRight_cons_one (L : List (ℕ × ℕ)) : + (1 : Fin 2) >> encRight L = encRight (bumpPairHead L) := by + rcases L with _ | ⟨⟨a, b⟩, L'⟩ + · simp [bumpPairHead, encRight] + · exact (encRight_succ a b L').symm + +@[simp] private theorem encLeft_cons_one (R : List (ℕ × ℕ)) : + (1 : Fin 2) >> encLeft R = encLeft (bumpPairHead R) := by + rcases R with _ | ⟨⟨a, b⟩, R'⟩ + · simp [bumpPairHead, encLeft] + · exact (encLeft_succ a b R').symm + +local macro "finish" : tactic => `(tactic| ( + refine ⟨0, ?_⟩ + try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', + encLeft_nil, encRight_nil, ListBlank.append_cons, ListBlank.append_nil, + ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, + ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, + List.nil_append, List.cons_append, zeros_append_default, + Nat.mul_zero, Nat.mul_add, Nat.mul_one] + simp only [encLeft_cons_one, encRight_cons_one, multiStep_zero] + try rfl)) + +local macro "execute" n:num : tactic => `(tactic| ( + iterate $n step + finish)) + +private def cfg_AR_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := + (encLeft R) {{A}}> (encRight L) + +private def cfg_CL_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := + (encLeft R) <{{C}} (encRight L) + +private def cfg_BL_0_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := + (encLeft R) <{{B}} ([0] +> encRight L) + +private def cfg_BR_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := + (encLeft R) {{B}}> (encRight L) + +private inductive StackMode + | AR_n_n + | CL_n_n + | BL_0_n + | BR_n_n + deriving DecidableEq + +private def evalStackCfg : StackMode → List (ℕ × ℕ) → List (ℕ × ℕ) → Cfg (Fin 2) (Fin 6) + | .AR_n_n, L, R => cfg_AR_n_n R L + | .CL_n_n, L, R => cfg_CL_n_n R L + | .BL_0_n, L, R => cfg_BL_0_n R L + | .BR_n_n, L, R => cfg_BR_n_n R L + +private def IsInStackSystem (cfg : Cfg (Fin 2) (Fin 6)) : Prop := + ∃ m L R, cfg = evalStackCfg m L R + +/-! ## Inner Token System -/ + +private def encTokens : List ℕ → List (ℕ × ℕ) → ListBlank (Fin 2) + | [], R3 => encLeft R3 + | k :: K, R3 => (([1] : List (Fin 2)) ^ k) +> ((0 : Fin 2) >> encTokens K R3) + +@[simp] private theorem encTokens_nil (R3 : List (ℕ × ℕ)) : encTokens [] R3 = encLeft R3 := rfl + +@[simp] private theorem encTokens_zero (K : List ℕ) (R3 : List (ℕ × ℕ)) : + encTokens (0 :: K) R3 = (0 : Fin 2) >> encTokens K R3 := rfl + +@[simp] private theorem encTokens_succ (k : ℕ) (K : List ℕ) (R3 : List (ℕ × ℕ)) : + encTokens ((k + 1) :: K) R3 = (1 : Fin 2) >> encTokens (k :: K) R3 := by + simp only [encTokens, list_pow_succ, List.cons_append, List.nil_append, ListBlank.append_cons] + +private def encRightNat : List ℕ → ListBlank (Fin 2) + | [] => default + | a :: L => (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> encRightNat L) + +@[simp] private theorem encRightNat_nil : encRightNat [] = default := rfl + +@[simp] private theorem encRightNat_zero (L : List ℕ) : + encRightNat (0 :: L) = (1 : Fin 2) >> (0 : Fin 2) >> encRightNat L := rfl + +@[simp] private theorem encRightNat_succ (a : ℕ) (L : List ℕ) : + encRightNat ((a + 1) :: L) = (1 : Fin 2) >> encRightNat (a :: L) := by + simp only [encRightNat, list_pow_succ, List.cons_append, List.nil_append, ListBlank.append_cons] + +private theorem encRight_eq_nat (L : List (ℕ × ℕ)) : encRight L = encRightNat (L.map Prod.fst) := by + induction L with + | nil => rfl + | cons p L ih => + rcases p with ⟨a, b⟩ + rw [encRight_mod1 a b L, Nat.mod_one b, encRight_run_s0 a L, ih] + rfl + +private theorem encRightNat_eq (L : List ℕ) : encRightNat L = encRight (L.map (fun x => (x, 0))) := + by + induction L with + | nil => rfl + | cons a L ih => + simp only [List.map_cons, encRightNat, ih, encRight_run_s0] + +@[simp] private theorem encRightNat_cons_one (L : List ℕ) : + (1 : Fin 2) >> encRightNat L = encRightNat (bumpHead L) := by + rcases L with _ | ⟨a, L'⟩ + · simp [bumpHead, encRightNat] + · simp [bumpHead] + +local macro "tstep" : tactic => `(tactic| ( + try refine ReachesPlus.to_star ?_ + try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', + encTokens_nil, encTokens_zero, encTokens_succ, + encRightNat_nil, encRightNat_zero, encRightNat_succ, + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, + list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, + zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one] + refine ReachesPlus.head (by rfl) ?_ + simp only [Tape.move, Tape.write, encTokens_nil, encTokens_zero, encTokens_succ, + encRightNat_nil, encRightNat_zero, encRightNat_succ, + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, + list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, + zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one])) + +local macro "tfinish" : tactic => `(tactic| ( + refine ⟨0, ?_⟩ + try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', + encTokens_nil, encTokens_zero, encTokens_succ, + encRightNat_nil, encRightNat_zero, encRightNat_succ, encLeft_nil, encRight_nil, + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, + list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, + zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one] + simp only [encRightNat_cons_one, encLeft_cons_one, encRight_cons_one, multiStep_zero] + try rfl)) + +local macro "texecute" n:num : tactic => `(tactic| ( + iterate $n tstep + tfinish)) + +private def tok_AR (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := + (encTokens K R3) {{A}}> (encRightNat L) + +private def tok_BR (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := + (encTokens K R3) {{B}}> (encRightNat L) + +private def tok_CL (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := + (encTokens K R3) <{{C}} (encRightNat L) + +private theorem tok_CL_exit_zero (R3 : List (ℕ × ℕ)) (L : List ℕ) : + (tok_CL [0] R3 L) [target]⊢⁺ cfg_AR_n_n (L.map (fun x => (x, 0))) (bumpPairHead R3) := by + unfold tok_CL cfg_AR_n_n + rw [← encRightNat_eq L] + texecute 1 + +private theorem tok_CL_0_cons (k1 : ℕ) (K2 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : + (tok_CL (0 :: k1 :: K2) R3 L) [target]⊢⁺ tok_AR ((k1 + 1) :: K2) R3 L := by + unfold tok_CL tok_AR; texecute 1 + +private theorem tok_CL_1 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : + (tok_CL (1 :: K1) R3 L) [target]⊢⁺ tok_CL K1 R3 (0 :: L) := by + unfold tok_CL; texecute 2 + +private theorem tok_CL_2 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : + (tok_CL (2 :: K1) R3 (0 :: L)) [target]⊢⁺ tok_CL K1 R3 (0 :: 1 :: L) := by + unfold tok_CL; texecute 7 + +private theorem tok_CL_add3 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : + (tok_CL ((k + 3) :: K1) R3 L) [target]⊢⁺ tok_BR (2 :: k :: K1) R3 L := by + unfold tok_CL tok_BR; texecute 5 + +private theorem tok_BR_nil_8 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_BR (2 :: K1) R3 []) [target]⊢⁺ tok_CL K1 R3 [0, 1] := by + unfold tok_BR tok_CL; texecute 8 + +private theorem tok_BR_zero (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L1 : List ℕ) : + (tok_BR (2 :: K1) R3 (0 :: L1)) [target]⊢⁺ tok_BR (2 :: 1 :: K1) R3 L1 := by + unfold tok_BR; texecute 4 + +private theorem tok_BR_1_nil_28 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_BR (2 :: K1) R3 [1]) [target]⊢⁺ tok_CL (1 :: K1) R3 [0, 0, 0, 1] := by + unfold tok_BR tok_CL; texecute 28 + +private theorem tok_BR_succ (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L1 : List ℕ) : + (tok_BR (2 :: K1) R3 ((a + 1) :: L1)) [target]⊢⁺ tok_AR (1 :: 1 :: K1) R3 (a :: L1) := by + unfold tok_BR tok_AR; texecute 3 + +private theorem tok_AR_1_nil_9 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_AR (1 :: K1) R3 []) [target]⊢⁺ tok_CL K1 R3 [0, 1] := by + unfold tok_AR tok_CL; texecute 9 + +private theorem tok_AR_add2_nil_21 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_AR ((k + 2) :: K1) R3 []) [target]⊢⁺ tok_CL (k :: K1) R3 [0, 0, 1] := by + unfold tok_AR tok_CL; texecute 21 + +private theorem tok_AR_zero (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L1 : List ℕ) : + (tok_AR (k :: K1) R3 (0 :: L1)) [target]⊢⁺ tok_AR ((k + 2) :: K1) R3 L1 := by + unfold tok_AR; texecute 2 + +private theorem tok_AR_1_nil_33 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_AR (k :: K1) R3 [1]) [target]⊢⁺ tok_CL (k :: K1) R3 [0, 0, 0, 1] := by + unfold tok_AR tok_CL; texecute 33 + +private theorem tok_AR_1_0 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L2 : List ℕ) : + (tok_AR (k :: K1) R3 (1 :: 0 :: L2)) [target]⊢⁺ tok_AR (1 :: (k + 3) :: K1) R3 L2 := by + unfold tok_AR; texecute 5 + +private theorem tok_AR_1_1_nil_25 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : + (tok_AR (k :: K1) R3 [1, 1]) [target]⊢⁺ tok_CL (k :: K1) R3 [0, 0, 1] := by + unfold tok_AR tok_CL; texecute 25 + +private theorem tok_AR_1_1_cons_25 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (c : ℕ) (L3 : List ℕ) : + (tok_AR (k :: K1) R3 (1 :: 1 :: c :: L3)) [target]⊢⁺ + tok_CL (k :: K1) R3 (0 :: 0 :: (c + 2) :: L3) := by + unfold tok_AR tok_CL; texecute 25 + +private theorem tok_AR_1_add2 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L2 : List ℕ) : + (tok_AR (k :: K1) R3 (1 :: (a + 2) :: L2)) [target]⊢⁺ tok_BR (2 :: 1 :: k :: K1) R3 (a :: L2) := + by + unfold tok_AR tok_BR; texecute 15 + +private theorem tok_AR_add2_halts (K : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L1 : List ℕ) : + ∃ cfg_, ((tok_AR K R3 ((a + 2) :: L1)) [target]⊢⁺ cfg_) ∧ + (step target cfg_).isNone := by + refine ⟨((1 : Fin 2) >> (1 : Fin 2) >> encTokens K R3) {{F}}> (encRightNat (a :: L1)), ?_, + by simp only [encRightNat]; bb_halt⟩ + unfold tok_AR; texecute 2 + +/-! ## Weight and Lexicographic Measure -/ + +@[simp] +private def predNat : ℕ → ℕ + | 0 => 0 + | a + 1 => a + +@[simp] +private def wtL : List ℕ → ℕ + | [] => 0 + | [a] => predNat a + | a :: b :: L => a + wtL (b :: L) + +@[simp] private theorem predNat_succ (a : ℕ) : predNat (a + 1) = a := rfl + +@[simp] private theorem wtL_single (a : ℕ) : wtL [a] = predNat a := rfl + +@[simp] private theorem wtL_cons_cons (a b : ℕ) (L : List ℕ) : wtL (a :: b :: L) = + a + wtL (b :: L) := rfl + +@[simp] private theorem wtL_zero_cons (L : List ℕ) : wtL (0 :: L) = wtL L := by + rcases L with _ | ⟨b, L'⟩ + · rfl + · exact Nat.zero_add (wtL (b :: L')) + +private theorem wtL_1_1_cons (c : ℕ) (L3 : List ℕ) : wtL ((c + 2) :: L3) ≤ wtL (1 :: 1 :: c :: L3) + := by + rcases L3 with _ | ⟨d, L4⟩ + · rcases c with _ | c' + · decide + · simp only [wtL_cons_cons, wtL_single, predNat_succ]; omega + · simp only [wtL_cons_cons]; omega + +private theorem wtL_1_add2 (b : ℕ) (L2 : List ℕ) : wtL (b :: L2) + 2 ≤ wtL (1 :: (b + 2) :: L2) := + by + rcases L2 with _ | ⟨d, L3⟩ + · rcases b with _ | b' + · decide + · simp only [wtL_cons_cons, wtL_single, predNat_succ]; omega + · simp only [wtL_cons_cons]; omega + +@[simp] +private def sumL : List ℕ → ℕ + | [] => 0 + | a :: L => a + sumL L + +@[simp] +private def countNonOne : List ℕ → ℕ + | [] => 0 + | 0 :: K => 1 + countNonOne K + | 1 :: K => countNonOne K + | (_ + 2) :: K => 1 + countNonOne K + +@[simp] private theorem countNonOne_zero (K : List ℕ) : countNonOne (0 :: K) = 1 + countNonOne K := + rfl + +@[simp] private theorem countNonOne_one (K : List ℕ) : countNonOne (1 :: K) = countNonOne K := rfl + +@[simp] private theorem countNonOne_add2 (k : ℕ) (K : List ℕ) : countNonOne ((k + 2) :: K) = + 1 + countNonOne K := rfl + +private theorem countNonOne_cons_le (k : ℕ) (K : List ℕ) : countNonOne (k :: K) ≤ 1 + countNonOne K + := by + rcases k with _ | _ | k' + · exact Nat.le_refl _ + · exact Nat.le_add_left _ 1 + · exact Nat.le_refl _ + +private theorem le_countNonOne_cons (k : ℕ) (K : List ℕ) : countNonOne K ≤ countNonOne (k :: K) := + by + rcases k with _ | _ | k' + · exact Nat.le_add_left _ 1 + · exact Nat.le_refl _ + · exact Nat.le_add_left _ 1 + +@[simp] +private def scores : List ℕ → List (ℕ × ℕ) + | [] => [] + | 0 :: K => scores K ++ [(K.length, 0)] + | 1 :: K => scores K + | (k + 2) :: K => scores K ++ [(K.length, k + 2)] + +@[simp] private theorem scores_zero (K : List ℕ) : scores (0 :: K) = scores K ++ [(K.length, 0)] := + rfl + +@[simp] private theorem scores_one (K : List ℕ) : scores (1 :: K) = scores K := rfl + +@[simp] private theorem scores_add2 (k : ℕ) (K : List ℕ) : scores ((k + 2) :: K) = scores K ++ + [(K.length, k + 2)] := rfl + +private theorem scores_cons_ext (k : ℕ) (K : List ℕ) : ∃ ext, scores (k :: K) = scores K ++ ext := + by + rcases k with _ | _ | k' + · exact ⟨[(K.length, 0)], rfl⟩ + · exact ⟨[], (List.append_nil (scores K)).symm⟩ + · exact ⟨[(K.length, k' + 2)], rfl⟩ + +private theorem scores_length (K : List ℕ) : (scores K).length = countNonOne K := by + induction K with + | nil => rfl + | cons k K ih => + rcases k with _ | _ | k' + · simp only [scores_zero, countNonOne_zero, List.length_append, List.length_singleton, + ih]; omega + · exact ih + · dsimp only [scores, countNonOne] + rw [List.length_append, List.length_singleton, ih] + omega + +private def PairLt (p q : ℕ × ℕ) : Prop := + p.1 < q.1 ∨ (p.1 = q.1 ∧ p.2 < q.2) + +private inductive BoundedLex : ℕ → List (ℕ × ℕ) → List (ℕ × ℕ) → Prop + | head {m : ℕ} {x y : ℕ × ℕ} {xs ys : List (ℕ × ℕ)} : + PairLt x y → BoundedLex (m + 1) (x :: xs) (y :: ys) + | cons {m : ℕ} {z : ℕ × ℕ} {xs ys : List (ℕ × ℕ)} : + BoundedLex m xs ys → BoundedLex (m + 1) (z :: xs) (z :: ys) + +private theorem boundedLex_append (P : List (ℕ × ℕ)) {m : ℕ} {x y : ℕ × ℕ} (rest ext : List (ℕ × ℕ)) + (hxy : PairLt x y) (hlen : P.length < m) : + BoundedLex m (P ++ (x :: ext)) (P ++ (y :: rest)) := by + induction P generalizing m with + | nil => + rcases m with _ | m' + · omega + · exact BoundedLex.head hxy + | cons z P' ih => + rcases m with _ | m' + · simp at hlen + · simp only [List.cons_append] + exact BoundedLex.cons (ih (by simp at hlen; omega)) + +private theorem boundedLex_acc_snd (m a : ℕ) + (ih_m : ∀ xs, Acc (BoundedLex m) xs) + (ih_a : ∀ a' < a, ∀ b ys, Acc (BoundedLex (m + 1)) ((a', b) :: ys)) + (n : ℕ) : + ∀ b ≤ n, ∀ ys, Acc (BoundedLex (m + 1)) ((a, b) :: ys) := by + induction n with + | zero => + intro b hb ys + have hb0 : b = 0 := by omega + subst hb0 + induction (ih_m ys) with + | intro ys _ ih_ys => + refine Acc.intro ((a, 0) :: ys) (fun zs h => ?_) + cases h with + | @head _ x _ xs _ hlt => + rcases x with ⟨a', b'⟩ + rcases hlt with ha' | ⟨rfl, hb'⟩ + · exact ih_a a' ha' b' xs + · dsimp at hb'; omega + | cons hsub => exact ih_ys _ hsub + | succ n ih_n => + intro b hb ys + rcases Nat.of_le_succ hb with hle | rfl + · exact ih_n b hle ys + · induction (ih_m ys) with + | intro ys _ ih_ys => + refine Acc.intro ((a, n + 1) :: ys) (fun zs h => ?_) + cases h with + | @head _ x _ xs _ hlt => + rcases x with ⟨a', b'⟩ + rcases hlt with ha' | ⟨rfl, hb'⟩ + · exact ih_a a' ha' b' xs + · dsimp at hb'; exact ih_n b' (by omega) xs + | cons hsub => exact ih_ys _ hsub + +private theorem boundedLex_acc_fst (m : ℕ) (ih_m : ∀ xs, Acc (BoundedLex m) xs) (n : ℕ) : + ∀ a ≤ n, ∀ b ys, Acc (BoundedLex (m + 1)) ((a, b) :: ys) := by + induction n with + | zero => + intro a ha b ys + have ha0 : a = 0 := by omega + subst ha0 + exact boundedLex_acc_snd m 0 ih_m (fun _ hlt => by omega) b b (Nat.le_refl b) ys + | succ n ih_n => + intro a ha b ys + rcases Nat.of_le_succ ha with hle | rfl + · exact ih_n a hle b ys + · exact boundedLex_acc_snd m (n + 1) ih_m (fun a' hlt => ih_n a' (by omega)) b b (Nat.le_refl b) + ys + +private theorem boundedLex_acc (m : ℕ) (xs : List (ℕ × ℕ)) : Acc (BoundedLex m) xs := by + induction m generalizing xs with + | zero => exact Acc.intro xs (fun _ h => nomatch h) + | succ m ih_m => + rcases xs with _ | ⟨⟨a, b⟩, ys⟩ + · exact Acc.intro [] (fun _ h => nomatch h) + · exact boundedLex_acc_fst m ih_m a a (Nat.le_refl a) b ys + +/-! ## Bounce Lemmas for `AR` and `BR` -/ + +private theorem bounce_len (R3 : List (ℕ × ℕ)) (n : ℕ) : + ∀ (L : List ℕ), 2 * sumL L + L.length ≤ n → + (∀ (k0 : ℕ) (K_acc : List ℕ), + (∃ cfg_, ((tok_AR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ + (∃ K_out L_out, ((tok_AR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ + tok_CL K_out R3 (0 :: L_out)) ∧ + (∃ ext, scores K_out = scores K_acc ++ ext) ∧ + (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∨ + (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + 1 + wtL L ∧ + (k0 ≠ 0 → ∃ d ext, scores K_out = scores K_acc ++ ((K_acc.length, d) :: ext)))))) ∧ + (∀ (K_acc : List ℕ), + (∃ cfg_, ((tok_BR (2 :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ + (∃ K_out L_out, ((tok_BR (2 :: K_acc) R3 L) [target]⊢⁺ tok_CL K_out R3 (0 :: L_out)) ∧ + countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∧ + (∃ ext, scores K_out = scores K_acc ++ ext))) := by + induction n with + | zero => + intro L hlen + rcases L with _ | ⟨a, L1⟩ + · refine ⟨fun k0 K_acc => ?_, fun K_acc => ?_⟩ + · rcases k0 with _ | k' + · refine Or.inr ⟨K_acc, [1], tok_AR_1_nil_9 K_acc R3, ⟨[], by simp⟩, Or.inl (by simp)⟩ + · rcases k' with _ | m + · refine Or.inr ⟨0 :: K_acc, [0, 1], tok_AR_add2_nil_21 0 K_acc R3, ⟨[(K_acc.length, 0)], + by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨0, [], by simp⟩⟩⟩ + · rcases m with _ | m' + · refine Or.inr ⟨1 :: K_acc, [0, 1], tok_AR_add2_nil_21 1 K_acc R3, ⟨[], by simp⟩, + Or.inl (by simp)⟩ + · refine Or.inr ⟨(m' + 2) :: K_acc, [0, 1], tok_AR_add2_nil_21 (m' + 2) K_acc R3, + ⟨[(K_acc.length, m' + 2)], by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨m' + 2, [], + by simp⟩⟩⟩ + · exact Or.inr ⟨K_acc, [1], tok_BR_nil_8 K_acc R3, by simp, ⟨[], by simp⟩⟩ + · simp at hlen + | succ n ih_n => + intro L hlen + rcases Nat.of_le_succ hlen with hle | heq + · exact ih_n L hle + · refine ⟨fun k0 K_acc => ?_, fun K_acc => ?_⟩ + · rcases L with _ | ⟨a, L1⟩ + · simp at heq + · rcases a with _ | _ | a' + · have hstep1 := tok_AR_zero (k0 + 1) K_acc R3 L1 + rcases (ih_n L1 (by simp at heq ⊢; omega)).1 (k0 + 2) K_acc with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hext, hbr⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, hext, ?_⟩ + rcases hbr with hlt | ⟨hle, hd⟩ + · exact Or.inl (by simpa using hlt) + · exact Or.inr ⟨by simpa using hle, fun _ => hd (by omega)⟩ + · rcases L1 with _ | ⟨b, L2⟩ + · rcases k0 with _ | k' + · refine Or.inr ⟨1 :: K_acc, [0, 0, 1], tok_AR_1_nil_33 1 K_acc R3, ⟨[], by simp⟩, + Or.inl (by simp)⟩ + · refine Or.inr ⟨(k' + 2) :: K_acc, [0, 0, 1], tok_AR_1_nil_33 (k' + 2) K_acc R3, + ⟨[(K_acc.length, k' + 2)], by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨k' + 2, [], + by simp⟩⟩⟩ + · rcases b with _ | _ | b' + · have hstep1 := tok_AR_1_0 (k0 + 1) K_acc R3 L2 + rcases (ih_n L2 (by simp at heq ⊢; omega)).1 0 ((k0 + 4) :: K_acc) with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · have hsc' : scores K_out = scores K_acc ++ ((K_acc.length, k0 + 4) :: ext) := by + simpa [scores_add2 (k0 + 2) K_acc, List.append_assoc] using hsc + refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ⟨(K_acc.length, + k0 + 4) :: ext, hsc'⟩, ?_⟩ + have hwt : wtL ((0 + 1) :: 0 :: L2) = 1 + wtL L2 := by simp + have hcnt : countNonOne ((k0 + 4) :: K_acc) = 1 + countNonOne K_acc := + countNonOne_add2 (k0 + 2) K_acc + rcases hbr with hlt | ⟨hle, _⟩ + · exact Or.inl (by omega) + · exact Or.inr ⟨by omega, fun _ => ⟨k0 + 4, ext, hsc'⟩⟩ + · rcases L2 with _ | ⟨c, L3⟩ + · have hstep := tok_AR_1_1_nil_25 (k0 + 1) K_acc R3 + have hcnt := countNonOne_cons_le (k0 + 1) K_acc + refine Or.inr ⟨(k0 + 1) :: K_acc, [0, 1], hstep, scores_cons_ext (k0 + 1) K_acc, + Or.inl ?_⟩ + simp at hcnt ⊢; omega + · have hstep := tok_AR_1_1_cons_25 (k0 + 1) K_acc R3 c L3 + have hwt : wtL ((c + 2) :: L3) ≤ wtL ((0 + 1) :: (0 + 1) :: c :: L3) := + wtL_1_1_cons c L3 + rcases k0 with _ | k' + · refine Or.inr ⟨1 :: K_acc, 0 :: (c + 2) :: L3, hstep, ⟨[], by simp⟩, Or.inl ?_⟩ + simp only [countNonOne_one, wtL_zero_cons]; omega + · refine Or.inr ⟨(k' + 2) :: K_acc, 0 :: (c + 2) :: L3, hstep, ⟨[(K_acc.length, + k' + 2)], by simp⟩, Or.inr ⟨?_, fun _ => ⟨k' + 2, [], by simp⟩⟩⟩ + simp only [countNonOne_add2, wtL_zero_cons]; omega + · have hstep1 := tok_AR_1_add2 (k0 + 1) K_acc R3 b' L2 + rcases (ih_n (b' :: L2) (by simp at heq ⊢; omega)).2 (1 :: (k0 + 1) :: K_acc) with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · obtain ⟨ext0, hsc0⟩ := scores_cons_ext (k0 + 1) K_acc + have hcnt := countNonOne_cons_le (k0 + 1) K_acc + have hwt : wtL (b' :: L2) + 2 ≤ wtL ((0 + 1) :: (b' + 1 + 1) :: L2) := + wtL_1_add2 b' L2 + refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ⟨ext0 ++ ext, + by simp [hsc, hsc0, List.append_assoc]⟩, Or.inl ?_⟩ + simp only [countNonOne_one] at hle + omega + · exact Or.inl (tok_AR_add2_halts ((k0 + 1) :: K_acc) R3 a' L1) + · rcases L with _ | ⟨a, L1⟩ + · simp at heq + · rcases a with _ | a' + · have hstep1 := tok_BR_zero K_acc R3 L1 + rcases (ih_n L1 (by simp at heq ⊢; omega)).2 (1 :: K_acc) with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · exact Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, by simpa using hle, ⟨ext, + by simpa using hsc⟩⟩ + · rcases L1 with _ | ⟨b, L2⟩ + · rcases a' with _ | a'' + · exact Or.inr ⟨1 :: K_acc, [0, 0, 1], tok_BR_1_nil_28 K_acc R3, by simp, ⟨[], + by simp⟩⟩ + · have hstep1 := tok_BR_succ K_acc R3 (a'' + 1) [] + rcases (ih_n [a'' + 1] (by simp at heq ⊢; omega)).1 0 (1 :: K_acc) with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ?_, ⟨ext, + by simpa using hsc⟩⟩ + rcases hbr with hlt | ⟨hle, _⟩ + · simp at hlt ⊢; omega + · simp at hle ⊢; omega + · have hstep1 := tok_BR_succ K_acc R3 a' (b :: L2) + rcases (ih_n (a' :: b :: L2) (by simp at heq ⊢; omega)).1 0 (1 :: K_acc) with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ + · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ?_, ⟨ext, + by simpa using hsc⟩⟩ + rcases hbr with hlt | ⟨hle, _⟩ + · simp at hlt ⊢; omega + · simp at hle ⊢; omega + +private theorem bounce_AR (R3 : List (ℕ × ℕ)) (k0 : ℕ) (K_acc : List ℕ) (L : List ℕ) : + (∃ cfg_, ((tok_AR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ + (∃ K_out L_out, ((tok_AR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ tok_CL K_out R3 (0 :: L_out)) ∧ + (∃ ext, scores K_out = scores K_acc ++ ext) ∧ + (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∨ + (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + 1 + wtL L ∧ + (k0 ≠ 0 → ∃ d ext, scores K_out = scores K_acc ++ ((K_acc.length, d) :: ext))))) := + (bounce_len R3 (2 * sumL L + L.length) L (Nat.le_refl _)).1 k0 K_acc + +private theorem bounce_BR (R3 : List (ℕ × ℕ)) (K_acc : List ℕ) (L : List ℕ) : + (∃ cfg_, ((tok_BR (2 :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ + (∃ K_out L_out, ((tok_BR (2 :: K_acc) R3 L) [target]⊢⁺ tok_CL K_out R3 (0 :: L_out)) ∧ + countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∧ + (∃ ext, scores K_out = scores K_acc ++ ext)) := + (bounce_len R3 (2 * sumL L + L.length) L (Nat.le_refl _)).2 K_acc + +/-! ## Token System Termination -/ + +private theorem bl_step_macro_len (R3 : List (ℕ × ℕ)) (n : ℕ) : + ∀ (K : List ℕ), K.length ≤ n → ∀ (L : List ℕ), + (∃ cfg_, ((tok_CL K R3 (0 :: L)) [target]⊢* cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone)) ∨ + (∃ K' L', ((tok_CL K R3 (0 :: L)) [target]⊢⁺ tok_CL K' R3 (0 :: L')) ∧ + countNonOne K' + wtL L' < countNonOne K + wtL L) ∨ + (∃ K' L' P x y rest ext, ((tok_CL K R3 (0 :: L)) [target]⊢⁺ tok_CL K' R3 (0 :: L')) ∧ + countNonOne K' + wtL L' = countNonOne K + wtL L ∧ PairLt x y ∧ + scores K = P ++ (y :: rest) ∧ scores K' = P ++ (x :: ext)) := by + induction n with + | zero => + intro K hlen L + cases K with + | nil => + refine Or.inl ⟨cfg_CL_n_n ((0 :: L).map (fun x => (x, 0))) R3, ⟨0, ?_⟩, + Or.inl ⟨.CL_n_n, R3, (0 :: L).map (fun x => (x, 0)), rfl⟩⟩ + unfold tok_CL cfg_CL_n_n + rw [encTokens_nil, encRightNat_eq] + rfl + | cons _ _ => simp at hlen + | succ n ih_n => + intro K hlen L + rcases K with _ | ⟨k1, K1⟩ + · refine Or.inl ⟨cfg_CL_n_n ((0 :: L).map (fun x => (x, 0))) R3, ⟨0, ?_⟩, + Or.inl ⟨.CL_n_n, R3, (0 :: L).map (fun x => (x, 0)), rfl⟩⟩ + unfold tok_CL cfg_CL_n_n + rw [encTokens_nil, encRightNat_eq] + rfl + · rcases k1 with _ | _ | _ | k' + · rcases K1 with _ | ⟨k2, K2⟩ + · exact Or.inl ⟨cfg_AR_n_n ((0 :: L).map (fun x => (x, 0))) (bumpPairHead R3), + ReachesPlus.to_star (tok_CL_exit_zero R3 (0 :: L)), + Or.inl ⟨.AR_n_n, bumpPairHead R3, (0 :: L).map (fun x => (x, 0)), rfl⟩⟩ + · have hstep1 := + ReachesPlus.trans (tok_CL_0_cons k2 K2 R3 (0 :: L)) (tok_AR_zero (k2 + 1) K2 R3 L) + rcases bounce_AR R3 (k2 + 2) K2 L with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, _, hbr⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans hstep1 hstep2), Or.inr hhalt⟩ + · have hstep := ReachesPlus.trans hstep1 hstep2 + rcases hbr with hlt | ⟨hle, hd⟩ + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + have hcnt := le_countNonOne_cons k2 K2 + simp only [countNonOne_zero]; omega + · rcases k2 with _ | _ | k2' + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [countNonOne_zero]; omega + · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [Nat.zero_add, countNonOne_zero, countNonOne_one]; omega + · obtain ⟨d, ext, hsc_out⟩ := hd (by omega) + refine Or.inr (Or.inr ⟨K_out, L_out, scores K2, (K2.length, d), ((1 :: K2).length, + 0), + [], ext, hstep, by simp only [Nat.zero_add, countNonOne_zero, + countNonOne_one]; omega, + Or.inl (by simp), by simp, hsc_out⟩) + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [countNonOne_zero, countNonOne_add2]; omega + · have hstep1 := tok_CL_1 K1 R3 (0 :: L) + rcases ih_n K1 (by simp at hlen; omega) (0 :: L) with + ⟨cfg_, hstep2, hsys⟩ | + ⟨K', L', hstep2, hlt⟩ | + ⟨K', L', P, x, y, rest, ext, hstep2, heq, hxy, hsc1, hsc2⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep1 hstep2), hsys⟩ + · refine Or.inr (Or.inl ⟨K', L', ReachesPlus.trans hstep1 hstep2, ?_⟩) + simpa using hlt + · refine Or.inr (Or.inr ⟨K', L', P, x, y, rest, ext, ReachesPlus.trans hstep1 hstep2, + by simpa using heq, hxy, by simpa using hsc1, hsc2⟩) + · have hstep1 := tok_CL_2 K1 R3 L + rcases L with _ | ⟨a, L1⟩ + · refine Or.inr (Or.inl ⟨K1, [1], hstep1, ?_⟩) + simp + · have hwt1 : wtL (1 :: a :: L1) = 1 + wtL (a :: L1) := by simp + rcases ih_n K1 (by simp at hlen; omega) (1 :: a :: L1) with + ⟨cfg_, hstep2, hsys⟩ | + ⟨K', L', hstep2, hlt⟩ | + ⟨K', L', P, x, y, rest, ext, hstep2, heq, hxy, hsc1, hsc2⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep1 hstep2), hsys⟩ + · refine Or.inr (Or.inl ⟨K', L', ReachesPlus.trans hstep1 hstep2, ?_⟩) + simp only [countNonOne_add2 0 K1]; omega + · refine Or.inr (Or.inr ⟨K', L', P, x, y, rest ++ [(K1.length, 2)], ext, + ReachesPlus.trans hstep1 hstep2, by simp only [countNonOne_add2 0 K1]; omega, + hxy, by simp [hsc1, List.append_assoc], hsc2⟩) + · have hstep1 := + ReachesPlus.trans (tok_CL_add3 k' K1 R3 (0 :: L)) (tok_BR_zero (k' :: K1) R3 L) + rcases bounce_BR R3 (1 :: k' :: K1) L with + ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ + · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans hstep1 hstep2), Or.inr hhalt⟩ + · have hstep := ReachesPlus.trans hstep1 hstep2 + simp only [countNonOne_one, scores_one] at hle hsc + rcases k' with _ | _ | k'' + · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [countNonOne_zero, countNonOne_add2] at hlt' ⊢; omega + · refine Or.inr (Or.inr ⟨K_out, L_out, scores K1, (K1.length, 0), (K1.length, 3), + [], ext, hstep, by simp only [countNonOne_zero, countNonOne_add2] at heq' ⊢; omega, + Or.inr ⟨rfl, by simp⟩, by simp, + by simpa [List.append_assoc] using hsc⟩) + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [Nat.zero_add, countNonOne_one, countNonOne_add2] at hle ⊢; omega + · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' + · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) + simp only [countNonOne_add2] at hlt' ⊢; omega + · refine Or.inr (Or.inr ⟨K_out, L_out, scores K1, (K1.length, k'' + 2), (K1.length, + k'' + 5), + [], ext, hstep, by simp only [countNonOne_add2] at heq' ⊢; omega, + Or.inr ⟨rfl, by simp⟩, by simp, + by simpa [List.append_assoc] using hsc⟩) + +private theorem bl_terminates_acc (R3 : List (ℕ × ℕ)) (m : ℕ) + (ih_m : ∀ (K : List ℕ) (L : List ℕ), + countNonOne K + wtL L < m → + ∃ cfg_, ((tok_CL K R3 (0 :: L)) [target]⊢* cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone)) + (S : List (ℕ × ℕ)) (hacc : Acc (BoundedLex m) S) : + ∀ (K : List ℕ) (L : List ℕ), + scores K = S → countNonOne K + wtL L = m → + ∃ cfg_, ((tok_CL K R3 (0 :: L)) [target]⊢* cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + induction hacc with + | intro S _ ih_acc => + intro K L hS hm + rcases bl_step_macro_len R3 K.length K (Nat.le_refl K.length) L with + ⟨cfg_, hstep, hsys⟩ | + ⟨K', L', hstep, hlt⟩ | + ⟨K', L', P, x, y, rest, ext, hstep, heq, hxy, hsc1, hsc2⟩ + · exact ⟨cfg_, hstep, hsys⟩ + · obtain ⟨cfg_, hstep2, hsys⟩ := ih_m K' L' (by omega) + exact ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep hstep2), hsys⟩ + · have hlenP : P.length < m := by + have hlenK := scores_length K + rw [hsc1, List.length_append, List.length_cons] at hlenK + omega + have hlex : BoundedLex m (scores K') S := by + rw [← hS, hsc1, hsc2] + exact boundedLex_append P rest ext hxy hlenP + obtain ⟨cfg_, hstep2, hsys⟩ := ih_acc (scores K') hlex K' L' rfl (by omega) + exact ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep hstep2), hsys⟩ + +private theorem bl_terminates_le (R3 : List (ℕ × ℕ)) (n : ℕ) : + ∀ (m : ℕ), m ≤ n → ∀ (K : List ℕ) (L : List ℕ), + countNonOne K + wtL L = m → + ∃ cfg_, ((tok_CL K R3 (0 :: L)) [target]⊢* cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + induction n with + | zero => + intro m hm K L hM + have hm0 : m = 0 := by omega + subst hm0 + exact bl_terminates_acc R3 0 (fun _ _ hlt => by omega) (scores K) (boundedLex_acc 0 (scores K)) + K L rfl hM + | succ n ih_n => + intro m hm K L hM + rcases Nat.of_le_succ hm with hle | rfl + · exact ih_n m hle K L hM + · refine bl_terminates_acc R3 (n + 1) (fun K' L' hlt => ?_) + (scores K) (boundedLex_acc (n + 1) (scores K)) K L rfl hM + exact ih_n (countNonOne K' + wtL L') (by omega) K' L' rfl + +private theorem tok_BR_2_0_closed (R3 : List (ℕ × ℕ)) (L : List ℕ) : + ∃ cfg_, ((tok_BR [2, 0] R3 L) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases bounce_BR R3 [0] L with ⟨cfg_, hstep, hhalt⟩ | ⟨K_out, L_out, hstep, _, _⟩ + · exact ⟨cfg_, hstep, Or.inr hhalt⟩ + · obtain ⟨cfg_, hstep2, hsys⟩ := bl_terminates_le R3 (countNonOne K_out + wtL L_out) + (countNonOne K_out + wtL L_out) (Nat.le_refl _) K_out L_out rfl + exact ⟨cfg_, ReachesPlus.trans_star hstep hstep2, hsys⟩ + +private theorem tok_AR_1_0_closed (R3 : List (ℕ × ℕ)) (L : List ℕ) : + ∃ cfg_, ((tok_AR [1, 0] R3 L) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases bounce_AR R3 0 [0] L with ⟨cfg_, hstep, hhalt⟩ | ⟨K_out, L_out, hstep, _, _⟩ + · exact ⟨cfg_, hstep, Or.inr hhalt⟩ + · obtain ⟨cfg_, hstep2, hsys⟩ := bl_terminates_le R3 (countNonOne K_out + wtL L_out) + (countNonOne K_out + wtL L_out) (Nat.le_refl _) K_out L_out rfl + exact ⟨cfg_, ReachesPlus.trans_star hstep hstep2, hsys⟩ + +/-! ## Mode Closure Theorems -/ + +private theorem mode_AR_n_n_closed (L R : List (ℕ × ℕ)) : + ∃ cfg_, ((cfg_AR_n_n L R) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases L with _ | ⟨⟨a1, b2⟩, L3⟩ + · refine ⟨cfg_CL_n_n [(0, 0)] (bumpPairHead R), ?_, Or.inl ⟨.CL_n_n, bumpPairHead R, [(0, 0)], + rfl⟩⟩ + unfold cfg_AR_n_n cfg_CL_n_n + rw [encRight_d0_s0 [], ← encLeft_cons_one R] + execute 2 + · rcases a1 with _ | a5 + · refine ⟨cfg_AR_n_n L3 (bumpPairHead (bumpPairHead R)), ?_, Or.inl ⟨.AR_n_n, + bumpPairHead (bumpPairHead R), L3, rfl⟩⟩ + unfold cfg_AR_n_n + rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, + ← encLeft_cons_one (bumpPairHead R), ← encLeft_cons_one R] + execute 2 + · rcases a5 with _ | a14 + · rcases L3 with _ | ⟨⟨a6, b7⟩, L8⟩ + · refine ⟨cfg_CL_n_n [(0, 0)] ((0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R))), ?_, + Or.inl ⟨.CL_n_n, (0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R)), [(0, 0)], rfl⟩⟩ + unfold cfg_AR_n_n cfg_CL_n_n + rw [encRight_mod1 1 b2 [], Nat.mod_one b2, encRight_d1_s0 [], encRight_d0_s0 [], + encLeft_d0_s0 (bumpPairHead (bumpPairHead (bumpPairHead R))), + ← encLeft_cons_one (bumpPairHead (bumpPairHead R)), + ← encLeft_cons_one (bumpPairHead R), ← encLeft_cons_one R] + execute 6 + · rcases a6 with _ | a10 + · refine ⟨cfg_AR_n_n L8 ((0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R))), ?_, + Or.inl ⟨.AR_n_n, (0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R)), L8, rfl⟩⟩ + unfold cfg_AR_n_n + rw [encRight_mod1 1 b2 ((0, b7) :: L8), Nat.mod_one b2, encRight_d1_s0 ((0, b7) :: L8), + encRight_mod1 0 b7 L8, Nat.mod_one b7, encRight_d0_s0 L8, + encLeft_d0_s0 (bumpPairHead (bumpPairHead (bumpPairHead R))), + ← encLeft_cons_one (bumpPairHead (bumpPairHead R)), + ← encLeft_cons_one (bumpPairHead R), ← encLeft_cons_one R] + execute 5 + · rcases a10 with _ | a11 + · refine ⟨cfg_CL_n_n (bumpPairHead L8) ((1, 0) :: (0, 0) :: R), ?_, Or.inl ⟨.CL_n_n, (1, + 0) :: (0, 0) :: R, bumpPairHead L8, rfl⟩⟩ + unfold cfg_AR_n_n cfg_CL_n_n + rw [encRight_mod1 1 b2 ((1, b7) :: L8), Nat.mod_one b2, + encRight_d1_s0 ((1, b7) :: L8), encRight_mod1 1 b7 L8, Nat.mod_one b7, + encRight_d1_s0 L8, ← encRight_cons_one L8, encLeft_d1_s0 ((0, 0) :: R), + encLeft_d0_s0 R] + execute 16 + · refine ⟨cfg_BR_n_n ((a11, 0) :: L8) ((1, 0) :: (0, 0) :: R), ?_, Or.inl ⟨.BR_n_n, (1, + 0) :: (0, 0) :: R, (a11, 0) :: L8, rfl⟩⟩ + unfold cfg_AR_n_n cfg_BR_n_n + rw [encRight_mod1 1 b2 ((a11 + 2, b7) :: L8), Nat.mod_one b2, + encRight_d1_s0 ((a11 + 2, b7) :: L8), encRight_mod1 (a11 + 2) b7 L8, + Nat.mod_one b7, encRight_succ (a11 + 1) 0 L8, encRight_succ a11 0 L8, + encRight_run_s0 a11 L8, encLeft_d1_s0 ((0, 0) :: R), encLeft_d0_s0 R] + execute 15 + · refine ⟨((1 : Fin 2) >> (1 : Fin 2) >> encLeft R) {{F}}> (encRight ((a14, 0) :: L3)), ?_, + Or.inr (by rw [encRight_run_s0]; bb_halt)⟩ + unfold cfg_AR_n_n + rw [encRight_mod1 (a14 + 2) b2 L3, Nat.mod_one b2, encRight_succ (a14 + 1) 0 L3, + encRight_succ a14 0 L3] + execute 2 + +private theorem mode_CL_n_n_closed (L R : List (ℕ × ℕ)) : + ∃ cfg_, ((cfg_CL_n_n L R) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases R with _ | ⟨⟨r1, b2⟩, R3⟩ + · refine ⟨cfg_AR_n_n L [(0, 0)], ?_, Or.inl ⟨.AR_n_n, [(0, 0)], L, rfl⟩⟩ + unfold cfg_CL_n_n cfg_AR_n_n + rw [encLeft_d0_s0 []] + execute 1 + · rcases r1 with _ | r5 + · refine ⟨cfg_CL_n_n ((0, 0) :: L) R3, ?_, Or.inl ⟨.CL_n_n, R3, (0, 0) :: L, rfl⟩⟩ + unfold cfg_CL_n_n + rw [encLeft_mod1 0 b2 R3, Nat.mod_one b2, encLeft_d0_s0 R3, encRight_d0_s0 L] + execute 2 + · refine ⟨cfg_BL_0_n L ((r5, 0) :: R3), ?_, Or.inl ⟨.BL_0_n, (r5, 0) :: R3, L, rfl⟩⟩ + unfold cfg_CL_n_n cfg_BL_0_n + rw [encLeft_mod1 (r5 + 1) b2 R3, Nat.mod_one b2, encLeft_succ r5 0 R3, encLeft_run_s0 r5 R3] + execute 1 + +private theorem mode_BL_0_n_closed (L R : List (ℕ × ℕ)) : + ∃ cfg_, ((cfg_BL_0_n L R) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases R with _ | ⟨⟨r1, b2⟩, R3⟩ + · refine ⟨cfg_AR_n_n L [(2, 0)], ?_, Or.inl ⟨.AR_n_n, [(2, 0)], L, rfl⟩⟩ + unfold cfg_BL_0_n cfg_AR_n_n + rw [encLeft_succ 1 0 [], encLeft_d1_s0 []] + execute 4 + · rcases r1 with _ | _ | r5 + · refine ⟨cfg_CL_n_n ((0, 0) :: bumpPairHead L) R3, ?_, Or.inl ⟨.CL_n_n, R3, (0, + 0) :: bumpPairHead L, rfl⟩⟩ + unfold cfg_BL_0_n cfg_CL_n_n + rw [encLeft_mod1 0 b2 R3, Nat.mod_one b2, encLeft_d0_s0 R3, encRight_d0_s0 (bumpPairHead L), + ← encRight_cons_one L] + execute 6 + · obtain ⟨cfg_, hstep2, hsys⟩ := tok_BR_2_0_closed R3 (L.map Prod.fst) + refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ + unfold cfg_BL_0_n tok_BR + rw [encLeft_mod1 1 b2 R3, Nat.mod_one b2, encLeft_d1_s0 R3, encRight_eq_nat L, + encTokens_succ, encTokens_succ, encTokens_zero, encTokens_zero, encTokens_nil] + texecute 4 + · refine ⟨cfg_BR_n_n L ((1, 0) :: (r5, 0) :: R3), ?_, Or.inl ⟨.BR_n_n, (1, 0) :: (r5, 0) :: R3, + L, rfl⟩⟩ + unfold cfg_BL_0_n cfg_BR_n_n + rw [encLeft_mod1 (r5 + 2) b2 R3, Nat.mod_one b2, encLeft_succ (r5 + 1) 0 R3, + encLeft_succ r5 0 R3, encLeft_run_s0 r5 R3, encLeft_d1_s0 ((r5, 0) :: R3), + encLeft_run_s0 r5 R3] + execute 4 + +private theorem mode_BR_n_n_closed (L R : List (ℕ × ℕ)) : + ∃ cfg_, ((cfg_BR_n_n L R) [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases L with _ | ⟨⟨a1, b2⟩, L3⟩ + · refine ⟨cfg_CL_n_n [(0, 0)] R, ?_, Or.inl ⟨.CL_n_n, R, [(0, 0)], rfl⟩⟩ + unfold cfg_BR_n_n cfg_CL_n_n + rw [encRight_d0_s0 []] + execute 1 + · rcases R with _ | ⟨⟨r1, b4⟩, R3⟩ + · rcases a1 with _ | a5 + · refine ⟨cfg_CL_n_n (bumpPairHead L3) [(0, 0)], ?_, Or.inl ⟨.CL_n_n, [(0, 0)], + bumpPairHead L3, rfl⟩⟩ + unfold cfg_BR_n_n cfg_CL_n_n + rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, ← encRight_cons_one L3, + encLeft_d0_s0 []] + execute 4 + · refine ⟨cfg_BR_n_n ((a5, 0) :: L3) [(0, 0)], ?_, Or.inl ⟨.BR_n_n, [(0, 0)], (a5, 0) :: L3, + rfl⟩⟩ + unfold cfg_BR_n_n + rw [encRight_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encRight_succ a5 0 L3, + encRight_run_s0 a5 L3, encLeft_d0_s0 []] + execute 3 + · rcases r1 with _ | r5 + · rcases a1 with _ | a5 + · obtain ⟨cfg_, hstep2, hsys⟩ := tok_BR_2_0_closed R3 (L3.map Prod.fst) + refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ + unfold cfg_BR_n_n tok_BR + rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, encLeft_mod1 0 b4 R3, + Nat.mod_one b4, encLeft_d0_s0 R3, encRight_eq_nat L3, encTokens_succ, encTokens_succ, + encTokens_zero, encTokens_zero, encTokens_nil] + texecute 4 + · obtain ⟨cfg_, hstep2, hsys⟩ := tok_AR_1_0_closed R3 (a5 :: L3.map Prod.fst) + refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ + unfold cfg_BR_n_n tok_AR + rw [encRight_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encRight_succ a5 0 L3, + encRight_run_s0 a5 L3, encLeft_mod1 0 b4 R3, Nat.mod_one b4, encLeft_d0_s0 R3, + encRight_eq_nat L3, encTokens_succ, encTokens_zero, encTokens_zero, encTokens_nil] + change (((1 : Fin 2) >> (0 : Fin 2) >> encLeft R3) {{B}}> ((1 : Fin 2) >> + encRightNat (a5 :: List.map Prod.fst L3))) [target]⊢⁺ (((1 : Fin 2) >> (0 : Fin 2) >> + (0 : Fin 2) >> encLeft R3) {{A}}> (encRightNat (a5 :: List.map Prod.fst L3))) + texecute 3 + · rcases a1 with _ | a5 + · refine ⟨cfg_BR_n_n L3 ((1, 0) :: (r5, 0) :: R3), ?_, Or.inl ⟨.BR_n_n, (1, 0) :: (r5, + 0) :: R3, L3, rfl⟩⟩ + unfold cfg_BR_n_n + rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, + encLeft_mod1 (r5 + 1) b4 R3, Nat.mod_one b4, encLeft_succ r5 0 R3, + encLeft_run_s0 r5 R3, encLeft_d1_s0 ((r5, 0) :: R3), encLeft_run_s0 r5 R3] + execute 4 + · refine ⟨cfg_AR_n_n ((a5, 0) :: L3) ((0, 0) :: (r5, 0) :: R3), ?_, Or.inl ⟨.AR_n_n, (0, + 0) :: (r5, 0) :: R3, (a5, 0) :: L3, rfl⟩⟩ + unfold cfg_BR_n_n cfg_AR_n_n + rw [encRight_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encRight_succ a5 0 L3, + encRight_run_s0 a5 L3, encLeft_mod1 (r5 + 1) b4 R3, Nat.mod_one b4, + encLeft_succ r5 0 R3, encLeft_run_s0 r5 R3, encLeft_d0_s0 ((r5, 0) :: R3), + encLeft_run_s0 r5 R3] + execute 3 + +private theorem stack_system_closed (cfg : Cfg (Fin 2) (Fin 6)) (h : IsInStackSystem cfg) : + ∃ cfg_, (cfg [target]⊢⁺ cfg_) ∧ + (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by + rcases h with ⟨m, R, L, rfl⟩ + cases m with + | AR_n_n => exact mode_AR_n_n_closed L R + | CL_n_n => exact mode_CL_n_n_closed L R + | BL_0_n => exact mode_BL_0_n_closed L R + | BR_n_n => exact mode_BR_n_n_closed L R + +private theorem init_reaches_nontrivial : + (init []) [target]⊢⁺ evalStackCfg .BR_n_n [(3, 0)] [(0, 0), (0, 0)] := by + have hL : encLeft [(3, 0)] = + (1 : Fin 2) >> (1 : Fin 2) >> (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default := rfl + have hR : encRight [(0, 0), (0, 0)] = + (1 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default := rfl + dsimp only [evalStackCfg, cfg_BR_n_n] + rw [hL, hR] + execute 12 + +private theorem step_CL_transfer (z : ℕ × ℕ) (L R : List (ℕ × ℕ)) : + (evalStackCfg .CL_n_n ((0, 0) :: z :: L) R) [target]⊢⁺ + evalStackCfg .CL_n_n (z :: L) ((0, 0) :: R) := by + dsimp only [evalStackCfg, cfg_CL_n_n] + rw [encLeft_d0_s0 (z :: L), encRight_d0_s0 R] + execute 2 + +private theorem encRight_head (a b : ℕ) (L : List (ℕ × ℕ)) : + (encRight ((a, b) :: L)).head = 1 := by + rw [encRight_cons, show 1 * a + 1 = (1 * a + 0) + 1 by omega, list_pow_succ, List.cons_append] + simp only [ListBlank.append_cons, ListBlank.head_cons] + +private theorem encRight_not_surjective : + ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ L : List (ℕ × ℕ), encRight L ≠ t := by + refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ + intro L h + rcases L with _ | ⟨⟨a, b⟩, L'⟩ + · have h1 := congrArg (fun s => s.head) h + simp at h1 + · rw [encRight_mod1] at h + have hb0 : b % 1 = 0 := Nat.mod_one b + rw [hb0, encRight_run_s0] at h + rcases a with _ | a' + · rcases L' with _ | ⟨⟨a', b'⟩, L''⟩ + · have h2 := congrArg (fun s => s.tail.tail.tail.head) h + simp at h2 + · have h1 := congrArg (fun s => s.tail.tail.head) h + normalize_at h1 + rw [encRight_head a' b' L''] at h1; contradiction + · have h1 := congrArg (fun s => s.tail.head) h + normalize_at h1 + contradiction + +private theorem encLeft_head (a b : ℕ) (R : List (ℕ × ℕ)) : + (encLeft ((a, b) :: R)).head = 1 := by + rw [encLeft_cons, show 1 * a + 1 = (1 * a + 0) + 1 by omega, list_pow_succ, List.cons_append] + simp only [ListBlank.append_cons, ListBlank.head_cons] + +private theorem encLeft_not_surjective : + ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ R : List (ℕ × ℕ), encLeft R ≠ t := by + refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ + intro R h + rcases R with _ | ⟨⟨a, b⟩, R'⟩ + · have h1 := congrArg (fun s => s.head) h + simp at h1 + · rw [encLeft_mod1] at h + have hb0 : b % 1 = 0 := Nat.mod_one b + rw [hb0, encLeft_run_s0] at h + rcases a with _ | a' + · rcases R' with _ | ⟨⟨a', b'⟩, L''⟩ + · have h2 := congrArg (fun s => s.tail.tail.tail.head) h + simp at h2 + · have h1 := congrArg (fun s => s.tail.tail.head) h + normalize_at h1 + rw [encLeft_head a' b' L''] at h1; contradiction + · have h1 := congrArg (fun s => s.tail.head) h + normalize_at h1 + contradiction + +private theorem valid_stack_modes : IsValidStackModes encLeft encRight evalStackCfg := by + intro m + cases m with + | AR_n_n => exact ⟨A, .id [], .id [], by decide, by decide, Or.inr (Or.inr (fun _ _ => rfl))⟩ + | CL_n_n => exact ⟨C, .id [], .id [], by decide, by decide, Or.inr (Or.inl (fun _ _ => rfl))⟩ + | BL_0_n => exact ⟨B, .id [], .id [0], by decide, by decide, Or.inr (Or.inl (fun _ _ => rfl))⟩ + | BR_n_n => exact ⟨B, .id [], .id [], by decide, by decide, Or.inr (Or.inr (fun _ _ => rfl))⟩ + + +/-! ## Stack Reduction Witness -/ + +/-- `target` reduces to a closed 2nd-order digit-stack transition system. -/ +theorem has_stack_reduction : HasStackReduction target := by + refine ⟨StackMode, 1, 0, encLeft, encRight, evalStackCfg, IsInStackSystem, + Or.inl ⟨rfl, rfl⟩, rfl, rfl, + encLeft_head, encRight_head, encLeft_not_surjective, encRight_not_surjective, + ⟨1, 1, 1, 1, 1, 1, 1, 1, by decide, by decide, by decide, by decide, by decide, + by decide, by decide, by decide, by decide, by decide, + fun _ _ _ => rfl, fun _ _ _ => rfl⟩, + ⟨[.AR_n_n, .CL_n_n, .BL_0_n, .BR_n_n], by decide, by intro m; cases m <;> decide⟩, + valid_stack_modes, + fun _ => Iff.rfl, + fun m L R => ⟨m, L, R, rfl⟩, + ⟨.BR_n_n, [(3, 0)], [(0, 0), (0, 0)], init_reaches_nontrivial, + by decide, ⟨(3, 0), by decide, by decide⟩⟩, + Or.inl ⟨.CL_n_n, .CL_n_n, (0, 0), id, ((0, 0) :: ·), + fun _ => Nat.le_succ _, step_CL_transfer⟩, + stack_system_closed⟩ + +end BusyBeaver.M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH diff --git a/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean b/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean index 22b494b1..11cca384 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean @@ -18,16 +18,27 @@ Formal `HasStackReduction` proof for the 6-state, 2-symbol Busy Beaver holdout ## Hardness -*Hardness class:* Wiki stack — trigger **—**, growth —, shield —. - -*Verdict (heuristic, from exact accelerated simulation of the certified rules):* wiki cryptid family -(E1 group #85/#285/#490/#500). - -*Hazard:* not re-measured - -*Simulated horizon:* — - -*Why it is hard:* `IsStackCryptid` closure proved +*Hardness class:* Wiki stack — trigger **RES (a particular sequence of $\approx 107$–$110$ residues +mod 3 must occur while the left side is empty; wiki)**, growth exponential (the main number is +multiplied by $8/3$ per era; wiki), shield none (every return to an empty left side is a fresh +trial). + +*Verdict (heuristic; community analysis, see the wiki page):* probviously **halting** (wiki, +Racheline 2024-11-23: expected halt at $\approx 10^{10^{38.1}}$ steps, far beyond any simulation); +the wiki treats the four start states #85/#285/#490/#500 as one cryptid. + +*Hazard:* community estimate, not re-measured here: per empty-left-side reset, probability +$\approx 3^{-80}$–$3^{-87}$ of entering one of the $2^{13}\cdot 3^{15}$ shortest halting residue +sequences (length 107–110, Racheline); @-d's breadth-first search over $\approx 235{,}000$ +right-side words found a halting path of length 108 and the halting residue class +$A(3^{108}k + 1975700577069254261393123959451562008800234946348086, \varepsilon)$ + +*Simulated horizon:* community: exhaustive search of the right-side word graph (wiki); here the +two-sided pair-stack system is certified closed (`HasStackReduction`) + +*Why it is hard:* the halting mechanism is explicit and the halting set is a residue class of +positive density, but reaching it needs $\approx 3^{80}$ independent resets: the archetype of RES +hardness without a shield See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. diff --git a/BusyBeaver/BB6/Accelerations/README.md b/BusyBeaver/BB6/Accelerations/README.md index fcc0ed3f..274abdef 100644 --- a/BusyBeaver/BB6/Accelerations/README.md +++ b/BusyBeaver/BB6/Accelerations/README.md @@ -22,6 +22,9 @@ This directory contains formal Lean 4 specifications and kernel-verified reducti | `1RB1LA_1RC0RF_1RD---_0LE1RB_---0LA_1LD1RF` | Stacked | `HasStackReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB1LA_1RC0RF_1RD---_0LE1RB_---0LA_1LD1RF) | [`M_1RB1LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean`](./M_1RB1LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean) | | `1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_---0LB` | Stacked | `HasStackReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_---0LB) | [`M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean`](./M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean) | | `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` | Stacked | `HasStackReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA) | [`M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean`](./M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean) | +| `1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---` | Stacked | `HasStackReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---) (redirects to `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`: the same table restarted from its state `C`) | [`M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean`](./M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean) | +| `1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LE---` | Stacked | `HasStackReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LE---) (redirects to `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`: the same table restarted from its state `D`, mirrored) | [`M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean`](./M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean) | +| `1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---` | Stacked | `HasStackReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---) (redirects to `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`: the same table restarted from its state `E`) | [`M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean`](./M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean) | | `1RB1RA_1LC0RC_---0LD_0LE0RF_1RE0RA_0LF1LB` | Stacked | `HasStackReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB1RA_1LC0RC_---0LD_0LE0RF_1RE0RA_0LF1LB) | [`M_1RB1RA_1LC0RC_HHH0LD_0LE0RF_1RE0RA_0LF1LB.lean`](./M_1RB1RA_1LC0RC_HHH0LD_0LE0RF_1RE0RA_0LF1LB.lean) | | `1RB0RE_0RC---_1LD1LE_1LE1LD_1RF0LC_1RA1RF` | Stacked | `HasStackReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB0RE_0RC---_1LD1LE_1LE1LD_1RF0LC_1RA1RF) | [`M_1RB0RE_0RCHHH_1LD1LE_1LE1LD_1RF0LC_1RA1RF.lean`](./M_1RB0RE_0RCHHH_1LD1LE_1LE1LD_1RF0LC_1RA1RF.lean) | | `1RB---_0RC1RD_1LA0LA_1LE0RB_1LF1LE_1LC0LD` | Stacked | `HasStackReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB---_0RC1RD_1LA0LA_1LE0RB_1LF1LE_1LC0LD) | [`M_1RBHHH_0RC1RD_1LA0LA_1LE0RB_1LF1LE_1LC0LD.lean`](./M_1RBHHH_0RC1RD_1LA0LA_1LE0RB_1LF1LE_1LC0LD.lean) | diff --git a/BusyBeaver/BB6/Hardness.lean b/BusyBeaver/BB6/Hardness.lean index 65471a93..37243c80 100644 --- a/BusyBeaver/BB6/Hardness.lean +++ b/BusyBeaver/BB6/Hardness.lean @@ -45,6 +45,15 @@ first-order problems of the report, the shielded single-base exponential cascade Collatz-like stacked cryptids. Eight were known to the community before our campaign; the rest are new. Problem S1 (`#72`) is listed last because the community has since **proved that it halts**. +Not listed below, but counted as hard by our solvability census, is the base-3 odometer family of +[BMO Problem 11](https://wiki.bbchallenge.org/wiki/Beaver_Math_Olympiad): the holdout +`1RB0LD_0RC---_1LD0RF_0LE0RA_0RA1LF_0LA1LB` (#15, macro-equivalent to the wiki's Problem 11 machine, +[`HasOdometerReduction`](./Accelerations/M_1RB0LD_0RCHHH_1LD0RF_0LE0RA_0RA1LF_0LA1LB.lean)) together +with eleven holdout classes that run the same odometer up to a proof isomorphism (`#14`, `#49`, +`#118`, `#223`, `#278`, `#301`, `#304`, `#313`, `#325`, `#566`, `#652`; `#118` is +[formalized here](./Accelerations/M_1RBHHH_1LC0RF_0RA0LD_1LE1LA_1RF0LF_0LC0RA.lean)). Their hazard +has not been re-measured with the method of this page, so they carry no verdict here. + ### Problems 1-5 (first-order, this campaign) * `1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LF---_0RA1LA` @@ -201,21 +210,32 @@ new. Problem S1 (`#72`) is listed last because the community has since **proved `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` ([#85](./Accelerations/M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean)) (wiki): Wiki stack; - Unary-Binary Bounded Stack Counter. Trigger —; growth —; shield —. wiki cryptid family (E1 group - #85/#285/#490/#500). Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout - list). + Unary-Binary Bounded Stack Counter. Trigger RES (a particular sequence of $\approx 107$–$110$ + residues mod 3 must occur while the left side is empty; wiki); growth exponential (the main number + is multiplied by $8/3$ per era; wiki); shield none (every return to an empty left side is a fresh + trial). probviously **halting** (wiki, Racheline 2024-11-23: expected halt at + $\approx 10^{10^{38.1}}$ steps, far beyond any simulation); the wiki treats the four start states + #85/#285/#490/#500 as one cryptid. Status: `is_stack_cryptid`; `Accelerations`; open (on the + 2026-10-24 holdout list). * `1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---` - ([bbchallenge](https://bbchallenge.org/1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---)) (wiki): Wiki - stack; Unary-Binary Bounded Stack Counter. Trigger —; growth —; shield —. E1 sibling of #85. - Status: `is_stack_cryptid`; open (on the 2026-10-24 holdout list). + ([#285](./Accelerations/M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean)) (wiki): Wiki stack; + Unary-Binary Bounded Stack Counter. Trigger as #85 (same table, started from its state `C`); + growth as #85; shield as #85. same dynamics as `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` (#85) + (wiki: "when the TM starts on any starting state, it exhibits the same probviously halting + behaviour"). Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LE---` - ([bbchallenge](https://bbchallenge.org/1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LE---)) (wiki): Wiki - stack; Unary-Binary Bounded Stack Counter. Trigger —; growth —; shield —. E1 sibling of #85. - Status: `is_stack_cryptid`; open (on the 2026-10-24 holdout list). + ([#490](./Accelerations/M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean)) (wiki): Wiki stack; + Unary-Binary Bounded Stack Counter. Trigger as #85 (same table, started from its state `D`, + mirrored); growth as #85; shield as #85. same dynamics as + `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` (#85); this is the start state analysed by @-d on the + wiki (halting path of length 108, $\approx 235{,}000$ right-side words explored). Status: + `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---` - ([bbchallenge](https://bbchallenge.org/1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---)) (wiki): Wiki - stack; Unary-Binary Bounded Stack Counter. Trigger —; growth —; shield —. E1 sibling of #85. - Status: `is_stack_cryptid`; open (on the 2026-10-24 holdout list). + ([#500](./Accelerations/M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean)) (wiki): Wiki stack; + Unary-Binary Bounded Stack Counter. Trigger as #85 (same table, started from its state `E`); + growth as #85; shield as #85. same dynamics as `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` (#85) + (wiki: the start states `E` and `F` share one trajectory). Status: `is_stack_cryptid`; + `Accelerations`; open (on the 2026-10-24 holdout list). ### Resolved by the community @@ -443,30 +463,40 @@ new. Problem S1 (`#72`) is listed last because the community has since **proved ### `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` (#85, Wiki stack) -* **Hazard:** not re-measured -* **Simulated horizon:** — -* **Why it is hard / what a proof needs:** `IsStackCryptid` closure proved +* **Hazard:** community estimate, not re-measured here: per empty-left-side reset, probability + $\approx 3^{-80}$–$3^{-87}$ of entering one of the $2^{13}\cdot 3^{15}$ shortest halting residue + sequences (length 107–110, Racheline); @-d's breadth-first search over $\approx 235{,}000$ + right-side words found a halting path of length 108 and the halting residue class + $A(3^{108}k + 1975700577069254261393123959451562008800234946348086, \varepsilon)$ +* **Simulated horizon:** community: exhaustive search of the right-side word graph (wiki); here the + two-sided pair-stack system is certified closed (`HasStackReduction`) +* **Why it is hard / what a proof needs:** the halting mechanism is explicit and the halting set is + a residue class of positive density, but reaching it needs $\approx 3^{80}$ independent resets: + the archetype of RES hardness without a shield * **Wiki:** ### `1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---` (#285, Wiki stack) -* **Hazard:** not re-measured -* **Simulated horizon:** — -* **Why it is hard / what a proof needs:** `IsStackCryptid` closure proved +* **Hazard:** as #85 (community estimate) +* **Simulated horizon:** as #85 +* **Why it is hard / what a proof needs:** the proof is the state relabelling of the #85 proof with + its own blank-tape entry (12 raw steps) * **Wiki:** ### `1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LE---` (#490, Wiki stack) -* **Hazard:** not re-measured -* **Simulated horizon:** — -* **Why it is hard / what a proof needs:** `IsStackCryptid` closure proved +* **Hazard:** as #85 (community estimate) +* **Simulated horizon:** as #85 +* **Why it is hard / what a proof needs:** the proof is the relabelling and left/right mirror of the + #85 proof with its own blank-tape entry (7 raw steps) * **Wiki:** ### `1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---` (#500, Wiki stack) -* **Hazard:** not re-measured -* **Simulated horizon:** — -* **Why it is hard / what a proof needs:** `IsStackCryptid` closure proved +* **Hazard:** as #85 (community estimate) +* **Simulated horizon:** as #85 +* **Why it is hard / what a proof needs:** the proof is the state relabelling of the #85 proof with + its own blank-tape entry (11 raw steps) * **Wiki:** ### `1RB1LA_0RC1RD_1LC0LA_1LE1RE_0RB0LF_---0LD` (#72, Problem S1 (resolved: halts)) diff --git a/BusyBeaver/BB6/M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean b/BusyBeaver/BB6/M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean index eb2af095..fabb86e4 100644 --- a/BusyBeaver/BB6/M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean +++ b/BusyBeaver/BB6/M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean @@ -165,8 +165,8 @@ $$ *Hardness class:* Cascade — trigger **EQ**, growth exponential, shield see family. -*Verdict (heuristic, from exact accelerated simulation of the certified rules):* wiki rediscovery -(RobinCodes *Next Steps* list). +*Verdict (heuristic; community analysis, see the wiki page):* wiki rediscovery (RobinCodes *Next +Steps* list). *Hazard:* not re-measured in our dossiers diff --git a/BusyBeaver/BB6/M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean b/BusyBeaver/BB6/M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean index 4e0ec9f3..25e98734 100644 --- a/BusyBeaver/BB6/M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean +++ b/BusyBeaver/BB6/M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean @@ -49,8 +49,8 @@ E(a, b + 2, 1) --> E(0, b, 2a + 5) *Hardness class:* Cascade — trigger **EQ**, growth exponential, shield see family. -*Verdict (heuristic, from exact accelerated simulation of the certified rules):* wiki rediscovery -(RobinCodes *Next Steps* list). +*Verdict (heuristic; community analysis, see the wiki page):* wiki rediscovery (RobinCodes *Next +Steps* list). *Hazard:* not re-measured in our dossiers diff --git a/BusyBeaverChallenge.lean b/BusyBeaverChallenge.lean index ecece41c..47d2a9d4 100644 --- a/BusyBeaverChallenge.lean +++ b/BusyBeaverChallenge.lean @@ -6918,6 +6918,16 @@ abbrev target : Machine (Fin 2) (Fin 6) := theorem has_odometer_reduction : HasOdometerReduction target := by sorry end M_1RB0LB_0RC0LD_1LD1RE_0LA0RF_0RD1RF_0RCHHH +namespace M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH +def machine : ConjectureMachines.Machine 6 2 := + load_rle_machine% "1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---" + +abbrev target : Machine (Fin 2) (Fin 6) := + machine.toBB + +theorem has_stack_reduction : HasStackReduction target := by sorry +end M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH + namespace M_1RB0LD_0RCHHH_0LD0RF_1LE1LD_0LA0RD_0RB1RA def machine : ConjectureMachines.Machine 6 2 := load_rle_machine% "1RB0LD_0RC---_0LD0RF_1LE1LD_0LA0RD_0RB1RA" @@ -7432,6 +7442,16 @@ abbrev target : Machine (Fin 2) (Fin 6) := theorem has_stack_reduction : HasStackReduction target := by sorry end M_1RB0RE_0RCHHH_1LD1LE_1LE1LD_1RF0LC_1RA1RF +namespace M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH +def machine : ConjectureMachines.Machine 6 2 := + load_rle_machine% "1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LE---" + +abbrev target : Machine (Fin 2) (Fin 6) := + machine.toBB + +theorem has_stack_reduction : HasStackReduction target := by sorry +end M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH + namespace M_1RB0RE_1RC1RE_1LD1LC_0RB0LC_1RF0RB_HHH1RA def machine : ConjectureMachines.Machine 6 2 := load_rle_machine% "1RB0RE_1RC1RE_1LD1LC_0RB0LC_1RF0RB_---1RA" @@ -8328,6 +8348,16 @@ theorem acceleration_iff_highLevel_acceleration : CollatzHalts next start ↔ CollatzHalts highLevelNext highLevelStart := by sorry end M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB +namespace M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH +def machine : ConjectureMachines.Machine 6 2 := + load_rle_machine% "1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---" + +abbrev target : Machine (Fin 2) (Fin 6) := + machine.toBB + +theorem has_stack_reduction : HasStackReduction target := by sorry +end M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH + namespace M_1RB1RE_1LC0RA_HHH1LD_1LA0LF_0LB0LC_1RB0LB def machine : ConjectureMachines.Machine 6 2 := load_rle_machine% "1RB1RE_1LC0RA_---1LD_1LA0LF_0LB0LC_1RB0LB" diff --git a/comparator/busy_beaver.json b/comparator/busy_beaver.json index 46f4c2fe..990978c1 100644 --- a/comparator/busy_beaver.json +++ b/comparator/busy_beaver.json @@ -426,7 +426,10 @@ "BusyBeaver.M_1RBHHH_0RC1RD_1LA0LA_1LE0RB_1LF1LE_1LC0LD.has_stack_reduction", "BusyBeaver.M_1RBHHH_1LC0RF_0RA0LD_1LE1LA_1RF0LF_0LC0RA.is_valid_acceleration", "BusyBeaver.M_1RBHHH_1LC0RF_0RA0LD_1LE1LA_1RF0LF_0LC0RA.isHalt_iff_acceleration", - "BusyBeaver.M_1RB0LF_1RC0RA_1LD0RB_0LE0LC_0LA0LC_0LBHHH.is_not_halt" + "BusyBeaver.M_1RB0LF_1RC0RA_1LD0RB_0LE0LC_0LA0LC_0LBHHH.is_not_halt", + "BusyBeaver.M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.has_stack_reduction", + "BusyBeaver.M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.has_stack_reduction", + "BusyBeaver.M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.has_stack_reduction" ], "permitted_axioms": [ "propext", From 75490e473b64ea341a5f0494fe199e3936037cad Mon Sep 17 00:00:00 2001 From: Tom Zahavy Date: Thu, 29 Oct 2026 09:25:18 +0000 Subject: [PATCH 3/6] Prove IsHalt equivalence of the busycoq-merged pair 1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---1LC / ---0LA BusyBeaver.BB6.Equivalences transports CollatzHalts along the identity of the two (textually identical) high-level counter systems and combines the two isHalt_iff_highLevel_acceleration theorems into isHalt_HHH1LC_iff_HHH0LA : IsHalt (---1LC) <-> IsHalt (---0LA). --- BusyBeaver.lean | 1 + BusyBeaver/BB6/Equivalences.lean | 142 +++++++++++++++++++++++++++++++ BusyBeaver/BB6/README.md | 6 +- BusyBeaverChallenge.lean | 6 ++ comparator/busy_beaver.json | 1 + 5 files changed, 154 insertions(+), 2 deletions(-) create mode 100644 BusyBeaver/BB6/Equivalences.lean diff --git a/BusyBeaver.lean b/BusyBeaver.lean index 3295a1ed..52fc3b08 100644 --- a/BusyBeaver.lean +++ b/BusyBeaver.lean @@ -11,6 +11,7 @@ public import BusyBeaver.Cert public import BusyBeaver.WordRLE public import BusyBeaver.AffRLE public import BusyBeaver.ElabRLE +public import BusyBeaver.BB6.Equivalences public import BusyBeaver.BB6.Hardness public import BusyBeaver.BB6.M_1RB0LB_1LC0RE_1LA1LD_0LCHHH_0RB0RF_1RE1RB public import BusyBeaver.BB6.M_1RB0LC_0LC0RF_1RD1LC_0RA1LE_HHH0LD_1LF1LA diff --git a/BusyBeaver/BB6/Equivalences.lean b/BusyBeaver/BB6/Equivalences.lean new file mode 100644 index 00000000..f35e2546 --- /dev/null +++ b/BusyBeaver/BB6/Equivalences.lean @@ -0,0 +1,142 @@ +/- +Copyright (c) 2026 Google LLC. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +-/ +module + +public import BusyBeaver.Basic +public import BusyBeaver.BB6.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA +public import BusyBeaver.BB6.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC + +/-! +# Halting Equivalences between `BB(6)` Holdouts + +Machine-level halting equivalences between `BB(6)` holdouts whose certified high-level +Collatz-like accelerations coincide. Each equivalence is a theorem about the two raw Turing +machines (`IsHalt`), obtained by transporting `CollatzHalts` between the two accelerated systems. + +## `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---1LC` and `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---0LA` + +The two transition tables (`#568` and `#623` of the 2026-10-24 holdout list, see +`BusyBeaver.BB6.Hardness`) differ only in the `F1` transition (`1LC` versus `0LA`), and the +`bbchallenge` community merged the first machine into the holdout class of the second (busycoq +[`Eqv_RegularPairs.v`](https://github.com/ccz181078/busycoq/blob/BB6/verify/Eqv_RegularPairs.v)). +The two modules prove, independently of each other, that each machine halts from the blank tape +if and only if its high-level acceleration `highLevelNext` halts from `highLevelStart` +(`isHalt_iff_highLevel_acceleration`), on the $b = 0$ Poincaré section + +$$ +D(a, d) := 0^\infty \ \mathrm{D}{>} \ (10)^{a+1} \ 0 \ 1^d \ 0^\infty, +$$ + +and the two accelerated systems (`HighLevelState`, `highLevelStart` $= D(0, 7)$, `evalA`, +`drainB`, `highLevelNext`) are given by literally the same equations on the counters $(a, d)$. +The theorem `isHalt_HHH1LC_iff_HHH0LA` proves that the two copies of `evalA`, `drainB` and +`highLevelNext` agree along the identity of counters $D(a, d) \mapsto D(a, d)$ between the two +state types, transports `CollatzHalts` along it, and combines the two halting equivalences: + +$$ +\mathrm{IsHalt}(\texttt{---1LC}) \iff \mathrm{CollatzHalts}(T_{\mathrm{HL}}, D(0, 7)) \iff +\mathrm{IsHalt}(\texttt{---0LA}). +$$ +-/ + +@[expose] public section + +namespace BusyBeaver.BB6 + +/-- Iterating `Option.bind` commutes with `Option.map e` when `e` intertwines the two transition +functions. -/ +private theorem iterate_bind_map {S T : Type*} {e : S → T} {next : S → Option S} + {next' : T → Option T} (h : ∀ s, next' (e s) = (next s).map e) (n : ℕ) (o : Option S) : + (Option.bind · next')^[n] (o.map e) = ((Option.bind · next)^[n] o).map e := by + induction n generalizing o with + | zero => rfl + | succ n ih => + have hstep : (o.map e).bind next' = (o.bind next).map e := by + cases o with + | none => rfl + | some s => exact h s + rw [Function.iterate_succ_apply, Function.iterate_succ_apply, hstep, ih] + +/-- `CollatzHalts` is transported along any map `e` that intertwines the two transition functions +(no injectivity is needed). -/ +private theorem collatzHalts_iff_map {S T : Type*} {e : S → T} {next : S → Option S} + {next' : T → Option T} (h : ∀ s, next' (e s) = (next s).map e) (s : S) : + CollatzHalts next s ↔ CollatzHalts next' (e s) := by + unfold CollatzHalts + refine exists_congr fun n => ?_ + rw [show some (e s) = (some s).map e from rfl, iterate_bind_map h, Option.isNone_map] + +/-- The identity of counters $D(a, d) \mapsto D(a, d)$ between the two high-level state spaces. -/ +private def embed : M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.HighLevelState → + M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.HighLevelState + | .D a d => .D a d + +/-- The two copies of `evalA` agree. -/ +private theorem evalA_eq (a : ℕ) : ∀ k m : ℕ, + M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.evalA a k m = + M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.evalA a k m := by + induction a with + | zero => + intro k m + rw [M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.evalA, + M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.evalA] + simp only [↓reduceIte] + | succ a ih => + intro k m + rw [M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.evalA, + M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.evalA] + simp only [Nat.add_eq_zero_iff, one_ne_zero, and_false, ↓reduceIte, Nat.add_sub_cancel, ih] + +/-- The two copies of `drainB` agree, up to `embed`. -/ +private theorem drainB_eq (b : ℕ) : ∀ a d : ℕ, + M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.drainB a b d = + (M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.drainB a b d).map embed := by + induction b using Nat.strong_induction_on with + | h b ih => + intro a d + rw [M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.drainB, + M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.drainB, ← evalA_eq] + split_ifs + · rfl + · cases M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.evalA a (b - 1) (d + 2 * b + 3) with + | none => rfl + | some p => + simp only [Option.bind_some] + split_ifs with hlt + · exact ih p.2.1 hlt p.1 p.2.2 + · rfl + +/-- The two copies of `highLevelNext` agree, up to `embed`. -/ +private theorem highLevelNext_embed + (s : M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.HighLevelState) : + M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.highLevelNext (embed s) = + (M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.highLevelNext s).map embed := by + obtain ⟨a, d⟩ := s + dsimp only [embed, M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.highLevelNext, + M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.highLevelNext] + split_ifs + · exact drainB_eq _ _ _ + · rfl + · exact drainB_eq _ _ _ + · exact drainB_eq _ _ _ + · rfl + · exact drainB_eq _ _ _ + · exact drainB_eq _ _ _ + · rw [← evalA_eq] + cases M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.evalA (d + 1 - a) a (2 * a + 5) with + | none => rfl + | some p => exact drainB_eq _ _ _ + +/-- `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---1LC` halts from the blank tape if and only if +`1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---0LA` does: both are equivalent to the halting of the same +high-level Collatz-like acceleration `highLevelNext` from $D(0, 7)$. -/ +theorem isHalt_HHH1LC_iff_HHH0LA : + IsHalt M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.target ↔ + IsHalt M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.target := by + rw [M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.isHalt_iff_highLevel_acceleration, + M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.isHalt_iff_highLevel_acceleration] + exact collatzHalts_iff_map highLevelNext_embed _ + +end BusyBeaver.BB6 diff --git a/BusyBeaver/BB6/README.md b/BusyBeaver/BB6/README.md index e4192e96..9f698fb7 100644 --- a/BusyBeaver/BB6/README.md +++ b/BusyBeaver/BB6/README.md @@ -8,6 +8,8 @@ entry certificate and a universal return family; it has a separate > **Hardness.** Why the hardest of these holdouts are hard (halting trigger, growth regime, shields, heuristic hazards, and the calibration case `#72` that the community proved halting) is recorded in [`Hardness.lean`](./Hardness.lean) (rendered on the docs site as `BusyBeaver.BB6.Hardness`); each machine in that core also carries a `## Hardness` section in its module docstring. +> **Equivalences.** Machine-level halting equivalences between holdouts whose certified high-level accelerations coincide are collected in [`Equivalences.lean`](./Equivalences.lean) (`BusyBeaver.BB6.Equivalences`): `isHalt_HHH1LC_iff_HHH0LA` proves that `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---1LC` halts if and only if `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---0LA` does (the pair merged by busycoq `Eqv_RegularPairs.v`). + ## Formalized `BB(6)` Machines | Machine (`bbchallenge` RLE) | States | Symbols | Proved Properties | Wiki / Notes | Lean 4 Proof | @@ -23,7 +25,7 @@ entry certificate and a universal return family; it has a separate | `1RB0LD_1RC1RA_1LD0RB_1LE1LA_1RF0RC_---1RE` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB0LD_1RC1RA_1LD0RB_1LE1LA_1RF0RC_---1RE) | [`M_1RB0LD_1RC1RA_1LD0RB_1LE1LA_1RF0RC_HHH1RE.lean`](./M_1RB0LD_1RC1RA_1LD0RB_1LE1LA_1RF0RC_HHH1RE.lean) | | `1RB0LD_1RC1RF_1LA0RA_0LA0LE_1LD1LA_0RB---` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB0LD_1RC1RF_1LA0RA_0LA0LE_1LD1LA_0RB---) | [`M_1RB0LD_1RC1RF_1LA0RA_0LA0LE_1LD1LA_0RBHHH.lean`](./M_1RB0LD_1RC1RF_1LA0RA_0LA0LE_1LD1LA_0RBHHH.lean) | | `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---0LA` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | — | [`M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean`](./M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean) | -| `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---1LC` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | equivalent to `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---0LA` (same orbit after two macro-steps; busycoq [`Eqv_RegularPairs.v`](https://github.com/ccz181078/busycoq/blob/BB6/verify/Eqv_RegularPairs.v)) | [`M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.lean`](./M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.lean) | +| `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---1LC` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | equivalent to `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---0LA` (same orbit after two macro-steps; busycoq [`Eqv_RegularPairs.v`](https://github.com/ccz181078/busycoq/blob/BB6/verify/Eqv_RegularPairs.v)); the machine-level halting equivalence is proved in [`Equivalences.lean`](./Equivalences.lean) (`BusyBeaver.BB6.isHalt_HHH1LC_iff_HHH0LA`) | [`M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.lean`](./M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.lean) | | `1RB0LE_1LC1RA_1RA1LD_0LC0LA_0RE1RF_0RC---` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | [Wiki (`User:RobinCodes/Next_Steps`)](https://wiki.bbchallenge.org/wiki/User:RobinCodes/Next_Steps) | [`M_1RB0LE_1LC1RA_1RA1LD_0LC0LA_0RE1RF_0RCHHH.lean`](./M_1RB0LE_1LC1RA_1RA1LD_0LC0LA_0RE1RF_0RCHHH.lean) | | `1RB0LF_1LC0LD_1RD1LB_---1RE_0RA1RE_1LA0LE` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | — | [`M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean`](./M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean) | | `1RB0LF_1LC1RA_0RE0RD_---1LE_1LF1RC_1LC1LA` | `6` | `2` | `IsClosedPatternSet`, `HasCollatzReduction`, `IsValidAcceleration` | — | [`M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean`](./M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean) | @@ -207,7 +209,7 @@ B(a, b, d) = \begin{cases} \end{cases} $$ -This 2-counter system is identical to that of [`1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---1LC`](./M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.lean), proving that the two machines have identical halting behavior. +This 2-counter system is identical to that of [`1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---1LC`](./M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.lean), proving that the two machines have identical halting behavior. The machine-level statement `IsHalt` (`---1LC`) `↔` `IsHalt` (`---0LA`) is formalized as `BusyBeaver.BB6.isHalt_HHH1LC_iff_HHH0LA` in [`Equivalences.lean`](./Equivalences.lean), by transporting `CollatzHalts` along the identity of the two `HighLevelState` counter spaces. ### [`1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---1LC`](./M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.lean) diff --git a/BusyBeaverChallenge.lean b/BusyBeaverChallenge.lean index 47d2a9d4..6a844242 100644 --- a/BusyBeaverChallenge.lean +++ b/BusyBeaverChallenge.lean @@ -2263,6 +2263,12 @@ theorem acceleration_iff_highLevel_acceleration : CollatzHalts next start ↔ CollatzHalts highLevelNext highLevelStart := by sorry end M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC +namespace BB6 +theorem isHalt_HHH1LC_iff_HHH0LA : + IsHalt M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.target ↔ + IsHalt M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.target := by sorry +end BB6 + namespace M_1RB0LE_1LC1RA_1RA1LD_0LC0LA_0RE1RF_0RCHHH def machine : ConjectureMachines.Machine 6 2 := load_rle_machine% "1RB0LE_1LC1RA_1RA1LD_0LC0LA_0RE1RF_0RC---" diff --git a/comparator/busy_beaver.json b/comparator/busy_beaver.json index 990978c1..5e55ff0f 100644 --- a/comparator/busy_beaver.json +++ b/comparator/busy_beaver.json @@ -67,6 +67,7 @@ "BusyBeaver.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.is_valid_highLevel_acceleration", "BusyBeaver.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.isHalt_iff_highLevel_acceleration", "BusyBeaver.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.acceleration_iff_highLevel_acceleration", + "BusyBeaver.BB6.isHalt_HHH1LC_iff_HHH0LA", "BusyBeaver.M_1RB0LE_1LC1RA_1RA1LD_0LC0LA_0RE1RF_0RCHHH.is_closed_pattern_set", "BusyBeaver.M_1RB0LE_1LC1RA_1RA1LD_0LC0LA_0RE1RF_0RCHHH.has_collatz_reduction", "BusyBeaver.M_1RB0LE_1LC1RA_1RA1LD_0LC0LA_0RE1RF_0RCHHH.is_valid_acceleration", From e0424001a5a29cb8a3cb904af7a6b8e43e705fab Mon Sep 17 00:00:00 2001 From: Tom Zahavy Date: Thu, 29 Oct 2026 10:22:29 +0000 Subject: [PATCH 4/6] Port Halving Tower #659/#209/#480, add HardnessEvidence, and update docs --- BusyBeaver.lean | 4 + ...LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.lean | 467 ++++++++++ ...LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean | 2 +- ...RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean | 2 +- ...RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.lean | 452 +++++++++ ...RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.lean | 868 ++++++++++++++++++ ...RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean | 2 +- BusyBeaver/BB6/Accelerations/README.md | 15 +- BusyBeaver/BB6/Hardness.lean | 33 +- BusyBeaver/BB6/HardnessEvidence.lean | 711 ++++++++++++++ BusyBeaver/BB6/README.md | 4 +- BusyBeaver/README.md | 4 +- BusyBeaverChallenge.lean | 307 +++++++ README.md | 2 +- comparator/README.md | 9 +- comparator/busy_beaver.json | 79 +- 16 files changed, 2928 insertions(+), 33 deletions(-) create mode 100644 BusyBeaver/BB6/Accelerations/M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.lean create mode 100644 BusyBeaver/BB6/Accelerations/M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.lean create mode 100644 BusyBeaver/BB6/Accelerations/M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.lean create mode 100644 BusyBeaver/BB6/HardnessEvidence.lean diff --git a/BusyBeaver.lean b/BusyBeaver.lean index 52fc3b08..3211ccb6 100644 --- a/BusyBeaver.lean +++ b/BusyBeaver.lean @@ -13,6 +13,7 @@ public import BusyBeaver.AffRLE public import BusyBeaver.ElabRLE public import BusyBeaver.BB6.Equivalences public import BusyBeaver.BB6.Hardness +public import BusyBeaver.BB6.HardnessEvidence public import BusyBeaver.BB6.M_1RB0LB_1LC0RE_1LA1LD_0LCHHH_0RB0RF_1RE1RB public import BusyBeaver.BB6.M_1RB0LC_0LC0RF_1RD1LC_0RA1LE_HHH0LD_1LF1LA public import BusyBeaver.BB6.M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA @@ -69,6 +70,7 @@ public import BusyBeaver.BB6.M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB public import BusyBeaver.BB6.M_1RBHHH_1RC1LE_0RD0RF_0RE0LA_1LF0LB_1LA1LD public import BusyBeaver.BB6.Accelerations.Stack public import BusyBeaver.BB6.Accelerations.M_1RB0LB_0RC0LD_1LD1RE_0LA0RF_0RD1RF_0RCHHH +public import BusyBeaver.BB6.Accelerations.M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD public import BusyBeaver.BB6.Accelerations.M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH public import BusyBeaver.BB6.Accelerations.M_1RB0LD_0RCHHH_0LD0RF_1LE1LD_0LA0RD_0RB1RA public import BusyBeaver.BB6.Accelerations.M_1RB0LD_0RCHHH_1LD0RF_0LE0RA_0RA1LF_0LA1LB @@ -88,8 +90,10 @@ public import BusyBeaver.BB6.Accelerations.M_1RB1LB_1RC0RD_0LA1RE_0RF1LC_1LA0RB_ public import BusyBeaver.BB6.Accelerations.M_1RB1LD_0RC0LF_1LD1RE_0LA0RB_0RD1RB_0LDHHH public import BusyBeaver.BB6.Accelerations.M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB public import BusyBeaver.BB6.Accelerations.M_1RB1LF_0RC0RB_0LD1RB_1LE0LB_0LA1LC_0LBHHH +public import BusyBeaver.BB6.Accelerations.M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF public import BusyBeaver.BB6.Accelerations.M_1RB1RA_1LC0RC_HHH0LD_0LE0RF_1RE0RA_0LF1LB public import BusyBeaver.BB6.Accelerations.M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB +public import BusyBeaver.BB6.Accelerations.M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF public import BusyBeaver.BB6.Accelerations.M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH public import BusyBeaver.BB6.Accelerations.M_1RB1RE_1LC0RA_HHH1LD_1LA0LF_0LB0LC_1RB0LB public import BusyBeaver.BB6.Accelerations.M_1RB1RE_1LC0RC_1RA1LD_1RB0LA_0LC1RF_HHH1RD diff --git a/BusyBeaver/BB6/Accelerations/M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.lean b/BusyBeaver/BB6/Accelerations/M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.lean new file mode 100644 index 00000000..a021bd3e --- /dev/null +++ b/BusyBeaver/BB6/Accelerations/M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.lean @@ -0,0 +1,467 @@ +/- +Copyright (c) 2026 Google LLC. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +-/ +module + +public import BusyBeaver.Basic +public import BusyBeaver.BB6.Accelerations.Stack +public import BusyBeaver.Bridge + +/-! +# Busy Beaver Holdout `1RB0LC_1LC0RE_1LD1LC_1LA1RD_---0RF_0LB0RD` + +Formal `HasStackReduction` proof for the 6-state, 2-symbol Busy Beaver holdout +`1RB0LC_1LC0RE_1LD1LC_1LA1RD_---0RF_0LB0RD` (Halving Tower family). + +The left half-tape stack encodes unary blocks $1^{a + 1}$ separated by double zeros (`encStack2`), +and the right half-tape stack encodes unary blocks $1^{d + 1}$ separated by single zeros +(`encStack`), both ordered from the tape head outward. The closed 2-mode 2nd-order digit-stack +system has the configurations `D(L, R)` (state `D` reading the `0` separator between `encStack2 L` +and `encStack R`) and `AL(L, R)` (state `A` reading the `0` separator between `(encStack2 L).tail` +and `encStack R`). Below, `bumpHead` increments the head digit of a stack (pushing `0` onto an +empty stack) and `tailWeight L` is the head digit of `L` (`0` if `L = []`). + +## Accelerated Transition Rules + +```text +D([], R) -> AL([], bumpHead R) +D(a :: L, R) -> D(L, a :: bumpHead R) + +AL(L, []) -> D(L.tail, [tailWeight L + 2]) +AL(L, 0 :: R) -> Halt +AL(L, 1 :: R) -> D((tailWeight L + 2) :: L.tail, R) +AL(L, 2 :: R) -> AL(0 :: tailWeight L :: L.tail, bumpHead R) +AL(L, (d + 3) :: R) -> AL((tailWeight L + 1) :: L.tail, (d + 1) :: bumpHead R) + +Start: D([3], [0]), reached after 23 raw TM steps +``` + + +## Hardness + +*Hardness class:* S4 sibling — trigger **POW**, growth mass-conserving sandpile, shield partial +(strict digit positivity blocks the sole $d=0$ halt). + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* as #660/#680 + +*Simulated horizon:* family-level + +*Why it is hard:* E1 pair of #680 (different seed) + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + +-/ + +@[expose] public section + +namespace BusyBeaver.M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD + +open SixState Turing Stack + +/-- The `(6, 2)` Turing machine in `ConjectureMachines.Machine` form. -/ +def machine : ConjectureMachines.Machine 6 2 := + load_rle_machine% "1RB0LC_1LC0RE_1LD1LC_1LA1RD_---0RF_0LB0RD" + +/-- The `(6, 2)` Turing machine in `BusyBeaver.Machine` form. -/ +abbrev target : Machine (Fin 2) (Fin 6) := + machine.toBB + +/-! ## Digit-Stack Encodings and Walk Helpers -/ + +@[simp] +private theorem encStack2_nil : encStack2 [] = default := + rfl + +private theorem encStack2_cons (a : ℕ) (L : List ℕ) : + encStack2 (a :: L) = (((encStack2 L).cons 0).cons 0) <+ (([1] : List (Fin 2)) ^ (a + 1)) := + rfl + +@[simp] +private theorem encStack_nil : encStack [] = default := + rfl + +private theorem encStack_cons (d : ℕ) (R : List ℕ) : + encStack (d :: R) = (([1] : List (Fin 2)) ^ (d + 1)) +> ((encStack R).cons 0) := + rfl + +@[simp] +private theorem encStack2_cons_one (L : List ℕ) : + (1 : Fin 2) >> encStack2 L = encStack2 (bumpHead L) := by + cases L with + | nil => simp [bumpHead, encStack2] + | cons b L' => rfl + +@[simp] +private theorem encStack_cons_one (R : List ℕ) : + (1 : Fin 2) >> encStack R = encStack (bumpHead R) := by + cases R with + | nil => simp [bumpHead, encStack] + | cons d R' => rfl + +/-- Head digit of a left stack under `.tail` (`0` if empty, `a` if `a :: _`). -/ +private def tailWeight : List ℕ → ℕ + | [] => 0 + | a :: _ => a + +@[simp] +private theorem encStack2_tail_cons_one (L : List ℕ) : + (1 : Fin 2) >> (encStack2 L).tail = encStack2 (tailWeight L :: L.tail) := by + cases L with + | nil => simp [tailWeight, encStack2] + | cons a L' => simp [tailWeight, encStack2, list_pow_succ] + +private theorem encStack2_tail_decomp (L : List ℕ) : + (encStack2 L).tail = + (((encStack2 L.tail).cons 0).cons 0) <+ (([1] : List (Fin 2)) ^ (tailWeight L)) := by + cases L with + | nil => simp [tailWeight, encStack2] + | cons a L' => simp [tailWeight, encStack2, list_pow_succ] + +local macro "finish" : tactic => `(tactic| ( + refine ⟨0, ?_⟩ + simp only [Cfg.headRight, Cfg.headLeft, ListBlank.append_cons, ListBlank.append_nil, + ListBlank.cons_zero_default, encStack2_nil, encStack_nil, encStack2_cons_one, + encStack_cons_one, encStack2_tail_cons_one, ListBlank.head_cons, ListBlank.tail_cons, + multiStep_zero] + try rfl)) + +local macro "step" : tactic => `(tactic| ( + try refine ReachesPlus.to_star ?_ + try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, + ListBlank.head_default_fin, ListBlank.tail_cons, ListBlank.tail_default, + ListBlank.cons_zero_default] + apply ReachesPlus.head (by rfl) + simp only [Cfg.headRight, Cfg.headLeft, Tape.move, Tape.write, + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.cons_zero_default, ListBlank.head_default_fin, ListBlank.tail_default])) + +local macro "execute" n:num : tactic => `(tactic| ( + iterate $n step + try finish)) + +/-- Right-sweep separator configuration: state `D` reading `0` between `L` and `R`. -/ +private def cfg_D (L R : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some D, ⟨0, encStack2 L, encStack R⟩⟩ + +/-- Left-split separator configuration: state `A` reading `0` between `(encStack2 L).tail` and `R`. +-/ +private def cfg_AL (L R : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some A, ⟨0, (encStack2 L).tail, encStack R⟩⟩ + +/-- Modes of the 2nd-order digit-stack configuration family. -/ +private inductive StackMode + | D + | AL + +private def evalStackCfg1 : StackMode → List ℕ → List ℕ → Cfg (Fin 2) (Fin 6) + | .D, L, R => cfg_D L R + | .AL, L, R => cfg_AL L R + +private def IsInStackSystem1 (cfg : Cfg (Fin 2) (Fin 6)) : Prop := + ∃ m L R, cfg = evalStackCfg1 m L R + +/-- State `C` walks left across `1^k` (`C, 1 -> 1LC`). -/ +private theorem c_walk_left (k : ℕ) (l r : ListBlank (Fin 2)) : + ((l <+ (([1] : List (Fin 2)) ^ k)) <{{C}} r) [target]⊢* + (l <{{C}} ((([1] : List (Fin 2)) ^ k) +> r)) := by + induction k generalizing l r with + | zero => exact ⟨0, rfl⟩ + | succ k ih => + have h_split : k + 1 = 1 + k := by omega + rw [h_split, list_pow_add, ListBlank.append_assoc] + have h1 : + (((l <+ (([1] : List (Fin 2)) ^ k)) <+ (([1] : List (Fin 2)) ^ 1)) <{{C}} r) [target]⊢⁺ + ((l <+ (([1] : List (Fin 2)) ^ k)) <{{C}} (([1] : List (Fin 2)) ^ 1 +> r)) := by + simp only [list_pow_one] + execute 1 + refine h1.to_star.trans ?_ + refine (ih l (([1] : List (Fin 2)) ^ 1 +> r)).trans ?_ + rw [← ListBlank.append_assoc, list_pow_add_comm] + +/-- State `D` walks right across `1^k` (`D, 1 -> 1RD`). -/ +private theorem d_walk_right (k : ℕ) (l r : ListBlank (Fin 2)) : + (l {{D}}> ((([1] : List (Fin 2)) ^ k) +> r)) [target]⊢* + ((l <+ (([1] : List (Fin 2)) ^ k)) {{D}}> r) := by + induction k generalizing l r with + | zero => exact ⟨0, rfl⟩ + | succ k ih => + have h_split : k + 1 = 1 + k := by omega + rw [h_split, list_pow_add, ListBlank.append_assoc] + have h1 : + (l {{D}}> (([1] : List (Fin 2)) ^ 1 +> (([1] : List (Fin 2)) ^ k +> r))) [target]⊢⁺ + ((l <+ (([1] : List (Fin 2)) ^ 1)) {{D}}> (([1] : List (Fin 2)) ^ k +> r)) := by + simp only [list_pow_one] + execute 1 + refine h1.to_star.trans ?_ + refine (ih (l <+ (([1] : List (Fin 2)) ^ 1)) r).trans ?_ + rw [← ListBlank.append_assoc, list_pow_add_comm] + +/-! ## Local Separator Rules -/ + +private theorem rule_D_nil (R : List ℕ) : + (cfg_D [] R) [target]⊢⁺ (cfg_AL [] (bumpHead R)) := by + unfold cfg_D cfg_AL + rw [encStack2_nil] + execute 1 + +private theorem rule_D_cons (a : ℕ) (L R : List ℕ) : + (cfg_D (a :: L) R) [target]⊢⁺ (cfg_D L (a :: bumpHead R)) := by + unfold cfg_D + rw [encStack2_cons a L] + have h_pre : + (⟨some D, ⟨0, (((encStack2 L).cons 0).cons 0) <+ (([1] : List (Fin 2)) ^ (a + 1)), + encStack R⟩⟩ : Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + (((((encStack2 L).cons 0).cons 0) <+ (([1] : List (Fin 2)) ^ a)) <{{C}} + ((encStack (bumpHead R)).cons 0)) := by + simp only [list_pow_succ, List.cons_append, List.nil_append] + execute 2 + refine h_pre.trans_star ?_ + refine (c_walk_left a (((encStack2 L).cons 0).cons 0) + ((encStack (bumpHead R)).cons 0)).trans ?_ + have h_post : + ((((encStack2 L).cons 0).cons 0) <{{C}} + ((([1] : List (Fin 2)) ^ a) +> ((encStack (bumpHead R)).cons 0))) + [target]⊢⁺ + (⟨some D, ⟨0, encStack2 L, encStack (a :: bumpHead R)⟩⟩ : Cfg (Fin 2) (Fin 6)) := by + rw [encStack_cons a (bumpHead R)] + simp only [list_pow_succ, List.cons_append, List.nil_append] + execute 1 + exact h_post.to_star + +private theorem rule_AL_nil (L : List ℕ) : + (cfg_AL L []) [target]⊢⁺ (cfg_D L.tail [tailWeight L + 2]) := by + unfold cfg_AL cfg_D + rw [encStack2_tail_decomp L, encStack_nil] + have h_pre : + (⟨some A, ⟨0, + (((encStack2 L.tail).cons 0).cons 0) <+ (([1] : List (Fin 2)) ^ (tailWeight L)), + default⟩⟩ : Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + (((((encStack2 L.tail).cons 0).cons 0) <+ (([1] : List (Fin 2)) ^ (tailWeight L))) <{{C}} + (([1] : List (Fin 2)) ^ 2 +> default)) := by + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 3 + refine h_pre.trans_star ?_ + refine (c_walk_left (tailWeight L) (((encStack2 L.tail).cons 0).cons 0) + (([1] : List (Fin 2)) ^ 2 +> default)).trans ?_ + have h_post : + ((((encStack2 L.tail).cons 0).cons 0) <{{C}} + ((([1] : List (Fin 2)) ^ (tailWeight L)) +> (([1] : List (Fin 2)) ^ 2 +> default))) + [target]⊢⁺ + (⟨some D, ⟨0, encStack2 L.tail, + (([1] : List (Fin 2)) ^ 1) +> + ((([1] : List (Fin 2)) ^ (tailWeight L)) +> + (([1] : List (Fin 2)) ^ 2 +> default))⟩⟩ : Cfg (Fin 2) (Fin 6)) := by + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 1 + refine h_post.to_star.trans ?_ + rw [← ListBlank.append_assoc, ← list_pow_add, ← ListBlank.append_assoc, ← list_pow_add] + have h_eq : 1 + tailWeight L + 2 = tailWeight L + 2 + 1 := by omega + rw [h_eq, encStack_cons (tailWeight L + 2) [], encStack_nil, ListBlank.cons_zero_default] + +private def cfg_Halt_AL (L R : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some E, ⟨0, (encStack2 (tailWeight L :: L.tail)).cons 0, encStack R⟩⟩ + +private theorem rule_AL_zero (L R : List ℕ) : + ((cfg_AL L (0 :: R)) [target]⊢⁺ (cfg_Halt_AL L R)) ∧ + (step target (cfg_Halt_AL L R)).isNone := by + refine ⟨?_, rfl⟩ + unfold cfg_AL cfg_Halt_AL + rw [encStack_cons 0 R] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 2 + +private theorem rule_AL_one (L R : List ℕ) : + (cfg_AL L (1 :: R)) [target]⊢⁺ (cfg_D ((tailWeight L + 2) :: L.tail) R) := by + unfold cfg_AL cfg_D + rw [encStack_cons 1 R] + have h_pre : + (⟨some A, ⟨0, (encStack2 L).tail, + (([1] : List (Fin 2)) ^ (1 + 1)) +> ((encStack R).cons 0)⟩⟩ : Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + (⟨some C, ⟨0, encStack2 (tailWeight L :: L.tail), encStack (0 :: R)⟩⟩ : + Cfg (Fin 2) (Fin 6)) := by + rw [encStack_cons 0 R] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 5 + refine h_pre.trans ?_ + rw [encStack2_cons (tailWeight L) L.tail, encStack_cons 0 R, + encStack2_cons (tailWeight L + 2) L.tail] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 4 + +private theorem rule_AL_two (L R : List ℕ) : + (cfg_AL L (2 :: R)) [target]⊢⁺ (cfg_AL (0 :: tailWeight L :: L.tail) (bumpHead R)) := by + unfold cfg_AL + rw [encStack_cons 2 R, encStack2_cons 0 (tailWeight L :: L.tail)] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 5 + +private theorem rule_AL_ge3 (d : ℕ) (L R : List ℕ) : + (cfg_AL L ((d + 3) :: R)) [target]⊢⁺ + (cfg_AL ((tailWeight L + 1) :: L.tail) ((d + 1) :: bumpHead R)) := by + unfold cfg_AL + rw [encStack_cons (d + 3) R] + have h_split : d + 3 + 1 = 3 + (d + 1) := by omega + rw [h_split, list_pow_add, ListBlank.append_assoc] + have h_pre : + (⟨some A, ⟨0, (encStack2 L).tail, + (([1] : List (Fin 2)) ^ 3) +> + ((([1] : List (Fin 2)) ^ (d + 1)) +> ((encStack R).cons 0))⟩⟩ : Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + (((((encStack2 (tailWeight L :: L.tail)).cons 0).cons 0).cons 0) {{D}}> + ((([1] : List (Fin 2)) ^ (d + 1)) +> ((encStack R).cons 0))) := by + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 4 + refine h_pre.trans_star ?_ + refine (d_walk_right (d + 1) + ((((encStack2 (tailWeight L :: L.tail)).cons 0).cons 0).cons 0) + ((encStack R).cons 0)).trans ?_ + have h_mid : + ((((((encStack2 (tailWeight L :: L.tail)).cons 0).cons 0).cons 0) <+ + (([1] : List (Fin 2)) ^ (d + 1))) {{D}}> ((encStack R).cons 0)) + [target]⊢⁺ + ((((((encStack2 (tailWeight L :: L.tail)).cons 0).cons 0).cons 0) <+ + (([1] : List (Fin 2)) ^ d)) <{{C}} ((encStack (bumpHead R)).cons 0)) := by + simp only [list_pow_succ, List.cons_append, List.nil_append] + execute 2 + refine h_mid.to_star.trans ?_ + refine (c_walk_left d ((((encStack2 (tailWeight L :: L.tail)).cons 0).cons 0).cons 0) + ((encStack (bumpHead R)).cons 0)).trans ?_ + have h_post : + (((((encStack2 (tailWeight L :: L.tail)).cons 0).cons 0).cons 0) <{{C}} + ((([1] : List (Fin 2)) ^ d) +> ((encStack (bumpHead R)).cons 0))) + [target]⊢⁺ + (⟨some A, ⟨0, (encStack2 ((tailWeight L + 1) :: L.tail)).tail, + encStack ((d + 1) :: bumpHead R)⟩⟩ : Cfg (Fin 2) (Fin 6)) := by + rw [encStack2_cons (tailWeight L + 1) L.tail, encStack_cons (d + 1) (bumpHead R)] + simp only [list_pow_succ, List.cons_append, List.nil_append] + execute 2 + exact h_post.to_star + +/-! ## Initial Reachability and Stack Reduction Closure -/ + +private theorem init_to_cfg_D : + (init []) [target]⊢⁺ (cfg_D [3] [0]) := by + unfold cfg_D + rw [encStack2_cons, encStack2_nil, encStack_cons, encStack_nil] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 23 + +private theorem init_reaches_nontrivial : + (init []) [target]⊢⁺ evalStackCfg1 .AL [1] [2, 2] := + init_to_cfg_D + |>.trans (rule_D_cons 3 [] [0]) + |>.trans (rule_D_nil [3, 1]) + |>.trans (rule_AL_ge3 1 [] [1]) + +private theorem stack_system_closed (cfg : Cfg (Fin 2) (Fin 6)) (h : IsInStackSystem1 cfg) : + ∃ cfg', (cfg [target]⊢⁺ cfg') ∧ + (IsInStackSystem1 cfg' ∨ (step target cfg').isNone) := by + rcases h with ⟨m, L, R, rfl⟩ + cases m with + | D => + cases L with + | nil => + exact ⟨cfg_AL [] (bumpHead R), rule_D_nil R, Or.inl ⟨.AL, [], bumpHead R, rfl⟩⟩ + | cons a L' => + exact ⟨cfg_D L' (a :: bumpHead R), rule_D_cons a L' R, + Or.inl ⟨.D, L', a :: bumpHead R, rfl⟩⟩ + | AL => + cases R with + | nil => + exact ⟨cfg_D L.tail [tailWeight L + 2], rule_AL_nil L, + Or.inl ⟨.D, L.tail, [tailWeight L + 2], rfl⟩⟩ + | cons d R' => + rcases d with _ | _ | _ | d + · obtain ⟨hstep, hnone⟩ := rule_AL_zero L R' + exact ⟨cfg_Halt_AL L R', hstep, Or.inr hnone⟩ + · exact ⟨cfg_D ((tailWeight L + 2) :: L.tail) R', rule_AL_one L R', + Or.inl ⟨.D, (tailWeight L + 2) :: L.tail, R', rfl⟩⟩ + · exact ⟨cfg_AL (0 :: tailWeight L :: L.tail) (bumpHead R'), rule_AL_two L R', + Or.inl ⟨.AL, 0 :: tailWeight L :: L.tail, bumpHead R', rfl⟩⟩ + · exact ⟨cfg_AL ((tailWeight L + 1) :: L.tail) ((d + 1) :: bumpHead R'), + rule_AL_ge3 d L R', + Or.inl ⟨.AL, (tailWeight L + 1) :: L.tail, (d + 1) :: bumpHead R', rfl⟩⟩ + +private theorem encStack2_head (a : ℕ) (L : List ℕ) : (encStack2 (a :: L)).head = 1 := by + simp [encStack2, list_pow_succ] + +private theorem encStack_head (d : ℕ) (R : List ℕ) : (encStack (d :: R)).head = 1 := by + simp [encStack, list_pow_succ] + +private theorem encStack2_not_surjective : + ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ s : List ℕ, encStack2 s ≠ t := by + refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ + intro s h + rcases s with _ | ⟨_ | a, rest⟩ + · have h1 := congrArg ListBlank.head h + simp [encStack2] at h1 + · have h1 := congrArg (fun x => x.tail.tail.head) h + simp [encStack2, list_pow_succ, list_pow_zero] at h1 + · have h1 := congrArg (fun x => x.tail.head) h + simp [encStack2, list_pow_succ] at h1 + +private theorem encStack_not_surjective : + ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ s : List ℕ, encStack s ≠ t := by + refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ + intro s h + rcases s with _ | ⟨_ | a, rest⟩ + · have h1 := congrArg ListBlank.head h + simp [encStack] at h1 + · rcases rest with _ | ⟨b, s'⟩ + · have h1 := congrArg (fun x => x.tail.tail.tail.head) h + simp [encStack, list_pow_succ, list_pow_zero] at h1 + · have h1 := congrArg (fun x => x.tail.tail.head) h + simp [encStack, list_pow_succ, list_pow_zero] at h1 + · have h1 := congrArg (fun x => x.tail.head) h + simp [encStack, list_pow_succ] at h1 + +private theorem block_encoding : + ∃ strideL offsetL sepL strideR offsetR sepR : ℕ, + strideL > 0 ∧ offsetL > 0 ∧ sepL > 0 ∧ + strideR > 0 ∧ offsetR > 0 ∧ sepR > 0 ∧ + (∀ a L, encStack2 (a :: L) = + ListBlank.append (([1] : List (Fin 2)) ^ (strideL * a + offsetL)) + (ListBlank.append (([0] : List (Fin 2)) ^ sepL) (encStack2 L))) ∧ + (∀ d R, encStack (d :: R) = + ListBlank.append (([1] : List (Fin 2)) ^ (strideR * d + offsetR)) + (ListBlank.append (([0] : List (Fin 2)) ^ sepR) (encStack R))) := by + refine ⟨1, 1, 2, 1, 1, 1, + by decide, by decide, by decide, by decide, by decide, by decide, ?_, ?_⟩ + · intro a L + simp [encStack2, list_pow_succ, list_pow_zero] + · intro d R + simp [encStack] + +private theorem modes_bounded : + ∃ modes : List StackMode, modes.length ≤ 6 ∧ ∀ m : StackMode, m ∈ modes := by + refine ⟨[.D, .AL], by decide, ?_⟩ + intro m + cases m <;> simp + +private theorem valid_stack_modes : IsValidStackModes encStack2 encStack evalStackCfg1 := by + intro m + cases m with + | D => exact ⟨D, .id [], .id [], by decide, by decide, Or.inl (fun _ _ => rfl)⟩ + | AL => exact ⟨A, .tail [], .id [], by decide, by decide, Or.inl (fun _ _ => rfl)⟩ + +/-- `target` reduces to a closed 2nd-order digit-stack system (`HasStackReduction`). -/ +theorem has_stack_reduction : HasStackReduction target := + HasStackReduction.of_oneDigit target StackMode encStack2 encStack evalStackCfg1 IsInStackSystem1 + ⟨rfl, rfl, encStack2_head, encStack_head, + encStack2_not_surjective, encStack_not_surjective, + block_encoding, modes_bounded, valid_stack_modes, + fun _ => Iff.rfl, fun m L R => ⟨m, L, R, rfl⟩, + ⟨.AL, [1], [2, 2], init_reaches_nontrivial, by decide, ⟨1, by decide, by decide⟩⟩, + Or.inl ⟨.D, .D, 0, id, fun R => 0 :: bumpHead R, + fun s => by cases s <;> simp [bumpHead], fun z L R => rule_D_cons 0 (z :: L) R⟩, + stack_system_closed⟩ + +end BusyBeaver.M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD diff --git a/BusyBeaver/BB6/Accelerations/M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean b/BusyBeaver/BB6/Accelerations/M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean index a4497b2a..d6ea4e8f 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean @@ -22,7 +22,7 @@ the states `E`, `C`, `D`, `B`, `F`, `A` of that machine, the two transition tabl machines run the same closed pair-stack system. The proof below is the mechanical relabelling of the proof in [`1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`](./M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean); -only the blank-tape entry lemma `init_reaches_nontrivial` is specific to this start state. +only the blank-tape entry theorem `init_reaches_nontrivial` is specific to this start state. ## Hardness diff --git a/BusyBeaver/BB6/Accelerations/M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean b/BusyBeaver/BB6/Accelerations/M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean index 2c0d789e..56d26cd7 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean @@ -22,7 +22,7 @@ the states `D`, `E`, `C`, `F`, `B`, `A` of that machine and mirroring the tape l transition tables coincide, so both machines run the same closed pair-stack system. The proof below is the mechanical relabelling and mirroring of the proof in [`1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`](./M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean); -only the blank-tape entry lemma `init_reaches_nontrivial` is specific to this start state. +only the blank-tape entry theorem `init_reaches_nontrivial` is specific to this start state. ## Hardness diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.lean b/BusyBeaver/BB6/Accelerations/M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.lean new file mode 100644 index 00000000..fee8e0b0 --- /dev/null +++ b/BusyBeaver/BB6/Accelerations/M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.lean @@ -0,0 +1,452 @@ +/- +Copyright (c) 2026 Google LLC. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +-/ +module + +public import BusyBeaver.Basic +public import BusyBeaver.BB6.Accelerations.Stack +public import BusyBeaver.Bridge + +/-! +# Busy Beaver Holdout `1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RA---_1RB1LF` + +Formal `HasStackReduction` proof for the 6-state, 2-symbol Busy Beaver holdout +`1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RA---_1RB1LF` (Halving Tower family). + +Each half-tape stack encodes unary blocks $1^{a + 1}$ separated by single zeros (`encStack`), +ordered from the tape head outward. The closed 2-mode 2nd-order digit-stack system has the +configurations `A(L, R)` (state `A` reading the `0` separator between `encStack L` and +`encStack R`) and `BR(L, R)` (state `B` reading the `0` separator between `encStack L` and +`(encStack R).tail`). Below, `bumpHead` increments the head digit of a stack (pushing `0` onto an +empty stack) and `tailWeight R` is the head digit of `R` (`0` if `R = []`). + +## Accelerated Transition Rules + +```text +A(L, []) -> BR(bumpHead L, []) +A(L, [0]) -> A(1 :: bumpHead L, []) +A(L, 0 :: e :: R) -> Halt +A(L, (d + 1) :: R) -> A(d :: bumpHead L, R) + +BR([], R) -> Halt +BR(0 :: L, R) -> A((tailWeight R + 1) :: L, R.tail) +BR(1 :: L, R) -> BR(bumpHead L, 0 :: tailWeight R :: R.tail) +BR(2 :: L, R) -> A((tailWeight R + 2) :: bumpHead L, R.tail) +BR((a + 3) :: L, R) -> BR((a + 1) :: bumpHead L, (tailWeight R + 1) :: R.tail) + +Start: A([2, 0], []), reached after 16 raw TM steps +``` + + +## Hardness + +*Hardness class:* Problem S4 — trigger **POW**, growth mass-conserving sandpile, shield partial. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* as #660 (same sandpile law); E3 macro twin of #209; busycoq `Eqv_*` merges #96 into this +class + +*Simulated horizon:* family-level + +*Why it is hard:* see #660 + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + +-/ + +@[expose] public section + +namespace BusyBeaver.M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF + +open SixState Turing Stack + +/-- The `(6, 2)` Turing machine in `ConjectureMachines.Machine` form. -/ +def machine : ConjectureMachines.Machine 6 2 := + load_rle_machine% "1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RA---_1RB1LF" + +/-- The `(6, 2)` Turing machine in `BusyBeaver.Machine` form. -/ +abbrev target : Machine (Fin 2) (Fin 6) := + machine.toBB + +/-! ## Digit-Stack Encodings and Walk Helpers -/ + +@[simp] +private theorem encStack_nil : encStack [] = default := + rfl + +private theorem encStack_cons (a : ℕ) (s : List ℕ) : + encStack (a :: s) = ((encStack s).cons 0) <+ (([1] : List (Fin 2)) ^ (a + 1)) := + rfl + +@[simp] +private theorem encStack_cons_one (s : List ℕ) : + (1 : Fin 2) >> encStack s = encStack (bumpHead s) := by + cases s with + | nil => simp [bumpHead, encStack] + | cons a s' => rfl + +/-- Head digit of a right stack under `.tail` (`0` if empty, `d` if `d :: _`). -/ +private def tailWeight : List ℕ → ℕ + | [] => 0 + | d :: _ => d + +@[simp] +private theorem encStack_tail_cons_one (R : List ℕ) : + (1 : Fin 2) >> (encStack R).tail = encStack (tailWeight R :: R.tail) := by + cases R with + | nil => simp [tailWeight, encStack] + | cons d R' => simp [tailWeight, encStack, list_pow_succ] + +private theorem encStack_tail_decomp (R : List ℕ) : + (encStack R).tail = (([1] : List (Fin 2)) ^ (tailWeight R)) +> ((encStack R.tail).cons 0) := by + cases R with + | nil => simp [tailWeight, encStack] + | cons d R' => simp [tailWeight, encStack, list_pow_succ] + +local macro "finish" : tactic => `(tactic| ( + refine ⟨0, ?_⟩ + simp only [Cfg.headRight, Cfg.headLeft, ListBlank.append_cons, ListBlank.append_nil, + ListBlank.cons_zero_default, encStack_nil, encStack_cons_one, encStack_tail_cons_one, + ListBlank.head_cons, ListBlank.tail_cons, multiStep_zero] + try rfl)) + +local macro "step" : tactic => `(tactic| ( + try refine ReachesPlus.to_star ?_ + try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, + ListBlank.head_default_fin, ListBlank.tail_cons, ListBlank.tail_default, + ListBlank.cons_zero_default] + apply ReachesPlus.head (by rfl) + simp only [Cfg.headRight, Cfg.headLeft, Tape.move, Tape.write, + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.cons_zero_default, ListBlank.head_default_fin, ListBlank.tail_default])) + +local macro "execute" n:num : tactic => `(tactic| ( + iterate $n step + try finish)) + +/-- Right-sweep separator configuration: state `A` reading `0` between `L` and `R`. -/ +private def cfg_A (L R : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some A, ⟨0, encStack L, encStack R⟩⟩ + +/-- Left-split separator configuration: state `B` reading `0` between `L` and `(encStack R).tail`. +-/ +private def cfg_BR (L R : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some B, ⟨0, encStack L, (encStack R).tail⟩⟩ + +/-- Modes of the 2nd-order digit-stack configuration family. -/ +private inductive StackMode + | A + | BR + +private def evalStackCfg1 : StackMode → List ℕ → List ℕ → Cfg (Fin 2) (Fin 6) + | .A, L, R => cfg_A L R + | .BR, L, R => cfg_BR L R + +private def IsInStackSystem1 (cfg : Cfg (Fin 2) (Fin 6)) : Prop := + ∃ m L R, cfg = evalStackCfg1 m L R + +/-- State `A` walks right across `1^k` (`A, 1 -> 1RA`). -/ +private theorem a_walk_right (k : ℕ) (l r : ListBlank (Fin 2)) : + (l {{A}}> ((([1] : List (Fin 2)) ^ k) +> r)) [target]⊢* + ((l <+ (([1] : List (Fin 2)) ^ k)) {{A}}> r) := by + induction k generalizing l r with + | zero => exact ⟨0, rfl⟩ + | succ k ih => + have h_split : k + 1 = 1 + k := by omega + rw [h_split, list_pow_add, ListBlank.append_assoc] + have h1 : + (l {{A}}> (([1] : List (Fin 2)) ^ 1 +> (([1] : List (Fin 2)) ^ k +> r))) [target]⊢⁺ + ((l <+ (([1] : List (Fin 2)) ^ 1)) {{A}}> (([1] : List (Fin 2)) ^ k +> r)) := by + simp only [list_pow_one] + execute 1 + refine h1.to_star.trans ?_ + refine (ih (l <+ (([1] : List (Fin 2)) ^ 1)) r).trans ?_ + rw [← ListBlank.append_assoc, list_pow_add_comm] + +/-- State `F` walks left across `1^k` (`F, 1 -> 1LF`). -/ +private theorem f_walk_left (k : ℕ) (l r : ListBlank (Fin 2)) : + ((l <+ (([1] : List (Fin 2)) ^ k)) <{{F}} r) [target]⊢* + (l <{{F}} ((([1] : List (Fin 2)) ^ k) +> r)) := by + induction k generalizing l r with + | zero => exact ⟨0, rfl⟩ + | succ k ih => + have h_split : k + 1 = 1 + k := by omega + rw [h_split, list_pow_add, ListBlank.append_assoc] + have h1 : + (((l <+ (([1] : List (Fin 2)) ^ k)) <+ (([1] : List (Fin 2)) ^ 1)) <{{F}} r) [target]⊢⁺ + ((l <+ (([1] : List (Fin 2)) ^ k)) <{{F}} (([1] : List (Fin 2)) ^ 1 +> r)) := by + simp only [list_pow_one] + execute 1 + refine h1.to_star.trans ?_ + refine (ih l (([1] : List (Fin 2)) ^ 1 +> r)).trans ?_ + rw [← ListBlank.append_assoc, list_pow_add_comm] + +/-! ## Local Separator Rules -/ + +private theorem rule_A_nil (L : List ℕ) : + (cfg_A L []) [target]⊢⁺ (cfg_BR (bumpHead L) []) := by + unfold cfg_A cfg_BR + rw [encStack_nil] + execute 1 + +private theorem rule_A_zero_nil (L : List ℕ) : + (cfg_A L [0]) [target]⊢⁺ (cfg_A (1 :: bumpHead L) []) := by + unfold cfg_A + rw [encStack_cons 0 [], encStack_nil, encStack_cons 1 (bumpHead L)] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 4 + +private def cfg_Halt_A (L : List ℕ) (e : ℕ) (R : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some E, ⟨1, (1 : Fin 2) >> (0 : Fin 2) >> encStack (bumpHead L), + (([1] : List (Fin 2)) ^ e) +> (encStack R).cons 0⟩⟩ + +private theorem rule_A_zero_cons (L R : List ℕ) (e : ℕ) : + ((cfg_A L (0 :: e :: R)) [target]⊢⁺ (cfg_Halt_A L e R)) ∧ + (step target (cfg_Halt_A L e R)).isNone := by + refine ⟨?_, rfl⟩ + unfold cfg_A cfg_Halt_A + rw [encStack_cons 0 (e :: R), encStack_cons e R] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 3 + +private theorem rule_A_succ_cons (L R : List ℕ) (d : ℕ) : + (cfg_A L ((d + 1) :: R)) [target]⊢⁺ (cfg_A (d :: bumpHead L) R) := by + unfold cfg_A + rw [encStack_cons (d + 1) R] + have h_split : d + 1 + 1 = 2 + d := by omega + rw [h_split, list_pow_add, ListBlank.append_assoc] + have h_pre : + (⟨some A, ⟨0, encStack L, + (([1] : List (Fin 2)) ^ 2) +> ((([1] : List (Fin 2)) ^ d) +> (encStack R).cons 0)⟩⟩ : + Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + ((((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) {{A}}> + ((([1] : List (Fin 2)) ^ d) +> (encStack R).cons 0)) := by + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 5 + refine h_pre.trans_star ?_ + refine (a_walk_right d (((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) + ((encStack R).cons 0)).trans ?_ + rw [← ListBlank.append_assoc, ← list_pow_add, ← encStack_cons d (bumpHead L)] + finish + +private def cfg_Halt_BR (R : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some E, ⟨1, encStack [0], (encStack R).tail⟩⟩ + +private theorem rule_BR_nil (R : List ℕ) : + ((cfg_BR [] R) [target]⊢⁺ (cfg_Halt_BR R)) ∧ + (step target (cfg_Halt_BR R)).isNone := by + refine ⟨?_, rfl⟩ + unfold cfg_BR cfg_Halt_BR + rw [encStack_cons 0 [], encStack_nil] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 2 + +private theorem rule_BR_zero (L R : List ℕ) : + (cfg_BR (0 :: L) R) [target]⊢⁺ (cfg_A ((tailWeight R + 1) :: L) R.tail) := by + unfold cfg_BR cfg_A + rw [encStack_cons 0 L, encStack_tail_decomp R] + have h_pre : + (⟨some B, ⟨0, ((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 1), + (([1] : List (Fin 2)) ^ (tailWeight R)) +> (encStack R.tail).cons 0⟩⟩ : + Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + ((((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 2)) {{A}}> + ((([1] : List (Fin 2)) ^ (tailWeight R)) +> (encStack R.tail).cons 0)) := by + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 5 + refine h_pre.trans_star ?_ + refine (a_walk_right (tailWeight R) (((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 2)) + ((encStack R.tail).cons 0)).trans ?_ + rw [← ListBlank.append_assoc, ← list_pow_add, ← encStack_cons (tailWeight R + 1) L] + finish + +private theorem rule_BR_one (L R : List ℕ) : + (cfg_BR (1 :: L) R) [target]⊢⁺ (cfg_BR (bumpHead L) (0 :: tailWeight R :: R.tail)) := by + unfold cfg_BR + rw [encStack_cons 1 L, encStack_cons 0 (tailWeight R :: R.tail)] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 4 + +private theorem rule_BR_two (L R : List ℕ) : + (cfg_BR (2 :: L) R) [target]⊢⁺ (cfg_A ((tailWeight R + 2) :: bumpHead L) R.tail) := by + unfold cfg_BR cfg_A + rw [encStack_cons 2 L, encStack_tail_decomp R] + have h_pre : + (⟨some B, ⟨0, ((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 3), + (([1] : List (Fin 2)) ^ (tailWeight R)) +> (encStack R.tail).cons 0⟩⟩ : + Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + ((((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 3)) {{A}}> + ((([1] : List (Fin 2)) ^ (tailWeight R)) +> (encStack R.tail).cons 0)) := by + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 9 + refine h_pre.trans_star ?_ + refine (a_walk_right (tailWeight R) + (((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 3)) + ((encStack R.tail).cons 0)).trans ?_ + rw [← ListBlank.append_assoc, ← list_pow_add, ← encStack_cons (tailWeight R + 2) (bumpHead L)] + finish + +private theorem rule_BR_ge3 (L R : List ℕ) (a : ℕ) : + (cfg_BR ((a + 3) :: L) R) [target]⊢⁺ + (cfg_BR ((a + 1) :: bumpHead L) ((tailWeight R + 1) :: R.tail)) := by + unfold cfg_BR + rw [encStack_cons (a + 3) L] + have h_split : a + 3 + 1 = 2 + (a + 1 + 1) := by omega + rw [h_split, list_pow_add, ListBlank.append_assoc] + have h_pre : + (⟨some B, ⟨0, (((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ (a + 1 + 1))) <+ + (([1] : List (Fin 2)) ^ 2), (encStack R).tail⟩⟩ : Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + ((((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ (a + 1 + 1))) <{{F}} + (((encStack (tailWeight R :: R.tail)).cons 0).cons 0)) := by + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 3 + refine h_pre.trans_star ?_ + rw [list_pow_add, ListBlank.append_assoc] + refine (f_walk_left (a + 1) (((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) + (((encStack (tailWeight R :: R.tail)).cons 0).cons 0)).trans ?_ + have h_split3 : a + 1 = 1 + a := by omega + rw [h_split3, list_pow_add, ListBlank.append_assoc] + have h_mid : + ((((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) <{{F}} + ((([1] : List (Fin 2)) ^ 1) +> + ((([1] : List (Fin 2)) ^ a) +> (((encStack (tailWeight R :: R.tail)).cons 0).cons 0)))) + [target]⊢⁺ + ((((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) {{A}}> + ((([1] : List (Fin 2)) ^ a) +> + (((encStack (tailWeight R :: R.tail)).cons 0).cons 0))) := by + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 6 + refine h_mid.to_star.trans ?_ + refine (a_walk_right a (((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) + (((encStack (tailWeight R :: R.tail)).cons 0).cons 0)).trans ?_ + rw [← ListBlank.append_assoc, ← list_pow_add, ← encStack_cons a (bumpHead L)] + have h_post : + ((encStack (a :: bumpHead L)) {{A}}> (((encStack (tailWeight R :: R.tail)).cons 0).cons 0)) + [target]⊢⁺ + (⟨some B, ⟨0, encStack ((a + 1) :: bumpHead L), + (encStack ((tailWeight R + 1) :: R.tail)).tail⟩⟩ : Cfg (Fin 2) (Fin 6)) := by + rw [encStack_cons (tailWeight R + 1) R.tail] + simp only [list_pow_succ, List.cons_append, List.nil_append] + execute 1 + rw [Nat.add_comm 1 a] + exact h_post.to_star + +/-! ## Initial Reachability and Stack Reduction Closure -/ + +private theorem init_to_cfg_A : + (init []) [target]⊢⁺ (cfg_A [2, 0] []) := by + unfold cfg_A + rw [encStack_cons 2 [0], encStack_cons 0 [], encStack_nil] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 16 + +private theorem init_reaches_nontrivial : + (init []) [target]⊢⁺ evalStackCfg1 .BR [1, 1] [1] := + init_to_cfg_A + |>.trans (rule_A_nil [2, 0]) + |>.trans (rule_BR_ge3 [0] [] 0) + +private theorem stack_system_closed (cfg : Cfg (Fin 2) (Fin 6)) (h : IsInStackSystem1 cfg) : + ∃ cfg', (cfg [target]⊢⁺ cfg') ∧ + (IsInStackSystem1 cfg' ∨ (step target cfg').isNone) := by + rcases h with ⟨m, L, R, rfl⟩ + cases m with + | A => + cases R with + | nil => + exact ⟨cfg_BR (bumpHead L) [], rule_A_nil L, Or.inl ⟨.BR, bumpHead L, [], rfl⟩⟩ + | cons d R' => + rcases d with _ | d + · cases R' with + | nil => + exact ⟨cfg_A (1 :: bumpHead L) [], rule_A_zero_nil L, + Or.inl ⟨.A, 1 :: bumpHead L, [], rfl⟩⟩ + | cons e R'' => + obtain ⟨hstep, hnone⟩ := rule_A_zero_cons L R'' e + exact ⟨cfg_Halt_A L e R'', hstep, Or.inr hnone⟩ + · exact ⟨cfg_A (d :: bumpHead L) R', rule_A_succ_cons L R' d, + Or.inl ⟨.A, d :: bumpHead L, R', rfl⟩⟩ + | BR => + cases L with + | nil => + obtain ⟨hstep, hnone⟩ := rule_BR_nil R + exact ⟨cfg_Halt_BR R, hstep, Or.inr hnone⟩ + | cons a L' => + rcases a with _ | _ | _ | a + · exact ⟨cfg_A ((tailWeight R + 1) :: L') R.tail, rule_BR_zero L' R, + Or.inl ⟨.A, (tailWeight R + 1) :: L', R.tail, rfl⟩⟩ + · exact ⟨cfg_BR (bumpHead L') (0 :: tailWeight R :: R.tail), rule_BR_one L' R, + Or.inl ⟨.BR, bumpHead L', 0 :: tailWeight R :: R.tail, rfl⟩⟩ + · exact ⟨cfg_A ((tailWeight R + 2) :: bumpHead L') R.tail, rule_BR_two L' R, + Or.inl ⟨.A, (tailWeight R + 2) :: bumpHead L', R.tail, rfl⟩⟩ + · exact ⟨cfg_BR ((a + 1) :: bumpHead L') ((tailWeight R + 1) :: R.tail), + rule_BR_ge3 L' R a, + Or.inl ⟨.BR, (a + 1) :: bumpHead L', (tailWeight R + 1) :: R.tail, rfl⟩⟩ + +private theorem encStack_head (a : ℕ) (s : List ℕ) : (encStack (a :: s)).head = 1 := by + simp [encStack, list_pow_succ] + +private theorem encStack_not_surjective : + ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ s : List ℕ, encStack s ≠ t := by + refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ + intro s h + rcases s with _ | ⟨_ | a, rest⟩ + · have h1 := congrArg ListBlank.head h + simp [encStack] at h1 + · rcases rest with _ | ⟨b, s'⟩ + · have h1 := congrArg (fun x => x.tail.tail.tail.head) h + simp [encStack, list_pow_succ, list_pow_zero] at h1 + · have h1 := congrArg (fun x => x.tail.tail.head) h + simp [encStack, list_pow_succ, list_pow_zero] at h1 + · have h1 := congrArg (fun x => x.tail.head) h + simp [encStack, list_pow_succ] at h1 + +private theorem block_encoding : + ∃ strideL offsetL sepL strideR offsetR sepR : ℕ, + strideL > 0 ∧ offsetL > 0 ∧ sepL > 0 ∧ + strideR > 0 ∧ offsetR > 0 ∧ sepR > 0 ∧ + (∀ a L, encStack (a :: L) = + ListBlank.append (([1] : List (Fin 2)) ^ (strideL * a + offsetL)) + (ListBlank.append (([0] : List (Fin 2)) ^ sepL) (encStack L))) ∧ + (∀ d R, encStack (d :: R) = + ListBlank.append (([1] : List (Fin 2)) ^ (strideR * d + offsetR)) + (ListBlank.append (([0] : List (Fin 2)) ^ sepR) (encStack R))) := by + refine ⟨1, 1, 1, 1, 1, 1, + by decide, by decide, by decide, by decide, by decide, by decide, ?_, ?_⟩ + · intro a L + simp [encStack] + · intro d R + simp [encStack] + +private theorem modes_bounded : + ∃ modes : List StackMode, modes.length ≤ 6 ∧ ∀ m : StackMode, m ∈ modes := by + refine ⟨[.A, .BR], by decide, ?_⟩ + intro m + cases m <;> simp + +private theorem valid_stack_modes : IsValidStackModes encStack encStack evalStackCfg1 := by + intro m + cases m with + | A => exact ⟨A, .id [], .id [], by decide, by decide, Or.inl (fun _ _ => rfl)⟩ + | BR => exact ⟨B, .id [], .tail [], by decide, by decide, Or.inl (fun _ _ => rfl)⟩ + +/-- `target` reduces to a closed 2nd-order digit-stack system (`HasStackReduction`). -/ +theorem has_stack_reduction : HasStackReduction target := + HasStackReduction.of_oneDigit target StackMode encStack encStack evalStackCfg1 IsInStackSystem1 + ⟨rfl, rfl, encStack_head, encStack_head, + encStack_not_surjective, encStack_not_surjective, + block_encoding, modes_bounded, valid_stack_modes, + fun _ => Iff.rfl, fun m L R => ⟨m, L, R, rfl⟩, + ⟨.BR, [1, 1], [1], init_reaches_nontrivial, by decide, ⟨1, by decide, by decide⟩⟩, + Or.inl ⟨.BR, .BR, 1, (· + 1), fun R => 0 :: tailWeight R :: R.tail, + fun s => by cases s <;> simp, fun z L R => rule_BR_one (z :: L) R⟩, + stack_system_closed⟩ + +end BusyBeaver.M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.lean b/BusyBeaver/BB6/Accelerations/M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.lean new file mode 100644 index 00000000..73886ee8 --- /dev/null +++ b/BusyBeaver/BB6/Accelerations/M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.lean @@ -0,0 +1,868 @@ +/- +Copyright (c) 2026 Google LLC. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +-/ +module + +public import BusyBeaver.Basic +public import BusyBeaver.BB6.Accelerations.Stack +public import BusyBeaver.Bridge + +/-! +# Busy Beaver Holdout `1RB1RC_1LC0LE_1RD1RC_1LB0RA_---0LF_1RD1LF` + +Formal `HasStackReduction` proof for the 6-state, 2-symbol Busy Beaver holdout +`1RB1RC_1LC0LE_1RD1RC_1LB0RA_---0LF_1RD1LF` (Halving Tower family). + +Each half-tape stack encodes unary blocks $1^{a + 1}$ separated by single zeros (`encStack`), +ordered from the tape head outward. Starting from `init []`, the machine enters a closed 3-mode +(`C`, `D`, `D00`) 2nd-order digit-stack system in 5 raw steps, where + +* `C(L, R)` has state `C` reading the `0` separator between `encStack L` and `encStack R`, +* `D(L, R)` has state `D` reading the `0` separator between `encStack L` and `encStack R`, +* `D00(L, R)` has state `D` reading `0` between `encStack L` and `0 · encStack R`. + +## Accelerated Transition Rules + +With `β = bumpHead` (increment the head digit, or push `0` onto an empty stack): + +```text +C(L, []) -> D(β L, []) +C(L, [0]) -> C(1 :: β L, []) +C(L, 0 :: (e + 1) :: R) -> D00(β (β L), e :: R) +C(L, 0 :: 0 :: R) -> D00₀(β (β L), [] | R) (double-zero sub-system, see below) +C(L, (d + 1) :: R) -> C(d :: β L, R) + +D([], []) -> C([0, 0], []) +D([], d :: R) -> C([d + 1, 0], R) +D(0 :: L, R) -> Halt (state E) +D(1 :: L, R) -> D00(β L, β R) +D(2 :: L, []) -> C(2 :: β L, []) +D(2 :: L, d :: R) -> C((d + 3) :: β L, R) +D((a + 3) :: L, R) -> D((a + 1) :: β L, β R) + +D00([], R) -> C([0, 0], R) +D00(0 :: L, R) -> Halt (state E) +D00(1 :: L, R) -> D00(β L, 0 :: R) +D00(2 :: L, R) -> C(2 :: β L, R) +D00((a + 3) :: L, R) -> D((a + 1) :: β L, 0 :: R) + +Start: D([2], []), reached after 5 raw TM steps +``` + +The double-zero case `C(L, 0 :: 0 :: R)` is closed through an inner sub-system `C₀`, `D₀`, `D00₀` +whose right half-tape is `encRight0 R S`: the digit stack `S` encoded as usual but sealed by +`0 · encStack R` instead of the blank tape. Its rules mirror the `C`/`D`/`D00` rules +(`C₀(L, [] | R) -> D(β L, R)` re-enters the main system, `D00₀([1], S | R)` halts), and a +strong induction on the head digit shows that every inner configuration with all entries of `S` +positive either halts or returns to the main system (`rule_C_zero_zero_cons`). + + +## Hardness + +*Hardness class:* Problem S4 — trigger **POW**, growth mass-conserving sandpile, shield partial. + +*Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously +non-halting. + +*Hazard:* as #660; E3 macro twin of #659 + +*Simulated horizon:* family-level + +*Why it is hard:* see #660 + +See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. + +-/ + +@[expose] public section + +namespace BusyBeaver.M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF + +open SixState Turing Stack + +/-- The `(6, 2)` Turing machine in `ConjectureMachines.Machine` form. -/ +def machine : ConjectureMachines.Machine 6 2 := + load_rle_machine% "1RB1RC_1LC0LE_1RD1RC_1LB0RA_---0LF_1RD1LF" + +/-- The `(6, 2)` Turing machine in `BusyBeaver.Machine` form. -/ +abbrev target : Machine (Fin 2) (Fin 6) := + machine.toBB + +/-! ## Digit-Stack Encodings and Walk Helpers -/ + +@[simp] +private theorem encStack_nil : encStack [] = default := + rfl + +private theorem encStack_cons (a : ℕ) (s : List ℕ) : + encStack (a :: s) = ((encStack s).cons 0) <+ (([1] : List (Fin 2)) ^ (a + 1)) := + rfl + +@[simp] +private theorem encStack_cons_one (s : List ℕ) : + (1 : Fin 2) >> encStack s = encStack (bumpHead s) := by + cases s with + | nil => simp [bumpHead, encStack] + | cons a s' => rfl + +local macro "finish" : tactic => `(tactic| ( + refine ⟨0, ?_⟩ + simp only [Cfg.headRight, Cfg.headLeft, ListBlank.append_cons, ListBlank.append_nil, + ListBlank.cons_zero_default, encStack_nil, encStack_cons_one, + ListBlank.head_cons, ListBlank.tail_cons, multiStep_zero] + try rfl)) + +local macro "step" : tactic => `(tactic| ( + try refine ReachesPlus.to_star ?_ + try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, + ListBlank.head_default_fin, ListBlank.tail_cons, ListBlank.tail_default, + ListBlank.cons_zero_default] + apply ReachesPlus.head (by rfl) + simp only [Cfg.headRight, Cfg.headLeft, Tape.move, Tape.write, + ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, + ListBlank.cons_zero_default, ListBlank.head_default_fin, ListBlank.tail_default])) + +local macro "execute" n:num : tactic => `(tactic| ( + iterate $n step + try finish)) + +/-- Right-sweep separator configuration: state `C` reading `0` between `L` and `R`. -/ +private def cfg_C (L R : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some C, ⟨0, encStack L, encStack R⟩⟩ + +/-- Left-split separator configuration: state `D` reading `0` between `L` and `R`. -/ +private def cfg_D (L R : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some D, ⟨0, encStack L, encStack R⟩⟩ + +/-- Double-zero separator configuration: state `D` reading `0` between `L` and `0 >> encStack R`. +-/ +private def cfg_D00 (L R : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some D, ⟨0, encStack L, (encStack R).cons 0⟩⟩ + +/-- Modes of the 2nd-order digit-stack configuration family. -/ +private inductive StackMode + | C + | D + | D00 + +private def evalStackCfg1 : StackMode → List ℕ → List ℕ → Cfg (Fin 2) (Fin 6) + | .C, L, R => cfg_C L R + | .D, L, R => cfg_D L R + | .D00, L, R => cfg_D00 L R + +private def IsInStackSystem1 (cfg : Cfg (Fin 2) (Fin 6)) : Prop := + ∃ m L R, cfg = evalStackCfg1 m L R + +/-- State `C` walks right across `1^k` (`C, 1 -> 1RC`). -/ +private theorem c_walk_right (k : ℕ) (l r : ListBlank (Fin 2)) : + (l {{C}}> ((([1] : List (Fin 2)) ^ k) +> r)) [target]⊢* + ((l <+ (([1] : List (Fin 2)) ^ k)) {{C}}> r) := by + induction k generalizing l r with + | zero => exact ⟨0, rfl⟩ + | succ k ih => + have h_split : k + 1 = 1 + k := by omega + rw [h_split, list_pow_add, ListBlank.append_assoc] + have h1 : + (l {{C}}> (([1] : List (Fin 2)) ^ 1 +> (([1] : List (Fin 2)) ^ k +> r))) [target]⊢⁺ + ((l <+ (([1] : List (Fin 2)) ^ 1)) {{C}}> (([1] : List (Fin 2)) ^ k +> r)) := by + simp only [list_pow_one] + execute 1 + refine h1.to_star.trans ?_ + refine (ih (l <+ (([1] : List (Fin 2)) ^ 1)) r).trans ?_ + rw [← ListBlank.append_assoc, list_pow_add_comm] + +/-- State `F` walks left across `1^k` (`F, 1 -> 1LF`). -/ +private theorem f_walk_left (k : ℕ) (l r : ListBlank (Fin 2)) : + ((l <+ (([1] : List (Fin 2)) ^ k)) <{{F}} r) [target]⊢* + (l <{{F}} ((([1] : List (Fin 2)) ^ k) +> r)) := by + induction k generalizing l r with + | zero => exact ⟨0, rfl⟩ + | succ k ih => + have h_split : k + 1 = 1 + k := by omega + rw [h_split, list_pow_add, ListBlank.append_assoc] + have h1 : + (((l <+ (([1] : List (Fin 2)) ^ k)) <+ (([1] : List (Fin 2)) ^ 1)) <{{F}} r) [target]⊢⁺ + ((l <+ (([1] : List (Fin 2)) ^ k)) <{{F}} (([1] : List (Fin 2)) ^ 1 +> r)) := by + simp only [list_pow_one] + execute 1 + refine h1.to_star.trans ?_ + refine (ih l (([1] : List (Fin 2)) ^ 1 +> r)).trans ?_ + rw [← ListBlank.append_assoc, list_pow_add_comm] + +/-! ## Mode `C` Rules -/ + +private theorem rule_C_nil (L : List ℕ) : + (cfg_C L []) [target]⊢⁺ (cfg_D (bumpHead L) []) := by + unfold cfg_C cfg_D + rw [encStack_nil] + execute 1 + +private theorem rule_C_zero_nil (L : List ℕ) : + (cfg_C L [0]) [target]⊢⁺ (cfg_C (1 :: bumpHead L) []) := by + unfold cfg_C + rw [encStack_cons 0 [], encStack_nil, encStack_cons 1 (bumpHead L)] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 6 + +private theorem rule_C_zero_succ_cons (L R : List ℕ) (e : ℕ) : + (cfg_C L (0 :: (e + 1) :: R)) [target]⊢⁺ (cfg_D00 (bumpHead (bumpHead L)) (e :: R)) := by + unfold cfg_C cfg_D00 + rw [encStack_cons 0 ((e + 1) :: R), encStack_cons (e + 1) R, encStack_cons e R] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 6 + +private theorem rule_C_succ_cons (L R : List ℕ) (d : ℕ) : + (cfg_C L ((d + 1) :: R)) [target]⊢⁺ (cfg_C (d :: bumpHead L) R) := by + unfold cfg_C + rw [encStack_cons (d + 1) R] + have h_split : d + 1 + 1 = 2 + d := by omega + rw [h_split, list_pow_add, ListBlank.append_assoc] + have h_pre : + (⟨some C, ⟨0, encStack L, + (([1] : List (Fin 2)) ^ 2) +> + ((([1] : List (Fin 2)) ^ d) +> (encStack R).cons 0)⟩⟩ : Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + ((((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) {{C}}> + ((([1] : List (Fin 2)) ^ d) +> (encStack R).cons 0)) := by + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 3 + refine h_pre.trans_star ?_ + refine (c_walk_right d (((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) + ((encStack R).cons 0)).trans ?_ + rw [← ListBlank.append_assoc, ← list_pow_add, ← encStack_cons d (bumpHead L)] + finish + +/-! ## Mode `D` Rules -/ + +private theorem rule_D_nil_nil : + (cfg_D [] []) [target]⊢⁺ (cfg_C [0, 0] []) := by + unfold cfg_D cfg_C + rw [encStack_nil, encStack_cons 0 [0], encStack_cons 0 [], encStack_nil] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 5 + +private theorem rule_D_nil_cons (R : List ℕ) (d : ℕ) : + (cfg_D [] (d :: R)) [target]⊢⁺ (cfg_C ((d + 1) :: [0]) R) := by + unfold cfg_D cfg_C + rw [encStack_nil, encStack_cons d R] + have h_pre : + (⟨some D, ⟨0, default, + (([1] : List (Fin 2)) ^ (d + 1)) +> (encStack R).cons 0⟩⟩ : Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + ((((encStack [0]).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) {{C}}> + ((([1] : List (Fin 2)) ^ (d + 1)) +> (encStack R).cons 0)) := by + rw [encStack_cons 0 [], encStack_nil] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 5 + refine h_pre.trans_star ?_ + refine (c_walk_right (d + 1) (((encStack [0]).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) + ((encStack R).cons 0)).trans ?_ + rw [← ListBlank.append_assoc, ← list_pow_add, ← encStack_cons (d + 1) [0]] + finish + +private def cfg_Halt_D (L R : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some E, ⟨0, encStack L, (0 : Fin 2) >> encStack (bumpHead R)⟩⟩ + +private theorem rule_D_zero (L R : List ℕ) : + ((cfg_D (0 :: L) R) [target]⊢⁺ (cfg_Halt_D L R)) ∧ + (step target (cfg_Halt_D L R)).isNone := by + refine ⟨?_, rfl⟩ + unfold cfg_D cfg_Halt_D + rw [encStack_cons 0 L] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 2 + +private theorem rule_D_one (L R : List ℕ) : + (cfg_D (1 :: L) R) [target]⊢⁺ (cfg_D00 (bumpHead L) (bumpHead R)) := by + unfold cfg_D cfg_D00 + rw [encStack_cons 1 L] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 4 + +private theorem rule_D_two_nil (L : List ℕ) : + (cfg_D (2 :: L) []) [target]⊢⁺ (cfg_C (2 :: bumpHead L) []) := by + unfold cfg_D cfg_C + rw [encStack_cons 2 L, encStack_cons 2 (bumpHead L), encStack_nil] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 11 + +private theorem rule_D_two_cons (L R : List ℕ) (d : ℕ) : + (cfg_D (2 :: L) (d :: R)) [target]⊢⁺ (cfg_C ((d + 3) :: bumpHead L) R) := by + unfold cfg_D cfg_C + rw [encStack_cons 2 L, encStack_cons d R] + have h_pre : + (⟨some D, ⟨0, ((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 3), + (([1] : List (Fin 2)) ^ (d + 1)) +> (encStack R).cons 0⟩⟩ : Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + ((((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 3)) {{C}}> + ((([1] : List (Fin 2)) ^ (d + 1)) +> (encStack R).cons 0)) := by + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 11 + refine h_pre.trans_star ?_ + refine (c_walk_right (d + 1) (((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 3)) + ((encStack R).cons 0)).trans ?_ + rw [← ListBlank.append_assoc, ← list_pow_add, ← encStack_cons (d + 3) (bumpHead L)] + finish + +private theorem rule_D_ge3 (L R : List ℕ) (a : ℕ) : + (cfg_D ((a + 3) :: L) R) [target]⊢⁺ (cfg_D ((a + 1) :: bumpHead L) (bumpHead R)) := by + unfold cfg_D + rw [encStack_cons (a + 3) L] + have h_split : a + 3 + 1 = 2 + (a + 1 + 1) := by omega + rw [h_split, list_pow_add, ListBlank.append_assoc] + have h_pre : + (⟨some D, ⟨0, (((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ (a + 1 + 1))) <+ + (([1] : List (Fin 2)) ^ 2), encStack R⟩⟩ : Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + ((((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ (a + 1 + 1))) <{{F}} + (((encStack (bumpHead R)).cons 0).cons 0)) := by + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 3 + refine h_pre.trans_star ?_ + rw [list_pow_add, ListBlank.append_assoc] + refine (f_walk_left (a + 1) (((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) + (((encStack (bumpHead R)).cons 0).cons 0)).trans ?_ + have h_split3 : a + 1 = 1 + a := by omega + rw [h_split3, list_pow_add, ListBlank.append_assoc] + have h_mid : + ((((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) <{{F}} + ((([1] : List (Fin 2)) ^ 1) +> + ((([1] : List (Fin 2)) ^ a) +> (((encStack (bumpHead R)).cons 0).cons 0)))) + [target]⊢⁺ + ((((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) {{C}}> + ((([1] : List (Fin 2)) ^ a) +> (((encStack (bumpHead R)).cons 0).cons 0))) := by + simp only [list_pow_one] + execute 4 + refine h_mid.to_star.trans ?_ + refine (c_walk_right a (((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) + (((encStack (bumpHead R)).cons 0).cons 0)).trans ?_ + rw [← ListBlank.append_assoc, ← list_pow_add, ← encStack_cons a (bumpHead L)] + have h_post : + ((encStack (a :: bumpHead L)) {{C}}> (((encStack (bumpHead R)).cons 0).cons 0)) + [target]⊢⁺ + (⟨some D, ⟨0, encStack ((a + 1) :: bumpHead L), encStack (bumpHead R)⟩⟩ : + Cfg (Fin 2) (Fin 6)) := by + execute 1 + rw [Nat.add_comm 1 a] + exact h_post.to_star + +/-! ## Mode `D00` Rules -/ + +private theorem rule_D00_nil (R : List ℕ) : + (cfg_D00 [] R) [target]⊢⁺ (cfg_C [0, 0] R) := by + unfold cfg_D00 cfg_C + rw [encStack_nil, encStack_cons 0 [0], encStack_cons 0 [], encStack_nil] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 5 + +private def cfg_Halt_D00 (L R : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some E, ⟨0, encStack L, (0 : Fin 2) >> (1 : Fin 2) >> (encStack R).cons 0⟩⟩ + +private theorem rule_D00_zero (L R : List ℕ) : + ((cfg_D00 (0 :: L) R) [target]⊢⁺ (cfg_Halt_D00 L R)) ∧ + (step target (cfg_Halt_D00 L R)).isNone := by + refine ⟨?_, rfl⟩ + unfold cfg_D00 cfg_Halt_D00 + rw [encStack_cons 0 L] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 2 + +private theorem rule_D00_one (L R : List ℕ) : + (cfg_D00 (1 :: L) R) [target]⊢⁺ (cfg_D00 (bumpHead L) (0 :: R)) := by + unfold cfg_D00 + rw [encStack_cons 1 L, encStack_cons 0 R] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 4 + +private theorem rule_D00_two (L R : List ℕ) : + (cfg_D00 (2 :: L) R) [target]⊢⁺ (cfg_C (2 :: bumpHead L) R) := by + unfold cfg_D00 cfg_C + rw [encStack_cons 2 L, encStack_cons 2 (bumpHead L)] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 11 + +private theorem rule_D00_ge3 (L R : List ℕ) (a : ℕ) : + (cfg_D00 ((a + 3) :: L) R) [target]⊢⁺ (cfg_D ((a + 1) :: bumpHead L) (0 :: R)) := by + unfold cfg_D00 cfg_D + rw [encStack_cons (a + 3) L] + have h_split : a + 3 + 1 = 2 + (a + 1 + 1) := by omega + rw [h_split, list_pow_add, ListBlank.append_assoc] + have h_pre : + (⟨some D, ⟨0, (((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ (a + 1 + 1))) <+ + (([1] : List (Fin 2)) ^ 2), (encStack R).cons 0⟩⟩ : Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + ((((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ (a + 1 + 1))) <{{F}} + (((encStack (0 :: R)).cons 0).cons 0)) := by + rw [encStack_cons 0 R] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 3 + refine h_pre.trans_star ?_ + rw [list_pow_add, ListBlank.append_assoc] + refine (f_walk_left (a + 1) (((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) + (((encStack (0 :: R)).cons 0).cons 0)).trans ?_ + have h_split3 : a + 1 = 1 + a := by omega + rw [h_split3, list_pow_add, ListBlank.append_assoc] + have h_mid : + ((((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) <{{F}} + ((([1] : List (Fin 2)) ^ 1) +> + ((([1] : List (Fin 2)) ^ a) +> (((encStack (0 :: R)).cons 0).cons 0)))) + [target]⊢⁺ + ((((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) {{C}}> + ((([1] : List (Fin 2)) ^ a) +> (((encStack (0 :: R)).cons 0).cons 0))) := by + simp only [list_pow_one] + execute 4 + refine h_mid.to_star.trans ?_ + refine (c_walk_right a (((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) + (((encStack (0 :: R)).cons 0).cons 0)).trans ?_ + rw [← ListBlank.append_assoc, ← list_pow_add, ← encStack_cons a (bumpHead L)] + have h_post : + ((encStack (a :: bumpHead L)) {{C}}> (((encStack (0 :: R)).cons 0).cons 0)) + [target]⊢⁺ + (⟨some D, ⟨0, encStack ((a + 1) :: bumpHead L), encStack (0 :: R)⟩⟩ : + Cfg (Fin 2) (Fin 6)) := by + execute 1 + rw [Nat.add_comm 1 a] + exact h_post.to_star + +/-! ## Double-Zero Sub-System (`C(L, 0 :: 0 :: R)`) -/ + +/-- Right half-tape of the inner sub-system: the digit stack `R_act` encoded as `encStack`, but +sealed by `0 >> encStack R` instead of the blank tape. -/ +private def encRight0 (R : List ℕ) : List ℕ → ListBlank (Fin 2) + | [] => (encStack R).cons 0 + | d :: R_act => (([1] : List (Fin 2)) ^ (d + 1)) +> ((encRight0 R R_act).cons 0) + +private theorem encRight0_nil (R : List ℕ) : encRight0 R [] = (encStack R).cons 0 := + rfl + +private theorem encRight0_cons (R : List ℕ) (d : ℕ) (R_act : List ℕ) : + encRight0 R (d :: R_act) = (([1] : List (Fin 2)) ^ (d + 1)) +> ((encRight0 R R_act).cons 0) := + rfl + +/-- Inner right-sweep configuration: state `C` reading `0` between `L` and `encRight0 R R_act`. -/ +private def cfg_C0 (R L R_act : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some C, ⟨0, encStack L, encRight0 R R_act⟩⟩ + +/-- Inner left-split configuration: state `D` reading `0` between `L` and `encRight0 R R_act`. -/ +private def cfg_D0 (R L R_act : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some D, ⟨0, encStack L, encRight0 R R_act⟩⟩ + +/-- Inner double-zero configuration: state `D` reading `0` between `L` and +`0 >> encRight0 R R_act`. -/ +private def cfg_D00_0 (R L R_act : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some D, ⟨0, encStack L, (encRight0 R R_act).cons 0⟩⟩ + +private theorem rule_C_zero_zero_to_D00_0 (L R : List ℕ) : + (cfg_C L (0 :: 0 :: R)) [target]⊢⁺ (cfg_D00_0 R (bumpHead (bumpHead L)) []) := by + unfold cfg_C cfg_D00_0 + rw [encStack_cons 0 (0 :: R), encStack_cons 0 R, encRight0_nil] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 6 + +private def cfg_Halt_D00_0 (R R_act : List ℕ) : Cfg (Fin 2) (Fin 6) := + ⟨some E, ⟨0, default, + (0 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> (encRight0 R R_act).cons 0⟩⟩ + +private theorem rule_D00_0_one_nil_halt (R R_act : List ℕ) : + ((cfg_D00_0 R [1] R_act) [target]⊢⁺ (cfg_Halt_D00_0 R R_act)) ∧ + (step target (cfg_Halt_D00_0 R R_act)).isNone := by + refine ⟨?_, rfl⟩ + unfold cfg_D00_0 cfg_Halt_D00_0 + rw [encStack_cons 1 [], encStack_nil] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 6 + +private theorem rule_C0_nil (R L : List ℕ) : + (cfg_C0 R L []) [target]⊢⁺ (cfg_D (bumpHead L) R) := by + unfold cfg_C0 cfg_D + rw [encRight0_nil] + execute 1 + +private theorem rule_C0_succ_cons (R L R_act : List ℕ) (d : ℕ) : + (cfg_C0 R L ((d + 1) :: R_act)) [target]⊢⁺ (cfg_C0 R (d :: bumpHead L) R_act) := by + unfold cfg_C0 + rw [encRight0_cons R (d + 1) R_act] + have h_split : d + 1 + 1 = 2 + d := by omega + rw [h_split, list_pow_add, ListBlank.append_assoc] + have h_pre : + (⟨some C, ⟨0, encStack L, + (([1] : List (Fin 2)) ^ 2) +> + ((([1] : List (Fin 2)) ^ d) +> (encRight0 R R_act).cons 0)⟩⟩ : Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + ((((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) {{C}}> + ((([1] : List (Fin 2)) ^ d) +> (encRight0 R R_act).cons 0)) := by + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 3 + refine h_pre.trans_star ?_ + refine (c_walk_right d (((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) + ((encRight0 R R_act).cons 0)).trans ?_ + rw [← ListBlank.append_assoc, ← list_pow_add, ← encStack_cons d (bumpHead L)] + finish + +private theorem rule_D00_0_two (R L R_act : List ℕ) : + (cfg_D00_0 R (2 :: L) R_act) [target]⊢⁺ (cfg_C0 R (2 :: bumpHead L) R_act) := by + unfold cfg_D00_0 cfg_C0 + rw [encStack_cons 2 L, encStack_cons 2 (bumpHead L)] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 11 + +private theorem rule_D00_0_ge3 (R L R_act : List ℕ) (a : ℕ) : + (cfg_D00_0 R ((a + 3) :: L) R_act) [target]⊢⁺ + (cfg_D0 R ((a + 1) :: bumpHead L) (0 :: R_act)) := by + unfold cfg_D00_0 cfg_D0 + rw [encStack_cons (a + 3) L] + have h_split : a + 3 + 1 = 2 + (a + 1 + 1) := by omega + rw [h_split, list_pow_add, ListBlank.append_assoc] + have h_pre : + (⟨some D, ⟨0, (((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ (a + 1 + 1))) <+ + (([1] : List (Fin 2)) ^ 2), (encRight0 R R_act).cons 0⟩⟩ : Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + ((((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ (a + 1 + 1))) <{{F}} + (((encRight0 R (0 :: R_act)).cons 0).cons 0)) := by + rw [encRight0_cons R 0 R_act] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 3 + refine h_pre.trans_star ?_ + rw [list_pow_add, ListBlank.append_assoc] + refine (f_walk_left (a + 1) (((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) + (((encRight0 R (0 :: R_act)).cons 0).cons 0)).trans ?_ + have h_split3 : a + 1 = 1 + a := by omega + rw [h_split3, list_pow_add, ListBlank.append_assoc] + have h_mid : + ((((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) <{{F}} + ((([1] : List (Fin 2)) ^ 1) +> + ((([1] : List (Fin 2)) ^ a) +> (((encRight0 R (0 :: R_act)).cons 0).cons 0)))) + [target]⊢⁺ + ((((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) {{C}}> + ((([1] : List (Fin 2)) ^ a) +> (((encRight0 R (0 :: R_act)).cons 0).cons 0))) := by + simp only [list_pow_one] + execute 4 + refine h_mid.to_star.trans ?_ + refine (c_walk_right a (((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) + (((encRight0 R (0 :: R_act)).cons 0).cons 0)).trans ?_ + rw [← ListBlank.append_assoc, ← list_pow_add, ← encStack_cons a (bumpHead L)] + have h_post : + ((encStack (a :: bumpHead L)) {{C}}> (((encRight0 R (0 :: R_act)).cons 0).cons 0)) + [target]⊢⁺ + (⟨some D, ⟨0, encStack ((a + 1) :: bumpHead L), encRight0 R (0 :: R_act)⟩⟩ : + Cfg (Fin 2) (Fin 6)) := by + execute 1 + rw [Nat.add_comm 1 a] + exact h_post.to_star + +private theorem rule_D0_one_cons (R L R_act : List ℕ) (d : ℕ) : + (cfg_D0 R (1 :: L) (d :: R_act)) [target]⊢⁺ + (cfg_D00_0 R (bumpHead L) ((d + 1) :: R_act)) := by + unfold cfg_D0 cfg_D00_0 + rw [encStack_cons 1 L, encRight0_cons R d R_act, encRight0_cons R (d + 1) R_act] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 4 + +private theorem rule_D0_two_cons (R L R_act : List ℕ) (d : ℕ) : + (cfg_D0 R (2 :: L) (d :: R_act)) [target]⊢⁺ (cfg_C0 R ((d + 3) :: bumpHead L) R_act) := by + unfold cfg_D0 cfg_C0 + rw [encStack_cons 2 L, encRight0_cons R d R_act] + have h_pre : + (⟨some D, ⟨0, ((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 3), + (([1] : List (Fin 2)) ^ (d + 1)) +> (encRight0 R R_act).cons 0⟩⟩ : Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + ((((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 3)) {{C}}> + ((([1] : List (Fin 2)) ^ (d + 1)) +> (encRight0 R R_act).cons 0)) := by + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 11 + refine h_pre.trans_star ?_ + refine (c_walk_right (d + 1) (((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 3)) + ((encRight0 R R_act).cons 0)).trans ?_ + rw [← ListBlank.append_assoc, ← list_pow_add, ← encStack_cons (d + 3) (bumpHead L)] + finish + +private theorem rule_D0_ge3_cons (R L R_act : List ℕ) (a d : ℕ) : + (cfg_D0 R ((a + 3) :: L) (d :: R_act)) [target]⊢⁺ + (cfg_D0 R ((a + 1) :: bumpHead L) ((d + 1) :: R_act)) := by + unfold cfg_D0 + rw [encStack_cons (a + 3) L] + have h_split : a + 3 + 1 = 2 + (a + 1 + 1) := by omega + rw [h_split, list_pow_add, ListBlank.append_assoc] + have h_pre : + (⟨some D, ⟨0, (((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ (a + 1 + 1))) <+ + (([1] : List (Fin 2)) ^ 2), encRight0 R (d :: R_act)⟩⟩ : Cfg (Fin 2) (Fin 6)) + [target]⊢⁺ + ((((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ (a + 1 + 1))) <{{F}} + (((encRight0 R ((d + 1) :: R_act)).cons 0).cons 0)) := by + rw [encRight0_cons R d R_act, encRight0_cons R (d + 1) R_act] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 3 + refine h_pre.trans_star ?_ + rw [list_pow_add, ListBlank.append_assoc] + refine (f_walk_left (a + 1) (((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) + (((encRight0 R ((d + 1) :: R_act)).cons 0).cons 0)).trans ?_ + have h_split3 : a + 1 = 1 + a := by omega + rw [h_split3, list_pow_add, ListBlank.append_assoc] + have h_mid : + ((((encStack L).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) <{{F}} + ((([1] : List (Fin 2)) ^ 1) +> + ((([1] : List (Fin 2)) ^ a) +> (((encRight0 R ((d + 1) :: R_act)).cons 0).cons 0)))) + [target]⊢⁺ + ((((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) {{C}}> + ((([1] : List (Fin 2)) ^ a) +> (((encRight0 R ((d + 1) :: R_act)).cons 0).cons 0))) := by + simp only [list_pow_one] + execute 4 + refine h_mid.to_star.trans ?_ + refine (c_walk_right a (((encStack (bumpHead L)).cons 0) <+ (([1] : List (Fin 2)) ^ 1)) + (((encRight0 R ((d + 1) :: R_act)).cons 0).cons 0)).trans ?_ + rw [← ListBlank.append_assoc, ← list_pow_add, ← encStack_cons a (bumpHead L)] + have h_post : + ((encStack (a :: bumpHead L)) {{C}}> (((encRight0 R ((d + 1) :: R_act)).cons 0).cons 0)) + [target]⊢⁺ + (⟨some D, ⟨0, encStack ((a + 1) :: bumpHead L), encRight0 R ((d + 1) :: R_act)⟩⟩ : + Cfg (Fin 2) (Fin 6)) := by + execute 1 + rw [Nat.add_comm 1 a] + exact h_post.to_star + +/-- `cfg` reaches (in `≥ 1` steps) a stack configuration or a halting configuration. -/ +private abbrev Closes (cfg : Cfg (Fin 2) (Fin 6)) : Prop := + ∃ cfg', (cfg [target]⊢⁺ cfg') ∧ (IsInStackSystem1 cfg' ∨ (step target cfg').isNone) + +private theorem Closes_step {c₁ c₂ : Cfg (Fin 2) (Fin 6)} (h₁ : c₁ [target]⊢⁺ c₂) + (h₂ : Closes c₂) : Closes c₁ := by + rcases h₂ with ⟨cfg', h_rest, h_end⟩ + exact ⟨cfg', h₁.trans h_rest, h_end⟩ + +/-- An inner `C₀` sweep across a right stack of positive digits re-enters the main system. -/ +private theorem c0_sweep_pos_to_D (R R_pos L : List ℕ) : + Closes (cfg_C0 R L (List.map (· + 1) R_pos)) := by + induction R_pos generalizing L with + | nil => exact ⟨cfg_D (bumpHead L) R, rule_C0_nil R L, Or.inl ⟨.D, bumpHead L, R, rfl⟩⟩ + | cons d R_pos' ih => + exact Closes_step (rule_C0_succ_cons R L (List.map (· + 1) R_pos') d) (ih (d :: bumpHead L)) + +/-- Peeling the head digit `a + 1` of an inner `D₀` configuration either closes or returns to an +inner `D00₀` configuration with a smaller second digit bound. -/ +private theorem d0_peel_gen (R : List ℕ) (a : ℕ) : + ∀ (b₀ : ℕ) (L'' : List ℕ) (d : ℕ) (R_pos : List ℕ), + Closes (cfg_D0 R ((a + 1) :: (b₀ + 1) :: L'') (d :: List.map (· + 1) R_pos)) ∨ + (∃ b₁ d₁, b₁ ≤ b₀ + a / 2 ∧ + (cfg_D0 R ((a + 1) :: (b₀ + 1) :: L'') (d :: List.map (· + 1) R_pos)) [target]⊢⁺ + (cfg_D00_0 R ((b₁ + 2) :: L'') (List.map (· + 1) (d₁ :: R_pos)))) := by + induction a using Nat.strong_induction_on with + | h a ih => + intro b₀ L'' d R_pos + rcases a with _ | _ | a' + · refine Or.inr ⟨b₀, d, by omega, ?_⟩ + simpa [bumpHead] using rule_D0_one_cons R ((b₀ + 1) :: L'') (List.map (· + 1) R_pos) d + · refine Or.inl (Closes_step ?_ (c0_sweep_pos_to_D R R_pos ((d + 3) :: (b₀ + 2) :: L''))) + simpa [bumpHead] using rule_D0_two_cons R ((b₀ + 1) :: L'') (List.map (· + 1) R_pos) d + · have h_step : + (cfg_D0 R ((a' + 2 + 1) :: (b₀ + 1) :: L'') (d :: List.map (· + 1) R_pos)) [target]⊢⁺ + (cfg_D0 R ((a' + 1) :: (b₀ + 2) :: L'') ((d + 1) :: List.map (· + 1) R_pos)) := by + simpa [bumpHead] using + rule_D0_ge3_cons R ((b₀ + 1) :: L'') (List.map (· + 1) R_pos) a' d + rcases ih a' (by omega) (b₀ + 1) L'' (d + 1) R_pos with h_close | ⟨b₁, d₁, hb₁, h_rest⟩ + · exact Or.inl (Closes_step h_step h_close) + · exact Or.inr ⟨b₁, d₁, by omega, h_step.trans h_rest⟩ + +/-- Every inner `D00₀` configuration with a single left digit `a + 2` closes. -/ +private theorem d00_single_closed (R : List ℕ) (a : ℕ) : + ∀ (R_pos : List ℕ), Closes (cfg_D00_0 R [a + 2] (List.map (· + 1) R_pos)) := by + induction a using Nat.strong_induction_on with + | h a ih => + intro R_pos + rcases a with _ | _ | _ | a' + · refine Closes_step ?_ (c0_sweep_pos_to_D R R_pos [2, 0]) + simpa [bumpHead] using rule_D00_0_two R [] (List.map (· + 1) R_pos) + · have h1 : (cfg_D00_0 R [3] (List.map (· + 1) R_pos)) [target]⊢⁺ + (cfg_D0 R [1, 0] (0 :: List.map (· + 1) R_pos)) := by + simpa [bumpHead] using rule_D00_0_ge3 R [] (List.map (· + 1) R_pos) 0 + have h2 : (cfg_D0 R [1, 0] (0 :: List.map (· + 1) R_pos)) [target]⊢⁺ + (cfg_D00_0 R [1] (1 :: List.map (· + 1) R_pos)) := by + simpa [bumpHead] using rule_D0_one_cons R [0] (List.map (· + 1) R_pos) 0 + obtain ⟨h3, hnone⟩ := rule_D00_0_one_nil_halt R (1 :: List.map (· + 1) R_pos) + exact ⟨_, (h1.trans h2).trans h3, Or.inr hnone⟩ + · have h1 : (cfg_D00_0 R [4] (List.map (· + 1) R_pos)) [target]⊢⁺ + (cfg_D0 R [2, 0] (0 :: List.map (· + 1) R_pos)) := by + simpa [bumpHead] using rule_D00_0_ge3 R [] (List.map (· + 1) R_pos) 1 + have h2 : (cfg_D0 R [2, 0] (0 :: List.map (· + 1) R_pos)) [target]⊢⁺ + (cfg_C0 R [3, 1] (List.map (· + 1) R_pos)) := by + simpa [bumpHead] using rule_D0_two_cons R [0] (List.map (· + 1) R_pos) 0 + exact Closes_step (h1.trans h2) (c0_sweep_pos_to_D R R_pos [3, 1]) + · have h1 : (cfg_D00_0 R [a' + 3 + 2] (List.map (· + 1) R_pos)) [target]⊢⁺ + (cfg_D0 R ((a' + 3) :: [0]) (0 :: List.map (· + 1) R_pos)) := by + simpa [bumpHead] using rule_D00_0_ge3 R [] (List.map (· + 1) R_pos) (a' + 2) + have h2 : (cfg_D0 R ((a' + 3) :: [0]) (0 :: List.map (· + 1) R_pos)) [target]⊢⁺ + (cfg_D0 R ((a' + 1) :: [1]) (1 :: List.map (· + 1) R_pos)) := by + simpa [bumpHead] using rule_D0_ge3_cons R [0] (List.map (· + 1) R_pos) a' 0 + rcases d0_peel_gen R a' 0 [] 1 R_pos with h_close | ⟨b₁, d₁, hb₁, h_rest⟩ + · exact Closes_step (h1.trans h2) h_close + · exact Closes_step ((h1.trans h2).trans h_rest) (ih b₁ (by omega) (d₁ :: R_pos)) + +/-- Every inner `D00₀` configuration with head left digit `a + 2` closes. -/ +private theorem d00_list_closed (R L_tail : List ℕ) : + ∀ (a : ℕ) (R_pos : List ℕ), + Closes (cfg_D00_0 R ((a + 2) :: L_tail) (List.map (· + 1) R_pos)) := by + induction L_tail with + | nil => + intro a R_pos + exact d00_single_closed R a R_pos + | cons b L'' ih => + intro a R_pos + rcases a with _ | a' + · refine Closes_step ?_ (c0_sweep_pos_to_D R R_pos (2 :: (b + 1) :: L'')) + simpa [bumpHead] using rule_D00_0_two R (b :: L'') (List.map (· + 1) R_pos) + · have h1 : (cfg_D00_0 R ((a' + 1 + 2) :: b :: L'') (List.map (· + 1) R_pos)) [target]⊢⁺ + (cfg_D0 R ((a' + 1) :: (b + 1) :: L'') (0 :: List.map (· + 1) R_pos)) := by + simpa [bumpHead] using rule_D00_0_ge3 R (b :: L'') (List.map (· + 1) R_pos) a' + rcases d0_peel_gen R a' b L'' 0 R_pos with h_close | ⟨b₁, d₁, _, h_rest⟩ + · exact Closes_step h1 h_close + · exact Closes_step (h1.trans h_rest) (ih b₁ (d₁ :: R_pos)) + +private theorem rule_C_zero_zero_cons (L R : List ℕ) : + Closes (cfg_C L (0 :: 0 :: R)) := by + refine Closes_step (rule_C_zero_zero_to_D00_0 L R) ?_ + cases L with + | nil => + obtain ⟨hstep, hnone⟩ := rule_D00_0_one_nil_halt R [] + exact ⟨_, hstep, Or.inr hnone⟩ + | cons a L_tail => + exact d00_list_closed R L_tail a [] + +/-! ## Initial Reachability and Stack Reduction Closure -/ + +private theorem init_to_cfg_D : + (init []) [target]⊢⁺ (cfg_D [2] []) := by + unfold cfg_D + rw [encStack_cons 2 [], encStack_nil] + simp only [list_pow_succ, list_pow_zero, List.cons_append, List.nil_append] + execute 5 + +private theorem init_reaches_nontrivial : + (init []) [target]⊢⁺ evalStackCfg1 .D [1, 1] [0] := + init_to_cfg_D + |>.trans (rule_D_two_nil []) + |>.trans (rule_C_nil [2, 0]) + |>.trans (rule_D_ge3 [0] [] 0) + +private theorem stack_system_closed (cfg : Cfg (Fin 2) (Fin 6)) (h : IsInStackSystem1 cfg) : + ∃ cfg', (cfg [target]⊢⁺ cfg') ∧ + (IsInStackSystem1 cfg' ∨ (step target cfg').isNone) := by + rcases h with ⟨m, L, R, rfl⟩ + cases m with + | C => + cases R with + | nil => + exact ⟨cfg_D (bumpHead L) [], rule_C_nil L, Or.inl ⟨.D, bumpHead L, [], rfl⟩⟩ + | cons d R' => + rcases d with _ | d + · cases R' with + | nil => + exact ⟨cfg_C (1 :: bumpHead L) [], rule_C_zero_nil L, + Or.inl ⟨.C, 1 :: bumpHead L, [], rfl⟩⟩ + | cons e R'' => + rcases e with _ | e + · exact rule_C_zero_zero_cons L R'' + · exact ⟨cfg_D00 (bumpHead (bumpHead L)) (e :: R''), rule_C_zero_succ_cons L R'' e, + Or.inl ⟨.D00, bumpHead (bumpHead L), e :: R'', rfl⟩⟩ + · exact ⟨cfg_C (d :: bumpHead L) R', rule_C_succ_cons L R' d, + Or.inl ⟨.C, d :: bumpHead L, R', rfl⟩⟩ + | D => + cases L with + | nil => + cases R with + | nil => + exact ⟨cfg_C [0, 0] [], rule_D_nil_nil, Or.inl ⟨.C, [0, 0], [], rfl⟩⟩ + | cons d R' => + exact ⟨cfg_C ((d + 1) :: [0]) R', rule_D_nil_cons R' d, + Or.inl ⟨.C, (d + 1) :: [0], R', rfl⟩⟩ + | cons a L' => + rcases a with _ | _ | _ | a + · obtain ⟨hstep, hnone⟩ := rule_D_zero L' R + exact ⟨cfg_Halt_D L' R, hstep, Or.inr hnone⟩ + · exact ⟨cfg_D00 (bumpHead L') (bumpHead R), rule_D_one L' R, + Or.inl ⟨.D00, bumpHead L', bumpHead R, rfl⟩⟩ + · cases R with + | nil => + exact ⟨cfg_C (2 :: bumpHead L') [], rule_D_two_nil L', + Or.inl ⟨.C, 2 :: bumpHead L', [], rfl⟩⟩ + | cons d R' => + exact ⟨cfg_C ((d + 3) :: bumpHead L') R', rule_D_two_cons L' R' d, + Or.inl ⟨.C, (d + 3) :: bumpHead L', R', rfl⟩⟩ + · exact ⟨cfg_D ((a + 1) :: bumpHead L') (bumpHead R), rule_D_ge3 L' R a, + Or.inl ⟨.D, (a + 1) :: bumpHead L', bumpHead R, rfl⟩⟩ + | D00 => + cases L with + | nil => + exact ⟨cfg_C [0, 0] R, rule_D00_nil R, Or.inl ⟨.C, [0, 0], R, rfl⟩⟩ + | cons a L' => + rcases a with _ | _ | _ | a + · obtain ⟨hstep, hnone⟩ := rule_D00_zero L' R + exact ⟨cfg_Halt_D00 L' R, hstep, Or.inr hnone⟩ + · exact ⟨cfg_D00 (bumpHead L') (0 :: R), rule_D00_one L' R, + Or.inl ⟨.D00, bumpHead L', 0 :: R, rfl⟩⟩ + · exact ⟨cfg_C (2 :: bumpHead L') R, rule_D00_two L' R, + Or.inl ⟨.C, 2 :: bumpHead L', R, rfl⟩⟩ + · exact ⟨cfg_D ((a + 1) :: bumpHead L') (0 :: R), rule_D00_ge3 L' R a, + Or.inl ⟨.D, (a + 1) :: bumpHead L', 0 :: R, rfl⟩⟩ + +private theorem encStack_head (a : ℕ) (s : List ℕ) : (encStack (a :: s)).head = 1 := by + simp [encStack, list_pow_succ] + +private theorem encStack_not_surjective : + ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ s : List ℕ, encStack s ≠ t := by + refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ + intro s h + rcases s with _ | ⟨_ | a, rest⟩ + · have h1 := congrArg ListBlank.head h + simp [encStack] at h1 + · rcases rest with _ | ⟨b, s'⟩ + · have h1 := congrArg (fun x => x.tail.tail.tail.head) h + simp [encStack, list_pow_succ, list_pow_zero] at h1 + · have h1 := congrArg (fun x => x.tail.tail.head) h + simp [encStack, list_pow_succ, list_pow_zero] at h1 + · have h1 := congrArg (fun x => x.tail.head) h + simp [encStack, list_pow_succ] at h1 + +private theorem block_encoding : + ∃ strideL offsetL sepL strideR offsetR sepR : ℕ, + strideL > 0 ∧ offsetL > 0 ∧ sepL > 0 ∧ + strideR > 0 ∧ offsetR > 0 ∧ sepR > 0 ∧ + (∀ a L, encStack (a :: L) = + ListBlank.append (([1] : List (Fin 2)) ^ (strideL * a + offsetL)) + (ListBlank.append (([0] : List (Fin 2)) ^ sepL) (encStack L))) ∧ + (∀ d R, encStack (d :: R) = + ListBlank.append (([1] : List (Fin 2)) ^ (strideR * d + offsetR)) + (ListBlank.append (([0] : List (Fin 2)) ^ sepR) (encStack R))) := by + refine ⟨1, 1, 1, 1, 1, 1, + by decide, by decide, by decide, by decide, by decide, by decide, ?_, ?_⟩ + · intro a L + simp [encStack] + · intro d R + simp [encStack] + +private theorem modes_bounded : + ∃ modes : List StackMode, modes.length ≤ 6 ∧ ∀ m : StackMode, m ∈ modes := by + refine ⟨[.C, .D, .D00], by decide, ?_⟩ + intro m + cases m <;> simp + +private theorem valid_stack_modes : IsValidStackModes encStack encStack evalStackCfg1 := by + intro m + cases m with + | C => exact ⟨C, .id [], .id [], by decide, by decide, Or.inl (fun _ _ => rfl)⟩ + | D => exact ⟨D, .id [], .id [], by decide, by decide, Or.inl (fun _ _ => rfl)⟩ + | D00 => exact ⟨D, .id [], .id [0], by decide, by decide, Or.inl (fun _ _ => rfl)⟩ + +/-- `target` reduces to a closed 2nd-order digit-stack system (`HasStackReduction`). -/ +theorem has_stack_reduction : HasStackReduction target := + HasStackReduction.of_oneDigit target StackMode encStack encStack evalStackCfg1 IsInStackSystem1 + ⟨rfl, rfl, encStack_head, encStack_head, + encStack_not_surjective, encStack_not_surjective, + block_encoding, modes_bounded, valid_stack_modes, + fun _ => Iff.rfl, fun m L R => ⟨m, L, R, rfl⟩, + ⟨.D, [1, 1], [0], init_reaches_nontrivial, by decide, ⟨1, by decide, by decide⟩⟩, + Or.inl ⟨.D00, .D00, 1, (· + 1), (0 :: ·), + fun _ => Nat.le_succ _, fun z L R => rule_D00_one (z :: L) R⟩, + stack_system_closed⟩ + +end BusyBeaver.M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean b/BusyBeaver/BB6/Accelerations/M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean index cea3d822..c2f1338b 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean @@ -22,7 +22,7 @@ the states `C`, `D`, `E`, `F`, `B`, `A` of that machine, the two transition tabl machines run the same closed pair-stack system. The proof below is the mechanical relabelling of the proof in [`1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`](./M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean); -only the blank-tape entry lemma `init_reaches_nontrivial` is specific to this start state. +only the blank-tape entry theorem `init_reaches_nontrivial` is specific to this start state. ## Hardness diff --git a/BusyBeaver/BB6/Accelerations/README.md b/BusyBeaver/BB6/Accelerations/README.md index 274abdef..465066f7 100644 --- a/BusyBeaver/BB6/Accelerations/README.md +++ b/BusyBeaver/BB6/Accelerations/README.md @@ -1,11 +1,11 @@ # `BB(6)` Stacked, Odometer, and Transducer Accelerations (`BusyBeaver/BB6/Accelerations/`) -This directory contains formal Lean 4 specifications and kernel-verified reductions for 29 `BB(6)` (6-state, 2-symbol) holdout Turing machines whose blank-tape dynamics evolve over unbounded digit stacks, mixed-radix odometers, or bidirectional finite-state word transducers rather than fixed-dimension counter tuples: +This directory contains formal Lean 4 specifications and kernel-verified reductions for 35 `BB(6)` (6-state, 2-symbol) holdout Turing machines whose blank-tape dynamics evolve over unbounded digit stacks, mixed-radix odometers, or bidirectional finite-state word transducers rather than fixed-dimension counter tuples: -1. **9 Community-Documented `bbchallenge` Wiki Machines** formalized under the three structural reduction predicates defined in [`BusyBeaver/Defs.lean`](../../Defs.lean)—`HasStackReduction` (6 machines), `HasOdometerReduction` (2 machines: Beaver Math Olympiad Problems 10 and 11), and `HasTransducerReduction` (1 machine: *Bell eats counter*). +1. **15 Structural Stack, Odometer, and Transducer Reductions** formalized under the three structural reduction predicates defined in [`BusyBeaver/Defs.lean`](../../Defs.lean)—`HasStackReduction` (12 machines: 9 `bbchallenge` Wiki machines and 3 Halving Tower holdouts), `HasOdometerReduction` (2 machines: Beaver Math Olympiad Problems 10 and 11), and `HasTransducerReduction` (1 machine: *Bell eats counter*). 2. **20 Open `BB(6)` Acceleration Problems** certified via `IsValidAcceleration` and `IsHalt target ↔ CollatzHalts next start` (with [`1RB1LD_0RC0LF_1LD1RE_0LA0RB_0RD1RB_0LD---`](./M_1RB1LD_0RC0LF_1LD1RE_0LA0RB_0RD1RB_0LDHHH.lean) additionally proved under `HasOdometerReduction`). Each open problem states a self-contained initial state $s_0$ (`start`) and accelerated transition map $T$ (`next`) over finite sequences and non-negative integers: the corresponding Turing machine halts from the blank tape if and only if iterating $T$ from $s_0$ eventually reaches $\mathrm{Halt}$ (`none`). For **13** of the 20 machines, we additionally prove a **higher-level Poincaré / epoch acceleration** $(s_{0,\mathrm{HL}}, T_{\mathrm{HL}})$ (`HighLevelState`, `highLevelStart`, `highLevelEncode`, `highLevelNext`, `is_valid_highLevel_acceleration`, `isHalt_iff_highLevel_acceleration`, `acceleration_iff_highLevel_acceleration`) that eliminates an entire stack, mixed-radix odometer, or auxiliary mode by restricting to a canonical return section or contracting full multi-bounce epochs. -> **Hardness.** The Collatz-like stacked cryptids among these machines (`#391`, `#129`, `#660`/`#680`, `#549`, `#80`, `#33`, `#85`) are classified, with heuristic hazards and the resolved case `#72`, in [`../Hardness.lean`](../Hardness.lean) (`BusyBeaver.BB6.Hardness`). +> **Hardness & Formal Evidence.** The Collatz-like stacked cryptids among these machines (`#391`, `#129`, `#660`/`#659`/`#209`/`#680`/`#480`, `#549`/`#80`, `#33`, `#85`/`#285`/`#490`/`#500`) are classified, with heuristic hazards and the resolved case `#72`, in [`../Hardness.lean`](../Hardness.lean) (`BusyBeaver.BB6.Hardness`), and kernel-checked live-hazard witnesses and halting residue classes for the accelerated problems are proved in [`../HardnessEvidence.lean`](../HardnessEvidence.lean) (`BusyBeaver.HardnessEvidence`). ## Structural Reduction Predicates ([`BusyBeaver/Defs.lean`](../../Defs.lean)) @@ -15,9 +15,9 @@ This directory contains formal Lean 4 specifications and kernel-verified reducti | `HasOdometerReduction M` | Closed mixed-radix odometer stack and bit-stream system (`evalOdomR` / `evalOdomL`) with non-trivial odometer stack reachability (`stk.length ≥ 2`, `cap stk ≥ 1`), certified decrement (`cap (dec stk) = cap stk - 1`), zero-capacity drain (`drain`), reflection, and unconditional `ReachesPlus` closure from `init []`. | | `HasTransducerReduction M` | Closed bidirectional macro-word transducer (`IsValidTransducerModes`, `iterTransducerMacro`) over strict-sub-Kraft block alphabets (`kraftSum`) with a halting-verified multi-token exit gate, certified left-to-right and right-to-left unbounded sweeps, and `ReachesPlus` closure from `init []`. | -## Formalized `bbchallenge` Wiki Machines (9 Machines) +## Structural Stack, Odometer, and Transducer Machines (15 Machines) -| Machine (`bbchallenge` RLE) | Family | Proved Properties | Wiki Page | Lean 4 Proof | +| Machine (`bbchallenge` RLE) | Family | Proved Properties | Wiki / Notes | Lean 4 Proof | | :--- | :--- | :--- | :--- | :--- | | `1RB1LA_1RC0RF_1RD---_0LE1RB_---0LA_1LD1RF` | Stacked | `HasStackReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB1LA_1RC0RF_1RD---_0LE1RB_---0LA_1LD1RF) | [`M_1RB1LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean`](./M_1RB1LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean) | | `1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_---0LB` | Stacked | `HasStackReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_---0LB) | [`M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean`](./M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean) | @@ -28,6 +28,9 @@ This directory contains formal Lean 4 specifications and kernel-verified reducti | `1RB1RA_1LC0RC_---0LD_0LE0RF_1RE0RA_0LF1LB` | Stacked | `HasStackReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB1RA_1LC0RC_---0LD_0LE0RF_1RE0RA_0LF1LB) | [`M_1RB1RA_1LC0RC_HHH0LD_0LE0RF_1RE0RA_0LF1LB.lean`](./M_1RB1RA_1LC0RC_HHH0LD_0LE0RF_1RE0RA_0LF1LB.lean) | | `1RB0RE_0RC---_1LD1LE_1LE1LD_1RF0LC_1RA1RF` | Stacked | `HasStackReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB0RE_0RC---_1LD1LE_1LE1LD_1RF0LC_1RA1RF) | [`M_1RB0RE_0RCHHH_1LD1LE_1LE1LD_1RF0LC_1RA1RF.lean`](./M_1RB0RE_0RCHHH_1LD1LE_1LE1LD_1RF0LC_1RA1RF.lean) | | `1RB---_0RC1RD_1LA0LA_1LE0RB_1LF1LE_1LC0LD` | Stacked | `HasStackReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB---_0RC1RD_1LA0LA_1LE0RB_1LF1LE_1LC0LD) | [`M_1RBHHH_0RC1RD_1LA0LA_1LE0RB_1LF1LE_1LC0LD.lean`](./M_1RBHHH_0RC1RD_1LA0LA_1LE0RB_1LF1LE_1LC0LD.lean) | +| `1RB0LC_1LC0RE_1LD1LC_1LA1RD_---0RF_0LB0RD` | Stacked | `HasStackReduction` | — (Halving Tower family, E1 sibling of `1RB1RA_1RC1LB_1LD0RA_---0LE_1LC0LF_1RE0LB`) | [`M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.lean`](./M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.lean) | +| `1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RA---_1RB1LF` | Stacked | `HasStackReduction` | — (Halving Tower family; busycoq `Eqv_Select4_E3E4.v` merges `1RB---_0RC1RF_1RD0LD_1LA1LE_0RA0LB_1RE1LC` into this class) | [`M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.lean`](./M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.lean) | +| `1RB1RC_1LC0LE_1RD1RC_1LB0RA_---0LF_1RD1LF` | Stacked | `HasStackReduction` | — (Halving Tower family, E3 macro twin of `1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RA---_1RB1LF`) | [`M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.lean`](./M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.lean) | | `1RB0LB_0RC0LD_1LD1RE_0LA0RF_0RD1RF_0RC---` | Odometer | `HasOdometerReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB0LB_0RC0LD_1LD1RE_0LA0RF_0RD1RF_0RC---) ([BMO Problem 10](https://wiki.bbchallenge.org/wiki/Beaver_Math_Olympiad)) | [`M_1RB0LB_0RC0LD_1LD1RE_0LA0RF_0RD1RF_0RCHHH.lean`](./M_1RB0LB_0RC0LD_1LD1RE_0LA0RF_0RD1RF_0RCHHH.lean) | | `1RB0LD_0RC---_1LD0RF_0LE0RA_0RA1LF_0LA1LB` | Odometer | `HasOdometerReduction` | [Wiki](https://wiki.bbchallenge.org/wiki/1RB0LD_0LC0RE_1LA0RD_0RB0LC_1RC1RF_0LD---) ([BMO Problem 11](https://wiki.bbchallenge.org/wiki/Beaver_Math_Olympiad), macro-equivalent reflected holdout) | [`M_1RB0LD_0RCHHH_1LD0RF_0LE0RA_0RA1LF_0LA1LB.lean`](./M_1RB0LD_0RCHHH_1LD0RF_0LE0RA_0RA1LF_0LA1LB.lean) | | `1RB0LD_0RC---_0LD0RF_1LE1LD_0LA0RD_0RB1RA` | Transducer | `HasTransducerReduction` | [Wiki (`Bell_eats_counter`)](https://wiki.bbchallenge.org/wiki/Bell_eats_counter) (macro-equivalent holdout) | [`M_1RB0LD_0RCHHH_0LD0RF_1LE1LD_0LA0RD_0RB1RA.lean`](./M_1RB0LD_0RCHHH_0LD0RF_1LE1LD_0LA0RD_0RB1RA.lean) | @@ -79,7 +82,7 @@ and write $\beta_1^m$ for the $m$-fold iterate of $\beta_1$ (`bumpHead` in Lean) ## 1. Stacked Reductions -In a stacked reduction, both half-tapes organize into unbounded sequences $L, R \in \mathbb{N}^{\ast}$ of variable-length run blocks (such as $1^{a+1} 0^s$), so the machine's state space is an unbounded pair of integer stacks rather than a fixed-dimension tuple in $\mathbb{N}^d$. At each macro-step, the head performs modular arithmetic ($\bmod\ 2$, $\bmod\ 3$, or $\bmod\ 4$) on the active top counters adjacent to the head—incrementing stack tops or pushing fresh zero entries that increase stack depth—and periodically triggers a full-stack transfer sweep ($\tau$, $\sigma_D$, $\Delta$, $\tau_B$) that pours one stack onto the other in reverse order. This couples local Collatz-like residue branching at the head with arbitrarily deep historical memory stored across $L$ and $R$, while halting requires draining an entire stack down to $\varepsilon$ at a specific head residue. Six `bbchallenge` Wiki holdouts in the table above satisfy `HasStackReduction`; the seven open problems below give explicit accelerated maps $(s_0, T)$ in this family. +In a stacked reduction, both half-tapes organize into unbounded sequences $L, R \in \mathbb{N}^{\ast}$ of variable-length run blocks (such as $1^{a+1} 0^s$), so the machine's state space is an unbounded pair of integer stacks rather than a fixed-dimension tuple in $\mathbb{N}^d$. At each macro-step, the head performs modular arithmetic ($\bmod\ 2$, $\bmod\ 3$, or $\bmod\ 4$) on the active top counters adjacent to the head—incrementing stack tops or pushing fresh zero entries that increase stack depth—and periodically triggers a full-stack transfer sweep ($\tau$, $\sigma_D$, $\Delta$, $\tau_B$) that pours one stack onto the other in reverse order. This couples local Collatz-like residue branching at the head with arbitrarily deep historical memory stored across $L$ and $R$, while halting requires draining an entire stack down to $\varepsilon$ at a specific head residue. Twelve holdouts in the table above satisfy `HasStackReduction` (nine `bbchallenge` Wiki holdouts and three Halving Tower holdouts); the seven open problems below give explicit accelerated maps $(s_0, T)$ in this family. ### 1.1 [`1RB0LD_1LC1RD_0LE1LA_0RB1RD_---0LF_1RA1LF`](./M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.lean) diff --git a/BusyBeaver/BB6/Hardness.lean b/BusyBeaver/BB6/Hardness.lean index 37243c80..6cc8928f 100644 --- a/BusyBeaver/BB6/Hardness.lean +++ b/BusyBeaver/BB6/Hardness.lean @@ -12,10 +12,13 @@ public import BusyBeaver.Basic This page records *why* the hardest BB(6) holdouts are hard, in the vocabulary the `bbchallenge` community uses for [Cryptids](https://wiki.bbchallenge.org/wiki/Cryptids) (Antihydra, Space Needle, Lucy's Moonlight), applied uniformly to the machines formalized in this repository. Every reduction -cited here is kernel-verified (`HasCollatzReduction`, `HasStackReduction`, `IsValidAcceleration`); -every hazard statement is a *heuristic* computed from the certified rules by exact accelerated -simulation and is marked as such. The full dossiers, with reproduction commands, accompany the arXiv -report; this page is the summary. +cited here is kernel-verified (`HasCollatzReduction`, `HasStackReduction`, `IsValidAcceleration`), +machine-level halting equivalences are proved in `BusyBeaver.BB6.Equivalences`, and kernel-checked +live-hazard witnesses (`highLevelNext s = none` / `next s = none`) and parametric halting residue +classes across all 26 core machines with explicit Collatz-like accelerations are proved in +`BusyBeaver.BB6.HardnessEvidence`; every hazard statement below is a *heuristic* computed from the +certified rules by exact accelerated simulation and is marked as such. The full dossiers, with +reproduction commands, accompany the arXiv report; this page is the summary. ## 1. The hardness vocabulary @@ -173,23 +176,25 @@ has not been re-measured with the method of this page, so they carry no verdict ($\Delta M = 0$), log-depth tower; shield partial (`ValidStack660` kills $C([],R)$). probviously non-halting. Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RA---_1RB1LF` - ([bbchallenge](https://bbchallenge.org/1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RA---_1RB1LF)) (ours): Problem - S4; Halving Tower (2-Adic Stack). Trigger POW; growth mass-conserving sandpile; shield partial. - probviously non-halting. Status: `is_stack_cryptid`; open (on the 2026-10-24 holdout list). + ([#659](./Accelerations/M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.lean)) (ours): Problem S4; + Halving Tower (2-Adic Stack). Trigger POW; growth mass-conserving sandpile; shield partial. + probviously non-halting. Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 + holdout list). * `1RB1RC_1LC0LE_1RD1RC_1LB0RA_---0LF_1RD1LF` - ([bbchallenge](https://bbchallenge.org/1RB1RC_1LC0LE_1RD1RC_1LB0RA_---0LF_1RD1LF)) (ours): Problem - S4; Halving Tower (2-Adic Stack). Trigger POW; growth mass-conserving sandpile; shield partial. - probviously non-halting. Status: `is_stack_cryptid`; open (on the 2026-10-24 holdout list). + ([#209](./Accelerations/M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.lean)) (ours): Problem S4; + Halving Tower (2-Adic Stack). Trigger POW; growth mass-conserving sandpile; shield partial. + probviously non-halting. Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 + holdout list). * `1RB1RA_1RC1LB_1LD0RA_---0LE_1LC0LF_1RE0LB` ([#680](./Accelerations/M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.lean)) (ours): Problem S4; Halving Tower (2-Adic Stack). Trigger POW; growth mass-conserving sandpile; shield partial (`ValidStack680` kills $C([],R)$; strict digit positivity at `mode_C`). probviously non-halting. Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB0LC_1LC0RE_1LD1LC_1LA1RD_---0RF_0LB0RD` - ([bbchallenge](https://bbchallenge.org/1RB0LC_1LC0RE_1LD1LC_1LA1RD_---0RF_0LB0RD)) (ours): S4 - sibling; Halving Tower (2-Adic Stack). Trigger POW; growth mass-conserving sandpile; shield - partial (strict digit positivity blocks the sole $d=0$ halt). probviously non-halting. Status: - `is_stack_cryptid`; open (on the 2026-10-24 holdout list). + ([#480](./Accelerations/M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.lean)) (ours): S4 sibling; + Halving Tower (2-Adic Stack). Trigger POW; growth mass-conserving sandpile; shield partial (strict + digit positivity blocks the sole $d=0$ halt). probviously non-halting. Status: `is_stack_cryptid`; + `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB1LA_1RC0RF_1RD---_0LE1RB_---0LA_1LD1RF` ([#549](./Accelerations/M_1RB1LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean)) (wiki): Problem S5; Halving Tower (2-Adic Stack). Trigger POW (Mersenne bottom rung $2^k-1$); growth —; shield partial diff --git a/BusyBeaver/BB6/HardnessEvidence.lean b/BusyBeaver/BB6/HardnessEvidence.lean new file mode 100644 index 00000000..b416bd0d --- /dev/null +++ b/BusyBeaver/BB6/HardnessEvidence.lean @@ -0,0 +1,711 @@ +/- +Copyright (c) 2026 Google LLC. All rights reserved. +Released under Apache 2.0 license as described in the file LICENSE. +-/ +module + +public import BusyBeaver.Basic +public import BusyBeaver.BB6.Accelerations.M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF +public import BusyBeaver.BB6.Accelerations.M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA +public import BusyBeaver.BB6.Accelerations.M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA +public import BusyBeaver.BB6.Accelerations.M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB +public import BusyBeaver.BB6.Accelerations.M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD +public import BusyBeaver.BB6.Accelerations.M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA +public import BusyBeaver.BB6.M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA +public import BusyBeaver.BB6.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA +public import BusyBeaver.BB6.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC +public import BusyBeaver.BB6.M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE +public import BusyBeaver.BB6.M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA +public import BusyBeaver.BB6.M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA +public import BusyBeaver.BB6.M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD +public import BusyBeaver.BB6.M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC +public import BusyBeaver.BB6.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA +public import BusyBeaver.BB6.M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD +public import BusyBeaver.BB6.M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE +public import BusyBeaver.BB6.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA +public import BusyBeaver.BB6.M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE +public import BusyBeaver.BB6.M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE +public import BusyBeaver.BB6.M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD +public import BusyBeaver.BB6.M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE +public import BusyBeaver.BB6.M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE +public import BusyBeaver.BB6.M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE +public import BusyBeaver.BB6.M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD +public import BusyBeaver.BB6.M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB + +/-! +# Formal Hardness Evidence for `BB(6)` Accelerated Machines (`BusyBeaver.BB6.HardnessEvidence`) + +Kernel-checked theorems certifying that the halting transitions discussed in +`BusyBeaver.BB6.Hardness` are **live** and **arithmetically structured** on the certified +accelerated state spaces (`State` / `HighLevelState`) of the 26 `BB(6)` machines in this +repository that expose an explicit Collatz-like map `next` or `highLevelNext`: + +1. **Live hazard witnesses** (`halting_state_witness`): an explicit accelerated configuration `s` + with `highLevelNext s = none` (or `next s = none`). By `IsValidAcceleration.step_none`, every + such witness corresponds to a concrete Turing machine configuration `highLevelEncode s` (or + `encode s`) that reaches the undefined transition in a positive number of raw steps (`⊢⁺`). +2. **Parametric halting residue classes** (`halting_residue_class`): infinite arithmetic, + divisibility, or power-of-two families of accelerated configurations that halt in one (or + finitely many) accelerated steps, certifying the exact exit gates (`MOD`, `EQ`, `DIV`, `POW`) + classified in `BusyBeaver.BB6.Hardness`. + +These theorems characterize the preimage of `none` under the certified accelerated maps; they do +not decide whether the forward orbit from `start` / `highLevelStart` enters that preimage. +-/ + +@[expose] public section + +namespace BusyBeaver.HardnessEvidence + +/-! ## Problems 1–5 (Named Community Cryptids) -/ + +namespace M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA + +open BusyBeaver.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA + +/-- Live hazard witness for `1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LF---_0RA1LA`: `S6 2` halts in one +accelerated step. -/ +theorem halting_state_witness : next (.S6 2) = none := + rfl + +/-- Second halting witness on `S6`: `S6 17` halts in one accelerated step. -/ +theorem halting_state_witness_17 : next (.S6 17) = none := + rfl + +/-- Third halting witness on `S6`: `S6 25` halts in one accelerated step. -/ +theorem halting_state_witness_25 : next (.S6 25) = none := + rfl + +/-- Remainder-`3 mod 5` halting family for `next_HubTail_r_3`. -/ +theorem halting_residue_class (a k : ℕ) : next_HubTail_r_3 a (5 * k + 3) = none := by + induction k generalizing a with + | zero => rfl + | succ k ih => + rw [show 5 * (k + 1) + 3 = (5 * k + 3) + 5 by omega, next_HubTail_r_3] + exact ih (a + 31) + +end M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA + +namespace M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE + +open BusyBeaver.M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE + +/-- Live hazard witness for `1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_---0RE`: `P_1 1 2` halts in one +high-level step. -/ +theorem halting_state_witness : highLevelNext (.P_1 1 2) = none := by + simp [highLevelNext] + +/-- Odd-`a` halting family at `b = 2`: `P_1 (2k + 1) 2` halts for all `k`. -/ +theorem halting_residue_class (k : ℕ) : highLevelNext (.P_1 (2 * k + 1) 2) = none := by + have h : (2 * k + 1) % 2 = 1 := by omega + simp [highLevelNext, h] + +/-- Exact characterization of one-step halting at `b = 2`: `P_1 a 2` halts iff `a` is odd. -/ +theorem halting_residue_class_iff (a : ℕ) : highLevelNext (.P_1 a 2) = none ↔ a % 2 = 1 := by + simp only [highLevelNext] + split_ifs <;> simp <;> omega + +end M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE + +namespace M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE + +open BusyBeaver.M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE + +/-- Live hazard witness for `1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_---0RE`: `D false 0 2` halts in +one high-level step. -/ +theorem halting_state_witness : highLevelNext (.D false 0 2) = none := by + simp [highLevelNext] + +/-- Exact-equality halting family (`p = false`): `D false a (2a + 2)` halts for all `a`. -/ +theorem halting_residue_class (a : ℕ) : highLevelNext (.D false a (2 * a + 2)) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +/-- Exact-equality halting family (`p = true`): `D true a (2a + 2)` halts for all `a`. -/ +theorem halting_residue_class_true (a : ℕ) : highLevelNext (.D true a (2 * a + 2)) = none := by + simp only [highLevelNext] + rw [drainJ1] + split_ifs <;> first | rfl | omega + +/-- Next-rung halting family (`p = true`): `D true a (6a + 16)` halts in one `drainJ1` peel. -/ +theorem halting_residue_class_two_step (a : ℕ) : + highLevelNext (.D true a (6 * a + 16)) = none := by + simp only [highLevelNext] + rw [drainJ1] + split_ifs <;> first | rfl | omega | skip + rw [drainJ1] + split_ifs <;> first | rfl | omega + +end M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE + +namespace M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE + +open BusyBeaver.M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE + +/-- Live hazard witness for `1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_---0RE`: `D 0 2` halts in one +high-level step. -/ +theorem halting_state_witness : highLevelNext (.D 0 2) = none := by + simp [highLevelNext] + +/-- First-rung halting family: `D a (2a + 2)` halts for all `a`. -/ +theorem halting_residue_class (a : ℕ) : highLevelNext (.D a (2 * a + 2)) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +/-- Second-rung halting family: `D a (6a + 12)` halts via `evalK2` for all `a`. -/ +theorem halting_residue_class_two_step (a : ℕ) : highLevelNext (.D a (6 * a + 12)) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega | skip + rw [evalK2] + split_ifs <;> first | rfl | omega + +end M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE + +namespace M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA + +open BusyBeaver.M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA + +/-- Live hazard witness for `1RB0LF_1RC1RA_0RD0RB_1LE---_0LA1LE_1RD1LA`: `J 1 1` halts in one +high-level step. -/ +theorem halting_state_witness : highLevelNext (.J 1 1) = none := by + simp [highLevelNext] + +/-- Exact-equality halting family (`n = 2m - 1`): `J (k + 1) (2k + 1)` halts for all `k`. -/ +theorem halting_residue_class (k : ℕ) : highLevelNext (.J (k + 1) (2 * k + 1)) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +end M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA + +namespace M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA + +open BusyBeaver.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA + +/-- Live hazard witness for `1RB1LF_0RC1RD_1LA1LD_1LE0RA_---1LC_0LA1LA`: `C 1 8` halts in one +high-level step. -/ +theorem halting_state_witness : highLevelNext (.C 1 8) = none := by + simp [highLevelNext] + +/-- Even-`b` halting family (`b = 2a + 8`): `C (a + 1) (2a + 8)` halts for all `a`. -/ +theorem halting_residue_class (a : ℕ) : highLevelNext (.C (a + 1) (2 * a + 8)) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +/-- Second even-`b` halting family (`b = 2a + 10`): `C (a + 1) (2a + 10)` halts for all `a`. -/ +theorem halting_residue_class' (a : ℕ) : highLevelNext (.C (a + 1) (2 * a + 10)) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +/-- Odd-`b` halting family (`a = j + 3`): `C (j + 3) (2j + 1)` halts for all `j`. -/ +theorem halting_residue_class_odd (j : ℕ) : highLevelNext (.C (j + 3) (2 * j + 1)) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +/-- Second odd-`b` halting family (`a = j + 4`): `C (j + 4) (2j + 1)` halts for all `j`. -/ +theorem halting_residue_class_odd' (j : ℕ) : highLevelNext (.C (j + 4) (2 * j + 1)) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +end M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA + +namespace M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE + +open BusyBeaver.M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE + +/-- Live hazard witness for `1RB1RB_1LC0RE_---1LD_0RA1LB_1RA1LF_0LE1LE`: `C 0 0 false` halts in +one high-level step. -/ +theorem halting_state_witness : highLevelNext (.C 0 0 false) = none := by + simp [highLevelNext] + +/-- Diagonal halting family (`b = a`): `C a a p` halts for all `a` and `p`. -/ +theorem halting_residue_class (a : ℕ) (p : Bool) : highLevelNext (.C a a p) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +/-- Superdiagonal halting family (`b = a + 1`): `C a (a + 1) p` halts for all `a` and `p`. -/ +theorem halting_residue_class' (a : ℕ) (p : Bool) : highLevelNext (.C a (a + 1) p) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +end M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE + +/-! ## Shielded Exponential Cascades -/ + +namespace M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA + +open BusyBeaver.M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA + +/-- Live hazard witness for `1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_---1RA`: `E false 1 1` halts in +one high-level step. -/ +theorem halting_state_witness : highLevelNext (.E false 1 1) = none := by + simp [highLevelNext] + +/-- Odd-`c` halting family at `d = 1`: `E p (2j + 1) 1` halts for all `p` and `j`. -/ +theorem halting_residue_class (p : Bool) (j : ℕ) : highLevelNext (.E p (2 * j + 1) 1) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +end M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA + +namespace M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE + +open BusyBeaver.M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE + +/-- Live hazard witness for `1RB0LF_1LC0LD_1RD1LB_---1RE_0RA1RE_1LA0LE`: `A 4 0` halts in one +high-level step. -/ +theorem halting_state_witness : highLevelNext (.A 4 0) = none := by + simp [highLevelNext] + +/-- Exact-equality halting family: `A (2 * (c / 2) + 4) c` halts for all `c`. -/ +theorem halting_residue_class (c : ℕ) : highLevelNext (.A (2 * (c / 2) + 4) c) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +/-- Exact characterization: `A b c` halts in one high-level step iff `b = 2 * (c / 2) + 4`. -/ +theorem halting_residue_class_iff (b c : ℕ) : + highLevelNext (.A b c) = none ↔ b = 2 * (c / 2) + 4 := by + simp only [highLevelNext] + split_ifs <;> simp <;> omega + +end M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE + +namespace M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC + +open BusyBeaver.M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC + +/-- Live hazard witness for `1RB0RE_1LC0RA_1RF0RD_---1LE_0LB1LE_1LE1RC`: `A 4 0` halts in one +high-level step. -/ +theorem halting_state_witness : highLevelNext (.A 4 0) = none := by + simp [highLevelNext] + +/-- Exact-equality halting family: `A (2 * (c / 2) + 4) c` halts for all `c`. -/ +theorem halting_residue_class (c : ℕ) : highLevelNext (.A (2 * (c / 2) + 4) c) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +/-- Exact characterization: `A b c` halts in one high-level step iff `b = 2 * (c / 2) + 4`. -/ +theorem halting_residue_class_iff (b c : ℕ) : + highLevelNext (.A b c) = none ↔ b = 2 * (c / 2) + 4 := by + simp only [highLevelNext] + split_ifs <;> simp <;> omega + +end M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC + +namespace M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE + +open BusyBeaver.M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE + +/-- Live hazard witness on `C0` for `1RB1LF_1RC1RF_0LD1RE_---1LC_0RB1RE_1LA0LE`: `C0 0 1` halts in +one high-level step. -/ +theorem halting_state_witness : highLevelNext (.C0 0 1) = none := by + simp [highLevelNext] + +/-- Live hazard witness on `C1`: `C1 0 0 0` halts in one high-level step. -/ +theorem halting_state_witness_C1 : highLevelNext (.C1 0 0 0) = none := by + simp [highLevelNext] + +private theorem evalM_halt (k u : ℕ) : evalM k u (2 * k + 4) 0 false = none := by + induction k generalizing u with + | zero => simp [evalM, evalS, evalR] + | succ k ih => + rw [evalM] + simp only [Nat.add_eq_zero_iff, one_ne_zero, and_false, ↓reduceIte, Nat.add_sub_cancel] + have hb1 : ¬ (2 * (k + 1) + 4 = 1) := by omega + have hsub : 2 * (k + 1) + 4 - 2 = 2 * k + 4 := by omega + simp only [hb1, ↓reduceIte, hsub] + exact ih (u + 2) + +/-- Linear equality halting family on `C0`: `C0 (k + 1) (2k + 3)` halts for all `k`. -/ +theorem halting_residue_class (k : ℕ) : highLevelNext (.C0 (k + 1) (2 * k + 3)) = none := by + rcases k with _ | k + · simp [highLevelNext, evalCPos, evalS, evalR] + · simp only [highLevelNext, evalCPos] + have ha0 : ¬ (k + 1 + 1 = 0) := by omega + have ha1 : ¬ (k + 1 + 1 = 1) := by omega + have hb0 : ¬ (2 * (k + 1) + 3 = 0) := by omega + have h1 : k + 1 + 1 - 2 = k := by omega + have h2 : 2 * (k + 1) + 3 - 1 = 2 * k + 4 := by omega + simp only [ha0, ha1, hb0, ↓reduceIte, h1, h2] + exact evalM_halt k 0 + +end M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE + +namespace M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD + +open BusyBeaver.M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD + +/-- Live hazard witness for `1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_---1RD`: `C 0 2` halts in one +high-level step. -/ +theorem halting_state_witness : highLevelNext (.C 0 2) = none := by + simp [highLevelNext] + +/-- Exact-equality halting family (`c = b + 2`): `C b (b + 2)` halts for all `b`. -/ +theorem halting_residue_class (b : ℕ) : highLevelNext (.C b (b + 2)) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +end M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD + +namespace M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD + +open BusyBeaver.M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD + +/-- Live hazard witness for `1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_---0RD`: `S false 2 1` halts in +one high-level step. -/ +theorem halting_state_witness : highLevelNext (.S false 2 1) = none := by + simp [highLevelNext] + +/-- Linear halting family (`hat = false`): `S false (3q + 2) (q + 1)` halts for all `q`. -/ +theorem halting_residue_class (q : ℕ) : highLevelNext (.S false (3 * q + 2) (q + 1)) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +/-- Linear halting family (`hat = true`): `S true (3q + 2) (q + 2)` halts for all `q`. -/ +theorem halting_residue_class_hat (q : ℕ) : + highLevelNext (.S true (3 * q + 2) (q + 2)) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +end M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD + +namespace M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB + +open BusyBeaver.M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB + +/-- Live hazard witness for `1RB1RF_1LC---_1LE1RD_1RA0RC_0LF0LA_0LD0RB`: `P 0 2` halts in one +high-level step. -/ +theorem halting_state_witness : highLevelNext (.P 0 2) = none := by + simp [highLevelNext] + +/-- Exact-equality halting family (`c = b + 2`): `P b (b + 2)` halts for all `b`. -/ +theorem halting_residue_class (b : ℕ) : highLevelNext (.P b (b + 2)) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +/-- Exact characterization: `P b c` halts in one high-level step iff `c = b + 2`. -/ +theorem halting_residue_class_iff (b c : ℕ) : highLevelNext (.P b c) = none ↔ c = b + 2 := by + simp only [highLevelNext] + split_ifs <;> simp <;> omega + +end M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB + +namespace M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA + +open BusyBeaver.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA + +/-- Live hazard witness for `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---0LA`: `D 1 0` halts in one +high-level step. -/ +theorem halting_state_witness : highLevelNext (.D 1 0) = none := by + simp [highLevelNext] + +/-- Odd-`a` halting cone (`a % 2 = 1` and `a < d + 3`): `D a d` halts in one high-level step. -/ +theorem halting_residue_class (a d : ℕ) (ha : a % 2 = 1) (had : a < d + 3) : + highLevelNext (.D a d) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +/-- Diagonal odd halting family: `D (2k + 1) (2k + 1)` halts for all `k`. -/ +theorem halting_residue_class_diag (k : ℕ) : highLevelNext (.D (2 * k + 1) (2 * k + 1)) = none := + halting_residue_class _ _ (by omega) (by omega) + +end M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA + +namespace M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC + +open BusyBeaver.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC + +/-- Live hazard witness for `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---1LC`: `D 1 0` halts in one +high-level step. -/ +theorem halting_state_witness : highLevelNext (.D 1 0) = none := by + simp [highLevelNext] + +/-- Odd-`a` halting cone (`a % 2 = 1` and `a < d + 3`): `D a d` halts in one high-level step. -/ +theorem halting_residue_class (a d : ℕ) (ha : a % 2 = 1) (had : a < d + 3) : + highLevelNext (.D a d) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +/-- Diagonal odd halting family: `D (2k + 1) (2k + 1)` halts for all `k`. -/ +theorem halting_residue_class_diag (k : ℕ) : highLevelNext (.D (2 * k + 1) (2 * k + 1)) = none := + halting_residue_class _ _ (by omega) (by omega) + +end M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC + +namespace M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE + +open BusyBeaver.M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE + +/-- Live hazard witness for `1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_---0RE`: `E 0 2` halts in one +high-level step. -/ +theorem halting_state_witness : highLevelNext (.E 0 2) = none := by + simp [highLevelNext] + +/-- Exact-equality halting family (`d = 2b + 2`): `E b (2b + 2)` halts for all `b`. -/ +theorem halting_residue_class (b : ℕ) : highLevelNext (.E b (2 * b + 2)) = none := by + simp only [highLevelNext] + split_ifs <;> first | rfl | omega + +/-- Exact characterization: `E b d` halts in one high-level step iff `d = 2b + 2`. -/ +theorem halting_residue_class_iff (b d : ℕ) : highLevelNext (.E b d) = none ↔ d = 2 * b + 2 := by + simp only [highLevelNext] + split_ifs <;> simp <;> omega + +end M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE + +namespace M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD + +open BusyBeaver.M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD + +/-- Live hazard witness for `1RB1RF_1LC1LF_0RE1LD_0LB1LD_---1RC_1RA0RD`: `E 0 0 6` halts in one +accelerated step. -/ +theorem halting_state_witness : next (.E 0 0 6) = none := by + simp [next] + +/-- One-step halting family (`b = 0, c = 6`): `E a 0 6` halts for all `a`. -/ +theorem halting_residue_class (a : ℕ) : next (.E a 0 6) = none := by + simp [next] + +/-- Multi-step halting cone (`c = 2b + 6`): `E a b (2b + 6)` halts in `b + 1` steps for all `a, b`. +-/ +theorem halting_residue_class_multi_step (a b : ℕ) : CollatzHalts next (.E a b (2 * b + 6)) := by + induction b generalizing a with + | zero => exact ⟨1, by simp [next]⟩ + | succ b ih => + obtain ⟨n, hn⟩ := ih (a + 2) + refine ⟨n + 1, ?_⟩ + rw [Function.iterate_succ_apply] + have h : next (.E a (b + 1) (2 * (b + 1) + 6)) = some (.E (a + 2) b (2 * b + 6)) := by + rw [show 2 * (b + 1) + 6 = (2 * b + 6) + 2 by omega] + cases b <;> rfl + simpa [h] using hn + +end M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD + +namespace M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD + +open BusyBeaver.M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD + +/-- Live hazard witness for `1RB1RC_1LC1LC_1RE0LD_1LB1RF_---1RA_0RD1RD`: `C 0 0` halts in one +high-level step. -/ +theorem halting_state_witness : highLevelNext (.C 0 0) = none := by + simp [highLevelNext] + +/-- One-step halting family (`b = 0`): `C a 0` halts for all `a`. -/ +theorem halting_residue_class (a : ℕ) : highLevelNext (.C a 0) = none := by + simp [highLevelNext] + +/-- Pre-halting family (`b = a / 2 + 4`): `C a (a / 2 + 4)` steps directly into the `C _ 0` halting +family. -/ +theorem halting_residue_class_two_step (a : ℕ) : + highLevelNext (.C a (a / 2 + 4)) = some (.C (6 * (a / 2 + 2) + 3 * (a % 2) + 5) 0) := by + rw [show a / 2 + 4 = (a / 2 + 2) + 2 by omega] + simp only [highLevelNext] + split_ifs <;> first | omega | (congr 2; omega) + +end M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD + +namespace M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA + +open BusyBeaver.M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA + +/-- Live hazard witness for `1RB0LF_1LC1RA_0RE0RD_---1LE_1LF1RC_1LC1LA`: `C 0 1` halts in one +high-level step. -/ +theorem halting_state_witness : highLevelNext (.C 0 1) = none := by + simp [highLevelNext] + +/-- One-step halting family (`b = 1`): `C a 1` halts for all `a`. -/ +theorem halting_residue_class (a : ℕ) : highLevelNext (.C a 1) = none := by + simp [highLevelNext] + +/-- Pre-halting family (`b = 2a + 3`): `C a (2a + 3)` steps directly to `C (2a + 2) 1`, which halts +on the next high-level step. -/ +theorem halting_residue_class_two_step (a : ℕ) : + highLevelNext (.C a (2 * a + 3)) = some (.C (2 * a + 2) 1) := by + rw [show 2 * a + 3 = (2 * a + 1) + 2 by omega] + simp only [highLevelNext] + split_ifs <;> first | omega | (congr 2; omega) + +end M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA + +/-! ## True Stacked Cryptids and Odometer Calibration (`BusyBeaver/BB6/Accelerations/`) -/ + +namespace M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA + +open BusyBeaver.M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA + +/-- Live hazard witness for `1RB1LA_1LA0RC_1RD1RC_1LE0RC_---0LF_1LE0LA` (Problem S2): `D 0 0 []` +halts in one high-level epoch. -/ +theorem halting_state_witness : highLevelNext (.D 0 0 []) = none := by + rw [highLevelNext, runE] + simp + +private theorem runE_pow2_sub2 (m r₀ : ℕ) (R' : List ℕ) : + runE (2 ^ (m + 1) - 2) [] r₀ R' = none := by + induction m generalizing r₀ R' with + | zero => + rw [runE] + simp + | succ m ih => + rw [runE] + have hpow : 2 ^ (m + 1 + 1) ≥ 4 := by + have : 2 ^ m ≥ 1 := Nat.one_le_pow m 2 (by decide) + omega + have ha0 : ¬ (2 ^ (m + 1 + 1) - 2 = 0) := by omega + have ha1 : ¬ (2 ^ (m + 1 + 1) - 2 = 1) := by omega + have hmod : ¬ ((2 ^ (m + 1 + 1) - 2 - 2) % 2 = 1) := by omega + have hdiv : (2 ^ (m + 1 + 1) - 2 - 2) / 2 = 2 ^ (m + 1) - 2 := by omega + simp only [↓reduceIte, ha0, ha1, hmod, hdiv] + exact ih (2 ^ (m + 1) - 2 + 1) (r₀ :: R') + +/-- Power-of-two bottom funnel (`x + 2 = 2^{m+1}`): `D 0 (2^{m+1} - 2) []` halts in one high-level +epoch for all `m`. -/ +theorem halting_residue_class (m : ℕ) : + highLevelNext (.D 0 (2 ^ (m + 1) - 2) []) = none := by + simp only [highLevelNext, Nat.zero_mod, Nat.zero_div, Nat.add_zero] + exact runE_pow2_sub2 m 0 [] + +end M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA + +namespace M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA + +open BusyBeaver.M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA + +/-- Live hazard witness for `1RB0RB_1RC0LE_1LD1LA_---0LC_1RF1LE_1RA0RA` (Problem S3): +`F 0 0 [] 1 []` halts in one high-level step. -/ +theorem halting_state_witness : highLevelNext (.F 0 0 [] 1 []) = none := by + simp [highLevelNext, exitC] + +/-- Depth-two gate halting family: `F 0 0 L 1 []` halts in one high-level step for every left stack +`L`. -/ +theorem halting_residue_class (L : List ℕ) : highLevelNext (.F 0 0 L 1 []) = none := by + cases L <;> simp [highLevelNext, exitC] + +end M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA + +namespace M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF + +open BusyBeaver.M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF + +/-- Live hazard witness for `1RB0LD_1LC1RD_0LE1LA_0RB1RD_---0LF_1RA1LF` (Problem S4): `C 0 []` +halts in one high-level epoch. -/ +theorem halting_state_witness : highLevelNext (.C 0 []) = none := by + rw [highLevelNext, stepEpoch] + simp + +private theorem stepEpoch_pow2_sub1 (m : ℕ) (R : List ℕ) : + stepEpoch (2 ^ m - 1) [] R = none := by + induction m generalizing R with + | zero => + rw [stepEpoch] + simp + | succ m ih => + rw [stepEpoch] + by_cases hm : m = 0 + · subst hm + simp + · have hpow : 2 ^ m ≥ 2 := by + obtain ⟨k, rfl⟩ := Nat.exists_eq_add_of_le (Nat.one_le_iff_ne_zero.mpr hm) + have : 2 ^ k ≥ 1 := Nat.one_le_pow k 2 (by decide) + rw [Nat.pow_add] + omega + have hle : ¬ (2 ^ (m + 1) - 1 ≤ 1) := by + rw [Nat.pow_succ] + omega + have hmod : ¬ ((2 ^ (m + 1) - 1) % 2 = 0) := by + rw [Nat.pow_succ] + omega + have hdiv : (2 ^ (m + 1) - 1) / 2 = 2 ^ m - 1 := by + rw [Nat.pow_succ] + omega + simp only [↓reduceIte, hle, hmod, hdiv] + exact ih (0 :: Stack.bumpHeadBy (2 ^ m - 1) R) + +/-- Power-of-two bottom-exposure halting family: `C (2^m - 1) []` halts in one high-level epoch for +all `m`. -/ +theorem halting_residue_class (m : ℕ) : highLevelNext (.C (2 ^ m - 1) []) = none := + stepEpoch_pow2_sub1 m [0] + +end M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF + +namespace M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB + +open BusyBeaver.M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB + +/-- Live hazard witness for `1RB1RA_1RC1LB_1LD0RA_---0LE_1LC0LF_1RE0LB` (Problem S4): `C 0 []` +halts in one high-level epoch. -/ +theorem halting_state_witness : highLevelNext (.C 0 []) = none := by + rw [highLevelNext, runEpoch] + simp + +private theorem runEpoch_pow2_sub2 (m : ℕ) (R : List ℕ) : + runEpoch (2 ^ (m + 1) - 2) [] R = none := by + induction m generalizing R with + | zero => + rw [runEpoch] + simp + | succ m ih => + rw [runEpoch] + have hpow : 2 ^ (m + 1) ≥ 2 := by + have : 2 ^ m ≥ 1 := Nat.one_le_pow m 2 (by decide) + rw [Nat.pow_succ] + omega + have ha0 : ¬ (2 ^ (m + 1 + 1) - 2 = 0) := by + rw [Nat.pow_succ] + omega + have hmod : ¬ ((2 ^ (m + 1 + 1) - 2 - 1) % 2 = 0) := by + rw [Nat.pow_succ] + omega + have hdiv : (2 ^ (m + 1 + 1) - 2 - 1) / 2 = 2 ^ (m + 1) - 2 := by + rw [Nat.pow_succ] + omega + simp only [↓reduceIte, ha0, hmod, hdiv] + exact ih (0 :: (R.headD 0 + (2 ^ (m + 1) - 2)) :: R.tail) + +/-- Power-of-two bottom-exposure halting family: `C (2^{m+1} - 2) []` halts in one high-level epoch +for all `m`. -/ +theorem halting_residue_class (m : ℕ) : highLevelNext (.C (2 ^ (m + 1) - 2) []) = none := + runEpoch_pow2_sub2 m [] + +end M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB + +namespace M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA + +open BusyBeaver.M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA + +/-- Live hazard witness for `1RB---_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA` (Problem S5): +`CR 1 0 [] 1 []` halts in one accelerated step. -/ +theorem halting_state_witness : next (.CR 1 0 [] 1 []) = none := by + simp [next] + +/-- Halting family (`a = 1, r ≥ 1`): `CR 1 b L (d + 1) R` halts in one step for all `b, L, d, R`. +-/ +theorem halting_residue_class (b : ℕ) (L : List ℕ) (d : ℕ) (R : List ℕ) : + next (.CR 1 b L (d + 1) R) = none := by + simp [next] + +/-- Pre-halting family (`r = 1`): `CR (a + 2) b L 1 R` steps directly into the `CR 1 ...` halting +family whenever `bump1 R` has positive head. -/ +theorem halting_residue_class_two_step (a b : ℕ) (L R : List ℕ) : + next (.CR (a + 2) b L 1 R) = some (.CR 1 (a + 1) (b :: L) (bump1 R).1 (bump1 R).2) := by + simp [next] + +end M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA + +namespace M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD + +open BusyBeaver.M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD + +/-- Live hazard witness for the base-4 odometer `1RB1RF_1LC1LF_---1LD_1LE0RA_1RE1LB_1RD0LD`: +`EL 0 [] 0 []` halts in one high-level step. -/ +theorem halting_state_witness : highLevelNext (.EL 0 [] 0 []) = none := by + simp [highLevelNext] + +/-- Residue-`0 mod 4` halting family at empty left stack: `EL (4k) [] d R` halts for all `k, d, R`. +-/ +theorem halting_residue_class (k d : ℕ) (R : List ℕ) : + highLevelNext (.EL (4 * k) [] d R) = none := by + simp [highLevelNext] + +end M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD + +end BusyBeaver.HardnessEvidence diff --git a/BusyBeaver/BB6/README.md b/BusyBeaver/BB6/README.md index 9f698fb7..6a15ccbd 100644 --- a/BusyBeaver/BB6/README.md +++ b/BusyBeaver/BB6/README.md @@ -1,12 +1,12 @@ # Busy Beaver 6 Holdouts (`BusyBeaver/BB6/`) -This directory contains formal Lean 4 specifications and kernel-verified Collatz-like reductions for 53 Busy Beaver 6 (`BB(6)`, 6-state 2-symbol) holdout Turing machines, together with 29 stacked, odometer, and transducer holdouts (9 `bbchallenge` Wiki machines formalized under `HasStackReduction`, `HasOdometerReduction`, and `HasTransducerReduction`, plus 20 open acceleration problems under `IsValidAcceleration`, 13 with higher-level accelerations) in **[`BusyBeaver/BB6/Accelerations/`](./Accelerations/README.md)** (83 `BB(6)` machines total, including the nonhalting A6 certificate below). Each reduction module in `BusyBeaver/BB6/` below exposes both **Level A** (`ps`, `is_closed_pattern_set`, `has_collatz_reduction`) and **Level B** (`State`, `start`, `encode`, `next`, `is_valid_acceleration`, `isHalt_iff_acceleration`), and 33 modules (all 20 novel discovery modules together with 13 multi-family or multi-counter wiki/busycoq holdouts) additionally expose a higher-level Collatz-like acceleration (`HighLevelState`, `highLevelStart`, `highLevelEncode`, `highLevelNext`, `is_valid_highLevel_acceleration`, `isHalt_iff_highLevel_acceleration`, `acceleration_iff_highLevel_acceleration`); see [`BusyBeaver/README.md`](../README.md) for definitions of the behavioral predicates and [`BusyBeaver/BB6/Accelerations/README.md`](./Accelerations/README.md) for the stacked, odometer, and transducer formalizations and open problem statements. +This directory contains formal Lean 4 specifications and kernel-verified Collatz-like reductions for 54 Busy Beaver 6 (`BB(6)`, 6-state 2-symbol) holdout Turing machines (the [A6 nonhalting certificate](../artifacts/a6/README.md) and 53 closed-pattern holdouts), together with 35 stacked, odometer, and transducer holdouts (15 machines formalized under `HasStackReduction`, `HasOdometerReduction`, and `HasTransducerReduction`—12 `bbchallenge` Wiki machines and 3 Halving Tower holdouts—plus 20 open acceleration problems under `IsValidAcceleration`, 13 with higher-level accelerations) in **[`BusyBeaver/BB6/Accelerations/`](./Accelerations/README.md)** (89 `BB(6)` holdouts total). Each machine module in `BusyBeaver/BB6/` below exposes both **Level A** (`ps`, `is_closed_pattern_set`, `has_collatz_reduction`) and **Level B** (`State`, `start`, `encode`, `next`, `is_valid_acceleration`, `isHalt_iff_acceleration`), and 33 modules (all 20 novel discovery modules together with 13 multi-family or multi-counter wiki/busycoq holdouts) additionally expose a higher-level Collatz-like acceleration (`HighLevelState`, `highLevelStart`, `highLevelEncode`, `highLevelNext`, `is_valid_highLevel_acceleration`, `isHalt_iff_highLevel_acceleration`, `acceleration_iff_highLevel_acceleration`); see [`BusyBeaver/README.md`](../README.md) for definitions of the behavioral predicates and [`BusyBeaver/BB6/Accelerations/README.md`](./Accelerations/README.md) for the stacked, odometer, and transducer formalizations and open problem statements. The A6 module exports a closed blank-tape `IsNotHalt` proof using a checked entry certificate and a universal return family; it has a separate [proof guide](../../artifacts/a6/README.md). -> **Hardness.** Why the hardest of these holdouts are hard (halting trigger, growth regime, shields, heuristic hazards, and the calibration case `#72` that the community proved halting) is recorded in [`Hardness.lean`](./Hardness.lean) (rendered on the docs site as `BusyBeaver.BB6.Hardness`); each machine in that core also carries a `## Hardness` section in its module docstring. +> **Hardness & Formal Evidence.** Why the hardest of these holdouts are hard (halting trigger, growth regime, shields, heuristic hazards, and the calibration case `#72` that the community proved halting) is recorded in [`Hardness.lean`](./Hardness.lean) (rendered on the docs site as `BusyBeaver.BB6.Hardness`); each machine in that core also carries a `## Hardness` section in its module docstring. Kernel-checked live-hazard witnesses (`highLevelNext s = none` / `next s = none`) and parametric halting residue classes across 26 hard-core `BB(6)` holdouts with explicit Collatz-like accelerations (the 24 hard-core holdouts carrying `IsValidAcceleration`, plus `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC` and `1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD`) are proved in [`HardnessEvidence.lean`](./HardnessEvidence.lean) (`BusyBeaver.BB6.HardnessEvidence`). > **Equivalences.** Machine-level halting equivalences between holdouts whose certified high-level accelerations coincide are collected in [`Equivalences.lean`](./Equivalences.lean) (`BusyBeaver.BB6.Equivalences`): `isHalt_HHH1LC_iff_HHH0LA` proves that `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---1LC` halts if and only if `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---0LA` does (the pair merged by busycoq `Eqv_RegularPairs.v`). diff --git a/BusyBeaver/README.md b/BusyBeaver/README.md index 8c51b425..0ef6dee3 100644 --- a/BusyBeaver/README.md +++ b/BusyBeaver/README.md @@ -2,7 +2,7 @@ This library contains formal Lean 4 specifications and kernel-verified behavioral proofs for Busy Beaver 6 (`BB(6)`) and Busy Beaver (3, 3) (`BB(3, 3)`) holdouts, connected to `ConjectureMachines.Machine` via [`BusyBeaver/Bridge.lean`](./Bridge.lean): -- **[`BusyBeaver/BB6/`](./BB6/README.md)** — 83 `BB(6)` (6-state, 2-symbol) holdout Turing machines: the [A6 nonhalting certificate](../artifacts/a6/README.md), 53 holdouts with certified closed `TapePatternSet` invariants (`IsClosedPatternSet`, `HasCollatzReduction`) and Collatz-like accelerations (`IsValidAcceleration`), plus 29 stacked, odometer, and transducer holdouts (9 `bbchallenge` Wiki machines formalized under `HasStackReduction`, `HasOdometerReduction`, and `HasTransducerReduction`, and 20 open acceleration problems under `IsValidAcceleration`, 13 of which additionally carry higher-level Poincaré/contraction accelerations `highLevelNext`) in **[`BusyBeaver/BB6/Accelerations/`](./BB6/Accelerations/README.md)**. +- **[`BusyBeaver/BB6/`](./BB6/README.md)** — 89 `BB(6)` (6-state, 2-symbol) holdout Turing machines: 54 holdouts in `BB6/` (the [A6 nonhalting certificate](../artifacts/a6/README.md) and 53 holdouts with certified closed `TapePatternSet` invariants `IsClosedPatternSet`, `HasCollatzReduction` and Collatz-like accelerations `IsValidAcceleration`), plus 35 stacked, odometer, and transducer holdouts (15 machines formalized under `HasStackReduction`, `HasOdometerReduction`, and `HasTransducerReduction`—12 `bbchallenge` Wiki machines and 3 Halving Tower holdouts—and 20 open acceleration problems under `IsValidAcceleration`, 13 of which additionally carry higher-level Poincaré/contraction accelerations `highLevelNext`) in **[`BusyBeaver/BB6/Accelerations/`](./BB6/Accelerations/README.md)**, together with machine-level halting equivalences ([`Equivalences.lean`](./BB6/Equivalences.lean)), hardness classification ([`Hardness.lean`](./BB6/Hardness.lean)), and formal hardness evidence ([`HardnessEvidence.lean`](./BB6/HardnessEvidence.lean)). - **[`BusyBeaver/BB33/`](./BB33/README.md)** — All 6 remaining unsolved `BB(3, 3)` (3-state, 3-symbol) holdout Turing machines (4 equivalence classes: *Bigfoot* (holdout #829), the *Wily Coyote* pair (holdouts #531 & #532), the holdout #758 / #153 pair (probvious champion), and holdout #397), with certified Collatz-like (`HasCollatzReduction`) or stacked Collatz-like (`HasStackedCollatzReduction`) reductions and exact halting equivalences (`IsValidAcceleration`). ## Cryptids, Collatz-like, and Stacked Collatz Reductions @@ -68,7 +68,7 @@ theorem isNotHalt_toBB_iff_not_halts (M : ConjectureMachines.Machine states symb ## Formalized Machine Catalogs -- **[`BB(6)` Holdouts (`BusyBeaver/BB6/`)](./BB6/README.md)** — the [A6 nonhalting certificate](../artifacts/a6/README.md) and 53 closed-pattern 6-state 2-symbol holdouts (311 reduction theorems) and **[`BB(6)` Accelerations (`BusyBeaver/BB6/Accelerations/`)](./BB6/Accelerations/README.md)** — 29 stacked, odometer, and transducer holdouts (89 theorems: 9 `bbchallenge` Wiki reductions and 20 open acceleration problems, including 13 higher-level accelerations). +- **[`BB(6)` Holdouts (`BusyBeaver/BB6/`)](./BB6/README.md)** — 54 holdouts (the [A6 nonhalting certificate](../artifacts/a6/README.md) and 53 closed-pattern 6-state 2-symbol holdouts; 312 theorems), **[`BB(6)` Accelerations (`BusyBeaver/BB6/Accelerations/`)](./BB6/Accelerations/README.md)** — 35 stacked, odometer, and transducer holdouts (95 theorems: 15 structural reductions and 20 open acceleration problems, including 13 higher-level accelerations), **[`Equivalences.lean`](./BB6/Equivalences.lean)** (1 halting equivalence theorem), and **[`HardnessEvidence.lean`](./BB6/HardnessEvidence.lean)** (74 live-hazard witness and halting residue-class theorems across 26 `BB(6)` holdouts). - **[`BB(3, 3)` Holdouts (`BusyBeaver/BB33/`)](./BB33/README.md)** — 6 3-state 3-symbol holdouts (24 theorems). ## Building and Verifying diff --git a/BusyBeaverChallenge.lean b/BusyBeaverChallenge.lean index 6a844242..76cb9d95 100644 --- a/BusyBeaverChallenge.lean +++ b/BusyBeaverChallenge.lean @@ -6924,6 +6924,16 @@ abbrev target : Machine (Fin 2) (Fin 6) := theorem has_odometer_reduction : HasOdometerReduction target := by sorry end M_1RB0LB_0RC0LD_1LD1RE_0LA0RF_0RD1RF_0RCHHH +namespace M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD +def machine : ConjectureMachines.Machine 6 2 := + load_rle_machine% "1RB0LC_1LC0RE_1LD1LC_1LA1RD_---0RF_0LB0RD" + +abbrev target : Machine (Fin 2) (Fin 6) := + machine.toBB + +theorem has_stack_reduction : HasStackReduction target := by sorry +end M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD + namespace M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH def machine : ConjectureMachines.Machine 6 2 := load_rle_machine% "1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---" @@ -8251,6 +8261,16 @@ theorem is_valid_acceleration : IsValidAcceleration target start encode next := theorem isHalt_iff_acceleration : IsHalt target ↔ CollatzHalts next start := by sorry end M_1RB1LF_0RC0RB_0LD1RB_1LE0LB_0LA1LC_0LBHHH +namespace M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF +def machine : ConjectureMachines.Machine 6 2 := + load_rle_machine% "1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RA---_1RB1LF" + +abbrev target : Machine (Fin 2) (Fin 6) := + machine.toBB + +theorem has_stack_reduction : HasStackReduction target := by sorry +end M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF + namespace M_1RB1RA_1LC0RC_HHH0LD_0LE0RF_1RE0RA_0LF1LB def machine : ConjectureMachines.Machine 6 2 := load_rle_machine% "1RB1RA_1LC0RC_---0LD_0LE0RF_1RE0RA_0LF1LB" @@ -8354,6 +8374,16 @@ theorem acceleration_iff_highLevel_acceleration : CollatzHalts next start ↔ CollatzHalts highLevelNext highLevelStart := by sorry end M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB +namespace M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF +def machine : ConjectureMachines.Machine 6 2 := + load_rle_machine% "1RB1RC_1LC0LE_1RD1RC_1LB0RA_---0LF_1RD1LF" + +abbrev target : Machine (Fin 2) (Fin 6) := + machine.toBB + +theorem has_stack_reduction : HasStackReduction target := by sorry +end M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF + namespace M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH def machine : ConjectureMachines.Machine 6 2 := load_rle_machine% "1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---" @@ -9220,6 +9250,283 @@ theorem is_valid_acceleration : IsValidAcceleration target start encode next := theorem isHalt_iff_acceleration : IsHalt target ↔ CollatzHalts next start := by sorry end M_1RBHHH_1LC0RF_0RA0LD_1LE1LA_1RF0LF_0LC0RA +namespace HardnessEvidence +namespace M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA +open BusyBeaver.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA + +theorem halting_state_witness : next (.S6 2) = none := by sorry + +theorem halting_state_witness_17 : next (.S6 17) = none := by sorry + +theorem halting_state_witness_25 : next (.S6 25) = none := by sorry + +theorem halting_residue_class (a k : ℕ) : next_HubTail_r_3 a (5 * k + 3) = none := by sorry +end M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA + +namespace M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE +open BusyBeaver.M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE + +theorem halting_state_witness : highLevelNext (.P_1 1 2) = none := by sorry + +theorem halting_residue_class (k : ℕ) : highLevelNext (.P_1 (2 * k + 1) 2) = none := by sorry + +theorem halting_residue_class_iff (a : ℕ) : highLevelNext (.P_1 a 2) = none ↔ a % 2 = 1 := by sorry +end M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE + +namespace M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE +open BusyBeaver.M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE + +theorem halting_state_witness : highLevelNext (.D false 0 2) = none := by sorry + +theorem halting_residue_class (a : ℕ) : highLevelNext (.D false a (2 * a + 2)) = none := by sorry + +theorem halting_residue_class_true (a : ℕ) : highLevelNext (.D true a (2 * a + 2)) = none := + by sorry + +theorem halting_residue_class_two_step (a : ℕ) : + highLevelNext (.D true a (6 * a + 16)) = none := by sorry +end M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE + +namespace M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE +open BusyBeaver.M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE + +theorem halting_state_witness : highLevelNext (.D 0 2) = none := by sorry + +theorem halting_residue_class (a : ℕ) : highLevelNext (.D a (2 * a + 2)) = none := by sorry + +theorem halting_residue_class_two_step (a : ℕ) : highLevelNext (.D a (6 * a + 12)) = none := + by sorry +end M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE + +namespace M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA +open BusyBeaver.M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA + +theorem halting_state_witness : highLevelNext (.J 1 1) = none := by sorry + +theorem halting_residue_class (k : ℕ) : highLevelNext (.J (k + 1) (2 * k + 1)) = none := by sorry +end M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA + +namespace M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA +open BusyBeaver.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA + +theorem halting_state_witness : highLevelNext (.C 1 8) = none := by sorry + +theorem halting_residue_class (a : ℕ) : highLevelNext (.C (a + 1) (2 * a + 8)) = none := by sorry + +theorem halting_residue_class' (a : ℕ) : highLevelNext (.C (a + 1) (2 * a + 10)) = none := by sorry + +theorem halting_residue_class_odd (j : ℕ) : highLevelNext (.C (j + 3) (2 * j + 1)) = none := + by sorry + +theorem halting_residue_class_odd' (j : ℕ) : highLevelNext (.C (j + 4) (2 * j + 1)) = none := + by sorry +end M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA + +namespace M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE +open BusyBeaver.M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE + +theorem halting_state_witness : highLevelNext (.C 0 0 false) = none := by sorry + +theorem halting_residue_class (a : ℕ) (p : Bool) : highLevelNext (.C a a p) = none := by sorry + +theorem halting_residue_class' (a : ℕ) (p : Bool) : highLevelNext (.C a (a + 1) p) = none := + by sorry +end M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE + +namespace M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA +open BusyBeaver.M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA + +theorem halting_state_witness : highLevelNext (.E false 1 1) = none := by sorry + +theorem halting_residue_class (p : Bool) (j : ℕ) : highLevelNext (.E p (2 * j + 1) 1) = none := + by sorry +end M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA + +namespace M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE +open BusyBeaver.M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE + +theorem halting_state_witness : highLevelNext (.A 4 0) = none := by sorry + +theorem halting_residue_class (c : ℕ) : highLevelNext (.A (2 * (c / 2) + 4) c) = none := by sorry + +theorem halting_residue_class_iff (b c : ℕ) : + highLevelNext (.A b c) = none ↔ b = 2 * (c / 2) + 4 := by sorry +end M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE + +namespace M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC +open BusyBeaver.M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC + +theorem halting_state_witness : highLevelNext (.A 4 0) = none := by sorry + +theorem halting_residue_class (c : ℕ) : highLevelNext (.A (2 * (c / 2) + 4) c) = none := by sorry + +theorem halting_residue_class_iff (b c : ℕ) : + highLevelNext (.A b c) = none ↔ b = 2 * (c / 2) + 4 := by sorry +end M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC + +namespace M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE +open BusyBeaver.M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE + +theorem halting_state_witness : highLevelNext (.C0 0 1) = none := by sorry + +theorem halting_state_witness_C1 : highLevelNext (.C1 0 0 0) = none := by sorry + +theorem halting_residue_class (k : ℕ) : highLevelNext (.C0 (k + 1) (2 * k + 3)) = none := by sorry +end M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE + +namespace M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD +open BusyBeaver.M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD + +theorem halting_state_witness : highLevelNext (.C 0 2) = none := by sorry + +theorem halting_residue_class (b : ℕ) : highLevelNext (.C b (b + 2)) = none := by sorry +end M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD + +namespace M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD +open BusyBeaver.M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD + +theorem halting_state_witness : highLevelNext (.S false 2 1) = none := by sorry + +theorem halting_residue_class (q : ℕ) : highLevelNext (.S false (3 * q + 2) (q + 1)) = none := + by sorry + +theorem halting_residue_class_hat (q : ℕ) : + highLevelNext (.S true (3 * q + 2) (q + 2)) = none := by sorry +end M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD + +namespace M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB +open BusyBeaver.M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB + +theorem halting_state_witness : highLevelNext (.P 0 2) = none := by sorry + +theorem halting_residue_class (b : ℕ) : highLevelNext (.P b (b + 2)) = none := by sorry + +theorem halting_residue_class_iff (b c : ℕ) : highLevelNext (.P b c) = none ↔ c = b + 2 := by sorry +end M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB + +namespace M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA +open BusyBeaver.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA + +theorem halting_state_witness : highLevelNext (.D 1 0) = none := by sorry + +theorem halting_residue_class (a d : ℕ) (ha : a % 2 = 1) (had : a < d + 3) : + highLevelNext (.D a d) = none := by sorry + +theorem halting_residue_class_diag (k : ℕ) : highLevelNext (.D (2 * k + 1) (2 * k + 1)) = none := + by sorry +end M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA + +namespace M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC +open BusyBeaver.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC + +theorem halting_state_witness : highLevelNext (.D 1 0) = none := by sorry + +theorem halting_residue_class (a d : ℕ) (ha : a % 2 = 1) (had : a < d + 3) : + highLevelNext (.D a d) = none := by sorry + +theorem halting_residue_class_diag (k : ℕ) : highLevelNext (.D (2 * k + 1) (2 * k + 1)) = none := + by sorry +end M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC + +namespace M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE +open BusyBeaver.M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE + +theorem halting_state_witness : highLevelNext (.E 0 2) = none := by sorry + +theorem halting_residue_class (b : ℕ) : highLevelNext (.E b (2 * b + 2)) = none := by sorry + +theorem halting_residue_class_iff (b d : ℕ) : highLevelNext (.E b d) = none ↔ d = 2 * b + 2 := + by sorry +end M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE + +namespace M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD +open BusyBeaver.M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD + +theorem halting_state_witness : next (.E 0 0 6) = none := by sorry + +theorem halting_residue_class (a : ℕ) : next (.E a 0 6) = none := by sorry + +theorem halting_residue_class_multi_step (a b : ℕ) : CollatzHalts next (.E a b (2 * b + 6)) := + by sorry +end M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD + +namespace M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD +open BusyBeaver.M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD + +theorem halting_state_witness : highLevelNext (.C 0 0) = none := by sorry + +theorem halting_residue_class (a : ℕ) : highLevelNext (.C a 0) = none := by sorry + +theorem halting_residue_class_two_step (a : ℕ) : + highLevelNext (.C a (a / 2 + 4)) = some (.C (6 * (a / 2 + 2) + 3 * (a % 2) + 5) 0) := by sorry +end M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD + +namespace M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA +open BusyBeaver.M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA + +theorem halting_state_witness : highLevelNext (.C 0 1) = none := by sorry + +theorem halting_residue_class (a : ℕ) : highLevelNext (.C a 1) = none := by sorry + +theorem halting_residue_class_two_step (a : ℕ) : + highLevelNext (.C a (2 * a + 3)) = some (.C (2 * a + 2) 1) := by sorry +end M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA + +namespace M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA +open BusyBeaver.M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA + +theorem halting_state_witness : highLevelNext (.D 0 0 []) = none := by sorry + +theorem halting_residue_class (m : ℕ) : + highLevelNext (.D 0 (2 ^ (m + 1) - 2) []) = none := by sorry +end M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA + +namespace M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA +open BusyBeaver.M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA + +theorem halting_state_witness : highLevelNext (.F 0 0 [] 1 []) = none := by sorry + +theorem halting_residue_class (L : List ℕ) : highLevelNext (.F 0 0 L 1 []) = none := by sorry +end M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA + +namespace M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF +open BusyBeaver.M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF + +theorem halting_state_witness : highLevelNext (.C 0 []) = none := by sorry + +theorem halting_residue_class (m : ℕ) : highLevelNext (.C (2 ^ m - 1) []) = none := by sorry +end M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF + +namespace M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB +open BusyBeaver.M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB + +theorem halting_state_witness : highLevelNext (.C 0 []) = none := by sorry + +theorem halting_residue_class (m : ℕ) : highLevelNext (.C (2 ^ (m + 1) - 2) []) = none := by sorry +end M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB + +namespace M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA +open BusyBeaver.M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA + +theorem halting_state_witness : next (.CR 1 0 [] 1 []) = none := by sorry + +theorem halting_residue_class (b : ℕ) (L : List ℕ) (d : ℕ) (R : List ℕ) : + next (.CR 1 b L (d + 1) R) = none := by sorry + +theorem halting_residue_class_two_step (a b : ℕ) (L R : List ℕ) : + next (.CR (a + 2) b L 1 R) = some (.CR 1 (a + 1) (b :: L) (bump1 R).1 (bump1 R).2) := by sorry +end M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA + +namespace M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD +open BusyBeaver.M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD + +theorem halting_state_witness : highLevelNext (.EL 0 [] 0 []) = none := by sorry + +theorem halting_residue_class (k d : ℕ) (R : List ℕ) : + highLevelNext (.EL (4 * k) [] d R) = none := by sorry +end M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD +end HardnessEvidence + end BusyBeaver namespace BusyBeaver.M_1RB0LF_1RC0RA_1LD0RB_0LE0LC_0LA0LC_0LBHHH diff --git a/README.md b/README.md index 2b036fa7..4601cf9b 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ This repository contains two Lean 4 (`v4.35.0-rc4`) formalization libraries for | Library | Scope | Key Results | Documentation | | :--- | :--- | :--- | :--- | | [`Cryptids/`](Cryptids/) | `(Q, 2)` Turing machines for Goldbach, ZF consistency, and the Riemann Hypothesis | Certified state reductions (`25 → 21`, `393 → 380`, `120 → 104 → 95`) and end-to-end halting equivalences (`Halts M ↔ ¬ GoldbachConjecture`, `ZFInconsistent`, `¬ RiemannHypothesis`) | [`Cryptids/README.md`](Cryptids/README.md), [`Cryptids/Semantics/README.md`](Cryptids/Semantics/README.md) | -| [`BusyBeaver/`](BusyBeaver/) | `BB(6)` `(6, 2)` and `BB(3, 3)` `(3, 3)` holdout Turing machines (some are potential Cryptids, subject to community acceptance) | Shared execution semantics (`BusyBeaver/Defs.lean`), foundational lemmas (`BusyBeaver/Basic.lean`), RLE loader and `ConjectureMachines` bridge (`BusyBeaver/Bridge.lean`), and certified behavioral proofs in [`BusyBeaver/BB6/`](BusyBeaver/BB6/README.md) (53 machines) and [`BusyBeaver/BB33/`](BusyBeaver/BB33/README.md) (6 machines) | [`BusyBeaver/README.md`](BusyBeaver/README.md), [`BusyBeaver/BB6/README.md`](BusyBeaver/BB6/README.md), [`BusyBeaver/BB33/README.md`](BusyBeaver/BB33/README.md) | +| [`BusyBeaver/`](BusyBeaver/) | `BB(6)` `(6, 2)` and `BB(3, 3)` `(3, 3)` holdout Turing machines (some are potential Cryptids, subject to community acceptance) | Shared execution semantics (`BusyBeaver/Defs.lean`), foundational lemmas (`BusyBeaver/Basic.lean`), RLE loader and `ConjectureMachines` bridge (`BusyBeaver/Bridge.lean`), and certified behavioral proofs in [`BusyBeaver/BB6/`](BusyBeaver/BB6/README.md) (54 closed-pattern/reflective holdouts + 35 [`Accelerations/`](BusyBeaver/BB6/Accelerations/README.md), plus halting equivalences and hardness evidence) and [`BusyBeaver/BB33/`](BusyBeaver/BB33/README.md) (6 machines) | [`BusyBeaver/README.md`](BusyBeaver/README.md), [`BusyBeaver/BB6/README.md`](BusyBeaver/BB6/README.md), [`BusyBeaver/BB6/Accelerations/README.md`](BusyBeaver/BB6/Accelerations/README.md), [`BusyBeaver/BB33/README.md`](BusyBeaver/BB33/README.md) | All Lean 4 proofs are checked by the kernel without `sorry` and depend only on standard Lean axioms: - **Constructive (`["propext", "Quot.sound"]`, no `Classical.choice`):** All ZF machine-to-proof-search equivalences (`halts_zf393_iff_zfInconsistent`, `Zf380.Semantics.halts_candidate_iff_zfInconsistent`, `halts_zf432_iff_wadeZFInconsistent`), first-order Peano Arithmetic (`PAProvable`) consistency and $\Sigma_1^0$ standard-model adequacy (`not_paProvable_false`, `paHalts_holds_iff_halts`, `paZFInconsistent_holds_iff_zfInconsistent` in [`Cryptids/Semantics/PA/`](Cryptids/Semantics/PA/)), the direct simulation state reductions ([`Goldbach21.lean`](Cryptids/Goldbach21.lean), [`Zf380.lean`](Cryptids/Zf380.lean), [`Riemann104.lean`](Cryptids/Riemann104.lean)), and all four `candidate_fewer_states` theorems, audited in CI via [`comparator/constructive.json`](comparator/constructive.json). Because classical Lean (`ZFSet.{0}` in [`Soundness.lean`](Cryptids/Semantics/Zf/Soundness.lean)) proves `¬ ZFInconsistent`—so any non-halting machine would vacuously satisfy `Halts M ↔ ZFInconsistent` under `Classical.choice`—excluding `Classical.choice` blocks classical `Con(ZF)` shortcuts, while deeply embedded `PAProvable` provides a weak first-order metatheory strictly below `ZF` (see [Foundational Note on `Con(ZF)` and Constructive Equivalence](Cryptids/Semantics/README.md#foundational-note-conzf-in-lean-and-constructive-equivalence)). diff --git a/comparator/README.md b/comparator/README.md index e913838e..0099ce2a 100644 --- a/comparator/README.md +++ b/comparator/README.md @@ -19,13 +19,14 @@ using [`leanprover/comparator`](https://github.com/leanprover/comparator). acceleration semantics (`IsClosedPatternSet`, `HasCollatzReduction`, `IsClosedStackPatternSet`, `HasStackedCollatzReduction`, `HasStackReduction`, `HasOdometerReduction`, `HasTransducerReduction`, `IsValidAcceleration`, `CollatzHalts`, `IsHalt`, `IsNotHalt`), and - `load_rle_machine%` once, and states all 425 `BB(6)` and `BB(3, 3)` holdout theorems + `load_rle_machine%` once, and states all 506 `BB(6)` and `BB(3, 3)` holdout theorems (`is_closed_pattern_set` / `is_closed_stack_pattern_set`, `has_collatz_reduction` / `has_stacked_collatz_reduction`, `has_stack_reduction`, `has_odometer_reduction`, `has_transducer_reduction`, `is_valid_acceleration`, `isHalt_iff_acceleration`, `is_valid_highLevel_acceleration`, `isHalt_iff_highLevel_acceleration`, - `acceleration_iff_highLevel_acceleration`, and A6 `is_not_halt` across - the 89 machines) with `sorry`. + `acceleration_iff_highLevel_acceleration`, A6 `is_not_halt`, `isHalt_HHH1LC_iff_HHH0LA`, and the 74 + `HardnessEvidence` live-hazard witness and halting residue-class theorems across the 95 machines) + with `sorry`. Comparator exports both the challenge module (`Challenge` or `BusyBeaverChallenge`) and the solution module (`Cryptids` or `BusyBeaver`) via `leanexport`, verifying in a Bubblewrap sandbox @@ -59,7 +60,7 @@ that: | [`constructive.json`](./constructive.json) | `Challenge` | `Cryptids` | `propext`, `Quot.sound` | All 13 constructive theorems: all 3 ZF proof-search equivalences (`zf_393`, `zf_380`, `zf_432`), first-order `PA` consistency & $\Sigma_1^0$ adequacy (`not_paProvable_false`, `paHalts_holds_iff_halts`, `paZFInconsistent_holds_iff_zfInconsistent`), direct state reductions (`Goldbach21`, `Zf380`, `Riemann104`), and `Riemann95.candidate_fewer_states` | | [`all.json`](./all.json) | `Challenge` | `Cryptids` | `propext`, `Quot.sound`, `Classical.choice` | All 29 conjecture-checking state-reduction, equivalence, `PA` metatheory & internalized `ZF` provability, and semantics theorems | | [`pa_semantics.json`](./pa_semantics.json) | `Challenge` | `Cryptids.Semantics.PA` | `propext`, `Quot.sound`, `Classical.choice` | `not_paProvable_false`, `paHalts_holds_iff_halts`, `paZFInconsistent_holds_iff_zfInconsistent`, `paProvable_sound_nat`, `paProvable_halts_zf380_iff_zf393`, `paProvable_halts_zf393_iff_zfInconsistent`, `paProvable_halts_zf380_iff_zfInconsistent` | -| [`busy_beaver.json`](./busy_beaver.json) | `BusyBeaverChallenge` | `BusyBeaver` | `propext`, `Quot.sound`, `Classical.choice` | All 425 `BB(6)` and `BB(3, 3)` holdout theorems: Level A and Level B reductions (`is_closed_pattern_set`, `has_collatz_reduction`, `is_closed_stack_pattern_set`, `has_stacked_collatz_reduction`, `has_stack_reduction`, `has_odometer_reduction`, `has_transducer_reduction`, `is_valid_acceleration`, `isHalt_iff_acceleration`, `is_valid_highLevel_acceleration`, `isHalt_iff_highLevel_acceleration`, `acceleration_iff_highLevel_acceleration`) and A6 `is_not_halt` | +| [`busy_beaver.json`](./busy_beaver.json) | `BusyBeaverChallenge` | `BusyBeaver` | `propext`, `Quot.sound`, `Classical.choice` | All 506 `BB(6)` and `BB(3, 3)` holdout Level A, Level B, equivalence, A6 `is_not_halt`, and hardness-evidence theorems (`is_closed_pattern_set`, `has_collatz_reduction`, `is_closed_stack_pattern_set`, `has_stacked_collatz_reduction`, `has_stack_reduction`, `has_odometer_reduction`, `has_transducer_reduction`, `is_valid_acceleration`, `isHalt_iff_acceleration`, `is_valid_highLevel_acceleration`, `isHalt_iff_highLevel_acceleration`, `acceleration_iff_highLevel_acceleration`, `is_not_halt`, `isHalt_HHH1LC_iff_HHH0LA`, `HardnessEvidence.*`) | | [`a6.json`](./a6.json) | `BusyBeaverChallenge` | `BusyBeaver.BB6.M_1RB0LF_1RC0RA_1LD0RB_0LE0LC_0LA0LC_0LBHHH` | `propext`, `Quot.sound`, `Classical.choice` | A6 `is_not_halt` | | [`goldbach_21.json`](./goldbach_21.json) | `Challenge` | `Cryptids.Goldbach21` | `propext`, `Quot.sound` | `candidate_fewer_states`, `candidate_equivalent` | | [`goldbach_semantics.json`](./goldbach_semantics.json) | `Challenge` | `Cryptids.Semantics.Goldbach` | `propext`, `Quot.sound`, `Classical.choice` | `halts_reference_iff_not_goldbach`, `halts_candidate_iff_not_goldbach` | diff --git a/comparator/busy_beaver.json b/comparator/busy_beaver.json index 5e55ff0f..cce7dd77 100644 --- a/comparator/busy_beaver.json +++ b/comparator/busy_beaver.json @@ -430,7 +430,84 @@ "BusyBeaver.M_1RB0LF_1RC0RA_1LD0RB_0LE0LC_0LA0LC_0LBHHH.is_not_halt", "BusyBeaver.M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.has_stack_reduction", "BusyBeaver.M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.has_stack_reduction", - "BusyBeaver.M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.has_stack_reduction" + "BusyBeaver.M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.has_stack_reduction", + "BusyBeaver.M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.has_stack_reduction", + "BusyBeaver.M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.has_stack_reduction", + "BusyBeaver.M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.has_stack_reduction", + "BusyBeaver.HardnessEvidence.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.halting_state_witness_17", + "BusyBeaver.HardnessEvidence.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.halting_state_witness_25", + "BusyBeaver.HardnessEvidence.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.halting_residue_class_iff", + "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.halting_residue_class_true", + "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.halting_residue_class_two_step", + "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.halting_residue_class_two_step", + "BusyBeaver.HardnessEvidence.M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.halting_residue_class'", + "BusyBeaver.HardnessEvidence.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.halting_residue_class_odd", + "BusyBeaver.HardnessEvidence.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.halting_residue_class_odd'", + "BusyBeaver.HardnessEvidence.M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.halting_residue_class'", + "BusyBeaver.HardnessEvidence.M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.halting_residue_class_iff", + "BusyBeaver.HardnessEvidence.M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.halting_residue_class_iff", + "BusyBeaver.HardnessEvidence.M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.halting_state_witness_C1", + "BusyBeaver.HardnessEvidence.M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.halting_residue_class_hat", + "BusyBeaver.HardnessEvidence.M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.halting_residue_class_iff", + "BusyBeaver.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.halting_residue_class_diag", + "BusyBeaver.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.halting_residue_class_diag", + "BusyBeaver.HardnessEvidence.M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.halting_residue_class_iff", + "BusyBeaver.HardnessEvidence.M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.halting_residue_class_multi_step", + "BusyBeaver.HardnessEvidence.M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.halting_residue_class_two_step", + "BusyBeaver.HardnessEvidence.M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.halting_residue_class_two_step", + "BusyBeaver.HardnessEvidence.M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.halting_residue_class", + "BusyBeaver.HardnessEvidence.M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.halting_residue_class_two_step", + "BusyBeaver.HardnessEvidence.M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD.halting_state_witness", + "BusyBeaver.HardnessEvidence.M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD.halting_residue_class" ], "permitted_axioms": [ "propext", From fb512862f76d36edc2ecba54394d3b0afd0ae59c Mon Sep 17 00:00:00 2001 From: Tom Zahavy Date: Mon, 2 Nov 2026 10:08:19 +0000 Subject: [PATCH 5/6] Address review comments on PR #22: stack transport, HardnessEvidence, doc accuracy --- ...LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.lean | 2 - ...LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean | 1118 +--------------- ...LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.lean | 5 +- ...RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.lean | 4 +- ...RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean | 1120 +---------------- ...LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.lean | 4 +- ...LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean | 4 +- ...LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean | 4 +- ...RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.lean | 2 - ...RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.lean | 4 +- ...RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.lean | 2 - ...RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean | 1119 +--------------- ...HH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.lean | 2 - ...HH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean | 91 +- BusyBeaver/BB6/Accelerations/Stack.lean | 353 ++++++ BusyBeaver/BB6/Hardness.lean | 103 +- BusyBeaver/BB6/HardnessEvidence.lean | 36 +- ...LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.lean | 2 - ...LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean | 2 - ...LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean | 2 - ...LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean | 2 - ...LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.lean | 2 - ...RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.lean | 4 +- ...RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.lean | 8 +- ...LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.lean | 2 - ...LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.lean | 2 - ...LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.lean | 4 +- ...LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.lean | 2 - ...LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean | 4 +- ...RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.lean | 2 - ...RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.lean | 2 - ...RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.lean | 2 - ...RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.lean | 2 - ...RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.lean | 2 - ...RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean | 2 - ...RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.lean | 2 - BusyBeaver/BB6/README.md | 2 +- BusyBeaverChallenge.lean | 12 +- comparator/busy_beaver.json | 148 +-- 39 files changed, 676 insertions(+), 3509 deletions(-) diff --git a/BusyBeaver/BB6/Accelerations/M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.lean b/BusyBeaver/BB6/Accelerations/M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.lean index a021bd3e..001817eb 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.lean @@ -37,7 +37,6 @@ AL(L, (d + 3) :: R) -> AL((tailWeight L + 1) :: L.tail, (d + 1) :: bumpHead R) Start: D([3], [0]), reached after 23 raw TM steps ``` - ## Hardness *Hardness class:* S4 sibling — trigger **POW**, growth mass-conserving sandpile, shield partial @@ -53,7 +52,6 @@ non-halting. *Why it is hard:* E1 pair of #680 (different seed) See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean b/BusyBeaver/BB6/Accelerations/M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean index d6ea4e8f..b76db809 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean @@ -6,6 +6,7 @@ module public import BusyBeaver.Basic public import BusyBeaver.BB6.Accelerations.Stack +public import BusyBeaver.BB6.Accelerations.M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA public import BusyBeaver.Bridge /-! @@ -19,12 +20,11 @@ wiki page of `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`). This machine is the transition table of `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` restarted from its state `E` and brought to tree normal form: reading its states `A`, `B`, `C`, `D`, `E`, `F` as the states `E`, `C`, `D`, `B`, `F`, `A` of that machine, the two transition tables coincide, so both -machines run the same closed pair-stack system. The proof below is the mechanical relabelling of the -proof in -[`1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`](./M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean); -only the blank-tape entry theorem `init_reaches_nontrivial` is specific to this start state. +machines run the same closed pair-stack system. The proof below transports the closed stack witness +of [`1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`](./M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean) +via `ClosedStackSystem.relabel`; only the blank-tape entry theorem `init_reaches_nontrivial` is +specific to this start state. - ## Hardness *Hardness class:* Wiki stack — trigger **as #85 (same table, started from its state `E`)**, growth @@ -42,7 +42,6 @@ trajectory). (11 raw steps) See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section @@ -50,6 +49,7 @@ See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. namespace BusyBeaver.M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH open SixState Turing Stack +open M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA /-- The `(6, 2)` Turing machine in `ConjectureMachines.Machine` form. -/ def machine : ConjectureMachines.Machine 6 2 := @@ -59,21 +59,20 @@ def machine : ConjectureMachines.Machine 6 2 := abbrev target : Machine (Fin 2) (Fin 6) := machine.toBB -/-! ## Local Step Tactics and Pair-Stack Encodings -/ +/-- State bijection from #85 (`1RB---_...`) to #500 (`1RB0LC_...`). -/ +def f : Fin 6 → Fin 6 := ![5, 3, 1, 2, 0, 4] -local macro "normalize" : tactic => `(tactic| ( - try simp only [ListBlank.append_cons, ListBlank.append_nil, - ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, - ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, - List.nil_append, List.cons_append, zeros_append_default, - Nat.mul_zero, Nat.mul_add, Nat.mul_one])) +/-- Transition table isomorphism between #85 and #500 under state relabelling `f`. -/ +theorem hM : ∀ (q : Fin 6) (a : Fin 2), + target (f q) a = + (M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.target q a).map fun ⟨q', Stmt.write b d⟩ => + ⟨q'.map f, Stmt.write b d⟩ := by + intro q a + fin_cases q <;> fin_cases a <;> rfl -local macro "normalize_at" h:ident : tactic => `(tactic| ( - try simp only [ListBlank.append_cons, ListBlank.append_nil, - ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, - ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, - List.nil_append, List.cons_append, zeros_append_default, - Nat.mul_zero, Nat.mul_add, Nat.mul_one] at $h:ident)) +/-- Transport the closed pair-stack system of #85 to `target` along `f`. -/ +def closedStackSystem : ClosedStackSystem target := + M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.closedStackSystem.relabel f hM local macro "step" : tactic => `(tactic| ( try refine ReachesPlus.to_star ?_ @@ -89,1088 +88,35 @@ local macro "step" : tactic => `(tactic| ( list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one])) -private def encRight : List (ℕ × ℕ) → ListBlank (Fin 2) - | [] => default - | (a, b) :: L => (encRight L <+ (([0] : List (Fin 2)) ^ (1 + b % 1))) <+ - (([1] : List (Fin 2)) ^ (1 * a + 1)) - -private def encLeft : List (ℕ × ℕ) → ListBlank (Fin 2) - | [] => default - | (d, b) :: R => (([1] : List (Fin 2)) ^ (1 * d + 1)) +> ((([0] : List (Fin 2)) ^ (1 + b % 1)) +> - encLeft R) - -@[simp] private theorem encRight_nil : encRight [] = default := rfl - -@[simp] private theorem encRight_cons (a b : ℕ) (L : List (ℕ × ℕ)) : - encRight ((a, b) :: L) = (encRight L <+ (([0] : List (Fin 2)) ^ (1 + b % 1))) <+ - (([1] : List (Fin 2)) ^ (1 * a + 1)) := rfl - -@[simp] private theorem encLeft_nil : encLeft [] = default := rfl - -@[simp] private theorem encLeft_cons (d b : ℕ) (R : List (ℕ × ℕ)) : - encLeft ((d, b) :: R) = (([1] : List (Fin 2)) ^ (1 * d + 1)) +> - ((([0] : List (Fin 2)) ^ (1 + b % 1)) +> encLeft R) := rfl - -private theorem encRight_mod1 (a b : ℕ) (L : List (ℕ × ℕ)) : - encRight ((a, b) :: L) = encRight ((a, b % 1) :: L) := by - simp only [encRight_cons, Nat.mod_mod] - -private theorem encRight_succ (a b : ℕ) (L : List (ℕ × ℕ)) : - encRight ((a + 1, b) :: L) = (1 : Fin 2) >> encRight ((a, b) :: L) := by - simp only [encRight_cons] - rw [show 1 * (a + 1) + 1 = 1 + (1 * a + 1) by omega, list_pow_add, ListBlank.append_assoc] - rfl - -private theorem encRight_d0_s0 (L : List (ℕ × ℕ)) : - encRight ((0, 0) :: L) = (1 : Fin 2) >> (0 : Fin 2) >> encRight L := rfl - -private theorem encRight_d1_s0 (L : List (ℕ × ℕ)) : - encRight ((1, 0) :: L) = (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> encRight L := rfl - -private theorem encRight_run_s0 (a : ℕ) (L : List (ℕ × ℕ)) : - encRight ((a, 0) :: L) = (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> - encRight L) := by - induction a with - | zero => rfl - | succ k ih => rw [encRight_succ, ih]; normalize - -private theorem encLeft_mod1 (a b : ℕ) (R : List (ℕ × ℕ)) : - encLeft ((a, b) :: R) = encLeft ((a, b % 1) :: R) := by - simp only [encLeft_cons, Nat.mod_mod] - -private theorem encLeft_succ (a b : ℕ) (R : List (ℕ × ℕ)) : - encLeft ((a + 1, b) :: R) = (1 : Fin 2) >> encLeft ((a, b) :: R) := by - simp only [encLeft_cons] - rw [show 1 * (a + 1) + 1 = 1 + (1 * a + 1) by omega, list_pow_add, ListBlank.append_assoc] - rfl - -private theorem encLeft_d0_s0 (R : List (ℕ × ℕ)) : - encLeft ((0, 0) :: R) = (1 : Fin 2) >> (0 : Fin 2) >> encLeft R := rfl - -private theorem encLeft_d1_s0 (R : List (ℕ × ℕ)) : - encLeft ((1, 0) :: R) = (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> encLeft R := rfl - -private theorem encLeft_run_s0 (a : ℕ) (R : List (ℕ × ℕ)) : - encLeft ((a, 0) :: R) = (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> - encLeft R) := by - induction a with - | zero => rfl - | succ k ih => rw [encLeft_succ, ih]; normalize - -@[simp] private theorem encRight_cons_one (L : List (ℕ × ℕ)) : - (1 : Fin 2) >> encRight L = encRight (bumpPairHead L) := by - rcases L with _ | ⟨⟨a, b⟩, L'⟩ - · simp [bumpPairHead, encRight] - · exact (encRight_succ a b L').symm - -@[simp] private theorem encLeft_cons_one (R : List (ℕ × ℕ)) : - (1 : Fin 2) >> encLeft R = encLeft (bumpPairHead R) := by - rcases R with _ | ⟨⟨a, b⟩, R'⟩ - · simp [bumpPairHead, encLeft] - · exact (encLeft_succ a b R').symm - local macro "finish" : tactic => `(tactic| ( refine ⟨0, ?_⟩ try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', - encLeft_nil, encRight_nil, ListBlank.append_cons, ListBlank.append_nil, - ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, - ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, - List.nil_append, List.cons_append, zeros_append_default, - Nat.mul_zero, Nat.mul_add, Nat.mul_one] - simp only [encLeft_cons_one, encRight_cons_one, multiStep_zero] - try rfl)) - -local macro "execute" n:num : tactic => `(tactic| ( - iterate $n step - finish)) - -private def cfg_BR_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := - (encLeft R) {{B}}> (encRight L) - -private def cfg_AL_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := - (encLeft R) <{{A}} (encRight L) - -private def cfg_CL_0_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := - (encLeft R) <{{C}} ([0] +> encRight L) - -private def cfg_CR_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := - (encLeft R) {{C}}> (encRight L) - -private inductive StackMode - | BR_n_n - | AL_n_n - | CL_0_n - | CR_n_n - deriving DecidableEq - -private def evalStackCfg : StackMode → List (ℕ × ℕ) → List (ℕ × ℕ) → Cfg (Fin 2) (Fin 6) - | .BR_n_n, L, R => cfg_BR_n_n R L - | .AL_n_n, L, R => cfg_AL_n_n R L - | .CL_0_n, L, R => cfg_CL_0_n R L - | .CR_n_n, L, R => cfg_CR_n_n R L - -private def IsInStackSystem (cfg : Cfg (Fin 2) (Fin 6)) : Prop := - ∃ m L R, cfg = evalStackCfg m L R - -/-! ## Inner Token System -/ - -private def encTokens : List ℕ → List (ℕ × ℕ) → ListBlank (Fin 2) - | [], R3 => encLeft R3 - | k :: K, R3 => (([1] : List (Fin 2)) ^ k) +> ((0 : Fin 2) >> encTokens K R3) - -@[simp] private theorem encTokens_nil (R3 : List (ℕ × ℕ)) : encTokens [] R3 = encLeft R3 := rfl - -@[simp] private theorem encTokens_zero (K : List ℕ) (R3 : List (ℕ × ℕ)) : - encTokens (0 :: K) R3 = (0 : Fin 2) >> encTokens K R3 := rfl - -@[simp] private theorem encTokens_succ (k : ℕ) (K : List ℕ) (R3 : List (ℕ × ℕ)) : - encTokens ((k + 1) :: K) R3 = (1 : Fin 2) >> encTokens (k :: K) R3 := by - simp only [encTokens, list_pow_succ, List.cons_append, List.nil_append, ListBlank.append_cons] - -private def encRightNat : List ℕ → ListBlank (Fin 2) - | [] => default - | a :: L => (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> encRightNat L) - -@[simp] private theorem encRightNat_nil : encRightNat [] = default := rfl - -@[simp] private theorem encRightNat_zero (L : List ℕ) : - encRightNat (0 :: L) = (1 : Fin 2) >> (0 : Fin 2) >> encRightNat L := rfl - -@[simp] private theorem encRightNat_succ (a : ℕ) (L : List ℕ) : - encRightNat ((a + 1) :: L) = (1 : Fin 2) >> encRightNat (a :: L) := by - simp only [encRightNat, list_pow_succ, List.cons_append, List.nil_append, ListBlank.append_cons] - -private theorem encRight_eq_nat (L : List (ℕ × ℕ)) : encRight L = encRightNat (L.map Prod.fst) := by - induction L with - | nil => rfl - | cons p L ih => - rcases p with ⟨a, b⟩ - rw [encRight_mod1 a b L, Nat.mod_one b, encRight_run_s0 a L, ih] - rfl - -private theorem encRightNat_eq (L : List ℕ) : encRightNat L = encRight (L.map (fun x => (x, 0))) := - by - induction L with - | nil => rfl - | cons a L ih => - simp only [List.map_cons, encRightNat, ih, encRight_run_s0] - -@[simp] private theorem encRightNat_cons_one (L : List ℕ) : - (1 : Fin 2) >> encRightNat L = encRightNat (bumpHead L) := by - rcases L with _ | ⟨a, L'⟩ - · simp [bumpHead, encRightNat] - · simp [bumpHead] - -local macro "tstep" : tactic => `(tactic| ( - try refine ReachesPlus.to_star ?_ - try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', - encTokens_nil, encTokens_zero, encTokens_succ, - encRightNat_nil, encRightNat_zero, encRightNat_succ, ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one] - refine ReachesPlus.head (by rfl) ?_ - simp only [Tape.move, Tape.write, encTokens_nil, encTokens_zero, encTokens_succ, - encRightNat_nil, encRightNat_zero, encRightNat_succ, - ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, - ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, - list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, - zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one])) - -local macro "tfinish" : tactic => `(tactic| ( - refine ⟨0, ?_⟩ - try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', - encTokens_nil, encTokens_zero, encTokens_succ, - encRightNat_nil, encRightNat_zero, encRightNat_succ, encLeft_nil, encRight_nil, - ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, - ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, - list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, - zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one] - simp only [encRightNat_cons_one, encLeft_cons_one, encRight_cons_one, multiStep_zero] + simp only [multiStep_zero] try rfl)) -local macro "texecute" n:num : tactic => `(tactic| ( - iterate $n tstep - tfinish)) - -private def tok_BR (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := - (encTokens K R3) {{B}}> (encRightNat L) - -private def tok_CR (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := - (encTokens K R3) {{C}}> (encRightNat L) - -private def tok_AL (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := - (encTokens K R3) <{{A}} (encRightNat L) - -private theorem tok_AL_exit_zero (R3 : List (ℕ × ℕ)) (L : List ℕ) : - (tok_AL [0] R3 L) [target]⊢⁺ cfg_BR_n_n (L.map (fun x => (x, 0))) (bumpPairHead R3) := by - unfold tok_AL cfg_BR_n_n - rw [← encRightNat_eq L] - texecute 1 - -private theorem tok_AL_0_cons (k1 : ℕ) (K2 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : - (tok_AL (0 :: k1 :: K2) R3 L) [target]⊢⁺ tok_BR ((k1 + 1) :: K2) R3 L := by - unfold tok_AL tok_BR; texecute 1 - -private theorem tok_AL_1 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : - (tok_AL (1 :: K1) R3 L) [target]⊢⁺ tok_AL K1 R3 (0 :: L) := by - unfold tok_AL; texecute 2 - -private theorem tok_AL_2 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : - (tok_AL (2 :: K1) R3 (0 :: L)) [target]⊢⁺ tok_AL K1 R3 (0 :: 1 :: L) := by - unfold tok_AL; texecute 7 - -private theorem tok_AL_add3 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : - (tok_AL ((k + 3) :: K1) R3 L) [target]⊢⁺ tok_CR (2 :: k :: K1) R3 L := by - unfold tok_AL tok_CR; texecute 5 - -private theorem tok_CR_nil_8 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_CR (2 :: K1) R3 []) [target]⊢⁺ tok_AL K1 R3 [0, 1] := by - unfold tok_CR tok_AL; texecute 8 - -private theorem tok_CR_zero (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L1 : List ℕ) : - (tok_CR (2 :: K1) R3 (0 :: L1)) [target]⊢⁺ tok_CR (2 :: 1 :: K1) R3 L1 := by - unfold tok_CR; texecute 4 - -private theorem tok_CR_1_nil_28 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_CR (2 :: K1) R3 [1]) [target]⊢⁺ tok_AL (1 :: K1) R3 [0, 0, 0, 1] := by - unfold tok_CR tok_AL; texecute 28 - -private theorem tok_CR_succ (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L1 : List ℕ) : - (tok_CR (2 :: K1) R3 ((a + 1) :: L1)) [target]⊢⁺ tok_BR (1 :: 1 :: K1) R3 (a :: L1) := by - unfold tok_CR tok_BR; texecute 3 - -private theorem tok_BR_1_nil_9 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_BR (1 :: K1) R3 []) [target]⊢⁺ tok_AL K1 R3 [0, 1] := by - unfold tok_BR tok_AL; texecute 9 - -private theorem tok_BR_add2_nil_21 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_BR ((k + 2) :: K1) R3 []) [target]⊢⁺ tok_AL (k :: K1) R3 [0, 0, 1] := by - unfold tok_BR tok_AL; texecute 21 - -private theorem tok_BR_zero (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L1 : List ℕ) : - (tok_BR (k :: K1) R3 (0 :: L1)) [target]⊢⁺ tok_BR ((k + 2) :: K1) R3 L1 := by - unfold tok_BR; texecute 2 - -private theorem tok_BR_1_nil_33 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_BR (k :: K1) R3 [1]) [target]⊢⁺ tok_AL (k :: K1) R3 [0, 0, 0, 1] := by - unfold tok_BR tok_AL; texecute 33 - -private theorem tok_BR_1_0 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L2 : List ℕ) : - (tok_BR (k :: K1) R3 (1 :: 0 :: L2)) [target]⊢⁺ tok_BR (1 :: (k + 3) :: K1) R3 L2 := by - unfold tok_BR; texecute 5 - -private theorem tok_BR_1_1_nil_25 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_BR (k :: K1) R3 [1, 1]) [target]⊢⁺ tok_AL (k :: K1) R3 [0, 0, 1] := by - unfold tok_BR tok_AL; texecute 25 - -private theorem tok_BR_1_1_cons_25 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (c : ℕ) (L3 : List ℕ) : - (tok_BR (k :: K1) R3 (1 :: 1 :: c :: L3)) [target]⊢⁺ - tok_AL (k :: K1) R3 (0 :: 0 :: (c + 2) :: L3) := by - unfold tok_BR tok_AL; texecute 25 - -private theorem tok_BR_1_add2 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L2 : List ℕ) : - (tok_BR (k :: K1) R3 (1 :: (a + 2) :: L2)) [target]⊢⁺ tok_CR (2 :: 1 :: k :: K1) R3 (a :: L2) := - by - unfold tok_BR tok_CR; texecute 15 - -private theorem tok_BR_add2_halts (K : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L1 : List ℕ) : - ∃ cfg_, ((tok_BR K R3 ((a + 2) :: L1)) [target]⊢⁺ cfg_) ∧ - (step target cfg_).isNone := by - refine ⟨((1 : Fin 2) >> (1 : Fin 2) >> encTokens K R3) {{F}}> (encRightNat (a :: L1)), ?_, - by simp only [encRightNat]; bb_halt⟩ - unfold tok_BR; texecute 2 - -/-! ## Weight and Lexicographic Measure -/ - -@[simp] -private def predNat : ℕ → ℕ - | 0 => 0 - | a + 1 => a - -@[simp] -private def wtL : List ℕ → ℕ - | [] => 0 - | [a] => predNat a - | a :: b :: L => a + wtL (b :: L) - -@[simp] private theorem predNat_succ (a : ℕ) : predNat (a + 1) = a := rfl - -@[simp] private theorem wtL_single (a : ℕ) : wtL [a] = predNat a := rfl - -@[simp] private theorem wtL_cons_cons (a b : ℕ) (L : List ℕ) : wtL (a :: b :: L) = - a + wtL (b :: L) := rfl - -@[simp] private theorem wtL_zero_cons (L : List ℕ) : wtL (0 :: L) = wtL L := by - rcases L with _ | ⟨b, L'⟩ - · rfl - · exact Nat.zero_add (wtL (b :: L')) - -private theorem wtL_1_1_cons (c : ℕ) (L3 : List ℕ) : wtL ((c + 2) :: L3) ≤ wtL (1 :: 1 :: c :: L3) - := by - rcases L3 with _ | ⟨d, L4⟩ - · rcases c with _ | c' - · decide - · simp only [wtL_cons_cons, wtL_single, predNat_succ]; omega - · simp only [wtL_cons_cons]; omega - -private theorem wtL_1_add2 (b : ℕ) (L2 : List ℕ) : wtL (b :: L2) + 2 ≤ wtL (1 :: (b + 2) :: L2) := - by - rcases L2 with _ | ⟨d, L3⟩ - · rcases b with _ | b' - · decide - · simp only [wtL_cons_cons, wtL_single, predNat_succ]; omega - · simp only [wtL_cons_cons]; omega - -@[simp] -private def sumL : List ℕ → ℕ - | [] => 0 - | a :: L => a + sumL L - -@[simp] -private def countNonOne : List ℕ → ℕ - | [] => 0 - | 0 :: K => 1 + countNonOne K - | 1 :: K => countNonOne K - | (_ + 2) :: K => 1 + countNonOne K - -@[simp] private theorem countNonOne_zero (K : List ℕ) : countNonOne (0 :: K) = 1 + countNonOne K := - rfl - -@[simp] private theorem countNonOne_one (K : List ℕ) : countNonOne (1 :: K) = countNonOne K := rfl - -@[simp] private theorem countNonOne_add2 (k : ℕ) (K : List ℕ) : countNonOne ((k + 2) :: K) = - 1 + countNonOne K := rfl - -private theorem countNonOne_cons_le (k : ℕ) (K : List ℕ) : countNonOne (k :: K) ≤ 1 + countNonOne K - := by - rcases k with _ | _ | k' - · exact Nat.le_refl _ - · exact Nat.le_add_left _ 1 - · exact Nat.le_refl _ - -private theorem le_countNonOne_cons (k : ℕ) (K : List ℕ) : countNonOne K ≤ countNonOne (k :: K) := - by - rcases k with _ | _ | k' - · exact Nat.le_add_left _ 1 - · exact Nat.le_refl _ - · exact Nat.le_add_left _ 1 - -@[simp] -private def scores : List ℕ → List (ℕ × ℕ) - | [] => [] - | 0 :: K => scores K ++ [(K.length, 0)] - | 1 :: K => scores K - | (k + 2) :: K => scores K ++ [(K.length, k + 2)] - -@[simp] private theorem scores_zero (K : List ℕ) : scores (0 :: K) = scores K ++ [(K.length, 0)] := - rfl - -@[simp] private theorem scores_one (K : List ℕ) : scores (1 :: K) = scores K := rfl - -@[simp] private theorem scores_add2 (k : ℕ) (K : List ℕ) : scores ((k + 2) :: K) = scores K ++ - [(K.length, k + 2)] := rfl - -private theorem scores_cons_ext (k : ℕ) (K : List ℕ) : ∃ ext, scores (k :: K) = scores K ++ ext := - by - rcases k with _ | _ | k' - · exact ⟨[(K.length, 0)], rfl⟩ - · exact ⟨[], (List.append_nil (scores K)).symm⟩ - · exact ⟨[(K.length, k' + 2)], rfl⟩ - -private theorem scores_length (K : List ℕ) : (scores K).length = countNonOne K := by - induction K with - | nil => rfl - | cons k K ih => - rcases k with _ | _ | k' - · simp only [scores_zero, countNonOne_zero, List.length_append, List.length_singleton, - ih]; omega - · exact ih - · dsimp only [scores, countNonOne] - rw [List.length_append, List.length_singleton, ih] - omega - -private def PairLt (p q : ℕ × ℕ) : Prop := - p.1 < q.1 ∨ (p.1 = q.1 ∧ p.2 < q.2) - -private inductive BoundedLex : ℕ → List (ℕ × ℕ) → List (ℕ × ℕ) → Prop - | head {m : ℕ} {x y : ℕ × ℕ} {xs ys : List (ℕ × ℕ)} : - PairLt x y → BoundedLex (m + 1) (x :: xs) (y :: ys) - | cons {m : ℕ} {z : ℕ × ℕ} {xs ys : List (ℕ × ℕ)} : - BoundedLex m xs ys → BoundedLex (m + 1) (z :: xs) (z :: ys) - -private theorem boundedLex_append (P : List (ℕ × ℕ)) {m : ℕ} {x y : ℕ × ℕ} (rest ext : List (ℕ × ℕ)) - (hxy : PairLt x y) (hlen : P.length < m) : - BoundedLex m (P ++ (x :: ext)) (P ++ (y :: rest)) := by - induction P generalizing m with - | nil => - rcases m with _ | m' - · omega - · exact BoundedLex.head hxy - | cons z P' ih => - rcases m with _ | m' - · simp at hlen - · simp only [List.cons_append] - exact BoundedLex.cons (ih (by simp at hlen; omega)) - -private theorem boundedLex_acc_snd (m a : ℕ) - (ih_m : ∀ xs, Acc (BoundedLex m) xs) - (ih_a : ∀ a' < a, ∀ b ys, Acc (BoundedLex (m + 1)) ((a', b) :: ys)) - (n : ℕ) : - ∀ b ≤ n, ∀ ys, Acc (BoundedLex (m + 1)) ((a, b) :: ys) := by - induction n with - | zero => - intro b hb ys - have hb0 : b = 0 := by omega - subst hb0 - induction (ih_m ys) with - | intro ys _ ih_ys => - refine Acc.intro ((a, 0) :: ys) (fun zs h => ?_) - cases h with - | @head _ x _ xs _ hlt => - rcases x with ⟨a', b'⟩ - rcases hlt with ha' | ⟨rfl, hb'⟩ - · exact ih_a a' ha' b' xs - · dsimp at hb'; omega - | cons hsub => exact ih_ys _ hsub - | succ n ih_n => - intro b hb ys - rcases Nat.of_le_succ hb with hle | rfl - · exact ih_n b hle ys - · induction (ih_m ys) with - | intro ys _ ih_ys => - refine Acc.intro ((a, n + 1) :: ys) (fun zs h => ?_) - cases h with - | @head _ x _ xs _ hlt => - rcases x with ⟨a', b'⟩ - rcases hlt with ha' | ⟨rfl, hb'⟩ - · exact ih_a a' ha' b' xs - · dsimp at hb'; exact ih_n b' (by omega) xs - | cons hsub => exact ih_ys _ hsub - -private theorem boundedLex_acc_fst (m : ℕ) (ih_m : ∀ xs, Acc (BoundedLex m) xs) (n : ℕ) : - ∀ a ≤ n, ∀ b ys, Acc (BoundedLex (m + 1)) ((a, b) :: ys) := by - induction n with - | zero => - intro a ha b ys - have ha0 : a = 0 := by omega - subst ha0 - exact boundedLex_acc_snd m 0 ih_m (fun _ hlt => by omega) b b (Nat.le_refl b) ys - | succ n ih_n => - intro a ha b ys - rcases Nat.of_le_succ ha with hle | rfl - · exact ih_n a hle b ys - · exact boundedLex_acc_snd m (n + 1) ih_m (fun a' hlt => ih_n a' (by omega)) b b (Nat.le_refl b) - ys - -private theorem boundedLex_acc (m : ℕ) (xs : List (ℕ × ℕ)) : Acc (BoundedLex m) xs := by - induction m generalizing xs with - | zero => exact Acc.intro xs (fun _ h => nomatch h) - | succ m ih_m => - rcases xs with _ | ⟨⟨a, b⟩, ys⟩ - · exact Acc.intro [] (fun _ h => nomatch h) - · exact boundedLex_acc_fst m ih_m a a (Nat.le_refl a) b ys - -/-! ## Bounce Lemmas for `BR` and `CR` -/ - -private theorem bounce_len (R3 : List (ℕ × ℕ)) (n : ℕ) : - ∀ (L : List ℕ), 2 * sumL L + L.length ≤ n → - (∀ (k0 : ℕ) (K_acc : List ℕ), - (∃ cfg_, ((tok_BR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ - (∃ K_out L_out, ((tok_BR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ - tok_AL K_out R3 (0 :: L_out)) ∧ - (∃ ext, scores K_out = scores K_acc ++ ext) ∧ - (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∨ - (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + 1 + wtL L ∧ - (k0 ≠ 0 → ∃ d ext, scores K_out = scores K_acc ++ ((K_acc.length, d) :: ext)))))) ∧ - (∀ (K_acc : List ℕ), - (∃ cfg_, ((tok_CR (2 :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ - (∃ K_out L_out, ((tok_CR (2 :: K_acc) R3 L) [target]⊢⁺ tok_AL K_out R3 (0 :: L_out)) ∧ - countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∧ - (∃ ext, scores K_out = scores K_acc ++ ext))) := by - induction n with - | zero => - intro L hlen - rcases L with _ | ⟨a, L1⟩ - · refine ⟨fun k0 K_acc => ?_, fun K_acc => ?_⟩ - · rcases k0 with _ | k' - · refine Or.inr ⟨K_acc, [1], tok_BR_1_nil_9 K_acc R3, ⟨[], by simp⟩, Or.inl (by simp)⟩ - · rcases k' with _ | m - · refine Or.inr ⟨0 :: K_acc, [0, 1], tok_BR_add2_nil_21 0 K_acc R3, ⟨[(K_acc.length, 0)], - by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨0, [], by simp⟩⟩⟩ - · rcases m with _ | m' - · refine Or.inr ⟨1 :: K_acc, [0, 1], tok_BR_add2_nil_21 1 K_acc R3, ⟨[], by simp⟩, - Or.inl (by simp)⟩ - · refine Or.inr ⟨(m' + 2) :: K_acc, [0, 1], tok_BR_add2_nil_21 (m' + 2) K_acc R3, - ⟨[(K_acc.length, m' + 2)], by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨m' + 2, [], - by simp⟩⟩⟩ - · exact Or.inr ⟨K_acc, [1], tok_CR_nil_8 K_acc R3, by simp, ⟨[], by simp⟩⟩ - · simp at hlen - | succ n ih_n => - intro L hlen - rcases Nat.of_le_succ hlen with hle | heq - · exact ih_n L hle - · refine ⟨fun k0 K_acc => ?_, fun K_acc => ?_⟩ - · rcases L with _ | ⟨a, L1⟩ - · simp at heq - · rcases a with _ | _ | a' - · have hstep1 := tok_BR_zero (k0 + 1) K_acc R3 L1 - rcases (ih_n L1 (by simp at heq ⊢; omega)).1 (k0 + 2) K_acc with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hext, hbr⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, hext, ?_⟩ - rcases hbr with hlt | ⟨hle, hd⟩ - · exact Or.inl (by simpa using hlt) - · exact Or.inr ⟨by simpa using hle, fun _ => hd (by omega)⟩ - · rcases L1 with _ | ⟨b, L2⟩ - · rcases k0 with _ | k' - · refine Or.inr ⟨1 :: K_acc, [0, 0, 1], tok_BR_1_nil_33 1 K_acc R3, ⟨[], by simp⟩, - Or.inl (by simp)⟩ - · refine Or.inr ⟨(k' + 2) :: K_acc, [0, 0, 1], tok_BR_1_nil_33 (k' + 2) K_acc R3, - ⟨[(K_acc.length, k' + 2)], by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨k' + 2, [], - by simp⟩⟩⟩ - · rcases b with _ | _ | b' - · have hstep1 := tok_BR_1_0 (k0 + 1) K_acc R3 L2 - rcases (ih_n L2 (by simp at heq ⊢; omega)).1 0 ((k0 + 4) :: K_acc) with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · have hsc' : scores K_out = scores K_acc ++ ((K_acc.length, k0 + 4) :: ext) := by - simpa [scores_add2 (k0 + 2) K_acc, List.append_assoc] using hsc - refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ⟨(K_acc.length, - k0 + 4) :: ext, hsc'⟩, ?_⟩ - have hwt : wtL ((0 + 1) :: 0 :: L2) = 1 + wtL L2 := by simp - have hcnt : countNonOne ((k0 + 4) :: K_acc) = 1 + countNonOne K_acc := - countNonOne_add2 (k0 + 2) K_acc - rcases hbr with hlt | ⟨hle, _⟩ - · exact Or.inl (by omega) - · exact Or.inr ⟨by omega, fun _ => ⟨k0 + 4, ext, hsc'⟩⟩ - · rcases L2 with _ | ⟨c, L3⟩ - · have hstep := tok_BR_1_1_nil_25 (k0 + 1) K_acc R3 - have hcnt := countNonOne_cons_le (k0 + 1) K_acc - refine Or.inr ⟨(k0 + 1) :: K_acc, [0, 1], hstep, scores_cons_ext (k0 + 1) K_acc, - Or.inl ?_⟩ - simp at hcnt ⊢; omega - · have hstep := tok_BR_1_1_cons_25 (k0 + 1) K_acc R3 c L3 - have hwt : wtL ((c + 2) :: L3) ≤ wtL ((0 + 1) :: (0 + 1) :: c :: L3) := - wtL_1_1_cons c L3 - rcases k0 with _ | k' - · refine Or.inr ⟨1 :: K_acc, 0 :: (c + 2) :: L3, hstep, ⟨[], by simp⟩, Or.inl ?_⟩ - simp only [countNonOne_one, wtL_zero_cons]; omega - · refine Or.inr ⟨(k' + 2) :: K_acc, 0 :: (c + 2) :: L3, hstep, ⟨[(K_acc.length, - k' + 2)], by simp⟩, Or.inr ⟨?_, fun _ => ⟨k' + 2, [], by simp⟩⟩⟩ - simp only [countNonOne_add2, wtL_zero_cons]; omega - · have hstep1 := tok_BR_1_add2 (k0 + 1) K_acc R3 b' L2 - rcases (ih_n (b' :: L2) (by simp at heq ⊢; omega)).2 (1 :: (k0 + 1) :: K_acc) with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · obtain ⟨ext0, hsc0⟩ := scores_cons_ext (k0 + 1) K_acc - have hcnt := countNonOne_cons_le (k0 + 1) K_acc - have hwt : wtL (b' :: L2) + 2 ≤ wtL ((0 + 1) :: (b' + 1 + 1) :: L2) := - wtL_1_add2 b' L2 - refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ⟨ext0 ++ ext, - by simp [hsc, hsc0, List.append_assoc]⟩, Or.inl ?_⟩ - simp only [countNonOne_one] at hle - omega - · exact Or.inl (tok_BR_add2_halts ((k0 + 1) :: K_acc) R3 a' L1) - · rcases L with _ | ⟨a, L1⟩ - · simp at heq - · rcases a with _ | a' - · have hstep1 := tok_CR_zero K_acc R3 L1 - rcases (ih_n L1 (by simp at heq ⊢; omega)).2 (1 :: K_acc) with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · exact Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, by simpa using hle, ⟨ext, - by simpa using hsc⟩⟩ - · rcases L1 with _ | ⟨b, L2⟩ - · rcases a' with _ | a'' - · exact Or.inr ⟨1 :: K_acc, [0, 0, 1], tok_CR_1_nil_28 K_acc R3, by simp, ⟨[], - by simp⟩⟩ - · have hstep1 := tok_CR_succ K_acc R3 (a'' + 1) [] - rcases (ih_n [a'' + 1] (by simp at heq ⊢; omega)).1 0 (1 :: K_acc) with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ?_, ⟨ext, - by simpa using hsc⟩⟩ - rcases hbr with hlt | ⟨hle, _⟩ - · simp at hlt ⊢; omega - · simp at hle ⊢; omega - · have hstep1 := tok_CR_succ K_acc R3 a' (b :: L2) - rcases (ih_n (a' :: b :: L2) (by simp at heq ⊢; omega)).1 0 (1 :: K_acc) with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ?_, ⟨ext, - by simpa using hsc⟩⟩ - rcases hbr with hlt | ⟨hle, _⟩ - · simp at hlt ⊢; omega - · simp at hle ⊢; omega - -private theorem bounce_BR (R3 : List (ℕ × ℕ)) (k0 : ℕ) (K_acc : List ℕ) (L : List ℕ) : - (∃ cfg_, ((tok_BR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ - (∃ K_out L_out, ((tok_BR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ tok_AL K_out R3 (0 :: L_out)) ∧ - (∃ ext, scores K_out = scores K_acc ++ ext) ∧ - (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∨ - (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + 1 + wtL L ∧ - (k0 ≠ 0 → ∃ d ext, scores K_out = scores K_acc ++ ((K_acc.length, d) :: ext))))) := - (bounce_len R3 (2 * sumL L + L.length) L (Nat.le_refl _)).1 k0 K_acc - -private theorem bounce_CR (R3 : List (ℕ × ℕ)) (K_acc : List ℕ) (L : List ℕ) : - (∃ cfg_, ((tok_CR (2 :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ - (∃ K_out L_out, ((tok_CR (2 :: K_acc) R3 L) [target]⊢⁺ tok_AL K_out R3 (0 :: L_out)) ∧ - countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∧ - (∃ ext, scores K_out = scores K_acc ++ ext)) := - (bounce_len R3 (2 * sumL L + L.length) L (Nat.le_refl _)).2 K_acc - -/-! ## Token System Termination -/ - -private theorem bl_step_macro_len (R3 : List (ℕ × ℕ)) (n : ℕ) : - ∀ (K : List ℕ), K.length ≤ n → ∀ (L : List ℕ), - (∃ cfg_, ((tok_AL K R3 (0 :: L)) [target]⊢* cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone)) ∨ - (∃ K' L', ((tok_AL K R3 (0 :: L)) [target]⊢⁺ tok_AL K' R3 (0 :: L')) ∧ - countNonOne K' + wtL L' < countNonOne K + wtL L) ∨ - (∃ K' L' P x y rest ext, ((tok_AL K R3 (0 :: L)) [target]⊢⁺ tok_AL K' R3 (0 :: L')) ∧ - countNonOne K' + wtL L' = countNonOne K + wtL L ∧ PairLt x y ∧ - scores K = P ++ (y :: rest) ∧ scores K' = P ++ (x :: ext)) := by - induction n with - | zero => - intro K hlen L - cases K with - | nil => - refine Or.inl ⟨cfg_AL_n_n ((0 :: L).map (fun x => (x, 0))) R3, ⟨0, ?_⟩, - Or.inl ⟨.AL_n_n, R3, (0 :: L).map (fun x => (x, 0)), rfl⟩⟩ - unfold tok_AL cfg_AL_n_n - rw [encTokens_nil, encRightNat_eq] - rfl - | cons _ _ => simp at hlen - | succ n ih_n => - intro K hlen L - rcases K with _ | ⟨k1, K1⟩ - · refine Or.inl ⟨cfg_AL_n_n ((0 :: L).map (fun x => (x, 0))) R3, ⟨0, ?_⟩, - Or.inl ⟨.AL_n_n, R3, (0 :: L).map (fun x => (x, 0)), rfl⟩⟩ - unfold tok_AL cfg_AL_n_n - rw [encTokens_nil, encRightNat_eq] - rfl - · rcases k1 with _ | _ | _ | k' - · rcases K1 with _ | ⟨k2, K2⟩ - · exact Or.inl ⟨cfg_BR_n_n ((0 :: L).map (fun x => (x, 0))) (bumpPairHead R3), - ReachesPlus.to_star (tok_AL_exit_zero R3 (0 :: L)), - Or.inl ⟨.BR_n_n, bumpPairHead R3, (0 :: L).map (fun x => (x, 0)), rfl⟩⟩ - · have hstep1 := - ReachesPlus.trans (tok_AL_0_cons k2 K2 R3 (0 :: L)) (tok_BR_zero (k2 + 1) K2 R3 L) - rcases bounce_BR R3 (k2 + 2) K2 L with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, _, hbr⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans hstep1 hstep2), Or.inr hhalt⟩ - · have hstep := ReachesPlus.trans hstep1 hstep2 - rcases hbr with hlt | ⟨hle, hd⟩ - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - have hcnt := le_countNonOne_cons k2 K2 - simp only [countNonOne_zero]; omega - · rcases k2 with _ | _ | k2' - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [countNonOne_zero]; omega - · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [Nat.zero_add, countNonOne_zero, countNonOne_one]; omega - · obtain ⟨d, ext, hsc_out⟩ := hd (by omega) - refine Or.inr (Or.inr ⟨K_out, L_out, scores K2, (K2.length, d), ((1 :: K2).length, - 0), - [], ext, hstep, by simp only [Nat.zero_add, countNonOne_zero, - countNonOne_one]; omega, - Or.inl (by simp), by simp, hsc_out⟩) - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [countNonOne_zero, countNonOne_add2]; omega - · have hstep1 := tok_AL_1 K1 R3 (0 :: L) - rcases ih_n K1 (by simp at hlen; omega) (0 :: L) with - ⟨cfg_, hstep2, hsys⟩ | - ⟨K', L', hstep2, hlt⟩ | - ⟨K', L', P, x, y, rest, ext, hstep2, heq, hxy, hsc1, hsc2⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep1 hstep2), hsys⟩ - · refine Or.inr (Or.inl ⟨K', L', ReachesPlus.trans hstep1 hstep2, ?_⟩) - simpa using hlt - · refine Or.inr (Or.inr ⟨K', L', P, x, y, rest, ext, ReachesPlus.trans hstep1 hstep2, - by simpa using heq, hxy, by simpa using hsc1, hsc2⟩) - · have hstep1 := tok_AL_2 K1 R3 L - rcases L with _ | ⟨a, L1⟩ - · refine Or.inr (Or.inl ⟨K1, [1], hstep1, ?_⟩) - simp - · have hwt1 : wtL (1 :: a :: L1) = 1 + wtL (a :: L1) := by simp - rcases ih_n K1 (by simp at hlen; omega) (1 :: a :: L1) with - ⟨cfg_, hstep2, hsys⟩ | - ⟨K', L', hstep2, hlt⟩ | - ⟨K', L', P, x, y, rest, ext, hstep2, heq, hxy, hsc1, hsc2⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep1 hstep2), hsys⟩ - · refine Or.inr (Or.inl ⟨K', L', ReachesPlus.trans hstep1 hstep2, ?_⟩) - simp only [countNonOne_add2 0 K1]; omega - · refine Or.inr (Or.inr ⟨K', L', P, x, y, rest ++ [(K1.length, 2)], ext, - ReachesPlus.trans hstep1 hstep2, by simp only [countNonOne_add2 0 K1]; omega, - hxy, by simp [hsc1, List.append_assoc], hsc2⟩) - · have hstep1 := - ReachesPlus.trans (tok_AL_add3 k' K1 R3 (0 :: L)) (tok_CR_zero (k' :: K1) R3 L) - rcases bounce_CR R3 (1 :: k' :: K1) L with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans hstep1 hstep2), Or.inr hhalt⟩ - · have hstep := ReachesPlus.trans hstep1 hstep2 - simp only [countNonOne_one, scores_one] at hle hsc - rcases k' with _ | _ | k'' - · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [countNonOne_zero, countNonOne_add2] at hlt' ⊢; omega - · refine Or.inr (Or.inr ⟨K_out, L_out, scores K1, (K1.length, 0), (K1.length, 3), - [], ext, hstep, by simp only [countNonOne_zero, countNonOne_add2] at heq' ⊢; omega, - Or.inr ⟨rfl, by simp⟩, by simp, - by simpa [List.append_assoc] using hsc⟩) - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [Nat.zero_add, countNonOne_one, countNonOne_add2] at hle ⊢; omega - · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [countNonOne_add2] at hlt' ⊢; omega - · refine Or.inr (Or.inr ⟨K_out, L_out, scores K1, (K1.length, k'' + 2), (K1.length, - k'' + 5), - [], ext, hstep, by simp only [countNonOne_add2] at heq' ⊢; omega, - Or.inr ⟨rfl, by simp⟩, by simp, - by simpa [List.append_assoc] using hsc⟩) - -private theorem bl_terminates_acc (R3 : List (ℕ × ℕ)) (m : ℕ) - (ih_m : ∀ (K : List ℕ) (L : List ℕ), - countNonOne K + wtL L < m → - ∃ cfg_, ((tok_AL K R3 (0 :: L)) [target]⊢* cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone)) - (S : List (ℕ × ℕ)) (hacc : Acc (BoundedLex m) S) : - ∀ (K : List ℕ) (L : List ℕ), - scores K = S → countNonOne K + wtL L = m → - ∃ cfg_, ((tok_AL K R3 (0 :: L)) [target]⊢* cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - induction hacc with - | intro S _ ih_acc => - intro K L hS hm - rcases bl_step_macro_len R3 K.length K (Nat.le_refl K.length) L with - ⟨cfg_, hstep, hsys⟩ | - ⟨K', L', hstep, hlt⟩ | - ⟨K', L', P, x, y, rest, ext, hstep, heq, hxy, hsc1, hsc2⟩ - · exact ⟨cfg_, hstep, hsys⟩ - · obtain ⟨cfg_, hstep2, hsys⟩ := ih_m K' L' (by omega) - exact ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep hstep2), hsys⟩ - · have hlenP : P.length < m := by - have hlenK := scores_length K - rw [hsc1, List.length_append, List.length_cons] at hlenK - omega - have hlex : BoundedLex m (scores K') S := by - rw [← hS, hsc1, hsc2] - exact boundedLex_append P rest ext hxy hlenP - obtain ⟨cfg_, hstep2, hsys⟩ := ih_acc (scores K') hlex K' L' rfl (by omega) - exact ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep hstep2), hsys⟩ - -private theorem bl_terminates_le (R3 : List (ℕ × ℕ)) (n : ℕ) : - ∀ (m : ℕ), m ≤ n → ∀ (K : List ℕ) (L : List ℕ), - countNonOne K + wtL L = m → - ∃ cfg_, ((tok_AL K R3 (0 :: L)) [target]⊢* cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - induction n with - | zero => - intro m hm K L hM - have hm0 : m = 0 := by omega - subst hm0 - exact bl_terminates_acc R3 0 (fun _ _ hlt => by omega) (scores K) (boundedLex_acc 0 (scores K)) - K L rfl hM - | succ n ih_n => - intro m hm K L hM - rcases Nat.of_le_succ hm with hle | rfl - · exact ih_n m hle K L hM - · refine bl_terminates_acc R3 (n + 1) (fun K' L' hlt => ?_) - (scores K) (boundedLex_acc (n + 1) (scores K)) K L rfl hM - exact ih_n (countNonOne K' + wtL L') (by omega) K' L' rfl - -private theorem tok_CR_2_0_closed (R3 : List (ℕ × ℕ)) (L : List ℕ) : - ∃ cfg_, ((tok_CR [2, 0] R3 L) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases bounce_CR R3 [0] L with ⟨cfg_, hstep, hhalt⟩ | ⟨K_out, L_out, hstep, _, _⟩ - · exact ⟨cfg_, hstep, Or.inr hhalt⟩ - · obtain ⟨cfg_, hstep2, hsys⟩ := bl_terminates_le R3 (countNonOne K_out + wtL L_out) - (countNonOne K_out + wtL L_out) (Nat.le_refl _) K_out L_out rfl - exact ⟨cfg_, ReachesPlus.trans_star hstep hstep2, hsys⟩ - -private theorem tok_BR_1_0_closed (R3 : List (ℕ × ℕ)) (L : List ℕ) : - ∃ cfg_, ((tok_BR [1, 0] R3 L) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases bounce_BR R3 0 [0] L with ⟨cfg_, hstep, hhalt⟩ | ⟨K_out, L_out, hstep, _, _⟩ - · exact ⟨cfg_, hstep, Or.inr hhalt⟩ - · obtain ⟨cfg_, hstep2, hsys⟩ := bl_terminates_le R3 (countNonOne K_out + wtL L_out) - (countNonOne K_out + wtL L_out) (Nat.le_refl _) K_out L_out rfl - exact ⟨cfg_, ReachesPlus.trans_star hstep hstep2, hsys⟩ - -/-! ## Mode Closure Theorems -/ - -private theorem mode_BR_n_n_closed (L R : List (ℕ × ℕ)) : - ∃ cfg_, ((cfg_BR_n_n L R) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases L with _ | ⟨⟨a1, b2⟩, L3⟩ - · refine ⟨cfg_AL_n_n [(0, 0)] (bumpPairHead R), ?_, Or.inl ⟨.AL_n_n, bumpPairHead R, [(0, 0)], - rfl⟩⟩ - unfold cfg_BR_n_n cfg_AL_n_n - rw [encRight_d0_s0 [], ← encLeft_cons_one R] - execute 2 - · rcases a1 with _ | a5 - · refine ⟨cfg_BR_n_n L3 (bumpPairHead (bumpPairHead R)), ?_, Or.inl ⟨.BR_n_n, - bumpPairHead (bumpPairHead R), L3, rfl⟩⟩ - unfold cfg_BR_n_n - rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, - ← encLeft_cons_one (bumpPairHead R), ← encLeft_cons_one R] - execute 2 - · rcases a5 with _ | a14 - · rcases L3 with _ | ⟨⟨a6, b7⟩, L8⟩ - · refine ⟨cfg_AL_n_n [(0, 0)] ((0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R))), ?_, - Or.inl ⟨.AL_n_n, (0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R)), [(0, 0)], rfl⟩⟩ - unfold cfg_BR_n_n cfg_AL_n_n - rw [encRight_mod1 1 b2 [], Nat.mod_one b2, encRight_d1_s0 [], encRight_d0_s0 [], - encLeft_d0_s0 (bumpPairHead (bumpPairHead (bumpPairHead R))), - ← encLeft_cons_one (bumpPairHead (bumpPairHead R)), - ← encLeft_cons_one (bumpPairHead R), ← encLeft_cons_one R] - execute 6 - · rcases a6 with _ | a10 - · refine ⟨cfg_BR_n_n L8 ((0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R))), ?_, - Or.inl ⟨.BR_n_n, (0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R)), L8, rfl⟩⟩ - unfold cfg_BR_n_n - rw [encRight_mod1 1 b2 ((0, b7) :: L8), Nat.mod_one b2, encRight_d1_s0 ((0, b7) :: L8), - encRight_mod1 0 b7 L8, Nat.mod_one b7, encRight_d0_s0 L8, - encLeft_d0_s0 (bumpPairHead (bumpPairHead (bumpPairHead R))), - ← encLeft_cons_one (bumpPairHead (bumpPairHead R)), - ← encLeft_cons_one (bumpPairHead R), ← encLeft_cons_one R] - execute 5 - · rcases a10 with _ | a11 - · refine ⟨cfg_AL_n_n (bumpPairHead L8) ((1, 0) :: (0, 0) :: R), ?_, Or.inl ⟨.AL_n_n, (1, - 0) :: (0, 0) :: R, bumpPairHead L8, rfl⟩⟩ - unfold cfg_BR_n_n cfg_AL_n_n - rw [encRight_mod1 1 b2 ((1, b7) :: L8), Nat.mod_one b2, - encRight_d1_s0 ((1, b7) :: L8), encRight_mod1 1 b7 L8, Nat.mod_one b7, - encRight_d1_s0 L8, ← encRight_cons_one L8, encLeft_d1_s0 ((0, 0) :: R), - encLeft_d0_s0 R] - execute 16 - · refine ⟨cfg_CR_n_n ((a11, 0) :: L8) ((1, 0) :: (0, 0) :: R), ?_, Or.inl ⟨.CR_n_n, (1, - 0) :: (0, 0) :: R, (a11, 0) :: L8, rfl⟩⟩ - unfold cfg_BR_n_n cfg_CR_n_n - rw [encRight_mod1 1 b2 ((a11 + 2, b7) :: L8), Nat.mod_one b2, - encRight_d1_s0 ((a11 + 2, b7) :: L8), encRight_mod1 (a11 + 2) b7 L8, - Nat.mod_one b7, encRight_succ (a11 + 1) 0 L8, encRight_succ a11 0 L8, - encRight_run_s0 a11 L8, encLeft_d1_s0 ((0, 0) :: R), encLeft_d0_s0 R] - execute 15 - · refine ⟨((1 : Fin 2) >> (1 : Fin 2) >> encLeft R) {{F}}> (encRight ((a14, 0) :: L3)), ?_, - Or.inr (by rw [encRight_run_s0]; bb_halt)⟩ - unfold cfg_BR_n_n - rw [encRight_mod1 (a14 + 2) b2 L3, Nat.mod_one b2, encRight_succ (a14 + 1) 0 L3, - encRight_succ a14 0 L3] - execute 2 - -private theorem mode_AL_n_n_closed (L R : List (ℕ × ℕ)) : - ∃ cfg_, ((cfg_AL_n_n L R) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases R with _ | ⟨⟨r1, b2⟩, R3⟩ - · refine ⟨cfg_BR_n_n L [(0, 0)], ?_, Or.inl ⟨.BR_n_n, [(0, 0)], L, rfl⟩⟩ - unfold cfg_AL_n_n cfg_BR_n_n - rw [encLeft_d0_s0 []] - execute 1 - · rcases r1 with _ | r5 - · refine ⟨cfg_AL_n_n ((0, 0) :: L) R3, ?_, Or.inl ⟨.AL_n_n, R3, (0, 0) :: L, rfl⟩⟩ - unfold cfg_AL_n_n - rw [encLeft_mod1 0 b2 R3, Nat.mod_one b2, encLeft_d0_s0 R3, encRight_d0_s0 L] - execute 2 - · refine ⟨cfg_CL_0_n L ((r5, 0) :: R3), ?_, Or.inl ⟨.CL_0_n, (r5, 0) :: R3, L, rfl⟩⟩ - unfold cfg_AL_n_n cfg_CL_0_n - rw [encLeft_mod1 (r5 + 1) b2 R3, Nat.mod_one b2, encLeft_succ r5 0 R3, encLeft_run_s0 r5 R3] - execute 1 - -private theorem mode_CL_0_n_closed (L R : List (ℕ × ℕ)) : - ∃ cfg_, ((cfg_CL_0_n L R) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases R with _ | ⟨⟨r1, b2⟩, R3⟩ - · refine ⟨cfg_BR_n_n L [(2, 0)], ?_, Or.inl ⟨.BR_n_n, [(2, 0)], L, rfl⟩⟩ - unfold cfg_CL_0_n cfg_BR_n_n - rw [encLeft_succ 1 0 [], encLeft_d1_s0 []] - execute 4 - · rcases r1 with _ | _ | r5 - · refine ⟨cfg_AL_n_n ((0, 0) :: bumpPairHead L) R3, ?_, Or.inl ⟨.AL_n_n, R3, (0, - 0) :: bumpPairHead L, rfl⟩⟩ - unfold cfg_CL_0_n cfg_AL_n_n - rw [encLeft_mod1 0 b2 R3, Nat.mod_one b2, encLeft_d0_s0 R3, encRight_d0_s0 (bumpPairHead L), - ← encRight_cons_one L] - execute 6 - · obtain ⟨cfg_, hstep2, hsys⟩ := tok_CR_2_0_closed R3 (L.map Prod.fst) - refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ - unfold cfg_CL_0_n tok_CR - rw [encLeft_mod1 1 b2 R3, Nat.mod_one b2, encLeft_d1_s0 R3, encRight_eq_nat L, - encTokens_succ, encTokens_succ, encTokens_zero, encTokens_zero, encTokens_nil] - texecute 4 - · refine ⟨cfg_CR_n_n L ((1, 0) :: (r5, 0) :: R3), ?_, Or.inl ⟨.CR_n_n, (1, 0) :: (r5, 0) :: R3, - L, rfl⟩⟩ - unfold cfg_CL_0_n cfg_CR_n_n - rw [encLeft_mod1 (r5 + 2) b2 R3, Nat.mod_one b2, encLeft_succ (r5 + 1) 0 R3, - encLeft_succ r5 0 R3, encLeft_run_s0 r5 R3, encLeft_d1_s0 ((r5, 0) :: R3), - encLeft_run_s0 r5 R3] - execute 4 - -private theorem mode_CR_n_n_closed (L R : List (ℕ × ℕ)) : - ∃ cfg_, ((cfg_CR_n_n L R) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases L with _ | ⟨⟨a1, b2⟩, L3⟩ - · refine ⟨cfg_AL_n_n [(0, 0)] R, ?_, Or.inl ⟨.AL_n_n, R, [(0, 0)], rfl⟩⟩ - unfold cfg_CR_n_n cfg_AL_n_n - rw [encRight_d0_s0 []] - execute 1 - · rcases R with _ | ⟨⟨r1, b4⟩, R3⟩ - · rcases a1 with _ | a5 - · refine ⟨cfg_AL_n_n (bumpPairHead L3) [(0, 0)], ?_, Or.inl ⟨.AL_n_n, [(0, 0)], - bumpPairHead L3, rfl⟩⟩ - unfold cfg_CR_n_n cfg_AL_n_n - rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, ← encRight_cons_one L3, - encLeft_d0_s0 []] - execute 4 - · refine ⟨cfg_CR_n_n ((a5, 0) :: L3) [(0, 0)], ?_, Or.inl ⟨.CR_n_n, [(0, 0)], (a5, 0) :: L3, - rfl⟩⟩ - unfold cfg_CR_n_n - rw [encRight_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encRight_succ a5 0 L3, - encRight_run_s0 a5 L3, encLeft_d0_s0 []] - execute 3 - · rcases r1 with _ | r5 - · rcases a1 with _ | a5 - · obtain ⟨cfg_, hstep2, hsys⟩ := tok_CR_2_0_closed R3 (L3.map Prod.fst) - refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ - unfold cfg_CR_n_n tok_CR - rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, encLeft_mod1 0 b4 R3, - Nat.mod_one b4, encLeft_d0_s0 R3, encRight_eq_nat L3, encTokens_succ, encTokens_succ, - encTokens_zero, encTokens_zero, encTokens_nil] - texecute 4 - · obtain ⟨cfg_, hstep2, hsys⟩ := tok_BR_1_0_closed R3 (a5 :: L3.map Prod.fst) - refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ - unfold cfg_CR_n_n tok_BR - rw [encRight_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encRight_succ a5 0 L3, - encRight_run_s0 a5 L3, encLeft_mod1 0 b4 R3, Nat.mod_one b4, encLeft_d0_s0 R3, - encRight_eq_nat L3, encTokens_succ, encTokens_zero, encTokens_zero, encTokens_nil] - change (((1 : Fin 2) >> (0 : Fin 2) >> encLeft R3) {{C}}> ((1 : Fin 2) >> - encRightNat (a5 :: List.map Prod.fst L3))) [target]⊢⁺ (((1 : Fin 2) >> (0 : Fin 2) >> - (0 : Fin 2) >> encLeft R3) {{B}}> (encRightNat (a5 :: List.map Prod.fst L3))) - texecute 3 - · rcases a1 with _ | a5 - · refine ⟨cfg_CR_n_n L3 ((1, 0) :: (r5, 0) :: R3), ?_, Or.inl ⟨.CR_n_n, (1, 0) :: (r5, - 0) :: R3, L3, rfl⟩⟩ - unfold cfg_CR_n_n - rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, - encLeft_mod1 (r5 + 1) b4 R3, Nat.mod_one b4, encLeft_succ r5 0 R3, - encLeft_run_s0 r5 R3, encLeft_d1_s0 ((r5, 0) :: R3), encLeft_run_s0 r5 R3] - execute 4 - · refine ⟨cfg_BR_n_n ((a5, 0) :: L3) ((0, 0) :: (r5, 0) :: R3), ?_, Or.inl ⟨.BR_n_n, (0, - 0) :: (r5, 0) :: R3, (a5, 0) :: L3, rfl⟩⟩ - unfold cfg_CR_n_n cfg_BR_n_n - rw [encRight_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encRight_succ a5 0 L3, - encRight_run_s0 a5 L3, encLeft_mod1 (r5 + 1) b4 R3, Nat.mod_one b4, - encLeft_succ r5 0 R3, encLeft_run_s0 r5 R3, encLeft_d0_s0 ((r5, 0) :: R3), - encLeft_run_s0 r5 R3] - execute 3 - -private theorem stack_system_closed (cfg : Cfg (Fin 2) (Fin 6)) (h : IsInStackSystem cfg) : - ∃ cfg_, (cfg [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases h with ⟨m, R, L, rfl⟩ - cases m with - | BR_n_n => exact mode_BR_n_n_closed L R - | AL_n_n => exact mode_AL_n_n_closed L R - | CL_0_n => exact mode_CL_0_n_closed L R - | CR_n_n => exact mode_CR_n_n_closed L R +local macro "execute" n:num : tactic => `(tactic| ( + iterate $n step + finish)) private theorem init_reaches_nontrivial : - (init []) [target]⊢⁺ evalStackCfg .BR_n_n [(0, 0)] [(0, 0), (1, 0)] := by - have hL : encLeft [(0, 0)] = (1 : Fin 2) >> (0 : Fin 2) >> default := rfl - have hR : encRight [(0, 0), (1, 0)] = - (1 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default := rfl - dsimp only [evalStackCfg, cfg_BR_n_n] - rw [hL, hR] + ReachesPlus target (init []) + (closedStackSystem.evalStackCfg StackMode.CR_n_n [(0, 0)] [(0, 0), (1, 0)]) := by + have htarget : closedStackSystem.evalStackCfg StackMode.CR_n_n [(0, 0)] [(0, 0), (1, 0)] = + ((1 : Fin 2) >> (0 : Fin 2) >> default) {{B}}> + ((1 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default) := by + rfl + rw [htarget] execute 11 -private theorem step_AL_transfer (z : ℕ × ℕ) (L R : List (ℕ × ℕ)) : - (evalStackCfg .AL_n_n ((0, 0) :: z :: L) R) [target]⊢⁺ - evalStackCfg .AL_n_n (z :: L) ((0, 0) :: R) := by - dsimp only [evalStackCfg, cfg_AL_n_n] - rw [encLeft_d0_s0 (z :: L), encRight_d0_s0 R] - execute 2 - -private theorem encRight_head (a b : ℕ) (L : List (ℕ × ℕ)) : - (encRight ((a, b) :: L)).head = 1 := by - rw [encRight_cons, show 1 * a + 1 = (1 * a + 0) + 1 by omega, list_pow_succ, List.cons_append] - simp only [ListBlank.append_cons, ListBlank.head_cons] - -private theorem encRight_not_surjective : - ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ L : List (ℕ × ℕ), encRight L ≠ t := by - refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ - intro L h - rcases L with _ | ⟨⟨a, b⟩, L'⟩ - · have h1 := congrArg (fun s => s.head) h - simp at h1 - · rw [encRight_mod1] at h - have hb0 : b % 1 = 0 := Nat.mod_one b - rw [hb0, encRight_run_s0] at h - rcases a with _ | a' - · rcases L' with _ | ⟨⟨a', b'⟩, L''⟩ - · have h2 := congrArg (fun s => s.tail.tail.tail.head) h - simp at h2 - · have h1 := congrArg (fun s => s.tail.tail.head) h - normalize_at h1 - rw [encRight_head a' b' L''] at h1; contradiction - · have h1 := congrArg (fun s => s.tail.head) h - normalize_at h1 - contradiction - -private theorem encLeft_head (a b : ℕ) (R : List (ℕ × ℕ)) : - (encLeft ((a, b) :: R)).head = 1 := by - rw [encLeft_cons, show 1 * a + 1 = (1 * a + 0) + 1 by omega, list_pow_succ, List.cons_append] - simp only [ListBlank.append_cons, ListBlank.head_cons] - -private theorem encLeft_not_surjective : - ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ R : List (ℕ × ℕ), encLeft R ≠ t := by - refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ - intro R h - rcases R with _ | ⟨⟨a, b⟩, R'⟩ - · have h1 := congrArg (fun s => s.head) h - simp at h1 - · rw [encLeft_mod1] at h - have hb0 : b % 1 = 0 := Nat.mod_one b - rw [hb0, encLeft_run_s0] at h - rcases a with _ | a' - · rcases R' with _ | ⟨⟨a', b'⟩, L''⟩ - · have h2 := congrArg (fun s => s.tail.tail.tail.head) h - simp at h2 - · have h1 := congrArg (fun s => s.tail.tail.head) h - normalize_at h1 - rw [encLeft_head a' b' L''] at h1; contradiction - · have h1 := congrArg (fun s => s.tail.head) h - normalize_at h1 - contradiction - -private theorem valid_stack_modes : IsValidStackModes encLeft encRight evalStackCfg := by - intro m - cases m with - | BR_n_n => exact ⟨B, .id [], .id [], by decide, by decide, Or.inr (Or.inr (fun _ _ => rfl))⟩ - | AL_n_n => exact ⟨A, .id [], .id [], by decide, by decide, Or.inr (Or.inl (fun _ _ => rfl))⟩ - | CL_0_n => exact ⟨C, .id [], .id [0], by decide, by decide, Or.inr (Or.inl (fun _ _ => rfl))⟩ - | CR_n_n => exact ⟨C, .id [], .id [], by decide, by decide, Or.inr (Or.inr (fun _ _ => rfl))⟩ - - /-! ## Stack Reduction Witness -/ /-- `target` reduces to a closed 2nd-order digit-stack transition system. -/ -theorem has_stack_reduction : HasStackReduction target := by - refine ⟨StackMode, 1, 0, encLeft, encRight, evalStackCfg, IsInStackSystem, - Or.inl ⟨rfl, rfl⟩, rfl, rfl, - encLeft_head, encRight_head, encLeft_not_surjective, encRight_not_surjective, - ⟨1, 1, 1, 1, 1, 1, 1, 1, by decide, by decide, by decide, by decide, by decide, - by decide, by decide, by decide, by decide, by decide, - fun _ _ _ => rfl, fun _ _ _ => rfl⟩, - ⟨[.BR_n_n, .AL_n_n, .CL_0_n, .CR_n_n], by decide, by intro m; cases m <;> decide⟩, - valid_stack_modes, - fun _ => Iff.rfl, - fun m L R => ⟨m, L, R, rfl⟩, - ⟨.BR_n_n, [(0, 0)], [(0, 0), (1, 0)], init_reaches_nontrivial, - by decide, ⟨(1, 0), by decide, by decide⟩⟩, - Or.inl ⟨.AL_n_n, .AL_n_n, (0, 0), id, ((0, 0) :: ·), - fun _ => Nat.le_succ _, step_AL_transfer⟩, - stack_system_closed⟩ +theorem has_stack_reduction : HasStackReduction target := + HasStackReduction.of_closedSystem closedStackSystem StackMode.CR_n_n [(0, 0)] [(0, 0), (1, 0)] + init_reaches_nontrivial (by decide) ⟨(1, 0), by decide, by decide⟩ end BusyBeaver.M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH diff --git a/BusyBeaver/BB6/Accelerations/M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.lean b/BusyBeaver/BB6/Accelerations/M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.lean index 945ce478..619246dc 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.lean @@ -38,11 +38,11 @@ Restricting to the Poincaré return section $R = [0]$ eliminates the right stack a single-stack transition system $C_{\mathrm{HL}}(a, L) := C(a, L, [0])$ starting at $C_{\mathrm{HL}}(3, [0])$. - ## Hardness *Hardness class:* Problem S4 — trigger **POW (power-of-two bottom exposure)**, growth -mass-conserving ($\Delta M = 0$), log-depth tower, shield partial (`ValidStack660` kills $C([],R)$). +mass-conserving ($\Delta M = 0$), log-depth tower, shield partial +(the empty-left configuration $C([],R)$ is unreachable). *Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously non-halting. @@ -56,7 +56,6 @@ halts *Why it is hard:* Single-Pass Drainage Law $b_{i+1} = a_{i+1}+q_i+1$, $q_{k-1} = 2^m-1$, $u = 2^m$ See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.lean b/BusyBeaver/BB6/Accelerations/M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.lean index b057f812..15237fbe 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.lean @@ -46,11 +46,10 @@ Contracting every intermediate $C$-chain via structural recursion on $L$ (`exitC state $C$ completely, yielding a single-constructor high-level transition system $F_{\mathrm{HL}}(a, b, L, r, R)$ starting at $F_{\mathrm{HL}}(1, 0, [], 0, [])$. - ## Hardness *Hardness class:* Problem S3 — trigger **EQ (depth-two gate)**, growth —, shield partial -(`ValidStack129` kills $\mathrm{CR}\,[]\,R$ and all $0::0::L$ states). +(unreachable states include $\mathrm{CR}\,[]\,R$ and all $0::0::L$ configurations). *Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously non-halting (weak race). @@ -63,7 +62,6 @@ non-halting (weak race). *Why it is hard:* two-mode halving sweeper; halts iff $L$ drains to $[1,0]$ in $\mathrm{CR}$ See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean b/BusyBeaver/BB6/Accelerations/M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean index 56d26cd7..f0bc716f 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean @@ -6,6 +6,7 @@ module public import BusyBeaver.Basic public import BusyBeaver.BB6.Accelerations.Stack +public import BusyBeaver.BB6.Accelerations.M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA public import BusyBeaver.Bridge /-! @@ -20,11 +21,11 @@ This machine is the transition table of `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1 its state `D` and brought to tree normal form: reading its states `A`, `B`, `C`, `D`, `E`, `F` as the states `D`, `E`, `C`, `F`, `B`, `A` of that machine and mirroring the tape left/right, the two transition tables coincide, so both machines run the same closed pair-stack system. The proof below -is the mechanical relabelling and mirroring of the proof in -[`1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`](./M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean); -only the blank-tape entry theorem `init_reaches_nontrivial` is specific to this start state. +transports the closed stack witness of +[`1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`](./M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean) +via `ClosedStackSystem.mirror`; only the blank-tape entry theorem `init_reaches_nontrivial` is +specific to this start state. - ## Hardness *Hardness class:* Wiki stack — trigger **as #85 (same table, started from its state `D`, @@ -42,7 +43,6 @@ wiki (halting path of length 108, $\approx 235{,}000$ right-side words explored) blank-tape entry (7 raw steps) See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section @@ -50,6 +50,7 @@ See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. namespace BusyBeaver.M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH open SixState Turing Stack +open M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA /-- The `(6, 2)` Turing machine in `ConjectureMachines.Machine` form. -/ def machine : ConjectureMachines.Machine 6 2 := @@ -59,21 +60,21 @@ def machine : ConjectureMachines.Machine 6 2 := abbrev target : Machine (Fin 2) (Fin 6) := machine.toBB -/-! ## Local Step Tactics and Pair-Stack Encodings -/ +/-- State bijection from #85 (`1RB---_...`) to #490 (`1RB0RE_...`). -/ +def f : Fin 6 → Fin 6 := ![5, 4, 2, 0, 1, 3] -local macro "normalize" : tactic => `(tactic| ( - try simp only [ListBlank.append_cons, ListBlank.append_nil, - ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, - ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, - List.nil_append, List.cons_append, zeros_append_default, - Nat.mul_zero, Nat.mul_add, Nat.mul_one])) +/-- Transition table isomorphism between #85 and #490 under state relabelling `f` and mirror. -/ +theorem hM : ∀ (q : Fin 6) (a : Fin 2), + target (f q) a = + (M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.target q a).map fun ⟨q', Stmt.write b d⟩ => + ⟨q'.map f, Stmt.write b (reflectDir d)⟩ := by + intro q a + fin_cases q <;> fin_cases a <;> rfl -local macro "normalize_at" h:ident : tactic => `(tactic| ( - try simp only [ListBlank.append_cons, ListBlank.append_nil, - ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, - ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, - List.nil_append, List.cons_append, zeros_append_default, - Nat.mul_zero, Nat.mul_add, Nat.mul_one] at $h:ident)) +/-- Transport the closed pair-stack system of #85 to `target` along `f` and tape reflection. -/ +def closedStackSystem : ClosedStackSystem target := + M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.closedStackSystem.mirror f + M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.encLeft_eq_encRight hM local macro "step" : tactic => `(tactic| ( try refine ReachesPlus.to_star ?_ @@ -89,1090 +90,35 @@ local macro "step" : tactic => `(tactic| ( list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one])) -private def encLeft : List (ℕ × ℕ) → ListBlank (Fin 2) - | [] => default - | (a, b) :: L => (encLeft L <+ (([0] : List (Fin 2)) ^ (1 + b % 1))) <+ - (([1] : List (Fin 2)) ^ (1 * a + 1)) - -private def encRight : List (ℕ × ℕ) → ListBlank (Fin 2) - | [] => default - | (d, b) :: R => (([1] : List (Fin 2)) ^ (1 * d + 1)) +> ((([0] : List (Fin 2)) ^ (1 + b % 1)) +> - encRight R) - -@[simp] private theorem encLeft_nil : encLeft [] = default := rfl - -@[simp] private theorem encLeft_cons (a b : ℕ) (L : List (ℕ × ℕ)) : - encLeft ((a, b) :: L) = (encLeft L <+ (([0] : List (Fin 2)) ^ (1 + b % 1))) <+ - (([1] : List (Fin 2)) ^ (1 * a + 1)) := rfl - -@[simp] private theorem encRight_nil : encRight [] = default := rfl - -@[simp] private theorem encRight_cons (d b : ℕ) (R : List (ℕ × ℕ)) : - encRight ((d, b) :: R) = (([1] : List (Fin 2)) ^ (1 * d + 1)) +> - ((([0] : List (Fin 2)) ^ (1 + b % 1)) +> encRight R) := rfl - -private theorem encLeft_mod1 (a b : ℕ) (L : List (ℕ × ℕ)) : - encLeft ((a, b) :: L) = encLeft ((a, b % 1) :: L) := by - simp only [encLeft_cons, Nat.mod_mod] - -private theorem encLeft_succ (a b : ℕ) (L : List (ℕ × ℕ)) : - encLeft ((a + 1, b) :: L) = (1 : Fin 2) >> encLeft ((a, b) :: L) := by - simp only [encLeft_cons] - rw [show 1 * (a + 1) + 1 = 1 + (1 * a + 1) by omega, list_pow_add, ListBlank.append_assoc] - rfl - -private theorem encLeft_d0_s0 (L : List (ℕ × ℕ)) : - encLeft ((0, 0) :: L) = (1 : Fin 2) >> (0 : Fin 2) >> encLeft L := rfl - -private theorem encLeft_d1_s0 (L : List (ℕ × ℕ)) : - encLeft ((1, 0) :: L) = (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> encLeft L := rfl - -private theorem encLeft_run_s0 (a : ℕ) (L : List (ℕ × ℕ)) : - encLeft ((a, 0) :: L) = (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> - encLeft L) := by - induction a with - | zero => rfl - | succ k ih => rw [encLeft_succ, ih]; normalize - -private theorem encRight_mod1 (a b : ℕ) (R : List (ℕ × ℕ)) : - encRight ((a, b) :: R) = encRight ((a, b % 1) :: R) := by - simp only [encRight_cons, Nat.mod_mod] - -private theorem encRight_succ (a b : ℕ) (R : List (ℕ × ℕ)) : - encRight ((a + 1, b) :: R) = (1 : Fin 2) >> encRight ((a, b) :: R) := by - simp only [encRight_cons] - rw [show 1 * (a + 1) + 1 = 1 + (1 * a + 1) by omega, list_pow_add, ListBlank.append_assoc] - rfl - -private theorem encRight_d0_s0 (R : List (ℕ × ℕ)) : - encRight ((0, 0) :: R) = (1 : Fin 2) >> (0 : Fin 2) >> encRight R := rfl - -private theorem encRight_d1_s0 (R : List (ℕ × ℕ)) : - encRight ((1, 0) :: R) = (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> encRight R := rfl - -private theorem encRight_run_s0 (a : ℕ) (R : List (ℕ × ℕ)) : - encRight ((a, 0) :: R) = (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> - encRight R) := by - induction a with - | zero => rfl - | succ k ih => rw [encRight_succ, ih]; normalize - -@[simp] private theorem encLeft_cons_one (L : List (ℕ × ℕ)) : - (1 : Fin 2) >> encLeft L = encLeft (bumpPairHead L) := by - rcases L with _ | ⟨⟨a, b⟩, L'⟩ - · simp [bumpPairHead, encLeft] - · exact (encLeft_succ a b L').symm - -@[simp] private theorem encRight_cons_one (R : List (ℕ × ℕ)) : - (1 : Fin 2) >> encRight R = encRight (bumpPairHead R) := by - rcases R with _ | ⟨⟨a, b⟩, R'⟩ - · simp [bumpPairHead, encRight] - · exact (encRight_succ a b R').symm - local macro "finish" : tactic => `(tactic| ( refine ⟨0, ?_⟩ try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', - encRight_nil, encLeft_nil, ListBlank.append_cons, ListBlank.append_nil, - ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, - ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, - List.nil_append, List.cons_append, zeros_append_default, - Nat.mul_zero, Nat.mul_add, Nat.mul_one] - simp only [encRight_cons_one, encLeft_cons_one, multiStep_zero] - try rfl)) - -local macro "execute" n:num : tactic => `(tactic| ( - iterate $n step - finish)) - -private def cfg_CL_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := - (encLeft L) <{{C}} (encRight R) - -private def cfg_BR_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := - (encLeft L) {{B}}> (encRight R) - -private def cfg_AR_0_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := - ([0] +> encLeft L) {{A}}> (encRight R) - -private def cfg_AL_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := - (encLeft L) <{{A}} (encRight R) - -private inductive StackMode - | CL_n_n - | BR_n_n - | AR_0_n - | AL_n_n - deriving DecidableEq - -private def evalStackCfg : StackMode → List (ℕ × ℕ) → List (ℕ × ℕ) → Cfg (Fin 2) (Fin 6) - | .CL_n_n, L, R => cfg_CL_n_n L R - | .BR_n_n, L, R => cfg_BR_n_n L R - | .AR_0_n, L, R => cfg_AR_0_n L R - | .AL_n_n, L, R => cfg_AL_n_n L R - -private def IsInStackSystem (cfg : Cfg (Fin 2) (Fin 6)) : Prop := - ∃ m L R, cfg = evalStackCfg m L R - -/-! ## Inner Token System -/ - -private def encTokens : List ℕ → List (ℕ × ℕ) → ListBlank (Fin 2) - | [], R3 => encRight R3 - | k :: K, R3 => (([1] : List (Fin 2)) ^ k) +> ((0 : Fin 2) >> encTokens K R3) - -@[simp] private theorem encTokens_nil (R3 : List (ℕ × ℕ)) : encTokens [] R3 = encRight R3 := rfl - -@[simp] private theorem encTokens_zero (K : List ℕ) (R3 : List (ℕ × ℕ)) : - encTokens (0 :: K) R3 = (0 : Fin 2) >> encTokens K R3 := rfl - -@[simp] private theorem encTokens_succ (k : ℕ) (K : List ℕ) (R3 : List (ℕ × ℕ)) : - encTokens ((k + 1) :: K) R3 = (1 : Fin 2) >> encTokens (k :: K) R3 := by - simp only [encTokens, list_pow_succ, List.cons_append, List.nil_append, ListBlank.append_cons] - -private def encLeftNat : List ℕ → ListBlank (Fin 2) - | [] => default - | a :: L => (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> encLeftNat L) - -@[simp] private theorem encLeftNat_nil : encLeftNat [] = default := rfl - -@[simp] private theorem encLeftNat_zero (L : List ℕ) : - encLeftNat (0 :: L) = (1 : Fin 2) >> (0 : Fin 2) >> encLeftNat L := rfl - -@[simp] private theorem encLeftNat_succ (a : ℕ) (L : List ℕ) : - encLeftNat ((a + 1) :: L) = (1 : Fin 2) >> encLeftNat (a :: L) := by - simp only [encLeftNat, list_pow_succ, List.cons_append, List.nil_append, ListBlank.append_cons] - -private theorem encLeft_eq_nat (L : List (ℕ × ℕ)) : encLeft L = encLeftNat (L.map Prod.fst) := by - induction L with - | nil => rfl - | cons p L ih => - rcases p with ⟨a, b⟩ - rw [encLeft_mod1 a b L, Nat.mod_one b, encLeft_run_s0 a L, ih] - rfl - -private theorem encLeftNat_eq (L : List ℕ) : encLeftNat L = encLeft (L.map (fun x => (x, 0))) := - by - induction L with - | nil => rfl - | cons a L ih => - simp only [List.map_cons, encLeftNat, ih, encLeft_run_s0] - -@[simp] private theorem encLeftNat_cons_one (L : List ℕ) : - (1 : Fin 2) >> encLeftNat L = encLeftNat (bumpHead L) := by - rcases L with _ | ⟨a, L'⟩ - · simp [bumpHead, encLeftNat] - · simp [bumpHead] - -local macro "tstep" : tactic => `(tactic| ( - try refine ReachesPlus.to_star ?_ - try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', - encTokens_nil, encTokens_zero, encTokens_succ, - encLeftNat_nil, encLeftNat_zero, encLeftNat_succ, ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one] - refine ReachesPlus.head (by rfl) ?_ - simp only [Tape.move, Tape.write, encTokens_nil, encTokens_zero, encTokens_succ, - encLeftNat_nil, encLeftNat_zero, encLeftNat_succ, - ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, - ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, - list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, - zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one])) - -local macro "tfinish" : tactic => `(tactic| ( - refine ⟨0, ?_⟩ - try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', - encTokens_nil, encTokens_zero, encTokens_succ, - encLeftNat_nil, encLeftNat_zero, encLeftNat_succ, encRight_nil, encLeft_nil, - ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, - ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, - list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, - zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one] - simp only [encLeftNat_cons_one, encRight_cons_one, encLeft_cons_one, multiStep_zero] + simp only [multiStep_zero] try rfl)) -local macro "texecute" n:num : tactic => `(tactic| ( - iterate $n tstep - tfinish)) - -private def tok_CL (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := - (encLeftNat L) <{{C}} (encTokens K R3) - -private def tok_AL (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := - (encLeftNat L) <{{A}} (encTokens K R3) - -private def tok_BR (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := - (encLeftNat L) {{B}}> (encTokens K R3) - -private theorem tok_BR_exit_zero (R3 : List (ℕ × ℕ)) (L : List ℕ) : - (tok_BR [0] R3 L) [target]⊢⁺ cfg_CL_n_n (L.map (fun x => (x, 0))) (bumpPairHead R3) := by - unfold tok_BR cfg_CL_n_n - rw [← encLeftNat_eq L] - texecute 1 - -private theorem tok_BR_0_cons (k1 : ℕ) (K2 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : - (tok_BR (0 :: k1 :: K2) R3 L) [target]⊢⁺ tok_CL ((k1 + 1) :: K2) R3 L := by - unfold tok_BR tok_CL; texecute 1 - -private theorem tok_BR_1 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : - (tok_BR (1 :: K1) R3 L) [target]⊢⁺ tok_BR K1 R3 (0 :: L) := by - unfold tok_BR; texecute 2 - -private theorem tok_BR_2 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : - (tok_BR (2 :: K1) R3 (0 :: L)) [target]⊢⁺ tok_BR K1 R3 (0 :: 1 :: L) := by - unfold tok_BR; texecute 7 - -private theorem tok_BR_add3 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : - (tok_BR ((k + 3) :: K1) R3 L) [target]⊢⁺ tok_AL (2 :: k :: K1) R3 L := by - unfold tok_BR tok_AL; texecute 5 - -private theorem tok_AL_nil_8 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_AL (2 :: K1) R3 []) [target]⊢⁺ tok_BR K1 R3 [0, 1] := by - unfold tok_AL tok_BR; texecute 8 - -private theorem tok_AL_zero (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L1 : List ℕ) : - (tok_AL (2 :: K1) R3 (0 :: L1)) [target]⊢⁺ tok_AL (2 :: 1 :: K1) R3 L1 := by - unfold tok_AL; texecute 4 - -private theorem tok_AL_1_nil_28 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_AL (2 :: K1) R3 [1]) [target]⊢⁺ tok_BR (1 :: K1) R3 [0, 0, 0, 1] := by - unfold tok_AL tok_BR; texecute 28 - -private theorem tok_AL_succ (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L1 : List ℕ) : - (tok_AL (2 :: K1) R3 ((a + 1) :: L1)) [target]⊢⁺ tok_CL (1 :: 1 :: K1) R3 (a :: L1) := by - unfold tok_AL tok_CL; texecute 3 - -private theorem tok_CL_1_nil_9 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_CL (1 :: K1) R3 []) [target]⊢⁺ tok_BR K1 R3 [0, 1] := by - unfold tok_CL tok_BR; texecute 9 - -private theorem tok_CL_add2_nil_21 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_CL ((k + 2) :: K1) R3 []) [target]⊢⁺ tok_BR (k :: K1) R3 [0, 0, 1] := by - unfold tok_CL tok_BR; texecute 21 - -private theorem tok_CL_zero (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L1 : List ℕ) : - (tok_CL (k :: K1) R3 (0 :: L1)) [target]⊢⁺ tok_CL ((k + 2) :: K1) R3 L1 := by - unfold tok_CL; texecute 2 - -private theorem tok_CL_1_nil_33 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_CL (k :: K1) R3 [1]) [target]⊢⁺ tok_BR (k :: K1) R3 [0, 0, 0, 1] := by - unfold tok_CL tok_BR; texecute 33 - -private theorem tok_CL_1_0 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L2 : List ℕ) : - (tok_CL (k :: K1) R3 (1 :: 0 :: L2)) [target]⊢⁺ tok_CL (1 :: (k + 3) :: K1) R3 L2 := by - unfold tok_CL; texecute 5 - -private theorem tok_CL_1_1_nil_25 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_CL (k :: K1) R3 [1, 1]) [target]⊢⁺ tok_BR (k :: K1) R3 [0, 0, 1] := by - unfold tok_CL tok_BR; texecute 25 - -private theorem tok_CL_1_1_cons_25 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (c : ℕ) (L3 : List ℕ) : - (tok_CL (k :: K1) R3 (1 :: 1 :: c :: L3)) [target]⊢⁺ - tok_BR (k :: K1) R3 (0 :: 0 :: (c + 2) :: L3) := by - unfold tok_CL tok_BR; texecute 25 - -private theorem tok_CL_1_add2 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L2 : List ℕ) : - (tok_CL (k :: K1) R3 (1 :: (a + 2) :: L2)) [target]⊢⁺ tok_AL (2 :: 1 :: k :: K1) R3 (a :: L2) := - by - unfold tok_CL tok_AL; texecute 15 - -private theorem tok_CL_add2_halts (K : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L1 : List ℕ) : - ∃ cfg_, ((tok_CL K R3 ((a + 2) :: L1)) [target]⊢⁺ cfg_) ∧ - (step target cfg_).isNone := by - refine ⟨(encLeftNat (a :: L1)) <{{F}} ((1 : Fin 2) >> (1 : Fin 2) >> encTokens K R3), ?_, - by simp only [encLeftNat]; bb_halt⟩ - unfold tok_CL; texecute 2 - -/-! ## Weight and Lexicographic Measure -/ - -@[simp] -private def predNat : ℕ → ℕ - | 0 => 0 - | a + 1 => a - -@[simp] -private def wtL : List ℕ → ℕ - | [] => 0 - | [a] => predNat a - | a :: b :: L => a + wtL (b :: L) - -@[simp] private theorem predNat_succ (a : ℕ) : predNat (a + 1) = a := rfl - -@[simp] private theorem wtL_single (a : ℕ) : wtL [a] = predNat a := rfl - -@[simp] private theorem wtL_cons_cons (a b : ℕ) (L : List ℕ) : wtL (a :: b :: L) = - a + wtL (b :: L) := rfl - -@[simp] private theorem wtL_zero_cons (L : List ℕ) : wtL (0 :: L) = wtL L := by - rcases L with _ | ⟨b, L'⟩ - · rfl - · exact Nat.zero_add (wtL (b :: L')) - -private theorem wtL_1_1_cons (c : ℕ) (L3 : List ℕ) : wtL ((c + 2) :: L3) ≤ wtL (1 :: 1 :: c :: L3) - := by - rcases L3 with _ | ⟨d, L4⟩ - · rcases c with _ | c' - · decide - · simp only [wtL_cons_cons, wtL_single, predNat_succ]; omega - · simp only [wtL_cons_cons]; omega - -private theorem wtL_1_add2 (b : ℕ) (L2 : List ℕ) : wtL (b :: L2) + 2 ≤ wtL (1 :: (b + 2) :: L2) := - by - rcases L2 with _ | ⟨d, L3⟩ - · rcases b with _ | b' - · decide - · simp only [wtL_cons_cons, wtL_single, predNat_succ]; omega - · simp only [wtL_cons_cons]; omega - -@[simp] -private def sumL : List ℕ → ℕ - | [] => 0 - | a :: L => a + sumL L - -@[simp] -private def countNonOne : List ℕ → ℕ - | [] => 0 - | 0 :: K => 1 + countNonOne K - | 1 :: K => countNonOne K - | (_ + 2) :: K => 1 + countNonOne K - -@[simp] private theorem countNonOne_zero (K : List ℕ) : countNonOne (0 :: K) = 1 + countNonOne K := - rfl - -@[simp] private theorem countNonOne_one (K : List ℕ) : countNonOne (1 :: K) = countNonOne K := rfl - -@[simp] private theorem countNonOne_add2 (k : ℕ) (K : List ℕ) : countNonOne ((k + 2) :: K) = - 1 + countNonOne K := rfl - -private theorem countNonOne_cons_le (k : ℕ) (K : List ℕ) : countNonOne (k :: K) ≤ 1 + countNonOne K - := by - rcases k with _ | _ | k' - · exact Nat.le_refl _ - · exact Nat.le_add_left _ 1 - · exact Nat.le_refl _ - -private theorem le_countNonOne_cons (k : ℕ) (K : List ℕ) : countNonOne K ≤ countNonOne (k :: K) := - by - rcases k with _ | _ | k' - · exact Nat.le_add_left _ 1 - · exact Nat.le_refl _ - · exact Nat.le_add_left _ 1 - -@[simp] -private def scores : List ℕ → List (ℕ × ℕ) - | [] => [] - | 0 :: K => scores K ++ [(K.length, 0)] - | 1 :: K => scores K - | (k + 2) :: K => scores K ++ [(K.length, k + 2)] - -@[simp] private theorem scores_zero (K : List ℕ) : scores (0 :: K) = scores K ++ [(K.length, 0)] := - rfl - -@[simp] private theorem scores_one (K : List ℕ) : scores (1 :: K) = scores K := rfl - -@[simp] private theorem scores_add2 (k : ℕ) (K : List ℕ) : scores ((k + 2) :: K) = scores K ++ - [(K.length, k + 2)] := rfl - -private theorem scores_cons_ext (k : ℕ) (K : List ℕ) : ∃ ext, scores (k :: K) = scores K ++ ext := - by - rcases k with _ | _ | k' - · exact ⟨[(K.length, 0)], rfl⟩ - · exact ⟨[], (List.append_nil (scores K)).symm⟩ - · exact ⟨[(K.length, k' + 2)], rfl⟩ - -private theorem scores_length (K : List ℕ) : (scores K).length = countNonOne K := by - induction K with - | nil => rfl - | cons k K ih => - rcases k with _ | _ | k' - · simp only [scores_zero, countNonOne_zero, List.length_append, List.length_singleton, - ih]; omega - · exact ih - · dsimp only [scores, countNonOne] - rw [List.length_append, List.length_singleton, ih] - omega - -private def PairLt (p q : ℕ × ℕ) : Prop := - p.1 < q.1 ∨ (p.1 = q.1 ∧ p.2 < q.2) - -private inductive BoundedLex : ℕ → List (ℕ × ℕ) → List (ℕ × ℕ) → Prop - | head {m : ℕ} {x y : ℕ × ℕ} {xs ys : List (ℕ × ℕ)} : - PairLt x y → BoundedLex (m + 1) (x :: xs) (y :: ys) - | cons {m : ℕ} {z : ℕ × ℕ} {xs ys : List (ℕ × ℕ)} : - BoundedLex m xs ys → BoundedLex (m + 1) (z :: xs) (z :: ys) - -private theorem boundedLex_append (P : List (ℕ × ℕ)) {m : ℕ} {x y : ℕ × ℕ} (rest ext : List (ℕ × ℕ)) - (hxy : PairLt x y) (hlen : P.length < m) : - BoundedLex m (P ++ (x :: ext)) (P ++ (y :: rest)) := by - induction P generalizing m with - | nil => - rcases m with _ | m' - · omega - · exact BoundedLex.head hxy - | cons z P' ih => - rcases m with _ | m' - · simp at hlen - · simp only [List.cons_append] - exact BoundedLex.cons (ih (by simp at hlen; omega)) - -private theorem boundedLex_acc_snd (m a : ℕ) - (ih_m : ∀ xs, Acc (BoundedLex m) xs) - (ih_a : ∀ a' < a, ∀ b ys, Acc (BoundedLex (m + 1)) ((a', b) :: ys)) - (n : ℕ) : - ∀ b ≤ n, ∀ ys, Acc (BoundedLex (m + 1)) ((a, b) :: ys) := by - induction n with - | zero => - intro b hb ys - have hb0 : b = 0 := by omega - subst hb0 - induction (ih_m ys) with - | intro ys _ ih_ys => - refine Acc.intro ((a, 0) :: ys) (fun zs h => ?_) - cases h with - | @head _ x _ xs _ hlt => - rcases x with ⟨a', b'⟩ - rcases hlt with ha' | ⟨rfl, hb'⟩ - · exact ih_a a' ha' b' xs - · dsimp at hb'; omega - | cons hsub => exact ih_ys _ hsub - | succ n ih_n => - intro b hb ys - rcases Nat.of_le_succ hb with hle | rfl - · exact ih_n b hle ys - · induction (ih_m ys) with - | intro ys _ ih_ys => - refine Acc.intro ((a, n + 1) :: ys) (fun zs h => ?_) - cases h with - | @head _ x _ xs _ hlt => - rcases x with ⟨a', b'⟩ - rcases hlt with ha' | ⟨rfl, hb'⟩ - · exact ih_a a' ha' b' xs - · dsimp at hb'; exact ih_n b' (by omega) xs - | cons hsub => exact ih_ys _ hsub - -private theorem boundedLex_acc_fst (m : ℕ) (ih_m : ∀ xs, Acc (BoundedLex m) xs) (n : ℕ) : - ∀ a ≤ n, ∀ b ys, Acc (BoundedLex (m + 1)) ((a, b) :: ys) := by - induction n with - | zero => - intro a ha b ys - have ha0 : a = 0 := by omega - subst ha0 - exact boundedLex_acc_snd m 0 ih_m (fun _ hlt => by omega) b b (Nat.le_refl b) ys - | succ n ih_n => - intro a ha b ys - rcases Nat.of_le_succ ha with hle | rfl - · exact ih_n a hle b ys - · exact boundedLex_acc_snd m (n + 1) ih_m (fun a' hlt => ih_n a' (by omega)) b b (Nat.le_refl b) - ys - -private theorem boundedLex_acc (m : ℕ) (xs : List (ℕ × ℕ)) : Acc (BoundedLex m) xs := by - induction m generalizing xs with - | zero => exact Acc.intro xs (fun _ h => nomatch h) - | succ m ih_m => - rcases xs with _ | ⟨⟨a, b⟩, ys⟩ - · exact Acc.intro [] (fun _ h => nomatch h) - · exact boundedLex_acc_fst m ih_m a a (Nat.le_refl a) b ys - -/-! ## Bounce Lemmas for `CL` and `AL` -/ - -private theorem bounce_len (R3 : List (ℕ × ℕ)) (n : ℕ) : - ∀ (L : List ℕ), 2 * sumL L + L.length ≤ n → - (∀ (k0 : ℕ) (K_acc : List ℕ), - (∃ cfg_, ((tok_CL ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ - (∃ K_out L_out, ((tok_CL ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ - tok_BR K_out R3 (0 :: L_out)) ∧ - (∃ ext, scores K_out = scores K_acc ++ ext) ∧ - (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∨ - (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + 1 + wtL L ∧ - (k0 ≠ 0 → ∃ d ext, scores K_out = scores K_acc ++ ((K_acc.length, d) :: ext)))))) ∧ - (∀ (K_acc : List ℕ), - (∃ cfg_, ((tok_AL (2 :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ - (∃ K_out L_out, ((tok_AL (2 :: K_acc) R3 L) [target]⊢⁺ tok_BR K_out R3 (0 :: L_out)) ∧ - countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∧ - (∃ ext, scores K_out = scores K_acc ++ ext))) := by - induction n with - | zero => - intro L hlen - rcases L with _ | ⟨a, L1⟩ - · refine ⟨fun k0 K_acc => ?_, fun K_acc => ?_⟩ - · rcases k0 with _ | k' - · refine Or.inr ⟨K_acc, [1], tok_CL_1_nil_9 K_acc R3, ⟨[], by simp⟩, Or.inl (by simp)⟩ - · rcases k' with _ | m - · refine Or.inr ⟨0 :: K_acc, [0, 1], tok_CL_add2_nil_21 0 K_acc R3, ⟨[(K_acc.length, 0)], - by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨0, [], by simp⟩⟩⟩ - · rcases m with _ | m' - · refine Or.inr ⟨1 :: K_acc, [0, 1], tok_CL_add2_nil_21 1 K_acc R3, ⟨[], by simp⟩, - Or.inl (by simp)⟩ - · refine Or.inr ⟨(m' + 2) :: K_acc, [0, 1], tok_CL_add2_nil_21 (m' + 2) K_acc R3, - ⟨[(K_acc.length, m' + 2)], by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨m' + 2, [], - by simp⟩⟩⟩ - · exact Or.inr ⟨K_acc, [1], tok_AL_nil_8 K_acc R3, by simp, ⟨[], by simp⟩⟩ - · simp at hlen - | succ n ih_n => - intro L hlen - rcases Nat.of_le_succ hlen with hle | heq - · exact ih_n L hle - · refine ⟨fun k0 K_acc => ?_, fun K_acc => ?_⟩ - · rcases L with _ | ⟨a, L1⟩ - · simp at heq - · rcases a with _ | _ | a' - · have hstep1 := tok_CL_zero (k0 + 1) K_acc R3 L1 - rcases (ih_n L1 (by simp at heq ⊢; omega)).1 (k0 + 2) K_acc with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hext, hbr⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, hext, ?_⟩ - rcases hbr with hlt | ⟨hle, hd⟩ - · exact Or.inl (by simpa using hlt) - · exact Or.inr ⟨by simpa using hle, fun _ => hd (by omega)⟩ - · rcases L1 with _ | ⟨b, L2⟩ - · rcases k0 with _ | k' - · refine Or.inr ⟨1 :: K_acc, [0, 0, 1], tok_CL_1_nil_33 1 K_acc R3, ⟨[], by simp⟩, - Or.inl (by simp)⟩ - · refine Or.inr ⟨(k' + 2) :: K_acc, [0, 0, 1], tok_CL_1_nil_33 (k' + 2) K_acc R3, - ⟨[(K_acc.length, k' + 2)], by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨k' + 2, [], - by simp⟩⟩⟩ - · rcases b with _ | _ | b' - · have hstep1 := tok_CL_1_0 (k0 + 1) K_acc R3 L2 - rcases (ih_n L2 (by simp at heq ⊢; omega)).1 0 ((k0 + 4) :: K_acc) with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · have hsc' : scores K_out = scores K_acc ++ ((K_acc.length, k0 + 4) :: ext) := by - simpa [scores_add2 (k0 + 2) K_acc, List.append_assoc] using hsc - refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ⟨(K_acc.length, - k0 + 4) :: ext, hsc'⟩, ?_⟩ - have hwt : wtL ((0 + 1) :: 0 :: L2) = 1 + wtL L2 := by simp - have hcnt : countNonOne ((k0 + 4) :: K_acc) = 1 + countNonOne K_acc := - countNonOne_add2 (k0 + 2) K_acc - rcases hbr with hlt | ⟨hle, _⟩ - · exact Or.inl (by omega) - · exact Or.inr ⟨by omega, fun _ => ⟨k0 + 4, ext, hsc'⟩⟩ - · rcases L2 with _ | ⟨c, L3⟩ - · have hstep := tok_CL_1_1_nil_25 (k0 + 1) K_acc R3 - have hcnt := countNonOne_cons_le (k0 + 1) K_acc - refine Or.inr ⟨(k0 + 1) :: K_acc, [0, 1], hstep, scores_cons_ext (k0 + 1) K_acc, - Or.inl ?_⟩ - simp at hcnt ⊢; omega - · have hstep := tok_CL_1_1_cons_25 (k0 + 1) K_acc R3 c L3 - have hwt : wtL ((c + 2) :: L3) ≤ wtL ((0 + 1) :: (0 + 1) :: c :: L3) := - wtL_1_1_cons c L3 - rcases k0 with _ | k' - · refine Or.inr ⟨1 :: K_acc, 0 :: (c + 2) :: L3, hstep, ⟨[], by simp⟩, Or.inl ?_⟩ - simp only [countNonOne_one, wtL_zero_cons]; omega - · refine Or.inr ⟨(k' + 2) :: K_acc, 0 :: (c + 2) :: L3, hstep, ⟨[(K_acc.length, - k' + 2)], by simp⟩, Or.inr ⟨?_, fun _ => ⟨k' + 2, [], by simp⟩⟩⟩ - simp only [countNonOne_add2, wtL_zero_cons]; omega - · have hstep1 := tok_CL_1_add2 (k0 + 1) K_acc R3 b' L2 - rcases (ih_n (b' :: L2) (by simp at heq ⊢; omega)).2 (1 :: (k0 + 1) :: K_acc) with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · obtain ⟨ext0, hsc0⟩ := scores_cons_ext (k0 + 1) K_acc - have hcnt := countNonOne_cons_le (k0 + 1) K_acc - have hwt : wtL (b' :: L2) + 2 ≤ wtL ((0 + 1) :: (b' + 1 + 1) :: L2) := - wtL_1_add2 b' L2 - refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ⟨ext0 ++ ext, - by simp [hsc, hsc0, List.append_assoc]⟩, Or.inl ?_⟩ - simp only [countNonOne_one] at hle - omega - · exact Or.inl (tok_CL_add2_halts ((k0 + 1) :: K_acc) R3 a' L1) - · rcases L with _ | ⟨a, L1⟩ - · simp at heq - · rcases a with _ | a' - · have hstep1 := tok_AL_zero K_acc R3 L1 - rcases (ih_n L1 (by simp at heq ⊢; omega)).2 (1 :: K_acc) with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · exact Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, by simpa using hle, ⟨ext, - by simpa using hsc⟩⟩ - · rcases L1 with _ | ⟨b, L2⟩ - · rcases a' with _ | a'' - · exact Or.inr ⟨1 :: K_acc, [0, 0, 1], tok_AL_1_nil_28 K_acc R3, by simp, ⟨[], - by simp⟩⟩ - · have hstep1 := tok_AL_succ K_acc R3 (a'' + 1) [] - rcases (ih_n [a'' + 1] (by simp at heq ⊢; omega)).1 0 (1 :: K_acc) with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ?_, ⟨ext, - by simpa using hsc⟩⟩ - rcases hbr with hlt | ⟨hle, _⟩ - · simp at hlt ⊢; omega - · simp at hle ⊢; omega - · have hstep1 := tok_AL_succ K_acc R3 a' (b :: L2) - rcases (ih_n (a' :: b :: L2) (by simp at heq ⊢; omega)).1 0 (1 :: K_acc) with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ?_, ⟨ext, - by simpa using hsc⟩⟩ - rcases hbr with hlt | ⟨hle, _⟩ - · simp at hlt ⊢; omega - · simp at hle ⊢; omega - -private theorem bounce_CL (R3 : List (ℕ × ℕ)) (k0 : ℕ) (K_acc : List ℕ) (L : List ℕ) : - (∃ cfg_, ((tok_CL ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ - (∃ K_out L_out, ((tok_CL ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ tok_BR K_out R3 (0 :: L_out)) ∧ - (∃ ext, scores K_out = scores K_acc ++ ext) ∧ - (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∨ - (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + 1 + wtL L ∧ - (k0 ≠ 0 → ∃ d ext, scores K_out = scores K_acc ++ ((K_acc.length, d) :: ext))))) := - (bounce_len R3 (2 * sumL L + L.length) L (Nat.le_refl _)).1 k0 K_acc - -private theorem bounce_AL (R3 : List (ℕ × ℕ)) (K_acc : List ℕ) (L : List ℕ) : - (∃ cfg_, ((tok_AL (2 :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ - (∃ K_out L_out, ((tok_AL (2 :: K_acc) R3 L) [target]⊢⁺ tok_BR K_out R3 (0 :: L_out)) ∧ - countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∧ - (∃ ext, scores K_out = scores K_acc ++ ext)) := - (bounce_len R3 (2 * sumL L + L.length) L (Nat.le_refl _)).2 K_acc - -/-! ## Token System Termination -/ - -private theorem bl_step_macro_len (R3 : List (ℕ × ℕ)) (n : ℕ) : - ∀ (K : List ℕ), K.length ≤ n → ∀ (L : List ℕ), - (∃ cfg_, ((tok_BR K R3 (0 :: L)) [target]⊢* cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone)) ∨ - (∃ K' L', ((tok_BR K R3 (0 :: L)) [target]⊢⁺ tok_BR K' R3 (0 :: L')) ∧ - countNonOne K' + wtL L' < countNonOne K + wtL L) ∨ - (∃ K' L' P x y rest ext, ((tok_BR K R3 (0 :: L)) [target]⊢⁺ tok_BR K' R3 (0 :: L')) ∧ - countNonOne K' + wtL L' = countNonOne K + wtL L ∧ PairLt x y ∧ - scores K = P ++ (y :: rest) ∧ scores K' = P ++ (x :: ext)) := by - induction n with - | zero => - intro K hlen L - cases K with - | nil => - refine Or.inl ⟨cfg_BR_n_n ((0 :: L).map (fun x => (x, 0))) R3, ⟨0, ?_⟩, - Or.inl ⟨.BR_n_n, (0 :: L).map (fun x => (x, 0)), R3, rfl⟩⟩ - unfold tok_BR cfg_BR_n_n - rw [encTokens_nil, encLeftNat_eq] - rfl - | cons _ _ => simp at hlen - | succ n ih_n => - intro K hlen L - rcases K with _ | ⟨k1, K1⟩ - · refine Or.inl ⟨cfg_BR_n_n ((0 :: L).map (fun x => (x, 0))) R3, ⟨0, ?_⟩, - Or.inl ⟨.BR_n_n, (0 :: L).map (fun x => (x, 0)), R3, rfl⟩⟩ - unfold tok_BR cfg_BR_n_n - rw [encTokens_nil, encLeftNat_eq] - rfl - · rcases k1 with _ | _ | _ | k' - · rcases K1 with _ | ⟨k2, K2⟩ - · exact Or.inl ⟨cfg_CL_n_n ((0 :: L).map (fun x => (x, 0))) (bumpPairHead R3), - ReachesPlus.to_star (tok_BR_exit_zero R3 (0 :: L)), - Or.inl ⟨.CL_n_n, (0 :: L).map (fun x => (x, 0)), bumpPairHead R3, rfl⟩⟩ - · have hstep1 := - ReachesPlus.trans (tok_BR_0_cons k2 K2 R3 (0 :: L)) (tok_CL_zero (k2 + 1) K2 R3 L) - rcases bounce_CL R3 (k2 + 2) K2 L with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, _, hbr⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans hstep1 hstep2), Or.inr hhalt⟩ - · have hstep := ReachesPlus.trans hstep1 hstep2 - rcases hbr with hlt | ⟨hle, hd⟩ - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - have hcnt := le_countNonOne_cons k2 K2 - simp only [countNonOne_zero]; omega - · rcases k2 with _ | _ | k2' - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [countNonOne_zero]; omega - · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [Nat.zero_add, countNonOne_zero, countNonOne_one]; omega - · obtain ⟨d, ext, hsc_out⟩ := hd (by omega) - refine Or.inr (Or.inr ⟨K_out, L_out, scores K2, (K2.length, d), ((1 :: K2).length, - 0), - [], ext, hstep, by simp only [Nat.zero_add, countNonOne_zero, - countNonOne_one]; omega, - Or.inl (by simp), by simp, hsc_out⟩) - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [countNonOne_zero, countNonOne_add2]; omega - · have hstep1 := tok_BR_1 K1 R3 (0 :: L) - rcases ih_n K1 (by simp at hlen; omega) (0 :: L) with - ⟨cfg_, hstep2, hsys⟩ | - ⟨K', L', hstep2, hlt⟩ | - ⟨K', L', P, x, y, rest, ext, hstep2, heq, hxy, hsc1, hsc2⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep1 hstep2), hsys⟩ - · refine Or.inr (Or.inl ⟨K', L', ReachesPlus.trans hstep1 hstep2, ?_⟩) - simpa using hlt - · refine Or.inr (Or.inr ⟨K', L', P, x, y, rest, ext, ReachesPlus.trans hstep1 hstep2, - by simpa using heq, hxy, by simpa using hsc1, hsc2⟩) - · have hstep1 := tok_BR_2 K1 R3 L - rcases L with _ | ⟨a, L1⟩ - · refine Or.inr (Or.inl ⟨K1, [1], hstep1, ?_⟩) - simp - · have hwt1 : wtL (1 :: a :: L1) = 1 + wtL (a :: L1) := by simp - rcases ih_n K1 (by simp at hlen; omega) (1 :: a :: L1) with - ⟨cfg_, hstep2, hsys⟩ | - ⟨K', L', hstep2, hlt⟩ | - ⟨K', L', P, x, y, rest, ext, hstep2, heq, hxy, hsc1, hsc2⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep1 hstep2), hsys⟩ - · refine Or.inr (Or.inl ⟨K', L', ReachesPlus.trans hstep1 hstep2, ?_⟩) - simp only [countNonOne_add2 0 K1]; omega - · refine Or.inr (Or.inr ⟨K', L', P, x, y, rest ++ [(K1.length, 2)], ext, - ReachesPlus.trans hstep1 hstep2, by simp only [countNonOne_add2 0 K1]; omega, - hxy, by simp [hsc1, List.append_assoc], hsc2⟩) - · have hstep1 := - ReachesPlus.trans (tok_BR_add3 k' K1 R3 (0 :: L)) (tok_AL_zero (k' :: K1) R3 L) - rcases bounce_AL R3 (1 :: k' :: K1) L with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans hstep1 hstep2), Or.inr hhalt⟩ - · have hstep := ReachesPlus.trans hstep1 hstep2 - simp only [countNonOne_one, scores_one] at hle hsc - rcases k' with _ | _ | k'' - · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [countNonOne_zero, countNonOne_add2] at hlt' ⊢; omega - · refine Or.inr (Or.inr ⟨K_out, L_out, scores K1, (K1.length, 0), (K1.length, 3), - [], ext, hstep, by simp only [countNonOne_zero, countNonOne_add2] at heq' ⊢; omega, - Or.inr ⟨rfl, by simp⟩, by simp, - by simpa [List.append_assoc] using hsc⟩) - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [Nat.zero_add, countNonOne_one, countNonOne_add2] at hle ⊢; omega - · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [countNonOne_add2] at hlt' ⊢; omega - · refine Or.inr (Or.inr ⟨K_out, L_out, scores K1, (K1.length, k'' + 2), (K1.length, - k'' + 5), - [], ext, hstep, by simp only [countNonOne_add2] at heq' ⊢; omega, - Or.inr ⟨rfl, by simp⟩, by simp, - by simpa [List.append_assoc] using hsc⟩) - -private theorem bl_terminates_acc (R3 : List (ℕ × ℕ)) (m : ℕ) - (ih_m : ∀ (K : List ℕ) (L : List ℕ), - countNonOne K + wtL L < m → - ∃ cfg_, ((tok_BR K R3 (0 :: L)) [target]⊢* cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone)) - (S : List (ℕ × ℕ)) (hacc : Acc (BoundedLex m) S) : - ∀ (K : List ℕ) (L : List ℕ), - scores K = S → countNonOne K + wtL L = m → - ∃ cfg_, ((tok_BR K R3 (0 :: L)) [target]⊢* cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - induction hacc with - | intro S _ ih_acc => - intro K L hS hm - rcases bl_step_macro_len R3 K.length K (Nat.le_refl K.length) L with - ⟨cfg_, hstep, hsys⟩ | - ⟨K', L', hstep, hlt⟩ | - ⟨K', L', P, x, y, rest, ext, hstep, heq, hxy, hsc1, hsc2⟩ - · exact ⟨cfg_, hstep, hsys⟩ - · obtain ⟨cfg_, hstep2, hsys⟩ := ih_m K' L' (by omega) - exact ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep hstep2), hsys⟩ - · have hlenP : P.length < m := by - have hlenK := scores_length K - rw [hsc1, List.length_append, List.length_cons] at hlenK - omega - have hlex : BoundedLex m (scores K') S := by - rw [← hS, hsc1, hsc2] - exact boundedLex_append P rest ext hxy hlenP - obtain ⟨cfg_, hstep2, hsys⟩ := ih_acc (scores K') hlex K' L' rfl (by omega) - exact ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep hstep2), hsys⟩ - -private theorem bl_terminates_le (R3 : List (ℕ × ℕ)) (n : ℕ) : - ∀ (m : ℕ), m ≤ n → ∀ (K : List ℕ) (L : List ℕ), - countNonOne K + wtL L = m → - ∃ cfg_, ((tok_BR K R3 (0 :: L)) [target]⊢* cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - induction n with - | zero => - intro m hm K L hM - have hm0 : m = 0 := by omega - subst hm0 - exact bl_terminates_acc R3 0 (fun _ _ hlt => by omega) (scores K) (boundedLex_acc 0 (scores K)) - K L rfl hM - | succ n ih_n => - intro m hm K L hM - rcases Nat.of_le_succ hm with hle | rfl - · exact ih_n m hle K L hM - · refine bl_terminates_acc R3 (n + 1) (fun K' L' hlt => ?_) - (scores K) (boundedLex_acc (n + 1) (scores K)) K L rfl hM - exact ih_n (countNonOne K' + wtL L') (by omega) K' L' rfl - -private theorem tok_AL_2_0_closed (R3 : List (ℕ × ℕ)) (L : List ℕ) : - ∃ cfg_, ((tok_AL [2, 0] R3 L) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases bounce_AL R3 [0] L with ⟨cfg_, hstep, hhalt⟩ | ⟨K_out, L_out, hstep, _, _⟩ - · exact ⟨cfg_, hstep, Or.inr hhalt⟩ - · obtain ⟨cfg_, hstep2, hsys⟩ := bl_terminates_le R3 (countNonOne K_out + wtL L_out) - (countNonOne K_out + wtL L_out) (Nat.le_refl _) K_out L_out rfl - exact ⟨cfg_, ReachesPlus.trans_star hstep hstep2, hsys⟩ - -private theorem tok_CL_1_0_closed (R3 : List (ℕ × ℕ)) (L : List ℕ) : - ∃ cfg_, ((tok_CL [1, 0] R3 L) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases bounce_CL R3 0 [0] L with ⟨cfg_, hstep, hhalt⟩ | ⟨K_out, L_out, hstep, _, _⟩ - · exact ⟨cfg_, hstep, Or.inr hhalt⟩ - · obtain ⟨cfg_, hstep2, hsys⟩ := bl_terminates_le R3 (countNonOne K_out + wtL L_out) - (countNonOne K_out + wtL L_out) (Nat.le_refl _) K_out L_out rfl - exact ⟨cfg_, ReachesPlus.trans_star hstep hstep2, hsys⟩ - -/-! ## Mode Closure Theorems -/ - -private theorem mode_CL_n_n_closed (L R : List (ℕ × ℕ)) : - ∃ cfg_, ((cfg_CL_n_n L R) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases L with _ | ⟨⟨a1, b2⟩, L3⟩ - · refine ⟨cfg_BR_n_n [(0, 0)] (bumpPairHead R), ?_, - Or.inl ⟨.BR_n_n, [(0, 0)], bumpPairHead R, rfl⟩⟩ - unfold cfg_CL_n_n cfg_BR_n_n - rw [encLeft_d0_s0 [], ← encRight_cons_one R] - execute 2 - · rcases a1 with _ | a5 - · refine ⟨cfg_CL_n_n L3 (bumpPairHead (bumpPairHead R)), ?_, - Or.inl ⟨.CL_n_n, L3, bumpPairHead (bumpPairHead R), rfl⟩⟩ - unfold cfg_CL_n_n - rw [encLeft_mod1 0 b2 L3, Nat.mod_one b2, encLeft_d0_s0 L3, - ← encRight_cons_one (bumpPairHead R), ← encRight_cons_one R] - execute 2 - · rcases a5 with _ | a14 - · rcases L3 with _ | ⟨⟨a6, b7⟩, L8⟩ - · refine ⟨cfg_BR_n_n [(0, 0)] ((0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R))), ?_, - Or.inl ⟨.BR_n_n, [(0, 0)], (0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R)), rfl⟩⟩ - unfold cfg_CL_n_n cfg_BR_n_n - rw [encLeft_mod1 1 b2 [], Nat.mod_one b2, encLeft_d1_s0 [], encLeft_d0_s0 [], - encRight_d0_s0 (bumpPairHead (bumpPairHead (bumpPairHead R))), - ← encRight_cons_one (bumpPairHead (bumpPairHead R)), - ← encRight_cons_one (bumpPairHead R), ← encRight_cons_one R] - execute 6 - · rcases a6 with _ | a10 - · refine ⟨cfg_CL_n_n L8 ((0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R))), ?_, - Or.inl ⟨.CL_n_n, L8, (0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R)), rfl⟩⟩ - unfold cfg_CL_n_n - rw [encLeft_mod1 1 b2 ((0, b7) :: L8), Nat.mod_one b2, encLeft_d1_s0 ((0, b7) :: L8), - encLeft_mod1 0 b7 L8, Nat.mod_one b7, encLeft_d0_s0 L8, - encRight_d0_s0 (bumpPairHead (bumpPairHead (bumpPairHead R))), - ← encRight_cons_one (bumpPairHead (bumpPairHead R)), - ← encRight_cons_one (bumpPairHead R), ← encRight_cons_one R] - execute 5 - · rcases a10 with _ | a11 - · refine ⟨cfg_BR_n_n (bumpPairHead L8) ((1, 0) :: (0, 0) :: R), ?_, - Or.inl ⟨.BR_n_n, bumpPairHead L8, (1, 0) :: (0, 0) :: R, rfl⟩⟩ - unfold cfg_CL_n_n cfg_BR_n_n - rw [encLeft_mod1 1 b2 ((1, b7) :: L8), Nat.mod_one b2, - encLeft_d1_s0 ((1, b7) :: L8), encLeft_mod1 1 b7 L8, Nat.mod_one b7, - encLeft_d1_s0 L8, ← encLeft_cons_one L8, encRight_d1_s0 ((0, 0) :: R), - encRight_d0_s0 R] - execute 16 - · refine ⟨cfg_AL_n_n ((a11, 0) :: L8) ((1, 0) :: (0, 0) :: R), ?_, - Or.inl ⟨.AL_n_n, (a11, 0) :: L8, (1, 0) :: (0, 0) :: R, rfl⟩⟩ - unfold cfg_CL_n_n cfg_AL_n_n - rw [encLeft_mod1 1 b2 ((a11 + 2, b7) :: L8), Nat.mod_one b2, - encLeft_d1_s0 ((a11 + 2, b7) :: L8), encLeft_mod1 (a11 + 2) b7 L8, - Nat.mod_one b7, encLeft_succ (a11 + 1) 0 L8, encLeft_succ a11 0 L8, - encLeft_run_s0 a11 L8, encRight_d1_s0 ((0, 0) :: R), encRight_d0_s0 R] - execute 15 - · refine ⟨(encLeft ((a14, 0) :: L3)) <{{F}} ((1 : Fin 2) >> (1 : Fin 2) >> encRight R), ?_, - Or.inr (by rw [encLeft_run_s0]; bb_halt)⟩ - unfold cfg_CL_n_n - rw [encLeft_mod1 (a14 + 2) b2 L3, Nat.mod_one b2, encLeft_succ (a14 + 1) 0 L3, - encLeft_succ a14 0 L3] - execute 2 - -private theorem mode_BR_n_n_closed (L R : List (ℕ × ℕ)) : - ∃ cfg_, ((cfg_BR_n_n L R) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases R with _ | ⟨⟨r1, b2⟩, R3⟩ - · refine ⟨cfg_CL_n_n L [(0, 0)], ?_, Or.inl ⟨.CL_n_n, L, [(0, 0)], rfl⟩⟩ - unfold cfg_BR_n_n cfg_CL_n_n - rw [encRight_d0_s0 []] - execute 1 - · rcases r1 with _ | r5 - · refine ⟨cfg_BR_n_n ((0, 0) :: L) R3, ?_, Or.inl ⟨.BR_n_n, (0, 0) :: L, R3, rfl⟩⟩ - unfold cfg_BR_n_n - rw [encRight_mod1 0 b2 R3, Nat.mod_one b2, encRight_d0_s0 R3, encLeft_d0_s0 L] - execute 2 - · refine ⟨cfg_AR_0_n L ((r5, 0) :: R3), ?_, Or.inl ⟨.AR_0_n, L, (r5, 0) :: R3, rfl⟩⟩ - unfold cfg_BR_n_n cfg_AR_0_n - rw [encRight_mod1 (r5 + 1) b2 R3, Nat.mod_one b2, encRight_succ r5 0 R3, - encRight_run_s0 r5 R3] - execute 1 - -private theorem mode_AR_0_n_closed (L R : List (ℕ × ℕ)) : - ∃ cfg_, ((cfg_AR_0_n L R) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases R with _ | ⟨⟨r1, b2⟩, R3⟩ - · refine ⟨cfg_CL_n_n L [(2, 0)], ?_, Or.inl ⟨.CL_n_n, L, [(2, 0)], rfl⟩⟩ - unfold cfg_AR_0_n cfg_CL_n_n - rw [encRight_succ 1 0 [], encRight_d1_s0 []] - execute 4 - · rcases r1 with _ | _ | r5 - · refine ⟨cfg_BR_n_n ((0, 0) :: bumpPairHead L) R3, ?_, Or.inl ⟨.BR_n_n, (0, - 0) :: bumpPairHead L, R3, rfl⟩⟩ - unfold cfg_AR_0_n cfg_BR_n_n - rw [encRight_mod1 0 b2 R3, Nat.mod_one b2, encRight_d0_s0 R3, encLeft_d0_s0 (bumpPairHead L), - ← encLeft_cons_one L] - execute 6 - · obtain ⟨cfg_, hstep2, hsys⟩ := tok_AL_2_0_closed R3 (L.map Prod.fst) - refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ - unfold cfg_AR_0_n tok_AL - rw [encRight_mod1 1 b2 R3, Nat.mod_one b2, encRight_d1_s0 R3, encLeft_eq_nat L, - encTokens_succ, encTokens_succ, encTokens_zero, encTokens_zero, encTokens_nil] - texecute 4 - · refine ⟨cfg_AL_n_n L ((1, 0) :: (r5, 0) :: R3), ?_, - Or.inl ⟨.AL_n_n, L, (1, 0) :: (r5, 0) :: R3, rfl⟩⟩ - unfold cfg_AR_0_n cfg_AL_n_n - rw [encRight_mod1 (r5 + 2) b2 R3, Nat.mod_one b2, encRight_succ (r5 + 1) 0 R3, - encRight_succ r5 0 R3, encRight_run_s0 r5 R3, encRight_d1_s0 ((r5, 0) :: R3), - encRight_run_s0 r5 R3] - execute 4 - -private theorem mode_AL_n_n_closed (L R : List (ℕ × ℕ)) : - ∃ cfg_, ((cfg_AL_n_n L R) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases L with _ | ⟨⟨a1, b2⟩, L3⟩ - · refine ⟨cfg_BR_n_n [(0, 0)] R, ?_, Or.inl ⟨.BR_n_n, [(0, 0)], R, rfl⟩⟩ - unfold cfg_AL_n_n cfg_BR_n_n - rw [encLeft_d0_s0 []] - execute 1 - · rcases R with _ | ⟨⟨r1, b4⟩, R3⟩ - · rcases a1 with _ | a5 - · refine ⟨cfg_BR_n_n (bumpPairHead L3) [(0, 0)], ?_, - Or.inl ⟨.BR_n_n, bumpPairHead L3, [(0, 0)], rfl⟩⟩ - unfold cfg_AL_n_n cfg_BR_n_n - rw [encLeft_mod1 0 b2 L3, Nat.mod_one b2, encLeft_d0_s0 L3, ← encLeft_cons_one L3, - encRight_d0_s0 []] - execute 4 - · refine ⟨cfg_AL_n_n ((a5, 0) :: L3) [(0, 0)], ?_, - Or.inl ⟨.AL_n_n, (a5, 0) :: L3, [(0, 0)], rfl⟩⟩ - unfold cfg_AL_n_n - rw [encLeft_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encLeft_succ a5 0 L3, - encLeft_run_s0 a5 L3, encRight_d0_s0 []] - execute 3 - · rcases r1 with _ | r5 - · rcases a1 with _ | a5 - · obtain ⟨cfg_, hstep2, hsys⟩ := tok_AL_2_0_closed R3 (L3.map Prod.fst) - refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ - unfold cfg_AL_n_n tok_AL - rw [encLeft_mod1 0 b2 L3, Nat.mod_one b2, encLeft_d0_s0 L3, encRight_mod1 0 b4 R3, - Nat.mod_one b4, encRight_d0_s0 R3, encLeft_eq_nat L3, encTokens_succ, encTokens_succ, - encTokens_zero, encTokens_zero, encTokens_nil] - texecute 4 - · obtain ⟨cfg_, hstep2, hsys⟩ := tok_CL_1_0_closed R3 (a5 :: L3.map Prod.fst) - refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ - unfold cfg_AL_n_n tok_CL - rw [encLeft_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encLeft_succ a5 0 L3, - encLeft_run_s0 a5 L3, encRight_mod1 0 b4 R3, Nat.mod_one b4, encRight_d0_s0 R3, - encLeft_eq_nat L3, encTokens_succ, encTokens_zero, encTokens_zero, encTokens_nil] - change (((1 : Fin 2) >> encLeftNat (a5 :: List.map Prod.fst L3)) <{{A}} - ((1 : Fin 2) >> (0 : Fin 2) >> encRight R3)) [target]⊢⁺ - ((encLeftNat (a5 :: List.map Prod.fst L3)) <{{C}} - ((1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> encRight R3)) - texecute 3 - · rcases a1 with _ | a5 - · refine ⟨cfg_AL_n_n L3 ((1, 0) :: (r5, 0) :: R3), ?_, - Or.inl ⟨.AL_n_n, L3, (1, 0) :: (r5, 0) :: R3, rfl⟩⟩ - unfold cfg_AL_n_n - rw [encLeft_mod1 0 b2 L3, Nat.mod_one b2, encLeft_d0_s0 L3, - encRight_mod1 (r5 + 1) b4 R3, Nat.mod_one b4, encRight_succ r5 0 R3, - encRight_run_s0 r5 R3, encRight_d1_s0 ((r5, 0) :: R3), encRight_run_s0 r5 R3] - execute 4 - · refine ⟨cfg_CL_n_n ((a5, 0) :: L3) ((0, 0) :: (r5, 0) :: R3), ?_, - Or.inl ⟨.CL_n_n, (a5, 0) :: L3, (0, 0) :: (r5, 0) :: R3, rfl⟩⟩ - unfold cfg_AL_n_n cfg_CL_n_n - rw [encLeft_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encLeft_succ a5 0 L3, - encLeft_run_s0 a5 L3, encRight_mod1 (r5 + 1) b4 R3, Nat.mod_one b4, - encRight_succ r5 0 R3, encRight_run_s0 r5 R3, encRight_d0_s0 ((r5, 0) :: R3), - encRight_run_s0 r5 R3] - execute 3 - -private theorem stack_system_closed (cfg : Cfg (Fin 2) (Fin 6)) (h : IsInStackSystem cfg) : - ∃ cfg_, (cfg [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases h with ⟨m, L, R, rfl⟩ - cases m with - | CL_n_n => exact mode_CL_n_n_closed L R - | BR_n_n => exact mode_BR_n_n_closed L R - | AR_0_n => exact mode_AR_0_n_closed L R - | AL_n_n => exact mode_AL_n_n_closed L R +local macro "execute" n:num : tactic => `(tactic| ( + iterate $n step + finish)) private theorem init_reaches_nontrivial : - (init []) [target]⊢⁺ evalStackCfg .AL_n_n [(0, 0), (0, 0)] [(1, 0)] := by - have hL : encLeft [(0, 0), (0, 0)] = - (1 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default := rfl - have hR : encRight [(1, 0)] = (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default := rfl - dsimp only [evalStackCfg, cfg_AL_n_n] - rw [hL, hR] + ReachesPlus target (init []) + (closedStackSystem.evalStackCfg StackMode.DR_n_n [(0, 0), (0, 0)] [(1, 0)]) := by + have htarget : closedStackSystem.evalStackCfg StackMode.DR_n_n [(0, 0), (0, 0)] [(1, 0)] = + ((1 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default) <{{A}} + ((1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default) := by + rfl + rw [htarget] execute 7 -private theorem step_BR_transfer (z : ℕ × ℕ) (L R : List (ℕ × ℕ)) : - (evalStackCfg .BR_n_n L ((0, 0) :: z :: R)) [target]⊢⁺ - evalStackCfg .BR_n_n ((0, 0) :: L) (z :: R) := by - dsimp only [evalStackCfg, cfg_BR_n_n] - rw [encRight_d0_s0 (z :: R), encLeft_d0_s0 L] - execute 2 - -private theorem encLeft_head (a b : ℕ) (L : List (ℕ × ℕ)) : - (encLeft ((a, b) :: L)).head = 1 := by - rw [encLeft_cons, show 1 * a + 1 = (1 * a + 0) + 1 by omega, list_pow_succ, List.cons_append] - simp only [ListBlank.append_cons, ListBlank.head_cons] - -private theorem encLeft_not_surjective : - ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ L : List (ℕ × ℕ), encLeft L ≠ t := by - refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ - intro L h - rcases L with _ | ⟨⟨a, b⟩, L'⟩ - · have h1 := congrArg (fun s => s.head) h - simp at h1 - · rw [encLeft_mod1] at h - have hb0 : b % 1 = 0 := Nat.mod_one b - rw [hb0, encLeft_run_s0] at h - rcases a with _ | a' - · rcases L' with _ | ⟨⟨a', b'⟩, L''⟩ - · have h2 := congrArg (fun s => s.tail.tail.tail.head) h - simp at h2 - · have h1 := congrArg (fun s => s.tail.tail.head) h - normalize_at h1 - rw [encLeft_head a' b' L''] at h1; contradiction - · have h1 := congrArg (fun s => s.tail.head) h - normalize_at h1 - contradiction - -private theorem encRight_head (a b : ℕ) (R : List (ℕ × ℕ)) : - (encRight ((a, b) :: R)).head = 1 := by - rw [encRight_cons, show 1 * a + 1 = (1 * a + 0) + 1 by omega, list_pow_succ, List.cons_append] - simp only [ListBlank.append_cons, ListBlank.head_cons] - -private theorem encRight_not_surjective : - ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ R : List (ℕ × ℕ), encRight R ≠ t := by - refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ - intro R h - rcases R with _ | ⟨⟨a, b⟩, R'⟩ - · have h1 := congrArg (fun s => s.head) h - simp at h1 - · rw [encRight_mod1] at h - have hb0 : b % 1 = 0 := Nat.mod_one b - rw [hb0, encRight_run_s0] at h - rcases a with _ | a' - · rcases R' with _ | ⟨⟨a', b'⟩, L''⟩ - · have h2 := congrArg (fun s => s.tail.tail.tail.head) h - simp at h2 - · have h1 := congrArg (fun s => s.tail.tail.head) h - normalize_at h1 - rw [encRight_head a' b' L''] at h1; contradiction - · have h1 := congrArg (fun s => s.tail.head) h - normalize_at h1 - contradiction - -private theorem valid_stack_modes : IsValidStackModes encLeft encRight evalStackCfg := by - intro m - cases m with - | CL_n_n => exact ⟨C, .id [], .id [], by decide, by decide, Or.inr (Or.inl (fun _ _ => rfl))⟩ - | BR_n_n => exact ⟨B, .id [], .id [], by decide, by decide, Or.inr (Or.inr (fun _ _ => rfl))⟩ - | AR_0_n => exact ⟨A, .id [0], .id [], by decide, by decide, Or.inr (Or.inr (fun _ _ => rfl))⟩ - | AL_n_n => exact ⟨A, .id [], .id [], by decide, by decide, Or.inr (Or.inl (fun _ _ => rfl))⟩ - - /-! ## Stack Reduction Witness -/ /-- `target` reduces to a closed 2nd-order digit-stack transition system. -/ -theorem has_stack_reduction : HasStackReduction target := by - refine ⟨StackMode, 1, 0, encLeft, encRight, evalStackCfg, IsInStackSystem, - Or.inl ⟨rfl, rfl⟩, rfl, rfl, - encLeft_head, encRight_head, encLeft_not_surjective, encRight_not_surjective, - ⟨1, 1, 1, 1, 1, 1, 1, 1, by decide, by decide, by decide, by decide, by decide, - by decide, by decide, by decide, by decide, by decide, - fun _ _ _ => rfl, fun _ _ _ => rfl⟩, - ⟨[.CL_n_n, .BR_n_n, .AR_0_n, .AL_n_n], by decide, by intro m; cases m <;> decide⟩, - valid_stack_modes, - fun _ => Iff.rfl, - fun m L R => ⟨m, L, R, rfl⟩, - ⟨.AL_n_n, [(0, 0), (0, 0)], [(1, 0)], init_reaches_nontrivial, - by decide, ⟨(1, 0), by decide, by decide⟩⟩, - Or.inr ⟨.BR_n_n, .BR_n_n, (0, 0), id, ((0, 0) :: ·), - fun _ => Nat.le_succ _, step_BR_transfer⟩, - stack_system_closed⟩ +theorem has_stack_reduction : HasStackReduction target := + HasStackReduction.of_closedSystem closedStackSystem StackMode.DR_n_n [(0, 0), (0, 0)] [(1, 0)] + init_reaches_nontrivial (by decide) ⟨(1, 0), by decide, by decide⟩ end BusyBeaver.M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.lean b/BusyBeaver/BB6/Accelerations/M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.lean index 422557a3..a388fc06 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.lean @@ -44,11 +44,10 @@ Restricting to the $R = []$ return section and contracting intermediate $E$ and chains (`runE`) eliminates both state $E$ and the right stack $R$, yielding a single-stack system $D_{\mathrm{HL}}(a, b, L) := D(a, b, L, [])$ starting at $D_{\mathrm{HL}}(1, 0, [])$. - ## Hardness *Hardness class:* Problem S2 — trigger **POW (bottom funnel $x+2 = 2^k$)**, growth power-law regime, -shield partial (`ValidStack391`: mode $D$ never halts). +shield partial (mode $D$ never halts). *Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously non-halting (clean race). @@ -62,7 +61,6 @@ in $10^5$ steps *Why it is hard:* rung-by-rung halving with carry on $\mathrm{List}(\mathbb N)$ See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean b/BusyBeaver/BB6/Accelerations/M_1RB1LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean index 69c8d3fd..ce728183 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB1LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB1LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean @@ -19,11 +19,10 @@ Each half-tape stack encodes unary blocks $1^{a + 1}$ separated by single zeros ordered from the tape head outward. Starting from `init []`, the machine enters a closed 2-mode (`D`, `FR`) 2nd-order digit-stack system in 3 raw steps. - ## Hardness *Hardness class:* Problem S5 — trigger **POW (Mersenne bottom rung $2^k-1$)**, growth —, shield -partial (`ValidStack549` kills the empty-stack halt). +partial (the empty-stack halt is unreachable). *Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously non-halting, slowly critical. @@ -36,7 +35,6 @@ $\approx0.05$ expected halts per decade; near-misses $4,13,61,65,252,513,1020,10 *Why it is hard:* the community's *Sweeper* re-measured; two-mode halving sweeper See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean b/BusyBeaver/BB6/Accelerations/M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean index 38926209..e8d03c91 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_HHH0LB.lean @@ -19,7 +19,6 @@ Each half-tape stack encodes unary blocks $1^{3a + 2}$ separated by single zeros tape head outward. Starting from `init []`, the machine enters a closed 2-mode (`SweepR`, `CarryD`) 2nd-order digit-stack system in 14 raw steps. - ## Hardness *Hardness class:* Wiki stack — trigger **era-recursive (3-case bottom-extension recurrence)**, @@ -29,14 +28,13 @@ $R$ + $L.\mathrm{last}=0$ refuted across eras). *Verdict (heuristic; community analysis, see the wiki page):* probviously non-halting (wiki cryptid). -*Hazard:* not quantified; perturbed all-even seeds halt in Era 2/3 (`rec_59_bottom_extension`) +*Hazard:* not quantified; perturbed all-even seeds halt in Era 2/3 (bottom extension recurrence) *Simulated horizon:* pumping test: 46 perturbed configurations, 0 halts in $10^5$ steps *Why it is hard:* exact 3-case composition theorem verified on all 1,024 stacks of weight $\le10$ See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.lean b/BusyBeaver/BB6/Accelerations/M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.lean index fee8e0b0..6e0bac83 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.lean @@ -38,7 +38,6 @@ BR((a + 3) :: L, R) -> BR((a + 1) :: bumpHead L, (tailWeight R + 1) :: R.tail) Start: A([2, 0], []), reached after 16 raw TM steps ``` - ## Hardness *Hardness class:* Problem S4 — trigger **POW**, growth mass-conserving sandpile, shield partial. @@ -54,7 +53,6 @@ class *Why it is hard:* see #660 See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.lean b/BusyBeaver/BB6/Accelerations/M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.lean index 08ca23b3..7609658e 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.lean @@ -42,11 +42,10 @@ Restricting to the Poincaré return section $R = []$ eliminates the right stack a single-stack transition system $C_{\mathrm{HL}}(a, L) := C(a, L, [])$ starting at $C_{\mathrm{HL}}(3, [0])$. - ## Hardness *Hardness class:* Problem S4 — trigger **POW**, growth mass-conserving sandpile, shield partial -(`ValidStack680` kills $C([],R)$; strict digit positivity at `mode_C`). +(the empty-left configuration $C([],R)$ is unreachable; strict digit positivity at mode $C$). *Verdict (heuristic, from exact accelerated simulation of the certified rules):* probviously non-halting. @@ -58,7 +57,6 @@ non-halting. *Why it is hard:* E1 pair of #480 See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.lean b/BusyBeaver/BB6/Accelerations/M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.lean index 73886ee8..57fc201a 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.lean @@ -57,7 +57,6 @@ whose right half-tape is `encRight0 R S`: the digit stack `S` encoded as usual b strong induction on the head digit shows that every inner configuration with all entries of `S` positive either halts or returns to the main system (`rule_C_zero_zero_cons`). - ## Hardness *Hardness class:* Problem S4 — trigger **POW**, growth mass-conserving sandpile, shield partial. @@ -72,7 +71,6 @@ non-halting. *Why it is hard:* see #660 See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean b/BusyBeaver/BB6/Accelerations/M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean index c2f1338b..adf3add0 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean @@ -6,6 +6,7 @@ module public import BusyBeaver.Basic public import BusyBeaver.BB6.Accelerations.Stack +public import BusyBeaver.BB6.Accelerations.M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA public import BusyBeaver.Bridge /-! @@ -19,12 +20,11 @@ wiki page of `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`). This machine is the transition table of `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` restarted from its state `C` and brought to tree normal form: reading its states `A`, `B`, `C`, `D`, `E`, `F` as the states `C`, `D`, `E`, `F`, `B`, `A` of that machine, the two transition tables coincide, so both -machines run the same closed pair-stack system. The proof below is the mechanical relabelling of the -proof in -[`1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`](./M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean); -only the blank-tape entry theorem `init_reaches_nontrivial` is specific to this start state. +machines run the same closed pair-stack system. The proof below transports the closed stack witness +of [`1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA`](./M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean) +via `ClosedStackSystem.relabel`; only the blank-tape entry theorem `init_reaches_nontrivial` is +specific to this start state. - ## Hardness *Hardness class:* Wiki stack — trigger **as #85 (same table, started from its state `C`)**, growth @@ -42,7 +42,6 @@ it exhibits the same probviously halting behaviour"). (12 raw steps) See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section @@ -50,6 +49,7 @@ See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. namespace BusyBeaver.M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH open SixState Turing Stack +open M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA /-- The `(6, 2)` Turing machine in `ConjectureMachines.Machine` form. -/ def machine : ConjectureMachines.Machine 6 2 := @@ -59,21 +59,20 @@ def machine : ConjectureMachines.Machine 6 2 := abbrev target : Machine (Fin 2) (Fin 6) := machine.toBB -/-! ## Local Step Tactics and Pair-Stack Encodings -/ +/-- State bijection from #85 (`1RB---_...`) to #285 (`1RB1RD_...`). -/ +def f : Fin 6 → Fin 6 := ![5, 4, 0, 1, 2, 3] -local macro "normalize" : tactic => `(tactic| ( - try simp only [ListBlank.append_cons, ListBlank.append_nil, - ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, - ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, - List.nil_append, List.cons_append, zeros_append_default, - Nat.mul_zero, Nat.mul_add, Nat.mul_one])) +/-- Transition table isomorphism between #85 and #285 under state relabelling `f`. -/ +theorem hM : ∀ (q : Fin 6) (a : Fin 2), + target (f q) a = + (M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.target q a).map fun ⟨q', Stmt.write b d⟩ => + ⟨q'.map f, Stmt.write b d⟩ := by + intro q a + fin_cases q <;> fin_cases a <;> rfl -local macro "normalize_at" h:ident : tactic => `(tactic| ( - try simp only [ListBlank.append_cons, ListBlank.append_nil, - ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, - ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, - List.nil_append, List.cons_append, zeros_append_default, - Nat.mul_zero, Nat.mul_add, Nat.mul_one] at $h:ident)) +/-- Transport the closed pair-stack system of #85 to `target` along `f`. -/ +def closedStackSystem : ClosedStackSystem target := + M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.closedStackSystem.relabel f hM local macro "step" : tactic => `(tactic| ( try refine ReachesPlus.to_star ?_ @@ -89,1089 +88,35 @@ local macro "step" : tactic => `(tactic| ( list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one])) -private def encRight : List (ℕ × ℕ) → ListBlank (Fin 2) - | [] => default - | (a, b) :: L => (encRight L <+ (([0] : List (Fin 2)) ^ (1 + b % 1))) <+ - (([1] : List (Fin 2)) ^ (1 * a + 1)) - -private def encLeft : List (ℕ × ℕ) → ListBlank (Fin 2) - | [] => default - | (d, b) :: R => (([1] : List (Fin 2)) ^ (1 * d + 1)) +> ((([0] : List (Fin 2)) ^ (1 + b % 1)) +> - encLeft R) - -@[simp] private theorem encRight_nil : encRight [] = default := rfl - -@[simp] private theorem encRight_cons (a b : ℕ) (L : List (ℕ × ℕ)) : - encRight ((a, b) :: L) = (encRight L <+ (([0] : List (Fin 2)) ^ (1 + b % 1))) <+ - (([1] : List (Fin 2)) ^ (1 * a + 1)) := rfl - -@[simp] private theorem encLeft_nil : encLeft [] = default := rfl - -@[simp] private theorem encLeft_cons (d b : ℕ) (R : List (ℕ × ℕ)) : - encLeft ((d, b) :: R) = (([1] : List (Fin 2)) ^ (1 * d + 1)) +> - ((([0] : List (Fin 2)) ^ (1 + b % 1)) +> encLeft R) := rfl - -private theorem encRight_mod1 (a b : ℕ) (L : List (ℕ × ℕ)) : - encRight ((a, b) :: L) = encRight ((a, b % 1) :: L) := by - simp only [encRight_cons, Nat.mod_mod] - -private theorem encRight_succ (a b : ℕ) (L : List (ℕ × ℕ)) : - encRight ((a + 1, b) :: L) = (1 : Fin 2) >> encRight ((a, b) :: L) := by - simp only [encRight_cons] - rw [show 1 * (a + 1) + 1 = 1 + (1 * a + 1) by omega, list_pow_add, ListBlank.append_assoc] - rfl - -private theorem encRight_d0_s0 (L : List (ℕ × ℕ)) : - encRight ((0, 0) :: L) = (1 : Fin 2) >> (0 : Fin 2) >> encRight L := rfl - -private theorem encRight_d1_s0 (L : List (ℕ × ℕ)) : - encRight ((1, 0) :: L) = (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> encRight L := rfl - -private theorem encRight_run_s0 (a : ℕ) (L : List (ℕ × ℕ)) : - encRight ((a, 0) :: L) = (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> - encRight L) := by - induction a with - | zero => rfl - | succ k ih => rw [encRight_succ, ih]; normalize - -private theorem encLeft_mod1 (a b : ℕ) (R : List (ℕ × ℕ)) : - encLeft ((a, b) :: R) = encLeft ((a, b % 1) :: R) := by - simp only [encLeft_cons, Nat.mod_mod] - -private theorem encLeft_succ (a b : ℕ) (R : List (ℕ × ℕ)) : - encLeft ((a + 1, b) :: R) = (1 : Fin 2) >> encLeft ((a, b) :: R) := by - simp only [encLeft_cons] - rw [show 1 * (a + 1) + 1 = 1 + (1 * a + 1) by omega, list_pow_add, ListBlank.append_assoc] - rfl - -private theorem encLeft_d0_s0 (R : List (ℕ × ℕ)) : - encLeft ((0, 0) :: R) = (1 : Fin 2) >> (0 : Fin 2) >> encLeft R := rfl - -private theorem encLeft_d1_s0 (R : List (ℕ × ℕ)) : - encLeft ((1, 0) :: R) = (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> encLeft R := rfl - -private theorem encLeft_run_s0 (a : ℕ) (R : List (ℕ × ℕ)) : - encLeft ((a, 0) :: R) = (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> - encLeft R) := by - induction a with - | zero => rfl - | succ k ih => rw [encLeft_succ, ih]; normalize - -@[simp] private theorem encRight_cons_one (L : List (ℕ × ℕ)) : - (1 : Fin 2) >> encRight L = encRight (bumpPairHead L) := by - rcases L with _ | ⟨⟨a, b⟩, L'⟩ - · simp [bumpPairHead, encRight] - · exact (encRight_succ a b L').symm - -@[simp] private theorem encLeft_cons_one (R : List (ℕ × ℕ)) : - (1 : Fin 2) >> encLeft R = encLeft (bumpPairHead R) := by - rcases R with _ | ⟨⟨a, b⟩, R'⟩ - · simp [bumpPairHead, encLeft] - · exact (encLeft_succ a b R').symm - local macro "finish" : tactic => `(tactic| ( refine ⟨0, ?_⟩ try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', - encLeft_nil, encRight_nil, ListBlank.append_cons, ListBlank.append_nil, - ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, - ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, - List.nil_append, List.cons_append, zeros_append_default, - Nat.mul_zero, Nat.mul_add, Nat.mul_one] - simp only [encLeft_cons_one, encRight_cons_one, multiStep_zero] - try rfl)) - -local macro "execute" n:num : tactic => `(tactic| ( - iterate $n step - finish)) - -private def cfg_AR_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := - (encLeft R) {{A}}> (encRight L) - -private def cfg_CL_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := - (encLeft R) <{{C}} (encRight L) - -private def cfg_BL_0_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := - (encLeft R) <{{B}} ([0] +> encRight L) - -private def cfg_BR_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := - (encLeft R) {{B}}> (encRight L) - -private inductive StackMode - | AR_n_n - | CL_n_n - | BL_0_n - | BR_n_n - deriving DecidableEq - -private def evalStackCfg : StackMode → List (ℕ × ℕ) → List (ℕ × ℕ) → Cfg (Fin 2) (Fin 6) - | .AR_n_n, L, R => cfg_AR_n_n R L - | .CL_n_n, L, R => cfg_CL_n_n R L - | .BL_0_n, L, R => cfg_BL_0_n R L - | .BR_n_n, L, R => cfg_BR_n_n R L - -private def IsInStackSystem (cfg : Cfg (Fin 2) (Fin 6)) : Prop := - ∃ m L R, cfg = evalStackCfg m L R - -/-! ## Inner Token System -/ - -private def encTokens : List ℕ → List (ℕ × ℕ) → ListBlank (Fin 2) - | [], R3 => encLeft R3 - | k :: K, R3 => (([1] : List (Fin 2)) ^ k) +> ((0 : Fin 2) >> encTokens K R3) - -@[simp] private theorem encTokens_nil (R3 : List (ℕ × ℕ)) : encTokens [] R3 = encLeft R3 := rfl - -@[simp] private theorem encTokens_zero (K : List ℕ) (R3 : List (ℕ × ℕ)) : - encTokens (0 :: K) R3 = (0 : Fin 2) >> encTokens K R3 := rfl - -@[simp] private theorem encTokens_succ (k : ℕ) (K : List ℕ) (R3 : List (ℕ × ℕ)) : - encTokens ((k + 1) :: K) R3 = (1 : Fin 2) >> encTokens (k :: K) R3 := by - simp only [encTokens, list_pow_succ, List.cons_append, List.nil_append, ListBlank.append_cons] - -private def encRightNat : List ℕ → ListBlank (Fin 2) - | [] => default - | a :: L => (1 : Fin 2) >> (([1] : List (Fin 2)) ^ a) +> ((0 : Fin 2) >> encRightNat L) - -@[simp] private theorem encRightNat_nil : encRightNat [] = default := rfl - -@[simp] private theorem encRightNat_zero (L : List ℕ) : - encRightNat (0 :: L) = (1 : Fin 2) >> (0 : Fin 2) >> encRightNat L := rfl - -@[simp] private theorem encRightNat_succ (a : ℕ) (L : List ℕ) : - encRightNat ((a + 1) :: L) = (1 : Fin 2) >> encRightNat (a :: L) := by - simp only [encRightNat, list_pow_succ, List.cons_append, List.nil_append, ListBlank.append_cons] - -private theorem encRight_eq_nat (L : List (ℕ × ℕ)) : encRight L = encRightNat (L.map Prod.fst) := by - induction L with - | nil => rfl - | cons p L ih => - rcases p with ⟨a, b⟩ - rw [encRight_mod1 a b L, Nat.mod_one b, encRight_run_s0 a L, ih] - rfl - -private theorem encRightNat_eq (L : List ℕ) : encRightNat L = encRight (L.map (fun x => (x, 0))) := - by - induction L with - | nil => rfl - | cons a L ih => - simp only [List.map_cons, encRightNat, ih, encRight_run_s0] - -@[simp] private theorem encRightNat_cons_one (L : List ℕ) : - (1 : Fin 2) >> encRightNat L = encRightNat (bumpHead L) := by - rcases L with _ | ⟨a, L'⟩ - · simp [bumpHead, encRightNat] - · simp [bumpHead] - -local macro "tstep" : tactic => `(tactic| ( - try refine ReachesPlus.to_star ?_ - try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', - encTokens_nil, encTokens_zero, encTokens_succ, - encRightNat_nil, encRightNat_zero, encRightNat_succ, ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one] - refine ReachesPlus.head (by rfl) ?_ - simp only [Tape.move, Tape.write, encTokens_nil, encTokens_zero, encTokens_succ, - encRightNat_nil, encRightNat_zero, encRightNat_succ, - ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, - ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, - list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, - zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one])) - -local macro "tfinish" : tactic => `(tactic| ( - refine ⟨0, ?_⟩ - try simp only [Cfg.headRight, Cfg.headLeft, init, Tape.mk₁, Tape.mk₂, Tape.mk', - encTokens_nil, encTokens_zero, encTokens_succ, - encRightNat_nil, encRightNat_zero, encRightNat_succ, encLeft_nil, encRight_nil, - ListBlank.append_cons, ListBlank.append_nil, ListBlank.head_cons, ListBlank.tail_cons, - ListBlank.head_default_fin, ListBlank.tail_default, ListBlank.cons_zero_default, - list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, - zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one] - simp only [encRightNat_cons_one, encLeft_cons_one, encRight_cons_one, multiStep_zero] + simp only [multiStep_zero] try rfl)) -local macro "texecute" n:num : tactic => `(tactic| ( - iterate $n tstep - tfinish)) - -private def tok_AR (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := - (encTokens K R3) {{A}}> (encRightNat L) - -private def tok_BR (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := - (encTokens K R3) {{B}}> (encRightNat L) - -private def tok_CL (K : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : Cfg (Fin 2) (Fin 6) := - (encTokens K R3) <{{C}} (encRightNat L) - -private theorem tok_CL_exit_zero (R3 : List (ℕ × ℕ)) (L : List ℕ) : - (tok_CL [0] R3 L) [target]⊢⁺ cfg_AR_n_n (L.map (fun x => (x, 0))) (bumpPairHead R3) := by - unfold tok_CL cfg_AR_n_n - rw [← encRightNat_eq L] - texecute 1 - -private theorem tok_CL_0_cons (k1 : ℕ) (K2 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : - (tok_CL (0 :: k1 :: K2) R3 L) [target]⊢⁺ tok_AR ((k1 + 1) :: K2) R3 L := by - unfold tok_CL tok_AR; texecute 1 - -private theorem tok_CL_1 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : - (tok_CL (1 :: K1) R3 L) [target]⊢⁺ tok_CL K1 R3 (0 :: L) := by - unfold tok_CL; texecute 2 - -private theorem tok_CL_2 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : - (tok_CL (2 :: K1) R3 (0 :: L)) [target]⊢⁺ tok_CL K1 R3 (0 :: 1 :: L) := by - unfold tok_CL; texecute 7 - -private theorem tok_CL_add3 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L : List ℕ) : - (tok_CL ((k + 3) :: K1) R3 L) [target]⊢⁺ tok_BR (2 :: k :: K1) R3 L := by - unfold tok_CL tok_BR; texecute 5 - -private theorem tok_BR_nil_8 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_BR (2 :: K1) R3 []) [target]⊢⁺ tok_CL K1 R3 [0, 1] := by - unfold tok_BR tok_CL; texecute 8 - -private theorem tok_BR_zero (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L1 : List ℕ) : - (tok_BR (2 :: K1) R3 (0 :: L1)) [target]⊢⁺ tok_BR (2 :: 1 :: K1) R3 L1 := by - unfold tok_BR; texecute 4 - -private theorem tok_BR_1_nil_28 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_BR (2 :: K1) R3 [1]) [target]⊢⁺ tok_CL (1 :: K1) R3 [0, 0, 0, 1] := by - unfold tok_BR tok_CL; texecute 28 - -private theorem tok_BR_succ (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L1 : List ℕ) : - (tok_BR (2 :: K1) R3 ((a + 1) :: L1)) [target]⊢⁺ tok_AR (1 :: 1 :: K1) R3 (a :: L1) := by - unfold tok_BR tok_AR; texecute 3 - -private theorem tok_AR_1_nil_9 (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_AR (1 :: K1) R3 []) [target]⊢⁺ tok_CL K1 R3 [0, 1] := by - unfold tok_AR tok_CL; texecute 9 - -private theorem tok_AR_add2_nil_21 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_AR ((k + 2) :: K1) R3 []) [target]⊢⁺ tok_CL (k :: K1) R3 [0, 0, 1] := by - unfold tok_AR tok_CL; texecute 21 - -private theorem tok_AR_zero (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L1 : List ℕ) : - (tok_AR (k :: K1) R3 (0 :: L1)) [target]⊢⁺ tok_AR ((k + 2) :: K1) R3 L1 := by - unfold tok_AR; texecute 2 - -private theorem tok_AR_1_nil_33 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_AR (k :: K1) R3 [1]) [target]⊢⁺ tok_CL (k :: K1) R3 [0, 0, 0, 1] := by - unfold tok_AR tok_CL; texecute 33 - -private theorem tok_AR_1_0 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (L2 : List ℕ) : - (tok_AR (k :: K1) R3 (1 :: 0 :: L2)) [target]⊢⁺ tok_AR (1 :: (k + 3) :: K1) R3 L2 := by - unfold tok_AR; texecute 5 - -private theorem tok_AR_1_1_nil_25 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) : - (tok_AR (k :: K1) R3 [1, 1]) [target]⊢⁺ tok_CL (k :: K1) R3 [0, 0, 1] := by - unfold tok_AR tok_CL; texecute 25 - -private theorem tok_AR_1_1_cons_25 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (c : ℕ) (L3 : List ℕ) : - (tok_AR (k :: K1) R3 (1 :: 1 :: c :: L3)) [target]⊢⁺ - tok_CL (k :: K1) R3 (0 :: 0 :: (c + 2) :: L3) := by - unfold tok_AR tok_CL; texecute 25 - -private theorem tok_AR_1_add2 (k : ℕ) (K1 : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L2 : List ℕ) : - (tok_AR (k :: K1) R3 (1 :: (a + 2) :: L2)) [target]⊢⁺ tok_BR (2 :: 1 :: k :: K1) R3 (a :: L2) := - by - unfold tok_AR tok_BR; texecute 15 - -private theorem tok_AR_add2_halts (K : List ℕ) (R3 : List (ℕ × ℕ)) (a : ℕ) (L1 : List ℕ) : - ∃ cfg_, ((tok_AR K R3 ((a + 2) :: L1)) [target]⊢⁺ cfg_) ∧ - (step target cfg_).isNone := by - refine ⟨((1 : Fin 2) >> (1 : Fin 2) >> encTokens K R3) {{F}}> (encRightNat (a :: L1)), ?_, - by simp only [encRightNat]; bb_halt⟩ - unfold tok_AR; texecute 2 - -/-! ## Weight and Lexicographic Measure -/ - -@[simp] -private def predNat : ℕ → ℕ - | 0 => 0 - | a + 1 => a - -@[simp] -private def wtL : List ℕ → ℕ - | [] => 0 - | [a] => predNat a - | a :: b :: L => a + wtL (b :: L) - -@[simp] private theorem predNat_succ (a : ℕ) : predNat (a + 1) = a := rfl - -@[simp] private theorem wtL_single (a : ℕ) : wtL [a] = predNat a := rfl - -@[simp] private theorem wtL_cons_cons (a b : ℕ) (L : List ℕ) : wtL (a :: b :: L) = - a + wtL (b :: L) := rfl - -@[simp] private theorem wtL_zero_cons (L : List ℕ) : wtL (0 :: L) = wtL L := by - rcases L with _ | ⟨b, L'⟩ - · rfl - · exact Nat.zero_add (wtL (b :: L')) - -private theorem wtL_1_1_cons (c : ℕ) (L3 : List ℕ) : wtL ((c + 2) :: L3) ≤ wtL (1 :: 1 :: c :: L3) - := by - rcases L3 with _ | ⟨d, L4⟩ - · rcases c with _ | c' - · decide - · simp only [wtL_cons_cons, wtL_single, predNat_succ]; omega - · simp only [wtL_cons_cons]; omega - -private theorem wtL_1_add2 (b : ℕ) (L2 : List ℕ) : wtL (b :: L2) + 2 ≤ wtL (1 :: (b + 2) :: L2) := - by - rcases L2 with _ | ⟨d, L3⟩ - · rcases b with _ | b' - · decide - · simp only [wtL_cons_cons, wtL_single, predNat_succ]; omega - · simp only [wtL_cons_cons]; omega - -@[simp] -private def sumL : List ℕ → ℕ - | [] => 0 - | a :: L => a + sumL L - -@[simp] -private def countNonOne : List ℕ → ℕ - | [] => 0 - | 0 :: K => 1 + countNonOne K - | 1 :: K => countNonOne K - | (_ + 2) :: K => 1 + countNonOne K - -@[simp] private theorem countNonOne_zero (K : List ℕ) : countNonOne (0 :: K) = 1 + countNonOne K := - rfl - -@[simp] private theorem countNonOne_one (K : List ℕ) : countNonOne (1 :: K) = countNonOne K := rfl - -@[simp] private theorem countNonOne_add2 (k : ℕ) (K : List ℕ) : countNonOne ((k + 2) :: K) = - 1 + countNonOne K := rfl - -private theorem countNonOne_cons_le (k : ℕ) (K : List ℕ) : countNonOne (k :: K) ≤ 1 + countNonOne K - := by - rcases k with _ | _ | k' - · exact Nat.le_refl _ - · exact Nat.le_add_left _ 1 - · exact Nat.le_refl _ - -private theorem le_countNonOne_cons (k : ℕ) (K : List ℕ) : countNonOne K ≤ countNonOne (k :: K) := - by - rcases k with _ | _ | k' - · exact Nat.le_add_left _ 1 - · exact Nat.le_refl _ - · exact Nat.le_add_left _ 1 - -@[simp] -private def scores : List ℕ → List (ℕ × ℕ) - | [] => [] - | 0 :: K => scores K ++ [(K.length, 0)] - | 1 :: K => scores K - | (k + 2) :: K => scores K ++ [(K.length, k + 2)] - -@[simp] private theorem scores_zero (K : List ℕ) : scores (0 :: K) = scores K ++ [(K.length, 0)] := - rfl - -@[simp] private theorem scores_one (K : List ℕ) : scores (1 :: K) = scores K := rfl - -@[simp] private theorem scores_add2 (k : ℕ) (K : List ℕ) : scores ((k + 2) :: K) = scores K ++ - [(K.length, k + 2)] := rfl - -private theorem scores_cons_ext (k : ℕ) (K : List ℕ) : ∃ ext, scores (k :: K) = scores K ++ ext := - by - rcases k with _ | _ | k' - · exact ⟨[(K.length, 0)], rfl⟩ - · exact ⟨[], (List.append_nil (scores K)).symm⟩ - · exact ⟨[(K.length, k' + 2)], rfl⟩ - -private theorem scores_length (K : List ℕ) : (scores K).length = countNonOne K := by - induction K with - | nil => rfl - | cons k K ih => - rcases k with _ | _ | k' - · simp only [scores_zero, countNonOne_zero, List.length_append, List.length_singleton, - ih]; omega - · exact ih - · dsimp only [scores, countNonOne] - rw [List.length_append, List.length_singleton, ih] - omega - -private def PairLt (p q : ℕ × ℕ) : Prop := - p.1 < q.1 ∨ (p.1 = q.1 ∧ p.2 < q.2) - -private inductive BoundedLex : ℕ → List (ℕ × ℕ) → List (ℕ × ℕ) → Prop - | head {m : ℕ} {x y : ℕ × ℕ} {xs ys : List (ℕ × ℕ)} : - PairLt x y → BoundedLex (m + 1) (x :: xs) (y :: ys) - | cons {m : ℕ} {z : ℕ × ℕ} {xs ys : List (ℕ × ℕ)} : - BoundedLex m xs ys → BoundedLex (m + 1) (z :: xs) (z :: ys) - -private theorem boundedLex_append (P : List (ℕ × ℕ)) {m : ℕ} {x y : ℕ × ℕ} (rest ext : List (ℕ × ℕ)) - (hxy : PairLt x y) (hlen : P.length < m) : - BoundedLex m (P ++ (x :: ext)) (P ++ (y :: rest)) := by - induction P generalizing m with - | nil => - rcases m with _ | m' - · omega - · exact BoundedLex.head hxy - | cons z P' ih => - rcases m with _ | m' - · simp at hlen - · simp only [List.cons_append] - exact BoundedLex.cons (ih (by simp at hlen; omega)) - -private theorem boundedLex_acc_snd (m a : ℕ) - (ih_m : ∀ xs, Acc (BoundedLex m) xs) - (ih_a : ∀ a' < a, ∀ b ys, Acc (BoundedLex (m + 1)) ((a', b) :: ys)) - (n : ℕ) : - ∀ b ≤ n, ∀ ys, Acc (BoundedLex (m + 1)) ((a, b) :: ys) := by - induction n with - | zero => - intro b hb ys - have hb0 : b = 0 := by omega - subst hb0 - induction (ih_m ys) with - | intro ys _ ih_ys => - refine Acc.intro ((a, 0) :: ys) (fun zs h => ?_) - cases h with - | @head _ x _ xs _ hlt => - rcases x with ⟨a', b'⟩ - rcases hlt with ha' | ⟨rfl, hb'⟩ - · exact ih_a a' ha' b' xs - · dsimp at hb'; omega - | cons hsub => exact ih_ys _ hsub - | succ n ih_n => - intro b hb ys - rcases Nat.of_le_succ hb with hle | rfl - · exact ih_n b hle ys - · induction (ih_m ys) with - | intro ys _ ih_ys => - refine Acc.intro ((a, n + 1) :: ys) (fun zs h => ?_) - cases h with - | @head _ x _ xs _ hlt => - rcases x with ⟨a', b'⟩ - rcases hlt with ha' | ⟨rfl, hb'⟩ - · exact ih_a a' ha' b' xs - · dsimp at hb'; exact ih_n b' (by omega) xs - | cons hsub => exact ih_ys _ hsub - -private theorem boundedLex_acc_fst (m : ℕ) (ih_m : ∀ xs, Acc (BoundedLex m) xs) (n : ℕ) : - ∀ a ≤ n, ∀ b ys, Acc (BoundedLex (m + 1)) ((a, b) :: ys) := by - induction n with - | zero => - intro a ha b ys - have ha0 : a = 0 := by omega - subst ha0 - exact boundedLex_acc_snd m 0 ih_m (fun _ hlt => by omega) b b (Nat.le_refl b) ys - | succ n ih_n => - intro a ha b ys - rcases Nat.of_le_succ ha with hle | rfl - · exact ih_n a hle b ys - · exact boundedLex_acc_snd m (n + 1) ih_m (fun a' hlt => ih_n a' (by omega)) b b (Nat.le_refl b) - ys - -private theorem boundedLex_acc (m : ℕ) (xs : List (ℕ × ℕ)) : Acc (BoundedLex m) xs := by - induction m generalizing xs with - | zero => exact Acc.intro xs (fun _ h => nomatch h) - | succ m ih_m => - rcases xs with _ | ⟨⟨a, b⟩, ys⟩ - · exact Acc.intro [] (fun _ h => nomatch h) - · exact boundedLex_acc_fst m ih_m a a (Nat.le_refl a) b ys - -/-! ## Bounce Lemmas for `AR` and `BR` -/ - -private theorem bounce_len (R3 : List (ℕ × ℕ)) (n : ℕ) : - ∀ (L : List ℕ), 2 * sumL L + L.length ≤ n → - (∀ (k0 : ℕ) (K_acc : List ℕ), - (∃ cfg_, ((tok_AR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ - (∃ K_out L_out, ((tok_AR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ - tok_CL K_out R3 (0 :: L_out)) ∧ - (∃ ext, scores K_out = scores K_acc ++ ext) ∧ - (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∨ - (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + 1 + wtL L ∧ - (k0 ≠ 0 → ∃ d ext, scores K_out = scores K_acc ++ ((K_acc.length, d) :: ext)))))) ∧ - (∀ (K_acc : List ℕ), - (∃ cfg_, ((tok_BR (2 :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ - (∃ K_out L_out, ((tok_BR (2 :: K_acc) R3 L) [target]⊢⁺ tok_CL K_out R3 (0 :: L_out)) ∧ - countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∧ - (∃ ext, scores K_out = scores K_acc ++ ext))) := by - induction n with - | zero => - intro L hlen - rcases L with _ | ⟨a, L1⟩ - · refine ⟨fun k0 K_acc => ?_, fun K_acc => ?_⟩ - · rcases k0 with _ | k' - · refine Or.inr ⟨K_acc, [1], tok_AR_1_nil_9 K_acc R3, ⟨[], by simp⟩, Or.inl (by simp)⟩ - · rcases k' with _ | m - · refine Or.inr ⟨0 :: K_acc, [0, 1], tok_AR_add2_nil_21 0 K_acc R3, ⟨[(K_acc.length, 0)], - by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨0, [], by simp⟩⟩⟩ - · rcases m with _ | m' - · refine Or.inr ⟨1 :: K_acc, [0, 1], tok_AR_add2_nil_21 1 K_acc R3, ⟨[], by simp⟩, - Or.inl (by simp)⟩ - · refine Or.inr ⟨(m' + 2) :: K_acc, [0, 1], tok_AR_add2_nil_21 (m' + 2) K_acc R3, - ⟨[(K_acc.length, m' + 2)], by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨m' + 2, [], - by simp⟩⟩⟩ - · exact Or.inr ⟨K_acc, [1], tok_BR_nil_8 K_acc R3, by simp, ⟨[], by simp⟩⟩ - · simp at hlen - | succ n ih_n => - intro L hlen - rcases Nat.of_le_succ hlen with hle | heq - · exact ih_n L hle - · refine ⟨fun k0 K_acc => ?_, fun K_acc => ?_⟩ - · rcases L with _ | ⟨a, L1⟩ - · simp at heq - · rcases a with _ | _ | a' - · have hstep1 := tok_AR_zero (k0 + 1) K_acc R3 L1 - rcases (ih_n L1 (by simp at heq ⊢; omega)).1 (k0 + 2) K_acc with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hext, hbr⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, hext, ?_⟩ - rcases hbr with hlt | ⟨hle, hd⟩ - · exact Or.inl (by simpa using hlt) - · exact Or.inr ⟨by simpa using hle, fun _ => hd (by omega)⟩ - · rcases L1 with _ | ⟨b, L2⟩ - · rcases k0 with _ | k' - · refine Or.inr ⟨1 :: K_acc, [0, 0, 1], tok_AR_1_nil_33 1 K_acc R3, ⟨[], by simp⟩, - Or.inl (by simp)⟩ - · refine Or.inr ⟨(k' + 2) :: K_acc, [0, 0, 1], tok_AR_1_nil_33 (k' + 2) K_acc R3, - ⟨[(K_acc.length, k' + 2)], by simp⟩, Or.inr ⟨by simp; omega, fun _ => ⟨k' + 2, [], - by simp⟩⟩⟩ - · rcases b with _ | _ | b' - · have hstep1 := tok_AR_1_0 (k0 + 1) K_acc R3 L2 - rcases (ih_n L2 (by simp at heq ⊢; omega)).1 0 ((k0 + 4) :: K_acc) with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · have hsc' : scores K_out = scores K_acc ++ ((K_acc.length, k0 + 4) :: ext) := by - simpa [scores_add2 (k0 + 2) K_acc, List.append_assoc] using hsc - refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ⟨(K_acc.length, - k0 + 4) :: ext, hsc'⟩, ?_⟩ - have hwt : wtL ((0 + 1) :: 0 :: L2) = 1 + wtL L2 := by simp - have hcnt : countNonOne ((k0 + 4) :: K_acc) = 1 + countNonOne K_acc := - countNonOne_add2 (k0 + 2) K_acc - rcases hbr with hlt | ⟨hle, _⟩ - · exact Or.inl (by omega) - · exact Or.inr ⟨by omega, fun _ => ⟨k0 + 4, ext, hsc'⟩⟩ - · rcases L2 with _ | ⟨c, L3⟩ - · have hstep := tok_AR_1_1_nil_25 (k0 + 1) K_acc R3 - have hcnt := countNonOne_cons_le (k0 + 1) K_acc - refine Or.inr ⟨(k0 + 1) :: K_acc, [0, 1], hstep, scores_cons_ext (k0 + 1) K_acc, - Or.inl ?_⟩ - simp at hcnt ⊢; omega - · have hstep := tok_AR_1_1_cons_25 (k0 + 1) K_acc R3 c L3 - have hwt : wtL ((c + 2) :: L3) ≤ wtL ((0 + 1) :: (0 + 1) :: c :: L3) := - wtL_1_1_cons c L3 - rcases k0 with _ | k' - · refine Or.inr ⟨1 :: K_acc, 0 :: (c + 2) :: L3, hstep, ⟨[], by simp⟩, Or.inl ?_⟩ - simp only [countNonOne_one, wtL_zero_cons]; omega - · refine Or.inr ⟨(k' + 2) :: K_acc, 0 :: (c + 2) :: L3, hstep, ⟨[(K_acc.length, - k' + 2)], by simp⟩, Or.inr ⟨?_, fun _ => ⟨k' + 2, [], by simp⟩⟩⟩ - simp only [countNonOne_add2, wtL_zero_cons]; omega - · have hstep1 := tok_AR_1_add2 (k0 + 1) K_acc R3 b' L2 - rcases (ih_n (b' :: L2) (by simp at heq ⊢; omega)).2 (1 :: (k0 + 1) :: K_acc) with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · obtain ⟨ext0, hsc0⟩ := scores_cons_ext (k0 + 1) K_acc - have hcnt := countNonOne_cons_le (k0 + 1) K_acc - have hwt : wtL (b' :: L2) + 2 ≤ wtL ((0 + 1) :: (b' + 1 + 1) :: L2) := - wtL_1_add2 b' L2 - refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ⟨ext0 ++ ext, - by simp [hsc, hsc0, List.append_assoc]⟩, Or.inl ?_⟩ - simp only [countNonOne_one] at hle - omega - · exact Or.inl (tok_AR_add2_halts ((k0 + 1) :: K_acc) R3 a' L1) - · rcases L with _ | ⟨a, L1⟩ - · simp at heq - · rcases a with _ | a' - · have hstep1 := tok_BR_zero K_acc R3 L1 - rcases (ih_n L1 (by simp at heq ⊢; omega)).2 (1 :: K_acc) with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · exact Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, by simpa using hle, ⟨ext, - by simpa using hsc⟩⟩ - · rcases L1 with _ | ⟨b, L2⟩ - · rcases a' with _ | a'' - · exact Or.inr ⟨1 :: K_acc, [0, 0, 1], tok_BR_1_nil_28 K_acc R3, by simp, ⟨[], - by simp⟩⟩ - · have hstep1 := tok_BR_succ K_acc R3 (a'' + 1) [] - rcases (ih_n [a'' + 1] (by simp at heq ⊢; omega)).1 0 (1 :: K_acc) with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ?_, ⟨ext, - by simpa using hsc⟩⟩ - rcases hbr with hlt | ⟨hle, _⟩ - · simp at hlt ⊢; omega - · simp at hle ⊢; omega - · have hstep1 := tok_BR_succ K_acc R3 a' (b :: L2) - rcases (ih_n (a' :: b :: L2) (by simp at heq ⊢; omega)).1 0 (1 :: K_acc) with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, ⟨ext, hsc⟩, hbr⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.trans hstep1 hstep2, hhalt⟩ - · refine Or.inr ⟨K_out, L_out, ReachesPlus.trans hstep1 hstep2, ?_, ⟨ext, - by simpa using hsc⟩⟩ - rcases hbr with hlt | ⟨hle, _⟩ - · simp at hlt ⊢; omega - · simp at hle ⊢; omega - -private theorem bounce_AR (R3 : List (ℕ × ℕ)) (k0 : ℕ) (K_acc : List ℕ) (L : List ℕ) : - (∃ cfg_, ((tok_AR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ - (∃ K_out L_out, ((tok_AR ((k0 + 1) :: K_acc) R3 L) [target]⊢⁺ tok_CL K_out R3 (0 :: L_out)) ∧ - (∃ ext, scores K_out = scores K_acc ++ ext) ∧ - (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∨ - (countNonOne K_out + wtL L_out ≤ countNonOne K_acc + 1 + wtL L ∧ - (k0 ≠ 0 → ∃ d ext, scores K_out = scores K_acc ++ ((K_acc.length, d) :: ext))))) := - (bounce_len R3 (2 * sumL L + L.length) L (Nat.le_refl _)).1 k0 K_acc - -private theorem bounce_BR (R3 : List (ℕ × ℕ)) (K_acc : List ℕ) (L : List ℕ) : - (∃ cfg_, ((tok_BR (2 :: K_acc) R3 L) [target]⊢⁺ cfg_) ∧ (step target cfg_).isNone) ∨ - (∃ K_out L_out, ((tok_BR (2 :: K_acc) R3 L) [target]⊢⁺ tok_CL K_out R3 (0 :: L_out)) ∧ - countNonOne K_out + wtL L_out ≤ countNonOne K_acc + wtL L ∧ - (∃ ext, scores K_out = scores K_acc ++ ext)) := - (bounce_len R3 (2 * sumL L + L.length) L (Nat.le_refl _)).2 K_acc - -/-! ## Token System Termination -/ - -private theorem bl_step_macro_len (R3 : List (ℕ × ℕ)) (n : ℕ) : - ∀ (K : List ℕ), K.length ≤ n → ∀ (L : List ℕ), - (∃ cfg_, ((tok_CL K R3 (0 :: L)) [target]⊢* cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone)) ∨ - (∃ K' L', ((tok_CL K R3 (0 :: L)) [target]⊢⁺ tok_CL K' R3 (0 :: L')) ∧ - countNonOne K' + wtL L' < countNonOne K + wtL L) ∨ - (∃ K' L' P x y rest ext, ((tok_CL K R3 (0 :: L)) [target]⊢⁺ tok_CL K' R3 (0 :: L')) ∧ - countNonOne K' + wtL L' = countNonOne K + wtL L ∧ PairLt x y ∧ - scores K = P ++ (y :: rest) ∧ scores K' = P ++ (x :: ext)) := by - induction n with - | zero => - intro K hlen L - cases K with - | nil => - refine Or.inl ⟨cfg_CL_n_n ((0 :: L).map (fun x => (x, 0))) R3, ⟨0, ?_⟩, - Or.inl ⟨.CL_n_n, R3, (0 :: L).map (fun x => (x, 0)), rfl⟩⟩ - unfold tok_CL cfg_CL_n_n - rw [encTokens_nil, encRightNat_eq] - rfl - | cons _ _ => simp at hlen - | succ n ih_n => - intro K hlen L - rcases K with _ | ⟨k1, K1⟩ - · refine Or.inl ⟨cfg_CL_n_n ((0 :: L).map (fun x => (x, 0))) R3, ⟨0, ?_⟩, - Or.inl ⟨.CL_n_n, R3, (0 :: L).map (fun x => (x, 0)), rfl⟩⟩ - unfold tok_CL cfg_CL_n_n - rw [encTokens_nil, encRightNat_eq] - rfl - · rcases k1 with _ | _ | _ | k' - · rcases K1 with _ | ⟨k2, K2⟩ - · exact Or.inl ⟨cfg_AR_n_n ((0 :: L).map (fun x => (x, 0))) (bumpPairHead R3), - ReachesPlus.to_star (tok_CL_exit_zero R3 (0 :: L)), - Or.inl ⟨.AR_n_n, bumpPairHead R3, (0 :: L).map (fun x => (x, 0)), rfl⟩⟩ - · have hstep1 := - ReachesPlus.trans (tok_CL_0_cons k2 K2 R3 (0 :: L)) (tok_AR_zero (k2 + 1) K2 R3 L) - rcases bounce_AR R3 (k2 + 2) K2 L with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, _, hbr⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans hstep1 hstep2), Or.inr hhalt⟩ - · have hstep := ReachesPlus.trans hstep1 hstep2 - rcases hbr with hlt | ⟨hle, hd⟩ - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - have hcnt := le_countNonOne_cons k2 K2 - simp only [countNonOne_zero]; omega - · rcases k2 with _ | _ | k2' - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [countNonOne_zero]; omega - · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [Nat.zero_add, countNonOne_zero, countNonOne_one]; omega - · obtain ⟨d, ext, hsc_out⟩ := hd (by omega) - refine Or.inr (Or.inr ⟨K_out, L_out, scores K2, (K2.length, d), ((1 :: K2).length, - 0), - [], ext, hstep, by simp only [Nat.zero_add, countNonOne_zero, - countNonOne_one]; omega, - Or.inl (by simp), by simp, hsc_out⟩) - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [countNonOne_zero, countNonOne_add2]; omega - · have hstep1 := tok_CL_1 K1 R3 (0 :: L) - rcases ih_n K1 (by simp at hlen; omega) (0 :: L) with - ⟨cfg_, hstep2, hsys⟩ | - ⟨K', L', hstep2, hlt⟩ | - ⟨K', L', P, x, y, rest, ext, hstep2, heq, hxy, hsc1, hsc2⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep1 hstep2), hsys⟩ - · refine Or.inr (Or.inl ⟨K', L', ReachesPlus.trans hstep1 hstep2, ?_⟩) - simpa using hlt - · refine Or.inr (Or.inr ⟨K', L', P, x, y, rest, ext, ReachesPlus.trans hstep1 hstep2, - by simpa using heq, hxy, by simpa using hsc1, hsc2⟩) - · have hstep1 := tok_CL_2 K1 R3 L - rcases L with _ | ⟨a, L1⟩ - · refine Or.inr (Or.inl ⟨K1, [1], hstep1, ?_⟩) - simp - · have hwt1 : wtL (1 :: a :: L1) = 1 + wtL (a :: L1) := by simp - rcases ih_n K1 (by simp at hlen; omega) (1 :: a :: L1) with - ⟨cfg_, hstep2, hsys⟩ | - ⟨K', L', hstep2, hlt⟩ | - ⟨K', L', P, x, y, rest, ext, hstep2, heq, hxy, hsc1, hsc2⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep1 hstep2), hsys⟩ - · refine Or.inr (Or.inl ⟨K', L', ReachesPlus.trans hstep1 hstep2, ?_⟩) - simp only [countNonOne_add2 0 K1]; omega - · refine Or.inr (Or.inr ⟨K', L', P, x, y, rest ++ [(K1.length, 2)], ext, - ReachesPlus.trans hstep1 hstep2, by simp only [countNonOne_add2 0 K1]; omega, - hxy, by simp [hsc1, List.append_assoc], hsc2⟩) - · have hstep1 := - ReachesPlus.trans (tok_CL_add3 k' K1 R3 (0 :: L)) (tok_BR_zero (k' :: K1) R3 L) - rcases bounce_BR R3 (1 :: k' :: K1) L with - ⟨cfg_, hstep2, hhalt⟩ | ⟨K_out, L_out, hstep2, hle, ⟨ext, hsc⟩⟩ - · exact Or.inl ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans hstep1 hstep2), Or.inr hhalt⟩ - · have hstep := ReachesPlus.trans hstep1 hstep2 - simp only [countNonOne_one, scores_one] at hle hsc - rcases k' with _ | _ | k'' - · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [countNonOne_zero, countNonOne_add2] at hlt' ⊢; omega - · refine Or.inr (Or.inr ⟨K_out, L_out, scores K1, (K1.length, 0), (K1.length, 3), - [], ext, hstep, by simp only [countNonOne_zero, countNonOne_add2] at heq' ⊢; omega, - Or.inr ⟨rfl, by simp⟩, by simp, - by simpa [List.append_assoc] using hsc⟩) - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [Nat.zero_add, countNonOne_one, countNonOne_add2] at hle ⊢; omega - · rcases Nat.lt_or_eq_of_le hle with hlt' | heq' - · refine Or.inr (Or.inl ⟨K_out, L_out, hstep, ?_⟩) - simp only [countNonOne_add2] at hlt' ⊢; omega - · refine Or.inr (Or.inr ⟨K_out, L_out, scores K1, (K1.length, k'' + 2), (K1.length, - k'' + 5), - [], ext, hstep, by simp only [countNonOne_add2] at heq' ⊢; omega, - Or.inr ⟨rfl, by simp⟩, by simp, - by simpa [List.append_assoc] using hsc⟩) - -private theorem bl_terminates_acc (R3 : List (ℕ × ℕ)) (m : ℕ) - (ih_m : ∀ (K : List ℕ) (L : List ℕ), - countNonOne K + wtL L < m → - ∃ cfg_, ((tok_CL K R3 (0 :: L)) [target]⊢* cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone)) - (S : List (ℕ × ℕ)) (hacc : Acc (BoundedLex m) S) : - ∀ (K : List ℕ) (L : List ℕ), - scores K = S → countNonOne K + wtL L = m → - ∃ cfg_, ((tok_CL K R3 (0 :: L)) [target]⊢* cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - induction hacc with - | intro S _ ih_acc => - intro K L hS hm - rcases bl_step_macro_len R3 K.length K (Nat.le_refl K.length) L with - ⟨cfg_, hstep, hsys⟩ | - ⟨K', L', hstep, hlt⟩ | - ⟨K', L', P, x, y, rest, ext, hstep, heq, hxy, hsc1, hsc2⟩ - · exact ⟨cfg_, hstep, hsys⟩ - · obtain ⟨cfg_, hstep2, hsys⟩ := ih_m K' L' (by omega) - exact ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep hstep2), hsys⟩ - · have hlenP : P.length < m := by - have hlenK := scores_length K - rw [hsc1, List.length_append, List.length_cons] at hlenK - omega - have hlex : BoundedLex m (scores K') S := by - rw [← hS, hsc1, hsc2] - exact boundedLex_append P rest ext hxy hlenP - obtain ⟨cfg_, hstep2, hsys⟩ := ih_acc (scores K') hlex K' L' rfl (by omega) - exact ⟨cfg_, ReachesPlus.to_star (ReachesPlus.trans_star hstep hstep2), hsys⟩ - -private theorem bl_terminates_le (R3 : List (ℕ × ℕ)) (n : ℕ) : - ∀ (m : ℕ), m ≤ n → ∀ (K : List ℕ) (L : List ℕ), - countNonOne K + wtL L = m → - ∃ cfg_, ((tok_CL K R3 (0 :: L)) [target]⊢* cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - induction n with - | zero => - intro m hm K L hM - have hm0 : m = 0 := by omega - subst hm0 - exact bl_terminates_acc R3 0 (fun _ _ hlt => by omega) (scores K) (boundedLex_acc 0 (scores K)) - K L rfl hM - | succ n ih_n => - intro m hm K L hM - rcases Nat.of_le_succ hm with hle | rfl - · exact ih_n m hle K L hM - · refine bl_terminates_acc R3 (n + 1) (fun K' L' hlt => ?_) - (scores K) (boundedLex_acc (n + 1) (scores K)) K L rfl hM - exact ih_n (countNonOne K' + wtL L') (by omega) K' L' rfl - -private theorem tok_BR_2_0_closed (R3 : List (ℕ × ℕ)) (L : List ℕ) : - ∃ cfg_, ((tok_BR [2, 0] R3 L) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases bounce_BR R3 [0] L with ⟨cfg_, hstep, hhalt⟩ | ⟨K_out, L_out, hstep, _, _⟩ - · exact ⟨cfg_, hstep, Or.inr hhalt⟩ - · obtain ⟨cfg_, hstep2, hsys⟩ := bl_terminates_le R3 (countNonOne K_out + wtL L_out) - (countNonOne K_out + wtL L_out) (Nat.le_refl _) K_out L_out rfl - exact ⟨cfg_, ReachesPlus.trans_star hstep hstep2, hsys⟩ - -private theorem tok_AR_1_0_closed (R3 : List (ℕ × ℕ)) (L : List ℕ) : - ∃ cfg_, ((tok_AR [1, 0] R3 L) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases bounce_AR R3 0 [0] L with ⟨cfg_, hstep, hhalt⟩ | ⟨K_out, L_out, hstep, _, _⟩ - · exact ⟨cfg_, hstep, Or.inr hhalt⟩ - · obtain ⟨cfg_, hstep2, hsys⟩ := bl_terminates_le R3 (countNonOne K_out + wtL L_out) - (countNonOne K_out + wtL L_out) (Nat.le_refl _) K_out L_out rfl - exact ⟨cfg_, ReachesPlus.trans_star hstep hstep2, hsys⟩ - -/-! ## Mode Closure Theorems -/ - -private theorem mode_AR_n_n_closed (L R : List (ℕ × ℕ)) : - ∃ cfg_, ((cfg_AR_n_n L R) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases L with _ | ⟨⟨a1, b2⟩, L3⟩ - · refine ⟨cfg_CL_n_n [(0, 0)] (bumpPairHead R), ?_, Or.inl ⟨.CL_n_n, bumpPairHead R, [(0, 0)], - rfl⟩⟩ - unfold cfg_AR_n_n cfg_CL_n_n - rw [encRight_d0_s0 [], ← encLeft_cons_one R] - execute 2 - · rcases a1 with _ | a5 - · refine ⟨cfg_AR_n_n L3 (bumpPairHead (bumpPairHead R)), ?_, Or.inl ⟨.AR_n_n, - bumpPairHead (bumpPairHead R), L3, rfl⟩⟩ - unfold cfg_AR_n_n - rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, - ← encLeft_cons_one (bumpPairHead R), ← encLeft_cons_one R] - execute 2 - · rcases a5 with _ | a14 - · rcases L3 with _ | ⟨⟨a6, b7⟩, L8⟩ - · refine ⟨cfg_CL_n_n [(0, 0)] ((0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R))), ?_, - Or.inl ⟨.CL_n_n, (0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R)), [(0, 0)], rfl⟩⟩ - unfold cfg_AR_n_n cfg_CL_n_n - rw [encRight_mod1 1 b2 [], Nat.mod_one b2, encRight_d1_s0 [], encRight_d0_s0 [], - encLeft_d0_s0 (bumpPairHead (bumpPairHead (bumpPairHead R))), - ← encLeft_cons_one (bumpPairHead (bumpPairHead R)), - ← encLeft_cons_one (bumpPairHead R), ← encLeft_cons_one R] - execute 6 - · rcases a6 with _ | a10 - · refine ⟨cfg_AR_n_n L8 ((0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R))), ?_, - Or.inl ⟨.AR_n_n, (0, 0) :: bumpPairHead (bumpPairHead (bumpPairHead R)), L8, rfl⟩⟩ - unfold cfg_AR_n_n - rw [encRight_mod1 1 b2 ((0, b7) :: L8), Nat.mod_one b2, encRight_d1_s0 ((0, b7) :: L8), - encRight_mod1 0 b7 L8, Nat.mod_one b7, encRight_d0_s0 L8, - encLeft_d0_s0 (bumpPairHead (bumpPairHead (bumpPairHead R))), - ← encLeft_cons_one (bumpPairHead (bumpPairHead R)), - ← encLeft_cons_one (bumpPairHead R), ← encLeft_cons_one R] - execute 5 - · rcases a10 with _ | a11 - · refine ⟨cfg_CL_n_n (bumpPairHead L8) ((1, 0) :: (0, 0) :: R), ?_, Or.inl ⟨.CL_n_n, (1, - 0) :: (0, 0) :: R, bumpPairHead L8, rfl⟩⟩ - unfold cfg_AR_n_n cfg_CL_n_n - rw [encRight_mod1 1 b2 ((1, b7) :: L8), Nat.mod_one b2, - encRight_d1_s0 ((1, b7) :: L8), encRight_mod1 1 b7 L8, Nat.mod_one b7, - encRight_d1_s0 L8, ← encRight_cons_one L8, encLeft_d1_s0 ((0, 0) :: R), - encLeft_d0_s0 R] - execute 16 - · refine ⟨cfg_BR_n_n ((a11, 0) :: L8) ((1, 0) :: (0, 0) :: R), ?_, Or.inl ⟨.BR_n_n, (1, - 0) :: (0, 0) :: R, (a11, 0) :: L8, rfl⟩⟩ - unfold cfg_AR_n_n cfg_BR_n_n - rw [encRight_mod1 1 b2 ((a11 + 2, b7) :: L8), Nat.mod_one b2, - encRight_d1_s0 ((a11 + 2, b7) :: L8), encRight_mod1 (a11 + 2) b7 L8, - Nat.mod_one b7, encRight_succ (a11 + 1) 0 L8, encRight_succ a11 0 L8, - encRight_run_s0 a11 L8, encLeft_d1_s0 ((0, 0) :: R), encLeft_d0_s0 R] - execute 15 - · refine ⟨((1 : Fin 2) >> (1 : Fin 2) >> encLeft R) {{F}}> (encRight ((a14, 0) :: L3)), ?_, - Or.inr (by rw [encRight_run_s0]; bb_halt)⟩ - unfold cfg_AR_n_n - rw [encRight_mod1 (a14 + 2) b2 L3, Nat.mod_one b2, encRight_succ (a14 + 1) 0 L3, - encRight_succ a14 0 L3] - execute 2 - -private theorem mode_CL_n_n_closed (L R : List (ℕ × ℕ)) : - ∃ cfg_, ((cfg_CL_n_n L R) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases R with _ | ⟨⟨r1, b2⟩, R3⟩ - · refine ⟨cfg_AR_n_n L [(0, 0)], ?_, Or.inl ⟨.AR_n_n, [(0, 0)], L, rfl⟩⟩ - unfold cfg_CL_n_n cfg_AR_n_n - rw [encLeft_d0_s0 []] - execute 1 - · rcases r1 with _ | r5 - · refine ⟨cfg_CL_n_n ((0, 0) :: L) R3, ?_, Or.inl ⟨.CL_n_n, R3, (0, 0) :: L, rfl⟩⟩ - unfold cfg_CL_n_n - rw [encLeft_mod1 0 b2 R3, Nat.mod_one b2, encLeft_d0_s0 R3, encRight_d0_s0 L] - execute 2 - · refine ⟨cfg_BL_0_n L ((r5, 0) :: R3), ?_, Or.inl ⟨.BL_0_n, (r5, 0) :: R3, L, rfl⟩⟩ - unfold cfg_CL_n_n cfg_BL_0_n - rw [encLeft_mod1 (r5 + 1) b2 R3, Nat.mod_one b2, encLeft_succ r5 0 R3, encLeft_run_s0 r5 R3] - execute 1 - -private theorem mode_BL_0_n_closed (L R : List (ℕ × ℕ)) : - ∃ cfg_, ((cfg_BL_0_n L R) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases R with _ | ⟨⟨r1, b2⟩, R3⟩ - · refine ⟨cfg_AR_n_n L [(2, 0)], ?_, Or.inl ⟨.AR_n_n, [(2, 0)], L, rfl⟩⟩ - unfold cfg_BL_0_n cfg_AR_n_n - rw [encLeft_succ 1 0 [], encLeft_d1_s0 []] - execute 4 - · rcases r1 with _ | _ | r5 - · refine ⟨cfg_CL_n_n ((0, 0) :: bumpPairHead L) R3, ?_, Or.inl ⟨.CL_n_n, R3, (0, - 0) :: bumpPairHead L, rfl⟩⟩ - unfold cfg_BL_0_n cfg_CL_n_n - rw [encLeft_mod1 0 b2 R3, Nat.mod_one b2, encLeft_d0_s0 R3, encRight_d0_s0 (bumpPairHead L), - ← encRight_cons_one L] - execute 6 - · obtain ⟨cfg_, hstep2, hsys⟩ := tok_BR_2_0_closed R3 (L.map Prod.fst) - refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ - unfold cfg_BL_0_n tok_BR - rw [encLeft_mod1 1 b2 R3, Nat.mod_one b2, encLeft_d1_s0 R3, encRight_eq_nat L, - encTokens_succ, encTokens_succ, encTokens_zero, encTokens_zero, encTokens_nil] - texecute 4 - · refine ⟨cfg_BR_n_n L ((1, 0) :: (r5, 0) :: R3), ?_, Or.inl ⟨.BR_n_n, (1, 0) :: (r5, 0) :: R3, - L, rfl⟩⟩ - unfold cfg_BL_0_n cfg_BR_n_n - rw [encLeft_mod1 (r5 + 2) b2 R3, Nat.mod_one b2, encLeft_succ (r5 + 1) 0 R3, - encLeft_succ r5 0 R3, encLeft_run_s0 r5 R3, encLeft_d1_s0 ((r5, 0) :: R3), - encLeft_run_s0 r5 R3] - execute 4 - -private theorem mode_BR_n_n_closed (L R : List (ℕ × ℕ)) : - ∃ cfg_, ((cfg_BR_n_n L R) [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases L with _ | ⟨⟨a1, b2⟩, L3⟩ - · refine ⟨cfg_CL_n_n [(0, 0)] R, ?_, Or.inl ⟨.CL_n_n, R, [(0, 0)], rfl⟩⟩ - unfold cfg_BR_n_n cfg_CL_n_n - rw [encRight_d0_s0 []] - execute 1 - · rcases R with _ | ⟨⟨r1, b4⟩, R3⟩ - · rcases a1 with _ | a5 - · refine ⟨cfg_CL_n_n (bumpPairHead L3) [(0, 0)], ?_, Or.inl ⟨.CL_n_n, [(0, 0)], - bumpPairHead L3, rfl⟩⟩ - unfold cfg_BR_n_n cfg_CL_n_n - rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, ← encRight_cons_one L3, - encLeft_d0_s0 []] - execute 4 - · refine ⟨cfg_BR_n_n ((a5, 0) :: L3) [(0, 0)], ?_, Or.inl ⟨.BR_n_n, [(0, 0)], (a5, 0) :: L3, - rfl⟩⟩ - unfold cfg_BR_n_n - rw [encRight_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encRight_succ a5 0 L3, - encRight_run_s0 a5 L3, encLeft_d0_s0 []] - execute 3 - · rcases r1 with _ | r5 - · rcases a1 with _ | a5 - · obtain ⟨cfg_, hstep2, hsys⟩ := tok_BR_2_0_closed R3 (L3.map Prod.fst) - refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ - unfold cfg_BR_n_n tok_BR - rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, encLeft_mod1 0 b4 R3, - Nat.mod_one b4, encLeft_d0_s0 R3, encRight_eq_nat L3, encTokens_succ, encTokens_succ, - encTokens_zero, encTokens_zero, encTokens_nil] - texecute 4 - · obtain ⟨cfg_, hstep2, hsys⟩ := tok_AR_1_0_closed R3 (a5 :: L3.map Prod.fst) - refine ⟨cfg_, ReachesPlus.trans ?_ hstep2, hsys⟩ - unfold cfg_BR_n_n tok_AR - rw [encRight_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encRight_succ a5 0 L3, - encRight_run_s0 a5 L3, encLeft_mod1 0 b4 R3, Nat.mod_one b4, encLeft_d0_s0 R3, - encRight_eq_nat L3, encTokens_succ, encTokens_zero, encTokens_zero, encTokens_nil] - change (((1 : Fin 2) >> (0 : Fin 2) >> encLeft R3) {{B}}> ((1 : Fin 2) >> - encRightNat (a5 :: List.map Prod.fst L3))) [target]⊢⁺ (((1 : Fin 2) >> (0 : Fin 2) >> - (0 : Fin 2) >> encLeft R3) {{A}}> (encRightNat (a5 :: List.map Prod.fst L3))) - texecute 3 - · rcases a1 with _ | a5 - · refine ⟨cfg_BR_n_n L3 ((1, 0) :: (r5, 0) :: R3), ?_, Or.inl ⟨.BR_n_n, (1, 0) :: (r5, - 0) :: R3, L3, rfl⟩⟩ - unfold cfg_BR_n_n - rw [encRight_mod1 0 b2 L3, Nat.mod_one b2, encRight_d0_s0 L3, - encLeft_mod1 (r5 + 1) b4 R3, Nat.mod_one b4, encLeft_succ r5 0 R3, - encLeft_run_s0 r5 R3, encLeft_d1_s0 ((r5, 0) :: R3), encLeft_run_s0 r5 R3] - execute 4 - · refine ⟨cfg_AR_n_n ((a5, 0) :: L3) ((0, 0) :: (r5, 0) :: R3), ?_, Or.inl ⟨.AR_n_n, (0, - 0) :: (r5, 0) :: R3, (a5, 0) :: L3, rfl⟩⟩ - unfold cfg_BR_n_n cfg_AR_n_n - rw [encRight_mod1 (a5 + 1) b2 L3, Nat.mod_one b2, encRight_succ a5 0 L3, - encRight_run_s0 a5 L3, encLeft_mod1 (r5 + 1) b4 R3, Nat.mod_one b4, - encLeft_succ r5 0 R3, encLeft_run_s0 r5 R3, encLeft_d0_s0 ((r5, 0) :: R3), - encLeft_run_s0 r5 R3] - execute 3 - -private theorem stack_system_closed (cfg : Cfg (Fin 2) (Fin 6)) (h : IsInStackSystem cfg) : - ∃ cfg_, (cfg [target]⊢⁺ cfg_) ∧ - (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by - rcases h with ⟨m, R, L, rfl⟩ - cases m with - | AR_n_n => exact mode_AR_n_n_closed L R - | CL_n_n => exact mode_CL_n_n_closed L R - | BL_0_n => exact mode_BL_0_n_closed L R - | BR_n_n => exact mode_BR_n_n_closed L R +local macro "execute" n:num : tactic => `(tactic| ( + iterate $n step + finish)) private theorem init_reaches_nontrivial : - (init []) [target]⊢⁺ evalStackCfg .BR_n_n [(3, 0)] [(0, 0), (0, 0)] := by - have hL : encLeft [(3, 0)] = - (1 : Fin 2) >> (1 : Fin 2) >> (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default := rfl - have hR : encRight [(0, 0), (0, 0)] = - (1 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default := rfl - dsimp only [evalStackCfg, cfg_BR_n_n] - rw [hL, hR] + ReachesPlus target (init []) + (closedStackSystem.evalStackCfg StackMode.DR_n_n [(3, 0)] [(0, 0), (0, 0)]) := by + have htarget : closedStackSystem.evalStackCfg StackMode.DR_n_n [(3, 0)] [(0, 0), (0, 0)] = + ((1 : Fin 2) >> (1 : Fin 2) >> (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default) {{B}}> + ((1 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default) := by + rfl + rw [htarget] execute 12 -private theorem step_CL_transfer (z : ℕ × ℕ) (L R : List (ℕ × ℕ)) : - (evalStackCfg .CL_n_n ((0, 0) :: z :: L) R) [target]⊢⁺ - evalStackCfg .CL_n_n (z :: L) ((0, 0) :: R) := by - dsimp only [evalStackCfg, cfg_CL_n_n] - rw [encLeft_d0_s0 (z :: L), encRight_d0_s0 R] - execute 2 - -private theorem encRight_head (a b : ℕ) (L : List (ℕ × ℕ)) : - (encRight ((a, b) :: L)).head = 1 := by - rw [encRight_cons, show 1 * a + 1 = (1 * a + 0) + 1 by omega, list_pow_succ, List.cons_append] - simp only [ListBlank.append_cons, ListBlank.head_cons] - -private theorem encRight_not_surjective : - ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ L : List (ℕ × ℕ), encRight L ≠ t := by - refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ - intro L h - rcases L with _ | ⟨⟨a, b⟩, L'⟩ - · have h1 := congrArg (fun s => s.head) h - simp at h1 - · rw [encRight_mod1] at h - have hb0 : b % 1 = 0 := Nat.mod_one b - rw [hb0, encRight_run_s0] at h - rcases a with _ | a' - · rcases L' with _ | ⟨⟨a', b'⟩, L''⟩ - · have h2 := congrArg (fun s => s.tail.tail.tail.head) h - simp at h2 - · have h1 := congrArg (fun s => s.tail.tail.head) h - normalize_at h1 - rw [encRight_head a' b' L''] at h1; contradiction - · have h1 := congrArg (fun s => s.tail.head) h - normalize_at h1 - contradiction - -private theorem encLeft_head (a b : ℕ) (R : List (ℕ × ℕ)) : - (encLeft ((a, b) :: R)).head = 1 := by - rw [encLeft_cons, show 1 * a + 1 = (1 * a + 0) + 1 by omega, list_pow_succ, List.cons_append] - simp only [ListBlank.append_cons, ListBlank.head_cons] - -private theorem encLeft_not_surjective : - ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ R : List (ℕ × ℕ), encLeft R ≠ t := by - refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ - intro R h - rcases R with _ | ⟨⟨a, b⟩, R'⟩ - · have h1 := congrArg (fun s => s.head) h - simp at h1 - · rw [encLeft_mod1] at h - have hb0 : b % 1 = 0 := Nat.mod_one b - rw [hb0, encLeft_run_s0] at h - rcases a with _ | a' - · rcases R' with _ | ⟨⟨a', b'⟩, L''⟩ - · have h2 := congrArg (fun s => s.tail.tail.tail.head) h - simp at h2 - · have h1 := congrArg (fun s => s.tail.tail.head) h - normalize_at h1 - rw [encLeft_head a' b' L''] at h1; contradiction - · have h1 := congrArg (fun s => s.tail.head) h - normalize_at h1 - contradiction - -private theorem valid_stack_modes : IsValidStackModes encLeft encRight evalStackCfg := by - intro m - cases m with - | AR_n_n => exact ⟨A, .id [], .id [], by decide, by decide, Or.inr (Or.inr (fun _ _ => rfl))⟩ - | CL_n_n => exact ⟨C, .id [], .id [], by decide, by decide, Or.inr (Or.inl (fun _ _ => rfl))⟩ - | BL_0_n => exact ⟨B, .id [], .id [0], by decide, by decide, Or.inr (Or.inl (fun _ _ => rfl))⟩ - | BR_n_n => exact ⟨B, .id [], .id [], by decide, by decide, Or.inr (Or.inr (fun _ _ => rfl))⟩ - - /-! ## Stack Reduction Witness -/ /-- `target` reduces to a closed 2nd-order digit-stack transition system. -/ -theorem has_stack_reduction : HasStackReduction target := by - refine ⟨StackMode, 1, 0, encLeft, encRight, evalStackCfg, IsInStackSystem, - Or.inl ⟨rfl, rfl⟩, rfl, rfl, - encLeft_head, encRight_head, encLeft_not_surjective, encRight_not_surjective, - ⟨1, 1, 1, 1, 1, 1, 1, 1, by decide, by decide, by decide, by decide, by decide, - by decide, by decide, by decide, by decide, by decide, - fun _ _ _ => rfl, fun _ _ _ => rfl⟩, - ⟨[.AR_n_n, .CL_n_n, .BL_0_n, .BR_n_n], by decide, by intro m; cases m <;> decide⟩, - valid_stack_modes, - fun _ => Iff.rfl, - fun m L R => ⟨m, L, R, rfl⟩, - ⟨.BR_n_n, [(3, 0)], [(0, 0), (0, 0)], init_reaches_nontrivial, - by decide, ⟨(3, 0), by decide, by decide⟩⟩, - Or.inl ⟨.CL_n_n, .CL_n_n, (0, 0), id, ((0, 0) :: ·), - fun _ => Nat.le_succ _, step_CL_transfer⟩, - stack_system_closed⟩ +theorem has_stack_reduction : HasStackReduction target := + HasStackReduction.of_closedSystem closedStackSystem StackMode.DR_n_n [(3, 0)] [(0, 0), (0, 0)] + init_reaches_nontrivial (by decide) ⟨(3, 0), by decide, by decide⟩ end BusyBeaver.M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH diff --git a/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.lean b/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.lean index 98ce44b2..1af3eeb4 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.lean @@ -43,7 +43,6 @@ CR(a + 2, b, L, d + 1, R) -> CR(d + 1, a + 1, b :: L, r, R') where (r, R') Start: CR(0, 0, [], 0, []), reached after 5 raw TM steps ``` - ## Hardness *Hardness class:* S5 sibling — trigger **POW**, growth —, shield partial. @@ -58,7 +57,6 @@ non-halting. *Why it is hard:* see #549 See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean b/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean index 11cca384..7e1ac8ac 100644 --- a/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean +++ b/BusyBeaver/BB6/Accelerations/M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean @@ -15,7 +15,6 @@ Formal `HasStackReduction` proof for the 6-state, 2-symbol Busy Beaver holdout `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` (https://wiki.bbchallenge.org/wiki/1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA). - ## Hardness *Hardness class:* Wiki stack — trigger **RES (a particular sequence of $\approx 107$–$110$ residues @@ -41,7 +40,6 @@ positive density, but reaching it needs $\approx 3^{80}$ independent resets: the hardness without a shield See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section @@ -88,12 +86,12 @@ local macro "step" : tactic => `(tactic| ( list_pow_zero, list_pow_succ, List.nil_append, List.cons_append, zeros_append_default, Nat.mul_zero, Nat.mul_add, Nat.mul_one])) -private def encRight : List (ℕ × ℕ) → ListBlank (Fin 2) +def encRight : List (ℕ × ℕ) → ListBlank (Fin 2) | [] => default | (a, b) :: L => (encRight L <+ (([0] : List (Fin 2)) ^ (1 + b % 1))) <+ (([1] : List (Fin 2)) ^ (1 * a + 1)) -private def encLeft : List (ℕ × ℕ) → ListBlank (Fin 2) +def encLeft : List (ℕ × ℕ) → ListBlank (Fin 2) | [] => default | (d, b) :: R => (([1] : List (Fin 2)) ^ (1 * d + 1)) +> ((([0] : List (Fin 2)) ^ (1 + b % 1)) +> encLeft R) @@ -183,32 +181,32 @@ local macro "execute" n:num : tactic => `(tactic| ( iterate $n step finish)) -private def cfg_CR_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := +def cfg_CR_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := (encLeft R) {{C}}> (encRight L) -private def cfg_EL_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := +def cfg_EL_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := (encLeft R) <{{E}} (encRight L) -private def cfg_DL_0_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := +def cfg_DL_0_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := (encLeft R) <{{D}} ([0] +> encRight L) -private def cfg_DR_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := +def cfg_DR_n_n (L R : List (ℕ × ℕ)) : Cfg (Fin 2) (Fin 6) := (encLeft R) {{D}}> (encRight L) -private inductive StackMode +inductive StackMode | CR_n_n | EL_n_n | DL_0_n | DR_n_n deriving DecidableEq -private def evalStackCfg : StackMode → List (ℕ × ℕ) → List (ℕ × ℕ) → Cfg (Fin 2) (Fin 6) +def evalStackCfg : StackMode → List (ℕ × ℕ) → List (ℕ × ℕ) → Cfg (Fin 2) (Fin 6) | .CR_n_n, L, R => cfg_CR_n_n R L | .EL_n_n, L, R => cfg_EL_n_n R L | .DL_0_n, L, R => cfg_DL_0_n R L | .DR_n_n, L, R => cfg_DR_n_n R L -private def IsInStackSystem (cfg : Cfg (Fin 2) (Fin 6)) : Prop := +def IsInStackSystem (cfg : Cfg (Fin 2) (Fin 6)) : Prop := ∃ m L R, cfg = evalStackCfg m L R /-! ## Inner Token System -/ @@ -1065,7 +1063,7 @@ private theorem mode_DR_n_n_closed (L R : List (ℕ × ℕ)) : encLeft_run_s0 r5 R3] execute 3 -private theorem stack_system_closed (cfg : Cfg (Fin 2) (Fin 6)) (h : IsInStackSystem cfg) : +theorem stack_system_closed (cfg : Cfg (Fin 2) (Fin 6)) (h : IsInStackSystem cfg) : ∃ cfg_, (cfg [target]⊢⁺ cfg_) ∧ (IsInStackSystem cfg_ ∨ (step target cfg_).isNone) := by rcases h with ⟨m, R, L, rfl⟩ @@ -1075,7 +1073,7 @@ private theorem stack_system_closed (cfg : Cfg (Fin 2) (Fin 6)) (h : IsInStackSy | DL_0_n => exact mode_DL_0_n_closed L R | DR_n_n => exact mode_DR_n_n_closed L R -private theorem init_reaches_nontrivial : +theorem init_reaches_nontrivial : (init []) [target]⊢⁺ evalStackCfg .CR_n_n [(2, 0)] [(0, 0), (0, 0)] := by have hL : encLeft [(2, 0)] = (1 : Fin 2) >> (1 : Fin 2) >> (1 : Fin 2) >> (0 : Fin 2) >> default := rfl @@ -1085,19 +1083,19 @@ private theorem init_reaches_nontrivial : rw [hL, hR] execute 11 -private theorem step_EL_transfer (z : ℕ × ℕ) (L R : List (ℕ × ℕ)) : +theorem step_EL_transfer (z : ℕ × ℕ) (L R : List (ℕ × ℕ)) : (evalStackCfg .EL_n_n ((0, 0) :: z :: L) R) [target]⊢⁺ evalStackCfg .EL_n_n (z :: L) ((0, 0) :: R) := by dsimp only [evalStackCfg, cfg_EL_n_n] rw [encLeft_d0_s0 (z :: L), encRight_d0_s0 R] execute 2 -private theorem encRight_head (a b : ℕ) (L : List (ℕ × ℕ)) : +theorem encRight_head (a b : ℕ) (L : List (ℕ × ℕ)) : (encRight ((a, b) :: L)).head = 1 := by rw [encRight_cons, show 1 * a + 1 = (1 * a + 0) + 1 by omega, list_pow_succ, List.cons_append] simp only [ListBlank.append_cons, ListBlank.head_cons] -private theorem encRight_not_surjective : +theorem encRight_not_surjective : ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ L : List (ℕ × ℕ), encRight L ≠ t := by refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ intro L h @@ -1118,12 +1116,12 @@ private theorem encRight_not_surjective : normalize_at h1 contradiction -private theorem encLeft_head (a b : ℕ) (R : List (ℕ × ℕ)) : +theorem encLeft_head (a b : ℕ) (R : List (ℕ × ℕ)) : (encLeft ((a, b) :: R)).head = 1 := by rw [encLeft_cons, show 1 * a + 1 = (1 * a + 0) + 1 by omega, list_pow_succ, List.cons_append] simp only [ListBlank.append_cons, ListBlank.head_cons] -private theorem encLeft_not_surjective : +theorem encLeft_not_surjective : ∃ t : ListBlank (Fin 2), t.head = 1 ∧ ∀ R : List (ℕ × ℕ), encLeft R ≠ t := by refine ⟨(1 : Fin 2) >> (0 : Fin 2) >> (0 : Fin 2) >> (1 : Fin 2) >> default, rfl, ?_⟩ intro R h @@ -1144,7 +1142,7 @@ private theorem encLeft_not_surjective : normalize_at h1 contradiction -private theorem valid_stack_modes : IsValidStackModes encLeft encRight evalStackCfg := by +theorem valid_stack_modes : IsValidStackModes encLeft encRight evalStackCfg := by intro m cases m with | CR_n_n => exact ⟨C, .id [], .id [], by decide, by decide, Or.inr (Or.inr (fun _ _ => rfl))⟩ @@ -1152,25 +1150,48 @@ private theorem valid_stack_modes : IsValidStackModes encLeft encRight evalStack | DL_0_n => exact ⟨D, .id [], .id [0], by decide, by decide, Or.inr (Or.inl (fun _ _ => rfl))⟩ | DR_n_n => exact ⟨D, .id [], .id [], by decide, by decide, Or.inr (Or.inr (fun _ _ => rfl))⟩ +/-- The left and right pair-stack encodings are definitionally equal on all inputs. -/ +theorem encLeft_eq_encRight : encLeft = encRight := by + funext L + induction L with + | nil => rfl + | cons head tail ih => + rcases head with ⟨a, b⟩ + dsimp only [encLeft, encRight] + rw [ih] /-! ## Stack Reduction Witness -/ +/-- Closed pair-stack transition system for `target`. -/ +def closedStackSystem : ClosedStackSystem target where + StackMode := StackMode + dSym := 1 + sSym := 0 + encLeft := encLeft + encRight := encRight + evalStackCfg := evalStackCfg + IsInStackSystem := IsInStackSystem + hpolarity := Or.inl ⟨rfl, rfl⟩ + hnilL := rfl + hnilR := rfl + hheadL := encLeft_head + hheadR := encRight_head + hnsL := encLeft_not_surjective + hnsR := encRight_not_surjective + hparams := ⟨1, 1, 1, 1, 1, 1, 1, 1, by decide, by decide, by decide, by decide, by decide, + by decide, by decide, by decide, by decide, by decide, + fun _ _ _ => rfl, fun _ _ _ => rfl⟩ + hmodes := ⟨[.CR_n_n, .EL_n_n, .DL_0_n, .DR_n_n], by decide, by intro m; cases m <;> decide⟩ + hvalid := valid_stack_modes + hiff := fun _ => Iff.rfl + hin := fun m L R => ⟨m, L, R, rfl⟩ + htransfer := Or.inl ⟨.EL_n_n, .EL_n_n, (0, 0), id, ((0, 0) :: ·), + fun _ => Nat.le_succ _, step_EL_transfer⟩ + hclosed := stack_system_closed + /-- `target` reduces to a closed 2nd-order digit-stack transition system. -/ -theorem has_stack_reduction : HasStackReduction target := by - refine ⟨StackMode, 1, 0, encLeft, encRight, evalStackCfg, IsInStackSystem, - Or.inl ⟨rfl, rfl⟩, rfl, rfl, - encLeft_head, encRight_head, encLeft_not_surjective, encRight_not_surjective, - ⟨1, 1, 1, 1, 1, 1, 1, 1, by decide, by decide, by decide, by decide, by decide, - by decide, by decide, by decide, by decide, by decide, - fun _ _ _ => rfl, fun _ _ _ => rfl⟩, - ⟨[.CR_n_n, .EL_n_n, .DL_0_n, .DR_n_n], by decide, by intro m; cases m <;> decide⟩, - valid_stack_modes, - fun _ => Iff.rfl, - fun m L R => ⟨m, L, R, rfl⟩, - ⟨.CR_n_n, [(2, 0)], [(0, 0), (0, 0)], init_reaches_nontrivial, - by decide, ⟨(2, 0), by decide, by decide⟩⟩, - Or.inl ⟨.EL_n_n, .EL_n_n, (0, 0), id, ((0, 0) :: ·), - fun _ => Nat.le_succ _, step_EL_transfer⟩, - stack_system_closed⟩ +theorem has_stack_reduction : HasStackReduction target := + HasStackReduction.of_closedSystem closedStackSystem StackMode.CR_n_n [(2, 0)] [(0, 0), (0, 0)] + init_reaches_nontrivial (by decide) ⟨(2, 0), by decide, by decide⟩ end BusyBeaver.M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA diff --git a/BusyBeaver/BB6/Accelerations/Stack.lean b/BusyBeaver/BB6/Accelerations/Stack.lean index c879524a..df837fea 100644 --- a/BusyBeaver/BB6/Accelerations/Stack.lean +++ b/BusyBeaver/BB6/Accelerations/Stack.lean @@ -204,4 +204,357 @@ theorem HasStackReduction.of_oneDigit {Λ : Type*} [Inhabited Λ] exact hcfg' · exact ⟨cfg', hstep, Or.inr hhalt⟩ +/-! ## Direction and Tape Reflection -/ + +/-- Flip tape direction. -/ +def reflectDir : Dir → Dir + | .left => .right + | .right => .left + +@[simp] theorem reflectDir_reflectDir (d : Dir) : reflectDir (reflectDir d) = d := by + cases d <;> rfl + +/-- Reflect a doubly-infinite tape by swapping its left and right half-tapes. -/ +def reflectTape {Γ : Type*} [Inhabited Γ] (T : Tape Γ) : Tape Γ := + ⟨T.head, T.right, T.left⟩ + +@[simp] theorem reflectTape_reflectTape {Γ : Type*} [Inhabited Γ] (T : Tape Γ) : + reflectTape (reflectTape T) = T := by + cases T; rfl + +@[simp] theorem reflectTape_head {Γ : Type*} [Inhabited Γ] (T : Tape Γ) : + (reflectTape T).head = T.head := rfl + +@[simp] theorem reflectTape_write {Γ : Type*} [Inhabited Γ] (b : Γ) (T : Tape Γ) : + reflectTape (Tape.write b T) = Tape.write b (reflectTape T) := by + cases T; rfl + +@[simp] theorem reflectTape_move {Γ : Type*} [Inhabited Γ] (d : Dir) (T : Tape Γ) : + reflectTape (Tape.move d T) = Tape.move (reflectDir d) (reflectTape T) := by + cases d <;> cases T <;> rfl + +@[simp] theorem reflectTape_step_tape {Γ : Type*} [Inhabited Γ] (b : Γ) (d : Dir) (T : Tape Γ) : + reflectTape ((T.write b).move d) = ((reflectTape T).write b).move (reflectDir d) := by + cases d <;> cases T <;> rfl + +/-! ## Configuration Functors -/ + +/-- Map state and tape across Turing machine configuration types. -/ +def mapCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] + (σ : Option Λ₁ → Option Λ₂) (Tmap : Tape Γ → Tape Γ) (c : Cfg Γ Λ₁) : Cfg Γ Λ₂ := + ⟨σ c.q, Tmap c.tape⟩ + +/-- Relabel control states of a configuration. -/ +def mapState {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] (f : Λ₁ → Λ₂) (c : Cfg Γ Λ₁) : Cfg Γ Λ₂ := + ⟨c.q.map f, c.tape⟩ + +/-- Relabel control states and reflect tape of a configuration. -/ +def mirrorCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] (f : Λ₁ → Λ₂) (c : Cfg Γ Λ₁) : Cfg Γ Λ₂ := + ⟨c.q.map f, reflectTape c.tape⟩ + +@[simp] theorem mapState_headRight {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] + (f : Λ₁ → Λ₂) (q : Λ₁) (l r : ListBlank Γ) : + mapState f (Cfg.headRight q l r) = Cfg.headRight (f q) l r := rfl + +@[simp] theorem mapState_headLeft {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] + (f : Λ₁ → Λ₂) (q : Λ₁) (l r : ListBlank Γ) : + mapState f (Cfg.headLeft q l r) = Cfg.headLeft (f q) l r := rfl + +@[simp] theorem mapState_zero {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [OfNat Γ 0] + (f : Λ₁ → Λ₂) (q : Λ₁) (l r : ListBlank Γ) : + mapState f ⟨some q, ⟨(0 : Γ), l, r⟩⟩ = ⟨some (f q), ⟨(0 : Γ), l, r⟩⟩ := rfl + +@[simp] theorem mirrorCfg_headRight {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] + (f : Λ₁ → Λ₂) (q : Λ₁) (l r : ListBlank Γ) : + mirrorCfg f (Cfg.headRight q l r) = Cfg.headLeft (f q) r l := rfl + +@[simp] theorem mirrorCfg_headLeft {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] + (f : Λ₁ → Λ₂) (q : Λ₁) (l r : ListBlank Γ) : + mirrorCfg f (Cfg.headLeft q l r) = Cfg.headRight (f q) r l := rfl + +@[simp] theorem mirrorCfg_zero {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [OfNat Γ 0] + (f : Λ₁ → Λ₂) (q : Λ₁) (l r : ListBlank Γ) : + mirrorCfg f ⟨some q, ⟨(0 : Γ), l, r⟩⟩ = ⟨some (f q), ⟨(0 : Γ), r, l⟩⟩ := rfl + +/-! ## Commutation with Machine Steps -/ + +theorem step_mapCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] + (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) + (f : Λ₁ → Λ₂) (dmap : Dir → Dir) (Tmap : Tape Γ → Tape Γ) + (hT_head : ∀ (T : Tape Γ), (Tmap T).head = T.head) + (hT : ∀ (b : Γ) (d : Dir) (T : Tape Γ), + Tmap ((T.write b).move d) = ((Tmap T).write b).move (dmap d)) + (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => + ⟨q'.map f, Stmt.write b (dmap d)⟩) + (c : Cfg Γ Λ₁) : + step M₂ (mapCfg (Option.map f) Tmap c) = (step M₁ c).map (mapCfg (Option.map f) Tmap) := by + rcases c with ⟨_ | q, T⟩ + · rfl + · dsimp only [mapCfg, step, Option.map] + rw [hT_head, hM] + cases h : M₁ q T.head with + | none => rfl + | some res => + rcases res with ⟨q', ⟨b, d⟩⟩ + dsimp only [Option.map, Function.comp_apply] + rw [hT] + +theorem multiStep_mapCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] + (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) + (f : Λ₁ → Λ₂) (dmap : Dir → Dir) (Tmap : Tape Γ → Tape Γ) + (hT_head : ∀ (T : Tape Γ), (Tmap T).head = T.head) + (hT : ∀ (b : Γ) (d : Dir) (T : Tape Γ), + Tmap ((T.write b).move d) = ((Tmap T).write b).move (dmap d)) + (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => + ⟨q'.map f, Stmt.write b (dmap d)⟩) + (n : ℕ) (c : Cfg Γ Λ₁) : + multiStep M₂ (mapCfg (Option.map f) Tmap c) n = + (multiStep M₁ c n).map (mapCfg (Option.map f) Tmap) := by + induction n generalizing c with + | zero => rfl + | succ n ih => + simp only [multiStep_succ] + rw [step_mapCfg M₁ M₂ f dmap Tmap hT_head hT hM] + cases hs : step M₁ c with + | none => rfl + | some c' => + dsimp only [Option.map, Option.bind] + exact ih c' + +theorem reachesPlus_mapCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] + (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) + (f : Λ₁ → Λ₂) (dmap : Dir → Dir) (Tmap : Tape Γ → Tape Γ) + (hT_head : ∀ (T : Tape Γ), (Tmap T).head = T.head) + (hT : ∀ (b : Γ) (d : Dir) (T : Tape Γ), + Tmap ((T.write b).move d) = ((Tmap T).write b).move (dmap d)) + (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => + ⟨q'.map f, Stmt.write b (dmap d)⟩) + {c₁ c₂ : Cfg Γ Λ₁} (h : ReachesPlus M₁ c₁ c₂) : + ReachesPlus M₂ (mapCfg (Option.map f) Tmap c₁) (mapCfg (Option.map f) Tmap c₂) := by + rcases h with ⟨n, hn, hstep⟩ + refine ⟨n, hn, ?_⟩ + rw [multiStep_mapCfg M₁ M₂ f dmap Tmap hT_head hT hM, hstep] + rfl + +theorem step_isNone_mapCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] + (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) + (f : Λ₁ → Λ₂) (dmap : Dir → Dir) (Tmap : Tape Γ → Tape Γ) + (hT_head : ∀ (T : Tape Γ), (Tmap T).head = T.head) + (hT : ∀ (b : Γ) (d : Dir) (T : Tape Γ), + Tmap ((T.write b).move d) = ((Tmap T).write b).move (dmap d)) + (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => + ⟨q'.map f, Stmt.write b (dmap d)⟩) + (c : Cfg Γ Λ₁) : + (step M₂ (mapCfg (Option.map f) Tmap c)).isNone = (step M₁ c).isNone := by + rw [step_mapCfg M₁ M₂ f dmap Tmap hT_head hT hM] + cases step M₁ c <;> rfl + +theorem reachesPlus_mapState {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] + (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) (f : Λ₁ → Λ₂) + (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => ⟨q'.map f, Stmt.write b d⟩) + {c₁ c₂ : Cfg Γ Λ₁} (h : ReachesPlus M₁ c₁ c₂) : + ReachesPlus M₂ (mapState f c₁) (mapState f c₂) := + reachesPlus_mapCfg M₁ M₂ f id id (fun _ => rfl) (fun _ _ _ => rfl) hM h + +theorem reachesPlus_mirrorCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] + (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) (f : Λ₁ → Λ₂) + (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => + ⟨q'.map f, Stmt.write b (reflectDir d)⟩) + {c₁ c₂ : Cfg Γ Λ₁} (h : ReachesPlus M₁ c₁ c₂) : + ReachesPlus M₂ (mirrorCfg f c₁) (mirrorCfg f c₂) := + reachesPlus_mapCfg M₁ M₂ f reflectDir reflectTape (fun _ => rfl) reflectTape_step_tape hM h + +theorem step_isNone_mapState {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] + (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) (f : Λ₁ → Λ₂) + (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => ⟨q'.map f, Stmt.write b d⟩) + (c : Cfg Γ Λ₁) : + (step M₂ (mapState f c)).isNone = (step M₁ c).isNone := + step_isNone_mapCfg M₁ M₂ f id id (fun _ => rfl) (fun _ _ _ => rfl) hM c + +theorem step_isNone_mirrorCfg {Γ Λ₁ Λ₂ : Type*} [Inhabited Γ] [Inhabited Λ₁] [Inhabited Λ₂] + (M₁ : Machine Γ Λ₁) (M₂ : Machine Γ Λ₂) (f : Λ₁ → Λ₂) + (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => + ⟨q'.map f, Stmt.write b (reflectDir d)⟩) + (c : Cfg Γ Λ₁) : + (step M₂ (mirrorCfg f c)).isNone = (step M₁ c).isNone := + step_isNone_mapCfg M₁ M₂ f reflectDir reflectTape (fun _ => rfl) reflectTape_step_tape hM c + +/-! ## Closed Stack Transition Systems -/ + +/-- A closed 2nd-order digit-stack transition system for a Turing machine `M`. +Bundles the stack modes, polarity, unary-block recurrences, transfer rule, and closure +under `ReachesPlus`, independent of blank-tape reachability. -/ +structure ClosedStackSystem {k : ℕ} {Λ : Type*} [Inhabited Λ] + (M : Machine (Fin (k + 2)) Λ) where + StackMode : Type + dSym : Fin (k + 2) + sSym : Fin (k + 2) + encLeft : List (StackTuple (k + 2)) → ListBlank (Fin (k + 2)) + encRight : List (StackTuple (k + 2)) → ListBlank (Fin (k + 2)) + evalStackCfg : + StackMode → List (StackTuple (k + 2)) → List (StackTuple (k + 2)) → Cfg (Fin (k + 2)) Λ + IsInStackSystem : Cfg (Fin (k + 2)) Λ → Prop + hpolarity : IsValidStackPolarity dSym sSym + hnilL : encLeft [] = default + hnilR : encRight [] = default + hheadL : ∀ a b L, (encLeft ((a, b) :: L)).head = dSym + hheadR : ∀ d b R, (encRight ((d, b) :: R)).head = dSym + hnsL : ∃ t : ListBlank (Fin (k + 2)), t.head = dSym ∧ ∀ L, encLeft L ≠ t + hnsR : ∃ t : ListBlank (Fin (k + 2)), t.head = dSym ∧ ∀ R, encRight R ≠ t + hparams : ∃ strideL offsetL sepL maxSepL strideR offsetR sepR maxSepR : ℕ, + strideL > 0 ∧ offsetL > 0 ∧ sepL > 0 ∧ 1 ≤ maxSepL ∧ maxSepL ≤ 4 ∧ + strideR > 0 ∧ offsetR > 0 ∧ sepR > 0 ∧ 1 ≤ maxSepR ∧ maxSepR ≤ 4 ∧ + (∀ a b L, encLeft ((a, b) :: L) = + ListBlank.append (([dSym] : List (Fin (k + 2))) ^ (strideL * a + offsetL)) + (ListBlank.append + (([sSym] : List (Fin (k + 2))) ^ (stackSepLen (n := k + 1) sepL maxSepL b)) + (encLeft L))) ∧ + (∀ d b R, encRight ((d, b) :: R) = + ListBlank.append (([dSym] : List (Fin (k + 2))) ^ (strideR * d + offsetR)) + (ListBlank.append + (([sSym] : List (Fin (k + 2))) ^ (stackSepLen (n := k + 1) sepR maxSepR b)) + (encRight R))) + hmodes : ∃ modes : List StackMode, modes.length ≤ 6 ∧ ∀ m : StackMode, m ∈ modes + hvalid : IsValidStackModes encLeft encRight evalStackCfg + hiff : ∀ cfg, IsInStackSystem cfg ↔ ∃ m L R, cfg = evalStackCfg m L R + hin : ∀ m L R, IsInStackSystem (evalStackCfg m L R) + htransfer : + (∃ (m m' : StackMode) (x : StackTuple (k + 2)) + (g : StackTuple (k + 2) → StackTuple (k + 2)) + (f : List (StackTuple (k + 2)) → List (StackTuple (k + 2))), + (∀ s, s.length ≤ (f s).length) ∧ + ∀ z L R, + ReachesPlus M (evalStackCfg m (x :: z :: L) R) (evalStackCfg m' (g z :: L) (f R))) ∨ + (∃ (m m' : StackMode) (x : StackTuple (k + 2)) + (g : StackTuple (k + 2) → StackTuple (k + 2)) + (f : List (StackTuple (k + 2)) → List (StackTuple (k + 2))), + (∀ s, s.length ≤ (f s).length) ∧ + ∀ z L R, + ReachesPlus M (evalStackCfg m L (x :: z :: R)) (evalStackCfg m' (f L) (g z :: R))) + hclosed : ∀ cfg, IsInStackSystem cfg → + ∃ cfg', ReachesPlus M cfg cfg' ∧ (IsInStackSystem cfg' ∨ (step M cfg').isNone) + +/-- Derive `HasStackReduction` from a `ClosedStackSystem` together with an initial reachability +path from the blank tape to a non-trivial stack configuration. -/ +theorem HasStackReduction.of_closedSystem {k : ℕ} {Λ : Type*} [Inhabited Λ] + {M : Machine (Fin (k + 2)) Λ} (W : ClosedStackSystem M) + (m_g : W.StackMode) (L_g R_g : List (StackTuple (k + 2))) + (hreach : ReachesPlus M (init []) (W.evalStackCfg m_g L_g R_g)) + (hlen : 3 ≤ L_g.length + R_g.length) + (hpos : ∃ x ∈ L_g ++ R_g, 1 ≤ x.1) : + HasStackReduction M := by + refine ⟨W.StackMode, W.dSym, W.sSym, W.encLeft, W.encRight, W.evalStackCfg, W.IsInStackSystem, + W.hpolarity, W.hnilL, W.hnilR, W.hheadL, W.hheadR, W.hnsL, W.hnsR, W.hparams, W.hmodes, + W.hvalid, W.hiff, W.hin, ⟨m_g, L_g, R_g, hreach, hlen, hpos⟩, W.htransfer, W.hclosed⟩ + +/-- Transport a `ClosedStackSystem` along a state relabeling bijection `f`. -/ +def ClosedStackSystem.relabel {k : ℕ} {Λ₁ Λ₂ : Type*} [Inhabited Λ₁] [Inhabited Λ₂] + {M₁ : Machine (Fin (k + 2)) Λ₁} {M₂ : Machine (Fin (k + 2)) Λ₂} + (W : ClosedStackSystem M₁) (f : Λ₁ → Λ₂) + (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => ⟨q'.map f, Stmt.write b d⟩) : + ClosedStackSystem M₂ where + StackMode := W.StackMode + dSym := W.dSym + sSym := W.sSym + encLeft := W.encLeft + encRight := W.encRight + evalStackCfg m L R := mapState f (W.evalStackCfg m L R) + IsInStackSystem cfg := ∃ m L R, cfg = mapState f (W.evalStackCfg m L R) + hpolarity := W.hpolarity + hnilL := W.hnilL + hnilR := W.hnilR + hheadL := W.hheadL + hheadR := W.hheadR + hnsL := W.hnsL + hnsR := W.hnsR + hparams := W.hparams + hmodes := W.hmodes + hvalid := by + intro m + rcases W.hvalid m with ⟨q, vL, vR, hvL, hvR, h1 | h2 | h3⟩ + · refine ⟨f q, vL, vR, hvL, hvR, Or.inl (fun L R => ?_)⟩ + dsimp only + rw [h1, mapState_zero] + · refine ⟨f q, vL, vR, hvL, hvR, Or.inr (Or.inl (fun L R => ?_))⟩ + dsimp only + rw [h2, mapState_headLeft] + · refine ⟨f q, vL, vR, hvL, hvR, Or.inr (Or.inr (fun L R => ?_))⟩ + dsimp only + rw [h3, mapState_headRight] + hiff := by intro cfg; rfl + hin := by intro m L R; exact ⟨m, L, R, rfl⟩ + htransfer := by + rcases W.htransfer with ⟨m, m', x, g, fl, hflen, hstep⟩ | ⟨m, m', x, g, fl, hflen, hstep⟩ + · refine Or.inl ⟨m, m', x, g, fl, hflen, fun z L R => ?_⟩ + exact reachesPlus_mapState M₁ M₂ f hM (hstep z L R) + · refine Or.inr ⟨m, m', x, g, fl, hflen, fun z L R => ?_⟩ + exact reachesPlus_mapState M₁ M₂ f hM (hstep z L R) + hclosed := by + intro cfg ⟨m, L, R, hcfg⟩ + rw [hcfg] + have hsys₁ : W.IsInStackSystem (W.evalStackCfg m L R) := W.hin m L R + rcases W.hclosed (W.evalStackCfg m L R) hsys₁ with ⟨cfg', hreach, hsys' | hhalt⟩ + · rcases (W.hiff cfg').mp hsys' with ⟨m', L', R', hcfg'⟩ + refine ⟨mapState f cfg', reachesPlus_mapState M₁ M₂ f hM hreach, Or.inl ⟨m', L', R', ?_⟩⟩ + rw [hcfg'] + · refine ⟨mapState f cfg', reachesPlus_mapState M₁ M₂ f hM hreach, Or.inr ?_⟩ + rw [step_isNone_mapState M₁ M₂ f hM] + exact hhalt + +/-- Transport a `ClosedStackSystem` along a state bijection `f` and tape reflection (mirror). -/ +def ClosedStackSystem.mirror {k : ℕ} {Λ₁ Λ₂ : Type*} [Inhabited Λ₁] [Inhabited Λ₂] + {M₁ : Machine (Fin (k + 2)) Λ₁} {M₂ : Machine (Fin (k + 2)) Λ₂} + (W : ClosedStackSystem M₁) (f : Λ₁ → Λ₂) + (h_symm : W.encLeft = W.encRight) + (hM : ∀ q a, M₂ (f q) a = (M₁ q a).map fun ⟨q', Stmt.write b d⟩ => + ⟨q'.map f, Stmt.write b (reflectDir d)⟩) : + ClosedStackSystem M₂ where + StackMode := W.StackMode + dSym := W.dSym + sSym := W.sSym + encLeft := W.encLeft + encRight := W.encRight + evalStackCfg m L R := mirrorCfg f (W.evalStackCfg m R L) + IsInStackSystem cfg := ∃ m L R, cfg = mirrorCfg f (W.evalStackCfg m R L) + hpolarity := W.hpolarity + hnilL := W.hnilL + hnilR := W.hnilR + hheadL := W.hheadL + hheadR := W.hheadR + hnsL := W.hnsL + hnsR := W.hnsR + hparams := W.hparams + hmodes := W.hmodes + hvalid := by + intro m + rcases W.hvalid m with ⟨q, vL, vR, hvL, hvR, h1 | h2 | h3⟩ + · refine ⟨f q, vR, vL, hvR, hvL, Or.inl (fun L R => ?_)⟩ + dsimp only + rw [h1, mirrorCfg_zero, h_symm] + · refine ⟨f q, vR, vL, hvR, hvL, Or.inr (Or.inr (fun L R => ?_))⟩ + dsimp only + rw [h2, mirrorCfg_headLeft, h_symm] + · refine ⟨f q, vR, vL, hvR, hvL, Or.inr (Or.inl (fun L R => ?_))⟩ + dsimp only + rw [h3, mirrorCfg_headRight, h_symm] + hiff := by intro cfg; rfl + hin := by intro m L R; exact ⟨m, L, R, rfl⟩ + htransfer := by + rcases W.htransfer with ⟨m, m', x, g, fl, hflen, hstep⟩ | ⟨m, m', x, g, fl, hflen, hstep⟩ + · refine Or.inr ⟨m, m', x, g, fl, hflen, fun z L R => ?_⟩ + exact reachesPlus_mirrorCfg M₁ M₂ f hM (hstep z R L) + · refine Or.inl ⟨m, m', x, g, fl, hflen, fun z L R => ?_⟩ + exact reachesPlus_mirrorCfg M₁ M₂ f hM (hstep z R L) + hclosed := by + intro cfg ⟨m, L, R, hcfg⟩ + rw [hcfg] + have hsys₁ : W.IsInStackSystem (W.evalStackCfg m R L) := W.hin m R L + rcases W.hclosed (W.evalStackCfg m R L) hsys₁ with ⟨cfg', hreach, hsys' | hhalt⟩ + · rcases (W.hiff cfg').mp hsys' with ⟨m', R', L', hcfg'⟩ + refine ⟨mirrorCfg f cfg', reachesPlus_mirrorCfg M₁ M₂ f hM hreach, Or.inl ⟨m', L', R', ?_⟩⟩ + rw [hcfg'] + · refine ⟨mirrorCfg f cfg', reachesPlus_mirrorCfg M₁ M₂ f hM hreach, Or.inr ?_⟩ + rw [step_isNone_mirrorCfg M₁ M₂ f hM] + exact hhalt + end BusyBeaver.Stack diff --git a/BusyBeaver/BB6/Hardness.lean b/BusyBeaver/BB6/Hardness.lean index 6cc8928f..8b8f0984 100644 --- a/BusyBeaver/BB6/Hardness.lean +++ b/BusyBeaver/BB6/Hardness.lean @@ -15,7 +15,8 @@ Lucy's Moonlight), applied uniformly to the machines formalized in this reposito cited here is kernel-verified (`HasCollatzReduction`, `HasStackReduction`, `IsValidAcceleration`), machine-level halting equivalences are proved in `BusyBeaver.BB6.Equivalences`, and kernel-checked live-hazard witnesses (`highLevelNext s = none` / `next s = none`) and parametric halting residue -classes across all 26 core machines with explicit Collatz-like accelerations are proved in +classes across 26 core machines (the 24 hard-core machines that have `IsValidAcceleration`, +plus `#568` and `1RB1RF_1LC1LF_---1LD_1LE0RA_1RE1LB_1RD0LD`) are proved in `BusyBeaver.BB6.HardnessEvidence`; every hazard statement below is a *heuristic* computed from the certified rules by exact accelerated simulation and is marked as such. The full dossiers, with reproduction commands, accompany the arXiv report; this page is the summary. @@ -63,41 +64,41 @@ has not been re-measured with the method of this page, so they carry no verdict ([#330](./M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.lean)) (ours): Problem 1; Tetrational Hydra-Reset (Racheline / ShiftOv6). Trigger RES + competing sinks; growth tetrational ($10 \uparrow\uparrow k$, $N_7 \approx 2.86\times10^{771}$); shield none. undecided type (second - known after Racheline's #424). Status: `is_cryptid`; `HasCollatzReduction`; open (on the + known after Racheline's #424). Status: cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_---0RE` ([#183](./M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.lean)) (ours): Problem 2; Single-Base Exponential Cascade. Trigger EQ (shrinking target) with leaky parity shield; growth linear (mass $2k+c$, drift $+2$/cycle); shield leaky (odd-$c$ regime blocks the coincidence). probviously - non-halting. Status: `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). + non-halting. Status: cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_---0RE` ([#352](./M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.lean)) (ours): Problem 2; Single-Base Exponential Cascade. Trigger EQ with leaky parity shield; growth linear ($2^n$ fuel bursts, - intermittent resets); shield leaky. probviously non-halting. Status: `is_cryptid`; + intermittent resets); shield leaky. probviously non-halting. Status: cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_---0RE` ([#530](./M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.lean)) (ours): Problem 2; Single-Base Exponential Cascade. Trigger EQ with leaky parity shield; growth linear; shield leaky. probviously - non-halting. Status: `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). + non-halting. Status: cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB0LF_1RC1RA_0RD0RB_1LE---_0LA1LE_1RD1LA` ([#429](./M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.lean)) (ours): Problem 3; Single-Base Exponential Cascade. Trigger EQ, critical; growth linear ($2v+w \approx 43.66\,T$); shield none (parity flips every step). probviously halting, but only at $\sim 10^{110}$ steps. Status: - `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). + cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB1LF_0RC1RD_1LA1LD_1LE0RA_---1LC_0LA1LA` ([#184](./M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.lean)) (ours): Problem 4; Single-Base Exponential Cascade. Trigger EQ (2-wide window at turnaround); growth exponential ($\gamma\approx1.4246$ per era, base 3); shield none. probviously non-halting. Status: - `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). + cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB1RB_1LC0RE_---1LD_0RA1LB_1RA1LF_0LE1LE` ([#724](./M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.lean)) (ours): Problem 4; Single-Base Exponential Cascade. Trigger EQ (2-wide window); growth exponential ($\gamma\approx1.4589$ per - era); shield none. probviously non-halting. Status: `is_cryptid`; `HasCollatzReduction`; open (on + era); shield none. probviously non-halting. Status: cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_---1RA` ([#73](./M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.lean)) (ours): Problem 5; Tetrational Hydra-Reset (Racheline / ShiftOv6). Trigger EQ (rebound trap); growth exponential - ($\gamma\approx1.9538$ per era); shield none. probviously non-halting. Status: `is_cryptid`; + ($\gamma\approx1.9538$ per era); shield none. probviously non-halting. Status: cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). ### Shielded single-base exponential cascades @@ -105,57 +106,57 @@ has not been re-measured with the method of this page, so they carry no verdict * `1RB0LF_1LC0LD_1RD1LB_---1RE_0RA1RE_1LA0LE` ([#79](./M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean)) (ours): Cascade; Single-Base Exponential Cascade. Trigger EQ; growth super-exponential (two-stage $2^n$ doubling tower); shield - none. probviously non-halting. Status: `is_cryptid`; `HasCollatzReduction`; open (on the + none. probviously non-halting. Status: cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB1LF_1RC1RF_0LD1RE_---1LC_0RB1RE_1LA0LE` ([#116](./M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean)) (wiki): Cascade; Single-Base Exponential Cascade. Trigger EQ; growth exponential; shield see family. wiki rediscovery - (RobinCodes *Next Steps* list). Status: `is_cryptid`, `is_stack_cryptid`; `HasCollatzReduction`; + (RobinCodes *Next Steps* list). Status: cryptid / stack cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_---1RD` ([#153](./M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.lean)) (ours): Cascade; Single-Base Exponential Cascade. Trigger EQ; growth exponential (two-base: $2^n$ doubling then $4^n$ quadrupling, $\times2.3917$ per launch); shield none. probviously non-halting. Status: - `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). + cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_---0RD` ([#464](./M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.lean)) (ours): Cascade; Single-Base Exponential Cascade. Trigger EQ; growth exponential ($4^n$ inner cascades, $(4/3)^k$ sweeps); shield partial (odd-$a$ invariant kills 2 of 4 halting rules and 12 of 34 rules). probviously - non-halting. Status: `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). + non-halting. Status: cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB0RE_1LC0RA_1RF0RD_---1LE_0LB1LE_1LE1RC` ([#590](./M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.lean)) (ours): Cascade; Single-Base Exponential Cascade. Trigger EQ; growth super-exponential; shield none. probviously non-halting. - Status: `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). + Status: cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB1RF_1LC---_1LE1RD_1RA0RC_0LF0LA_0LD0RB` ([#614](./M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.lean)) (ours): Cascade; Single-Base Exponential Cascade. Trigger EQ ($2^n$ remainder coincidence); growth exponential ($\times1.4069$ per cascade); shield partial ($a\ge1$ kills `rule_1_halt`). probviously non-halting. Status: - `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). + cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---0LA` ([#623](./M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean)) (ours): Cascade; Single-Base Exponential Cascade. Trigger EQ; growth exponential (4-counter $3^n$ cascade); shield full (odd-$a_H$ parity shield blocks every `closes_H_mid` halt). probviously non-halting; strong - `IsDoesNotHalt` candidate. Status: `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 + `IsDoesNotHalt` candidate. Status: cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_---0RE` ([#644](./M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.lean)) (ours): Cascade; Single-Base Exponential Cascade. Trigger EQ (second-order coincidence); growth exponential ($2^n$ cascade); shield partial (even-$c$ parity shield blocks 99.8% of visits). probviously non-halting. Status: - `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). + cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB1RF_1LC1LF_0RE1LD_0LB1LD_---1RC_1RA0RD` ([#688](./M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean)) (wiki): Cascade; Single-Base Exponential Cascade. Trigger EQ; growth exponential; shield see family. wiki rediscovery - (RobinCodes *Next Steps* list). Status: `is_cryptid`, `is_stack_cryptid`; `HasCollatzReduction`; + (RobinCodes *Next Steps* list). Status: cryptid / stack cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB1RC_1LC1LC_1RE0LD_1LB1RF_---1RA_0RD1RD` ([#693](./M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.lean)) (ours): Cascade; Single-Base Exponential Cascade. Trigger EQ; growth exponential ($\times1.2402$ per step); shield none. - probviously non-halting. Status: `is_cryptid`; `HasCollatzReduction`; open (on the 2026-10-24 + probviously non-halting. Status: cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). * `1RB0LF_1LC1RA_0RE0RD_---1LE_1LF1RC_1LC1LA` ([#746](./M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean)) (ours): Cascade; Single-Base Exponential Cascade. Trigger EQ; growth exponential ($2^n$ cascade + base-$3/2$ underflow drain); - shield partial (exact even-$c$ invariant). probviously non-halting. Status: `is_cryptid`; + shield partial (exact even-$c$ invariant). probviously non-halting. Status: cryptid; `HasCollatzReduction`; open (on the 2026-10-24 holdout list). ### Collatz-like stacked cryptids (S2-S5 and their siblings) @@ -163,47 +164,50 @@ has not been re-measured with the method of this page, so they carry no verdict * `1RB1LA_1LA0RC_1RD1RC_1LE0RC_---0LF_1LE0LA` ([#391](./Accelerations/M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.lean)) (ours): Problem S2; Unary-Binary Bounded Stack Counter. Trigger POW (bottom funnel $x+2 = 2^k$); growth power-law - regime; shield partial (`ValidStack391`: mode $D$ never halts). probviously non-halting (clean - race). Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). + regime; shield partial (mode $D$ never halts). probviously non-halting (clean + race). Status: stack cryptid; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB0RB_1RC0LE_1LD1LA_---0LC_1RF1LE_1RA0RA` ([#129](./Accelerations/M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.lean)) (ours): Problem S3; Halving Tower (2-Adic Stack). Trigger EQ (depth-two gate); growth —; shield partial - (`ValidStack129` kills $\mathrm{CR}\,[]\,R$ and all $0::0::L$ states). probviously non-halting - (weak race). Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). + (unreachable states include $\mathrm{CR}\,[]\,R$ and all $0::0::L$ configurations). + probviously non-halting + (weak race). Status: stack cryptid; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB0LD_1LC1RD_0LE1LA_0RB1RD_---0LF_1RA1LF` ([#660](./Accelerations/M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.lean)) (ours): Problem S4; Halving Tower (2-Adic Stack). Trigger POW (power-of-two bottom exposure); growth mass-conserving - ($\Delta M = 0$), log-depth tower; shield partial (`ValidStack660` kills $C([],R)$). probviously - non-halting. Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). + ($\Delta M = 0$), log-depth tower; shield partial + (the empty-left configuration $C([],R)$ is unreachable). probviously + non-halting. Status: stack cryptid; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RA---_1RB1LF` ([#659](./Accelerations/M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.lean)) (ours): Problem S4; Halving Tower (2-Adic Stack). Trigger POW; growth mass-conserving sandpile; shield partial. - probviously non-halting. Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 + probviously non-halting. Status: stack cryptid; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB1RC_1LC0LE_1RD1RC_1LB0RA_---0LF_1RD1LF` ([#209](./Accelerations/M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.lean)) (ours): Problem S4; Halving Tower (2-Adic Stack). Trigger POW; growth mass-conserving sandpile; shield partial. - probviously non-halting. Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 + probviously non-halting. Status: stack cryptid; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB1RA_1RC1LB_1LD0RA_---0LE_1LC0LF_1RE0LB` ([#680](./Accelerations/M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.lean)) (ours): Problem S4; Halving Tower (2-Adic Stack). Trigger POW; growth mass-conserving sandpile; shield partial - (`ValidStack680` kills $C([],R)$; strict digit positivity at `mode_C`). probviously non-halting. - Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). + (the empty-left configuration $C([],R)$ is unreachable; strict digit positivity at mode $C$). + probviously non-halting. + Status: stack cryptid; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB0LC_1LC0RE_1LD1LC_1LA1RD_---0RF_0LB0RD` ([#480](./Accelerations/M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.lean)) (ours): S4 sibling; Halving Tower (2-Adic Stack). Trigger POW; growth mass-conserving sandpile; shield partial (strict - digit positivity blocks the sole $d=0$ halt). probviously non-halting. Status: `is_stack_cryptid`; + digit positivity blocks the sole $d=0$ halt). probviously non-halting. Status: stack cryptid; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB1LA_1RC0RF_1RD---_0LE1RB_---0LA_1LD1RF` ([#549](./Accelerations/M_1RB1LA_1RC0RF_1RDHHH_0LE1RB_HHH0LA_1LD1RF.lean)) (wiki): Problem S5; Halving Tower (2-Adic Stack). Trigger POW (Mersenne bottom rung $2^k-1$); growth —; shield partial - (`ValidStack549` kills the empty-stack halt). probviously non-halting, slowly critical. Status: - `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). + (the empty-stack halt is unreachable). probviously non-halting, slowly critical. Status: + stack cryptid; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB---_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA` ([#80](./Accelerations/M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.lean)) (ours): S5 sibling; Halving Tower (2-Adic Stack). Trigger POW; growth —; shield partial. probviously non-halting. - Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). + Status: stack cryptid; `Accelerations`; open (on the 2026-10-24 holdout list). ### Wiki stack families @@ -212,7 +216,7 @@ has not been re-measured with the method of this page, so they carry no verdict 2nd-Order Stride-k Digit-Stack. Trigger era-recursive (3-case bottom-extension recurrence); growth doubly-exponential era lengths ($T_0..T_3 = 1, 2, 8, 256$); shield none closed (all-even $R$ + $L.\mathrm{last}=0$ refuted across eras). probviously non-halting (wiki cryptid). Status: - `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). + stack cryptid; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` ([#85](./Accelerations/M_1RBHHH_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA.lean)) (wiki): Wiki stack; Unary-Binary Bounded Stack Counter. Trigger RES (a particular sequence of $\approx 107$–$110$ @@ -220,26 +224,26 @@ has not been re-measured with the method of this page, so they carry no verdict is multiplied by $8/3$ per era; wiki); shield none (every return to an empty left side is a fresh trial). probviously **halting** (wiki, Racheline 2024-11-23: expected halt at $\approx 10^{10^{38.1}}$ steps, far beyond any simulation); the wiki treats the four start states - #85/#285/#490/#500 as one cryptid. Status: `is_stack_cryptid`; `Accelerations`; open (on the + #85/#285/#490/#500 as one cryptid. Status: stack cryptid; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1RE---` ([#285](./Accelerations/M_1RB1RD_1LC0LE_1RA0LB_1RA1RF_0RA0RC_1REHHH.lean)) (wiki): Wiki stack; Unary-Binary Bounded Stack Counter. Trigger as #85 (same table, started from its state `C`); growth as #85; shield as #85. same dynamics as `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` (#85) (wiki: "when the TM starts on any starting state, it exhibits the same probviously halting - behaviour"). Status: `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). + behaviour"). Status: stack cryptid; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LE---` ([#490](./Accelerations/M_1RB0RE_1LC0RA_1LA1LD_1LC1LF_0LC0LB_1LEHHH.lean)) (wiki): Wiki stack; Unary-Binary Bounded Stack Counter. Trigger as #85 (same table, started from its state `D`, mirrored); growth as #85; shield as #85. same dynamics as `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` (#85); this is the start state analysed by @-d on the wiki (halting path of length 108, $\approx 235{,}000$ right-side words explored). Status: - `is_stack_cryptid`; `Accelerations`; open (on the 2026-10-24 holdout list). + stack cryptid; `Accelerations`; open (on the 2026-10-24 holdout list). * `1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RD---` ([#500](./Accelerations/M_1RB0LC_1RC1RE_1LA0LD_0RB0RA_1RB1RF_1RDHHH.lean)) (wiki): Wiki stack; Unary-Binary Bounded Stack Counter. Trigger as #85 (same table, started from its state `E`); growth as #85; shield as #85. same dynamics as `1RB---_0RC0RE_1RD1RF_1LE0LB_1RC0LD_1RC1RA` (#85) - (wiki: the start states `E` and `F` share one trajectory). Status: `is_stack_cryptid`; + (wiki: the start states `E` and `F` share one trajectory). Status: stack cryptid; `Accelerations`; open (on the 2026-10-24 holdout list). ### Resolved by the community @@ -247,9 +251,10 @@ has not been re-measured with the method of this page, so they carry no verdict * `1RB1LA_0RC1RD_1LC0LA_1LE1RE_0RB0LF_---0LD` ([bbchallenge](https://bbchallenge.org/1RB1LA_0RC1RD_1LC0LA_1LE1RE_0RB0LF_---0LD)) (ours): Problem S1 (resolved: halts); Unary-Binary Bounded Stack Counter. Trigger POW (Mersenne-minus-2 funnel - $c+2=2^r$ at $L=[]$); growth power-law ($\propto t^{1/2}$); shield partial (`inv_126_R_shape`). + $c+2=2^r$ at $L=[]$); growth power-law ($\propto t^{1/2}$); shield partial + (right-stack shape invariant). **HALTS** — busycoq `CubicMachines.v` (TM49), certified accelerated simulation; our dossier said - "critical, $0.4$–$0.9$ expected halts per decade". Status: `is_stack_cryptid`; decided HALTING + "critical, $0.4$–$0.9$ expected halts per decade". Status: stack cryptid; decided HALTING (busycoq). ## 3. Per-machine hazard statements @@ -327,7 +332,8 @@ has not been re-measured with the method of this page, so they carry no verdict * **Hazard:** not re-measured in our dossiers * **Simulated horizon:** — -* **Why it is hard / what a proof needs:** 1st-order collapse of a false stack (`Valid3Counter116`) +* **Why it is hard / what a proof needs:** 1st-order collapse of a false stack + (unreachable non-zero second stack) * **Wiki:** ### `1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_---1RD` (#153, Cascade) @@ -339,16 +345,17 @@ has not been re-measured with the method of this page, so they carry no verdict ### `1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_---0RD` (#464, Cascade) * **Hazard:** $P(\text{halt}) \lesssim 10^{-5}$ per era -* **Simulated horizon:** exact rule simulation (see dossier) +* **Simulated horizon:** exact rule simulation * **Why it is hard / what a proof needs:** remaining halts `rule_4/12_halt` need $c_{\text{rem}}=1$: a $(4/3)^k$ Mahler-type residue problem ### `1RB0RE_1LC0RA_1RF0RD_---1LE_0LB1LE_1LE1RC` (#590, Cascade) * **Hazard:** $P(\text{halt}) \ll 10^{-600}$ -* **Simulated horizon:** $> 3.46\times10^{1204}$ TM steps in 12 cascades -* **Why it is hard / what a proof needs:** E1 sibling of #79 with identical rules from $D_1(1,0,0)$ - (candidate exact equivalence) +* **Simulated horizon:** 10 cascades (exact; reaches $A(65490, 3)$) +* **Why it is hard / what a proof needs:** shares the exact `highLevelNext` transition map with #79, + but starts from $A(4, 3)$ rather than $A(5, 2)$; the two orbits remain disjoint + (`(4,3) → (19,3) → (13,11) → (28,3)` vs. `(5,2) → (10,3) → (4,11) → (27,3)`) ### `1RB1RF_1LC---_1LE1RD_1RA0RC_0LF0LA_0LD0RB` (#614, Cascade) @@ -367,7 +374,7 @@ has not been re-measured with the method of this page, so they carry no verdict ### `1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_---0RE` (#644, Cascade) * **Hazard:** $P(\text{halt}) \lesssim 10^{-6}$ (convergent $\sum m^{-2}$ tail) -* **Simulated horizon:** exact rule simulation (see dossier) +* **Simulated horizon:** exact rule simulation * **Why it is hard / what a proof needs:** halting requires both $c = 2b-4$ and $c_{\text{odd}} = 2^{k+3}-2k-5$ @@ -460,7 +467,7 @@ has not been re-measured with the method of this page, so they carry no verdict ### `1RB1LD_1RC0LE_1LA1RE_0LF1LA_1RB0RB_---0LB` (#33, Wiki stack) -* **Hazard:** not quantified; perturbed all-even seeds halt in Era 2/3 (`rec_59_bottom_extension`) +* **Hazard:** not quantified; perturbed all-even seeds halt in Era 2/3 (bottom extension recurrence) * **Simulated horizon:** pumping test: 46 perturbed configurations, 0 halts in $10^5$ steps * **Why it is hard / what a proof needs:** exact 3-case composition theorem verified on all 1,024 stacks of weight $\le10$ diff --git a/BusyBeaver/BB6/HardnessEvidence.lean b/BusyBeaver/BB6/HardnessEvidence.lean index b416bd0d..8e633466 100644 --- a/BusyBeaver/BB6/HardnessEvidence.lean +++ b/BusyBeaver/BB6/HardnessEvidence.lean @@ -55,7 +55,7 @@ not decide whether the forward orbit from `start` / `highLevelStart` enters that @[expose] public section -namespace BusyBeaver.HardnessEvidence +namespace BusyBeaver.BB6.HardnessEvidence /-! ## Problems 1–5 (Named Community Cryptids) -/ @@ -494,13 +494,16 @@ theorem halting_state_witness : highLevelNext (.C 0 0) = none := by theorem halting_residue_class (a : ℕ) : highLevelNext (.C a 0) = none := by simp [highLevelNext] -/-- Pre-halting family (`b = a / 2 + 4`): `C a (a / 2 + 4)` steps directly into the `C _ 0` halting -family. -/ +/-- Two-step halting family (`b = a / 2 + 4`): `C a (a / 2 + 4)` steps into `C _ 0` and halts in +two high-level steps. -/ theorem halting_residue_class_two_step (a : ℕ) : - highLevelNext (.C a (a / 2 + 4)) = some (.C (6 * (a / 2 + 2) + 3 * (a % 2) + 5) 0) := by + (highLevelNext (.C a (a / 2 + 4))).bind highLevelNext = none := by rw [show a / 2 + 4 = (a / 2 + 2) + 2 by omega] simp only [highLevelNext] - split_ifs <;> first | omega | (congr 2; omega) + split_ifs <;> try omega + have hsub : a / 2 + 2 - (a / 2 + 2) = 0 := by omega + rw [hsub] + rfl end M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD @@ -517,13 +520,16 @@ theorem halting_state_witness : highLevelNext (.C 0 1) = none := by theorem halting_residue_class (a : ℕ) : highLevelNext (.C a 1) = none := by simp [highLevelNext] -/-- Pre-halting family (`b = 2a + 3`): `C a (2a + 3)` steps directly to `C (2a + 2) 1`, which halts -on the next high-level step. -/ +/-- Two-step halting family (`b = 2a + 3`): `C a (2a + 3)` steps to `C (2a + 2) 1` and halts in +two high-level steps. -/ theorem halting_residue_class_two_step (a : ℕ) : - highLevelNext (.C a (2 * a + 3)) = some (.C (2 * a + 2) 1) := by + (highLevelNext (.C a (2 * a + 3))).bind highLevelNext = none := by rw [show 2 * a + 3 = (2 * a + 1) + 2 by omega] simp only [highLevelNext] - split_ifs <;> first | omega | (congr 2; omega) + split_ifs <;> try omega + have hsub : 2 * a + 1 - 2 * a = 1 := by omega + rw [hsub] + rfl end M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA @@ -683,11 +689,11 @@ theorem halting_residue_class (b : ℕ) (L : List ℕ) (d : ℕ) (R : List ℕ) next (.CR 1 b L (d + 1) R) = none := by simp [next] -/-- Pre-halting family (`r = 1`): `CR (a + 2) b L 1 R` steps directly into the `CR 1 ...` halting -family whenever `bump1 R` has positive head. -/ -theorem halting_residue_class_two_step (a b : ℕ) (L R : List ℕ) : - next (.CR (a + 2) b L 1 R) = some (.CR 1 (a + 1) (b :: L) (bump1 R).1 (bump1 R).2) := by - simp [next] +/-- Two-step halting family (`r = 1`, non-empty tail `r :: R`): `CR (a + 2) b L 1 (r :: R)` halts +in two accelerated steps via `bump1 (r :: R) = (r + 1, R)`. -/ +theorem halting_residue_class_two_step (a b : ℕ) (L : List ℕ) (r : ℕ) (R : List ℕ) : + (next (.CR (a + 2) b L 1 (r :: R))).bind next = none := by + simp [next, bump1] end M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA @@ -708,4 +714,4 @@ theorem halting_residue_class (k d : ℕ) (R : List ℕ) : end M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD -end BusyBeaver.HardnessEvidence +end BusyBeaver.BB6.HardnessEvidence diff --git a/BusyBeaver/BB6/M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.lean b/BusyBeaver/BB6/M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.lean index 37da6a41..f68d4406 100644 --- a/BusyBeaver/BB6/M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.lean +++ b/BusyBeaver/BB6/M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.lean @@ -44,7 +44,6 @@ T(E(p, k, c)) = \begin{cases} \end{cases} $$ - ## Hardness *Hardness class:* Problem 5 — trigger **EQ (rebound trap)**, growth exponential @@ -62,7 +61,6 @@ the expanding dual of Tao's Syracuse step) alternating with even-$c$ subtraction $c_j - 2k_j \in \lbrace -4,+2 \rbrace$ See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean b/BusyBeaver/BB6/M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean index 92350d5a..ccec8dbe 100644 --- a/BusyBeaver/BB6/M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean +++ b/BusyBeaver/BB6/M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.lean @@ -64,7 +64,6 @@ T_{\mathrm{HL}}(D(a, d)) = \begin{cases} \end{cases} $$ - ## Hardness *Hardness class:* Cascade — trigger **EQ**, growth exponential (4-counter $3^n$ cascade), shield @@ -81,7 +80,6 @@ non-halting; strong `IsDoesNotHalt` candidate. proves #568 ≡ #623 See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean b/BusyBeaver/BB6/M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean index 03274386..e40a3fda 100644 --- a/BusyBeaver/BB6/M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean +++ b/BusyBeaver/BB6/M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.lean @@ -45,7 +45,6 @@ F(m, p, n, c) = \begin{cases} \end{cases} $$ - ## Hardness *Hardness class:* Cascade — trigger **EQ**, growth super-exponential (two-stage $2^n$ doubling @@ -61,7 +60,6 @@ non-halting. *Why it is hard:* coupled outer `D1` and inner `Modd` $2^n$ cascades; halts iff $D_1(2,u,0)$ See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean b/BusyBeaver/BB6/M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean index 3615b773..6955c0d4 100644 --- a/BusyBeaver/BB6/M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean +++ b/BusyBeaver/BB6/M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.lean @@ -31,7 +31,6 @@ T(C(a, b)) = \begin{cases} \end{cases} $$ - ## Hardness *Hardness class:* Cascade — trigger **EQ**, growth exponential ($2^n$ cascade + base-$3/2$ underflow @@ -48,7 +47,6 @@ non-halting. $\lbrace 4\cdot2^n - n - 6 \rbrace$ See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.lean b/BusyBeaver/BB6/M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.lean index 6b8d67d3..1ce1cc5d 100644 --- a/BusyBeaver/BB6/M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.lean +++ b/BusyBeaver/BB6/M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.lean @@ -36,7 +36,6 @@ T(J(u, w)) = \begin{cases} \end{cases} $$ - ## Hardness *Hardness class:* Problem 3 — trigger **EQ, critical**, growth linear ($2v+w \approx 43.66\,T$), @@ -53,7 +52,6 @@ Borel–Cantelli boundary); $\approx 2\%$ per decade *Why it is hard:* 1-D harmonic-series shrinking target; halting iff $w_t = 2v_t + 8$ at a turnaround See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.lean b/BusyBeaver/BB6/M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.lean index 7215b08e..3d679a66 100644 --- a/BusyBeaver/BB6/M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.lean +++ b/BusyBeaver/BB6/M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.lean @@ -55,7 +55,6 @@ map $T$, writing $k = 3q + r$ with $r \in \lbrace 0, 1, 2 \rbrace$ and $d = c - \end{cases} $$ - ## Hardness *Hardness class:* Cascade — trigger **EQ**, growth exponential ($4^n$ inner cascades, $(4/3)^k$ @@ -66,13 +65,12 @@ non-halting. *Hazard:* $P(\text{halt}) \lesssim 10^{-5}$ per era -*Simulated horizon:* exact rule simulation (see dossier) +*Simulated horizon:* exact rule simulation *Why it is hard:* remaining halts `rule_4/12_halt` need $c_{\text{rem}}=1$: a $(4/3)^k$ Mahler-type residue problem See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.lean b/BusyBeaver/BB6/M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.lean index 95b6acb1..b3f28d97 100644 --- a/BusyBeaver/BB6/M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.lean +++ b/BusyBeaver/BB6/M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.lean @@ -45,7 +45,6 @@ F(m, p, n, c) = \begin{cases} \end{cases} $$ - ## Hardness *Hardness class:* Cascade — trigger **EQ**, growth super-exponential, shield none. @@ -55,13 +54,12 @@ non-halting. *Hazard:* $P(\text{halt}) \ll 10^{-600}$ -*Simulated horizon:* $> 3.46\times10^{1204}$ TM steps in 12 cascades +*Simulated horizon:* 10 cascades (exact; reaches $A(65490, 3)$) -*Why it is hard:* E1 sibling of #79 with identical rules from $D_1(1,0,0)$ (candidate exact -equivalence) +*Why it is hard:* shares the exact `highLevelNext` transition map with #79, but starts from +$A(4, 3)$ rather than $A(5, 2)$; the two orbits remain disjoint See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.lean b/BusyBeaver/BB6/M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.lean index 5863a198..e470a86b 100644 --- a/BusyBeaver/BB6/M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.lean +++ b/BusyBeaver/BB6/M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.lean @@ -96,7 +96,6 @@ $$ \end{aligned} $$ - ## Hardness *Hardness class:* Problem 1 — trigger **RES + competing sinks**, growth tetrational @@ -115,7 +114,6 @@ $10^{771}$-digit number computable, not provable with current tools See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.lean b/BusyBeaver/BB6/M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.lean index 1dbf3388..46c00e52 100644 --- a/BusyBeaver/BB6/M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.lean +++ b/BusyBeaver/BB6/M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.lean @@ -57,7 +57,6 @@ T_{\mathrm{HL}}(C(b, d + 2)) &= \begin{cases} \end{aligned} $$ - ## Hardness *Hardness class:* Cascade — trigger **EQ**, growth exponential (two-base: $2^n$ doubling then $4^n$ @@ -73,7 +72,6 @@ non-halting. *Why it is hard:* halts iff $d_j = b_j + 2$ at $A(0,b_j,0,d_j)$ See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.lean b/BusyBeaver/BB6/M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.lean index b7fbb0f6..2ecddd35 100644 --- a/BusyBeaver/BB6/M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.lean +++ b/BusyBeaver/BB6/M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.lean @@ -31,7 +31,6 @@ T(E(b, d)) = \begin{cases} \end{cases} $$ - ## Hardness *Hardness class:* Cascade — trigger **EQ (second-order coincidence)**, growth exponential ($2^n$ @@ -42,12 +41,11 @@ non-halting. *Hazard:* $P(\text{halt}) \lesssim 10^{-6}$ (convergent $\sum m^{-2}$ tail) -*Simulated horizon:* exact rule simulation (see dossier) +*Simulated horizon:* exact rule simulation *Why it is hard:* halting requires both $c = 2b-4$ and $c_{\text{odd}} = 2^{k+3}-2k-5$ See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.lean b/BusyBeaver/BB6/M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.lean index 1177e677..5645700d 100644 --- a/BusyBeaver/BB6/M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.lean +++ b/BusyBeaver/BB6/M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.lean @@ -31,7 +31,6 @@ T(C(a, b)) = \begin{cases} \end{cases} $$ - ## Hardness *Hardness class:* Problem 4 — trigger **EQ (2-wide window at turnaround)**, growth exponential @@ -48,7 +47,6 @@ non-halting. $(a,b)\mapsto(b-a,3a)$; sits between Baker–Wüstholz and $\times2,\times3$ rigidity See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean b/BusyBeaver/BB6/M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean index fabb86e4..d5db9605 100644 --- a/BusyBeaver/BB6/M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean +++ b/BusyBeaver/BB6/M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.lean @@ -160,7 +160,6 @@ $$ \end{aligned} $$ - ## Hardness *Hardness class:* Cascade — trigger **EQ**, growth exponential, shield see family. @@ -172,10 +171,9 @@ Steps* list). *Simulated horizon:* — -*Why it is hard:* 1st-order collapse of a false stack (`Valid3Counter116`) +*Why it is hard:* 1st-order collapse of a false stack (unreachable non-zero second stack) See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.lean b/BusyBeaver/BB6/M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.lean index 34d4fa48..a97e482c 100644 --- a/BusyBeaver/BB6/M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.lean +++ b/BusyBeaver/BB6/M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.lean @@ -38,7 +38,6 @@ T(D_p(a, b)) = \begin{cases} \end{cases} $$ - ## Hardness *Hardness class:* Problem 4 — trigger **EQ (2-wide window)**, growth exponential @@ -55,7 +54,6 @@ non-halting. structural twin of #184 (different orbit) See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.lean b/BusyBeaver/BB6/M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.lean index afd2459a..8a007f4c 100644 --- a/BusyBeaver/BB6/M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.lean +++ b/BusyBeaver/BB6/M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.lean @@ -31,7 +31,6 @@ T(C(a, c)) = \begin{cases} \end{cases} $$ - ## Hardness *Hardness class:* Cascade — trigger **EQ**, growth exponential ($\times1.2402$ per step), shield @@ -48,7 +47,6 @@ non-halting. $|v_1-v_2|\in\lbrace 0,1 \rbrace$ with $v_1\ge v_2$ See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.lean b/BusyBeaver/BB6/M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.lean index bb4babf4..746fe128 100644 --- a/BusyBeaver/BB6/M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.lean +++ b/BusyBeaver/BB6/M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.lean @@ -45,7 +45,6 @@ E(a, w) = \begin{cases} \end{cases} $$ - ## Hardness *Hardness class:* Problem 2 — trigger **EQ with leaky parity shield**, growth linear, shield leaky. @@ -60,7 +59,6 @@ non-halting. *Why it is hard:* third sibling of #183/#352 with reset offset $+2$ See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.lean b/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.lean index 81ebfe17..27d63097 100644 --- a/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.lean +++ b/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.lean @@ -41,7 +41,6 @@ G(k, c) = \begin{cases} \end{cases} $$ - ## Hardness *Hardness class:* Problem 2 — trigger **EQ (shrinking target) with leaky parity shield**, growth @@ -59,7 +58,6 @@ $\sum t^{-2} < \infty$ $2\rho/(1-\rho)$; coincidence $c_0-2k_0=6$ only in the rare even-source regime See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.lean b/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.lean index 2af84c89..c93d25f4 100644 --- a/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.lean +++ b/BusyBeaver/BB6/M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.lean @@ -48,7 +48,6 @@ J_1(a, w) = \begin{cases} \end{cases} $$ - ## Hardness *Hardness class:* Problem 2 — trigger **EQ with leaky parity shield**, growth linear ($2^n$ fuel @@ -65,7 +64,6 @@ non-halting. $w_{\text{rem}} = 2a+7$ in the even-source branch See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean b/BusyBeaver/BB6/M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean index 25e98734..c182d59e 100644 --- a/BusyBeaver/BB6/M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean +++ b/BusyBeaver/BB6/M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.lean @@ -44,7 +44,6 @@ E(a, b + 2, 0) --> E(0, b, 2a + 7) E(a, b + 2, 1) --> E(0, b, 2a + 5) ``` - ## Hardness *Hardness class:* Cascade — trigger **EQ**, growth exponential, shield see family. @@ -59,7 +58,6 @@ Steps* list). *Why it is hard:* E1 pair of #116 See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.lean b/BusyBeaver/BB6/M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.lean index de3d83ed..fff1f051 100644 --- a/BusyBeaver/BB6/M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.lean +++ b/BusyBeaver/BB6/M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.lean @@ -31,7 +31,6 @@ T(P(b, c)) = \begin{cases} \end{cases} $$ - ## Hardness *Hardness class:* Cascade — trigger **EQ ($2^n$ remainder coincidence)**, growth exponential @@ -47,7 +46,6 @@ non-halting. *Why it is hard:* `rule_8_halt` requires $P_2(a,0,2)$ at a cascade turnaround See `BusyBeaver.BB6.Hardness` for the vocabulary and the full table. - -/ @[expose] public section diff --git a/BusyBeaver/BB6/README.md b/BusyBeaver/BB6/README.md index 6a15ccbd..9a093773 100644 --- a/BusyBeaver/BB6/README.md +++ b/BusyBeaver/BB6/README.md @@ -6,7 +6,7 @@ The A6 module exports a closed blank-tape `IsNotHalt` proof using a checked entry certificate and a universal return family; it has a separate [proof guide](../../artifacts/a6/README.md). -> **Hardness & Formal Evidence.** Why the hardest of these holdouts are hard (halting trigger, growth regime, shields, heuristic hazards, and the calibration case `#72` that the community proved halting) is recorded in [`Hardness.lean`](./Hardness.lean) (rendered on the docs site as `BusyBeaver.BB6.Hardness`); each machine in that core also carries a `## Hardness` section in its module docstring. Kernel-checked live-hazard witnesses (`highLevelNext s = none` / `next s = none`) and parametric halting residue classes across 26 hard-core `BB(6)` holdouts with explicit Collatz-like accelerations (the 24 hard-core holdouts carrying `IsValidAcceleration`, plus `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC` and `1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD`) are proved in [`HardnessEvidence.lean`](./HardnessEvidence.lean) (`BusyBeaver.BB6.HardnessEvidence`). +> **Hardness & Formal Evidence.** Why the hardest of these holdouts are hard (halting trigger, growth regime, shields, heuristic hazards, and the calibration case `#72` that the community proved halting) is recorded in [`Hardness.lean`](./Hardness.lean) (rendered on the docs site as `BusyBeaver.BB6.Hardness`); each machine in that core also carries a `## Hardness` section in its module docstring. Kernel-checked live-hazard witnesses (`highLevelNext s = none` / `next s = none`) and parametric halting residue classes across 26 select `BB(6)` holdouts (the 24 hard-core holdouts carrying `IsValidAcceleration`, plus `#568` (`1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC`) and `1RB1RF_1LC1LF_---1LD_1LE0RA_1RE1LB_1RD0LD`, out of 73 accelerated holdouts in the repository) are proved in [`HardnessEvidence.lean`](./HardnessEvidence.lean) (`BusyBeaver.BB6.HardnessEvidence`). > **Equivalences.** Machine-level halting equivalences between holdouts whose certified high-level accelerations coincide are collected in [`Equivalences.lean`](./Equivalences.lean) (`BusyBeaver.BB6.Equivalences`): `isHalt_HHH1LC_iff_HHH0LA` proves that `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---1LC` halts if and only if `1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_---0LA` does (the pair merged by busycoq `Eqv_RegularPairs.v`). diff --git a/BusyBeaverChallenge.lean b/BusyBeaverChallenge.lean index 76cb9d95..0d1b5edf 100644 --- a/BusyBeaverChallenge.lean +++ b/BusyBeaverChallenge.lean @@ -9250,7 +9250,7 @@ theorem is_valid_acceleration : IsValidAcceleration target start encode next := theorem isHalt_iff_acceleration : IsHalt target ↔ CollatzHalts next start := by sorry end M_1RBHHH_1LC0RF_0RA0LD_1LE1LA_1RF0LF_0LC0RA -namespace HardnessEvidence +namespace BB6.HardnessEvidence namespace M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA open BusyBeaver.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA @@ -9458,7 +9458,7 @@ theorem halting_state_witness : highLevelNext (.C 0 0) = none := by sorry theorem halting_residue_class (a : ℕ) : highLevelNext (.C a 0) = none := by sorry theorem halting_residue_class_two_step (a : ℕ) : - highLevelNext (.C a (a / 2 + 4)) = some (.C (6 * (a / 2 + 2) + 3 * (a % 2) + 5) 0) := by sorry + (highLevelNext (.C a (a / 2 + 4))).bind highLevelNext = none := by sorry end M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD namespace M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA @@ -9469,7 +9469,7 @@ theorem halting_state_witness : highLevelNext (.C 0 1) = none := by sorry theorem halting_residue_class (a : ℕ) : highLevelNext (.C a 1) = none := by sorry theorem halting_residue_class_two_step (a : ℕ) : - highLevelNext (.C a (2 * a + 3)) = some (.C (2 * a + 2) 1) := by sorry + (highLevelNext (.C a (2 * a + 3))).bind highLevelNext = none := by sorry end M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA namespace M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA @@ -9513,8 +9513,8 @@ theorem halting_state_witness : next (.CR 1 0 [] 1 []) = none := by sorry theorem halting_residue_class (b : ℕ) (L : List ℕ) (d : ℕ) (R : List ℕ) : next (.CR 1 b L (d + 1) R) = none := by sorry -theorem halting_residue_class_two_step (a b : ℕ) (L R : List ℕ) : - next (.CR (a + 2) b L 1 R) = some (.CR 1 (a + 1) (b :: L) (bump1 R).1 (bump1 R).2) := by sorry +theorem halting_residue_class_two_step (a b : ℕ) (L : List ℕ) (r : ℕ) (R : List ℕ) : + (next (.CR (a + 2) b L 1 (r :: R))).bind next = none := by sorry end M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA namespace M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD @@ -9525,7 +9525,7 @@ theorem halting_state_witness : highLevelNext (.EL 0 [] 0 []) = none := by sorry theorem halting_residue_class (k d : ℕ) (R : List ℕ) : highLevelNext (.EL (4 * k) [] d R) = none := by sorry end M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD -end HardnessEvidence +end BB6.HardnessEvidence end BusyBeaver diff --git a/comparator/busy_beaver.json b/comparator/busy_beaver.json index cce7dd77..c2d0191a 100644 --- a/comparator/busy_beaver.json +++ b/comparator/busy_beaver.json @@ -434,80 +434,80 @@ "BusyBeaver.M_1RB1RA_1LC0RC_1RE0LD_0RE0LF_1RAHHH_1RB1LF.has_stack_reduction", "BusyBeaver.M_1RB1RC_1LC0LE_1RD1RC_1LB0RA_HHH0LF_1RD1LF.has_stack_reduction", "BusyBeaver.M_1RB0LC_1LC0RE_1LD1LC_1LA1RD_HHH0RF_0LB0RD.has_stack_reduction", - "BusyBeaver.HardnessEvidence.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.halting_state_witness_17", - "BusyBeaver.HardnessEvidence.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.halting_state_witness_25", - "BusyBeaver.HardnessEvidence.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.halting_residue_class_iff", - "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.halting_residue_class_true", - "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.halting_residue_class_two_step", - "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.halting_residue_class_two_step", - "BusyBeaver.HardnessEvidence.M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.halting_residue_class'", - "BusyBeaver.HardnessEvidence.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.halting_residue_class_odd", - "BusyBeaver.HardnessEvidence.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.halting_residue_class_odd'", - "BusyBeaver.HardnessEvidence.M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.halting_residue_class'", - "BusyBeaver.HardnessEvidence.M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.halting_residue_class_iff", - "BusyBeaver.HardnessEvidence.M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.halting_residue_class_iff", - "BusyBeaver.HardnessEvidence.M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.halting_state_witness_C1", - "BusyBeaver.HardnessEvidence.M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.halting_residue_class_hat", - "BusyBeaver.HardnessEvidence.M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.halting_residue_class_iff", - "BusyBeaver.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.halting_residue_class_diag", - "BusyBeaver.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.halting_residue_class_diag", - "BusyBeaver.HardnessEvidence.M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.halting_residue_class_iff", - "BusyBeaver.HardnessEvidence.M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.halting_residue_class_multi_step", - "BusyBeaver.HardnessEvidence.M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.halting_residue_class_two_step", - "BusyBeaver.HardnessEvidence.M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.halting_residue_class_two_step", - "BusyBeaver.HardnessEvidence.M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.halting_residue_class", - "BusyBeaver.HardnessEvidence.M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.halting_residue_class_two_step", - "BusyBeaver.HardnessEvidence.M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD.halting_state_witness", - "BusyBeaver.HardnessEvidence.M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD.halting_residue_class" + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.halting_state_witness_17", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.halting_state_witness_25", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LC_1RC0RF_1RD0LB_1RE0LD_1LFHHH_0RA1LA.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RD_0LC1RA_1LA1LC_1RA1LE_1RF0LD_HHH0RE.halting_residue_class_iff", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.halting_residue_class_true", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RD_0LC1RA_1RA1LC_0RB1LE_1RF0LD_HHH0RE.halting_residue_class_two_step", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RD_0LC1RA_0RA1LC_1RA1LE_1RF0LD_HHH0RE.halting_residue_class_two_step", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LF_1RC1RA_0RD0RB_1LEHHH_0LA1LE_1RD1LA.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.halting_residue_class'", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.halting_residue_class_odd", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LF_0RC1RD_1LA1LD_1LE0RA_HHH1LC_0LA1LA.halting_residue_class_odd'", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RB_1LC0RE_HHH1LD_0RA1LB_1RA1LF_0LE1LE.halting_residue_class'", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LC_0LC1RF_1LE1RD_0RC1RC_0LA1LA_HHH1RA.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LF_1LC0LD_1RD1LB_HHH1RE_0RA1RE_1LA0LE.halting_residue_class_iff", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0RE_1LC0RA_1RF0RD_HHH1LE_0LB1LE_1LE1RC.halting_residue_class_iff", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.halting_state_witness_C1", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LF_1RC1RF_0LD1RE_HHH1LC_0RB1RE_1LA0LE.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LD_1RC0RA_1LA1RE_0LA0LB_0RB1RF_HHH1RD.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0RC_1LC1RE_1RA1LD_0LC0LA_1RF1RD_HHH0RD.halting_residue_class_hat", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RF_1LCHHH_1LE1RD_1RA0RC_0LF0LA_0LD0RB.halting_residue_class_iff", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH0LA.halting_residue_class_diag", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LE_0RC1RC_0RD1LA_1LD0LA_1LF1LC_HHH1LC.halting_residue_class_diag", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LE_1RC1RA_0LD1RB_1LE1LD_1RF0LA_HHH0RE.halting_residue_class_iff", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RF_1LC1LF_0RE1LD_0LB1LD_HHH1RC_1RA0RD.halting_residue_class_multi_step", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RC_1LC1LC_1RE0LD_1LB1RF_HHH1RA_0RD1RD.halting_residue_class_two_step", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LF_1LC1RA_0RE0RD_HHH1LE_1LF1RC_1LC1LA.halting_residue_class_two_step", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1LA_1LA0RC_1RD1RC_1LE0RC_HHH0LF_1LE0LA.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0RB_1RC0LE_1LD1LA_HHH0LC_1RF1LE_1RA0RA.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB0LD_1LC1RD_0LE1LA_0RB1RD_HHH0LF_1RA1LF.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RA_1RC1LB_1LD0RA_HHH0LE_1LC0LF_1RE0LB.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.halting_residue_class", + "BusyBeaver.BB6.HardnessEvidence.M_1RBHHH_0RC0LD_1LB1RC_0LE0LF_1RD1LE_1RF1RA.halting_residue_class_two_step", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD.halting_state_witness", + "BusyBeaver.BB6.HardnessEvidence.M_1RB1RF_1LC1LF_HHH1LD_1LE0RA_1RE1LB_1RD0LD.halting_residue_class" ], "permitted_axioms": [ "propext", From 365ec984d9c447db9de1f182fceb21f0fccea4b2 Mon Sep 17 00:00:00 2001 From: Tom Zahavy Date: Mon, 2 Nov 2026 10:45:33 +0000 Subject: [PATCH 6/6] Fix namespace reference in BusyBeaver/BB6/Accelerations/README.md --- BusyBeaver/BB6/Accelerations/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BusyBeaver/BB6/Accelerations/README.md b/BusyBeaver/BB6/Accelerations/README.md index 465066f7..42268d7f 100644 --- a/BusyBeaver/BB6/Accelerations/README.md +++ b/BusyBeaver/BB6/Accelerations/README.md @@ -5,7 +5,7 @@ This directory contains formal Lean 4 specifications and kernel-verified reducti 1. **15 Structural Stack, Odometer, and Transducer Reductions** formalized under the three structural reduction predicates defined in [`BusyBeaver/Defs.lean`](../../Defs.lean)—`HasStackReduction` (12 machines: 9 `bbchallenge` Wiki machines and 3 Halving Tower holdouts), `HasOdometerReduction` (2 machines: Beaver Math Olympiad Problems 10 and 11), and `HasTransducerReduction` (1 machine: *Bell eats counter*). 2. **20 Open `BB(6)` Acceleration Problems** certified via `IsValidAcceleration` and `IsHalt target ↔ CollatzHalts next start` (with [`1RB1LD_0RC0LF_1LD1RE_0LA0RB_0RD1RB_0LD---`](./M_1RB1LD_0RC0LF_1LD1RE_0LA0RB_0RD1RB_0LDHHH.lean) additionally proved under `HasOdometerReduction`). Each open problem states a self-contained initial state $s_0$ (`start`) and accelerated transition map $T$ (`next`) over finite sequences and non-negative integers: the corresponding Turing machine halts from the blank tape if and only if iterating $T$ from $s_0$ eventually reaches $\mathrm{Halt}$ (`none`). For **13** of the 20 machines, we additionally prove a **higher-level Poincaré / epoch acceleration** $(s_{0,\mathrm{HL}}, T_{\mathrm{HL}})$ (`HighLevelState`, `highLevelStart`, `highLevelEncode`, `highLevelNext`, `is_valid_highLevel_acceleration`, `isHalt_iff_highLevel_acceleration`, `acceleration_iff_highLevel_acceleration`) that eliminates an entire stack, mixed-radix odometer, or auxiliary mode by restricting to a canonical return section or contracting full multi-bounce epochs. -> **Hardness & Formal Evidence.** The Collatz-like stacked cryptids among these machines (`#391`, `#129`, `#660`/`#659`/`#209`/`#680`/`#480`, `#549`/`#80`, `#33`, `#85`/`#285`/`#490`/`#500`) are classified, with heuristic hazards and the resolved case `#72`, in [`../Hardness.lean`](../Hardness.lean) (`BusyBeaver.BB6.Hardness`), and kernel-checked live-hazard witnesses and halting residue classes for the accelerated problems are proved in [`../HardnessEvidence.lean`](../HardnessEvidence.lean) (`BusyBeaver.HardnessEvidence`). +> **Hardness & Formal Evidence.** The Collatz-like stacked cryptids among these machines (`#391`, `#129`, `#660`/`#659`/`#209`/`#680`/`#480`, `#549`/`#80`, `#33`, `#85`/`#285`/`#490`/`#500`) are classified, with heuristic hazards and the resolved case `#72`, in [`../Hardness.lean`](../Hardness.lean) (`BusyBeaver.BB6.Hardness`), and kernel-checked live-hazard witnesses and halting residue classes for the accelerated problems are proved in [`../HardnessEvidence.lean`](../HardnessEvidence.lean) (`BusyBeaver.BB6.HardnessEvidence`). ## Structural Reduction Predicates ([`BusyBeaver/Defs.lean`](../../Defs.lean))