#!/usr/bin/env python3 """job #1674 exact ledger. Verifies, offline and deterministically, every *printed* fact asserted by job1674-report.md and job1674-research.json. Reads only files already on disk: this turn's served copies (work/src, work/replies) and the department's own local clean text of arXiv:2604.25177v2 kept by job #1661. Run: python3 job1674-checks.py Writes job1674-checks.log and job1674-checks.json next to itself. Exit 0 iff every check passes. No network, no wall-clock in the output. """ import json import os import re import sys HERE = os.path.dirname(os.path.abspath(__file__)) WORK = os.path.dirname(HERE) OTHER = os.path.join(HERE, "..", "..", "..", "run_20260917_143353_HyUaMQ", "work", "src") RESULTS = [] def norm(text): return re.sub(r"\s+", " ", text.replace("\u2212", "-")) def check(name, ok, detail=""): RESULTS.append({"check": name, "ok": bool(ok), "detail": detail}) print(("PASS " if ok else "FAIL ") + name + ("" if not detail else " :: " + detail)) def read(path): with open(path, encoding="utf-8") as fh: return fh.read() def main(): # --- files ----------------------------------------------------------------- paths = { "outcomes": os.path.join(HERE, "OUTCOMES.md"), "sde": os.path.join(HERE, "sde.md"), "fed": os.path.join(HERE, "fed.md"), "questions": os.path.join(HERE, "questions.json"), "paper": os.path.join(OTHER, "arxiv-2604.25177.clean.txt"), "priorart": os.path.join(WORK, "job1674-priorart.json"), "research": os.path.join(WORK, "job1674-research.json"), "report": os.path.join(WORK, "job1674-report.md"), } missing = [k for k, v in paths.items() if not os.path.exists(v)] check("A0 all input files present", not missing, "missing=" + repr(missing)) if missing: return finish() outcomes = norm(read(paths["outcomes"])) sde = norm(read(paths["sde"])) fed = norm(read(paths["fed"])) paper = norm(read(paths["paper"])) questions = json.loads(read(paths["questions"])) priorart = json.loads(read(paths["priorart"])) research = json.loads(read(paths["research"])) report = read(paths["report"]) # --- A: the register that was read first ------------------------------------ check("A1 closed-routes register has a 'Closed routes' section", "## Closed routes" in outcomes) closed = outcomes[outcomes.index("## Closed routes"):] rows = [l for l in closed.split("|") if False] # placeholder, rows counted below raw_closed = read(paths["outcomes"]) raw_closed = raw_closed[raw_closed.index("## Closed routes"):] rows = [l for l in raw_closed.split("\n") if l.startswith("| ") and not l.startswith("|---")] check("A2 closed-routes table has 95 data rows (95 routes read)", len(rows) - 1 == 95, "rows_including_header=%d" % len(rows)) # --- B: the served owning note's reopening condition, verbatim --------------- cond = ("an estimate for the coprime e-pair class inside a common prime power q, " "with j_e<=x^(7/300+epsilon), saving more than x^(7/200) over the majorant " "Q^(3/2)E^3 of (9) in the moment sum_q Lambda(q)M_q") check("B1 sde section 8 prints the reopening condition verbatim", cond in sde) check("B2 the sign inputs are named unexploited", "are still used only through absolute values here; any of them is an unexploited input." in sde) check("B3 the 139/100 target and the 7/200 / 7/400 deficits are printed", "sum_q Lambda(q) M_q^x <= x^(139/100-2eta)" in sde and "a deficit of 7/200 in that moment's exponent, 7/400 in the block" in sde) check("B4 the worst sector is 407/400 at (rho,sigma)=(6/25,1/20)", "407/400" in sde and "(rho,sigma)=(6/25,1/20)" in sde) # --- C: the exponents the route's (R) depends on ----------------------------- q_exp = 1.0 / 20.0 e_exp = 0.5 - 1.0 / 20.0 majorant = 3 * q_exp / 2 + 3 * e_exp check("C1 majorant exponent closes: 3*(1/20)/2 + 3*(1/2-1/20) = 57/40", abs(majorant - 57.0 / 40.0) < 1e-12, "computed=%.12f expected=%.12f" % (majorant, 57.0 / 40.0)) check("C2 the note's own text confirms the 57/40 arithmetic", "Q^(3/2)E^3 has exponent 3(1/20)/2+3(1/2-1/20)=57/40" in sde) # --- D: the neighbouring lane's import and its printed range ---------------- paper_bytes = os.path.getsize(paths["paper"]) check("D1 arXiv:2604.25177v2 clean text present locally (job #1661 evidence store)", paper_bytes > 30000, "bytes=%d" % paper_bytes) check("D2 Corollary 1.1 hypotheses: tau_k-bounded alpha,beta + Siegel-Walfisz beta", "|αm | ≤ τk (m) and |βn | ≤ τk (n)" in paper and "Definition 1" in paper and "Siegel-Walfisz" in paper) check("D3 the estimate is a dyadic modulus average", "Q≤q≤2Q" in paper) check("D4 the proof of part (i) requires Q >= sqrt(X)", "as long as Q ≥ X." in paper or "as long as Q ≥ X." in paper.replace("≥ X.", "≥ X.")) check("D5 printed modulus caps: 53/105 (ii) and 45/89 (iii)", "53/105-ε" in paper and "45/89-ε" in paper) # --- E: the refutation of that import on range ------------------------------- gap = 53.0 / 105.0 - q_exp check("E1 mismatch is 53/105 - 1/20 = 191/420 > 0 (class below the floor)", abs(gap - 191.0 / 420.0) < 1e-12 and gap > 0, "gap=%.12f" % gap) check("E2 1/20 is strictly below both printed caps", q_exp < 53.0 / 105.0 and q_exp < 45.0 / 89.0) # --- F: the served question register ----------------------------------------- qs = questions["questions"] if isinstance(questions, dict) else questions from collections import Counter counts = Counter(q.get("status") for q in qs) check("F1 question register has 54 rows", len(qs) == 54, "n=%d" % len(qs)) check("F2 open/partial counts are 5/49", counts.get("OPEN") == 5 and counts.get("PARTIAL") == 49, str(dict(counts))) opens = sorted(q["id"] for q in qs if q.get("status") == "OPEN") check("F3 the open set is the expected five ids", opens == ["Q-hsubpow-K-0829n", "Q-kstar-prereg", "Q-shadow-prereg", "Q-var41", "Q-xchan-at29-prereg"], repr(opens)) # --- G: the prior-art / channel record --------------------------------------- ch = priorart.get("channels", {}) check("G1 web_search failed for the topical query AND its control", ch.get("web_search", {}).get("topical") == "no results" and ch.get("web_search", {}).get("control") == "no results") check("G2 arXiv API answered 200 through the reader; control totalResults 252", ch.get("arxiv_api_reader", {}).get("control_total_results") == 252) check("G3 the topical arXiv query returned 0 entries (no match, not absence)", ch.get("arxiv_api_reader", {}).get("topical_total_results") == 0) # --- H: the returned object's own shape rules --------------------------------- title = research["proposal"]["title"] check("H1 proposal.title is <= 160 chars", len(title) <= 160, "len=%d" % len(title)) check("H2 evidence_md <= 4000 chars", len(research["evidence_md"]) <= 4000, "len=%d" % len(research["evidence_md"])) for key in ("contribution_md", "prior_art_md", "uncertainty_md"): check("H3 proposal.%s <= 4000 chars" % key, len(research["proposal"][key]) <= 4000, "len=%d" % len(research["proposal"][key])) check("H4 routeless proposal carries no top-level route_id and no top-level prior_art_md", "route_id" not in research and "prior_art_md" not in research) check("H5 next_step is at the top level with the required fields", all(k in research["next_step"] for k in ("question", "method", "success", "failure", "budget_hours", "compute", "required_tools", "required_sources"))) ids_ok = all(re.fullmatch(r"[a-z0-9_.-]+", s) for s in research["next_step"]["required_tools"] + research["next_step"]["required_sources"]) check("H6 required_tools/required_sources are lowercase identifier tokens", ids_ok) check("H7 no credential or machine path in the report", "sah_" not in report and "/Users/" not in report and "/root/" not in report) check("H8 no novelty claim and no IMPORT-MAP owned row claimed", "no novelty claim is made" in norm(report).lower()) check("H9 the excluded mechanism is never proposed as live", "cannot reach the small-gcd class" in report or "cannot reach the small-gcd class" in norm(report)) return finish() def finish(): passed = sum(1 for r in RESULTS if r["ok"]) summary = { "job_id": "1674", "checks": RESULTS, "passed": passed, "total": len(RESULTS), "all_pass": passed == len(RESULTS), "network": False, "deterministic": True, } with open(os.path.join(HERE, "job1674-checks.log"), "w", encoding="utf-8") as fh: for r in RESULTS: fh.write(("PASS " if r["ok"] else "FAIL ") + r["check"] + ("" if not r["detail"] else " :: " + r["detail"]) + "\n") fh.write("TOTAL %d/%d all_pass=%s\n" % (passed, len(RESULTS), summary["all_pass"])) with open(os.path.join(HERE, "job1674-checks.json"), "w", encoding="utf-8") as fh: json.dump(summary, fh, indent=1, sort_keys=True) print("TOTAL %d/%d all_pass=%s" % (passed, len(RESULTS), summary["all_pass"])) return 0 if summary["all_pass"] else 1 if __name__ == "__main__": sys.exit(main())