The script src/22-quantum/transport.py of the validation package of the paper 22-qm, rendered with an anchor per line. ▶ run the predicates on Google Colab.
1## Quarter-turn transport (Lemma lem:transport): for an embedded cycle C_n of2## the phase cycle of F_P (n = 4*kappa_n dividing P-1 = 4*kappa), the winding3## reduction Pi: g^a -> g_n^{a mod n} carries the ambient quarter-turn4## i = g^{-kappa} onto the shell label i_n = g_n^{-kappa_n} iff5## kappa = kappa_n (mod n); onto the conjugate -i_n iff kappa = -kappa_n6## (mod n); and onto a half-turn-preserving image iff kappa = +-kappa_n7## (mod n). kappa mod 4 is the coarsest transport invariant.8## Instances (all exact, criterion checked against the computed elements):9## (K1) F_157 -> C_12: kappa = 39 = 3 = kappa_12 (mod 12): faithful;10## (K2) F_421 -> C_12: 105 = 9 = -3 (mod 12): conjugate;11## (K3) F_421 -> C_60 and C_28: both conjugate (105 = -15 mod 60; = -7 mod 28);12## (K4) F_421 -> C_4 = Q4: faithful (105 = 1 mod 4);13## (K5) F_641 -> C_40: 160 = 0 (mod 40): Pi(i) = 1, even the half-turn fails;14## (K6) F_157 -> C_52: 39 = -13 (mod 52): conjugate.15def report(label, ok):16 print(('PASS ' if ok else 'FAIL ') + label)17 assert ok, label1819def order(a, mod):20 x, k = 1, 021 while True:22 x, k = (x*a) % mod, k+123 if x == 1:24 return k2526def transport(P, g, n):27 N = P - 128 kap, kn = N // 4, n // 429 assert P % 4 == 1 and N % n == 0 and n % 4 == 0 and order(g, P) == N30 gS = pow(g, N//n, P)31 i_n = pow(gS, n - kn, P) # i_n = gS^{-kappa_n}32 Pi_i = pow(gS, (N - kap) % n, P) # Pi(i) = gS^{-kappa mod n}33 faithful = kap % n == kn % n34 conjugate = kap % n == (n - kn) % n35 half = kap % (n//2) == kn % (n//2)36 okA = (Pi_i == i_n) == faithful37 okB = (Pi_i == P - i_n) == conjugate38 okC = ((Pi_i * Pi_i) % P == P - 1) == half39 return okA and okB and okC, faithful, conjugate, half, Pi_i4041ok, f, c, h, _ = transport(157, 5, 12)42report('K1: F_157 -> C_12: 39 = 3 = kappa_12 (mod 12): Pi(i) = i_12, faithful',43 ok and f and not c)44ok, f, c, h, _ = transport(421, 2, 12)45report('K2: F_421 -> C_12: 105 = 9 = -3 (mod 12): Pi(i) = -i_12, conjugate',46 ok and (not f) and c and h)47o1 = transport(421, 2, 60); o2 = transport(421, 2, 28)48report('K3: F_421 -> C_60, C_28: both conjugate charts',49 o1[0] and (not o1[1]) and o1[2] and o2[0] and (not o2[1]) and o2[2])50ok, f, c, h, _ = transport(421, 2, 4)51report('K4: F_421 -> C_4 = Q4: 105 = 1 (mod 4): faithful', ok and f)52ok, f, c, h, Pi_i = transport(641, 3, 40)53report('K5: F_641 -> C_40: 160 = 0 (mod 40): Pi(i) = 1, half-turn fails',54 ok and (not f) and (not c) and (not h) and Pi_i == 1)55ok, f, c, h, _ = transport(157, 5, 52)56report('K6: F_157 -> C_52: 39 = -13 (mod 52): Pi(i) = -i_52, conjugate',57 ok and (not f) and c and h)58print('transport: all checks passed')59