back to table · edit · history · where entries came from · files · download
2632 bytes, as of the version from 2026-12-02 04:01 (current). Recorded here, not run.
"""Validate full primary/independent enclosures and exact stored uncertainties."""
import json,pathlib,hashlib,sys
from fractions import Fraction
from flint import ctx,arb,fmpq
import check_values as cv
W=pathlib.Path(__file__).resolve().parent;ctx.prec=1920
primary=json.loads((W/'primary-results.json').read_text())
check=json.loads((W/'check-results.json').read_text())
assert not check['failures'] and check['known_answer_control'] and check['negative_control_rejected']
sage=json.loads((W/'sage-versions.json').read_text())
assert sage['generator_sha256'] in {
hashlib.sha256((W/'generate-computed.py').read_bytes()).hexdigest(),
hashlib.sha256((W/'generate.py').read_bytes()).hexdigest()}
import ast
def executable_body(path):
tree=ast.parse(path.read_text());tree.body=tree.body[1:]
return ast.dump(tree,include_attributes=False)
assert executable_body(W/'generate.py')==executable_body(W/'generate-computed.py')
rows=[]
for cert in primary['certificates']:
m=cert['m'];p=cv.from_bounds(cert['value_interval'])
cp=json.loads((W/('independent-m'+str(m)+'.json')).read_text());v=cv.from_bounds(cp['interval'])
lo,hi,ulp=cv.claim(cert['stored_number'])
assert cv.fits(p,lo,hi) and cv.fits(v,lo,hi) and p.overlaps(v)
assert Fraction(cert['value_interval'][0])<Fraction(cert['value_interval'][1])
e=cv.from_bounds(cert['tail_error_interval']);assert e>0
rows.append({'m':m,'primary_bits':cert['accuracy_bits'],'independent_bits':cp['accuracy_bits'],
'primary_contains_no_zero':bool(p>0),'enclosures_overlap':True,
'full_primary_and_independent_inside_stored_uncertainty':True})
# Check the actual existing contextual row, independently of that table's code.
companion=json.loads((W/'companion-entry.json').read_text())
assert companion['tid']=='T885'
entry=companion['entry'];assert entry['params']=={'a':'5','d':'2'}
text=entry['number']
lo,hi,_=cv.claim(text);c2=cv.from_bounds(json.loads((W/'independent-m2.json').read_text())['interval'])
assert cv.fits(c2,lo,hi)
out={'checked_entries':29,'failures':[],'rows':rows,'T885_row':'5,2',
'T885_stored_uncertainty_contains_C2':True,
'computed_generator_sha256':sage['generator_sha256'],
'current_generator_sha256':hashlib.sha256((W/'generate.py').read_bytes()).hexdigest(),
'generator_executable_ast_identical':True,
'skill_manifest_sha256':'b115697c9321b4193a70f8fc1fda7a31aa492fbce8fc08f20b62363d72eab302'}
(W/'evidence-validation.json').write_text(json.dumps(out,indent=2)+'\n')
print('29 full primary/independent enclosures verified; T885 equality matches its actual row.')