back to table · edit · history · where entries came from · files · download
1630 bytes, as of the version from 2026-11-20 03:35 (current). Recorded here, not run.
"""Check explicit-subgroup determinants from the two saved height routes.
No new height computation; this supplements the all-entry comparisons.
Sage dense determinant is compared to a rank<=3 permutation expansion of
independent PARI entries, preserving all propagated p-adic uncertainty.
"""
import numberdb.sage as numberdb
import sage.rings.polynomial.laurent_polynomial_ring
from sage.rings.integer_ring import ZZ
from sage.rings.padics.factory import Qp
from sage.matrix.constructor import matrix
from pathlib import Path
import itertools,json
w=Path(__file__).parent;ck=json.loads((w/'checkpoint.json').read_text());rows=[]
for o in ck['objects']:
p=o['p'];r=o['rank'];K=Qp(ZZ(p),prec=o['n_high']+50,print_mode='val-unit')
A={};B={}
for e in o['entries']:
for dest,key in [(A,'retained'),(B,'pari_high')]:
v=e[key];a=(K(ZZ(v['unit']))*K(ZZ(p))**v['valuation']).add_bigoh(v['precision'])
dest[e['i']-1,e['j']-1]=dest[e['j']-1,e['i']-1]=a
d=matrix(K,r,r,lambda i,j:A[i,j]).det();q=K(0)
for perm in itertools.permutations(range(r)):
inv=sum(perm[i]>perm[j] for i in range(r) for j in range(i+1,r));term=K((-1)**inv)
for i,j in enumerate(perm):term*=B[i,j]
q+=term
n=int(min(d.precision_absolute(),q.precision_absolute()));assert (d-q).valuation()>=n
rows.append({'key':o['key'],'label':o['label'],'rank':r,'sage_determinant':str(d),'pari_entry_permutation_determinant':str(q),'comparison_exponent':n,'status':'explicit-subgroup determinant; full lattice index not newly certified'})
print('DETERMINANTS '+json.dumps({'objects':len(rows),'comparisons':rows,'failures':[]},separators=(',',':')),flush=True)