resume_independent.py

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

1519 bytes, as of the version from 2026-11-15 19:16 (current). Recorded here, not run.

"""Resume the exact checker from captured CHECK_ROW_JSON lines.

sage -python resume_independent.py interrupted.log original-rows.json results.json
All completed rows must match their original parameters and decimal strings.
The unchanged checks.main then validates controls and every stored interval.
This reuses only narrow, fully computed enclosures, not a pass verdict.
"""
import json,pathlib,sys,os
sys.path.insert(0,os.path.dirname(__file__))
import checks
from checks import R,narrow
log,inp,out=map(pathlib.Path,sys.argv[1:4])
assert __import__('hashlib').sha256(inp.read_bytes()).hexdigest() == 'c1acd850a3a296ad91690dd0164387d4bb1b3a9d0da07e1aad35ec392aff2bfd'
assert __import__('hashlib').sha256((pathlib.Path(__file__).parent/'checks.py').read_bytes()).hexdigest() == '95cf911f64f9b17de9de852f79e8e6290e9046d702b2563a4c063b1321520997'
allowed={(int(r['params']['p']),str(r['params']['v'])) for r in json.loads(inp.read_text())['rows']}
cache={}
for line in log.read_text().splitlines():
 if line.startswith('CHECK_ROW_JSON='):
  row=json.loads(line[len('CHECK_ROW_JSON='):]);p=int(row['params']['p']);v=row['params']['v']
  assert row['stored_contains_integral'] and row['stored_contains_direct'] is not False
  # Arb's string form includes outer brackets, absent from its parser input.
  y=R(row['integral_ball'].strip('[]'))
  assert narrow(y)
  assert (p,v) in allowed
  cache[p,v]=y
orig=checks.mellin
checks.mellin=lambda p,v:cache[p,str(v)] if (p,str(v)) in cache else orig(p,v)
checks.main(inp,out)