/machines/1RB0RD_1LC0RA_---1RD_1RA1LE_1RC0LF_1LE0LB/rocq/log.md · raw

C2-552 Rocq log

Compile helper: rocq/cc.sh <file.v> [no|yes] (temp dir, bb6 flags, ulimit -s unlimited; ulimit -v 8000000, refuses when MemAvailable < 10 GB or more than one other coqc runs). Capture tool for words in the mirror convention: rocq/tools/mcap.py "<tm tokens>" L R (prints IN/OUT/BACK/RET crossings of tm cells L and R with the near-first words that segRR/segLL/segRL expect).

Round 1 (2026-10-12)

Design decision: hybrid engine instead of hand-written structural rules (changes plan section 4)

Measured on the real run (scratchpad scripts, numbers reproducible from work/fast.py): - 53,973 structural increments; 53,805 batches. - Carry paths of the structural increments contain 88.1M wall/gap tokens in total (max config 2,990 tokens). - Event unit: U0 in 25,150 increments, U1 in 26,179, others ~5k; the event unit's marker count summed over all structural increments is 19.9M (max k = 1,342).

So: - The plan's call1 needs ~15 structural lemma families (glue, unglue g=1/g>=2, absorb, edge1, U0-1111, U0-stop, resets, glue-after-unglue) plus canon re-cut lemmas. That was the plan's risk #1 and #2. - A purely generic run-length simulator (busycoq Sk1Tape.Runs + RunMachine.raw + Sk1 scans) needs no structural lemmas but would take ~1e9 macro steps (88M tokens x ~10 steps): too slow. - Chosen (B'): generic engine on RunMachine.config for tmf (Sk1Tape/Sk1Check machinery: raw steps, scans with context), plus verified macro rules that skip a whole standard unit (unit segRR/segLL/segRL) or a whole passive block (block segRR/segLL), plus auto_bulk at the root (the batch). Structural events then need no lemma at all: the event unit is simulated by raw steps + scans + block macros (cost ~ sum of k of event units ~ 20M macro steps, plus ~25 unit macros per structural increment). Opening (342 steps) and the halt itself are also done by the engine (RM.raw returns None = halted). - Untrusted proposals (parse of the Runs into unit records, batch size d) need no proofs; every use is checked by Runs.remove-style word removal (Sk1Check.remove_cells pattern) whose spec is generic.

Call protocol, block level (found with mcap.py, confirmed by solve_seg)

Mirror machine tmf, words near-first. A unit (root-first) = prefix ++ lead ++ x-gap ++ boundary, where prefix = Y block (y gap + last passive) followed by the chain of passive blocks (gap + stack), all of shape blk m j = [0] ++ [1;0]^^m ++ [1] ++ [1;1;1]^^j; k=1 digits have an empty prefix. - Y block: out B->F, back D->D. Chain blocks: out F->F, back D->D (LL cuts are shifted 2 cells root-ward; this is what lbw m j = [0;1;1]^^j ++ [0;1]^^(S m) encodes, and cmid_shift re-associates). - Lead 1111 (= blk a 1): out F->F (or B->F for k=1); back A->D. Lead 00 stop: F->D (B->D for k=1). - x gap + boundary 11 after a 1111 lead: out F->B, back D->A, word unchanged. - U0 far region (x gap + edge 1^(3f)), e = 0 mod 3: side F->D, edge f -> f+1. - Unit level: in B, out B, back D, return D (hB/hD, h = [(hB,hD)]), as in the plan.

Proved (rocq/dev/core.v, compiles in 2.5 s, -native-compiler no, all by solve_seg/es + list algebra)

Next (round 2), in order

  1. N-level closed form for iter (digits: from bit 0, n = 2q + r: c -= n, a += q (k>=2) or a -= q + r (k=1), x += q - r, bit = r, forwarded q; from bit 1 do one pass first; guards as in rocq-plan) with closedN_spec : closedN n d = Some (d',p) -> iter (N.to_nat n) (toNat d) = Some (toNat d', N.to_nat p), proved by induction on q (pairs lemma) + case split. Same for u0iter (trivial closed form).
  2. Pieces representation: a unit word as a list of (word, N) pieces; generic remove/push with spec (copy Sk1Check.remove_cells/push_cells); dword (toNat d) = pieces_word (dpieces d).
  3. Engine: advance = (at root: proposal d -> batch) | unit/block macros | scans | RM.raw. Sk1Machines.vo does not exist in vendor/ (and vendor/ is read-only), so check_kill would reject Require Sk1Machines: copy Sk1Tape.Runs, RunMachine (raw/raw_spec), Sk1Check (orient, scan_stacks, use_scan, remove_cells/push_cells) into the kill file ("adapted from verify/Sk1Machines.v"). Eqb.vo, LongitudinalHalt.vo, Flip.vo exist (N_iter_until_spec, sideRLs_halt, flip_halts_iff). Scans needed (brute force, scratchpad tmf.py): A/L, B/L, D/L over [0;1]/[1;0]; E/R, F/R over [1;0]/[0;1]; 1-walls: E/R and F/R over [1;1;1], B/R over [1;1;1] with context, D/L over [0;1;1], A/L over [1;1;0] (verify each by shift_rule + es).
  4. Untrusted parse (Runs -> unit records) and batch-size proposal (fast.py event_touch/first_inc).
  5. Test on prefixes with vm_compute/native (the checker itself is the mirror), then the full run.

Open questions

Round 2 (2026-10-12)

Design change back to structured records (supersedes round 1's hybrid engine)