TFPT scientific source excerpt Original repository path: experiments/theory-contracts/mixed-current-origin-20261014/check_gauge_locality_completion.py Original file SHA-256: 00a825e406e510e445034e7b7b6aee68196bef709932c5a39beae47abbbeb69c Inclusive original lines: 1-197 Line numbers below refer to the original source. This bounded excerpt is source evidence; it is not a new proof/checker run. Conversation metadata and personal execution details are omitted where indicated. 000001 | """Exact control of a CONDITIONAL locality change, not its P1 derivation. 000002 | 000003 | Question: can a fermion-parity Gauss completion make the existing half flux 000004 | endpoint-local while preserving the full even physical Hilbert space and 000005 | the original register Hamiltonian? The proof is all-size; this small exact 000006 | CAR control checks its signs with the actual v1033 hopping coefficients. 000007 | The first new premise is the Gauss/local-observable rule, not a new energy. 000008 | """ 000009 | from pathlib import Path 000010 | import hashlib 000011 | import importlib 000012 | import json 000013 | import sys 000014 | import numpy as np 000015 | import sympy as s 000016 | 000017 | [OMITTED: non-scientific conversation or execution metadata] 000018 | sys.path.insert(0,str(ROOT/'verification')) 000019 | v1033=importlib.import_module('v1033_charged_disorder') 000020 | 000021 | 000022 | def need(value,label): 000023 | if not value:raise ValueError(label) 000024 | 000025 | 000026 | def zero(matrix): 000027 | return all(s.expand(x)==0 for x in matrix.todok().values()) 000028 | 000029 | 000030 | def annihilator(m,k): 000031 | out=s.MutableSparseMatrix(2**m,2**m,{}) 000032 | for bits in range(2**m): 000033 | if bits&(1<1 else 3),1 000055 | m=2*L*ny 000056 | dim=2**m 000057 | ops=[annihilator(m,k) for k in range(m)] 000058 | even=[n for n in range(dim) if n.bit_count()%2==0] 000059 | states=[(r,n) for r in range(4) for n in even] 000060 | pos={a:i for i,a in enumerate(states)} 000061 | 000062 | 000063 | def col_parity(n,j): 000064 | mask=((1<<(2*ny))-1)<<(2*ny*j) 000065 | return (n&mask).bit_count()%2 000066 | 000067 | 000068 | def ext_index(b,z,n): 000069 | return (b*2**L+z)*dim+n 000070 | 000071 | 000072 | extended=2*2**L*dim 000073 | E=s.MutableSparseMatrix(extended,len(states),{}) 000074 | for (r,n),col in pos.items(): 000075 | b,w=r%2,r//2 000076 | for tbits in range(2**(L-1)): 000077 | t=[0]+[(tbits>>(j-1))&1 for j in range(1,L)] 000078 | z=sum((((w if j==L-1 else 0)+t[j]+t[(j+1)%L])%2)<>x)&1)-1)*amp 000119 | if change: 000120 | for a in range(2): 000121 | for c in range(2): 000122 | i,j=2*((x+1)%L)+a,2*x+c 000123 | h[i,j]+=change*TX[a,c] 000124 | h[j,i]+=s.conjugate(change*TX[a,c]) 000125 | block=second_quantize(h,ops) 000126 | for n in range(dim): 000127 | for nprime in range(dim): 000128 | if block[nprime,n]:H_new[ext_index(b,z,nprime),ext_index(b,z,n)]=block[nprime,n] 000129 | H_new=s.SparseMatrix(H_new) 000130 | need(zero(H_new*E-E*H_old),'EXACT original physical Hamiltonian and all time words') 000131 | need(all(H_new*G==G*H_new for G in gauss),'local Gauss constraints commute with Hamiltonian') 000132 | 000133 | W=s.diag(*[s.I**b*(-1)**z.bit_count() for b in range(2) for z in range(2**L) for n in range(dim)]) 000134 | Zold=s.diag(*[s.I**r for r,n in states]) 000135 | need(W*E==E*Zold,'old local register Z becomes global Wilson loop') 000136 | 000137 | for endpoint in range(L): 000138 | F=s.MutableSparseMatrix(len(states),len(states),{}) 000139 | for (r,n),col in pos.items(): 000140 | parity=sum(col_parity(n,x) for x in range(endpoint+1))%2 000141 | F[pos[(r+2)%4,n],col]=(-1)**parity 000142 | need(electric[endpoint]*E==E*F,'existing half string becomes LOCAL electric endpoint') 000143 | 000144 | # Any nontrivial register-grade q continues to obstruct old local inclusion. 000145 | X4=s.zeros(4) 000146 | for r in range(4):X4[(r+1)%4,r]=1 000147 | Z4=s.diag(1,s.I,-1,-s.I) 000148 | need(all(Z4*X4**q*Z4.conjugate().T==s.I**q*X4**q for q in range(4)), 000149 | 'all register grades survive arbitrary matter dressing and homogeneous words') 000150 | 000151 | # Independently check the one-particle gauge covariance at the ACTUAL width8. 000152 | # All values are binary rationals times powers of i, so these identities are 000153 | # exact in floating representation, not tolerance-based spectral checks. 000154 | def signed_cylinder(nx,ny,b,z): 000155 | h=v1033.qwz_cylinder(nx,ny,1.,b).copy() 000156 | for x in range(nx): 000157 | if (z>>x)&1: 000158 | change=-2*(1j**b if x==nx-1 else 1) 000159 | for y in range(ny): 000160 | i=2*((x+1)%nx*ny+y) 000161 | j=2*(x*ny+y) 000162 | h[i:i+2,j:j+2]+=change*v1033.TX 000163 | h[j:j+2,i:i+2]+=np.conj(change)*v1033.TX.conj().T 000164 | return h 000165 | 000166 | width8_cases=0 000167 | for b in range(2): 000168 | for z in range(8): 000169 | h=signed_cylinder(3,8,b,z) 000170 | for x in range(3): 000171 | u=np.ones(48) 000172 | u[16*x:16*(x+1)]=-1 000173 | znew=z^(1<