p27_fields.py — frc/ledgers

The ledger file frc/ledgers/p27_fields.py of Standard-Model Interactions over Finite Substrate, rendered with an anchor per line: the marked lines (# 27:C2 (p27010): a predicate and its accession key) are the checks that decide the predicates of the paper's predicate ledger — 58 of 58 checks passing; the predicates' theorems are the declarations of Fields in the core. ▶ run the predicates on Google Colab.

27-fields ledgerfrc/ledgers/p27_fields.py · 75.6 KBp27_fields.pyColab
1"""p27_fields — the ledger file of 27-fields (ledger migration, task LM35, 7 October 2026; the 27-fields migration,216 October 2026).34"Standard-Model Interactions over Finite Substrate" (Akhtman and Voether, preprint 2026; doi 10.20944/preprints202606.1328.v1).5The paper's predicate ledger is docs/27-fields/27-fields-ledger.json. This file binds its python-witnessed predicates to6the framework: the table of keys (generated from the ledger by ci/make_ledgers.py) and the checks of eight blocks. The7exact checks call the interactions theme (frc/interactions.py) and, for the closed role ladder, the horizon theme8(frc/ladder.py); the continuum readings call the chart theme (frc/chart.py, frc/chart_fields.py) and compare its9readings with rational bounds. Each check names the predicate(s) it witnesses (LEDGER) and carries a `# 27:XN (<key>)`10marker when it decides one (PREDICATES).1112The checks are EXACT or CHART, one kind per check. An EXACT check decides by integer, finite-field, rational or13cyclotomic arithmetic; no float decides anything. A CHART check is a continuum reading: floats, transcendental14functions, measured data, dimensional estimates; its label carries "[chart]". The paper's own classes were EXACT, MIXED15and APPROX, one per package record (src/27-fields, twenty-eight scripts run by fldcommon.py); the checks of 7 October16carried their record's class. On 16 October 2026 (the 27-fields migration) MIXED and APPROX split: each mixed check whose17two halves both carry content became an exact check under the old label and a chart check under the label with the18suffix c (B1/B1c, B4/B4c, C8/C8c, E5/E5c, F6/F6c); a check whose float clause only illustrated an exact clause was19retagged EXACT; a check that is wholly a continuum reading was retagged CHART; and the APPROX checks of the finite gauge20correspondence B1, B2 and B4 became EXACT (the roots of unity in Q(ζ_M), the 24 quaternions of 2T over Q, the area law's21rational function positive beyond x = 1), the rest CHART. FAMILY names the package record (fld.<script>) each check22reproduces. The package stays the paper's published witness until its release pins the framework (tasks LM33, LM36).23The Lean side (16 October 2026): the theorems of the interactions theme (Theme/Interactions.lean, Theme/Unitary.lean) and its24kernel-decided certificates (Theme/Fields.lean), the paper module FrcCore/Fields.lean, and the chart readings on Mathlib25(FrcLedger/Theme/Fields.lean); the keys in Keys/Interactions.lean, the certificates Ledgers/P27Fields.lean.2627The anchor Ω = 4S + 1 at the scale import (ln Ω = 283.5) enters one check, B3, and is read from frc.chart (LN_OMEGA, the28bracket of ln 10); no numeral above Ω is formed. The "Ω ≡ 5 (mod 12)" of E8 and F7 is the paper's residue clause on the29shells, decided in the integers.3031    python3 -m frc.ledgers.p27_fields         every block, the census; exit 1 if a check fails (≈ 6 s)32    python3 -m frc.ledgers.p27_fields C       one block (A to H)33    from frc.ledgers.p27_fields import R; R.predicate("27:C5")    one predicate: its blocks run once per session3435Blocks:  A  electromagnetism: the finite U(1), Maxwell's uniqueness, the bare coupling     (27:C2, C3, X1, X2, X3)36         B  the finite gauge correspondence                                              (27:C1, C7, C12)37         C  the weak sector: the SU(2) connection, the breaking, the spectrum, V − A       (27:C4–C6, C10, X1, X3–X6)38         D  the electroweak scale against the transmutation forms                        (27:Y1, Z1)39         E  the strong sector: SU(3) over F_4 and F_25, the string tension, the β-function  (27:C7, C8, X1, X7, Z1)40         F  matter: one generation, unification, the generations, the residue mod 12      (27:C6, C8–C11, X8, X9, P1, P2, P4, P6, P7)41         G  the running couplings and the mass mechanism                                 (27:C6, P3, P5, Z1)42         H  flavour: the Koide form and the strong-CP angle                              (27:X10, X11, P8, P9)4344Checks: 58, of them 38 EXACT and 20 CHART (A3, A4, A11, A12, B1c, B3, B4c, B5, C8c, D1, D2, E2, E5c, E7, F3, F6c, G2,45G3, G4, H2). The notebook frc/ledgers/p27_fields.ipynb runs one predicate per cell, the cell's id its key (gate G13).46"""47import random48import sys49from collections import Counter50from fractions import Fraction as Q51from itertools import product52from math import comb, gcd, isqrt5354from frc.registry import Registry55from frc import arith56from frc import interactions as I57from frc import ladder as LD58from frc import chart as CH59from frc import chart_fields as CF6061# ---- generated by ci/make_ledgers.py from docs/27-fields/27-fields-ledger.json; edit the ledger, not this table ----62PAPER = "27-fields"63KEYS = {"A1": "p27001", "A2": "p27002", "A3": "p27003", "A4": "p27004", "A5": "p27005", "A6": "p27006", "B1": "p27007", "B2": "p27008", "B3": "p27009", "B4": "p27010", "B5": "p27011", "B6": "p27012", "C1": "p27013", "C2": "p27014", "C3": "p27015", "C4": "p27016", "C5": "p27017", "C6": "p27018", "C7": "p27019", "C8": "p27020", "C9": "p27021", "C10": "p27022", "C11": "p27023", "C12": "p27049", "X1": "p27024", "X2": "p27025", "X3": "p27026", "X4": "p27027", "X5": "p27028", "X6": "p27029", "X7": "p27030", "X8": "p27031", "X9": "p27032", "X10": "p27033", "X11": "p27034", "P1": "p27035", "P2": "p27036", "P3": "p27037", "P4": "p27038", "P5": "p27039", "P6": "p27040", "P7": "p27041", "P8": "p27042", "P9": "p27043", "Z1": "p27047", "Y1": "p27048"}       # every row of the ledger: its label and its accession key64LEAN = {"C1": "core, ml", "C2": "core", "C3": "core", "C4": "core", "C5": "core", "C6": "core, ml", "C7": "core, ml", "C8": "core", "C9": "core", "C10": "core", "C11": "core", "X1": "core", "X2": "core", "X3": "core", "X4": "core", "X5": "core", "X6": "core", "X7": "core, ml", "X8": "core", "X9": "core", "X10": "core", "X11": "core", "P1": "core", "P2": "core", "P3": "core, ml", "P4": "core, ml", "P5": "core, ml", "P6": "core", "P7": "core", "P8": "core", "P9": "core"}       # the rows with a Lean declaration: the libraries whose key files prove them65# ---- end of the generated table ----6667LEAN_ONLY = ()                  # the predicates with a Lean declaration and no python check (gate G12): none6869# The paper's predicate ledger (predicates cited as 27:XN): the predicate(s) each check witnesses. The union over a70# family's checks contains the package's row list for that family (fldcommon.LEDGER); since 16 October 2026 the checks71# also witness the rows the package did not (27:X1, P2, P6, P7, C12), and the correspondence's chart checks B3, B5 witness72# the window row 27:C12 in place of 27:C1.73LEDGER = {74    "A1": "27:C2", "A2": "27:X2, 27:C2", "A3": "27:C3, 27:C2", "A4": "27:C2, 27:C3", "A5": "27:C2, 27:X3, 27:X1", "A6": "27:X3, 27:C2",75    "A7": "27:C2, 27:C3", "A8": "27:C3", "A9": "27:C2", "A10": "27:C2", "A11": "27:C2", "A12": "27:C2",76    "B1": "27:C1", "B1c": "27:C1", "B2": "27:C1", "B3": "27:C12", "B4": "27:C7, 27:C1", "B4c": "27:C7, 27:C1", "B5": "27:C12",77    "C1": "27:C4", "C2": "27:C4, 27:X1", "C3": "27:C5, 27:X5", "C4": "27:C6, 27:X4", "C5": "27:C5, 27:X5, 27:X3", "C6": "27:C5, 27:X5",78    "C7": "27:C4, 27:X6", "C8": "27:C6", "C8c": "27:C6", "C9": "27:X6, 27:C4", "C10": "27:C10",79    "D1": "27:Z1", "D2": "27:Y1",80    "E1": "27:C7", "E2": "27:X7", "E3": "27:C7", "E4": "27:X7, 27:C7", "E5": "27:X7, 27:C7", "E5c": "27:X7, 27:C7", "E6": "27:X7",81    "E7": "27:Z1", "E8": "27:C7, 27:C8, 27:X1",82    "F1": "27:C8, 27:X8, 27:C6, 27:P2, 27:P6, 27:P7", "F2": "27:C9, 27:X8", "F3": "27:P4", "F4": "27:C9, 27:X8", "F5": "27:C10",83    "F6": "27:C10, 27:X9, 27:P1, 27:P2, 27:P6, 27:P7", "F6c": "27:C10, 27:X9, 27:P1", "F7": "27:C11", "F8": "27:C9, 27:X8",84    "G1": "27:C6", "G2": "27:P3", "G3": "27:P5", "G4": "27:Z1",85    "H1": "27:X10, 27:P8", "H2": "27:P8", "H3": "27:X11, 27:P9", "H4": "27:X11, 27:P9",86}8788# the package record (fld.<script>) each check reproduces (a chart check with the suffix c reproduces its parent's record)89FAMILY = {90    "A1": "em1_prototype", "A2": "em1_prototype", "A3": "em1_prototype", "A4": "em1_prototype",91    "A5": "enumerate_maxwell", "A6": "enumerate_maxwell", "A7": "audit_finitism", "A8": "audit_finitism",92    "A9": "audit_finitism", "A10": "audit_finitism", "A11": "o2_numbers", "A12": "p2",93    "B1": "correspondence", "B1c": "correspondence", "B2": "correspondence", "B3": "correspondence", "B4": "correspondence",94    "B4c": "correspondence", "B5": "correspondence",95    "C1": "p3", "C2": "ew1", "C3": "ew1", "C4": "ew1", "C5": "weak_spectrum", "C6": "weak_spectrum",96    "C7": "weak_current", "C8": "weak_current", "C8c": "weak_current", "C9": "p4", "C10": "p10",97    "D1": "v_scale", "D2": "v_scale",98    "E1": "qcd", "E2": "qcd", "E3": "p5", "E4": "string_tension", "E5": "string_tension", "E5c": "string_tension", "E6": "p6",99    "E7": "p6", "E8": "missing_rank",100    "F1": "generation", "F2": "p8", "F3": "p8", "F4": "p8b", "F5": "p9", "F6": "p9b", "F6c": "p9b", "F7": "p11", "F8": "p8b",101    "G1": "p1", "G2": "p1", "G3": "p7", "G4": "p7",102    "H1": "koide", "H2": "koide", "H3": "strongcp", "H4": "strongcp",103}104105BLOCK = {"A": "electromagnetism: the finite U(1), Maxwell's uniqueness, the bare coupling",106         "B": "the finite gauge correspondence",107         "C": "the weak sector: the SU(2) connection, the breaking, the spectrum, the V − A current",108         "D": "the electroweak scale against the transmutation forms",109         "E": "the strong sector: SU(3) over F_4 and F_25, the string tension, the β-function",110         "F": "matter: one generation, unification, the generations, the residue mod 12",111         "G": "the running couplings and the mass mechanism",112         "H": "flavour: the Koide form and the strong-CP angle"}113114# the deciding check of each witnessed predicate (the other checks that touch it are corroboration)115PREDICATES = {116    "27:C1": "B2", "27:C2": "A5", "27:C3": "A3", "27:C4": "C2", "27:C5": "C5", "27:C6": "C4", "27:C7": "E8", "27:C8": "F1",117    "27:C9": "F4", "27:C10": "F6", "27:C11": "F7", "27:C12": "B3",118    "27:X1": "A5", "27:X2": "A2", "27:X3": "A6", "27:X4": "C4", "27:X5": "C5", "27:X6": "C9", "27:X7": "E4", "27:X8": "F1",119    "27:X9": "F6", "27:X10": "H1", "27:X11": "H3",120    "27:P1": "F6", "27:P2": "F6", "27:P3": "G2", "27:P4": "F3", "27:P5": "G3", "27:P6": "F6", "27:P7": "F6", "27:P8": "H2",121    "27:P9": "H3",122    "27:Y1": "D2", "27:Z1": "D1",123}124125R = Registry("27", "fields", LEDGER, PREDICATES, sources=[__file__])126127PI = CH.pi_bracket()                                  # π between two rationals (Machin; the chart theme)128129130def _within(x, centre, tol):131    """|x − centre| < tol, x a float of the chart converted exactly."""132    return abs(Q(x) - centre) < tol133134135def _pi_scaled_within(value_over_pi, centre, tol):136    """|v/π − centre| < tol for both ends of the bracket of π (v > 0)."""137    return all(abs(value_over_pi / p - centre) < tol for p in PI)138139140# ------------------------------------------------------------------------------------------------------------141# block A: electromagnetism (27:C2, C3, X1, X2, X3)142# The finite U(1) lives on the phase cycle Z/M (em1_prototype). Its plaquette flux, Wilson action, covariant difference143# and global phases are gauge invariant as integer identities. The holonomy of a loop is the enclosed flux (discrete144# Stokes). The lattice Green's function carries the Coulomb coefficient 1/4π on the chart, and the field-quadratic action145# makes like charges repel. The range-1 gauge- and cube-invariant quadratic actions form a space of dimension 2 on146# L = 4, 5, 6: one relevant operator, Maxwell's transverse projector, and one irrelevant one (enumerate_maxwell); that147# uniqueness is the gauging of the phase frame (27:X1). audit_finitism makes the same claims with no float, and o2_numbers148# and p2 read the bare coupling 1/4π on the chart.149@R.block("A", BLOCK["A"])150def block_A():151    """Block A — electromagnetism: A1–A12 (A3, A4, A11, A12 CHART)."""152    # A1 gauge invariance on Z/M for M = 12, 52, 156, 420 (the phase cycles of F_13, F_53, F_157, F_421), on 200 random153    #    configurations each (L = 4). The Wilson action is a function of the plaquette values, so their multiset decides it.154    rng = random.Random(20260615); L = 4; n = L ** 3; ok = True; det = []155    for M in (12, 52, 156, 420):156        okF = okS = okC = okG = True157        for _ in range(200):158            A = [[rng.randrange(M) for _ in range(n)] for _ in range(3)]159            lam = [rng.randrange(M) for _ in range(n)]; phi = [rng.randrange(M) for _ in range(n)]160            Ap = I.gauge_transform(A, lam, M, L)161            vals, valsp = [], []162            for i in range(3):163                for j in range(i + 1, 3):164                    F, Fp = I.plaquette(A, i, j, M, L), I.plaquette(Ap, i, j, M, L)165                    okF &= F == Fp; vals += F; valsp += Fp166            okS &= Counter(vals) == Counter(valsp)167            phip = [(a + b) % M for a, b in zip(phi, lam)]168            okC &= I.gauge_transform([[(-a) % M for a in row] for row in A], phi, M, L) == \169                I.gauge_transform([[(-a) % M for a in row] for row in Ap], phip, M, L)       # φ(x+e_i) − φ(x) − A_i(x)170            c = rng.randrange(M)171            okG &= I.gauge_transform(A, [c] * n, M, L) == A172        ok &= okF and okS and okC and okG173        det.append(f"M={M}: {okF} {okS} {okC} {okG}")174    R.check("A1", "plaquette flux, Wilson action, covariant difference and global superselection gauge-invariant over Z/M, "175            "M = 12, 52, 156, 420, on 200 random configurations each (L = 4)", ok, "; ".join(det))176177    # A2 discrete Stokes: the holonomy of a rectangle is the enclosed flux mod M, and adjacent rectangles add178    rng = random.Random(156); L = 8; ok_s = ok_a = True179    for M in (12, 156, 420):180        for _ in range(100):181            Ax = {(x, y): rng.randrange(M) for x in range(L) for y in range(L)}182            Ay = {(x, y): rng.randrange(M) for x in range(L) for y in range(L)}183            F = {(x, y): (Ax[(x, y)] + Ay[((x + 1) % L, y)] - Ax[(x, (y + 1) % L)] - Ay[(x, y)]) % M184                 for x in range(L) for y in range(L)}185            a, b = rng.randrange(2, L), rng.randrange(2, L)186            enclosed = sum(F[(x, y)] for x in range(a) for y in range(b)) % M187            ok_s &= I.holonomy(Ax, Ay, 0, 0, a, b, L, M) == enclosed188            a2 = rng.randrange(1, L - a + 1)189            ok_a &= (I.holonomy(Ax, Ay, 0, 0, a, b, L, M) + I.holonomy(Ax, Ay, a, 0, a2, b, L, M)) % M == \190                I.holonomy(Ax, Ay, 0, 0, a + a2, b, L, M)191    # 27:X2 (p27025)192    R.check("A2", "charge = winding: the holonomy of a loop is the enclosed flux mod M (discrete Stokes) and additive over "193            "adjacent loops, M = 12, 156, 420, 100 random fields each (L = 8)", ok_s and ok_a, f"Stokes {ok_s}, additive {ok_a}")194195    # A3 [chart] the Coulomb coefficient of the L = 128 periodic lattice Green's function (the chart theme's separable sums)196    C, target, resid, g0 = CF.coulomb_fit(128)197    ratio = Q(C) / Q(target)198    # 27:C3 (p27015)199    R.check("A3", "[chart] the lattice Green's function on L = 128 carries the Coulomb coefficient: C/(1/4π) within 2 %, the "200            "fit residual below 2 %", abs(ratio - 1) < Q(2, 100) and Q(resid) < Q(2, 100),201            f"C = {C:.5f}, 1/4π = {target:.5f}, ratio = {C / target:.4f}, rel. residual = {100 * resid:.2f} %, g(0) = {g0:.4f}",202            kind="CHART")203204    # A4 [chart] the sign: like charges repel under the field-quadratic action, gravity's linear coupling attracts (L = 48)205    seps, Uem, Ugr = CF.sign_dichotomy(48)206    em = all(Q(Uem[i]) > Q(Uem[i + 1]) > 0 for i in range(len(seps) - 1))207    gr = all(Q(Ugr[i]) < Q(Ugr[i + 1]) < 0 for i in range(len(seps) - 1))208    R.check("A4", "[chart] like charges repel (U_EM > 0, falling with r) and gravity attracts (U < 0, deepening as r → 0) at "209            "r = 6 … 20 on L = 48", em and gr, "U_EM×1e3 = " + ", ".join(f"{1000 * u:.3f}" for u in Uem), kind="CHART")210211    # A5 Maxwell's plaquette action is admissible (L = 5), and the admissible space has exact corank 2 on L = 4, 5, 6212    pars, rows5 = I.maxwell_constraints(5)213    cM = I.maxwell_form(5)214    ok = all(sum(r.get(a, 0) * cM[a] for a in r) == 0 for r in rows5) and any(cM)215    det = [f"{len(pars)} range-1 parameters"]216    adm = {}217    for L in (4, 5, 6):218        pars, rows = I.maxwell_constraints(L)219        rk = I.rank_mod(rows, len(pars), (1 << 61) - 1)220        basis = I.nullspace(rows, len(pars))221        adm[L] = basis222        ok &= len(pars) - rk == 2 == len(basis)223        det.append(f"L={L}: corank {len(pars) - rk} over F_(2^61-1), rational nullity {len(basis)}")224    # 27:C2 (p27014), 27:X1 (p27024)225    R.check("A5", "Maxwell's plaquette action is gauge- and hypercubic-invariant; the range-1 translation-, gauge- and "226            "hypercubic-invariant quadratic actions have exact corank 2 on L = 4, 5, 6: the gauging of the phase frame by the "227            "one recipe leaves no choice of operator", ok, "; ".join(det))228229    # A6 the split: the quadratic part of the cosine symbol has rank 1 on the admissible space, its image is the230    #    transverse projector |k|²δ − kk (exactly), the constant part vanishes, so the second operator is O(k⁴)231    P = I.transverse_projector(); ok = True; det = []232    flat = lambda S0, S2: [x for r in S0 for x in r] + [x for a in S2 for b in a for c in b for x in c]233    for L in (4, 5, 6):234        vecs = [flat(*I.symbol_taylor(I.kernel_of(v))) for v in adm[L]]235        rk = len(vecs[0]) - len(I.nullspace([{k: v[k] for k in range(len(v)) if v[k]} for v in vecs], len(vecs[0])))236        rel = next(v for v in vecs if any(v))237        S2 = rel[9:]; Pf = [x for a in P for b in a for c in b for x in c]238        lam = next(s / p for s, p in zip(S2, Pf) if p)239        proj = all(s == lam * p for s, p in zip(S2, Pf)) and lam != 0 and not any(rel[:9])240        ok &= rk == 1 and proj241        det.append(f"L={L}: {rk} relevant + {len(vecs) - rk} irrelevant, relevant = {lam} × transverse projector")242    # 27:X3 (p27026)243    R.check("A6", "the admissible space splits into one relevant O(k²) operator, exactly the transverse projector "244            "|k|²δ − kk, and one irrelevant O(k⁴) operator, on L = 4, 5, 6", ok, "; ".join(det))245246    # A7 F(dλ) = 0 on all 64 basis gauge fields of L = 4, hence for every λ by linearity. A constant gauge is inert.247    L = 4; worst = 0248    for s in range(L ** 3):249        lam = [int(x == s) for x in range(L ** 3)]250        A = I.gradient(lam, L)251        for i in range(3):252            for j in range(i + 1, 3):253                worst = max(worst, max(abs(v) for v in I.plaquette(A, i, j, None, L)))254    const = all(v == 0 for row in I.gradient([7] * L ** 3, L) for v in row)255    R.check("A7", "F(dλ) = 0 exactly on all 64 basis gauge fields (L = 4), and the gradient of a constant vanishes",256            worst == 0 and const, f"max |F| = {worst}")257258    # A8 the L = 4 Green's function in exact rationals (the quarter-turn DFT): two unit charges at separation 1259    axis = [I.green_exact(4, (k, 0, 0)) for k in range(4)]260    R.check("A8", "the L = 4 Coulomb Green's function is an exact rational: U(separation 1) = 257/7680, and "261            "G(0,0,0) > G(1,0,0) > G(2,0,0)", axis[1] == Q(257, 7680) and axis[0] > axis[1] > axis[2],262            "G(n,0,0) = " + ", ".join(str(g) for g in axis))263264    # A9 the admissible nullity by the integer Gram matrix of the constraints (the package's route), rank mod two primes265    pars, rows = I.maxwell_constraints(4); npar = len(pars)266    gram = [[0] * npar for _ in range(npar)]267    for r in rows:268        items = list(r.items())269        for a, x in items:270            for b, y in items: gram[a][b] += x * y271    grows = [{b: gram[a][b] for b in range(npar) if gram[a][b]} for a in range(npar)]272    rk = max(I.rank_mod(grows, npar, 2147483647), I.rank_mod(grows, npar, 2147483629))273    R.check("A9", "the O1 admissible nullity is 2 by the exact rank of the integer Gram matrix (123 range-1 parameters, L = 4)",274            npar - rk == 2 and npar == 123, f"parameters {npar}, rank {rk}, nullity {npar - rk}")275276    # A10 the Wilson action is cyclotomic: 1 − cos(2πF/M) = 1 − (ζ^F + ζ^−F)/2 lies in Q(ζ_M). Its values at (12, 1),277    #     (12, 3), (52, 13), (8, 1) are 1 − √3/2, 1, 1, 1 − √2/2, decided by the square of 2cos and by the sign of cos.278    def zc(M, F):279        v = [0] * M; v[F % M] += 1; v[(-F) % M] += 1280        return v281    def zsq(v, M):282        w = [0] * M283        for a, x in enumerate(v):284            for b, y in enumerate(v): w[(a + b) % M] += x * y285        return w286    def is_value(M, F, sq, sign):287        v = zsq(zc(M, F), M); v[0] -= sq288        quarter = Q(F, M) % 1289        positive = quarter < Q(1, 4) or quarter > Q(3, 4)290        return I.cyclo_zero(v, M) and (sign == 0 or positive == (sign > 0))291    ok = is_value(12, 1, 3, 1) and I.cyclo_zero(zc(12, 3), 12) and I.cyclo_zero(zc(52, 13), 52) and is_value(8, 1, 2, 1)292    R.check("A10", "1 − cos(2πF/M) is exact in Q(ζ_M): 2cos(2π/12) = √3, cos(2π·3/12) = cos(2π·13/52) = 0, 2cos(2π/8) = √2",293            ok, "(12,1): 1 − √3/2; (12,3): 1; (52,13): 1; (8,1): 1 − √2/2")294295    # A11 [chart] the bare coupling as phase-channel capacity: 1/α_bare = 4π, the hierarchy α/(m_p/m_P)² on the measured296    #     constants, the gap 4π → 137.04297    inv_bare, ratio_f, gap_f = CF.o2_numbers(); d = CF.DATA["o2_numbers"]298    hier = d["m_P"] ** 2 / (d["alpha0_inv"] * d["m_p"] ** 2)299    ok = _pi_scaled_within(Q(inv_bare), 4, Q(1, 10 ** 12)) and 10 ** 36 < hier < 2 * 10 ** 36 and abs(Q(ratio_f) / hier - 1) < Q(1, 10 ** 9)300    ok &= _pi_scaled_within(d["alpha0_inv"] / 4, Q(10905, 1000), Q(1, 100))301    R.check("A11", "[chart] 1/α_bare = 4π; the EM/gravity hierarchy α/(m_p/m_P)² on the measured m_p, m_P and α lies in "302            "[10³⁶, 2·10³⁶]; the gap 4π → 137.04 is a factor 10.9 (the open part)", ok,303            f"hierarchy = {ratio_f:.3e}, gap = {gap_f:.3f}", kind="CHART")304305    # A12 [chart] the order-one coefficient 1, and the saturation profile 4πr² sin E = q with its core and self-energy306    a20 = Q(CF.saturation_potential(20)) * 20307    rstar = Q(CF.saturation_core()); U = Q(CF.saturation_self_energy(CF.saturation_core()))308    ok = all(abs(a20 * 4 * p - 1) < Q(1, 100) for p in PI)                           # r·A₀(20) against 1/4π within 1 %309    ok &= all(abs(rstar ** 2 * 4 * p - 1) < Q(1, 10 ** 12) for p in PI)            # r* = (4π)^(−1/2)310    ok &= all(Q(1, 2) < U * 8 * p * rstar < 2 for p in PI) and U > 0             # U of the order q²/(8πr*)311    R.check("A12", "[chart] α_bare = e²/4π = 1/4π with coefficient 1 (e = 1, one phase quantum); the weak-field Coulomb "312            "coefficient r·A₀(r) of the saturation profile 4πr² sin E = q at r = 20 within 1 % of 1/4π; the core r* = (4π)^(−1/2); "313            "a finite self-energy of the order q²/(8πr*)", ok,314            f"r·A₀(20) = {CH.show(a20, '.5f')}, r* = {CH.show(rstar, '.5f')}, U(>r*) = {CH.show(U, '.4f')}", kind="CHART")315316317# ------------------------------------------------------------------------------------------------------------318# block B: the finite gauge correspondence (27:C1, C7, C12)319# correspondence.py has eight blocks. Z_M embeds in U(1) with a positive Wilson weight (A). SU(2, F_3) = 2T is a finite320# subgroup of SU(2, C) of order 24 = |SL(2, F_3)|, with S ≥ 0 (B) and S a class function (D). Near the identity321# S = (ε²/2n) Tr X² + O(ε⁴), the Yang–Mills term (C), and the window residue grows linearly in H (E). The area law σ > 0322# follows from positivity on 2T (F). The character lift is fixed on the shells (G). Finite quadrature converges on the323# near-identity ball (H). Since 16 October 2026 A, B, D and F are decided exactly (B1, B2, B4: Q(ζ_M), the quaternions324# over Q, Q[x]); C, E, G and H are the chart's resolvable-window reading (B3, B5, row 27:C12), with B1c and B4c the325# chart clauses of B1 and B4.326@R.block("B", BLOCK["B"])327def block_B():328    """Block B — the finite gauge correspondence: B1, B2, B4 EXACT; B1c, B3, B4c, B5 CHART."""329    # B1 (A) Z_M -> U(1), j -> ζ^j, exactly in Q(ζ_M) for M = 12, 52, 156, 420: a homomorphism (x^j x^k reduced modulo Φ_M330    #    is ζ^{(j+k) mod M}, since ζ^M = 1), injective (the M canonical forms are distinct), and the Wilson weight331    #    1 − Re ζ^k = |1 − ζ^k|²/2 as an identity of Z[ζ_M], positive off k ≡ 0332    ok = True; det = []333    for M in (12, 52, 156, 420):334        hom, inj = I.roots_embed(M); ident, pos = I.wilson_weight(M)335        ok &= hom and inj and ident and pos and len(I.roots_of_unity(M)) == M336        det.append(f"M={M}: homomorphism {hom}, injective {inj}, weight identity {ident}, positive off 0 {pos}")337    R.check("B1", "Z_M embeds in U(1) as the M-th roots of unity, exactly in Q(ζ_M): j ↦ ζ^j is a homomorphism and injective "338            "on Z/M for M = 12, 52, 156, 420 (the phase cycles of F_13, F_53, F_157, F_421); the Wilson weight "339            "1 − Re ζ^k = |1 − ζ^k|²/2 is an identity of Z[ζ_M], so it is ≥ 0, and it vanishes only at k ≡ 0", ok, "; ".join(det))340341    # B1c [chart] the window residue of the embedding, 2π/M, at M = 1000342    res = 2 * PI[1] / 1000343    R.check("B1c", "[chart] the window residue 2π/M of the embedding Z_M → U(1) at M = 1000 is below 10⁻²", res < Q(1, 100),344            f"2π/M < {CH.show(res, '.5f')}", kind="CHART")345346    # B2 (B, D) 2T is 24 unit quaternions with integer and half-integer coordinates, each an SU(2) matrix over the Gaussian347    #    rationals, closed under the quaternion product. |SL(2, F_3)| = 24. S(U) = 1 − ½ Re Tr U is nonnegative and a class348    #    function (all 24 × 24 pairs, exact).349    G, closed, unit, traces = I.tetrahedral_quaternions()350    su2 = all(I.su2_unitary(x) for x in G)351    sl23 = I.sl2_order(3)352    S = [1 - x[0] for x in G]                                                     # 1 − ½ Re Tr U, Tr U = 2a353    cls = I.trace_class_function(G)354    ok = len(G) == 24 == len(set(G)) and closed and unit and su2 and sl23 == 24355    ok &= traces == {2: 1, -2: 1, 0: 6, 1: 8, -1: 8} and min(S) >= 0 and cls356    # 27:C1 (p27013)357    R.check("B2", "SU(2, F_3) = 2T is a finite subgroup of SU(2, C), exactly over Q: 24 unit quaternions with integer and "358            "half-integer coordinates, closed under the quaternion product, each unitary with det 1 over the Gaussian rationals; "359            "|SL(2, F_3)| = 24; the trace multiset {2:1, −2:1, 0:6, 1:8, −1:8}; S(U) = 1 − ½ Re Tr U ≥ 0 on 2T and a class "360            "function", ok, f"|2T| = {len(G)}, |SL(2,F_3)| = {sl23}, closed {closed}, unit {unit}, min S = {min(S)}")361362    # B3 (C, E) [chart] low curvature, read in the chart: S/ε² → Tr X²/2n for SU(2) and SU(3) with an O(ε⁴) residue. The363    #    F_q directions are spaced 1/q. The window residue of H links grows linearly in H and is O(ε⁴) per link. The364    #    substrate term H/Ω of the window bound is read on the anchor: ln Ω = 283.5 > 122 ln 10, so H/Ω < 10⁻¹²⁰ at H = 100.365    x2, x3 = (Q(1, 2), Q(-1, 2)), (Q(1, 2), Q(-1, 2), Q(0))366    c2, c3 = sum(x * x for x in x2) / 4, sum(x * x for x in x3) / 6                 # Tr X²/(2n)367    eps = Q(1, 1000)368    ok = abs(Q(CF.s_fund_diag(x2, eps)) / eps ** 2 - c2) < Q(1, 10 ** 6)369    res = [(Q(CF.s_fund_diag(x2, e)) - c2 * e ** 2) / e ** 4 for e in (Q(1, 10), Q(1, 100), Q(1, 1000))]370    ok &= max(abs(r) for r in res) < 1371    ok &= abs(Q(CF.s_fund_diag(x3, eps)) / eps ** 2 - c3) < Q(1, 1000)372    ok &= all(Q(1, q) < Q(2, 100) for q in (53, 997))373    r10, n10 = CF.window_residue(10, seed=10); r100, n100 = CF.window_residue(100, seed=100)374    e5 = Q(5, 100)375    ok &= 8 < Q(r100) / Q(r10) < 12 and Q(r10) / 10 < 5 * e5 ** 4376    ok &= CH.LN_OMEGA > 122 * CH.log10_bracket()[1]                              # Ω > 10¹²², so 100/Ω < 10⁻¹²⁰377    # 27:C12 (p27049)378    R.check("B3", "[chart] the resolvable window: the compact Wilson action's expansion S(exp iεX) = (ε²/2n) Tr X² + O(ε⁴), the "379            "Yang–Mills coefficient 1/(2n), for SU(2) (c = 1/8) and SU(3) (c = 1/12), the finite action compared at q = 3 only "380            "(B2); the 1/q-net at q = 53, 997; the window residue grows linearly in H "381            "(r(100)/r(10) ≈ 10) and is O(ε⁴) per link; the substrate term H/Ω of the window bound at H = 100 is below 10⁻¹²⁰ "382            "on the anchor Ω = 4S + 1 at the scale import, ln Ω = 283.5", ok,383            f"r(10) = {r10:.2e}, r(100) = {r100:.2e}, ratio {r100 / r10:.2f}; ln Ω = {CH.show(CH.LN_OMEGA, '.1f')} > "384            f"122 ln 10 = {CH.show(122 * CH.log10_bracket()[1], '.1f')}", kind="CHART")385386    # B4 (F) the area law from positivity on 2T, exactly. Σχ = 0, and c₁(β) = N(x)/D(x) in x = e^{β/2}, with387    #    N = (x − 1)(x³ + 5x² + 5x + 1) and D − N = 4x³ + 6x² + 12x + 2. N, D and D − N are positive for every x > 1 by the388    #    Taylor shift to x = 1 + y, so 0 < c₁ < 1 and σ = −ln c₁ > 0 for every β > 0.389    Nn, Dd, positive = I.area_law_rational()390    exact = sum(t * m for t, m in traces.items()) == 0 and positive391    exact &= Nn == [Q(c) for c in (-1, -4, 0, 4, 1)] and Dd == [Q(c) for c in (1, 8, 6, 8, 1)]392    c1_at = I.area_law_rational(Q(3, 2))[3]                                       # one rational x > 1, exactly393    exact &= 0 < c1_at < 1394    R.check("B4", "confinement from positivity on 2T, exactly: Σχ = 0 over the trace multiset; c₁(β) = "395            "(x⁴ + 4x³ − 4x − 1)/(x⁴ + 8x³ + 6x² + 8x + 1), x = e^{β/2}, has numerator, denominator and their difference "396            "positive for every x > 1 (the Taylor shift to x = 1 + y), so 0 < c₁ < 1 and σ = −ln c₁ > 0 for every β > 0",397            exact, f"c₁(x = 3/2) = {c1_at}")398399    # B4c [chart] the same c₁ on the chart at β = 0.2, 0.5, 1.0: in (0, 1) and increasing in β400    vals = [Q(CF.c1_traces(traces, 2, b)) for b in (Q(2, 10), Q(5, 10), Q(1))]401    R.check("B4c", "[chart] c₁(β) of 2T on the chart at β = 0.2, 0.5, 1.0 lies in (0, 1) and increases with β, so σ = −ln c₁ "402            "is positive and falling", all(0 < c < 1 for c in vals) and vals[0] < vals[1] < vals[2],403            "c₁ = " + ", ".join(CH.show(c, ".3f") for c in vals), kind="CHART")404405    # B5 (G, H) [chart] the character lift. The fundamental coefficient I_ρ/d_ρ = 1/n is one rational on every admissible406    #    shell, so the finite-minus-compact difference vanishes at each (the package's last clause, recorded as it is).407    #    The midpoint residue of finite quadrature decreases as the grid refines, with N·err non-increasing.408    ok = True409    for n in (2, 3):410        shells = [q for q in (2, 3, 5, 7, 13) if gcd(n, q) == 1]411        ok &= all(n % q for q in shells) and len(shells) >= 4                      # the admissible shells: n invertible on each412    e = [Q(CF.quadrature_error(N)) for N in (50, 100, 200)]413    ok &= e[0] > e[1] > e[2] and 50 * e[0] >= 100 * e[1] >= 200 * e[2] - Q(1, 10 ** 12)414    R.check("B5", "[chart] the character lift on the resolvable window: the fundamental coefficient 1/n is fixed on the "415            "admissible shells for SU(2), SU(3), so the finite-minus-compact difference vanishes at each; the finite quadrature "416            "residue decreases with the grid, N·err non-increasing (N = 50, 100, 200)", ok,417            "errors " + ", ".join(CH.show(x, ".2e") for x in e), kind="CHART")418419420# ------------------------------------------------------------------------------------------------------------421# block C: the weak sector (27:C4, C5, C6, C10, X1, X3–X6)422# p3 builds SU(2, F_3) over K = F_9 with its Wilson invariance and the drive's centraliser. ew1 reads the breaking in423# F_13 as drive–torus misalignment (the gauging of the spinor frame, 27:X1), with the neutral mass matrix, ρ = 1 and the424# Weinberg angle from the charge spectrum. weak_spectrum takes the Hessian of S_ρ at the broken vacuum over Q and over425# F_13 and F_5. weak_current sums the V − A characters and derives G_F (C8), read against the measured G_F on the chart426# (C8c). p4 decouples the Frobenius branch. p10 reads chirality relative to the drive.427@R.block("C", BLOCK["C"])428def block_C():429    """Block C — the weak sector: C1–C10 EXACT, C8c CHART."""430    # C1 SU(2, 3) over F_9 = F_3[i] has order 24 and its Wilson trace is invariant exhaustively. The plaquette and the431    #    doublet transform covariantly. The drive diag(i, −i) has a proper centraliser, so SU(2) breaks to a U(1).432    K = I.Fq2(3, 0, 2)433    SU2 = [((a, b), (c, d)) for a, b, c, d in product(K.elements(), repeat=4)434           if I.mat_mul(K, I.dagger(K, ((a, b), (c, d))), ((a, b), (c, d))) == ((K.one, K.zero), (K.zero, K.one))435           and I.det(K, ((a, b), (c, d))) == K.one]436    mm = lambda X, Y: I.mat_mul(K, X, Y); inv = lambda X: I.dagger(K, X); tr = lambda X: I.trace(K, X)437    ok = len(SU2) == 24 == 3 * (9 - 1)438    ok &= any(mm(X, Y) != mm(Y, X) for X in SU2 for Y in SU2) and all(tr(X)[1] == 0 for X in SU2)439    ok &= all(tr(mm(mm(g, X), inv(g))) == tr(X) for g in SU2 for X in SU2)440    Uab, Ubc, Ucd, Uda = SU2[5], SU2[11], SU2[17], SU2[23]; ga, gb, gc, gd = SU2[3], SU2[8], SU2[14], SU2[20]441    P = mm(mm(Uab, Ubc), mm(Ucd, Uda))442    U2 = [mm(mm(ga, Uab), inv(gb)), mm(mm(gb, Ubc), inv(gc)), mm(mm(gc, Ucd), inv(gd)), mm(mm(gd, Uda), inv(ga))]443    P2 = mm(mm(U2[0], U2[1]), mm(U2[2], U2[3]))444    ok &= P2 == mm(mm(ga, P), inv(ga)) and tr(P2) == tr(P)445    psi_a, psi_b = (SU2[1][0][0], SU2[1][1][0]), (SU2[2][0][0], SU2[2][1][0])446    sub = lambda u, w: tuple(K.sub(x, y) for x, y in zip(u, w))447    D = sub(psi_a, I.matvec(K, Uab, psi_b)); D2 = sub(I.matvec(K, ga, psi_a), I.matvec(K, U2[0], I.matvec(K, gb, psi_b)))448    ok &= D2 == I.matvec(K, ga, D)449    t = (0, 1); drive = ((t, K.zero), (K.zero, K.conj(t)))450    cent = sum(1 for X in SU2 if mm(drive, X) == mm(X, drive))451    ok &= drive in SU2 and cent == 4452    R.check("C1", "SU(2, F_3) over F_9: order 24 = q(q² − 1), non-abelian, Tr ∈ F_3; Tr(gMg⁻¹) = Tr M exhaustively; the "453            "plaquette conjugates and the doublet is covariant; the drive diag(i, −i) has centraliser of order exactly 4", ok,454            f"|SU(2,3)| = {len(SU2)}, Tr P = {tr(P)}, centraliser {cent}")455456    # C2 the breaking in F_13. Ad_drive fixes H and scales E, F by g^{±2}. The drive's centraliser in SL₂(F_13) is the457    #    split torus of order p − 1, and the non-split torus does not commute with the drive.458    p, g = 13, 2459    mul = lambda X, Y: ((X[0] * Y[0] + X[1] * Y[2]) % p, (X[0] * Y[1] + X[1] * Y[3]) % p,460                        (X[2] * Y[0] + X[3] * Y[2]) % p, (X[2] * Y[1] + X[3] * Y[3]) % p)461    ti = pow(g, p - 2, p); drive, drive_i = (g, 0, 0, ti), (ti, 0, 0, g)462    eig = {}463    for name, Xb in (("H", (1, 0, 0, p - 1)), ("E", (0, 1, 0, 0)), ("F", (0, 0, 1, 0))):464        Y = mul(mul(drive, Xb), drive_i); c = next(i for i in range(4) if Xb[i])465        eig[name] = Y[c] * pow(Xb[c], p - 2, p) % p466        assert all(Y[i] == eig[name] * Xb[i] % p for i in range(4))467    cent = sum(1 for M in product(range(p), repeat=4) if (M[0] * M[3] - M[1] * M[2]) % p == 1 and mul(M, drive) == mul(drive, M))468    sq = {x * x % p for x in range(p)}; nu = next(x for x in range(2, p) if x not in sq)469    a, b = next((a, b) for a in range(p) for b in range(p) if (a * a - nu * b * b) % p == 1 and not (b == 0 and a == 1))470    ns = (a, nu * b % p, b, a)471    ok = eig["H"] == 1 and eig["E"] != 1 and eig["F"] != 1 and eig["E"] * eig["F"] % p == 1 and cent == p - 1 == 12472    ok &= mul(ns, drive) != mul(drive, ns)473    # 27:C4 (p27016)474    R.check("C2", "electroweak breaking as drive–torus misalignment in F_13: Ad_drive H = H (the unbroken U(1) direction), E, F scaled by "475            "g^{±2} ≠ 1 (gapped W±); the drive's centraliser in SL₂(F_13) is the split torus of order 12; the non-split torus "476            "does not commute: the gauging of the spinor frame", ok,477            f"eigenvalues H {eig['H']}, E {eig['E']}, F {eig['F']}; centraliser {cent}; ν = {nu}")478479    # C3 the neutral (W₃, B) mass matrix ¼v²[[g², −gg'], [−gg', g'²]] has determinant 0 (the photon) and trace M_Z²480    names = ("g", "gp", "v"); gg, gp, v = (I.Poly.var(names, x) for x in names)481    M2 = [[gg * gg * v * v * Q(1, 4), -gg * gp * v * v * Q(1, 4)], [-gg * gp * v * v * Q(1, 4), gp * gp * v * v * Q(1, 4)]]482    MW2, MZ2 = gg * gg * v * v * Q(1, 4), (gg * gg + gp * gp) * v * v * Q(1, 4)483    ok = (M2[0][0] * M2[1][1] - M2[0][1] * M2[1][0]).is_zero() and M2[0][0] + M2[1][1] == MZ2484    ok &= MW2 * (gg * gg + gp * gp) == MZ2 * gg * gg                              # ρ = M_W²/(M_Z² cos²θ_W) = 1485    R.check("C3", "the neutral (W₃, B) mass matrix has a zero eigenvalue (the photon) and the other M_Z² = (g² + g'²)v²/4; "486            "custodial ρ = 1 as a polynomial identity", ok, f"M_Z² = {MZ2}")487488    # C4 the Weinberg angle from the charge spectrum: Tr T₃²/Tr Q² = 1/2 for a lone lepton doublet, 3/8 for a generation489    def sin2(ferm):490        t3 = sum(Q(a) ** 2 * m for a, qq, m in ferm); q2 = sum(Q(qq) ** 2 * m for a, qq, m in ferm)491        return t3 / q2, t3, q2492    lep = [(Q(1, 2), 0, 1), (Q(-1, 2), -1, 1)]493    gen = [(Q(1, 2), 0, 1), (Q(-1, 2), -1, 1), (0, 1, 1), (Q(1, 2), Q(2, 3), 3), (Q(-1, 2), Q(-1, 3), 3), (0, Q(-2, 3), 3),494           (0, Q(1, 3), 3)]495    s_lep, s_gen, t3, q2 = sin2(lep)[0], *sin2(gen)496    # 27:C6 (p27018), 27:X4 (p27027)497    R.check("C4", "sin²θ_W = Tr T₃²/Tr Q²: 1/2 for a lone lepton doublet, 3/8 for a complete generation (Tr T₃² = 2, "498            "Tr Q² = 16/3)", s_lep == Q(1, 2) and t3 == 2 and q2 == Q(16, 3) and s_gen == Q(3, 8), f"{s_lep}, {s_gen}")499500    # C5 the Hessian of the gauged-Higgs action at the broken vacuum over Q: M²_ab = Re (X_a φ₀)†(X_b φ₀), with501    #    X = (gT₁, gT₂, gT₃, g'Y) and φ₀ = (0, v). The eigenvectors e₁, e₂ (M_W²), (0, 0, g', g) (0, the photon) and502    #    (0, 0, g, −g') (M_Z²) are independent, so the spectrum is {0, M_W² (×2), M_Z²}. At sin²θ_W = 3/8 the ratio503    #    M_W²/M_Z² is cos²θ_W = 5/8.504    names = ("i", "g", "gp", "v"); iu, gg, gp, v = (I.Poly.var(names, x) for x in names)505    h = Q(1, 2); z = I.Poly.const(names, 0)506    T = [[[z, h + z], [h + z, z]], [[z, -iu * h], [iu * h, z]], [[h + z, z], [z, -h + z]], [[h + z, z], [z, h + z]]]507    X = [[[gg * e for e in row] for row in T[0]], [[gg * e for e in row] for row in T[1]],508         [[gg * e for e in row] for row in T[2]], [[gp * e for e in row] for row in T[3]]]509    phi0 = [z, v]510    Xphi = [[Xa[r][0] * phi0[0] + Xa[r][1] * phi0[1] for r in range(2)] for Xa in X]511    M2 = [[(Xphi[a][0].conj() * Xphi[b][0] + Xphi[a][1].conj() * Xphi[b][1]).real() for b in range(4)] for a in range(4)]512    MW2, MZ2 = gg * gg * v * v * Q(1, 4), (gg * gg + gp * gp) * v * v * Q(1, 4)513    apply = lambda vec: [sum((M2[a][b] * vec[b] for b in range(4)), z) for a in range(4)]514    vecs = {"e1": ([1 + z, z, z, z], MW2), "e2": ([z, 1 + z, z, z], MW2), "photon": ([z, z, gp, gg], z),515            "Z": ([z, z, gg, -gp], MZ2)}516    ok = all(all((x - lamb * y).is_zero() for x, y in zip(apply(vec), vec)) for vec, lamb in vecs.values())517    ok &= not (gp * (-gp) - gg * gg).is_zero()                                      # the 4 eigenvectors' determinant −(g² + g'²) ≠ 0518    ok &= MW2 * (gg * gg + gp * gp) == MZ2 * gg * gg519    ok &= (M2[2][2] * M2[3][3] - M2[2][3] * M2[3][2]).is_zero()520    ok &= Q(1) / (1 + (Q(3, 8) / (1 - Q(3, 8)))) == Q(5, 8)                        # g'²/g² = 3/5 ⇒ cos²θ_W = 5/8521    # 27:C5 (p27017), 27:X5 (p27028)522    R.check("C5", "the propagating spectrum as the Hessian of S_ρ over Q: eigenvalues {0, g²v²/4 (×2), (g² + g'²)v²/4}, the "523            "photon the exact kernel ∝ (0, 0, g', g), ρ = 1, det(W₃, B) ≡ 0, M_W²/M_Z² = 5/8 at sin²θ_W = 3/8", ok,524            f"M²[W1,W2] = {M2[0][1]} (the real part)")525526    # C6 the same operator over F_13 and F_5 (i = √−1 in F_q), at (q, g, g', v) = (13, 1, 2, 2) and (5, 1, 1, 2)527    ok = True; det = []528    for q, g1, g2, vv in ((13, 1, 2, 2), (5, 1, 1, 2)):529        iq = next(x for x in range(q) if x * x % q == q - 1); h2 = pow(2, q - 2, q)530        def gens(i_):531            return [[[0, g1 * h2], [g1 * h2, 0]], [[0, -i_ * g1 * h2], [i_ * g1 * h2, 0]], [[g1 * h2, 0], [0, -g1 * h2]],532                    [[g2 * h2, 0], [0, g2 * h2]]]533        Xp = [[(A[0][1] * vv) % q, (A[1][1] * vv) % q] for A in gens(iq)]534        Xc = [[(A[0][1] * vv) % q, (A[1][1] * vv) % q] for A in gens(q - iq)]535        Mq = [[(Xc[a][0] * Xp[b][0] + Xc[a][1] * Xp[b][1]) % q for b in range(4)] for a in range(4)]536        kern = all(sum(Mq[a][b] * w for b, w in enumerate((0, 0, g2, g1))) % q == 0 for a in range(4))537        dWB = (Mq[2][2] * Mq[3][3] - Mq[2][3] * Mq[3][2]) % q538        ok &= kern and dWB == 0 and Mq[0][0] == Mq[1][1] and (g1 * g1 + g2 * g2) * vv * vv % q != 0539        ok &= (Mq[2][2] + Mq[3][3]) % q == (g1 * g1 + g2 * g2) * vv * vv * h2 * h2 % q          # the trace is M_Z² = (g² + g'²)v²/4540        det.append(f"F_{q}: kernel {kern}, det(W3,B) = {dWB}, M_W² = {Mq[0][0]}")541    R.check("C6", "over F_13 and F_5: (0, 0, g', g) is the exact photon kernel, det(W₃, B) ≡ 0 (ρ = 1), W₁, W₂ degenerate and "542            "M_Z² = (g² + g'²)v²/4 ≠ 0", ok, "; ".join(det))543544    # C7 the V − A current: Σ_τ ζ_N^0 = N and Σ_τ ζ_N^{2τ} = 0 in Q(ζ_N), N = q + 1, for q = 3, 5, 7, 13. The chiral545    #    projector P_L = (1/N) Σ_τ diag(1, ζ^{2τ}) = diag(1, 0) is idempotent and kills the right branch (q = 5, 13).546    ok = True547    for q in (3, 5, 7, 13):548        N = q + 1; left = I.char_sum(N, 0)549        ok &= left[0] == N and not any(left[1:]) and I.cyclo_zero(I.char_sum(N, 2), N)550    for q in (5, 13):551        N = q + 1552        PL = (Q(I.char_sum(N, 0)[0], N), Q(0) if I.cyclo_zero(I.char_sum(N, 2), N) else None)553        ok &= PL == (1, 0) and (PL[0] * PL[0], PL[1] * PL[1]) == PL554    R.check("C7", "the V − A current: left = Σζ⁰ = N and right = Σζ_N^{2τ} = 0 exactly (q = 3, 5, 7, 13); P_L = diag(1, 0), "555            "idempotent, annihilating the right branch", ok)556557    # C8 the four-fermion amplitude: G_F/√2 = g²/(8M_W²) = 1/(2v²) with M_W² = g²v²/4, so G_F = 1/(√2 v²), a polynomial558    #    identity in g and v559    names = ("g", "v"); gg, v = (I.Poly.var(names, x) for x in names)560    MW2 = gg * gg * v * v * Q(1, 4)561    sym = 8 * MW2 == 2 * v * v * gg * gg                                          # g²/(8 M_W²) = 1/(2 v²)562    R.check("C8", "the four-fermion amplitude: G_F/√2 = g²/(8M_W²) = 1/(2v²) from M_W² = g²v²/4, so G_F = 1/(√2 v²), as a "563            "polynomial identity in g and v", sym, f"8 M_W² = {8 * MW2}")564565    # C8c [chart] the reading at v = 246.21965 GeV meets the measured G_F within 0.01 %, compared squared as 2(G_F v²)²566    #     against 1567    d = CF.DATA["weak_current"]; x2 = 2 * (d["G_F"] * d["v"] ** 2) ** 2568    num = (1 - Q(1, 10 ** 4)) ** 2 < x2 < (1 + Q(1, 10 ** 4)) ** 2569    R.check("C8c", "[chart] 1/(√2 v²) at v = 246.22 GeV agrees with the measured G_F within 0.01 %, compared squared as "570            "2(G_F v²)² against 1", num, f"√2 G_F v² = √{CH.show(x2, '.8f')}", kind="CHART")571572    # C9 maximal parity violation from the Frobenius branch, exact in Z/(q + 1)573    ok = True574    for q in (3, 5, 7, 13):575        N = q + 1576        ok &= all(q * a % N == (-a) % N for a in range(N))                       # Frobenius z -> z^q is inversion577    for q, dl in ((3, 1), (3, 2), (7, 1), (7, 3)):578        N = q + 1579        DS = [((-a) % N + dl) % N for a in range(N)]; SD = [(-((a + dl) % N)) % N for a in range(N)]580        ok &= (DS == SD) == ((2 * dl) % N == 0)581    for q in (3, 5, 7, 13):582        N = q + 1; dl = next(x for x in range(1, N) if gcd(x, N) == 1)583        right = N if (2 * dl) % N == 0 else 0584        ok &= right == 0 and I.cyclo_zero(I.char_sum(N, 2 * dl), N)585    # 27:X6 (p27029)586    R.check("C9", "Frobenius inverts the boost cycle C_{q+1} (q = 3, 5, 7, 13); the drive commutes with it iff 2δ ≡ 0 (mod N); "587            "over one drive period the left coupling is N and the right exactly 0 for a generator drive", ok)588589    # C10 chirality selection: the two orientation conventions disagree on the label and agree on the drive-aligned branch590    #     (the relabelling theorem orientation_flip): the drive-aligned branch carries the exponent 0 and sums to N over the591    #     period, the counter-aligned branch the exponent 2εδ, ε = ±1 the orientation convention, and sums to 0 for either592    #     sign (the inverse exponent 2(N − δ) as well as 2δ); the convention names the aligned branch L (ε = +1) or R (ε = −1).593    ok = True; labels = {}594    for q in (3, 5, 7, 13):595        N = q + 1; dl = next(x for x in range(1, N) if gcd(x, N) == 1)596        for eps in (1, -1):597            counter = (2 * eps * dl) % N                                              # the counter-aligned branch's exponent598            aligned = I.char_sum(N, 0)599            ok &= aligned[0] == N and not any(aligned[1:]) and counter != 0 and I.cyclo_zero(I.char_sum(N, counter), N)600            labels[(q, eps)] = "L" if eps > 0 else "R"601        ok &= labels[(q, 1)] != labels[(q, -1)]602    R.check("C10", "chirality: the conventions ε = ±1 disagree on the absolute label (L against R) and agree on the drive-aligned "603            "branch, which sums to N over the period while the counter-aligned branch, exponent 2εδ, sums to 0 for either sign "604            "(q = 3, 5, 7, 13)", ok)605606607# ------------------------------------------------------------------------------------------------------------608# block D: the electroweak scale against the transmutation forms (27:Y1, Z1)609# v_scale.py shows that v is not the SU(2) gauge transmutation scale. The b = 2.00 that lands on M_W is a fit, b₂ = 19/6610# lands at 10⁸–10⁹ GeV, and the SU(2) infrared scale is far below. The QCD control is consistent. The closed forms611# m_P e^{−(2π)²} = 87.4 GeV and 2^{3/2} m_P e^{−(2π)²} = 247.2 GeV are readings, the second the conjecture Y1. Both612# checks are continuum readings on the measured scales: CHART.613@R.block("D", BLOCK["D"])614def block_D():615    """Block D — the electroweak scale: D1–D2 CHART."""616    r = CF.v_scale(); d = CF.DATA["v_scale"]617    ok = _within(r["b_fit_MW"], 2, Q(1, 100)) and 10 ** 8 < Q(r["L_b2"]) < 10 ** 9 and Q(r["mu_IR"]) < Q(1, 10 ** 20)618    ok &= _within(Q(r["as_MP_needed"]) / Q(r["as_MP_run"]), 1, Q(1, 10)) and _within(Q(r["vc"]) / d["M_W"], 1, Q(1, 10))619    # 27:Z1 (p27047)620    R.check("D1", "[chart] v against the transmutation forms: the b landing on M_W is a fit (|b − 2| < 0.01); b₂ = 19/6 gives "621            "10⁸–10⁹ GeV; the SU(2) infrared scale is below 10⁻²⁰ GeV; the QCD control agrees within 10 %; m_P e^{−(2π)²} within "622            "10 % of M_W: the absolute scales lie beyond the coherence horizon",623            ok, f"b = {r['b_fit_MW']:.3f}, Λ(b₂) = {r['L_b2']:.2e} GeV, μ_IR = {r['mu_IR']:.1e} GeV, "624                f"α_s(M_P) {r['as_MP_needed']:.4f} vs {r['as_MP_run']:.4f}", kind="CHART")625    ok = _within(Q(r["v1"]) / d["v_ref"], 1, Q(5, 1000)) and _within(r["vc"], Q(874, 10), Q(2, 10))626    # 27:Y1 (p27048)627    R.check("D2", "[chart] the Y1 numeral 2^{3/2} m_P e^{−(2π)²} = 247.2 GeV against v = 246.2 GeV within 0.5 %; "628            "m_P e^{−(2π)²} = 87.4 GeV",629            ok, f"{r['v1']:.1f} GeV against {CH.show(d['v_ref'], '.1f')} GeV ({CH.show(100 * (Q(r['v1']) / d['v_ref'] - 1), '+.2f')} %), "630                f"m_P e^(-(2π)²) = {r['vc']:.2f} GeV", kind="CHART")631632633# ------------------------------------------------------------------------------------------------------------634# block E: the strong sector (27:C7, C8, X1, X7, Z1)635# qcd.py builds SU(3, 2) over F_4, of order 216 with centre Z_3 (E1), and the strong-coupling string tensions of U(1)636# and Z_N on the chart (E2). p5.py gauges the colour frame over F_4. string_tension.py gives c₁ as an exact character sum,637# in closed form on 2T and as the series β/18 + β²/216 for SU(3) (E4, E5), with its resolved-window fit on the chart638# (E5c). p6.py has b₀ = 11 − (2/3)n_f (E6) and Λ_QCD by transmutation on the chart (E7). missing_rank.py has the rank639# tower and SU(3, 5): the gauging of the colour frame (E8, 27:X1).640@R.block("E", BLOCK["E"])641def block_E():642    """Block E — the strong sector: E1, E3–E6, E8 EXACT; E2, E5c, E7 CHART."""643    F4 = I.Fq2(2, 1, 1)                                                          # F_4 = F_2[w], w² = w + 1644    code = lambda x: x[0] + 2 * x[1]                                             # 0, 1, w, w² as the package's 0, 1, 2, 3645    su3 = sorted(I.unitary_frames(F4, 3), key=lambda M: tuple(code(e) for row in M for e in row))646    cube = [x for x in F4.elements() if x != F4.zero and F4.mul(x, F4.conj(x)) == F4.one and F4.pow(x, 3) == F4.one]647    scal = lambda x: tuple(tuple(x if i == j else F4.zero for j in range(3)) for i in range(3))648    mm0 = lambda X, Y: I.mat_mul(F4, X, Y)649    centre = [g for g in su3 if all(mm0(g, h) == mm0(h, g) for h in su3)]         # the centre, by the 216² products650    # E1 SU(3, 2) by its orthonormal frames over F_4: order 216 = q³(q² − 1)(q³ + 1), the centre the scalar cube roots of unity651    R.check("E1", "|SU(3, 2)| = 216 = q³(q² − 1)(q³ + 1) by exhaustive enumeration over F_4; the centre, by all 216² products, "652            "is the three scalar cube roots of unity (Z_3, colour triality)",653            len(su3) == 216 == 2 ** 3 * (2 ** 2 - 1) * (2 ** 3 + 1) and len(cube) == 3 and sorted(centre) == sorted(scal(x) for x in cube),654            f"|SU(3,2)| = {len(su3)}, centre Z_{len(centre)}")655656    # E2 [chart] the strong-coupling string tension σ = −ln c₁(β): U(1) (σ(0.5) = 1.4168, positive, decreasing), Z₃ positive657    s = {b: Q(CF.sigma_U1(b)) for b in (Q(2, 10), Q(5, 10), Q(1), Q(2), Q(4))}658    bs = sorted(s)659    ok = abs(s[Q(1, 2)] - Q(14168, 10000)) < Q(1, 1000) and all(s[a] > s[b] > 0 for a, b in zip(bs, bs[1:]))660    ok &= all(Q(CF.sigma_ZN(b, 3)) > 0 for b in bs)661    R.check("E2", "[chart] the U(1) string tension σ(0.5) = 1.4168, positive and decreasing in β (0.2 … 4.0); σ_Z₃(β) > 0", ok,662            f"σ_U(1)(0.5) = {CH.show(s[Q(1, 2)], '.4f')}", kind="CHART")663664    # E3 the gluon connection over F_4: the plaquette conjugates, Tr P invariant exhaustively, the commutator plaquette of665    #    two non-commuting links ≠ I against = I for the diagonal U(1) control, the triplet covariant666    mm = lambda X, Y: I.mat_mul(F4, X, Y); inv = lambda X: I.dagger(F4, X); tr = lambda X: I.trace(F4, X)667    one = tuple(tuple(F4.one if i == j else F4.zero for j in range(3)) for i in range(3))668    Uab, Ubc, Ucd, Uda = su3[7], su3[40], su3[123], su3[200]; ga, gb, gc, gd = su3[3], su3[55], su3[150], su3[210]669    P = mm(mm(Uab, Ubc), mm(Ucd, Uda))670    U2 = [mm(mm(ga, Uab), inv(gb)), mm(mm(gb, Ubc), inv(gc)), mm(mm(gc, Ucd), inv(gd)), mm(mm(gd, Uda), inv(ga))]671    P2 = mm(mm(U2[0], U2[1]), mm(U2[2], U2[3]))672    ok = P2 == mm(mm(ga, P), inv(ga)) and tr(P2) == tr(P) and all(tr(mm(mm(g, P), inv(g))) == tr(P) for g in su3)673    X, Y = next((X, Y) for X in su3 for Y in su3 if mm(X, Y) != mm(Y, X))674    Fc = mm(mm(X, Y), mm(inv(X), inv(Y)))675    w = (0, 1); w2 = F4.mul(w, w)676    dg = lambda a, b, c: ((a, F4.zero, F4.zero), (F4.zero, b, F4.zero), (F4.zero, F4.zero, c))677    D1, D2 = dg(F4.one, w, w2), dg(w, F4.one, w2)678    Fab = mm(mm(D1, D2), mm(inv(D1), inv(D2)))679    el = {0: (0, 0), 1: (1, 0), 2: (0, 1), 3: (1, 1)}680    psi_a, psi_b = tuple(el[c] for c in (1, 2, 0)), tuple(el[c] for c in (0, 1, 3))681    vsub = lambda u, v: tuple(F4.sub(x, y) for x, y in zip(u, v))682    Dq = vsub(psi_a, I.matvec(F4, Uab, psi_b)); Dq2 = vsub(I.matvec(F4, ga, psi_a), I.matvec(F4, U2[0], I.matvec(F4, gb, psi_b)))683    ok &= Fc != one and Fab == one and Dq2 == I.matvec(F4, ga, Dq) and len(su3) == 216684    R.check("E3", "the SU(3, F_4) gluon connection: the plaquette conjugates and Tr P is invariant over all of SU(3, 2); the "685            "commutator plaquette U₁U₂U₁⁻¹U₂⁻¹ ≠ I (gluon self-coupling), = I for the abelian control; the triplet covariant", ok,686            f"Tr P = {tr(P)}")687688    # E4 the string tension, exact. S₃ and 2T satisfy character orthogonality, with the trace multiset of 2T689    #    {2:1, −2:1, 0:6, 1:8, −1:8}. The moments of 2T give c₁^{2T}(β) = β/4 + …, equal to the continuum SU(2) series690    #    I₂/I₁ through β⁴. σ > 0 for every β > 0 by the closed form of B4. |SU(3, 2)| = 216 and its centre is Z_3.691    chars = {"triv": (1, 1, 1), "sgn": (1, -1, 1), "std": (2, 0, -1)}; sizes = (1, 3, 2)692    ok = all(sum(s_ * c for s_, c in zip(sizes, chars[r])) == 0 for r in ("sgn", "std"))693    ok &= all(Q(sum(s_ * c * c for s_, c in zip(sizes, chars[r])), 6) == 1 for r in chars)694    G, closed, unit, traces = I.tetrahedral_quaternions()695    ok &= len(G) == 24 and closed and unit696    ok &= traces == {2: 1, -2: 1, 0: 6, 1: 8, -1: 8} and sum(t * m for t, m in traces.items()) == 0697    mom = [Q(sum(m * t ** k for t, m in traces.items()), 24) for k in range(8)]698    c2T = I.moment_c1_series(mom, 2, 7); cSU2 = I.bessel_ratio_series(1, 7)699    ok &= c2T[0] == 0 and c2T[1] == Q(1, 4) and c2T[:5] == cSU2[:5] and c2T[5] != cSU2[5]      # the difference starts at β⁵700    ok &= I.area_law_rational()[2]                                                # 0 < c₁ < 1 for every x > 1 (B4)701    ok &= len(su3) == 216 and len(centre) == 3 and (2 + 1) % 3 == 0702    # 27:X7 (p27030)703    R.check("E4", "the string tension in finite units: S₃ and 2T character orthogonality; |2T| = 24 in SU(2, C) with traces "704            "{2:1, −2:1, 0:6, 1:8, −1:8}; c₁^{2T} = β/4 + … agrees with continuum SU(2) through β⁴; σ > 0 for every β > 0 by "705            "the closed form of B4; |SU(3, 2)| = 216, centre Z_3", ok,706            f"c₁^2T series {[str(c) for c in c2T[:6]]}; I₂/I₁ {[str(c) for c in cSU2[:6]]}")707708    # E5 colour SU(3): c₁ = β/18 + β²/216 + … exactly, from the Haar moments of the fundamental character (the Weyl709    #    constant term)710    mom = []711    for k in range(5):712        mom.append(sum(comb(k, j) * I.su3_moment(j, k - j) for j in range(k + 1)) * Q(1, 2 ** k))713    c3 = I.moment_c1_series(mom, 3, 4)714    R.check("E5", "colour SU(3): c₁ = β/18 + β²/216 + … exactly, from the Haar moments of the fundamental character (the "715            "Weyl constant term)", c3[:3] == [0, Q(1, 18), Q(1, 216)], f"series {[str(c) for c in c3]}")716717    # E5c [chart] the package's fit on the resolved window agrees with the series within 10⁻⁴, σ^{SU(3)} > 0 at β = 0.2 … 8,718    #     and the U(1) normalisation σ(0.5) = 1.4168719    a, b, _ = CF.su3_fit()720    ok = abs(Q(a) - Q(1, 18)) < Q(1, 10 ** 4) and abs(Q(b) - Q(1, 216)) < Q(1, 10 ** 4)721    ok &= all(0 < Q(CF.c1_su3(be)) < 1 for be in (Q(2, 10), Q(5, 10), Q(1), Q(2), Q(4), Q(8)))722    ok &= abs(Q(CF.sigma_U1(Q(1, 2))) - Q(14168, 10000)) < Q(1, 1000)723    R.check("E5c", "[chart] the resolved-window fit of c₁^{SU(3)} agrees with β/18 + β²/216 within 10⁻⁴; σ^{SU(3)}(β) > 0 at "724            "β = 0.2 … 8; the U(1) normalisation σ(0.5) = 1.4168", ok, f"fit {a:.6f} β + {b:.6f} β²", kind="CHART")725726    # E6 asymptotic freedom: b₀ = 11 − (2/3)n_f exactly, positive up to n_f = 16, while the abelian b₀ is negative727    b0 = lambda nf: 11 - Q(2, 3) * nf; bU = lambda nf: -Q(4, 3) * nf728    ok = b0(2) == Q(29, 3) and b0(6) == 7 and b0(16) > 0 and b0(17) < 0 and all(bU(n_) < 0 for n_ in (2, 6, 16))729    R.check("E6", "b₀ = 11 − (2/3)n_f as exact rationals: 29/3 at n_f = 2, 7 at n_f = 6, positive up to 16, negative at 17; the "730            "abelian b₀ < 0", ok)731732    # E7 [chart] Λ_QCD by one-loop transmutation from the M_Z anchor (n_f = 5) lies in the 50–500 MeV decade, and733    #    (m_p/m_P)² = e^{−88}734    lam = Q(CF.lambda_qcd(b0(5))); ex = Q(CF.proton_planck_exponent())735    ok = Q(5, 100) < lam < Q(5, 10) and abs(ex - 88) < Q(1, 10)736    R.check("E7", "[chart] Λ_QCD = M_Z exp(−2π/(b₀α_s)) at n_f = 5 lies in 50–500 MeV; (m_p/m_P)² = e^{−88.0}", ok,737            f"Λ = {CH.show(lam * 1000, '.0f')} MeV, 2 ln(m_P/m_p) = {CH.show(ex, '.2f')}", kind="CHART")738739    # E8 the rank tower and SU(3, 5) over F_25 = F_5[t]/(t² − 2): the colour frame forced as the minimal triality-carrying740    #    rank, its gauging the SU(3) connection (27:X1)741    adm = [q for q in range(5, 200) if q % 12 == 5 and all(q % d_ for d_ in range(2, q) if d_ * d_ <= q)]742    A_ok = all([gcd(n_, Om + 1) for n_ in (1, 2, 3)] == [1, 2, 3] for Om in adm[:8])743    r3 = min(n_ for n_ in range(1, 13) if gcd(n_, 6) % 3 == 0); r2 = min(n_ for n_ in range(1, 13) if gcd(n_, 6) % 2 == 0)744    K = I.Fq2(5, 0, 2)745    N1, N2, N3 = (I.unit_vectors(K, m) for m in (1, 2, 3))746    SU3 = N3 * N2 * N1 // (5 + 1)747    cube = [x for x in K.elements() if K.pow(x, 3) == K.one and K.norm(x) == 1]748    def frame(reverse):749        vs = list(product(K.elements(), repeat=3)); vs = vs[::-1] if reverse else vs750        cols = []751        for vec in vs:752            if I.herm(K, vec, vec) != K.one: continue753            if all(I.herm(K, c, vec) == K.zero for c in cols):754                cols.append(vec)755                if len(cols) == 3: break756        M = [[cols[j][i] for j in range(3)] for i in range(3)]757        dinv = K.inv(I.det(K, M))758        return tuple(tuple(K.mul(M[r_][c_], dinv) if c_ == 2 else M[r_][c_] for c_ in range(3)) for r_ in range(3))759    U1, U2 = frame(False), frame(True)760    one = tuple(tuple(K.one if i == j else K.zero for j in range(3)) for i in range(3))761    mm = lambda X, Y: I.mat_mul(K, X, Y); dg_ = lambda X: I.dagger(K, X)762    unit = mm(dg_(U1), U1) == one and mm(dg_(U2), U2) == one763    dets = I.det(K, U1) == K.one and I.det(K, U2) == K.one764    Up = mm(mm(U1, U2), mm(dg_(U1), dg_(U2)))765    gi = I.trace(K, mm(mm(U2, Up), dg_(U2))) == I.trace(K, Up)766    ok = A_ok and r3 == 3 and r2 == 2 and SU3 == 378000 and len(cube) == 3 and unit and dets and gi and Up != one767    ok &= comb(5, 0) + comb(5, 2) + comb(5, 4) == 16768    # 27:C7 (p27019)769    R.check("E8", "the rank tower: centre orders [1, 2, 3] for n = 1, 2, 3 over the first eight shell primes Ω ≡ 5 (mod 12); "770            "minimal ranks 3 (colour) and 2 (isospin), the gauging of the colour frame; |SU(3, 5)| = 378 000; three norm-one "771            "cube roots of unity; two SU(3, 5) matrices unitary, det 1, Wilson-invariant, non-commuting; dim Λ^even(C⁵) = 16", ok,772            f"(N1, N2, N3) = {(N1, N2, N3)}, |SU(3,5)| = {SU3}, admissible {adm[:8]}")773774775# ------------------------------------------------------------------------------------------------------------776# block F: matter (27:C6, C8–C11, X8, X9, P1, P2, P4, P6, P7)777# generation.py reads one generation as the spinor of C³ ⊕ C² (F1: the matter content, which the exclusion rows P2, P6,778# P7 rest on). p8.py and p8b.py give the spinorial unification argument, the X, Y as the colour–isospin off-block and779# the proton lifetime (F3, a dimensional estimate on the chart). p9.py counts Frobenius orbits. p9b.py splits the roles780# 1 + 3 (F6, with the ladder's closure from the horizon theme: no further sector, the deciding check of P2, P6, P7) and781# orders the masses (F6c, on the measured masses). p11.py derives Ω ≡ 5 (mod 12).782@R.block("F", BLOCK["F"])783def block_F():784    """Block F — matter: F1, F2, F4–F7 EXACT; F3, F6c CHART."""785    # F1 the 16 = 1 ⊕ 5̄ ⊕ 10: sixteen Weyl fermions with ΣY = ΣY³ = 0 and Tr T₃²/Tr Q² = 3/8. The 6Y multiset equals786    #    that of the theme's even subsets read 3 + 2 (gen16, y6).787    h = Q(1, 2)788    GEN = [("Q", 3, [h, -h], Q(1, 6)), ("u^c", 3, [Q(0)], Q(-2, 3)), ("d^c", 3, [Q(0)], Q(1, 3)),789           ("L", 1, [h, -h], Q(-1, 2)), ("e^c", 1, [Q(0)], Q(1)), ("nu^c", 1, [Q(0)], Q(0))]790    nW = sum(c * len(t) for _, c, t, _ in GEN)791    sY = sum(c * len(t) * y for _, c, t, y in GEN); sY3 = sum(c * len(t) * y ** 3 for _, c, t, y in GEN)792    T3 = sum(c * sum(x * x for x in t) for _, c, t, _ in GEN); Q2 = sum(c * sum((x + y) ** 2 for x in t) for _, c, t, y in GEN)793    charges = {x + y for _, c, t, y in GEN for x in t}794    wsum = all(any(y == a * Q(-1, 3) + b * h for a in range(-3, 4) for b in range(-2, 3)) for _, _, _, y in GEN)795    six = Counter(6 * y for _, c, t, y in GEN for _ in range(c * len(t)))796    ok = nW == 16 and sY == 0 and sY3 == 0 and charges == {Q(2, 3), Q(-1, 3), Q(-2, 3), Q(1, 3), Q(0), Q(-1), Q(1)}797    ok &= T3 / Q2 == Q(3, 8) and wsum and six == Counter(I.y6(S) for S in I.gen16())798    # 27:C8 (p27020), 27:X8 (p27031)799    R.check("F1", "one generation as the spinor of C³ ⊕ C²: sixteen Weyl fermions, hypercharges weight sums of (−1/3, +1/2), "800            "charges {±2/3, ±1/3, 0, ±1}, ΣY = ΣY³ = 0, Tr T₃²/Tr Q² = 3/8: the matter content that the exclusion predictions "801            "rest on", ok, f"Tr T₃² = {T3}, Tr Q² = {Q2}")802803    # F2 the spinorial argument: 1 + 5 + 10 = 16804    R.check("F2", "the generation pieces of the irreducible SO(10) spinor: 1 + 5 + 10 = 16", 1 + 5 + 10 == 16)805806    # F3 [chart] the proton lifetime τ_p ~ M_X⁴/(α_GUT² m_p⁵) in years, a dimensional estimate on the declared numerals. It807    #    is 10⁴⁸ yr at the Planck scale, above row P4's bound 10⁴⁵, and 4.6 × 10³⁵ yr at 10¹⁶ GeV, above the Super-K bound 10³⁴.808    d = CF.DATA["p8"]809    tau = {M: M ** 4 / (d["alpha_GUT"] ** 2 * d["m_p"] ** 5) * d["hbar_GeV_s"] / d["year_s"] for M in d["M_X"]}810    Ms = sorted(tau)811    ok = all(tau[b] / tau[a] == (b / a) ** 4 for a, b in zip(Ms, Ms[1:])) and tau[Ms[-1]] >= 10 ** 45 and tau[Ms[0]] > 10 ** 34812    # 27:P4 (p27038)813    R.check("F3", "[chart] τ_p ∝ M_X⁴; τ_p at the Planck scale ≥ 10⁴⁵ yr (row P4's bound); τ_p at M_X = 10¹⁶ GeV above the "814            "Super-K bound 10³⁴ yr", ok, ", ".join(f"{CH.show(M, '.1e')} GeV: {CH.show(tau[M], '.1e')} yr" for M in Ms), kind="CHART")815816    # F4 the X, Y as the colour–isospin off-block: dim SU(5) − dim(SU(3) × SU(2) × U(1)) = 24 − 12 = 12 = 2·(3·2)817    su5, sm, off, so10 = 5 ** 2 - 1, (3 ** 2 - 1) + (2 ** 2 - 1) + 1, 2 * (3 * 2), 10 * 9 // 2818    # 27:C9 (p27021)819    R.check("F4", "the X, Y leptoquarks are the colour–isospin off-block: 24 − 12 = 12 = the 3 × 2 complex off-block; "820            "dim SO(10) = 45; 1 + 5 + 10 = 16", su5 == 24 and sm == 12 and su5 - sm == off == 12 and so10 == 45 and 1 + 5 + 10 == 16)821822    # F5 generations as Galois conjugates: the orbits of x -> x^q on F_{q^n}^× (multiplication by q on Z/(q^n − 1))823    def orbits(q, n):824        N = q ** n - 1; seen = set(); out = []825        for a in range(N):826            if a in seen: continue827            orb = []; b = a828            while b not in seen: seen.add(b); orb.append(b); b = b * q % N829            out.append(orb)830        return out831    ok = True832    for q in (2, 3, 5):833        fo = {n: orbits(q, n) for n in (2, 3, 6)}834        ok &= {n: max(len(o) for o in fo[n]) for n in fo} == {2: 2, 3: 3, 6: 6}835        ok &= all(all(n % len(o) == 0 for o in fo[n]) for n in fo)836    R.check("F5", "Frobenius orbits on F_{q^n}^× for q = 2, 3, 5: full orbits of size 2, 3, 6 for n = 2, 3, 6, every orbit size "837            "dividing the degree; the degrees 2 and 3 coprime", ok and gcd(2, 3) == 1)838839    # F6 the closed role ladder and its 1 + 3 split. The fifth step returns to counting: on the shells F_13, F_53, F_157,840    #    F_421 the tower g^(g^j) is read with its exponent modulo p − 1, an index on the cycle, for every j (the horizon841    #    theme's tower, as 26-pnp's closure). One role is non-generative (counting, the bosonic Carrier), three are842    #    generative (the generations): no fifth interaction, no fourth generation, no further sector.843    ok = True; det = []844    for p in (13, 53, 157, 421):845        g, n = arith.primitive_root(p), p - 1846        closes = all(LD.tower(g, j, p)[0] == LD.tower(g, j, p)[1] for j in range(n))    # g^(g^j) = g^((g^j) mod n)847        acts = any(pow(g, j, p) >= n for j in range(n))                                   # the reduction is not vacuous848        ok &= closes and acts849        det.append(f"F_{p}: g = {g}, the tower exponent read modulo {n} for all {n} indices")850    # 27:C10 (p27022), 27:X9 (p27032), 27:P1 (p27035), 27:P2 (p27036), 27:P6 (p27040), 27:P7 (p27041)851    R.check("F6", "the closed role ladder: the fifth step returns to counting (on F_13, F_53, F_157, F_421 the tower g^(g^j) is "852            "read with its exponent modulo p − 1, an index on the cycle, for every j, and the reduction is not vacuous): iterated "853            "exponentiation opens no fifth role; the count 4 = 1 + 3 (one non-generative role, the bosonic Carrier, three "854            "generative, the generations) is the realisation B6's reading of the closed ladder, not decided here", ok, "; ".join(det))855856    # F6c [chart] the generations ordered by the ladder: the geometric-mean masses of the three generations from the857    #     measured quark and lepton masses, gen1 < gen2 < gen3, each step above ×40 (compared cubed, in rationals)858    d = CF.DATA["p9b"]859    pr = [d[g][0] * d[g][1] * d[g][2] for g in ("gen1", "gen2", "gen3")]860    ok = pr[0] < pr[1] < pr[2] and pr[1] / pr[0] > 40 ** 3 and pr[2] / pr[1] > 40 ** 3861    R.check("F6c", "[chart] the generations ordered as the ladder orders the roles: the geometric-mean masses from the measured "862            "quark and lepton masses satisfy gen1 < gen2 < gen3, each step above ×40", ok,863            "step ratios³ " + ", ".join(CH.show(pr[i + 1] / pr[i], ".3g") for i in range(2)), kind="CHART")864865    # F7 Ω ≡ 5 (mod 12) as the CRT conjunction, and the primes below 200 000 by residue mod 12 (1/4 each within 0.01)866    lim = 200000; sieve = bytearray([1]) * lim; sieve[0] = sieve[1] = 0867    for i in range(2, isqrt(lim) + 1):868        if sieve[i]: sieve[i * i::i] = bytearray(len(range(i * i, lim, i)))869    cnt = Counter(p % 12 for p in range(5, lim) if sieve[p]); tot = sum(cnt[r] for r in (1, 5, 7, 11))870    shells = (13, 53, 61, 157, 421)871    ok = {r for r in range(12) if r % 4 == 1 and r % 3 == 2} == {5}872    ok &= all(abs(Q(cnt[r], tot) - Q(1, 4)) < Q(1, 100) for r in (1, 5, 7, 11))873    ok &= all(p % 4 == 1 for p in shells) and [p for p in shells if p % 12 == 5] == [53]874    # 27:C11 (p27023)875    R.check("F7", "5 is the unique residue mod 12 with r ≡ 1 (mod 4) and r ≡ 2 (mod 3), the residue clause Ω ≡ 5 (mod 12) as a "876            "CRT conjunction; the primes below 200 000 split 1/4 each by residue mod 12 within 0.01; the shells 13, 53, 61, 157, "877            "421 are ≡ 1 (mod 4), 53 alone ≡ 5 (mod 12)", ok,878            ", ".join(f"{r}: {CH.show(Q(cnt[r], tot), '.3f')}" for r in (1, 5, 7, 11)))879880    # F8 the torsion period against the horizon count (17 October 2026): on every admissible shell Ω ≡ 5 (mod 12) the881    #    non-split torus has order Ω + 1 ≡ 0 (mod 3), so the Z_3-against-Z_2 torsion is read after (Ω + 1)/3 coherent steps;882    #    that count exceeds every horizon count s with s² ≤ Ω, since 3 s < Ω + 1 — on the shells 17, 53, 173, 389, 1373, the883    #    laboratory Carrier 2 408 561 and every Ω from 7 to 10⁵. The cap of coherent reading at the horizon is the master's884    #    (00:Z2–Z4); this check is the relation alone.885    tors = SHELLS_5MOD12 + (2408561,)886    ok = all(w % 12 == 5 and (w + 1) % 3 == 0 and 3 * isqrt(w) < w + 1 and (w + 1) // 3 > isqrt(w) for w in tors)887    ok &= all(3 * isqrt(w) < w + 1 for w in range(7, 10 ** 5)) and not all(3 * isqrt(w) < w + 1 for w in range(1, 7))888    R.check("F8", "the torsion period exceeds the horizon count: (Ω + 1)/3 > ⌊√Ω⌋ and 3⌊√Ω⌋ < Ω + 1 on the shells 17, 53, 173, "889            "389, 1373 and 2 408 561, and on every Ω from 7 to 10⁵ (false below 7)", ok,890            ", ".join(f"Ω={w}: (Ω+1)/3 = {(w + 1) // 3}, ⌊√Ω⌋ = {isqrt(w)}" for w in tors[:3]))891892893# ------------------------------------------------------------------------------------------------------------894# block G: the running couplings and the mass mechanism (27:C6, P3, P5, Z1)895# p1.py runs the measured M_Z couplings at one loop with b = (41/10, −19/6, −7) (G2, on the chart), and sin²θ_W = 3/8896# where α₁ = α₂ (G1, exact). p7.py reads the seesaw scale, b–τ unification and the winding-overlap hierarchy (G3, G4, on897# the chart).898@R.block("G", BLOCK["G"])899def block_G():900    """Block G — the running couplings and the mass mechanism: G1 EXACT; G2–G4 CHART."""901    # G1 at α₁ = α₂ (GUT-normalised hypercharge, α_Y = (3/5)α₁): sin²θ_W = α_Y/(α₂ + α_Y) = (3/5)/(1 + 3/5) = 3/8902    s = Q(3, 5) / (1 + Q(3, 5))903    R.check("G1", "sin²θ_W = (3/5)/(1 + 3/5) = 3/8 exactly where α₁ = α₂", s == Q(3, 8), str(s))904905    # G2 [chart] the running in rationals on the measured couplings, since π cancels from the couplings at the meeting.906    #    The α₃ near-miss is below 20 %; the chart reads the meeting scale in [10¹², 10¹⁴] GeV. The clause "3/8 runs back907    #    to the measured value" of 16 October was an identity (one-loop running is linear, so running up and back returns908    #    the input exactly) and is gone (17 October 2026).909    d = CF.DATA["p1"]; b1, b2, b3 = d["b"]910    a1, a2, a3 = Q(3, 5) * (1 - d["sin2"]) * d["ainv_em"], d["sin2"] * d["ainv_em"], 1 / d["alpha_s"]911    u = (a1 - a2) / (b1 - b2)                                                     # t₁₂/2π912    aG, a3X = a2 - b2 * u, a3 - b3 * u913    miss = abs(a3X - aG) / aG914    MX = Q(CF.unification_scale())915    ok = miss < Q(1, 5) and 10 ** 12 < MX < 10 ** 14916    # 27:P3 (p27037)917    R.check("G2", "[chart] one-loop running of the measured M_Z couplings with b = (41/10, −19/6, −7): α₁ = α₂ at M_X in "918            "[10¹², 10¹⁴] GeV, where sin²θ_W = 3/8 by the normalisation (G1); the α₃ near-miss below 20 %", ok,919            f"M_X = {CH.show(MX, '.2e')} GeV, α_GUT⁻¹ = {CH.show(aG, '.1f')}, α₃⁻¹ = {CH.show(a3X, '.1f')}, "920            f"near-miss {CH.show(100 * miss, '.0f')} %", kind="CHART")921922    # G3 [chart] the seesaw m_ν = y²v²/M_R reaches 0.01–0.1 eV for M_R = 10¹⁴–10¹⁵ GeV, and m_b/m_τ lies in the band 2–3923    d = CF.DATA["p7"]924    band = [y ** 2 * d["v"] ** 2 / MR * 10 ** 9 for MR in d["M_R"][1:3] for y in d["y"]]925    ok = any(Q(1, 100) < m < Q(1, 10) for m in band) and 2 < d["m_b"] / d["m_tau"] < 3926    # 27:P5 (p27039)927    R.check("G3", "[chart] the seesaw y²v²/M_R reaches 0.01–0.1 eV for M_R = 10¹⁴–10¹⁵ GeV; m_b/m_τ = 2.35 in the b–τ band 2–3",928            ok, "m_ν (eV) = " + ", ".join(CH.show(m, ".3f") for m in band) + f"; m_b/m_τ = {CH.show(d['m_b'] / d['m_tau'], '.2f')}",929            kind="CHART")930931    # G4 [chart] the winding overlap |Σ_{t<T} ζ_N^{kt}|/T (N = 60, T = 12): 1 at k = 0 and decreasing in k = 0 … 5932    ov = [Q(x) for x in CF.winding_overlaps(d["N"], d["T"])]933    ok = abs(ov[0] - 1) < Q(1, 10 ** 12) and all(ov[k] > ov[k + 1] for k in range(5))934    R.check("G4", "[chart] the winding overlap |Σζ^{kτ}|/T is 1 at k = 0 and decreases in the winding distance k = 0 … 5", ok,935            ", ".join(CH.show(x, ".3f") for x in ov), kind="CHART")936937938# ------------------------------------------------------------------------------------------------------------939# block H: flavour (27:X10, X11, P8, P9)940# koide.py proves the framed-rational Koide identity over F_p, p ≡ 5 (mod 12), with the cube root of unity in941# F_{p²} = F_p(√−3) (H1), and reads the measured charged leptons on the chart (H2). strongcp.py shows that Hermitian mass942# matrices over F_{p²}/F_p have their determinant in F_p, so arg det M_q = 0, while [M_u, M_d] ≠ 0 (H3).943SHELLS_5MOD12 = (17, 53, 173, 389, 1373)944945946@R.block("H", BLOCK["H"])947def block_H():948    """Block H — flavour: H1, H3 EXACT; H2 CHART."""949    # H1 over each shell −3 is a non-residue and ω = (−1 + θ)/2 has order 3. The eigenvalues λ_k = a + bω^k + b^pω^{−k}950    #    lie in F_p, with Σλ = 3a, Σλ² = 3a² + 6N(b) and Q = 1/3 + (2/3)ρ². So ρ² = N(b)/a² = 1/2 gives Q = 2/3.951    ok = True952    for p in SHELLS_5MOD12:953        K = I.Fq2(p, 0, -3); i2, i3 = pow(2, p - 2, p), pow(3, p - 2, p)954        ok &= p % 12 == 5 and pow(p - 3, (p - 1) // 2, p) == p - 1955        om = ((-i2) % p, i2); ok &= K.pow(om, 3) == K.one and om != K.one956        oms = [K.one, om, K.mul(om, om)]957        for a in (1, 2, 7):958            for b in ((1, 1), (2, 1), (3, 2)):959                lam = []960                for k in range(3):961                    e = K.add(K.add(K.scalar(a), K.mul(b, oms[k])), K.mul(K.conj(b), oms[(-k) % 3]))962                    ok &= e[1] == 0; lam.append(e[0])963                S1, S2, nb = sum(lam) % p, sum(x * x for x in lam) % p, K.norm(b)964                ok &= S1 == 3 * a % p and S2 == (3 * a * a + 6 * nb) % p965                Qk = S2 * pow(S1 * S1 % p, p - 2, p) % p; rho2 = nb * pow(a * a % p, p - 2, p) % p966                ok &= Qk == (i3 + 2 * i3 * rho2) % p967        ok &= (i3 + 2 * i3 * i2) % p == 2 * i3 % p968    # 27:X10 (p27033)969    R.check("H1", "the framed-rational Koide identity over F_p, p = 17, 53, 173, 389, 1373 (p ≡ 5 mod 12): Σλ = 3a, "970            "Σλ² = 3a² + 6N(b), Q = 1/3 + (2/3)ρ², and ρ² = 1/2 gives Q = 2/3 exactly", ok)971972    # H2 [chart] the measured charged-lepton Q against 2/3 (10⁻⁴) and ρ² against 1/2 (10⁻³)973    Qm, r2 = CF.koide_measured()974    # 27:P8 (p27042)975    R.check("H2", "[chart] the measured charged-lepton Q = Σm/(Σ√m)² is 2/3 within 10⁻⁴ and ρ² is 1/2 within 10⁻³",976            _within(Qm, Q(2, 3), Q(1, 10 ** 4)) and _within(r2, Q(1, 2), Q(1, 1000)), f"Q = {Qm:.6f}, ρ² = {r2:.5f}", kind="CHART")977978    # H3 Hermitian circulant and textured up/down mass matrices over F_{p²}/F_p: det ∈ F_p, det(M_u M_d) ∈ F_p, [M_u, M_d] ≠ 0979    ok = True; n_ = 0980    for p in SHELLS_5MOD12:981        K = I.Fq2(p, 0, -3)982        def herm_m(diag, up):983            return ((K.scalar(diag[0]), up[0], up[1]), (K.conj(up[0]), K.scalar(diag[1]), up[2]),984                    (K.conj(up[1]), K.conj(up[2]), K.scalar(diag[2])))985        b = (2, 1)986        Hc = herm_m((7, 7, 7), (b, K.conj(b), b))                                # det = (7 − 5)(7 + 1)(7 + 4) = 176 ≠ 0987        Hu = herm_m((3, 7, 11), ((1, 1), (2, 3), (4, 1))); Hd = herm_m((2, 5, 13), ((3, 2), (1, 4), (5, 2)))988        dc, du, dd = I.det(K, Hc), I.det(K, Hu), I.det(K, Hd)989        checks = [dc[1] == 0 and dc != K.zero, du[1] == 0 and du != K.zero, dd[1] == 0 and dd != K.zero, K.mul(du, dd)[1] == 0,990                  I.mat_mul(K, Hu, Hd) != I.mat_mul(K, Hd, Hu)]991        ok &= all(checks); n_ += len(checks)992    # 27:X11 (p27034), 27:P9 (p27043)993    R.check("H3", "the strong-CP angle over F_{p²}/F_p, p = 17, 53, 173, 389, 1373: Hermitian circulant and textured mass "994            "matrices have det ∈ F_p, nonzero (arg det M_q = 0), det(M_u M_d) ∈ F_p, and [M_u, M_d] ≠ 0", ok, f"{n_} exact checks")995996    # H4 the Wilson term under orientation reversal (17 October 2026): on the 24 elements of 2T over the Gaussian rationals997    #    and on all 216 elements of SU(3, 2) over F_4, U⁻¹ = U† and Tr U⁻¹ = conj Tr U, so the plaquette term Tr U + conj Tr U998    #    is unchanged by U ↦ U⁻¹: the Wilson class carries no orientation-odd term. 2T first: the inverse of a unit quaternion999    #    is its conjugate, the matrix trace 2a is real, so Tr U⁻¹ = Tr U = conj Tr U.1000    G, _, _, _ = I.tetrahedral_quaternions()1001    ok = all(I.qmul(g, I.qconj(g)) == (1, 0, 0, 0) for g in G)1002    for g in G:1003        M, Mi = I.su2_matrix(g), I.su2_matrix(I.qconj(g))1004        trM = tuple(a + b for a, b in zip(M[0][0], M[1][1])); trMi = tuple(a + b for a, b in zip(Mi[0][0], Mi[1][1]))1005        ok &= trMi == I.gauss_conj(trM) and trM[1] == 0 and I.gauss_mul(trMi, (1, 0)) == trM1006    F4 = I.Fq2(2, 1, 1); su3 = I.unitary_frames(F4, 3)1007    one = tuple(tuple(F4.one if i == j else F4.zero for j in range(3)) for i in range(3))1008    mm = lambda X, Y: I.mat_mul(F4, X, Y); dg = lambda X: I.dagger(F4, X); tr = lambda X: I.trace(F4, X)1009    re2 = lambda U: F4.add(tr(U), F4.conj(tr(U)))                                 # Tr U + conj Tr U, the Wilson term1010    ok &= len(su3) == 216 and all(mm(U, dg(U)) == one and mm(dg(U), U) == one for U in su3)1011    ok &= all(tr(dg(U)) == F4.conj(tr(U)) and re2(dg(U)) == re2(U) for U in su3)1012    # 27:X11 (p27034), 27:P9 (p27043) — corroboration of H3's rows: the orientation clause1013    R.check("H4", "the Wilson term Tr U + conj Tr U is even under orientation reversal U → U⁻¹ = U† on the 24 elements of 2T "1014            "and all 216 elements of SU(3, 2) over F_4: no orientation-odd (topological) term in the Wilson class", ok,1015            f"{len(G)} + {len(su3)} elements")101610171018if __name__ == "__main__":1019    want = [a.upper() for a in sys.argv[1:]] or sorted(BLOCK)1020    bad = [b for b in want if b not in BLOCK]1021    if bad: sys.exit(f"no block {', '.join(bad)}: the blocks are {', '.join(sorted(BLOCK))}")1022    for b in want: R.run_block(b)1023    sys.exit(0 if R.summary(write=False, expect=list(LEDGER) if want == sorted(BLOCK) else None) else 1)1024