/* * verify-section61.mjs — checks the citation claims of job #598 against the PDF of record. * * Input: holt-pdf.txt, produced by * curl -sSL -A 'Mozilla/5.0' https://arxiv.org/pdf/1408.6002v1 -o holt-1408.6002v1.pdf * pdftotext -layout holt-1408.6002v1.pdf holt-pdf.txt * * stdout is the artifact; it is deterministic (no timing, no randomness, no paths printed). * Exit code 0 iff every check passes. */ import fs from 'node:fs'; const FILE = 'holt-pdf.txt'; if (!fs.existsSync(FILE)) { console.error(`missing ${FILE}: run pdftotext -layout first`); process.exit(2); } // Page text, whitespace-normalised so a phrase that wraps a line still matches. const pages = fs.readFileSync(FILE, 'utf8').split('\f').map((p) => p.replace(/\s+/g, ' ').trim()); if (pages.length && pages[pages.length - 1] === '') pages.pop(); // the last form feed leaves an empty tail const on = (n) => pages[n - 1] ?? ''; const pg = (re) => { for (let i = 0; i < pages.length; i++) if (re.test(pages[i])) return i + 1; return 0; }; const checks = [ ['pages=34', `the PDF has 34 pages (got ${pages.length})`, pages.length === 34], // §3 Corollary 3.2, the span-restricted form. ['sec3.page=12', `Corollary 3.2 is on page 12 (found on ${pg(/Corollary 3\.2\./)}), not Lemma 3.1`, pg(/Corollary 3\.2\./) === 12], ['sec3.statement', 'the Corollary 3.2 statement is present with its span hypothesis', /Corollary 3\.2\. If s is any constellation in G\(pk#\) of length j and sum g < 2pk\+1/.test(on(12))], ['sec3.coefficient', 'the recursion carries the coefficient (pk+1 - j - 1) and the driving-term term', /Ns\(pk\+1#\) = \(pk\+1 - j - 1\)/.test(on(12)) && /ns,j\+1\(pk#\)/.test(on(12))], // §6.1 Corollary 6.3, the form with no span hypothesis. ['sec6.heading=22', `section 6 heading is on page 22 (found on ${pg(/6\. Polignac.s conjecture and Hardy & Littlewood.s Conjecture B/)})`, pg(/6\. Polignac.s conjecture and Hardy & Littlewood.s Conjecture B/) === 22], ['sec6.subdivided', 'section 6 has subsections 6.1, 6.2 and 6.3 (it is not an undivided section)', pg(/6\.1\. General recursion on cycles of gaps/) > 0 && pg(/6\.2\. Polignac.s conjecture for Eratosthenes sieve/) > 0 && pg(/6\.3\. Examples from/) > 0], ['sec61.heading=23', `the 6.1 heading "General recursion on cycles of gaps" is on page 23 (found on ${pg(/6\.1\. General recursion on cycles of gaps/)})`, pg(/6\.1\. General recursion on cycles of gaps/) === 23], ['sec61.cor63=25', `Corollary 6.3 is on page 25 (found on ${pg(/Corollary 6\.3\./)})`, pg(/Corollary 6\.3\./) === 25], ['sec61.figure4=25', `Figure 4 is on page 25 (found on ${pg(/Figure 4\./)})`, pg(/Figure 4\./) === 25], ['sec61.figure4caption', 'the Figure 4 caption states the no-span case: g < 2pk+1 may not be satisfied, two exterior closures still remove two copies', /when the con-? dition g < 2pk\+1 may not be satisfied/.test(on(25)) && /two exterior closures still remove two copies/.test(on(25))], ['sec61.proof=26', 'the proof of Corollary 6.3 concludes on page 26', /Corollary 6\.3|two are eliminated as driving terms/.test(on(26))], ['sec61.sentence', 'the sentence SEARCH-CONVENTIONS.md quotes is verbatim on page 26', /of the q copies of s, two are eliminated as driving terms and q - 2 remain as driving terms of various lengths/.test(on(26))], ['sec61.equation', 'the aggregated transport sum_{j} ng,j(qN) = (q - 2) sum_{j} ng,j(N) is on page 26', /ng,j\(qN \) = \(q - 2\)/.test(on(26)) && /j j/.test(on(26))], ['sec61.ratios', 'the preserved-ratio consequence is on page 26', /wg,j\(qN \) = wg,j \(N \)/.test(on(26)) || /wg,j\(qN \) = wg,j \(N\)/.test(on(26))], ['sec61.nospan', 'the no-span reasoning is stated in the proof', /For the current result we do not know that the closures necessarily occur in distinct copies of s/.test(on(26))], ['sec61.cor64=26', 'Corollary 6.4 (the combination with Lemma 5.1) follows on page 26', /Corollary 6\.4\./.test(on(26))], ['sec61.twin.census', 'the twin-generator census N2(p#) is in the same instrument (§4)', pg(/Twin Generators/) > 0 || pg(/N2\(pk#\)/) > 0], ]; let failed = 0; for (const [id, why, ok] of checks) { if (!ok) failed++; console.log(`${ok ? 'PASS' : 'FAIL'} ${id.padEnd(22)} ${why}`); } console.log(`\nchecks ${checks.length}, failed ${failed}`); process.exit(failed ? 1 : 0);