TFPT scientific source excerpt Original repository path: experiments/theory-contracts/tfpt-unified-source-derivation-20261029/aps_source_review/check_local_source_record_split.py Original file SHA-256: 6461f9496634f5c42c283d93d0ff25ef7cb44ff5cec3850ca40b5aa0600e37e8 Inclusive original lines: 1-78 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 | #!/usr/bin/env python3 000002 | """R065 finite source tests for a manual standard-split theorem application. 000003 | Does NOT numerically construct the infinite split unitary or prove a 4D net. 000004 | """ 000005 | from pathlib import Path 000006 | import sys,json,hashlib,itertools as it 000007 | import numpy as np 000008 | import sympy as sp 000009 | ROOT=Path(__file__).resolve().parents[4] 000010 | SRC=ROOT/'experiments/theory-contracts/compiler-correlated-event-clock-20260919/source_channel.py' 000011 | OLD=ROOT/'experiments/theory-contracts/compiler-current-descendant-20260919' 000012 | sys.path.insert(0,str(SRC.parent));import source_channel as s 000013 | checks=[] 000014 | def ck(name,test): 000015 | ok=bool(test);checks.append(dict(name=name,passed=ok)) 000016 | if not ok:raise RuntimeError(name) 000017 | def exact(m): 000018 | return sp.Matrix([[sp.Rational(float(z.real))+sp.I*sp.Rational(float(z.imag)) for z in row] for row in m]) 000019 | ck('pinned unchanged original60 source',hashlib.sha256(SRC.read_bytes()).hexdigest()=='3852fabaf10c143fe20238b67406df6396f85c931dfd4834fe91a2d7ef900593') 000020 | zs=s.source_rays();Us,_,_=s.reflection_actions(zs);F=np.column_stack([x.reshape(-1)/2 for x in s.SYMMETRIC_PAULIS]) 000021 | # Reuse the original NS CAR embedding data; independently reconstruct its defining T F. 000022 | cert=json.loads((OLD/'certificate.json').read_text());E=sp.zeros(28,10) 000023 | for i,j,v in cert['embedding_matrix_nonzero_entries']:E[i,j]=sp.sympify(v) 000024 | pairs=list(it.combinations(range(8),2));lookup={p:i for i,p in enumerate(pairs)} 000025 | T=sp.zeros(28,16) 000026 | for i,j in it.product(range(4),repeat=2):T[lookup[(i,j+4)],4*i+j]=1 000027 | ck('actual original descendant certificate equals original CAR tensor embedding',E==T*exact(F)) 000028 | ck('actual original descendant is isometric',E.conjugate().T*E==sp.eye(10)) 000029 | Lferm=sp.diag(*[sum(sp.Rational(3,2) if k<4 else sp.Rational(1,2) for k in pair) for pair in pairs]) 000030 | ck('actual source has fermionweight2 before U1 quotient',Lferm*E==2*E) 000031 | ck('actual SU4 plus compulsory D5 weights sum2',sp.Rational(2)-sp.Rational(4,8)+sp.Rational(1,2)==2) 000032 | I=np.eye(4);J={a:F.conj().T@(np.kron(P,I)+np.kron(I,P))@F for a,P in enumerate(s.PAULIS)} 000033 | pi=(I+s.PAULIS[1])/2;Q=F.conj().T@np.kron(pi,pi)@F;rho=Q/3 000034 | ck('original R064 IZ plus preparation is rank3 normalized',np.array_equal(Q@Q,Q) and np.trace(Q)==3 and np.trace(rho)==1) 000035 | ck('outside IZ current before source event is2h0',np.trace(rho@J[1])==2) 000036 | ck('ray13 is actual allones reflection',np.array_equal(zs[13],[-1,-1,-1,-1])) 000037 | after=Us[13]@rho@Us[13].conj().T 000038 | ck('outside IZ current after actual global ray13 event is0',np.trace(after@J[1])==0) 000039 | mean=sum(U@rho@U.conj().T for U in Us)/60 000040 | ck('outside IZ current after unread globalC60 is2over5',abs(np.trace(mean@J[1])-.4)<1e-14) 000041 | signed=sum(U.conj().T@J[1]@U for U in Us) 000042 | ck('unread exterior coefficient is exactly12over60 before final division',np.array_equal(signed,12*J[1])) 000043 | ck('original code exposes plus minus logical input in any exterior current smear',np.trace(((F.conj().T@np.kron((I-s.PAULIS[1])/2,(I-s.PAULIS[1])/2)@F)/3)@J[1])==-2) 000044 | # Exact symbolic same exterior witness, no floating denominators. 000045 | qe=exact(Q);je=exact(J[1]);u13=exact(Us[13]);re=qe/3 000046 | ck('exact symbolic exterior source contrast2to0',sp.trace(re*je)==2 and sp.trace(u13*re*u13.conjugate().T*je)==0) 000047 | # Phase faithful word relation: original SU4 descendant action is -iU per event. 000048 | ck('sixty actual current lifts square to minusI in class2',all(np.array_equal((-1j*U)@(-1j*U),-np.eye(10)) for U in Us)) 000049 | ck('sixty scalar phase corrected record restrictions are original U',all(np.array_equal(1j*(-1j*U),U) for U in Us)) 000050 | for word in [(0,13),(13,0),(0,54),(0,13,54),(13,0,45,59)]: 000051 | a=np.eye(10,dtype=complex);b=np.eye(10,dtype=complex) 000052 | for k in word:a=Us[k]@a;b=(-1j*Us[k])@b 000053 | ck('whole-word original phase bookkeeping '+str(word),np.array_equal((1j)**len(word)*b,a)) 000054 | EX=F.conj().T@np.kron((I+s.PAULIS[8])/2,(I+s.PAULIS[8])/2)@F 000055 | for name,V,target in [('r_then_s',u13*exact(Us[0]),sp.Rational(1,3)),('s_then_r',exact(Us[0])*u13,sp.Integer(1))]: 000056 | ck('actual order witness transports through split isometry: finite coefficient '+name,sp.trace(exact(EX)*V*re*V.conjugate().T)==target) 000057 | # New localized-current word witness: same original IZ / XI labels, actual same rays. 000058 | rr=I-np.outer(zs[0],zs[0].conj())/2;ss=I-np.outer(zs[13],zs[13].conj())/2 000059 | ck('interior current word gives normalized trace0 in first order',np.trace(s.PAULIS[8]@ss@rr@s.PAULIS[1]@rr@ss)==0) 000060 | ck('interior current word gives normalized trace1 in reverseorder',np.trace(s.PAULIS[8]@rr@ss@s.PAULIS[1]@ss@rr)==4) 000061 | # Current normalization with one exact NS particle-hole crossing, no finite-CCR claim. 000062 | q=sp.diag(sp.Rational(3,4),-sp.Rational(1,4),-sp.Rational(1,4),-sp.Rational(1,4)) 000063 | v=sp.zeros(256,1);filled=15 000064 | for i in range(4): 000065 | m=filled;sg=(-1)**((m&((1<