stored_identity.py

back to table · edit · history · where entries came from · files · download

1914 bytes, as of the version from 2026-11-16 21:12 (current). Recorded here, not run.

"""Check the A/B algebraic identity on every stored T727 interval. Read-only.
Uses the build's preserved rigorous endpoint enclosures, not newly guessed roots.
"""
import os,sys,json,hashlib
from pathlib import Path
import numberdb.sage as numberdb
from sage.rings.real_arb import RealBallField
from sage.rings.rational_field import QQ
from numberdb._generate import _stored_entries
from checks import interval
if os.environ.get('NUMBERDB_KEY_FROM_STDIN')=='1':os.environ['NUMBERDB_API_KEY']=sys.stdin.read().strip()
p=Path(__file__).parent;R=RealBallField(600)
roots=json.loads((p/'endpoint-checkpoints.json').read_text())['roots']
def ball(text):return R(text[1:-1] if text.startswith('[') else text)
endpoints={r['n']:(ball(r['gamma']),[ball(x) for x in r['derivatives']]) for r in roots}
stored=_stored_entries(numberdb.table('T727'));checked=[]
for key,text in stored.items():
 n=int(key);a,da=endpoints[n];b,db=endpoints[n+1]
 gap=(b-a)**2
 A=gap*sum(-d[2]/d[0]+QQ(3)/4*(d[1]/d[0])**2 for d in [da,db])/3-2
 correction=gap*sum((d[1]/d[0])**2 for d in [da,db])/12
 lo,hi=interval(text);claim=R((lo,hi));residual=claim-A-correction
 assert residual.is_finite() and residual.contains_zero()
 assert residual> -2*(hi-lo) and residual<2*(hi-lo)
 assert lo<A+correction and A+correction<hi
 assert not (residual+QQ(1)/10**90).contains_zero()
 checked.append(n)
assert len(checked)==105
print('STORED_IDENTITY_JSON '+json.dumps({'table':'T727','checked_entries':len(checked),'identities':checked,'identity':'stored B - newly formed A - gap^2/12 * sum((Zsecond/Zfirst)^2) contains zero with radius limited by the stored unit','finite_nonvacuous_intervals':True,'negative_control_rejected':True,'independence':'Algebraic consistency using preserved rigorous FLINT endpoint input balls; not an independent campaign verdict','endpoint_sha256':hashlib.sha256((p/'endpoint-checkpoints.json').read_bytes()).hexdigest()}))