TFPT scientific source excerpt Original repository path: experiments/theory-contracts/tfpt-unified-source-derivation-20261029/aps_source_review/check_original_color_density_descent.py Original file SHA-256: 1a01188cdff0ee922eb82ab4eee70795585b72d94a83a0c49266db020fb2eb07 Inclusive original lines: 1-84 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 | """R073: actual color-selector action on the original infinite-Maya currents.""" 000002 | from pathlib import Path 000003 | import sys, json 000004 | from fractions import Fraction 000005 | import sympy as s 000006 | 000007 | HERE = Path(__file__).resolve().parent 000008 | REPO = HERE.parents[3] 000009 | sys.path.insert(0, str(REPO/'experiments/theory-contracts/joint-native-algebra-selection-20261016')) 000010 | import check_original_current_schur_kernel as original 000011 | 000012 | data = json.loads((REPO/'experiments/theory-contracts/v16-operator-pullback-20261014/fold-results.json').read_text()) 000013 | M = s.Matrix([[s.Rational(x) for x in row] for row in data['explicit_Weyl_matrix']]) 000014 | target = s.Matrix([1,1,-2,0,0,0,0,0]) 000015 | w = list(map(int, M.T*target)) 000016 | checks = [] 000017 | 000018 | 000019 | def need(ok, msg): 000020 | if not bool(ok): 000021 | raise AssertionError(msg) 000022 | checks.append(msg) 000023 | 000024 | 000025 | def color(lam): 000026 | # All changed beads are above -depth. The infinite identical sea cancels. 000027 | depth = sum(lam)+3 000028 | occ = {(lam[i-1] if i <= len(lam) else 0)-i for i in range(1, depth+1)} 000029 | vac = set(range(-depth, 0)) 000030 | return (sum(w[r%8] for r in occ-vac)-sum(w[r%8] for r in vac-occ))%3 000031 | 000032 | 000033 | need(w == [1,-1,0,-1,-1,-1,0,-1], 'actual center transported by unchanged M') 000034 | D = [sum((w[j]-w[(j-r)%8])%3 != 0 for j in range(8)) for r in range(8)] 000035 | L = [sum((w[j]-w[(j-r)%8])%3 != 0 for j in range(r)) for r in range(8)] 000036 | need(D == [0,6,4,6,2,6,4,6], 'all eight full-residue counts') 000037 | need(L == [0,1,1,3,1,3,3,5], 'all eight prefix counts') 000038 | need([j for j,x in enumerate(w) if x%3 == 1] == [0], 'unique residue1 gives all-mode witness') 000039 | rows = [] 000040 | for m in range(1,25): 000041 | terms = original.add_ribbons((), m) 000042 | charged = sum(abs(coefficient)**2 for lam,coefficient in terms if color(lam)) 000043 | neutral = sum(abs(coefficient)**2 for lam,coefficient in terms if not color(lam)) 000044 | predicted = (m//8)*D[m%8]+L[m%8] 000045 | need(charged == predicted and charged+neutral == m, f'original infinite-Maya J_-{m} full vector color count') 000046 | rows.append({'m':m,'charged_norm2':charged,'neutral_norm2':neutral,'total_norm2':m}) 000047 | need(rows[0]['charged_norm2'] == 1 and rows[0]['neutral_norm2'] == 0, 'whole J1J-1 word norm1, factorwise color projections0') 000048 | need(Fraction(rows[0]['charged_norm2'],4) == Fraction(1,4), 'cos(theta) infinitesimal leakage exactly1/4') 000049 | need([k for k in range(8) if all((w[j]-w[(j+k)%8])%3 == 0 for j in range(8))] == [0], 'only period8 scalar density shift preserves all colors') 000050 | 000051 | # Independent actual arc-matrix commutant system, computed modulo z^2+z+1. 000052 | z = s.symbols('z') 000053 | roots = [(1+s.I)/s.sqrt(2)] 000054 | F = s.Matrix(8,8,lambda r,k:s.expand_complex(roots[0]**(r*k))/s.sqrt(8)) 000055 | Z = (F*s.diag(*[z**(x%3) for x in w])*F.conjugate().T).applyfunc(s.expand) 000056 | Z = Z.applyfunc(lambda x:s.rem(x,z*z+z+1,z)) 000057 | g = s.symbols('g0:8') 000058 | comm = s.diag(*g)*Z-Z*s.diag(*g) 000059 | equations=[] 000060 | for x in comm: 000061 | equations.extend([s.expand(x).coeff(z,0),s.expand(x).coeff(z,1)]) 000062 | A,_ = s.linear_eq_to_matrix(equations,g) 000063 | need(A.rank() == 7 and A.nullspace() == [s.ones(8,1)], 'actual color arc matrix forces all diagonal arc phases equal') 000064 | Za = Z.subs(z,(-1+s.I*s.sqrt(3))/2).applyfunc(s.simplify) 000065 | P = s.zeros(8); P[0,0]=1 000066 | Q = s.zeros(8); Q[1,1]=1 000067 | leak = (Za*P*Za.conjugate().T*Q-Q*Za*P*Za.conjugate().T).applyfunc(s.simplify) 000068 | norm = s.simplify(s.trace(leak.conjugate().T*leak)) 000069 | need(s.simplify(Za[1,0]*s.conjugate(Za[1,0])) == s.Rational(3,64), 'original color action connects two different cover arcs') 000070 | need(norm == s.Rational(183,2048), 'exterior locality witness has nonzero exact norm183/2048') 000071 | 000072 | # q-current transfers only between modes with the same actual residue/color. 000073 | q = M.T*s.Matrix([0,1,-1,0,0,0,0,0]) 000074 | need((q.T*q)[0] == 2, 'actual q current retained at level2') 000075 | need(all(w[(r+8*n)%8] == w[r%8] for r in range(8) for n in [-1,0,1]), 'whole q-current mode rule preserves actual center') 000076 | result={'result':'R073','passed':len(checks),'w':w,'D':D,'L':L, 000077 | 'whole_formula':'ell_(8k+s)=k*D_s+L_s; ell_m=0 iff8 dividesm', 000078 | 'continuous_admissible_scalar_profiles':'Fourier support in8Z', 000079 | 'cos_leakage_norm2':'1/4','arc_commutant_rank':7, 000080 | 'exterior_commutator_norm2':'183/2048', 000081 | 'coordinate_support_class':'O=F^-1(K) modulo nullsets for color-invariant CAR support', 000082 | 'modes':rows,'checks':checks} 000083 | (HERE/'ORIGINAL-COLOR-DENSITY-DESCENT.json').write_text(json.dumps(result,indent=2)+'\n') 000084 | print(json.dumps({'result':'R073','passed':len(checks),'actual_Maya_modes':24,'arc_commutant_rank':7}))