#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Build `artifacts/rev-prime-dispersion.md`: one block before section 6. Carrier: `research/prime-dispersion.md` (sha 5921068b, 15220 B) has a section 5 titled "Price the bound and consume the earlier reductions" -- a pricing section in a dispersion note, which is where a general price lemma belongs and will be read. It carries no pending revision (RESEARCH-HANDOFF #899, grouped-divisor-moment #902, structural-literature-audit #905, small-divisor-kernel #908 and prime-band-completion #909 are all occupied). """ import hashlib import os RUN = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) SRC = os.path.join(RUN, "evidence", "docs", "research__prime-dispersion.md") DST = os.path.join(RUN, "artifacts", "rev-prime-dispersion.md") BASE_SHA = "5921068b3b46165f338784810a9047583eea616b592595a1a803cd1766dbd88d" ANCHOR = "## 6. Checks, limitations and the next question\n" BLOCK = """ ## 5bis. A general price lemma for two-family profile families Every interface this note and its neighbours price -- the Hilbert-Schmidt/operator-norm interface of [grouped-divisor-moment](grouped-divisor-moment.md) section 6, the non-abelian amplification of [prime-band-completion](prime-band-completion.md) section 4, the dispersion method of [small-divisor-kernel](small-divisor-kernel.md) -- consumes a coefficient that is a **sum of rank-one products of a row factor and a column factor**. The following lemma is the exact price of such an object, and it is general: it assumes nothing about the origin of the family. ### The lemma **Object.** For two index families `{mu_w}_{w=1..S}` (rows) and `{t_m}_{m=1..T}` (columns), moment means `U_j = `, `V_j = `, and scalars `c_1, c_2, ...`, put ```text u_k = (mu_w^k)_w , v_k = (t_m^k)_m , A(v) = sum_{k>=1} c_k v^k u_k v_k^T , ``` i.e. `A(v)_{w,m} = sum_k c_k v^k mu_w^k t_m^k`: a sum of rank-one row-factor-times-column-factor terms, the k-th of size `O(v^k)`. **Hypotheses.** (H1) both families are bounded away from 0 and infinity, with `U_1 = V_1 = 1`; (H2) `c_1 != 0` and `c_2 != 0`; (H3) the tail is `O(v^3)`, i.e. `sum_{k>=3} |c_k| v^{k-2} ||u_k|| ||v_k|| = O(1)` as `v -> 0`. **Conclusion.** As `v -> 0`, ```text ||A||_nuc / ||A||_F = 1 + (|c_2|/|c_1|) v sqrt(D_mu D_t) + O(v^2), (P1) ||A||_nuc - ||A||_F = |c_2| v^2 ||u_1|| ||v_1|| sqrt(D_mu D_t) + O(v^3), (P2) ``` where the two families' **normalised Cauchy-Schwarz deficits**, i.e. their dispersions, ```text D_mu = (U_2 U_4 - U_3^2)/U_2^2 , D_t = (V_2 V_4 - V_3^2)/V_2^2 ``` are nonnegative, dimensionless, vanish exactly for a constant family, and enter through their **geometric mean** `sqrt(D_mu D_t)`. In words: **the exact nuclear norm above the Frobenius price is `(|c_2|/|c_1|) v` times the geometric mean of the two families' dispersions.** ### Properties of the dispersion `D >= 0` by Cauchy-Schwarz on the moment sequence; `D = 0` iff the family is constant, in which case `A` is rank one and the Frobenius price is exact. `D` depends only on the first four moments of the family, so it is computable for any family that can be averaged, and it is invariant under scaling each family by a constant. ### Proof **Step 1 -- the rank-two truncation, and the area identity.** Let `B = c_1 v u_1 v_1^T + c_2 v^2 u_2 v_2^T`. For any rank-two matrix `B = x y^T + z w^T`, the Gram determinant `sigma_1^2 sigma_2^2 = det(B*B)` expands to the classical parallelogram identity ```text sigma_1 sigma_2 = ||x ^ z|| * ||y ^ w|| , ``` the product of the two areas. Applied to `B`, ```text sigma_1 sigma_2 = |c_1 c_2| v^3 * ||u_1 ^ u_2|| * ||v_1 ^ v_2|| . ``` Since `||u_1||^2 = S U_2`, ` = S U_3`, `||u_2||^2 = S U_4`, we have `||u_1 ^ u_2||^2 = S^2 (U_2 U_4 - U_3^2)`, and identically for the columns; and `sigma_1(B) = |c_1| v ||u_1|| ||v_1|| + O(v^2)`, because the `k = 1` term dominates and the `k = 2` term has operator norm `O(v^2)`. Therefore ```text sigma_2(B) = (sigma_1 sigma_2)/sigma_1 = |c_2| v^2 (||u_1 ^ u_2|| / ||u_1||) (||v_1 ^ v_2|| / ||v_1||) (1 + O(v)) = |c_2| v^2 ||u_1|| ||v_1|| sqrt(D_mu D_t) (1 + O(v)), ``` using `||u_1 ^ u_2||/||u_1||^2 = sqrt(U_2 U_4 - U_3^2)/U_2 = sqrt(D_mu)`. **Step 2 -- the tail is rank one, so the rank never enters the price.** Every term with `k >= 3` is of rank one, and for a rank-one matrix the nuclear norm **equals** the Frobenius norm. So by the triangle inequality ```text || sum_{k>=3} c_k v^k u_k v_k^T ||_nuc <= sum_{k>=3} |c_k| v^k ||u_k|| ||v_k|| = O(v^3) by (H3). ``` By Weyl, `sigma_2(A) = sigma_2(B) + O(v^3)` and `sigma_1(A) = sigma_1(B) + O(v^3)`; and `||A||_F = sigma_1 (1 + O(v^2))`. No `sqrt(rank)` appears anywhere: the tail may have high rank, but its nuclear norm is its Frobenius norm term by term. This is the step that makes the lemma a price and not a bound. **Step 3 -- assembly.** `||A||_nuc = sigma_1 + sigma_2 + O(v^3)` and `||A||_F = sigma_1 + O(sigma_2^2 /sigma_1)`, so ```text ||A||_nuc - ||A||_F = sigma_2 + O(v^3) , ``` which with Step 1 is (P2); dividing by `||A||_F = sigma_1(1 + O(v^2))` and using `||u_1|| ||v_1|| = sqrt(S T U_2 V_2)` gives (P1). `square` ### Corollary (the corpus's own family) For the endpoint profile `f(x) = e(2 pi i x) - e(2 pi i rho x)`, i.e. `c_k = (2 pi i)^k (1 - rho^k)/k!`, one has `|c_2|/|c_1| = pi(1+rho)`, so (P1) reads ```text C = pi(1+rho) sqrt(D_mu D_t) , ``` which is exactly the closed-form constant recorded for the (D1) coefficient in [grouped-divisor-moment](grouped-divisor-moment.md) section 6: that formula is a special case of (P1), with `rho = z'/z_0'` entering only through the coefficient ratio. ### Consequences for the corpus's prices * An interface consuming a family of this shape pays `1 + C v`, which is `x`-free whenever `v = O(1)`. For the (D1) boxes `v = A x/(M N)`, so the family is free exactly on the bands with `A <= M N / x` -- the same reading as the owning note's `(1+v) <= 2` bookkeeping, but exact. * The only way a family escapes the price is to be **flat**: `D_mu D_t = 0` iff one of the two index families is constant, i.e. the family is rank one. The geometric mean says the two families must **both** vary: one dispersed factor and one flat factor still costs, and costs nothing only if one of them is flat. * The lemma is a tool, not a result about the twin target: it prices a coefficient, and the deficit of the corpus is on the moment/Kloosterman side. ### Verification `work/price-lemma.py` (numpy SVD, exact singular values), output retained as `artifacts/price-lemma.out`, on **generic** families `mu_w = (w/S)^a`, `t_m = (m/T)^b`: | test | result | |---|---| | (P1) over 36 configurations (three `(S,T)` shapes, four `(a,b)`, three `v`) | worst relative deviation of `(R-1)/v` from `pi(1+rho) sqrt(D_mu D_t)` is **0.0034** | | the `O(v^2)` residual `(R-1-Cv)/v^2` | stays in `[0.0247, 0.0297]` -- bounded, as `O(v^2)` requires | | (P2), the excess law | ratio measured/predicted `1.00016, 1.00063, 1.00143, 1.00258` at `v = 1/400 ... 1/16` | | **separability** (the geometric-mean signature): column family fixed, six row families | `(R-1)/(v sqrt(D_mu))` spreads by **0.04 %** (1.8688 ... 1.8696, against the predicted `pi(1+rho) sqrt(D_t) = 1.8664`) | | the corpus's boxes (`S = T = 512`, `a = b = 1`) at `rho = 5/4, 3/2, 2, 5/2` | reproduces the recorded `C` to within 0.1 % | ### Limits * (H3) is a real hypothesis: a profile whose coefficients decay slower than geometrically (say `c_k ~ k^{-s}`) has a tail contributing at higher order, and (P1) as stated does not apply to it. The lemma is about families with a genuine expansion parameter. * (P1) is an upper price on the nuclear norm, not a lower bound, and it says nothing about the sign of the family. A family with `D_mu = 0` has the Frobenius price **exactly** -- the degenerate direction, which the coefficient route wants and, per the audits of 2026-09-17, does not get. * The verification is finite and over a parametric family; the proof, not the table, is what carries the claim. """ def main(): raw = open(SRC, "rb").read() sha = hashlib.sha256(raw).hexdigest() if sha != BASE_SHA: raise SystemExit("base is not the served copy: %s != %s" % (sha, BASE_SHA)) text = raw.decode("utf-8") if text.count(ANCHOR) != 1: raise SystemExit("anchor occurs %d times, not once" % text.count(ANCHOR)) if "A general price lemma for two-family profile families" in text: raise SystemExit("the block is already present") out = text.replace(ANCHOR, BLOCK + "\n" + ANCHOR) with open(DST, "w", encoding="utf-8", newline="\n") as fh: fh.write(out) print("base %s %d bytes %d lines" % (sha[:12], len(raw), len(text.splitlines()))) print("rev %s %d bytes %d lines (+%d / -0)" % (hashlib.sha256(out.encode()).hexdigest()[:12], len(out.encode()), len(out.splitlines()), len(out.splitlines()) - len(text.splitlines()))) print("wrote %s" % DST) return 0 if __name__ == "__main__": raise SystemExit(main())