back to table · edit · history · where entries came from · files · download
10569 bytes, as of the version from 2026-11-18 16:47 (current). Recorded here, not run.
"""Independent geometric and point-count checks for T755.
Run: sage -python checks.py computed-values.json check-results.json
No import of generate.py or its character sums. The algebraic factor comes
from the 48 lines of Gvirtz–Skorobogatov v2 Appendix A, exact intersections,
and a rank-20 quotient; multiply the separate integer Gaussian CM factor
from Proposition 3.2 and Remark 3.10, and remove the ambient hyperplane.
A separate coefficient-weighted fourth-power histogram counts F_p and F_p^2
points for all rows. These are builder checks, not an independent actor verdict.
"""
import json
from functools import lru_cache
from itertools import product
from math import isqrt, comb
import sys
import numberdb.sage as numberdb
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.rings.finite_rings.finite_field_constructor import GF
from sage.rings.number_field.number_field import CyclotomicField
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.matrix.constructor import matrix
R = PolynomialRing(ZZ, 'T')
T = R.gen()
PAIRS = (((0,1),(2,3)), ((0,2),(1,3)), ((0,3),(1,2)))
LABELS = tuple((h,m,n) for h in range(3) for m in range(4) for n in range(4))
DOCUMENTED = ((1,2,8),(1,-2,-8),(2,-2,-4),(-2,4,8),(1,2,-2),(1,8,-8))
def expected_arguments():
models = [(1,1,1)] + [(1,1,k) for h in range(2,11) for k in (h,-h)] + list(DOCUMENTED)
return [{'a':'.'.join(map(str,a)), 'p':p} for a in models for p in range(3,32,2)
if all(p%d for d in range(2,isqrt(p)+1)) and (a[0]*a[1]*a[2])%p]
def cm_polynomial(a,p,conjugate=False):
# Separate Python integer implementation, no finite-field character or
# Jacobi evaluation. The primary Gaussian prime and residue symbol are
# recovered from their defining congruences.
if p%4 == 3:
return R([1,0,-p*p])
candidates=[(x,y) for x in range(-isqrt(p),isqrt(p)+1) for y in range(2,isqrt(p)+1,2)
if x*x+y*y==p and (x-1+y)%4==0 and (y-x+1)%4==0]
assert len(candidates)==1
x,y=candidates[0]
if conjugate:y=-y
rho=(-x*pow(y,-1,p))%p
assert rho*rho%p == p-1
residue=pow((a[0]*a[1]*a[2])%p,(p-1)//4,p)
units=[(1,0),(0,1),(-1,0),(0,-1)]
u,v=next((u,v) for u,v in units if (u+rho*v)%p==residue)
real=u*(x*x-y*y)+v*(2*x*y)
imag=u*(2*x*y)-v*(x*x-y*y)
assert real*real+imag*imag==p*p
return R([1,-2*real,p*p])
def line_matrix(field,h,r,s):
rows=[]
for (i,j),value in zip(PAIRS[h],(r,s)):
row=[field(0)]*4;row[i]=field(1);row[j]=-value;rows.append(row)
return matrix(field,rows)
@lru_cache(maxsize=1)
def intersection_quotient():
K=CyclotomicField(8);z=K.gen()
equations=[line_matrix(K,h,z**(2*m+1),z**(2*n+1)) for h,m,n in LABELS]
G=matrix(QQ,48,48)
for i in range(48):
G[i,i]=-2 # Adjunction for a line on a smooth quartic K3 surface.
for j in range(i):
rank=equations[i].stack(equations[j]).rank()
assert rank in (3,4)
G[i,j]=G[j,i]=1 if rank==3 else 0
assert G.rank()==20
basis=list(G.pivots());H=G.matrix_from_rows_and_columns(basis,basis)
assert H.det()!=0
C=G.matrix_from_columns(basis)*H.inverse()
assert C*H*C.transpose()==G
assert C.matrix_from_rows(basis)==matrix.identity(QQ,20)
return G,basis,H,C
@lru_cache(maxsize=None)
def line_action(a,p):
G,basis,H,C=intersection_quotient()
# All F_p* coefficients have fourth roots in F_(p^4); it also contains mu8.
F=GF(p**4,'v');z=F.multiplicative_generator()**((p**4-1)//8)
assert z.multiplicative_order()==8
alpha=(F(1),)+tuple(F(c).nth_root(4) for c in a)
assert all(u**4==F(c) for u,c in zip(alpha,(1,)+a))
roots=[]
for h,m,n in LABELS:
((i,j),(k,l))=PAIRS[h]
roots.append((h,z**(2*m+1)*alpha[j]/alpha[i],z**(2*n+1)*alpha[l]/alpha[k]))
lookup={v:i for i,v in enumerate(roots)};assert len(lookup)==48
permutation=[lookup[(h,r**p,s**p)] for h,r,s in roots]
assert sorted(permutation)==list(range(48))
assert G.matrix_from_rows_and_columns(permutation,permutation)==G
A=C.matrix_from_rows([permutation[i] for i in basis])
assert C*A==C.matrix_from_rows(permutation)
assert A*H*A.transpose()==H
assert A**4==matrix.identity(QQ,20)
# Hyperplane = four coplanar lines with fixed first pair root.
hyperplane=sum((C[i] for i in range(4)),C[0]*0)
assert hyperplane*A==hyperplane and hyperplane*H*hyperplane==4
algebraic=R(A.charpoly().reverse()(p*T))
quotient,remainder=algebraic.quo_rem(1-p*T)
assert remainder==0 and quotient.degree()==19 and algebraic.degree()==20
# A and its inverse have the same determinant by the preserved pairing.
assert A.charpoly()==A.inverse().charpoly()
return quotient,permutation,{'rank':20,'basis':basis,'basis_gram_det':str(H.det()),
'action_det':str(A.det()),'field_order':p**4}
@lru_cache(maxsize=None)
def weighted_histogram(p,r,c):
F=GF(p**r,'w');hist={}
for x in F:
y=F(c)*x**4
if r==1:index=int(y)
else:
coeffs=y.polynomial().list()+[0,0]
index=int(coeffs[0])+p*int(coeffs[1])
hist[index]=hist.get(index,0)+1
assert sum(hist.values())==p**r
return hist
def add_index(x,y,p,r):
if r==1:return (x+y)%p
return (x%p+y%p)%p+p*((x//p+y//p)%p)
def neg_index(x,p,r):
if r==1:return (-x)%p
return (-x%p)%p+p*((- (x//p))%p)
@lru_cache(maxsize=None)
def pair_histogram(p,r,c,d):
h=weighted_histogram(p,r,c);k=weighted_histogram(p,r,d);answer={}
for x,m in h.items():
for y,n in k.items():
z=add_index(x,y,p,r);answer[z]=answer.get(z,0)+m*n
assert sum(answer.values())==p**(2*r)
return answer
def point_count(a,p,r):
a=tuple(x%p for x in a)
h=pair_histogram(p,r,1,a[0]);k=pair_histogram(p,r,a[1],a[2])
count=sum(m*k.get(neg_index(x,p,r),0) for x,m in h.items())
assert (count-1)%(p**r-1)==0
return (count-1)//(p**r-1)
def raw_permutation_poly(permutation,p):
remaining=set(range(48));poly=R(1)
while remaining:
start=min(remaining);x=start;length=0
while x in remaining:
remaining.remove(x);length+=1;x=permutation[x]
assert x==start
poly*=1-(p*T)**length
return poly
def check_records(records,progress=None):
failures=[];cases=[]
expected=expected_arguments()
if [r['params'] for r in records]!=expected:failures.append('selection/order mismatch')
if len(records)!=238:failures.append('entry count is not 238')
known=(cm_polynomial((1,1,1),5)==R([1,6,25]) and cm_polynomial((1,1,2),5)==R([1,-8,25])
and [point_count(a,5,1) for a in [(1,1,1),(1,1,-1),(1,1,2)]]==[0,12,64])
if not known:failures.append('known-answer controls failed')
negative={'altered_coefficient':0,'wrong_Tate_scale':0,'determinant_reversal':0,
'unquotiented_48_lines':0,'missing_hyperplane_removal':0,'missing_twist':0}
for index,record in enumerate(records):
a=tuple(map(int,record['params']['a'].split('.')));p=int(record['params']['p'])
poly=R(record['coefficients']);alg,permutation,certificate=line_action(a,p)
tr=cm_polynomial(a,p);oracle=alg*tr
assert cm_polynomial(a,p,True)==tr
n1=point_count(a,p,1);n2=point_count(a,p,2)
predicted1=1+p+p*p-int(poly[1])
predicted2=1+p*p+p**4+int(poly[1])**2-2*int(poly[2])
if poly!=oracle:failures.append({'params':record['params'],'reason':'geometric all-coefficient mismatch','oracle':str(oracle)})
if (n1,n2)!=(predicted1,predicted2):failures.append({'params':record['params'],'reason':'point count mismatch','actual':[n1,n2],'predicted':[predicted1,predicted2]})
degree=poly.degree();lead=poly[degree]
structural=(degree==21 and poly[0]==1 and abs(lead)==p**21
and all(poly[degree-j]==(lead//p**(2*j))*poly[j] for j in range(11))
and all(abs(poly[j])<=comb(21,j)*p**j for j in range(22))
and all(type(c).__name__=='Integer' for c in poly.list()))
# For j <=10, p^(2j) divides leading coefficient p^21 exactly.
if not structural:failures.append({'params':record['params'],'reason':'exact type/weight/reciprocity/degree failure'})
if poly!=oracle+T*T:negative['altered_coefficient']+=1
if poly!=R(oracle(T*p)):negative['wrong_Tate_scale']+=1
if poly!=oracle.reverse():negative['determinant_reversal']+=1
if poly!=raw_permutation_poly(permutation,p)*tr:negative['unquotiented_48_lines']+=1
if poly!=(1-p*T)*oracle:negative['missing_hyperplane_removal']+=1
base=line_action((1,1,1),p)[0]*cm_polynomial((1,1,1),p)
if poly!=base:negative['missing_twist']+=1
case={'params':record['params'],'geometric_coefficients':[int(c) for c in oracle.list()],
'point_counts':[n1,n2],'predicted_counts':[predicted1,predicted2],
'transcendental_coefficients':[int(c) for c in tr.list()],
'primitive_algebraic_coefficients':[int(c) for c in alg.list()],
'line_permutation':permutation,'certificate':certificate,'structural':structural}
cases.append(case)
if progress:progress(index+1,case)
base3=line_action((1,1,1),3)[0]*cm_polynomial((1,1,1),3)
known=known and base3==(1-3*T)*(1-9*T*T)**10
negative_ok=(all(negative[k]==len(records) for k in negative if k!='missing_twist') and negative['missing_twist']>0)
if not negative_ok:failures.append('negative control not discriminating')
return {'checked_entries':len(records),'total_entries':238,'failures':failures,
'known_answer_control':bool(known),'negative_control_rejected':bool(negative_ok),
'negative_counts':negative,'cases':cases,
'independence':'48-line rank-20 quotient plus integer Gaussian CM; no production character sums. Point counts use fourth-power histograms. Shared Sage finite-field/matrix libraries and source conventions.',
'limitations':'Builder evidence only, not independent actor acceptance or a new correspondence theorem.'}
if __name__=='__main__':
records=json.load(open(sys.argv[1]));result=check_records(records)
with open(sys.argv[2],'w') as f:json.dump(result,f,indent=2);f.write('\n')
print(json.dumps({k:v for k,v in result.items() if k!='cases'},indent=2))
sys.exit(bool(result['failures']) or not result['known_answer_control'] or not result['negative_control_rejected'])