"""Audit the elliptic system, its spectra, rational independence and numerical margins. Requires Python 3 and SymPy. No high tower is expanded. """ if not __debug__: raise RuntimeError("Certificate verification requires assertions enabled") from fractions import Fraction import sympy as S R = S.Rational C = S.zeros(8) B = S.zeros(8) def put(A, i, items): for j, v in items.items(): A[i, j] = v # (1,M0,M1,P0,P1,Q,E_b,U) put(C, 1, {2: 2}) put(B, 1, {1: -R(5, 6), 3: R(1, 2), 4: -R(1, 3), 5: R(1, 6)}) put(C, 2, {1: 2}) put(B, 2, {2: -R(7, 6), 3: -R(14, 9), 4: R(5, 18), 5: R(7, 12), 7: R(1, 9)}) put(C, 3, {3: R(17, 36), 4: R(14, 9), 7: -R(5, 18)}) put(B, 3, {3: -R(1, 3), 6: R(1, 3)}) put(C, 4, {3: R(28, 27), 4: R(163, 108), 7: -R(41, 108)}) put(B, 4, {3: R(1, 9), 4: -R(2, 3), 6: -R(1, 9)}) put(C, 5, {5: -R(11, 8), 7: -1}) put(B, 5, {5: -R(1, 2), 6: 1}) put(C, 6, {6: R(11, 8)}) put(C, 7, {7: -R(3, 8)}) put(B, 7, {6: R(7, 4), 7: -1}) x, y = S.symbols("x y") p = C.charpoly(y).as_expr() pencil = (C + x * B).charpoly(y).as_expr() assert S.gcd(p, S.diff(p, y)) == 1 assert ( S.factor( B.charpoly(y).as_expr() - y**2 * (y + 1) * (y + R(1, 2)) * (y + R(1, 3)) * (y + R(2, 3)) * (y + R(5, 6)) * (y + R(7, 6)) ) == 0 ) velocities = [] for a in C.eigenvals(): velocity = S.simplify( -S.diff(pencil, x).subs({x: 0, y: a}) / S.diff(pencil, y).subs({x: 0, y: a}) ) velocities.append(velocity) assert sorted(velocities) == [-1, -1, -1, -R(1, 2), -R(1, 2), -R(1, 2), 0, 0] print("Leading characteristic polynomial:", S.factor(p)) print("Residue characteristic polynomial:", S.factor(B.charpoly(y).as_expr())) print("First derivatives of eigenvalues:", sorted(velocities)) # Put ordinary Taylor coefficients modulo p into a linear relation tableau. # For each fixed degree <=18 coefficient polynomial in each of 8 functions, # a functional identity forces a corresponding null vector over the rationals. # A full rank minor mod p proves full rank over Q. prime = 1009 def modq(q): q = S.Rational(q) return int(q.p) * pow(int(q.q), -1, prime) % prime def invmat(a): n = len(a) a = [v[:] + [int(i == j) for j in range(n)] for i, v in enumerate(a)] for j in range(n): pivot = next(i for i in range(j, n) if a[i][j] % prime) a[j], a[pivot] = a[pivot], a[j] z = pow(a[j][j], -1, prime) a[j] = [t * z % prime for t in a[j]] for i in range(n): if i != j: z = a[i][j] a[i] = [(u - z * v) % prime for u, v in zip(a[i], a[j])] return [row[n:] for row in a] cm = [[modq(C[i, j]) for j in range(8)] for i in range(8)] bm = [[modq(B[i, j]) for j in range(8)] for i in range(8)] init = [1, 1, -R(1, 6), 1, 0, 2, 1, R(7, 4)] assert B * S.Matrix(init) == S.zeros(8, 1) jets = [[modq(t) for t in init]] def mul(mat, v): return [sum(x * y for x, y in zip(row, v)) % prime for row in mat] degree = 18 cols = 8 * (degree + 1) basis = {} for n in range(240): if n: jac = [ [((n if i == j else 0) - bm[i][j]) % prime for j in range(8)] for i in range(8) ] jets.append(mul(invmat(jac), mul(cm, jets[-1]))) row = [jets[n - j][i] if n >= j else 0 for i in range(8) for j in range(degree + 1)] for j in sorted(basis): t = row[j] if t: row = [(a - t * b) % prime for a, b in zip(row, basis[j])] lead = next((j for j, t in enumerate(row) if t), None) if lead is not None: scalar = pow(row[lead], -1, prime) basis[lead] = [x * scalar % prime for x in row] if len(basis) == cols: break assert len(basis) == cols print( "Polynomial relation tableau: rank", cols, "through Taylor order", n, "mod", prime ) # Coefficients of the elliptic integrals can also be checked directly by # integrating polynomials after x=1/2-u, y=u*v, with Jacobian u. u, v = S.symbols("u v") xx = R(1, 2) - u yy = u * v phase = yy**2 - xx**3 + 3 * xx face = -(xx**3) + xx**2 + 2 * xx + R(1, 4) def integral(poly): return sum( c * R(1, i + 1) * (R(2, j + 1) if j % 2 == 0 else 0) for (i, j), c in S.Poly(poly, u, v).terms() ) for n in range(6): coeff = [ int(n == 0), integral(u * phase**n), integral(u * xx * phase**n), integral(face**n) / 2, integral(xx * face**n) / 2, integral((v * v - R(11, 8)) ** n), R(11, 8) ** n, (R(11, 8) ** (n + 1) - (-R(3, 8)) ** (n + 1)) / (n + 1), ] assert [modq(t / S.factorial(n)) for t in coeff] == jets[n] print("Integral check: all eight columns, orders 0 through 5") delta = Fraction(1, 64) eta = delta a = 1 - 3 * delta b = 2 * (1 + delta) gamma = (1 + eta) * b / a assert gamma == Fraction(4225, 1952) < Fraction(5, 2) assert 8 * 17**2 * 128**2 < 2**26 print("Degree cap:", 8 * 17**2 * 128**2, "endgame exponent:", gamma) # Identical differential equations for every order, using Stokes on the # triangle and one-variable integration by parts on its boundary. z = S.symbols("z", nonzero=True) m0, m1, p0, p1, q0, eb, ea = S.symbols("M0 M1 P0 P1 Q0 Eb Ea") P = [p0, p1] for k in range(3): endpoint = R(1, 2) ** k * eb - (-R(1, 2)) ** k * ea derivative = k * P[k - 1] if k else 0 P.append((2 * z * (P[k + 1] + P[k]) + derivative - endpoint) / (3 * z)) def bx(k): return 2 * P[k] - (-R(1, 2)) ** k * q0 def by(k): return P[k] - 2 * P[k + 1] def dp(k): return -P[k + 3] + P[k + 2] + 2 * P[k + 1] + P[k] / 4 symbolic = S.Matrix([1, m0, m1, p0, p1, q0, eb, (eb - ea) / z]) dz = S.Matrix( [ 0, 2 * m1 + (-R(5, 6) * m0 + by(0) / 2 + bx(1) / 3) / z, 2 * m0 + (-R(7, 6) * m1 + by(1) / 2 + bx(2) / 3 - 2 * bx(0) / 3) / z, dp(0), dp(1), -R(11, 8) * q0 + (2 * ea - q0) / (2 * z), R(11, 8) * eb, (R(11, 8) * eb + R(3, 8) * ea) / z - (eb - ea) / z**2, ] ) assert ((C + B / z) * symbolic - dz).applyfunc(S.cancel) == S.zeros(8, 1) print("Eight differential identities: exact symbolic boundary reductions passed") # Exact margins and the size budget used for the all-height conclusion. e_symbol = S.symbols("e", integer=True, positive=True) loss = R(1, 64) q_choice = 128 * (e_symbol + 1) t_height = e_symbol / q_choice + loss / 8 height_margin = (loss - t_height - 3 * loss / 8).cancel() assert height_margin == 1 / q_choice # Use the least permissible slope, 3 - loss, for the error margin. alpha_min = 3 - loss - 1 / q_choice error_margin = alpha_min - loss / 8 - 1 - t_height - 2 + 2 * loss assert S.simplify(error_margin - loss / 4) == 0 assert gamma < Fraction(9, 4) assert (4 * Fraction(11901, 10**6)) ** 4 * 8**9 < 10**4 blocks = (3, 6, 6, 4, 6, 6, 6, 3) assert 5 + 48 * sum(blocks) == 1925 < 2000 print( "Threshold margins, determinant exponents, tower indices and extreme tail: passed" )