back to table · edit · history · where entries came from · files · download
3417 bytes, as of the version from 2026-11-01 06:59 (current). Recorded here, not run.
"""Check the unchanged generating identity for numberdb.org/T643.
Download document-before.json and document-proposed.json (or rename the current
API document to document-proposed.json) beside this file. Run:
sage -python repair_check.py
This exact coefficient calculation imports neither the table generator nor its
checkers. It checks all 100 ordinary traces in the displayed generating identity,
its constant and principal terms, and its forbidden support through degree 200.
There are no new approximate values or rounded arguments in this layout repair.
"""
import hashlib
import json
from math import isqrt
from pathlib import Path
import platform
from sage.version import version as sage_version
base=Path(__file__).resolve().parent
before=json.loads((base/'document-before.json').read_text())
after=json.loads((base/'document-proposed.json').read_text())
old=before['Formulas']['formula-generating']
new=after['Formulas']['formula-generating']
canonical=new.replace(r'\begin{aligned}&','').replace(r'\\&','').replace(r'\end{aligned}','').replace('$','')
assert canonical == old.replace('$','')
assert before['Numbers'] == after['Numbers']
assert list(before) == list(after)
assert [k for k in before if before[k] != after[k]] == ['Formulas']
assert [k for k in before['Formulas'] if before['Formulas'][k] != after['Formulas'][k]] == ['formula-generating']
# Expand q times the displayed generating function with exact Python integers.
bound=201
product=[1]+[0]*bound
for n in range(4,bound+1,4):
for _ in range(6):
for k in range(n,bound+1):
product[k] += product[k-n]
eisenstein=[1]+[0]*bound
for a in range(1,bound//4+1):
for n in range(a,bound//4+1,a):
eisenstein[4*n] += 240*a**3
combined=[sum(eisenstein[k]*product[n-k] for k in range(n+1)) for n in range(bound+1)]
coefficient=[]
for n in range(bound+1):
coefficient.append(-(combined[n]+sum(2*(-1)**r*combined[n-r*r] for r in range(1,isqrt(n)+1))))
assert coefficient[0] == -1
assert coefficient[1] == 2
controls={3:-248,4:492,12:53008}
for d,value in controls.items():
assert coefficient[d+1] == value
assert coefficient[4] != -247 # deliberately incorrect trace must fail
assert all(coefficient[d+1] == 0 for d in range(1,201) if d%4 in (1,2))
checked=0
for d,row in after['Numbers']['1'].items():
value=row['number'] if isinstance(row,dict) else row
assert coefficient[int(d)+1] == int(value), d
checked += 1
assert checked == 100
print(json.dumps({'table':'T643','skill_manifest':'agents/runs/20261101T065245Z-repair-skills/manifest.json','skill_local_sha256':'a2b28d9953264d7b0ca62663785c2952190c5be6d6d3597fd695d9a54d606278','skill_live_sha256':'a2b28d9953264d7b0ca62663785c2952190c5be6d6d3597fd695d9a54d606278','sage_version':sage_version,'python_version':platform.python_version(),'identity_change':'display delimiters, alignment and line break only; all mathematical tokens and prose preserved','ordinary_traces_exactly_checked':checked,'zero_support_indices_checked':100,'known_answer_controls':controls,'wrong_answer_control_rejected':True,'all_400_stored_values_and_identifiers_unchanged':True,'limitations':'Only the displayed ordinary-trace generating identity was recomputed during repair. Higher Hecke orders were preserved, not recomputed. No interval or precision claim is introduced.','checker_sha256':hashlib.sha256(Path(__file__).read_bytes()).hexdigest()},indent=2))