The script src/21-gravity/validate_defect.py of the validation package of the paper 21-grav, rendered with an anchor per line. ▶ run the predicates on Google Colab.
1#!/usr/bin/env python32"""Projection defect (Definition def:defect): exact checks on dev shells.34(a) Cycle-quotient closure: for the cycle-projection registration the chart5 closes exactly (defect = 1), matching 'each shell reads its own projection'.6(b) Windowed (no-wrap) registration does NOT close: the accumulated defect over7 one full recurrence equals the exact wrap count -- the bias in count form.8(c) K_S = P U_C P on a non-invariant sector appears contractive (exact rational9 norms strictly decreasing on a test vector) while U_C is a permutation with10 U_C^ord = identity (reversible, recurrent).11(d) Constitutive selection: on the odd-character space of C_12 the antisymmetric12 currents J(z^-1) = -J(z) are spanned by odd harmonics; the minimal degree is13 unique up to sign (the sine mode); higher odd harmonics exist, so the14 minimal-degree condition is a declared realisation, exactly as stated.15"""16from fractions import Fraction17ok = True18def chk(n, c):19 global ok; ok = ok and bool(c); print(('PASS ' if c else 'FAIL ') + n)2021# (a) cycle projection closes22p, g = 157, 523e = (p - 1) // 52 # 3: projection onto C_52 by cubing24G = pow(g, e, p)25closed = all(pow((g * c) % p, e, p) == (G * pow(c, e, p)) % p for c in range(1, p))26chk("(a) cycle-quotient registration closes: defect = 1 on all of F_157^x", closed)2728# (b) windowed registration wraps: accumulated defect = exact winding count29q, gq = 13, 2 # Subject F_13, drive 2, additive no-wrap window30W = 3 # window half-width (comprehension bound, toy)31wraps = 032x = 133for n in range(12): # one full multiplicative recurrence ord(2)=1234 xn = x * gq % q35 lift = x if x <= q // 2 else x - q36 liftn = xn if xn <= q // 2 else xn - q37 if abs(liftn) > W or abs(lift) > W:38 wraps += 139 x = xn40chk(f"(b) windowed chart fails to close; accumulated defect over one recurrence = {wraps} (exact count > 0)", wraps > 0)4142# (c) K_S = P U P contracts on the non-invariant sector; U recurrent43n = 12 # cyclic permutation U on Z_1244sector = list(range(5)) # non-invariant window P45v = [Fraction(1) if i in sector else Fraction(0) for i in range(n)]46def U(vec): return [vec[(i - 1) % n] for i in range(n)]47def P(vec): return [vec[i] if i in sector else Fraction(0) for i in range(n)]48norms = []49w = v[:]50for _ in range(6):51 w = P(U(P(w)))52 norms.append(sum(x * x for x in w))53chk("(c) K_S norms strictly decreasing (exact rationals): " + ">".join(str(x) for x in norms[:4]),54 all(norms[i] > norms[i + 1] for i in range(len(norms) - 1)) or norms[-1] == 0)55w = v[:]56for _ in range(n):57 w = U(w)58chk("(c) U_C^ord = identity (reversible recurrence)", w == v)5960# (d) odd-character space and the minimal degree61import itertools62m = 1263odd = [k for k in range(1, m) if (-k) % m != k and k < m - k] # representatives k, m-k pair64chk(f"(d) antisymmetric currents = odd harmonics; minimal degree k=1 unique up to sign; higher odd harmonics exist (dim = {len(odd)} > 1)",65 odd[0] == 1 and len(odd) > 1)666768# ---- round-02 additions ----69from math import gcd70# (e) relative-cycle defect and recurrence (Lemma lem:relcycle)71nA, nB, wA, wB = 60, 28, 1, 172L = nA*nB//gcd(nA,nB); qq = gcd(nA,nB); aa = (wB*L//nB - wA*L//nA) % L73Tdef = (L//qq)//gcd(L//qq, aa)74chk(f"(e) relative-cycle defect: L=420, q=4, a=8, T_def=105 on the C60-C28 pair",75 (L, qq, aa, Tdef) == (420, 4, 8, 105))76# (f) compression identity P - K^t K = C^t C on the cyclic model (exact rationals)77from fractions import Fraction78n2 = 12; sector = list(range(5))79def Umat():80 M = [[Fraction(0)]*n2 for _ in range(n2)]81 for i in range(n2): M[i][(i-1) % n2] = Fraction(1)82 return M83def Pmat():84 M = [[Fraction(0)]*n2 for _ in range(n2)]85 for i in sector: M[i][i] = Fraction(1)86 return M87def mm(A,B): return [[sum(A[i][k]*B[k][j] for k in range(n2)) for j in range(n2)] for i in range(n2)]88def mt(A): return [[A[j][i] for j in range(n2)] for i in range(n2)]89def msub(A,B): return [[A[i][j]-B[i][j] for j in range(n2)] for i in range(n2)]90Uc, P = Umat(), Pmat()91K = mm(P, mm(Uc, P)); C = mm(msub([[Fraction(i==j) for j in range(n2)] for i in range(n2)], P), mm(Uc, P))92lhs = msub(P, mm(mt(K), K)); rhs = mm(mt(C), C)93chk("(f) compression identity P - K^T K = C^T C exact (12-cycle, 5-cell sector)",94 lhs == rhs)95# (g) Laurent uniqueness of the pair-tally deficit (support {0,+-1}, inversion, alignment)96# general a0 + a1 z + a-1 z^-1 with inversion symmetry a1 = a-1 and E(1) = 0 => a0 = -2 a197# => E = a1 (2 - z - z^-1) up to scale; oriented mate (z - z^-1)/2i unique odd part98import sympy as _sp99_z, _a0, _a1, _am = _sp.symbols('z a0 a1 am')100_E = _a0 + _a1*_z + _am/_z101_c1 = _sp.simplify(_E - _E.subs(_z, 1/_z)) # inversion symmetry102_sol = _sp.solve([_sp.Poly(_sp.together(_c1)*_z, _z).all_coeffs()[0], _E.subs(_z, 1)], [_am, _a0], dict=True)103_ok_g = False104if _sol:105 _Ef = _sp.simplify(_E.subs(_sol[0]))106 _ok_g = _sp.simplify(_Ef - _a1*(_z + 1/_z - 2)) == 0107chk("(g) pair-tally deficit unique on unit-capacity support: E = a1(z + z^{-1} - 2), one scale",108 _ok_g)109110print("\nALL PASS" if ok else "\nFAILURES PRESENT")111raise SystemExit(0 if ok else 1)112