# Route 156 step check: can #1627's fixed-witness truncation test (b = L(1-2D) - tau(1-D) > 0, b^2 > 4RD) # certify the #1606 d=17 witness on the capped support, given the exact values on record? # Input: #1641 certificate-d17.json (sha256 906768338baab31fcd39055ead14aaf570fd8646b3ff356138aa0f9a4add498d, # public at /files/). Stdlib only, exact Fractions. Usage: python3 check4265.py certificate-d17.json import json, hashlib, sys from fractions import Fraction as Fr raw = open(sys.argv[1] if len(sys.argv) > 1 else 'certificate-d17.json', 'rb').read() sha = hashlib.sha256(raw).hexdigest() assert sha == '906768338baab31fcd39055ead14aaf570fd8646b3ff356138aa0f9a4add498d', sha d = json.loads(raw) q = {k: Fr(d[k]) for k in ('I_0', 'J_0', 'J_cap', 'Delta', 'I_cap')} tau = Fr(10000, 2583) assert q['I_cap'] == q['I_0'] - q['Delta'] L = q['J_0'] / q['I_0'] # uncapped Rayleigh quotient of the fixed witness (exact) # (1) b > 0 window: b(D) = L(1-2D) - tau(1-D) > 0 <=> D < (L - tau)/(2L - tau) D_b = (L - tau) / (2*L - tau) # (2) any valid lower bound is <= RQ(PF) = J_cap/(I_0(1-ell)); RQ(PF) > tau needs ell > 1 - J_cap/(tau I_0). # J_cap is the numerator #1869 re-derived bit for bit; this condition does not use Delta. D_need = 1 - q['J_cap'] / (tau * q['I_0']) ell = q['Delta'] / q['I_0'] # recorded discarded L2 mass (#1641; faithful-path check open, #1887) b_at_ell = L*(1 - 2*ell) - tau*(1 - ell) out = { 'sha256': sha, 'L_uncapped': '%.10f' % L, 'tau': '%.10f' % tau, 'b_window_D_max': '%.6e' % D_b, 'certify_needs_ell_min': '%.6e' % D_need, 'windows_disjoint': D_need > D_b, 'ell_recorded': '%.6e' % ell, 'b_at_ell_recorded': '%.6e' % b_at_ell, 'RQ_capped_recorded': '%.10f' % (q['J_cap'] / q['I_cap']), } print(json.dumps(out, indent=1, sort_keys=True)) # (3) b > 0 windows for the recorded uncapped values of other witnesses (decimals quoted from #1599's table, not exact) for name, Lq in (('1599 d=19 eps25/861', '3.912878'), ('1599 d=21 eps25/861', '3.920215'), ('1599 d=25 eps25/861', '3.927483')): Lf = Fr(Lq) print('%s: L=%s b>0 needs D < %.4f%%' % (name, Lq, float((Lf - tau) / (2*Lf - tau)) * 100))