#!/usr/bin/env python3 """Route 89's next experiment (job #2040): the V-ladder of the signed telescoped aggregate. Object, unchanged from #1097/#1103: tI_V(U) is the Vaughan Type I piece of P_low at fixed V for f(n) = Lambda(n-2) mu(n) on (x/2, x]; chain dyadic {1,2,4,...,V}; Tx(V) = tI_V(V) - tI_V(1) is the signed telescoped aggregate (chain-independent by telescoping) and Vx(V) = sum|increments| the absolute variation. Ladder: x = 2^24 with V in {16,32,64,128,256}; x = 2^25 with V = 32. Refinement only at V = 32. Falsifiers S1/S2 and the disclosed correction of the old S2: job2040/PREREG-2040.md, written first. The family implementation is job2050/window_increments.py, used unchanged; the certified port is job2044/split_census.py. """ import json import math import os import sys HERE = os.path.dirname(os.path.abspath(__file__)) RUN = os.path.join(HERE, "..") sys.path.insert(0, os.path.join(RUN, "job2050")) from window_increments import family # noqa: E402 ALLOWANCE = 0.08 # Overridable for the smoke test only (VL_LADDER='[[18,[16,32]]]'); the run of record uses the # pre-registered ladder. XLADDER = (json.loads(os.environ["VL_LADDER"]) if os.environ.get("VL_LADDER") else [(24, [16, 32, 64, 128, 256]), (25, [32])]) def chain_for(V): c = [] u = 1 while u <= V: c.append(u) u *= 2 if c[-1] != V: c.append(V) return c def refine(chain): out = set(chain) for a, b in zip(chain, chain[1:]): out.add((a + b) // 2) return sorted(out) def main(): # Tx at V = 32 from the earlier ladders (chain-independent by telescoping) prev = json.load(open(os.path.join(RUN, "job2050", "window-increments.json"))) prev_tx = [(r["j"], (r["members_over_x"][-1] - r["members_over_x"][0])) for r in prev["rows"]] triage = json.load(open(os.path.join(RUN, "job2059", "ladder-ext.json"))) prev_tx += [(r["j"], r["signed_sum_over_x"]) for r in triage["rows"] if "signed_sum_over_x" in r] out = {"tx_prior_scales": prev_tx, "rows": []} for j, Vs in XLADDER: x = 2 ** j for V in Vs: ch = chain_for(V) r = family(x, ch, V) inc = r["increments_over_x"] Tx = sum(inc) Vx = sum(abs(v) for v in inc) row = { "j": j, "x": x, "V": V, "chain": ch, "Tx_over_x": Tx, "Vx_over_x": Vx, "Tx_over_allowance": Tx / ALLOWANCE, "Vx_over_allowance": Vx / ALLOWANCE, "signed_over_abs": (abs(Tx) / Vx if Vx else None), "G": r["G_sum_abs_inc_over_max_member"], "Mx_max_member_over_x": r["max_member_over_x"], "members_over_x": r["members_over_x"], "increments_over_x": inc, "sign_changes": r["sign_changes"], "window_identity_resid_rel": r["window_identity_resid_rel"], "invariant_spread_over_x": r["invariant_spread_over_x"], "invariant_matches_free_side": r["invariant_matches_free_side"], "mu_identity_violations": r["mu_identity_violations"], "surviving_pairs": r["surviving_pairs"], } if V == 32: r2 = family(x, refine(ch), V) row["G_ref"] = r2["G_sum_abs_inc_over_max_member"] row["refined_chain"] = refine(ch) row["Tx_ref"] = sum(r2["increments_over_x"]) out["rows"].append(row) print(json.dumps({k: row[k] for k in ( "j", "V", "Tx_over_x", "Vx_over_x", "Tx_over_allowance", "Vx_over_allowance", "signed_over_abs", "G", "sign_changes", "mu_identity_violations", "window_identity_resid_rel", "invariant_matches_free_side", "surviving_pairs")}), flush=True) # --- S1: trend of Tx at V = 32 over every scale we have, plus the two new points pts = list(prev_tx) for r in out["rows"]: if r["V"] == 32: pts.append((r["j"], r["Tx_over_x"])) pts.sort() xs = [j * math.log(2.0) for j, _ in pts] # ln x, not ln j (label fixed after the smoke test) ys = [math.log(abs(t)) for _, t in pts] mx, my = sum(xs) / len(xs), sum(ys) / len(ys) sxx = sum((a - mx) ** 2 for a in xs) sxy = sum((a - mx) * (b - my) for a, b in zip(xs, ys)) slope = sxy / sxx resid = [b - (my + slope * (a - mx)) for a, b in zip(xs, ys)] se = math.sqrt(sum(r * r for r in resid) / (len(xs) - 2) / sxx) top = {r["j"]: r["Tx_over_x"] for r in out["rows"] if r["V"] == 32} out["S1"] = { "scales_at_V32": pts, "slope_lnTx_on_lnx": slope, "se": se, "Tx_at_2^24": top.get(24), "Tx_at_2^25": top.get(25), "S1_refuted": (top.get(24, 0) >= ALLOWANCE and top.get(25, 0) >= ALLOWANCE), "S1_supported": (slope < -0.2 and top.get(24, 1) < ALLOWANCE and top.get(25, 1) < ALLOWANCE), } # --- S2: V-stability at x = 2^24 txv = {r["V"]: r["Tx_over_x"] for r in out["rows"] if r["j"] == 24} base = txv.get(32) dev = {V: (abs(v - base) / ALLOWANCE if base is not None else None) for V, v in txv.items()} big = [d for V, d in dev.items() if V >= 128 and d is not None] out["S2"] = { "Tx_by_V_at_2^24": txv, "dev_from_V32_in_allowance_units": dev, "S2_refuted": bool(big) and max(big) >= 2, "S2_supported": bool(big) and max(big) <= 1, } with open(os.path.join(HERE, "v-ladder.json"), "w") as fh: json.dump(out, fh, indent=1) print(json.dumps({"S1": out["S1"], "S2": out["S2"]}, indent=1)) if __name__ == "__main__": main()