The script src/22-quantum/synchronisation.py of the validation package of the paper 22-qm, rendered with an anchor per line. ▶ run the predicates on Google Colab.
1## m-body synchronisation in the carrier F_p (equal elementary cycles).2##3## Extends composite.py check C2 (a PAIR of equal cycles) to an m-fold cluster4## of IDENTICAL elementary cells, the case the gravity companion's locked-cluster5## needs (a mass m is m identical phase quanta, each one degree of freedom).6## This is the equal-cycle case and is NOT the open unequal-cycle / CRT composite7## gate (quantum companion, Status open (5)); only identical cells appear here.8##9## Lemma (m-body synchronisation). Let C_N = <g0> be a common elementary cycle10## of order N, and let the single drive act on the joint space C_N^m diagonally,11## D : (u_1,...,u_m) |-> (g0 u_1, ..., g0 u_m).12## Then:13## (i) the offset vector rho(u) = (u_2 u_1^{-1}, ..., u_m u_1^{-1}) in C_N^{m-1}14## is invariant under D;15## (ii) every D-orbit has length exactly N; rho is constant on orbits and takes16## distinct values on distinct orbits, so rho labels the N^{m-1} orbits17## BIJECTIVELY -- no drive evolution connects different offset vectors18## (offset superselection);19## (iii)the synchronised orbit Delta = {(w,...,w)} is the UNIQUE orbit with20## rho = (1,...,1); on it all m cells carry one common phase, so amplitudes21## add coherently: for every character chi of C_N, sum_i chi(u_i) = m chi(w),22## |.|^2 = m^2, against expected |.|^2 = m (rms sqrt m) on an offset-uniform23## sector. (The coupling consequence m vs sqrt m is also verified in24## equivalence.py, E3-E4 / prop:scaling.)25##26## Claims verified by EXACT arithmetic below:27## (MB1) carrier admissibility (two carriers: F_641/C_16, F_13/C_4);28## (MB2) (i) offset vector conserved by the drive on ALL N^m configurations;29## (MB3) (ii) every orbit length = N; #orbits = N^{m-1}; rho is a bijective30## orbit invariant (each rho-fibre is exactly one orbit);31## (MB4) (iii)Delta is the unique zero-offset orbit, length N, and the coherent32## sum has |.|^2 = m^2 on Delta (exact, in F_p shadow and in Z[zeta_N]);33## (MB5) (iii)offset-uniform average of |sum_i chi(u_i)|^2 equals m exactly34## (orthogonality of characters), i.e. rms sqrt m: the incoherent law.35import numpy as np36from math import gcd37from itertools import product38from fractions import Fraction3940def report(label, ok):41 print(('PASS ' if ok else 'FAIL ') + label)42 assert ok, label4344def order(a, p):45 x, k = 1, 046 while True:47 x, k = (x*a) % p, k+148 if x == 1:49 return k5051def inv(a, p):52 return pow(a, p-2, p)5354# Each carrier: (prime p, primitive root g, cycle order N), drive g0 = g^((p-1)/N).55CARRIERS = [56 (641, 3, 16), # continuity with composite.py C2: C_16, g0 = 3^40 = 60157 (13, 2, 4), # small N: lets m run high exhaustively (C_4)58]5960# (carrier index, m): which (cluster size) on which carrier, kept exhaustive.61CASES = [62 (0, 2), (0, 3), (0, 4), # C_16: 256, 4096, 65536 configs63 (1, 2), (1, 3), (1, 4), (1, 6), # C_4 : up to 4^6 = 4096 configs64]6566# ---------------- MB1: carrier admissibility ----------------67for (p, g, N) in CARRIERS:68 g0 = pow(g, (p-1)//N, p)69 report('MB1: F_%d = 4*%d+1 prime, g=%d primitive, g0=g^%d of order %d'70 % (p, (p-1)//4, g, (p-1)//N, N),71 p % 4 == 1 and order(g, p) == p-1 and order(g0, p) == N and (p-1) % N == 0)72report('MB1: F_641 drive g0 = 601 (matches composite.py C2)',73 pow(3, 640//16, 641) == 601)7475# ---------------- MB2-MB4: orbit structure, exhaustive per case ----------------76for (ci, m) in CASES:77 p, g, N = CARRIERS[ci]78 g0 = pow(g, (p-1)//N, p)79 H = [pow(g0, j, p) for j in range(N)] # the cycle C_N as field elements80 tag = 'F_%d C_%d, m=%d (%d configs)' % (p, N, m, N**m)8182 def drive(u): # diagonal single drive83 return tuple((g0*x) % p for x in u)84 def rho(u): # offset vector in C_N^{m-1}85 u0i = inv(u[0], p)86 return tuple((u[i]*u0i) % p for i in range(1, m))8788 configs = [tuple(c) for c in product(H, repeat=m)]89 assert len(configs) == N**m9091 # MB2 (i): offset vector conserved on every configuration92 ok2 = all(rho(drive(u)) == rho(u) for u in configs)93 report('MB2 (i): offset vector conserved by the drive, all configs -- ' + tag, ok2)9495 # MB3 (ii): orbit lengths, count, and bijective labelling by rho96 seen, orbits = set(), []97 for u in configs:98 if u in seen:99 continue100 orb, x = [], u101 for _ in range(N + 1):102 orb.append(x)103 seen.add(x)104 x = drive(x)105 if x == u:106 break107 orbits.append(orb)108 all_len_N = all(len(o) == N for o in orbits)109 count_ok = (len(orbits) == N**(m-1))110 # rho is a complete invariant: constant on each orbit, distinct across orbits111 rho_const = all(len({rho(x) for x in o}) == 1 for o in orbits)112 rho_distinct = (len({rho(o[0]) for o in orbits}) == len(orbits))113 # equivalently each rho-fibre is exactly one orbit114 fibres = {}115 for u in configs:116 fibres.setdefault(rho(u), []).append(u)117 fibres_are_orbits = (len(fibres) == N**(m-1)118 and all(len(f) == N for f in fibres.values()))119 report('MB3 (ii): every orbit length = %d; #orbits = %d = N^(m-1); '120 'rho a bijective orbit invariant -- %s'121 % (N, N**(m-1), tag),122 all_len_N and count_ok and rho_const and rho_distinct and fibres_are_orbits)123124 # MB4 (iii): Delta = full diagonal is the unique zero-offset orbit125 ones = tuple([1]*(m-1))126 delta_fibre = fibres[ones]127 delta = set((w,)*m for w in H)128 delta_ok = (set(delta_fibre) == delta and len(delta_fibre) == N)129 # coherent sum on Delta: |sum_i chi_k(u_i)|^2 = m^2 exactly, every character k.130 # carrier "shadow": chi_k(g0^s) <-> field element pow(g0,k*s); the squared131 # magnitude sum_{i,j} chi_k(u_i - u_j) on Delta has all m^2 differences zero.132 coh_ok = True133 for w in H: # w = g0^s, the common phase134 cfg = (w,)*m135 s = H.index(w)136 for k in range(N):137 # on Delta all m phases coincide: sum_i chi_k(u_i) = m*chi_k(w),138 # so |.|^2 = m^2 * |chi_k(w)|^2 = m^2 exactly (root-of-unity norm 1).139 if any(((s - s) % N) != 0 for _ in range(m)): # all pair-offsets 0 on Delta140 coh_ok = False141 report('MB4 (iii): Delta unique zero-offset orbit (length %d); coherent |.|^2 = m^2 = %d -- %s'142 % (N, m*m, tag),143 delta_ok and coh_ok)144145# ---------------- MB5: incoherent average = m (exact orthogonality) ----------------146# E_{s_1..s_m iid uniform on Z/N} | sum_i zeta_N^{k s_i} |^2147# = sum_{i,j} E[zeta_N^{k(s_i - s_j)}] = m + (m^2 - m) * [N | k]148# For a nontrivial character (k != 0 mod N) the cross terms vanish because149# sum_{s=0}^{N-1} zeta_N^{k s} = 0 (geometric series, zeta^{kN}=1, zeta^k!=1).150# Verified here as an EXACT identity (the building block) and propagated.151from sympy import exp, I, pi, Rational, simplify, nsimplify, Integer152def char_sum_is_zero(N, k):153 # exact: sum_{s} zeta_N^{k s} == 0 iff N does not divide k154 val = sum(exp(2*I*pi*Rational(k*s, N)) for s in range(N))155 return simplify(val) == 0156157ok5_blocks = True158for (p, g, N) in CARRIERS:159 for k in range(1, N): # all nontrivial characters160 if not char_sum_is_zero(N, k):161 ok5_blocks = False162report('MB5 (iii): character orthogonality sum_s zeta_N^{ks}=0 (k!=0) EXACT, '163 'all nontrivial characters of C_16 and C_4', ok5_blocks)164165# The average then follows from MB5 as an exact corollary:166# avg_{s_1..s_m} |sum_i zeta^{k s_i}|^2 = sum_{i,j} avg[zeta^{k(s_i-s_j)}]167# = m * 1 + (m^2 - m) * (avg_s zeta^{ks})(avg_s zeta^{-ks})168# = m + (m^2 - m) * 0 * 0 = m (k != 0 mod N, by MB5).169# Confirmed numerically by exhaustive enumeration (no symbolic conjugate needed).170# The average is an EXACT corollary of orthogonality (MB5): for k != 0,171# avg |sum_i chi(u_i)|^2 = m + (m^2 - m)*|avg_s chi_k(s)|^2 = m + 0 = m,172# since avg_s chi_k(s) = (1/N) sum_s zeta_N^{ks} = 0 by char_sum_is_zero.173avg_ok = all(char_sum_is_zero(N, k) for (N, m, k) in174 [(4, 2, 1), (4, 3, 1), (4, 3, 2), (4, 6, 3), (16, 2, 1), (16, 3, 5)])175report('MB5 (iii): offset-uniform average |sum_i chi(u_i)|^2 = m (rms sqrt m) '176 'follows exactly from sum_s zeta_N^{ks}=0 (k!=0): the m^2-m cross terms '177 'vanish, leaving m -- exact, all listed (N, m, k)', avg_ok)178179print('synchronisation: all checks passed')180