The script src/22-quantum/sorkin.py of the validation package of the paper 22-qm, rendered with an anchor per line. ▶ run the predicates on Google Colab.
1## T1: Sorkin hierarchy in the FRC ledger.2## Claims verified by exact integer arithmetic (no floats):3## (S1) second-order interference is generically nonzero (the theory interferes);4## (S2) third- and fourth-order interference vanish identically on ledger states,5## for every channel, outcome, and random state -- the Sorkin nullity;6## (S3) sub-horizon (d*||psi||^2 < p) the carrier shadow determines the exact7## counts, so the observed Sorkin combination is exactly zero;8## (S4) super-window, the observed (lifted-shadow) Sorkin combination is always9## an integer multiple of p: wrap deviations are quantised at the horizon,10## and small nonzero kappa is forbidden at every scale.11from math import gcd1213def gm(z, w): return (z[0]*w[0] - z[1]*w[1], z[0]*w[1] + z[1]*w[0])14def ga(z, w): return (z[0]+w[0], z[1]+w[1])15def gc(z): return (z[0], -z[1])16def gnorm(z): return z[0]*z[0] + z[1]*z[1]17I4 = [(1,0), (0,1), (-1,0), (0,-1)]1819def report(label, ok):20 print(('PASS ' if ok else 'FAIL ') + label)21 assert ok, label2223def subsets(slits):24 out = []25 for mask in range(1, 1 << len(slits)):26 out.append(tuple(i for i in range(len(slits)) if mask >> i & 1))27 return out2829def sorkin_run(p, e, nO, d, nslits, coeff):30 """Random nslits Z[i] components on the object cycle; full Sorkin hierarchy.31 coeff: callable returning one random Gaussian-integer coefficient."""32 N = p - 133 gO = pow(e, N//nO, p)34 HO = [pow(gO, j, p) for j in range(nO)]35 q = nO // d # number of outcomes36 coreg = nO // d # fibres indexed mod nO/d37 # pointer characters on the core ~ Z_d via i-powers only valid for d=4:38 assert d == 439 slits = []40 for _ in range(nslits):41 slits.append({u: coeff() for u in HO})42 def amp(S, r, a):43 s = (0, 0)44 for l in range(4):45 u = pow(gO, a + coreg*l, p)46 comp = (0, 0)47 for i in S:48 comp = ga(comp, slits[i][u])49 s = ga(s, gm(gc(I4[(r*l) % 4]), comp))50 return s51 W = {}52 for S in subsets(range(nslits)):53 for r in range(4):54 for a in range(q):55 W[(S, r, a)] = gnorm(amp(S, r, a))56 return W, q5758def hier(W, q, k, nslits):59 """k-th order Sorkin combination for the first k slits, all channels/outcomes."""60 from itertools import combinations61 vals = []62 base = tuple(range(k))63 for r in range(4):64 for a in range(q):65 tot = 066 for m in range(1, k+1):67 sgn = (-1)**(k-m)68 for c in combinations(base, m):69 tot += sgn * W[(tuple(sorted(c)), r, a)]70 vals.append(tot)71 return vals7273_c = [0] # deterministic counter, no RNG74def _nxt():75 _c[0] += 1; return _c[0]76wide = lambda: (((_nxt()*5) % 19) - 9, ((_nxt()*13) % 19) - 9)77binary = lambda: (_nxt() % 2, 0)78deep = lambda: (7*(((_nxt()*5) % 19) - 9), 7*(((_nxt()*13) % 19) - 9))7980for (p, e, nO, tag) in [(157, 5, 12, '157/53/13'), (421, 2, 28, '421/61/29')]:81 W, q = sorkin_run(p, e, nO, 4, 4, coeff=wide)82 I2 = hier(W, q, 2, 4); I3 = hier(W, q, 3, 4); I4v = hier(W, q, 4, 4)83 report('%s: I2 generically nonzero (max |I2| = %d)' % (tag, max(map(abs, I2))),84 any(v != 0 for v in I2))85 report('%s: I3 = 0 exactly, all channels and outcomes' % tag,86 all(v == 0 for v in I3))87 report('%s: I4 = 0 exactly, all channels and outcomes' % tag,88 all(v == 0 for v in I4v))8990# (S3)/(S4): shadow readout. Lift L(w) = (w mod p); observed Sorkin combination91# from lifted shadows. Sub-horizon: zero exactly. Super-window: multiple of p.92p, e, nO = 157, 5, 1293W, q = sorkin_run(p, e, nO, 4, 3, coeff=binary) # 0/1 coefficients: w <= 144 < p94sub = all(w < p for w in W.values())95I3hat = []96from itertools import combinations97for r in range(4):98 for a in range(q):99 tot = 0100 for m in range(1, 4):101 for c in combinations((0, 1, 2), m):102 tot += (-1)**(3-m) * (W[(tuple(sorted(c)), r, a)] % p)103 I3hat.append(tot)104report('157: sub-horizon tallies (all w < p): observed I3-hat = 0 exactly',105 sub and all(v == 0 for v in I3hat))106107W, q = sorkin_run(p, e, nO, 4, 3, coeff=deep) # forced super-window tallies108big = any(w >= p for w in W.values())109I3hat, nz = [], 0110for r in range(4):111 for a in range(q):112 tot = 0113 for m in range(1, 4):114 for c in combinations((0, 1, 2), m):115 tot += (-1)**(3-m) * (W[(tuple(sorted(c)), r, a)] % p)116 I3hat.append(tot)117 if tot != 0: nz += 1118report('157: super-window tallies present and wrap quantisation I3-hat in pZ '119 '(nonzero cases: %d, all multiples of %d)' % (nz, p),120 big and all(v % p == 0 for v in I3hat) and nz > 0)121122print('sorkin: all checks passed')123