// ver656.mjs -- independent check of the objects two lanes meet on. // // 1. rebuild T_5..T_23 by iterated fold (own implementation, from the definitions in // research/attack-foldL-03-transport.js foldTile/qualifies and U-FRAME 11); // 2. for each consecutive fold (x, q): the loose certificate (interior "all qualify", // what the served tctRHS computes) and the legal-walk certificate (what U-FRAME 11 // states as PROVEN and return #159 implements in C), plus the largest L that // contributes and the L values contributing at the certificate itself; // 3. the longest killed run trueL in the actual fold -- the object return #161 // measures as L(T_x, p); // 4. report max contributing L beside trueL: that juxtaposition is the claim. // // stdout is figures only, so it reproduces byte for byte. No clock, no RNG, no paths. const PRIMES = [2, 3, 5, 7, 11, 13, 17, 19, 23]; function baseTile() { return { slots: Float64Array.from([5]), W: 6, x: 3 }; } // fold T_x by q: lay q copies at offsets kW, delete a slot iff its value is // congruent to 0 or -2 mod q (U-FRAME 5a step 1; exactly foldTile in the served script). function foldTile(tile, q) { const { slots, W } = tile, D = slots.length; const out = new Float64Array(D * (q - 2)); let n = 0; for (let k = 0; k < q; k++) { const off = k * W; for (let i = 0; i < D; i++) { const v = slots[i] + off; const r = v % q; if (r !== 0 && r !== q - 2) out[n++] = v; } } if (n !== out.length) throw new Error('kill count wrong at q=' + q); return { slots: out, W: W * q, x: q }; } function gapWord(tile) { const { slots, W } = tile, D = slots.length; const g = new Float64Array(D); for (let i = 0; i < D - 1; i++) g[i] = slots[i + 1] - slots[i]; g[D - 1] = slots[0] + W - slots[D - 1]; return g; } // longest run of consecutive deleted slots in the ACTUAL fold, walking the q copies in // order with the per-copy translate (gcd(W,q)=1, so the residue pattern is not periodic). function trueL(tile, q) { const { slots, W } = tile, D = slots.length; const rs = new Int32Array(D); for (let i = 0; i < D; i++) rs[i] = slots[i] % q; const wq = W % q; let run = 0, best = 0; for (let pass = 0; pass < 2; pass++) { for (let k = 0; k < q; k++) { const kw = (k * wq) % q; const d0 = (q - kw) % q, d2 = (2 * q - 2 - kw) % q; for (let i = 0; i < D; i++) { if (rs[i] === d0 || rs[i] === d2) { run++; if (run > best) best = run; } else run = 0; } } if (pass === 0) run = 0; } return best; } const NB = 4096; // theta bins, units of 6 (as in #159's C) const LMAX = 24; // as in #159's C (MAXRUN) // class of a gap mod q: 0, +1 (=+2), -1 (=-2), or null when the gap does not qualify. function qclass(g, q) { const r = g % q; return r === 0 ? 0 : (r === 2 ? 1 : (r === q - 2 ? -1 : null)); } // The legal-walk reachability of return #159's C (histQa): a bitmask over the classes a // killed slot may have. mi=0 stays, mi=+2 enters 0 only from class (q-2), mi=-2 enters // (q-2) only from class 0. Anchored at the start of the interior (reach = 3), as in #159. function profiles(g, q) { const D = g.length, NONQ = 100; const cls = new Int8Array(D); for (let i = 0; i < D; i++) { const c = qclass(g[i], q); cls[i] = (c === null) ? NONQ : c; } const loose = new Float64Array(NB), alt = new Float64Array(NB); const byLoose = [], byAlt = []; for (let L = 0; L <= LMAX; L++) { byLoose.push(new Float64Array(NB)); byAlt.push(new Float64Array(NB)); } let totL = 0, totA = 0; for (let i = 0; i < D; i++) { const b0 = g[i] / 6; if (b0 < NB) { loose[b0] += (q - 2); alt[b0] += (q - 2); byLoose[0][b0] += (q - 2); byAlt[0][b0] += (q - 2); } let s = g[i], okLoose = true, reach = 3; for (let L = 1; L <= LMAX; L++) { if (L >= 2) { const c = cls[(i + L - 1) % D]; // reachability of the interior class word, exactly #159's nr recurrence if (c === NONQ) { okLoose = false; reach = 0; } else reach = (c === 0) ? reach : (c === 1) ? ((reach & 2) ? 1 : 0) : ((reach & 1) ? 2 : 0); } s += g[(i + L) % D]; if (!okLoose && reach === 0) break; const b = s / 6; if (b < NB) { if (okLoose) { loose[b] += 2; byLoose[L][b] += 2; totL++; } if (reach !== 0) { alt[b] += 2; byAlt[L][b] += 2; totA++; } } } } for (let b = NB - 2; b >= 0; b--) { loose[b] += loose[b + 1]; alt[b] += alt[b + 1]; for (let L = 0; L <= LMAX; L++) { byLoose[L][b] += byLoose[L][b + 1]; byAlt[L][b] += byAlt[L][b + 1]; } } function cert(prof) { for (let b = NB - 1; b >= 1; b--) if (prof[b] >= 1) return b * 6; return 0; } function dec(byL, cv) { const b = cv / 6, out = []; for (let l = 0; l <= LMAX; l++) if (byL[l][b] > 0) out.push(l); return out.join(','); } function top(byL) { let t = 0; for (let l = 1; l <= LMAX; l++) if (byL[l][0] > 0) t = l; return t; } const cvL = cert(loose), cvA = cert(alt); return { cvL, cvA, decLoose: dec(byLoose, cvL), decAlt: dec(byAlt, cvA), topLoose: top(byLoose), topAlt: top(byAlt), totL, totA }; } const tiles = { 3: baseTile() }; for (let i = 2; i < PRIMES.length; i++) tiles[PRIMES[i]] = foldTile(tiles[PRIMES[i - 1]], PRIMES[i]); console.log('== ladder (custody) =='); console.log(' x D(x) expected G2(x) verdict'); const EXPECT_D = { 5: 3, 7: 15, 11: 135, 13: 1485, 17: 22275, 19: 378675, 23: 7952175 }; function g2of(t) { let m = 0; for (const v of gapWord(t)) if (v > m) m = v; return m; } for (const q of [5, 7, 11, 13, 17, 19, 23]) { const D = tiles[q].slots.length, exp = EXPECT_D[q]; console.log(' ' + String(q).padStart(2) + String(D).padStart(12) + String(exp).padStart(13) + String(g2of(tiles[q])).padStart(7) + ' ' + (D === exp ? 'MATCH' : 'MISMATCH')); } // runFor, verbatim in effect from the served research/Lgrowth.js (corrected 2026-08-16), // which return #161 ports: a maximal run of consecutive slots whose residues mod p all // lie in one 2-set {a, a+2}, the set anchored at the run's first pair. A linear scan of // one copy, not cyclic -- the convention difference from trueL recorded in the report. function runFor(S, p) { const okPair = (a, b) => { if (a === b) return true; const d = Math.abs(a - b); return d === 2 || d === p - 2; }; let best = 0, cur = 0, s1 = -1, s2 = -1, last = -1; for (let i = 0; i < S.length; i++) { const r = S[i] % p; let ext = false; if (cur > 0) { if (r === s1 || r === s2) ext = true; else if (s2 === -1 && okPair(s1, r)) { s2 = r; ext = true; } } if (ext) cur++; else { cur = (last >= 0 && okPair(last, r)) ? 2 : 1; if (cur === 2) { s1 = last; s2 = r; } else { s1 = r; s2 = -1; } } last = r; if (cur > best) best = cur; } return best; } console.log(''); console.log('== folds: certificates, contributing L, and the killed-run index =='); console.log(' x q trueL M_loose M_alt L at M_loose maxL loose maxL alt sumL windows(loose/alt)'); const REC_CERT = { '7>11': [42, 42], '11>13': [66, 66], '13>17': [108, 108], '17>19': [150, 150], '19>23': [204, 204], '23>29': [270, 258], '23>31': [270, 258], '23>37': [240, 240] }; const g23 = gapWord(tiles[23]); for (const [x, q] of [[7, 11], [11, 13], [13, 17], [17, 19], [19, 23], [23, 29], [23, 31], [23, 37]]) { const g = (x === 23) ? g23 : gapWord(tiles[x]); const p = profiles(g, q); const L = trueL(tiles[x], q); const rec = REC_CERT[x + '>' + q] || []; console.log(' ' + String(x).padStart(2) + String(q).padStart(5) + String(L).padStart(7) + String(p.cvL).padStart(9) + String(p.cvA).padStart(7) + String(p.decLoose).padStart(14) + String(p.topLoose).padStart(12) + String(p.topAlt).padStart(10) + (' ' + p.totL + '/' + p.totA).padStart(26) + (rec.length ? ' recorded M=' + rec[0] + '/' + rec[1] : '')); } console.log(''); console.log('== identity: runFor (served Lgrowth.js, return #161) vs trueL (transport) =='); console.log(' tile primes swept entries disagreements'); function sweep(tileQ, primes) { let n = 0, bad = 0, list = []; for (const p of primes) { if (p <= tileQ) continue; const a = runFor(tiles[tileQ].slots, p), b = trueL(tiles[tileQ], p); n++; if (a !== b) { bad++; if (list.length < 6) list.push('p=' + p + ' runFor=' + a + ' trueL=' + b); } } return { n, bad, list }; } const PRIMES_SMALL = []; for (let n = 2; n <= 1009; n++) { let pr = true; for (let d = 2; d * d <= n; d++) if (n % d === 0) { pr = false; break; } if (pr) PRIMES_SMALL.push(n); } for (const [tileQ, lo, hi] of [[13, 17, 1009], [17, 19, 211], [19, 23, 97], [23, 29, 37]]) { const primes = PRIMES_SMALL.filter(p => p >= lo && p <= hi); const s = sweep(tileQ, primes); console.log(' T_' + String(tileQ).padEnd(4) + (lo + '..' + hi).padEnd(24) + String(s.n).padStart(6) + String(s.bad).padStart(14) + (s.list.length ? ' ' + s.list.join(' ') : '')); } console.log(' diagonal (tile T_{q-}, folded by the next prime q):'); console.log(' q runFor trueL agreement'); let dd = 0, dn = 0; for (const [tileQ, q] of [[5, 7], [7, 11], [11, 13], [13, 17], [17, 19], [19, 23], [23, 29]]) { const a = runFor(tiles[tileQ].slots, q), b = trueL(tiles[tileQ], q); dn++; if (a !== b) dd++; console.log(' ' + String(q).padStart(5) + String(a).padStart(9) + String(b).padStart(7) + ' ' + (a === b ? 'same' : 'DIFFER')); } console.log(' diagonal entries ' + dn + ' disagreements ' + dd); console.log(' return #161 records this diagonal as 2, 1, 2, 2, 2, 3, 2, 4 at folds 7..31.');