exact_core.py โ€” src/28-flavour

The file src/28-flavour/exact_core.py of the validation package of the paper 28-flav, rendered with an anchor per line; the file itself is beside this page.

28-flavour ledgersrc/28-flavour/exact_core.py ยท 10.4 KBexact_core.py
1#!/usr/bin/env python32# -*- coding: utf-8 -*-3"""4EXACT CORE -- the load-bearing flavour claims verified with ZERO continuum operations.5No float, no log, no numerical trig, no RNG, no tolerances.  Arena ladder (most native first):6  * FRAMED RATIONALS (1-algebra) : the Koide identity over F_{p^2}/F_p with Frobenius the7                        native conjugation; omega the finite cube root, the 'sqrt2 amplitude'8                        the framed RATIONAL N(b)/a^2=1/2, Q=2/3 exact in F_p (section E); and the9                        amplitude diagonal r^2=N(1-zeta_n)=2,3 as INTEGERS in F_p (section F).10  * cyclotomic Q(omega, sqrt2)   : one continuum rung up -- omega a complex cube root, sqrt211                        =zeta_8+zeta_8^{-1} irrational (sections A, D).  A labelled reading.12  * rational multiples of pi     : the pi/12 boundary, and 1+sqrt2 cos(3pi/4)=0 (section B).13  * INTEGER group ring Z[Z/3 x Z/p] : Gauss-sum reality and pi/3-quantisation (section C).14Each continuum quantity used elsewhere (logs for lambda-powers, arccos for delta extraction,15RNG for robustness, float linalg for the mixing demo) is a labelled data-comparison or16sensitivity check, NOT a verification of an exact claim; see the finitism-audit note.17"""18import sympy as sp1920ok=[]21def must(tag,cond,detail=""):22    ok.append((tag,bool(cond))); print(f"[{'EXACT' if cond else 'FAIL'}] {tag}: {detail}")2324print("="*70); print("A. Koide / circulant in the cyclotomic field Q(omega, sqrt2)")25print("="*70)26# omega: primitive cube root of unity as an EXACT algebraic number (no pi, no float)27w  = sp.Rational(-1,2) + sp.sqrt(3)/2*sp.I28s2 = sp.sqrt(2)                                   # = zeta_8 + zeta_8^{-1}, cyclotomic29must("A.omega", sp.simplify(w**3-1)==0 and sp.simplify(1+w+w**2)==0,30     "omega^3=1 and 1+omega+omega^2=0 (exact)")31a, bx, by = sp.symbols('a b_x b_y', real=True)32b  = bx + sp.I*by; bc = bx - sp.I*by              # b and its conjugate33lam = [sp.expand(a + b*w**k + bc*w**(2*k)) for k in range(3)]   # circulant eigenvalues34S1 = sp.simplify(sum(lam))35S2 = sp.simplify(sum(l**2 for l in lam))36must("A.sum1", sp.simplify(S1-3*a)==0, f"sum_k lambda_k = {S1} = 3a")37must("A.sum2", sp.simplify(S2-(3*a**2+6*(bx**2+by**2)))==0,38     f"sum_k lambda_k^2 = 3a^2 + 6|b|^2  (exact; the omega-cross terms cancel)")39# Koide ratio Q = sum lambda^2 / (sum lambda)^2 = 1/3 + (2/3) rho^2,  rho^2=|b|^2/a^240rho2 = sp.symbols('rho2', positive=True)          # |b|^2/a^241Q = sp.Rational(1,3) + sp.Rational(2,3)*rho242must("A.Qform", sp.simplify(Q-(3*a**2+6*a**2*rho2)/(9*a**2))==0,43     "Q = 1/3 + (2/3) rho^2  (exact)")44# r = 2|b|/a ; r = sqrt2  <=>  rho^2 = 1/2  <=>  Q = 2/345must("A.koide", sp.simplify(Q.subs(rho2, sp.Rational(1,2))-sp.Rational(2,3))==0,46     "r = sqrt2  (rho=1/sqrt2, the quarter-turn diagonal)  =>  Q = 2/3 exactly")47# circulant eigen-identity & Hermiticity, exact symbolic matrix over Z[omega]48P = sp.Matrix([[0,1,0],[0,0,1],[1,0,0]])49M = a*sp.eye(3) + b*P + bc*P.T                      # P.T = P^2 = P^dagger50must("A.herm", sp.simplify(M - M.conjugate().T)==sp.zeros(3),51     "sqrt(M)=a*1+b*P+conj(b)*P^2 is Hermitian (P^2=P^dagger)")52F = sp.Matrix(3,3, lambda j,k: w**(j*k))            # Fourier (Vandermonde in omega)53D = sp.simplify(F.inv()*M*F)54diag_ok = all(sp.simplify(D[i,j])==0 for i in range(3) for j in range(3) if i!=j)55eig_ok  = all(sp.simplify(D[k,k]-(a+b*w**k+bc*w**(2*k)))==0 for k in range(3))56must("A.eig", diag_ok and eig_ok,57     "F^{-1} M F diagonal with entries a+b w^k+conj(b) w^{2k}  (exact eigenvalues)")5859print("\n"+"="*70); print("B. The pi/12 boundary (exact rational-pi + algebraic)")60print("="*70)61must("B.pi12", sp.simplify(sp.Rational(3,4)*sp.pi - sp.Rational(2,3)*sp.pi - sp.pi/12)==0,62     "delta_LO = 3pi/4 - 2pi/3 = pi/12 (exact)")63# at the boundary the lightest eigenvalue vanishes EXACTLY: 1 + sqrt2*cos(3pi/4)=064must("B.zero", sp.simplify(1 + s2*sp.cos(sp.Rational(3,4)*sp.pi))==0,65     "1 + sqrt2*cos(3pi/4) = 1 + sqrt2*(-1/sqrt2) = 0 (electron massless at boundary)")6667print("\n"+"="*70); print("C. Gauss sums: reality & pi/3-quantisation as INTEGER identities")68print("="*70)69def isprime(n): return n>1 and all(n%k for k in range(2,int(n**0.5)+1))70def nonresidue(p): return next(n for n in range(2,p) if pow(n,(p-1)//2,p)==p-1)7172def grp_overlap(p, drive):73    """Return the cubic overlap as an exact element of Z[Z/3 x Z/p]:74       C[r][s] = # { k : chi3(g^k)=omega^r  and  additive exponent = s }.75       No complex numbers -- only integer counts of roots of unity."""76    nqr=nonresidue(p)77    def mul(x,y):78        (A,B),(Cc,Dd)=x,y; return ((A*Cc+nqr*B*Dd)%p,(A*Dd+B*Cc)%p)79    U=[(A,B) for A in range(p) for B in range(p) if (A*A-nqr*B*B-1)%p==0]80    assert len(U)==p+181    def order(x):82        o=1;y=x83        while y!=(1,0): y=mul(y,x);o+=184        return o85    g=next(x for x in U if x!=(1,0) and order(x)==p+1)86    C=[[0]*p for _ in range(3)]87    cur=(1,0); w0=(1,1) if drive else (1,0)88    for k in range(p+1):89        A,B=mul(w0,cur); s=(2*A)%p                 # additive exponent Tr(w0 u)=2 Re(w0 u)90        C[k%3][s]+=191        cur=mul(cur,g)92    return C9394def conj(C,p):                                     # zeta_3 -> zeta_3^-1, zeta_p -> zeta_p^-195    return [[C[(-r)%3][(-s)%p] for s in range(p)] for r in range(3)]96def equal(C,D): return C==D97def gmul(C,D,p):                                   # group-ring product over Z/3 x Z/p98    E=[[0]*p for _ in range(3)]99    for r1 in range(3):100        for s1 in range(p):101            c=C[r1][s1]102            if not c: continue103            for r2 in range(3):104                for s2 in range(p):105                    d=D[r2][s2]106                    if d: E[(r1+r2)%3][(s1+s2)%p]+=c*d107    return E108109for p in [17,29,41,53]:110    assert isprime(p) and p%12==5111    Csym=grp_overlap(p,False)112    must(f"C.real_p{p}", equal(Csym,conj(Csym,p)),113         f"p={p}: symmetric cubic overlap b = conj(b) EXACTLY (integer-real); no phase")114for p in [17,29,41,53]:115    Cdrv=grp_overlap(p,True)116    b3=gmul(gmul(Cdrv,Cdrv,p),Cdrv,p)              # b^3117    must(f"C.cube_p{p}", equal(b3,conj(b3,p)),118         f"p={p}: drive-twisted b^3 = conj(b^3) EXACTLY  =>  arg(b) in (pi/3)Z")119120print("\n"+"="*70); print("D. Leptonic CP: the magic matrix is maximal (cyclotomic Z[omega])")121print("="*70)122# the C3 eigenvector (DFT) matrix F = (1/sqrt3)[[1,1,1],[1,w,w^2],[1,w^2,w]]123Fm = sp.Matrix(3,3, lambda j,k: w**(j*k)) / sp.sqrt(3)124mod2 = [sp.simplify(sp.Abs(Fm[j,k])**2) for j in range(3) for k in range(3)]125must("D.trimaximal", all(sp.simplify(m-sp.Rational(1,3))==0 for m in mod2),126     "|F_jk|^2 = 1/3 for all 9 entries (trimaximal), exact")127# Jarlskog J = Im(F00 F11 conj(F01) conj(F10)) = Im(omega)/9 = 1/(6 sqrt3); compute exactly128J = sp.im(sp.simplify(Fm[0,0]*Fm[1,1]*sp.conjugate(Fm[0,1])*sp.conjugate(Fm[1,0])))129Jmax = 1/(6*sp.sqrt(3))130must("D.maxCP", sp.simplify(sp.Abs(J)-Jmax)==0,131     f"J(F) = {sp.simplify(J)} = +-1/(6 sqrt3): MAXIMAL CP (the cube-root phase Im(omega)=sqrt3/2)")132133print("\n"+"="*70); print("E. Koide over FRAMED RATIONALS (1-algebra) -- the most native arena")134print("="*70)135# F_{p^2}/F_p, Frobenius the native conjugation; omega the finite cube root; the quarter-turn136# 'sqrt2' is the framed RATIONAL N(b)/a^2 = 1/2 (a norm condition).  Q=2/3 exact in F_p.137from math import isqrt138def _ratrecon(x,p):                       # canonical framed rational r/s = x (mod p)139    x%=p; B=isqrt(p//2); r0,r1,s0,s1=p,x,0,1140    while r1>B: q=r0//r1; r0,r1=r1,r0-q*r1; s0,s1=s1,s0-q*s1141    return (-r1,-s1) if s1<0 else (r1,s1)142def _framed_koide(p):143    n=next(m for m in range(2,p) if pow(m,(p-1)//2,p)==p-1)   # non-residue: t^2=n144    mul=lambda A,B:((A[0]*B[0]+A[1]*B[1]*n)%p,(A[0]*B[1]+A[1]*B[0])%p)145    conj=lambda A:(A[0],(-A[1])%p); norm=lambda A:(A[0]*A[0]-n*A[1]*A[1])%p146    inv=lambda z:pow(z,p-2,p)147    def order(A):148        o=1;X=A149        while X!=(1,0): X=mul(X,A); o+=1150        return o151    omega=next((u,v) for u in range(p) for v in range(1,p) if order((u,v))==3)152    a=1; tgt=(a*a*inv(2))%p                                   # N(b)=a^2/2 : the quarter-turn153    b=next((u,v) for u in range(p) for v in range(p) if (u,v)!=(0,0) and norm((u,v))==tgt)154    lam=[]155    for k in range(3):156        wk=(1,0)157        for _ in range(k): wk=mul(wk,omega)158        t=( (a if k==0 else 0)+0, 0 )159        L=((a+mul(b,wk)[0]+mul(conj(b),mul(wk,wk))[0])%p,160           (mul(b,wk)[1]+mul(conj(b),mul(wk,wk))[1])%p)161        lam.append(L)162    inFp=all(L[1]==0 for L in lam); l=[L[0] for L in lam]163    Q=(sum((x*x)%p for x in l)*inv((sum(l)%p)**2))%p164    amp=(norm(b)*inv(a*a))%p165    return Q==(2*inv(3))%p and inFp and amp==inv(2)%p, l, omega166for p in [17,53,89]:167    good,l,om=_framed_koide(p)168    must(f"E.framed_p{p}",good,169         f"p={p}: Q=2/3 exact in F_p; sqrt-mass eigenvalues framed rationals "170         f"{[_ratrecon(x,p) for x in l]}; omega={_ratrecon(om[0],p)}+{_ratrecon(om[1],p)}t; "171         f"quarter-turn = N(b)/a^2 = 1/2 (rational, not sqrt2)")172173print("\n"+"="*70)174print("F. The amplitude diagonal over FRAMED RATIONALS: r^2 = N(1-zeta_n) = 2, 3 (integers in F_p)")175print("="*70)176# r^2 = N(1-zeta_n), the finite-field NORM of (1 - finite n-th root of unity): quarter-turn177# (i, i^2=-1) -> 2 (Q=2/3, four-fold, colourless); cube root (omega, omega^2+omega+1=0) -> 3178# (Q=5/6, three-fold, colour).  N(b)/a^2 = 1/2, 3/4 are framed rationals.  The 'sqrt2, sqrt3,179# 2 sin(pi/n)' are CONTINUUM readings of the integers 2, 3 -- one rung up.  No complex, no trig.180for p in [17,53,89]:181    i_=next(x for x in range(1,p) if (x*x+1)%p==0)             # quarter-turn i in F_p (i^2=-1)182    N1mi=((1-i_)*(1+i_))%p                                     # (1-i)(1+i)=1-i^2 = 2183    nq=next(m for m in range(2,p) if pow(m,(p-1)//2,p)==p-1)   # F_{p^2}=F_p[t]/(t^2-nq)184    mul=lambda A,B:((A[0]*B[0]+A[1]*B[1]*nq)%p,(A[0]*B[1]+A[1]*B[0])%p)185    def order(A):186        o=1;X=A187        while X!=(1,0):X=mul(X,A);o+=1188        return o189    om=next((u,v) for u in range(p) for v in range(1,p) if order((u,v))==3)   # cube root omega190    a1=((1-om[0])%p,(-om[1])%p); a2=((1-om[0])%p,(om[1])%p)    # (1-omega) and (1-conj omega)191    N1mw=mul(a1,a2)                                            # N(1-omega) = (3, 0) in F_p192    must(f"F.diag_p{p}", N1mi==2%p and N1mw==(3%p,0),193         f"p={p}: N(1-i)={N1mi} (=2: four-fold, r^2=2 -> Q=2/3); "194         f"N(1-omega)={N1mw[0]} (=3: three-fold/colour, r^2=3 -> Q=5/6) -- integers in F_p")195196print("\n"+"="*70)197nfail=sum(1 for _,c in ok if not c)198print(f"EXACT CORE: {sum(1 for _,c in ok if c)}/{len(ok)} float-free verifications hold"199      + ("" if nfail==0 else f"  ({nfail} FAILED)"))200print("="*70)201