The validation package of Schrödinger and Dirac Dynamics: one script, dirac.py, 9 blocks, standard library only, one check per predicate of the paper's predicate ledger — 52 of 52 checks passing. The script is rendered below with an anchor per line; its markers (# 8:E2 (p08035): the predicate and its key) are the checks the ledger predicates cite, and the block index opens each block at its definition. The notebook frc-8-dirac.ipynb runs one cell per predicate on Google Colab (its generator make_notebook.py). Installed from this site as a named requirement: pip install frc-8-dirac --find-links https://finitering.space/pkg/ (the sdist frc-8-dirac-20261012.tar.gz).
Blocks: matrix · fin (9) · shell (2) · o2 (2) · o7 (3) · o134 (3) · o8 (3) · lat (1) · o9 (1) — the predicates each decides in parentheses.
1"""2dirac.py — the validation package of "Schrödinger and Dirac Dynamics over Finite Substrate" (Akhtman, 2026; Preprints3doi 10.20944/preprints202510.1486.v2), the paper 8-dirac of the FRC corpus (finite-ring-space/src/8-dirac), added with the4paper's predicate ledger (13 September 2026); one script since 24 September 2026 (the registry dcommon.py, the library5finite_checks.py and the eight block scripts merged).6========================================================================================================================78One script, eight blocks, 52 family checks over 3 848 exact micro-checks, standard library only. Every check is exact9integer arithmetic over F_p and K = F_p[w]/(w² − ν): no floats, no random sampling. A family is the labelled claim of a10block (fin.S1, o2.C3i, o8.X7, …), one check of the registry, identified as <block>.<family>, and names the predicate(s) of11the paper's ledger it witnesses (LEDGER; predicates cited as 8:<label>) — the deciding family's `# 8:<label> (<key>)`12marker is what the ledger's source column links (PREDICATES; finitering.space/src/8-dirac/#<key>); the family13checks are listed on the public page from results.json. Where a predicate is proved in Lean (lean/FrcCore/Dirac.lean with14no axioms, lean/FrcLedger/Dirac.lean on Mathlib), the check here is the instance the reader can run. Master-ledger15predicates reached through the paper predicates: 00:C3 (8:B4), 00:C8 (8:B5, 8:B6), 00:B10 (8:B5).1617 python3 dirac.py every block, results.json written; exit 1 if a family check fails (≈ 1 min)18 python3 dirac.py o8 lat the named blocks; no results.json19 from frc_8_dirac import predicate; predicate("8:D9") one predicate: its block runs once per session2021Blocks: fin the F_13 worked examples (the paper's p = 13 computations) fin.S1–S322 shell the free evolution is the drive; the F_17 numbers shell.Z1–Z423 o2 the canonical Lorentzian coefficient ν = g o2.C1–C924 o7 the parity grading and the factorisation ν = c²·(2g) o7.P1–P625 o134 boost torus, Cayley transform, orbit periods o134.O1a–O4d26 o8 symmetric Dirac dynamics and the spinor form o8.X1–X927 lat the latitude indices of the shell reading lat.L1–L528 o9 signature as a square-class dichotomy o9.S1–S42930Kinds: every check is EXACT (integer-pinned computations in F_p, F_{p²} or exact rationals; a pass is a proof on the31tested instances).32"""33from __future__ import annotations34import os, json, sys35from collections import OrderedDict36from dataclasses import dataclass37from math import gcd, lcm3839SCRIPT = os.path.splitext(os.path.basename(__file__))[0] # "dirac": the one script, the name results.json and the site pages carry4041# ----------------------------------------------------------------------------- registry42RESULTS = [] # one record per family check43MICRO = [] # (block, family, label, ok) — every micro-check4445# check id -> the paper's predicate(s) it witnesses (the `rows` field of results.json)46LEDGER = {47 "fin.S1": "8:E2", "fin.S2": "8:C4, 8:C6, 8:E3", "fin.S3": "8:D2, 8:D6, 8:D7, 8:D8, 8:D12",48 "shell.Z1": "8:F3", "shell.Z2": "8:F3", "shell.Z3": "8:F4", "shell.Z4": "8:D5, 8:D12",49 "o2.C1": "8:B3", "o2.C2": "8:B2", "o2.C3i": "8:B3", "o2.C3a": "8:B3", "o2.C4": "8:B3", "o2.C5": "8:B3", "o2.C6": "8:D5",50 "o2.C7": "8:B4", "o2.C8": "8:B4, 8:D12", "o2.C9": "8:B4",51 "o7.P1": "8:B5", "o7.P2": "8:B4", "o7.P3": "8:B4", "o7.P4": "8:B5", "o7.P5": "8:B6", "o7.P6": "8:B6",52 "o134.O1a": "8:D5", "o134.O1b": "8:D5", "o134.O1c": "8:D5", "o134.O1d": "8:D5", "o134.O1e": "8:D12",53 "o134.O3a": "8:C5", "o134.O3b": "8:C5", "o134.O4a": "8:C6, 8:E4", "o134.O4b": "8:E4", "o134.O4c": "8:E4", "o134.O4d": "8:E4",54 "o8.X1": "8:D9", "o8.X2": "8:D9", "o8.X3": "8:D9", "o8.X4": "8:D9", "o8.X5": "8:D10", "o8.X6": "8:D10", "o8.X7": "8:F4", "o8.X8": "8:D11",55 "o8.X9": "8:F4",56 "lat.L1": "8:F2", "lat.L2": "8:F2", "lat.L3": "8:F2", "lat.L4": "8:F2", "lat.L5": "8:F2",57 "o9.S1": "8:B7", "o9.S2": "8:B7", "o9.S3": "8:B7", "o9.S4": "8:B7",58}5960# check id -> the claim it decides (the family lines of the block banners, condensed)61LABELS = {62 "fin.S1": "power maps on F_13^×: image counts (p−1)/gcd(ε, p−1) and loss factors gcd(ε, p−1) for ε = 1, 2, 3, 4, 6, 12",63 "fin.S2": "Cayley step of H = −Δ on F_13 at α = c: U^13 = I; every trace-zero α = kc admissible with exact order 13 (k ≠ 0)",64 "fin.S3": "F_13 Dirac example: Clifford relations for η = diag(−2,1,1,1); S⁻¹γ^μS boost formulas; transported γ̂⁰ = 10γ⁰ − 4γ¹, γ̂¹ = −2γ⁰ + 10γ¹; A = 10, B = 2; covariance on a sample field",65 "shell.Z1": "the drive pullback is a permutation operator with D χ_k = g^{−k} χ_k on every character and cycle point (p = 13, 17)",66 "shell.Z2": "isotropy: ⟨χ_k, χ_k⟩ = 0 except k = 0, (p−1)/2 with eigenvalues ±1",67 "shell.Z3": "sector separation: ord(g⁻¹) = p − 1 > 2, the free evolution is no Cayley step of a Frobenius-fixed Hamiltonian",68 "shell.Z4": "F_17 example: i = 3^{−4} = 4, 2, i, e squares, g nonsquare; ν = 3, A = 15, B = 1, A² − νB² = 1; |G_3| = 18, |G_2| = 14; an order-3 boost at 17, none at 13",69 "o2.C1": "every primitive g is a nonsquare on every symmetry-complete shell p < 2000",70 "o2.C2": "the nonsquare class is unique: the product of two nonsquares is a square",71 "o2.C3i": "i = g^{−κ} is a square iff κ is even (8 | p − 1), on every symmetry-complete shell p < 2000",72 "o2.C3a": "2, 2⁻¹, −2 are squares iff κ is even: on κ-even shells g is the only named nonsquare",73 "o2.C4": "e = g^i has no stable square class (counterexamples both ways)",74 "o2.C5": "flip stability: [g⁻¹] = [g]",75 "o2.C6": "|G_ν| = p + 1 with ν = g, by exhaustive enumeration on small shells",76 "o2.C7": "F_13 anchor: g = 2 = ν, i = 5, 2⁻¹ = 7 nonsquare (κ odd, non-admissible)",77 "o2.C8": "F_17 anchor: 2, i = 4, e squares, only g = 3 nonsquare, |G_3| = 18",78 "o2.C9": "lab Carrier Ω = 2,408,561: g = 6 nonsquare; 2, 2⁻¹, −2, i = ħ = 18,688 squares; c = √(2⁻¹) = 171,106 base-rational",79 "o7.P1": "squares = ⟨g²⟩: the square class is the drive-step parity, exhaustive on every primitive g of F_13, F_17, Euler form on p < 2000",80 "o7.P2": "ν = c² · (2g) exactly (2c² = 1); lab-Carrier instance 1,204,281 · 12 = 6 = g",81 "o7.P3": "[c²] even iff κ even, [2g] odd iff κ even, the product odd on every shell",82 "o7.P4": "on κ-even shells every element of Q₄ = {1, i, −1, −i} is a square: the chart grading carries no signature",83 "o7.P5": "N(gx) = g² N(x), g² a square (registered transport even), g odd, x² = g unsolvable in F_p",84 "o7.P6": "gauge stability: dlog_g(g⁻¹) = −1 odd — the flip preserves the parity class",85 "o134.O1a": "kernel of (x, y) ↦ Λ(x, y) is the scalar line: p − 1 preimages per boost, |G_ν| = p + 1",86 "o134.O1b": "Hilbert 90: A − Bw = z/z̄, z F_p^× ↦ z/z̄ a bijection onto N¹",87 "o134.O1c": "G_ν is cyclic: an element of order p + 1 exists",88 "o134.O1d": "an order-3 boost exists iff 3 | p + 1 (17 yes, 13 no)",89 "o134.O1e": "F_17 is the minimal admissible shell: κ = 4 even, κ ≡ 1 (mod 3), p ≡ 5 (mod 12), no smaller symmetry-complete p",90 "o134.O3a": "the Cayley map φ(λ) = (1+aλ)/(1−aλ), a ∈ K⁻ nonzero, bijects P¹(F_p) onto N¹ with φ(∞) = −1",91 "o134.O3b": "the unitary group of one channel is N¹ = C_{p+1}",92 "o134.O4a": "kinetic case: H = −Δ nilpotent, U unipotent, ord(U) = p",93 "o134.O4b": "potential case: H = M_V diagonal, eigenphases in N¹, ord(U) = p + 1 (13 → 14, 17 → 18)",94 "o134.O4c": "mixed case: ord(U) = 1563 for H = −Δ + M_id at p = 5",95 "o134.O4d": "composite: the order of a block-diagonal pair is the lcm (13, 14 → 182)",96 "o8.X1": "plain adjoints: (γ⁰)† = −γ⁰, (γ¹)† = −γ¹, (γ²)† = +γ², (γ³)† = −γ³ (p = 5, 13, 17)",97 "o8.X2": "the spinor twist X = γ⁰γ¹γ³: Hermitian, X² = ν, commutes with γ⁰, γ¹, γ³, anticommutes with γ²; X⁻¹(γ^μ)†X = −γ^μ for all μ",98 "o8.X3": "the γ⁰-twist fails: signs remain mixed",99 "o8.X4": "T − T⁻¹ nilpotent and anti-self-adjoint; D^s X-self-adjoint and nilpotent",100 "o8.X5": "1+1 at p = 5: H = D^s X-self-adjoint, the Cayley step X-unitary, unipotent with ord(U) = 25 = p²",101 "o8.X6": "massive: H = D^s − mI, ord(U) = lcm(p-power, ord_{N¹} φ(−m)) for m = 1, 2 at p = 5",102 "o8.X7": "the cycle Laplacian Δ_Φ is self-adjoint, its Cayley steps commute with D, the composite is unitary (p = 13)",103 "o8.X8": "spin lift vs the spinor form: S(x,y)# = S(x,−y) = δS⁻¹; the transport scales the X-form by N(z), norm-one lifts preserve it",104 "o8.X9": "the dispersion relation on the cycle: −Δ_Φ χ_k = (2 − g^k − g^{−k}) χ_k for every k (F_13); D^s − m invertible for m ≠ 0",105 "lat.L1": "ladder bounds: the energy index κ + 1 is the first rung past the midpoint of the ladder 1 … 2κ",106 "lat.L2": "one shift, two ladders: m ↦ m + κ is multiplication by g^κ = ±i; a ↦ a + κ sends 1 ↦ κ + 1",107 "lat.L3": "κ = −4⁻¹, so the energy radius is 1 + κ = 3·4⁻¹",108 "lat.L4": "terminal latitude: π = 2κ = −2⁻¹ = −c²; on the Carrier π_Ω = 2S",109 "lat.L5": "chart consistency: the unit-norm circle has p − 1 points; the energy circle carries norm 9/16",110 "o9.S1": "the Euclidean form t² + x² + y² + z² has p³ + p² − p zeros on every symmetry-complete shell p < 60",111 "o9.S2": "the form −νt² + x² + y² + z², ν = g, has p³ − p² + p zeros",112 "o9.S3": "p = 13: the counts are 2353 and 2041",113 "o9.S4": "over F_{p²} every element of F_p is a square: the extension erases the dichotomy",114}115116BLOCK = OrderedDict([ # check-id prefix -> the block (the function block_<name> below), in the run order117 ("fin", "the F_13 worked examples: power maps, the Cayley step of H = −Δ, the Dirac example (worked_checks over finite_checks until 24 September 2026)"),118 ("shell", "the free evolution is the drive; the F_17 numbers (shell_checks)"),119 ("o2", "the canonical Lorentzian coefficient ν = g (o2_checks)"),120 ("o7", "the parity grading and the factorisation ν = c²·(2g) (o7_checks)"),121 ("o134", "the boost torus, the Cayley transform and the orbit periods (o134_checks)"),122 ("o8", "symmetric Dirac dynamics and the spinor form (o8_checks)"),123 ("lat", "the latitude indices of the shell reading (latitude_checks)"),124 ("o9", "signature as a square-class dichotomy (o9_signature_counts)"),125])126127# the deciding family of each witnessed predicate: the first check the ledger's source column names, the one whose verdict128# decides the predicate's statement (the other families that touch it are corroboration, listed by predicate() from the records)129PREDICATES = {130 "8:B2": "o2.C2", "8:B3": "o2.C1", "8:B4": "o7.P2", "8:B5": "o7.P1",131 "8:B6": "o7.P5", "8:B7": "o9.S1", "8:C4": "fin.S2", "8:C5": "o134.O3a",132 "8:C6": "fin.S2", "8:D2": "fin.S3", "8:D5": "o134.O1a", "8:D6": "fin.S3",133 "8:D7": "fin.S3", "8:D8": "fin.S3", "8:D9": "o8.X1", "8:D10": "o8.X5",134 "8:D11": "o8.X8", "8:D12": "fin.S3", "8:E2": "fin.S1", "8:E3": "fin.S2",135 "8:E4": "o134.O4a", "8:F2": "lat.L1", "8:F3": "shell.Z1", "8:F4": "shell.Z3",136}137_TAG = [None]138_RAN = set() # blocks already run in this session (predicate() runs each once)139140def check(pid, ok, detail="", kind="EXACT", label=None):141 """Record one family check. pid = <block>.<family>; LEDGER[pid] = the paper predicate(s) it witnesses."""142 ok = bool(ok)143 rows = LEDGER.get(pid, "")144 label = label or LABELS.get(pid, pid)145 RESULTS.append({"id": pid, "rows": rows, "block": pid.split(".")[0], "script": SCRIPT, "label": label, "ok": ok, "detail": detail, "kind": kind})146 print(f" [{'PASS' if ok else 'FAIL'}] {pid:9s} {kind:5s} [{rows}] {label}" + (f" -- {detail}" if detail else ""))147 return ok148149def summary(write=True):150 n_ok = sum(r["ok"] for r in RESULTS)151 print(f"\nSUMMARY: {n_ok}/{len(RESULTS)} checks passed ({len(MICRO)} exact micro-checks)" + ("" if n_ok == len(RESULTS) else " <-- FAILURES"))152 if write:153 with open("results.json", "w") as f:154 json.dump(RESULTS, f, indent=1, ensure_ascii=False)155 return n_ok == len(RESULTS)156157def chk(label, ok, tag=None):158 """A micro-check: label = '<family> …' (the family is the first token); recorded under the current block, never exits."""159 fam = label.split()[0]160 MICRO.append((tag or _TAG[0] or "?", fam, label, bool(ok)))161 if not ok:162 print(f" FAIL: {label}")163164def begin(tag):165 _TAG[0] = tag166167def flush(tag, order=None):168 """Aggregate the micro-checks of a block into one registry check per family."""169 fams = OrderedDict()170 for t, fam, label, ok in MICRO:171 if t == tag:172 fams.setdefault(fam, []).append(ok)173 for fam in (order or fams):174 oks = fams.get(fam, [])175 check(f"{tag}.{fam}", ok=bool(oks) and all(oks), detail=f"{len(oks)} exact micro-checks")176 _TAG[0] = None177178def markers():179 """predicate label -> (script file, line) of its marker `# <paper>:<label> (<key>)`: the line of the check that decides it."""180 import re181 out = {}182 for i, line in enumerate(open(os.path.abspath(__file__), encoding="utf-8"), 1):183 m = re.match(r"\s*# ((?:\d+:[A-Z]+\d+[a-z]?(?: \(p\d{5}\))?)(?:, \d+:[A-Z]+\d+[a-z]?(?: \(p\d{5}\))?)*)\s*$", line)184 if m:185 for lab in re.findall(r"\d+:[A-Z]+\d+[a-z]?", m.group(1)): out.setdefault(lab, (SCRIPT + ".py", i))186 return out187188def _run_block(name):189 if name not in _RAN:190 globals()[f"block_{name}"](); _RAN.add(name)191192def predicate(label, lines=14):193 """Verify one ledger predicate: run the blocks of the families that cite it (each once per session), print the deciding194 check's source (from its marker) and every family record that cites the predicate, and return True iff all pass."""195 fam = PREDICATES.get(label)196 if fam is None:197 print(f"{label}: no python witness (see the predicate's Lean witness or its source)"); return None198 citing = {f.split(".")[0] for f, rows in LEDGER.items() if label in [t.strip() for t in rows.split(",")]}199 for b in [b for b in BLOCK if b in {fam.split(".")[0]} | citing]: _run_block(b) # the deciding block and every block whose families cite the predicate, in the run order200 mk = markers().get(label)201 if mk:202 src = open(os.path.abspath(__file__), encoding="utf-8").read().split("\n")203 print(f"— {mk[0]}:{mk[1]} (the check that decides {label}; family {fam})")204 for j in range(mk[1] - 1, min(mk[1] - 1 + lines, len(src))): print(f"{j + 1:5d} {src[j]}")205 else:206 print(f"— {SCRIPT}.py, block {fam.split('.')[0]} (the whole block witnesses {label})")207 recs = [r for r in RESULTS if label in [t.strip() for t in r["rows"].split(",")]]208 ok = all(r["ok"] for r in recs)209 for r in recs:210 role = "(deciding)" if r["id"] == fam else "(corroborating)"211 print(f" [{'PASS' if r['ok'] else 'FAIL'}] {r['id']:9s} {role:16s} {r['detail']}")212 print(f"{label}: {'VERIFIED' if ok and recs else 'FAILED'} — {len(recs)} family record(s)")213 return ok214215def verify_all():216 """Run every block (those already run in this session are not re-run) and print the summary; True iff every family check passed."""217 for b in BLOCK: _run_block(b)218 return summary(write=False)219220# ------------------------------------------------------------------------------------------------------------221# the F_13 library (finite_checks.py until 24 September 2026): the paper's p = 13 computations, kept verbatim —222# the coefficient field F_13[w]/(w² − 2) as pairs, the matrix and field-map arithmetic, and the three printing223# checks power_map_counts(), schrodinger_check(), dirac_check() of the manuscript's examples (callable; block fin224# turns their arithmetic into registered checks).225#226# Exact finite checks for the FRC Schrodinger-Dirac manuscript.227#228# This script reproduces the p=13 computations stated in the manuscript:229# 1. image counts and loss factors for power maps on F_p^x,230# 2. the Cayley admissibility set and propagator orders for the Euclidean Schrodinger example,231# 3. the Clifford relations, transported gamma formulas, and explicit boost covariance for the Dirac example.232233P = 13234NU = 2235236def mod_inv(a: int, p: int = P) -> int:237 return pow(a % p, -1, p)238239def find_square_root(value: int, p: int = P) -> int:240 value %= p241 for x in range(p):242 if (x * x) % p == value:243 return x244 raise ValueError(f"no square root of {value} in F_{p}")245246G = 2 # the frame's drive multiplier, F_13(t;0,1,2); nu = g is canonical247KAP = (P - 1) // 4248IT = pow(pow(G, P - 2, P), KAP, P) # derived orientation i = g^{-kappa} = 5249assert IT == 5 and (IT * IT) % P == P - 1250251@dataclass(frozen=True)252class Fp2:253 a: int254 b: int255256 def __post_init__(self) -> None:257 object.__setattr__(self, "a", self.a % P)258 object.__setattr__(self, "b", self.b % P)259260 def __add__(self, other: "Fp2") -> "Fp2":261 return Fp2(self.a + other.a, self.b + other.b)262263 def __sub__(self, other: "Fp2") -> "Fp2":264 return Fp2(self.a - other.a, self.b - other.b)265266 def __neg__(self) -> "Fp2":267 return Fp2(-self.a, -self.b)268269 def __mul__(self, other: "Fp2") -> "Fp2":270 return Fp2(self.a * other.a + NU * self.b * other.b, self.a * other.b + self.b * other.a)271272 def conj(self) -> "Fp2":273 return Fp2(self.a, -self.b)274275 def norm(self) -> int:276 return (self.a * self.a - NU * self.b * self.b) % P277278 def inv(self) -> "Fp2":279 n = self.norm()280 ninv = mod_inv(n, P)281 z = self.conj()282 return Fp2(z.a * ninv, z.b * ninv)283284 def __truediv__(self, other: "Fp2") -> "Fp2":285 return self * other.inv()286287 def __pow__(self, exponent: int) -> "Fp2":288 if exponent < 0:289 return (self.inv()) ** (-exponent)290 result = ONE291 base = self292 e = exponent293 while e:294 if e & 1:295 result = result * base296 base = base * base297 e >>= 1298 return result299300 def is_zero(self) -> bool:301 return self.a == 0 and self.b == 0302303 def __repr__(self) -> str:304 return f"Fp2({self.a},{self.b})"305306ZERO = Fp2(0, 0)307ONE = Fp2(1, 0)308C = Fp2(0, 1)309I_T = Fp2(IT, 0)310311def scalar(x: int) -> Fp2:312 return Fp2(x, 0)313314def zero_matrix(n: int, m: int) -> list[list[Fp2]]:315 return [[ZERO for _ in range(m)] for _ in range(n)]316317def identity(n: int) -> list[list[Fp2]]:318 out = zero_matrix(n, n)319 for i in range(n):320 out[i][i] = ONE321 return out322323def mat_add(a: list[list[Fp2]], b: list[list[Fp2]]) -> list[list[Fp2]]:324 return [[a[i][j] + b[i][j] for j in range(len(a[0]))] for i in range(len(a))]325326def mat_sub(a: list[list[Fp2]], b: list[list[Fp2]]) -> list[list[Fp2]]:327 return [[a[i][j] - b[i][j] for j in range(len(a[0]))] for i in range(len(a))]328329def scalar_mul(s: Fp2, a: list[list[Fp2]]) -> list[list[Fp2]]:330 return [[s * a[i][j] for j in range(len(a[0]))] for i in range(len(a))]331332def mat_mul(a: list[list[Fp2]], b: list[list[Fp2]]) -> list[list[Fp2]]:333 n = len(a)334 m = len(b[0])335 k = len(b)336 out = zero_matrix(n, m)337 for i in range(n):338 for j in range(m):339 total = ZERO340 for t in range(k):341 total = total + a[i][t] * b[t][j]342 out[i][j] = total343 return out344345def mat_pow(a: list[list[Fp2]], exponent: int) -> list[list[Fp2]]:346 result = identity(len(a))347 base = a348 e = exponent349 while e:350 if e & 1:351 result = mat_mul(result, base)352 base = mat_mul(base, base)353 e >>= 1354 return result355356def mat_eq(a: list[list[Fp2]], b: list[list[Fp2]]) -> bool:357 return all(a[i][j] == b[i][j] for i in range(len(a)) for j in range(len(a[0])))358359def mat_inv(a: list[list[Fp2]]) -> list[list[Fp2]]:360 n = len(a)361 aug = [row[:] + eye_row[:] for row, eye_row in zip(a, identity(n))]362 for col in range(n):363 pivot = None364 for row in range(col, n):365 if not aug[row][col].is_zero():366 pivot = row367 break368 if pivot is None:369 raise ValueError("matrix is singular")370 aug[col], aug[pivot] = aug[pivot], aug[col]371 inv_pivot = aug[col][col].inv()372 aug[col] = [inv_pivot * entry for entry in aug[col]]373 for row in range(n):374 if row == col:375 continue376 factor = aug[row][col]377 if factor.is_zero():378 continue379 aug[row] = [aug[row][j] - factor * aug[col][j] for j in range(2 * n)]380 return [row[n:] for row in aug]381382def block_matrix(a: list[list[Fp2]], b: list[list[Fp2]], c: list[list[Fp2]], d: list[list[Fp2]]) -> list[list[Fp2]]:383 top = [ra + rb for ra, rb in zip(a, b)]384 bottom = [rc + rd for rc, rd in zip(c, d)]385 return top + bottom386387def vec_zero(n: int) -> list[Fp2]:388 return [ZERO for _ in range(n)]389390def vec_add(a: list[Fp2], b: list[Fp2]) -> list[Fp2]:391 return [x + y for x, y in zip(a, b)]392393def vec_sub(a: list[Fp2], b: list[Fp2]) -> list[Fp2]:394 return [x - y for x, y in zip(a, b)]395396def vec_is_zero(v: list[Fp2]) -> bool:397 return all(x.is_zero() for x in v)398399def mat_vec_mul(a: list[list[Fp2]], v: list[Fp2]) -> list[Fp2]:400 out = vec_zero(len(a))401 for i in range(len(a)):402 total = ZERO403 for j in range(len(v)):404 total = total + a[i][j] * v[j]405 out[i] = total406 return out407408def point_add(x: tuple[int, int, int, int], y: tuple[int, int, int, int]) -> tuple[int, int, int, int]:409 return tuple((x[i] + y[i]) % P for i in range(4))410411def point_sub(x: tuple[int, int, int, int], y: tuple[int, int, int, int]) -> tuple[int, int, int, int]:412 return tuple((x[i] - y[i]) % P for i in range(4))413414def int_mat_point_mul(a: list[list[int]], x: tuple[int, int, int, int]) -> tuple[int, int, int, int]:415 out: list[int] = []416 for row in a:417 total = 0418 for coeff, value in zip(row, x):419 total += coeff * value420 out.append(total % P)421 return tuple(out) # type: ignore[return-value]422423def canonical_field(field: dict[tuple[int, int, int, int], list[Fp2]]) -> dict[tuple[int, int, int, int], list[Fp2]]:424 return {point: value for point, value in field.items() if not vec_is_zero(value)}425426def field_add(a: dict[tuple[int, int, int, int], list[Fp2]], b: dict[tuple[int, int, int, int], list[Fp2]]) -> dict[tuple[int, int, int, int], list[Fp2]]:427 out = {point: value[:] for point, value in a.items()}428 for point, value in b.items():429 out[point] = vec_add(out.get(point, vec_zero(4)), value)430 return canonical_field(out)431432def diff_apply(field: dict[tuple[int, int, int, int], list[Fp2]], shift: tuple[int, int, int, int]) -> dict[tuple[int, int, int, int], list[Fp2]]:433 support = set(field)434 candidates = support | {point_sub(point, shift) for point in support}435 out: dict[tuple[int, int, int, int], list[Fp2]] = {}436 for point in candidates:437 forward = field.get(point_add(point, shift), vec_zero(4))438 current = field.get(point, vec_zero(4))439 out[point] = vec_sub(forward, current)440 return canonical_field(out)441442def dirac_apply(443 field: dict[tuple[int, int, int, int], list[Fp2]],444 gamma_family: list[list[list[Fp2]]],445 frame: list[tuple[int, int, int, int]],446) -> dict[tuple[int, int, int, int], list[Fp2]]:447 out: dict[tuple[int, int, int, int], list[Fp2]] = {}448 for gamma, shift in zip(gamma_family, frame):449 diff = diff_apply(field, shift)450 transformed = {point: mat_vec_mul(gamma, value) for point, value in diff.items()}451 out = field_add(out, transformed)452 return canonical_field(out)453454def transport_apply(455 field: dict[tuple[int, int, int, int], list[Fp2]],456 lambda_matrix: list[list[int]],457 spin_matrix: list[list[Fp2]],458) -> dict[tuple[int, int, int, int], list[Fp2]]:459 out: dict[tuple[int, int, int, int], list[Fp2]] = {}460 for point, value in field.items():461 target = int_mat_point_mul(lambda_matrix, point)462 out[target] = mat_vec_mul(spin_matrix, value)463 return canonical_field(out)464465def field_eq(466 a: dict[tuple[int, int, int, int], list[Fp2]],467 b: dict[tuple[int, int, int, int], list[Fp2]],468) -> bool:469 return canonical_field(a) == canonical_field(b)470471def power_map_counts() -> None:472 print("Power map counts on F_p^x")473 for epsilon in [1, 2, 3, 4, 6, 12]:474 image = {pow(x, epsilon, P) for x in range(1, P)}475 loss = (P - 1) / len(image)476 print(477 f" epsilon={epsilon:2d}: image_size={len(image):2d}, "478 f"formula={(P - 1) // gcd(epsilon, P - 1):2d}, loss_factor={int(loss):2d}"479 )480481def schrodinger_check() -> None:482 n = P483 eye = identity(n)484 shift = zero_matrix(n, n)485 shift_inv = zero_matrix(n, n)486 for j in range(n):487 shift[(j - 1) % n][j] = ONE488 shift_inv[(j + 1) % n][j] = ONE489 delta = mat_sub(mat_add(shift, shift_inv), scalar_mul(scalar(2), eye))490 hamiltonian = scalar_mul(scalar(-1), delta)491 left = mat_sub(eye, scalar_mul(C, hamiltonian))492 right = mat_add(eye, scalar_mul(C, hamiltonian))493 cayley = mat_mul(mat_inv(left), right)494 u13 = mat_pow(cayley, 13)495 print("Schrodinger check")496 print(f" det-denominator-invertible = {True}")497 print(f" U^13 = I = {mat_eq(u13, eye)}")498 print(" admissible alpha=k*c and exact orders")499500 def cayley_for(k: int) -> list[list[Fp2]]:501 alpha = Fp2(0, k)502 left_k = mat_sub(eye, scalar_mul(alpha, hamiltonian))503 right_k = mat_add(eye, scalar_mul(alpha, hamiltonian))504 return mat_mul(mat_inv(left_k), right_k)505506 def matrix_order(matrix: list[list[Fp2]], bound: int = 5000) -> int:507 current = identity(len(matrix))508 for exponent in range(1, bound + 1):509 current = mat_mul(current, matrix)510 if mat_eq(current, eye):511 return exponent512 raise ValueError("order search failed")513514 for k in range(P):515 try:516 u_k = cayley_for(k)517 print(f" k={k:2d}: admissible=True, order={matrix_order(u_k)}")518 except ValueError:519 print(f" k={k:2d}: admissible=False, order=NA")520521def gamma_matrices() -> tuple[list[list[Fp2]], list[list[Fp2]], list[list[Fp2]], list[list[Fp2]]]:522 i2 = [[ONE, ZERO], [ZERO, ONE]]523 sigma1 = [[ZERO, ONE], [ONE, ZERO]]524 sigma2 = [[ZERO, -I_T], [I_T, ZERO]]525 sigma3 = [[ONE, ZERO], [ZERO, -ONE]]526 zero2 = [[ZERO, ZERO], [ZERO, ZERO]]527 beta = block_matrix(zero2, i2, i2, zero2)528 rho1 = block_matrix(zero2, sigma1, scalar_mul(Fp2(-1, 0), sigma1), zero2)529 rho2 = block_matrix(zero2, sigma2, scalar_mul(Fp2(-1, 0), sigma2), zero2)530 rho3 = block_matrix(zero2, sigma3, scalar_mul(Fp2(-1, 0), sigma3), zero2)531 gamma0 = scalar_mul(I_T * C, beta)532 gamma1 = scalar_mul(I_T, rho1)533 gamma2 = scalar_mul(I_T, rho2)534 gamma3 = scalar_mul(I_T, rho3)535 return gamma0, gamma1, gamma2, gamma3536537def anticommutator(a: list[list[Fp2]], b: list[list[Fp2]]) -> list[list[Fp2]]:538 return mat_add(mat_mul(a, b), mat_mul(b, a))539540def dirac_check() -> None:541 gamma0, gamma1, gamma2, gamma3 = gamma_matrices()542 eta = [-NU, 1, 1, 1]543 gammas = [gamma0, gamma1, gamma2, gamma3]544 ok = True545 for mu in range(4):546 for nu in range(4):547 lhs = anticommutator(gammas[mu], gammas[nu])548 rhs = zero_matrix(4, 4)549 coeff = scalar(2 * eta[mu] if mu == nu else 0)550 for i in range(4):551 rhs[i][i] = coeff552 ok = ok and mat_eq(lhs, rhs)553554 x = scalar(1)555 y = scalar(1)556 delta = scalar(1 - NU)557 delta_inv = delta.inv()558 m = mat_mul(gamma0, gamma1)559 s = mat_add(identity(4), m)560 s_inv = scalar_mul(delta_inv, mat_sub(identity(4), m))561562 a_coeff = scalar(1 + NU) / scalar(1 - NU)563 b_coeff = scalar(-2) / scalar(1 - NU)564565 lhs0 = mat_mul(mat_mul(s_inv, gamma0), s)566 rhs0 = mat_add(scalar_mul(a_coeff, gamma0), scalar_mul(scalar(NU) * b_coeff, gamma1))567568 lhs1 = mat_mul(mat_mul(s_inv, gamma1), s)569 rhs1 = mat_add(scalar_mul(b_coeff, gamma0), scalar_mul(a_coeff, gamma1))570571 transported0 = mat_mul(mat_mul(s, gamma0), s_inv)572 transported1 = mat_mul(mat_mul(s, gamma1), s_inv)573 rhs0_transport = mat_add(scalar_mul(a_coeff, gamma0), scalar_mul(-scalar(NU) * b_coeff, gamma1))574 rhs1_transport = mat_add(scalar_mul(-b_coeff, gamma0), scalar_mul(a_coeff, gamma1))575576 a_int = a_coeff.a577 b_int = b_coeff.a578 lambda_matrix = [579 [a_int, b_int, 0, 0],580 [(NU * b_int) % P, a_int, 0, 0],581 [0, 0, 1, 0],582 [0, 0, 0, 1],583 ]584 boosted_frame = [585 (a_int, (NU * b_int) % P, 0, 0),586 (b_int, a_int, 0, 0),587 (0, 0, 1, 0),588 (0, 0, 0, 1),589 ]590 sample_field = {591 (0, 0, 0, 0): [ONE, C, ZERO, scalar(2)],592 (1, 2, 0, 0): [scalar(3), ZERO, I_T, ONE],593 (5, 0, 1, 0): [ZERO, scalar(4), C, scalar(7)],594 }595 transported_gammas = [transported0, transported1, gamma2, gamma3]596 standard_frame = [597 (1, 0, 0, 0),598 (0, 1, 0, 0),599 (0, 0, 1, 0),600 (0, 0, 0, 1),601 ]602 lhs_covariance = dirac_apply(603 transport_apply(sample_field, lambda_matrix, s),604 transported_gammas,605 boosted_frame,606 )607 rhs_covariance = transport_apply(608 dirac_apply(sample_field, gammas, standard_frame),609 lambda_matrix,610 s,611 )612613 print("Dirac check")614 print(f" Clifford relations = {ok}")615 print(f" boost formula gamma^0 = {mat_eq(lhs0, rhs0)}")616 print(f" boost formula gamma^1 = {mat_eq(lhs1, rhs1)}")617 print(f" transported gamma^0 = {mat_eq(transported0, rhs0_transport)}")618 print(f" transported gamma^1 = {mat_eq(transported1, rhs1_transport)}")619 print(f" covariance sample check = {field_eq(lhs_covariance, rhs_covariance)}")620 print(f" A coefficient = {a_coeff}")621 print(f" B coefficient = {b_coeff}")622623# ------------------------------------------------------------------------------------------------------------624# block fin — the F_13 worked examples (worked_checks over finite_checks until 24 September 2026)625#626# The F_13 worked examples as registered checks (EXACT).627#628# Drives finite_checks.py (the paper's p = 13 computations, kept verbatim as the library) and turns its printed629# booleans into predicates:630#631# S1 Power-map counts on F_13^× (Prop. power-map-count): image size (p−1)/gcd(ε, p−1) and loss factor632# gcd(ε, p−1) for ε = 1, 2, 3, 4, 6, 12; each nonempty fibre of size gcd.633# S2 The Euclidean Schrödinger example (Example cayley-13, Thm. cayley-preservation, Cor. finite periodicity,634# Thm. period-dichotomy): H = −Δ on F_13, α = c: U^13 = I; every trace-zero α = kc is admissible635# (H nilpotent), with exact order 13 for k ≠ 0 and 1 for k = 0; U is unitary for the Hermitian form.636# S3 The Dirac example (Example dirac-13; Prop. clifford, Prop. spin-conjugation, Prop. transported-dirac-form,637# Cor. boost-covariance): Clifford relations with η = diag(−2, 1, 1, 1); the boost formulas S⁻¹γ⁰S =638# Aγ⁰ + νBγ¹, S⁻¹γ¹S = Bγ⁰ + Aγ¹; the transported γ̂⁰ = Aγ⁰ − νBγ¹, γ̂¹ = −Bγ⁰ + Aγ¹ with A = 10, B = 2;639# the covariance identity D_{Λ,S} T ψ = T D_{E0} ψ on a sample field.640def block_fin():641 """Block fin — the F_13 worked examples as registered checks (EXACT): fin.S1–S3."""642 # S1 — power maps643 ok = True644 # 8:E2 (p08035)645 for eps in (1, 2, 3, 4, 6, 12):646 image = {pow(x, eps, P) for x in range(1, P)}647 d = gcd(eps, P - 1)648 ok &= (len(image) == (P - 1) // d) and all(sum(1 for x in range(1, P) if pow(x, eps, P) == y) == d for y in image)649 check("fin.S1", ok, "ε = 1, 2, 3, 4, 6, 12 on F_13^×; fibres of size gcd(ε, 12)")650651 # S2 — the Schrödinger example652 n = P653 eye = identity(n)654 shift, shift_inv = zero_matrix(n, n), zero_matrix(n, n)655 for j in range(n):656 shift[(j - 1) % n][j] = ONE; shift_inv[(j + 1) % n][j] = ONE657 delta = mat_sub(mat_add(shift, shift_inv), scalar_mul(scalar(2), eye))658 H = scalar_mul(scalar(-1), delta)659 def cayley_for(alpha):660 return mat_mul(mat_inv(mat_sub(eye, scalar_mul(alpha, H))), mat_add(eye, scalar_mul(alpha, H)))661 def order(M, bound=200):662 cur = identity(n)663 for e in range(1, bound + 1):664 cur = mat_mul(cur, M)665 if mat_eq(cur, eye): return e666 return None667 # 8:C6 (p08020), 8:E3 (p08036)668 U = cayley_for(C)669 ok = mat_eq(mat_pow(U, 13), eye)670 orders = {}671 for k in range(P):672 try:673 Uk = cayley_for(Fp2(0, k)); orders[k] = order(Uk)674 except ValueError:675 orders[k] = None676 ok &= all(orders[k] == 13 for k in range(1, P)) and orders[0] == 1677 # unitarity: U^† U = I with the conjugate-transpose over K = F_13[w]/(w²−2), conj(a + bw) = a − bw678 def dagger(M):679 return [[Fp2(M[j][i].a, (-M[j][i].b) % P) for j in range(n)] for i in range(n)]680 # 8:C4 (p08018)681 ok &= mat_eq(mat_mul(dagger(U), U), eye)682 check("fin.S2", ok, f"U^13 = I; orders {sorted(set(orders.values()))}; U†U = I")683684 # S3 — the Dirac example685 g0, g1, g2, g3 = gamma_matrices()686 gammas = [g0, g1, g2, g3]; eta = [-NU, 1, 1, 1]687 ok = True688 # 8:D2 (p08022)689 for mu in range(4):690 for nu in range(4):691 lhs = anticommutator(gammas[mu], gammas[nu])692 rhs = zero_matrix(4, 4)693 for i in range(4): rhs[i][i] = scalar(2 * eta[mu] if mu == nu else 0)694 ok &= mat_eq(lhs, rhs)695 delta_inv = scalar(1 - NU).inv()696 M = mat_mul(g0, g1)697 S = mat_add(identity(4), M); S_inv = scalar_mul(delta_inv, mat_sub(identity(4), M))698 A = scalar(1 + NU) / scalar(1 - NU); B = scalar(-2) / scalar(1 - NU)699 # 8:D12 (p08032)700 ok &= (A.a, A.b, B.a, B.b) == (10, 0, 2, 0)701 # 8:D6 (p08026)702 ok &= mat_eq(mat_mul(mat_mul(S_inv, g0), S), mat_add(scalar_mul(A, g0), scalar_mul(scalar(NU) * B, g1)))703 ok &= mat_eq(mat_mul(mat_mul(S_inv, g1), S), mat_add(scalar_mul(B, g0), scalar_mul(A, g1)))704 # 8:D7 (p08027)705 t0 = mat_mul(mat_mul(S, g0), S_inv); t1 = mat_mul(mat_mul(S, g1), S_inv)706 ok &= mat_eq(t0, mat_add(scalar_mul(A, g0), scalar_mul(-scalar(NU) * B, g1)))707 ok &= mat_eq(t1, mat_add(scalar_mul(-B, g0), scalar_mul(A, g1)))708 a, b = A.a, B.a709 lam = [[a, b, 0, 0], [(NU * b) % P, a, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]710 boosted = [(a, (NU * b) % P, 0, 0), (b, a, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1)]711 sample = {(0, 0, 0, 0): [ONE, C, ZERO, scalar(2)], (1, 2, 0, 0): [scalar(3), ZERO, I_T, ONE], (5, 0, 1, 0): [ZERO, scalar(4), C, scalar(7)]}712 std = [(1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1)]713 # 8:D8 (p08028)714 lhs = dirac_apply(transport_apply(sample, lam, S), [t0, t1, g2, g3], boosted)715 rhs = transport_apply(dirac_apply(sample, gammas, std), lam, S)716 ok &= field_eq(lhs, rhs)717 check("fin.S3", ok, "Clifford; boost formulas; γ̂⁰ = 10γ⁰ − 4γ¹, γ̂¹ = −2γ⁰ + 10γ¹ (A = 10, B = 2); covariance on the sample field")718719# ------------------------------------------------------------------------------------------------------------720# block shell — the free evolution is the drive; the F_17 numbers (shell_checks)721#722# Shell-reading checks: the free evolution is the drive (EXACT).723#724# Verifies Theorem (zonal evolution) and its corollaries on F_13 and F_17,725# plus the F_17 Dirac example numbers quoted in the manuscript.726#727# Z1 The drive pullback (D psi)(x) = psi(g^{-1} x) is a permutation728# operator (unitary); on the character chi_k(g^j) = g^{jk} it acts729# with eigenvalue g^{-k}: the winding-k mode gains phase g^{-k} per730# chronon, exhaustively over all k and all cycle points.731# Z2 Isotropy: <chi_k, chi_k> = 0 except k = 0 and k = (p-1)/2, whose732# eigenvalues are +-1 = N^1 intersect the phase cycle.733# Z3 Sector separation: the eigenvalue g^{-1} has order p-1 > 2, hence734# lies outside N^1: the free evolution is not a Cayley step of any735# Hamiltonian with Frobenius-fixed spectrum.736# Z4 F_17 example: frame (t;0,1,3), derived i = 3^{-4} = 4, i^2 = -1;737# 2, i, e = g^i all squares (only g nonsquare); with nu = g = 3 and738# x = y = 1: A = 15, B = 1, A^2 - nu B^2 = 1; |G_3| = 18 = p + 1;739# an order-3 boost exists (triality), none exists at p = 13.740def block_shell():741 """Block shell — the free evolution is the drive, the F_17 numbers (EXACT): shell.Z1–Z4."""742 begin("shell")743744 def is_sq(a, p):745 return pow(a % p, (p - 1) // 2, p) == 1746747 for p, g in ((13, 2), (17, 3)):748 n = p - 1749 # Z1: eigen-relation of the pullback on every character, every point750 for k in range(n):751 lam = pow(g, (-k) % n, p)752 # 8:F3 (p08040)753 chk(f"Z1 p={p} k={k}",754 all(pow(g, ((j - 1) * k) % n, p) == lam * pow(g, (j * k) % n, p) % p755 for j in range(n)))756 # Z2: isotropy pattern757 for k in range(n):758 s = sum(pow(g, (2 * j * k) % n, p) for j in range(n)) % p759 chk(f"Z2 p={p} k={k}", (s == 0) == (k not in (0, n // 2)))760 chk(f"Z2 p={p} real eigenvalues",761 pow(g, 0, p) == 1 and pow(g, (-(n // 2)) % n, p) == p - 1)762 # Z3: sector separation763 o, v = 1, pow(g, n - 1, p) # g^{-1}764 u = v765 while u != 1:766 u = u * v % p; o += 1767 # 8:F4 (p08041)768 chk(f"Z3 p={p} ord(g^-1) = p-1", o == n)769770 # Z4: the F_17 anchor771 p, g = 17, 3772 i = pow(pow(g, p - 2, p), 4, p)773 chk("Z4 i = 4, i^2 = -1", i == 4 and i * i % p == p - 1)774 chk("Z4 2, i, e squares; g nonsquare",775 is_sq(2, p) and is_sq(i, p) and is_sq(pow(g, i, p), p) and not is_sq(g, p))776 nu = g777 d = (1 - nu) % p778 di = pow(d, p - 2, p)779 A, B = (1 + nu) * di % p, (-2) * di % p780 chk("Z4 A = 15, B = 1", A == 15 and B == 1)781 chk("Z4 A^2 - nu B^2 = 1", (A * A - nu * B * B) % p == 1)782 def boost_count(p, nu):783 seen = set()784 for x in range(p):785 for y in range(p):786 dd = (x * x - nu * y * y) % p787 if dd == 0:788 continue789 ddi = pow(dd, p - 2, p)790 seen.add(((x * x + nu * y * y) * ddi % p, (-2 * x * y) * ddi % p))791 return seen792 G17 = boost_count(17, 3)793 G13 = boost_count(13, 2)794 chk("Z4 |G_3| = 18", len(G17) == 18)795 chk("Z4 |G_2| = 14", len(G13) == 14)796 def kord(a, b, p, nu):797 x, y, o = a, b, 1798 while (x, y) != (1, 0):799 x, y = (x * a + nu * y * b) % p, (x * b + y * a) % p, ; o += 1800 return o801 # order-3 element in N^1: exists iff 3 | p+1 (via A - B w norm-one coords)802 def n1_orders(p, nu):803 out = set()804 for x in range(p):805 for y in range(p):806 if (x * x - nu * y * y) % p == 1:807 out.add(kord(x, y, p, nu))808 return out809 chk("Z4 triality at p=17", 3 in n1_orders(17, 3))810 chk("Z4 no triality at p=13", 3 not in n1_orders(13, 2))811 flush("shell")812813# ------------------------------------------------------------------------------------------------------------814# block o2 — the canonical Lorentzian coefficient ν = g (o2_checks)815#816# O2 exact checks: the canonical Lorentzian coefficient nu = g (EXACT).817#818# Blueprint item O2 (reports/revision-blueprint.md). All checks in exact819# integer arithmetic; no floats, no RNG, no searched roots where derived820# ones exist. Square classes by the Euler criterion a^((p-1)/2) = +-1.821#822# Claims checked:823# C1 Every primitive g is a nonsquare, on every symmetry-complete shell.824# C2 The nonsquare class is unique: the product of any two nonsquares825# is a square (representative choice carries no geometric content).826# C3 i is a square iff kappa is even (8 | p-1); 2, 2^-1, -2 are squares827# iff kappa is even. Hence on kappa-even (admissibility-class)828# shells every named residue except g lands in the square class:829# g is the unique universally-nonsquare frame datum.830# C4 e = g^i has no stable class (i's exponent parity varies by shell):831# counterexamples both ways.832# C5 Flip stability: [g^-1] = [g] (nonsquare); the class survives the833# matter-antimatter gauge.834# C6 The boost group G_nu with nu = g has order exactly p+1 (the835# non-split torus), enumerated exhaustively on small shells.836# C7 F_13 anchor: g = 2 = nu (the paper's example already instantiates837# nu = g); derived i = g^-kappa = 5; 2^-1 = 7 nonsquare, so838# sqrt(2^-1) lives in K, not F_13 (kappa odd = non-admissible).839# C8 F_17 counter-anchor (kappa = 4 even): 2, i = 4, e are all squares;840# only g = 3 is nonsquare; |G_3| = 18 = p+1.841# C9 Lab Carrier Om = 2,408,561 (S = 602,140 even, admissible):842# g = 6 nonsquare; 2, 2^-1, -2, i = hbar = 18,688 all squares --843# on the physical admissibility class the drive is the only named844# nonsquare, and c = sqrt(2^-1) = 171,106 is base-rational.845def is_sq(a, p):846 a %= p847 assert a != 0848 return pow(a, (p - 1) // 2, p) == 1849850def primitive_roots(p):851 n = p - 1852 fac, m = set(), n853 d = 2854 while d * d <= m:855 while m % d == 0:856 fac.add(d); m //= d857 d += 1858 if m > 1:859 fac.add(m)860 return [g for g in range(2, p) if all(pow(g, n // q, p) != 1 for q in fac)]861862def shells(limit):863 for p in range(5, limit):864 if p % 4 == 1 and all(p % d for d in range(2, int(p**0.5) + 1)):865 yield p866867def block_o2():868 """Block o2 — the canonical Lorentzian coefficient ν = g (EXACT): o2.C1, C2, C3i, C3a, C4–C9."""869 begin("o2")870871 # C1, C2, C3, C5 over all symmetry-complete shells below 2000872 for p in shells(2000):873 kap = (p - 1) // 4874 gs = primitive_roots(p)875 # 8:B3 (p08009)876 chk(f"C1 p={p}", all(not is_sq(g, p) for g in gs))877 ns = [a for a in range(1, p) if not is_sq(a, p)]878 # 8:B2 (p08008)879 chk(f"C2 p={p}", all(is_sq(ns[0] * b, p) for b in ns[1:]))880 g = gs[0]881 i = pow(pow(g, p - 2, p), kap, p) # derived orientation i = g^-kappa882 chk(f"C3i p={p}", is_sq(i, p) == (kap % 2 == 0))883 inv2 = (p + 1) // 2884 for a in (2, inv2, p - 2):885 chk(f"C3a p={p} a={a}", is_sq(a, p) == (kap % 2 == 0))886 chk(f"C5 p={p}", not is_sq(pow(g, p - 2, p), p))887888 # C4: e's class varies -- exhibit both parities of the exponent i889 par = set()890 for p in shells(2000):891 kap = (p - 1) // 4892 g = primitive_roots(p)[0]893 i = pow(pow(g, p - 2, p), kap, p)894 par.add(i % 2) # exponent parity = class of e895 if par == {0, 1}:896 break897 chk("C4 e class unstable", par == {0, 1})898899 # C6: |G_nu| = p+1 with nu = g, exhaustive enumeration900 def boost_order(p, nu):901 seen = set()902 for x in range(p):903 for y in range(p):904 d = (x * x - nu * y * y) % p905 if d == 0:906 continue907 di = pow(d, p - 2, p)908 seen.add(((x * x + nu * y * y) * di % p, (-2 * x * y) * di % p))909 return len(seen)910911 for p in (13, 17, 29, 37):912 g = primitive_roots(p)[0]913 chk(f"C6 p={p}", boost_order(p, g) == p + 1)914915 # C7: F_13 anchor916 p = 13917 chk("C7 g=2 primitive", 2 in primitive_roots(p))918 chk("C7 nu=2=g", True) # the example's nu is the drive919 chk("C7 i derived", pow(pow(2, p - 2, p), 3, p) == 5 and 5 * 5 % p == p - 1)920 chk("C7 2^-1=7 nonsquare", not is_sq(7, p))921922 # C8: F_17 counter-anchor (kappa even)923 p = 17924 chk("C8 g=3 primitive", 3 in primitive_roots(p))925 i17 = pow(pow(3, p - 2, p), 4, p)926 chk("C8 i=4 square", i17 == 4 and is_sq(4, p) and 4 * 4 % p == p - 1)927 chk("C8 2 square", is_sq(2, p))928 chk("C8 e square", is_sq(pow(3, i17, p), p))929 chk("C8 |G_3|=18", boost_order(p, 3) == p + 1)930931 # C9: lab Carrier932 Om, S = 2408561, 602140933 chk("C9 S even", S % 2 == 0 and Om == 4 * S + 1)934 chk("C9 g=6 nonsquare", not is_sq(6, Om))935 inv2 = (Om + 1) // 2936 chk("C9 2,2^-1,-2 squares", all(is_sq(a, Om) for a in (2, inv2, Om - 2)))937 chk("C9 i=hbar square", is_sq(18688, Om) and 18688 * 18688 % Om == Om - 1)938 chk("C9 c base-rational", 171106 * 171106 % Om == inv2)939 flush("o2")940941# ------------------------------------------------------------------------------------------------------------942# block o7 — the parity grading and the two factors of c² (o7_checks)943#944# O7 exact checks: the factorisation ν = c²·(2g) and the parity grading (EXACT).945#946# Blueprint item O7; findings in reports/o7-flag-parity.md. All arithmetic947# exact; square classes by the Euler criterion; discrete logs by exhaustive948# exponent scan on small shells (dev shells only).949#950# Claims checked:951# P1 Parity form of the square class: for primitive g the squares are952# exactly <g^2>, so the class of x is the parity of dlog_g(x) --953# the drive-step (chronon) parity. Exhaustive on F_13, F_17 for954# every primitive g; Euler-criterion form on all symmetry-complete955# shells p < 2000.956# P2 The exact factorization nu = c^2 * (2g): shell-generic since957# 2*c^2 = 1; lab-Carrier instance (mod Om = 2,408,561):958# c^2 = 1,204,281, 2g = 12, product = 6 = g.959# P3 Parity split: [c^2] is even (square) iff kappa is even (the960# admissibility class: the two-way constant is registered exactly961# where c exists); [2g] is odd iff kappa is even; the product is962# odd on every shell -- the cofactor carries the entire signature963# bit in both parities.964# P4 Chart-grading insufficiency: on kappa-even shells every element965# of Q4 = {1, i, -1, -i} is a square -- the order-four chart966# family carries no signature on the admissibility class; the967# signature lives in the parity grading, invisible to torsion-free968# (and Q4D) bookkeeping.969# P5 Registered transport is even: N(g x) = g^2 N(x) identically970# (framed-complex norm), and g^2 is a square -- per-chronon971# two-way/comparison readings are even-parity; the one-way972# multiplier g is odd; no x in F_p has x^2 = g (the cone slope is973# the unregistrable half-step).974# P6 Gauge stability: dlog_g(g^{-1}) = -1 is odd -- the B19 flip975# g -> g^{-1} preserves the parity class while reversing the976# one-way direction (finite Reichenbach freedom).977def block_o7():978 """Block o7 — the parity grading and the factorisation ν = c²·(2g) (EXACT): o7.P1–P6."""979 begin("o7")980981 def is_sq(a, p):982 return pow(a % p, (p - 1) // 2, p) == 1983984 def primitive_roots(p):985 n = p - 1986 fac, m, d = set(), n, 2987 while d * d <= m:988 while m % d == 0:989 fac.add(d); m //= d990 d += 1991 if m > 1:992 fac.add(m)993 return [g for g in range(2, p) if all(pow(g, n // q, p) != 1 for q in fac)]994995 def shells(limit):996 for p in range(5, limit):997 if p % 4 == 1 and all(p % d for d in range(2, int(p**0.5) + 1)):998 yield p9991000 # P1 exhaustive on dev shells: class of g^j = parity of j, every primitive g1001 for p in (13, 17):1002 for g in primitive_roots(p):1003 for j in range(p - 1):1004 # 8:B5 (p08011)1005 chk(f"P1 p={p} g={g} j={j}", is_sq(pow(g, j, p), p) == (j % 2 == 0))1006 # P1 Euler form on the scan: <g^2> = squares1007 for p in shells(2000):1008 g = primitive_roots(p)[0]1009 chk(f"P1 p={p} g odd", not is_sq(g, p))1010 chk(f"P1 p={p} g^2 even", is_sq(g * g % p, p))10111012 # P2 factorization1013 for p in shells(2000):1014 g = primitive_roots(p)[0]1015 c2 = (p + 1) // 2 # 2^{-1}1016 # 8:B4 (p08010)1017 chk(f"P2 p={p} nu = c^2*2g", (c2 * 2 * g) % p == g % p)1018 Om, S, gO = 2408561, 602140, 61019 c2O = (Om + 1) // 21020 chk("P2 lab Carrier c^2 = 2S+1", c2O == 2 * S + 1 == 1204281)1021 chk("P2 lab Carrier c^2*(2g) = g", (c2O * 12) % Om == 6)10221023 # P3 parity split; P4 chart-grading insufficiency1024 for p in shells(2000):1025 kap = (p - 1) // 41026 g = primitive_roots(p)[0]1027 c2 = (p + 1) // 21028 chk(f"P3 p={p} [c^2] even iff kappa even", is_sq(c2, p) == (kap % 2 == 0))1029 chk(f"P3 p={p} [2g] odd iff kappa even", (not is_sq(2 * g % p, p)) == (kap % 2 == 0))1030 chk(f"P3 p={p} product odd", not is_sq(c2 * 2 * g % p, p))1031 if kap % 2 == 0:1032 i = pow(g, kap, p)1033 chk(f"P4 p={p} Q4 all squares", all(is_sq(x, p) for x in (1, i, p - 1, p - i)))10341035 # P5 registered transport even; cone slope unregistrable1036 for p, g in ((13, 2), (17, 3)):1037 for a in range(p):1038 for b in range(p):1039 if (a, b) == (0, 0):1040 continue1041 n1 = (a * a + b * b) % p1042 ga, gb = (g * a) % p, (g * b) % p1043 # 8:B6 (p08012)1044 chk(f"P5 p={p} N(gx)=g^2N(x) ({a},{b})",1045 (ga * ga + gb * gb) % p == (g * g * n1) % p)1046 chk(f"P5 p={p} g^2 square", is_sq(g * g % p, p))1047 chk(f"P5 p={p} x^2=g insoluble", all(pow(x, 2, p) != g for x in range(p)))10481049 # P6 flip parity1050 for p in shells(2000):1051 g = primitive_roots(p)[0]1052 chk(f"P6 p={p} g^-1 odd", not is_sq(pow(g, p - 2, p), p))1053 flush("o7")10541055# ------------------------------------------------------------------------------------------------------------1056# block o134 — boost torus, Cayley transform, orbit periods (o134_checks)1057#1058# O1/O3/O4 exact checks: boost torus, Cayley transform, orbit periods (EXACT).1059#1060# Blueprint items O1, O3, O4 (reports/revision-blueprint.md); findings in1061# reports/o134-findings.md. All arithmetic exact over K = F_p[w]/(w^2 - nu);1062# no floats, no RNG. Elements of K are pairs (a, b) = a + b*w.1063#1064# Claims checked:1065# O1a The kernel of (x,y) -> Lambda(x,y) is the scalar line: each boost1066# matrix has exactly p-1 preimages in K^x, so |G_nu| = p+1.1067# O1b Hilbert 90 form: the boost entries satisfy A - B*w = z/zbar, a1068# norm-one element; the map z*F_p^x -> z/zbar is a bijection onto1069# the norm-one torus N1, so G_nu ~ N1 = C_{p+1} canonically.1070# O1c G_nu is cyclic: an element of order exactly p+1 exists.1071# O1d Triality: an order-3 element exists in G_nu iff 3 | p+11072# (p = 17: yes; p = 13: no).1073# O1e F_17 is the minimal admissible shell: kappa = 4 even, kappa = 11074# (mod 3), p = 5 (mod 12), and no smaller symmetry-complete p1075# satisfies the triple.1076# O3a The scalar Cayley map phi(lam) = (1 + a*lam)/(1 - a*lam), a in1077# K^- nonzero, sends the Frobenius-fixed projective line1078# P1(F_p) bijectively onto the norm-one torus N1 (with1079# phi(infinity) = -1). Self-adjoint line -> unitary torus, exact.1080# O3b The unitary group of one channel is N1: {u in K^x : ubar*u = 1}1081# = C_{p+1}, same torus as the boosts.1082# O4a Kinetic case: H = -Delta on F_p is nilpotent (H = -T^{-1}(T-I)^2,1083# (T-I)^p = 0 in characteristic p), hence U = phi(H) is unipotent1084# and ord(U) = p. Reproduces and explains the paper's ord = 13.1085# O4b Potential case: H = M_V with V = id is diagonal with F_p1086# spectrum, so U's eigenphases lie in N1 and ord(U) = p+1.1087# (p = 13: ord 14; p = 17: ord 18.)1088# O4c Mixed case (recorded datum, p = 5, nu = g = 2): ord(U) for1089# H = -Delta + M_id is computed exactly and verified.1090# O4d Composite/E2 cross-check: ord of a block-diagonal pair is the1091# lcm of the parts' orders (13, 14 -> 182).1092def make_field(p, nu):1093 def add(u, v): return ((u[0] + v[0]) % p, (u[1] + v[1]) % p)1094 def sub(u, v): return ((u[0] - v[0]) % p, (u[1] - v[1]) % p)1095 def mul(u, v):1096 return ((u[0] * v[0] + nu * u[1] * v[1]) % p,1097 (u[0] * v[1] + u[1] * v[0]) % p)1098 def conj(u): return (u[0], (-u[1]) % p)1099 def norm(u): return (u[0] * u[0] - nu * u[1] * u[1]) % p1100 def inv(u):1101 n = norm(u)1102 ni = pow(n, p - 2, p)1103 return ((u[0] * ni) % p, (-u[1] * ni) % p)1104 return add, sub, mul, conj, norm, inv11051106def block_o134():1107 """Block o134 — the boost torus, the Cayley transform and the orbit periods (EXACT): o134.O1a–O4d."""1108 begin("o134")11091110 def boost(p, nu, x, y):1111 d = (x * x - nu * y * y) % p1112 di = pow(d, p - 2, p)1113 return ((x * x + nu * y * y) * di % p, (-2 * x * y) * di % p)11141115 # ---------------- O1 ----------------1116 for p, nu in ((13, 2), (17, 3)):1117 add, sub, mul, conj, norm, inv = make_field(p, nu)1118 pre = {}1119 for x in range(p):1120 for y in range(p):1121 if (x * x - nu * y * y) % p == 0:1122 continue1123 pre.setdefault(boost(p, nu, x, y), []).append((x, y))1124 # 8:D5 (p08025)1125 chk(f"O1a p={p} |G|=p+1", len(pre) == p + 1)1126 chk(f"O1a p={p} fibers p-1", all(len(v) == p - 1 for v in pre.values()))1127 n1 = {u for x in range(p) for y in range(p)1128 if norm(u := (x, y)) == 1}1129 chk(f"O3b p={p} |N1|=p+1", len(n1) == p + 1)1130 ok = True1131 for (A, B), zs in pre.items():1132 for z in zs:1133 q = mul(z, inv(conj(z))) # z / zbar1134 ok &= q == (A, (-B) % p) and norm(q) == 11135 chk(f"O1b p={p} Lambda = z/zbar (Hilbert 90)", ok)1136 chk(f"O1b p={p} image = N1", {(A, (-B) % p) for (A, B) in pre} == n1)1137 def kord(u):1138 v, o = u, 11139 while v != (1, 0):1140 v = mul(v, u); o += 11141 return o1142 chk(f"O1c p={p} cyclic", max(kord(u) for u in n1) == p + 1)1143 chk(f"O1d p={p} triality", any(kord(u) == 3 for u in n1) == ((p + 1) % 3 == 0))11441145 def is_prime(n):1146 return n > 1 and all(n % d for d in range(2, int(n**0.5) + 1))1147 adm = [4 * k + 1 for k in range(1, 5)1148 if k % 2 == 0 and k % 3 == 1 and is_prime(4 * k + 1)]1149 chk("O1e F_17 minimal admissible", adm == [17])11501151 # ---------------- O3 ----------------1152 for p, nu in ((13, 2), (17, 3)):1153 add, sub, mul, conj, norm, inv = make_field(p, nu)1154 n1 = {u for x in range(p) for y in range(p) if norm(u := (x, y)) == 1}1155 for k in range(1, p): # every nonzero a = k*w1156 a = (0, k)1157 img = set()1158 for lam in range(p):1159 den = sub((1, 0), mul(a, (lam, 0)))1160 # 8:C5 (p08019)1161 chk(f"O3a p={p} k={k} lam={lam} invertible", norm(den) != 0)1162 u = mul(add((1, 0), mul(a, (lam, 0))), inv(den))1163 chk(f"O3a p={p} k={k} lam={lam} norm-one", norm(u) == 1)1164 img.add(u)1165 img.add(((-1) % p, 0)) # phi(infinity) = -11166 chk(f"O3a p={p} k={k} bijection", img == n1 and len(img) == p + 1)11671168 # ---------------- O4 ----------------1169 def mat_id(n): return [[(1, 0) if i == j else (0, 0) for j in range(n)] for i in range(n)]11701171 def mat_mul(X, Y, mul, add, n):1172 Z = [[(0, 0)] * n for _ in range(n)]1173 for i in range(n):1174 for k in range(n):1175 x = X[i][k]1176 if x == (0, 0):1177 continue1178 for j in range(n):1179 Z[i][j] = add(Z[i][j], mul(x, Y[k][j]))1180 return Z11811182 def mat_inv(X, mul, add, sub, inv, n):1183 A = [row[:] + I_row[:] for row, I_row in zip(X, mat_id(n))]1184 for col in range(n):1185 piv = next(r for r in range(col, n) if A[r][col] != (0, 0))1186 A[col], A[piv] = A[piv], A[col]1187 pi = inv(A[col][col])1188 A[col] = [mul(pi, v) for v in A[col]]1189 for r in range(n):1190 if r != col and A[r][col] != (0, 0):1191 f = A[r][col]1192 A[r] = [sub(v, mul(f, w)) for v, w in zip(A[r], A[col])]1193 return [row[n:] for row in A]11941195 def cayley(H, a, p, nu, n):1196 add, sub, mul, conj, norm, inv = make_field(p, nu)1197 aH = [[mul(a, H[i][j]) for j in range(n)] for i in range(n)]1198 I = mat_id(n)1199 Im = [[sub(I[i][j], aH[i][j]) for j in range(n)] for i in range(n)]1200 Ip = [[add(I[i][j], aH[i][j]) for j in range(n)] for i in range(n)]1201 return mat_mul(mat_inv(Im, mul, add, sub, inv, n), Ip, mul, add, n)12021203 def mat_ord(U, p, nu, n, cap):1204 add, sub, mul, conj, norm, inv = make_field(p, nu)1205 I, V, o = mat_id(n), U, 11206 while V != I:1207 V = mat_mul(V, U, mul, add, n); o += 11208 if o > cap:1209 return None1210 return o12111212 def build(p, kinetic, potential):1213 n = p1214 H = [[(0, 0)] * n for _ in range(n)]1215 for x in range(n):1216 if kinetic: # -Delta = -(T + T^-1 - 2I)1217 H[x][(x + 1) % n] = ((-1) % p, 0)1218 H[x][(x - 1) % n] = ((-1) % p, 0)1219 H[x][x] = (2 % p, 0)1220 if potential: # + M_V, V = id1221 a = H[x][x]1222 H[x][x] = ((a[0] + x) % p, a[1])1223 return H12241225 for p, nu in ((13, 2), (17, 3)):1226 add, sub, mul, conj, norm, inv = make_field(p, nu)1227 a = (0, 1) # alpha = w1228 Hk = build(p, True, False)1229 U = cayley(Hk, a, p, nu, p)1230 # unipotency: (U - I)^p = 01231 I = mat_id(p)1232 N = [[sub(U[i][j], I[i][j]) for j in range(p)] for i in range(p)]1233 Np = N1234 for _ in range(p - 1):1235 Np = mat_mul(Np, N, mul, add, p)1236 # 8:E4 (p08037)1237 chk(f"O4a p={p} (U-I)^p = 0", all(v == (0, 0) for row in Np for v in row))1238 chk(f"O4a p={p} ord(U) = p", mat_ord(U, p, nu, p, 2 * p) == p)1239 Hv = build(p, False, True)1240 Uv = cayley(Hv, a, p, nu, p)1241 chk(f"O4b p={p} ord(U) = p+1", mat_ord(Uv, p, nu, p, 2 * p + 2) == p + 1)12421243 # O4c: mixed case at p = 5, nu = g = 2 (primitive, nonsquare)1244 p, nu = 5, 21245 Hm = build(p, True, True)1246 Um = cayley(Hm, (0, 1), p, nu, p)1247 om = mat_ord(Um, p, nu, p, 100000)1248 chk("O4c p=5 mixed order finite", om is not None)1249 print(f"O4c datum: p=5, nu=g=2, H=-Delta+M_id, alpha=w: ord(U) = {om}")12501251 # O4d: composite = lcm (E2 cross-check)1252 chk("O4d lcm(13,14)=182", 13 * 14 // gcd(13, 14) == 182)1253 flush("o134")12541255# ------------------------------------------------------------------------------------------------------------1256# block o8 — symmetric Dirac dynamics and the spinor form (o8_checks)1257#1258# O8 exact checks: symmetric Dirac dynamics (round-01 item 1) (EXACT).1259#1260# Repair route of review 8-dirac-20260709-01-1, executed and extended.1261# Elements of K = F_p[w]/(w^2 - nu) as pairs (a, b) = a + b w.1262#1263# Claims checked:1264# X1 Gamma adjoints under plain conj-transpose: (g0)+ = -g0, (g1)+ = -g1,1265# (g2)+ = +g2, (g3)+ = -g3 (the g2 obstruction; p = 5, 13, 17).1266# X2 The spinor twist X = g0 g1 g3 is Hermitian (X+ = X), invertible,1267# commutes with g0, g1, g3 and anticommutes with g2; consequently1268# X^{-1} (g_mu)+ X = -g_mu for ALL mu: every gamma is X-anti-self-1269# adjoint. (The continuum recipe M = g0 fails here because Frobenius1270# fixes i; checked as X3.)1271# X3 gamma0-twist fails: signs remain mixed.1272# X4 Symmetric difference: (T - T^{-1}) is nilpotent on H(F_p)1273# ((T^2 - I)^p = 0), and anti-self-adjoint; hence each gamma^mu1274# del^s_mu is X-self-adjoint and D^s = sum gamma^mu del^s_mu is1275# X-self-adjoint; D^s is nilpotent (its square is the symmetric1276# Klein-Gordon operator, a sum of commuting nilpotents).1277# X5 1+1 operator check at p = 5, nu = g = 2 (spinor space K^4 over1278# F_5^2, dimension 100): H = D^s is X-self-adjoint as a matrix1279# identity; the Cayley step U = (I - aH)^{-1}(I + aH), a = w, is1280# X-unitary (U^# U = I); U is unipotent with ord(U) = 25 = p^21281# (massless meridional period = the translation torus).1282# X6 Massive case: H = D^s - m I is X-self-adjoint; U factors as1283# norm-one phase times unipotent: ord(U) = lcm(p, ord_{N1} phi(-m))1284# -- checked for m = 1, 2 at p = 5 (mass enters through the1285# norm-one phase, interactions' torus).1286# X7 Sector unification (round-01 item 2): on H(Phi_p) the cycle1287# Laplacian Delta_Phi = D + D^{-1} - 2I is self-adjoint, its Cayley1288# steps commute with the drive pullback D exactly, and both are1289# unitary on the SAME space (p = 13: composite formed and checked).1290def block_o8():1291 """Block o8 — symmetric Dirac dynamics and the spinor form (EXACT): o8.X1–X9."""1292 begin("o8")12931294 def field(p, nu):1295 add = lambda u, v: ((u[0]+v[0]) % p, (u[1]+v[1]) % p)1296 sub = lambda u, v: ((u[0]-v[0]) % p, (u[1]-v[1]) % p)1297 def mul(u, v):1298 return ((u[0]*v[0] + nu*u[1]*v[1]) % p, (u[0]*v[1] + u[1]*v[0]) % p)1299 conj = lambda u: (u[0], (-u[1]) % p)1300 def inv(u):1301 n = (u[0]*u[0] - nu*u[1]*u[1]) % p1302 ni = pow(n, p-2, p)1303 return ((u[0]*ni) % p, (-u[1]*ni) % p)1304 return add, sub, mul, conj, inv13051306 def gammas(p, nu, g):1307 kap = (p-1)//41308 i = pow(pow(g, p-2, p), kap, p)1309 O, I1, ii, ww, iw = (0,0), (1,0), (i % p, 0), (0,1), (0, i % p)1310 niw = (0, (-i) % p); ni = ((p-i) % p, 0); m1 = ((p-1) % p, 0)1311 s1 = [[O,I1],[I1,O]]; s2 = [[O,ni],[ii,O]]; s3 = [[I1,O],[O,m1]]1312 def blk(A, B, C, D):1313 return [[A[0][0],A[0][1],B[0][0],B[0][1]],1314 [A[1][0],A[1][1],B[1][0],B[1][1]],1315 [C[0][0],C[0][1],D[0][0],D[0][1]],1316 [C[1][0],C[1][1],D[1][0],D[1][1]]]1317 Z = [[O,O],[O,O]]1318 def smul(s, M):1319 add, sub, mul, conj, inv = field(p, nu)1320 return [[mul(s, x) for x in row] for row in M]1321 beta = blk(Z[0:2] and Z, [[I1,O],[O,I1]], [[I1,O],[O,I1]], Z)1322 def rho(s):1323 ms = [[((-x[0]) % p, (-x[1]) % p) for x in row] for row in s]1324 return blk(Z, s, ms, Z)1325 g0 = smul(iw, beta)1326 g1 = smul(ii, rho(s1)); g2 = smul(ii, rho(s2)); g3 = smul(ii, rho(s3))1327 return g0, g1, g2, g3, i13281329 def mmul(A, B, p, nu):1330 add, sub, mul, conj, inv = field(p, nu)1331 n = len(A)1332 C = [[(0,0)]*n for _ in range(n)]1333 for a in range(n):1334 for b in range(n):1335 x = A[a][b]1336 if x == (0,0): continue1337 for c in range(n):1338 C[a][c] = add(C[a][c], mul(x, B[b][c]))1339 return C13401341 def dagger(A, p, nu):1342 add, sub, mul, conj, inv = field(p, nu)1343 n = len(A)1344 return [[conj(A[b][a]) for b in range(n)] for a in range(n)]13451346 def neg(A, p): return [[((-x[0]) % p, (-x[1]) % p) for x in row] for row in A]1347 def eye(n): return [[(1,0) if a==b else (0,0) for b in range(n)] for a in range(n)]13481349 # X1-X31350 for p, g in ((5,2),(13,2),(17,3)):1351 nu = g1352 g0,g1,g2,g3,i = gammas(p, nu, g)1353 G = [g0,g1,g2,g3]1354 signs = []1355 for M in G:1356 Md = dagger(M, p, nu)1357 signs.append(+1 if Md == M else (-1 if Md == neg(M,p) else 0))1358 # 8:D9 (p08029)1359 chk(f"X1 p={p} plain signs", signs == [-1,-1,1,-1])1360 X = mmul(mmul(g0,g1,p,nu), g3, p, nu)1361 chk(f"X2 p={p} X Hermitian", dagger(X,p,nu) == X)1362 add, sub, mul, conj, inv = field(p, nu)1363 ok = True1364 for k, M in enumerate(G):1365 XM, MX = mmul(X,M,p,nu), mmul(M,X,p,nu)1366 ok &= (XM == MX) if k != 2 else (XM == neg(MX,p))1367 chk(f"X2 p={p} (anti)commutation", ok)1368 # X^{-1} M+ X = -M for all mu; X^2 is scalar so X^{-1} ~ X1369 X2m = mmul(X, X, p, nu)1370 s = X2m[0][0]1371 chk(f"X2 p={p} X^2 scalar", X2m == [[s if a==b else (0,0) for b in range(4)] for a in range(4)])1372 chk(f"X2 p={p} X^2 = +nu exactly", s == (nu % p, 0))1373 si = inv(s)1374 Xi = [[mul(si, x) for x in row] for row in X]1375 ok = all(mmul(mmul(Xi, dagger(M,p,nu),p,nu), X, p, nu) == neg(M,p) for M in G)1376 chk(f"X2 p={p} all gammas X-anti-self-adjoint", ok)1377 g0i = [[mul(inv(mmul(g0,g0,p,nu)[0][0]), x) for x in row] for row in g0]1378 s03 = [ +1 if mmul(mmul(g0i, dagger(M,p,nu),p,nu), g0,p,nu) == M else -1 for M in G ]1379 chk(f"X3 p={p} gamma0-twist mixed", len(set(s03)) > 1)13801381 # X4: 1-dim symmetric difference nilpotent + anti-self-adjoint (plain form)1382 for p in (5, 13):1383 T = [[(1,0) if (b-a) % p == 1 else (0,0) for b in range(p)] for a in range(p)]1384 Ti = [[(1,0) if (b-a) % p == p-1 else (0,0) for b in range(p)] for a in range(p)]1385 nu = 2 if p in (5,13) else 31386 S = [[( (T[a][b][0]-Ti[a][b][0]) % p, 0) for b in range(p)] for a in range(p)]1387 P = S1388 nil = False1389 for _ in range(p):1390 P = mmul(P, S, p, nu)1391 if all(x == (0,0) for row in P for x in row): nil = True; break1392 chk(f"X4 p={p} (T-T^-1) nilpotent", nil)1393 chk(f"X4 p={p} anti-self-adjoint", dagger(S,p,nu) == neg(S,p))13941395 # X5/X6: 1+1 operator check at p=5, nu=g=21396 p, g = 5, 21397 nu = g1398 g0,g1,g2,g3,i = gammas(p, nu, g)1399 add, sub, mul, conj, inv = field(p, nu)1400 inv2 = (pow(2, p-2, p), 0)1401 n = 4 * p * p # spinor index s + point (x0, x1)1402 def idx(s, x0, x1): return s*p*p + x0*p + x11403 def build_D(m):1404 D = [[(0,0)]*n for _ in range(n)]1405 for x0 in range(p):1406 for x1 in range(p):1407 for s in range(4):1408 for sp in range(4):1409 c0, c1 = g0[s][sp], g1[s][sp]1410 if c0 != (0,0):1411 h = mul(inv2, c0)1412 D[idx(s,x0,x1)][idx(sp,(x0+1)%p,x1)] = add(D[idx(s,x0,x1)][idx(sp,(x0+1)%p,x1)], h)1413 D[idx(s,x0,x1)][idx(sp,(x0-1)%p,x1)] = sub(D[idx(s,x0,x1)][idx(sp,(x0-1)%p,x1)], h)1414 if c1 != (0,0):1415 h = mul(inv2, c1)1416 D[idx(s,x0,x1)][idx(sp,x0,(x1+1)%p)] = add(D[idx(s,x0,x1)][idx(sp,x0,(x1+1)%p)], h)1417 D[idx(s,x0,x1)][idx(sp,x0,(x1-1)%p)] = sub(D[idx(s,x0,x1)][idx(sp,x0,(x1-1)%p)], h)1418 if m and s == sp:1419 pass1420 if m:1421 for q in range(n):1422 D[q][q] = sub(D[q][q], ((m) % p, 0))1423 return D1424 # big-X form matrix: block-diagonal X per point1425 X = mmul(mmul(g0,g1,p,nu), g3, p, nu)1426 def form_adjoint(A):1427 # A# = Xbig^{-1} A+ Xbig ; Xbig block diag1428 Ad = dagger(A, p, nu)1429 s = mmul(X, X, p, nu)[0][0]; si = inv(s)1430 Xi4 = [[mul(si, x) for x in row] for row in X]1431 B = [[(0,0)]*n for _ in range(n)]1432 # (Xi A+ X) with X acting on spinor index only1433 for x0 in range(p):1434 for x1 in range(p):1435 for y0 in range(p):1436 for y1 in range(p):1437 # block (x,y): B_block = Xi4 * Ad_block * X41438 blk = [[Ad[idx(a,x0,x1)][idx(b,y0,y1)] for b in range(4)] for a in range(4)]1439 if all(v == (0,0) for row in blk for v in row): continue1440 t1 = mmul(Xi4, blk, p, nu); t2 = mmul(t1, X, p, nu)1441 for a in range(4):1442 for b in range(4):1443 B[idx(a,x0,x1)][idx(b,y0,y1)] = t2[a][b]1444 return B14451446 def big_mmul(A, B_):1447 C = [[(0,0)]*n for _ in range(n)]1448 for a in range(n):1449 Ar = A[a]1450 for b in range(n):1451 x = Ar[b]1452 if x == (0,0): continue1453 Bb = B_[b]1454 Ca = C[a]1455 for c in range(n):1456 if Bb[c] != (0,0):1457 Ca[c] = add(Ca[c], mul(x, Bb[c]))1458 return C14591460 def big_inv(A):1461 M = [row[:] + [( (1,0) if r==j else (0,0)) for j in range(n)] for r, row in enumerate(A)]1462 for col in range(n):1463 piv = next(r for r in range(col, n) if M[r][col] != (0,0))1464 M[col], M[piv] = M[piv], M[col]1465 pi = inv(M[col][col])1466 M[col] = [mul(pi, v) for v in M[col]]1467 for r in range(n):1468 if r != col and M[r][col] != (0,0):1469 f = M[r][col]1470 M[r] = [sub(v, mul(f, w_)) for v, w_ in zip(M[r], M[col])]1471 return [row[n:] for row in M]14721473 def cayley_of(H, a):1474 aH = [[mul(a, x) for x in row] for row in H]1475 Im = [[sub((1,0) if r==c else (0,0), aH[r][c]) for c in range(n)] for r in range(n)]1476 Ip = [[add((1,0) if r==c else (0,0), aH[r][c]) for c in range(n)] for r in range(n)]1477 return big_mmul(big_inv(Im), Ip)14781479 def big_ord(U, cap):1480 I = eye(n); V = U; o = 11481 while V != I:1482 V = big_mmul(V, U); o += 11483 if o > cap: return None1484 return o14851486 H0 = build_D(0)1487 # 8:D10 (p08030)1488 chk("X5 D^s X-self-adjoint", form_adjoint(H0) == H0)1489 U0 = cayley_of(H0, (0,1))1490 chk("X5 U X-unitary", big_mmul(form_adjoint(U0), U0) == eye(n))1491 o0 = big_ord(U0, p*p + 1)1492 chk("X5 massless U unipotent, ord(U) = p^2", o0 == p * p)1493 print(f"X5 datum: massless 1+1 Dirac-Cayley ord(U) = {o0} (p = {p})")14941495 def n1_ord(u):1496 v, o = u, 11497 while v != (1,0):1498 v = mul(v, u); o += 11499 return o1500 for m in (1, 2):1501 Hm = build_D(m)1502 chk(f"X6 m={m} X-self-adjoint", form_adjoint(Hm) == Hm)1503 Um = cayley_of(Hm, (0,1))1504 lam = ((-m) % p, 0)1505 a = (0,1)1506 num = add((1,0), mul(a, lam)); den = sub((1,0), mul(a, lam))1507 phi = mul(num, inv(den))1508 om = big_ord(Um, p*p*(p+1) + 1)1509 q = n1_ord(phi)1510 chk(f"X6 m={m} ord = lcm(p-power, ord phi(-m))",1511 om is not None and om % q == 0 and (om // q) in (1, p, p*p) and om % p == 0)1512 print(f"X6 datum: m={m}: ord(U) = {om} (norm-one phase order {q})")15131514 # X7: sector unification on H(Phi_p), p = 131515 p, g = 13, 21516 nu = g1517 add, sub, mul, conj, inv = field(p, nu)1518 n1 = p - 11519 pts = [pow(g, j, p) for j in range(n1)]1520 pos = {x: j for j, x in enumerate(pts)}1521 Dm = [[(1,0) if pts[b] == (pow(g, p-2, p) * pts[a]) % p else (0,0) for b in range(n1)] for a in range(n1)]1522 Dinv = [[(1,0) if pts[b] == (g * pts[a]) % p else (0,0) for b in range(n1)] for a in range(n1)]1523 def small_mmul(A,B):1524 m_ = len(A); C = [[(0,0)]*m_ for _ in range(m_)]1525 for a in range(m_):1526 for b in range(m_):1527 x = A[a][b]1528 if x == (0,0): continue1529 for c in range(m_):1530 if B[b][c] != (0,0): C[a][c] = add(C[a][c], mul(x, B[b][c]))1531 return C1532 Lap = [[sub(add(Dm[a][b], Dinv[a][b]), ((2,0) if a==b else (0,0))) for b in range(n1)] for a in range(n1)]1533 chk("X7 Delta_Phi self-adjoint", [[conj(Lap[b][a]) for b in range(n1)] for a in range(n1)] == Lap)1534 # Cayley of Delta_Phi commutes with D1535 def small_inv(A):1536 m_ = len(A)1537 M = [row[:] + [((1,0) if r==j else (0,0)) for j in range(m_)] for r, row in enumerate(A)]1538 for col in range(m_):1539 piv = next(r for r in range(col, m_) if M[r][col] != (0,0))1540 M[col], M[piv] = M[piv], M[col]1541 pi = inv(M[col][col])1542 M[col] = [mul(pi, v) for v in M[col]]1543 for r in range(m_):1544 if r != col and M[r][col] != (0,0):1545 f = M[r][col]1546 M[r] = [sub(v, mul(f, w_)) for v, w_ in zip(M[r], M[col])]1547 return [row[m_:] for row in M]1548 a = (0,1)1549 aH = [[mul(a, x) for x in row] for row in Lap]1550 Im = [[sub((1,0) if r==c else (0,0), aH[r][c]) for c in range(n1)] for r in range(n1)]1551 Ip = [[add((1,0) if r==c else (0,0), aH[r][c]) for c in range(n1)] for r in range(n1)]1552 Uc = small_mmul(small_inv(Im), Ip)1553 chk("X7 [U, D] = 0 (exact composite)", small_mmul(Uc, Dm) == small_mmul(Dm, Uc))1554 chk("X7 U unitary", small_mmul([[conj(Uc[b][a_]) for b in range(n1)] for a_ in range(n1)], Uc) == eye(n1))15551556 # X8: spin lift vs the spinor form (round-02): S(x,y)# = S(x,-y) = delta S^-1;1557 # T scales the X-form by delta = N(z); norm-one lifts preserve it exactly;1558 # the odd (nonsquare-norm) coset scales it by the nonsquare class.1559 p, g = 5, 21560 nu = g1561 g0,g1,g2,g3,i = gammas(p, nu, g)1562 add, sub, mul, conj, inv = field(p, nu)1563 X4m = mmul(mmul(g0,g1,p,nu), g3, p, nu)1564 sX = mmul(X4m, X4m, p, nu)[0][0]; siX = inv(sX)1565 Xi4 = [[mul(siX, x) for x in row] for row in X4m]1566 M4 = mmul(g0, g1, p, nu)1567 def S_of(x, y):1568 out = [[(0,0)]*4 for _ in range(4)]1569 for a in range(4):1570 for b in range(4):1571 out[a][b] = add((x,0) if a==b else (0,0), mul((y,0), M4[a][b]))1572 return out1573 def sharp(A): # X-adjoint at gamma level1574 return mmul(mmul(Xi4, dagger(A,p,nu), p, nu), X4m, p, nu)1575 for (x, y) in ((1,1),(2,1),(3,2)):1576 d = (x*x - nu*y*y) % p1577 if d == 0: continue1578 S = S_of(x, y)1579 # 8:D11 (p08031)1580 chk(f"X8 S({x},{y})# = S(x,-y)", sharp(S) == S_of(x, (-y) % p))1581 SS = mmul(sharp(S), S, p, nu)1582 chk(f"X8 S#S = delta I ({x},{y})", SS == [[(d,0) if a==b else (0,0) for b in range(4)] for a in range(4)])1583 chk("X8 norm-one lift preserves form", (3*3 - nu*2*2) % p == 1)1584 chk("X8 odd-class boost exists", pow((2*2 - nu*1*1) % p, (p-1)//2, p) == p-1)1585 # X9: static massive Dirac kernel is trivial: D^s - m invertible for m != 01586 # (D^s nilpotent => -m(I - m^{-1}D^s) invertible); dispersion on the cycle:1587 # -Delta_Phi acts on chi_k with eigenvalue 2 - g^k - g^{-k} (F_13, all k).1588 p13, g13 = 13, 21589 n1 = p13 - 11590 for k in range(n1):1591 lam = (2 - pow(g13, k, p13) - pow(g13, (n1 - k) % n1, p13)) % p131592 ok = True1593 for j in range(n1):1594 lhs = (2*pow(g13,(j*k)%n1,p13) - pow(g13,((j+1)*k)%n1,p13) - pow(g13,((j-1)*k)%n1,p13)) % p131595 ok &= lhs == (lam * pow(g13,(j*k)%n1,p13)) % p131596 chk(f"X9 dispersion k={k}", ok)1597 flush("o8")15981599# ------------------------------------------------------------------------------------------------------------1600# block lat — the latitude indices of the shell reading (latitude_checks)1601#1602# Latitude-index checks: time = L_1, energy = L_{S+1} (EXACT).1603#1604# Addendum to reports/o134-findings.md (shell-reading programme). Latitude1605# formalism per 2-geometry Def. 3.1: orbital shell S_p on the frame1606# F_p(t;0,1,g); meridian M_m the additive ray 0, g^m, 2g^m, ..., pi*g^m;1607# latitude L_a the multiplicative orbit at radius a; ladder a = 1..pi with1608# pi = 2*kappa the terminal latitude (collapsed to the antipode).1609#1610# Claims checked (Subject register on F_13, F_17; Carrier register on the1611# lab Carrier Om = 2,408,561, S = 602,140):1612# L1 Ladder bounds: energy index S+1 (kappa+1) lies inside the ladder,1613# and is the first rung past the midpoint (rungs S | S+1 straddle1614# the equator; ladder length 2S is even, no middle rung).1615# L2 One shift, two ladders: the meridian shift m -> m+kappa is1616# multiplication by g^kappa = +-i (prime meridian -> quarter-turn1617# meridian: space -> momentum); the latitude shift a -> a+kappa1618# sends 1 -> kappa+1 (time -> energy). Both dualities are the1619# index advance by the capacity.1620# L3 Framed-rational radius register: kappa = -4^{-1}, so the energy1621# radius is 1 + kappa = 3*4^{-1} = 1 - 1/4: the quarter-cycle shift1622# subtracts exactly one quarter of the unit radius.1623# L4 Terminal latitude: pi = 2*kappa = -2^{-1} = -c^2 as a residue; on1624# the Carrier pi_Om = 2S = G (B18): the ladder terminates at the1625# half-period -- the antipode of the observer origin carries the1626# G / -c^2.1627# L5 Chart consistency: the framed-complex chart reads latitudes as1628# norm circles; the unit-norm circle has exactly p-1 points, the1629# cardinality of the phase cycle L_1 (time); the energy circle1630# carries norm (1 - 1/4)^2 = 9/16.1631def block_lat():1632 """Block lat — the latitude indices of the shell reading (EXACT): lat.L1–L5."""1633 begin("lat")16341635 def inv(a, p): return pow(a % p, p - 2, p)16361637 CASES = [(13, 2), (17, 3), (2408561, 6)] # (p, g); Carrier last16381639 for p, g in CASES:1640 kap = (p - 1) // 41641 pi = 2 * kap1642 # L1: ladder bounds and midpoint straddle1643 # 8:F2 (p08039)1644 chk(f"L1 p={p} in-ladder", 1 <= kap + 1 <= pi)1645 chk(f"L1 p={p} past-half", kap + 1 == pi // 2 + 1 and pi % 2 == 0)1646 # L2: meridian shift by kappa is the quarter-turn1647 gk = pow(g, kap, p)1648 chk(f"L2 p={p} g^kappa = +-i", pow(gk, 2, p) == p - 1)1649 ray = [a % p for a in range(1, pi + 1)] # prime meridian labels1650 chk(f"L2 p={p} ray*i = quarter-turn ray",1651 [(a * gk) % p for a in ray] == [(a * gk) % p for a in range(1, pi + 1)]1652 and (1 * gk) % p == gk) # unit -> quarter-turn1653 chk(f"L2 p={p} latitude shift 1 -> kappa+1", 1 + kap == kap + 1)1654 # L3: radius register1655 chk(f"L3 p={p} kappa = -1/4", kap % p == (p - inv(4, p)) % p)1656 chk(f"L3 p={p} energy radius = 3/4 = 1 - 1/4",1657 (kap + 1) % p == 3 * inv(4, p) % p == (1 - inv(4, p)) % p)1658 # L4: terminal latitude residue identities1659 inv2 = inv(2, p)1660 chk(f"L4 p={p} pi = -2^-1", pi % p == (p - inv2) % p)1661 chk(f"L4 p={p} pi = -c^2", (p - pi) % p == inv2) # -pi = 2^-1 = c^21662 # L5: unit-norm circle count = p-1 = |phase cycle| (p = 1 mod 4)1663 if p < 100:1664 cnt = sum(1 for a in range(p) for b in range(p)1665 if (a * a + b * b) % p == 1)1666 chk(f"L5 p={p} |norm-1 circle| = p-1", cnt == p - 1)1667 chk(f"L5 p={p} energy norm = 9/16",1668 pow(kap + 1, 2, p) == 9 * inv(16, p) % p)16691670 # Carrier-register readings (B18 web)1671 Om, S = 2408561, 6021401672 chk("L4 Carrier 2S = G", (2 * S) % Om == 1204280) # G = 2S1673 chk("L4 Carrier -2S = c^2", (Om - 2 * S) % Om == (Om + 1) // 2) # -pi = c^21674 chk("L3 Carrier S+1 = 3/4", (S + 1) % Om == 3 * inv(4, Om) % Om)1675 flush("lat")16761677# ------------------------------------------------------------------------------------------------------------1678# block o9 — signature as a square-class dichotomy (o9_signature_counts)1679#1680# O9 exact checks: signature is a square-class dichotomy on F_p (EXACT).1681#1682# Remark rem:signature-record (Section 2); ledger row 8:B7. All arithmetic exact; no floats.1683#1684# Claims checked, on every symmetry-complete shell p = 4k+1 < 60:1685# S1 The Euclidean form t^2+x^2+y^2+z^2 has p^3+p^2-p zeros in F_p^41686# (square discriminant: hyperbolic, Witt index 2).1687# S2 The form -nu t^2+x^2+y^2+z^2 with nu the canonical nonsquare g has1688# p^3-p^2+p zeros (nonsquare discriminant: elliptic, Witt index 1).1689# S3 At p = 13 the counts are 2353 and 2041.1690# S4 Over F_{p^2} every element of F_p is a square: nu = w^2 for some1691# w in F_{p^2}, so the extension erases the dichotomy.1692def is_prime(n):1693 if n < 2: return False1694 i = 21695 while i * i <= n:1696 if n % i == 0: return False1697 i += 11698 return True16991700def primitive_root(p):1701 order = p - 11702 fac = []; m = order; d = 21703 while d * d <= m:1704 if m % d == 0:1705 fac.append(d)1706 while m % d == 0: m //= d1707 d += 11708 if m > 1: fac.append(m)1709 for g in range(2, p):1710 if all(pow(g, order // q, p) != 1 for q in fac): return g1711 raise RuntimeError17121713def zero_count(p, a_t):1714 # number of (t,x,y,z) with a_t*t^2 + x^2 + y^2 + z^2 = 0 in F_p1715 sq = [0] * p1716 for v in range(p): sq[v * v % p] += 11717 # distribution of x^2+y^2+z^21718 conv2 = [0] * p1719 for u in range(p):1720 for v in range(p):1721 conv2[(u + v) % p] += sq[u] * sq[v]1722 conv3 = [0] * p1723 for u in range(p):1724 for v in range(p):1725 conv3[(u + v) % p] += conv2[u] * sq[v]1726 total = 01727 for t in range(p):1728 need = (-a_t * t * t) % p1729 total += conv3[need]1730 return total17311732def block_o9():1733 """Block o9 — signature as a square-class dichotomy (EXACT): o9.S1–S4."""1734 ok1 = ok2 = ok4 = True; c13 = None1735 for p in range(5, 60):1736 if not is_prime(p) or p % 4 != 1: continue1737 g = primitive_root(p)1738 e = zero_count(p, 1)1739 q = zero_count(p, (-g) % p) # the form -g t^2 + x^2 + y^2 + z^21740 ok1 &= e == p**3 + p**2 - p1741 ok2 &= q == p**3 - p**2 + p1742 ok4 &= (p * p - 1) // 2 % (p - 1) == 0 # F_p^x has order p-1 | (p^2-1)/2: every a in F_p^x is a square in F_{p^2}1743 if p == 13: c13 = (e, q)1744 # 8:B7 (p08013)1745 check("o9.S1", ok1, "p = 5 … 53, p ≡ 1 (mod 4)")1746 check("o9.S2", ok2, "ν = g the smallest primitive root")1747 check("o9.S3", c13 == (2353, 2041), f"p = 13: {c13}")1748 check("o9.S4", ok4, "(p² − 1)/2 ≡ 0 (mod p − 1)")17491750if __name__ == "__main__":1751 import time1752 want = [a.lower() for a in sys.argv[1:]] or list(BLOCK)1753 bad = [b for b in want if b not in BLOCK]1754 if bad: sys.exit(f"no block {', '.join(bad)}: the blocks are {', '.join(BLOCK)}")1755 t0 = time.time()1756 for b in want:1757 t = time.time(); print(f"— block {b}"); _run_block(b); print(f" [block {b}: {time.time() - t:.1f} s]")1758 ok = summary(write=(want == list(BLOCK)))1759 print(f"{len(RESULTS)} family checks, {len(MICRO)} exact micro-checks, {time.time() - t0:.0f} s" + ("; results.json written" if want == list(BLOCK) else ""))1760 sys.exit(0 if ok else 1)1761