"""Interior-kernel lower bounds for the Li–Liu operator at N=2^k. python-flint 0.9.0 supplies rigorous balls. SciPy only chooses directions. Run with --levels 15 16 17 18 for the four moduli in the research notes. """ import argparse import math import numpy as np from flint import acb, acb_series, arb, ctx from scipy.linalg import eigh from experiment_dyadic import powers_of_five, primes_to def character_row(residues, modulus, point): """All odd log derivatives at 1/2 + point in common character order.""" shift = acb_series([point + arb(1) / 2, 1], prec=2) values, derivatives = [], [] for residue in residues: a = arb(int(residue)) / modulus diff = shift.zeta(a) - shift.zeta(1 - a) values.append(diff[0]) derivatives.append(diff[1]) den, num = acb.dft(values), acb.dft(derivatives) if any(z.contains(0) for z in den): raise ArithmeticError("The transform does not certify nonzero denominators.") log_n = arb(modulus).log() return [d / z - log_n for d, z in zip(num, den)] def model_factors(w, modulus, primes, cutoff): """Enclose D(w) and K without its two point-dependent Gamma ratios.""" z = acb_series([1 + w, 1], prec=3).zeta() diagonal = 2 * z[2] / z[0] - (z[1] / z[0]) ** 2 product = acb(1) for p, log_p in primes: x = (-w * log_p).exp() inv = x / (p - x) diagonal -= (log_p * inv) ** 2 if p == 2: diagonal -= log_p**2 * inv else: product *= 1 - ((1 - x) / (p - 1)) ** 2 # For n>P, bound n^(-2 Re w) by P^(-2 Re w), then integrate # (log t)^2/t^2 from P. This function decreases on [P,infinity). limit = arb(cutoff) lp = limit.log() d_tail = ((-2 * w.real * lp).exp() * (lp**2 + 2*lp + 2) / (limit * (1 - 1/limit)**2)) err = arb(0, d_tail.upper()) diagonal += acb(err, err) # The sum of |(1-p^-w)/(p-1)|^2 is <= 4/(P-1) in the omitted tail. # This accounts for the complex phase of the product as well. factor_err = arb(0, (4 / (limit - 1)).expm1().upper()) product *= 1 + acb(factor_err, factor_err) two = arb(2) model = ((w * (arb.pi() / modulus).log()).exp() * (2 - (-w * two.log()).exp()) * product * (1+w).zeta() * (1-w).zeta()) return diagonal, model def quadratic_form(matrix, coeff): n = len(coeff) return sum(coeff[i].conjugate() * matrix[i][j] * coeff[j] for i in range(n) for j in range(n)).real def mid_matrix(matrix): return np.array([[complex(z) for z in row] for row in matrix]) def scaled_int(x, digits, lower): endpoint = (x * 10**digits).lower() if lower else (x * 10**digits).upper() return int((endpoint.floor() if lower else endpoint.ceil()).unique_fmpz()) def enclosure(x, digits=8): def fmt(n): q, r = divmod(abs(n), 10**digits) return f"{'-' if n < 0 else ''}{q}.{r:0{digits}d}" return f"[{fmt(scaled_int(x, digits, True))}, {fmt(scaled_int(x, digits, False))}]" def accelerated_factors(w, modulus, primes, cutoff): """Enclosures with absolutely convergent corrections of order p^-4 and p^-3.""" def log_zeta_second(s): v = acb_series([s,1], prec=3).zeta() return 2*v[2]/v[0] - (v[1]/v[0])**2 diagonal = log_zeta_second(1+w) - log_zeta_second(2+2*w) - 2*log_zeta_second(3+3*w) product = (2+w).zeta()**2 / (acb(2).zeta()*(2+2*w).zeta()) for p, lp in primes: x = (-w*lp).exp() a = x/p a2, a3 = a*a, a*a*a diagonal -= lp**2 * ((2*a3 + a2*a2)/(1-a2)**2 - 2*a3/(1-a3)**2) local = 1 - (p*(1-x)/(p*p-x))**2 if p == 2: diagonal -= lp**2 * a/(1-a) product /= local else: product *= (1-((1-x)/(p-1))**2)/local limit = arb(cutoff) lp = limit.log() # For |a|<1/4 the absolute correction in the diagonal is <=8|a|^4. d_tail = 8*(lp**2+2*lp+2)/limit**3 err = arb(0,d_tail.upper()) diagonal += acb(err,err) # The relative residual per p is bounded by 16/(p-1)^3. err = arb(0,(8/(limit-1)**2).expm1().upper()) product *= 1+acb(err,err) return diagonal, ((w*(arb.pi()/modulus).log()).exp() * (2-(-w*arb(2).log()).exp()) * (1+w).zeta()*(1-w).zeta()*product) def evaluate(k, primes, cutoff, half_grid): n = 1 << k alpha, beta = 1 / arb(n).log(), arb(1) / 8 strip_width = beta - alpha if not (arb(n).log() > 10 and strip_width > 0): raise ValueError("This modulus is outside the operator's stated range.") re = (alpha + beta) / 2 indices = list(range(-half_grid, half_grid + 1)) points = [acb(re, arb(j) / 4) for j in indices] width = len(points) residues = powers_of_five(k) rows = {} for j in range(half_grid + 1): row = character_row(residues, n, acb(re, arb(j)/4)) rows[j] = row if j: rows[-j] = [row[-u % len(row)].conjugate() for u in range(len(row))] three_quarters = arb(3) / 4 gammas = [(three_quarters - s/2).gamma() / (three_quarters + s/2).gamma() for s in points] factors = [model_factors(acb(2*re, arb(d)/4), n, primes, cutoff) for d in range(width)] gram = [[None]*width for _ in points] kernel = [[None]*width for _ in points] for i, s in enumerate(points): for j in range(i + 1): zbar = points[j].conjugate() # All nodes are on the strip midline, so the cosecant is a sech. g = 1 / (4 * strip_width * (arb.pi() * (s.imag - points[j].imag) / (2*strip_width)).cosh()) gram[i][j] = gram[j][i] = acb(g) a, b = rows[indices[i]], rows[indices[j]] moment = sum(x*y.conjugate() for x, y in zip(a, b)) / len(a) diagonal, model = factors[i-j] entry = ((moment - diagonal - model * gammas[i]*gammas[j].conjugate()) / ((1+s)*(1+zbar))) if i == j: if not entry.imag.contains(0): raise ArithmeticError("Failed Hermitian diagonal check.") entry = acb(entry.real) kernel[i][j], kernel[j][i] = entry, entry.conjugate() # Gershgorin bounds provide a rigorous condition-number check. radii = [sum(abs(x) for j, x in enumerate(row) if j != i) for i, row in enumerate(gram)] if not all(gram[i][i].real > r for i, r in enumerate(radii)): raise ArithmeticError("Positive Gram lower bound not established.") condition_bound = max((gram[i][i].real + r).upper() for i,r in enumerate(radii)) / min( (gram[i][i].real - r).lower() for i,r in enumerate(radii)) _, vecs = eigh(mid_matrix(kernel), mid_matrix(gram)) norm_lb = arb(0) print(f"k={k} N={n} m={width} Gram condition number <= {enclosure(condition_bound)[1:-1].split(', ')[1]}") print(" central point quotient", enclosure(kernel[half_grid][half_grid].real / gram[half_grid][half_grid].real)) for name, vector in (("min", vecs[:, 0]), ("max", vecs[:, -1])): # Fix a Gaussian-integer vector. The scale cancels in its quotient. coeff = [acb(round(math.ldexp(z.real, 26)), round(math.ldexp(z.imag, 26))) for z in vector] den = quadratic_form(gram, coeff) if not den > 0: raise ArithmeticError("Uncertified Rayleigh denominator.") quotient = quadratic_form(kernel, coeff) / den print(f" {name} direction quotient {enclosure(quotient)}") print(" coefficients", [(int(x.real.unique_fmpz()), int(x.imag.unique_fmpz())) for x in coeff]) norm_lb = max(norm_lb, abs(quotient).lower()) if not norm_lb > 0: raise ArithmeticError("No positive operator norm lower bound obtained.") c2 = arb(1) for p, _ in primes[1:]: c2 *= 1 - 1 / arb(p - 1)**2 # For these real factors the tail lies in [1-1/(P-1),1]. c2 *= (1 - 1 / arb(cutoff-1)).union(arb(1)) delta = (2*c2 * arb(n).log()**3/n).sqrt() print(f" norm >= {scaled_int(norm_lb, 8, True)}/100000000 delta {enclosure(delta)}", flush=True) def main(): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("--levels", nargs="+", type=int, default=[15, 16, 17, 18]) parser.add_argument("--cutoff", type=int, default=50000) parser.add_argument("--half-grid", type=int, default=2) parser.add_argument("--bits", type=int, default=96) args = parser.parse_args() if min(args.levels) < 15 or max(args.levels) > 28 or args.cutoff < 4 or args.half_grid < 1: parser.error("Use 15 <= k <= 28, cutoff >= 4 and half-grid >= 1.") ctx.prec = args.bits primes = [(int(p), arb(int(p)).log()) for p in primes_to(args.cutoff)] print(f"bits={args.bits} prime cutoff={args.cutoff} nodes=(alpha+beta)/2 + j*i/4") for k in args.levels: evaluate(k, primes, args.cutoff, args.half_grid) if __name__ == "__main__": main()