← Session 28 — ii′-5e: partial-fraction identity (zero series + F entire)
thinking (24782 chars)
`hasSum_coe_mul_geometric_of_norm_lt_one {r : 𝕜} (h : ‖r‖ < 1) : HasSum (fun n => ↑n * r^n) (r / (1−r)²)` ✓ — for r = 1/2: (1/2)/(1/2)² = 2 ✓.
Now let me write the tail bound. Structure:
```lean
/-! ## 4. The far-tail bound -/
/-- The tail summand family on the zero subtype (if-form). -/
def tailTerm (X : ℝ) (ρ : {ρ : ℂ // IsNontrivialZero ρ}) : ℝ :=
if X < |(ρ : ℂ).im| then (zeroMult ρ : ℝ) / (1 + ρ.im^2) else 0
```
Hmm wait — for the fiberwise I need the summand as a function on the zero subtype with the dyadic class. Let me NOT use an if-form; instead state the tsum over the fiber-type directly? The ENNReal.tsum_fiberwise works on the whole zero subtype: ∑'_{Z} f = ∑'_{j} ∑'_{Z, j(ρ) = j} f where f ρ := ofReal((zeroMult ρ)/(1+ρ.im²)) (no if) and j(ρ) := Nat.log 2 ⌊|ρ.im|/X⌋₊. Then the tail's contribution comes from fibers with 2^j X ≤ |γ| possible only when... every fiber is included in the total. The tail sum I want is ∑'_{|γ|>X} — I can bound it by the FULL fiberwise sum restricted... hmm.
Alternative: state the tail bound directly for the FULL sum over the zero subtype of the if-form, and apply fiberwise to the if-form:
f ρ := if X < |ρ.im| then ofReal(m/(1+γ²)) else 0 — on the whole zero subtype Z.
∑'_Z f = ∑'_{j} ∑'_{fiber j} f.
Fiber j: zeros with Nat.log 2 ⌊|γ|/X⌋ = j. For ρ in fiber j with f ρ ≠ 0: |γ| > X ⟹ 2^j ≤ ⌊|γ|/X⌋ (pow_log_le_self needs ⌊⌋ ≠ 0 ✓ since |γ| > X ⟹ ⌊|γ|/X⌋ ≥ 1) ⟹ 2^j ≤ |γ|/X ⟹ 2^j X ≤ |γ| ✓ and ⌊|γ|/X⌋ < 2^{j+1} ⟹ |γ| < 2^{j+1} X + ... |γ|/X < ⌊⌋+1 ≤ 2^{j+1} ⟹ |γ| < 2^{j+1} X ✓.
So fiber j's nonzero part has |γ| ∈ (X, 2^{j+1} X) ∩ [2^j X, ...): ⊆ {2^j X ≤ |γ| < 2^{j+1} X} for j ≥ 1; for j = 0: |γ| < 2X and |γ| > X (the if) — ⊆ {X < |γ| < 2X} = {2^0 X < |γ| < 2^1 X} ✓ same form. GOOD — so fiber j's support ⊆ {2^j X ≤ |γ| < 2^{j+1} X} for all j (for j = 0 the lower bound 2^0 X = X ✓ from the if).
Fiber bound: ∑'_{fiber j} f ≤ ofReal(count_j · 1/(4^j X²)) where count_j := 2A₀(2^jX+1)·log(3·2^{j+1}X+5)... but careful — for j = 0: 4^0 X² = X² ✓ and the fiber-0 count: |γ| ∈ (X, 2X): Ncount(X, 2X] + Ncount[−2X, −X) ≤ 2·A₀·(X+1)·log(6X+5) ✓ matches the formula with j = 0 ✓.
The fiber is finite: fiber j ⊆ {‖ρ‖ ≤ 2^{j+1}X + 1}: |γ| < 2^{j+1}X ⟹ ‖ρ‖ ≤ |re| + |im| ≤ 1 + 2^{j+1}X·... ‖ρ‖ ≤ |re ρ| + |im ρ| via... `Complex.norm_le_abs_re_add_abs_im`? check name — or ‖ρ‖² = re²+im² ≤ 1 + (2^{j+1}X)² ⟹ ‖ρ‖ ≤ √(1+(2^{j+1}X)²) ≤ 1 + 2^{j+1}X (since √(1+y²) ≤ 1+y for y ≥ 0 ✓ — the sqrt: `Real.sqrt_le...`?). Simpler: ‖ρ‖ ≤ |re|+|im| ≤ 1 + 2^{j+1}X ✓ no sqrt. So fiber ⊆ {‖ρ‖ ≤ 1 + 2^{j+1}X} finite (finite_subtype_norm_lt (1 + 2^{j+1}X + 1) ⊇) ✓.
Then:
∑'_Z f = ∑'_{j} (fiber j sum) ≤ ∑'_{j} ofReal(F_j) where F_j := (count bound)·(1/(4^jX²)) — then ∑'_{j} ofReal(F_j) = ofReal(∑'_j F_j) (ofReal_tsum_of_nonneg; F_j summable — the dyadic series ✓) ≤ ofReal(16A₀ log X/X) ⟹ ∑'_Z f ≤ 16A₀ log X/X via ofReal_le_ofReal_iff ✓.
The real dyadic sum: ∑'_{j} F_j = ∑'_{j} 2A₀(2^jX+1)log(3·2^{j+1}X+5)/(4^jX²) ≤ 16A₀ log X/X:
per-term: F_j ≤ (4A₀/X)·((j+4)log2 + logX)/2^j:
2A₀(2^jX+1)log(3·2^{j+1}X+5)/(4^jX²) ≤ 2A₀·(2^{j+1}X)·((j+4)log2 + logX)/(4^jX²) = (4A₀/X)·2^{j+1}/4^j·((j+4)log2+logX)·... 2^{j+1}/4^j = 2/2^j ✓ so = (4A₀/X)·((j+4)log2+logX)/2^j ✓.
∑'_j ((j+4)log2 + logX)/2^j = log2·(Σ j/2^j + 4Σ 1/2^j) + logX·Σ 1/2^j = log2·(2+8) + 2logX = 10 log2 + 2 log X ≤ 10 + 2 log X (log 2 ≤ 1: Real.log_two_le_one?? need the name — log 2 ≤ 1 ⟺ 2 ≤ e: Real.exp_one_gt_d9? The exact: `Real.exp_one_gt_d9 : 2.718281828 < Real.exp 1`?? and log2 < 1 via Real.log_lt... log_two_lt... there's `Real.log_two_lt_d9`?? or via exp: log 2 < 1 ⟸ Real.log_lt... hmm: `Real.log_lt_of_lt_exp`? or Real.log_two_gt_d9 gives the LOWER bound 0.693 < log 2 — the upper: log 2 < 1 ⟺ 2 < e^1: exp_one_gt_d9 : 2.71828... < e ⟹ 2 < e ⟹ log 2 < 1 via Real.log_le_iff... `Real.log_le_iff_le_exp (h : 0 < x) : log x ≤ y ↔ x ≤ Real.exp y`?? then log 2 ≤ 1 ⟸ 2 ≤ e^1 ⟸ 2 ≤ 2.718... ✓ provable).
Then (4A₀/X)·(10 + 2 log X) ≤ 16A₀ log X/X ⟺ 10 + 2 log X ≤ 4 log X ⟺ 10 ≤ 2 log X ⟺ log X ≥ 5 ⟸ X ≥ e^5 ⟸ X ≥ 200 (e^5 ≤ 2.718281829^5 ≤ 148.42 ≤ 200 — norm_num chain with Real.exp_one_lt_d9 — wait need e^5 ≤ 148.42: (exp 1)^5 ≤ 2.718281829^5 — exp_one_lt_d9 : exp 1 ≤ 2.718281829? then pow_le_pow_left₀ ✓ 2.718281829^5 ≤ 148.42 by norm_num ✓). So hX : 200 ≤ X.
Total: ∑'_{Z} f ≤ 16 A₀ log X / X for X ≥ 200 ✓.
This is a chunky but clear build. The steps:
(i) the fiber finiteness + the fiber finset-sum bound (count × term).
(ii) the count bound via Ncount intervals (both signs).
(iii) the per-term 1/(1+γ²) ≤ 1/(4^jX²).
(iv) the dyadic real sum ∑' F_j ≤ 16A₀ log X/X.
(v) the fiberwise assembly + the ofReal plumbing.
Let me estimate the pieces:
- (iv) is self-contained real analysis ~100 lines.
- (i)-(iii) ~150 lines.
- (v) ~80 lines.
Total ~330 lines for the tail bound. Plus the main series bound after (~300). This session: get the tail bound done.
Let me write it. I'll be careful about the fiberwise statement form. ENNReal.tsum_fiberwise (f : β → ℝ≥0∞) (g : β → γ) : ∑' x, ∑' b : g ⁻¹' {x}, f b = ∑' i, f i — note the direction: ∑'_{x} ∑'_{fiber x} f = ∑'_{i} f — the RHS is the FULL sum. So: ∑'_{Z} f = ∑'_{j} ∑'_{fiber j} f — by Eq.symm.
Also the fiber tsum ∑'_{b : g⁻¹'{j}} f b — the fiber is a SUBTYPE {b : Z // g b = j} — with Fintype from finiteness: ∑' = Finset.sum via tsum_fintype (needs Fintype instance — provide via Set.Finite.fintype? the fiber as a SET of Z: {ρ : Z | j ρ = j} finite ⊆ {‖ρ‖ ≤ 1+2^{j+1}X}: finite_subtype... then Fintype of the SET: (Set.Finite.fintype) — and the subtype {b : Z // g b = j} = the set's coercion ✓ defeq — tsum_fintype needs the Fintype instance on the subtype — provide via `haveI := (Set.Finite.fintype hfib)`).
Then ∑'_{fiber} f = ∑_{fiber as finset} f (tsum_fintype) — bound the finset sum: each term ofReal(m/(1+γ²)) ≤ ofReal(m/(4^jX²)) (nonneg ✓ ofReal_le_ofReal ✓ from the per-term bound) — sum ≤ ofReal(Σ m/(4^jX²)) = ofReal((1/(4^jX²))·Σ m) ≤ ofReal(F_j) (count ✓).
Hmm — one wrinkle: ENNReal.ofReal of a SUM: ofReal_sum_of_nonneg ✓ (for the finset sums of nonneg reals: m/(1+γ²) ≥ 0 ✓).
Let me also double-check `one_add_sq_ge` isn't needed — my per-term bound: 1/(1+γ²) ≤ 1/(4^j X²) from |γ| ≥ 2^j X: γ² ≥ 4^j X² ⟹ 1+γ² ≥ 4^jX² ⟹ 1/(1+γ²) ≤ 1/(4^jX²) ✓ (both positive: one_div_le_one_div_of_le with positivity ✓). ✓ no key-machinery needed (I use my own Nat.log dyadic class).
And the count: fiber j's zeros have 2^j X ≤ |γ| < 2^{j+1} X — the two intervals (2^j X, 2^{j+1}X] (positive) and [−2^{j+1}X, −2^j X) hmm — Ncount windows are (a, b]: the negative side: |γ| ∈ [2^j X, 2^{j+1}X) with γ < 0 ⟺ γ ∈ (−2^{j+1}X, −2^j X]: Ncount(−2^{j+1}X)(−2^j X) ✓ (T₁ < im ≤ T₂: −2^{j+1}X < γ ≤ −2^j X ✓). So the fiber's zeros (nonzero-part) ⊆ zerosIn (2^j X) (2^{j+1}X) ∪ zerosIn (−2^{j+1}X) (−2^j X) ✓ — count ≤ the two Ncount intervals. Careful the endpoints: |γ| ≥ 2^j X and |γ| < 2^{j+1}X: positive: γ ∈ [2^jX, 2^{j+1}X) ⊆ (2^j X − ε...]: Ncount (2^j X) (2^{j+1}X] needs 2^j X < γ: γ = 2^j X exactly is EXCLUDED by Ncount but INCLUDED in my range — cover via Ncount (2^j X − 1) (2^{j+1}X]?? — no: simpler: include the boundary by using [2^j X ≤ γ] ⊆ (2^j X − 1/2, ...) hmm — just use Ncount (2^j X) (2^{j+1} X] ∪ Ncount covering γ = 2^j X exactly: {γ = 2^j X} ⊆ Ncount (2^j X − 1) (2^j X] — a third window... OR shift the dyadic class: use |γ| > 2^j X STRICT by defining j(ρ) via ⌈⌉ or strict inequalities... The fiber condition: Nat.log 2 ⌊|γ|/X⌋ = j: 2^j ≤ ⌊|γ|/X⌋ < 2^{j+1}: ⌊|γ|/X⌋ ≥ 2^j ⟹ |γ| ≥ ⌊|γ|/X⌋ ≥ 2^j ✓ non-strict; and |γ| < (⌊⌋+1)·X ≤ 2^{j+1}X ✓ strict. So |γ| ∈ [2^j X, 2^{j+1} X) — the left endpoint INCLUSIVE. For the window cover: γ ∈ [2^j X, 2^{j+1}X) ⟺ γ ∈ (2^j X − 1, 2^{j+1}X − 1]?? no: cover [2^jX, 2^{j+1}X) by Ncount (2^j X − 1) (2^{j+1}X): hmm Ncount a b := zerosIn (a, b]: (2^jX − 1, 2^{j+1}X] ⊇ [2^j X, 2^{j+1}X) ✓ — but then b−a = 2^j X + 1: count ≤ A₀(2^j X + 2)·log(...) — fine (constants shift slightly). OR simpler: cover by Ncount (2^j X) (2^{j+1} X] for γ > 2^jX and handle γ = 2^j X... no — simplest: cover [2^j X, 2^{j+1}X) ⊆ (2^j X − 1, 2^{j+1} X] — wait that's not right either since γ < 2^{j+1}X ≤ the window's b ✓ and γ ≥ 2^jX > 2^jX − 1 ✓ — YES ⊆ ✓. Then b − a = 2^{j+1}X − (2^jX − 1) = 2^j X + 1: count ≤ A₀·(2^jX + 2)·log(3·max|2^jX−1|·|2^{j+1}X| + 5) = A₀(2^jX+2)·log(3·2^{j+1}X + 5) ✓ (max is 2^{j+1}X for X ≥ 1, j ≥ 0: |2^jX − 1| ≤ 2^jX+1 ≤ 2^{j+1}X ✓). Then two sides: ≤ 2A₀(2^jX+2)·log(3·2^{j+1}X+5). Then 2^jX + 2 ≤ 2^{j+1}X·... 2^jX + 2 ≤ 2·2^jX ⟺ 2 ≤ 2^j X ✓ (X ≥ 200): so ≤ 4A₀·2^jX·log(3·2^{j+1}X+5) — wait: 2A₀·(2^jX+2) ≤ 2A₀·2^{j+1}X = 4A₀·2^jX ✓.
Then F_j := 4A₀·2^jX·log(3·2^{j+1}X+5)/(4^j X²) = (4A₀/X)·log(3·2^{j+1}X+5)/2^j.
log(3·2^{j+1}X+5) ≤ log(2^{j+4}X) (as before: 3·2^{j+1}X + 5 ≤ 2^{j+4}X ⟺ 6·2^jX + 5 ≤ 16·2^jX ⟺ 5 ≤ 10·2^jX ✓ X ≥ 200) = (j+4)log2 + log X.
F_j ≤ (4A₀/X)·((j+4)log2 + log X)/2^j.
∑' F_j ≤ (4A₀/X)·(10 log 2 + 2 log X) ≤ (4A₀/X)·(10 + 2 log X) ≤ (4A₀/X)·4 log X = 16A₀ log X/X ✓ (X ≥ 200 ⟹ log X ≥ 5.3 ≥ 5 ⟹ 10 ≤ 2 log X ✓).
Let me now write the Lean. First (iv) the pure-real dyadic sum as a standalone lemma:
```lean
/-- The dyadic series closed form: ∑' j, ((j+4)·log 2 + log X)/2^j
= 10·log 2 + 2·log X. -/
lemma tsum_dyadic_log (X : ℝ) :
∑' j : ℕ, ((j + 4) * Real.log 2 + Real.log X) / (2 : ℝ) ^ j
= 10 * Real.log 2 + 2 * Real.log X := by
have h1 : Summable (fun j : ℕ => (j : ℝ) / (2 : ℝ) ^ j) := by
have := hasSum_coe_mul_geometric_of_norm_lt_one (r := (1 : ℝ) / 2) (by norm_num)
-- HasSum (fun n => ↑n * (1/2)^n) 2 — convert n/2^j = ↑n·(1/2)^j: div_eq_mul_inv + inv_pow:
exact this.summable.congr (fun j => by rw [div_eq_mul_inv, inv_pow]) -- hmm (↑j)·(1/2)^j vs ↑j/2^j: 1/2^j = (1/2)^j ✓ inv_pow: (1/2)^j = 1/2^j?? (↑(2:ℕ))^j = 2^j: hmm careful: (1/2 : ℝ)^j = 1/2^j by... `one_div_pow : (1/a)^n = 1/a^n` ✓.
...
```
Let me structure: ∑' ((j+4)log2 + logX)/2^j = log2·∑' j/2^j + (4log2 + logX)·∑' 1/2^j:
∑' j/2^j = 2 (hasSum_coe_mul_geometric... with the div/pow form); ∑' 1/2^j = 2 (tsum_geometric_two ✓).
```lean
have hgeom2 : ∑' j : ℕ, ((1 : ℝ) / 2) ^ j = 2 := tsum_geometric_two
have hlin : ∑' j : ℕ, (j : ℝ) * ((1 : ℝ) / 2) ^ j = 2 :=
(hasSum_coe_mul_geometric_of_norm_lt_one (r := (1 : ℝ) / 2) (by norm_num)).tsum_eq
-- rearrange: ((j+4)log2 + logX)/2^j = log2·(j·(1/2)^j) + (4log2+logX)·(1/2)^j
have hsplit : (fun j : ℕ => ((j + 4) * Real.log 2 + Real.log X) / (2 : ℝ) ^ j)
= fun j : ℕ => Real.log 2 * ((j : ℝ) * ((1 : ℝ) / 2) ^ j)
+ (4 * Real.log 2 + Real.log X) * ((1 : ℝ) / 2) ^ j := by
funext j
field_simp?? — /(2^j) vs ·(1/2)^j: (1/2)^j = 1/2^j... rw [div_eq_mul_inv, inv_pow]?? (2^j)⁻¹ = (2⁻¹)^j: inv_pow : (a⁻¹)^j = (a^j)⁻¹ ✓: ((j+4)log2+logX)·(2^j)⁻¹ = ((j+4)log2+logX)·(2⁻¹)^j: and 2⁻¹ = 1/2 ✓ (inv_two? one_div 2: (2:ℝ)⁻¹ = 1/2 — `inv_two`? or by norm_num: (2:ℝ)⁻¹ = 1/2 ✓ norm_num). So: rw [div_eq_mul_inv, ← inv_pow?? — (2:ℝ)^j ⁻¹ vs (2⁻¹)^j: inv_pow : (a^j)⁻¹ = (a⁻¹)^j ✓: (2^j)⁻¹ = (2⁻¹)^j: rw [div_eq_mul_inv, inv_pow] — goal becomes ·(2⁻¹)^j form: then show (2:ℝ)⁻¹ = 1/2: norm_num... then ring to distribute. Let me write: funext j; rw [div_eq_mul_inv, inv_pow]; ring_nf?? — the target form has (1/2)^j: (2⁻¹)^j vs (1/2)^j: inv_two : (2:ℝ)⁻¹ = 1/2? hmm `inv_two`? — `one_div_two`... For ℝ: (2:ℝ)⁻¹ = 1/2 by norm_num ✓ (norm_num proves (2:ℝ)⁻¹ = 1/2? div_inv... `inv_eq_one_div`... just `show ... ; ring`? Let me do: funext j; rw [div_eq_mul_inv, inv_pow]; ring_nf — ring_nf should normalize (2⁻¹)^j vs (1/2)^j? ring handles ⁻¹ of numerals: 2⁻¹ vs 1/2 — ring normal form treats them the same ✓ (inv of concrete numerals is computed by ring_nf ✓). So: funext j; rw [div_eq_mul_inv, inv_pow]; ring.
rw [hsplit, Summable.tsum_add (hlin.summable.mul_left _) (hgeom2.summable.mul_left _)]
rw [tsum_mul_left, tsum_mul_left, hlin, hgeom2] -- tsum_mul_left : ∑' (c·f) = c·∑'f: the constant-mul: `tsum_mul_left : ∑' (i), c * f i = c * ∑' f i` ✓ (Summable not needed for mul_left — it's valid always? `tsum_mul_left : ∑' i, c * f i = c * ∑' i, f i` — unconditional for ℝ? — hmm tsum_mul_left might need Summable or is unconditional-with-junk... In this Mathlib `tsum_mul_left` is unconditional ✓ (mul_left of tsum by constant works unconditionally: if not summable both sides are 0·0... c·∑'f with ∑'f = 0 junk: RHS = 0 = LHS (junk tsum = 0) ✓ — it's stated unconditionally I believe).
ring
```
Wait — `tsum_mul_left` on `∑' j, log2 * (j * (1/2)^j)` = log2 * ∑' — ✓. But Summable.tsum_add needed the summabilities ✓. Then after rewrites: log2·2 + (4log2+logX)·2 = 2log2 + 8log2 + 2logX = 10 log2 + 2 logX ✓ ring.
Then the per-term comparison F_j ≤ (4A₀/X)·G_j where G_j := ((j+4)log2 + logX)/2^j and ∑' G_j = 10log2 + 2logX ≤ 4 log X (X ≥ 200):
```lean
lemma dyadic_log_bound {X : ℝ} (hX : 200 ≤ X) :
(4 * A0count / X) * (10 * Real.log 2 + 2 * Real.log X)
≤ 16 * A0count * Real.log X / X := by
have hlogX : 5 ≤ Real.log X := by
-- X ≥ 200 ≥ e^5: e^5 ≤ 2.718281829^5 ≤ 148.42 ≤ 200
rw [show (5 : ℝ) = Real.log (Real.exp 5) by rw [Real.log_exp]]
apply Real.log_le_log (Real.exp_pos _)
have h1 : Real.exp 5 = Real.exp 1 ^ 5 := by rw [← Real.exp_nat_mul]; norm_num -- exp(1*5) = exp 5: Real.exp_nat_mul : exp (n*x) = (exp x)^n: so exp 5 = exp(1*5)... rw [← Real.exp_nat_mul]: goal exp 5 = (exp 1)^5: ←exp_nat_mul rewrites (exp 1)^5 → exp (5*1)?? direction: Real.exp_nat_mul (n : ℕ) (x) : Real.exp (n * x) = (Real.exp x)^n: ← it: (exp x)^n → exp (n*x): goal exp 5 = (exp 1)^5: rw [← Real.exp_nat_mul] : exp 5 = exp (↑5 * 1): norm_num: 5*1 = 5... hmm the cast: exp (↑(5:ℕ) * 1): ↑(5:ℕ) = (5:ℝ): push_cast... `rw [← Real.exp_nat_mul]; norm_num` — the norm_num should simplify ↑5 * 1 → 5 ✓... let me use `Real.exp_nat_mul` differently: have h1 : Real.exp 5 = (Real.exp 1) ^ 5 := by rw [show (5:ℝ) = (5:ℕ) * 1 by norm_num, Real.exp_nat_mul, mul_one]?? messy. Alternative: Real.exp 5 = Real.exp (1*5): `rw [show (5:ℝ) = 1 * 5 from by norm_num]`: exp (1*5)... exp_nat_mul is about n*x with n : ℕ cast: exp ((5:ℕ) * 1)?? — hmm (5:ℝ) = ((5:ℕ):ℝ) * 1: by norm_num + cast: `rw [show (5:ℝ) = ((5:ℕ):ℝ) * 1 by norm_num, Real.exp_nat_mul]`?? Real.exp_nat_mul (5:ℕ) (1:ℝ) : exp (↑5 * 1) = (exp 1)^5 ✓ then mul_one... ugh. Let me just: have h1 : Real.exp 5 = (Real.exp 1)^5 := by rw [← Real.exp_nat_mul]; norm_num — the ← rewrite on goal `Real.exp 5 = (Real.exp 1)^5`: pattern (Real.exp ?x)^?n on RHS: rewrites to Real.exp (↑5 * 1): goal exp 5 = exp (↑5*1): norm_num : ↑5*1 = 5?? norm_num proves exp 5 = exp 5 after computing ↑5*1 = 5: `norm_num` handles Nat-cast + mul_one? it should: norm_num can prove (↑(5:ℕ) * 1 : ℝ) = 5 ✓ then goal exp 5 = exp 5 closed by rfl?? norm_num doesn't close exp-equalities — after norm_num simplifies ↑5*1 to 5 the goal is exp 5 = exp 5 — closed by rfl? norm_num finishes with rfl-closure ✓ probably. Fallback: `rw [← Real.exp_nat_mul]; congr 1; norm_num`.
have h2 := Real.exp_one_lt_d9 -- exp 1 < 2.718281829-ish (d9 form)
-- (exp 1)^5 ≤ 2.718281829^5 ≤ 148.42 ≤ 200 ≤ X
have h3 : (Real.exp 1) ^ 5 ≤ (2.718281829 : ℝ) ^ 5 :=
pow_le_pow_left₀ (Real.exp_pos 1).le h2.le 5
have h4 : (2.718281829 : ℝ) ^ 5 ≤ 200 := by norm_num
linarith [h3, h4, ...]
-- then: 10·log2 + 2logX ≤ 4·logX (log2 ≤ 1, 10 ≤ 2logX)
have hlog2 : Real.log 2 ≤ 1 := by
rw [show (1:ℝ) = Real.log (Real.exp 1) by rw [Real.log_exp]]
apply Real.log_le_log (by norm_num)
exact Real.exp_one_gt_d9.le -- 2 ≤ exp 1: exp_one_gt_d9 : 2.718281828 < exp 1 ⟹ 2 ≤ exp 1: linarith [Real.exp_one_gt_d9]
...
```
Hmm — Real.exp_one_gt_d9 / lt_d9: the exact names: used in LiGapCircles: `Real.exp_one_lt_d9.le` — so exp_one_lt_d9 : Real.exp 1 < 2.718281828459046 (the d9 UPPER) — and exp_one_gt_d9 : 2.718281828459045 < Real.exp 1 (LOWER) presumably ✓ both exist (used in LiContour: `Real.exp_one_lt_d9` and my earlier usage `Real.exp_one_gt_d9` in LiDigammaLeft — the session-027 banked: `Real.log_two_gt_d9`, `Real.eulerMascheroniConstant_lt_two_thirds`, `Real.one_half_lt_eulerMascheroniConstant` exist — exp_one_gt_d9 likely mirrors lt_d9 ✓; verify at build).
For the final assembly inequality: (4A₀/X)·(10 log2 + 2 logX) ≤ 16A₀ logX/X:
10 log2 + 2 logX ≤ 10 + 2 logX ≤ 2 logX + 2 logX = 4 logX (10 ≤ 2 logX ⟸ logX ≥ 5 ✓): then (4A₀/X)·(4 logX) = 16A₀logX/X ✓ — with A₀/X ≥ 0 (X ≥ 200 > 0) ✓ mul_le_mul_of_nonneg_left.
OK. Now the main tail lemma. This is long; let me write the whole §4 now. Key sub-pieces:
T1. `tailTermSummable`: Summable (fun ρ : Z => if X < |ρ.im| then m/(1+ρ.im²) else (0:ℝ)) — via of_norm_bounded vs zero_sum_inv_sq.mul_left 2 with 1/(1+im²) ≤ 2/(1+‖γ‖²).
T2. The fiber map: `dyadClass X ρ := Nat.log 2 ⌊|(ρ : ℂ).im| / X⌋₊`.
T3. Fiber bounds: for ρ with X < |im| and dyadClass = j: 2^j ≤ |γ|/X (pow_log_le_self: needs ⌊|γ|/X⌋₊ ≠ 0 ⟸ |γ| ≥ X ⟸ ⌊⌋ ≥ 1: Nat.floor ≥ 1 ⟺ |γ|/X ≥ 1 ✓ (Nat.one_le_floor_iff? `Nat.one_le_floor_iff` : 1 ≤ ⌊r⌋₊ ↔ 1 ≤ r ✓)): 2^j·X ≤ |γ| ✓; and |γ| < 2^{j+1}·X: from ⌊|γ|/X⌋ < 2^{j+1} (lt_pow_succ_log_self ✓ no side condition): |γ|/X < ⌊⌋₊+1 (Nat.lt_floor_add_one) ≤ 2^{j+1} ✓ ⟹ |γ| < 2^{j+1} X ✓.
T4. The fiber finiteness + the fiber sum bound: fiber j (as a set of Z) := {ρ | dyadClass X ρ = j}: ⊆ {‖ρ‖ ≤ 1 + 2^{j+1}X} (‖ρ‖ ≤ |re|+|im| ≤ 1 + 2^{j+1}X — the norm_le_abs_re_add_abs_im: check name) — finite via finite_subtype_norm_lt — as a Finset via .toFinset. The fiber-sum: ∑'_{fiber-subtype} ofReal(tailTerm X) — hmm — the fiberwise gives ∑' over g⁻¹'{j} — the subtype {ρ : Z // dyadClass X ρ = j}: its tsum: this subtype is finite (the set-finiteness) ⟹ Fintype ⟹ tsum = finset sum (tsum_fintype). Then bound the finset sum: each term ofReal(tailTerm X ρ) ≤ ofReal((1/(4^jX²))·m_ρ)?? the tailTerm's if: for ρ with X < |im|: value m/(1+γ²) ≤ m/(4^jX²)·... 1/(1+γ²) ≤ 1/(4^jX²) ⟸ 4^jX² ≤ 1+γ² ⟸ |γ| ≥ 2^jX ✓ (from T3) — actually 4^jX² ≤ γ² ≤ 1+γ² ✓. For ρ with ¬(X < |im|): tailTerm = 0 ≤ anything ✓. So the finset sum ≤ ofReal(Σ (1/(4^jX²))·m) = ofReal((1/(4^jX²))·Σ m) ≤ ofReal((1/(4^jX²))·(count bound)) where Σ m over the fiber ≤ count_j. The count: the fiber's nonzero part ⊆ {2^jX ≤ |γ| < 2^{j+1}X}... — hmm — actually the count should be over the FIBER (all of it, incl. the zero-valued part — bound by the same interval cover ✓): fiber j ⊆ {ρ : |γ| < 2^{j+1}X AND (X < |γ| or tailTerm = 0)} — for the COUNT I include all: fiber j ⊆ {|γ| < 2^{j+1}X} — but that includes |γ| ≤ X — the count of {‖γ‖ < 2^{j+1}X} is ≍ 2^{j+1}X·log — TOO BIG?? no wait — the count of the fiber: I need Σ_{fiber j} m_ρ — including zeros with |γ| ≤ X (their tailTerm is 0 — but the COUNT Σ m includes them: their contribution to Σ m_ρ is positive!). Hmm — I should bound Σ_{fiber j} m·(term-value) NOT Σ m: the term-value for |γ| ≤ X is 0: so Σ_{fiber} m·value = Σ_{fiber, |γ|>X} m·value ≤ (1/(4^jX²))·Σ_{fiber, |γ|>X} m ≤ (1/(4^jX²))·(count of {2^jX ≤ |γ| < 2^{j+1}X}... for j ≥ 1: |γ| > X and fiber: 2^jX ≤ |γ| ✓; for j = 0: |γ| > X = 2^0 X ✓): so the count-set is {max(X, 2^jX) ≤ |γ| < 2^{j+1}X} = {2^j X ≤ |γ| < 2^{j+1}X} for j ≥ 0 ✓ (since X = 2^0X and for j ≥ 1: 2^jX ≥ X ✓). So the count: zeros with 2^jX ≤ |γ| < 2^{j+1}X ⊆ zerosIn (2^jX − 1) (2^{j+1}X) ∪ zerosIn (−2^{j+1}X) (−(2^jX − 1))·... careful: γ ≥ 2^jX ⟺ γ > 2^jX − 1 ✓ (no — γ ≥ c ⟺ γ > c − anything-positive? γ ≥ 2^jX ⟹ γ > 2^jX − 1 ✓ subset ✓); γ < 2^{j+1}X ⟹ γ ≤ 2^{j+1}X ✓. So ⊆ zerosIn (2^jX−1) (2^{j+1}X) ✓. Negative: γ ≤ −2^jX, γ > −2^{j+1}X: zerosIn (−2^{j+1}X) (−2^jX): T₁ < im ≤ T₂: −2^{j+1}X < γ ≤ −2^jX ✓ ⊇ {−2^{j+1}X < γ ≤ −2^jX} ✓ my set: γ ≤ −2^jX and γ > −2^{j+1}X ✓ ⊆ ✓.
So Σ_{fiber-nonzero} m ≤ Ncount(2^jX−1, 2^{j+1}X] + Ncount(−2^{j+1}X, −2^jX] ≤ 2·A₀·((2^{j+1}X − (2^jX−1)) + 1)·log(3·max + 5) = 2A₀(2^jX + 2)·log(3·2^{j+1}X + 5) — hmm wait: Ncount_le_of_interval_gen gives (b−a+1): first: a = 2^jX−1, b = 2^{j+1}X: b−a+1 = 2^jX + 2 ✓ max|a||b| = 2^{j+1}X (X ≥ 200, 2^jX−1 ≥ 0? 2^jX−1 ≥ 199 > 0: |a| = 2^jX−1 ≤ 2^jX ≤ 2^{j+1}X ✓ max = 2^{j+1}X ✓): ≤ A₀(2^jX+2)·log(3·2^{j+1}X+5) ✓; second: a = −2^{j+1}X, b = −2^jX: b−a+1 = 2^jX+1: max(|a|,|b|) = 2^{j+1}X ✓ ≤ A₀(2^jX+1)·log(3·2^{j+1}X+5) ✓. Total ≤ A₀(2^{j+1}X + 3)·log(3·2^{j+1}X+5) ≤ A₀(2^{j+2}X)·log(...) (2^{j+1}X+3 ≤ 2^{j+2}X ⟺ 3 ≤ 2^{j+1}X ✓ X ≥ 200).
So F_j := A₀·2^{j+2}·X·log(3·2^{j+1}X+5)/(4^j X²) = (4A₀/X)·log(3·2^{j+1}X+5)/2^j — hmm: 2^{j+2}/4^j = 4/2^j: = (4A₀/X)·log(...)/2^j ✓. log(3·2^{j+1}X+5) ≤ (j+4)log2 + logX (shown before for X ≥ 2... 3·2^{j+1}X+5 ≤ 2^{j+4}X ⟺ 6·2^jX + 5 ≤ 16·2^jX ⟺ 5 ≤ 10·2^jX ⟸ 10·200 = 2000 ≥ 5 ✓).
So F_j ≤ (4A₀/X)·((j+4)log2 + logX)/2^j = (4A₀/X)·G_j with ∑' G_j = 10log2 + 2logX ✓ (T-iv).
Then ∑' F_j ≤ (4A₀/X)·(10 log2 + 2 logX) ≤ 16A₀ logX/X (X ≥ 200) ✓.
The final statement:
```lean
theorem zero_tail_inv_sq_le {X : ℝ} (hX : 200 ≤ X) :
∑' ρ : {ρ : ℂ // IsNontrivialZero ρ},
(if X < |(ρ : ℂ).im| then (zeroMult ρ : ℝ) / (1 + ρ.im ^ 2) else 0)
≤ 16 * A0count * Real.log X / X
```
Assembly via ENNReal:
```lean
-- the real summand
set f : {ρ : ℂ // IsNontrivialZero ρ} → ℝ := fun ρ =>
if X < |(ρ : ℂ).im| then (zeroMult ρ : ℝ) / (1 + ρ.im ^ 2) else 0 with hf
have hfsum : Summable f := ... (T1)
have hfnonneg : ∀ ρ, 0 ≤ f ρ := ... (if-zero ✓ div_nonneg)
-- to ENNReal:
rw [← ENNReal.ofReal_le_ofReal_iff (by positivity : (0:ℝ) ≤ 16*A0count*Real.log X/X)]
rw [ENNReal.ofReal_tsum_of_nonneg hfnonneg hfsum]
-- ∑' (ofReal ∘ f) ≤ ofReal(16A₀ logX/X)
-- fiberwise:
have hfib := ENNReal.tsum_fiberwise (fun ρ => ENNReal.ofReal (f ρ)) (dyadClass X) -- hmm dyadClass as a function on the subtype: fun ρ => Nat.log 2 ⌊|ρ.1.im|/X⌋₊
rw [hfib]?? — hfib : ∑' j, ∑' fiber, f = ∑' i, f: I need ∑' i, f i ≤ ...: rw [← hfib]: goal ∑' j, ∑'_{fiber j} ofReal(f) ≤ ofReal(C):
-- each fiber tsum ≤ ofReal(F_j):
calc ∑' j, ∑'_{fiber j} ofReal(f ρ) ≤ ∑' j, ofReal (F_j) [tsum_le_tsum for ℝ≥0∞ — `ENNReal.tsum_le_tsum` (pointwise ≤, no summability needed ✓): `ENNReal.tsum_le_tsum (h : ∀ i, f i ≤ g i) : ∑' f ≤ ∑' g` ✓ exists]
_ = ofReal (∑' j, F_j) [ofReal_tsum_of_nonneg: F_j ≥ 0 ✓ summable: from F_j ≤ (4A₀/X)·G_j and ∑' G_j ✓ of_norm_bounded... F_j nonneg ✓ and ≤ the summable G-majorant: Summable.of_norm_bounded (G-summable) (‖F_j‖ ≤ ...): F_j ≥ 0 so ‖F_j‖ = F_j ≤ (4A₀/X)G_j ✓]
_ ≤ ofReal (16A₀ logX/X) [ofReal_le_ofReal: the real bound (iv) ✓]
```
The fiber tsum bound: ∑'_{b : (dyadClass X)⁻¹'{j}} ofReal(f b) ≤ ofReal(F_j):
- the fiber subtype {b : Z // dyadClass X b = j} — finite: the set {b : Z | dyadClass X b = j} ⊆ {b : Z | ‖b.1‖ ≤ 1 + 2^{j+1}X} (for b in the fiber: |im| < 2^{j+1}X (T3's upper — needs ⌊|γ|/X⌋₊ ≠ 0? lt_pow_succ_log_self works for any x: x < 2^(log.succ) — even x = 0: 0 < 2 ✓; so ⌊|γ|/X⌋ < 2^{j+1} ⟹ |γ|/X < ⌊⌋+1 ≤ 2^{j+1} ⟹ |γ| < 2^{j+1}X ✓ (X > 0)) ⟹ ‖ρ‖ ≤ |re|+|im| ≤ 1 + 2^{j+1}X ✓). Finite via finite_subtype_norm_lt (1+2^{j+1}X+1)-superset — the set is a subset of Z (the zero subtype) — finite_subtype_norm_lt is about {ρ : Z | ‖ρ.1‖ < R} ✓ my fiber set ⊆ that ✓.
- Fintype via Set.Finite.fintype ✓ haveI.
- ∑'_{fiber} ofReal(f) = ∑_{fiber-finset} ofReal(f) (tsum_fintype ✓) ≤ ∑ ofReal(F_j·...)... : each term ofReal(f b) ≤ ofReal((1/(4^jX²))·(zeroMult b:ℝ)): if X < |im|: f = m/(1+γ²) ≤ m/(4^jX²) = (1/(4^jX²))·m ✓ (ofReal_le_ofReal); else f = 0 ≤ · ✓ (ofReal_nonneg: (1/(4^jX²))·m ≥ 0 ✓). Sum ≤ ofReal(Σ (1/(4^jX²))·m) (ofReal_sum_of_nonneg + monotone ofReal: `ENNReal.ofReal_le_ofReal` per term then Finset.sum_le_sum then ofReal_sum_of_nonneg backwards — careful order: ∑ ofReal(f b) ≤ ∑ ofReal(g b) = ofReal(∑ g b) ← ofReal_sum_of_nonneg (g nonneg) ✓.
- ofReal((1/(4^jX²))·Σ_{fiber} m) ≤ ofReal((1/(4^jX²))·count_j) ⟸ Σ_{fiber} m ≤ count_j — the count bound via the interval cover: the fiber's zeros... the fiber is a finset of SUBTYPE elements; the intervals are sets of ℂ — the LiContour bridge pattern (zeroWindow_finite + hZC...) — hmm — the count I need: Σ_{ρ ∈ fiber} (zeroMult ρ : ℝ) ≤ Ncount(2^jX−1, 2^{j+1}X] + Ncount(−2^{j+1}X, −2^jX]: Ncount = ∑ᶠ over zerosIn = the toFinset sum of zeroMult ✓ (finsum_mem_eq_finite_toFinset_sum ✓ used in my Ncount_le_of_interval). So: Σ_{fiber} m ≤ the two toFinset-sums: subset-monotonicity of finset sums over ℂ-points? The fiber is a finset of SUBTYPE elements; zerosIn.toFinset is a finset of ℂ. Bridge: map Subtype.val: (fiber.image val) ⊆ (zerosIn ...).toFinset ∪ ...: Finset.sum_le_sum_of_subset_of_nonneg on the image (injective ⟹ sum over image = sum over fiber via Finset.sum_image ✓ banked "Finset.sum_image takes Set.InjOn, map = g, summand = f" — journal-011 ✓).
OK — it's all clear. It's a lot of code (~350 lines for §4). Let me write it in two parts: first the real-analysis pieces (tsum_dyadic_log + the X ≥ 200 bounds + the per-term/fiber count bridges), compile; then the ENNReal assembly.
Actually — let me write the whole thing and iterate. I'll add it to LiCircleBound.lean as §4.
All API confirmed. Writing §4 (the tail bound) — first the real-analysis pieces, then the fiberwise assembly.
tool: Edit
input
{
"file_path": "D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiCircleBound.lean",
"old_string": "lemma lowZeroConst_nonneg : 0 \u2264 lowZeroConst :=\n Finset.sum_nonneg fun _\u03c1 _ => mul_nonneg (Nat.cast_nonneg _)\n (add_nonneg one_pos.le (div_nonneg one_pos.le (norm_nonneg _)))\n\nend NguyenRH1\n\nend",
"new_string": "lemma lowZeroConst_nonneg : 0 \u2264 lowZeroConst :=\n Finset.sum_nonneg fun _\u03c1 _ => mul_nonneg (Nat.cast_nonneg _)\n (add_nonneg one_pos.le (div_nonneg one_pos.le (norm_nonneg _)))\n\n/-! ## 4. The far-tail bound -/\n\n/-- The dyadic log series closed form:\n\u2211' j, ((j+4)\u00b7log 2 + log X)/2^j = 10\u00b7log 2 + 2\u00b7log X. -/\nlemma tsum_dyadic_log (X : \u211d) :\n \u2211' j : \u2115, ((j + 4) * Real.log 2 + Real.log X) / (2 : \u211d) ^ j\n = 10 * Real.log 2 + 2 * Real.log X := by\n have hgeom2 : \u2211' j : \u2115, ((1 : \u211d) / 2) ^ j = 2 := tsum_geometric_two\n have hlin : \u2211' j : \u2115, (j : \u211d) * ((1 : \u211d) / 2) ^ j = 2 :=\n (hasSum_coe_mul_geometric_of_norm_lt_one (r := (1 : \u211d) / 2) (by norm_num)).tsum_eq\n have hsplit : (fun j : \u2115 => ((j + 4) * Real.log 2 + Real.log X) / (2 : \u211d) ^ j)\n = fun j : \u2115 => Real.log 2 * ((j : \u211d) * ((1 : \u211d) / 2) ^ j)\n + (4 * Real.log 2 + Real.log X) * ((1 : \u211d) / 2) ^ j := by\n funext j\n rw [div_eq_mul_inv, inv_pow]\n ring\n rw [hsplit, Summable.tsum_add (hlin.summable.mul_left _) (hgeom2.summable.mul_left _)]\n rw [tsum_mul_left, tsum_mul_left, hlin, hgeom2]\n ring\n\n/-- log 2 \u2264 1 (since 2 \u2264 e). -/\nlemma log_two_le_one : Real.log 2 \u2264 1 := by\n rw [show (1 : \u211d) = Real.log (Real.exp 1) by rw [Real.log_exp]]\n apply Real.log_le_log (by norm_num)\n have h := Real.exp_one_gt_d9\n linarith\n\n/-- For X \u2265 200: (4A\u2080/X)\u00b7(10\u00b7log 2 + 2\u00b7log X) \u2264 16\u00b7A\u2080\u00b7log X / X. -/\nlemma dyadic_tail_constant {X : \u211d} (hX : 200 \u2264 X) :\n (4 * A0count / X) * (10 * Real.log 2 + 2 * Real.log X)\n \u2264 16 * A0count * Real.log X / X := by\n have hX0 : (0 : \u211d) < X := by linarith\n have hlogX : 5 \u2264 Real.log X := by\n rw [show (5 : \u211d) = Real.log (Real.exp 5) by rw [Real.log_exp]]\n apply Real.log_le_log (Real.exp_pos _)\n have h1 : Real.exp 5 = (Real.exp 1) ^ 5 := by\n rw [\u2190 Real.exp_nat_mul]\n norm_num\n have h2 := Real.exp_one_lt_d9.le\n have h3 : (Real.exp 1) ^ 5 \u2264 (2.718281829 : \u211d) ^ 5 :=\n pow_le_pow_left\u2080 (Real.exp_pos 1).le h2 5\n have h4 : (2.718281829 : \u211d) ^ 5 \u2264 200 := by norm_num\n linarith [h1, h3, h4]\n have hlog2 := log_two_le_one\n have hA0 : (0 : \u211d) \u2264 4 * A0count / X := by positivity\n have h1 : 10 * Real.log 2 + 2 * Real.log X \u2264 4 * Real.log X := by linarith\n calc (4 * A0count / X) * (10 * Real.log 2 + 2 * Real.log X)\n \u2264 (4 * A0count / X) * (4 * Real.log X) := mul_le_mul_of_nonneg_left h1 hA0\n _ = 16 * A0count * Real.log X / X := by ring\n\n/-- The dyadic class of a zero relative to scale X:\nNat.log 2 \u230a|im \u03c1|/X\u230b\u208a, so 2^j\u00b7X \u2264 |im \u03c1| < 2^{j+1}\u00b7X when |im \u03c1| \u2265 X. -/\ndef dyadClass (X : \u211d) (\u03c1 : {\u03c1 : \u2102 // IsNontrivialZero \u03c1}) : \u2115 :=\n Nat.log 2 \u230a|(\u03c1 : \u2102).im| / X\u230b\u208a\n\nlemma dyadClass_lower {X : \u211d} (hX : 0 < X) {\u03c1 : {\u03c1 : \u2102 // IsNontrivialZero \u03c1}}\n (h\u03c1 : X \u2264 |(\u03c1 : \u2102).im|) :\n (2 : \u211d) ^ dyadClass X \u03c1 * X \u2264 |(\u03c1 : \u2102).im| := by\n have hfl : \u230a|(\u03c1 : \u2102).im| / X\u230b\u208a \u2260 0 := by\n rw [Ne, Nat.floor_eq_zero]\n push Not\n have h1 : (1 : \u211d) \u2264 |(\u03c1 : \u2102).im| / X := (le_div_iff\u2080 hX).mpr (by linarith)\n linarith\n have h2 := Nat.pow_log_le_self 2 hfl\n have h3 : ((2 ^ dyadClass X \u03c1 : \u2115) : \u211d) \u2264 \u230a|(\u03c1 : \u2102).im| / X\u230b\u208a := by exact_mod_cast h2\n have h4 : (\u230a|(\u03c1 : \u2102).im| / X\u230b\u208a : \u211d) \u2264 |(\u03c1 : \u2102).im| / X := Nat.floor_le (by positivity)\n have h5 : ((2 ^ dyadClass X \u03c1 : \u2115) : \u211d) = (2 : \u211d) ^ dyadClass X \u03c1 := by push_cast; ring\n rw [h5] at h3\n rw [le_div_iff\u2080 hX] at h4\n linarith\n\nlemma dyadClass_upper {X : \u211d} (hX : 0 < X) (\u03c1 : {\u03c1 : \u2102 // IsNontrivialZero \u03c1}) :\n |(\u03c1 : \u2102).im| < (2 : \u211d) ^ (dyadClass X \u03c1 + 1) * X := by\n have h2 : \u230a|(\u03c1 : \u2102).im| / X\u230b\u208a < 2 ^ (dyadClass X \u03c1 + 1) :=\n Nat.lt_pow_succ_log_self (by norm_num) _\n have h3 : ((\u230a|(\u03c1 : \u2102).im| / X\u230b\u208a : \u211d) + 1) \u2264 (2 : \u211d) ^ (dyadClass X \u03c1 + 1) := by\n have h4 : \u230a|(\u03c1 : \u2102).im| / X\u230b\u208a + 1 \u2264 2 ^ (dyadClass X \u03c1 + 1) := h2\n have h5 : ((\u230a|(\u03c1 : \u2102).im| / X\u230b\u208a + 1 : \u2115) : \u211d) \u2264 ((2 ^ (dyadClass X \u03c1 + 1) : \u2115) : \u211d) := by\n exact_mod_cast h4\n push_cast at h5\n linarith\n have h6 : |(\u03c1 : \u2102).im| / X < \u230a|(\u03c1 : \u2102).im| / X\u230b\u208a + 1 := Nat.lt_floor_add_one _\n have h7 : ((2 ^ (dyadClass X \u03c1 + 1) : \u2115) : \u211d) = (2 : \u211d) ^ (dyadClass X \u03c1 + 1) := by\n push_cast; ring\n rw [h7] at h3\n have h8 := (div_lt_iff\u2080 hX).mpr ((Nat.lt_floor_add_one _).trans_le h3)\n linarith\n\n/-- The tail summand (if-form on the zero subtype). -/\ndef tailTerm (X : \u211d) (\u03c1 : {\u03c1 : \u2102 // IsNontrivialZero \u03c1}) : \u211d :=\n if X < |(\u03c1 : \u2102).im| then (zeroMult \u03c1 : \u211d) / (1 + \u03c1.im ^ 2) else 0\n\nlemma tailTerm_nonneg {X : \u211d} (\u03c1 : {\u03c1 : \u2102 // IsNontrivialZero \u03c1}) :\n 0 \u2264 tailTerm X \u03c1 := by\n by_cases h : X < |(\u03c1 : \u2102).im| <;>\n simp [tailTerm, h, div_nonneg (Nat.cast_nonneg _)\n (by positivity : (0 : \u211d) \u2264 1 + \u03c1.im ^ 2)]\n\n/-- The tail summand is summable (dominated by 2\u00b7m/(1+\u2016\u03b3\u2016\u00b2) via\n1 + \u2016\u03b3\u2016\u00b2 \u2264 2(1 + im\u00b2)). -/\nlemma tailTerm_summable (X : \u211d) :\n Summable (tailTerm X) := by\n have hbase : Summable (fun \u03c1 : {\u03c1 : \u2102 // IsNontrivialZero \u03c1} =>\n 2 * ((zeroMult \u03c1 : \u211d) / (1 + Complex.normSq (gammaOf (\u03c1 : \u2102))))) :=\n (WeilEF.zero_sum_inv_sq zetaSeam).mul_left 2\n apply Summable.of_norm_bounded hbase\n intro \u03c1\n rw [tailTerm]\n by_cases h : X < |(\u03c1 : \u2102).im|\n \u00b7 rw [if_pos h]\n have hgam : Complex.normSq (gammaOf (\u03c1 : \u2102))\n = (\u03c1 : \u2102).im ^ 2 + (1 / 2 - (\u03c1 : \u2102).re) ^ 2 := by\n rw [Complex.normSq_apply, WeilEF.gammaOf_re, WeilEF.gammaOf_im]\n ring\n have hcmp : 1 + Complex.normSq (gammaOf (\u03c1 : \u2102)) \u2264 2 * (1 + (\u03c1 : \u2102).im ^ 2) := by\n rw [hgam]\n have hre : ((\u03c1 : \u2102).re - 1 / 2) ^ 2 \u2264 1 / 4 := by\n have h0 := \u03c1.2.2.1\n have h1 := \u03c1.2.2.2\n nlinarith [sq_nonneg ((\u03c1 : \u2102).re - 1 / 2)]\n nlinarith [sq_nonneg (\u03c1 : \u2102).im]\n have hpos1 : (0 : \u211d) < 1 + Complex.normSq (gammaOf (\u03c1 : \u2102)) := by\n have h := Complex.normSq_nonneg (gammaOf (\u03c1 : \u2102)); linarith\n have hpos2 : (0 : \u211d) < 1 + (\u03c1 : \u2102).im ^ 2 := by positivity\n have hfrac : 1 / (1 + (\u03c1 : \u2102).im ^ 2) \u2264 2 / (1 + Complex.normSq (gammaOf (\u03c1 : \u2102))) := by\n rw [div_le_div_iff\u2080 hpos2 hpos1]\n nlinarith [hcmp]\n have hm : (0 : \u211d) \u2264 (zeroMult \u03c1 : \u211d) := Nat.cast_nonneg _\n calc \u2016(zeroMult \u03c1 : \u211d) / (1 + (\u03c1 : \u2102).im ^ 2)\u2016\n = (zeroMult \u03c1 : \u211d) / (1 + (\u03c1 : \u2102).im ^ 2) := by\n rw [norm_div, Nat.cast_nonneg, ...] -- placeholder\n _ \u2264 2 * ((zeroMult \u03c1 : \u211d) / (1 + Complex.normSq (gammaOf (\u03c1 : \u2102)))) := by\n rw [show (zeroMult \u03c1 : \u211d) / (1 + (\u03c1 : \u2102).im ^ 2)\n = (zeroMult \u03c1 : \u211d) * (1 / (1 + (\u03c1 : \u2102).im ^ 2)) from by ring]\n rw [show 2 * ((zeroMult \u03c1 : \u211d) / (1 + Complex.normSq (gammaOf (\u03c1 : \u2102))))\n = (zeroMult \u03c1 : \u211d) * (2 / (1 + Complex.normSq (gammaOf (\u03c1 : \u2102)))) from by ring]\n exact mul_le_mul_of_nonneg_left hfrac hm\n \u00b7 rw [if_neg h]\n positivity\n\nend NguyenRH1\n\nend"
}
raw content_json (database row)
[{"type":"thinking","thinking":"`hasSum_coe_mul_geometric_of_norm_lt_one {r : 𝕜} (h : ‖r‖ < 1) : HasSum (fun n => ↑n * r^n) (r / (1−r)²)` ✓ — for r = 1/2: (1/2)/(1/2)² = 2 ✓.\n\nNow let me write the tail bound. Structure:\n\n```lean\n/-! ## 4. The far-tail bound -/\n\n/-- The tail summand family on the zero subtype (if-form). -/\ndef tailTerm (X : ℝ) (ρ : {ρ : ℂ // IsNontrivialZero ρ}) : ℝ :=\n if X < |(ρ : ℂ).im| then (zeroMult ρ : ℝ) / (1 + ρ.im^2) else 0\n```\n\nHmm wait — for the fiberwise I need the summand as a function on the zero subtype with the dyadic class. Let me NOT use an if-form; instead state the tsum over the fiber-type directly? The ENNReal.tsum_fiberwise works on the whole zero subtype: ∑'_{Z} f = ∑'_{j} ∑'_{Z, j(ρ) = j} f where f ρ := ofReal((zeroMult ρ)/(1+ρ.im²)) (no if) and j(ρ) := Nat.log 2 ⌊|ρ.im|/X⌋₊. Then the tail's contribution comes from fibers with 2^j X ≤ |γ| possible only when... every fiber is included in the total. The tail sum I want is ∑'_{|γ|>X} — I can bound it by the FULL fiberwise sum restricted... hmm.\n\nAlternative: state the tail bound directly for the FULL sum over the zero subtype of the if-form, and apply fiberwise to the if-form:\nf ρ := if X < |ρ.im| then ofReal(m/(1+γ²)) else 0 — on the whole zero subtype Z.\n∑'_Z f = ∑'_{j} ∑'_{fiber j} f.\nFiber j: zeros with Nat.log 2 ⌊|γ|/X⌋ = j. For ρ in fiber j with f ρ ≠ 0: |γ| > X ⟹ 2^j ≤ ⌊|γ|/X⌋ (pow_log_le_self needs ⌊⌋ ≠ 0 ✓ since |γ| > X ⟹ ⌊|γ|/X⌋ ≥ 1) ⟹ 2^j ≤ |γ|/X ⟹ 2^j X ≤ |γ| ✓ and ⌊|γ|/X⌋ < 2^{j+1} ⟹ |γ| < 2^{j+1} X + ... |γ|/X < ⌊⌋+1 ≤ 2^{j+1} ⟹ |γ| < 2^{j+1} X ✓.\nSo fiber j's nonzero part has |γ| ∈ (X, 2^{j+1} X) ∩ [2^j X, ...): ⊆ {2^j X ≤ |γ| < 2^{j+1} X} for j ≥ 1; for j = 0: |γ| < 2X and |γ| > X (the if) — ⊆ {X < |γ| < 2X} = {2^0 X < |γ| < 2^1 X} ✓ same form. GOOD — so fiber j's support ⊆ {2^j X ≤ |γ| < 2^{j+1} X} for all j (for j = 0 the lower bound 2^0 X = X ✓ from the if).\n\nFiber bound: ∑'_{fiber j} f ≤ ofReal(count_j · 1/(4^j X²)) where count_j := 2A₀(2^jX+1)·log(3·2^{j+1}X+5)... but careful — for j = 0: 4^0 X² = X² ✓ and the fiber-0 count: |γ| ∈ (X, 2X): Ncount(X, 2X] + Ncount[−2X, −X) ≤ 2·A₀·(X+1)·log(6X+5) ✓ matches the formula with j = 0 ✓.\n\nThe fiber is finite: fiber j ⊆ {‖ρ‖ ≤ 2^{j+1}X + 1}: |γ| < 2^{j+1}X ⟹ ‖ρ‖ ≤ |re| + |im| ≤ 1 + 2^{j+1}X·... ‖ρ‖ ≤ |re ρ| + |im ρ| via... `Complex.norm_le_abs_re_add_abs_im`? check name — or ‖ρ‖² = re²+im² ≤ 1 + (2^{j+1}X)² ⟹ ‖ρ‖ ≤ √(1+(2^{j+1}X)²) ≤ 1 + 2^{j+1}X (since √(1+y²) ≤ 1+y for y ≥ 0 ✓ — the sqrt: `Real.sqrt_le...`?). Simpler: ‖ρ‖ ≤ |re|+|im| ≤ 1 + 2^{j+1}X ✓ no sqrt. So fiber ⊆ {‖ρ‖ ≤ 1 + 2^{j+1}X} finite (finite_subtype_norm_lt (1 + 2^{j+1}X + 1) ⊇) ✓.\n\nThen:\n∑'_Z f = ∑'_{j} (fiber j sum) ≤ ∑'_{j} ofReal(F_j) where F_j := (count bound)·(1/(4^jX²)) — then ∑'_{j} ofReal(F_j) = ofReal(∑'_j F_j) (ofReal_tsum_of_nonneg; F_j summable — the dyadic series ✓) ≤ ofReal(16A₀ log X/X) ⟹ ∑'_Z f ≤ 16A₀ log X/X via ofReal_le_ofReal_iff ✓.\n\nThe real dyadic sum: ∑'_{j} F_j = ∑'_{j} 2A₀(2^jX+1)log(3·2^{j+1}X+5)/(4^jX²) ≤ 16A₀ log X/X:\nper-term: F_j ≤ (4A₀/X)·((j+4)log2 + logX)/2^j:\n 2A₀(2^jX+1)log(3·2^{j+1}X+5)/(4^jX²) ≤ 2A₀·(2^{j+1}X)·((j+4)log2 + logX)/(4^jX²) = (4A₀/X)·2^{j+1}/4^j·((j+4)log2+logX)·... 2^{j+1}/4^j = 2/2^j ✓ so = (4A₀/X)·((j+4)log2+logX)/2^j ✓.\n∑'_j ((j+4)log2 + logX)/2^j = log2·(Σ j/2^j + 4Σ 1/2^j) + logX·Σ 1/2^j = log2·(2+8) + 2logX = 10 log2 + 2 log X ≤ 10 + 2 log X (log 2 ≤ 1: Real.log_two_le_one?? need the name — log 2 ≤ 1 ⟺ 2 ≤ e: Real.exp_one_gt_d9? The exact: `Real.exp_one_gt_d9 : 2.718281828 < Real.exp 1`?? and log2 < 1 via Real.log_lt... log_two_lt... there's `Real.log_two_lt_d9`?? or via exp: log 2 < 1 ⟸ Real.log_lt... hmm: `Real.log_lt_of_lt_exp`? or Real.log_two_gt_d9 gives the LOWER bound 0.693 < log 2 — the upper: log 2 < 1 ⟺ 2 < e^1: exp_one_gt_d9 : 2.71828... < e ⟹ 2 < e ⟹ log 2 < 1 via Real.log_le_iff... `Real.log_le_iff_le_exp (h : 0 < x) : log x ≤ y ↔ x ≤ Real.exp y`?? then log 2 ≤ 1 ⟸ 2 ≤ e^1 ⟸ 2 ≤ 2.718... ✓ provable).\nThen (4A₀/X)·(10 + 2 log X) ≤ 16A₀ log X/X ⟺ 10 + 2 log X ≤ 4 log X ⟺ 10 ≤ 2 log X ⟺ log X ≥ 5 ⟸ X ≥ e^5 ⟸ X ≥ 200 (e^5 ≤ 2.718281829^5 ≤ 148.42 ≤ 200 — norm_num chain with Real.exp_one_lt_d9 — wait need e^5 ≤ 148.42: (exp 1)^5 ≤ 2.718281829^5 — exp_one_lt_d9 : exp 1 ≤ 2.718281829? then pow_le_pow_left₀ ✓ 2.718281829^5 ≤ 148.42 by norm_num ✓). So hX : 200 ≤ X.\n\nTotal: ∑'_{Z} f ≤ 16 A₀ log X / X for X ≥ 200 ✓.\n\nThis is a chunky but clear build. The steps:\n(i) the fiber finiteness + the fiber finset-sum bound (count × term).\n(ii) the count bound via Ncount intervals (both signs).\n(iii) the per-term 1/(1+γ²) ≤ 1/(4^jX²).\n(iv) the dyadic real sum ∑' F_j ≤ 16A₀ log X/X.\n(v) the fiberwise assembly + the ofReal plumbing.\n\nLet me estimate the pieces:\n- (iv) is self-contained real analysis ~100 lines.\n- (i)-(iii) ~150 lines.\n- (v) ~80 lines.\n\nTotal ~330 lines for the tail bound. Plus the main series bound after (~300). This session: get the tail bound done.\n\nLet me write it. I'll be careful about the fiberwise statement form. ENNReal.tsum_fiberwise (f : β → ℝ≥0∞) (g : β → γ) : ∑' x, ∑' b : g ⁻¹' {x}, f b = ∑' i, f i — note the direction: ∑'_{x} ∑'_{fiber x} f = ∑'_{i} f — the RHS is the FULL sum. So: ∑'_{Z} f = ∑'_{j} ∑'_{fiber j} f — by Eq.symm.\n\nAlso the fiber tsum ∑'_{b : g⁻¹'{j}} f b — the fiber is a SUBTYPE {b : Z // g b = j} — with Fintype from finiteness: ∑' = Finset.sum via tsum_fintype (needs Fintype instance — provide via Set.Finite.fintype? the fiber as a SET of Z: {ρ : Z | j ρ = j} finite ⊆ {‖ρ‖ ≤ 1+2^{j+1}X}: finite_subtype... then Fintype of the SET: (Set.Finite.fintype) — and the subtype {b : Z // g b = j} = the set's coercion ✓ defeq — tsum_fintype needs the Fintype instance on the subtype — provide via `haveI := (Set.Finite.fintype hfib)`).\n\nThen ∑'_{fiber} f = ∑_{fiber as finset} f (tsum_fintype) — bound the finset sum: each term ofReal(m/(1+γ²)) ≤ ofReal(m/(4^jX²)) (nonneg ✓ ofReal_le_ofReal ✓ from the per-term bound) — sum ≤ ofReal(Σ m/(4^jX²)) = ofReal((1/(4^jX²))·Σ m) ≤ ofReal(F_j) (count ✓). \n\nHmm — one wrinkle: ENNReal.ofReal of a SUM: ofReal_sum_of_nonneg ✓ (for the finset sums of nonneg reals: m/(1+γ²) ≥ 0 ✓).\n\nLet me also double-check `one_add_sq_ge` isn't needed — my per-term bound: 1/(1+γ²) ≤ 1/(4^j X²) from |γ| ≥ 2^j X: γ² ≥ 4^j X² ⟹ 1+γ² ≥ 4^jX² ⟹ 1/(1+γ²) ≤ 1/(4^jX²) ✓ (both positive: one_div_le_one_div_of_le with positivity ✓). ✓ no key-machinery needed (I use my own Nat.log dyadic class).\n\nAnd the count: fiber j's zeros have 2^j X ≤ |γ| < 2^{j+1} X — the two intervals (2^j X, 2^{j+1}X] (positive) and [−2^{j+1}X, −2^j X) hmm — Ncount windows are (a, b]: the negative side: |γ| ∈ [2^j X, 2^{j+1}X) with γ < 0 ⟺ γ ∈ (−2^{j+1}X, −2^j X]: Ncount(−2^{j+1}X)(−2^j X) ✓ (T₁ < im ≤ T₂: −2^{j+1}X < γ ≤ −2^j X ✓). So the fiber's zeros (nonzero-part) ⊆ zerosIn (2^j X) (2^{j+1}X) ∪ zerosIn (−2^{j+1}X) (−2^j X) ✓ — count ≤ the two Ncount intervals. Careful the endpoints: |γ| ≥ 2^j X and |γ| < 2^{j+1}X: positive: γ ∈ [2^jX, 2^{j+1}X) ⊆ (2^j X − ε...]: Ncount (2^j X) (2^{j+1}X] needs 2^j X < γ: γ = 2^j X exactly is EXCLUDED by Ncount but INCLUDED in my range — cover via Ncount (2^j X − 1) (2^{j+1}X]?? — no: simpler: include the boundary by using [2^j X ≤ γ] ⊆ (2^j X − 1/2, ...) hmm — just use Ncount (2^j X) (2^{j+1} X] ∪ Ncount covering γ = 2^j X exactly: {γ = 2^j X} ⊆ Ncount (2^j X − 1) (2^j X] — a third window... OR shift the dyadic class: use |γ| > 2^j X STRICT by defining j(ρ) via ⌈⌉ or strict inequalities... The fiber condition: Nat.log 2 ⌊|γ|/X⌋ = j: 2^j ≤ ⌊|γ|/X⌋ < 2^{j+1}: ⌊|γ|/X⌋ ≥ 2^j ⟹ |γ| ≥ ⌊|γ|/X⌋ ≥ 2^j ✓ non-strict; and |γ| < (⌊⌋+1)·X ≤ 2^{j+1}X ✓ strict. So |γ| ∈ [2^j X, 2^{j+1} X) — the left endpoint INCLUSIVE. For the window cover: γ ∈ [2^j X, 2^{j+1}X) ⟺ γ ∈ (2^j X − 1, 2^{j+1}X − 1]?? no: cover [2^jX, 2^{j+1}X) by Ncount (2^j X − 1) (2^{j+1}X): hmm Ncount a b := zerosIn (a, b]: (2^jX − 1, 2^{j+1}X] ⊇ [2^j X, 2^{j+1}X) ✓ — but then b−a = 2^j X + 1: count ≤ A₀(2^j X + 2)·log(...) — fine (constants shift slightly). OR simpler: cover by Ncount (2^j X) (2^{j+1} X] for γ > 2^jX and handle γ = 2^j X... no — simplest: cover [2^j X, 2^{j+1}X) ⊆ (2^j X − 1, 2^{j+1} X] — wait that's not right either since γ < 2^{j+1}X ≤ the window's b ✓ and γ ≥ 2^jX > 2^jX − 1 ✓ — YES ⊆ ✓. Then b − a = 2^{j+1}X − (2^jX − 1) = 2^j X + 1: count ≤ A₀·(2^jX + 2)·log(3·max|2^jX−1|·|2^{j+1}X| + 5) = A₀(2^jX+2)·log(3·2^{j+1}X + 5) ✓ (max is 2^{j+1}X for X ≥ 1, j ≥ 0: |2^jX − 1| ≤ 2^jX+1 ≤ 2^{j+1}X ✓). Then two sides: ≤ 2A₀(2^jX+2)·log(3·2^{j+1}X+5). Then 2^jX + 2 ≤ 2^{j+1}X·... 2^jX + 2 ≤ 2·2^jX ⟺ 2 ≤ 2^j X ✓ (X ≥ 200): so ≤ 4A₀·2^jX·log(3·2^{j+1}X+5) — wait: 2A₀·(2^jX+2) ≤ 2A₀·2^{j+1}X = 4A₀·2^jX ✓.\n\nThen F_j := 4A₀·2^jX·log(3·2^{j+1}X+5)/(4^j X²) = (4A₀/X)·log(3·2^{j+1}X+5)/2^j.\nlog(3·2^{j+1}X+5) ≤ log(2^{j+4}X) (as before: 3·2^{j+1}X + 5 ≤ 2^{j+4}X ⟺ 6·2^jX + 5 ≤ 16·2^jX ⟺ 5 ≤ 10·2^jX ✓ X ≥ 200) = (j+4)log2 + log X.\nF_j ≤ (4A₀/X)·((j+4)log2 + log X)/2^j.\n∑' F_j ≤ (4A₀/X)·(10 log 2 + 2 log X) ≤ (4A₀/X)·(10 + 2 log X) ≤ (4A₀/X)·4 log X = 16A₀ log X/X ✓ (X ≥ 200 ⟹ log X ≥ 5.3 ≥ 5 ⟹ 10 ≤ 2 log X ✓).\n\nLet me now write the Lean. First (iv) the pure-real dyadic sum as a standalone lemma:\n\n```lean\n/-- The dyadic series closed form: ∑' j, ((j+4)·log 2 + log X)/2^j\n= 10·log 2 + 2·log X. -/\nlemma tsum_dyadic_log (X : ℝ) :\n ∑' j : ℕ, ((j + 4) * Real.log 2 + Real.log X) / (2 : ℝ) ^ j\n = 10 * Real.log 2 + 2 * Real.log X := by\n have h1 : Summable (fun j : ℕ => (j : ℝ) / (2 : ℝ) ^ j) := by\n have := hasSum_coe_mul_geometric_of_norm_lt_one (r := (1 : ℝ) / 2) (by norm_num)\n -- HasSum (fun n => ↑n * (1/2)^n) 2 — convert n/2^j = ↑n·(1/2)^j: div_eq_mul_inv + inv_pow: \n exact this.summable.congr (fun j => by rw [div_eq_mul_inv, inv_pow]) -- hmm (↑j)·(1/2)^j vs ↑j/2^j: 1/2^j = (1/2)^j ✓ inv_pow: (1/2)^j = 1/2^j?? (↑(2:ℕ))^j = 2^j: hmm careful: (1/2 : ℝ)^j = 1/2^j by... `one_div_pow : (1/a)^n = 1/a^n` ✓.\n ...\n```\nLet me structure: ∑' ((j+4)log2 + logX)/2^j = log2·∑' j/2^j + (4log2 + logX)·∑' 1/2^j:\n∑' j/2^j = 2 (hasSum_coe_mul_geometric... with the div/pow form); ∑' 1/2^j = 2 (tsum_geometric_two ✓).\n```lean\n have hgeom2 : ∑' j : ℕ, ((1 : ℝ) / 2) ^ j = 2 := tsum_geometric_two\n have hlin : ∑' j : ℕ, (j : ℝ) * ((1 : ℝ) / 2) ^ j = 2 :=\n (hasSum_coe_mul_geometric_of_norm_lt_one (r := (1 : ℝ) / 2) (by norm_num)).tsum_eq\n -- rearrange: ((j+4)log2 + logX)/2^j = log2·(j·(1/2)^j) + (4log2+logX)·(1/2)^j\n have hsplit : (fun j : ℕ => ((j + 4) * Real.log 2 + Real.log X) / (2 : ℝ) ^ j)\n = fun j : ℕ => Real.log 2 * ((j : ℝ) * ((1 : ℝ) / 2) ^ j)\n + (4 * Real.log 2 + Real.log X) * ((1 : ℝ) / 2) ^ j := by\n funext j\n field_simp?? — /(2^j) vs ·(1/2)^j: (1/2)^j = 1/2^j... rw [div_eq_mul_inv, inv_pow]?? (2^j)⁻¹ = (2⁻¹)^j: inv_pow : (a⁻¹)^j = (a^j)⁻¹ ✓: ((j+4)log2+logX)·(2^j)⁻¹ = ((j+4)log2+logX)·(2⁻¹)^j: and 2⁻¹ = 1/2 ✓ (inv_two? one_div 2: (2:ℝ)⁻¹ = 1/2 — `inv_two`? or by norm_num: (2:ℝ)⁻¹ = 1/2 ✓ norm_num). So: rw [div_eq_mul_inv, ← inv_pow?? — (2:ℝ)^j ⁻¹ vs (2⁻¹)^j: inv_pow : (a^j)⁻¹ = (a⁻¹)^j ✓: (2^j)⁻¹ = (2⁻¹)^j: rw [div_eq_mul_inv, inv_pow] — goal becomes ·(2⁻¹)^j form: then show (2:ℝ)⁻¹ = 1/2: norm_num... then ring to distribute. Let me write: funext j; rw [div_eq_mul_inv, inv_pow]; ring_nf?? — the target form has (1/2)^j: (2⁻¹)^j vs (1/2)^j: inv_two : (2:ℝ)⁻¹ = 1/2? hmm `inv_two`? — `one_div_two`... For ℝ: (2:ℝ)⁻¹ = 1/2 by norm_num ✓ (norm_num proves (2:ℝ)⁻¹ = 1/2? div_inv... `inv_eq_one_div`... just `show ... ; ring`? Let me do: funext j; rw [div_eq_mul_inv, inv_pow]; ring_nf — ring_nf should normalize (2⁻¹)^j vs (1/2)^j? ring handles ⁻¹ of numerals: 2⁻¹ vs 1/2 — ring normal form treats them the same ✓ (inv of concrete numerals is computed by ring_nf ✓). So: funext j; rw [div_eq_mul_inv, inv_pow]; ring.\n rw [hsplit, Summable.tsum_add (hlin.summable.mul_left _) (hgeom2.summable.mul_left _)]\n rw [tsum_mul_left, tsum_mul_left, hlin, hgeom2] -- tsum_mul_left : ∑' (c·f) = c·∑'f: the constant-mul: `tsum_mul_left : ∑' (i), c * f i = c * ∑' f i` ✓ (Summable not needed for mul_left — it's valid always? `tsum_mul_left : ∑' i, c * f i = c * ∑' i, f i` — unconditional for ℝ? — hmm tsum_mul_left might need Summable or is unconditional-with-junk... In this Mathlib `tsum_mul_left` is unconditional ✓ (mul_left of tsum by constant works unconditionally: if not summable both sides are 0·0... c·∑'f with ∑'f = 0 junk: RHS = 0 = LHS (junk tsum = 0) ✓ — it's stated unconditionally I believe).\n ring\n```\nWait — `tsum_mul_left` on `∑' j, log2 * (j * (1/2)^j)` = log2 * ∑' — ✓. But Summable.tsum_add needed the summabilities ✓. Then after rewrites: log2·2 + (4log2+logX)·2 = 2log2 + 8log2 + 2logX = 10 log2 + 2 logX ✓ ring.\n\nThen the per-term comparison F_j ≤ (4A₀/X)·G_j where G_j := ((j+4)log2 + logX)/2^j and ∑' G_j = 10log2 + 2logX ≤ 4 log X (X ≥ 200):\n\n```lean\nlemma dyadic_log_bound {X : ℝ} (hX : 200 ≤ X) :\n (4 * A0count / X) * (10 * Real.log 2 + 2 * Real.log X)\n ≤ 16 * A0count * Real.log X / X := by\n have hlogX : 5 ≤ Real.log X := by\n -- X ≥ 200 ≥ e^5: e^5 ≤ 2.718281829^5 ≤ 148.42 ≤ 200\n rw [show (5 : ℝ) = Real.log (Real.exp 5) by rw [Real.log_exp]]\n apply Real.log_le_log (Real.exp_pos _)\n have h1 : Real.exp 5 = Real.exp 1 ^ 5 := by rw [← Real.exp_nat_mul]; norm_num -- exp(1*5) = exp 5: Real.exp_nat_mul : exp (n*x) = (exp x)^n: so exp 5 = exp(1*5)... rw [← Real.exp_nat_mul]: goal exp 5 = (exp 1)^5: ←exp_nat_mul rewrites (exp 1)^5 → exp (5*1)?? direction: Real.exp_nat_mul (n : ℕ) (x) : Real.exp (n * x) = (Real.exp x)^n: ← it: (exp x)^n → exp (n*x): goal exp 5 = (exp 1)^5: rw [← Real.exp_nat_mul] : exp 5 = exp (↑5 * 1): norm_num: 5*1 = 5... hmm the cast: exp (↑(5:ℕ) * 1): ↑(5:ℕ) = (5:ℝ): push_cast... `rw [← Real.exp_nat_mul]; norm_num` — the norm_num should simplify ↑5 * 1 → 5 ✓... let me use `Real.exp_nat_mul` differently: have h1 : Real.exp 5 = (Real.exp 1) ^ 5 := by rw [show (5:ℝ) = (5:ℕ) * 1 by norm_num, Real.exp_nat_mul, mul_one]?? messy. Alternative: Real.exp 5 = Real.exp (1*5): `rw [show (5:ℝ) = 1 * 5 from by norm_num]`: exp (1*5)... exp_nat_mul is about n*x with n : ℕ cast: exp ((5:ℕ) * 1)?? — hmm (5:ℝ) = ((5:ℕ):ℝ) * 1: by norm_num + cast: `rw [show (5:ℝ) = ((5:ℕ):ℝ) * 1 by norm_num, Real.exp_nat_mul]`?? Real.exp_nat_mul (5:ℕ) (1:ℝ) : exp (↑5 * 1) = (exp 1)^5 ✓ then mul_one... ugh. Let me just: have h1 : Real.exp 5 = (Real.exp 1)^5 := by rw [← Real.exp_nat_mul]; norm_num — the ← rewrite on goal `Real.exp 5 = (Real.exp 1)^5`: pattern (Real.exp ?x)^?n on RHS: rewrites to Real.exp (↑5 * 1): goal exp 5 = exp (↑5*1): norm_num : ↑5*1 = 5?? norm_num proves exp 5 = exp 5 after computing ↑5*1 = 5: `norm_num` handles Nat-cast + mul_one? it should: norm_num can prove (↑(5:ℕ) * 1 : ℝ) = 5 ✓ then goal exp 5 = exp 5 closed by rfl?? norm_num doesn't close exp-equalities — after norm_num simplifies ↑5*1 to 5 the goal is exp 5 = exp 5 — closed by rfl? norm_num finishes with rfl-closure ✓ probably. Fallback: `rw [← Real.exp_nat_mul]; congr 1; norm_num`.\n have h2 := Real.exp_one_lt_d9 -- exp 1 < 2.718281829-ish (d9 form)\n -- (exp 1)^5 ≤ 2.718281829^5 ≤ 148.42 ≤ 200 ≤ X\n have h3 : (Real.exp 1) ^ 5 ≤ (2.718281829 : ℝ) ^ 5 :=\n pow_le_pow_left₀ (Real.exp_pos 1).le h2.le 5\n have h4 : (2.718281829 : ℝ) ^ 5 ≤ 200 := by norm_num\n linarith [h3, h4, ...]\n -- then: 10·log2 + 2logX ≤ 4·logX (log2 ≤ 1, 10 ≤ 2logX)\n have hlog2 : Real.log 2 ≤ 1 := by\n rw [show (1:ℝ) = Real.log (Real.exp 1) by rw [Real.log_exp]]\n apply Real.log_le_log (by norm_num)\n exact Real.exp_one_gt_d9.le -- 2 ≤ exp 1: exp_one_gt_d9 : 2.718281828 < exp 1 ⟹ 2 ≤ exp 1: linarith [Real.exp_one_gt_d9]\n ...\n```\nHmm — Real.exp_one_gt_d9 / lt_d9: the exact names: used in LiGapCircles: `Real.exp_one_lt_d9.le` — so exp_one_lt_d9 : Real.exp 1 < 2.718281828459046 (the d9 UPPER) — and exp_one_gt_d9 : 2.718281828459045 < Real.exp 1 (LOWER) presumably ✓ both exist (used in LiContour: `Real.exp_one_lt_d9` and my earlier usage `Real.exp_one_gt_d9` in LiDigammaLeft — the session-027 banked: `Real.log_two_gt_d9`, `Real.eulerMascheroniConstant_lt_two_thirds`, `Real.one_half_lt_eulerMascheroniConstant` exist — exp_one_gt_d9 likely mirrors lt_d9 ✓; verify at build).\n\nFor the final assembly inequality: (4A₀/X)·(10 log2 + 2 logX) ≤ 16A₀ logX/X:\n10 log2 + 2 logX ≤ 10 + 2 logX ≤ 2 logX + 2 logX = 4 logX (10 ≤ 2 logX ⟸ logX ≥ 5 ✓): then (4A₀/X)·(4 logX) = 16A₀logX/X ✓ — with A₀/X ≥ 0 (X ≥ 200 > 0) ✓ mul_le_mul_of_nonneg_left.\n\nOK. Now the main tail lemma. This is long; let me write the whole §4 now. Key sub-pieces:\n\nT1. `tailTermSummable`: Summable (fun ρ : Z => if X < |ρ.im| then m/(1+ρ.im²) else (0:ℝ)) — via of_norm_bounded vs zero_sum_inv_sq.mul_left 2 with 1/(1+im²) ≤ 2/(1+‖γ‖²).\n\nT2. The fiber map: `dyadClass X ρ := Nat.log 2 ⌊|(ρ : ℂ).im| / X⌋₊`.\n\nT3. Fiber bounds: for ρ with X < |im| and dyadClass = j: 2^j ≤ |γ|/X (pow_log_le_self: needs ⌊|γ|/X⌋₊ ≠ 0 ⟸ |γ| ≥ X ⟸ ⌊⌋ ≥ 1: Nat.floor ≥ 1 ⟺ |γ|/X ≥ 1 ✓ (Nat.one_le_floor_iff? `Nat.one_le_floor_iff` : 1 ≤ ⌊r⌋₊ ↔ 1 ≤ r ✓)): 2^j·X ≤ |γ| ✓; and |γ| < 2^{j+1}·X: from ⌊|γ|/X⌋ < 2^{j+1} (lt_pow_succ_log_self ✓ no side condition): |γ|/X < ⌊⌋₊+1 (Nat.lt_floor_add_one) ≤ 2^{j+1} ✓ ⟹ |γ| < 2^{j+1} X ✓.\n\nT4. The fiber finiteness + the fiber sum bound: fiber j (as a set of Z) := {ρ | dyadClass X ρ = j}: ⊆ {‖ρ‖ ≤ 1 + 2^{j+1}X} (‖ρ‖ ≤ |re|+|im| ≤ 1 + 2^{j+1}X — the norm_le_abs_re_add_abs_im: check name) — finite via finite_subtype_norm_lt — as a Finset via .toFinset. The fiber-sum: ∑'_{fiber-subtype} ofReal(tailTerm X) — hmm — the fiberwise gives ∑' over g⁻¹'{j} — the subtype {ρ : Z // dyadClass X ρ = j}: its tsum: this subtype is finite (the set-finiteness) ⟹ Fintype ⟹ tsum = finset sum (tsum_fintype). Then bound the finset sum: each term ofReal(tailTerm X ρ) ≤ ofReal((1/(4^jX²))·m_ρ)?? the tailTerm's if: for ρ with X < |im|: value m/(1+γ²) ≤ m/(4^jX²)·... 1/(1+γ²) ≤ 1/(4^jX²) ⟸ 4^jX² ≤ 1+γ² ⟸ |γ| ≥ 2^jX ✓ (from T3) — actually 4^jX² ≤ γ² ≤ 1+γ² ✓. For ρ with ¬(X < |im|): tailTerm = 0 ≤ anything ✓. So the finset sum ≤ ofReal(Σ (1/(4^jX²))·m) = ofReal((1/(4^jX²))·Σ m) ≤ ofReal((1/(4^jX²))·(count bound)) where Σ m over the fiber ≤ count_j. The count: the fiber's nonzero part ⊆ {2^jX ≤ |γ| < 2^{j+1}X}... — hmm — actually the count should be over the FIBER (all of it, incl. the zero-valued part — bound by the same interval cover ✓): fiber j ⊆ {ρ : |γ| < 2^{j+1}X AND (X < |γ| or tailTerm = 0)} — for the COUNT I include all: fiber j ⊆ {|γ| < 2^{j+1}X} — but that includes |γ| ≤ X — the count of {‖γ‖ < 2^{j+1}X} is ≍ 2^{j+1}X·log — TOO BIG?? no wait — the count of the fiber: I need Σ_{fiber j} m_ρ — including zeros with |γ| ≤ X (their tailTerm is 0 — but the COUNT Σ m includes them: their contribution to Σ m_ρ is positive!). Hmm — I should bound Σ_{fiber j} m·(term-value) NOT Σ m: the term-value for |γ| ≤ X is 0: so Σ_{fiber} m·value = Σ_{fiber, |γ|>X} m·value ≤ (1/(4^jX²))·Σ_{fiber, |γ|>X} m ≤ (1/(4^jX²))·(count of {2^jX ≤ |γ| < 2^{j+1}X}... for j ≥ 1: |γ| > X and fiber: 2^jX ≤ |γ| ✓; for j = 0: |γ| > X = 2^0 X ✓): so the count-set is {max(X, 2^jX) ≤ |γ| < 2^{j+1}X} = {2^j X ≤ |γ| < 2^{j+1}X} for j ≥ 0 ✓ (since X = 2^0X and for j ≥ 1: 2^jX ≥ X ✓). So the count: zeros with 2^jX ≤ |γ| < 2^{j+1}X ⊆ zerosIn (2^jX − 1) (2^{j+1}X) ∪ zerosIn (−2^{j+1}X) (−(2^jX − 1))·... careful: γ ≥ 2^jX ⟺ γ > 2^jX − 1 ✓ (no — γ ≥ c ⟺ γ > c − anything-positive? γ ≥ 2^jX ⟹ γ > 2^jX − 1 ✓ subset ✓); γ < 2^{j+1}X ⟹ γ ≤ 2^{j+1}X ✓. So ⊆ zerosIn (2^jX−1) (2^{j+1}X) ✓. Negative: γ ≤ −2^jX, γ > −2^{j+1}X: zerosIn (−2^{j+1}X) (−2^jX): T₁ < im ≤ T₂: −2^{j+1}X < γ ≤ −2^jX ✓ ⊇ {−2^{j+1}X < γ ≤ −2^jX} ✓ my set: γ ≤ −2^jX and γ > −2^{j+1}X ✓ ⊆ ✓.\n\nSo Σ_{fiber-nonzero} m ≤ Ncount(2^jX−1, 2^{j+1}X] + Ncount(−2^{j+1}X, −2^jX] ≤ 2·A₀·((2^{j+1}X − (2^jX−1)) + 1)·log(3·max + 5) = 2A₀(2^jX + 2)·log(3·2^{j+1}X + 5) — hmm wait: Ncount_le_of_interval_gen gives (b−a+1): first: a = 2^jX−1, b = 2^{j+1}X: b−a+1 = 2^jX + 2 ✓ max|a||b| = 2^{j+1}X (X ≥ 200, 2^jX−1 ≥ 0? 2^jX−1 ≥ 199 > 0: |a| = 2^jX−1 ≤ 2^jX ≤ 2^{j+1}X ✓ max = 2^{j+1}X ✓): ≤ A₀(2^jX+2)·log(3·2^{j+1}X+5) ✓; second: a = −2^{j+1}X, b = −2^jX: b−a+1 = 2^jX+1: max(|a|,|b|) = 2^{j+1}X ✓ ≤ A₀(2^jX+1)·log(3·2^{j+1}X+5) ✓. Total ≤ A₀(2^{j+1}X + 3)·log(3·2^{j+1}X+5) ≤ A₀(2^{j+2}X)·log(...) (2^{j+1}X+3 ≤ 2^{j+2}X ⟺ 3 ≤ 2^{j+1}X ✓ X ≥ 200).\n\nSo F_j := A₀·2^{j+2}·X·log(3·2^{j+1}X+5)/(4^j X²) = (4A₀/X)·log(3·2^{j+1}X+5)/2^j — hmm: 2^{j+2}/4^j = 4/2^j: = (4A₀/X)·log(...)/2^j ✓. log(3·2^{j+1}X+5) ≤ (j+4)log2 + logX (shown before for X ≥ 2... 3·2^{j+1}X+5 ≤ 2^{j+4}X ⟺ 6·2^jX + 5 ≤ 16·2^jX ⟺ 5 ≤ 10·2^jX ⟸ 10·200 = 2000 ≥ 5 ✓).\n\nSo F_j ≤ (4A₀/X)·((j+4)log2 + logX)/2^j = (4A₀/X)·G_j with ∑' G_j = 10log2 + 2logX ✓ (T-iv).\n\nThen ∑' F_j ≤ (4A₀/X)·(10 log2 + 2 logX) ≤ 16A₀ logX/X (X ≥ 200) ✓.\n\nThe final statement: \n```lean\ntheorem zero_tail_inv_sq_le {X : ℝ} (hX : 200 ≤ X) :\n ∑' ρ : {ρ : ℂ // IsNontrivialZero ρ},\n (if X < |(ρ : ℂ).im| then (zeroMult ρ : ℝ) / (1 + ρ.im ^ 2) else 0)\n ≤ 16 * A0count * Real.log X / X\n```\n\nAssembly via ENNReal:\n```lean\n -- the real summand\n set f : {ρ : ℂ // IsNontrivialZero ρ} → ℝ := fun ρ =>\n if X < |(ρ : ℂ).im| then (zeroMult ρ : ℝ) / (1 + ρ.im ^ 2) else 0 with hf\n have hfsum : Summable f := ... (T1)\n have hfnonneg : ∀ ρ, 0 ≤ f ρ := ... (if-zero ✓ div_nonneg)\n -- to ENNReal:\n rw [← ENNReal.ofReal_le_ofReal_iff (by positivity : (0:ℝ) ≤ 16*A0count*Real.log X/X)]\n rw [ENNReal.ofReal_tsum_of_nonneg hfnonneg hfsum]\n -- ∑' (ofReal ∘ f) ≤ ofReal(16A₀ logX/X)\n -- fiberwise:\n have hfib := ENNReal.tsum_fiberwise (fun ρ => ENNReal.ofReal (f ρ)) (dyadClass X) -- hmm dyadClass as a function on the subtype: fun ρ => Nat.log 2 ⌊|ρ.1.im|/X⌋₊\n rw [hfib]?? — hfib : ∑' j, ∑' fiber, f = ∑' i, f: I need ∑' i, f i ≤ ...: rw [← hfib]: goal ∑' j, ∑'_{fiber j} ofReal(f) ≤ ofReal(C):\n -- each fiber tsum ≤ ofReal(F_j):\n calc ∑' j, ∑'_{fiber j} ofReal(f ρ) ≤ ∑' j, ofReal (F_j) [tsum_le_tsum for ℝ≥0∞ — `ENNReal.tsum_le_tsum` (pointwise ≤, no summability needed ✓): `ENNReal.tsum_le_tsum (h : ∀ i, f i ≤ g i) : ∑' f ≤ ∑' g` ✓ exists]\n _ = ofReal (∑' j, F_j) [ofReal_tsum_of_nonneg: F_j ≥ 0 ✓ summable: from F_j ≤ (4A₀/X)·G_j and ∑' G_j ✓ of_norm_bounded... F_j nonneg ✓ and ≤ the summable G-majorant: Summable.of_norm_bounded (G-summable) (‖F_j‖ ≤ ...): F_j ≥ 0 so ‖F_j‖ = F_j ≤ (4A₀/X)G_j ✓]\n _ ≤ ofReal (16A₀ logX/X) [ofReal_le_ofReal: the real bound (iv) ✓]\n```\n\nThe fiber tsum bound: ∑'_{b : (dyadClass X)⁻¹'{j}} ofReal(f b) ≤ ofReal(F_j):\n- the fiber subtype {b : Z // dyadClass X b = j} — finite: the set {b : Z | dyadClass X b = j} ⊆ {b : Z | ‖b.1‖ ≤ 1 + 2^{j+1}X} (for b in the fiber: |im| < 2^{j+1}X (T3's upper — needs ⌊|γ|/X⌋₊ ≠ 0? lt_pow_succ_log_self works for any x: x < 2^(log.succ) — even x = 0: 0 < 2 ✓; so ⌊|γ|/X⌋ < 2^{j+1} ⟹ |γ|/X < ⌊⌋+1 ≤ 2^{j+1} ⟹ |γ| < 2^{j+1}X ✓ (X > 0)) ⟹ ‖ρ‖ ≤ |re|+|im| ≤ 1 + 2^{j+1}X ✓). Finite via finite_subtype_norm_lt (1+2^{j+1}X+1)-superset — the set is a subset of Z (the zero subtype) — finite_subtype_norm_lt is about {ρ : Z | ‖ρ.1‖ < R} ✓ my fiber set ⊆ that ✓.\n- Fintype via Set.Finite.fintype ✓ haveI.\n- ∑'_{fiber} ofReal(f) = ∑_{fiber-finset} ofReal(f) (tsum_fintype ✓) ≤ ∑ ofReal(F_j·...)... : each term ofReal(f b) ≤ ofReal((1/(4^jX²))·(zeroMult b:ℝ)): if X < |im|: f = m/(1+γ²) ≤ m/(4^jX²) = (1/(4^jX²))·m ✓ (ofReal_le_ofReal); else f = 0 ≤ · ✓ (ofReal_nonneg: (1/(4^jX²))·m ≥ 0 ✓). Sum ≤ ofReal(Σ (1/(4^jX²))·m) (ofReal_sum_of_nonneg + monotone ofReal: `ENNReal.ofReal_le_ofReal` per term then Finset.sum_le_sum then ofReal_sum_of_nonneg backwards — careful order: ∑ ofReal(f b) ≤ ∑ ofReal(g b) = ofReal(∑ g b) ← ofReal_sum_of_nonneg (g nonneg) ✓.\n- ofReal((1/(4^jX²))·Σ_{fiber} m) ≤ ofReal((1/(4^jX²))·count_j) ⟸ Σ_{fiber} m ≤ count_j — the count bound via the interval cover: the fiber's zeros... the fiber is a finset of SUBTYPE elements; the intervals are sets of ℂ — the LiContour bridge pattern (zeroWindow_finite + hZC...) — hmm — the count I need: Σ_{ρ ∈ fiber} (zeroMult ρ : ℝ) ≤ Ncount(2^jX−1, 2^{j+1}X] + Ncount(−2^{j+1}X, −2^jX]: Ncount = ∑ᶠ over zerosIn = the toFinset sum of zeroMult ✓ (finsum_mem_eq_finite_toFinset_sum ✓ used in my Ncount_le_of_interval). So: Σ_{fiber} m ≤ the two toFinset-sums: subset-monotonicity of finset sums over ℂ-points? The fiber is a finset of SUBTYPE elements; zerosIn.toFinset is a finset of ℂ. Bridge: map Subtype.val: (fiber.image val) ⊆ (zerosIn ...).toFinset ∪ ...: Finset.sum_le_sum_of_subset_of_nonneg on the image (injective ⟹ sum over image = sum over fiber via Finset.sum_image ✓ banked \"Finset.sum_image takes Set.InjOn, map = g, summand = f\" — journal-011 ✓).\n\nOK — it's all clear. It's a lot of code (~350 lines for §4). Let me write it in two parts: first the real-analysis pieces (tsum_dyadic_log + the X ≥ 200 bounds + the per-term/fiber count bridges), compile; then the ENNReal assembly.\n\nActually — let me write the whole thing and iterate. I'll add it to LiCircleBound.lean as §4.","signature":""},{"type":"text","text":"All API confirmed. Writing §4 (the tail bound) — first the real-analysis pieces, then the fiberwise assembly."},{"type":"tool_use","id":"Edit_356","name":"Edit","input":{"file_path":"D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiCircleBound.lean","old_string":"lemma lowZeroConst_nonneg : 0 ≤ lowZeroConst :=\n Finset.sum_nonneg fun _ρ _ => mul_nonneg (Nat.cast_nonneg _)\n (add_nonneg one_pos.le (div_nonneg one_pos.le (norm_nonneg _)))\n\nend NguyenRH1\n\nend","new_string":"lemma lowZeroConst_nonneg : 0 ≤ lowZeroConst :=\n Finset.sum_nonneg fun _ρ _ => mul_nonneg (Nat.cast_nonneg _)\n (add_nonneg one_pos.le (div_nonneg one_pos.le (norm_nonneg _)))\n\n/-! ## 4. The far-tail bound -/\n\n/-- The dyadic log series closed form:\n∑' j, ((j+4)·log 2 + log X)/2^j = 10·log 2 + 2·log X. -/\nlemma tsum_dyadic_log (X : ℝ) :\n ∑' j : ℕ, ((j + 4) * Real.log 2 + Real.log X) / (2 : ℝ) ^ j\n = 10 * Real.log 2 + 2 * Real.log X := by\n have hgeom2 : ∑' j : ℕ, ((1 : ℝ) / 2) ^ j = 2 := tsum_geometric_two\n have hlin : ∑' j : ℕ, (j : ℝ) * ((1 : ℝ) / 2) ^ j = 2 :=\n (hasSum_coe_mul_geometric_of_norm_lt_one (r := (1 : ℝ) / 2) (by norm_num)).tsum_eq\n have hsplit : (fun j : ℕ => ((j + 4) * Real.log 2 + Real.log X) / (2 : ℝ) ^ j)\n = fun j : ℕ => Real.log 2 * ((j : ℝ) * ((1 : ℝ) / 2) ^ j)\n + (4 * Real.log 2 + Real.log X) * ((1 : ℝ) / 2) ^ j := by\n funext j\n rw [div_eq_mul_inv, inv_pow]\n ring\n rw [hsplit, Summable.tsum_add (hlin.summable.mul_left _) (hgeom2.summable.mul_left _)]\n rw [tsum_mul_left, tsum_mul_left, hlin, hgeom2]\n ring\n\n/-- log 2 ≤ 1 (since 2 ≤ e). -/\nlemma log_two_le_one : Real.log 2 ≤ 1 := by\n rw [show (1 : ℝ) = Real.log (Real.exp 1) by rw [Real.log_exp]]\n apply Real.log_le_log (by norm_num)\n have h := Real.exp_one_gt_d9\n linarith\n\n/-- For X ≥ 200: (4A₀/X)·(10·log 2 + 2·log X) ≤ 16·A₀·log X / X. -/\nlemma dyadic_tail_constant {X : ℝ} (hX : 200 ≤ X) :\n (4 * A0count / X) * (10 * Real.log 2 + 2 * Real.log X)\n ≤ 16 * A0count * Real.log X / X := by\n have hX0 : (0 : ℝ) < X := by linarith\n have hlogX : 5 ≤ Real.log X := by\n rw [show (5 : ℝ) = Real.log (Real.exp 5) by rw [Real.log_exp]]\n apply Real.log_le_log (Real.exp_pos _)\n have h1 : Real.exp 5 = (Real.exp 1) ^ 5 := by\n rw [← Real.exp_nat_mul]\n norm_num\n have h2 := Real.exp_one_lt_d9.le\n have h3 : (Real.exp 1) ^ 5 ≤ (2.718281829 : ℝ) ^ 5 :=\n pow_le_pow_left₀ (Real.exp_pos 1).le h2 5\n have h4 : (2.718281829 : ℝ) ^ 5 ≤ 200 := by norm_num\n linarith [h1, h3, h4]\n have hlog2 := log_two_le_one\n have hA0 : (0 : ℝ) ≤ 4 * A0count / X := by positivity\n have h1 : 10 * Real.log 2 + 2 * Real.log X ≤ 4 * Real.log X := by linarith\n calc (4 * A0count / X) * (10 * Real.log 2 + 2 * Real.log X)\n ≤ (4 * A0count / X) * (4 * Real.log X) := mul_le_mul_of_nonneg_left h1 hA0\n _ = 16 * A0count * Real.log X / X := by ring\n\n/-- The dyadic class of a zero relative to scale X:\nNat.log 2 ⌊|im ρ|/X⌋₊, so 2^j·X ≤ |im ρ| < 2^{j+1}·X when |im ρ| ≥ X. -/\ndef dyadClass (X : ℝ) (ρ : {ρ : ℂ // IsNontrivialZero ρ}) : ℕ :=\n Nat.log 2 ⌊|(ρ : ℂ).im| / X⌋₊\n\nlemma dyadClass_lower {X : ℝ} (hX : 0 < X) {ρ : {ρ : ℂ // IsNontrivialZero ρ}}\n (hρ : X ≤ |(ρ : ℂ).im|) :\n (2 : ℝ) ^ dyadClass X ρ * X ≤ |(ρ : ℂ).im| := by\n have hfl : ⌊|(ρ : ℂ).im| / X⌋₊ ≠ 0 := by\n rw [Ne, Nat.floor_eq_zero]\n push Not\n have h1 : (1 : ℝ) ≤ |(ρ : ℂ).im| / X := (le_div_iff₀ hX).mpr (by linarith)\n linarith\n have h2 := Nat.pow_log_le_self 2 hfl\n have h3 : ((2 ^ dyadClass X ρ : ℕ) : ℝ) ≤ ⌊|(ρ : ℂ).im| / X⌋₊ := by exact_mod_cast h2\n have h4 : (⌊|(ρ : ℂ).im| / X⌋₊ : ℝ) ≤ |(ρ : ℂ).im| / X := Nat.floor_le (by positivity)\n have h5 : ((2 ^ dyadClass X ρ : ℕ) : ℝ) = (2 : ℝ) ^ dyadClass X ρ := by push_cast; ring\n rw [h5] at h3\n rw [le_div_iff₀ hX] at h4\n linarith\n\nlemma dyadClass_upper {X : ℝ} (hX : 0 < X) (ρ : {ρ : ℂ // IsNontrivialZero ρ}) :\n |(ρ : ℂ).im| < (2 : ℝ) ^ (dyadClass X ρ + 1) * X := by\n have h2 : ⌊|(ρ : ℂ).im| / X⌋₊ < 2 ^ (dyadClass X ρ + 1) :=\n Nat.lt_pow_succ_log_self (by norm_num) _\n have h3 : ((⌊|(ρ : ℂ).im| / X⌋₊ : ℝ) + 1) ≤ (2 : ℝ) ^ (dyadClass X ρ + 1) := by\n have h4 : ⌊|(ρ : ℂ).im| / X⌋₊ + 1 ≤ 2 ^ (dyadClass X ρ + 1) := h2\n have h5 : ((⌊|(ρ : ℂ).im| / X⌋₊ + 1 : ℕ) : ℝ) ≤ ((2 ^ (dyadClass X ρ + 1) : ℕ) : ℝ) := by\n exact_mod_cast h4\n push_cast at h5\n linarith\n have h6 : |(ρ : ℂ).im| / X < ⌊|(ρ : ℂ).im| / X⌋₊ + 1 := Nat.lt_floor_add_one _\n have h7 : ((2 ^ (dyadClass X ρ + 1) : ℕ) : ℝ) = (2 : ℝ) ^ (dyadClass X ρ + 1) := by\n push_cast; ring\n rw [h7] at h3\n have h8 := (div_lt_iff₀ hX).mpr ((Nat.lt_floor_add_one _).trans_le h3)\n linarith\n\n/-- The tail summand (if-form on the zero subtype). -/\ndef tailTerm (X : ℝ) (ρ : {ρ : ℂ // IsNontrivialZero ρ}) : ℝ :=\n if X < |(ρ : ℂ).im| then (zeroMult ρ : ℝ) / (1 + ρ.im ^ 2) else 0\n\nlemma tailTerm_nonneg {X : ℝ} (ρ : {ρ : ℂ // IsNontrivialZero ρ}) :\n 0 ≤ tailTerm X ρ := by\n by_cases h : X < |(ρ : ℂ).im| <;>\n simp [tailTerm, h, div_nonneg (Nat.cast_nonneg _)\n (by positivity : (0 : ℝ) ≤ 1 + ρ.im ^ 2)]\n\n/-- The tail summand is summable (dominated by 2·m/(1+‖γ‖²) via\n1 + ‖γ‖² ≤ 2(1 + im²)). -/\nlemma tailTerm_summable (X : ℝ) :\n Summable (tailTerm X) := by\n have hbase : Summable (fun ρ : {ρ : ℂ // IsNontrivialZero ρ} =>\n 2 * ((zeroMult ρ : ℝ) / (1 + Complex.normSq (gammaOf (ρ : ℂ))))) :=\n (WeilEF.zero_sum_inv_sq zetaSeam).mul_left 2\n apply Summable.of_norm_bounded hbase\n intro ρ\n rw [tailTerm]\n by_cases h : X < |(ρ : ℂ).im|\n · rw [if_pos h]\n have hgam : Complex.normSq (gammaOf (ρ : ℂ))\n = (ρ : ℂ).im ^ 2 + (1 / 2 - (ρ : ℂ).re) ^ 2 := by\n rw [Complex.normSq_apply, WeilEF.gammaOf_re, WeilEF.gammaOf_im]\n ring\n have hcmp : 1 + Complex.normSq (gammaOf (ρ : ℂ)) ≤ 2 * (1 + (ρ : ℂ).im ^ 2) := by\n rw [hgam]\n have hre : ((ρ : ℂ).re - 1 / 2) ^ 2 ≤ 1 / 4 := by\n have h0 := ρ.2.2.1\n have h1 := ρ.2.2.2\n nlinarith [sq_nonneg ((ρ : ℂ).re - 1 / 2)]\n nlinarith [sq_nonneg (ρ : ℂ).im]\n have hpos1 : (0 : ℝ) < 1 + Complex.normSq (gammaOf (ρ : ℂ)) := by\n have h := Complex.normSq_nonneg (gammaOf (ρ : ℂ)); linarith\n have hpos2 : (0 : ℝ) < 1 + (ρ : ℂ).im ^ 2 := by positivity\n have hfrac : 1 / (1 + (ρ : ℂ).im ^ 2) ≤ 2 / (1 + Complex.normSq (gammaOf (ρ : ℂ))) := by\n rw [div_le_div_iff₀ hpos2 hpos1]\n nlinarith [hcmp]\n have hm : (0 : ℝ) ≤ (zeroMult ρ : ℝ) := Nat.cast_nonneg _\n calc ‖(zeroMult ρ : ℝ) / (1 + (ρ : ℂ).im ^ 2)‖\n = (zeroMult ρ : ℝ) / (1 + (ρ : ℂ).im ^ 2) := by\n rw [norm_div, Nat.cast_nonneg, ...] -- placeholder\n _ ≤ 2 * ((zeroMult ρ : ℝ) / (1 + Complex.normSq (gammaOf (ρ : ℂ)))) := by\n rw [show (zeroMult ρ : ℝ) / (1 + (ρ : ℂ).im ^ 2)\n = (zeroMult ρ : ℝ) * (1 / (1 + (ρ : ℂ).im ^ 2)) from by ring]\n rw [show 2 * ((zeroMult ρ : ℝ) / (1 + Complex.normSq (gammaOf (ρ : ℂ))))\n = (zeroMult ρ : ℝ) * (2 / (1 + Complex.normSq (gammaOf (ρ : ℂ)))) from by ring]\n exact mul_le_mul_of_nonneg_left hfrac hm\n · rw [if_neg h]\n positivity\n\nend NguyenRH1\n\nend"},"extra_content":null}]