back to table · edit · history · where entries came from · files · download
7972 bytes, as of the version from 2026-12-02 04:00 (current). Recorded here, not run.
"""Builder's independent-formula checks, not an independent critique verdict.
Tested on SageMath 10.9 with numberdb 0.1.10. Run:
sage -python build_check.py --entries entries.json
sage -python build_check.py --table T859
The default output is JSON on stdout. A private draft needs NUMBERDB_API_KEY
or NUMBERDB_KEY_FROM_STDIN=1 with the key piped on stdin.
Every claimed decimal interval is checked against an explicitly summed
two-dimensional version of Ziff--Lorenz--Kleban (9), without a production
helper, plus their reciprocal theta product (10) with native Arb theta and
eta. The rectangular Gaussian truncation has a union bound for its exterior.
The native eta is independent of production's truncated eta product.
The same CFT input is shared; this is evaluation and normalization evidence,
not proof of the physical scaling-limit identification. The controller must
obtain a fresh independent scientific and argument-selection critique.
"""
import argparse
from fractions import Fraction
from functools import lru_cache
import json,re,sys,os
from pathlib import Path
import numberdb.sage as numberdb
from sage.rings.rational_field import QQ
from sage.rings.real_arb import RealBallField
from sage.rings.complex_arb import ComplexBallField
BITS=640
F=RealBallField(BITS); C=ComplexBallField(BITS)
def rational(x):
q=Fraction(str(x)); return QQ(q.numerator)/q.denominator
def expected_selection():
return [str(q) for q in sorted({Fraction(u,v) for v in range(1,7) for u in range(v,7)})]
@lru_cache(maxsize=256)
def eta(r):
e=C(0,F(r)).modular_eta()
assert e.real().is_finite() and e.imag().is_finite() and e.imag().contains_zero()
assert e.real().lower()>0 and e.real().accuracy()>BITS-30
return e.real()
def theta(t):
v=C(0).jacobi_theta(C(0,F(t)))[2]
assert v.real().is_finite() and v.imag().is_finite() and v.imag().contains_zero()
return v.real()
def gaussian_box(h,r):
alpha=F.pi()*F(h/r); beta=F.pi()*F(h*r)
target=F(2)**(-BITS+48)
def extent(c):
n=0
while True:
tail=2*(-c*(n+1)**2).exp()/(1-(-c*(2*n+3)).exp())
if tail.upper()<target.lower(): return n,tail
n+=1
nx,tx=extent(alpha); ny,ty=extent(beta)
# Direct two-dimensional sum, rather than production's theta product.
partial=sum(((-alpha*m*m-beta*n*n).exp()
for m in range(-nx,nx+1) for n in range(-ny,ny+1)),F(0))
sx=sum(((-alpha*m*m).exp() for m in range(-nx,nx+1)),F(0))
sy=sum(((-beta*n*n).exp() for n in range(-ny,ny+1)),F(0))
exterior=tx*(sy+ty)+sx*ty
return partial.add_error(exterior),{'x_extent':nx,'y_extent':ny,'exterior_bound':str(exterior.upper())}
@lru_cache(maxsize=256)
def partition_cross(r):
r=QQ(r); sums=[]; details=[]
for h in [QQ(8)/3,QQ(2)/3]:
s,d=gaussian_box(h,r); sums.append(F(h/r).sqrt()*s/eta(r)**2); details.append(d)
return (sums[0]-sums[1])/2,details
def reciprocal_product(r):
r=QQ(r)
return (F(QQ(3)/2).sqrt()/4)*(theta(QQ(3)*r/8)*theta(QQ(3)/(8*r))
-2*theta(QQ(3)*r/2)*theta(QQ(3)/(2*r)))/(eta(r)*eta(1/r))
def winding(r,a,b):
r=QQ(r); A=QQ(a*a)/r+b*b*r
return (F(QQ(6)/r).sqrt()*theta(6*A)/2
-F(QQ(8)/(3*r)).sqrt()*theta(QQ(8)*A/3)
+F(QQ(2)/(3*r)).sqrt()*theta(QQ(2)*A/3)/2)/eta(r)**2
def decimal_interval(text):
text=str(text)
m=re.fullmatch(r'([+-]?\d+)(?:\.(\d+))?(?:[eE]([+-]?\d+))?',text)
if not m: raise ValueError('Expected a stored ordinary decimal.')
if m.group(2) is None and m.group(3) is None:
center=rational(text); return center,center,QQ(0)
unit=QQ(10)**(int(m.group(3) or 0)-len(m.group(2) or ''))
center=rational(text); return center-unit,center+unit,unit
def narrow(v):
return bool(v.is_finite() and v.lower()>0 and v.upper()<1 and
(v.rad_as_ball()/abs(v)).upper()<(F(10)**-130).lower())
def matches(text,v):
if not narrow(v): return False
lo,hi,ulp=decimal_interval(text)
return bool(v.lower()>=lo and v.upper()<=hi)
def read_rows(args):
if args.table:
d=numberdb.table(args.table)
# Generator submission may normalize the one-parameter block to a map.
block=d['Numbers']
if isinstance(block,list): return block
return [{'params':{'r':str(k)},**(v if isinstance(v,dict) else {'number':v})}
for k,v in block.items()]
return json.loads(Path(args.entries).read_text())
def main():
parser=argparse.ArgumentParser(description=__doc__)
parser.add_argument('--entries'); parser.add_argument('--table')
args=parser.parse_args()
if os.environ.get('NUMBERDB_KEY_FROM_STDIN')=='1': numberdb.configure(api_key=sys.stdin.read().strip())
if not args.entries and not args.table: args.entries=str(Path(__file__).with_name('entries.json'))
rows=read_rows(args); failures=[]; comparisons=[]
identities=[str(row['params']['r']) for row in rows]
if identities!=expected_selection(): failures.append('Stored enumeration differs from the independently enumerated reduced shapes.')
square,unused=partition_cross(QQ(1))
known=bool(narrow(square) and square.lower()>QQ(309526275)/10**9
and square.upper()<QQ(309526276)/10**9)
sample=rows[0]['number']; lo,hi,ulp=decimal_interval(sample); center=(lo+hi)/2
shifted=str(center+10*ulp)
# matches() takes decimals, so compare the shifted interval explicitly.
perturb_rejected=not (square.lower()>=center+9*ulp and square.upper()<=center+11*ulp)
diagonally_wrong=winding(QQ(1),1,1)
both_direction=1-square-winding(QQ(1),1,0)-winding(QQ(1),0,1)
controls={'published_square':known,'ten_ulp_perturbation_rejected':perturb_rejected,
'two_color_factor_rejected':not matches(sample,2*square),
'diagonal_rank_one_rejected':not matches(sample,diagonally_wrong),
'both_direction_event_rejected':not matches(sample,both_direction),
'exact_zero_rejected':not matches(sample,F(0)),
'nan_rejected':not matches(sample,F('nan')),
'wide_ball_rejected':not matches(sample,F(0).add_error(F(100)))}
for row in rows:
r=rational(row['params']['r']); text=row['number']
direct,details=partition_cross(r); dual=reciprocal_product(r); rotation,_=partition_cross(1/r)
passed=matches(text,direct) and matches(text,dual) and direct.overlaps(dual) and direct.overlaps(rotation) and narrow(rotation)
if not passed: failures.append('Mismatch or invalid enclosure at r='+str(r))
lo,hi,ulp=decimal_interval(text)
comparisons.append({'r':str(r),'stored':text,'partition_ball':str(direct),
'reciprocal_product_ball':str(dual),'reciprocity':bool(direct.overlaps(rotation)),
'partition_accuracy_bits':int(direct.accuracy()),
'absolute_radius_upper':str(direct.rad_as_ball().upper()),
'difference_ulp_upper':str((abs(direct-dual)/ulp).upper()),
'box_bounds':details,'passed':bool(passed)})
for name,passed in controls.items():
if not passed: failures.append('Failed control: '+name)
print(json.dumps({'checked_entries':len(rows),'total_entries':len(rows),'failures':failures,
'known_answer_control':known,'negative_control_rejected':all(v for k,v in controls.items() if k!='published_square'),
'controls':controls,'control_values':{'published_square_lower':'0.309526275',
'published_square_upper':'0.309526276','diagonal_rank_one':str(diagonally_wrong),
'both_direction':str(both_direction),'perturbed_center':shifted},
'comparisons':comparisons,'working_bits':BITS,
'method':'Original bounded 2D partition sums plus native reciprocal product; independent native eta.',
'limitations':'Builder evidence only; shared CFT formula, no independent critique verdict and no proof of the physical limit.'},indent=2))
if failures: raise SystemExit(1)
if __name__=='__main__':main()