BB(6) hunt
Machines / #11

1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---

#11local proof 3Kill claimedSkelet 1-like Class 2bbchallenge ↗Explorer

How we proved it never halts

A counter whose digits burn fuel but never run dry the wrong way

It counts up in binary, like an odometer. Each digit is a run of 10s then a run of 01s, with two blank cells between them for a 0 (1010…10 00 0101…01) and none for a 1. To add 1, the head walks left from the right end to the nearest 0 digit, makes it a 1, turns the 1s it passed into 0s, and walks back; each digit it changes burns one 01 as fuel. When all digits are 1, an overflow swaps the two halves of every digit and adds a digit.

Trouble needs a carry to reach a digit with no fuel. A digit that runs dry while becoming a 1 just merges into the next digit, which is harmless. The danger is a 1 digit with one unit of fuel being turned into a 0.

The key idea: call the stretch between two overflows a cycle. In a quiet cycle every digit has more fuel than touches still to come. In the lossy cycle after it, digits run dry at irregular times, but each digit's fuel plus its value stays odd, since a touch burns one unit and flips the digit. So a digit on its last unit of fuel is always a 0, and runs dry harmlessly as it becomes a 1.

Why that settles it: each overflow sets up the next cycle. A quiet cycle leaves lengths that give the lossy one its odd sums, and a lossy cycle leaves runs long enough to fuel a quiet one. The run reaches this pattern at step 483 and every move keeps it, so the machine never halts.

The Rocq proof (checked against busycoq) builds both moves from 20 small tape lemmas, replays the first 483 steps, and proves that every move keeps the invariant.

#3local proof number
694lines of Rocq
9 sto compile
6/6automatic checks
space-time diagram, first 10,000 steps from blank
The first 10,000 steps from a blank tape. Time runs down; white is 1.
About this picture

The standard picture (bbchallenge.org's Default view): each row is the whole tape at one step, time runs downward, and the head's path draws the pattern.

bbchallenge-defaultStart blankRows steps 0 → 10,000, top to bottomWindow cells −200..199, left to rightColors 1 0 or unvisited

Overview

In one sentence

Binary counter on (10)^u[00](01)^v blocks; carries + re-pairing overflow explain every step to 1e9

Submitted mechanism At the right edge the tape is K = 0^inf 10 01 d_1 .. d_m (10)^a 000 (10)^b B> 0^inf. Each digit is (10)^u 00 (01)^v (bit 0) or (10)^u (01)^v (bit 1), and d_m is the least significant bit. (submission/README.md, Mechanism)

Upstream
Kill claimed · PR #16merged 2026-10-13 12:26 UTC by ccz181078 · Sk1Class2_v2.v · TM10 · on Submissions →
Rocq proof
check_kill PASS · first Oct 10 05:20
694 lines · 29 KB .v · compile 8.6 s · coqchk pass · 0 axioms · PASS Oct 10 05:20 (re-run Oct 12 18:15)
· the .v file
Automatic review
6 of 6 checks passtemplate: verify/SBCv6.v Module TM21 (template) · details in Proof →
Class
Skelet 1-like Class 2ours: sheet Skelet 1-like Class 2 ≠ ours Binary counter over a block list with re-pairing overflow (TM21-like Skelet 1-like Class 2) · high confidence
On the list
not on BB6_holdouts_663.txt (line 438 of the previous list) · historical 740 line 438
#11eqv ×1sim 1e15

Mechanism

What to check here: the pictures show the mechanism that the rule table describes.

How it works: 3 notes
  • Tape = digits (10)^u J (01)^v (J = 00: bit 0, empty: bit 1), then a growing (10)^a 000 (10)^b block at the right end.
  • Every 4 right records = +1: the head runs left to the first 0-bit (ruler-depth carry); each touched v drops by 1.
  • All bits 1 -> overflow: a run to the far left re-pairs the blocks. A digit whose v runs out fuses with its neighbour.

Figures for Checkpoint A

Fig 1 · Carry sweeps from a built counter tapeQ1

Every 10 steps from a built counter tape. Dotted diagonals are head sweeps; compare how deep each one goes.

Carry sweeps from a built counter tape
bbchallenge-defaultStart constructed tape (below)Rows every 10 stepsWindow cells -116..66, 1 px = 1/3 cellColors 1 0 or unvisited head (last move right/left)
Start: 0∞ 10 01 (10)2 00 (01)3 (10)3 00 (01)5 (10)3 00 (01)9 (10)3 00 (01)17 (10)4 03 B> 0∞ · Rows: steps 0..5,600 after the start (561 rows, 3 px each; no head drawn on row 0). The head moves up to 10 cells between rows, so each sweep shows as a dotted diagonal · Window: (each cell 3x3 px); cell 0 = the head's start cell
Fig 2 · Edge records to 300,000 stepsQ2Q3viewer ↗

Edge records to 300,000 steps. Look at the dashed vertical walls and each band break (left edge steps out).

Edge records to 300,000 steps
bbchallenge-defaultStart blankRows left/right recordsWindow cells -57..1095, 1 px = 1 cellColors 1 0 or unvisited head (last move right/left)
Rows: the start, then one row per new leftmost or rightmost cell (1,153 rows to step 300,000; not evenly spaced in time) · Colors: the 1010 background is 1-px stripes that look gray when shrunk
Fig 3 · Edge records to 5.1 million stepsQ3

The same view to 5.1M steps. Compare its walls and band breaks with Fig 2.

Edge records to 5.1 million steps
bbchallenge-defaultStart blankRows left/right recordsWindow cells -87..4912, 1 px = 1 cellColors 1 0 or unvisited head (last move right/left)
Rows: the start, then one row per new record; stopped at the 5,000-row cap at step 5,122,482 (not evenly spaced in time) · Colors: the 1010 background is 1-px stripes that look gray when shrunk
More figures (2)Fig 4–5: bbchallenge Default view, first 10,000 steps · Blaze view, 10 million steps
Fig 4 · bbchallenge Default view, first 10,000 stepsviewer ↗

For orientation: the start of the run as bbchallenge.org shows it.

bbchallenge Default view, first 10,000 steps
bbchallenge-defaultStart blankRows every step 0..9,999Window cells -200..199, 1 px = 1 cellColors 1 0 or unvisited head (last move right/left)
Rows: squeezed into 500 px by the site's bilinear filter: px row y blends steps 20y+9 and 20y+10, so it is effectively one sample every 20 steps
Fig 5 · Blaze view, 10 million steps

The right edge grows like the square root of time; the faint vertical lines are digit walls.

Blaze view, 10 million steps
bbchallenge-blazeStart blankRows Blaze time blocks of 16,384 stepsWindow cells -104..6903, 1 px = 8.8 cellsColors 0 1 1 only part of the time (or in part of the cells) of that pixel's block
Rows: (each averaged), 611 blocks to step 1e7, stretched to 500 px (1 px = about 20,000 steps) · Window: Blaze image: 1 column per 8 cells, averaged; 876 columns stretched to 800 px · Colors: no head; the 1010 background averages to pale orange
Rules (5/5 validated)exact tape rewrites the proof will formalize, each re-checked by simulation
rulefrom ⟶ tocasesstepschecked
M_k carry (k = trailing 1-bits)
l (10)u_k 02 (01)v_k [(10)u_i (01)v_i]_{i=k-1..0} (10)a 03 (10)b B> 0∞
⟶ l (10)u_k+1 (01)v_k-1 [(10)u_i 02 (01)v_i-1]_{i=k-1..0} (10)a+1 03 (10)b+2 B> 0∞
k=0..5 tested; needs v_i>=1 (i<=k), u_i>=1 (i<k), u_k>=0, a>=1, b>=0; v=1 gives a fused (merged) digit32 + 8a + 8b + 8*sum_{i<k} u_i + 4*sum_{i<=k} v_i✓84/84
O overflow (all bits 1)
0∞ 10 01 [(10)u_i (01)v_i]_{i=1..n} (10)a 03 (10)b B> 0∞
⟶ 0∞ 10 01 00 (01)u_1 [(10)v_i-1 02 (01)u_(i+1)]_{i=1..n-1} (10)v_n (01)a (10)b+3 03 10 B> 0∞
n=1..7 tested; needs v_i>=1 (i<n); left edge moves 3 cells; counter restarts at 189 - 4n + 8a + 20b + 4*sum u_i + 8*sum v_i✓118/118
init (blank tape to first K)
0∞ A> 0∞
⟶ 0∞ 10 01 (10)3 01 (10)2 03 10 B> 0∞
twins: start B -> K((1,2);2,1) in 122 steps; start C -> K((1,1);2,1) in 101 steps142✓1/1
B sweep right
B> (01)n
⟶ (10)n B>
—2n✓10/10
D sweep left
(01)n <D
⟶ <D (10)n
—2n✓10/10
Compressed historythe tape as 0∞ 10 01 [(10)u_i (01)v_i]_{i=1..n} (10)a 03 (10)b B> 0∞ at 40 moments: where the rules are read off
0∞ 10 01 [(10)u_i (01)v_i]_{i=1..n} (10)a 03 (10)b B> 0∞
stepnu_1..u_nv_1..v_nab
148,244467,313,1631,412,8486261
196,5695115,151,5636,628,244,8329461
323,918468,319,4631,283,232126125
398,4275113,113,9476,728,874,89615861
561,920569,319,463,127104,241,696126125
755,701611,173,131,127682,887,489,664190125
1,267,210470,125,190,1278,166,464254253
1,406,407519,197,1796.91·101328661
1,659,14857.11·10136,125,648,224126125
1,917,105617,156,363,2557.01·1015190125
2,517,86267.21·101648,483,219,264254253
3,255,15571.51·10137.11·1018382253
5,250,96867.31·1016244,016,160,128510509
6,469,64571.37·10127.21·1019638253
9,142,1784389,382,382,5113,212,864,384510509
9,463,015513,313,171,3993.88·101454261
9,966,52453.9·10143.01·1012126125
10,405,09761.31·10133.89·1016190125
11,256,62263.91·10172.81·1014254253
12,174,53171.29·10163.9·1019382253
14,421,11263.92·10172.61·1015510509
15,820,40571.27·10163.91·1020638253
18,743,70673.93·10202.41·1017510509
22,061,82381.25·10193.92·1023766509
30,571,41273.94·10202.21·10181,0221,021
35,551,58581.23·10193.93·10231,278509
46,376,29483.95·10242.01·10211,0221,021
59,038,87591.21·10233.94·10261,5341,021
92,220,94483.96·10251.81·10202,0462,045
111,528,10991.19·10223.95·10282,5581,021
153,971,60283.97·10261.69·10212,0462,045
176,217,46391.17·10223.96·10292,5581,021
222,615,94893.98·10301.49·10252,0462,045
275,605,721101.15·10263.97·10333,0702,045
411,458,14283.99·10271.28·10244,0944,093
447,518,22791.13·10253.98·10314,6061,021
513,030,92094·10311.08·10252,0462,045
579,826,725101.11·10293.99·10353,0702,045
734,793,354104.01·10358.8·10284,0944,093
924,601,615111.98·10294·10396,1424,093
nlast 11
1141.5e59.2e8log xstep 148244: n = 4step 196569: n = 5step 323918: n = 4step 398427: n = 5step 561920: n = 5step 755701: n = 6step 1267210: n = 4step 1406407: n = 5step 1659148: n = 5step 1917105: n = 6step 2517862: n = 6step 3255155: n = 7step 5250968: n = 6step 6469645: n = 7step 9142178: n = 4step 9463015: n = 5step 9966524: n = 5step 10405097: n = 6step 11256622: n = 6step 12174531: n = 7step 14421112: n = 6step 15820405: n = 7step 18743706: n = 7step 22061823: n = 8step 30571412: n = 7step 35551585: n = 8step 46376294: n = 8step 59038875: n = 9step 92220944: n = 8step 111528109: n = 9step 153971602: n = 8step 176217463: n = 9step 222615948: n = 9step 275605721: n = 10step 411458142: n = 8step 447518227: n = 9step 513030920: n = 9step 579826725: n = 10step 734793354: n = 10step 924601615: n = 11
u_1..u_nlast 1.98·1029
4e351.9e71.5e59.2e8log-logstep 148244: u_1..u_n = 67313163step 196569: u_1..u_n = 115151563step 323918: u_1..u_n = 68319463step 398427: u_1..u_n = 113113947step 561920: u_1..u_n = 69319463127step 755701: u_1..u_n = 11173131127step 1267210: u_1..u_n = 70125190127step 1406407: u_1..u_n = 19197179step 1659148: u_1..u_n = 71125190127255step 1917105: u_1..u_n = 17156363255step 2517862: u_1..u_n = 72125190127255127step 3255155: u_1..u_n = 15115547223127step 5250968: u_1..u_n = 73125190127255382step 6469645: u_1..u_n = 1374731191191step 9142178: u_1..u_n = 389382382511step 9463015: u_1..u_n = 13313171399step 9966524: u_1..u_n = 390382382511511step 10405097: u_1..u_n = 13112763383511step 11256622: u_1..u_n = 391382382511511127step 12174531: u_1..u_n = 12912355367479127step 14421112: u_1..u_n = 392382382511511382step 15820405: u_1..u_n = 12711947351447191step 18743706: u_1..u_n = 393382382511511382511step 22061823: u_1..u_n = 12511539335415127511step 30571412: u_1..u_n = 394382382511511893511step 35551585: u_1..u_n = 12311131319383319383step 46376294: u_1..u_n = 3953823825115118935111023step 59038875: u_1..u_n = 121107233033512552551023step 92220944: u_1..u_n = 39638238251151189315341023step 111528109: u_1..u_n = 11910315287319191639767step 153971602: u_1..u_n = 397382893511893153410232047step 176217463: u_1..u_n = 11799263271954473831791step 222615948: u_1..u_n = 3983828935118931534102320472047step 275605721: u_1..u_n = 115952552556338325515352047step 411458142: u_1..u_n = 3993828935112427307020472047step 447518227: u_1..u_n = 11391247239287108711511279step 513030920: u_1..u_n = 40038289351124273070204720474095step 579826725: u_1..u_n = 111872392232551023102310234095step 734793354: u_1..u_n = 401382893511242730702047204740952047step 924601615: u_1..u_n = 198323120722395989576735832047
v_1..v_nlast 4·1039
4e391.3e61.5e59.2e8log-logstep 148244: v_1..v_n = 1412848step 196569: v_1..v_n = 6628244832step 323918: v_1..v_n = 1283232step 398427: v_1..v_n = 6728874896step 561920: v_1..v_n = 104241696step 755701: v_1..v_n = 682887489664step 1267210: v_1..v_n = 8166464step 1406407: v_1..v_n = 69122183112224step 1659148: v_1..v_n = 6125648224step 1917105: v_1..v_n = 7012218311222464step 2517862: v_1..v_n = 48483219264step 3255155: v_1..v_n = 7112218311222464128step 5250968: v_1..v_n = 244016160128step 6469645: v_1..v_n = 72122183112224319384step 9142178: v_1..v_n = 3212864384step 9463015: v_1..v_n = 388379375496480step 9966524: v_1..v_n = 3012456368480step 10405097: v_1..v_n = 38937937549648064step 11256622: v_1..v_n = 281204835244864step 12174531: v_1..v_n = 39037937549648064128step 14421112: v_1..v_n = 2611640336416128step 15820405: v_1..v_n = 391379375496480319384step 18743706: v_1..v_n = 241123232038464384step 22061823: v_1..v_n = 392379375496480319384256step 30571412: v_1..v_n = 2210824304352256256step 35551585: v_1..v_n = 393379375496480830384768step 46376294: v_1..v_n = 2010416288320192128768step 59038875: v_1..v_n = 394379375496480830384768512step 92220944: v_1..v_n = 181008272288128512512step 111528109: v_1..v_n = 39537937549648083014077681536step 153971602: v_1..v_n = 1696256256643842561536step 176217463: v_1..v_n = 396379886496862147189617921536step 222615948: v_1..v_n = 14922482403232012812801536step 275605721: v_1..v_n = 3973798864968621471896179215361024step 411458142: v_1..v_n = 1288240224256102410241024step 447518227: v_1..v_n = 39837988649623963007192017923584step 513030920: v_1..v_n = 10842322082249608967683584step 579826725: v_1..v_n = 399379886496239630071920179235841024step 734793354: v_1..v_n = 88022419219289676851230721024step 924601615: v_1..v_n = 4e39
alast 6,142
6,142621.5e59.2e8log xstep 148244: a = 62step 196569: a = 94step 323918: a = 126step 398427: a = 158step 561920: a = 126step 755701: a = 190step 1267210: a = 254step 1406407: a = 286step 1659148: a = 126step 1917105: a = 190step 2517862: a = 254step 3255155: a = 382step 5250968: a = 510step 6469645: a = 638step 9142178: a = 510step 9463015: a = 542step 9966524: a = 126step 10405097: a = 190step 11256622: a = 254step 12174531: a = 382step 14421112: a = 510step 15820405: a = 638step 18743706: a = 510step 22061823: a = 766step 30571412: a = 1022step 35551585: a = 1278step 46376294: a = 1022step 59038875: a = 1534step 92220944: a = 2046step 111528109: a = 2558step 153971602: a = 2046step 176217463: a = 2558step 222615948: a = 2046step 275605721: a = 3070step 411458142: a = 4094step 447518227: a = 4606step 513030920: a = 2046step 579826725: a = 3070step 734793354: a = 4094step 924601615: a = 6142
blast 4,093
4,093611.5e59.2e8log xstep 148244: b = 61step 196569: b = 61step 323918: b = 125step 398427: b = 61step 561920: b = 125step 755701: b = 125step 1267210: b = 253step 1406407: b = 61step 1659148: b = 125step 1917105: b = 125step 2517862: b = 253step 3255155: b = 253step 5250968: b = 509step 6469645: b = 253step 9142178: b = 509step 9463015: b = 61step 9966524: b = 125step 10405097: b = 125step 11256622: b = 253step 12174531: b = 253step 14421112: b = 509step 15820405: b = 253step 18743706: b = 509step 22061823: b = 509step 30571412: b = 1021step 35551585: b = 509step 46376294: b = 1021step 59038875: b = 1021step 92220944: b = 2045step 111528109: b = 1021step 153971602: b = 2045step 176217463: b = 1021step 222615948: b = 2045step 275605721: b = 2045step 411458142: b = 4093step 447518227: b = 1021step 513030920: b = 2045step 579826725: b = 2045step 734793354: b = 4093step 924601615: b = 4093
Template comparisonSBCv6.v TM21: partly applies · the nearest solved proof, what carries over, and the transitions that differ
01
A1RB0LE
B1RC0RC
C1LD0RB
D1LA0LE
E1LD1LF
F1LD---
file
SBCv6.v:3702
module
TM21
machine
1RB1LB_0LC1RD_0RA1LC_0RB1RE_0RD0LF_---1LE (11 transitions apart)
diff
10 of 12 transitions differ under the best renaming/mirror (Sk1like_TC_v2 TM1: 9 of 12)
note
Same architecture (LIncs = carries, Ov = re-pairing overflow, BigStep), but TM21's S' configs never recur here (0 real hits in 2e5 steps, all 6 states). Its LWF invariant fails: here digits run out and merge.
Proof strategy & riskshow the formal proof will go · 3 risks to watch

Copy TM21's shape: K(list,a,b) as a Fixpoint over (u,bit,v) blocks; prove M_k by induction on k (like LIncs_spec) and O by induction on the list (like Ov_spec) from es-level sweep lemmas. Then nonhalt via multistep_nonhalt + progress_nonhalt_cond with a merge-aware invariant that keeps every v reached by a carry >= 1. Same rules give the 2 twins (new init lemmas only).

  • ▲Invariant is the real work: digits do run out and merge (9 -> 5 digits in one cycle); TM21's LWF does not carry over.
  • ▲Twin on the 'worked on extensively' tab (hipparcos, Oct 2025 thread) is this same table: duplicate-work risk until he answers.
  • ▲Size: list bookkeeping plus merge cases likely 20-50 KB of Rocq (TM21 is ~300 lines).
Stats & provenance109 steps simulated · 77,685 cells · the status in full · files
simulated
109 steps
tape
77,685 cells · 38,836 nonzeros
growth
right edge ~t^0.51; left edge -3 cells per overflow (54 by 1e9; rules-only model: 122 by 1e15, 23 digits)
status now
check_kill PASS, independently re-verified (status.json, 2026-10-10)
observer's note
M_k + O validated, exact to 1e9; rules-only model runs to 1e15 with no stuck case. Not cryptid. Ask hipparcos first (same table).
files
observe.json · notes.md · proof.md · how_proved.md · status.json · 1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---.v

Proof & checks

6/6 automatic checks pass

Kill 3 · Skelet 1-like Class 2 · the kill file 1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---.v: 694 lines, 105 items · the package submission/

✓ 6/6 automatic checks pass · Checkpoint B: no note from Dennis yet · template (template): verify/SBCv6.v Module TM21 · 6% of our lines identical
1What is provedCheck: the string, the theorem and every check_kill line are green, and the .v on disk is the one that was checked (same sha256).
Machine
1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---
vs holdout list
✓ byte-exact: the .v literal (L18) == 2026-10-07_778.txt line 467 (41 bytes, via tools/holdouts.py)
Theorem
✓ Lemma nonhalt: ~halts tm c0. L662
check_kill
✓ PASS · 17/17 checks pass · compile 8.58 s · coqchk pass (1.74 s) · assumptions: 0 (closed) · 2026-10-13 01:15:24 UTC · submission/check_kill.txt
Checked .v
sha256 d177c06de5df0ff2…
✓1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---.vd177c06de5df0ff2… = checked
✓submission/1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---.vd177c06de5df0ff2… = checked
Status
✓Killed: never halts updated 2026-10-10
✓ args✓ input✓ framework✓ framework_build✓ forbidden✓ structure✓ tm_text✓ theorem_text✓ coq✓ names✓ compile✓ tm_rocq✓ theorem_rocq✓ isolation✓ assumptions✓ coqchk✓ integrity
All 17 check_kill checks with their one-line results
✓args6x2 machine, framework module Individual62, mode nonhalt
✓input29716 bytes, 694 lines, 756 sentences
✓frameworkHEAD 0940bb9cf434ba68f0c025dabfde45a219999973 == pin; no tracked changes under verify/
✓framework_build13 needed framework .vo files present and fresh, with native code no older than the .vo
✓forbiddennone of 30 forbidden patterns occur (ground rule 1's words: anywhere; command words: outside comments and strings; comments never split a token)
✓structure6 Require name(s) allowed; no top-level Variable/Context; no shadowing; Module/Section balanced
✓tm_textline 18: TM_from_str "1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---" == <tm> (41 bytes)
✓theorem_textline 662: nonhalt : ~halts tm c0
✓coqcoqc 8.20.1 ([local working file]
✓nameshalts, c0, TM_from_str resolved inside Individual62
✓compilecompiled in 8.6s with all appended checks
✓tm_rocqBB6Kill.Candidate.tm = BusyCoq.Individual62.TM_from_str "1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---" by eq_refl (in-file and isolated)
✓theorem_rocqnonhalt : ~ halts (TM_from_str "1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---") c0 with absolute names (in-file and isolated)
✓isolationonly stock proof plugins loaded; guard/positivity/universe checking on, definitional UIP off
✓assumptions0 assumption(s), all in the baseline
✓coqchkcoqchk -norec BB6Kill.Candidate ok (1.7s); its context summary lists nothing of the file's own
✓integrityinput sha256 and framework HEAD/cleanliness identical before and after
2Where it came fromCheck: the template is the one you expect, and the measured reuse (tiles, the reuse figure, diff) agrees with what the README says was kept and changed (quoted).
6%of our lines identical to the template
2changed lines
559added lines (ours only)
284template lines dropped
1 / 2 / 102items identical / adapted / new
What the package README says it reused and changed (submission/README.md line 19, Template and what changed), quoted:

It follows the architecture of SBCv6.v Module TM21 (1RB1LB_0LC1RD_0RA1LC_0RB1RE_0RD0LF_---1LE), a binary counter over a list of (n, m) pairs with a re-pairing overflow. Its transitions are not close (10 of 12 differ under the best renaming).

  • Kept: a Fixpoint over a digit list as the configuration, the overflow as a list re-pairing (Oz/Oout, as TM21's Ov), and multistep_nonhalt + progress_nonhalt_cond with a list invariant.
  • Changed: every digit carries a bit. The macro step is one carry (M_spec) rather than TM21's whole-cycle LIncs/BigStep, because merges happen at data-dependent times. TM21's LWF (2^len ≤ m) fails here, so it is replaced by the three-phase INV. The window lemmas are direct es runs, not flip/sideRLs.

The file is 694 lines, about 2.2 times TM21's 308. The informal proof is proof.md (§6 maps it to lemma names).

Fig P1 · Reuse of the template, line by line and by name

Top two bars: non-blank lines after the TM string is replaced by <TM> and whitespace is collapsed. Bottom bar: our Definitions/Lemmas/… by name.

ours 595 lines
6% identical · 2 changed · 559 added
template 320 lines
11% kept verbatim · 284 not in ours
our items 105
1 identical · 2 adapted · 102 new · 25 template-only
identicalchanged / adaptedours only (new)template only
Template part: lines 1–53 (shared header, before the first Module) + 3703–4008 (body of Module TM21; the Module/End lines left out). Ours: lines 11–694 (header comment 1–10 left out). Line diff: Python difflib SequenceMatcher; inside a replaced block, line pairs at least 75% alike count as changed, the rest as removed + added.

Template-only names: segRLs_trans_add, sideRLs_trans_add, sideRLs_trans_S, tm', C0, C1, LH, toLH, LC1, LC0, Ov, Ov_spec, RC, RIncs, Ov', LIncs, LIncs_spec, S', BigStep, length_LIncs, LIncs_k, length_Ov, LWF, aWF, LWF_spec

Side-by-side diff: template (320 lines) vs ours (595 lines), 845 lines differ; runs of identical lines and long template-only runs folded
identicalequal once each TM string is <TM>changedours onlytemplate only
templateours
1From BusyCoq Require Import Individual62.12From BusyCoq Require Import Individual62.
2Require Import ZifyNat Lia.13Require Import ZifyNat Lia.
3Require Import ZArith.
4Require Import String.14Require Import String.
5Require Import List.15Require Import List.
6From BusyCoq Require Import Longitudinal.
16Require Import Arith.
8Open Scope list.
10Ltac flia := repeat (lia || f_equal).
⋯ 35 template-only lines (template 12–49), not in ours
50 [ eassumption | ];
51 try esx ].
3704Definition tm := Eval compute in (TM_from_str "1RB1LB_0LC1RD_0RA1LC_0RB1RE_0RD0LF_---1LE").18Definition tm := Eval compute in (TM_from_str "1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---").
20Notation "c --> c'" := (c -[ tm ]-> c') (at level 40).
3706Notation "c -->* c'" := (c -[ tm ]->* c') (at level 40).21Notation "c -->* c'" := (c -[ tm ]->* c') (at level 40).
3707Notation "c -->+ c'" := (c -[ tm ]->+ c') (at level 40).22Notation "c -->+ c'" := (c -[ tm ]->+ c') (at level 40).
3709Definition tm' := flip tm.
24Open Scope list.
3711Notation "l <| r" := (l <{{C}} [] *> r) (at level 30).
26(* rotation of a power by one cell *)
3712Notation "l |> r" := (l <* [] {{E}}> r) (at level 30).
27Lemma rot01 n (Y : side) : [0;1]^^n *> (0 >> Y) = 0 >> ([1;0]^^n *> Y).
3714Notation hL := (C,[]).
28Proof.
3715Notation hR := (E,[]).
29 induction n; cbn; [reflexivity|].
3716Notation hLR2 := [(hL,hR)].
30 rewrite IHn. reflexivity.
3717Notation hRL2 := [(hR,hL)].
31Qed.
3719Definition C0 n m := <[0;1]^^(n) <+ <[0;0;1] <+ <[0;1]^^m <+ <[1].
33Lemma lshift (xs : list sym) n (l : side) : l <* xs <* xs^^n = l <* xs^^(S n).
3720Definition C1 n m := <[0;1]^^(n) <+ <[0;1;1] <+ <[0;1]^^m <+ <[1].
34Proof.
3722Inductive LH := LH1|LH2|LH3.
35 cbn. rewrite <-Str_app_assoc, lpow_shift. reflexivity.
3724Definition toLH x :=
36Qed.
3725match x with
38(* ---------- one-block lemmas ---------- *)
3726| LH1 => 0inf
39Lemma S1_1 l r: l <* [] {{B}}> [0;1] *> r -->* l <* [0;1] <* [] {{B}}> r. Proof. es. Qed.
3727| LH2 => 0inf <* <[1;1;0;1;0;1;1]
40Lemma S2_1 l r: l <* [] {{C}}> [1;0] *> r -->* l <* [1;0] <* [] {{C}}> r. Proof. es. Qed.
3728| LH3 => 0inf <* <[1;1;1]
41Lemma S3_1 l r: l <* [1;0] <{{D}} [] *> r -->* l <{{D}} [] *> [1;0] *> r. Proof. es. Qed.
42Lemma S4_1 l r: l <* [0;1] <{{E}} [] *> r -->* l <{{E}} [] *> [0;1] *> r. Proof. es. Qed.
43Lemma S6_1 l r: l <* [0] {{B}}> [1;0] *> r -->* l <* [0;1] <* [0] {{B}}> r. Proof. es. Qed.
44Lemma S5_1 l r: l {{C}}> [1;1] *> [0;1] *> r -->* l <* [0;1] {{C}}> [1;1] *> r. Proof. es. Qed.
46Definition S1 := shift_rule_R _ _ _ _ _ S1_1.
47Definition S2 := shift_rule_R _ _ _ _ _ S2_1.
48Definition S3 := shift_rule_L _ _ _ _ _ S3_1.
49Definition S4 := shift_rule_L _ _ _ _ _ S4_1.
50Definition S6 := shift_rule_R _ _ _ _ _ S6_1.
52Lemma S5 n: forall l r, l {{C}}> [1;1] *> [0;1]^^n *> r -->* l <* [0;1]^^n {{C}}> [1;1] *> r.
53Proof.
54 induction n; intros.
55 - finish.
56 - follow S5_1. follow IHn. rewrite lshift. finish.
57Qed.
59(* ---------- finite turns ---------- *)
60Lemma T1 l: l {{B}}> 0inf -->* l <{{E}} [0;1] *> 0inf. Proof. es. Qed.
61Lemma T2 l r: l <* [0;0;0] <{{E}} r -->* l <* [0;0;1] {{B}}> r. Proof. es. Qed.
62Lemma T3 l r: l <* [0;0;1] <{{E}} r -->* l <{{E}} [0;1;1] *> r. Proof. es. Qed.
63Lemma T4 l r: l <* [1;0] <{{E}} r -->* l <{{D}} [1;1] *> r. Proof. es. Qed.
64Lemma T5 l r: l <* [0;1] <{{D}} r -->* l <{{E}} [0;1] *> r. Proof. es. Qed.
65Lemma T6 l r: l <* [0;0] <{{D}} r -->* l <* [0;1] {{C}}> r. Proof. es. Qed.
66Lemma T7 l r: l {{C}}> [1;1] *> r -->* l <* [0;0] {{C}}> r. Proof. es. Qed.
67Lemma T8 l r: l {{C}}> [1;1;0;1;1] *> r -->* l <* [0;0;0;0;1] {{B}}> r. Proof. es. Qed.
68Lemma T9 r: 0inf <* [1;0;0;1] <{{E}} r -->* 0inf <* [1;0;0;1] <* [0;0;0] {{B}}> r. Proof. es. Qed.
69Lemma T10 l r: l {{B}}> [1;1] *> r -->* l <* [0;0] {{B}}> r. Proof. es. Qed.
70Lemma T11 l r: l {{B}}> [0] *> r -->* l <* [1] {{C}}> r. Proof. es. Qed.
71Lemma T12 l: l {{C}}> [1;1] *> 0inf -->* l <{{E}} [0;1;1;0;1] *> 0inf. Proof. es. Qed.
72Lemma T13 l r: l <* [1;0;1] <{{E}} r -->* l <{{E}} [0;1;1] *> r. Proof. es. Qed.
73Lemma T14 l r: l {{B}}> [1;1;0;1] *> r -->* l <* [0;1;0;0] {{B}}> r. Proof. es. Qed.
76Lemma p01 n (Y : side) : [0;1]^^n *> 0 >> 1 >> Y = 0 >> 1 >> [0;1]^^n *> Y.
77Proof. exact (lpow_shift' _ n [0;1] Y). Qed.
78Lemma p10 n (Y : side) : [1;0]^^n *> 1 >> 0 >> Y = 1 >> 0 >> [1;0]^^n *> Y.
79Proof. exact (lpow_shift' _ n [1;0] Y). Qed.
81Lemma rot10 n (Y : side) : [1;0]^^n *> (1 >> Y) = 1 >> ([0;1]^^n *> Y).
82Proof.
83 induction n; cbn; [reflexivity|].
84 rewrite IHn. reflexivity.
85Qed.
86Ltac fin := apply evstep_refl'; simpl_tape; repeat (rewrite rot01 || rewrite rot10); try reflexivity.
88(* ---------- digit lemmas ---------- *)
89Lemma Lb u v l r:
90 l <* [0;1]^^(S u) <* [1;0]^^(S v) <{{E}} r -->*
91 l <{{E}} [0;1]^^(S u) *> [1;0]^^v *> [1;1] *> r.
92Proof.
93 follow T4. follow S3. follow T5. follow S4. fin.
94Qed.
96Lemma Lf u v l r:
97 l <* [0;1]^^u <* [0;0] <* [1;0]^^(S v) <{{E}} r -->*
98 l <* [0;1]^^(S u) <* [1;0]^^v {{C}}> [1;1] *> r.
99Proof.
100 follow T4. follow S3. follow T6. follow S2. fin.
101Qed.
103Lemma Rb u v l r:
104 l {{C}}> [1;1] *> [0;1]^^u *> [1;0]^^v *> [1;1] *> r -->*
105 l <* [0;1]^^u <* [0;0] <* [1;0]^^v {{C}}> [1;1] *> r.
106Proof.
107 follow S5. follow T7. follow S2. fin.
108Qed.
110Lemma Ro u v l r:
111 l <* [0;0;0] {{B}}> [0;1]^^(S u) *> [1;0]^^v *> [1;1] *> r -->*
112 l <* [0;0] <* [1;0]^^(S u) <* [0;1]^^v <* [0;0;0] {{B}}> r.
113Proof.
114 follow S1.
115 follow (S6 (l <* [0;0;0] <* [0;1]^^u <* [1])).
116 follow T10.
117 fin.
118Qed.
120(* right-edge chunk shared by M and O: (10)^a 000 (10)^b B> 0^inf -> <E (01)^a 011 (01)^(b+2) 0^inf *)
121Lemma chunkA a b l:
122 l <* [0;1]^^a <* [0;0;0] <* [0;1]^^b {{B}}> 0inf -->+
123 l <{{E}} [0;1]^^a *> [0;1;1] *> [0;1]^^(S (S b)) *> 0inf.
124Proof. es. Qed.
126(* end of M: C> 11 (01)^a 011 (01)^(b+2) 0^inf -> (10)^(a+1) 000 (10)^(b+2) B> 0^inf *)
127Lemma chunkC a b l:
128 l {{C}}> [1;1] *> [0;1]^^a *> [0;1;1] *> [0;1]^^(S (S b)) *> 0inf -->*
129 l <* [0;1]^^(S a) <* [0;0;0] <* [0;1]^^(S (S b)) {{B}}> 0inf.
130Proof.
131 follow S5. follow T8. follow S1. fin.
132Qed.
134(* end of O: 000 B> (01)^(a+1) 011 (01)^(b+2) 0^inf -> 10 (01)^(a+1) (10)^(b+3) 000 10 B> 0^inf *)
135Lemma chunkO a b l:
136 l <* [0;0;0] {{B}}> [0;1]^^(S a) *> [0;1;1] *> [0;1]^^(S (S b)) *> 0inf -->*
137 l <* [0;1] <* [1;0]^^(S a) <* [0;1]^^(S (S (S b))) <* [0;0;0] <* [0;1] {{B}}> 0inf.
138Proof.
139 follow S1. follow T11. follow S5. follow T12. follow S4. follow T13. follow S4. follow T2. follow S1. follow S1_1.
140 rewrite (rot01 (S (S b))).
141 follow (S6 (l <* [0;0;1] <* [0;1]^^a <* [1]) ([1;1;0;1] *> 0inf) (S (S (S b)))).
142 follow T14. fin.
143Qed.
145(* ---------- the digit list ---------- *)
146Inductive dg := d0 (u v : nat) | d1 (u v : nat).
148(* left-side lists are written nearest-cell first: (10)^u is [0;1]^^u, (01)^v is [1;0]^^v *)
149Definition dl (d : dg) (l : side) : side :=
150 match d with
151 | d0 u v => l <* [0;1]^^u <* [0;0] <* [1;0]^^v
152 | d1 u v => l <* [0;1]^^u <* [1;0]^^v
3729end.153 end.
3731Notation LS := (list (nat*nat)).
155(* digit lists are least significant digit first *)
3733Fixpoint LC1(x:LS)(y:LH):side :=
156Fixpoint app_ds (l : side) (ds : list dg) : side :=
3734match x with157 match ds with
3735| [] => toLH y
158 | [] => l
3736| (n,m)::t => LC1 t y <* C1 n m
159 | d :: t => dl d (app_ds l t)
3737end.160 end.
3739Fixpoint LC0(x:LS)(y:LH):side :=
162Definition L0 : side := 0inf <* [1;0;0;1].
3740match x with
164Definition K (ds : list dg) (a b : nat) : Q * tape :=
3741| [] => toLH y
165 app_ds L0 ds <* [0;1]^^a <* [0;0;0] <* [0;1]^^b {{B}}> 0inf.
3742| (n,m)::t => LC0 t y <* C0 n m
167Definition map1 (os : list (nat*nat)) := map (fun '(u,v) => d1 (S u) (S v)) os.
168Definition map0 (os : list (nat*nat)) := map (fun '(u,v) => d0 (S u) v) os.
170Fixpoint rw (os : list (nat*nat)) (r : side) : side :=
171 match os with
172 | [] => r
173 | (u,v) :: t => rw t ([0;1]^^(S u) *> [1;0]^^v *> [1;1] *> r)
3743end.174 end.
3745Inductive Ov: LS->LH->nat->LS->LH->Prop :=
176Lemma app_ds_app l xs ys : app_ds l (xs ++ ys) = app_ds (app_ds l ys) xs.
3746| Ov_1 m a:
177Proof. induction xs; cbn; congruence. Qed.
3747 m<>O ->
179Lemma LbS os: forall l r, app_ds l (map1 os) <{{E}} r -->* l <{{E}} rw os r.
3748 Ov [(2,m)] LH1 a [(m,a)] LH2
3749| Ov_2 a:
⋯ 11 template-only lines (template 3750–3761), not in ours
3762 LC1 x y <| [0;1]^^(1+a) *> [1] *> r -->+
3763 LC0 x' y' |> r.
3764Proof.180Proof.
3765 intro H.
181 induction os as [|[u v] t IH]; intros.
3766 induction H; intros.
182 - finish.
3767 - destruct m. 1: lia.
183 - cbn [map1 map app_ds dl rw]. follow Lb. apply IH.
3768 es.
3769 - es.
⋯ 5 template-only lines (template 3770–3774), not in ours
3775 follow100 IHOv.
3776 es.
3777Qed.184Qed.
3779Definition RC n m := [0;1]^^(1+n) *> [1] *> [0;1]^^m *> 0inf.
186Lemma RbS os: forall l r, l {{C}}> [1;1] *> rw os r -->* app_ds l (map0 os) {{C}}> [1;1] *> r.
3781Lemma RIncs k n m:
3782 sideRLs tm (hRL2^^k) (RC n m) (RC (k+n) (k+m)).
3783Proof.187Proof.
3784 unfold RC.
188 induction os as [|[u v] t IH]; intros.
3785 sideRLs_ind k.
189 - finish.
190 - cbn [map0 map app_ds dl rw]. follow IH. apply Rb.
3786Qed.191Qed.
3788Lemma Ov' x y a x' y' b:
193Fixpoint ro_out (os : list (nat*nat)) (l : side) : side :=
3789 Ov x y a x' y' ->
194 match os with
3790 LC1 x y <| RC a b -->+
195 | [] => l
3791 LC0 x' y' <| RC b 1.
196 | (u,v) :: t => ro_out t l <* [0;0] <* [1;0]^^(S u) <* [0;1]^^v
197 end.
199Lemma RoS os: forall l r, l <* [0;0;0] {{B}}> rw os r -->* ro_out os l <* [0;0;0] {{B}}> r.
3792Proof.200Proof.
3793 unfold RC.
201 induction os as [|[u v] t IH]; intros.
3794 intro H.
202 - finish.
3795 eapply Ov_spec in H.
203 - cbn [ro_out rw]. follow IH. apply Ro.
3796 follow10 H.
3797 es.
3798Qed.204Qed.
3800Inductive LIncs: LS->LS->nat->Prop :=
206Fixpoint Oz (t : list (nat*nat)) (u : nat) : list dg :=
3801| LIncs_O:
207 match t with
3802 LIncs [] [] 0
208 | [] => [d0 0 u]
3803| LIncs_S x y k n m:
209 | (a, b) :: t' => d0 b u :: Oz t' (S a)
3804 LIncs x y k ->
210 end.
3805 LIncs (x<:(n,k+m)) (y<:(k+n,m)) (k*2+1)
212Definition Oout (os : list (nat*nat)) (A : nat) : list dg :=
3806.
213 match os with
3808Lemma LIncs_spec x y k z:
214 | [] => []
3809 LIncs x y k ->
215 | (u, v) :: t => d1 (S v) A :: Oz t (S u)
3810 sideRLs tm' (hLR2^^k) (LC0 x z) (LC1 y z).
216 end.
218Lemma Ozeq t: forall u l, ro_out t l <* [0;0] <* [1;0]^^u = app_ds l (Oz t u).
3811Proof.219Proof.
3812 intros H.
220 induction t as [|[a b] t IH]; intros.
3813 induction H.
221 - reflexivity.
3814 - esx.
222 - cbn [ro_out Oz app_ds dl]. rewrite <- IH. reflexivity.
3815 - cbn[LC0]; cbn[LC1].
3816 eapply segRLs_sideRLs_concat.
⋯ 14 template-only lines (template 3817–3830), not in ours
3831 simpl_tape; cbn.
3832 esx.
3833Qed.223Qed.
3835Definition S' '(x,y,z) := LC0 x y <| RC z 1.
225(* M: carry *)
3837Lemma BigStep x y z x0 x1 y0 k:
226Lemma M_spec os u v rest a b:
3838 LIncs x x0 k ->
227 K (map1 os ++ d0 u (S v) :: rest) a b -->+
3839 Ov x0 y (k+z) x1 y0 ->
228 K (map0 os ++ d1 (S u) v :: rest) (S a) (S (S b)).
3840 S' (x,y,z) -->+
3841 S' (x1,y0,k+1).
3842Proof.229Proof.
3843 unfold S'.
230 unfold K. rewrite !app_ds_app.
3844 intros I1 I2.
231 follow10 chunkA.
3845 eapply LIncs_spec in I1.
232 follow LbS.
3846 eapply Ov' in I2.
233 cbn [app_ds dl].
3847 epose proof (sideRLs_concat_1L (RIncs k _ _) I1) as I1'.
234 follow Lf.
3848 follow I1'.
235 follow RbS.
3849 apply I2.
236 apply chunkC.
3850Qed.237Qed.
3852Lemma init:
239(* M with the flipped digit dropping: (u+1,1,0) fuses into the digit below it *)
3853 c0 -->*
240Lemma Mdrop_spec os u2 v2 u rest a b:
3854 S' (<[(2,2);(1%nat,3);(2,5)],LH1,4).
241 K (map1 (os ++ [(u2,v2)]) ++ d0 u 1 :: rest) a b -->+
242 K (map0 os ++ d0 (S u2 + S u) v2 :: rest) (S a) (S (S b)).
3855Proof.243Proof.
3856 esx.
244 follow10 (M_spec (os ++ [(u2,v2)]) u 0 rest a b).
245 assert (E: app_ds L0 (map0 (os ++ [(u2,v2)]) ++ d1 (S u) 0 :: rest) =
246 app_ds L0 (map0 os ++ d0 (S u2 + S u) v2 :: rest)).
247 { unfold map0. rewrite map_app, <- app_assoc. cbn [map app].
248 rewrite !app_ds_app. f_equal. cbn [app_ds dl].
249 rewrite (lpow_add _ (S u2) (S u)), Str_app_assoc. reflexivity. }
250 unfold K. rewrite E. finish.
3857Qed.251Qed.
3859Lemma length_LIncs {x y k}:
253(* O: overflow *)
3860 LIncs x y k ->
254Lemma O_spec os a b: os <> [] ->
3861 length y = length x.
255 K (map1 os) (S a) b -->+ K (Oout os (S a)) (S (S (S b))) 1.
3862Proof.256Proof.
3863 intros H.
257 intro H. destruct os as [|[u v] t]; [congruence|].
3864 induction H; cbn; lia.
258 unfold K.
259 follow10 chunkA.
260 follow LbS.
261 follow T9.
262 follow RoS.
263 follow chunkO.
264 apply evstep_refl'. cbn [Oout app_ds dl ro_out]. rewrite <- Ozeq. reflexivity.
3865Qed.265Qed.
3867Lemma LIncs_k x y k:
267Lemma init: c0 -->* K [d1 1 2] 8 5.
3868 LIncs x y k ->
268Proof. unfold K, L0. cbn. solve_init. Qed.
3869 k = 2^(length x)-1.
270(* ================= abstract invariant (write-up section 3) ================= *)
271Open Scope nat_scope.
273Definition bof d := match d with d0 _ _ => 0 | d1 _ _ => 1 end.
274Definition vof d := match d with d0 _ v => v | d1 _ v => v end.
276(* R of a list: carries still to come into its last (least significant) digit *)
277Fixpoint Rof (ds : list dg) : nat :=
278 match ds with
279 | [] => 0
280 | d0 _ _ :: t => 2 * Rof t + 1
281 | d1 _ _ :: t => 2 * Rof t
282 end.
284(* per-digit quantities, r = Rof of the digits above *)
285Definition Rd d r := match d with d0 _ _ => 2*r+1 | d1 _ _ => 2*r end.
286Definition ub d r := match d with d0 u _ => u + r + 1 | d1 u _ => u + r end.
288Fixpoint AllD (P : dg -> nat -> nat -> Prop) (ds : list dg) : Prop :=
289 match ds with
290 | [] => True
291 | d :: t => AllD P t /\ P d (Rof t) (length t)
292 end.
294Definition canon d := match d with d0 _ v => v >= 1 | d1 u v => u >= 1 /\ v >= 1 end.
296Definition PA d r p :=
297 canon d /\ vof d >= Rd d r + 1 /\ ub d r mod 2 = 1 /\ (p = 0 -> ub d r = 1).
298Definition PB k d r p :=
299 canon d /\ (vof d + bof d) mod 2 = 1 /\ ub d r >= 2^(p+k) /\ (k = 0 -> p = 0 -> d = d0 0 1).
301Definition LSBok ds := match ds with [] => False | d :: _ => vof d >= Rof ds + 1 end.
303Definition INV (s : list dg * nat * nat) : Prop :=
304 let '(ds, a, b) := s in
305 ds <> [] /\ a >= 1 /\ b mod 2 = 1 /\ (a + Rof ds) mod 2 = 0 /\
306 a + Rof ds + 2 >= 2^(S (length ds)) /\ b + 3 + 2 * Rof ds >= 2^(S (length ds)) /\ LSBok ds /\
307 ( (AllD PA ds /\ a + Rof ds + 1 >= 2^(S (length ds)))
308 \/ AllD (PB 0) ds
309 \/ (AllD (PB 1) ds /\ a + Rof ds + 1 >= 2^(S (length ds)) /\ b + 1 + 2 * Rof ds >= 2^(S (length ds))) ).
311Definition Kc (s : list dg * nat * nat) : Q * tape := let '(ds, a, b) := s in K ds a b.
313(* ---------- arithmetic helpers ---------- *)
314Lemma pow2S n : 2^(S n) = 2 * 2^n.
315Proof. apply Nat.pow_succ_r'. Qed.
316Lemma pow2pos n : 2^n >= 1.
317Proof. pose proof (Nat.pow_nonzero 2 n). lia. Qed.
319Lemma Rof_bound ds : Rof ds + 1 <= 2^(length ds).
3870Proof.320Proof.
3871 intros H.
321 induction ds as [|[u v|u v] t IH]; cbn [Rof length]; rewrite ?pow2S; cbn; lia.
3872 induction H; cbn; lia.
3873Qed.322Qed.
3875Lemma length_Ov {x y a x' y'}:
324Lemma Rof_map1 os X : Rof (map1 os ++ X) = 2^(length os) * Rof X.
3876 Ov x y a x' y' ->
3877 length x' = length x + (match y with LH1 => 0 | _ => 1 end).
3878Proof.325Proof.
3879 intro H.
326 induction os as [|[u v] t IH]; cbn [map1 map app Rof length] in *.
3880 induction H; cbn; trivial.
327 - cbn; lia.
3881 rewrite IHOv; trivial.
328 - unfold map1 in IH. rewrite IH, pow2S. lia.
3882Qed.329Qed.
3884Inductive LWF: LS->LH->Prop :=
331Lemma Rof_map1' os : Rof (map1 os) = 0.
3885| LWF_S x y n m
332Proof. rewrite <- (app_nil_r (map1 os)), Rof_map1. cbn. lia. Qed.
3886 (Ha:LWF x y)
334Lemma len_map1 os : length (map1 os) = length os.
3887 (Hb:2^(length x)<=m)
335Proof. apply length_map. Qed.
3888 (Hc:n<>O):
336Lemma len_map0 os : length (map0 os) = length os.
3889 LWF (x<:(n,m)) y
337Proof. apply length_map. Qed.
3890| LWF_O_1:
339Lemma AllD_app P xs ys : AllD P (xs ++ ys) -> AllD P ys.
3891 LWF [(2,2)] LH1
340Proof. induction xs; cbn; tauto. Qed.
3892| LWF_O_2 a:
342Lemma AllD_last P xs d : AllD P (xs ++ [d]) -> P d 0 0.
3893 2<=a ->
343Proof. intro H. apply AllD_app in H. cbn in H. tauto. Qed.
3894 LWF [(2,a)] LH2
345Lemma AllD_canon (P : dg -> nat -> nat -> Prop) ds :
3895| LWF_O_3 a a0:
346 (forall d r p, P d r p -> canon d) -> AllD P ds -> Forall canon ds.
3896 2<=a ->
3897 2<=a0 ->
⋯ 14 template-only lines (template 3898–3914), not in ours
3915 Ov x0 y a x1 y0 /\
3916 LWF x1 y0.
3917Proof.347Proof.
3918 intro H.
348 intro HP. induction ds; cbn; intros; constructor; firstorder.
3919 gen a.
349Qed.
3920 induction H.
351Lemma decomp ds : Forall canon ds ->
3921 - intros.
352 (exists os, ds = map1 os) \/ (exists os u v rest, ds = map1 os ++ d0 u (S v) :: rest).
3922 epose proof (IHLWF _ _) as [x0 [k [I1 [x1 [y0 [I2 I3]]]]]].
353Proof.
3923 epose proof (LIncs_k _ _ _ I1); subst.
354 induction ds as [|[u v|u v] t IH]; intro H.
3924 eexists _,_; split.
355 - left. exists (@nil (nat*nat)). reflexivity.
3925 { applys_eq (LIncs_S _ _ _ n (m-(2^(length x)-1)) I1).
356 - inversion H; subst. cbn in *. destruct v as [|v]; [lia|].
3926 flia. }
357 right. exists (@nil (nat*nat)), u, v, t. reflexivity.
3927 eexists _,_; split.
358 - inversion H; subst. cbn in *. destruct u as [|u]; [lia|]. destruct v as [|v]; [lia|].
3928 { apply Ov_S.
359 destruct (IH ltac:(assumption)) as [[os E]|[os [u' [v' [rest E]]]]]; subst.
3929 2: lia.
360 + left. exists ((u,v)::os). reflexivity.
3930 apply I2. }
361 + right. exists ((u,v)::os), u', v', rest. reflexivity.
3931 eapply LWF_S.
362Qed.
3932 + apply I3.
364(* ---------- F1: a carry without a drop keeps every ubar/vbar ---------- *)
3933 + inverts H0.
365Lemma F1 (P : dg -> nat -> nat -> Prop) os u v rest:
3934 cbn in HaWF.
366 (forall u v r p, P (d0 u (S (S v))) r p -> P (d1 (S u) (S v)) r p) ->
3935 epose proof (length_LIncs I1).
367 (forall u v r p, P (d1 (S u) (S v)) (S r) p -> P (d0 (S u) v) r p) ->
3936 epose proof (length_Ov I2).
368 AllD P (map1 os ++ d0 u (S (S v)) :: rest) ->
3937 rewrite H1,H0.
369 AllD P (map0 os ++ d1 (S u) (S v) :: rest) /\
3938 destruct y; rewrite Nat.pow_add_r; lia.
370 Rof (map1 os ++ d0 u (S (S v)) :: rest) = S (Rof (map0 os ++ d1 (S u) (S v) :: rest)) /\
371 length (map0 os ++ d1 (S u) (S v) :: rest) = length (map1 os ++ d0 u (S (S v)) :: rest).
372Proof.
373 intros H0 H1. induction os as [|[u' v'] t IH]; intros HA.
374 - cbn [map1 map0 map app AllD Rof length] in *. destruct HA as [HA HP].
375 repeat split; auto. lia.
376 - unfold map1, map0 in *. cbn [map app AllD Rof length] in *. destruct HA as [HA HP].
377 destruct (IH HA) as [IA [IR IL]].
378 rewrite IR in HP. rewrite IL. repeat split; auto. lia.
379Qed.
381Lemma PA_touch0 u v r p : PA (d0 u (S (S v))) r p -> PA (d1 (S u) (S v)) r p.
382Proof. unfold PA, canon, Rd, ub, vof. intros (H1 & H2 & H3 & H4).
383 repeat split; try lia; intro E; specialize (H4 E); lia. Qed.
385Lemma PA_touch1 u v r p : PA (d1 (S u) (S v)) (S r) p -> PA (d0 (S u) v) r p.
386Proof. unfold PA, canon, Rd, ub, vof. intros (H1 & H2 & H3 & H4).
387 repeat split; try lia; intro E; specialize (H4 E); lia. Qed.
389Lemma PB_touch0 k u v r p : PB k (d0 u (S (S v))) r p -> PB k (d1 (S u) (S v)) r p.
390Proof. unfold PB, canon, ub, vof, bof. intros (H1 & H2 & H3 & H4).
391 repeat split; try lia; intros E1 E2; specialize (H4 E1 E2); discriminate. Qed.
393Lemma PB_touch1 k u v r p : PB k (d1 (S u) (S v)) (S r) p -> PB k (d0 (S u) v) r p.
394Proof. unfold PB, canon, ub, vof, bof. intros (H1 & H2 & H3 & H4).
395 repeat split; try lia; intros E1 E2; specialize (H4 E1 E2); discriminate. Qed.
397(* ---------- F2: a drop ---------- *)
398Definition Rel r ro rn := rn + 1 <= ro /\ ro <= 2 * (rn + 1) /\ (r = 0 -> ro = rn + 1).
400Lemma PB_chain k k' r u v ro rn p :
401 (k' = k \/ (k = 0 /\ k' = 1 /\ r = 0)) -> Rel r ro rn -> p >= 1 ->
402 PB k (d1 (S u) (S v)) ro (S p) -> PB k' (d0 (S u) v) rn p.
403Proof.
404 unfold PB, Rel, canon, ub, vof, bof. intros Hk (R1 & R2 & R3) Hp (H1 & H2 & H3 & H4).
405 cbn [Nat.add] in H3. rewrite pow2S in H3.
406 repeat split; try lia.
407 destruct Hk as [Hk|(Hk & Hk' & Hr)]; subst.
408 - lia.
409 - specialize (R3 eq_refl). rewrite Nat.add_0_r in H3. rewrite (Nat.add_1_r p), pow2S. lia.
410Qed.
412Lemma PB_abs k k' r p u2 v2 u :
413 ((k' = k /\ (k = 0 -> p >= 1)) \/ (k = 0 /\ k' = 1 /\ p = 0 /\ r = 0)) ->
414 PB k (d0 u 1) r p -> PB k (d1 (S u2) (S v2)) (2*r+1) (S p) -> PB k' (d0 (S u2 + S u) v2) r p.
415Proof.
416 unfold PB, canon, ub, vof, bof. intros Hk (A1 & A2 & A3 & A4) (H1 & H2 & H3 & H4).
417 destruct Hk as [(Hk & Hp)|(Hk & Hk' & Hp & Hr)]; subst.
418 - repeat split; try lia; try (intros E1 E2; specialize (Hp E1); lia).
419 - cbn [Nat.pow Nat.add] in *. repeat split; try lia; try (intros E1; discriminate).
420Qed.
422Lemma F2chain k k' r os X X' :
423 (k' = k \/ (k = 0 /\ k' = 1 /\ r = 0)) -> X' <> [] ->
424 AllD (PB k) (map1 os ++ X) -> AllD (PB k') X' -> Rel r (Rof X) (Rof X') -> length X = S (length X') ->
425 AllD (PB k') (map0 os ++ X') /\ Rel r (Rof (map1 os ++ X)) (Rof (map0 os ++ X')) /\
426 length (map1 os ++ X) = S (length (map0 os ++ X')).
427Proof.
428 intros Hk HX'. induction os as [|[u v] t IH]; intros HA HA' HR HL.
429 - cbn [map1 map0 map app] in *. auto.
430 - unfold map1, map0 in *. cbn [map app AllD Rof length] in *. destruct HA as [HA HP].
431 destruct (IH HA HA' HR HL) as [IA [IR IL]].
432 rewrite IL in HP.
433 split; [split|split].
434 + exact IA.
435 + eapply PB_chain; eauto.
436 rewrite length_app. destruct X'; [congruence|]. cbn. lia.
437 + unfold Rel in *. destruct IR as (R1 & R2 & R3). repeat split; try lia;
438 try (intro E; specialize (R3 E); lia).
3939 + lia.439 + lia.
3940 Unshelve.
3941 { econstructor; lia. }
⋯ 35 template-only lines (template 3942–3976), not in ours
3977 2,3: cbn; lia.
3978 apply LWF_O_1.
3979Qed.440Qed.
3981Close Scope sym.
442Lemma F2 k k' os u2 v2 u rest:
443 ((k' = k /\ (k = 0 -> rest <> [])) \/ (k = 0 /\ k' = 1 /\ rest = [])) ->
444 AllD (PB k) (map1 (os ++ [(u2,v2)]) ++ d0 u 1 :: rest) ->
445 AllD (PB k') (map0 os ++ d0 (S u2 + S u) v2 :: rest) /\
446 Rel (Rof rest) (Rof (map1 (os ++ [(u2,v2)]) ++ d0 u 1 :: rest))
447 (Rof (map0 os ++ d0 (S u2 + S u) v2 :: rest)) /\
448 length (map1 (os ++ [(u2,v2)]) ++ d0 u 1 :: rest) = S (length (map0 os ++ d0 (S u2 + S u) v2 :: rest)).
449Proof.
450 intros Hk HA.
451 replace (map1 (os ++ [(u2,v2)]) ++ d0 u 1 :: rest)
452 with (map1 os ++ (d1 (S u2) (S v2) :: d0 u 1 :: rest)) in *
453 by (unfold map1; rewrite map_app, <- app_assoc; reflexivity).
454 pose proof (AllD_app _ _ _ HA) as HX. cbn [AllD Rof length] in HX.
455 destruct HX as [[Hrest Hdrop] Habs].
456 apply (F2chain k k' (Rof rest)).
457 - destruct Hk as [(Hk & _)|(Hk & Hk' & Hr)]; [left; auto|right; subst; auto].
458 - congruence.
459 - exact HA.
460 - cbn [AllD Rof length]. split.
461 + destruct Hk as [(Hk & _)|(Hk & Hk' & Hr)]; subst; [exact Hrest|exact I].
462 + eapply PB_abs; [|exact Hdrop|exact Habs].
463 destruct Hk as [(Hk & Hne)|(Hk & Hk' & Hr)]; subst.
464 * left. split; auto. intro E. specialize (Hne E). destruct rest; [congruence|]. cbn. lia.
465 * right. cbn. auto.
466 - unfold Rel. cbn [Rof]. lia.
467 - reflexivity.
468Qed.
470(* ---------- F3: the overflow ---------- *)
471Lemma Oz_len t u : length (Oz t u) = S (length t).
472Proof. revert u. induction t as [|[a b] t IH]; intro u; cbn; [reflexivity|]. rewrite IH. reflexivity. Qed.
474Lemma Oz_R t u : Rof (Oz t u) + 1 = 2^(S (length t)).
475Proof.
476 revert u. induction t as [|[a b] t IH]; intro u; cbn [Oz Rof length].
477 - cbn. reflexivity.
478 - specialize (IH (S a)). rewrite (pow2S (S (length t))). lia.
479Qed.
481Lemma Oz_AB t : forall u, AllD PA (map1 t) -> u mod 2 = 1 -> (t = [] -> u = 1) -> AllD (PB 0) (Oz t u).
482Proof.
483 induction t as [|[a b] t IH]; intros u HA Hu Ht.
484 - cbn. split; [exact I|]. unfold PB, canon, ub, vof, bof. cbn.
485 rewrite (Ht eq_refl). repeat split; lia.
486 - unfold map1 in HA. cbn [map AllD] in HA. destruct HA as [HA HP]. fold (map1 t) in HA, HP.
487 rewrite Rof_map1', len_map1 in HP. unfold PA, canon, Rd, ub, vof in HP. destruct HP as (P1 & P2 & P3 & P4).
488 cbn [Oz AllD]. split.
489 + apply IH; [exact HA | lia | intro E; subst t; specialize (P4 eq_refl); lia].
490 + pose proof (Oz_R t (S a)) as HR. rewrite Oz_len.
491 unfold PB, canon, ub, vof, bof. rewrite !Nat.add_0_r.
492 repeat split; try lia; try (intros E1 E2; discriminate).
493Qed.
495Lemma Oz_CA t : forall u, AllD (PB 1) (map1 t) -> u >= 2^(S (length t)) -> AllD PA (Oz t u).
496Proof.
497 induction t as [|[a b] t IH]; intros u HA Hu.
498 - cbn. split; [exact I|]. unfold PA, canon, Rd, ub, vof. cbn in *. repeat split; lia.
499 - unfold map1 in HA. cbn [map AllD] in HA. destruct HA as [HA HP]. fold (map1 t) in HA, HP.
500 rewrite Rof_map1', len_map1 in HP. unfold PB, canon, ub, vof, bof in HP. destruct HP as (P1 & P2 & P3 & P4).
501 cbn [Oz AllD]. split.
502 + apply IH; [exact HA|]. rewrite (Nat.add_1_r (length t)) in P3. lia.
503 + pose proof (Oz_R t (S a)) as HR. rewrite Oz_len.
504 cbn [length] in Hu. rewrite (pow2S (S (length t))), (pow2S (length t)) in Hu. rewrite (pow2S (length t)) in HR.
505 unfold PA, canon, Rd, ub, vof.
506 repeat split; try lia; try (intros E1; discriminate).
507Qed.
509(* ---------- bookkeeping for one carry ---------- *)
510Lemma Rof_M os u v rest :
511 Rof (map1 os ++ d0 u (S v) :: rest) = S (Rof (map0 os ++ d1 (S u) v :: rest)).
512Proof.
513 induction os as [|[a b] t IH]; unfold map1, map0 in *; cbn [map app Rof] in *; lia.
514Qed.
516Lemma len_M os u v w x rest :
517 length (map0 os ++ d1 w x :: rest) = length (map1 os ++ d0 u v :: rest).
518Proof. rewrite !length_app, len_map0, len_map1. reflexivity. Qed.
520Lemma LSB_M os u v rest :
521 LSBok (map1 os ++ d0 u (S (S v)) :: rest) -> LSBok (map0 os ++ d1 (S u) (S v) :: rest).
522Proof.
523 intro H. pose proof (Rof_M os u (S v) rest) as E.
524 destruct os as [|[a b] t]; cbn [map1 map0 map app LSBok vof] in *; lia.
525Qed.
527Lemma Rof_head1 os X : os <> [] -> Rof (map1 os ++ X) mod 2 = 0.
528Proof.
529 destruct os as [|[u v] t]; [congruence|]. intros _. unfold map1. cbn [map app Rof]. lia.
530Qed.
532Lemma Rof_head0 os x y rest : Rof (map0 os ++ d0 x y :: rest) mod 2 = 1.
533Proof. destruct os as [|[u v] t]; unfold map0; cbn [map app Rof]; lia. Qed.
535Lemma LSB_drop os u2 v2 u rest r :
536 LSBok (map1 (os ++ [(u2,v2)]) ++ d0 u 1 :: rest) ->
537 Rel r (Rof (map1 (os ++ [(u2,v2)]) ++ d0 u 1 :: rest)) (Rof (map0 os ++ d0 (S u2 + S u) v2 :: rest)) ->
538 LSBok (map0 os ++ d0 (S u2 + S u) v2 :: rest).
539Proof.
540 unfold Rel. intros H (R1 & R2 & R3).
541 destruct os as [|[a b] t]; cbn [map1 map0 map app LSBok vof] in *; lia.
542Qed.
544Lemma app_cons_ne {A} (xs : list A) y ys : xs ++ y :: ys <> [].
545Proof. destruct xs; discriminate. Qed.
547Ltac pw := repeat (rewrite pow2S in *).
549(* ---------- closure: every INV state takes a macro step into INV ---------- *)
550Lemma step s : INV s -> exists s', Kc s -->+ Kc s' /\ INV s'.
551Proof.
552 destruct s as [[ds a] b]. unfold INV.
553 intros (Hne & Ha & Hb & Hpar & HS & HT & HL & Hcls).
554 assert (Hc : Forall canon ds).
555 { destruct Hcls as [[HA _]|[HB|[HC _]]]; (eapply AllD_canon; [|eassumption]);
556 unfold PA, PB; intros; tauto. }
557 destruct (decomp ds Hc) as [[os E]|[os [u [v [rest E]]]]]; subst ds.
558 - (* all bits 1: overflow O *)
559 destruct a as [|a]; [lia|].
560 assert (Hos : os <> []) by (intro; subst; apply Hne; reflexivity).
561 rewrite Rof_map1', len_map1 in *.
562 destruct os as [|[u v] t]; [congruence|].
563 pose proof (Oz_R t (S u)) as HR. pose proof (Oz_len t (S u)) as HLz.
564 exists (Oout ((u,v)::t) (S a), S (S (S b)), 1). split.
565 { apply O_spec. congruence. }
566 unfold INV. cbn [Oout length Rof LSBok vof AllD] in *. rewrite HLz.
567 destruct Hcls as [[HA HS1]|[HB|[HC [HS1 HT2]]]].
568 + (* A -> B *)
569 unfold map1 in HA. cbn [map AllD] in HA. fold (map1 t) in HA. destruct HA as [HA HP].
570 rewrite Rof_map1', len_map1 in HP. unfold PA, canon, Rd, ub, vof in HP. destruct HP as (P1 & P2 & P3 & P4).
571 assert (HB' : AllD (PB 0) (Oz t (S u))).
572 { apply Oz_AB; [exact HA | lia | intro E; subst t; specialize (P4 eq_refl); lia]. }
573 pw.
574 repeat split; try lia; try discriminate.
575 right. left. split; [exact HB'|].
576 unfold PB, canon, ub, vof, bof. rewrite ?Nat.add_0_r. pw.
577 repeat split; try lia; try (intros E1 E2; discriminate).
578 + (* B cannot be all ones: its top is (0,0,1) *)
579 exfalso. destruct (exists_last Hos) as [os' [o E]]. rewrite E in HB.
580 unfold map1 in HB. rewrite map_app in HB. apply AllD_last in HB.
581 destruct o as [x y]. unfold PB in HB. destruct HB as (_ & _ & _ & H4).
582 specialize (H4 eq_refl eq_refl). discriminate.
583 + (* C -> A *)
584 unfold map1 in HC. cbn [map AllD] in HC. fold (map1 t) in HC. destruct HC as [HC HP].
585 rewrite Rof_map1', len_map1 in HP. unfold PB, canon, ub, vof, bof in HP. destruct HP as (P1 & P2 & P3 & P4).
586 assert (HA' : AllD PA (Oz t (S u))).
587 { apply Oz_CA; [exact HC|]. rewrite (Nat.add_1_r (length t)) in P3. lia. }
588 pw.
589 repeat split; try lia; try discriminate.
590 left. split; [split; [exact HA'|]|].
591 * unfold PA, canon, Rd, ub, vof.
592 repeat split; try lia; try (intros E1; discriminate).
593 * lia.
594 - (* some bit 0: carry M *)
595 destruct v as [|v].
596 + (* the flipped digit drops *)
597 destruct Hcls as [[HA _]|[HB|[HC [HS1 HT2]]]].
598 { exfalso. apply AllD_app in HA. cbn [AllD] in HA. destruct HA as [_ HP].
599 unfold PA, Rd, vof in HP. lia. }
600 all: destruct os as [|o os0] eqn:Eos;
601 [ exfalso; cbn [map1 map app LSBok vof Rof] in HL; lia | ].
602 all: assert (Hos : os <> []) by (subst os; discriminate).
603 all: rewrite <- Eos in *; clear Eos o os0.
604 all: destruct (exists_last Hos) as [os' [[u2 v2] Eo]]; subst os.
605 all: exists (map0 os' ++ d0 (S u2 + S u) v2 :: rest, S a, S (S b)); split;
606 [ apply Mdrop_spec | unfold INV ].
607 * (* B *)
608 destruct rest as [|d rest'] eqn:Er.
609 -- (* top fall: B -> C *)
610 rewrite <- Er in *.
611 destruct (F2 0 1 os' u2 v2 u rest) as (HA' & HR & HLn); [right; auto | exact HB |].
612 pose proof (Rof_bound (map0 os' ++ d0 (S u2 + S u) v2 :: rest)) as Hbd.
613 pose proof (Rof_head1 (os' ++ [(u2,v2)]) (d0 u 1 :: rest) ltac:(apply app_cons_ne)) as Hp1.
614 pose proof (Rof_head0 os' (S u2 + S u) v2 rest) as Hp0.
615 pose proof (LSB_drop _ _ _ _ _ _ HL HR) as HL'.
616 unfold Rel in HR. subst rest. cbn [Rof] in HR. destruct HR as (R1 & R2 & R3).
617 specialize (R3 eq_refl).
618 rewrite HLn in *. pw.
619 repeat split; try lia; try apply app_cons_ne; auto.
620 right. right. repeat split; auto; lia.
621 -- (* B -> B *)
622 rewrite <- Er in *.
623 destruct (F2 0 0 os' u2 v2 u rest) as (HA' & HR & HLn);
624 [left; split; auto; intros _; subst rest; discriminate | exact HB |].
625 pose proof (Rof_bound (map0 os' ++ d0 (S u2 + S u) v2 :: rest)) as Hbd.
626 pose proof (Rof_head1 (os' ++ [(u2,v2)]) (d0 u 1 :: rest) ltac:(apply app_cons_ne)) as Hp1.
627 pose proof (Rof_head0 os' (S u2 + S u) v2 rest) as Hp0.
628 pose proof (LSB_drop _ _ _ _ _ _ HL HR) as HL'.
629 unfold Rel in HR. destruct HR as (R1 & R2 & R3).
630 rewrite HLn in *. pw.
631 repeat split; try lia; try apply app_cons_ne; auto.
632 * (* C -> C *)
633 destruct (F2 1 1 os' u2 v2 u rest) as (HA' & HR & HLn);
634 [left; split; auto; intro E; discriminate | exact HC |].
635 pose proof (Rof_bound (map0 os' ++ d0 (S u2 + S u) v2 :: rest)) as Hbd.
636 pose proof (Rof_head1 (os' ++ [(u2,v2)]) (d0 u 1 :: rest) ltac:(apply app_cons_ne)) as Hp1.
637 pose proof (Rof_head0 os' (S u2 + S u) v2 rest) as Hp0.
638 pose proof (LSB_drop _ _ _ _ _ _ HL HR) as HL'.
639 unfold Rel in HR. destruct HR as (R1 & R2 & R3).
640 rewrite HLn in *. pw.
641 repeat split; try lia; try apply app_cons_ne; auto.
642 right. right. repeat split; auto; lia.
643 + (* no drop *)
644 exists (map0 os ++ d1 (S u) (S v) :: rest, S a, S (S b)). split; [apply M_spec | unfold INV].
645 pose proof (Rof_M os u (S v) rest) as ER.
646 pose proof (len_M os u (S (S v)) (S u) (S v) rest) as EL.
647 pose proof (LSB_M os u v rest HL) as HL'.
648 rewrite EL.
649 destruct Hcls as [[HA HS1]|[HB|[HC [HS1 HT2]]]].
650 * destruct (F1 PA os u v rest PA_touch0 PA_touch1 HA) as (HA' & _ & _).
651 repeat split; try lia; try apply app_cons_ne; auto.
652 left. split; [exact HA'|lia].
653 * destruct (F1 (PB 0) os u v rest (PB_touch0 0) (PB_touch1 0) HB) as (HB' & _ & _).
654 repeat split; try lia; try apply app_cons_ne; auto.
655 * destruct (F1 (PB 1) os u v rest (PB_touch0 1) (PB_touch1 1) HC) as (HC' & _ & _).
656 repeat split; try lia; try apply app_cons_ne; auto.
657 right. right. repeat split; auto; lia.
658Qed.
3983Lemma nonhalt: ~halts tm c0.662Lemma nonhalt: ~halts tm c0.
3984Proof.663Proof.
3985 eapply multistep_nonhalt.664 eapply multistep_nonhalt; [apply init|].
3986 1: apply init.
665 change (K [d1 1 2] 8 5) with (Kc ([d1 1 2], 8, 5)).
3987 eapply progress_nonhalt_cond with (P:=fun '(x,y,z) => LWF x y /\ 1<=z).
666 apply progress_nonhalt_cond with (P := INV).
3988 2:{
667 - exact step.
3989 split.
668 - unfold INV. cbn. repeat split; try lia; try discriminate.
3990 - apply LWF_S. 2,3: cbn; lia.
669 left. unfold PA, canon, Rd, ub, vof. cbn. repeat split; lia.
3991 apply LWF_S. 2,3: cbn; lia.
3992 apply LWF_O_1.
⋯ 12 template-only lines (template 3993–4004), not in ours
4005 Unshelve.
4006 apply aWF_intro; lia.
4007Qed.670Qed.
673(*
674```
6751RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---
677K(d_1 .. d_m; a, b) := 0^inf 10 01 d_1 .. d_m (10)^a 000 (10)^b B> 0^inf
678digit (u,0,v) := (10)^u 00 (01)^v, (u,1,v) := (10)^u (01)^v (d_m least significant)
679start: 0^inf A> 0^inf -->* K((1,1,2); 8, 5) (step 483)
681M (j* = last bit-0 digit):
682 K(.., (u,0,v), (u_j,1,v_j)_{j>j*}; a, b) -->+ K(.., (u+1,1,v-1), (u_j,0,v_j-1)_{j>j*}; a+1, b+2)
683 v = 1: (u+1,1,0) fuses into the next digit: (u',0,v'-1) becomes (u'+u+1,0,v'-1)
684O (all bits 1):
685 K((u_1,1,v_1) .. (u_m,1,v_m); a, b) -->+ K((0,0,u_1), (v_1-1,0,u_2), .., (v_m,1,a); b+3, 1)
687per digit, r = R of the digits above: R = 2r+1-bit, ubar = u + r + 1 - bit, vbar = v - R
688INV: m >= 1, a >= 1, b odd, a+R even, a+R+2 >= 2^(m+1), b+3+2R >= 2^(m+1), v_m >= R+1, and
689 A: every digit canonical, v >= R+1, ubar odd, ubar_1 = 1; a+R+1 >= 2^(m+1)
690 B: every digit canonical, v+bit odd, ubar_j >= 2^(j-1), d_1 = (0,0,1)
691 C: every digit canonical, v+bit odd, ubar_j >= 2^j; a+R+1 >= 2^(m+1), b+1+2R >= 2^(m+1)
692INV -> a macro step (M, M with a drop, or O) into INV (A->A, A->B, B->B, B->C, C->C, C->A)
693```
694*)
3Proof outlineCheck: the new items (green) carry the argument; the names read like the proof.md rules.

105 items in 1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---.v (694 lines): 75 Lemma, 23 Definition, 6 Fixpoint, 1 Inductive. Tags against the template: identical = same name and same text once each file's own TM string is <TM> (marked "except the TM string" when that is the only difference); adapted = same name, different text; new = no item of that name in the template part.

#kindnamestatement (no proof body)linevs template
1Definitiontm
Definition tm := Eval compute in (TM_from_str "1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---").
L18identicalexcept the TM string
2Lemmarot01
Lemma rot01 n (Y : side) : [0;1]^^n *> (0 >> Y) = 0 >> ([1;0]^^n *> Y).
L27new
3Lemmalshift
Lemma lshift (xs : list sym) n (l : side) : l <* xs <* xs^^n = l <* xs^^(S n).
L33new
4LemmaS1_1
Lemma S1_1 l r: l <* [] {{B}}> [0;1] *> r -->* l <* [0;1] <* [] {{B}}> r.
L39new
5LemmaS2_1
Lemma S2_1 l r: l <* [] {{C}}> [1;0] *> r -->* l <* [1;0] <* [] {{C}}> r.
L40new
6LemmaS3_1
Lemma S3_1 l r: l <* [1;0] <{{D}} [] *> r -->* l <{{D}} [] *> [1;0] *> r.
L41new
7LemmaS4_1
Lemma S4_1 l r: l <* [0;1] <{{E}} [] *> r -->* l <{{E}} [] *> [0;1] *> r.
L42new
8LemmaS6_1
Lemma S6_1 l r: l <* [0] {{B}}> [1;0] *> r -->* l <* [0;1] <* [0] {{B}}> r.
L43new
9LemmaS5_1
Lemma S5_1 l r: l {{C}}> [1;1] *> [0;1] *> r -->* l <* [0;1] {{C}}> [1;1] *> r.
L44new
10DefinitionS1
Definition S1 := shift_rule_R _ _ _ _ _ S1_1.
L46new
11DefinitionS2
Definition S2 := shift_rule_R _ _ _ _ _ S2_1.
L47new
12DefinitionS3
Definition S3 := shift_rule_L _ _ _ _ _ S3_1.
L48new
13DefinitionS4
Definition S4 := shift_rule_L _ _ _ _ _ S4_1.
L49new
14DefinitionS6
Definition S6 := shift_rule_R _ _ _ _ _ S6_1.
L50new
15LemmaS5
Lemma S5 n: forall l r, l {{C}}> [1;1] *> [0;1]^^n *> r -->* l <* [0;1]^^n {{C}}> [1;1] *> r.
L52new
16LemmaT1
Lemma T1 l: l {{B}}> 0inf -->* l <{{E}} [0;1] *> 0inf.
L60new
17LemmaT2
Lemma T2 l r: l <* [0;0;0] <{{E}} r -->* l <* [0;0;1] {{B}}> r.
L61new
18LemmaT3
Lemma T3 l r: l <* [0;0;1] <{{E}} r -->* l <{{E}} [0;1;1] *> r.
L62new
19LemmaT4
Lemma T4 l r: l <* [1;0] <{{E}} r -->* l <{{D}} [1;1] *> r.
L63new
20LemmaT5
Lemma T5 l r: l <* [0;1] <{{D}} r -->* l <{{E}} [0;1] *> r.
L64new
21LemmaT6
Lemma T6 l r: l <* [0;0] <{{D}} r -->* l <* [0;1] {{C}}> r.
L65new
22LemmaT7
Lemma T7 l r: l {{C}}> [1;1] *> r -->* l <* [0;0] {{C}}> r.
L66new
23LemmaT8
Lemma T8 l r: l {{C}}> [1;1;0;1;1] *> r -->* l <* [0;0;0;0;1] {{B}}> r.
L67new
24LemmaT9
Lemma T9 r: 0inf <* [1;0;0;1] <{{E}} r -->* 0inf <* [1;0;0;1] <* [0;0;0] {{B}}> r.
L68new
25LemmaT10
Lemma T10 l r: l {{B}}> [1;1] *> r -->* l <* [0;0] {{B}}> r.
L69new
26LemmaT11
Lemma T11 l r: l {{B}}> [0] *> r -->* l <* [1] {{C}}> r.
L70new
27LemmaT12
Lemma T12 l: l {{C}}> [1;1] *> 0inf -->* l <{{E}} [0;1;1;0;1] *> 0inf.
L71new
28LemmaT13
Lemma T13 l r: l <* [1;0;1] <{{E}} r -->* l <{{E}} [0;1;1] *> r.
L72new
29LemmaT14
Lemma T14 l r: l {{B}}> [1;1;0;1] *> r -->* l <* [0;1;0;0] {{B}}> r.
L73new
30Lemmap01
Lemma p01 n (Y : side) : [0;1]^^n *> 0 >> 1 >> Y = 0 >> 1 >> [0;1]^^n *> Y.
L76new
31Lemmap10
Lemma p10 n (Y : side) : [1;0]^^n *> 1 >> 0 >> Y = 1 >> 0 >> [1;0]^^n *> Y.
L78new
32Lemmarot10
Lemma rot10 n (Y : side) : [1;0]^^n *> (1 >> Y) = 1 >> ([0;1]^^n *> Y).
L81new
33LemmaLb
Lemma Lb u v l r:
l <* [0;1]^^(S u) <* [1;0]^^(S v) <{{E}} r -->*
l <{{E}} [0;1]^^(S u) *> [1;0]^^v *> [1;1] *> r.
L89new
34LemmaLf
Lemma Lf u v l r:
l <* [0;1]^^u <* [0;0] <* [1;0]^^(S v) <{{E}} r -->*
l <* [0;1]^^(S u) <* [1;0]^^v {{C}}> [1;1] *> r.
L96new
35LemmaRb
Lemma Rb u v l r:
l {{C}}> [1;1] *> [0;1]^^u *> [1;0]^^v *> [1;1] *> r -->*
l <* [0;1]^^u <* [0;0] <* [1;0]^^v {{C}}> [1;1] *> r.
L103new
36LemmaRo
Lemma Ro u v l r:
l <* [0;0;0] {{B}}> [0;1]^^(S u) *> [1;0]^^v *> [1;1] *> r -->*
l <* [0;0] <* [1;0]^^(S u) <* [0;1]^^v <* [0;0;0] {{B}}> r.
L110new
37LemmachunkA
Lemma chunkA a b l:
l <* [0;1]^^a <* [0;0;0] <* [0;1]^^b {{B}}> 0inf -->+
l <{{E}} [0;1]^^a *> [0;1;1] *> [0;1]^^(S (S b)) *> 0inf.
L121new
38LemmachunkC
Lemma chunkC a b l:
l {{C}}> [1;1] *> [0;1]^^a *> [0;1;1] *> [0;1]^^(S (S b)) *> 0inf -->*
l <* [0;1]^^(S a) <* [0;0;0] <* [0;1]^^(S (S b)) {{B}}> 0inf.
L127new
39LemmachunkO
Lemma chunkO a b l:
l <* [0;0;0] {{B}}> [0;1]^^(S a) *> [0;1;1] *> [0;1]^^(S (S b)) *> 0inf -->*
l <* [0;1] <* [1;0]^^(S a) <* [0;1]^^(S (S (S b))) <* [0;0;0] <* [0;1] {{B}}> 0inf.
L135new
40Inductivedg
Inductive dg := d0 (u v : nat) | d1 (u v : nat).
L146new
41Definitiondl
Definition dl (d : dg) (l : side) : side :=
match d with
| d0 u v => l <* [0;1]^^u <* [0;0] <* [1;0]^^v
| d1 u v => l <* [0;1]^^u <* [1;0]^^v
end.
L149new
42Fixpointapp_ds
Fixpoint app_ds (l : side) (ds : list dg) : side :=
match ds with
| [] => l
| d :: t => dl d (app_ds l t)
end.
L156new
43DefinitionL0
Definition L0 : side := 0inf <* [1;0;0;1].
L162new
44DefinitionK
Definition K (ds : list dg) (a b : nat) : Q * tape :=
app_ds L0 ds <* [0;1]^^a <* [0;0;0] <* [0;1]^^b {{B}}> 0inf.
L164new
45Definitionmap1
Definition map1 (os : list (nat*nat)) := map (fun '(u,v) => d1 (S u) (S v)) os.
L167new
46Definitionmap0
Definition map0 (os : list (nat*nat)) := map (fun '(u,v) => d0 (S u) v) os.
L168new
47Fixpointrw
Fixpoint rw (os : list (nat*nat)) (r : side) : side :=
match os with
| [] => r
| (u,v) :: t => rw t ([0;1]^^(S u) *> [1;0]^^v *> [1;1] *> r)
end.
L170new
48Lemmaapp_ds_app
Lemma app_ds_app l xs ys : app_ds l (xs ++ ys) = app_ds (app_ds l ys) xs.
L176new
49LemmaLbS
Lemma LbS os: forall l r, app_ds l (map1 os) <{{E}} r -->* l <{{E}} rw os r.
L179new
50LemmaRbS
Lemma RbS os: forall l r, l {{C}}> [1;1] *> rw os r -->* app_ds l (map0 os) {{C}}> [1;1] *> r.
L186new
51Fixpointro_out
Fixpoint ro_out (os : list (nat*nat)) (l : side) : side :=
match os with
| [] => l
| (u,v) :: t => ro_out t l <* [0;0] <* [1;0]^^(S u) <* [0;1]^^v
end.
L193new
52LemmaRoS
Lemma RoS os: forall l r, l <* [0;0;0] {{B}}> rw os r -->* ro_out os l <* [0;0;0] {{B}}> r.
L199new
53FixpointOz
Fixpoint Oz (t : list (nat*nat)) (u : nat) : list dg :=
match t with
| [] => [d0 0 u]
| (a, b) :: t' => d0 b u :: Oz t' (S a)
end.
L206new
54DefinitionOout
Definition Oout (os : list (nat*nat)) (A : nat) : list dg :=
match os with
| [] => []
| (u, v) :: t => d1 (S v) A :: Oz t (S u)
end.
L212new
55LemmaOzeq
Lemma Ozeq t: forall u l, ro_out t l <* [0;0] <* [1;0]^^u = app_ds l (Oz t u).
L218new
56LemmaM_spec
Lemma M_spec os u v rest a b:
K (map1 os ++ d0 u (S v) :: rest) a b -->+
K (map0 os ++ d1 (S u) v :: rest) (S a) (S (S b)).
L226new
57LemmaMdrop_spec
Lemma Mdrop_spec os u2 v2 u rest a b:
K (map1 (os ++ [(u2,v2)]) ++ d0 u 1 :: rest) a b -->+
K (map0 os ++ d0 (S u2 + S u) v2 :: rest) (S a) (S (S b)).
L240new
58LemmaO_spec
Lemma O_spec os a b: os <> [] ->
K (map1 os) (S a) b -->+ K (Oout os (S a)) (S (S (S b))) 1.
L254new
59Lemmainit
Lemma init: c0 -->* K [d1 1 2] 8 5.
L267adapted
60Definitionbof
Definition bof d := match d with d0 _ _ => 0 | d1 _ _ => 1 end.
L273new
61Definitionvof
Definition vof d := match d with d0 _ v => v | d1 _ v => v end.
L274new
62FixpointRof
Fixpoint Rof (ds : list dg) : nat :=
match ds with
| [] => 0
| d0 _ _ :: t => 2 * Rof t + 1
| d1 _ _ :: t => 2 * Rof t
end.
L277new
63DefinitionRd
Definition Rd d r := match d with d0 _ _ => 2*r+1 | d1 _ _ => 2*r end.
L285new
64Definitionub
Definition ub d r := match d with d0 u _ => u + r + 1 | d1 u _ => u + r end.
L286new
65FixpointAllD
Fixpoint AllD (P : dg -> nat -> nat -> Prop) (ds : list dg) : Prop :=
match ds with
| [] => True
| d :: t => AllD P t /\ P d (Rof t) (length t)
end.
L288new
66Definitioncanon
Definition canon d := match d with d0 _ v => v >= 1 | d1 u v => u >= 1 /\ v >= 1 end.
L294new
67DefinitionPA
Definition PA d r p :=
canon d /\ vof d >= Rd d r + 1 /\ ub d r mod 2 = 1 /\ (p = 0 -> ub d r = 1).
L296new
68DefinitionPB
Definition PB k d r p :=
canon d /\ (vof d + bof d) mod 2 = 1 /\ ub d r >= 2^(p+k) /\ (k = 0 -> p = 0 -> d = d0 0 1).
L298new
69DefinitionLSBok
Definition LSBok ds := match ds with [] => False | d :: _ => vof d >= Rof ds + 1 end.
L301new
70DefinitionINV
Definition INV (s : list dg * nat * nat) : Prop :=
let '(ds, a, b) := s in
ds <> [] /\ a >= 1 /\ b mod 2 = 1 /\ (a + Rof ds) mod 2 = 0 /\
a + Rof ds + 2 >= 2^(S (length ds)) /\ b + 3 + 2 * Rof ds >= 2^(S (length ds)) /\ LSBok ds /\
( (AllD PA ds /\ a + Rof ds + 1 >= 2^(S (length ds)))
\/ AllD (PB 0) ds
… +1 lines
L303new
71DefinitionKc
Definition Kc (s : list dg * nat * nat) : Q * tape := let '(ds, a, b) := s in K ds a b.
L311new
72Lemmapow2S
Lemma pow2S n : 2^(S n) = 2 * 2^n.
L314new
73Lemmapow2pos
Lemma pow2pos n : 2^n >= 1.
L316new
74LemmaRof_bound
Lemma Rof_bound ds : Rof ds + 1 <= 2^(length ds).
L319new
75LemmaRof_map1
Lemma Rof_map1 os X : Rof (map1 os ++ X) = 2^(length os) * Rof X.
L324new
76LemmaRof_map1'
Lemma Rof_map1' os : Rof (map1 os) = 0.
L331new
77Lemmalen_map1
Lemma len_map1 os : length (map1 os) = length os.
L334new
78Lemmalen_map0
Lemma len_map0 os : length (map0 os) = length os.
L336new
79LemmaAllD_app
Lemma AllD_app P xs ys : AllD P (xs ++ ys) -> AllD P ys.
L339new
80LemmaAllD_last
Lemma AllD_last P xs d : AllD P (xs ++ [d]) -> P d 0 0.
L342new
81LemmaAllD_canon
Lemma AllD_canon (P : dg -> nat -> nat -> Prop) ds :
(forall d r p, P d r p -> canon d) -> AllD P ds -> Forall canon ds.
L345new
82Lemmadecomp
Lemma decomp ds : Forall canon ds ->
(exists os, ds = map1 os) \/ (exists os u v rest, ds = map1 os ++ d0 u (S v) :: rest).
L351new
83LemmaF1
Lemma F1 (P : dg -> nat -> nat -> Prop) os u v rest:
(forall u v r p, P (d0 u (S (S v))) r p -> P (d1 (S u) (S v)) r p) ->
(forall u v r p, P (d1 (S u) (S v)) (S r) p -> P (d0 (S u) v) r p) ->
AllD P (map1 os ++ d0 u (S (S v)) :: rest) ->
AllD P (map0 os ++ d1 (S u) (S v) :: rest) /\
Rof (map1 os ++ d0 u (S (S v)) :: rest) = S (Rof (map0 os ++ d1 (S u) (S v) :: rest)) /\
… +1 lines
L365new
84LemmaPA_touch0
Lemma PA_touch0 u v r p : PA (d0 u (S (S v))) r p -> PA (d1 (S u) (S v)) r p.
L381new
85LemmaPA_touch1
Lemma PA_touch1 u v r p : PA (d1 (S u) (S v)) (S r) p -> PA (d0 (S u) v) r p.
L385new
86LemmaPB_touch0
Lemma PB_touch0 k u v r p : PB k (d0 u (S (S v))) r p -> PB k (d1 (S u) (S v)) r p.
L389new
87LemmaPB_touch1
Lemma PB_touch1 k u v r p : PB k (d1 (S u) (S v)) (S r) p -> PB k (d0 (S u) v) r p.
L393new
88DefinitionRel
Definition Rel r ro rn := rn + 1 <= ro /\ ro <= 2 * (rn + 1) /\ (r = 0 -> ro = rn + 1).
L398new
89LemmaPB_chain
Lemma PB_chain k k' r u v ro rn p :
(k' = k \/ (k = 0 /\ k' = 1 /\ r = 0)) -> Rel r ro rn -> p >= 1 ->
PB k (d1 (S u) (S v)) ro (S p) -> PB k' (d0 (S u) v) rn p.
L400new
90LemmaPB_abs
Lemma PB_abs k k' r p u2 v2 u :
((k' = k /\ (k = 0 -> p >= 1)) \/ (k = 0 /\ k' = 1 /\ p = 0 /\ r = 0)) ->
PB k (d0 u 1) r p -> PB k (d1 (S u2) (S v2)) (2*r+1) (S p) -> PB k' (d0 (S u2 + S u) v2) r p.
L412new
91LemmaF2chain
Lemma F2chain k k' r os X X' :
(k' = k \/ (k = 0 /\ k' = 1 /\ r = 0)) -> X' <> [] ->
AllD (PB k) (map1 os ++ X) -> AllD (PB k') X' -> Rel r (Rof X) (Rof X') -> length X = S (length X') ->
AllD (PB k') (map0 os ++ X') /\ Rel r (Rof (map1 os ++ X)) (Rof (map0 os ++ X')) /\
length (map1 os ++ X) = S (length (map0 os ++ X')).
L422new
92LemmaF2
Lemma F2 k k' os u2 v2 u rest:
((k' = k /\ (k = 0 -> rest <> [])) \/ (k = 0 /\ k' = 1 /\ rest = [])) ->
AllD (PB k) (map1 (os ++ [(u2,v2)]) ++ d0 u 1 :: rest) ->
AllD (PB k') (map0 os ++ d0 (S u2 + S u) v2 :: rest) /\
Rel (Rof rest) (Rof (map1 (os ++ [(u2,v2)]) ++ d0 u 1 :: rest))
    (Rof (map0 os ++ d0 (S u2 + S u) v2 :: rest)) /\
… +1 lines
L442new
93LemmaOz_len
Lemma Oz_len t u : length (Oz t u) = S (length t).
L471new
94LemmaOz_R
Lemma Oz_R t u : Rof (Oz t u) + 1 = 2^(S (length t)).
L474new
95LemmaOz_AB
Lemma Oz_AB t : forall u, AllD PA (map1 t) -> u mod 2 = 1 -> (t = [] -> u = 1) -> AllD (PB 0) (Oz t u).
L481new
96LemmaOz_CA
Lemma Oz_CA t : forall u, AllD (PB 1) (map1 t) -> u >= 2^(S (length t)) -> AllD PA (Oz t u).
L495new
97LemmaRof_M
Lemma Rof_M os u v rest :
Rof (map1 os ++ d0 u (S v) :: rest) = S (Rof (map0 os ++ d1 (S u) v :: rest)).
L510new
98Lemmalen_M
Lemma len_M os u v w x rest :
length (map0 os ++ d1 w x :: rest) = length (map1 os ++ d0 u v :: rest).
L516new
99LemmaLSB_M
Lemma LSB_M os u v rest :
LSBok (map1 os ++ d0 u (S (S v)) :: rest) -> LSBok (map0 os ++ d1 (S u) (S v) :: rest).
L520new
100LemmaRof_head1
Lemma Rof_head1 os X : os <> [] -> Rof (map1 os ++ X) mod 2 = 0.
L527new
101LemmaRof_head0
Lemma Rof_head0 os x y rest : Rof (map0 os ++ d0 x y :: rest) mod 2 = 1.
L532new
102LemmaLSB_drop
Lemma LSB_drop os u2 v2 u rest r :
LSBok (map1 (os ++ [(u2,v2)]) ++ d0 u 1 :: rest) ->
Rel r (Rof (map1 (os ++ [(u2,v2)]) ++ d0 u 1 :: rest)) (Rof (map0 os ++ d0 (S u2 + S u) v2 :: rest)) ->
LSBok (map0 os ++ d0 (S u2 + S u) v2 :: rest).
L535new
103Lemmaapp_cons_ne
Lemma app_cons_ne {A} (xs : list A) y ys : xs ++ y :: ys <> [].
L544new
104Lemmastep
Lemma step s : INV s -> exists s', Kc s -->+ Kc s' /\ INV s'.
L550new
105Lemmanonhalt
Lemma nonhalt: ~halts tm c0.
L662adapted
4What a maintainer readsCheck: the rule table below is what the .v proves, and proof.md / README read cleanly for a maintainer.
submission/proof.md line 137: 2. Rules

Transition table

     0    1
A   1RB  0LE
B   1RC  0RC
C   1LD  0RB
D   1LA  0LE
E   1LD  1LF
F   1LD  ---        halting transition: F reads 1

The macro rules M and O

In busycoq comment-block style:

1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---

start from K((1,1,2); 8, 5)                                   (step 483, §4)

M  (carry; some bit is 0; j* = index of the LAST bit-0 digit, k = m - j*):
   K(.., (u,0,v), (u_j,1,v_j)_{j*<j<=m}; a, b)
     --> K(.., (u+1,1,v-1), (u_j,0,v_j-1)_{j*<j<=m}; a+1, b+2)
   steps 32 + 8a + 8b + 4v + sum_{j>j*} (8 u_j + 4 v_j)
   needs v >= 1 (u >= 0), u_j >= 1 and v_j >= 1 for j > j*, a >= 0, b >= 0
   if v = 1, the digit (u+1,1,0) drops (re-reading, §1)
O  (overflow; all bits 1):
   K((u_1,1,v_1) .. (u_m,1,v_m); a, b)
     --> K((0,0,u_1), (v_1-1,0,u_2), .., (v_{m-1}-1,0,u_m), (v_m,1,a); b+3, 1)
   steps 89 - 4m + 8a + 20b + 4 sum u_j + 8 sum v_j
   needs m >= 1, all u_j, v_j >= 1, a >= 1, b >= 0

On the tape, O's right side is

0^inf 10 01 00 (01)^u_1 [(10)^(v_i-1) 00 (01)^u_(i+1)]_{i<m} (10)^v_m (01)^a (10)^(b+3) 0^3 10 B> 0^inf

M and O are derived from the 20 window lemmas of §2.1, as chains of intermediate configurations (§2.2, §2.3). Each step count above is the sum along the chain.

M needs only a ≥ 0; Common has a ≥ 1 anyway.

The .v proves the chains as -->+ statements (M_spec, Mdrop_spec, O_spec), so the step counts are not part of the formal statement.

2.1 Building blocks

Notation. X> means the head is in state X on the next cell, and <X means it is in state X on the previous cell (busycoq's {{X}}> and <{{X}}).

A window lemma w → w' means: started on the cells of w, the machine runs the stated number of steps without reading a cell outside w (the last step may move the head onto a neighbouring cell), and leaves w'. Such a lemma holds in every tape context.

How the lemmas are proved:

  • T1–T14 are exact finite runs (in the .v, each is one es).
  • S1–S6 are proved for one block by a finite run, and induction on n gives every n (in the .v, shift_rule_R/shift_rule_L, and plain induction for S5).

For example:

C> 11 (01)^(n+1) = C> 11 01 (01)^n → 10 C> 11 (01)^n → 10 (10)^n C> 11

Shift lemmas

lemma steps one block transitions
S1 B> (01)^n → (10)^n B> 2n B>01 → 10B> B0 C1
S2 C> (10)^n → (01)^n C> 2n C>10 → 01C> C1 B0
S3 (01)^n <D → <D (10)^n 2n 01<D → <D10 D1 E0
S4 (10)^n <E → <E (01)^n 2n 10<E → <E01 E0 D1
S5 C> 11 (01)^n → (10)^n C> 11 6n C>1101 → 10C>11 C1 B1 C0 D0 A0 B1
S6 0 B> (10)^n → (10)^n 0 B> 6n 0B>10 → 100B> B1 C0 D0 A0 B1 C1

S5 and S6 are the 2-cell back-bounces: on each block the head steps two cells right, two left and two right again.

Finite lemmas

lemma steps transitions where
T1 B> 00 → <E 01 3 B0 C0 D1 right-edge turn (on 0^inf)
T2 000 <E → 100 B> 5 E0 D0 A0 B1 C1 turn inside a 0^3 gap
T3 100 <E → <E 011 3 E0 D0 A1
T4 01 <E → <D 11 2 E1 F0 start of a digit's (01)^v
T5 10 <D → <E 01 2 D0 A1 end of a bit-1 digit's (01)^v
T6 00 <D → 10 C> 3 D0 A0 B1 flips the 00 of a bit-0 digit
T7 C> 11 → 00 C> 2 C1 B1
T8 C> 11011 → 10000 B> 9 C1 B1 C0 D0 A0 B1 C1 B1 C1
T9 0^inf 1001 <E → 0^inf 1001000 B> 13 E1 F0 D0 A1 E0 D0 A0 B1 C1 B0 C1 B1 C1 far-left turn (window 0001001)
T10 B> 11 → 00 B> 2 B1 C1
T11 B> 0 → 1 C> 1 B0
T12 C> 11 0^inf → <E 01101 0^inf 13 C1 B1 C0 D0 A0 B1 C1 B0 C0 D1 E0 D0 A1 right-edge turn in O (window 11000)
T13 101 <E → <E 011 3 E1 F0 D1
T14 B> 1101 → 0010 B> 4 B1 C1 B0 C1

Digit lemmas

These are compositions; u, v are those of one digit.

lemma steps made of needs
Lb (10)^u (01)^v <E → <E (01)^u (10)^(v−1) 11 2u+2v T4, S3(v−1), T5, S4(u−1) u, v ≥ 1
Lf (10)^u 00 (01)^v <E → (10)^(u+1) (01)^(v−1) C> 11 4v+1 T4, S3(v−1), T6, S2(v−1) v ≥ 1
Rb C> 11 (01)^u (10)^(v−1) 11 → (10)^u 00 (01)^(v−1) C> 11 6u+2v S5(u), T7, S2(v−1) v ≥ 1
Ro B> (01)^u (10)^(v−1) 11 → (10)^(u−1) 1 (10)^(v−1) 000 B> 2u+6v−4 S1(u), S6(v−1), T10 u, v ≥ 1

In Ro, S6 starts on the last 0 of (10)^u = (10)^(u−1) 1 0.

What each digit lemma does:

  • Lb sweeps a bit-1 digit leftward.
  • Lf flips the bit-0 digit.
  • Rb restores a swept digit as bit 0 on the way back in M.
  • Ro does the same in O.

2.2 Derivation of M

Write:

  • X for everything left of d_{j*} (it is never read);
  • (u*, v*) for d_{j*} = (u*,0,v*);
  • Y for the trailing bit-1 digits, with i = 1 being j*+1:
Y = Π_{i=1..k} (10)^u_i (01)^v_i

The chain

                                                                                        steps
    X (10)^u* 00 (01)^v* Y (10)^a 000 (10)^b B> 0^inf
 Phase 1: right-edge preamble with a dip into the 0^3 gap                               4b+10
T1  .. Y (10)^a 000 (10)^b <E 01                                                        3
S4  .. Y (10)^a 000 <E (01)^(b+1)                                                       2b
T2  .. Y (10)^a 100 B> (01)^(b+1)                                                       5
S1  .. Y (10)^(a+1) 0 (10)^(b+1) B> 0^inf                                               2b+2
 Phase 2: one long left sweep, down to the 00 of d_{j*}                                 2a+2b+9+4v*+Σ(2u_i+2v_i)
T1  .. Y (10)^(a+1) 0 (10)^(b+1) <E 01                                                  3
S4  .. Y (10)^(a+1) 0 <E (01)^(b+2)                                                     2b+2
T3  .. Y (10)^a <E 011 (01)^(b+2)                                                       3
S4  X (10)^u* 00 (01)^v* Y <E (01)^a 011 (01)^(b+2)                                     2a
Lb  X (10)^u* 00 (01)^v* <E Y' (01)^a 011 (01)^(b+2)       (i = k down to 1)            Σ(2u_i+2v_i)
                         Y' = Π_i (01)^u_i (10)^(v_i−1) 11
Lf  X (10)^(u*+1) (01)^(v*−1) C> 11 Y' (01)^a 011 (01)^(b+2)                            4v*+1
 Phase 3: rightward pass with 2-cell back-bounces, then a plain run to the edge         6a+2b+13+Σ(6u_i+2v_i)
Rb  X (10)^(u*+1) (01)^(v*−1) Y'' C> 11 (01)^a 011 (01)^(b+2)   (i = 1 up to k)         Σ(6u_i+2v_i)
                         Y'' = Π_i (10)^u_i 00 (01)^(v_i−1)
S5  .. Y'' (10)^a C> 11 011 (01)^(b+2)                                                  6a
T8  .. Y'' (10)^a 10000 B> (01)^(b+2)                                                   9
S1  X (10)^(u*+1) (01)^(v*−1) Y'' (10)^(a+1) 000 (10)^(b+2) B> 0^inf                    2b+4

The last line is

K(.., (u*+1,1,v*−1), (u_i,0,v_i−1)_i; a+1, b+2)

The sum is

(4b+10) + (2a+2b+9+4v*) + (6a+2b+13) + Σ(8u_i+4v_i) = 32 + 8a + 8b + 4v* + Σ(8u_i+4v_i)

Head path

Phase 1 runs left only to the 0^3 gap, turns (T2) and returns to the edge.

Phase 2 is the only long leftward leg. Its leftmost read is the first 0 of d_{j*}'s 00 (T6 reads both cells, then moves right). So M is a side rule: the tape X left of that 00 is never read.

Phase 3 moves right. It steps back two cells once per 01 block (S5, on the (01)^u_i blocks and on (01)^a), and it crosses the (10)^(v−1) blocks and the final (01)^(b+2) with plain sweeps (S2, S1).

When v* = 1, the flipped digit (u*+1,1,0) drops (§1). When some v_i = 1, the result has (u_i,0,0). That can happen only outside INV (§3.3).

2.3 Derivation of O

Let all digits be bit 1, and let

Y = Π_{i=1..m} (10)^u_i (01)^v_i

The chain

                                                                                        steps
    0^inf 10 01 Y (10)^a 000 (10)^b B> 0^inf
 Phases 1–2 as in M, with Lb on all m digits and no Lf                                  (4b+10)+(2a+2b+8)+Σ(2u_i+2v_i)
    0^inf 10 01 <E Y' (01)^a 011 (01)^(b+2)                Y' = Π_i (01)^u_i (10)^(v_i−1) 11
 Phase 3: turn at the far left
T9  0^inf 10 01 000 B> Y' (01)^a 011 (01)^(b+2)                                         13
 Phase 4: rightward pass
Ro  0^inf 10 01 000 Y''' B> (01)^a 011 (01)^(b+2)          (i = 1 up to m)              Σ(2u_i+6v_i−4)
                         Y''' = Π_i (10)^(u_i−1) 1 (10)^(v_i−1) 000
 Phase 5: right end                                                                     2a+8b+30
S1  .. Y''' (10)^a B> 011 (01)^(b+2)                                                    2a
T11 .. Y''' (10)^a 1 C> 11 (01)^(b+2)                                                   1
S5  .. Y''' (10)^a 1 (10)^(b+2) C> 11 0^inf                                             6b+12
T12 .. Y''' (10)^a 1 (10)^(b+2) <E 01101 0^inf                                          13
S4  .. Y''' (10)^a 1 <E (01)^(b+2) 01101                                                2b+4
 Phase 6: short left sweep over the a block, back to the 000 that Ro left after d_m    2a+1
T13 .. Y''' (10)^(a−1) <E 011 (01)^(b+2) 01101                                          3
S4  .. (10)^(v_m−1) 000 <E (01)^a 1 (01)^(b+2) 01101                                    2a−2
 Phase 7: turn in that 000, final run to the edge                                       2a+6b+27
T2  .. (10)^(v_m−1) 100 B> (01)^a (10)^(b+3) 1101          (1 (01)^(b+2) 0 = (10)^(b+3))  5
S1  .. (10)^(v_m−1) 100 (10)^a B> (10)^(b+3) 1101                                       2a
S6  .. (10)^(v_m−1) 100 (10)^(a−1) 1 (10)^(b+3) 0 B> 1101                               6b+18
T14 .. (10)^(v_m−1) 100 (10)^(a−1) 1 (10)^(b+3) 000 10 B> 0^inf                         4

Reading the result

Re-read the final tape with

0 (10)^(n−1) 1   = (01)^n
(10)^(v_m−1) 10  = (10)^v_m

This gives:

0^inf 10 01 000 Π_{i<m}[(10)^(u_i−1) 1 (10)^(v_i−1) 000] (10)^(u_m−1) 1 (10)^(v_m−1) 100 (10)^(a−1) 1 (10)^(b+3) 000 10 B>
  = 0^inf 10 01 00 (01)^u_1 [(10)^(v_i−1) 00 (01)^u_(i+1)]_{i<m} (10)^v_m (01)^a (10)^(b+3) 000 10 B> 0^inf
  = K((0,0,u_1), (v_1−1,0,u_2), .., (v_{m−1}−1,0,u_m), (v_m,1,a); b+3, 1)

The sum is

(4b+10) + (2a+2b+8) + 13 + (2a+8b+30) + (2a+1) + (2a+6b+27) + Σ(4u_i+8v_i−4) = 89 − 4m + 8a + 20b + 4Σu_i + 8Σv_i

Domain

  • Lb and Ro need u_i, v_i ≥ 1.
  • T13 and the S6 of phase 7 use the last 10 of (10)^a, so a ≥ 1.
  • T9 needs 0^inf on the left.

Head path

O has two leftward legs:

  • the long phase 2, which T9 ends 3 cells left of the leading 10 01 (so the leftmost cell visited moves 3 cells per overflow);
  • the short phase 6.

2.4 What the rules do, in words

The digits form a binary counter. Each M is one increment. It flips the trailing 1s to 0 and the last 0 to 1, and every digit it touches pays one 01 from its v. A digit flipping 0→1 also gains a 10.

When all bits are 1, O swaps the two halves of every digit:

  • each (10)^u becomes the (01)^u fuel of a new bit-0 digit;
  • each (01)^v becomes the next digit's (10)^(v-1).

The counter restarts at value 1 with one more digit.

When a digit flipping 0→1 has spent its last 01 (v = 1), it drops: its 10s merge into the next digit, and the counter loses that digit.

The only way the rules can fail is the failure mode: a carry arriving at a bit-0 digit with v = 0, where Lf's first lemma T4 has no 01 to read. That happens if a carry flips a bit-1 digit with v = 1 to 0.

Every macro step is an exact run of at least 32 steps, so every macro step makes progress.

5FamilyCheck: related machines are killed together or have a reason to be left open.

6 machines, 4 killed, 2 not. Family links: status.json parent, same transition table with another start (tools/dashboard.py), targeting.md follow-on rows, ledger "= twin" notes. A machine string named in a .v header / proof.md / notes.md is listed but does not make a family.

whomachinestatusrelation to this kill
#11 kill 31RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---✓Killed: never haltsthis kill
#33 kill 91RB0RE_1LC0RE_1LD0LD_1RA0LC_1RA1RF_1RA---✓Killed: never halts= #11's table mirrored, run from state D; named in #33's .v header; named in #33's proof.md; named in #33's notes.md · review · mechanism
#33b kill 101RB0LD_1RC0RE_1LD0RE_1LA0LA_1RB1RF_1RB---✓Killed: never halts= #11's table mirrored, run from state C; named in #11's proof.md; named in #11's notes.md; named in #33b's .v header · review · mechanism
#11b kill 141RB0RB_1LC0RA_1LE0LD_1LC1LF_1RA0LD_1LC---✓Killed: never haltsparent link; = #11's table, run from state B; named in #11b's .v header; named in #11b's proof.md; named in #11b's notes.md; named in #11's proof.md; named in #11's notes.md · review · same machine as this kill? (same table, started in #11's B; trajectory twin; tables, pictures and numbers side by side)
#321RB0LC_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---⚠Cryptid candidateparent link; targeting: follow-on to #11; ledger: #32 = twin of #11; named in #32's proof.md; named in #32's notes.md · page
R41RB0RE_1LC0RD_1LD0LD_1RA0LC_1RA1RF_1RA---⚠Cryptid candidatenamed in R4's notes.md · mechanism
Named in a file but not linked (not counted as family)
#11RB0LC_1LA0RE_0RD1LF_1LC1LB_0LD0RB_0LA---⚠Cryptid candidatenamed in #1's proof.md · mechanism
W4-41RB0RA_1LC0RE_0LD0LB_1LA1LF_1RA0LF_1LC---▲Stucknamed in W4-4's notes.md · mechanism
W4-3 kill 201RB0RF_1RC0RB_1LD0RA_1LE0LD_1RB0LC_1LA---✓Killed: never haltsnamed in W4-3's proof.md; named in W4-3's notes.md · review · mechanism
6ChecklistCheck: every ✓ is computed; the two ○ are yours to decide; an amber ! is an optional check that did not finish.
  • ✓
    Machine string exact
    the .v literal == holdout list line 467 byte for byte
  • ✓
    Statement is ~halts tm c0
    parsed from the .v and confirmed by check_kill (theorem_text, theorem_rocq)
  • ✓
    No axioms beyond baseline
    0 assumption(s); tools/assumptions_baseline.txt allows only functional_extensionality_dep
  • ✓
    coqchk finished (optional)
    coqchk pass in 1.74 s
  • ✓
    .v hash matches the checked hash
    .v = checked sha256 d177c06de5df…; submission/ copy = checked sha256 d177c06de5df…
  • ✓
    No repo-local paths in the .v
    comments name no path of ours (vendor/, machines/, tools/, rocq/, scripts/, reports/, atlas/, data/, journal/, /home/); busycoq's own verify/X.v is fine: none in the .v or the submission/ copy
  • ✓
    Public write-up is clean
    tools/writeup_lint.py on submission/proof.md: 0 error(s)
  • ○
    proof.md reviewed by Dennis (Checkpoint B)
    no Checkpoint B note from Dennis found
    • notes.md L101: - No Checkpoint B notes from Dennis were on file when this was packaged. If he adds any, fold them into proof.md and the submission copy first.
    • proof.md L6: - Status: informal proof, revised after the skeptic review (Review log at the end). Checkpoint B pending, non-blocking. Evidence: `check_proof.py` (§7).
  • ○
    Family posted together?
    3 other kill(s) in the family: #33, #33b, #11b; the Discord draft names 2 of them; 2 member(s) not killed: #32, R4

Generated by tools/killreview.py at 2026-10-16 13:29 PDT in 0.1 s from the files linked above; nothing in this review is hand-written except the box “How we proved it never halts” (above), which quotes how_proved.md. Re-run: python3 -B tools/killreview.py 1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---

Files

machines/<tm>/: 14 entries · raw notes, status, scripts, images

namesizechanged
notes.md ↓11 KB2026-10-10 05:25
proof.md ↓32 KB2026-10-10 04:38
how_proved.md ↓1.5 KB2026-10-14 10:51
status.json ↓353 B2026-10-13 06:44
observe.json ↓15 KB2026-10-10 04:41
1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---.v ↓29 KB2026-10-12 18:15
img/8 items2026-10-10 01:54
rocq/5 items2026-10-10 05:18
scripts/17 items2026-10-10 00:38
submission/6 items2026-10-12 17:41
work/2 items2026-10-12 17:33
check_proof.py ↓31 KB2026-10-10 04:38
qsim.jsonl ↓7.0 KB2026-10-10 00:09
sim_records_1e9.jsonl ↓7.4 MB2026-10-10 00:07
status.json in full
{
 "tm": "1RB0LE_1RC0RC_1LD0RB_1LA0LE_1LD1LF_1LD---",
 "status": "KILLED_NONHALT",
 "stage": "done",
 "updated": "2026-10-10",
 "reason": "check_kill PASS, independently re-verified",
 "pr": "https://github.com/ccz181078/busycoq/pull/16",
 "pr_state": "merged",
 "pr_comments": 0,
 "pr_merged_at": "2026-10-13T12:26:07Z",
 "pr_merged_by": "ccz181078"
}