checks.py

back to table · edit · history · where entries came from · files · download

2701 bytes, as of the version from 2026-11-20 03:35 (current). Recorded here, not run.

"""Independent numerical construction and controls for T770.

Run compute.py in Sage with generate.py and points.txt beside it. PARI receives
only exact curve coefficients and affine points, never Sage's height values.
PARI constructs its rational Bernardi formal sigma and de Rham height [f,g]
and projects by f-ellpadics2*g. Its bilinear two-point call uses
(H(P+Q)-H(P-Q))/4, separate from the generator's /2 polarization.
Both implementations share the canonical mathematical definition and input
catalogue. They have distinct sigma constructions and implementations; this
is not a claim of logically disjoint mathematical assumptions.
"""
from sage.libs.pari import pari
from sage.rings.integer_ring import ZZ
from sage.rings.rational_field import QQ
from sage.matrix.constructor import matrix

def projected(E, pts, p, n):
    pe=pari(list(E.a_invariants())).ellinit()
    c=pe.ellpadics2(p,n)
    out={}
    for i,P in enumerate(pts):
        for j in range(i,len(pts)):
            Q=pts[j]
            a=[P[0],P[1]];b=[Q[0],Q[1]]
            fg=pe.ellpadicheight(p,n,a) if i==j else pe.ellpadicheight(p,n,a,b)
            out[i+1,j+1]=(fg[0]-c*fg[1]).sage()
    return out

def agrees(a,b,n):
    return (a.precision_absolute()>=n and b.precision_absolute()>=n
            and (a-b).valuation()>=n)

def control(label,E,pts,p,raw,h):
    results={}
    if p!=5:return results
    if label=='37a1':
        known=ZZ(5)+5**2+5**3+3*5**6+4*5**7+5**9
        assert (raw[1,1]-known).valuation()>=10
        results['known_37a1_mod_5_10']=True
    elif label=='389a1':
        assert pts[1]-pts[0]==E(-1,1)
        U=matrix(ZZ,[[-1,0],[1,1]])
        M=matrix([[raw[min(i,j),max(i,j)] for j in [1,2]] for i in [1,2]])
        A=U.transpose()*M*U
        known=[[3*5+2*5**2+5**4+5**5+5**7+4*5**9,
                5+4*5**2+5**3+2*5**4+3*5**5+4*5**6+5**7+5**8+2*5**9],
               [0,4*5+2*5**4+3*5**6+4*5**7+4*5**8]]
        for i,j in [(0,0),(0,1),(1,1)]:assert (A[i,j]-ZZ(known[i][j])).valuation()>=10
        results['known_389a1_transformed_full_matrix_mod_5_10']=True
    elif label=='5077a1':
        assert -pts[1]-pts[2]==E(-1,3)
        assert -sum(pts,E(0))==E(4,6)
        U=matrix(ZZ,[[0,0,-1],[-1,1,-1],[-1,0,-1]])
        assert U.det()==-1
        M=matrix([[raw[min(i,j),max(i,j)] for j in [1,2,3]] for i in [1,2,3]])
        A=U.transpose()*M*U
        known={(0,0):4+3*5+4*5**2+4*5**3,(0,1):4+4*5**2+2*5**3,
               (0,2):3*5+4*5**2+5**3,(1,1):3+4*5+3*5**2+5**3,
               (1,2):2+4*5,(2,2):1+3*5+5**2+5**3}
        for ij,v in known.items():assert (A[ij]-ZZ(v)).valuation()>=4
        results['known_5077a1_transformed_full_matrix_mod_5_4']=True
    return results