"""Certified contour bounds for the annulus theorem. Run with python-flint 0.9.""" from fractions import Fraction from functools import cache from math import prod from flint import arb, ctx ctx.prec = 160 def require(claim, label): if not claim: raise ArithmeticError(label) def D(q, i): return prod(1 - q ** (-s) for s in range(1, i + 1)) * prod( 1 - q ** (-s) for s in range(1, i) ) def check_tail(): q = Fraction(2) totals = [1, 1] for size in range(2, 24): def split(k): i = min(k, size - k) factors = prod( ((1 + q ** (1 - s)) * (1 + q ** (-s))) ** 2 for s in range(1, i + 1) ) return q ** (-k * (size - k)) * factors / D(q, i) totals.append( 1 + Fraction(4, 3) * sum(split(k) * totals[size - k] for k in range(1, size)) ) require(max(totals) < 2048, "initial composition bound") C, M, n = 2**16, 2048, 80 require( Fraction(4, 3) * C * 23 * Fraction(1, 2**23) < Fraction(1, 2), "tail induction" ) endpoint = 36 * Fraction(4, 3) * C * M * n * q ** (n // 2 - 2 * (n - 1) + 1) interior = 300000 * C * M * M * n * q ** (-(n - 4)) require(endpoint + interior < Fraction(1, 4), "tail contour") print("All ranks from 80 pass the analytic tail bounds.") def contour(q0, g, coarse): q = arb(q0) x = q.root(4) @cache def mass(k, l): i, j = sorted((k, l)) ratio = prod((1 + q ** (1 - s)) * (1 + q ** (-s)) for s in range(1, i + 1)) if coarse: K = 1 / D(q, i) else: K = D(q, i + j) / (D(q, i) * D(q, j)) ratio /= prod( (1 + q ** (1 - s - j)) * (1 + q ** (-s - j)) for s in range(1, i + 1) ) return K * q ** (-(g - 1) * k * l) * ratio**g @cache def row(j, a): if a == j: return arb(1) return mass(a, j - a) * sum( row(j - a, b) / (q ** (a + b) - 1) for b in range(1, j - a + 1) ) def bound(n, d): m, t = n - 1, d - 2 * n def gap(e): require(e != 0, "contour through pole") return abs(1 - x**e) error = sum( row(m, a) * (1 + x ** (2 * n + d)) / gap(4 * (a + 1) + t) for a in range(1, m) ) for k in range(1, m // 2 + 1): l = m - k left = sum(row(k, a) / gap(4 * (a - k) - t) for a in range(1, k + 1)) right = sum(row(l, b) / gap(4 * (b + 1 + k) + t) for b in range(1, l + 1)) if coarse: radial = (1 + x ** (4 * k + 4 + t)) ** (2 * g) else: radial = ( ((1 + x ** (4 * k + 4 + t)) * (1 + x ** (4 * k + t))) / ((1 + x ** (4 + t)) * (1 + x**t)) ) ** g factors = (1 + x**t) * (1 + x ** (4 + t)) * (1 + x ** (2 * n + d)) error += ( mass(k, l) * left * right * factors * q ** (-(g - 1) * k) * radial / (gap(t + 4 * k) * gap(t + 4 * k + 4) * (2 if k == l else 1)) ) return error return lambda n: [bound(n, d) for d in ((0,) if n % 2 else (-1, 1))] def verify(): check_tail() tables = [ (2, 2, True, range(11, 80)), (8, 2, True, range(3, 11)), (2, 2, False, (9, 10)), (2, 3, False, (7, 8)), (2, 4, False, (6,)), (2, 5, False, (5,)), (3, 2, False, range(5, 11)), (3, 3, False, (4,)), (3, 4, False, (3,)), *((q, 2, False, range(3, 11)) for q in (4, 5, 7)), ] for q, g, coarse, ranks in tables: bound = contour(q, g, coarse) for n in ranks: for E in bound(n): require(E < 1, f"q={q}, g={g}, n={n}, error {E}") print( f"q{' >=' if coarse else ' ='} {q}, g >= {g}, ranks {min(ranks)}..{max(ranks)} pass." ) sq = arb(2).sqrt() lam = arb(4) ** 5 / (2 * 5**5) C = (1 + sq) / (2 + 1 / sq) require( (2 * sq - 1) * lam + 3 * lam * C**5 / (2 * sq) < sq - 1, "special rank three" ) if __name__ == "__main__": verify()