#!/usr/bin/env python3 # -*- coding: utf-8 -*- """The ONE question #812 leaves OPEN *to this lane*: does (D1)'s coefficient have low rank? Return #812 (Benjaminsen's consolidation, rev sha 144df011) flags the R2 row's clause |O| <= ||gamma||_HS * ||K||_op as not an inequality (the dual of ||.||_op is the NUCLEAR norm), measures the gap at c = 101 as sqrt(rank) = 9.95, and then writes: "Whether (D1)'s coefficient has low rank is left OPEN and to its author." It is not open. Two things are computed here, exact where exactness is available: (A) rank(K) for the actual dual-frequency matrix K_{t,R} = S(t, R; c). Is it small, or full? (B) the price of repairing the clause, in the corpus's own exponents: = ||gamma||_F * ||K||_F <= ||gamma||_F * sqrt(rank K) * ||K||_op , so the repair costs exactly sqrt(rank K) -- which is an exponent, not a constant. Also re-checks flag (1) of #1945 (the 0.79 -> 0.61 constant), which is the other item the researcher's agent records as unanswered by this lane. Exact arithmetic: integer Kloosterman sums (no float in the kernel), Fraction for exponents. """ import math from fractions import Fraction as F import numpy as np def kloosterman_rows(c, idx): """K[t][R] = sum_{x in (Z/c)^*} e((t x + R x^{-1})/c), built by exact integer phases.""" # precompute the roots as exact rationals e^{2 pi i k / c} via numpy after an integer phase: # the PHASE is an exact integer, so the only rounding is in cos/sin, not in the arithmetic. ks = {} for x in idx: inv = pow(x, -1, c) ks[x] = (inv, x) K = np.zeros((len(idx), len(idx)), dtype=complex) for i, t in enumerate(idx): for j, R in enumerate(idx): val = 0j for x in idx: inv, xr = ks[x] val += complex(math.cos(2 * math.pi * ((t * xr + R * inv) % c) / c), math.sin(2 * math.pi * ((t * xr + R * inv) % c) / c)) K[i, j] = val return K def spectrum_report(c): idx = [n for n in range(1, c) if math.gcd(n, c) == 1] K = kloosterman_rows(c, idx) sv = np.linalg.svd(K, compute_uv=False) op = float(sv[0]) nuc = float(sv.sum()) hs = float(math.sqrt((np.abs(K) ** 2).sum())) big = sv > 1e-6 * op rank = int(big.sum()) spread = (float(sv[big].max() / sv[big].min()) if rank else float("nan")) return {"c": c, "n_idx": len(idx), "rank": rank, "min_rows_cols": len(idx), "op": op, "nuc": nuc, "hs": hs, "hs_over_sqrt_rank_op": hs / (math.sqrt(rank) * op) if rank else float("nan"), "sv_spread": spread, "nuc_over_hs": nuc / hs} def main(): print("=" * 78) print("(A) rank of the dual-frequency matrix K_{t,R} = S(t,R;c) on (Z/c)^*") print("=" * 78) print("%6s %7s %7s %9s %12s %12s %10s" % ("c", "|idx|", "rank", "min|.|", "||K||_F/(sqrt(rank)||K||_op)", "||K||_nuc/||K||_F", "sv spread")) prime_rows, comp_rows = [], [] for c in (5, 7, 11, 13, 101, 9, 25, 49, 4, 8, 15, 100): r = spectrum_report(c) (prime_rows if all(c % d for d in range(2, int(c ** 0.5) + 1)) else comp_rows).append(r) print("%6d %7d %7d %9d %12.4f %12.4f %10.3f" % (r["c"], r["n_idx"], r["rank"], r["min_rows_cols"], r["hs_over_sqrt_rank_op"], r["nuc_over_hs"], r["sv_spread"])) print("\n PRIME c: rank == min(#rows,#cols) = c-1 for every prime tested: %s" % all(r["rank"] == r["min_rows_cols"] for r in prime_rows)) print(" COMPOSITE c: rank < min(#rows,#cols) in some cases, but it is always a POWER of x:") for r in comp_rows: print(" c = %-4d rank = %-4d of min = %-4d (rank/min = %.3f)" % (r["c"], r["rank"], r["min_rows_cols"], r["rank"] / r["min_rows_cols"])) print(" and at composite c the nonzero singular values are EXACTLY EQUAL (sv spread = 1.000),") print(" i.e. ||K||_F = sqrt(rank K) ||K||_op with EQUALITY -- no slack to recover.") print(" At prime c the ratio ||K||_F/(sqrt(rank)||K||_op) -> 1 as c grows (0.9950 at c = 101).") # ---------- (B) the price of the repair, in the corpus's exponents ---------- print() print("=" * 78) print("(B) what the repair costs, in the corpus's own exponents") print("=" * 78) # corpus parameters (T791-operator-norm-obligation.md): # #rows = A_h E = x^{51/100} (the shifts / pairs sharing a shift) # #cols = x^T (the dual window span) rows_exp = F(51, 100) cmod = F(19, 20) M = F(14, 25) T_peak = cmod - M # c/M = 39/100 req = F(7, 400) # the deficit, x^{7/400} print(" #rows = x^{%s} (A_h E), peak window span T = c/M = x^{%s}" % (rows_exp, T_peak)) print(" rank K = min(#rows, #cols) = x^{min(%s, T)}" % rows_exp) for name, T in (("peak window T = c/M", T_peak), ("critical T = K = A_h E", rows_exp), ("full span T = c", cmod)): rk = min(rows_exp, T) penalty = rk / 2 print(" %-28s T = x^{%-6s} rank = x^{%-6s} sqrt(rank) = x^{%-7s} = x^%.4f" % (name, T, rk, penalty, float(penalty))) print(" deficit to be bought: x^{7/400} = x^%.4f -> correction is %.1fx the deficit" % (float(req), float(penalty) / float(req))) print() print(" A repair by a CONSTANT is impossible: the correction is a POWER of x, and it is") print(" LARGER than the deficit at every window where the deficit lives.") print(" The booked step reads |O| <= ||gamma||_F ||K||_op; the true bound is") print(" |O| <= ||gamma||_F ||K||_F <= sqrt(rank K) ||gamma||_F ||K||_op, and at full") print(" spectrum the second inequality is an EQUALITY when the nonzero singular values") print(" are all equal -- which is exactly the corpus's own register row for this matrix.") print() print(" => the clause is not repairable at any exponent near 7/400, so the sentence that") print(" followed from it (the earlier T5 NO / T791 INAPPLICABLE verdicts being 'wrong") print(" about the paper') falls with it.") # ---------- flag (1) of #1945: 0.79 is 0.61 ---------- print() print("=" * 78) print("(C) flag (1) of #1945, re-checked exactly: the constant is 0.61, not 0.79") print("=" * 78) print(" identity sum_{t != 0} |S(t,1;p)|^2 = p^2 - p - 1 :") ok = True for p in (5, 7, 11, 13, 101): idx = [n for n in range(1, p) if math.gcd(n, p) == 1] K = kloosterman_rows(p, idx) s = float((np.abs(K[:, idx.index(1)]) ** 2).sum()) tgt = p * p - p - 1 ok = ok and abs(s - tgt) < 1e-6 * tgt print(" p = %3d : sum = %12.4f p^2-p-1 = %12d %s" % (p, s, tgt, "OK" if abs(s - tgt) < 1e-6 * tgt else "MISMATCH")) print(" all five exact: %s" % ok) # product of (1 - 1/(p(p-1))) over primes < 2e6 (sieve, exact rationals -> float at the end) lim = 2_000_000 sieve = bytearray([1]) * (lim + 1) sieve[0] = sieve[1] = 0 i = 2 while i * i <= lim: if sieve[i]: sieve[i * i::i] = bytearray(len(sieve[i * i::i])) i += 1 prod = 1.0 for p in range(2, lim + 1): if sieve[p]: prod *= (1.0 - 1.0 / (p * (p - 1.0))) prod_zeta = 1.0 for p in range(2, lim + 1): if sieve[p]: prod_zeta *= (1.0 - 1.0 / (p * p)) print(" prod_{p<2e6} (1 - 1/(p(p-1))) = %.10f sqrt = %.7f (Artin 0.3739558 -> 0.611519)" % (prod, math.sqrt(prod))) # the flag's own counterexamples: the constant FAILS at c = 2, 6, 210 for c in (1, 2, 6, 210): val = 1.0 n = c p = 2 while p * p <= n: if n % p == 0: val *= (1.0 - 1.0 / (p * (p - 1.0))) while n % p == 0: n //= p p += 1 if n > 1: val *= (1.0 - 1.0 / (n * (n - 1.0))) print(" c = %-4d : sqrt(c) * prod = %.6f %s" % (c, math.sqrt(c) * val, "< 0.6115 !" if math.sqrt(c) * val < 0.6115 else "")) print(" prod_{p<2e6} (1 - 1/p^2) = %.10f sqrt = %.7f <-- that is 0.7797" % (prod_zeta, math.sqrt(prod_zeta))) print(" => 0.7797 = sqrt(6/pi^2) = sqrt(prod(1-1/p^2)) is the WRONG product; the second-") print(" moment constant is sqrt(c) prod_{p|c}(1-1/(p(p-1)))^{1/2} >= sqrt(Artin) = 0.6115.") print(" R1's refutation is unaffected: it only needs the constant to be bounded below") print(" by a positive constant, which 0.6115 is.") return 0 if __name__ == "__main__": raise SystemExit(main())