TFPT scientific source excerpt Original repository path: experiments/theory-contracts/tfpt-unified-source-derivation-20261029/aps_source_review/check_collective_higgs_source.py Original file SHA-256: 55e0d6a455c4c5a099c80a4e2997638d15affd615f618a09104c4aba5a451fbd Inclusive original lines: 1-100 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 | """Actual original Higgs-force source, finite-class test and collective Legendre reader. 000002 | 000003 | No physical H measure, new Yukawas, physical time or KO-doubled Fock space. 000004 | The control inputs are precisely v252's seed252 arithmetic inputs. 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 | from scipy.optimize import root 000012 | ROOT=Path(__file__).resolve().parents[4] 000013 | sys.path.insert(0,str(ROOT/'verification')) 000014 | import v252_full_finite_triple as original 000015 | checks={} 000016 | def need(name,value): 000017 | checks[name]=bool(value) 000018 | if not value: raise RuntimeError(name) 000019 | def close(a,b,tol=1e-9):return np.linalg.norm(a-b)0) 000066 | radius=float(3*sum(np.linalg.svd(y,compute_uv=False).sum() for y in Ys[:2])) 000067 | for n in [np.eye(4)[k] for k in range(4)]+[x]: 000068 | e=np.linalg.eigvalsh(field(n)) 000069 | need('original_direction_spectrum_and_support_'+str(len(checks)),close(e,np.linalg.eigvalsh(T[2])) and abs(e[e>0].sum()-radius)<1e-9) 000070 | 000071 | # Exactly the already given constant Quarter source: no H or time selected. 000072 | h=.25*g-1j*g@sub(D);A0=2*h;C=fun(A0,expit);I=np.eye(36) 000073 | need('given_first_face_C_is_faithful',np.linalg.eigvalsh(C)[0]>0 and np.linalg.eigvalsh(C)[-1]<1) 000074 | logZ=lambda a:float(np.logaddexp(0,np.linalg.eigvalsh(a)).sum()) 000075 | logZ0=logZ(A0) 000076 | def read(j): 000077 | a=A0+field(j);c=fun(a,expit) 000078 | return logZ(a)-logZ0,np.array([np.trace(c@t).real for t in T]),c,a 000079 | def hessian(a): 000080 | e,u=np.linalg.eigh(a);f=expit(e);diff=e[:,None]-e[None,:] 000081 | dd=np.divide(f[:,None]-f[None,:],diff,out=np.zeros_like(diff),where=np.abs(diff)>1e-8) 000082 | for i in range(len(e)): 000083 | for j in range(len(e)): 000084 | if abs(diff[i,j])<=1e-8:dd[i,j]=expit((e[i]+e[j])/2)*(1-expit((e[i]+e[j])/2)) 000085 | mats=[u.conj().T@t@u for t in T] 000086 | return np.array([[np.trace(a@(dd*b)).real for b in mats] for a in mats]) 000087 | j=np.array([.1,.2,.3,.4]);W,m,Cj,Aj=read(j);Hess=hessian(Aj) 000088 | step=1e-5;num=np.column_stack([(read(j+step*np.eye(4)[i])[1]-read(j-step*np.eye(4)[i])[1])/(2*step) for i in range(4)]) 000089 | need('whole_Gibbs_Hessian_matches_native_source_derivative',close(Hess,num,1e-7)) 000090 | need('collective_Hessian_positive_definite',np.linalg.eigvalsh(Hess)[0]>0 and close(Hess,Hess.T)) 000091 | Gamma=float(j@m-W) 000092 | logc=lambda a:-np.logaddexp(0,-a) 000093 | log1c=lambda a:-np.logaddexp(0,a) 000094 | entropy=float(np.trace(Cj@(fun(Aj,logc)-fun(A0,logc))+(I-Cj)@(fun(Aj,log1c)-fun(A0,log1c))).real) 000095 | need('actual_collective_Legendre_value_equals_relative_entropy',abs(Gamma-entropy)<1e-10 and Gamma>=0) 000096 | need('collective_mean_within_proved_ball',np.linalg.norm(m)0)