/* * analyze-fold41.mjs — read parfold.mjs's stdout and state what it certifies. * * Input: parfold-big.out (mode big, the fold 23 -> 29 -> 31 -> 37 with certification at 41; the old * word is T_37, 217,929,355,875 gaps) and, optionally, parfold-validate.out for the small gates. * Output: a fixed-table summary on stdout, deterministic, no timing. * * The checks it makes are the ones the record already carries, so a reviewer can see at a glance * whether the run is a reproduction or a surprise: D(T_37) = 217,929,355,875 (= A059861, the * record's own slot count), max gap 528 (= the twelfth term of the G2 ladder in * research/oeis-G2-submission.md line 46), and the certificate at the fold 37 -> 41 against * G2(41#) = 546 (QUESTIONS.md row Q-block-combined-L). */ import fs from 'node:fs'; const BIG = process.argv[2] ?? 'parfold-big.out'; const VAL = process.argv[3] ?? 'parfold-validate.out'; const text = fs.readFileSync(BIG, 'utf8'); const grab = (re) => { const m = text.match(re); return m ? m[1] : null; }; const D = grab(/old word: D = (\d+)/); const xem = grab(/x emitted = (\d+)/); const maxg = grab(/max gap = (\d+)/); const lcap = grab(/longest L reaching CAP: (\d+)/); const M = grab(/certificate M = (\d+);/); const hits = grab(/argmax windows (\d+) \(/); const local = grab(/LOCAL TEST: (\d+\/\d+ argmax windows realizable[^\n]*)/); const gate = grab(/(GATE T_37: [^\n]*)/); const cross = grab(/(cross-check: [^\n]*)/); const ok = (v, want) => (v === want ? 'PASS' : 'FAIL'); const argLines = text.split('\n').filter((l) => l.trim().startsWith('i =')); console.log('# analyze-fold41.mjs — the parallel fold, read back'); console.log(''); console.log(`input ${BIG}`); console.log(''); console.log('| quantity | measured | the record says | verdict |'); console.log('|---|---|---|---|'); console.log(`| D(T_37) | ${D} | 217929355875 (A059861, oeis-G2-submission.md line 174) | ${ok(D, '217929355875')} |`); console.log(`| x emitted | ${xem} | = D up to the wrap | ${ok(xem, D)} |`); console.log(`| max gap of T_37 | ${maxg} | 528 (the G2 ladder's twelfth term, oeis-G2-submission.md line 46) | ${ok(maxg, '528')} |`); console.log(`| certificate at fold 37 -> 41 | ${M} | 546 (= G2(41#), QUESTIONS.md Q-block-combined-L) | ${ok(M, '546')} |`); console.log(''); console.log(`longest L reaching CAP (128): ${lcap}`); console.log(`argmax windows: ${hits}`); for (const l of argLines) console.log(` ${l.trim()}`); console.log(`LOCAL TEST: ${local}`); console.log(''); console.log(gate ?? '(no GATE line)'); console.log(cross ?? '(no cross-check line)'); console.log(''); try { const v = fs.readFileSync(VAL, 'utf8'); console.log(`validate run (${VAL}):`); for (const l of v.split('\n').filter((l) => l.startsWith('GATE') || l.startsWith('LOCAL TEST'))) console.log(` ${l.trim()}`); } catch { console.log(`(no ${VAL}; the small gates are in parfold.mjs mode=validate)`); } console.log(''); console.log('# verdict: ' + (ok(D, '217929355875') === 'PASS' && ok(maxg, '528') === 'PASS' ? 'the run reproduces the record on both gates' : 'a gate failed — read the failures above'));