back to table · edit · history · where entries came from · files · download
8378 bytes, as of the version from 2026-12-02 04:01 (current). Recorded here, not run.
"""T873: p-adic regulator squares of cyclic cubic fields.
Requires SageMath (p-adics and PARI) and the numberdb Python client.
sage -pip install numberdb
sage -python generate.py # offline computation, no writes
sage -python generate.py --verify # verify stored values with own key
sage -python generate.py --evidence # JSON field and local certificates
The default selection is all prime q = 1 (mod 3), q <= 73, and every prime
5 <= p <= 97 with p^((q-1)/3) = 1 (mod q), p != q. Parameters are q,p.
PARI polsubcyclo(q,3) fixes the exact field generator a. bnfinit(f,1) retains
exact units; bnfcertify(bnf) uses flag ZERO, certifying the FULL unit group.
The flag-one certificate is deliberately not used. polrootspadic gives all
simple p-adic roots. Their labels are increasing residue representatives.
Sage tracked-precision Iwasawa logs form the unscaled 2 by 2 minor squared.
Work starts 30 base-p digits beyond the requested relative digits and adapts.
Every return has >= digits decimal-equivalent relative accuracy, proved by
the exact inequality p^(N-v) >= 10^digits. No exact zeros are inferred.
A separate integer Hensel/series checker verifies each retained modulus.
The bounds are noncanonical small-conductor/local-prime reference budgets.
"""
import argparse
import json
import os
import sys
from functools import lru_cache
import numberdb.sage as numberdb
from sage.libs.pari import pari
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
from sage.rings.padics.factory import Qp
from sage.env import SAGE_VERSION
R = PolynomialRing(QQ, 'x')
TABLE = 'T873'
def primes(limit):
return [n for n in range(2, limit + 1)
if all(n % d for d in range(2, int(ZZ(n).isqrt()) + 1))]
def selected():
for q in primes(73):
if q % 3 == 1:
for p in primes(97):
if p >= 5 and p != q and pow(p, (q - 1) // 3, q) == 1:
yield {'q': q, 'p': p}
def needed(p, digits):
n = 0
while p**n < 10**digits:
n += 1
return n
def coeffs(poly):
return [str(poly.polcoef(j)) for j in range(3)]
def member(b, name):
return pari('b->b.' + name)(b)
@lru_cache(None)
def field(q):
assert ZZ(q).is_prime() and q % 3 == 1
f = pari.polsubcyclo(q, 3)
if f.type() == 't_VEC':
assert len(f) == 1
f = f[0]
assert f.polisirreducible()
b = pari.bnfinit(f, 1)
certificate = int(b.bnfcertify()) # full certificate, default flag 0
assert certificate == 1
disc = int(member(b, 'disc'))
assert disc == q*q
assert list(map(int, member(b, 'sign'))) == [3, 0]
u = list(b.bnf_get_fu())
assert len(u) == 2
for v in u:
assert abs(int(v.norm())) == 1
coordinates = b.nfalgtobasis(v)
assert all(c.denominator() == 1 for c in coordinates)
conjugates = list(pari.nfgaloisconj(b))
sigma = next(g for g in conjugates if g != pari('x'))
a = pari.Mod(pari('x'), f)
ga = pari.Mod(sigma, f)
assert f(ga) == 0 and ga != a
assert sigma(sigma(ga)) == a
images = [v.lift()(ga) for v in u]
exponent_columns = [list(map(int, b.bnfisunit(v))) for v in images]
for v, ex in zip(images, exponent_columns):
assert v == u[0]**ex[0] * u[1]**ex[1] * (-1)**ex[2]
M = [[exponent_columns[j][i] for j in range(2)] for i in range(2)]
record = {'q': q, 'polynomial': str(f), 'coefficients': [int(f.polcoef(j)) for j in range(4)],
'maximal_order_basis': [str(v) for v in b.nf_get_zk()],
'order_index': int(member(b, 'index')), 'discriminant': disc,
'signature': [3, 0], 'bnfcertify_flag': 0, 'bnfcertify_result': certificate,
'torsion_order': int(member(b, 'tu')[0]),
'units': [coeffs(v.lift()) for v in u],
'unit_norms': [int(v.norm()) for v in u],
'galois_generator': coeffs(sigma), 'galois_unit_matrix': M,
'galois_unit_torsion_exponents': [c[2] for c in exponent_columns]}
return b, f, record
def padic_record(z):
assert not z.is_zero()
p = int(z.parent().prime())
v, N = int(z.valuation()), int(z.precision_absolute())
assert N > v >= 0
return {'p': p, 'valuation': v, 'N': N,
'residue': str(int(z.lift()) % p**N),
'unit': str(int(z.unit_part().lift()) % p**(N-v))}
@lru_cache(None)
def compute(q, p, digits=100):
b, f, frec = field(q)
assert ZZ(p).is_prime() and p >= 5 and p != q
assert pow(p, (q - 1)//3, q) == 1
decomposition = b.idealprimedec(p)
assert len(decomposition) == 3
assert all(int(t[2]) == int(t[3]) == 1 for t in decomposition)
# All selected power orders have index prime to p; fail instead of
# guessing a residue label if this ceases to hold on an extension.
assert frec['order_index'] % p != 0
np = needed(p, digits)
A = np + 30
while True:
P = Qp(p, prec=A, print_mode='val-unit')
roots = sorted([P(t) for t in pari.polrootspadic(f, p, A)], key=lambda t: int(t.residue()))
assert len(roots) == 3 and len(set(int(t.residue()) for t in roots)) == 3
upolys = [R([QQ(c) for c in u]) for u in frec['units']]
L = [[u(r).log() for u in upolys] for r in roots]
assert all(z.valuation() >= 1 for row in L for z in row)
minors = [L[i][0]*L[j][1] - L[j][0]*L[i][1] for i,j in [(1,2),(0,2),(0,1)]]
d = minors[2]
S = d*d
if not S.is_zero() and S.precision_relative() >= np:
break
A *= 2
assert A <= 4096, 'Unresolved regulator; no exact-zero claim allowed'
# Retain exactly the requested modulus, rather than accidental guards.
v = int(S.valuation())
S = S.add_bigoh(v + np)
assert int(S.precision_absolute()) == v + np and p**int(S.precision_relative()) >= 10**digits
for j in range(2):
assert sum(L[i][j] for i in range(3)).is_zero()
assert all((t*t-S).is_zero() for t in minors)
record = {'q': q, 'p': p, 'relative_digits': np, 'working_absolute_digits': A,
'splitting_power_residue': pow(p, (q-1)//3, q),
'prime_decomposition': str(decomposition),
'ramification_and_residue_degrees': [[int(t[2]),int(t[3])] for t in decomposition],
'root_labels': [int(t.residue()) for t in roots],
'roots': [padic_record(t) for t in roots],
'logarithms': [[padic_record(z) for z in row] for row in L],
'signed_minors': [padic_record(t) for t in minors],
'square': padic_record(S)}
return S, record
class RegulatorSquares(numberdb.Generator):
table = TABLE
parameters = ('q', 'p')
type = 'Qp'
digits = 100
rigour = 'proven'
files = ('generate.py', 'independent_check.py', 'argument-selection.md',
'field-certificates.json', 'computation.json', 'check-results.json',
'research.md', 'skill-manifest.json', 'numerical-evidence.md')
def enumerate(self):
yield from selected()
def value(self, params, digits):
return compute(int(params['q']), int(params['p']), digits)[0]
def evidence():
rows = [compute(a['q'],a['p'])[1] for a in selected()]
return {'schema': 1, 'table': TABLE,
'skill_bundle_sha256': 'f20b09e3db5fd443660c0c6b29391ee369b7c710a43e22d8abb971ec3f54dd14',
'versions': {'SageMath': SAGE_VERSION, 'PARI': str(pari('version()')),
'Python': sys.version, 'numberdb': numberdb.__version__},
'fields': [field(q)[2] for q in sorted({a['q'] for a in rows})], 'rows': rows}
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--verify', action='store_true')
parser.add_argument('--evidence', action='store_true')
args = parser.parse_args()
if args.evidence:
print(json.dumps(evidence(), indent=2))
else:
g = RegulatorSquares()
if args.verify:
report = g.verify(sample=None)
print(report)
assert report.ok
else:
values = [g.value(params, g.digits) for params in g.enumerate()]
print('Computed %s certified p-adic values; no website writes.' % len(values))