back to table · edit · history · where entries came from · files · download
5352 bytes, as of the version from 2026-11-18 17:13 (current). Recorded here, not run.
"""Separate integer CM checker for the diagonal-quartic transcendental data.
Run with ordinary Python: python3 checks.py computed-values.json results.json.
No Sage, finite-field characters, Jacobi sums or production value() are used.
Assumptions: Gvirtz–Skorobogatov v2 Proposition 3.2 and Remark 3.10, translated
from H^2(1) to H^2. Checks are builder evidence, not an independent actor verdict.
"""
import json
from math import isqrt
import sys
DOCUMENTED = [(1, 2, 8), (1, -2, -8), (2, -2, -4),
(-2, 4, 8), (1, 2, -2), (1, 8, -8)]
def is_prime(n):
return n >= 2 and all(n % d for d in range(2, isqrt(n) + 1))
def expected_arguments():
triples = [(1, 1, 1)]
triples += [(1, 1, k) for h in range(1, 11) for k in (h, -h) if k != 1]
triples += DOCUMENTED
return [{'a': '.'.join(map(str, a)), 'p': p}
for a in triples for p in range(3, 98, 2)
if is_prime(p) and (a[0] * a[1] * a[2]) % p]
def mul(z, w):
a, b = z
c, d = w
return a*c-b*d, a*d+b*c
def cm_polynomial(a, p, conjugate=False):
if p % 4 == 3:
return [1, 0, -p*p]
# The primary Gaussian prime is found by its defining integer conditions.
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 # i modulo (x+i*y)
assert rho*rho % p == p-1
product = a[0]*a[1]*a[2]
residue = pow(product % p, (p-1)//4, p)
units = [(1, 0), (0, 1), (-1, 0), (0, -1)]
matches = [(u, v) for u, v in units if (u+rho*v) % p == residue]
assert len(matches) == 1
u, v = matches[0]
real, imag = mul((u, -v), mul((x, y), (x, y)))
assert real*real+imag*imag == p*p
return [1, -2*real, p*p]
def count_points_mod5(a):
c = (1,) + tuple(a)
total = sum((sum(cj * pow(xj, 4, 5) for cj, xj in zip(c, (x, y, z, w))) % 5 == 0)
for x in range(5) for y in range(5) for z in range(5) for w in range(5))
assert (total-1) % 4 == 0
return (total-1)//4
def check_records(records):
failures=[]
expected=expected_arguments()
if [r['params'] for r in records] != expected:
failures.append('enumeration/order differs from independently listed selection')
controls=[([1, 1, 1],5,[1,6,25]),([1,1,2],5,[1,-8,25]),
([1,1,-1],5,[1,-6,25]),([1,1,1],3,[1,0,-9]),
([1,1,1],13,[1,-10,169])]
known=all(cm_polynomial(a,p)==poly for a,p,poly in controls)
point_controls=[([1,1,1],0),([1,1,-1],12),([1,1,2],64)]
point_ok=all(count_points_mod5(a)==n for a,n in point_controls)
if not known or not point_ok:failures.append('known-answer control failed')
negative_counts={k:0 for k in ['altered_trace','wrong_Tate_scale','determinant_reversal','inert_sign','missing_coefficient_twist']}
cases=[]
for record in records:
params=record['params'];a=tuple(map(int,params['a'].split('.')));p=int(params['p'])
stored=record['coefficients'];oracle=cm_polynomial(a,p)
if stored != oracle or cm_polynomial(a,p,conjugate=True) != oracle:
failures.append({'params':params,'stored':stored,'oracle':oracle})
if len(stored)!=3 or any(type(c) is not int for c in stored) or stored[0]!=1 or abs(stored[2])!=p*p or abs(stored[1])>2*p:
failures.append({'params':params,'fault':'type/degree/constant/determinant/Weil bound'})
if stored[2]==-p*p and stored[1]!=0:failures.append({'params':params,'fault':'signed reciprocity'})
wrong=[stored[0],stored[1]+1,stored[2]]
negative_counts['altered_trace'] += wrong!=oracle
wrong=[1,stored[1],1 if p%4==1 else -1]
negative_counts['wrong_Tate_scale'] += wrong!=oracle
negative_counts['determinant_reversal'] += stored[::-1]!=oracle
if p%4==3:
negative_counts['inert_sign'] += [1,0,p*p]!=oracle
base=cm_polynomial((1,1,1),p)
negative_counts['missing_coefficient_twist'] += base!=oracle
cases.append({'params':params,'coefficients':stored,'cm_coefficients':oracle})
n=len(records)
negative_ok=(all(negative_counts[k]==n for k in ['altered_trace','wrong_Tate_scale','determinant_reversal'])
and negative_counts['inert_sign']>0 and negative_counts['missing_coefficient_twist']>0)
if not negative_ok:failures.append('deliberately wrong control did not fail')
return {'checked_entries':n,'total_entries':len(expected),'failures':failures,
'known_answer_control':known and point_ok,'negative_control_rejected':negative_ok,
'known_polynomials':controls,'projective_point_controls_mod5':point_controls,
'negative_controls_rejected':negative_counts,'comparisons':cases,
'method':'Exact integer Gaussian prime search and modular quartic residue symbol; both Gaussian conjugate choices checked.'}
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!='comparisons'},indent=2))
sys.exit(bool(result['failures']))