#!/usr/bin/env python3 """Generate job #1507's checks.json and research.json from the files on disk. Hashes are computed from disk, never typed. The quoted MR record is read out of the raw reply the channel probe saved, so no source text is retyped here. """ import hashlib import html import json import os import re HERE = os.path.dirname(os.path.abspath(__file__)) RUN = os.path.abspath(os.path.join(HERE, '..', '..')) S = os.path.join(RUN, 'work', 'job1507-searches') def sha(p): with open(p, 'rb') as f: return hashlib.sha256(f.read()).hexdigest() def strip(p): t = open(p, encoding='utf-8', errors='replace').read() return re.sub(r'\s+', ' ', html.unescape(re.sub(r'<[^>]+>', ' ', t))) # ---------------------------------------------------------------- raw record mr = strip(os.path.join(S, 'mrlookup-02.txt')) i = mr.find('@incollection') mr_bibtex = mr[i:mr.find('}', mr.find('Scourfield')) + 2] if i >= 0 else '' cal = strip(os.path.join(S, 'mrlookup-01.txt')) cal_line = cal[cal.find('Retrieved'):cal.find('Retrieved') + 60] ctrl = strip(os.path.join(S, 'mrlookup-03.txt')) ctrl_line = ctrl[ctrl.find('View clipboard'):ctrl.find('View clipboard') + 120] channels = [ {'channel': 'mathscinet-mrlookup', 'query': 'au=Motohashi year=1976 format=bibtex', 'status': 200, 'result': cal_line.strip(), 'reading': 'calibration: channel live, 7 hits'}, {'channel': 'mathscinet-mrlookup', 'query': 'au=Levin ti=distribution year=1984 format=bibtex', 'status': 200, 'result': 'Retrieved all documents: MR781173 (+ MR770907)', 'reading': 'the unfilled channel: positive, single document'}, {'channel': 'mathscinet-mrlookup', 'query': 'au=Levin ti=Bombieri year=1980 format=bibtex', 'status': 200, 'result': ctrl_line.strip(), 'reading': 'control: empty result, no Retrieved line'}, {'channel': 'mathscinet-mrlookup', 'query': 'ti=average distribution year=1984 format=bibtex', 'status': 200, 'result': 'first 3 documents out of 4, none of them Levin', 'reading': 'title-only is a worse probe than author+title'}, {'channel': 'zbmath', 'query': 'Jacobsthal function', 'status': 200, 'result': '20 records', 'reading': 'calibration: live'}, {'channel': 'zbmath', 'query': 'Levin average distribution arithmetic progressions', 'status': 200, 'result': '2 records, first = id 0547.10037', 'reading': 're-reaches the record return #705 read'}, {'channel': 'arxiv', 'query': 'ti:"Jacobsthal function"', 'status': 200, 'result': '8 entries', 'reading': 'calibration: live'}, {'channel': 'arxiv', 'query': 'all:"Levin" AND all:"Bombieri-Vinogradov"', 'status': 200, 'result': '0 entries', 'reading': 'weak metadata-only negative (conjunctive)'}, {'channel': 'archive.org', 'query': 'title:(Elementary and analytic theory of numbers)', 'status': 200, 'result': '0 relevant of 6', 'reading': 'no scan of the volume'}, {'channel': 'archive.org', 'query': 'isbn:(0444865098) OR title:("Topics in classical number theory")', 'status': 200, 'result': '0 hits', 'reading': 'no scan under the ISBN either'}, {'channel': 'openlibrary', 'query': 'isbn/0444865098.json', 'status': 200, 'result': 'catalogued; MARC source records from Harvard, Columbia, Oregon Summit', 'reading': 'held in research libraries; not online as text'}, ] artifacts = [] for name in ('report.md', 'job1507-served-doc-revision.md'): p = os.path.join(HERE, name) artifacts.append({'file': 'work/job1507/' + name, 'bytes': os.path.getsize(p), 'sha256': sha(p)}) for name in ('job1507-search.py',): p = os.path.join(RUN, 'work', name) artifacts.append({'file': 'work/' + name, 'bytes': os.path.getsize(p), 'sha256': sha(p)}) for name in ('job1507-searches/summary.json', 'job1507-searches/summary2.json', 'job1507-searches/mrlookup-02.txt'): p = os.path.join(RUN, 'work', name) artifacts.append({'file': 'work/' + name, 'bytes': os.path.getsize(p), 'sha256': sha(p)}) checks = { 'job_id': '1507', 'run': 'run_20260916_170915_0taWUg', 'observed_utc': None, 'mr_record_MR781173': mr_bibtex, 'identifier_agreement': { 'zbMATH': 'Zbl 0547.10037 (read by return #705: Colloq. Math. Soc. Janos Bolyai 34, 995-1022, 1984)', 'MathSciNet': 'MR781173 (read here: Topics in classical number theory (Budapest 1981), Colloq. Math. Soc. Janos Bolyai 34, 995-1022, North-Holland 1984, ISBN 0-444-86509-8)', 'agree_on': ['author', 'title', 'venue series', 'volume 34', 'pages 995-1022', 'year 1984'], }, 'channels': channels, 'artifacts': artifacts, 'rungs': [ {'claim': 'MR781173 is the same paper as Zbl 0547.10037', 'rung': 'measured'}, {'claim': 'mrlookup is live and distinguishes hit from miss', 'rung': 'measured'}, {'claim': 'the volume is not online; it is a library read', 'rung': 'measured'}, {'claim': 'the consumer level is Q = T^1/10, so the owed read decides Q >= x^1/10', 'rung': 'heuristic (inference from the consumer document, not from a page)'}, {'claim': "Levin 1984's printed Q(x), C, R(z)", 'rung': 'not read - still owed'}, ], 'not_done': [ 'page read of Levin 1984 (not online: archive.org 0 by title and by ISBN)', 'MR review text (subscription; mrlookup is bibliographic only)', 'no re-derivation; no twin-prime claim; no novelty claim for return #4', ], 'cpu_hours': 0, } with open(os.path.join(HERE, 'job1507-checks.json'), 'w') as f: json.dump(checks, f, indent=1) evidence = ( "Job #1500 / return #705 identified Levin 1984 (Colloq. Math. Soc. Janos Bolyai 34, 995-1022; " "Zbl 0547.10037) Theorem 1 as the published carrier of the corpus's (M), read through the zbMATH " "review, and recorded two unfilled obligations: MathSciNet had not been queried, and the paper's " "explicit Q(x), C were unread. This return fills the first. POST https://mathscinet.ams.org/" "mrlookup (the free recipe of research/SEARCH-CONVENTIONS.md section 5; bibliographic only) with " "au=Levin, ti=distribution, year=1984, format=bibtex answers 200 and returns the record MR781173 " "- Levin, B. V., 'The average distribution of mu(n) and Lambda_f(n) in progressions', in Topics in " "classical number theory (Budapest, 1981), Colloq. Math. Soc. Janos Bolyai 34, North-Holland " "Amsterdam 1984, pp. 995-1022, ISBN 0-444-86509-8, MRCLASS 11N64 (11N35), MR reviewer E. J. " "Scourfield - an independent bibliographic confirmation (different database, different reviewer) " "of the paper #705 found, agreeing on author, title, series, volume, pages and year, and adding " "the volume title, its ISBN and the reviewer's name. Calibration in the same process: " "au=Motohashi year=1976 returns 'Retrieved first 3 documents out of 7' (channel live), a " "non-matching control (au=Levin ti=Bombieri year=1980) returns an empty result, the zbMATH control " "'Jacobsthal function' returns 20 records, and arXiv ti:\"Jacobsthal function\" returns 8 entries; " "against those, arXiv all:\"Levin\" AND all:\"Bombieri-Vinogradov\" is 0 (a weak metadata-only " "negative), archive.org returns 0 hits for the volume by title and 0 by ISBN 0444865098, and " "OpenLibrary catalogues the volume (Elsevier Science Publishing, hardcover, MARC records from " "Harvard, Columbia and Oregon Summit) without a text. So the remaining obligation is a LIBRARY " "page read. New narrowing: the corpus consumes Q = T^1/10 (TWIN-REDUCTION.md; return #4 section 4's " "mesh reaches 'T^1/10, any fixed exponent below 1/2', and its reviewer job #55 corrected only the " "summary sentence), while (M) is stated at Q <= T^1/2 (log T)^-B, so the owed page read decides a " "much weaker inequality - whether the printed Q is any fixed positive power of x at or above " "1/10 - not the level 1/2. That narrowing is heuristic (an inference from the consumer's own " "document, not a page read) and is labelled as such. All raw replies are saved under " "work/job1507-searches/ with sha256 in job1507-checks.json. cpu_hours: 0; nothing re-derived; no " "twin-prime claim; no novelty claim for return #4 (a provenance repair: (M) now has two " "independent bibliographic channels behind it, and a machine-applicable served-document revision " "is delivered as a file)." ) prior_art = ( "Channels actually run this turn, with the calibrations that make a zero readable (raw replies " "hashed in work/job1507-checks.json): MathSciNet mrlookup (free, POST https://mathscinet.ams.org/" "mrlookup, fields au/ti/jrnl/year/format=bibtex) - calibration au=Motohashi year=1976: 200, " "'Retrieved first 3 documents out of 7'; target au=Levin ti=distribution year=1984: 200, " "'Retrieved all documents', MR781173 = Zbl 0547.10037 (plus the companion MR770907, Levin and " "Timofeev, Mat. Sb. (N.S.) 125(167) 4, 558-572, 1984, reviewer H.-E. Richert); control au=Levin " "ti=Bombieri year=1980: 200, empty. zbMATH API - calibration 'Jacobsthal function': 20 records; " "'Levin average distribution arithmetic progressions': 2 records, first id 0547.10037. arXiv API " "- calibration ti:\"Jacobsthal function\": 8 entries; all:\"Levin\" AND all:\"Bombieri-Vinogradov\": " "0 (weak metadata-only negative, not absence). archive.org - title:(Elementary and analytic theory " "of numbers): 0 relevant; isbn:(0444865098) OR title:(\"Topics in classical number theory\"): 0. " "OpenLibrary isbn/0444865098.json: catalogued (Elsevier Science Publishing; MARC source records " "from Harvard, Columbia, Oregon Summit) - no text. NOT QUERIED / NOT READ and therefore not " "evidence of absence: the paper itself (a library read now, the volume being unonline); the " "MathSciNet review text (subscription; mrlookup is bibliographic only); the cited neighbours at " "statement level (Elliott II-V, Fouvry-Tenenbaum 2022, Granville-Shao) which return #705 already " "compared; hosted web_search, not used for any claim here. The nearest prior work remains Levin " "1984 Theorem 1 (a match, in the owning convention of SEARCH-CONVENTIONS.md section 1), with " "Motohashi 1976 (Zbl 0355.10035; read in full by return #709) as the mechanism and " "Levin-Timofeev 1984/1986 as the generalised neighbours." ) next_step = { 'question': ("Does the printed Theorem 1 of Levin 1984 (MR781173, Zbl 0547.10037) carry an " "explicit Q(x) at least a fixed positive power of x at or above 1/10 (equivalently, " "Q >= T^{1/10} for the corpus's consumer), which would make (M) at the consumer's " "level owned by a printed theorem?"), 'method': ("One page read at a library copy of Topics in classical number theory (Budapest 1981), " "Colloq. Math. Soc. Janos Bolyai 34, pp. 995-1022, Theorem 1 and its mu corollary: " "transcribe Q(x), C and the definition of R(z) verbatim, then evaluate the single " "inequality Q(T) >= T^{1/10}. Cheaper first probe if any subscription path is open: the " "review MR781173 (reviewer E. J. Scourfield), which may restate the explicit Q. Both " "routes are read-only; no computation is needed."), 'success': ("The printed Q is a fixed power of x at or above 1/10 (or x^{1/2}(log x)^{-C}): (M) at " "the consumer's level is owned by Levin 1984 Theorem 1, and the revision text in " "work/job1507/job1507-served-doc-revision.md can be applied as an audit return."), 'failure': ("The printed Q is below x^{1/10} (or Q is not a level statement in x at all): (M) at " "T^{1/10} is not covered, the corpus's own derivation from Opera de Cribro Theorem " "9.17 plus Vaughan plus Corollary 13.4 plus the mesh argument remains the only " "provenance, and the served note's five-channel negative must be replaced by that " "statement rather than by the Levin row."), 'budget_hours': 0.5, 'compute': {'cpu_hours': 0, 'ram_gb': 0.5, 'disk_gb': 0.1}, 'required_tools': ['python3', 'pdftotext', 'library-access', 'text-diff'], 'required_sources': ['levin-1984-colloq-bolyai-34', 'mr781173', 'zbmath-0547-10037', 'mobius-bv-derivation-md', 'twin-reduction-md', 'return-705'], } research = {'route_id': None, 'outcome': 'progress', 'depends_on': [4, 705], 'evidence_md': evidence, 'prior_art_md': prior_art, 'next_step': next_step} with open(os.path.join(HERE, 'job1507-research.json'), 'w') as f: json.dump(research, f, indent=1) print('checks.json', len(json.dumps(checks))) print('evidence_md chars', len(evidence), 'prior_art_md chars', len(prior_art)) print('mr record:', mr_bibtex[:200]) for a in artifacts: print(' ', a['file'], a['sha256'][:12], a['bytes'])