TFPT scientific source excerpt Original repository path: experiments/theory-contracts/tfpt-unified-source-derivation-20261029/aps_source_review/check_allmode_collective_time_source.py Original file SHA-256: c659919a62220eeef502a65e62bc8bede0c43dde94cbac8d3c17cb4420ddcea4 Inclusive original lines: 1-128 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 | """R079: original all-mode force and its actual time-smeared ordered source. 000002 | 000003 | Fixed v252 arithmetic controls, not physical parameters or a new H measure. 000004 | The proof, not these finite checks, establishes the infinite-mode 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)0) 000048 | sv=np.concatenate([np.linalg.svd(y,compute_uv=False) for y in Ys[:2]]) 000049 | def radial(p,time=0,width=None): 000050 | p=np.asarray(p);en=np.sqrt(p[...,None]**2+sv**2);cp=expit(2*ell*en);cm=expit(-2*ell*en) 000051 | diag=2*cp*cm*sv**4/en**2;off=sv**2*p[...,None]**2/en**2 000052 | if width is None:ans=diag+off*(cp**2*np.exp(2j*en*time)+cm**2*np.exp(-2j*en*time)) 000053 | else:ans=diag+off*(cp**2+cm**2)*np.exp(-4*width*en**2) 000054 | return 3*np.sum(ans,axis=-1) 000055 | for p in [.25,-.75,4.25]: 000056 | e,c,ts=native(p);d=e[:,None]-e[None,:] 000057 | need('native_full36_radial_time_matches_exact_singular_blocks_'+str(p),abs(cov(c,ts[2]*np.exp(.3j*d),ts[2])-radial(p,.3))<1e-9) 000058 | _,c,ts=native(p,width=.05) 000059 | need('native_full36_radial_smearing_matches_exact_singular_blocks_'+str(p),abs(cov(c,ts[2],ts[2])-radial(p,width=.05))<1e-9) 000060 | # Same-time all-four ordered exponential words, with exact native centering. 000061 | lams=[np.array([.04,.01,0,.02]),np.array([-.02,.03,.04,0])] 000062 | target=float(np.exp(-sig2*np.linalg.norm(sum(lams))**2/2));clt=[] 000063 | for nmax in [16,64,256]: 000064 | m=2*nmax;prod=np.eye(36,dtype=complex) 000065 | for la in lams:prod=prod@expm(1j*sum((la[k]*T[k] for k in range(4)),np.zeros((36,36),complex))/np.sqrt(m)) 000066 | z=1+0j;avg=np.zeros((4,4),complex) 000067 | for p in np.arange(-nmax,nmax)+alpha: 000068 | e,u=np.linalg.eigh(p*g+vstar);c=expit(2*e);C=(u*c)@u.conj().T 000069 | j=sum(lams)/np.sqrt(m);center=np.trace(C@sum((j[k]*T[k] for k in range(4)),np.zeros((36,36),complex))).real 000070 | z*=np.exp(-1j*center)*np.linalg.det(np.eye(36)-C+C@prod) 000071 | ts=[u.conj().T@t@u for t in T] 000072 | avg+=np.array([[cov(c,a,b) for b in ts] for a in ts])/m 000073 | clt.append({'N':nmax,'ordered_characteristic':[z.real,z.imag],'target':target,'error':abs(z-target),'covariance_error':float(np.linalg.norm(avg-sig2*np.eye(4)))}) 000074 | need('all_four_ordered_native_characteristic_approaches_proved_Gaussian',clt[-1]['error']0 and abs(smears[-1]['unscaled_variance']-smears[-2]['unscaled_variance'])<1e-10) 000085 | need('CLT_scaled_fixed_smearing_vanishes',smears[-1]['CLT_scaled_variance']1e-5) 000099 | def cumulants(c,a): 000100 | C=np.diag(c);ca=C@a;a2=a@a;a3=a2@a;a4=a3@a 000101 | return np.array([np.trace(C@a2-ca@ca).real,np.trace(C@a3-3*ca@C@a2+2*ca@ca@ca).real,np.trace(C@a4-4*ca@C@a3-3*C@a2@C@a2+12*ca@ca@C@a2-6*ca@ca@ca@ca).real]) 000102 | def pair_mom(p,s,width=.05): 000103 | h=np.array([[p,s],[s,-p]]);e,u=np.linalg.eigh(h);a=u.T@np.array([[0,s],[s,0]])@u 000104 | a=a*np.exp(-width*(e[:,None]-e[None,:])**2/2) 000105 | return expit(2*e),a 000106 | for p in [.25,-.75,4.25]: 000107 | _,c,a=native(p,width=.05);full=cumulants(c,a[2]);reduced=3*sum((cumulants(*pair_mom(p,s)) for s in sv),np.zeros(3)) 000108 | need('native_full36_cumulants_match_exact_singular_pairs_'+str(p),close(full,reduced,1e-8)) 000109 | # Independent four-state Fock trace for a supported singular pair: no moment formula reuse. 000110 | c,a=pair_mom(.25,float(sv[0]));ann=[] 000111 | for k in range(2): 000112 | op=np.zeros((4,4)) 000113 | for st in range(4): 000114 | if st>>k&1:op[st^(1<1e-4) 000126 | result={'result_id':'R079','all_passed':all(checks.values()),'checks':checks,'controls':len(checks),'scope':'Given constant original circle quark CAR/time; native v252 seed252 inputs, alpha1/4 ell1 Hstar(0,1). Gaussian f_v is a test function, width .05 is not a physical weight or scale prediction. All-N proof is separate. No primitive H/3+1/spin2 identification or Lean/ledger promotion.','Aq':aq,'equal_time_CLT_variance_limit':sig2,'ordered_CLT':clt,'same_time_and_timed':times,'smeared_variances':smears,'whole_ordered_smeared_source':ordered,'unscaled_radial_cumulants_2_3_4':tot.tolist(),'ledger_changed':False} 000127 | Path(__file__).with_name('ALLMODE-COLLECTIVE-TIME-SOURCE.json').write_text(json.dumps(result,indent=2)+'\n') 000128 | print(json.dumps(result,indent=2))