The file src/27-fields/koide.py of the validation package of the paper 27-fld, rendered with an anchor per line; the file itself is beside this page.
1# framed-rational status: MIXED -- exact framed-rational core; continuum constructs are confined to clearly-labelled [approx] / degenerate-idealisation comparisons (Tier 2/3/5 or measured-data), never to an exact claim.2"""Charged-lepton Koide relation from cube-root coherence at the quarter-turn.34Backs Proposition prop:koide of 27-fields (main.tex, sec:matter).56All exact checks are performed natively in the scale-periodic framed-rational7arithmetic of a shell F_p with p = 5 (mod 12): integer/modular arithmetic only,8no continuum primitives (no float, exp, log, trig, pi, sqrt, RNG). The cube root9omega lives on the order-three subgroup of the non-split torus C_{p+1} (3 | p+1),10reached by the native Frobenius conjugation x -> x^p of F_{p^2}/F_p. The quarter11turn enters as the framed-rational value rho^2 = 1/2, i.e. the norm relation122 N(b) = a^2 in F_p.1314The only continuum step is the comparison to the measured lepton masses, which is15isolated at the end and explicitly tagged [approx] (a profinite/continuum reading16of the data, carrying no framed-rational claim).17"""1819_pass = 020_fail = 0212223def check(name, cond):24 global _pass, _fail25 cond = bool(cond)26 print(("PASS" if cond else "FAIL") + " : " + name)27 if cond:28 _pass += 129 else:30 _fail += 1313233def legendre(a, p):34 return pow(a % p, (p - 1) // 2, p)353637# ---- F_{p^2} = F_p[theta], theta^2 = d with d = -3 (a non-residue for p=2 mod 3) ----38# element = (u, v) meaning u + v*theta. Frobenius: (u+v*theta)^p = u - v*theta.39def fmul(A, B, p, d):40 a0, a1 = A41 b0, b1 = B42 return ((a0 * b0 + a1 * b1 * d) % p, (a0 * b1 + a1 * b0) % p)434445def fpow(A, e, p, d):46 R = (1, 0)47 while e:48 if e & 1:49 R = fmul(R, A, p, d)50 A = fmul(A, A, p, d)51 e >>= 152 return R535455def frob(A, p):56 return (A[0] % p, (-A[1]) % p)575859def norm(A, p, d): # N(A) = A * A^p in F_p60 n = fmul(A, frob(A, p), p, d)61 assert n[1] == 062 return n[0]636465def koide_shell(p):66 assert p % 12 == 5, "shell must be 5 mod 12"67 d = (-3) % p68 ok_local = True69 ok_local &= (legendre(d, p) == p - 1) # -3 is a non-residue70 inv2 = pow(2, p - 2, p)71 inv3 = pow(3, p - 2, p)72 # cube root of unity: omega = (-1 + theta)/2, since (2*omega+1)^2 = theta^2 = -3.73 omega = ((-inv2) % p, inv2 % p)74 o3 = fpow(omega, 3, p, d)75 ok_local &= (o3 == (1, 0) and omega != (1, 0)) # order exactly 376 om = [(1, 0), omega, fmul(omega, omega, p, d)] # omega^0, ^1, ^2 (omega^{-1}=omega^2)7778 # eigenvalues lambda_k = a + b*omega^k + b^p*omega^{-k}, real (Frobenius-fixed) in F_p.79 for a in (1, 2, 7):80 for b in ((1, 1), (2, 1), (3, 2)):81 bp = frob(b, p)82 lam = []83 for k in range(3):84 t = fmul(b, om[k], p, d)85 t2 = fmul(bp, om[(-k) % 3], p, d)86 e = ((a + t[0] + t2[0]) % p, (t[1] + t2[1]) % p)87 ok_local &= (e[1] == 0) # lambda_k lies in F_p88 lam.append(e[0])89 S1 = sum(lam) % p90 S2 = sum((x * x) % p for x in lam) % p91 nb = norm(b, p, d)92 ok_local &= (S1 == (3 * a) % p) # sum lambda = 3a93 ok_local &= (S2 == (3 * a * a + 6 * nb) % p) # sum lambda^2 = 3a^2 + 6 N(b)94 # Q = S2 / S1^2 = 1/3 + 2/3 * rho^2, rho^2 = N(b)/a^2, all in F_p95 Q = (S2 * pow(S1 * S1 % p, p - 2, p)) % p96 rho2 = (nb * pow(a * a % p, p - 2, p)) % p97 ok_local &= (Q == (inv3 + 2 * inv3 % p * rho2) % p)98 # quarter-turn: rho^2 = 1/2 (the framed-rational value) <=> Q = 2/3 in F_p99 Q_qt = (inv3 + (2 * inv3) % p * inv2) % p100 ok_local &= (Q_qt == (2 * inv3) % p) # = 2/3101 return ok_local102103104for p in (17, 53, 173, 389, 1373):105 check("framed-rational Koide over F_%d (p=5 mod 12): "106 "sum lam=3a, sum lam^2=3a^2+6N(b), Q=1/3+2/3 rho^2, rho^2=1/2 => Q=2/3" % p,107 koide_shell(p))108109# ---- [approx] continuum comparison to the measured masses (PDG, MeV) ----------110# This block alone uses floats; it is a continuum reading of the data, not a111# framed-rational claim.112import math113me, mmu, mtau = 0.51099895, 105.6583755, 1776.86114a = [math.sqrt(m) for m in (me, mmu, mtau)]115Qm = (me + mmu + mtau) / sum(a) ** 2116w = complex(-0.5, math.sqrt(3) / 2) # continuum zeta_3117a0m = sum(a)118a1m = abs(sum(a[j] * w ** (-j) for j in range(3)))119print("[approx] measured Q = %.6f (2/3 = %.6f, deviation %.1e)"120 % (Qm, 2 / 3, abs(Qm - 2 / 3)))121print("[approx] measured rho^2 = %.6f vs framed-rational 1/2"122 % ((a1m / a0m) ** 2))123124print("\n%d framed-rational checks, %d passed, %d failed" % (_pass + _fail, _pass, _fail))125raise SystemExit(1 if _fail else 0)126