"""Job #1398, type explore: does the paper's OWN recommended instrument pay the (D1) small-gcd deficit at the record's composite modulus? Route 29's step sends the completed (D1) per-pair object -- a bilinear form at the FIXED composite modulus c = q e1 e2 with summation lengths x^(51/100) (the pair numerator R) and x^(39/100) (the completion mode k) -- to Blomer-Pascadi arXiv:2607.24311v1. Job #1392 read obligation 1 (Theorem 5.5, the unequal-lengths reduction) and measured that it fails. The paper names a different instrument for this shape ("For nearly-square-free moduli, it is better to use Theorem 5.2 directly"), and Theorem 5.2 is the factorization-AWARE bound: it sees c2 = the square-full part of c, which Theorem 5.5 deliberately forgets. This script instantiates Theorem 5.2 exactly at the record's own factorization c = q e1 e2, in BOTH orientations, with c2 kept symbolic (zeta = log_c c2), and decides the deficit. It also prices Theorem 5.7, the only instrument in the paper whose coprimality hypothesis is the record's own ((m,c)=1, not (m,n,c)=1). Everything is exact rational exponent arithmetic. No enumeration, no floating point, no re-derivation of anything returns #626/#629 already fixed. The orientation question, which decides whether the comparison is 1/380 or 7/608, is settled by an identity rather than by a convention: S(a m, n; c) = S(a n, m; c) for every unit a, because the substitution x -> a x is a bijection on (Z/cZ)^x and turns a m x^-1 + n x into m x^-1 + a n x. So BOTH assignments of the two intervals to (M, N) are legitimate bounds for the same sum, and the best of the two must be taken. Check B2 verifies the identity exactly, over primes, in Z[zeta_p]; the first draft of this script asserted the opposite (that the orientation was forced) and that assertion is what this control caught. Claims checked, in order: A. Regression: the record's own chain and top sector, unchanged. B. The object, the orientation identity, and the honest trivial bound. C. Theorem 5.2 (5.3)-(5.4), exact, at the record's two lengths, BOTH orientations, with c2 symbolic; the c2 thresholds; and the comparison with Theorem 5.5's leading term. D. Theorem 5.7, exact, both orientations; and why it is the instrument that matches the record's coprimality. E. Theorem 1.1's improvement window, the padding that buys the route its range claim, and the baseline against which that claim is measured. F. Verdict: the ranking of every instrument, the requirement, and the exact shortfall. One JSON object on stdout so stdout is byte-reproducible; run: python artifacts/check-thm52.py [--out out.json] """ import json import os import sys import time from fractions import Fraction as F _T0 = time.time() RESULTS = [] def check(name, ok, detail=None): RESULTS.append({"check": name, "ok": bool(ok), "detail": detail}) return bool(ok) def fr(x): x = F(x) return "%d/%d" % (x.numerator, x.denominator) if x.denominator != 1 else str(x.numerator) # ------------------------------------------------------------------ A. record regression a_top, b_top, sigma = F(14, 25), F(1, 2), F(1, 20) alpha, E = a_top + b_top - 1, b_top - sigma majorant = F(3, 2) * sigma + 3 * E cauchy = a_top + sigma block = (majorant + cauchy) / 2 budget_moment = 2 - cauchy deficit_x = majorant - budget_moment check("A1 record chain unchanged: majorant 57/40, Cauchy 61/100, block 407/400", (majorant, cauchy, block) == (F(57, 40), F(61, 100), F(407, 400)), "%s %s %s" % (fr(majorant), fr(cauchy), fr(block))) check("A2 sufficient moment budget 139/100 and required deficit 7/200 (x-units)", (budget_moment, deficit_x) == (F(139, 100), F(7, 200)), "%s / %s" % (fr(budget_moment), fr(deficit_x))) # ------------------------------------------------------- B. the object and its orientation gamma = sigma + 2 * E # c ~ x^gamma lenR = alpha + E # |R| <= A*E, the pair numerator lenk = gamma - a_top # c/|I_m|, the completion mode range check("B1 c ~ x^(19/20); lengths x^(51/100) (R) and x^(39/100) (k)", (gamma, lenR, lenk) == (F(19, 20), F(51, 100), F(39, 100)), "c=x^%s R=x^%s k=x^%s" % (fr(gamma), fr(lenR), fr(lenk))) muR, muk = lenR / gamma, lenk / gamma # the two lengths in c-units def kloosterman_vec(p, a, m, n): """S(a m, n; p) as an integer vector in the power basis of Z[zeta_p] (p prime). Exact: sum_{x=1}^{p-1} zeta_p^(a m x^-1 + n x), reduced by zeta^(p-1) = -(1+...+zeta^(p-2)). """ counts = [0] * p for x in range(1, p): counts[(a * m * pow(x, p - 2, p) + n * x) % p] += 1 top = counts[p - 1] return tuple(counts[i] - top for i in range(p - 1)) ident = all(kloosterman_vec(p, a, m, n) == kloosterman_vec(p, a, n, m) for p in (5, 7, 11, 13) for a in range(2, p) for m in range(1, p) for n in range(1, p)) sample = [kloosterman_vec(7, 3, 1, 2), kloosterman_vec(7, 3, 2, 1)] check("B2 the orientation IDENTITY S(a m, n; c) = S(a n, m; c), exact over every a, m, n " "for c = 5, 7, 11, 13 in Z[zeta_p]: the summand cannot tell the two intervals apart, " "so BOTH assignments of the two lengths to (M, N) are legitimate bounds for the same " "sum and the best of the two must be taken", ident and sample[0] == sample[1], "a*m=3, n=2 vs m=3, a*n=6 (c=7): %s == %s" % (list(sample[0]), list(sample[1]))) def trivial(mu, nu): """The honest trivial bound ||a|| ||b|| min(c, sqrt(MN) sqrt(c)), in c-units.""" return min(F(1), (mu + nu) / 2 + F(1, 2)) def termA(mu, nu, zeta): """Theorem 5.2 (5.4) first term: c2(M+N)MN/c^2, c-units, with (M+N) ~ max(M,N).""" return zeta + mu + nu + max(mu, nu) - 2 def f0_terms(mu, nu): """Theorem 5.2 (5.4) F0(M,N,c): its two terms' exponents of c. (c+MN) ~ c^max(1,mu+nu), (c+N^2) ~ c^max(1,2nu), min(c/M,c^(1/2)) ~ c^min(1-mu,1/2). """ tB = (mu / 2 + (max(F(1), mu + nu) + max(F(1), 2 * nu)) / 4 - F(1) + min(F(1) - mu, F(1, 2)) / 4) tC = max(2 * nu - 2, nu / 2 + mu + max(F(1), 2 * nu) - F(5, 2)) / 4 return tB, tC def saving52(mu, nu, zeta): """Theorem 5.2's saving over the honest trivial bound, in c-units, at log_c c2 = zeta.""" tB, tC = f0_terms(mu, nu) return trivial(mu, nu) - (1 + max(termA(mu, nu, zeta), tB, tC) / 4) def h55_terms(mu, nu): """Theorem 5.5's H(M,N,c) (5.12), exponents of c.""" return { "T1": (mu / 8 + (max(F(1), mu + nu) + max(F(1), 2 * nu)) / 16 - F(1, 4) + min(F(1) - mu, F(1, 2)) / 16), "T2": max(2 * nu - 2, nu / 2 + mu + max(F(1), 2 * nu) - F(5, 2)) / 16, "T3": max(mu, nu) / 5 - F(1, 5), "T4": max(mu / 2 + nu / 6, mu / 6 + nu / 2) - F(7, 18), "T5": (max(mu, nu) - 1) / 15, } def saving55(mu, nu): return trivial(mu, nu) - (1 + max(h55_terms(mu, nu).values())) def bracket57(mu, nu): """Theorem 5.7's bracket: (MN)^(1/2)/c^(3/4) + N^(1/2)/c^(1/2) + M^(1/2)/c^(1/4).""" return max((mu + nu) / 2 - F(3, 4), nu / 2 - F(1, 2), mu / 2 - F(1, 4)) def saving57(mu, nu): return trivial(mu, nu) - (1 + bracket57(mu, nu)) check("B3 in c-units the two lengths are 51/95 (R) and 39/95 (k), and the honest " "unequal-length trivial bound is c^(37/38) in both orientations", (muR, muk) == (F(51, 95), F(39, 95)) and trivial(muR, muk) == trivial(muk, muR) == F(37, 38), "%s, %s, trivial %s" % (fr(muR), fr(muk), fr(trivial(muR, muk)))) # ----------------------------------------------------------------- C. Theorem 5.2, exact tB_R, tC_R = f0_terms(muR, muk) # M = R-length in the first slot tB_S, tC_S = f0_terms(muk, muR) # M = k-length in the first slot check("C1 F0 at (M,N)=(51/95,39/95): terms c^(-11/95) and c^(-18/95), so F0 = c^(-11/95) " "and the saving (c2 = 1) is 1/380", (tB_R, tC_R, max(tB_R, tC_R), saving52(muR, muk, F(0))) == (F(-11, 95), F(-18, 95), F(-11, 95), F(1, 380)), "F0=%s saving=%s" % (fr(max(tB_R, tC_R)), fr(saving52(muR, muk, F(0))))) check("C2 F0 at (M,N)=(39/95,51/95): terms c^(-23/152) and c^(-71/380), so F0 = c^(-23/152) " "and the saving (c2 = 1) is 7/608 -- larger than the other orientation", (tB_S, tC_S, max(tB_S, tC_S), saving52(muk, muR, F(0))) == (F(-23, 152), F(-71, 380), F(-23, 152), F(7, 608)), "F0=%s saving=%s" % (fr(max(tB_S, tC_S)), fr(saving52(muk, muR, F(0))))) check("C3 at (M,N)=(51/95,39/95) Theorem 5.2 is EXACTLY Theorem 5.5: its F0 exponent is " "H(M,N,c)'s own leading term T1 = -11/380, and T1 dominates H -- so the " "factorization-aware instrument the paper recommends buys nothing at this object", max(h55_terms(muR, muk).values()) == F(-11, 380) and saving55(muR, muk) == saving52(muR, muk, F(0)) == F(1, 380), "5.2 %s == 5.5 %s (H max = %s)" % (fr(saving52(muR, muk, F(0))), fr(saving55(muR, muk)), fr(max(h55_terms(muR, muk).values())))) check("C4 the c2 term is the ONLY thing Theorem 5.2 sees that Theorem 5.5 does not; it is " "additive and nonnegative in F, so it can only subtract. Thresholds: term A ties F0 " "at zeta = 38/95 (c2 = x^(19/50)) with M = the R-length, and at zeta = 277/760 " "(c2 = x^(277/800)) with M = the k-length", (F(49, 95) - F(11, 95) == F(38, 95) and (F(49, 95) - F(11, 95)) * gamma == F(19, 50) and F(49, 95) - F(23, 152) == F(277, 760) and (F(49, 95) - F(23, 152)) * gamma == F(277, 800)), "c2 <= x^19/50 (R first) / x^277/800 (k first)") check("C5 the c2 term makes Theorem 5.2's saving vanish at zeta = 39/95 -- the square-full " "part equal to the SHORTER summation length itself, c2 = x^(39/100) -- and above it " "Theorem 5.2's bound is worse than the trivial bound, not better. This zero point is " "the same in both orientations because term A is", (saving52(muR, muk, F(39, 95)), saving52(muk, muR, F(39, 95)), F(39, 95) * gamma) == (F(0), F(0), F(39, 100)), "saving %s at c2 = x^%s" % (fr(saving52(muR, muk, F(39, 95))), fr(F(39, 100)))) check("C6 the record's own factorization does not put c2 near that: c = q e1 e2 with q = p^i " "a prime power of size x^(1/20) and e1, e2 ~ x^(9/20) coprime to each other, so " "c2 = c2(p^i)*c2(e1)*c2(e2). For e_i squarefree outside small primes (the generic " "case) c2 = x^o(1), far below both thresholds, and Theorem 5.2 returns its flat value", F(1, 20) + 2 * F(9, 20) == gamma and F(277, 800) > F(0), "generic c2 = x^o(1) << x^277/800") check("C7 best of Theorem 5.2 over the two orientations, at the most favourable possible " "factorization: 7/608 in c-units", max(saving52(muR, muk, F(0)), saving52(muk, muR, F(0))) == F(7, 608), fr(max(saving52(muR, muk, F(0)), saving52(muk, muR, F(0))))) # ----------------------------------------------------------------- D. Theorem 5.7, exact check("D1 Theorem 5.7's bracket, M = R-length first: max((MN)^(1/2)/c^(3/4), N^(1/2)/c^(1/2), " "M^(1/2)/c^(1/4)) = c^(7/380) > 1, so the bound c^(1+7/380) exceeds the trivial bound " "c^(37/38) and the theorem gives nothing in that orientation (saving -17/380)", bracket57(muR, muk) == F(7, 380) and saving57(muR, muk) == F(-17, 380), "bracket %s, saving %s" % (fr(bracket57(muR, muk)), fr(saving57(muR, muk)))) check("D2 Theorem 5.7's bracket, M = k-length first: c^(-17/380), giving a saving of 7/380 " "-- the LARGEST saving any instrument in the paper produces at this object", bracket57(muk, muR) == F(-17, 380) and saving57(muk, muR) == F(7, 380), "bracket %s, saving %s" % (fr(bracket57(muk, muR)), fr(saving57(muk, muR)))) check("D3 the rule is exact and geometric: Theorem 5.7's third term is c^(mu/2-1/4), which is " "negative iff the first-slot length is below c^(1/2). The k-length is 39/95 = " "c^(0.41053) < c^(1/2) and the R-length is 51/95 = c^(0.53684) > c^(1/2), so the " "orientation identity of B2 is what makes the largest saving available at all", F(39, 95) < F(1, 2) < F(51, 95), "39/95 < 1/2 < 51/95") check("D4 Theorem 5.7 is the only instrument whose coprimality hypothesis is the record's " "own: it sums over (m,c)=1, with no (m,n,c)=1 constraint and no quadratic-form input, " "whereas Theorems 1.1, 5.2 and 5.5 all need (m,n,c)=1 unless both ranges are initial " "segments. So with 5.7 obligation 2 of the route -- the coprimality switch -- does " "not arise at all", True, "documentary, quoted locators: 5.7 statement vs 5.5 (5.12) and 5.2 (5.3) clause") # ------------------------------------- E. the window, the padding, and the honest baseline win_lo, win_hi = F(13, 28), F(7, 12) def padded_t11(N): """Theorem 1.1's (1.3) bracket, as an exponent of c, at the padded length N.""" return max(N / 8 - F(3, 32), 5 * N / 16 - F(3, 16), 2 * N / 3 - F(7, 18)) def padded_ratio(N): """(Theorem 1.1's bound) / (its OWN trivial bound N c^(1/2) at the same padded N).""" return 1 + padded_t11(N) - (N + F(1, 2)) check("E1 the paper's improvement window is N in (c^(13/28), c^(7/12)). The R-length 51/95 " "= c^(0.53684) lies inside it; the k-length 39/95 = c^(0.41053) lies BELOW it. So the " "route's range claim exists only because return #626 quoted the longer length", win_lo < muR < win_hi and muk < win_lo, "13/28=%s < 51/95 < 7/12=%s, and 39/95 < 13/28" % (fr(win_lo), fr(win_hi))) check("E2 padding both intervals to N = 51/95 reproduces the route's numbers exactly: " "bracket c^(-3/152) = x^(-3/160), a gain over the PADDED trivial bound N c^(1/2) of " "43/760 in c-units = 43/800 in x-units, and a margin over the requirement 7/190 of " "3/152 in c-units = 3/160 in x-units", padded_t11(muR) == F(-3, 152) and padded_t11(muR) * gamma == F(-3, 160) and padded_ratio(muR) == F(-43, 760) and padded_ratio(muR) * gamma == F(-43, 800) and -padded_ratio(muR) * gamma - deficit_x == F(3, 160), "bracket %s = x^%s; padded gain %s = x^%s; margin x^%s over the requirement" % (fr(padded_t11(muR)), fr(padded_t11(muR) * gamma), fr(-padded_ratio(muR)), fr(-padded_ratio(muR) * gamma), fr(-padded_ratio(muR) * gamma - deficit_x))) check("E3 but that gain is measured against Theorem 1.1's OWN trivial bound for the padded " "form, min(c, N c^(1/2)) = c. The honest unequal-length trivial bound is " "sqrt(MN)sqrt(c) = c^(37/38), and c^(1-3/152) = c^(0.980263) is WORSE than it by " "c^(1/152). The route's priced margin is an artifact of the padded baseline", (1 + padded_t11(muR)) - trivial(muR, muk) == F(1, 152), "padded bound c^(%s) vs honest trivial c^(%s), worse by c^%s" % (fr(1 + padded_t11(muR)), fr(trivial(muR, muk)), fr((1 + padded_t11(muR)) - trivial(muR, muk)))) # --------------------------------------------------------------------------- F. the verdict req_c = deficit_x / gamma # the requirement in c-units best_52 = max(saving52(muR, muk, F(0)), saving52(muk, muR, F(0))) best_55 = max(saving55(muR, muk), saving55(muk, muR)) best_57 = max(saving57(muR, muk), saving57(muk, muR)) best = max(best_52, best_55, best_57) check("F1 the requirement is 7/190 in c-units (7/200 in x-units), unchanged", req_c == F(7, 190), fr(req_c)) check("F2 ranking of the paper's instruments, best orientation each, c2 most favourable: " "Theorem 5.7 7/380 > Theorem 5.2 7/608 > Theorem 5.5 13/2850 > (R-length first) " "1/380; and the plain equal-length Theorem 1.1 beats nothing at all", best_57 == F(7, 380) and best_52 == F(7, 608) and best_55 == F(13, 2850) and saving55(muR, muk) == F(1, 380) and best_57 > best_52 > best_55 > saving55(muR, muk), "%s > %s > %s > %s" % (fr(best_57), fr(best_52), fr(best_55), fr(saving55(muR, muk)))) check("F3 the best saving available at this object is 7/380 in c-units, and the requirement " "is EXACTLY twice it: the requirement is 14/380", best == F(7, 380) and req_c == 2 * best, "req/best = %s" % fr(req_c / best)) check("F4 in the record's own x-units: available 7/400, required 7/200, shortfall 7/400. The " "(D1) small-gcd deficit is NOT closed, and it is not closed by any instrument in the " "paper, in any orientation, for any factorization of c", (best * gamma, deficit_x - best * gamma) == (F(7, 400), F(7, 400)), "available x^-%s vs required x^-%s" % (fr(best * gamma), fr(deficit_x))) check("F5 the deficit returns to the record unchanged at 7/200, with the losing step named: " "the length RATIO, not the square-full part. Theorem 5.2's extra information is inert " "-- it is exactly Theorem 5.5 at the R-first orientation and only ever subtracts -- and " "the instrument that gets closest is Theorem 5.7, one the route never named", saving52(muR, muk, F(0)) - saving55(muR, muk) == 0 and saving52(muR, muk, F(1)) < saving55(muR, muk), "5.2-5.5 = %s at c2=1 and %s at c2=c" % (fr(saving52(muR, muk, F(0)) - saving55(muR, muk)), fr(saving52(muR, muk, F(1)) - saving55(muR, muk)))) # ------------------------------------------------------------------------------ output passed = sum(1 for r in RESULTS if r["ok"]) total = len(RESULTS) out = { "job": 1398, "route_id": 29, "instrument": "check-thm52.py", "checks_passed": passed, "checks_total": total, "all_passed": passed == total, "failures": [r for r in RESULTS if not r["ok"]], "findings": { "object": "completed (D1) per-pair kernel at fixed c = q e1 e2, summand " "S(sigma theta R, k; c)", "orientation": "free, by the identity S(a m,n;c) = S(a n,m;c); best value is taken " "over both assignments", "thm52_best": fr(best_52), "thm52_first_slot_R": fr(saving52(muR, muk, F(0))), "thm52_equals_thm55_at_R_first": True, "thm52_c2_thresholds": "c2 <= x^(19/50) with the R-length first, c2 <= x^(277/800) " "with the k-length first; c2 >= x^(39/100) makes the bound " "worse than trivial. The record's generic c2 is x^o(1)", "thm55_best": fr(best_55), "thm57_best": fr(best_57), "thm57_matches_record_coprimality": True, "thm11_padded_gain_x": fr(-padded_ratio(muR) * gamma), "thm11_padded_gain_c": fr(-padded_ratio(muR)), "thm11_versus_honest_baseline": "worse than the honest trivial bound by c^(1/152)", "required_c_units": fr(req_c), "required_x_units": fr(deficit_x), "best_available_c_units": fr(best), "best_available_x_units": fr(best * gamma), "shortfall_c_units": fr(req_c - best), "shortfall_x_units": fr(deficit_x - best * gamma), "ratio_required_to_best": 2, "verdict": "the (D1) small-gcd deficit is not closed; the requirement is exactly " "twice the best saving the 2026 fixed-modulus paper supplies at this object", }, "results": RESULTS, } blob = json.dumps(out, indent=1, sort_keys=True) if "--out" in sys.argv: dest = sys.argv[sys.argv.index("--out") + 1] d = os.path.dirname(dest) if d: os.makedirs(d, exist_ok=True) tmp = dest + ".tmp" with open(tmp, "w", encoding="utf-8", newline="\n") as fh: fh.write(blob + "\n") fh.flush() os.fsync(fh.fileno()) os.replace(tmp, dest) print(blob) sys.stderr.write("check-thm52: %d/%d checks pass, %.3f s\n" % (passed, total, time.time() - _T0)) sys.exit(0 if passed == total else 1)