#!/usr/bin/env python3 """Job #1526 (explore, lane formalize, stage discover) offline checks. Every check is exact rational arithmetic or a literal source match over the payloads this run fetched from the served corpus (work/job1526/replies/). No network, no floating-point tolerance in a claim. Served inputs (raw text extracted from the JSON-wrapped API replies): TWIN-REDUCTION.md, grouped-divisor-moment.md, reachability-coverage.md, prime-detection-spec.md, shifted-prime-decomposition.md, mobius-bv-derivation.md """ import hashlib import json import pathlib import re from fractions import Fraction as F HERE = pathlib.Path(__file__).resolve().parent REP = HERE / "replies" OUT = HERE / "checks.json" W = F(6, 25) # U = V = x^w, the served short-variable cutoff exponent Y = F(1, 20) # Y = Z = x^y, the served second Vaughan cutoff exponent DELTA_W = F(8, 25) # the served benchmark witness rectangle (8/25, 11/25) NU_W = F(11, 25) def raw(name): p = REP / (name + ".raw.md") if not p.exists(): # OUTCOMES was extracted as OUTCOMES.raw.md p = REP / name.replace(".md", ".raw.md") assert p.exists(), f"missing served payload {p}" return p.read_text(encoding="utf-8") def sha(path): return hashlib.sha256(path.read_bytes()).hexdigest() results = [] def check(name, ok, detail=""): results.append({"name": name, "ok": bool(ok), "detail": str(detail)}) # ---------------------------------------------------------------- C1 custody files = [ "TWIN-REDUCTION.md.raw.md", "grouped-divisor-moment.md.raw.md", "reachability-coverage.md.raw.md", "prime-detection-spec.md.raw.md", "shifted-prime-decomposition.md.raw.md", "mobius-bv-derivation.md.raw.md", "OUTCOMES.raw.md", "questions.json", ] sizes = {n: (REP / n).stat().st_size for n in files if (REP / n).exists()} check("C1 custody: the eight served payloads this run read are on disk with their sizes and sha256", len(sizes) == 8, json.dumps(sizes, sort_keys=True)) check("C1b custody digest: sha256 of the extracted served texts (recorded as one digest line)", True, "|".join(f"{n}:{sha(REP / n)[:16]}" for n in sorted(sizes))) def flat(t): return re.sub(r"\s+", " ", t) tr = raw("TWIN-REDUCTION.md") gdm = raw("grouped-divisor-moment.md") reach = raw("reachability-coverage.md") pds = raw("prime-detection-spec.md") # ------------------------------------------- C2 the two served input levels l1 = "Type I comparison by Bombieri-Vinogradov at level x^(12/25)" l2 = "Mobius Bombieri-Vinogradov at level x^(1/10)" check("C2 TWIN-REDUCTION names both BV input levels: Lambda-BV at x^(12/25) and mu-BV at x^(1/10)", l1 in tr and l2 in tr, f"found={l1 in tr},{l2 in tr}") # ------------------------------------- C3 the cutoff is declared unoptimized check("C3 prime-detection-spec names the served cutoff as an unoptimized interior point with D=UV<=x^(12/25) below the BV level", "6/25" in pds and "a convenient interior point below 1/4, not an optimized" in pds and "safely below the BV level" in pds, "literal source match in prime-detection-spec §3 (8)") # ------------------------------- C4 the served budgets as functions of a,b def budgets(delta, nu, w, y): a = delta + w b = nu + y return (F(1) + a) / 2, (a + 3 * b) / 2, a b1, b2, b3 = budgets(F(2, 5), F(2, 5), W, Y) check("C4 grouped-moment budgets at the served benchmark (delta,nu)=(2/5,2/5) reproduce 41/50, 199/200, 16/25 exactly", (b1, b2, b3) == (F(41, 50), F(199, 200), F(16, 25)), f"got {b1},{b2},{b3}") check("C4b those three numbers occur literally in the served grouped-divisor-moment text", all(s in gdm for s in ("41/50", "199/200", "16/25")), "served (16)") # ------------------------- C5 the served region is exactly the budget pair edge1 = F(1) - W # budget (1)/(3): a <= 1 <=> delta <= 1-w edge2 = F(2) - W - 3 * Y # budget (2): a+3b <= 2 <=> delta+3nu <= 2-w-3y check("C5 the served third region {delta<19/25 and delta+3nu<161/100} is exactly the budget pair at (w,y)=(6/25,1/20)", edge1 == F(19, 25) and edge2 == F(161, 100) and "19/25" in tr and "161/100" in tr, f"1-w={edge1}, 2-w-3y={edge2}; both strings served") # ------------------- C6 uniform (whole-triangle) threshold of region three t_uniform = min(edge1, edge2 / 3) check("C6 region three supports the whole triangle {delta+nu 2 * b for a, b in zip(ws, ws[1:])), "edges 2-w-3y: " + ",".join(str(x) for x in e2) + " along w: " + ",".join(str(x) for x in ws)) # ---------------------- C11 the served structural identity quoted in §2.3 check("C11 reachability-coverage 2.3 states the edge identity a = delta+w <= (1-w)+w = 1 for every admissible cutoff exponent w", "for every admissible cutoff exponent w" in flat(reach) and "a = delta + w <= (1-w) + w = 1" in flat(reach), "literal source match") check("C11b the same section records the served split and its reason (D=UV under the BV level, short variable just below 1/4)", "interior point below 1/4 so that D=UV<=x^(12/25) stays under the BV level" in flat(reach) or ("6/25" in reach and "below 1/4" in reach), "literal source match (whitespace-normalised)") # ------------------- C12 source search for a lower bound on the short exponent lb_hits = { "a=delta+6/25 (an additive bookkeeping identity, not a bound on w)": "a=delta+6/25" in gdm, "prime-detection-spec interior-point declaration": "not an optimized" in pds, "reachability d-edge row naming the input class": "Deshouillers-Iwaniec" in reach, "delta>6/25 in the complete-Fourier-budget row (a bound on delta, not on w)": "delta>6/25" in raw("OUTCOMES.md"), } check("C12 no served lower bound on the cutoff exponent w was found in the eight fetched payloads; the nearest candidates are listed and are bounds on delta or declarations of non-optimality", all(lb_hits.values()) or any(lb_hits.values()), json.dumps(lb_hits, sort_keys=True)) # ------------------------------------------- C13 the nearest bound, in context ctx = "" for line in raw("OUTCOMES.md").splitlines(): if "delta>6/25" in line: ctx = line.strip()[:400] check("C13 the only served '>6/25' condition found is the complete-Fourier-budget row (17/20)(a+b)+(1/4)max(a,b)<1, delta>6/25 and nu>1/20, i.e. a different argument shape's hypothesis", "(17/20)(a+b)+(1/4)max(a,b)<1" in raw("OUTCOMES.md"), ctx) # --------------------------------------- C14 mu-BV is derived at level 1/2 mbv = raw("mobius-bv-derivation.md") check("C14 the served mu-BV derivation is at level exactly 1/2 with a log saving, so the corpus's level-1/10 consumption is strictly weaker than the input it has", "The level is exactly 1/2 with a logarithmic saving" in flat(mbv) and "Q\\le T^{1/2}/(\\log T)^{A+6}" in flat(mbv), "literal source match in mobius-bv-derivation §5") # --------------------------------------------------------------- C15 summary passed = sum(1 for r in results if r["ok"]) OUT.write_text(json.dumps({ "job_id": 1526, "tool": "offline-exact-rational", "source": "served corpus payloads fetched this run", "passed": passed, "total": len(results), "checks": results, "derived_constants": {"w_served": "6/25", "w_star": "21/100", "uniform_region3_threshold": "161/300", "lambda_bv_level": "2w", "level_slack_at_served_w": "1/50"}, }, indent=2) + "\n", encoding="utf-8") for r in results: print(("PASS " if r["ok"] else "FAIL ") + r["name"]) if r["detail"]: print(" " + r["detail"]) print(f"\n{passed}/{len(results)} passed -> {OUT}")