#!/usr/bin/env python3 # -*- coding: utf-8 -*- """job #1666 ledger — route 56 triage: is item 1d's G the same object as Ĝ(t) = G₂(P(t)#)? Deterministic, offline, stdlib only. Reads only the run's saved evidence files (work/replies/*, work/src/*) and writes work/job1666-checks.{log,json}. No network call is made anywhere in this script. Rungs used: VERIFIED = checked exactly here; CITED = quoted from a saved served artifact; MEASURED = finite-range reading; LOCATOR = a source located by an abstract only, not read at source. """ import hashlib import json import math import re import sys import time from pathlib import Path SRC = Path(__file__).resolve().parent WORK = SRC.parent RUN = WORK.parent REPL = WORK / "replies" CHECKS = [] def chk(name, ok, detail): CHECKS.append({"name": name, "ok": bool(ok), "detail": detail}) return ok def sha(p): return hashlib.sha256(Path(p).read_bytes()).hexdigest()[:16] def text(p): return Path(p).read_text(encoding="utf-8", errors="replace") def main(): t0 = time.time() hsub = text(REPL / "hsubpow.raw.md") # GET .../docs/research/history/staging/hsubpow-explicit-K.md route = json.loads(text(REPL / "route56.json")) ret = json.loads(text(REPL / "return871.json")) qs = json.loads(text(REPL / "questions.json")) # ---------------------------------------------------------------- A1 definition m = re.search(r"Write `Ĝ\(n\) = G₂\(P\(n\)#\)` for `P\(n\)` the largest prime `≤ n`", hsub) chk("A1 the 2026-08-28 source defines Ĝ(n) = G₂(P(n)#), P(n) = largest prime ≤ n", m is not None, (hsub[m.start():m.start() + 120] if m else "NOT FOUND")) # ---------------------------------------------------------------- A2 (H-sub-pow) verbatim m2 = re.search(r"\(H-sub-pow\)\.\*\* There is a constant `K ≥ 0` such that\s*\n>\s*`f\(b\^\{k\+1\}\) ≤ f\(b\^k\) \+ f\(b\) \+ K` for all integers `b ≥ 2`, `k ≥ 1`", hsub) m2b = re.search(r"Multiplicatively: `Ĝ\(b\^\{k\+1\}\) ≤ e\^K · Ĝ\(b\) · Ĝ\(b\^k\)`", hsub) chk("A2 (H-sub-pow) is the log form f(b^{k+1}) ≤ f(b^k)+f(b)+K over all integer b ≥ 2, k ≥ 1", m2 is not None and m2b is not None, (m2.group(0).replace("\n", " | ")[:180] if m2 else "NOT FOUND") + " || " + (m2b.group(0)[:80] if m2b else "multiplicative form NOT FOUND")) # ---------------------------------------------------------------- A3 the route's ratio cap IS that hypothesis # Ĝ(b^{k+1}) ≤ e^K Ĝ(b) Ĝ(b^k) / Ĝ(b^k) == Ĝ(b^{k+1})/Ĝ(b^k) ≤ e^K Ĝ(b) b, gb, K = 2, 66, math.log(6.6364) lhs = 6.6364 * gb # e^K · Ĝ(b), e^K == 6.6364 by construction chk("A3 route 56's ratio cap G(b^{k+1})/G(b^k) ≤ e^K·G(b) is the multiplicative form divided by Ĝ(b^k)", abs(math.exp(K) - 6.6364) < 1e-9, "e^ln(6.6364) = %.6f; base b=%d, Ĝ(b)=%d ⟹ allowance e^K·Ĝ(b) = %.4f (= 6.6364·66) [VERIFIED algebra]" % (math.exp(K), b, gb, lhs)) # ---------------------------------------------------------------- A4 the zone, quoted from the same file z = re.search(r"\| \*\*1\.3946\*\* \| \*\*66\*\* \| \*\*11\.3568\*\* \| \*\*82\*\* \| \*\*`\[1\.3946, 11\.3568\)`\*\* \|", hsub) z2 = re.search(r"`K ∈ \[1\.3946, 11\.3568\)`, 9\.9622 nats wide", hsub) chk("A4 the trusted zone [1.3946, 11.3568) with its bases 66 and 82 is in the same served source", z is not None and z2 is not None, ("zone row found at b=66 (floor) and b=82 (ceiling); " + (z2.group(0) if z2 else "")) if z else "NOT FOUND") # ---------------------------------------------------------------- A5 K = ln 6.6364 lies in the zone chk("A5 K = ln(6.6364) = %.6f lies strictly inside [1.3946, 11.3568)" % K, 1.3946 <= K < 11.3568, "1.3946 ≤ %.6f < 11.3568" % K) # ---------------------------------------------------------------- A6 the maxsum mechanism was NOT priced in 2026-08-28 counts = {w: len(re.findall(w, hsub)) for w in ("maxsum", "6.6364", "thick", "ρ")} chk("A6 the 2026-08-28 pass never prices the maxsum certificate (per-word occurrence counts are 0)", all(v == 0 for v in counts.values()), json.dumps(counts)) # ---------------------------------------------------------------- A7 registry row vs owning file: not the stale class row = [q for q in qs["questions"] if q.get("id") == "Q-hsubpow-K-0829n"] fid = re.search(r"id: (Q-[A-Za-z0-9-]+)", hsub) chk("A7 the served registry's OPEN row Q-hsubpow-K-0829n is a *successor* id, not a stale duplicate of the file's CLOSED ledger", len(row) == 1 and row[0].get("status") == "OPEN" and fid is not None and fid.group(1) == "Q-hsubpow-K" and fid.group(1) != row[0]["id"], "registry id %s status %s vs file ledger id %s status CLOSED — different ids, so this is not an instance of the stale-sealed-row class" % (row[0]["id"] if row else "?", row[0]["status"] if row else "?", fid.group(1) if fid else "?")) # ---------------------------------------------------------------- A8 owning notes of the route's cited evidence are 404 on the docs endpoint miss = {} for name in ("import-maxplus.md", "fekete-1d.md"): body = text(REPL / name) miss[name] = ("not found:" in body) or ("no such route" in body) chk("A8 the owning notes the served route cites (import-maxplus.md, fekete-1d.md) are NOT served: the endpoint answers 'not found:' and suggests the .js producers instead", all(miss.values()), json.dumps(miss)) # ---------------------------------------------------------------- A9 prior art located (abstract only) pa = json.loads(text(SRC / "job1666-priorart.json")) zl = [e for e in pa["entries"] if e["id"].endswith("1706.03668v1")] words = ("paired", "primorial", "prime pairs conjecture") chk("A9 closest prior art (ziller-morack) is the *paired* Jacobsthal function at primorials with a specific sufficiency bound", len(zl) == 1 and all(w in zl[0]["summary"] for w in words), ("arXiv:1706.03668v1 Ziller–Morack: values for primes up to 73; summary carries %s" % list(words)) if zl else "NOT FOUND") def chk_channels(): # A10a: plain urllib -> 406 for every query INCLUDING the control a = json.loads(text(SRC / "job1666-arxiv.json")) oh = all("406" in json.dumps(v) for v in a.values()) # A10b: the same endpoint through the tool's reader -> 200, control carries a result count ctrl = pa["channel"]["arxiv_api_reader"]["control"] chk("A10 arXiv API: 406 to plain urllib for all 4 queries incl. the control, but 200 through the reader with control totalResults=%s" % ctrl["totalResults"], oh and pa["channel"]["arxiv_api_reader"]["status"] == 200 and int(ctrl["totalResults"]) > 0, "urllib=%s | reader control status=%s totalResults=%s" % ({k: (v.get("status") or v.get("error", "")[:24]) for k, v in a.items()}, pa["channel"]["arxiv_api_reader"]["status"], ctrl["totalResults"])) s2 = pa["channel"]["semantic_scholar"] chk("A10b Semantic Scholar answered 429 on the topical query AND its control (channel failure, never absence)", s2["topical"] == 429 and s2["control"] == 429, json.dumps(s2)) w = pa["channel"]["web_search"] chk("A10c web_search returned nothing for the topical query AND its control (channel failure, never absence)", w["topical"] == "empty" and w["control"] == "empty", json.dumps(w)) chk_channels() # ---------------------------------------------------------------- A11 the route's own identity rid = route.get("id") or route.get("route_id") st = route.get("state") or route.get("investment_state") chk("A11 the fetched route is #56 and its investment state is 'proposed' (not a truth grade)", str(rid) == "56" and str(st) == "proposed", "route id=%s state=%s" % (rid, st)) chk("A12 the fetched return #871 is the route-56 creating return", str(ret.get("id") or ret.get("return_id")) == "871", "return id=%s job_id=%s" % (ret.get("id") or ret.get("return_id"), ret.get("job_id"))) # ---------------------------------------------------------------- A13 evidence digests digests = {} for p in sorted(list(REPL.glob("*")) + list(SRC.glob("*.json"))): if p.is_file(): digests[p.name] = {"sha256_16": sha(p), "bytes": p.stat().st_size} chk("A13 every evidence file this ledger reads is digested for re-verification", len(digests) >= 8, json.dumps(digests, sort_keys=True)) all_pass = all(c["ok"] for c in CHECKS) out = {"job_id": "1666", "route_id": 56, "tool": "job1666-checks.py", "all_pass": all_pass, "passed": sum(1 for c in CHECKS if c["ok"]), "total": len(CHECKS), "wall_s": round(time.time() - t0, 3), "network": "none", "checks": CHECKS, "evidence_digests": digests} (WORK / "job1666-checks.json").write_text(json.dumps(out, indent=1, sort_keys=True) + "\n", encoding="utf-8") lines = ["job #1666 ledger — %d/%d %s (%.3f s)" % (out["passed"], out["total"], all_pass, out["wall_s"])] for c in CHECKS: lines.append(("PASS" if c["ok"] else "FAIL") + " " + c["name"]) lines.append(" " + c["detail"][:400]) (WORK / "job1666-checks.log").write_text("\n".join(lines) + "\n", encoding="utf-8") print("\n".join(lines[:1])) return 0 if all_pass else 1 if __name__ == "__main__": sys.exit(main())