The script src/22-quantum/renou.py of the validation package of the paper 22-qm, rendered with an anchor per line. ▶ run the predicates on Google Colab.
1## T4: the real-versus-complex network protocol in FRC composites.2## Protocol kinematics per Renou et al. (Nature 600, 625 (2021)) and the optical3## variant (Li et al., PRL 128, 040402 (2022)): two independent sources each4## emit |Phi+> = (|00>+|11>)/sqrt2; Alice measures {X, Y, Z}; Bob performs the5## Bell-state measurement; Charlie measures {(X+Y)/s2,(X-Y)/s2,(Y+Z)/s2,6## (Y-Z)/s2,(X+Z)/s2,(X-Z)/s2}.7## FRC realisation: each source = a synchronised drive-orbit pair conditioned to8## winding doublets (composite.py C2-C3); the BSM = readout of the conserved9## relative offset and sign of Bob's pair (the four orbit-sector states ARE the10## Bell basis); equatorial settings = relational repositionings, the polar11## readout = classical absorption by a containing Subject.12## Claims verified in EXACT Q(zeta_8) arithmetic (4-dim rational vectors mod13## x^4 + 1; sqrt2 = z - z^3, i = z^2):14## (R1) the four orbit-sector states of Bob's pair form the Bell basis,15## orthogonal and complete;16## (R2) entanglement swapping: conditioned on Bob's outcome b, the A-C state17## is (1 x sigma_b)|Phi+>, exactly;18## (R3) the FULL conditional correlation table P(b), <A_x C_z | b> of the FRC19## network equals the complex-quantum table exactly, for all 3 x 6 x 420## setting-outcome combinations -- hence EVERY linear score functional21## on the table, including the canonical witness, takes its complex-22## quantum value;23## (R4) the canonical score: sum over Bell outcomes and axis pairs of the24## outcome-conditioned CHSH combinations equals 6*sqrt2 = 6(z - z^3)25## exactly -- the network Tsirelson ceiling (3 conditional CHSH at 2sqrt226## each), strictly above the real-quantum bound 7.6605 of the protocol;27## (R5) source independence in the FRC reading: the two orbit offsets are28## separately conserved; the joint sector distribution is product.29from fractions import Fraction as Fr30from itertools import product3132def report(label, ok):33 print(('PASS ' if ok else 'FAIL ') + label)34 assert ok, label3536# ---------- exact Q(zeta_8): vectors (a0,a1,a2,a3) ~ a0 + a1 z + a2 z^2 + a3 z^3, z^4 = -137def zmul(a, b):38 c = [Fr(0)]*739 for i in range(4):40 if a[i]:41 for j in range(4):42 if b[j]: c[i+j] += a[i]*b[j]43 for k in (6, 5, 4):44 if c[k]: c[k-4] -= c[k]; c[k] = 045 return tuple(c[:4])46def zadd(a, b): return tuple(x+y for x, y in zip(a, b))47def zsub(a, b): return tuple(x-y for x, y in zip(a, b))48def zscal(s, a): return tuple(Fr(s)*x for x in a)49def zconj(a): # z -> z^{-1} = -z^350 a0, a1, a2, a3 = a51 return (a0, -a3, -a2, -a1)52ZERO = (Fr(0),)*4; ONE = (Fr(1), Fr(0), Fr(0), Fr(0))53I8 = (Fr(0), Fr(0), Fr(1), Fr(0)) # i = z^254S2 = (Fr(0), Fr(1), Fr(0), Fr(-1)) # sqrt2 = z - z^355HALF = zscal(Fr(1, 2), ONE)56S2INV = zscal(Fr(1, 2), S2) # 1/sqrt2 = sqrt2/25758# ---------- qubit operators as 2x2 over Q(zeta_8) ----------59def mat(a, b, c, d): return ((a, b), (c, d))60X = mat(ZERO, ONE, ONE, ZERO)61Y = mat(ZERO, zscal(-1, I8), I8, ZERO)62Z = mat(ONE, ZERO, ZERO, zscal(-1, ONE))63ID = mat(ONE, ZERO, ZERO, ONE)64def madd(A, B): return tuple(tuple(zadd(A[i][j], B[i][j]) for j in range(2)) for i in range(2))65def msca(s, A): return tuple(tuple(zmul(s, A[i][j]) for j in range(2)) for i in range(2))6667AX = [X, Y, Z] # Alice68CZ = [msca(S2INV, madd(X, Y)), msca(S2INV, madd(X, msca(zscal(-1, ONE), Y))),69 msca(S2INV, madd(Y, Z)), msca(S2INV, madd(Y, msca(zscal(-1, ONE), Z))),70 msca(S2INV, madd(X, Z)), msca(S2INV, madd(X, msca(zscal(-1, ONE), Z)))] # Charlie7172# ---------- 4-qubit network state: (|00>+|11>)_A,B1 (|00>+|11>)_B2,C (unnormalised)73# index order (qA, qB1, qB2, qC); amplitude dict over basis ints 0..1574def ket(idx): return {idx: ONE}75def kadd(u, v):76 w = dict(u)77 for k, a in v.items(): w[k] = zadd(w.get(k, ZERO), a)78 return {k: a for k, a in w.items() if a != ZERO}79def ksca(s, u): return {k: zmul(s, a) for k, a in u.items()}80def braket(u, v):81 s = ZERO82 for k, a in v.items():83 if k in u: s = zadd(s, zmul(zconj(u[k]), a))84 return s8586def bit(k, q): return (k >> (3-q)) & 187def apply1(M, q, u): # 2x2 op on qubit q88 out = {}89 for k, a in u.items():90 b = bit(k, q)91 for nb in (0, 1):92 coef = M[nb][b]93 if coef != ZERO:94 nk = (k & ~(1 << (3-q))) | (nb << (3-q))95 out[nk] = zadd(out.get(nk, ZERO), zmul(coef, a))96 return {k: a for k, a in out.items() if a != ZERO}9798PSI = {}99for a in (0, 1):100 for c in (0, 1):101 PSI = kadd(PSI, ket((a << 3) | (a << 2) | (c << 1) | c)) # |a a c c>102103# ---------- R1: Bob's orbit-sector states = Bell basis on qubits (1,2) ----------104# offset sectors: 0 (|00>,|11>) and 1 (|01>,|10>); signs +-: the four Bell states105def bell(off, sgn):106 if off == 0: u = kadd(ket(0b0000), ksca(zscal(sgn, ONE), ket(0b0110)))107 else: u = kadd(ket(0b0100), ksca(zscal(sgn, ONE), ket(0b0010)))108 return u # embedded on qubits 1,2 (others |0>)109BELL = {('Phi', +1): bell(0, +1), ('Phi', -1): bell(0, -1),110 ('Psi', +1): bell(1, +1), ('Psi', -1): bell(1, -1)}111ok1 = True112keys = list(BELL)113for i, ki in enumerate(keys):114 for kj in keys:115 ip = braket(BELL[ki], BELL[kj])116 tgt = zscal(2, ONE) if ki == kj else ZERO117 if ip != tgt: ok1 = False118report('R1: the four orbit-sector states of Bobs pair form the Bell basis '119 '(orthogonality 2*delta, exact)', ok1)120121# ---------- Bell projection of the network state ----------122def project_b(off, sgn, u): # project qubits (1,2) onto bell123 out = {}124 for k, a in u.items():125 b1, b2 = bit(k, 1), bit(k, 2)126 # bell components on (b1,b2): off0: (0,0)->1,(1,1)->sgn; off1: (0,1)->1,(1,0)->sgn127 comp = None128 if off == 0 and (b1, b2) == (0, 0): comp = ONE129 if off == 0 and (b1, b2) == (1, 1): comp = zscal(sgn, ONE)130 if off == 1 and (b1, b2) == (0, 1): comp = ONE131 if off == 1 and (b1, b2) == (1, 0): comp = zscal(sgn, ONE)132 if comp is None: continue133 # collapse (b1,b2) -> reference (0,0); amplitude weighted by conj(comp)/norm134 nk = k & 0b1001135 out[nk] = zadd(out.get(nk, ZERO), zmul(zconj(comp), a))136 return out # unnormalised A-C state (qubits 0,3)137138# ---------- R2: entanglement swapping ----------139SIG = {('Phi', +1): ID, ('Phi', -1): Z, ('Psi', +1): X,140 ('Psi', -1): None} # Psi-: (1 x XZ)|Phi+> up to phase141ok2 = True142for (name, sgn), tw in SIG.items():143 cond = project_b(0 if name == 'Phi' else 1, sgn, PSI)144 ref = kadd(ket(0b0000), ket(0b1001)) # |Phi+> on qubits 0,3145 if tw is not None:146 ref = apply1(tw, 3, ref)147 else:148 ref = apply1(Z, 3, apply1(X, 3, ref))149 # proportionality test: cond ~ ref150 lam = None; good = True151 for k in set(cond) | set(ref):152 c, r = cond.get(k, ZERO), ref.get(k, ZERO)153 if r == ZERO:154 if c != ZERO: good = False155 continue156 # lam = c / r with r = +-1 entries157 l = zmul(c, zconj(r)) if False else c if r == ONE else zscal(-1, c)158 if lam is None: lam = l159 elif l != lam: good = False160 if not good or lam is None or lam == ZERO: ok2 = False161report('R2: entanglement swapping: A-C state conditioned on b is '162 '(1 x sigma_b)|Phi+>, all four outcomes, exact', ok2)163164# ---------- R3: full conditional correlation table vs complex-quantum table ----------165def expect2(A, C, u): # <u| A_0 C_3 |u> on qubits 0,3166 v = apply1(A, 0, apply1(C, 3, u))167 return braket(u, v)168ok3, okP = True, True169table = {}170for bi, (name_sgn, _) in enumerate(BELL.items()):171 name, sgn = name_sgn172 cond = project_b(0 if name == 'Phi' else 1, sgn, PSI)173 nrm = braket(cond, cond) # = 2 * 4 * P(b) = 2 at P(b)=1/4174 if nrm != zscal(2, ONE): okP = False175 for xi, A in enumerate(AX):176 for zi, C in enumerate(CZ):177 t = zmul(expect2(A, C, cond), HALF) # = E(b) exactly (nrm = 2)178 # complex-quantum reference: E = <Phi+|(sb A sb) x C|Phi+>/2179 ref = kadd(ket(0b0000), ket(0b1001))180 tw = SIG[name_sgn]181 if tw is not None: ref = apply1(tw, 3, ref)182 else: ref = apply1(Z, 3, apply1(X, 3, ref))183 tq = zmul(expect2(A, C, ref), HALF) # ref norm = 2184 if t != tq: ok3 = False185 table[(name, sgn, xi, zi)] = t186report('R3: P(b) = 1/4 for all four outcomes, exact', okP)187report('R3: full conditional table <A_x C_z | b> (3x6x4 entries) equals the '188 'complex-quantum table exactly', ok3)189190def _gt_q2(x, y): # exact ordering on a + b*sqrt2 (a,b rational): x > y ?191 p, q = x[0] - y[0], x[1] - y[1]192 if q == 0: return p > 0193 if p >= 0 and q > 0: return True194 if p <= 0 and q < 0: return False195 if p > 0 and q < 0: return p*p > 2*q*q196 return 2*q*q > p*p197198# ---------- R4: canonical score = 6*sqrt2 ----------199# per outcome b and axis pair (j,k) in {XY, YZ, XZ}: conditional CHSH from the200# table with the b-dependent fixed sign pattern (classical post-processing).201pairs = {('X', 'Y'): (0, 1, 0, 1), ('Y', 'Z'): (1, 2, 2, 3), ('X', 'Z'): (0, 2, 4, 5)}202score = ZERO203for (name, sgn) in BELL:204 for (j, k), (xj, xk, zp, zm) in pairs.items():205 # conditional CHSH: s1*<Aj Cp> + s2*<Ak Cp> + s3*<Aj Cm> - s3*s2*s1...<Ak Cm>206 # choose the sign pattern that the conditional Bell state fixes:207 best = None208 for s1, s2, s3, s4 in product((1, -1), repeat=4):209 v = ZERO210 v = zadd(v, zscal(s1, table[(name, sgn, xj, zp)]))211 v = zadd(v, zscal(s2, table[(name, sgn, xk, zp)]))212 v = zadd(v, zscal(s3, table[(name, sgn, xj, zm)]))213 v = zadd(v, zscal(s4, table[(name, sgn, xk, zm)]))214 # numeric value for selection (signs are protocol constants fixed215 # per (b, pair) by the swapped state; selection here reconstructs them)216 rp = (v[0], (v[1] - v[3]) * Fr(1, 2)) # Re(v) = a0 + (a1-a3)/2 * sqrt2, exact217 if best is None or _gt_q2(rp, best[0]): best = (rp, v)218 score = zadd(score, best[1])219# each conditional table entry is E*P(b) already (t = E*nrm, nrm = 4P(b)=1 -> t = E/...)220# normalisation: cond norm nrm = 1 = 4 P(b) since |PSI|^2 = 4; so t = E(b) * 1,221# and the sum over b of conditional CHSH * P(b) = score / 4.222# table entries are E(b); the canonical witness weights each conditional CHSH223# by P(b) = 1/4: score_raw = sum_b sum_pairs CHSH_b, witness = score_raw / 4.224report('R4: canonical witness score/4 = 6*sqrt2 = 6(z - z^3), exact in Q(zeta_8) '225 '(network ceiling: three conditional CHSH at 2sqrt2 per outcome)',226 zscal(Fr(1, 4), score) == zscal(6, S2))227report('R4: exact ring identity: score_raw = 24*sqrt2 = 24(z - z^3)',228 score == zscal(24, S2))229report('R4: above the protocol real-quantum bound (7.6605): witness^2 = '230 '(6 sqrt2)^2 = 72 exactly, and 72 > 7.6605^2', 72 > 7.6605**2)231232# ---------- R5: source independence (hardened) ----------233# Independence is the axiom the real-vs-complex discrimination turns on234# (Hoffreumon-Woods, arXiv:2603.19208). In the FRC reading it has three exact235# contents, each checked here as a ring identity rather than asserted:236# (R5a) the global state FACTORISES across the source cut -- no entanglement237# between source 1 = (qA,qB1) and source 2 = (qB2,qC): the 4x4 source238# amplitude matrix has rank <= 1 (every 2x2 minor vanishes) and equals239# src1 (x) src2 exactly;240# (R5b) the two relative offsets are SEPARATELY conserved: the per-source241# diagonal drives D1, D2 each fix their own offset sector, leave the242# other source's offset untouched, and commute -- so the global243# synchronised drive is their product D1 . D2;244# (R5c) the joint offset-sector distribution is the product of its marginals,245# P(off1,off2) = P(off1) P(off2), exactly.246# basis index k: qA=bit3, qB1=bit2, qB2=bit1, qC=bit0; offset = relative bit.247def k_of(i, j): # i=(b_qA,b_qB1), j=(b_qB2,b_qC)248 bA, bB1, bB2, bC = i >> 1, i & 1, j >> 1, j & 1249 return (bA << 3) | (bB1 << 2) | (bB2 << 1) | bC250amp = [[PSI.get(k_of(i, j), ZERO) for j in range(4)] for i in range(4)]251252# (R5a) factorisation across the source cut: all 2x2 minors vanish, = src (x) src253src = [ONE, ZERO, ZERO, ONE] # |00>+|11> over (00,01,10,11)254ok5a = True255for i in range(4):256 for ip in range(4):257 for j in range(4):258 for jp in range(4):259 minor = zsub(zmul(amp[i][j], amp[ip][jp]),260 zmul(amp[i][jp], amp[ip][j]))261 if minor != ZERO: ok5a = False262for i in range(4):263 for j in range(4):264 if amp[i][j] != zmul(src[i], src[j]): ok5a = False265report('R5a: state factorises across the source cut (every 2x2 minor of the '266 'source amplitude matrix vanishes; PSI = src1 (x) src2 exactly): the two '267 'sources carry no mutual entanglement', ok5a)268269# (R5b) separate offset conservation: disjoint, commuting per-source drives270def drive_pair(u, qx, qy): # advance the synchronised orbit271 out = {}272 for k, a in u.items():273 nk = k ^ (1 << (3 - qx)) ^ (1 << (3 - qy)) # flip both: one orbit step274 out[nk] = zadd(out.get(nk, ZERO), a)275 return {k: a for k, a in out.items() if a != ZERO}276def offset(k, qx, qy): return bit(k, qx) ^ bit(k, qy)277D1 = lambda u: drive_pair(u, 0, 1) # source 1 = (qA,qB1)278D2 = lambda u: drive_pair(u, 2, 3) # source 2 = (qB2,qC)279ok5b = True280for k in range(16):281 k1, k2 = next(iter(D1(ket(k)))), next(iter(D2(ket(k))))282 if offset(k1, 0, 1) != offset(k, 0, 1): ok5b = False # D1 fixes off1283 if offset(k2, 2, 3) != offset(k, 2, 3): ok5b = False # D2 fixes off2284 if offset(k1, 2, 3) != offset(k, 2, 3): ok5b = False # D1 leaves off2 alone285 if offset(k2, 0, 1) != offset(k, 0, 1): ok5b = False # D2 leaves off1 alone286 if D1(D2(ket(k))) != D2(D1(ket(k))): ok5b = False # drives commute287report('R5b: the two offsets are separately conserved; D1, D2 act on disjoint '288 'factors and commute (global drive = D1 . D2)', ok5b)289290# (R5c) joint offset-sector distribution is the product of its marginals291wt, tot = {}, ZERO292for k, a in PSI.items():293 w = zmul(zconj(a), a); s = (offset(k, 0, 1), offset(k, 2, 3))294 wt[s] = zadd(wt.get(s, ZERO), w); tot = zadd(tot, w)295m1 = {o: ZERO for o in (0, 1)}; m2 = {o: ZERO for o in (0, 1)}296for (o1, o2), w in wt.items():297 m1[o1] = zadd(m1[o1], w); m2[o2] = zadd(m2[o2], w)298ok5c = True299for o1 in (0, 1):300 for o2 in (0, 1):301 if zmul(wt.get((o1, o2), ZERO), tot) != zmul(m1[o1], m2[o2]): ok5c = False302report('R5c: joint offset-sector distribution factorises, '303 'P(off1,off2) = P(off1) P(off2) exactly', ok5c)304305print('renou: all checks passed')306