The ledger file frc/ledgers/p22_quantum.py of Quantum Observation over Finite Substrate, rendered with an anchor per line: the marked lines (# 22:C2 (p22010): a predicate and its accession key) are the checks that decide the predicates of the paper's predicate ledger — 119 of 119 checks passing; the predicates' theorems are the declarations of Qm in the core. ▶ run the predicates on Google Colab.
1"""p22_quantum — the ledger file of 22-quantum (ledger migration, task LM35, 7 October 2026).23"Quantum Observation over Finite Holographic Substrate" (Akhtman & Voether, 2026, doi 10.20944/preprints202606.1160.v2).4The paper's predicate ledger is docs/22-quantum/22-quantum-ledger.json. This file binds its predicates to the framework:5the table of keys (generated from the ledger by ci/make_ledgers.py) and the checks of seventeen blocks. A block is one6suite of the paper's validation package (src/22-quantum, whose results.json holds one record per suite; served until the7release pin of the paper's milestone, 15 October 2026), and the composite suite is two blocks. Each check names the8predicate(s) it witnesses (LEDGER), under a `# 22:XN (<key>)` marker on the check that decides it (PREDICATES). The9checks compute what the suites compute, record for record, and since 15 October 2026 decide every theorem row of the10paper (the rows C6, C13, C25, X1–X3, X5, X6 had no suite), the Ω rows on the master's anchor (block O, G4), and the11sweep by certified brackets (C7). The Lean side is the quantum theme's Theme/Observation.lean, Theme/Interference.lean12and Theme/Composite.lean, the key files Keys/Quantum.lean, Keys/Extension.lean, Keys/Subject.lean and the13certificates lean/FrcCore/Ledgers/P22Qm.lean and lean/FrcLedger/Ledgers/P22Qm.lean.1415The checks call the quantum theme (frc/quantum.py: the cyclotomic ring ℤ[ζ_n], the partial transpose, the16characteristic polynomial), the extension theme (frc/extension.py: 𝔽_{p²}), the chart theme's certified brackets17(frc/chart.py: the Ω bracket of the scale import, π, √8) and, for the two continuum readings, the chart file18frc/chart_quantum.py. This file itself is exact (gate G09): it compares the chart's numbers with Fractions.1920 python3 -m frc.ledgers.p22_quantum every block, the census; exit 1 if a check fails (≈ 5 s)21 python3 -m frc.ledgers.p22_quantum C one block22 from frc.ledgers.p22_quantum import R; R.predicate("22:C17") one predicate: its blocks run once per session2324Blocks, with the package's suite and its kind:25 V validate the single-system formalism on F_157 and F_421 EXACT (22:C1–C7, C9, C13, C24, X2, X3, X5)26 S sorkin Sorkin nullity, shadows and wrap quantisation EXACT (22:C8, P2, X8)27 D dispersion exact boost transport on F_13 and F_169 EXACT (22:A2, P4)28 C composite the composite gate on F_641, CHSH and Tsirelson EXACT, the sweep CHART by brackets (22:C15–C17, C25, P3, X7)29 U composite the unequal-cycle gate on F_421 EXACT (22:C26)30 M synchronisation the m-body conserved offset EXACT (22:C15)31 R renou the real-versus-complex network over Q(ζ_8) EXACT (22:C18, P3)32 B bmv the gravitational channel over Q(ζ_80) EXACT (22:C19, P1)33 Q decoherence no collapse, dilation dephasing, the registered count EXACT, the envelope CHART (22:C7, C20)34 E equivalence the two scaling laws and the equivalence-principle null EXACT (22:C22)35 G granularity the depth ceiling, at the anchor by bit length EXACT (22:C14, P5)36 T stratum the two probability strata and the framed readout EXACT (22:C10, C11, X1, X6)37 F gravfraction the coherent-fraction channel over ℤ[ζ_16] EXACT (22:C21)38 L gleason uniqueness of the pair tally on the Q4 core EXACT (22:C12)39 O omega the Ω ledger in scale arithmetic EXACT (22:A5, Z2)40 I intersubject inter-Subject consistency on F_421 EXACT (22:C23, X4)41 K transport the quarter-turn transport trichotomy EXACT (22:C27)4243A check is CHART when its verdict is a continuum reading: the sweep decided by certified rational brackets on the44cosines (C7) and the Gaussian envelope at a stated tolerance (Q3). The notebook frc/ledgers/p22_quantum.ipynb runs one45predicate per cell, the cell's id its key (gate G13).46"""47import random48import sys49from fractions import Fraction as Fr50from itertools import combinations, permutations, product51from math import comb, gcd, isqrt, lcm5253from frc import arith54from frc import chart as CH55from frc import chart_quantum as CQ56from frc.extension import Ext57from frc.quantum import Cyclotomic, charpoly, nonneg_spectrum, partial_transpose58from frc.registry import Registry5960# ---- generated by ci/make_ledgers.py from docs/22-quantum/22-quantum-ledger.json; edit the ledger, not this table ----61PAPER = "22-quantum"62KEYS = {"A1": "p22001", "A2": "p22002", "A3": "p22003", "A4": "p22004", "A5": "p22005", "A6": "p22006", "A7": "p22007", "A8": "p22008", "B1": "p22009", "B2": "p22010", "B3": "p22011", "B4": "p22012", "B5": "p22013", "B6": "p22014", "B7": "p22015", "B8": "p22016", "C1": "p22017", "C2": "p22018", "C3": "p22019", "C4": "p22020", "C5": "p22021", "C6": "p22022", "C7": "p22023", "C8": "p22024", "C9": "p22025", "C10": "p22026", "C11": "p22027", "C12": "p22028", "C13": "p22029", "C14": "p22030", "C15": "p22031", "C16": "p22032", "C17": "p22033", "C18": "p22034", "C19": "p22035", "C20": "p22036", "C21": "p22037", "C22": "p22038", "C23": "p22039", "C24": "p22040", "C25": "p22041", "C26": "p22042", "C27": "p22043", "X1": "p22044", "X2": "p22045", "X3": "p22046", "X4": "p22047", "X5": "p22048", "X6": "p22049", "X7": "p22050", "X8": "p22051", "P1": "p22052", "P2": "p22053", "P3": "p22054", "P4": "p22055", "P5": "p22056", "Z1": "p22060", "Z2": "p22061"} # every row of the ledger: its label and its accession key63LEAN = {"A2": "core", "A5": "ml", "C1": "core", "C2": "core", "C3": "core", "C4": "core", "C5": "core", "C6": "core", "C7": "core, ml", "C8": "core, ml", "C9": "core", "C10": "core", "C11": "core", "C12": "core", "C13": "core", "C14": "core, ml", "C15": "core", "C16": "core", "C17": "core, ml", "C18": "core", "C19": "core, ml", "C20": "core", "C21": "core", "C22": "core", "C23": "core", "C24": "core", "C25": "core, ml", "C26": "core", "C27": "core", "X1": "core, ml", "X2": "core", "X3": "core", "X4": "core", "X5": "core", "X6": "core", "X7": "core, ml", "X8": "core, ml", "P1": "core, ml", "P2": "core, ml", "P3": "core, ml", "P4": "core", "P5": "core, ml", "Z2": "ml"} # the rows with a Lean declaration: the libraries whose key files prove them64# ---- end of the generated table ----6566LEAN_ONLY = () # the predicates with a Lean declaration and no python check (gate G12): none6768# The paper's predicate ledger (predicates cited as 22:XN): the predicate(s) each check witnesses.69LEDGER = {70 "V1": "22:C24", "V2": "22:C3", "V3": "22:C4", "V4": "22:C1, 22:C2", "V5": "22:C3, 22:X3", "V6": "22:C3, 22:C7",71 "V7": "22:C9", "V8": "22:C5", "V9": "22:C4, 22:C7", "V10": "22:C9", "V11": "22:C24", "V12": "22:C4", "V13": "22:C24, 22:X5",72 "V14": "22:C6", "V15": "22:C13, 22:X2", "V16": "22:C7, 22:X1",73 "S1": "22:C8, 22:X8", "S2": "22:P2, 22:C8", "S3": "22:P2, 22:X8",74 "D1": "22:A2", "D2": "22:A2", "D3": "22:A2", "D4": "22:P4", "D5": "22:P4", "D6": "22:P4", "D7": "22:P4", "D8": "22:P4",75 "C1": "22:C15", "C2": "22:C15", "C3": "22:C16", "C4": "22:C17", "C5": "22:C17", "C6": "22:C17",76 "C7": "22:C17, 22:P3", "C8": "22:X7, 22:C17, 22:P3, 22:C25",77 "U1": "22:C26", "U2": "22:C26", "U3": "22:C26", "U4": "22:C26", "U5": "22:C26", "U6": "22:C26",78 "M1": "22:C15", "M2": "22:C15", "M3": "22:C15", "M4": "22:C15", "M5": "22:C15",79 "R1": "22:C18", "R2": "22:C18", "R3": "22:C18", "R4": "22:P3, 22:C18", "R5": "22:C18",80 "B1": "22:C19", "B2": "22:C19", "B3": "22:C19, 22:P1", "B4": "22:C19", "B5": "22:P1, 22:C19",81 "Q1": "22:C20", "Q2": "22:C20", "Q3": "22:C20", "Q4": "22:C20", "Q5": "22:C7", "Q6": "22:C7", "Q7": "22:C7",82 "E1": "22:C22", "E2": "22:C22", "E3": "22:C22", "E4": "22:C22",83 "G1": "22:C14", "G2": "22:C14", "G3": "22:C14", "G4": "22:P5", "G5": "22:C14, 22:P5", "G6": "22:P5", "G7": "22:C14",84 "T1": "22:C10, 22:X1", "T2": "22:C10", "T3": "22:C10", "T4": "22:C11", "T5": "22:C11, 22:X6", "T6": "22:C11", "T7": "22:C11",85 "T8": "22:C11", "T9": "22:C11", "T10": "22:C11", "T11": "22:C11", "T12": "22:C10",86 "F1": "22:C21", "F2": "22:C21", "F3": "22:C21", "F4": "22:C21", "F5": "22:C21", "F6": "22:C21", "F7": "22:C21",87 "F8": "22:C21", "F9": "22:C21", "F10": "22:C21", "F11": "22:C21", "F12": "22:C21",88 "L1": "22:C12", "L2": "22:C12", "L3": "22:C12", "L4": "22:C12", "L5": "22:C12", "L6": "22:C12", "L7": "22:C12",89 "L8": "22:C12", "L9": "22:C12",90 "O1": "22:A5", "O2": "22:A5", "O3": "22:A5", "O4": "22:Z2",91 "I1": "22:C23", "I2": "22:C23", "I3": "22:C23", "I4": "22:C23", "I5": "22:X4, 22:C23", "I6": "22:X4", "I7": "22:X4",92 "K1": "22:C27",93}9495BLOCK = {"V": "validate: the single-system formalism on F_157 and F_421", # check-id prefix -> the block96 "S": "sorkin: Sorkin nullity, sub-horizon shadows, wrap quantisation",97 "D": "dispersion: exact boost transport on F_13 and F_169",98 "C": "composite: the composite gate on F_641, CHSH and Tsirelson",99 "U": "composite: the unequal-cycle gate on F_421",100 "M": "synchronisation: the m-body conserved offset",101 "R": "renou: the real-versus-complex network over Q(zeta_8)",102 "B": "bmv: the gravitational channel over Q(zeta_80)",103 "Q": "decoherence: no collapse, dilation dephasing, the registered count",104 "E": "equivalence: the two scaling laws and the equivalence-principle null",105 "G": "granularity: the depth ceiling",106 "T": "stratum: the two probability strata and the framed readout",107 "F": "gravfraction: the coherent-fraction channel",108 "L": "gleason: uniqueness of the pair tally",109 "O": "omega: the Omega ledger in scale arithmetic",110 "I": "intersubject: inter-Subject consistency",111 "K": "transport: the quarter-turn transport trichotomy"}112113# the package's suite of each block (the script its results.json record names)114SUITE = {"V": "validate", "S": "sorkin", "D": "dispersion", "C": "composite", "U": "composite", "M": "synchronisation",115 "R": "renou", "B": "bmv", "Q": "decoherence", "E": "equivalence", "G": "granularity", "T": "stratum",116 "F": "gravfraction", "L": "gleason", "O": "omega", "I": "intersubject", "K": "transport"}117118# the deciding check of each witnessed predicate (the other checks that touch it are corroboration)119PREDICATES = {120 "22:A2": "D3", "22:A5": "O1", "22:C1": "V4", "22:C2": "V4", "22:C3": "V5", "22:C4": "V3", "22:C5": "V8",121 "22:C6": "V14", "22:C7": "V16", "22:C8": "S1", "22:C9": "V7", "22:C10": "T1", "22:C11": "T5", "22:C12": "L1",122 "22:C13": "V15", "22:C14": "G3", "22:C15": "M3", "22:C16": "C3", "22:C17": "C4", "22:C18": "R3", "22:C19": "B2",123 "22:C20": "Q1", "22:C21": "F11", "22:C22": "E2", "22:C23": "I4", "22:C24": "V13", "22:C25": "C8", "22:C26": "U2",124 "22:C27": "K1", "22:P1": "B5", "22:P2": "S3", "22:P3": "R4", "22:P4": "D8", "22:P5": "G4", "22:X1": "V16",125 "22:X2": "V15", "22:X3": "V5", "22:X4": "I5", "22:X5": "V13", "22:X6": "T5", "22:X7": "C8", "22:X8": "S1",126 "22:Z2": "O4",127}128129R = Registry("22", "quantum", LEDGER, PREDICATES, sources=[__file__])130131TOL = Fr(1, 10 ** 12) # the package's tolerance for its floating-point laws132133134# ---- Gaussian integers as pairs, the ledger ℤ[i] of the suites -----------------------------------------------------135def gm(z, w): return (z[0] * w[0] - z[1] * w[1], z[0] * w[1] + z[1] * w[0])136def ga(z, w): return (z[0] + w[0], z[1] + w[1])137def gc(z): return (z[0], -z[1])138def gnorm(z): return z[0] * z[0] + z[1] * z[1]139I4 = [(1, 0), (0, 1), (-1, 0), (0, -1)] # i^l140141142def shell(p, e, nS, nO):143 """The Subject and Object cycles of orders nS, nO in F_p^x (generator e), their gcd and the core."""144 N = p - 1145 gS, gO = pow(e, N // nS, p), pow(e, N // nO, p)146 HS, HO = {pow(gS, j, p) for j in range(nS)}, [pow(gO, j, p) for j in range(nO)]147 return N, gS, gO, gcd(nS, nO), HS, HO, sorted(HS.intersection(HO))148149150# ------------------------------------------------------------------------------------------------------------151# block V: the single-system formalism (validate.py, 22:C1–C5, C7, C9, C24)152# The first Carrier is F_157 (g = 5), with the Subject S_53 (C_52) and the Object O_13 (C_12). Their core is Q4, and the153# Object has three outcomes. The checks cover the fibres, the selection rule over every channel pair and the drive154# eigenstates. The forced basis is checked on a fixed Gaussian-integer state: orthogonality, Parseval and Lüders. The155# ledger selection rule is checked in ℤ[ζ_12], with both reductions to the Carrier. The second Carrier is F_421 (g = 2).156# There the quantum pair S_61, O_29 has core Q4 and quotient C_7, and the classical pair S_61, O_13 is total absorption.157@R.block("V", BLOCK["V"])158def block_V():159 """Block V — validate.py (EXACT): V1–V13, the package's 19 checks."""160 p, e, nS, nO = 157, 5, 52, 12161 N, gS, gO, d, HS, HO, core = shell(p, e, nS, nO)162 ip = pow(e, N // 4, p)163 ok = arith.order(e, p) == N and core == [1, 28, 129, 156] and d == 4164 ok &= pow(e, N - 39, p) == 28 and pow(28, 2, p) == p - 1 and lcm(nS, nO) == N165 R.check("V1", "F_157: g = 5 primitive; core = {1, 28, 129, 156}, |core| = 4 = gcd(52, 12); I = g^-39 = 28, I^2 = -1; lcm(52, 12) = 156", ok)166167 fib = {a: [pow(gO, a + 3 * l, p) for l in range(4)] for a in range(3)}168 R.check("V2", "F_157: the three fibres (Q4-cosets) partition Phi_O", sorted(sum(fib.values(), [])) == sorted(HO))169170 ok = all(sum(pow(e, ((N // 4) * (s - r) * l) % N, p) for l in range(4)) % p == (4 if (r - s) % 4 == 0 else 0)171 for r in range(nS) for s in range(nO))172 # 22:C4 (p22020)173 R.check("V3", "F_157: the selection rule A(r, s) = 4 [r = s mod 4] over all 52 x 12 channel pairs", ok)174175 ok = all(pow(gO * u % p, s, p) == pow(gO, s, p) * pow(u, s, p) % p for u in HO for s in range(nO))176 distinct = len({tuple(pow(u, s, p) for u in HO) for s in range(nO)}) == nO == len({pow(gO, s, p) for s in range(nO)})177 roots = sorted(x for x in range(1, p) if pow(x, nO, p) == 1) # every 12th root of unity in F_157 ...178 complete = roots == sorted(HO) and len(roots) == nO # ... is a power of g_O: the characters are the power maps, no other179 # 22:C1 (p22017), 22:C2 (p22018)180 R.check("V4", "F_157: the windings psi_s(u) = u^s are drive eigenstates, U psi_s = g_O^s psi_s, all s; the 12 power maps and their eigenvalues pairwise distinct; every 12th root of unity in F_157 is a power of g_O (the characters are the power maps and no others)",181 ok and distinct and complete)182183 psi = {u: ((i % 13) - 6, (i % 11) - 5) for i, u in enumerate(HO)} # the fixed state, no RNG184 red = lambda z: (z[0] + ip * z[1]) % p # Z[i] -> F_p, i -> 5^39185 psip = {u: red(z) for u, z in psi.items()}186 def v(r, a):187 w = {u: (0, 0) for u in HO}188 for l in range(4): w[pow(gO, a + 3 * l, p)] = I4[(r * l) % 4]189 return w190 def pair(x, y):191 s = (0, 0)192 for u in HO: s = ga(s, gm(gc(x[u]), y[u]))193 return s194 def amp(r, a):195 s = (0, 0)196 for l in range(4): s = ga(s, gm(gc(I4[(r * l) % 4]), psi[pow(gO, a + 3 * l, p)]))197 return s198 def amp_fp(r, a):199 return sum(pow(pow(ip, l, p), (4 - r) % 4, p) * psip[pow(gO, a + 3 * l, p)] for l in range(4)) % p200 RA = [(r, a) for r in range(4) for a in range(3)]201 ok = all(pair(v(*x), v(*y)) == ((4, 0) if x == y else (0, 0)) for x in RA for y in RA)202 # 22:C3 (p22019), 22:X3 (p22046)203 R.check("V5", "F_157: the forced basis is orthogonal, <v_{r,a}, v_{r',a'}> = 4 delta delta (Z[i])", ok)204205 lhs = sum(gnorm(amp(r, a)) for r, a in RA); rhs = 4 * sum(gnorm(z) for z in psi.values())206 R.check("V6", "F_157: Parseval, sum |Psi|^2 = 4 ||psi||^2 on the fixed Gaussian-integer state (resolution of the identity, 22:C3)", lhs == rhs, f"{lhs} = {rhs}")207208 # The pair count (eq. paircount): the weight of a channel is the double sum over ordered pairs of fibre points of209 # the phase agreements conj(v(u)) psi(u) conj(psi(u')) v(u'), computed as that double sum in Z[i], equal to the210 # norm N(Psi) of the amplitude, a nonnegative integer (a realised tally), on every channel of the fixed state.211 def pair_count(r, a):212 vv, fibre, tot = v(r, a), [pow(gO, a + 3 * l, p) for l in range(4)], (0, 0)213 for u in fibre:214 for u2 in fibre: tot = ga(tot, gm(gm(gc(vv[u]), psi[u]), gm(gc(psi[u2]), vv[u2])))215 return tot216 counts = {x: pair_count(*x) for x in RA}217 ok = all(counts[x] == (gnorm(amp(*x)), 0) and gnorm(amp(*x)) >= 0 for x in RA) and any(gnorm(amp(*x)) > 0 for x in RA)218 # 22:C7 (p22023), 22:X1 (p22044)219 R.check("V16", "F_157: the pair count, the double sum of phase agreements over ordered fibre pairs, is the weight N(Psi_{r,a}) in Z, a nonnegative integer (a realised tally), on all 12 channels of the fixed state",220 ok, f"weights {[gnorm(amp(*x)) for x in RA]}")221222 # 22:C9 (p22025)223 R.check("V7", "F_157: the ledger reduction Z[i] -> F_157 commutes with the amplitudes on every channel", all(red(amp(r, a)) == amp_fp(r, a) for r, a in RA))224225 def proj(r, a, phi):226 A, vv = (0, 0), v(r, a)227 for l in range(4):228 u = pow(gO, a + 3 * l, p); A = ga(A, gm(gc(vv[u]), phi[u]))229 return {u: gm(vv[u], A) for u in HO}230 ok = True231 for r, a in RA:232 phi1 = proj(r, a, psi); phi2 = proj(r, a, phi1)233 ok &= all(phi2[u] == gm((4, 0), phi1[u]) for u in HO)234 # 22:C5 (p22021)235 R.check("V8", "F_157: Lueders idempotence Pi^2 = 4 Pi on all 12 channels (r, a) of the fixed state (the projector with its conjugate; r = 1, 3 are the complex channels)", ok)236237 Z = Cyclotomic(12)238 okL = okR = True239 for s in range(12):240 for r in range(4):241 for a in range(3):242 S = Z.sum(Z.mul(Z.zeta(s * (a + 3 * l)), Z.zeta(-3 * r * l)) for l in range(4))243 tgt = Z.zeta(s * a, 4) if (s - r) % 4 == 0 else Z.zero244 okL &= S == tgt245 okR &= Z.shadow(S, p, gO) == ((4 * pow(gO, s * a, p)) % p if (s - r) % 4 == 0 else 0)246 R.check("V9", "F_157: the ledger selection rule Psi = 4 zeta_12^{s a} iff r = s mod 4, else 0, in Z[zeta_12]", okL)247 R.check("V10", "F_157: the ledger reduction zeta_12 -> g_O = 22 matches the Carrier amplitudes", okR and gO == 22)248249 p2, e2 = 421, 2250 N2 = p2 - 1251 _, _, gO2, d2, HS2, HO2, core2 = shell(p2, e2, 60, 28)252 ok = arith.order(e2, p2) == N2 and core2 == [1, 29, 392, 420] and d2 == 4 and lcm(60, 28) == 420253 ok &= pow(e2, N2 - 105, p2) == 392 and pow(392, 2, p2) == p2 - 1254 R.check("V11", "F_421: g = 2 primitive; quantum pair S_61, O_29: core {1, 29, 392, 420}, gcd 4, lcm 420; I = 2^-105 = 392, I^2 = -1", ok)255 ok = all(sum(pow(e2, (105 * (s - r) * l) % N2, p2) for l in range(4)) % p2 == (4 if (r - s) % 4 == 0 else 0)256 for r in range(60) for s in range(28))257 R.check("V12", "F_421: the selection rule over all 60 x 28 channel pairs", ok)258 _, _, _, d3, HS3, HO3, core3 = shell(p2, e2, 60, 12)259 live = {s: [r for r in range(12) if sum(pow(e2, ((N2 // d3) * (s - r) * l) % N2, p2) for l in range(d3)) % p2 != 0] for s in range(12)}260 live_q = {s: [r for r in range(28) if sum(pow(e2, (105 * (s - r) * l) % N2, p2) for l in range(4)) % p2 != 0] for s in range(28)}261 # 22:C24 (p22040), 22:X5 (p22048)262 R.check("V13", "F_421: seven outcomes, C_28/Q4 = C_7 (quantum, index 7 > 1: every winding couples to 7 of the 28 channels); the classical pair S_61, O_13: gcd(60, 12) = 12, total absorption, one outcome per winding (the selection sums vanish on the other 11 channels)",263 28 // d2 == 7 and d3 == 12 and set(HO3) <= HS3 and 12 // d3 == 1 and all(len(live[s]) == 1 for s in range(12)) and all(len(live_q[s]) == 7 for s in range(28)))264265 # Conjugation is cycle inversion, forced in each setting (22:C6): on every prime p = 4k + 1 below 200, the Frobenius266 # x -> x^p of F_{p^2} is the conjugation (a, b) -> (a, -b), it inverts the norm-one torus (z z^p = 1), and it is the267 # only non-trivial automorphism over F_p (an automorphism sends sqrt(nu) to a root of X^2 - nu, so to +-sqrt(nu));268 # on the phase cycle exponent negation is inversion, zeta^k zeta^(n-k) = 1; and the ledger's conjugation reduces to269 # it: the shadow of zeta_12^(-e) is the inverse of the shadow of zeta_12^e on F_157 (zeta_12 -> 22).270 ok = True; det = []271 for q in [x for x in range(5, 200) if arith.is_prime(x) and x % 4 == 1]:272 nu = next(v for v in range(2, q) if pow(v, (q - 1) // 2, q) == q - 1)273 K = Ext(q, nu)274 torus = K.norm_one()275 ok &= len(torus) == q + 1 and all(K.pow(z, q) == K.conj(z) and K.mul(z, K.conj(z)) == (1, 0) for z in torus)276 ok &= all(K.pow(z, q) == K.conj(z) for z in K.elements())277 roots = [x for x in K.elements() if K.mul(x, x) == (nu % q, 0)]278 ok &= sorted(roots) == sorted([(0, 1), (0, q - 1)]) # sqrt(nu) has two images: the two automorphisms279 det.append(str(q))280 z12 = 22281 ok &= all(pow(z12, (12 - k) % 12, 157) * pow(z12, k, 157) % 157 == 1 for k in range(12))282 ok &= all(pow(pow(z12, k, 157), -1, 157) == pow(z12, (-k) % 12, 157) for k in range(12))283 # 22:C6 (p22022)284 R.check("V14", "conjugation is inversion in each setting: the Frobenius of F_{p^2} is (a, b) -> (a, -b), inverts the norm-one torus and is the only non-trivial automorphism over F_p (sqrt nu -> +-sqrt nu), every p = 4k+1 < 200; exponent negation inverts C_12 and the ledger's conjugation reduces to it on F_157",285 ok, f"{len(det)} shells")286287 # The forced complex sector (22:C13, X2): the shared core of two framed shells of capacities kappa, kappa' is the288 # cycle of order gcd(4 kappa, 4 kappa'), a multiple of 4, and exactly Q4 when the capacities are coprime (exhaustive289 # below 30); a shell p = 3 (mod 4) has no square root of -1 and every p = 1 (mod 4) has one (every prime below 200).290 ok = all(gcd(4 * a, 4 * b) % 4 == 0 for a in range(1, 30) for b in range(1, 30))291 ok &= all(gcd(4 * a, 4 * b) == 4 for a in range(1, 30) for b in range(1, 30) if gcd(a, b) == 1)292 ok &= any(gcd(4 * a, 4 * b) > 4 for a in range(1, 30) for b in range(1, 30))293 for q in [x for x in range(3, 200) if arith.is_prime(x)]:294 has = any(x * x % q == q - 1 for x in range(q))295 ok &= has == (q % 4 == 1)296 # 22:C13 (p22029), 22:X2 (p22045)297 R.check("V15", "the shared core of two framed shells has order a multiple of 4 and is Q4 for coprime capacities (kappa, kappa' < 30); a square root of -1 exists on p = 1 (mod 4) and on no p = 3 (mod 4), every prime below 200: the universal ledger is Z[i], the real theory arises from no capacity",298 ok)299300301# ------------------------------------------------------------------------------------------------------------302# block S: the Sorkin hierarchy (sorkin.py, 22:C8, P2, X8)303# Four slits carry deterministic Gaussian-integer components on the Object cycle. The k-th order Sorkin combination is304# taken over every channel and outcome, on F_157 and F_421. I2 is nonzero, and I3 = I4 = 0 exactly. The observed305# combination comes from the lifted shadows. It is zero below the horizon, where every tally is below p. Above the306# horizon it is a multiple of p, with nonzero instances.307@R.block("S", BLOCK["S"])308def block_S():309 """Block S — sorkin.py (EXACT): S1–S3, the package's 8 checks."""310 cnt = [0]311 def nxt():312 cnt[0] += 1; return cnt[0]313 wide = lambda: (((nxt() * 5) % 19) - 9, ((nxt() * 13) % 19) - 9)314 binary = lambda: (nxt() % 2, 0)315 deep = lambda: (7 * (((nxt() * 5) % 19) - 9), 7 * (((nxt() * 13) % 19) - 9))316 def run(p, e, nO, nslits, coeff):317 gO = pow(e, (p - 1) // nO, p); HO = [pow(gO, j, p) for j in range(nO)]; q = nO // 4318 slits = [{u: coeff() for u in HO} for _ in range(nslits)]319 W = {}320 for mask in range(1, 1 << nslits):321 S = tuple(i for i in range(nslits) if mask >> i & 1)322 for r in range(4):323 for a in range(q):324 s = (0, 0)325 for l in range(4):326 u = pow(gO, a + q * l, p); comp = (0, 0)327 for i in S: comp = ga(comp, slits[i][u])328 s = ga(s, gm(gc(I4[(r * l) % 4]), comp))329 W[(S, r, a)] = gnorm(s)330 return W, q331 def hier(W, q, k, lift=None):332 out = []333 for r in range(4):334 for a in range(q):335 out.append(sum((-1) ** (k - m) * (W[(c, r, a)] if lift is None else W[(c, r, a)] % lift)336 for m in range(1, k + 1) for c in combinations(range(k), m)))337 return out338 ok = True; det = []339 for p, e, nO, tag in [(157, 5, 12, "157/53/13"), (421, 2, 28, "421/61/29")]:340 W, q = run(p, e, nO, 4, wide)341 I2, I3, I4v = hier(W, q, 2), hier(W, q, 3), hier(W, q, 4)342 ok &= any(I2) and not any(I3) and not any(I4v)343 det.append(f"{tag}: max |I2| = {max(map(abs, I2))}")344 # 22:C8 (p22024), 22:X8 (p22051)345 R.check("S1", "Sorkin nullity on F_157 and F_421: I2 generically nonzero, I3 = I4 = 0 exactly on every channel and outcome", ok, "; ".join(det))346347 p = 157348 W, q = run(p, 5, 12, 3, binary)349 I3h = hier(W, q, 3, p)350 R.check("S2", "F_157, sub-horizon tallies (every w < p): the observed I3 from the lifted shadows is 0 exactly", all(w < p for w in W.values()) and not any(I3h))351 W, q = run(p, 5, 12, 3, deep)352 I3h = hier(W, q, 3, p); nz = sum(1 for v in I3h if v)353 # 22:P2 (p22053)354 R.check("S3", "F_157, super-window tallies present: the observed I3 is a multiple of p (wrap quantisation), with nonzero instances",355 any(w >= p for w in W.values()) and all(v % p == 0 for v in I3h) and nz > 0, f"{nz} nonzero cases, all multiples of {p}")356357358# ------------------------------------------------------------------------------------------------------------359# block D: exact boost transport (dispersion.py, 22:A2, P4)360# The Dirac layer lives over K = F_169 = F_13(c), with c² = ν = 2. The gammas obey G^μG^ν + G^νG^μ = 2η^{μν}, with361# η = diag(−ν, 1, 1, 1). The spin lift is S(x, y) = xI + yM, where M = G0 G1 and M² = ν. Spin conjugation is checked for362# every boost (x, y) with δ = x² − νy² ≠ 0, together with the transported Clifford relations. The boost group law is363# checked on the norm-one cycle of order p + 1 = 14. The spinor fields live over Y = F_13⁴, and the package's fixed field364# is used. The transported Dirac operator is covariant under every norm-one boost. The Dirac → Klein–Gordon factorisation365# holds in the standard and in a boosted frame, and the boost cycle closes. A field is four lists over the 13⁴ points.366# Its values are packed as a + 13b and are added and scaled by tables.367@R.block("D", BLOCK["D"])368def block_D():369 """Block D — dispersion.py (EXACT): D1–D6, the package's 9 checks, and D7 on a field the package does not use."""370 p, nu = 13, 2371 K = Ext(p, nu); Z0 = (0, 0)372 ip = min(x for x in range(2, p) if x * x % p == p - 1) # the internal i, 5² = −1373 def mm(X, Y): # 4 x 4 over K, rows as {col: value}374 out = []375 for row in X:376 acc = {}377 for k, a in row.items():378 for j, b in Y[k].items(): acc[j] = K.add(acc.get(j, Z0), K.mul(a, b))379 out.append({j: w for j, w in acc.items() if w != Z0})380 return out381 def madd(X, Y):382 out = []383 for rx, ry in zip(X, Y):384 acc = dict(rx)385 for j, b in ry.items(): acc[j] = K.add(acc.get(j, Z0), b)386 out.append({j: w for j, w in acc.items() if w != Z0})387 return out388 def msc(c, X): return [{j: K.mul(c, w) for j, w in row.items() if K.mul(c, w) != Z0} for row in X]389 def emb(M, part=0): return [{j: ((M[i][j] % p, 0) if part == 0 else (0, M[i][j] % p)) for j in range(4) if M[i][j] % p} for i in range(4)]390 def blk(off, sign, M):391 Zm = [[0] * 4 for _ in range(4)]392 for i in range(2):393 for j in range(2):394 if off: Zm[i][j + 2] = Zm[i + 2][j] = M[i][j]395 else: Zm[i][j], Zm[i + 2][j + 2] = M[i][j], sign * M[i][j]396 return Zm397 s1, s2, s3, I2 = [[0, 1], [1, 0]], [[0, -ip], [ip, 0]], [[1, 0], [0, -1]], [[1, 0], [0, 1]]398 E = [emb(blk(1, 0, s1)), emb(blk(1, 0, s2)), emb(blk(1, 0, s3))]399 G = [emb([[ip * x for x in row] for row in blk(0, -1, I2)], 1)] + E # G0 = c·i·e4, (G0)² = −ν400 eta = [(-nu) % p, 1, 1, 1]401 Id = emb([[int(i == j) for j in range(4)] for i in range(4)])402 def clifford(gs):403 return all(madd(mm(gs[m], gs[n]), mm(gs[n], gs[m])) == (msc((2 * eta[m] % p, 0), Id) if m == n else [{}] * 4)404 for m in range(4) for n in range(4))405 M = mm(G[0], G[1])406 R.check("D1", "Clifford relations G^mu G^nu + G^nu G^mu = 2 eta^{mu nu} I over F_169 (all 16 pairs, eta = diag(-nu, 1, 1, 1)); M = G0 G1 has M^2 = nu I",407 clifford(G) and mm(M, M) == msc((nu, 0), Id))408409 def AB(x, y):410 di = pow((x * x - nu * y * y) % p, -1, p)411 return (x * x + nu * y * y) * di % p, (-2 * x * y * di) % p412 def spin(x, y): return madd(msc((x % p, 0), Id), msc((y % p, 0), M))413 def hat(A, B): return [madd(msc((A, 0), G[0]), msc((-nu * B % p, 0), G[1])), madd(msc((-B % p, 0), G[0]), msc((A, 0), G[1])), G[2], G[3]]414 ok2 = ok4 = True; count = 0415 for x in range(p):416 for y in range(p):417 dl = (x * x - nu * y * y) % p418 if dl == 0: continue419 count += 1420 S = spin(x, y); Si = msc((pow(dl, -1, p), 0), spin(x, -y)) # S^{-1} = (xI − yM)/δ, checked421 A, B = AB(x, y)422 ok2 &= mm(S, Si) == Id423 ok2 &= mm(Si, mm(G[0], S)) == madd(msc((A, 0), G[0]), msc((nu * B % p, 0), G[1]))424 ok2 &= mm(Si, mm(G[1], S)) == madd(msc((B, 0), G[0]), msc((A, 0), G[1]))425 ok2 &= mm(Si, mm(G[2], S)) == G[2] and mm(Si, mm(G[3], S)) == G[3]426 ok4 &= clifford(hat(A, B))427 R.check("D2", "spin conjugation S^-1 G^mu S = Lambda G for all 168 boosts (x, y), delta != 0; the transported gammas obey the Clifford relations",428 ok2 and ok4 and count == p * p - 1, f"{count} boosts")429430 def lam(x, y):431 A, B = AB(x, y)432 return [[A, B, 0, 0], [nu * B % p, A, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]433 def imul(X, Y): return [[sum(X[i][k] * Y[k][j] for k in range(4)) % p for j in range(4)] for i in range(4)]434 U1 = [(x, y) for x in range(p) for y in range(p) if (x * x - nu * y * y) % p == 1]435 ok = all(imul(lam(x, y), lam(u, v)) == lam((x * u + nu * y * v) % p, (x * v + y * u) % p) for x, y in U1 for u, v in U1)436 # 22:A2 (p22002)437 R.check("D3", "the boost group law Lambda(x, y) Lambda(u, v) = Lambda(xu + nu yv, xv + yu), exhaustive on the norm-one cycle of order p + 1 = 14",438 ok and len(U1) == p + 1, f"{len(U1)}^2 products")439440 # the spinor fields over Y = F_13^4: values packed a + 13 b441 P2, P4 = p * p, p ** 4442 unpack = lambda w: (w % p, w // p)443 ADD = [K.add(unpack(u), unpack(w)) for u in range(P2) for w in range(P2)]444 ADD = [a + p * b for a, b in ADD]445 SUB = [(lambda z: z[0] + p * z[1])(K.sub(unpack(u), unpack(w))) for u in range(P2) for w in range(P2)]446 tabs = {}447 def tab(c):448 if c not in tabs: tabs[c] = [(lambda z: z[0] + p * z[1])(K.mul(c, unpack(w))) for w in range(P2)]449 return tabs[c]450 def lincomb(terms):451 if not terms: return [0] * P4452 if len(terms) == 1: return [terms[0][0][w] for w in terms[0][1]]453 (T1, L1), (T2, L2) = terms[:2]454 out = [ADD[T1[u] * P2 + T2[w]] for u, w in zip(L1, L2)]455 for T, L in terms[2:]: out = [ADD[u * P2 + T[w]] for u, w in zip(out, L)]456 return out457 def mvec(X, f): return [lincomb([(tab(c), f[k]) for k, c in X[i].items()]) for i in range(4)]458 def fadd(f, g): return [[ADD[u * P2 + w] for u, w in zip(a, b)] for a, b in zip(f, g)]459 def fsub(f, g): return [[SUB[u * P2 + w] for u, w in zip(a, b)] for a, b in zip(f, g)]460 def fsc(c, f):461 T = tab((c % p, 0))462 return [[T[w] for w in a] for a in f]463 COORD = list(product(range(p), repeat=4))464 perms = {}465 def shift_perm(vec): # f(z + vec)466 if vec not in perms:467 a, b, c, d = vec468 perms[vec] = [(((t + a) % p * p + (x + b) % p) * p + (y + c) % p) * p + (z + d) % p for t, x, y, z in COORD]469 return perms[vec]470 def nabla(f, perm): return [[SUB[fc[q] * P2 + w] for q, w in zip(perm, fc)] for fc in f]471 def dirac(f, gams, perms):472 nab = [nabla(f, perms[mu]) for mu in range(4)]473 return [lincomb([(tab(c), nab[mu][k]) for mu in range(4) for k, c in gams[mu][i].items()]) for i in range(4)]474 def kg(f, perms):475 out = None476 for mu in range(4):477 t = fsc(eta[mu], nabla(nabla(f, perms[mu]), perms[mu]))478 out = t if out is None else fadd(out, t)479 return out480 sources = {}481 def transport(f, x, y): # (T f)(z) = S f(Λ^{-1} z)482 if (x, y) not in sources:483 Li = lam(x, -y % p)484 sources[(x, y)] = [((Li[0][0] * t + Li[0][1] * xx) % p * p + (Li[1][0] * t + Li[1][1] * xx) % p) * P2 + yy * p + z485 for t, xx, yy, z in COORD]486 src = sources[(x, y)]487 return mvec(spin(x, y), [[fc[q] for q in src] for fc in f])488 def frame_perms(x, y):489 L = lam(x, y)490 return [shift_perm(tuple(L[i][mu] for i in range(4))) for mu in range(4)]491 psi = [[((((pos * 4 + c) * 2) * 7 + 3) % p) + p * ((((pos * 4 + c) * 2 + 1) * 7 + 3) % p) for pos in range(P4)] for c in range(4)]492 std = [shift_perm(tuple(int(i == mu) for i in range(4))) for mu in range(4)]493 D0 = dirac(psi, G, std)494 ok = True495 for x, y in U1:496 A, B = AB(x, y)497 ok &= dirac(transport(psi, x, y), hat(A, B), frame_perms(x, y)) == transport(D0, x, y)498 R.check("D4", "exact covariance D_{Lambda,S} T psi = T D psi on the fixed spinor field over F_13^4, all 14 norm-one boosts", ok)499500 m = 7501 def factorises(gams, perms):502 Dm = fadd(dirac(psi, gams, perms), fsc(m, psi))503 return fsub(dirac(Dm, gams, perms), fsc(m, Dm)) == fsub(kg(psi, perms), fsc(m * m, psi))504 x, y = U1[1]505 ok = factorises(G, std) and factorises(hat(*AB(x, y)), frame_perms(x, y))506 R.check("D5", "the Dirac -> Klein-Gordon factorisation (D - m)(D + m) = KG - m^2 on the fixed field, in the standard frame and a boosted frame", ok)507508 xg, yg = next((x, y) for x, y in U1 if y != 0)509 cur, order = (1, 0), 0510 while True:511 cur = ((cur[0] * xg + nu * cur[1] * yg) % p, (cur[0] * yg + cur[1] * xg) % p); order += 1512 if cur == (1, 0): break513 f = psi514 for _ in range(order): f = transport(f, xg, yg)515 Pw, half = Id, None516 for k in range(order):517 Pw = mm(Pw, spin(xg, yg))518 if k + 1 == order // 2: half = Pw519 R.check("D6", "closure of the boost cycle: transport around the generator's orbit returns S^n psi exactly, no accumulated deformation; the spinor double cover S^((p+1)/2) = -I",520 f == mvec(Pw, psi) and half == msc((p - 1, 0), Id), f"orbit of the generator {(xg, yg)}: {order} steps, S^{order // 2} = -I")521522 # The package's field is 7·index + 3 mod 13, and the strides 13, 13², 13³ of t, x, y vanish mod 13. So it depends on523 # z alone, and D4 and D5 test only the z-direction. D7 repeats them on point sources, which test every coefficient524 # of both operators at once. A sparse field is a dict from points to spinors over K.525 def sp_add(f, g, sign=1):526 out = {w: list(v) for w, v in f.items()}527 for w, v in g.items():528 cur = out.setdefault(w, [Z0] * 4)529 out[w] = [K.add(a, b) if sign > 0 else K.sub(a, b) for a, b in zip(cur, v)]530 return {w: v for w, v in out.items() if any(c != Z0 for c in v)}531 def sp_mvec(X, f, c=(1, 0)):532 out = {w: [K.mul(c, _ksum(K, (K.mul(a, v[k]) for k, a in X[i].items()))) for i in range(4)] for w, v in f.items()}533 return {w: v for w, v in out.items() if any(e != Z0 for e in v)}534 def sp_nabla(f, vec): # f(z + vec) − f(z)535 return sp_add({tuple((a - b) % p for a, b in zip(w, vec)): v for w, v in f.items()}, f, -1)536 def sp_dirac(f, gams, frame):537 out = {}538 for mu in range(4): out = sp_add(out, sp_mvec(gams[mu], sp_nabla(f, frame[mu])))539 return out540 def sp_transport(f, x, y): # (T f)(Λw) = S f(w)541 L = lam(x, y)542 return sp_mvec(spin(x, y), {tuple(sum(L[i][j] * w[j] for j in range(4)) % p for i in range(4)): v for w, v in f.items()})543 def sp_frame(x, y):544 L = lam(x, y)545 return [tuple(L[i][mu] for i in range(4)) for mu in range(4)]546 rnd = random.Random(13)547 ok = True548 for _ in range(3):549 psi = {tuple(rnd.randrange(p) for _ in range(4)): [(rnd.randrange(p), rnd.randrange(p)) for _ in range(4)] for _ in range(3)}550 D0 = sp_dirac(psi, G, sp_frame(1, 0))551 for x, y in U1:552 ok &= sp_dirac(sp_transport(psi, x, y), hat(*AB(x, y)), sp_frame(x, y)) == sp_transport(D0, x, y)553 for x, y in [(1, 0), U1[1]]:554 gams, frame = (G if (x, y) == (1, 0) else hat(*AB(x, y))), sp_frame(x, y)555 Dm = sp_add(sp_dirac(psi, gams, frame), sp_mvec(Id, psi, (m, 0)))556 kgf = {}557 for mu in range(4): kgf = sp_add(kgf, sp_mvec(Id, sp_nabla(sp_nabla(psi, frame[mu]), frame[mu]), (eta[mu], 0)))558 ok &= sp_add(sp_dirac(Dm, gams, frame), sp_mvec(Id, Dm, (m, 0)), -1) == sp_add(kgf, sp_mvec(Id, psi, (m * m % p, 0)), -1)559 R.check("D7", "D4 and D5 again on point sources, which test every coefficient of both operators (the package's field depends on z alone mod 13): covariance under all 14 norm-one boosts, the factorisation in the standard and a boosted frame",560 ok, "three fields of three random point sources")561 ok = True562 for _ in range(3):563 f0 = {tuple(rnd.randrange(p) for _ in range(4)): [(rnd.randrange(p), rnd.randrange(p)) for _ in range(4)] for _ in range(3)}564 f, Pw = f0, Id565 for k in range(1, order + 1):566 f = sp_transport(f, xg, yg); Pw = mm(Pw, spin(xg, yg))567 moved = f != sp_mvec(Pw, f0) # Lambda^k moves the support unless Lambda^k = 1 (order 7 on the points: Lambda(z) = conj(z)^2)568 ok &= moved == (k % (order // 2) != 0)569 if k == order // 2: ok &= f == sp_mvec(msc((p - 1, 0), Id), f0) # the double cover's sign on the field at the half orbit570 ok &= f == f0 and order == p + 1571 # 22:P4 (p22055)572 R.check("D8", "closure of the boost cycle on point-source fields, step by step: Lambda^k moves the support exactly when 7 does not divide k (Lambda has order 7 on the points), at the half orbit T^7 psi = -psi (the double cover's sign), and T^14 psi = psi exactly; nothing short of the orbit returns",573 ok and half == msc((p - 1, 0), Id), f"three point-source fields, {order} steps")574575576def _ksum(K, xs):577 out = (0, 0)578 for x in xs: out = K.add(out, x)579 return out580581582# ------------------------------------------------------------------------------------------------------------583# block C: the composite gate and the CHSH test (composite.py, C1–C8, 22:C15–C17, P3, X7)584# The Carrier is F_641 (g = 3). The Object pair O_17 x O_17 (C_16, g_O = 3^40 = 601, g_O^8 = −1) is read by S_41 (C_40),585# with core C_8 and quotient C_2. The drive conserves the relative offset, and the doublet readout is σ_x. Over ℤ[ζ_80]586# the checks cover the singlet law E(Δ) = cos(πΔ/40), its reduction to F_641 and no-signalling. The exhaustive 80³ CHSH587# sweep runs in floating point, in the chart. It reaches 2√2 and never exceeds it. In ℤ[ζ_8] the optimum is588# S = 2(ζ_8 + ζ_8^{-1}), with S² = 8.589@R.block("C", BLOCK["C"])590def block_C():591 """Block C — composite.py, the composite gate (EXACT; C7 CHART, by certified brackets): C1–C8, the package's 12 checks C1–C8."""592 p, g = 641, 3593 N = p - 1594 gO = pow(g, N // 16, p)595 ok = p % 4 == 1 and arith.order(g, p) == N and gO == 601 and arith.order(gO, p) == 16596 ok &= N % 40 == 0 and N % 16 == 0 and gcd(40, 16) == 8 and 16 // 8 == 2 and pow(gO, 8, p) == p - 1597 R.check("C1", "F_641 = 4*160 + 1, g = 3 primitive, g_O = 601 of order 16, g_O^8 = -1; 40 | 640, 16 | 640, core gcd(40, 16) = 8, quotient C_2", ok)598599 HO = [pow(gO, j, p) for j in range(16)]600 off = lambda u, v: u * pow(v, -1, p) % p601 ok = all(off(gO * u % p, gO * v % p) == off(u, v) for u in HO for v in HO)602 orbit, (u, v) = {(1, 1)}, (1, 1)603 for _ in range(16):604 u, v = gO * u % p, gO * v % p; orbit.add((u, v))605 R.check("C2", "the drive conserves the relative offset on all 256 pairs; the synchronised orbit (the Bell state) has length 16", ok and len(orbit) == 16)606607 core = [pow(gO, 2 * l, p) for l in range(8)]608 ok = True609 for s in range(16):610 r = s % 8611 for j in range(80):612 lam = pow(g, 8 * j, p)613 psi = lambda w: (pow(w, s, p) + lam * pow(w, s + 8, p)) % p614 P0 = sum((pow(k, (8 - r) % 8, p) if r else 1) * psi(k) for k in core) % p615 P1 = sum((pow(k, (8 - r) % 8, p) if r else 1) * psi(gO * k % p) for k in core) % p616 ok &= P0 == 8 * (1 + lam) % p and P1 == 8 * pow(gO, s, p) * (1 - lam) % p617 # 22:C16 (p22032)618 R.check("C3", "the doublet readout psi = u^s + lam u^{s+8}: Psi(0) = 8(1 + lam), Psi(1) = 8 g_O^s (1 - lam), a sigma_x measurement (16 windings x 80 settings)", ok)619620 Z = Cyclotomic(80)621 red8 = pow(g, 8, p) # the shadow of zeta_80622 ok4 = ok5 = ok6 = True623 for D in range(80):624 lam, lamc = Z.zeta(D), Z.zeta(-D)625 w = {}626 for al in (0, 1):627 for be in (0, 1):628 sg = 1 if (al + be) % 2 == 0 else -1629 w[(al, be)] = Z.mul(Z.add(Z.one, Z.scale(sg, lam)), Z.add(Z.one, Z.scale(sg, lamc)))630 lp = pow(red8, D, p)631 ok5 &= Z.shadow(w[(al, be)], p, red8) == (1 + sg * lp) * (1 + sg * pow(lp, -1, p)) % p632 ok4 &= Z.sum(w.values()) == Z.const(8)633 ok4 &= Z.sub(Z.add(w[(0, 0)], w[(1, 1)]), Z.add(w[(0, 1)], w[(1, 0)])) == Z.add(Z.zeta(D, 4), Z.zeta(-D, 4))634 ok6 &= all(Z.add(w[(al, 0)], w[(al, 1)]) == Z.const(4) for al in (0, 1))635 # 22:C17 (p22033)636 R.check("C4", "the singlet law: total weight 8 and E(Delta) = (zeta^D + zeta^-D)/2 = cos(pi Delta/40) exactly, all 80 settings (Z[zeta_80])", ok4)637 R.check("C5", "the composite reduction commutes: Z[zeta_80] -> F_641, zeta_80 -> g^8, on all weights", ok5)638 R.check("C6", "no-signalling: each marginal is 4 of 8 = 1/2 exactly, independent of the far setting", ok6)639640 below, at, over = CQ.chsh_bound(80) # every triple's S bracketed by certified cosines641 two_root_two = Z.scale(2, Z.add(Z.zeta(10), Z.zeta(-10))) # 2(zeta_8 + zeta_8^-1) = 2 sqrt 2 in Z[zeta_80]642 E_exact = lambda D: Z.scale(Fr(1, 2), Z.add(Z.zeta(D), Z.zeta(-D)))643 saturate = all(Z.sub(Z.sum([E_exact(d1), E_exact(d2), E_exact(d3)]), E_exact(d4)) == two_root_two for d1, d2, d3, d4 in at)644 R.check("C7", "the exhaustive 80^3 CHSH sweep never exceeds 2 sqrt 2: every triple's S lies below the bracket of 2 sqrt 2 by certified cosine brackets, except the saturating triples, where S = 2(zeta_8 + zeta_8^-1) exactly in Z[zeta_80]",645 below + len(at) == 80 ** 3 and not over and len(at) > 0 and saturate, f"{below} triples below, {len(at)} saturating {at}", kind="CHART")646647 Z8 = Cyclotomic(8)648 S8 = Z8.sub(Z8.scale(Fr(3, 2), Z8.add(Z8.zeta(1), Z8.zeta(-1))), Z8.scale(Fr(1, 2), Z8.add(Z8.zeta(3), Z8.zeta(-3))))649 # 22:X7 (p22050), 22:C25 (p22041)650 R.check("C8", "Tsirelson saturation as a ring identity: S = 3 cos(pi/4) - cos(3 pi/4) = 2(zeta_8 + zeta_8^-1) in Z[zeta_8], S^2 = 8",651 S8 == Z8.scale(2, Z8.add(Z8.zeta(1), Z8.zeta(-1))) and Z8.mul(S8, S8) == Z8.const(8))652653654# ------------------------------------------------------------------------------------------------------------655# block U: the unequal-cycle gate (composite.py, U1–U6, 22:C26)656# On F_421 the pair S_61 x O_29 has the cycles C_60 and C_28. The joint recurrence is lcm = 420, and the four gcd-offset657# sectors are conserved. The recurrence T' = lcm(n_j / gcd(s_j, n_j)) is checked for every winding vector. Four658# characters are orbit-trivial, and the other 1676 cancel. The cancellation holds in the Carrier too. The last check is659# the Born window guard of the worked pair state.660@R.block("U", BLOCK["U"])661def block_U():662 """Block U — composite.py, the unequal-cycle gate (EXACT): U1–U6, the package's 6 checks."""663 p, g, n1, n2 = 421, 2, 60, 28664 N = p - 1665 R.check("U1", "421 = 4*105 + 1, g = 2 primitive; 60, 28 | 420; gcd(60, 28) = 4 = |Q4|, lcm = 420",666 p % 4 == 1 and arith.order(g, p) == N and N % n1 == 0 and N % n2 == 0 and gcd(n1, n2) == 4 and lcm(n1, n2) == 420)667 T = lcm(n1, n2)668 orbit, a, b = set(), 0, 0669 for _ in range(T):670 orbit.add((a, b)); a, b = (a + 1) % n1, (b + 1) % n2671 sectors = {}672 for a0 in range(n1):673 for b0 in range(n2): sectors[(a0 - b0) % 4] = sectors.get((a0 - b0) % 4, 0) + 1674 a, b, cons = 7, 3, True675 for _ in range(T):676 a, b = (a + 1) % n1, (b + 1) % n2; cons &= (a - b) % 4 == (7 - 3) % 4677 # 22:C26 (p22042)678 R.check("U2", "the unit-winding joint orbit has length 420; 1680/420 = 4 sectors of 420 each; the gcd-offset a - b mod 4 is conserved over the recurrence",679 len(orbit) == T and n1 * n2 // T == 4 and cons and sorted(sectors) == [0, 1, 2, 3] and all(c == 420 for c in sectors.values()))680 ok = True681 for s1 in range(n1):682 for s2 in range(n2):683 t = next(t for t in range(1, n1 * n2 + 1) if (t * s1) % n1 == 0 and (t * s2) % n2 == 0)684 ok &= t == lcm(n1 // gcd(s1, n1), n2 // gcd(s2, n2))685 R.check("U3", "T' = lcm(n_j/gcd(s_j, n_j)) is the recurrence of every one of the 1680 winding vectors", ok)686 triv = sum(1 for k1 in range(n1) for k2 in range(n2) if (7 * k1 + 15 * k2) % 420 == 0)687 ok = triv == 4 and n1 * n2 - triv == 1676688 for k1, k2 in [(1, 0), (0, 1), (7, 3), (59, 27), (30, 14), (2, 25)]:689 e = (7 * k1 + 15 * k2) % 420690 if e == 0: continue691 hits = {}692 for t in range(420): hits[e * t % 420] = hits.get(e * t % 420, 0) + 1693 ok &= set(hits) == set(range(0, 420, gcd(e, 420))) and all(c == gcd(e, 420) for c in hits.values())694 R.check("U4", "4 orbit-trivial characters (the sector labels), 1676 nontrivial; the sampled nontrivial characters cancel exactly over one recurrence", ok)695 ok = True696 for k in [1, 3, 10, 100]:697 z = pow(g, k, p)698 ok &= (sum(pow(z, t, p) for t in range(420)) % p == 0) == (k % 420 != 0)699 R.check("U5", "the carrier-internal reduction: the nontrivial character sums vanish in F_421", ok)700 R.check("U6", "the Born window guard of the worked pair state: 4 ||psi||^2 = 16 < 421", 4 * 4 < p)701702703# ------------------------------------------------------------------------------------------------------------704# block M: m-body synchronisation (synchronisation.py, 22:C15)705# The cycles C_N are equal, and the single drive acts diagonally on C_N^m. The offset vector ρ(u) = (u_i u_1^{-1}) is706# conserved on every configuration. Every orbit has length N, and ρ labels the N^{m-1} orbits bijectively. The707# synchronised orbit is the unique one with ρ = 1, and on it |Σ_i χ(u_i)|² = m². Over an offset-uniform sector the708# average is m, by the orthogonality of the characters (exact in ℤ[ζ_N]). The checks are exhaustive on F_641/C_16709# (m ≤ 4) and on F_13/C_4 (m ≤ 6).710@R.block("M", BLOCK["M"])711def block_M():712 """Block M — synchronisation.py (EXACT): M1–M5, the package's 26 checks."""713 CARRIERS = [(641, 3, 16), (13, 2, 4)]714 CASES = [(0, 2), (0, 3), (0, 4), (1, 2), (1, 3), (1, 4), (1, 6)]715 ok = all(p % 4 == 1 and arith.order(g, p) == p - 1 and arith.order(pow(g, (p - 1) // N, p), p) == N and (p - 1) % N == 0716 for p, g, N in CARRIERS)717 R.check("M1", "F_641 (C_16, g_0 = 601, as in the composite gate) and F_13 (C_4): admissible carriers and drives", ok and pow(3, 640 // 16, 641) == 601)718 ok2 = ok3 = ok4 = True; det = []719 for ci, m in CASES:720 p, g, N = CARRIERS[ci]721 g0 = pow(g, (p - 1) // N, p)722 H = [pow(g0, j, p) for j in range(N)]723 inv = {h: pow(h, -1, p) for h in H}724 drive = lambda u: tuple(g0 * x % p for x in u)725 rho = lambda u: tuple(x * inv[u[0]] % p for x in u[1:])726 configs = list(product(H, repeat=m))727 ok2 &= len(configs) == N ** m and all(rho(drive(u)) == rho(u) for u in configs)728 seen, orbits = set(), []729 for u in configs:730 if u in seen: continue731 orb, x = [], u732 for _ in range(N + 1):733 orb.append(x); seen.add(x); x = drive(x)734 if x == u: break735 orbits.append(orb)736 fibres = {}737 for u in configs: fibres.setdefault(rho(u), []).append(u)738 ok3 &= all(len(o) == N for o in orbits) and len(orbits) == N ** (m - 1)739 ok3 &= all(len({rho(x) for x in o}) == 1 for o in orbits) and len({rho(o[0]) for o in orbits}) == len(orbits)740 ok3 &= len(fibres) == N ** (m - 1) and all(len(f) == N for f in fibres.values())741 ok4 &= set(fibres[(1,) * (m - 1)]) == {(w,) * m for w in H}742 Z = Cyclotomic(N)743 for s in range(N): # on Δ all m phases coincide744 for k in range(N):745 S = Z.sum(Z.zeta(k * s) for _ in range(m))746 ok4 &= S == Z.zeta(k * s, m) and Z.norm2(S) == Z.const(m * m)747 det.append(f"F_{p} C_{N} m={m}: {N ** m} configs, {len(orbits)} orbits")748 R.check("M2", "the offset vector is conserved by the drive on every configuration (all seven cases)", ok2, "; ".join(det))749 # 22:C15 (p22031)750 R.check("M3", "every orbit has length N, there are N^(m-1) orbits, and the offset vector labels them bijectively (each fibre is one orbit)", ok3)751 R.check("M4", "the synchronised orbit is the unique zero-offset orbit, of length N; on it sum_i chi(u_i) = m chi(w), |.|^2 = m^2 exactly (Z[zeta_N])", ok4)752 zero = lambda N, k: Cyclotomic(N).sum(Cyclotomic(N).zeta(k * s) for s in range(N)) == Cyclotomic(N).zero753 ok = all(zero(N, k) for _, _, N in CARRIERS for k in range(1, N))754 ok &= all(zero(N, k) for N, m, k in [(4, 2, 1), (4, 3, 1), (4, 3, 2), (4, 6, 3), (16, 2, 1), (16, 3, 5)])755 R.check("M5", "character orthogonality sum_s zeta_N^{ks} = 0 (k != 0) for every nontrivial character of C_16 and C_4, so the offset-uniform average |sum_i chi(u_i)|^2 is m", ok)756757758# ------------------------------------------------------------------------------------------------------------759# block R: the real-versus-complex network (renou.py, 22:C18, P3)760# Two sources each emit |Φ+⟩. Alice measures X, Y and Z, Bob makes the Bell-state measurement, and Charlie measures the761# six (A ± B)/√2. The arithmetic is exact in Q(ζ_8), with √2 = ζ − ζ³ and i = ζ². Bob's four orbit-sector states are762# the Bell basis, and entanglement swapping holds. The conditional correlation table of the network equals the763# complex-quantum table entry by entry. The canonical witness is 6√2 exactly, above the protocol's real-quantum bound764# 7.6605. The sources are independent: the state factorises across the source cut, the two offsets are separately765# conserved, and the joint sector distribution is a product.766@R.block("R", BLOCK["R"])767def block_R():768 """Block R — renou.py (EXACT): R1–R5, the package's 10 checks."""769 Z = Cyclotomic(8)770 ZERO, ONE, I8 = Z.zero, Z.one, Z.zeta(2)771 S2 = Z.sub(Z.zeta(1), Z.zeta(3)) # √2772 HALF, S2INV = Z.const(Fr(1, 2)), Z.scale(Fr(1, 2), S2)773 def mat(a, b, c, d): return ((a, b), (c, d))774 X, Y, Zm = mat(ZERO, ONE, ONE, ZERO), mat(ZERO, Z.neg(I8), I8, ZERO), mat(ONE, ZERO, ZERO, Z.neg(ONE))775 ID = mat(ONE, ZERO, ZERO, ONE)776 madd = lambda A, B: tuple(tuple(Z.add(A[i][j], B[i][j]) for j in range(2)) for i in range(2))777 msca = lambda s, A: tuple(tuple(Z.mul(s, A[i][j]) for j in range(2)) for i in range(2))778 neg = lambda A: msca(Z.neg(ONE), A)779 AX = [X, Y, Zm]780 CZ = [msca(S2INV, madd(X, Y)), msca(S2INV, madd(X, neg(Y))), msca(S2INV, madd(Y, Zm)), msca(S2INV, madd(Y, neg(Zm))),781 msca(S2INV, madd(X, Zm)), msca(S2INV, madd(X, neg(Zm)))]782 ket = lambda k: {k: ONE}783 def kadd(u, v):784 w = dict(u)785 for k, a in v.items(): w[k] = Z.add(w.get(k, ZERO), a)786 return {k: a for k, a in w.items() if a != ZERO}787 ksca = lambda s, u: {k: Z.mul(s, a) for k, a in u.items()}788 def braket(u, v): return Z.sum(Z.mul(Z.conj(u[k]), a) for k, a in v.items() if k in u)789 bit = lambda k, q: (k >> (3 - q)) & 1790 def apply1(M, q, u):791 out = {}792 for k, a in u.items():793 for nb in (0, 1):794 if M[nb][bit(k, q)] != ZERO:795 nk = (k & ~(1 << (3 - q))) | (nb << (3 - q))796 out[nk] = Z.add(out.get(nk, ZERO), Z.mul(M[nb][bit(k, q)], a))797 return {k: a for k, a in out.items() if a != ZERO}798 PSI = {}799 for a in (0, 1):800 for c in (0, 1): PSI = kadd(PSI, ket((a << 3) | (a << 2) | (c << 1) | c)) # |a a c c⟩801 def bell(off, sgn):802 return kadd(ket(0b0000), ksca(Z.const(sgn), ket(0b0110))) if off == 0 else kadd(ket(0b0100), ksca(Z.const(sgn), ket(0b0010)))803 BELL = {("Phi", 1): bell(0, 1), ("Phi", -1): bell(0, -1), ("Psi", 1): bell(1, 1), ("Psi", -1): bell(1, -1)}804 R.check("R1", "Bob's four orbit-sector states are the Bell basis: <b|b'> = 2 delta, exact",805 all(braket(BELL[x], BELL[y]) == (Z.const(2) if x == y else ZERO) for x in BELL for y in BELL))806807 def project_b(off, sgn, u):808 out = {}809 for k, a in u.items():810 b1, b2 = bit(k, 1), bit(k, 2)811 comp = {(0, (0, 0)): ONE, (0, (1, 1)): Z.const(sgn), (1, (0, 1)): ONE, (1, (1, 0)): Z.const(sgn)}.get((off, (b1, b2)))812 if comp is None: continue813 out[k & 0b1001] = Z.add(out.get(k & 0b1001, ZERO), Z.mul(Z.conj(comp), a))814 return out815 SIG = {("Phi", 1): ID, ("Phi", -1): Zm, ("Psi", 1): X, ("Psi", -1): None}816 def reference(name_sgn):817 ref = kadd(ket(0b0000), ket(0b1001))818 return apply1(SIG[name_sgn], 3, ref) if SIG[name_sgn] is not None else apply1(Zm, 3, apply1(X, 3, ref))819 ok = True820 for (name, sgn) in SIG:821 cond, ref = project_b(0 if name == "Phi" else 1, sgn, PSI), reference((name, sgn))822 lam, good = None, True823 for k in set(cond) | set(ref):824 c, r = cond.get(k, ZERO), ref.get(k, ZERO)825 if r == ZERO:826 good &= c == ZERO; continue827 l = c if r == ONE else Z.neg(c)828 if lam is None: lam = l829 elif l != lam: good = False830 ok &= good and lam is not None and lam != ZERO831 R.check("R2", "entanglement swapping: conditioned on Bob's outcome b the A-C state is (1 x sigma_b)|Phi+>, all four outcomes, exact", ok)832833 expect2 = lambda A, C, u: braket(u, apply1(A, 0, apply1(C, 3, u)))834 okT = okP = True; table = {}835 for (name, sgn) in BELL:836 cond = project_b(0 if name == "Phi" else 1, sgn, PSI)837 okP &= braket(cond, cond) == Z.const(2)838 ref = reference((name, sgn))839 for xi, A in enumerate(AX):840 for zi, C in enumerate(CZ):841 t = Z.mul(expect2(A, C, cond), HALF)842 okT &= t == Z.mul(expect2(A, C, ref), HALF)843 table[(name, sgn, xi, zi)] = t844 # The complex-quantum table in closed form, written without the operators: on (1 x sigma_b)|Phi+> the expectation845 # <P x P'> is [P = P'] e(P) s_b(P) with e(X) = e(Z) = 1, e(Y) = -1 (Y^T = -Y) and s_b(P) = +-1 as sigma_b commutes846 # or anticommutes with P; C_z = (P_u +- P_v)/sqrt2 gives (e(u) s_b(u) [A = P_u] +- e(v) s_b(v) [A = P_v])/sqrt2.847 E_ = {"X": 1, "Y": -1, "Z": 1}848 comm = lambda a, b: 1 if (a == b or a == "I" or b == "I") else -1849 SIGB = {("Phi", 1): "I", ("Phi", -1): "Z", ("Psi", 1): "X", ("Psi", -1): "Y"}850 CZn, AXn = [("X", "Y", 1), ("X", "Y", -1), ("Y", "Z", 1), ("Y", "Z", -1), ("X", "Z", 1), ("X", "Z", -1)], ["X", "Y", "Z"]851 def closed(name, sgn, xi, zi):852 u, w, sg = CZn[zi]; a_, sb = AXn[xi], SIGB[(name, sgn)]853 return Z.scale(Fr((E_[u] * comm(sb, u) if a_ == u else 0) + sg * (E_[w] * comm(sb, w) if a_ == w else 0)), S2INV)854 okC = all(table[k] == closed(*k) for k in table) and len(table) == 72 and Z.mul(S2, S2) == Z.const(2) and S2 != ZERO855 # 22:C18 (p22034)856 R.check("R3", "P(b) = 1/4 for each Bell outcome; the full conditional table <A_x C_z | b> (3 x 6 x 4 entries) equals the complex-quantum table exactly, computed in closed form from the Pauli commutation signs (entries 0 and +-1/sqrt2), and the reference states",857 okT and okP and okC)858859 def gt_q2(x, y): # a + b√2 > c + d√2, exactly860 pp, q = x[0] - y[0], x[1] - y[1]861 if q == 0: return pp > 0862 if pp >= 0 and q > 0: return True863 if pp <= 0 and q < 0: return False864 if pp > 0 and q < 0: return pp * pp > 2 * q * q865 return 2 * q * q > pp * pp866 pairs = {("X", "Y"): (0, 1, 0, 1), ("Y", "Z"): (1, 2, 2, 3), ("X", "Z"): (0, 2, 4, 5)}867 score = ZERO868 for (name, sgn) in BELL:869 for (xj, xk, zp, zm) in pairs.values():870 best = None871 for s1, s2, s3, s4 in product((1, -1), repeat=4):872 v = Z.sum([Z.scale(s1, table[(name, sgn, xj, zp)]), Z.scale(s2, table[(name, sgn, xk, zp)]),873 Z.scale(s3, table[(name, sgn, xj, zm)]), Z.scale(s4, table[(name, sgn, xk, zm)])])874 rp = (v[0], (v[1] - v[3]) * Fr(1, 2)) # Re v = v0 + (v1 − v3)/2 · √2875 if best is None or gt_q2(rp, best[0]): best = (rp, v)876 score = Z.add(score, best[1])877 # 22:P3 (p22054)878 R.check("R4", "the canonical witness: score/4 = 6 sqrt 2 = 6(zeta - zeta^3) exactly (score 24 sqrt 2), three conditional CHSH at 2 sqrt 2; 72 > 7.6605^2, above the real-quantum bound",879 Z.scale(Fr(1, 4), score) == Z.scale(6, S2) and score == Z.scale(24, S2) and Z.is_rational(Z.norm2(Z.scale(Fr(1, 4), score)))880 and Z.norm2(Z.scale(Fr(1, 4), score))[0] == 72 and 72 > Fr(76605, 10000) ** 2)881882 def k_of(i, j): return ((i >> 1) << 3) | ((i & 1) << 2) | ((j >> 1) << 1) | (j & 1)883 amp = [[PSI.get(k_of(i, j), ZERO) for j in range(4)] for i in range(4)]884 src = [ONE, ZERO, ZERO, ONE]885 ok5a = all(Z.sub(Z.mul(amp[i][j], amp[i2][j2]), Z.mul(amp[i][j2], amp[i2][j])) == ZERO for i, i2, j, j2 in product(range(4), repeat=4))886 ok5a &= all(amp[i][j] == Z.mul(src[i], src[j]) for i in range(4) for j in range(4))887 def drive_pair(u, qx, qy):888 out = {}889 for k, a in u.items():890 nk = k ^ (1 << (3 - qx)) ^ (1 << (3 - qy)); out[nk] = Z.add(out.get(nk, ZERO), a)891 return {k: a for k, a in out.items() if a != ZERO}892 offset = lambda k, qx, qy: bit(k, qx) ^ bit(k, qy)893 D1, D2 = (lambda u: drive_pair(u, 0, 1)), (lambda u: drive_pair(u, 2, 3))894 ok5b = True895 for k in range(16):896 k1, k2 = next(iter(D1(ket(k)))), next(iter(D2(ket(k))))897 ok5b &= offset(k1, 0, 1) == offset(k, 0, 1) and offset(k2, 2, 3) == offset(k, 2, 3)898 ok5b &= offset(k1, 2, 3) == offset(k, 2, 3) and offset(k2, 0, 1) == offset(k, 0, 1) and D1(D2(ket(k))) == D2(D1(ket(k)))899 wt, tot = {}, ZERO900 for k, a in PSI.items():901 w = Z.mul(Z.conj(a), a); s = (offset(k, 0, 1), offset(k, 2, 3))902 wt[s] = Z.add(wt.get(s, ZERO), w); tot = Z.add(tot, w)903 m1, m2 = {0: ZERO, 1: ZERO}, {0: ZERO, 1: ZERO}904 for (o1, o2), w in wt.items(): m1[o1] = Z.add(m1[o1], w); m2[o2] = Z.add(m2[o2], w)905 ok5c = all(Z.mul(wt.get((o1, o2), ZERO), tot) == Z.mul(m1[o1], m2[o2]) for o1 in (0, 1) for o2 in (0, 1))906 R.check("R5", "source independence: the state factorises across the source cut (every 2 x 2 minor vanishes); the two offsets are separately conserved by commuting drives; the joint sector distribution is the product of its marginals",907 ok5a and ok5b and ok5c)908909910# ------------------------------------------------------------------------------------------------------------911# block B: the gravitational channel (bmv.py, 22:C19, P1)912# Two clusters in path superposition carry the conditional phase ζ_80^k on |11⟩, with amplitudes (1, 1, 1, ζ^k). At913# k = 0 the state is a product. Over the sweep C² = |ad − bc|²/4 = sin²(φ/2) exactly. The Horodecki bound is914# S²_max = 4 + |ad − bc|², above 4 for k ≠ 0 and equal to 8 at φ = π. The coupling commutes with the drive, and Alice's915# marginal ignores Bob's local operations. The complementarity V² + C² = 1 holds as a ring identity.916@R.block("B", BLOCK["B"])917def block_B():918 """Block B — bmv.py (EXACT): B1–B5, the package's 6 checks."""919 Z = Cyclotomic(80)920 amps = lambda k: [Z.one, Z.one, Z.one, Z.zeta(k)]921 det = lambda a: Z.sub(Z.mul(a[0], a[3]), Z.mul(a[1], a[2]))922 R.check("B1", "zero coupling: ad - bc = 0 exactly, a product state (concurrence 0)", det(amps(0)) == Z.zero)923 c2 = [Z.norm2(det(amps(k))) for k in range(80)]924 # 22:C19 (p22035)925 R.check("B2", "4 C^2 = |ad - bc|^2 = 2 - zeta^k - zeta^-k, i.e. C^2 = sin^2(phi/2) exactly, the full sweep phi = 2 pi k/80",926 all(c2[k] == Z.sub(Z.const(2), Z.add(Z.zeta(k), Z.zeta(-k))) for k in range(80)))927 smax2 = [Z.add(Z.const(4), c) for c in c2]928 R.check("B3", "Horodecki S_max^2 = 4(1 + C^2) = 4 + |ad - bc|^2: above 4 for every k != 0, and 8 (S_max = 2 sqrt 2) at phi = pi",929 all(c2[k] != Z.zero for k in range(1, 80)) and smax2[40] == Z.const(8))930 II, ONE, ZERO = Z.zeta(20), Z.one, Z.zero931 locB = [[[ZERO, ONE], [ONE, ZERO]], [[ONE, ZERO], [ZERO, Z.neg(ONE)]], [[ZERO, Z.neg(II)], [II, ZERO]]]932 rhoA = lambda psi: [[Z.add(Z.mul(psi[2 * a], Z.conj(psi[2 * b])), Z.mul(psi[2 * a + 1], Z.conj(psi[2 * b + 1]))) for b in (0, 1)] for a in (0, 1)]933 Dd = [ONE, II, II, Z.neg(ONE)]934 ok_a = ok_b = True935 for k in (1, 7, 20, 40, 63):936 Gd = [ONE, ONE, ONE, Z.zeta(k)]937 ok_a &= all(Z.mul(Gd[j], Dd[j]) == Z.mul(Dd[j], Gd[j]) for j in range(4))938 psi = amps(k)939 for U in locB:940 psiU = [Z.add(Z.mul(U[b][0], psi[2 * a]), Z.mul(U[b][1], psi[2 * a + 1])) for a in (0, 1) for b in (0, 1)]941 ok_b &= rhoA(psiU) == rhoA(psi)942 R.check("B4", "the coupling commutes with the diagonal drive (offset-diagonal); Alice's reduced state is invariant under Bob's local X, Y, Z (no signalling), exact", ok_a and ok_b)943 # The visibility from the reduced state: for the unnormalised amplitudes (1, 1, 1, zeta^k) the norm is 4 and944 # Alice's reduced matrix has the off-diagonal rho_01 = (1 + zeta^-k)/4, so V = 2 |rho_01| gives 4 V^2 = |1 + zeta^k|^2;945 # the concurrence from the determinant (B2): 4 C^2 = |ad - bc|^2. Their sum is computed, not asserted.946 ok = True947 for k in range(80):948 rho = rhoA(amps(k))949 v2 = Z.norm2(rho[0][1]) # 4 V^2 = |rho_01|^2 (the norm 4 absorbed)950 ok &= Z.add(v2, c2[k]) == Z.const(4) and v2 == Z.add(Z.const(2), Z.add(Z.zeta(k), Z.zeta(-k)))951 ok &= Z.norm2(rhoA(amps(0))[0][1]) == Z.const(4) and Z.norm2(rhoA(amps(40))[0][1]) == Z.zero952 # 22:P1 (p22052)953 R.check("B5", "the complementarity V^2 + C^2 = 1 over the full sweep, with 4V^2 = |rho_01|^2 computed from Alice's reduced state and 4C^2 = |ad - bc|^2 from the determinant: the sum is 4 at every k, V = 1 at k = 0 and V = 0 at the half turn", ok)954955956# ------------------------------------------------------------------------------------------------------------957# block Q: the decoherence floor (decoherence.py, 22:C7, C20)958# Over ℚ(ζ_40) an isolated doublet keeps contrast 1 at every drive time. The dilation dephasing V(τ)² = |Σ_E p_E ζ^{Eτ}|²959# is real and equals 1 at τ = 0. Its Gaussian envelope for the binomial distribution is computed in floating point, in960# the chart. The revival V(40)² = 1 is exact. Over ℤ[ζ_7] (F_421, O_29, quotient C_7) the snapshot pair-count of961# ψ_0 + ψ_4 is not an integer. The registered drive-frequency count over the recurrence lcm(60, 28) = 420 is 13440 for962# every outcome, so P = 1/7.963@R.block("Q", BLOCK["Q"])964def block_Q():965 """Block Q — decoherence.py (EXACT; Q3 CHART): Q1–Q7, the package's 7 checks."""966 n = 40967 Z = Cyclotomic(n)968 ok = True969 for j in (0, 3, 11):970 for tau in (0, 1, 5, 17, 39):971 vals = [Z.add(Z.const(2), Z.add(Z.zeta(j + 8 * tau + jp), Z.zeta(-(j + 8 * tau + jp)))) for jp in range(n)]972 ok &= Z.const(4) in vals and Z.zero in vals973 # 22:C20 (p22036)974 R.check("Q1", "an isolated doublet keeps fringe contrast 1 exactly (weights 4 and 0 both occur) at every drive time and phase: no spontaneous collapse", ok)975 M = 8976 pE = {E: Fr(comb(M, E), 2 ** M) for E in range(M + 1)}977 def V2(tau):978 s = Z.from_exponents((E * tau, c) for E, c in pE.items())979 return Z.norm2(s)980 R.check("Q2", "V(tau)^2 = |characteristic function of the internal windings|^2 is real for every drive time and 1 at tau = 0, exact",981 all(V2(t) == Z.conj(V2(t)) for t in range(n)) and V2(0) == Z.one)982 env = CQ.envelope(M, n, (1, 2, 3, 4))983 R.check("Q3", "the Gaussian envelope V = exp(-sigma^2 theta^2/2) of the binomial distribution (sigma^2 = M/4) within 0.02, tau = 1..4: the large-M image of the exact ring form",984 all(abs(chi - ga_) <= Fr(2, 100) for _, chi, ga_ in env), "; ".join(f"tau={t}: {chi:.4f} vs {ga_:.4f}" for t, chi, ga_ in env), kind="CHART")985 R.check("Q4", "the exact revival V(n)^2 = 1 at the cycle period n = 40: dephasing, never collapse", V2(n) == Z.one)986987 Z7 = Cyclotomic(7)988 T7 = lcm(60, 28)989 Psi = lambda a: Z7.scale(4, Z7.add(Z7.one, Z7.zeta(a)))990 snap = [Z7.norm2(Psi(a)) for a in range(7)]991 tot = Z7.sum(snap)992 R.check("Q5", "the snapshot pair-count w_0(1) = 16(2 + zeta_7 + zeta_7^-1) is a real algebraic integer not in Z; the sum over the seven outcomes is 224",993 not Z7.is_rational(snap[1]) and tot == Z7.const(224))994 W = [Z7.sum(Z7.norm2(Psi(a - t)) for t in range(T7)) for a in range(7)]995 Wv = [w[0] for w in W]996 R.check("Q6", "the registered drive-frequency count W_0(a) = 13440 = 420 * 32 for every outcome over the recurrence T = lcm(60, 28) = 420: an ordinary integer, uniform",997 all(Z7.is_rational(w) for w in W) and len(set(Wv)) == 1 and Wv[0] == 13440)998 R.check("Q7", "the registered probability P_0(a) = 1/7; the count per chronon is 32 = |c_0|^2 + |c_4|^2 (incoherent)",999 Fr(Wv[0], sum(Wv)) == Fr(1, 7) and Wv[0] // T7 == 16 + 16)100010011002# ------------------------------------------------------------------------------------------------------------1003# block E: the two scaling laws and the equivalence principle (equivalence.py, 22:C22)1004# The Poisson equation on the periodic 4 x 4 x 4 lattice is solved exactly over ℚ, in the zero-mean gauge. The field is1005# linear in its sources, and a cluster of m sources has coefficient exactly m. The acceleration of a locked test cluster1006# is independent of its mass, so η = 0. For unlocked phases E|Σζ^θ|² = m by character orthogonality, against m² for a1007# locked cluster. The sampled √m scaling runs in floating point, in the chart. In the package it is an illustration1008# that decides nothing.1009@R.block("E", BLOCK["E"])1010def block_E():1011 """Block E — equivalence.py (EXACT): E1–E4, the package's exact checks (its sampled illustration, which decided nothing, is not carried)."""1012 L = 4; Ncell = L ** 31013 idx = lambda x, y, z: (x % L) * L * L + (y % L) * L + (z % L)1014 A = [[0] * Ncell for _ in range(Ncell)]1015 for X, Y, Zc in product(range(L), repeat=3):1016 i = idx(X, Y, Zc); A[i][i] = -61017 for dx, dy, dz in ((1, 0, 0), (-1, 0, 0), (0, 1, 0), (0, -1, 0), (0, 0, 1), (0, 0, -1)): A[i][idx(X + dx, Y + dy, Zc + dz)] += 11018 def solve(rhos):1019 """A u = −(ρ − mean ρ) with Σu = 0 (the last row replaced by the gauge), by Gauss–Jordan over ℚ, every ρ at once."""1020 Mx = [[Fr(a) for a in A[i]] + [-(Fr(r[i]) - Fr(sum(r), Ncell)) for r in rhos] for i in range(Ncell)]1021 Mx[-1] = [Fr(1)] * Ncell + [Fr(0)] * len(rhos)1022 for col in range(Ncell):1023 piv = next(r for r in range(col, Ncell) if Mx[r][col] != 0)1024 Mx[col], Mx[piv] = Mx[piv], Mx[col]1025 pv = Mx[col][col]; Mx[col] = [v / pv for v in Mx[col]]1026 for r in range(Ncell):1027 if r != col and Mx[r][col] != 0:1028 f = Mx[r][col]; Mx[r] = [vr - f * vc for vr, vc in zip(Mx[r], Mx[col])]1029 return [[Mx[i][Ncell + j] for i in range(Ncell)] for j in range(len(rhos))]1030 rho1, rho2, unit = [0] * Ncell, [0] * Ncell, [0] * Ncell1031 rho1[idx(0, 0, 0)] = 3; rho2[idx(2, 1, 3)] = 7; unit[idx(0, 0, 0)] = 11032 u1, u2, u12, uu = solve([rho1, rho2, [a + b for a, b in zip(rho1, rho2)], unit])1033 R.check("E1", "exact superposition on the lattice: u(m1 + m2) = u(m1) + u(m2) in all 64 cells (rational arithmetic)", all(a + b == c for a, b, c in zip(u1, u2, u12)))1034 # 22:C22 (p22038)1035 R.check("E2", "the source coefficient is exactly m: u(m = 3 cluster) = 3 u(unit), every cell, and u(m = 7) = 7 u(unit) (the field linear in its sources, coefficient m)",1036 all(3 * a == b for a, b in zip(uu, u1)) and solve([[7 * r for r in unit]])[0] == [7 * a for a in uu])1037 # The pull on a locked test cluster of m_t unit cells at a probe of nonzero gradient: each cell responds to the1038 # solved field, so the pull is m_t times the gradient and the acceleration pull/m_t is the gradient, for m_t = 31039 # and 7 — the lattice model's reading of eta = 0 (the row's exact content is E1, E2 and E4; this is their consequence).1040 probe = next(P for P in product(range(L), repeat=3) if u12[idx(P[0] + 1, P[1], P[2])] - u12[idx(P[0] - 1, P[1], P[2])] != 0)1041 gx = u12[idx(probe[0] + 1, probe[1], probe[2])] - u12[idx(probe[0] - 1, probe[1], probe[2])]1042 pull = {mt: sum(gx for _ in range(mt)) for mt in (3, 7)}1043 R.check("E3", "the equivalence principle as the model's null: at a probe of nonzero gradient the pull on a locked cluster of m_t cells is m_t times the gradient, so the acceleration pull/m_t is the gradient for m_t = 3 and 7 (eta = 0 by construction, the content being E1, E2, E4)",1044 gx != 0 and all(pull[mt] / mt == gx for mt in (3, 7)), f"probe {probe}, grad u = {gx}")1045 Z8 = Cyclotomic(8)1046 R.check("E4", "unlocked phases: E|sum zeta^theta|^2 = m exactly (the m^2 - m cross terms vanish, sum_k zeta_8^k = 0); a locked cluster gives m^2, |5 zeta|^2 = 25",1047 Z8.sum(Z8.zeta(k) for k in range(8)) == Z8.zero and Z8.norm2(Z8.zeta(1, 5)) == Z8.const(25))104810491050# ------------------------------------------------------------------------------------------------------------1051# block G: the granularity ceiling (granularity.py, 22:C14, P5)1052# The arithmetic is exact in ℚ(ζ_8), with 1/√2 = (ζ − ζ³)/2. After k Hadamard layers the minimal denominator is1053# 2^⌈k/2⌉, and the minimal tally norm is W(k) = 2^k (k even) or 2^(k+1) (k odd). The ceiling is the largest k with1054# d·W(k) < Ω. In F_641 it is k* = 8 for the unit core and 6 for the Bell core (d = 8). At the master's anchor1055# Ω ∼ 1.3 × 10^123 it is 408 and 204 at √Ω, by the bit length of the certified bracket's ends. Past k* two valid lifts1056# give different Born ratios, and they differ by multiples of Ω. Over ℚ(i) the Gaussian Hadamard gives the same law.1057@R.block("G", BLOCK["G"])1058def block_G():1059 """Block G — granularity.py (EXACT): G1–G7, the package's 7 checks (and the corpus ceilings it prints)."""1060 Z = Cyclotomic(8)1061 S2INV = Z.scale(Fr(1, 2), Z.sub(Z.zeta(1), Z.zeta(3)))1062 ok1 = ok2 = True1063 W = lambda k: 2 ** k if k % 2 == 0 else 2 ** (k + 1)1064 for k in range(1, 13):1065 amp = Z.const(Fr(1))1066 for _ in range(k): amp = Z.mul(amp, S2INV)1067 D = 11068 for f in amp:1069 if f != 0: D = lcm(D, Fr(f).denominator)1070 ints = [int(Fr(f) * D) for f in amp]1071 ok1 &= D == 2 ** ((k + 1) // 2) and gcd(*ints) == 11072 n1 = Z.norm2(tuple(ints))1073 ok2 &= Z.is_rational(n1) and 2 ** k * n1[0] == W(k)1074 R.check("G1", "the denominator law: after k Hadamard layers the minimal denominator is 2^ceil(k/2), k = 1..12, exact in Q(zeta_8) (2 ramified)", ok1)1075 R.check("G2", "the tally law: the minimal integer-tally norm is 2^k (k even) and 2^(k+1) (k odd), exactly", ok2)1076 p = 6411077 kstar, kstar8 = max(k for k in range(1, 12) if W(k) < p), max(k for k in range(1, 12) if 8 * W(k) < p)1078 # 22:C14 (p22030)1079 R.check("G3", "the exact ceilings in F_641: k* = max{k : W(k) < 641} = 8 (unit core, bit-length label 9); max{k : 8 W(k) < 641} = 6 (Bell core)",1080 kstar == 8 and p.bit_length() - 1 == 9 and kstar8 == 6, f"k* = {kstar}, Bell core {kstar8}")1081 # The ceiling at the master's anchor (00:A7, the scale import's certified bracket, frc/chart.py): T(k) < Omega iff1082 # k + [k odd] <= floor(log2 Omega), the bit length less one, so k* = b - b % 2 for b = floor(log2 Omega); no number1083 # above Omega is formed. Both ends of the bracket have bit length 410 (b = 409), and their integer square roots bit1084 # length 205 (b = 204).1085 lo, hi = CH.omega_bracket()1086 ends = (int(lo), int(hi) + 1)1087 bits = {e.bit_length() - 1 for e in ends}1088 rbits = {isqrt(e).bit_length() - 1 for e in ends}1089 kstar_of = lambda b: b - b % 21090 dO = {kstar_of(b) for b in bits}; dsO = {kstar_of(b) for b in rbits}1091 passes = lambda k, b: k + k % 2 <= b # W(k) = 2^(k + k%2) < Omega iff k + k%2 <= b, read on the exponent: no number above Omega is formed1092 ok = len(bits) == 1 and len(rbits) == 11093 ok &= all(W(kstar_of(b)) < e and passes(kstar_of(b), b) and not passes(kstar_of(b) + 1, b) for b in bits for e in ends)1094 ok &= all(W(kstar_of(b)) < isqrt(e) and passes(kstar_of(b), b) and not passes(kstar_of(b) + 1, b) for b in rbits for e in ends)1095 ok &= all(e // 10 ** 123 == 1 for e in ends)1096 # 22:P5 (p22056)1097 R.check("G4", "the ceilings at the master's anchor Omega ~ 1.3 x 10^123 (the certified bracket of the scale import, 00:A7), by the bit length of its ends: k* = 408 for the unit core and 204 at the coherence horizon sqrt(Omega)",1098 ok and dO == {408} and dsO == {204}, f"k* = {sorted(dO)} (Omega, bit length {sorted(b + 1 for b in bits)}), {sorted(dsO)} (sqrt Omega)")1099 ok3a = ok3b = ok4 = True1100 for k in range(1, 12):1101 Wk = W(k); wplus = Wk // 2 + 2 ** (k // 2)1102 if k <= kstar and Wk < p: ok3a &= wplus < p1103 if Wk > p:1104 sh = wplus % p1105 ok4 &= (sh + p) - sh == p1106 ok3b &= Fr(sh, Wk) != Fr(sh + p, Wk)1107 R.check("G5", "sub-horizon depths have the unique window lift; past k* two valid lifts give different Born ratios (the ambiguity onset)", ok3a and ok3b)1108 R.check("G6", "the lift discrepancies are multiples of p (wrap quantisation)", ok4)1109 h = (Fr(1, 2), Fr(1, 2))1110 H = [[h, h], [h, (-h[0], -h[1])]]1111 Pm = [[ga(gm(H[a][0], gc(H[b][0])), gm(H[a][1], gc(H[b][1]))) for b in range(2)] for a in range(2)]1112 ok7 = Pm == [[(1, 0), (0, 0)], [(0, 0), (1, 0)]] and all(gnorm(x) == Fr(1, 2) for row in H for x in row)1113 for k in range(1, 13):1114 z = (1, 0)1115 for _ in range(k): z = (z[0] - z[1], z[0] + z[1]) # (1 + i)^k1116 den = 2 ** k1117 g_ = gcd(gcd(abs(z[0]) or den, abs(z[1]) or den), den)1118 ok7 &= den // g_ == 2 ** ((k + 1) // 2) and 2 ** k * 2 ** (2 * ((k + 1) // 2) - k) == W(k)1119 R.check("G7", "the conductor-4 splitting law: the Gaussian Hadamard (1 + i)/2 is unitary and balanced over Q(i); denominator 2^ceil(k/2) and tally norm W(k) with no zeta_8 (k = 1..12)", ok7)112011211122# ------------------------------------------------------------------------------------------------------------1123# block T: the two probability strata (stratum.py, 22:C10, C11)1124# The two-way part of ℤ[i] is the tally line. On Ω = 641 the engineered-core weights W± = 2 ± r (r² = 2) are exact1125# residues. The element c = 1 + ζ_12 marks the hypothesis boundary, and r is a grid point g^n of the Subject chart. The1126# framed readout uses the integer square root. Its instances are 23/54, the largest-remainder allocation1127# 35 + 34 + 6 + 6 = 81, the grid nesting, the √3 instance and the canonical radicands. The conjugate-pair trace tally1128# is computed in ℤ[√2]. The dial-ensemble Parseval tally (160) is computed in ℤ[x]/(x^40 + 1), the ring of the package.1129@R.block("T", BLOCK["T"])1130def block_T():1131 """Block T — stratum.py (EXACT): T1–T11, the package's 12 checks."""1132 # The counting Born rule on a fixed Gaussian-integer state over the Object cycle C_12 of F_157 (g_O = 22, the core1133 # Q4, channels (r, a)): the channel weights w = N(Psi_{r,a}) are integers below the window Omega = 641, so each is1134 # the unique lift of its shadow; the drive U psi(u) = psi(g^-1 u) presents the ensemble, and the coincidence counts1135 # registered over its completed period of 12 chronons (on one fibre, and on all) give the registered frequencies,1136 # framed rationals equal to the structural ratios sum_a w_{r,a} / W with W = 4 ||psi||^2 (Parseval): the two strata1137 # coincide on the stationary core-valued sector, and the ratios sum to 1.1138 pT, gT, Om = 157, 22, 157 # the window is the carrier's count1139 HT = sorted({pow(gT, k, pT) for k in range(12)})1140 psiT = {u: ((i % 5) - 2, (i % 3) - 1) for i, u in enumerate(HT)}1141 def ampT(state, r, a):1142 s_ = (0, 0)1143 for l in range(4): s_ = ga(s_, gm(gc(I4[(r * l) % 4]), state[pow(gT, a + 3 * l, pT)]))1144 return s_1145 ginv = pow(gT, 11, pT)1146 driveT = lambda st: {u: st[(u * ginv) % pT] for u in HT}1147 RAT = [(r, a) for r in range(4) for a in range(3)]1148 wT = {x: gnorm(ampT(psiT, *x)) for x in RAT}; WT = sum(wT.values())1149 lifts_ok = all(0 <= w_ < Om and (w_ % Om) == w_ for w_ in wT.values()) # below the window: the least lift of the shadow is the weight itself1150 st, cnt_all, cnt_one = psiT, {r: 0 for r in range(4)}, {r: 0 for r in range(4)}1151 for _ in range(12):1152 for r in range(4):1153 cnt_one[r] += gnorm(ampT(st, r, 0))1154 for a in range(3): cnt_all[r] += gnorm(ampT(st, r, a))1155 st = driveT(st)1156 freq_all = {r: Fr(cnt_all[r], sum(cnt_all.values())) for r in range(4)}1157 freq_one = {r: Fr(cnt_one[r], sum(cnt_one.values())) for r in range(4)}1158 struct = {r: Fr(sum(wT[(r, a)] for a in range(3)), WT) for r in range(4)}1159 ok = st == psiT and WT == 4 * sum(gnorm(z) for z in psiT.values()) and lifts_ok and any(w_ > 0 for w_ in wT.values())1160 ok &= freq_all == struct and freq_one == struct and sum(struct.values()) == 1 and all(f.denominator > 1 for f in struct.values())1161 ok &= all(WT % f.denominator == 0 for f in struct.values()) # framed rationals: denominators divide the tally W1162 # 22:C10 (p22026)1163 R.check("T1", "the counting Born rule on a fixed Z[i] state over C_12 of F_157: the channel weights N(Psi) are integers below the carrier's window 157, each the unique lift of its shadow; the coincidence counts over the drive's completed period (12 chronons, one fibre and all fibres) give registered frequencies equal to the structural ratios sum_a w / W, W = 4 ||psi||^2, framed rationals summing to 1 (the two strata coincide)",1164 ok, f"W = {WT}, ratios {[str(struct[r]) for r in range(4)]}")1165 R.check("T12", "the two-way (conjugation-invariant) part of Z[i] is the tally line b = 0 (exhaustive, |a|, |b| <= 6; the hypothesis boundary of the strata, an identity of Z[i])",1166 all((b == 0) == ((a, b) == (a, -b)) for a in range(-6, 7) for b in range(-6, 7)))1167 Om = 6411168 r = next(x for x in range(1, Om) if x * x % Om == 2)1169 Wp, Wm = (2 + r) % Om, (2 - r) % Om1170 R.check("T2", "on Omega = 641: r^2 = 2 exists (641 = 1 mod 8); W+ + W- = 4 and W+ W- = 2 exactly", (Wp + Wm) % Om == 4 and Wp * Wm % Om == 2, f"r = {r}")1171 Z = Cyclotomic(12)1172 zin = Z.sub(Z.zeta(1), Z.zeta(3)) # ζ_12^{-1} = ζ − ζ³1173 cc = Z.mul(Z.add(Z.one, Z.zeta(1)), Z.add(Z.one, zin))1174 R.check("T3", "zeta_12^-1 = zeta - zeta^3 exactly; c = 1 + zeta_12 gives c cbar = 2 + (zeta + zeta^-1), off the tally line (the hypothesis boundary)",1175 Z.mul(Z.zeta(1), zin) == Z.one and cc[0] == 2 and any(cc[1:]))1176 g = 31177 dl = {pow(g, k, Om): k for k in range(Om - 1)}1178 R.check("T4", "r is on the Subject zoom grid, r = g^n for the chart generator g = 3 (scale-periodic)", r in dl, f"r = 3^{dl[r]}")1179 s_n = lambda m, n: isqrt(m * g ** (2 * n))1180 num, den = 2 * g ** 4 + s_n(2, 4), 8 * g ** 41181 # 22:C11 (p22027), 22:X6 (p22049)1182 R.check("T5", "the framed readout R_4((2 + sqrt 2)/8) = (2*81 + 114)/(8*81) = 23/54, the grid bound s^2 <= 2 g^8 < (s + 1)^2 exact",1183 s_n(2, 4) == 114 and s_n(2, 4) ** 2 <= 2 * g ** 8 < (s_n(2, 4) + 1) ** 2 and Fr(num, den) == Fr(23, 54), f"{num}/{den}")1184 B = 811185 probs = [Fr(23, 54), Fr(23, 54), Fr(2, 27), Fr(2, 27)]1186 prov = [(B * q).numerator // (B * q).denominator for q in probs]1187 rem = [B * q - v for q, v in zip(probs, prov)]1188 counts = prov[:]1189 for t in range(B - sum(prov)): counts[sorted(range(4), key=lambda i: (-rem[i], i))[t]] += 11190 R.check("T6", "the largest-remainder allocation at B = 81: provisional 34 + 34 + 6 + 6, final 35 + 34 + 6 + 6 = 81", sum(counts) == B and counts == [35, 34, 6, 6], f"{prov} -> {counts}")1191 ok = all(s_n(2, n) ** 2 <= 2 * g ** (2 * n) < (s_n(2, n) + 1) ** 2 for n in range(1, 8))1192 R.check("T7", "the grid bound at every scale n = 1..7, and the readouts nest: s_{n+1} - 3 s_n in {0, .., 3}", ok and all(0 <= s_n(2, n + 1) - g * s_n(2, n) <= g for n in range(1, 8)))1193 R.check("T8", "the M3 readout: s_3(sqrt 3) = isqrt(3 * 3^6), grid bound exact", s_n(3, 3) ** 2 <= 3 * g ** 6 < (s_n(3, 3) + 1) ** 2, f"s_3 = {s_n(3, 3)}")1194 def canon(u, v, m, b):1195 f, d, mm = 1, 2, m1196 while d * d <= mm:1197 while mm % (d * d) == 0: mm //= d * d; f *= d1198 d += 11199 gg = gcd(gcd(abs(u), abs(v * f)), b)1200 return (u // gg, v * f // gg, mm, b // gg)1201 R.check("T9", "canonical radicands: sqrt(8)/4 reduces to the canonical triple of sqrt(2)/2, (0, 1, 2, 2) (a representation-independent readout)",1202 canon(0, 1, 8, 4) == (0, 1, 2, 2) and canon(0, 1, 2, 2) == (0, 1, 2, 2))1203 mul2 = lambda x, y: (x[0] * y[0] + 2 * x[1] * y[1], x[0] * y[1] + x[1] * y[0])1204 def pow2(x, n):1205 out = (1, 0)1206 for _ in range(n): out = mul2(out, x)1207 return out1208 t = {0: 2, 1: 4}1209 for m in range(2, 14): t[m] = 4 * t[m - 1] - 2 * t[m - 2]1210 ok = t[2] == 12 and t[3] == 401211 for Bn in range(1, 13):1212 for k in range(Bn + 1):1213 x, y = mul2(pow2((2, 1), k), pow2((2, -1), Bn - k)), mul2(pow2((2, -1), k), pow2((2, 1), Bn - k))1214 ok &= (x[0] + y[0], x[1] + y[1]) == (2 ** min(k, Bn - k) * t[abs(Bn - 2 * k)], 0)1215 def vec(e): # x^e in Z[x]/(x^40 + 1)1216 e %= 80; v = [0] * 401217 if e < 40: v[e] += 11218 else: v[e - 40] -= 11219 return v1220 vadd = lambda a, b: [x + y for x, y in zip(a, b)]1221 ok &= all(vadd(vec(40 - D), vec(D - 40)) == [-x for x in vadd(vec(D), vec(-D))] for D in range(80))1222 R.check("T10", "the conjugate-pair trace tally: W+^k W-^(B-k) + W-^k W+^(B-k) = 2^min(k, B-k) t_|B-2k| in Z[sqrt 2], B <= 12; w(40 - D) = -w(D) in Z[x]/(x^40 + 1)", ok)1223 def vmul(a, b):1224 out = [0] * 401225 for i, ai in enumerate(a):1226 if ai:1227 for j, bj in enumerate(b):1228 if bj:1229 if i + j < 40: out[i + j] += ai * bj1230 else: out[i + j - 40] -= ai * bj1231 return out1232 one = vec(0); sp = sm = spm = [0] * 401233 for D in range(80):1234 c = vadd(vec(D), vec(-D))1235 wp, wm = vadd([2 * x for x in one], c), vadd([2 * x for x in one], [-x for x in c])1236 sp, sm, spm = vadd(sp, wp), vadd(sm, wm), vadd(spm, vmul(wp, wm))1237 R.check("T11", "the dial-ensemble Parseval tally over Z_80: sum w+ = sum w- = sum w+ w- = 160 exactly in Z[x]/(x^40 + 1)",1238 sp == sm == spm == [160 * x for x in one])123912401241# ------------------------------------------------------------------------------------------------------------1242# block F: the coherent-fraction channel (gravfraction.py, 22:C21)1243# The cells live on C_16, with the ledger ℤ[ζ_16] (ζ^8 = −1). The synchronised branch phase is ζ^{m_c a}, and the1244# pairwise phase is ζ^{m_c1 m_c2 a}. The offset-spread systematic phase vanishes by complete character sums. The1245# envelope |Σ|² is m² when synchronised and 0 for a complete spread. The reduced channel Γ = ζ^{m_c a} χ_inc factorises,1246# and the mixed complementarity 4(V² + C²) = 2(1 + |Γ|²) holds. A complete-spread state is (1/4) times the partition1247# matrix of the four branches. It is PPT, hence separable, unless the partition has a block of three. Then the least1248# eigenvalue of its partial transpose is (1 − √3)/4 exactly. Locally additive spread phases never make a block of1249# three. The signs of the eigenvalues are decided from the exact characteristic polynomial.1250@R.block("F", BLOCK["F"])1251def block_F():1252 """Block F — gravfraction.py (EXACT): F1–F12, the package's 12 checks."""1253 Z = Cyclotomic(16)1254 zp = Z.zeta1255 def power(a, k): # (ζ^a)^k by k multiplications1256 out = Z.one1257 for _ in range(k): out = Z.mul(out, zp(a))1258 return out1259 R.check("F1", "the synchronised branch phase is zeta^{m_c a} exactly (amplitudes multiply), m_c in {2, 3, 4}, every unit phase a",1260 all(power(a, mc) == zp(mc * a) for a in range(1, 16) for mc in (2, 3, 4)))1261 R.check("F2", "the offset-spread systematic branch phase vanishes: sum_s zeta^{a s} = 0 over the complete sector, every a != 0",1262 all(Z.sum(zp(a * s) for s in range(16)) == Z.zero for a in range(1, 16)))1263 R.check("F3", "the pairwise entangling phase is zeta^{m_c1 m_c2 a} exactly", all(power(a, m1 * m2) == zp(m1 * m2 * a) for a in range(1, 16) for m1 in (2, 3) for m2 in (2, 4)))1264 sector = lambda offs, a: Z.sum(zp(a * s) for s in offs)1265 R.check("F4", "the envelope: |sync sum|^2 = m^2 = 16 exactly; the complete C_4 spread sums to 0", Z.norm2(sector([0, 0, 0, 0], 1)) == Z.const(16) and sector([0, 4, 8, 12], 1) == Z.zero)1266 avg = lambda offs, a, mc: Z.sum(Z.mul(zp(mc * a), zp(a * s)) for s in offs)1267 R.check("F5", "the reduced channel factorises: the ensemble average is zeta^{m_c a} chi_inc (complete spread: both zero)", avg([0, 4, 8, 12], 3, 2) == Z.mul(zp(6), sector([0, 4, 8, 12], 3)))1268 n2 = Z.norm2(sector([0, 0, 4, 8], 3))1269 R.check("F6", "a nonuniform thermal chi_inc: the factorisation is exact and 0 < |chi|^2 < m^2", avg([0, 0, 4, 8], 3, 2) == Z.mul(zp(6), sector([0, 0, 4, 8], 3)) and any(n2) and n2 != Z.const(16))1270 def comp(G):1271 m1 = Z.mul(Z.sub(Z.one, G), Z.sub(Z.one, Z.conj(G))); m2 = Z.mul(Z.add(Z.one, G), Z.add(Z.one, Z.conj(G)))1272 return Z.add(m1, m2) == Z.add(Z.const(2), Z.scale(2, Z.norm2(G)))1273 R.check("F7", "the mixed complementarity 4(V^2 + C^2) = 2(1 + |Gamma|^2) as a ring identity (every pure phase and the mixed zeta + zeta^6)",1274 all(comp(zp(e)) for e in range(16)) and comp(Z.add(zp(1), zp(6))))1275 R.check("F8", "the pure-channel 4C^2 = (1 - zeta^e)(1 - zeta^-e) = 2 - (zeta^e + zeta^-e) exactly (the sin^2 chart reading)",1276 Z.mul(Z.sub(Z.one, zp(3)), Z.sub(Z.one, zp(-3))) == Z.sub(Z.const(2), Z.add(zp(3), zp(-3))))1277 R.check("F9", "the complete spread kills every cross-branch coherence (a complete character sum): rho diagonal, separable", all(Z.sum(zp(d * s) for s in range(16)) == Z.zero for d in range(1, 16)))1278 q = Fr(1, 4)1279 rho = [[q if a == b else q * Fr(1, 2) for b in range(4)] for a in range(4)]1280 R.check("F10", "the symmetric damped state (systematic phase 0, Gamma = 1/2) is PPT, hence separable, exactly", nonneg_spectrum(partial_transpose(rho)))1281 def canon(labels):1282 seen = {}1283 return tuple(seen.setdefault(x, len(seen)) for x in labels)1284 part = lambda lab: [[q if lab[a] == lab[b] else 0 for b in range(4)] for a in range(4)]1285 parts = sorted({canon(l) for l in product(range(4), repeat=4)})1286 npt = [Fr(1), Fr(-1), Fr(3, 16), Fr(1, 32), Fr(-1, 128)] # (x − 1/4)²(x² − x/2 − 1/8): roots 1/4, 1/4, (1 ± √3)/41287 ok = len(parts) == 151288 for lab in parts:1289 pt = partial_transpose(part(lab))1290 ok &= charpoly(pt) == npt if 3 in [lab.count(v) for v in set(lab)] else nonneg_spectrum(pt)1291 # 22:C21 (p22037)1292 R.check("F11", "all 15 branch partitions at complete spread: NPT exactly at the blocks of three (spectrum of the partial transpose 1/4, 1/4, (1 +- sqrt 3)/4, least (1 - sqrt 3)/4), every other partition PPT", ok)1293 achievable = {canon(((aL + bL) % n, (aL + bR) % n, (aR + bL) % n, (aR + bR) % n)) for n in range(2, 7) for aL, aR, bL, bR in product(range(n), repeat=4)}1294 ok = all(3 not in [lab.count(v) for v in set(lab)] and nonneg_spectrum(partial_transpose(part(lab))) for lab in achievable)1295 R.check("F12", "local additivity: the partitions of additive spread phases a_x + b_y (n <= 6) have no block of three and are PPT; theta = (0, 0, 0, 1) is not additively achievable",1296 ok and canon((0, 0, 0, 1)) not in achievable, f"{len(achievable)} achievable partitions")129712981299# ------------------------------------------------------------------------------------------------------------1300# block L: uniqueness of the pair tally (gleason.py, 22:C12)1301# The kernels live on the Q4 core with values in ℤ[i]. The kernels Σ_r c_r i^{rd} with nonnegative tallies c are two-way1302# and tally-valued, and Fourier inversion recovers c (exhaustive, c ∈ 0..3). A negative coefficient is witnessed by its1303# character state. A single-channel response holds iff c is a scaled unit vector, the channel fixing. The fibre norm and1304# the w_r/16 multiplier are the counterexamples, and the linear kernels are excluded. The pure-winding fixing reads1305# F(ψ_k) = 16 c_{k mod 4}. The core DFT has det −16i, so the responses fix the kernel.1306@R.block("L", BLOCK["L"])1307def block_L():1308 """Block L — gleason.py (EXACT): L1–L9, the package's 9 checks."""1309 ipow = lambda k: I4[k % 4]1310 def kernel(c): return [tuple(sum(cr * ipow(r * d)[j] for r, cr in enumerate(c)) for j in range(2)) for d in range(4)]1311 def F(K, psi):1312 tot = (0, 0)1313 for u in range(4):1314 for v in range(4): tot = ga(tot, gm(gm(K[(v - u) % 4], psi[u]), gc(psi[v])))1315 return tot1316 chars = [[ipow(r * u) for u in range(4)] for r in range(4)]1317 tests = [[(1, 0), (0, 0), (0, 0), (0, 0)], [(1, 0)] * 4, chars[1], [(1, 0), (1, 0), (0, 0), (0, 0)]]1318 ok1 = ok2 = True1319 for c in product(range(4), repeat=4):1320 K = kernel(c)1321 ok1 &= all(K[(-d) % 4] == gc(K[d]) for d in range(4)) and all(F(K, s)[1] == 0 and F(K, s)[0] >= 0 for s in tests)1322 ok2 &= all(_gsum(gm(K[d], ipow(-r * d)) for d in range(4)) == (4 * c[r], 0) for r in range(4))1323 # 22:C12 (p22028)1324 R.check("L1", "the nonnegative-tally character combinations are two-way and tally-valued on the test states (exhaustive, c in 0..3)", ok1)1325 R.check("L2", "Fourier inversion recovers every coefficient exactly", ok2)1326 R.check("L3", "a negative coefficient c = (1, -1, 1, 0) is witnessed by its character state: F = -16 < 0", F(kernel((1, -1, 1, 0)), chars[1]) == (-16, 0))1327 ok = True1328 for c in product(range(4), repeat=4):1329 resp = [F(kernel(c), chars[r])[0] for r in range(4)]1330 ok &= (sum(1 for x in resp if x) == 1) == (sum(1 for x in c if x) == 1)1331 R.check("L4", "a single-channel response holds iff the coefficient vector is a scaled unit vector (channel fixing, exhaustive)", ok)1332 Kfn = [(1, 0), (0, 0), (0, 0), (0, 0)]1333 resp = [F(Kfn, chars[r])[0] for r in range(4)]1334 inv = [_gsum(gm(Kfn[d], ipow(-r * d)) for d in range(4)) for r in range(4)]1335 R.check("L5", "the fibre norm K = [delta = 1]: responses (4, 4, 4, 4), 4 c_r = 1 each (c_r = 1/4, not a tally), so it fails channel selectivity",1336 resp == [4, 4, 4, 4] and all(x == (1, 0) for x in inv))1337 c_num, c_den = 1, 161338 R.check("L6", "the multiplier F = w_r/16: d^2 c = 16/16 = 1 is realised, c = 1/16 is not a tally (ray uniqueness only)", (16 * c_num) % c_den == 0 and c_den != 1)1339 ok = all(_gsum(ipow(k * u) for u in range(4)) == (0, 0) for k in range(1, 4))1340 ok &= all(not (gm((0, 1), (4 * c, 0))[1] == 0 and gm((0, 1), (4 * c, 0))[0] >= 0) for c in range(1, 5))1341 R.check("L7", "the linear exclusion: a linear drive-invariant kernel vanishes on the nontrivial windings, and F(i psi_0) = 4ci leaves the tally cone unless c = 0", ok)1342 R.check("L8", "pure-winding fixing: F(psi_k) = 16 c_{k mod 4} for every admissible kernel and winding, every channel index reached (exhaustive)",1343 all(F(kernel(c), chars[k]) == (16 * c[k], 0) for c in product(range(4), repeat=4) for k in range(4)))1344 det = (Fr(0), Fr(0))1345 for perm in permutations(range(4)):1346 sgn = (-1) ** sum(1 for a in range(4) for b in range(a + 1, 4) if perm[a] > perm[b])1347 term = (Fr(sgn), Fr(0))1348 for r in range(4): term = gm(term, chars[r][perm[r]])1349 det = ga(det, term)1350 def responses(K):1351 out = [F(K, chars[k]) for k in range(4)]1352 for k in range(4):1353 for kp in range(k + 1, 4):1354 out.append(F(K, [ga(chars[k][u], chars[kp][u]) for u in range(4)]))1355 out.append(F(K, [ga(chars[k][u], gm((0, 1), chars[kp][u])) for u in range(4)]))1356 return tuple(out)1357 seen, ok = {}, det == (0, -16)1358 for c in product(range(3), repeat=4):1359 K = tuple(kernel(c)); key = responses(K)1360 ok &= seen.setdefault(key, K) == K1361 R.check("L9", "spanning and polarisation: the core DFT has det -16i (invertible over Q(i)); equal responses on the admissible class force equal kernels (exhaustive)", ok)136213631364def _gsum(zs):1365 out = (0, 0)1366 for z in zs: out = ga(out, z)1367 return out136813691370# ------------------------------------------------------------------------------------------------------------1371# block O: the Ω ledger (omega.py, 22:A5, Z2)1372# The anchor is the master's A7, the certified bracket of the scale import (frc/chart.py, omega_bracket: Ω = 4S + 11373# from the fitted Λ and the Planck length), Ω ∼ 1.3 × 10^123 as an order of magnitude, with √Ω ∼ 3.6 × 10^61 and1374# Ω^(1/4) ∼ 6.0 × 10^30. The null channels put floors on Ω: the Riemann height (3·10^12)^4, the Sorkin and Born tallies1375# 10^22, and the granularity 2^60. Every floor lies below the anchor, and its margin in orders of ten is recorded; the1376# binding floor is the Riemann height, seventy-three orders below. The scales are the integer roots of one Ω. Every1377# comparison is of integers, and no number above Ω is formed.1378@R.block("O", BLOCK["O"])1379def block_O():1380 """Block O — omega.py (EXACT): O1–O4, the package's 4 checks, on the master's anchor."""1381 lo, hi = CH.omega_bracket()1382 L, H = int(lo), int(hi) + 1 # the bracket's ends, as integers1383 floors = [("Riemann zero verification (rh paper)", (3 * 10 ** 12) ** 4), ("Sorkin third-order nullity (exp I)", 10 ** 22),1384 ("Born readout window (companion Thm)", 10 ** 22), ("Granularity ceiling (exp V)", 2 ** 60)]1385 def orders(x): # the margin floor(log10(Omega/x)) at the lower end1386 q = Fr(L, x); k = 01387 while 10 ** (k + 1) <= q: k += 11388 return k1389 # 22:A5 (p22005)1390 R.check("O1", "every floor lies below the anchor Omega ~ 1.3 x 10^123 (the certified bracket's lower end), with its margin in orders of ten", all(f < L for _, f in floors),1391 "margins " + ", ".join(str(orders(f)) for _, f in floors))1392 omega_min = max(f for _, f in floors)1393 R.check("O2", "the binding floor Omega > 8.1 x 10^49 lies seventy-three orders below the anchor", omega_min < L and omega_min == 81 * 10 ** 48 and orders(omega_min) == 73,1394 f"margin {orders(omega_min)} orders")1395 rt, qt = isqrt(L), isqrt(isqrt(L))1396 R.check("O3", "the scales are the integer roots of one Omega: sqrt(Omega) ~ 3.6 x 10^61 and Omega^(1/4) ~ 6.0 x 10^30 (36 x 10^60 < sqrt < 37 x 10^60, 6 x 10^30 < quarter root < 7 x 10^30), the Riemann height 3 x 10^12 below the quarter root",1397 rt * rt <= L < (rt + 1) ** 2 and qt ** 4 <= L < (qt + 1) ** 4 and 36 * 10 ** 60 < rt < 37 * 10 ** 60 and 6 * 10 ** 30 < qt < 7 * 10 ** 30 and 3 * 10 ** 12 < qt1398 and L // 10 ** 122 == 13 and H // 10 ** 122 == 13)1399 binding = max((f, n) for n, f in floors)1400 # 22:Z2 (p22061)1401 R.check("O4", "the binding floor is the Riemann height, (3 x 10^12)^4 = 8.1 x 10^49, the largest of the floors, 73 orders below the anchor's lower end and below the quarter root's fourth power (the carrier scale fixed through Omega^(1/4)): the channel next-generation experiments push first",1402 binding[1].startswith("Riemann") and binding[0] == (3 * 10 ** 12) ** 4 == 81 * 10 ** 48 and binding[0] < L and orders(binding[0]) == 731403 and 3 * 10 ** 12 < qt and binding[0] < qt ** 4 and all(f <= binding[0] for _, f in floors), binding[1])140414051406# ------------------------------------------------------------------------------------------------------------1407# block I: inter-Subject consistency (intersubject.py, 22:C23, X4)1408# Two Subjects S, S' read one Object O in F_421, over the ledger ℤ[ζ_{n_O}]. In configuration A, O_29 is read by S_61 and1409# S_13 (equal cores Q4). In configuration B, O_61 is read by S_29 and S_13 (embedded cores Q4 < C_12). The control R is1410# C_24 with the incomparable cores C_12 and C_8. The joint refinement of the two fibre partitions is the partition by1411# the common core, in either order. By the selection rule both Subjects induce the same core character η_{s mod 4}. A1412# two-step registration is realisable exactly when its first step is selection-allowed, the fibres meet and the channels1413# agree on Q4. It then reads the core character on the shared cell, in either order. A Gaussian-integer superposition1414# input agrees on the shared cell, and channels that disagree on Q4 are null in both orders.1415@R.block("I", BLOCK["I"])1416def block_I():1417 """Block I — intersubject.py (EXACT): I1–I7, the package's 22 checks."""1418 p, g = 421, 21419 # A ledger value is kept in the group ring of C_n, as a dict {e: c} for Σ c ζ^e, so that a phase multiplies by a1420 # shift. It is compared and tested for zero in ℤ[ζ_n] itself, by its canonical form (frc.quantum.Cyclotomic).1421 rings = {}1422 def ring(n):1423 if n not in rings: rings[n] = Cyclotomic(n)1424 return rings[n]1425 def gadd(terms, n):1426 out = {}1427 for t in terms:1428 for e, c in t.items(): out[e] = out.get(e, 0) + c1429 return {e: c for e, c in out.items() if c}1430 def rot(v, e, n): return {(k + e) % n: c for k, c in v.items()}1431 def gmul(a, b, n): return gadd([{(i + j) % n: x * y} for i, x in a.items() for j, y in b.items()], n)1432 canon = lambda v, n: ring(n).from_exponents(v)1433 iszero = lambda v, n: canon(v, n) == ring(n).zero1434 fibre = lambda nO, d, a: frozenset((a + (nO // d) * l) % nO for l in range(d))1435 def eta(nO, d, r, l): return {(nO // d) * r * l % nO: 1}1436 def amplitude(state, nO, d, r, a):1437 st = nO // d1438 return gadd([rot(state[(a + st * l) % nO], -st * r * l, nO) for l in range(d) if (a + st * l) % nO in state], nO)1439 def luders(state, nO, d, r, a):1440 psi = amplitude(state, nO, d, r, a)1441 if iszero(psi, nO): return {}1442 return {(a + (nO // d) * l) % nO: rot(psi, (nO // d) * r * l, nO) for l in range(d)}1443 winding = lambda nO, s: {j: {s * j % nO: 1} for j in range(nO)}1444 restrict = lambda state, cell: {j: state[j] for j in cell if j in state}1445 def proportional(X, Y, nO):1446 if set(X) != set(Y) or not X: return set(X) == set(Y)1447 return all(canon(gmul(X[i], Y[j], nO), nO) == canon(gmul(X[j], Y[i], nO), nO) for i in X for j in X)1448 def k_cosets(nO, e): return {frozenset((a + (nO // e) * l) % nO for l in range(e)) for a in range(nO)}1449 def transported(nO, e, idx, coset):1450 rep = min(coset)1451 return {j: {(nO // e) * idx * (((j - rep) // (nO // e)) % e) % nO: 1} for j in coset}1452 ok = iszero(gadd([{7 * l: 1} for l in range(4)], 28), 28) and p % 4 == 1 and arith.order(g, p) == p - 11453 A = dict(nO=28, nS=60, nSp=12, tag="A: O_29 read by S_61, S_13")1454 B = dict(nO=60, nS=28, nSp=12, tag="B: O_61 read by S_29, S_13")1455 for cfg in (A, B):1456 nO = cfg["nO"]1457 cfg.update(d=gcd(cfg["nS"], nO), dp=gcd(cfg["nSp"], nO), e=gcd(gcd(cfg["nS"], cfg["nSp"]), nO))1458 ok &= cfg["e"] == gcd(cfg["d"], cfg["dp"]) and cfg["e"] % 4 == 0 and cfg["e"] == 41459 R.check("I1", "the ledger Z[zeta_28] is exact (1 + i + i^2 + i^3 = 0); F_421 admissible; the cores: A d = d' = 4, B d = 4 < d' = 12, the common core e = 4 = |Q4| in both", ok)14601461 def refinement(nO, d, dp, e):1462 Kc = k_cosets(nO, e); cells = [f & fp for f in (fibre(nO, d, a) for a in range(nO // d)) for fp in (fibre(nO, dp, a) for a in range(nO // dp)) if f & fp]1463 return all(c in Kc for c in cells), len(cells)1464 ok = True1465 for cfg in (A, B):1466 good, n = refinement(cfg["nO"], cfg["d"], cfg["dp"], cfg["e"]); ok &= good and n == cfg["nO"] // cfg["e"]1467 R.check("I2", "(I) each joint cell F cap F' is one coset of the common core, the same in either order; the joint refinement is the partition by Q4 (A: 7 cells, B: 15)", ok)1468 good, n = refinement(24, 12, 8, 4)1469 R.check("I3", "(I) the control C_24 with the incomparable cores C_12 and C_8: the joint cells are C_4-cosets, 24/4 = 6 cells", good and n == 6)14701471 ok_sel = ok_chr = True1472 for cfg in (A, B):1473 nO, d, dp, e = cfg["nO"], cfg["d"], cfg["dp"], cfg["e"]1474 for s in range(nO):1475 st = winding(nO, s)1476 live = {r for r in range(d) if any(not iszero(amplitude(st, nO, d, r, a), nO) for a in range(nO // d))}1477 livep = {r for r in range(dp) if any(not iszero(amplitude(st, nO, dp, r, a), nO) for a in range(nO // dp))}1478 ok_sel &= live == {s % d} and livep == {s % dp} and (s % d) % e == s % e and (s % dp) % e == s % e1479 ch, chp, chs = ([canon(eta(nO, e, x, l), nO) for l in range(e)] for x in ((s % d) % e, (s % dp) % e, s % e))1480 ok_chr &= ch == chp == chs1481 # 22:C23 (p22039)1482 R.check("I4", "(II) for every winding the selection rule leaves S the channel s mod d and S' the channel s mod d', both s mod 4: the two Subjects induce the identical core character eta_(s mod 4) on Q4 (A and B)",1483 ok_sel and ok_chr)14841485 def seq(state, first, second, nO, cache):1486 if first not in cache: cache[first] = luders(state, nO, *first)1487 s1 = cache[first]1488 return luders(s1, nO, *second) if s1 else {}1489 ok_pred = ok_value = ok_both = True; det = []1490 for cfg in (A, B):1491 nO, d, dp, e = cfg["nO"], cfg["d"], cfg["dp"], cfg["e"]1492 Kset = k_cosets(nO, e); n_fwd = n_both = 01493 for s in range(lcm(d, dp)):1494 st, cache = winding(nO, s), {}1495 for r, a, rp, ap in product(range(d), range(nO // d), range(dp), range(nO // dp)):1496 C = fibre(nO, d, a) & fibre(nO, dp, ap)1497 agree = r % e == rp % e1498 fwd, rev = seq(st, (d, r, a), (dp, rp, ap), nO, cache), seq(st, (dp, rp, ap), (d, r, a), nO, cache)1499 ok_pred &= bool(fwd) == (bool(C) and r % d == s % d and agree) and bool(rev) == (bool(C) and rp % dp == s % dp and agree)1500 ref = transported(nO, e, s % e, C) if C else None1501 for out in (fwd, rev):1502 if out: ok_value &= C in Kset and proportional(restrict(out, C), ref, nO)1503 n_fwd += bool(fwd)1504 if fwd and rev:1505 n_both += 1; ok_both &= proportional(restrict(fwd, C), restrict(rev, C), nO)1506 det.append(f"{cfg['tag'][:1]}: {n_fwd} forward, {n_both} both-order")1507 # 22:X4 (p22047)1508 R.check("I5", "(III) the realisability predicate is exact in both orders (first step selection-allowed, fibres meet, r = r' mod 4); every realisable sequence reads eta_(s mod 4) on its Q4-coset; both orders agree on the shared cell",1509 ok_pred and ok_value and ok_both, "; ".join(det))15101511 nO, d, dp = A["nO"], A["d"], A["dp"]1512 st = {}1513 for j in range(nO):1514 acc = gadd([{s * j % nO: 1 + s, (nO // 4 + s * j) % nO: 1 + s % 5} for s in range(nO)], nO) # Σ_s c_s ζ^{sj}1515 if not iszero(acc, nO): st[j] = acc1516 ok, both, cache = True, 0, {}1517 for r, a, rp, ap in product(range(d), range(nO // d), range(dp), range(nO // dp)):1518 C = fibre(nO, d, a) & fibre(nO, dp, ap)1519 fwd, rev = seq(st, (d, r, a), (dp, rp, ap), nO, cache), seq(st, (dp, rp, ap), (d, r, a), nO, cache)1520 if fwd and rev:1521 both += 1; ok &= proportional(restrict(fwd, C), restrict(rev, C), nO)1522 R.check("I6", "(III') a Gaussian-integer superposition input (A): every both-order sequence agrees on the shared cell", ok, f"{both} both-order sequences")1523 st, bad, cache = winding(nO, 1), [], {}1524 for r, a, rp, ap in product(range(d), range(nO // d), range(dp), range(nO // dp)):1525 if r % 4 != rp % 4:1526 bad.append(bool(seq(st, (d, r, a), (dp, rp, ap), nO, cache)) or bool(seq(st, (dp, rp, ap), (d, r, a), nO, cache)))1527 R.check("I7", "channels that disagree on Q4 (r != r' mod 4) are null in both orders: an inconsistency would show as nullity, never as a contradiction", len(bad) > 0 and not any(bad))152815291530# ------------------------------------------------------------------------------------------------------------1531# block K: quarter-turn transport (transport.py, 22:C27)1532# Let C_n be an embedded cycle of F_P^×, with n = 4κ_n dividing P − 1 = 4κ. The winding reduction g^a ↦ g_n^{a mod n}1533# carries the ambient quarter-turn i = g^{−κ} onto i_n = g_n^{−κ_n} iff κ ≡ κ_n (mod n). It carries i onto −i_n iff1534# κ ≡ −κ_n, and it keeps the half-turn iff κ ≡ ±κ_n (mod n/2). The criterion is checked against the computed elements1535# on six instances.1536@R.block("K", BLOCK["K"])1537def block_K():1538 """Block K — transport.py (EXACT): K1, the package's 6 checks K1–K6."""1539 def transport(P, g, n):1540 N = P - 1; kap, kn = N // 4, n // 41541 assert P % 4 == 1 and N % n == 0 and n % 4 == 0 and arith.order(g, P) == N1542 gS = pow(g, N // n, P)1543 i_n, Pi_i = pow(gS, n - kn, P), pow(gS, (N - kap) % n, P)1544 faithful, conjugate, half = kap % n == kn % n, kap % n == (n - kn) % n, kap % (n // 2) == kn % (n // 2)1545 ok = (Pi_i == i_n) == faithful and (Pi_i == P - i_n) == conjugate and (Pi_i * Pi_i % P == P - 1) == half1546 return ok, faithful, conjugate, half, Pi_i1547 cases = [(157, 5, 12, "faithful"), (421, 2, 12, "conjugate"), (421, 2, 60, "conjugate"), (421, 2, 28, "conjugate"),1548 (421, 2, 4, "faithful"), (641, 3, 40, "broken"), (157, 5, 52, "conjugate")]1549 ok = True; det = []1550 for P, g, n, kind in cases:1551 good, f, c, h, Pi_i = transport(P, g, n)1552 ok &= good and {"faithful": f and not c, "conjugate": (not f) and c and h, "broken": not (f or c or h) and Pi_i == 1}[kind]1553 det.append(f"F_{P} -> C_{n}: {kind}")1554 # 22:C27 (p22043)1555 R.check("K1", "the quarter-turn transport trichotomy against the computed elements: faithful iff kappa = kappa_n (mod n), conjugate iff kappa = -kappa_n, the half-turn iff kappa = +-kappa_n (mod n/2)",1556 ok, "; ".join(det))155715581559if __name__ == "__main__":1560 want = [a.upper() for a in sys.argv[1:]] or sorted(BLOCK)1561 bad = [b for b in want if b not in BLOCK]1562 if bad: sys.exit(f"no block {', '.join(bad)}: the blocks are {', '.join(sorted(BLOCK))}")1563 for b in want: R.run_block(b)1564 sys.exit(0 if R.summary(write=False, expect=list(LEDGER) if want == sorted(BLOCK) else None) else 1)1565