TFPT scientific source excerpt Original repository path: experiments/theory-contracts/tfpt-unified-source-derivation-20261029/aps_source_review/check_local_spacetime_force_source.py Original file SHA-256: 7d0f0fb9667a5467501b37fd6447d78e635c82c4b29856e0b880993ac412c252 Inclusive original lines: 1-132 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 | """R080: actual original local Higgs derivative and whole space/time source. 000002 | 000003 | Test functions probe the given circle; they are not physical H weights. 000004 | The separate proof establishes the infinite-dimensional statements. 000005 | """ 000006 | from pathlib import Path 000007 | import sys,json 000008 | import numpy as np 000009 | from scipy.linalg import expm 000010 | from scipy.special import expit 000011 | ROOT=Path(__file__).resolve().parents[4] 000012 | sys.path.insert(0,str(ROOT/'verification')) 000013 | import v252_full_finite_triple as original 000014 | checks={} 000015 | def need(name,condition): 000016 | checks[name]=bool(condition) 000017 | if not condition:raise RuntimeError(name) 000018 | def close(a,b,tol=1e-8):return np.linalg.norm(a-b)1e-4) 000071 | cv=covariance(c,a,b);cr=covariance(c,b,a) 000072 | need('native_spacetime_Wick_commutator_response_N'+str(nmax),abs(cv-cr-np.sum(c*np.diag(a@b-b@a)))<1e-10) 000073 | need('native_spacetime_covariance_Gram_positive_N'+str(nmax),np.linalg.eigvalsh(np.array([[covariance(c,a,a),cv],[cr,covariance(c,b,b)]]))[0]>0) 000074 | rows.append({'N':nmax,'one_particle_dimension':len(c),'HS_A_squared':float(np.linalg.norm(a)**2),'variance_A':float(covariance(c,a,a).real),'mean_before_centering_A':float(np.sum(c*np.diag(a)).real),'ordered_source':[float(val.real),float(val.imag)],'reversed_source':[float(rev.real),float(rev.imag)],'mixed_connected':[float(cv.real),float(cv.imag)],'trace_correction':[float(corr.real),float(corr.imag)]}) 000075 | need('whole_native_local_ordered_source_approaches_limit',abs(complex(*rows[-1]['ordered_source'])-complex(*rows[-2]['ordered_source']))1e-6) 000077 | need('whole_local_HS_tail_increment_decreases',rows[2]['HS_A_squared']-rows[1]['HS_A_squared']>k&1:z[st^(1<>k&1 else 1-c[k] for k in range(4)]) for st in range(16)]) 000089 | Xa=dg(aa)-np.sum(c*np.diag(aa))*np.eye(16);Xb=dg(bb)-np.sum(c*np.diag(bb))*np.eye(16) 000090 | fock=np.trace(rho@expm(1j*Xa)@expm(1j*Xb)) 000091 | need('independent_16state_Fock_checks_actual_mixed_mode_centered_det2',abs(fock-ordered(c,[aa,bb])[0])<1e-12) 000092 | need('independent_Fock_checks_actual_mixed_mode_Wick_response',abs(np.trace(rho@Xa@Xb)-covariance(c,aa,bb))<1e-12) 000093 | # Compact support locality control on ONE actual original singular channel. 000094 | # This is a numerical component control, not a new physical truncation. 000095 | s=float(np.linalg.svd(Ys[0],compute_uv=False)[0]);nodes,weights=np.polynomial.legendre.leggauss(256) 000096 | bump=np.exp(1-1/(1-nodes**2));tw=.1;sw=.35 000097 | def ft(w): 000098 | values=np.asarray(w);flat=values.ravel();out=np.empty(len(flat),complex) 000099 | for at in range(0,len(flat),4096):out[at:at+4096]=np.exp(1j*flat[at:at+4096,None]*tw*nodes)@(weights*bump)/np.sum(weights*bump) 000100 | return out.reshape(values.shape) 000101 | def local_pair(nmax,center,tcenter,rectangular=False): 000102 | ps=np.arange(-nmax,nmax)+.25;es=[];us=[] 000103 | for p in ps: 000104 | e,u=np.linalg.eigh(np.array([[p,s],[s,-p]]));es.append(e);us.append(u) 000105 | es=np.array(es);us=np.array(us);force=np.array([[0,s],[s,0]]) 000106 | mode=np.arange(2*nmax);kk=mode[:,None]-mode[None,:] 000107 | ks=np.arange(-2*nmax+1,2*nmax) 000108 | if rectangular:gcvals=sw/np.pi*np.sinc(ks*sw/np.pi) 000109 | else:gcvals=sw/(2*np.pi)*np.sum(np.exp(-1j*ks[:,None]*sw*nodes)*(weights*bump),axis=-1) 000110 | gc=gcvals[kk+2*nmax-1]*np.exp(-1j*kk*center) 000111 | d=es[:,None,:,None]-es[None,:,None,:] 000112 | tm=np.einsum('pik,kl,qjl->pqij',us.swapaxes(1,2),force,us.swapaxes(1,2)) 000113 | # Explicit transpose contraction independently verified below. 000114 | for i in [0,nmax,2*nmax-1]: 000115 | for j in [0,nmax,2*nmax-1]: 000116 | if not close(tm[i,j],us[i].T@force@us[j]):raise RuntimeError('pair basis contraction') 000117 | blocks=gc[:,:,None,None]*ft(d)*np.exp(1j*tcenter*d)*tm 000118 | return es.reshape(-1),blocks.transpose(0,2,1,3).reshape(4*nmax,4*nmax) 000119 | loc=[] 000120 | for nmax in [16,32,64,128]: 000121 | e,a=local_pair(nmax,0,0);_,b=local_pair(nmax,2.4,.3);c=expit(2*e) 000122 | cv=covariance(c,a,b);cr=covariance(c,b,a) 000123 | loc.append({'N':nmax,'HS_product_AB':float(np.linalg.norm(a@b)),'HS_commutator':float(np.linalg.norm(a@b-b@a)),'mixed_connected':[float(cv.real),float(cv.imag)],'order_defect':float(abs(cv-cr))}) 000124 | need('compact_test_supports_are_strictly_spacelike_in_original_cylinder',2.4-2*sw>.3+2*tw and 2.4+2*sw<2*np.pi-(.3+2*tw)) 000125 | need('finite_cutoff_locality_leak_decreases',loc[-1]['HS_product_AB']