Elyxune-Sharp-Exchange-Laws / verification /verify_construction.py
PureOne's picture
Add Elyxune sharp exchange research dataset
66937d8 verified
Raw History Blame Contribute Delete
6.8 kB
#!/usr/bin/env python3
"""Exact arithmetic checks for the Elyxune obstruction theorem.
Run: python verify_elyxune.py --output verification_results.json
Dependency: SymPy. No numerical optimizer is used in these checks.
"""
import argparse
import itertools
import json
import math
from pathlib import Path
import sympy as sp
def coefficients(rank, s, lam):
"""r! times the polarized coefficients, after deleting one y-copy.
Labels: A=0,...,r-1; B=r,...,2r-2; u=2r-1.
"""
t = s * lam
u = 2*rank-1
result = {}
for basis in itertools.combinations(range(2*rank), rank):
j = sum(i < rank for i in basis)
h = t**(j*(j-1)//2)
if u in basis:
g = s**j * h
c = g * sp.Rational(math.factorial(rank-j)*math.factorial(j+1), math.factorial(rank))
else:
c = h * sp.Rational(math.factorial(j)*math.factorial(rank-j), math.factorial(rank))
result[basis] = sp.factor(c)
return result
def quadratic_hessian(coeffs, selected, n):
selected = set(selected)
remaining = [i for i in range(n) if i not in selected]
H = sp.zeros(len(remaining))
for a, b in itertools.combinations(range(len(remaining)), 2):
key = tuple(sorted(selected | {remaining[a], remaining[b]}))
H[a,b] = H[b,a] = coeffs[key]
return H
def check_lorentzian_by_principal_minors(H, strict=False):
checked = 0
for k in range(2, H.rows+1):
for indices in itertools.combinations(range(H.rows), k):
d = H.extract(indices,indices).det(method='domain-ge')
assert ((-1)**k * d < 0 if strict else (-1)**k * d <= 0), (indices, d)
checked += 1
return checked
def integer_example():
# One-based labels in manuscript: A=1,2,3; B=4,5; u=6.
ans = {}
for basis in itertools.combinations(range(6),3):
A = sum(i < 3 for i in basis)
U = 5 in basis
if not U and A == 3: c=14
elif U and A == 0: c=11
elif (U and A == 2) or (not U and A == 1): c=4
else: c=8
ans[basis] = sp.Integer(c)
return ans
def main(output):
s = sp.symbols('s', positive=True)
lam = sp.symbols('lam', positive=True)
t = s*lam
v=sp.Matrix([1,1,1]); w=sp.Matrix([1,1-s,0])
M=sp.Matrix([[0,s,1],[s,t,1],[1,1,1]])
boundary=sp.Matrix([[0,s,1],[s,s*(2-s),1],[1,1,1]])
assert sp.simplify(boundary-(v*v.T-w*w.T)) == sp.zeros(3)
assert sp.factor(M.det()-s*(2-s-lam)) == 0
symbolic=[]
for r in range(2,9):
h=[t**(j*(j-1)//2) for j in range(r+1)]
g=[s**j*h[j] for j in range(r)]
for j in range(r-1):
Q=sp.Matrix([[0,g[j+1],g[j]], [g[j+1],h[j+2],h[j+1]], [g[j],h[j+1],h[j]]])
D=sp.diag(s**j,t**j,1)
assert sp.simplify(Q-h[j]*D*M*D) == sp.zeros(3)
for j in range(r-2):
assert sp.factor(g[j]*g[j+2]-g[j+1]**2-g[j+1]**2*(t-1)) == 0
ratio=sp.factor(r*h[r]/g[r-1])
assert sp.simplify(ratio-r*lam**(r-1)) == 0
symbolic.append(r)
polarized=[]
for r in range(2,6):
C=coefficients(r,sp.Rational(1,10),sp.Rational(9,5))
assert len(C)==math.comb(2*r,r) and all(c>0 for c in C.values())
u=2*r-1; A=tuple(range(r)); B=tuple(range(r,2*r-1))
big=C[A]*C[tuple(sorted(B+(u,)))];small=[]
for i in A:
small.append(C[tuple(sorted((set(A)-{i})|{u}))]*C[tuple(sorted(B+(i,)))])
assert len(set(small)) == 1
assert sp.factor(big/small[0]) == r*sp.Rational(9,5)**(r-1)
# One derivative per symmetry orbit; exact minor checks include every
# possible selected-label pattern up to S_r x S_(r-1).
count=0;orbits=0
for e in (0,1):
for a in range(r-1):
b=r-2-e-a
if b<0 or b>r-1: continue
S=tuple(range(a))+tuple(range(r,r+b))+((u,) if e else ())
H=quadratic_hessian(C,S,2*r)
count+=check_lorentzian_by_principal_minors(H,strict=True);orbits+=1
polarized.append({'rank':r,'bases':len(C),'derivative_orbits':orbits,'principal_minors_checked':count,'witness_ratio':str(sp.factor(big/small[0]))})
C=integer_example(); x=sp.Symbol('z'); chars={};checks=0
for i in range(6):
H=quadratic_hessian(C,(i,),6)
checks+=check_lorentzian_by_principal_minors(H,strict=True)
chars[str(i+1)] = str(sp.factor(H.charpoly(x).as_expr()))
expected_A=(x+4)*(x+14)*(x**3-18*x**2-360*x-128)
expected_B=(x+8)**2*(x**3-16*x**2-361*x-176)
expected_u=(x+4)**2*(x+11)*(x**2-19*x-296)
for i in range(3):assert sp.expand(sp.sympify(chars[str(i+1)])-expected_A) == 0
for i in (3,4):assert sp.expand(sp.sympify(chars[str(i+1)])-expected_B) == 0
assert sp.expand(sp.sympify(chars['6'])-expected_u) == 0
I={0,1,2,5};J={3,4}
products=[int(C[tuple(sorted(I-{i}))]*C[tuple(sorted(J|{i}))]) for i in sorted(I)]
assert sorted(products)==[16,16,16,154]
assert 154>3**2*16
short_checks=0
for fixed in range(6):
for quad in itertools.combinations([i for i in range(6) if i!=fixed],4):
a,b,c,d=quad
def cc(i,j):return C[tuple(sorted((fixed,i,j)))]
terms=[cc(a,b)*cc(c,d),cc(a,c)*cc(b,d),cc(a,d)*cc(b,c)]
T=sum(terms)
assert T*T-2*sum(z*z for z in terms) >= 0
short_checks+=1
table=[{'rank':r,'necessary_universal_parameter_lower_bound':1+(r-1)*math.log(2)/math.log(r)} for r in (2,3,4,8,16,64,128)]
result={
'status':'all exact assertions passed',
'proof_status':'self-contained mathematical proof in manuscript; symbolic and finite checks supplement it; no Lean formalization',
'symbolic_rank_two_boundary_identity':True,
'symbolic_strict_determinant_identity':True,
'symbolic_derivative_and_ratio_checks_ranks':symbolic,
'polarized_families':polarized,
'integer_example':{'coefficients':{''.join(str(i+1) for i in B):int(c) for B,c in C.items()},'characteristic_polynomials':chars,'principal_minors_checked':checks,'short_T2_relations_checked':short_checks,'failed_strong_relation_products':[154,16,16,16],'exact_failure_certificate':'154 > 9*16 = 144'},
'bound_table':table,
'scope':'No Millennium Prize problem or full pointwise finite-parameter question is claimed solved. Novelty is provisional.'
}
Path(output).write_text(json.dumps(result,indent=2)+'\n')
print(json.dumps({'status':result['status'],'polarized_families':polarized,'integer_example_minor_checks':checks,'integer_example_short_relations':short_checks,'bound_table':table},indent=2))
if __name__=='__main__':
p=argparse.ArgumentParser();p.add_argument('--output',default='verification_results.json')
main(p.parse_args().output)