back to table · edit · history · where entries came from · files · download
8891 bytes, as of the version from 2026-11-16 22:11 (current). Recorded here, not run.
"""T728 builder checks, not an independent campaign verdict.
sage -python checks.py (offline); download all attached dependencies beside it.
FLINT Hardy jets/gamma-envelope ratios are checked with mpmath zeta derivatives
and a scaled analytic Xi Cauchy contour. The numerical comparisons are heuristic;
rigorous bounds come from the FLINT input/output balls and exact serialization.
Progress JSON records permit checkpoints to survive interrupted executions.
"""
import os,sys,json,time,hashlib,platform
from pathlib import Path
from decimal import Decimal
from math import factorial
import numberdb.sage as numberdb
from sage.rings.rational_field import QQ
from sage.rings.real_arb import RealBallField
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.env import SAGE_VERSION
import mpmath as mp
from generate import bridge,compute_zero,pair_value,endpoint_q,XiStrongLehmerCondition,ZERO_INDICES,PAIR_INDICES,WORKING_GUARD
from check import exactness,exact_in_disguise,measure,names_its_rings
from numberdb._write import to_text
def rational(text):
d=Decimal(str(text));sign,digits,exponent=d.as_tuple()
return QQ(int(''.join(map(str,digits)) or '0')*(-1 if sign else 1))*QQ(10)**exponent
def interval(text):
text=str(text).strip()
if '+/-' in text:
c,r=text.strip('[]').split('+/-'); c,r=rational(c.strip()),rational(r.strip());return c-r,c+r
if text.startswith('['):
a,b=text.strip('[]').split(',');return rational(a.strip()),rational(b.strip())
c=rational(text);u=QQ(10)**Decimal(text).as_tuple().exponent;return c-u,c+u
def inside(value,text):
a,b=interval(text)
return (not hasattr(value,'is_finite') or value.is_finite()) and a<value<b
def mp_endpoint(t):
s=mp.mpf(1)/2+mp.j*t
z1,z2,z3=[mp.zeta(s,derivative=k) for k in (1,2,3)]
u=1/s+1/(s-1)-mp.log(mp.pi)/2+mp.digamma(s/2)/2
up=-1/s**2-1/(s-1)**2+mp.polygamma(1,s/2)/4
v=z2/z1;w=z3/z1
q=w-v*v-u*v+3*up-u*u
assert abs(mp.im(q))<mp.mpf(10)**(-mp.mp.dps+15)
return mp.re(q),abs(mp.im(q))
def main():
start=time.monotonic(); R=RealBallField(600);rows=[];endpoints=[];controls=[]
ev={'table':'T728','stage':'build','skill_manifest':'../20261116T213041Z-build-skills/manifest.json','versions':{'python':platform.python_version(),'sage':SAGE_VERSION,'flint':bridge().flint_version(),'mpmath':mp.__version__,'numberdb':numberdb.__version__},'working_guard_bits':WORKING_GUARD,'rows':rows,'controls':controls,'failures':[]}
P=PolynomialRing(QQ,'t');t=P.gen()
for f,expected in [(t*(t-1),QQ(8)),(t*(t-1)*(t-3),QQ(82)/9)]:
ds=[tuple(f.derivative(k)(x) for k in (1,2,3)) for x in (0,1)]
got=sum(-d[2]/d[0]+(d[1]/d[0])**2 for d in ds)
wrong=sum(-(d[2]/6)/d[0]+((d[1]/2)/d[0])**2 for d in ds)
assert got==expected and wrong!=expected
controls.append({'polynomial':str(f),'expected':str(expected),'got':str(got),'wrong_factorials_rejected':True})
# Product-rule envelope identity, including the sign of ell and coefficient 3.
f=t*(t-1)*(t-3);a=t*t+t+2;g=a*f
for x in (0,1):
q=lambda h:-h.derivative(3)(x)/h.derivative()(x)+(h.derivative(2)(x)/h.derivative()(x))**2
ell=a.derivative()(x)/a(x);ep=a.derivative(2)(x)/a(x)-ell**2;r=f.derivative(2)(x)/f.derivative()(x)
assert q(g)==q(f)+ell*r-3*ep+ell**2
controls.append({'exact_product_rule_identity':True})
assert bridge().count(0,128)==0 and bridge().count(20,128)==1
roots=json.loads(Path(__file__).with_name('finite-prefix-roots.json').read_text())
prefix=[RealBallField(96)(x.split('[',1)[1].rsplit(']',1)[0]) for x in roots]
assert len(prefix)==6712
prev=R(0)
for text,v in zip(roots,prefix):
assert text.startswith('0.50000000000000000000000000000 + [') and v.is_finite() and v>prev
prev=v
nxt=bridge().zero(6713,96).imag();cutoff=(prev.center().exact_rational()+nxt.center().exact_rational())/2
assert prev<cutoff<nxt and bridge().count(cutoff,128)==6712
ev['finite_indexing_certificate']={'root_list_file':'finite-prefix-roots.json','root_file_sha256':hashlib.sha256(Path(__file__).with_name('finite-prefix-roots.json').read_bytes()).hexdigest(),'origin':'T726 build finite-prefix input artifact; recomputed count, ordering and selected-endpoint consistency here','distinct_critical_line_roots':6712,'cutoff':str(cutoff),'N_at_cutoff':6712,'conclusion':'6712 distinct critical-line roots exhaust the count with multiplicity, proving finite simplicity and numbering without RH'}
assert list(XiStrongLehmerCondition().enumerate())==[{'n':str(n)} for n in PAIR_INDICES]
gammas={};qvalues={}
for n in ZERO_INDICES:
gamma,d=compute_zero(n,100);gh,dh=compute_zero(n,120)
assert gamma.overlaps(prefix[n-1]) and gamma.overlaps(gh)
for v,vh in zip(d,dh): assert v.overlaps(vh)
q=endpoint_q(gamma,d);qh=endpoint_q(gh,dh);assert q.overlaps(qh)
c=gamma.center().exact_rational();delta=QQ(1)/10**6
assert bridge().count(c-delta,128)==n-1 and bridge().count(c+delta,128)==n
gammas[n]=gamma;qvalues[n]=q
e={'n':n,'gamma':str(gamma),'derivatives':list(map(str,d)),'minus_Q_Xi':str(q),'left_count':n-1,'right_count':n}
endpoints.append(e);print('ENDPOINT_JSON '+json.dumps(e),flush=True)
vals={};texts={}
for n in PAIR_INDICES:
v=pair_value(n,100);vh=pair_value(n,120);text=to_text(v,100)
assert type(v).__name__=='RealBall' and v.overlaps(vh) and inside(v,text) and inside(vh,text)
vals[str(n)]=v;texts[n]=text
row={'n':n,'number':text,'ball':str(v),'accuracy_bits':int(v.accuracy()),'high_ball':str(vh)};rows.append(row)
print('ROW_JSON '+json.dumps(row),flush=True)
assert not exactness(vals) and not exact_in_disguise(vals) and not names_its_rings(str(Path(__file__).with_name('generate.py')))
assert not inside(vals['1']+QQ(1)/10**90,texts[1]) and not inside(vals['2'],texts[1])
controls.append({'perturbed_decimal_rejected':True,'wrong_pair_index_rejected':True})
print('FLINT_STAGE_JSON '+json.dumps({'rows':rows,'endpoints':endpoints,'controls':controls,'certificate':ev['finite_indexing_certificate']}),flush=True)
for dps in (130,165):
with mp.workdps(dps):
zs={};qs={};mpends=[]
for n in ZERO_INDICES:
mid=gammas[n].center().exact_rational();guess=mp.mpf(str(mid.numerator()))/mp.mpf(str(mid.denominator()))
z=mp.findroot(mp.siegelz,(guess-mp.mpf('1e-110'),guess+mp.mpf('1e-110')),solver='secant')
assert abs(mp.siegelz(z))<mp.mpf(10)**(-dps+15)
assert inside(rational(mp.nstr(z,dps)),str(gammas[n])) or abs(rational(mp.nstr(z,dps))-gammas[n])<R(10)**(-120)
q,imerr=mp_endpoint(z);zs[n]=z;qs[n]=q
assert abs(rational(mp.nstr(q,dps))-qvalues[n])<R(10)**(-115)
rec={'n':n,'dps':dps,'root':mp.nstr(z,dps),'minus_Q_Xi':mp.nstr(q,dps),'imaginary_error':mp.nstr(imerr,8)}
mpends.append(rec);print('MP_ENDPOINT_JSON '+json.dumps(rec),flush=True)
for row in rows:
n=row['n'];v=(zs[n+1]-zs[n])**2*(qs[n]+qs[n+1])
assert inside(rational(mp.nstr(v,dps)),texts[n]);row[f'mpmath_{dps}dps']=mp.nstr(v,dps)
print('MP_STAGE_JSON '+json.dumps({'dps':dps,'rows':rows}),flush=True)
print('all 105 product-rule comparisons',dps,'dps complete, seconds',time.monotonic()-start,flush=True)
sample=[1,34,100,6707,6708,6709,6710,6711];contour=[]
for dps,N in ((130,96),(165,128)):
with mp.workdps(dps):
cs={};zs={};radius=mp.mpf(1)/4
for n in sorted(set(sample)|{n+1 for n in sample}):
mid=gammas[n].center().exact_rational();guess=mp.mpf(str(mid.numerator()))/mp.mpf(str(mid.denominator()))
z=mp.findroot(mp.siegelz,guess);zs[n]=z;rho=mp.mpf(1)/2+mp.j*z
def scaled_Xi(w):
s=mp.mpf(1)/2+mp.j*w
logratio=-(s-rho)*mp.log(mp.pi)/2+mp.loggamma(s/2)-mp.loggamma(rho/2)
return s*(s-1)/(rho*(rho-1))*mp.exp(logratio)*mp.zeta(s)
samples=[scaled_Xi(z+radius*mp.exp(2*mp.pi*mp.j*j/N)) for j in range(N)]
ds=[factorial(k)*sum(samples[j]*mp.exp(-2*mp.pi*mp.j*j*k/N) for j in range(N))/(N*radius**k) for k in (1,2,3)]
q=-ds[2]/ds[0]+(ds[1]/ds[0])**2
assert abs(mp.im(q))<mp.mpf(10)**(-110);cs[n]=mp.re(q)
for n in sample:
v=(zs[n+1]-zs[n])**2*(cs[n]+cs[n+1]);assert inside(rational(mp.nstr(v,dps)),texts[n])
rec={'n':n,'dps':dps,'points':N,'radius':'1/4','value':mp.nstr(v,dps)};contour.append(rec)
print('CONTOUR_JSON '+json.dumps(rec),flush=True)
print('Cauchy subset complete',dps,N,'seconds',time.monotonic()-start,flush=True)
ev.update(total_entries=105,checked_entries=105,known_answer_control=True,negative_control_rejected=True,minimum_value_accuracy_bits=min(r['accuracy_bits'] for r in rows),native_return_type='sage.rings.real_arb.RealBall',contour_checks=contour,endpoints=endpoints,size=measure(texts),seconds=time.monotonic()-start)
ev['source_sha256']={name:hashlib.sha256(Path(__file__).with_name(name).read_bytes()).hexdigest() for name in ['generate.py','hardy_arb.pyx','checks.py','check.py','argument-selection.md','skill-manifest.json','finite-prefix-roots.json']}
print('EVIDENCE_JSON '+json.dumps(ev),flush=True)
if __name__=='__main__':main()