Research Atlas

Home / What 62 moments can detect / Interval verification of the original polynomial

Python program

Interval verification of the original polynomial

What 62 moments can detect

Python programwave11_certify_hankel_obstruction.py
"""Rational negative-Hankel witness from NEW actual directed theta moments.
The numerical guide only selects a fixed rational polynomial. The proof
evaluates that polynomial functional on the independent directed inputs.
Also certifies an exact interacting-pair escape and a graph-size-uniform
positive lower bound on total interaction for any62-moment match.
"""
from pathlib import Path
from fractions import Fraction as Q
from math import comb,factorial,isqrt
import hashlib,json
import mpmath as mp

P=Path(__file__).resolve().parent
mp.mp.dps=130;mp.iv.dps=110;iv=mp.iv
new=P/'wave11_theta62_certificate.json'
guide=P/'wave11_moment_obstruction_guide.json'
cert=json.loads(new.read_text());numeric=json.loads(guide.read_text())
K=31;N=16;lam=Q(27,100)

def exact(raw):return iv.make_mpf(tuple(tuple(map(int,z)) for z in raw))
def frac(raw):
    s,m,e,_=raw
    return (-1 if s else 1)*Q(int(m))*Q(2)**int(e)
def lo(x):return frac(x._mpi_[0])
def hi(x):return frac(x._mpi_[1])
def point(q):return iv.mpf(q.numerator)/q.denominator
def ends(x):return {'display_approximation':[mp.nstr(mp.mpf(x.a),85),mp.nstr(mp.mpf(x.b),85)],
                    'exact_binary':[[int(y) for y in z] for z in x._mpi_]}
def rational(q):return [str(q.numerator),str(q.denominator)]

mu={0:iv.mpf(1),2:iv.mpf(1)}
for k in range(4,63,2):mu[k]=exact(cert['theta_standardized_moments'][str(k)]['exact_binary'])
kap={};rad={}
for n in range(1,63):
    kap[n]=mu.get(n,iv.mpf(0))-sum((comb(n-1,j-1)*kap[j]*mu.get(n-j,iv.mpf(0)) for j in range(1,n)),iv.mpf(0))
    rad[n]=(1 if n%2==0 else 0)-sum(comb(n-1,j-1)*rad[j]*(1 if (n-j)%2==0 else 0) for j in range(1,n))
assert all((-1)**(j-1)*rad[2*j]>0 for j in range(1,32))
q=[iv.mpf(0)]+[kap[2*j]/rad[2*j]/point(lam)**j for j in range(1,32)]

# Fix one rational polynomial from the guide. The guide does not enter
# the final interval evaluation except via these exact selected decimals.
pg=[mp.mpf(0)]+[mp.mpf(t)/mp.mpf('.27')**j for j,t in enumerate(numeric['power_sums'][:31],1)]
H=mp.matrix([[pg[i+j+1] for j in range(15)] for i in range(15)])
v=mp.matrix([-pg[i+16] for i in range(15)])
chosen=mp.lu_solve(H,v)
c_decimal=[mp.nstr(t,90) for t in chosen]+['1']
c=list(map(Q,c_decimal))
alpha=[Q(0) for j in range(32)]
for i in range(16):
    for j in range(16):alpha[i+j+1]+=c[i]*c[j]
T=sum((point(alpha[j])*q[j] for j in range(1,32)),iv.mpf(0))
epsilon=Q(1,10**36)
assert hi(T)<-epsilon,ends(T)

# Explicit rational cumulant Lipschitz bound on moment box mu2j<=9*(2j-1)!!.
A=[Q(0)]+[Q(1,2**j*factorial(j)) for j in range(1,32)]
L=[Q(0)]
for j in range(1,32):L.append(A[j]+9*sum(A[l]*L[j-l] for l in range(1,j)))
C=sum(abs(alpha[j])*factorial(2*j)*L[j]/(abs(rad[2*j])*lam**j) for j in range(1,32))
assert C>0 and epsilon<18*C
exponent=1
while 18*C*Q(1,10**exponent)>epsilon:exponent+=1
assert 18*C*Q(1,10**exponent)<=epsilon

# Finite-LY variance1 gives M(h)<=exp(h^2/2). Coefficient extraction at
# h=sqrt(2j) and e<3 bound mu2j by B_j, without assuming coefficientwise
# Gaussian domination for the interacting law.
B=[Q(1)]+[Q(factorial(2*j)*3**j,(2*j)**j) for j in range(1,62)]
assert all(hi(mu[2*j])<B[j] for j in range(1,32))
Adom=[Q(0)]+[B[j]/factorial(2*j) for j in range(1,32)]
Dmoment=[0]
for j in range(1,32):
    bound=B[2*j-1]
    rootbound=isqrt(bound.numerator//bound.denominator)+1
    assert rootbound*rootbound>bound
    Dmoment.append(2*j*2**(2*j-1)*rootbound)
Lobs=[Q(0)]
for j in range(1,32):
    Lobs.append(Q(Dmoment[j],factorial(2*j))+sum(Adom[l]*Lobs[j-l] for l in range(1,j)))
Cobs=sum(abs(alpha[j])*factorial(2*j)*Lobs[j]/(abs(rad[2*j])*lam**j) for j in range(1,32))
assert Cobs>0
observable_bound=(epsilon/Cobs)**2
observable_exponent=1
while Q(1,10**observable_exponent)>observable_bound:observable_exponent+=1
assert Q(1,10**observable_exponent)<=observable_bound

# Exact small interacting graph: equal observed halves, q=e^-2J=1/2.
pairkap={}
for n in range(1,13):
    pairkap[n]=(Q(2,3) if n%2==0 else Q(0))-sum(comb(n-1,j-1)*pairkap[j]*(Q(2,3) if (n-j)%2==0 else Q(0)) for j in range(1,n))
pairp=[Q(0)]+[pairkap[2*j]/rad[2*j] for j in range(1,7)]
def det3(M):
    a,b,c=M[0];d,e,f=M[1];g,h,i=M[2]
    return a*e*i+b*f*g+c*d*h-c*e*g-b*d*i-a*f*h
pairdets={}
for off,expected in [(1,-Q(325,835982208)),(2,-Q(11675,3524500988928))]:
    det=det3([[pairp[i+j+off] for j in range(3)] for i in range(3)])
    assert det==expected<0
    pairdets[str(off)]=rational(det)

out={
 'status':'PASS actual theta violates independent/Gaussian-Rademacher Hankel condition through moment62',
 'scope':'finite-order independence obstruction and explicit required-interaction lower bound; not a general ferromagnetic obstruction or RH statement',
 'largest_even_moment':62,'Hankel_dimension':16,'Hankel_offset':1,
 'variance_standardized':True,'scale_lambda_exact_fraction':rational(lam),
 'polynomial_coefficients_ascending_exact_decimal':c_decimal,
 'quadratic_functional_coefficients_exact_fraction':[rational(t) for t in alpha],
 'target_normalized_cumulant_powers':{str(j):ends(q[j]) for j in range(1,32)},
 'negative_quadratic_form_enclosure':ends(T),
 'certified_negative_margin_exact_fraction':rational(epsilon),
 'cumulant_Lipschitz_coefficients_exact_fraction':[rational(t) for t in L],
 'functional_Lipschitz_constant_exact_fraction':rational(C),
 'total_interaction_lower_bound_exact_fraction':rational(epsilon/(18*C)),
 'coarse_uniform_total_interaction_lower_bound':'1e-'+str(exponent),
 'coarse_lower_bound_exactly_checked':True,
 'interaction_lower_bound_hypotheses':'finite zero-field J_ij>=0,w_i>=0, variance1, exact actual moments2..62; bound on sum_(i<j)J_ij',
 'observable_correlation_bound_hypotheses':'same finite ferromagnet; Delta=Var_J(X)-sum_i w_i^2; finite-LY subGaussian lemma',
 'observable_correlation_moment_bounds_exact_fraction':[rational(z) for z in B],
 'observable_moment_difference_integer_constants':list(map(str,Dmoment)),
 'observable_cumulant_Lipschitz_exact_fraction':[rational(z) for z in Lobs],
 'observable_functional_Lipschitz_constant_exact_fraction':rational(Cobs),
 'observable_variance_excess_lower_bound_exact_fraction':rational(observable_bound),
 'coarse_uniform_observable_variance_excess_lower_bound':'1e-'+str(observable_exponent),
 'interacting_pair':{'spin_count':2,'observation_weights':['1/2','1/2'],
                    'coupling':'log(2)/2','q_exp_minus2J':'1/2',
                    'all_positive_even_raw_moments':'2/3',
                    'normalized_cumulant_powers_exact_fraction':[rational(t) for t in pairp[1:]],
                    'negative_3x3_Hankel_determinants_exact_fraction':pairdets},
 'source_sha256':{z.name:hashlib.sha256(z.read_bytes()).hexdigest() for z in [new,guide,Path(__file__)]}}
dest=P/'wave11_hankel_obstruction_certificate.json'
dest.write_text(json.dumps(out,indent=2)+'\n')
print(json.dumps({'status':out['status'],'negative_form':out['negative_quadratic_form_enclosure']['display_approximation'],
                  'uniform_total_interaction_lower_bound':out['coarse_uniform_total_interaction_lower_bound'],
                  'uniform_observable_variance_excess_lower_bound':out['coarse_uniform_observable_variance_excess_lower_bound'],
                  'sum_absolute_polynomial_coefficients':float(sum(map(abs,c)))}))

The original records reflect the work at the time of writing. The article gives the final interpretation and scope.

Original file checksum · SHA-256566510d3e4e84a47579764956678d6da31e02e17be546033ed5dea9ce61bdef7