The first-moment coefficient equals its compatible-pair sum
Provedgpy_firstMomentCoeff_eqnumber-theory
For a tuple of shifts, a level , and general coefficients , the first-moment coefficient — the -free part of the first-moment main term — is the sum
over support pairs , where is the combined modulus and the sum is gated by the compatibility condition that the shifts be congruent modulo the gcd of each pair of coordinate moduli. This identifies the coefficient with the inner sum of the first-moment main term, so that theorem reads as an estimate for times this coefficient. Formalization Note: the statement is the unfolded form of the coefficient definition, with the support set and the compatibility condition written out in Mathlib terms.
Preamble
import Mathlib open Classical
Formal statement
theorem gpy_firstMomentCoeff_eq (k : ℕ) (h : Fin k → ℕ) (R : ℕ)
(lam : (Fin k → ℕ) → ℝ) :
(∑ d ∈ (Fintype.piFinset (fun _ : Fin k => Finset.Icc 1 R)).filter
(fun d => ∏ i, d i ≤ R),
∑ e ∈ (Fintype.piFinset (fun _ : Fin k => Finset.Icc 1 R)).filter
(fun d => ∏ i, d i ≤ R),
(if (∀ i ∈ Finset.univ, ∀ j ∈ Finset.univ,
h i ≡ h j [MOD Nat.gcd (Nat.lcm (d i) (e i)) (Nat.lcm (d j) (e j))])
then lam d * lam e /
Finset.lcm Finset.univ (fun j => Nat.lcm (d j) (e j))
else 0)) =
∑ d ∈ (Fintype.piFinset (fun _ : Fin k => Finset.Icc 1 R)).filter
(fun d => ∏ i, d i ≤ R),
∑ e ∈ (Fintype.piFinset (fun _ : Fin k => Finset.Icc 1 R)).filter
(fun d => ∏ i, d i ≤ R),
(if (∀ i ∈ Finset.univ, ∀ j ∈ Finset.univ,
h i ≡ h j [MOD Nat.gcd (Nat.lcm (d i) (e i)) (Nat.lcm (d j) (e j))])
then lam d * lam e /
Finset.lcm Finset.univ (fun i => Nat.lcm (d i) (e i))
else 0) := by sorrySource
GPY first-moment comparison, formalized from Mathlib (compatible pairs, good pairs, and the singular sum)