back to table · edit · history · where entries came from · files · download
3277 bytes, as of the version from 2026-11-02 08:29 (current). Recorded here, not run.
"""Recheck T661 cube-base wording and all retained values. Run with Sage:
sage -python repair_checks.py records.json generate.py
The output is JSON; no website writes or credentials are needed.
"""
import numberdb.sage as numberdb
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.rings.real_arb import RealBallField
from sage.interfaces.gap import gap
import ast
from sage.env import SAGE_VERSION
import json,sys,importlib.util,hashlib
from pathlib import Path
from collections import Counter
from math import isqrt
root=Path(__file__).parent
records=json.loads((Path(sys.argv[1]) if len(sys.argv)>1 else root/'records.json').read_text())
gpath=Path(sys.argv[2]) if len(sys.argv)>2 else root/'generate.py'
spec=importlib.util.spec_from_file_location('attached_generator',gpath); g=importlib.util.module_from_spec(spec);spec.loader.exec_module(g)
def decimal(s):
text=str(s); a,_,e=text.lower().partition('e'); exponent=int(e or 0)
digits=len(a.split('.')[1]) if '.' in a else 0
return QQ(ZZ(a.replace('.','')))*QQ(10)**(exponent-digits), QQ(10)**(exponent-digits)
def spectrum(expr):
return dict(sorted(Counter(int(x) for x in ast.literal_eval(gap.eval('List(Irr('+expr+'),chi->chi[1])'))).items()))
controls={}
for expr,expected in [('CyclicGroup(2)',{1:2}),('SymmetricGroup(3)',{1:2,2:1}),('AbelianGroup([2,2,2])',{1:8}),('WreathProduct(AbelianGroup(IsPermGroup,[2,2,2]),SymmetricGroup(2))',{1:16,2:28})]:
actual=spectrum(expr);assert actual==expected,(expr,actual);controls[expr]=actual
assert list(g.CharacterDegreePowerSum().enumerate())==[r['params'] for r in records]
R=RealBallField(600); minimum=10000; exact=0; enclosed=0; cubes=[]
for r in records:
q,n,s=int(r['params']['q']),int(r['params']['n']),r['params']['s'];num=str(r['number'])
val=g.moment(q,n,s,160)
if s=='3':
assert val==ZZ(num);exact+=1
else:
center,ulp=decimal(num)
assert val.is_finite() and val.accuracy()>450
assert val.lower()>center-ulp and val.upper()<center+ulp
minimum=min(minimum,int(val.accuracy()));enclosed+=1
if n==2 and q>=8:
m=next(m for m in range(2,41) if m**3==q)
assert 2*q+4*(q*(q-1)//2)==2*q*q
if s=='3': assert ZZ(num)==4*q*q-2*q
else:
scale=ZZ(10)**140;a=isqrt(isqrt(2*scale**4));assert a**4<=2*scale**4<(a+1)**4
lower=2*q+QQ(4*(q*(q-1)//2)*a)/scale
upper=2*q+QQ(4*(q*(q-1)//2)*(a+1))/scale
assert center-ulp<lower<=upper<center+ulp
cubes.append({'m':m,'q':q,'s':s,'passed':True})
assert len(cubes)==78
print(json.dumps({'table':'T661','sage_version':SAGE_VERSION,'generator_sha256':hashlib.sha256(gpath.read_bytes()).hexdigest(),'skill_manifest':'agents/runs/20261101T225849Z-repair-skills/manifest.json','skill_sha256':{'local':'a2b28d9953264d7b0ca62663785c2952190c5be6d6d3597fd695d9a54d606278','live':'a2b28d9953264d7b0ca62663785c2952190c5be6d6d3597fd695d9a54d606278'},'ordered_enumeration_matches':True,'retained_cubic_values_exact':exact,'retained_noninteger_values_enclosed':enclosed,'minimum_recomputed_accuracy_bits':minimum,'gap_controls':controls,'cube_entries_independently_checked':cubes,'scope':'All 154 retained values recomputed with unchanged generator; 78 cube-slice values independently checked by orbit formula and exact fourth-root isolation. No new values.'},indent=2))