The script src/22-quantum/composite.py of the validation package of the paper 22-qm, rendered with an anchor per line. ▶ run the predicates on Google Colab.
1## Composite gate + T3 (CHSH/Tsirelson) in the carrier F_641.2## Configuration: Carrier C_640 (g = 3), Object pair O_17 x O_17 (cycles C_16,3## g_O = 3^40 = 601, g_O^8 = -1), Subjects S_41 (cycles C_40, core C_8 with the4## objects, quotient C_2: natively dichotomic readout).5## Claims verified by exact arithmetic:6## (C1) carrier admissibility: 641 = 4*160+1 prime, 40 | 640, 16 | 640,7## gcd(40,16) = 8, [C_16 : C_8] = 2 outcomes;8## (C2) single drive => diagonal action: the relative offset of the object9## pair is a constant of motion; joint orbits have length 16; the10## synchronised orbit is the Bell state of the construction;11## (C3) doublet readout identity in F_641: for psi = u^s + lam*u^{s+8} the12## forced C_2 readout gives Psi(0) = 8(1+lam), Psi(1) = 8 g_O^s (1-lam):13## an exact sigma_x measurement on the winding doublet;14## (C4) correlator law: E(j_a, j_b) = cos(pi*(j_a - j_b)/40) exactly, from the15## full forced-basis computation in Z[zeta_80]; settings = relational16## repositionings c = g^j, granularity pi/40;17## (C5) reduction commutes at composite level: Z[zeta_80] -> F_641,18## zeta_80 -> g^8, matches the carrier-internal fibre sums;19## (C6) no-signalling: each party's marginal is setting-independent, exactly;20## (C7) CHSH: exhaustive sweep over all 80^3 setting differences gives21## max S = 2*sqrt(2) (Tsirelson saturation), min S = -2*sqrt(2), and22## native settings (e.g. a,a' = 0, 20 and b,b' = 10, -10) realise it;23## S > 2 strictly:24## Bell violation with carrier-native operations only;25## (C8) exact value: at the optimum S = 2(zeta_8 + zeta_8^{-1}) in Z[zeta_8],26## i.e. S^2 = 8: Tsirelson saturation as a cyclotomic identity.27import numpy as np28from math import gcd2930def report(label, ok):31 print(('PASS ' if ok else 'FAIL ') + label)32 assert ok, label3334# ---------------- C1: carrier admissibility ----------------35p, g = 641, 336N = p - 137def order(a):38 x, k = 1, 039 while True:40 x, k = (x*a) % p, k+141 if x == 1: return k42gO = pow(g, N//16, p)43report('C1: 641 = 4*160+1, g = 3 primitive, gO = 601 of order 16',44 p % 4 == 1 and order(g) == N and gO == 601 and order(gO) == 16)45report('C1: 40 | 640 and 16 | 640; core gcd(40,16) = 8; quotient C_2',46 N % 40 == 0 and N % 16 == 0 and gcd(40, 16) == 8 and 16//8 == 2)47report('C1: gO^8 = -1 (half-turn of the object cycle)', pow(gO, 8, p) == p-1)4849# ---------------- C2: diagonal drive, conserved offset, orbits ----------------50HO = [pow(gO, j, p) for j in range(16)]51pairs = [(u, v) for u in HO for v in HO]52def offset(u, v): return (u * pow(v, p-2, p)) % p53ok = all(offset((gO*u) % p, (gO*v) % p) == offset(u, v) for (u, v) in pairs)54orbit = {(1, 1)}55u, v = 1, 156for _ in range(16):57 u, v = (gO*u) % p, (gO*v) % p58 orbit.add((u, v))59report('C2: relative offset conserved by the drive on all 256 pairs; '60 'synchronised orbit has length 16', ok and len(orbit) == 16)6162# ---------------- C3: doublet sigma_x readout identity in F_641 ----------------63core = [pow(gO, 2*l, p) for l in range(8)] # C_8 inside C_1664ok3 = True65for s in range(16):66 for j in range(80):67 lam = pow(g, 8*j, p) # carrier phase on the doublet68 r = s % 8 # matched pointer channel69 # psi(u) = u^s + lam * u^{s+8}; fibres: core (alpha=0), gO*core (alpha=1)70 def psi(u): return (pow(u, s, p) + lam*pow(u, s+8, p)) % p71 P0, P1 = 0, 072 for k in core:73 kr = pow(k, (8 - r) % 8, p) if r else 1 # eta_r(k)^{-1} = k^{-r}74 P0 = (P0 + kr*psi(k)) % p75 P1 = (P1 + kr*psi((gO*k) % p)) % p76 t0 = (8*(1 + lam)) % p77 t1 = (8*pow(gO, s, p)*(1 - lam)) % p78 if P0 != t0 or P1 != t1: ok3 = False79report('C3: forced readout Psi(0) = 8(1+lam), Psi(1) = 8 gO^s (1-lam), '80 'all 16 windings x 80 settings', ok3)8182# ---------------- Z[zeta_80] exact arithmetic (poly mod Phi_80) ----------------83from sympy import Poly, symbols, cyclotomic_poly, Rational, sqrt, simplify, cos, pi, nsimplify84x = symbols('x')85PHI = Poly(cyclotomic_poly(80, x), x)86def zmul(a, b): return (a*b) % PHI87def zpow(k): return Poly(x, x)**(k % 80) % PHI88def zconj(a): # zeta -> zeta^{-1}89 out = Poly(0, x)90 for mono, c in zip(a.monoms(), a.coeffs()):91 out = (out + c*zpow(-mono[0])) % PHI92 return out9394# ---------------- C4 + C5: correlator law and reduction ----------------95# Conditioned Bell doublet (windings {a, a+8} on A, {-a, -a-8} on B), settings96# c_A = g^{j_a}, c_B = g^{j_b}. Joint forced-basis amplitude:97# A(alpha, beta) = 64 * zeta-phase * (1 + (-1)^{alpha+beta} Lambda),98# Lambda = zeta_80^{j_b - j_a}.99# Verified here from the explicit fibre sums (using C3 on each wing), and the100# F_641 shadow via zeta_80 -> g^8.101red8 = pow(g, 8, p) # zeta_80 shadow102def E_exact(D):103 lam = zpow(D); lamc = zconj(lam)104 w = {}105 for al in (0, 1):106 for be in (0, 1):107 sgn = 1 if (al+be) % 2 == 0 else -1108 amp = (Poly(1, x) + sgn*lam) % PHI109 ampc = (Poly(1, x) + sgn*lamc) % PHI110 w[(al, be)] = zmul(amp, ampc)111 tot = sum(w.values(), Poly(0, x)) % PHI112 num = (w[(0, 0)] + w[(1, 1)] - w[(0, 1)] - w[(1, 0)]) % PHI113 return num, tot, w114115ok4, ok5, ok6 = True, True, True116for D in range(80):117 num, tot, w = E_exact(D)118 # tot must equal 8 exactly119 if not tot.as_expr().equals(8): ok4 = False120 # num must equal 4*(zeta^D + zeta^-D), i.e. E = cos(2 pi D / 80)121 tgt = (4*zpow(D) + 4*zpow(-D)) % PHI122 if not (num - tgt).is_zero: ok4 = False123 # C5: shadows in F_641: w reduces via zeta -> g^8 to |1 +- g^{8D}|^2-shadow124 for (al, be), wp in w.items():125 sh = sum(int(c) * pow(red8, m[0], p) for m, c in zip(wp.monoms(), wp.coeffs())) % p126 sgn = 1 if (al+be) % 2 == 0 else -1127 lamp = pow(red8, D, p)128 # carrier-internal: (1+sgn*lam)(1+sgn*lam^{-1}) mod p129 direct = ((1 + sgn*lamp) * (1 + sgn*pow(lamp, p-2, p))) % p130 if sh != direct: ok5 = False131 # C6: marginals: w(al,0)+w(al,1) = 4 exactly, independent of D132 for al in (0, 1):133 marg = (w[(al, 0)] + w[(al, 1)]) % PHI134 if not marg.as_expr().equals(4): ok6 = False135report('C4: E(Delta) = cos(pi Delta/40) exactly, all 80 settings (Z[zeta_80])', ok4)136report('C5: composite reduction commutes, Z[zeta_80] -> F_641 on all weights', ok5)137report('C6: no-signalling: marginals = 1/2 exactly, independent of the far setting', ok6)138139# ---------------- C7: exhaustive CHSH sweep ----------------140Ev = np.cos(2*np.pi*np.arange(80)/80) # exact values' float image141best, worst = -10.0, 10.0142arg = None143for d1 in range(80):144 for d2 in range(80):145 for d3 in range(80):146 d4 = (d2 + d3 - d1) % 80 # Delta_4 = Delta_2+Delta_3-Delta_1147 S = Ev[d1] + Ev[d2] + Ev[d3] - Ev[d4]148 if S > best: best, arg = S, (d1, d2, d3, d4)149 if S < worst: worst = S150ts = 2*np.sqrt(2)151report('C7: exhaustive sweep (80^3): max S = 2*sqrt(2) to 1e-12 (got %.12f at %s); '152 'never exceeded' % (best, str(arg)),153 abs(best - ts) < 1e-12 and best <= ts + 1e-12 and abs(worst + ts) < 1e-12)154report('C7: native Bell violation: S = %.12f > 2 strictly' % best, best > 2 + 0.7)155156# ---------------- C8: exact Tsirelson saturation in Z[zeta_8] ----------------157# optimum e.g. at Delta = (70, 10, 10, 30) (settings j = 0, 20; 10, 70):158# E = cos(pi/4) thrice, -cos(3pi/4) once.159PHI8 = Poly(x**4 + 1, x) # Phi_8160z8 = Poly(x, x)161def z8pow(k): return Poly(x, x)**(k % 8) % PHI8162S8 = (z8pow(1) + z8pow(-1))*Rational(1, 2)*3 - (z8pow(3) + z8pow(-3))*Rational(1, 2)163S8 = S8 % PHI8164tgt = (2*(z8pow(1) + z8pow(-1))) % PHI8165report('C8: S = 2(zeta_8 + zeta_8^{-1}) = 2*sqrt(2) exactly in Z[zeta_8]',166 (S8 - tgt).is_zero)167S2 = zmul(Poly(S8, x), Poly(S8, x)) % PHI8168report('C8: S^2 = 8 as a ring identity', S2.as_expr().equals(8))169170print('composite: all checks passed')171172# ============ U1-U6: the unequal-cycle gate (Prop. prop:unequal) ============173def order2(a, mod):174 x, k = 1, 0175 while True:176 x, k = (x*a) % mod, k+1177 if x == 1:178 return k179## Native instance on F_421: the S_61 x O_29 cycle pair (C_60, C_28).180## (U1) admissibility: 421 = 4*105+1, g = 2 primitive; 60,28 | 420;181## gcd(60,28) = 4 = |Q4|; lcm(60,28) = 420;182## (U2) unit-winding joint orbit has length exactly 420; sector count183## 1680/420 = 4 = gcd; the gcd-offset (a - b mod 4) is conserved along184## the full recurrence and the four sectors partition A evenly;185## (U3) T' = lcm(n_j/gcd(s_j,n_j)) exact for all 1680 winding vectors;186## (U4) exactly 4 joint characters are orbit-trivial (the sector labels);187## all 1676 others cancel over one recurrence (exact exponent counting:188## uniform cover of the d-divisible residues, d = gcd(e,420));189## (U5) carrier-internal reduction: nontrivial character sums vanish in F_421;190## (U6) Born window guard for the worked pair state: 16 < 421.191from math import lcm as _lcm192193pU, gU = 421, 2194NU = pU - 1195n1, n2 = 60, 28196report('U1: 421 = 4*105+1, g = 2 primitive; 60,28 | 420; gcd = 4 = |Q4|; lcm = 420',197 pU % 4 == 1 and order2(gU, pU) == NU and NU % n1 == 0 and NU % n2 == 0198 and gcd(n1, n2) == 4 and _lcm(n1, n2) == 420)199200T = _lcm(n1, n2)201orbit = set()202a, b = 0, 0203for _ in range(T):204 orbit.add((a, b))205 a, b = (a+1) % n1, (b+1) % n2206sectors = {}207for a0 in range(n1):208 for b0 in range(n2):209 sectors.setdefault((a0-b0) % 4, 0)210 sectors[(a0-b0) % 4] += 1211a, b = 7, 3212lab = (a-b) % 4213ok_cons = True214for _ in range(T):215 a, b = (a+1) % n1, (b+1) % n2216 ok_cons = ok_cons and (a-b) % 4 == lab217report('U2: joint orbit length 420; sectors 1680/420 = 4; gcd-offset conserved; '218 'even partition (420 each)',219 len(orbit) == T and (n1*n2)//T == 4 and ok_cons220 and sorted(sectors.keys()) == [0, 1, 2, 3]221 and all(c == 420 for c in sectors.values()))222223ok = True224for s1 in range(n1):225 for s2 in range(n2):226 Tp = _lcm(n1//gcd(s1, n1), n2//gcd(s2, n2))227 a, b, t = 0, 0, 0228 while True:229 a, b, t = (a+s1) % n1, (b+s2) % n2, t+1230 if (a, b) == (0, 0):231 break232 ok = ok and t == Tp233report("U3: T' = lcm(n_j/gcd(s_j,n_j)) exact for all 1680 winding vectors", ok)234235triv = nontriv = 0236for k1 in range(n1):237 for k2 in range(n2):238 if (7*k1 + 15*k2) % 420 == 0:239 triv += 1240 else:241 nontriv += 1242ok = True243for (k1, k2) in [(1, 0), (0, 1), (7, 3), (59, 27), (30, 14), (2, 25)]:244 e = (7*k1 + 15*k2) % 420245 if e == 0:246 continue247 d = gcd(e, 420)248 hits = {}249 for t in range(420):250 hits[(e*t) % 420] = hits.get((e*t) % 420, 0) + 1251 ok = ok and set(hits.keys()) == set(range(0, 420, d)) \252 and all(c == d for c in hits.values())253report('U4: 4 orbit-trivial characters (sector labels); 1676 nontrivial; '254 'sampled nontrivial characters cancel exactly', triv == 4 and nontriv == 1676 and ok)255256ok = True257for k in [1, 3, 10, 100]:258 tot, x, z = 0, 1, pow(gU, k, pU)259 for _ in range(420):260 tot = (tot + x) % pU261 x = (x*z) % pU262 ok = ok and (tot == 0) == (k % 420 != 0)263report('U5: carrier-internal reduction: nontrivial character sums vanish in F_421', ok)264265report('U6: Born window guard 4*||psi||^2 = 16 < 421 for the worked pair state', 16 < 421)266print('composite (incl. unequal-cycle U-block): all checks passed')267