Research source · python

verify-face-defect.py

site/public/evidence/dehn-filled-quantum-trace/face-defect-attack/verify-face-defect.py

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

File fingerprint

SHA-256: e843727647ec3f2de62332380095f013b864bdda0bc0f2297ae7a571899455fa

#!/usr/bin/env python3
"""Exact local controls; universal graph/rank/convergence proofs are in the note."""
from fractions import Fraction
from itertools import combinations, product
import json
from pathlib import Path

checks=[]
def check(name, condition):
    assert condition, name
    checks.append(name)
def xor(*vectors):
    return tuple(sum(v[i] for v in vectors)%2 for i in range(len(vectors[0])))
def dot(a,b):
    return sum(x*y for x,y in zip(a,b))%2
def omega(a,b):
    n=len(a)//2
    return sum(a[n+j]*b[j]-a[j]*b[n+j] for j in range(n))
def rank2(rows):
    rows=[[x%2 for x in r] for r in rows]
    if not rows:return 0
    k=0
    for j in range(len(rows[0])):
        found=next((i for i in range(k,len(rows)) if rows[i][j]%2),None)
        if found is None:continue
        rows[k],rows[found]=rows[found],rows[k]
        for i in range(len(rows)):
            if i!=k and rows[i][j]%2:rows[i]=[a^b for a,b in zip(rows[i],rows[k])]
        k+=1
    return k

verts=tuple(range(4)); edges=list(combinations(verts,2)); ones=(1,)*4; zero=(0,)*4
alpha={e:tuple(int(i not in e) for i in verts) for e in edges}
check('each bare edge has even half-face parity',all(sum(a)==2 for a in alpha.values()))
check('bare-edge half-face map has rank three',rank2(list(alpha.values()))==3)
for i in verts:
    check(f'vertex {i} triple has zero half-face sum',xor(*(alpha[e] for e in edges if i in e))==zero)
for e in edges:
    opposite=tuple(i for i in verts if i not in e)
    check(f'opposite pair {e} differs by local all-ones',xor(alpha[e],alpha[opposite])==ones)
az,aw=alpha[(0,1)],alpha[(0,3)]
check('prime class is z plus w',xor(az,aw)==alpha[(0,2)])
check('local all-ones lies in the radical of even half-face vectors',all(dot(ones,a)==0 for a in alpha.values()))
reps={u:xor(tuple(u[0]*a for a in az),tuple(u[1]*a for a in aw)) for u in product(range(2),repeat=2)}
check('local root symplectic form equals half-face dot product',all(dot(reps[u],reps[v])==omega(u,v)%2 for u in reps for v in reps))
check('local root form is nondegenerate',rank2([[omega((1,0),v)%2 for v in [(1,0),(0,1)]],[omega((0,1),v)%2 for v in [(1,0),(0,1)]]])==2)
# One local orientation check: tetrahedron exponents are zero modulo two.
check('all three tetrahedron terms have degree zero',all(all(x%2==0 for x in u) for u in [(-2,0),(0,2),(0,0)]))
# Vertex-cusp rank argument uses a triangle; determinant 2 proves rational injection,
# including before arbitrary vertex identifications.
triangle=((1,1,0),(0,1,1),(1,0,1))
det=triangle[0][0]*(triangle[1][1]*triangle[2][2]-triangle[1][2]*triangle[2][1])-triangle[0][1]*(triangle[1][0]*triangle[2][2]-triangle[1][2]*triangle[2][0])
check('unsigned triangle incidence is injective over Q',det==2)
# Exact phase cancellation is periodic modulo four; exponents of A cancel identically.
check('native character dependency has zero A exponent',all(2*n-2*n==0 for n in range(4)))
check('native character dependency has phase one',all((-1)**n*(1j)**(-2*n)==1 for n in range(4)))
# The prior fixed figure-eight control is not a new triangulation or slope search.
h=(1,1,-1,-1); a=(1,0,0,-1); w=(0,0,1,-1)
check('fixed edge and traced meridian span an isotropic parity plane',rank2([h,a])==2 and omega(h,a)==0)
check('fixed insertion normalizes the actual integral edge',omega(w,h)==0)
check('fixed insertion is outside the traced parity plane',rank2([h,a,w])==3)
eta=lambda u:(u[1]+u[2])%2
check('retained eta separates the insertion from both traced generators',eta(h)==eta(a)==0 and eta(w)==1)
# Build an actual integral basis for Omega(h,u)=0: x0+x1+y0+y1=0.
pbasis=((1,0,0,-1),(0,1,0,-1),(0,0,1,-1))
check('fixed normalizer basis is integral and independent modulo two',all(omega(h,u)==0 for u in pbasis) and rank2(pbasis)==3)
check('fixed normalizer yields one extra defect dimension',rank2(pbasis)-rank2([h,a])==1)
# Guard against the invalid inference "every mod-two normal vector lifts".
check('nonsaturated edge control distinguishes integral and mod-two normalizers',omega((2,0),(0,1))!=0 and omega((2,0),(0,1))%2==0)
# Symbolic sidedness checks at the exponent level for general Weyl monomials.
# The phase difference for W(-w)W(h) versus W(h)W(-w) is -Omega(w,h).
check('edge-translation commutator vanishes for the native witness',Fraction(omega(tuple(-v for v in w),h)-omega(h,tuple(-v for v in w)),2)==0)
check('translated diagonal has no Weyl scalar',omega(tuple(-v for v in w),w)==0)
# These are the actual matrices used for the all-input mixed-term inequality.
D=((0,1,1),(1,0,1),(1,1,0)); O=((0,1,-1),(-1,0,1),(1,-1,0))
check('mixed degree matrix D minus Omega is entrywise nonnegative',all(D[i][j]-O[i][j]>=0 for i in range(3) for j in range(3)))
check('triple translation lies in the skew radical',all(sum(row)==0 for row in O))
result={'status':'PASS','checks':checks,'number_of_checks':len(checks),
        'scope':'Local exact controls and the retained fixed figure-eight witness; no census. General conclusions rely on the written proofs.',
        'fixed_control':{'h':h,'a':a,'w':w,'normalizer_mod2_rank':3,'traced_plane_rank':2},
        'unproved_strengthening':'No claim that every H^1(M;F_2) class lifts through the particular face-defect map.'}
Path(__file__).with_name('exact-results.json').write_text(json.dumps(result,indent=2)+'\n')
print(json.dumps({'status':'PASS','checks':len(checks),'scope':'local identities and fixed native witness'}))