#!/usr/bin/env python3 """Checker for the job #2044 finite claims. Consumes ONLY the published outputs. Targets (both are published artifacts of this return): split-census.json -- the 46-row ladder and its per-row identity flags port-control.json -- the 11 cross-lane controls The published values from other lanes that the claims compare against are constants below, each with its source, so the check needs no network and no other input. Run: python3 verify_claims.py (in the directory holding the two JSON files) Exit: 0 with "PASS" only if every claim below holds; 1 with the failing tags otherwise. """ import json import math import sys SERVED_LINE = {"tI_over_x": 4.4864, "tII_over_x": -4.4982, # served validator, x=2^16, U=V=3 "Pband_over_x": -0.0295, "Dall_over_x": -0.0231} PUB_165 = {16: (-0.016647, 0.014472), 17: (-0.039617, None), 18: (-0.030072, None), 19: (-0.003985, None), 20: (-0.014966, None)} # D_y/x, M/x as published by #165 fails = [] def need(cond, tag, detail=""): if not cond: fails.append("%s %s" % (tag, detail)) census = json.load(open("split-census.json", encoding="utf-8")) control = json.load(open("port-control.json", encoding="utf-8")) rows = census["rows"] # --- claim 1: every internal identity of every ladder row holds --- need(census["checks_failed"] == [], "no_failed_row_identities", census["checks_failed"][:3]) need(len(rows) == 46, "row_count", len(rows)) # --- claim 2: the port reproduces the served validator's own printed line to 4 dp --- for k, v in SERVED_LINE.items(): row = [r for r in rows if r["x"] == 2 ** 16 and r["U"] == 3 and r["V"] == 3] need(row and abs(round(row[0][k], 4) - v) < 1e-12, "served_line:" + k, "port=%r served=%r" % (row[0][k] if row else None, v)) # --- claim 3: the two lanes' M agree (served validator's M and #165's published M/x = 0.014472) --- r16 = [r for r in rows if r["x"] == 2 ** 16 and r["U"] == 3][0] need(abs(r16["M_over_x"] - 0.014471617101367918) < 1e-12, "M_matches_served_validator") need(abs(round(r16["M_over_x"], 6) - PUB_165[16][1]) < 1e-12, "M_matches_return_165_published") # --- claim 4: the split's pieces dominate the band for small cutoffs, and NOT for large ones --- small = [r for r in rows if r["U"] in (2, 3, 4, 5)] need(min(r["abs_TI_over_Pband"] for r in small) >= 21.7, "small_cutoff_domination", min(r["abs_TI_over_Pband"] for r in small)) need(min(r["abs_TI_over_Pband"] for r in rows if r["U"] >= 2) <= 2.2, "large_cutoff_fails_domination", min(r["abs_TI_over_Pband"] for r in rows if r["U"] >= 2)) need(max(r["abs_TI_plus_TII_over_TI"] for r in small) <= 0.137, "small_cutoff_cancellation", max(r["abs_TI_plus_TII_over_TI"] for r in small)) need(max(r["abs_TI_plus_TII_over_TI"] for r in rows if r["U"] >= 2) >= 0.5, "large_cutoff_cancellation", max(r["abs_TI_plus_TII_over_TI"] for r in rows if r["U"] >= 2)) # --- claim 5: the below-level sum is cutoff-invariant while the pieces are not --- from collections import defaultdict byx = defaultdict(list) for r in rows: byx[r["x"]].append(r) spreads = {} for x, rs in byx.items(): if len(rs) < 2: continue vals = [r["tI_over_x"] for r in rs] spreads[x] = max(vals) / min(vals) need(max(r["Plow_over_x"] for r in rs) - min(r["Plow_over_x"] for r in rs) < 1e-9, "cutoff_invariance_x=%d" % x) need(spreads and max(spreads.values()) > 30, "pieces_not_cutoff_stable", spreads) # --- claim 6: the note's own cutoff rule is degenerate below 2^180 --- deg = census["note_cutoff_degeneracy"] need(deg["first_j_with_U_at_least_2"] == 180, "note_cutoff_degeneracy", deg) need(int(math.floor((2 ** 179) ** (deg["eps_prime"] / 3.0))) == 1, "U_1_at_2_pow_179") # --- claim 7: the controls, and #165's published D_y against the fixed-endpoint center --- need(all(c["ok"] for c in control["checks"]), "all_controls_ok", [c["tag"] for c in control["checks"] if not c["ok"]]) diff = control["cross_parameterization_difference_over_x"] for j, (dy, _m) in PUB_165.items(): d = abs(diff[str(j)]) need(d > 1e-4, "two_centers_differ_j=%d" % j, d) need(max(abs(v) for v in diff.values()) > 0.02, "max_two_center_gap", max(abs(v) for v in diff.values())) print("failing tags: %s" % (fails if fails else "none")) print("PASS" if not fails else "FAIL") sys.exit(1 if fails else 0)