Research source · python

verify-actual-nahm.py

site/public/evidence/dehn-filled-quantum-trace/actual-nahm-attack/verify-actual-nahm.py

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

File fingerprint

SHA-256: 69d26214cf506882912f2eb7ef13628b3aef91fbeb75f3fa8c1911f84b178f2d

#!/usr/bin/env python3
"""Exact certificates for one fixed published triangulation; no census.

Series use integer A exponents and coefficients. All cutoffs have an explicit
quadratic tail bound. The infinite slope-family proof is in the companion note.
"""
from fractions import Fraction as F
from math import isqrt
from pathlib import Path
import json

ROOT = Path(__file__).resolve().parent
checks, tails = [], []
def check(name, statement):
    assert statement, name
    checks.append(name)
def dot(x,y): return sum(a*b for a,b in zip(x,y))
def addv(x,y): return tuple(a+b for a,b in zip(x,y))
def scale(c,x): return tuple(c*a for a in x)
def omega(x,y): return dot(x[2:],y[:2])-dot(x[:2],y[2:])
def collapse(R): return tuple(r-s for r,s,t in R)+tuple(t-s for r,s,t in R)
E1=((2,0,1),(2,0,1)); E2=((0,2,1),(0,2,1))
MU=((0,-1,0),(1,0,0)); LONG=((-2,2,0),(0,0,0))
h=collapse(E1); a=collapse(MU); d=collapse(LONG)
check('published raw rows collapse exactly',
      h==(2,2,1,1) and collapse(E2)==scale(-1,h)
      and a==(1,1,1,0) and d==(-4,0,-2,0))
check('native scalar exponents',
      [sum(r[1] for r in R) for R in (E1,E2,MU,LONG)]==[0,4,-1,2])
check('both actual edge characters agree',(-2)%4==2 and 2-4==-2)
check('isotropy and peripheral orientation',omega(h,a)==omega(h,d)==0
      and omega(a,d)==-2)

# Polynomial identities checked by coefficient dictionaries, not slope sampling.
# Variables are p,q,e,n. Graph equations multiply by 8q to avoid division.
def poly(*terms):
    out={}
    for c,powers in terms:out[powers]=out.get(powers,0)+c
    return {m:c for m,c in out.items() if c}
def padd(*ps): return poly(*[(c,m) for p in ps for m,c in p.items()])
def pmul(p,q): return poly(*[(a*b,tuple(x+y for x,y in zip(m,n))) for m,a in p.items() for n,b in q.items()])
def pc(c):return {(0,0,0,0):F(c)}
def ps(c,p):return pmul(pc(c),p)
P={(1,0,0,0):F(1)}; Q={(0,1,0,0):F(1)}
E={(0,0,1,0):F(1)}; N={(0,0,0,1):F(1)}
x1=padd(E,ps(F(1,2),pmul(padd(P,ps(-4,Q)),N)))
x2=padd(E,ps(F(1,2),pmul(P,N)))
y1=ps(F(1,2),padd(E,pmul(padd(P,ps(-2,Q)),N)))
y2=ps(F(1,2),E)
check('symbolic graph first component',ps(8,pmul(Q,y1))==padd(pmul(padd(ps(4,Q),ps(-1,P)),x1),pmul(P,x2)))
check('symbolic graph second component',ps(8,pmul(Q,y2))==padd(pmul(P,x1),pmul(padd(ps(4,Q),ps(-1,P)),x2)))
rawQ=padd(pmul(x1,x1),pmul(x2,x2),ps(-1,pmul(x1,y1)),ps(-1,pmul(x2,y2)))
rhs=padd(ps(4,pmul(Q,padd(pmul(x1,x1),pmul(x2,x2)))),pmul(P,pmul(padd(x1,ps(-1,x2)),padd(x1,ps(-1,x2)))))
check('symbolic cone form for all p,q',ps(8,pmul(Q,rawQ))==rhs)
check('boundary cone at p/q=-4 is x1*x2',F(1,2)-F(4,8)==0 and F(4,4)==1)

# The parity proof is symbolic: e even, np even; native phase is positive iff
# 2e+n(p-2q-2)=0 mod4 for all such pairs. For primitive p divisible by4,
# q is odd; write p=4k,q=2j+1: p-2q-2=4(k-j-1).
check('phase identity p=4k,q=2j+1',4-2*2==0 and -2-2==-4)
check('odd p obstruction uses n=2',2*(1-0-2)%4==2)
check('p=2 mod4 and odd q obstruction uses n=1',(2-2-2)%4==2)
check('complementary longitude sign is negative',(-1)**1==-1)

def clean(s): return {e:c for e,c in s.items() if c}
def sadd(*ss):
    out={}
    for s in ss:
        for e,c in s.items():out[e]=out.get(e,0)+c
    return clean(out)
def shift(s,p,c=1,cap=None):
    return clean({e+p:c*v for e,v in s.items() if cap is None or e+p<=cap})
def invpoch(indices,cap):
    if cap<0:return {}
    v=[0]*(cap+1);v[0]=1
    for n in indices:
        for j in range(1,n+1):
            for e in range(4*j,cap+1):v[e]+=v[e-4*j]
    return {e:c for e,c in enumerate(v) if c}

# Original unsaturated Lambda for (p,q)=(4,1):
# lambda=(2x1,2x2,x2,x1), x1=x2 mod2, chi=(-1)^x1 A^(2x2).
# Evaluate from the raw Weyl multiplication and seed, not the final Nahm formula.
def H(u,cap=48):
    if u[0]%2 or u[1]%2 or (u[2]-u[3])%2:return {}
    alpha=(u[0]//2,u[1]//2);beta=(F(u[2],2),F(u[3],2))
    # D=2(a1^2+a2^2-a1*a2)+L.a+const.
    L=(2+2*alpha[1]-4*beta[0],2*alpha[0]-4*beta[1])
    const=2*(dot(alpha,beta)-alpha[0]*alpha[1])+2*alpha[1]
    # Since 2(a1^2+a2^2-a1*a2)>=a1^2+a2^2,
    # D>=0.5(a1^2+a2^2)-0.5||L||^2+const.
    radius2=max(F(0),2*(cap-const)+dot(L,L))
    R=isqrt(radius2.numerator//radius2.denominator)+1
    tails.append({'input':u,'cap_A':cap,'excluded_radius_gt':R,
                  'bound_radius_squared':str(radius2)})
    out={}
    for a1 in range(R+1):
        for a2 in range(R+1):
            x=(a1-alpha[0],a2-alpha[1])
            if (x[0]-x[1])%2 or (x[0]-u[2])%2:continue
            lam=(2*x[0],2*x[1],x[1],x[0])
            ds=(F(x[1],2)+beta[0],F(x[0],2)+beta[1])
            assert all(v.denominator==1 for v in ds)
            deg=2*(a1*a1+a2*a2+a1+a2-dot((a1,a2),ds))+F(omega(lam,u),2)-2*x[1]
            expanded=2*(a1*a1+a2*a2-a1*a2)+dot(L,(a1,a2))+const
            assert deg==expanded and deg.denominator==1
            deg=int(deg)
            if deg<=cap:
                out=sadd(out,shift(invpoch((a1,a2),cap-deg),deg,(-1)**((a1+a2+x[0])%2),cap))
    return out

CAP=48
unit=H((0,0,0,0),CAP)
hs=(0,4,2,0); b=a
longsq=shift(H(scale(2,b),CAP+2),-2,-1,CAP)
vac=sadd(unit,shift(longsq,0,-1))
direct={}
# Tail: both displayed q powers >=u^2+v^2, so outside this square
# no term can reach A-order CAP. These loops are summation, not slope search.
R=isqrt(CAP//4)+1
for u in range(R+1):
    for v in range(R+1):
        base=2*u*u+2*v*v-2*u*v+u
        for deg,indices in [(4*base,(2*u,2*v)),(4*(base+2*v+1),(2*u+1,2*v+1))]:
            direct=sadd(direct,shift(invpoch(indices,CAP-deg),deg,cap=CAP))
check('raw full-image sum equals the displayed positive Nahm formula',vac==direct)
check('positive filled vacuum constant coefficient',vac.get(0)==1 and all(c>0 for c in vac.values()))
check('longitude-square summands have opposite sign',all(c<0 for c in longsq.values()) and longsq.get(4)==-1)

for u in [(0,0,0,0),(0,0,1,1),(2,0,-2,2)]:
    for j in range(2):
        uz=list(u);uz[j]-=2
        uw=list(u);uw[j+2]+=2
        first=shift(H(tuple(uz),CAP+u[j+2]),-u[j+2],cap=CAP)
        second=shift(H(tuple(uw),CAP+u[j]),-u[j],cap=CAP)
        check(f'original tetrahedron multiplier side j={j}, input={u}',sadd(first,second,shift(H(u,CAP),0,-1))=={})
    for row,scalar_power,scalar_phase,name in [(h,0,1,'edge1'),(scale(-1,h),4,1,'edge2'),(hs,-2,-1,'filling')]:
        power=scalar_power+omega(row,u)//2
        check(f'original right-multiplied {name}, input={u}',
              sadd(shift(H(addv(row,u),CAP-power),power,scalar_phase,CAP),shift(H(u,CAP-2),2,cap=CAP))=={})
check('native odd roots are genuinely supported',H((0,0,1,1),CAP)!={})
check('unsupported odd z roots have zero parity support',H((1,0,0,0),CAP)=={})
check('native commutator ml=A^2 lm',omega(hs,b)==2)
ray=addv(scale(-2,h),hs)
check('ordinary-index nonconvergence ray is in the actual image',ray==(-4,0,0,-2))
check('ordinary-index ray character exactly one',-2*2+4==0 and (-1)**(-2)==1)
check('one-sided seed excludes that ray',ray[0]<0)
# I(0,2k): defining n=0 term has degree 0 and denominator (q)_(2k).
# I(-k,0): n=0 term is 1. For every k>=1, all n>=1 exponents
# n(n+1)/2 and n(n+1)/2+nk, respectively, are strictly positive.
check('ordinary seed ray leading coefficient cannot cancel internally',1*(1+1)//2==1)

result={'status':'passed','check_count':len(checks),'checks':checks,
        'datum':'Dimofte-Garoufalidis arXiv:1202.6268v2, Sections 2.6 and 4.6',
        'family':'gcd(p,q)=1, q!=0, p divisible by 4, p/q>-4',
        'vacuum_coefficients_q_through_12':{str(e//4):c for e,c in sorted(vac.items())},
        'quadratic_tail_certificates':tails,
        'scope':'One actual published triangulation. No unrestricted conjecture resolution; proof not replaced by checks.'}
(ROOT/'exact-results.json').write_text(json.dumps(result,indent=2)+'\n')
print(f'PASS: {len(checks)} exact checks with certified quadratic series tails.')
print('Vacuum coefficients q^0 through q^12:',[vac.get(4*j,0) for j in range(13)])
print('Original tetrahedron, both edge, filling and odd-root checks pass.')