# analysis.py -- job #385: evaluate the pre-registered falsifiers F1-F4 of prereg-truncation-split.md from # t1main.out (delta_trunc, sharp and b-unbounded), thin385.out (own T1, thinning control, j = 16..29) and the embedded # tables of research/centered-discrepancy-measurement.js (embedded.json extracted from the served file). Deterministic stdout. import json, math, statistics # Primary source: the retained artifact research/centered-discrepancy-measurement.json (full precision); the embedded # 6-decimal tables (embedded.json, extracted from the served script) are the cross-check printed in section G. C2 = 0.6601618158468696 art = {r['j']: r for r in json.load(open('research/centered-discrepancy-measurement.json'))['rows'] if r.get('shift') == 2} def sd4(vals): m = sum(vals) / len(vals); return math.sqrt(sum((v - m) ** 2 for v in vals) / (len(vals) - 1)) main = {j: [None] * 7 + [r['D'] / r['x']] for j, r in art.items()} ident = {j: [None, r['S'] / r['x'], r['T1'] / r['x'] - C2, None, r['Epp'] / r['x']] for j, r in art.items()} ctrl_art = {j: sd4([s['D'] / r['x'] for s in r['seeds']]) for j, r in art.items()} import re def parse_embedded(path): # the MAIN TABLE / IDENTITY (12) PIECES / RANDOM-SIGN CONTROL rows of the served script's OUTPUT block blocks = {}; mode = None for l in open(path).read().splitlines(): m = re.match(r'// (MAIN TABLE|IDENTITY \(12\) PIECES|RANDOM-SIGN CONTROL)[^|]*(.*)', l) if m: mode = m.group(1); blocks[mode] = {'header': m.group(2), 'rows': {}}; continue if mode and re.match(r'// \d+ \|', l): cells = [c.strip() for c in l[3:].split('|')]; blocks[mode]['rows'][int(cells[0])] = cells elif mode and l.strip() != '//': mode = None return blocks emb = parse_embedded('research/centered-discrepancy-measurement.js') emb_ident = {int(j): r for j, r in emb['IDENTITY (12) PIECES']['rows'].items()} emb_ctrl = {int(j): r for j, r in emb['RANDOM-SIGN CONTROL']['rows'].items()} ctrl = emb_ctrl # F4 uses the embedded sd column, as pre-registered t1m = {} for l in open('t1main.out'): c = [v.strip() for v in l.split('|')]; t1m[int(c[0])] = dict(y=int(c[2]), sharp=float(c[3]), inf=float(c[4]), tail=float(c[5]), pairs=int(c[6])) thin = {} for l in list(open('thin385.out'))[1:]: c = [v.strip() for v in l.split('|')]; thin[int(c[0])] = dict(T1=float(c[3]), E=float(c[4]), sd=float(c[5]), draws=[float(v) for v in c[6:10]], PJ=float(c[12])) print("A. Identity control: own T1/x - C2 (thin385, all n) against the embedded IDENTITY column and census13.out (return #34), j = 16..29") worst = 0 for j in range(16, 30): d = abs(thin[j]['T1'] - float(ident[j][2])); worst = max(worst, d) print(f" max |difference| = {worst:.1e} against the artifact's full-precision T1") print() print("B. The split at every j: T1/x - C2 (embedded) = delta_trunc/x (sharp, computed without primes) + B/x") print(" j | y | pairs | T1/x-C2 | delta_sharp/x | delta_inf/x | B/x (sharp) | B/x (inf) | sd_thin/x | B/sd | draws min..max /sd") rows = {} for j in range(16, 39): t1 = float(ident[j][2]); ds = t1m[j]['sharp']; di = t1m[j]['inf']; B = t1 - ds; Bi = t1 - di sd = thin[j]['sd'] if j in thin else None z = B / sd if sd else None dr = [v / sd for v in thin[j]['draws']] if sd else None rows[j] = dict(t1=t1, ds=ds, di=di, B=B, Bi=Bi, sd=sd, z=z) print(f" {j} | {t1m[j]['y']} | {t1m[j]['pairs']} | {t1:+.6f} | {ds:+.6f} | {di:+.6f} | {B:+.6f} | {Bi:+.6f} | " + (f"{sd:.6f} | {z:+.2f} | {min(dr):+.2f}..{max(dr):+.2f}" if sd else "- | - | -")) print() print("C. Falsifiers (pre-registered in prereg-truncation-split.md, file 770da37e...)") J = range(30, 39) signs = sum(1 for j in J if math.copysign(1, rows[j]['ds']) == math.copysign(1, rows[j]['t1'])) rms_t1 = math.sqrt(sum(rows[j]['t1'] ** 2 for j in J) / 9); rms_B = math.sqrt(sum(rows[j]['B'] ** 2 for j in J) / 9) print(f" F1 sign agreement j=30..38: {signs} of 9 (needs >= 7): {'PASS' if signs >= 7 else 'FAIL'}; the disagreeing rows: {[j for j in J if math.copysign(1, rows[j]['ds']) != math.copysign(1, rows[j]['t1'])]}") print(f" F2 RMS(B/x) = {rms_B:.2e} against 0.5 * RMS(T1/x - C2) = {0.5 * rms_t1:.2e} (RMS(T1/x-C2) = {rms_t1:.2e}, ratio {rms_B / rms_t1:.3f}): {'PASS' if rms_B <= 0.5 * rms_t1 else 'FAIL'}") within3 = sum(1 for j in range(16, 30) if abs(rows[j]['z']) <= 3); within1 = sum(1 for j in range(16, 30) if abs(rows[j]['z']) <= 1) print(f" F3 |B| <= 3 sd_thin at j=16..29: {within3} of 14 (needs >= 11): {'PASS' if within3 >= 11 else 'FAIL'}; within 1 sd: {within1} of 14; max |z| = {max(abs(rows[j]['z']) for j in range(16, 30)):.2f}") print() print("D. The corrected object D~_y = D_y + delta_trunc against the census's random-sign control (sd column of RANDOM-SIGN CONTROL)") print(" j | D_y/x | delta_sharp/x | D~_y/x | ctrl sd | |D_y|/sd (raw) | |D~_y|/sd | S/x-C2 | -B/x | (S/x-C2) - B/x - Epp/x") ratios = []; raw = [] for j in range(16, 39): Dy = float(main[j][7]); Dt = Dy + rows[j]['ds']; sd = float(ctrl[j][3]); S = float(ident[j][1]) - 0.6601618158468696; Epp = float(ident[j][4]) r = abs(Dt) / sd; rr = abs(Dy) / sd if j >= 30: ratios.append(r); raw.append(rr) print(f" {j} | {Dy:+.6f} | {rows[j]['ds']:+.6f} | {Dt:+.6f} | {sd:.6f} | {rr:6.2f} | {r:5.2f} | {S:+.6f} | {-rows[j]['B']:+.6f} | {S - rows[j]['B'] - Epp:+.6f}") print(f" F4 median |D~_y/x| / ctrl sd over j=30..38 = {statistics.median(ratios):.2f} (needs <= 3): {'PASS' if statistics.median(ratios) <= 3 else 'FAIL'}; raw median {statistics.median(raw):.2f}; max corrected {max(ratios):.2f}, max raw {max(raw):.2f}") print() print("E. Normalisation check at j <= 29: replacing x/2 by the exact P_J = sum_J Lambda(n-2) in the main term changes delta_trunc/x by (P_J/x - 1/2) * 2 (delta_sharp/x + C2):") for j in (16, 20, 24, 29): shift = (thin[j]['PJ'] - 0.5) * 2 * (rows[j]['ds'] + 0.6601618158468696) print(f" j={j}: P_J/x - 1/2 = {thin[j]['PJ'] - 0.5:+.2e}, shift of delta/x = {shift:+.2e}, against B/x = {rows[j]['B']:+.2e}") print() print("F. b-tail (sharp - unbounded)/x: " + ", ".join(f"j={j}: {t1m[j]['tail']:+.1e}" for j in (16, 20, 24, 28, 30, 34, 38))) print() print("G. Cross-check of the sources: artifact T1/x - C2 and control sd against the embedded 6-decimal columns") w1 = max(abs(ident[j][2] - float(emb_ident[j][2])) for j in range(16, 39)); w2 = max(abs(ctrl_art[j] - float(emb_ctrl[j][3])) for j in range(16, 39)) print(f" max |T1/x - C2 (artifact) - (embedded)| = {w1:.1e}; max |ctrl sd (artifact, sample sd of 4 seeds) - (embedded)| = {w2:.1e}")