Research Atlas

Home / One elliptic curve of rank two / Building the rank certificate

Python program

Building the rank certificate

One elliptic curve of rank two

Python programbsd_rank_two_certificate.py
#!/usr/bin/env python3
"""Rigorous analytic-rank-2 certificate for E34, using known modularity.

Exact coefficients come from finite-field point counts and Euler recurrences.
The central second derivative is enclosed by directed interval Boole
quadrature, a complex Cauchy derivative bound, and two analytic tails.
Conductor/sign are the verified published invariants of LMFDB 18496.j3.
This does not prove the full BSD leading-term formula or odd-primary Sha.
"""

import itertools
import json
from math import isqrt
from pathlib import Path
import mpmath as mp


def endpoints(value, places=65):
    def decimal(dyadic, upper):
        sign, mantissa, exponent, _ = dyadic
        numerator = -mantissa if sign else mantissa
        denominator = 1
        if exponent >= 0:
            numerator <<= exponent
        else:
            denominator <<= -exponent
        scale = 10 ** places
        numerator *= scale
        rounded = -((-numerator) // denominator) if upper else numerator // denominator
        whole, fraction = divmod(abs(rounded), scale)
        sign_text = "-" if rounded < 0 else ""
        return (f"{sign_text}{whole}.{fraction:0{places}d}".rstrip("0").rstrip("."))
    return [decimal(value._mpi_[0], False), decimal(value._mpi_[1], True)]


def coefficients(limit):
    spf = list(range(limit + 1))
    for p in range(2, limit + 1):
        if spf[p] == p:
            for multiple in range(p * p, limit + 1, p):
                if spf[multiple] == multiple:
                    spf[multiple] = p
    aps = {}
    for p in range(2, limit + 1):
        if spf[p] != p:
            continue
        if p in (2, 17):
            aps[p] = 0
            continue
        character_sum = 0
        for x in range(p):
            residue = (x ** 3 - 1156 * x) % p
            symbol = pow(residue, (p - 1) // 2, p)
            character_sum += -1 if symbol == p - 1 else symbol
        aps[p] = -character_sum
        assert aps[p] ** 2 <= 4 * p
    values = [0] * (limit + 1)
    values[1] = 1
    for n in range(2, limit + 1):
        p = spf[n]
        quotient, power = n, 0
        while quotient % p == 0:
            quotient //= p
            power += 1
        if p in (2, 17):
            values[n] = 0
        else:
            previous, current = 1, aps[p]
            for exponent in range(2, power + 1):
                previous, current = current, aps[p] * current - p * previous
            values[n] = current * values[quotient]
        assert abs(values[n]) <= 2 * n
    expected_first_20 = [0, 1, 0, 0, 0, -2, 0, 0, 0, -3, 0, 0, 0, -6, 0, 0, 0, 0, 0, 0, 0]
    assert values[:21] == expected_first_20
    return values, aps


def arithmetic_checks():
    for x, y in [(162, 2016), (578, 13872), (-2, 48), (-16, 120)]:
        assert y * y == x ** 3 - 1156 * x
    assert 4624 ** 2 == 272 ** 3 + 4624 * 272
    squares16 = {n * n % 16 for n in range(16)}
    obstructions = {}
    for d in [2, 34]:
        residues = {(d * u ** 4 + (4624 // d) * v ** 4) % 16
                    for u in range(16) for v in range(16)
                    if u % 2 or v % 2}
        assert residues == {2, 8, 10}
        assert residues.isdisjoint(squares16)
        obstructions[str(d)] = sorted(residues)
    # Signed squareclasses on primes 2 and 17 represented by generators -1,2,34.
    classes = set()
    for sign, two, thirty_four in itertools.product([0, 1], repeat=3):
        parity_two = (two + thirty_four) % 2
        parity_seventeen = thirty_four
        classes.add((-1) ** sign * 2 ** parity_two * 17 ** parity_seventeen)
    assert classes == {-34, -17, -2, -1, 1, 2, 17, 34}
    return {
        "E_squareclasses_all_represented": sorted(classes),
        "E_prime_locally_allowed_squareclasses": [1, 17],
        "E_prime_point": [272, 4624],
        "excluded_2_adic_residues_mod_16": obstructions,
        "rank": 2,
        "sha_2_primary": "0, using both exact isogeny Selmer sequences in the proof note",
    }


def central_vanishing_exact():
    """Unconditional Tunnell identity, in Ono (1997), equation (3).

    E34=E_2(17); L(E34,1)=Omega*a_2(17)^2/(2*sqrt(34)).
    Compute a_2(17) from eta(8z)eta(16z)Theta(4z), using integers only.
    """
    degree = 17
    product = [0] * (degree + 1)
    product[1] = 1  # q^(8/24+16/24)=q.
    for stride in (8, 16):
        for shift in range(stride, degree + 1, stride):
            for n in range(degree, shift - 1, -1):
                product[n] -= product[n - shift]
    theta = [0] * (degree + 1)
    theta[0] = 1
    for m in range(1, isqrt(degree // 4) + 1):
        theta[4 * m * m] = 2
    a2_17 = sum(product[n] * theta[degree - n] for n in range(degree + 1))
    assert a2_17 == 0

    # Independent finite enumeration of the classical even-n ternary counts.
    counts = {}
    solutions = {}
    for name, z_coefficient in [("C", 64), ("D", 16)]:
        triples = [(x, y, z)
                   for x in range(-isqrt(34 // 8), isqrt(34 // 8) + 1)
                   for y in range(-isqrt(34 // 2), isqrt(34 // 2) + 1)
                   for z in range(-isqrt(34 // z_coefficient), isqrt(34 // z_coefficient) + 1)
                   if 8 * x * x + 2 * y * y + z_coefficient * z * z == 34]
        counts[name] = len(triples)
        solutions[name] = triples
    assert counts == {"C": 4, "D": 8}
    assert 2 * counts["C"] == counts["D"]
    return {
        "source": "https://uva.theopenscholar.com/files/ken-ono/files/024.pdf",
        "identity": "L(E34,1)=Omega*a_2(17)^2/(2*sqrt(34))",
        "Omega": "integral_1^infinity dx/sqrt(x^3-x)",
        "a_2_modular_form": "eta(8z)*eta(16z)*Theta(4z)",
        "eta_product_through_degree_17": {str(n): value for n, value in enumerate(product) if value},
        "theta_through_degree_17": {str(n): value for n, value in enumerate(theta) if value},
        "a_2_17_exact": a2_17,
        "ternary_counts": counts,
        "ternary_solutions": solutions,
        "L_at_1_exact": 0,
        "L_prime_at_1_exact": "0 by root number +1 and L(1)=0",
        "bsd_assumed": False,
    }


def main():
    mp.mp.dps = 80
    mp.iv.dps = 50
    iv = mp.iv
    limit = 200
    coeffs, aps = coefficients(limit)
    nonzero = [(n, value) for n, value in enumerate(coeffs) if value]
    c = iv.pi / 68  # 2*pi/sqrt(18496), sqrt conductor exactly 136.
    L = 200
    steps = 40
    count = (L - 1) * steps
    assert count % 4 == 0
    h = iv.mpf(1) / steps
    total = iv.mpf(0)
    # Nodes are exact rational enclosures.  Evaluate finite q-series by
    # interval Horner; only one interval exponential is needed per node.
    for j in range(count + 1):
        x = iv.mpf(steps + j) / steps
        q = iv.exp(-c * x)
        polynomial = iv.mpf(coeffs[limit])
        for n in range(limit - 1, 0, -1):
            polynomial = polynomial * q + coeffs[n]
        polynomial *= q
        integrand = 2 * polynomial * iv.ln(x) ** 2
        weight = 7 if j in (0, count) else 14 if j % 4 == 0 else 12 if j % 4 == 2 else 32
        total += weight * integrand
    quadrature = 2 * h * total / 45

    # On complex circles radius1/2 about x in[1,200]:
    # |f_M(iz/136)|<4202 and |Log z|^2<37.
    # Cauchy gives this exact uniform sixth derivative bound for 2f_M Log^2.
    derivative_bound = 720 * 64 * 2 * 4202 * 37
    boole_error = iv.mpf(2 * (L - 1) * derivative_bound) * h ** 6 / 945
    q1 = iv.exp(-c)
    coefficient_tail = 8 / c ** 3 * q1 ** (limit + 1) / ((limit + 1) ** 2 * (1 - q1))
    qL = iv.exp(-c * L)
    logL = iv.ln(L)
    integration_tail = 4 * qL / (1 - qL) ** 2 * (
        logL ** 2 / c + 2 * logL / (L * c ** 2) + 2 / (L ** 2 * c ** 3))
    error = boole_error + coefficient_tail + integration_tail
    bound = mp.mpf(error.b)
    completed_second = quadrature + iv.mpf([-bound, bound])
    L_second = c * completed_second
    assert L_second.a > 0
    assert L_second.a > 12
    assert L_second.b < 14
    result = {
        "status": "rigorous interval certificate using known modularity, conductor/sign and unconditional Tunnell central-value identity",
        "curve": "y^2=x^3-1156*x",
        "lmfdb_label": "18496.j3",
        "cremona_label": "18496i2",
        "conductor": 18496,
        "sqrt_conductor": 136,
        "root_number": 1,
        "local_root_numbers": {"infinity": -1, "2": -1, "17": 1},
        "arithmetic": arithmetic_checks(),
        "exact_central_vanishing": central_vanishing_exact(),
        "a_n_through_200": coeffs,
        "prime_traces": {str(p): value for p, value in aps.items()},
        "coefficient_bound": "|a_n|<=d(n)*sqrt(n)<=2n for all n",
        "completed_function": "Lambda(s)=(136/(2*pi))^s*Gamma(s)*L(s)",
        "central_identity": "Lambda''(1)=2*int_1^infinity f(i*x/136)*(log x)^2 dx",
        "lower_derivatives": "L(1)=0 by exact a_2(17)=0 and Tunnell identity; L'(1)=0 by root number+1",
        "alternative_lower_order_argument": "algebraic rank2 excludes analytic rank0/1 by Gross-Zagier/Kolyvagin plus modularity",
        "conversion": "L''(1)=(pi/68)*Lambda''(1) since lower derivatives vanish",
        "quadrature": {"rule": "composite Boole", "interval": [1, L],
                       "h": "1/40", "nodes": count + 1,
                       "interval_precision_digits": iv.dps,
                       "sixth_derivative_bound": derivative_bound,
                       "value_interval": endpoints(quadrature),
                       "error_bound_interval": endpoints(boole_error)},
        "fourier_coefficient_tail_bound_interval": endpoints(coefficient_tail),
        "integration_tail_bound_interval": endpoints(integration_tail),
        "completed_second_derivative_interval": endpoints(completed_second),
        "L_second_derivative_interval": endpoints(L_second),
        "L_second_over_two_interval": endpoints(L_second / 2),
        "simple_outer_certificate": "12 < L''(1) < 14",
        "certified_analytic_rank": 2,
        "known_database_leading_term_numerical_comparison": "L''(1)/2 approximately6.3851519548627282465954",
        "full_bsd_proved": False,
        "sha_odd_primary_parts_proved": False,
        "global_sha_finiteness_proved": False,
        "sources": [
            "https://www.lmfdb.org/EllipticCurve/Q/data/18496.j3",
            "https://www.lmfdb.org/knowledge/show/ec.q.analytic_sha_order",
            "https://web.math.ucsb.edu/~castella/Kato-Schoen.pdf",
            "https://johncremona.github.io/papers/d2.pdf",
            "https://uva.theopenscholar.com/files/ken-ono/files/024.pdf",
        ],
    }
    output = Path(__file__).with_suffix(".json")
    output.write_text(json.dumps(result, ensure_ascii=False, indent=2) + "\n", encoding="utf-8")
    print(json.dumps({"output": str(output), "L_second": endpoints(L_second),
                      "analytic_rank": 2, "rank": 2, "sha_2_primary": "0",
                      "total_error_completed_derivative": endpoints(error)}, ensure_ascii=False))


if __name__ == "__main__":
    main()

The original records reflect the work at the time of writing. The article gives the final interpretation and scope.

Original file checksum · SHA-25671fbe924b0f8ab73bc1a10f759c244bc08cb6c203005052a63efbea4b2e9f2fc