Research source · python

verify-ck-weyl-legacy.py

site/public/evidence/dehn-filled-quantum-trace/ck-publication-audit/verify-ck-weyl-legacy.py

154 lines. Source is displayed for inspection; it is not executed by this page.

File fingerprint

SHA-256: 273a44f5f2480c8bbf8d8bd4b36d6cf1bd32b29729052f418d976d074bb0854d

#!/usr/bin/env python3
"""Exact universal local checks; no manifold/triangulation/slope search.

Coefficients are Z[i,t^+-1], t=A^(1/2). Monomials are Weyl ordered.
The six-root inclusion pairs the two half-edge occurrences of each edge.
"""
from collections import defaultdict

N = 12
names = [('z',1),('p',1),('Y',1),('p',2),('d',2),('y',2),
         ('d',3),('z',3),('P',3),('y',4),('P',4),('Y',4)]
B = [[0]*N for _ in range(N)]
for k in range(0,N,3):
    for j,l in ((k,k+1),(k+1,k+2),(k+2,k)):
        B[j][l],B[l][j] = 1,-1

def omega(a,b):
    return sum(a[j]*B[j][l]*b[l] for j in range(N) for l in range(N))

class P(dict):
    """key=(t exponent, i exponent 0 or 1, exponent vector); value=int."""
    def __add__(self, other):
        ans=defaultdict(int,self)
        for key,val in other.items(): ans[key]+=val
        return P({key:val for key,val in ans.items() if val})
    def __neg__(self): return P({key:-val for key,val in self.items()})
    def __sub__(self,other): return self + -other
    def __mul__(self,other):
        ans=P()
        for (ta,ia,a),ca in self.items():
            for (tb,ib,b),cb in other.items():
                ans += mono(tuple(x+y for x,y in zip(a,b)),ta+tb+omega(a,b),ia+ib,ca*cb)
        return ans
    def inverse(self):
        assert len(self)==1
        (t,i,a),c=next(iter(self.items()))
        assert c in (-1,1)
        return mono(tuple(-v for v in a),-t,-i,c)
    def __pow__(self,n):
        if n<0:return self.inverse()**(-n)
        ans=one
        for _ in range(n):ans=ans*self
        return ans

def mono(a=None,t=0,i=0,c=1):
    if a is None:a=(0,)*N
    return P({(t,i%2,tuple(a)):c*(-1 if (i//2)%2 else 1)})

def weyl(*args):
    a=[0]*N;t=i=0;c=1
    for arg in args:
        assert len(arg)==1
        (tj,ij,aj),cj=next(iter(arg.items()))
        t+=tj;i+=ij;c*=cj
        a=[x+y for x,y in zip(a,aj)]
    return mono(a,t,i,c)

def vector(p):
    assert len(p)==1
    return next(iter(p))[2]

one=mono()
h={key:mono(tuple(int(j==idx) for j in range(N))) for idx,key in enumerate(names)}
s={label:weyl(*(h[key] for key in names if key[0]==label)) for label in ['z','p','d','y','P','Y']}
z,p,d,y,Pp,Y=(s[label] for label in ['z','p','d','y','P','Y'])
v=weyl(z,p,d)
v0=mono(t=2,i=1)
c=v0.inverse()

def gam(a,b):
    shared=[f for f in range(1,5) if (a,f) in h and (b,f) in h]
    assert len(shared)==1
    f=shared[0]
    return c*weyl(h[a,f],h[b,f])

g1,g2,g3=gam('z','p'),gam('p','d'),gam('d','z')
vr=g1*g2*g3-c**2
assert vr==c**3*(v-v0)
ell=(weyl(gam('z','P').inverse(),gam('P','d'))
     -weyl(gam('d','y').inverse(),gam('y','p'))*gam('z','p')
     -gam('p','d').inverse()*weyl(gam('p','Y').inverse(),gam('Y','z')))
unit=h['d',3].inverse()*h['z',3]
f=z**2+d**(-2)-one
factor=mono(t=-1)
rhs=-factor*f+factor*(v-v0)*(v.inverse()*z**2-v0.inverse()*d**(-2))
assert ell*unit==rhs
fprime=p**2+z**(-2)-one
assert f*z**(-2)+fprime==(v**2-v0**2)*weyl(z**(-2),d**(-2))
print('PASS: exact vertex image rho(vtilde)=c^3(v-iA).')
print('PASS: exact local identity ell*h=-A^(-1/2)f + A^(-1/2)(v-iA)(v^(-1)z^2-(iA)^(-1)zdouble^(-2)).')
print('PASS: exact right-ideal cyclic Lagrangian identity f*z^(-2)+fprime=(v^2-(iA)^2)[z^(-2)zdouble^(-2)].')

# The quotient-lattice degree records difference of paired half exponents.
def degree(a):
    return tuple(a[names.index(keys[0])]-a[names.index(keys[1])]
                 for label in ['z','p','d','y','P','Y']
                 for keys in [[key for key in names if key[0]==label]])

for root in s.values():assert degree(vector(root))==(0,)*6
for poly in (vr,ell*unit,f,v-v0):
    assert all(degree(key[2])==(0,)*6 for key in poly)
ell_degrees={degree(key[2]) for key in ell}
assert len(ell_degrees)==1
assert tuple(a+b for a,b in zip(next(iter(ell_degrees)),degree(vector(unit))))==(0,)*6
print('PASS: tetrahedron generators normalize to degree zero in Z^12 / shape(Z^6).')

O=[[omega(vector(a),vector(b)) for b in s.values()] for a in s.values()]
base=[[0,1,-1],[-1,0,1],[1,-1,0]]
assert O==[[base[j%3][k%3] for k in range(6)] for j in range(6)]
for a,b in ((z,y),(p,Pp),(d,Y)):
    diff=tuple(x-y0 for x,y0 in zip(vector(a),vector(b)))
    assert all(omega(diff,vector(root))==0 for root in s.values())
print('PASS: six-root skew matrix [[Omega,Omega],[Omega,Omega]] and opposite-ratio radical.')

# Central vertex signs are proved using group relations rather than enumerating sectors.
rz=y*z.inverse();rp=Pp*p.inverse();rd=Y*d.inverse()
vertices=[v,weyl(z,Pp,Y),weyl(y,p,Y),weyl(y,Pp,d)]
assert vertices[1]*v.inverse()==rp*rd
assert vertices[2]*v.inverse()==rz*rd
assert vertices[3]*v.inverse()==rz*rp
print('PASS: other vertex / base vertex ratios are rp*rd, rz*rd, rz*rp; hence all equal sigma, sigma^2=1.')

# Collapse and elimination preserve Weyl pairing on the entire lattice.
def omega3(a,b):
    return sum(a[j]*base[j][k]*b[k] for j in range(3) for k in range(3))
def collapse(a):return tuple(a[j]+a[j+3] for j in range(3))
def eliminate(a):return (a[0]-a[1],a[2]-a[1])
for j in range(6):
    for k in range(6):
        ej=tuple(int(n==j) for n in range(6))
        ek=tuple(int(n==k) for n in range(6))
        cj,ck=collapse(ej),collapse(ek)
        xj,xk=eliminate(cj),eliminate(ck)
        assert O[j][k]==omega3(cj,ck)==-xj[0]*xk[1]+xj[1]*xk[0]
print('PASS: full-lattice collapse/elimination Weyl forms; central factors are sigma^beta*(iA)^s, ordered factor A^((r-s)(t-s)/2).')

# The first normalized branch has c_T=-i/A,c_B=1. For Eulerian half
# scalings s*tau with s^2=-i and tau_bar=-tau:
assert mono(i=3)*mono(i=3)*mono(c=-1)==one  # (-i)*s^2*(-1)=1
assert mono(t=-2)*mono(i=3)==c
assert mono(i=3)*mono(c=-1)*v0==mono(t=2,c=-1) # i^3*(-1)*(iA)=-A
print('PASS: original PP to normalized coefficients, including vertex sign -A and auxiliary s^2=-i.')

# Universal peripheral 2-torus audit with Weyl pairing +2 or -2.
def pt_mul(a,b,sign=1):
    return (a[0]+b[0]+sign*2*(a[1]*b[2]-a[2]*b[1]),a[1]+b[1],a[2]+b[2])
m=(0,1,0);l=(0,0,1)
assert pt_mul(m,l)==(2,1,1)
assert pt_mul(l,m)==(-2,1,1)
assert pt_mul(m,l,-1)==(-2,1,1)
print('PASS: torus ml=A^2 lm, W_(mu+lambda)=A^(-1)ml; opposite ambient torus ml=A^(-2)lm, W_(mu+lambda)=A ml.')
assert all(isinstance(coefficient,int) for poly in (vr,ell,unit,f,rhs) for coefficient in poly.values())
print('NOTE: this last check audits normalization only, not the unproved six-root peripheral named-trace identity.')
print('All exact universal local checks passed.')