Current task: —

← Session 28 — ii′-5e: partial-fraction identity (zero series + F entire)

#1579 assistant 2026-08-23 20:04:37.044 UTC · 537→4876 tok open ⤢
thinking (5697 chars)
Now let me write the final two lemmas properly. The fiber bound: I need to connect the fiberwise tsum (over the subtype (dyadClass X)⁻¹'{j}) to the finset sum. Let me write it carefully: ```lean /-- The per-fiber tail bound: the ℝ≥0∞-sum of ofReal(tailTerm X) over the dyadic fiber (dyadClass X)⁻¹'{j} is at most ofReal of (1/(2^j X)²)·A₀·(2^{j+1}X+3)·log(3·2^{j+1}X+5). -/ lemma fiber_tail_le {X : ℝ} (hX : 200 ≤ X) (j : ℕ) : ∑' b : (dyadClass X) ⁻¹' {j}, ENNReal.ofReal (tailTerm X b.1) ≤ ENNReal.ofReal ((1 / ((2 : ℝ) ^ j * X) ^ 2) * (A0count * ((2 : ℝ) ^ (j + 1) * X + 3) * Real.log (3 * (2 : ℝ) ^ (j + 1) * X + 5))) := by classical have hX0 : (0 : ℝ) < X := by linarith -- the fiber subtype is finite have hfin : ((dyadClass X) ⁻¹' {j} : Set {ρ : ℂ // IsNontrivialZero ρ}).Finite := by have h := dyadClass_fiber_finite hX0 j apply h.subset intro ρ hρ -- hρ : ρ ∈ (dyadClass X)⁻¹' {j} — mem_preimage: dyadClass X ρ ∈ {j} — defeq dyadClass X ρ = j exact hρ ... ``` hmm — `h.subset (fun ρ hρ => hρ)` : (dyadClass)⁻¹'{j} ⊆ {ρ | dyadClass X ρ = j}: hρ : ρ ∈ preimage singleton: defeq to dyadClass X ρ = j ✓ (`Set.mem_preimage` : a ∈ f⁻¹' s ↔ f a ∈ s — and f a ∈ {j} ↔ f a = j (mem_singleton_iff ✓ defeq)). So hρ : dyadClass X ρ = j ✓ via defeq — `exact hρ` ✓. Then: ```lean haveI := hfin.fintype -- the fiber tsum = the finset sum rw [tsum_fintype] -- ∑' b, g b = ∑ b, g b — needs the Fintype on the subtype -- now: ∑ b : fiber, ofReal(tailTerm X b.1) — rewrite as the toFinset sum: rw [show ∑ b : (dyadClass X) ⁻¹' {j}, ENNReal.ofReal (tailTerm X b.1) = ∑ b ∈ hfin.toFinset, ENNReal.ofReal (tailTerm X b) from (Finset.sum_subtype hfin.toFinset (fun ρ => by rw [Set.Finite.mem_toFinset]) _).symm] ``` Hmm — Finset.sum_subtype (s) (h : ∀ x, x ∈ s ↔ p x) (f) : ∑ a ∈ s, f a = ∑ a, f ↑a — the RHS is the subtype-univ sum: ∑ a : {x // p x}, f ↑a ✓. So my goal after tsum_fintype: ∑ b : ↥((dyadClass)⁻¹'{j}), ofReal(tailTerm X ↑b) — via Finset.sum_subtype (s := hfin.toFinset) (h : ∀ ρ, ρ ∈ hfin.toFinset ↔ ρ ∈ (dyadClass)⁻¹'{j}) (f := fun ρ => ofReal(tailTerm X ρ)): gives ∑_{ρ ∈ toFinset} = ∑_{b : ↥preimage} — so rw [...] with the .symm form — the goal after tsum_fintype is `∑ b : ↥preimage, ofReal(tailTerm X ↑b) ≤ ...`: rw [show that = ∑ ρ ∈ hfin.toFinset, ofReal(tailTerm X ρ) from (Finset.sum_subtype ...).symm] — the sum_subtype's f: fun ρ : Z => ofReal(tailTerm X ρ) — with the subtype application f ↑b = ofReal(tailTerm X ↑b) ✓. Then: ```lean -- the real bound rw [← ENNReal.ofReal_sum_of_nonneg (fun ρ _ => tailTerm_nonneg ρ)] apply ENNReal.ofReal_le_ofReal -- ∑ ρ ∈ toFinset, tailTerm X ρ ≤ (1/(2^jX)²)·(count bound) -- split: terms with X < |im| vs not ... ``` The fiber toFinset sum: split by X < |im|: the members with ¬(X < |im|) have tailTerm = 0: ∑_{ρ ∈ toFinset} tailTerm X ρ = ∑_{ρ ∈ toFinset.filter (fun ρ => X < |ρ.1.im|)} tailTerm X ρ: via Finset.sum_subset (the filter ⊆) (the others 0) — direction: Finset.sum_subset (h : s ⊆ t) (hf : ∀ x ∈ t, x ∉ s → f x = 0) : ∑ s = ∑ t — hmm I want ∑_full = ∑_filtered: Finset.sum_filter : ∑ x ∈ s.filter p, f x + ∑ x ∈ s.filter ¬p, f x = ∑ x ∈ s, f x — `Finset.sum_filter_add_sum_filter_not` ✓: ∑_full = ∑_filter + ∑_filter-not = ∑_filter + 0 ✓ (the not-part: tailTerm = 0 by if_neg ✓ Finset.sum_eq_zero). Then the filtered finset = fiber_mult_count's finset? The filter (X < |im|) of the full-fiber-toFinset vs the subset-toFinset in fiber_mult_count: both are the {class = j ∧ X < |im|} set's... — the filter's members: class = j (from the toFinset membership) ∧ X < |im| ✓ — the SAME elements — as finsets: (hfin.toFinset).filter (fun ρ => X < |ρ.1.im|) vs (the subset .subset).toFinset — they're equal finsets by extensionality (Finset.ext + mem_filter + mem_toFinset ✓) — prove a tiny eq-lemma or just bound directly: ∑_{filtered} tailTerm ≤ (1/(4^jX²))·∑_{filtered} m (per-term ✓) ≤ (1/(4^jX²))·(fiber_mult_count's bound) — the second ≤ needs ∑_{filtered} m ≤ fiber_mult_count's finset sum: the two finsets are EQUAL (extensional) ⟹ equal sums — or just ⊆ + nonneg: filtered ⊆ multcount's finset ⟹ ∑_{filtered} m ≤ ∑_{multcount} m ✓ (avoid proving equality). Hmm wait — simpler: I should restate fiber_mult_count to use the FILTER form from the start: `∑ ρ ∈ (dyadClass_fiber_finite hX0 j).toFinset.filter (fun ρ => X < |(ρ:ℂ).im|), (zeroMult ρ : ℝ) ≤ ...` — hmm but its proof's himg-bridge used the set-membership... The current fiber_mult_count (with the subset form) compiled ✓ — let me just bridge via finset equality: have hfilter_eq : (dyadClass_fiber_finite hX0 j).toFinset.filter (fun ρ => X < |(ρ:ℂ).im|) = (Set.Finite.subset (dyadClass_fiber_finite hX0 j) (t := {class = j ∧ X < |im|}) (fun ρ hρ => hρ.1)).toFinset := by ext ρ simp [Finset.mem_filter, Set.Finite.mem_toFinset] tauto?/constructor... The LHS membership: ρ ∈ toFinset.filter (X < |im|) ↔ ρ ∈ toFinset ∧ X < |im| ↔ class = j ∧ X < |im| ✓; RHS: ρ ∈ subset-toFinset ↔ class = j ∧ X < |im| ✓ — `by simp [Finset.mem_filter, Set.Finite.mem_toFinset]` should close (both sides normalize to the And) — hmm simp might need Iff forms: `by simp only [Finset.mem_filter, Set.Finite.mem_toFinset]` leaves `class = j ∧ X < |im| ↔ class = j ∧ X < |im|` — Iff.rfl-close by simp ✓. OK. Let me write the whole two lemmas now. The fiber_tail_le lemma's statement: the fiberwise tsum's fiber is `(dyadClass X) ⁻¹' {j}` as a SET of Z — the tsum is over the subtype ↥((dyadClass X)⁻¹'{j}) — and b.1 : Z, b.1.1 : ℂ: tailTerm X b.1 — b.1 is the Z-element ✓. Also — the `Set.Finite.fintype` — the probe showed `Set.Finite.fintype : s.Finite → Fintype ↑s` ✓ (haveI). Let me write it.
Now writing the fiber bound and the main tail lemma.
tool: Edit
input
{
  "file_path": "D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiCircleBound.lean",
  "old_string": "        have hpow : (2 : \u211d) ^ (j + 1) * X = 2 * ((2 : \u211d) ^ j * X) := by rw [pow_succ']; ring\n        rw [hpow] at h1' h2' \u22a2\n        linarith [h1', h2', hA0, hlogpos]\n\nend NguyenRH1\n\nend",
  "new_string": "        have hpow : (2 : \u211d) ^ (j + 1) * X = 2 * ((2 : \u211d) ^ j * X) := by rw [pow_succ']; ring\n        rw [hpow] at h1' h2' \u22a2\n        linarith [h1', h2', hA0, hlogpos]\n\n/-- The per-fiber tail bound (in \u211d\u22650\u221e): the sum of ofReal(tailTerm X)\nover the dyadic fiber (dyadClass X)\u207b\u00b9'{j} is at most ofReal of\n(1/(2^j X)\u00b2)\u00b7A\u2080\u00b7(2^{j+1}X+3)\u00b7log(3\u00b72^{j+1}X+5). -/\nlemma fiber_tail_le {X : \u211d} (hX : 200 \u2264 X) (j : \u2115) :\n    \u2211' b : (dyadClass X) \u207b\u00b9' {j}, ENNReal.ofReal (tailTerm X b.1)\n      \u2264 ENNReal.ofReal ((1 / ((2 : \u211d) ^ j * X) ^ 2) *\n        (A0count * ((2 : \u211d) ^ (j + 1) * X + 3)\n          * Real.log (3 * (2 : \u211d) ^ (j + 1) * X + 5))) := by\n  classical\n  have hX0 : (0 : \u211d) < X := by linarith\n  have hfin : ((dyadClass X) \u207b\u00b9' {j} : Set {\u03c1 : \u2102 // IsNontrivialZero \u03c1}).Finite :=\n    (dyadClass_fiber_finite hX0 j).subset (fun \u03c1 h\u03c1 => h\u03c1)\n  haveI := hfin.fintype\n  rw [tsum_fintype]\n  rw [show (\u2211 b : \u21a5((dyadClass X) \u207b\u00b9' {j}), ENNReal.ofReal (tailTerm X b.1))\n      = \u2211 \u03c1 \u2208 hfin.toFinset, ENNReal.ofReal (tailTerm X \u03c1) from\n      (Finset.sum_subtype hfin.toFinset (fun \u03c1 => by rw [Set.Finite.mem_toFinset])\n        (fun \u03c1 => ENNReal.ofReal (tailTerm X \u03c1))).symm]\n  rw [\u2190 ENNReal.ofReal_sum_of_nonneg (fun \u03c1 _ => tailTerm_nonneg \u03c1)]\n  apply ENNReal.ofReal_le_ofReal\n  -- split off the zero-valued (|\u03b3| \u2264 X) members\n  rw [\u2190 Finset.sum_filter_add_sum_filter_not hfin.toFinset\n    (fun \u03c1 => X < |(\u03c1 : \u2102).im|) (tailTerm X)]\n  have hzero : \u2211 \u03c1 \u2208 hfin.toFinset.filter (fun \u03c1 => \u00ac X < |(\u03c1 : \u2102).im|), tailTerm X \u03c1 = 0 := by\n    apply Finset.sum_eq_zero\n    intro \u03c1 h\u03c1\n    rw [Finset.mem_filter] at h\u03c1\n    rw [tailTerm, if_neg (not_lt.mp h\u03c1.2)]\n  rw [hzero, add_zero]\n  -- the filtered finset = the fiber_mult_count finset\n  have hfilter_eq : hfin.toFinset.filter (fun \u03c1 => X < |(\u03c1 : \u2102).im|)\n      = (Set.Finite.subset (dyadClass_fiber_finite hX0 j)\n        (t := {\u03c1 : {\u03c1 // IsNontrivialZero \u03c1} | dyadClass X \u03c1 = j \u2227 X < |(\u03c1 : \u2102).im|})\n        (fun \u03c1 h\u03c1 => h\u03c1.1)).toFinset := by\n    ext \u03c1\n    simp only [Finset.mem_filter, Set.Finite.mem_toFinset]\n    constructor\n    \u00b7 rintro \u27e8h1, h2\u27e9\n      exact \u27e8h1, h2\u27e9\n    \u00b7 rintro \u27e8h1, h2\u27e9\n      exact \u27e8h1, h2\u27e9\n  rw [hfilter_eq]\n  -- per-term bound then the count\n  calc \u2211 \u03c1 \u2208 (Set.Finite.subset (dyadClass_fiber_finite hX0 j)\n          (t := {\u03c1 : {\u03c1 // IsNontrivialZero \u03c1} | dyadClass X \u03c1 = j \u2227 X < |(\u03c1 : \u2102).im|})\n          (fun \u03c1 h\u03c1 => h\u03c1.1)).toFinset, tailTerm X \u03c1\n      \u2264 \u2211 \u03c1 \u2208 (Set.Finite.subset (dyadClass_fiber_finite hX0 j)\n          (t := {\u03c1 : {\u03c1 // IsNontrivialZero \u03c1} | dyadClass X \u03c1 = j \u2227 X < |(\u03c1 : \u2102).im|})\n          (fun \u03c1 h\u03c1 => h\u03c1.1)).toFinset,\n        (1 / ((2 : \u211d) ^ j * X) ^ 2) * (zeroMult (\u03c1 : \u2102) : \u211d) := by\n        apply Finset.sum_le_sum\n        intro \u03c1 h\u03c1\n        rw [Set.Finite.mem_toFinset] at h\u03c1\n        obtain \u27e8h\u03c1j, hgt\u27e9 := h\u03c1\n        have hlo : (2 : \u211d) ^ j * X \u2264 |(\u03c1 : \u2102).im| := by\n          have h := dyadClass_lower hX0 (show X \u2264 |(\u03c1 : \u2102).im| from hgt.le)\n          rw [h\u03c1j] at h\n          exact h\n        have hsq : ((2 : \u211d) ^ j * X) ^ 2 \u2264 1 + ((\u03c1 : \u2102).im) ^ 2 := by\n          have h1 : ((2 : \u211d) ^ j * X) ^ 2 \u2264 ((\u03c1 : \u2102).im) ^ 2 := by\n            apply pow_le_pow_left\u2080 (by positivity) hlo 2\n          nlinarith [h1, sq_nonneg (\u03c1 : \u2102).im]\n        have hpos1 : (0 : \u211d) < (1 : \u211d) + ((\u03c1 : \u2102).im) ^ 2 := by positivity\n        have hpos2 : (0 : \u211d) < ((2 : \u211d) ^ j * X) ^ 2 := by positivity\n        rw [tailTerm, if_pos hgt]\n        rw [show (zeroMult (\u03c1 : \u2102) : \u211d) / (1 + ((\u03c1 : \u2102).im) ^ 2)\n            = (zeroMult (\u03c1 : \u2102) : \u211d) * (1 / (1 + ((\u03c1 : \u2102).im) ^ 2)) from by ring]\n        rw [show (1 / ((2 : \u211d) ^ j * X) ^ 2) * (zeroMult (\u03c1 : \u2102) : \u211d)\n            = (zeroMult (\u03c1 : \u2102) : \u211d) * (1 / ((2 : \u211d) ^ j * X) ^ 2) from by ring]\n        apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _)\n        rw [div_le_div_iff\u2080 hpos1 hpos2]\n        linarith [hsq]\n    _ = (1 / ((2 : \u211d) ^ j * X) ^ 2) *\n          \u2211 \u03c1 \u2208 (Set.Finite.subset (dyadClass_fiber_finite hX0 j)\n            (t := {\u03c1 : {\u03c1 // IsNontrivialZero \u03c1} | dyadClass X \u03c1 = j \u2227 X < |(\u03c1 : \u2102).im|})\n            (fun \u03c1 h\u03c1 => h\u03c1.1)).toFinset, (zeroMult (\u03c1 : \u2102) : \u211d) := by\n        rw [Finset.mul_sum]\n    _ \u2264 (1 / ((2 : \u211d) ^ j * X) ^ 2) *\n          (A0count * ((2 : \u211d) ^ (j + 1) * X + 3)\n            * Real.log (3 * (2 : \u211d) ^ (j + 1) * X + 5)) :=\n        mul_le_mul_of_nonneg_left (fiber_mult_count hX j) (by positivity)\n\n/-- **The far-tail bound**: for X \u2265 200, the zeros with |\u03b3| > X\ncontribute \u03a3 m/(1+\u03b3\u00b2) \u2264 16\u00b7A\u2080\u00b7log X / X. -/\ntheorem zero_tail_inv_sq_le {X : \u211d} (hX : 200 \u2264 X) :\n    \u2211' \u03c1 : {\u03c1 : \u2102 // IsNontrivialZero \u03c1}, tailTerm X \u03c1\n      \u2264 16 * A0count * Real.log X / X := by\n  have hX0 : (0 : \u211d) < X := by linarith\n  have hlogXnn : (0 : \u211d) \u2264 Real.log X := Real.log_nonneg (by linarith)\n  have hC0 : (0 : \u211d) \u2264 16 * A0count * Real.log X / X :=\n    div_nonneg (mul_nonneg (mul_nonneg (by norm_num) A0count_pos.le) hlogXnn) hX0.le\n  rw [\u2190 ENNReal.ofReal_le_ofReal_iff hC0]\n  rw [ENNReal.ofReal_tsum_of_nonneg (fun \u03c1 => tailTerm_nonneg \u03c1) (tailTerm_summable X)]\n  rw [\u2190 ENNReal.tsum_fiberwise (fun \u03c1 => ENNReal.ofReal (tailTerm X \u03c1)) (dyadClass X)]\n  -- the dyadic majorant family\n  set F : \u2115 \u2192 \u211d := fun j => (1 / ((2 : \u211d) ^ j * X) ^ 2) *\n    (A0count * ((2 : \u211d) ^ (j + 1) * X + 3) * Real.log (3 * (2 : \u211d) ^ (j + 1) * X + 5)) with hFdef\n  have hFnn : \u2200 j : \u2115, 0 \u2264 F j := by\n    intro j\n    rw [hFdef]\n    have h2j1X : (0 : \u211d) \u2264 (2 : \u211d) ^ (j + 1) * X := by positivity\n    have hL : (0 : \u211d) \u2264 Real.log (3 * (2 : \u211d) ^ (j + 1) * X + 5) := by\n      apply Real.log_nonneg\n      linarith\n    positivity\n  have hFle : \u2200 j : \u2115, F j\n      \u2264 (4 * A0count / X) * (((j : \u211d) + 4) * Real.log 2 + Real.log X) / (2 : \u211d) ^ j := by\n    intro j\n    rw [hFdef]\n    have h2jX1 : (1 : \u211d) \u2264 (2 : \u211d) ^ j * X := by\n      have h1 : (1 : \u211d) \u2264 (2 : \u211d) ^ j := by exact_mod_cast Nat.one_le_two_pow\n      nlinarith [h1, hX]\n    have h2jX : (0 : \u211d) < (2 : \u211d) ^ j * X := by positivity\n    have h2j1X : (0 : \u211d) < (2 : \u211d) ^ (j + 1) * X := by positivity\n    have hLnn : (0 : \u211d) \u2264 Real.log (3 * (2 : \u211d) ^ (j + 1) * X + 5) := by\n      apply Real.log_nonneg\n      linarith\n    have hlog2nn : (0 : \u211d) \u2264 Real.log 2 := Real.log_nonneg (by norm_num)\n    have hlogXnn' : (0 : \u211d) \u2264 Real.log X := Real.log_nonneg (by linarith)\n    -- the two factor bounds\n    have hfac1 : A0count * ((2 : \u211d) ^ (j + 1) * X + 3) / ((2 : \u211d) ^ j * X) ^ 2\n        \u2264 (4 * A0count / X) / (2 : \u211d) ^ j := by\n      rw [div_le_div_iff\u2080 (by positivity) (by positivity)]\n      have hpow2 : ((2 : \u211d) ^ j * X) ^ 2 = (2 : \u211d) ^ j ^ 2 * X ^ 2 := by ring\n      rw [hpow2]\n      have h1 : (2 : \u211d) ^ (j + 1) * X = 2 * ((2 : \u211d) ^ j * X) := by rw [pow_succ']; ring\n      have h2 : (2 : \u211d) ^ j * X * (2 : \u211d) ^ j * X * X \u2265 0 := by positivity\n      nlinarith [h1, h2jX1, h2jX, h2j1X, hX, A0count_pos]\n    -- wait: div_le_div_iff\u2080 with the forms \u2014 reconsider below\n    sorry\n  sorry\n\nend NguyenRH1\n\nend"
}
raw content_json (database row)
[{"type":"thinking","thinking":"Now let me write the final two lemmas properly. The fiber bound: I need to connect the fiberwise tsum (over the subtype (dyadClass X)⁻¹'{j}) to the finset sum. Let me write it carefully:\n\n```lean\n/-- The per-fiber tail bound: the ℝ≥0∞-sum of ofReal(tailTerm X) over the\ndyadic fiber (dyadClass X)⁻¹'{j} is at most ofReal of\n(1/(2^j X)²)·A₀·(2^{j+1}X+3)·log(3·2^{j+1}X+5). -/\nlemma fiber_tail_le {X : ℝ} (hX : 200 ≤ X) (j : ℕ) :\n    ∑' b : (dyadClass X) ⁻¹' {j}, ENNReal.ofReal (tailTerm X b.1)\n      ≤ ENNReal.ofReal ((1 / ((2 : ℝ) ^ j * X) ^ 2) *\n        (A0count * ((2 : ℝ) ^ (j + 1) * X + 3) * Real.log (3 * (2 : ℝ) ^ (j + 1) * X + 5))) := by\n  classical\n  have hX0 : (0 : ℝ) < X := by linarith\n  -- the fiber subtype is finite\n  have hfin : ((dyadClass X) ⁻¹' {j} : Set {ρ : ℂ // IsNontrivialZero ρ}).Finite := by\n    have h := dyadClass_fiber_finite hX0 j\n    apply h.subset\n    intro ρ hρ\n    -- hρ : ρ ∈ (dyadClass X)⁻¹' {j} — mem_preimage: dyadClass X ρ ∈ {j} — defeq dyadClass X ρ = j\n    exact hρ\n  ...\n```\nhmm — `h.subset (fun ρ hρ => hρ)` : (dyadClass)⁻¹'{j} ⊆ {ρ | dyadClass X ρ = j}: hρ : ρ ∈ preimage singleton: defeq to dyadClass X ρ = j ✓ (`Set.mem_preimage` : a ∈ f⁻¹' s ↔ f a ∈ s — and f a ∈ {j} ↔ f a = j (mem_singleton_iff ✓ defeq)). So hρ : dyadClass X ρ = j ✓ via defeq — `exact hρ` ✓.\n\nThen:\n```lean\n  haveI := hfin.fintype\n  -- the fiber tsum = the finset sum\n  rw [tsum_fintype]  -- ∑' b, g b = ∑ b, g b — needs the Fintype on the subtype\n  -- now: ∑ b : fiber, ofReal(tailTerm X b.1) — rewrite as the toFinset sum:\n  rw [show ∑ b : (dyadClass X) ⁻¹' {j}, ENNReal.ofReal (tailTerm X b.1)\n      = ∑ b ∈ hfin.toFinset, ENNReal.ofReal (tailTerm X b) from\n      (Finset.sum_subtype hfin.toFinset (fun ρ => by rw [Set.Finite.mem_toFinset]) _).symm]\n```\nHmm — Finset.sum_subtype (s) (h : ∀ x, x ∈ s ↔ p x) (f) : ∑ a ∈ s, f a = ∑ a, f ↑a — the RHS is the subtype-univ sum: ∑ a : {x // p x}, f ↑a ✓. So my goal after tsum_fintype: ∑ b : ↥((dyadClass)⁻¹'{j}), ofReal(tailTerm X ↑b) — via Finset.sum_subtype (s := hfin.toFinset) (h : ∀ ρ, ρ ∈ hfin.toFinset ↔ ρ ∈ (dyadClass)⁻¹'{j}) (f := fun ρ => ofReal(tailTerm X ρ)): gives ∑_{ρ ∈ toFinset} = ∑_{b : ↥preimage} — so rw [...] with the .symm form — the goal after tsum_fintype is `∑ b : ↥preimage, ofReal(tailTerm X ↑b) ≤ ...`: rw [show that = ∑ ρ ∈ hfin.toFinset, ofReal(tailTerm X ρ) from (Finset.sum_subtype ...).symm] — the sum_subtype's f: fun ρ : Z => ofReal(tailTerm X ρ) — with the subtype application f ↑b = ofReal(tailTerm X ↑b) ✓.\n\nThen:\n```lean\n  -- the real bound\n  rw [← ENNReal.ofReal_sum_of_nonneg (fun ρ _ => tailTerm_nonneg ρ)]\n  apply ENNReal.ofReal_le_ofReal\n  -- ∑ ρ ∈ toFinset, tailTerm X ρ ≤ (1/(2^jX)²)·(count bound)\n  -- split: terms with X < |im| vs not\n  ...\n```\nThe fiber toFinset sum: split by X < |im|: the members with ¬(X < |im|) have tailTerm = 0:\n∑_{ρ ∈ toFinset} tailTerm X ρ = ∑_{ρ ∈ toFinset.filter (fun ρ => X < |ρ.1.im|)} tailTerm X ρ: via Finset.sum_subset (the filter ⊆) (the others 0) — direction: Finset.sum_subset (h : s ⊆ t) (hf : ∀ x ∈ t, x ∉ s → f x = 0) : ∑ s = ∑ t — hmm I want ∑_full = ∑_filtered: Finset.sum_filter : ∑ x ∈ s.filter p, f x + ∑ x ∈ s.filter ¬p, f x = ∑ x ∈ s, f x — `Finset.sum_filter_add_sum_filter_not` ✓: ∑_full = ∑_filter + ∑_filter-not = ∑_filter + 0 ✓ (the not-part: tailTerm = 0 by if_neg ✓ Finset.sum_eq_zero).\nThen the filtered finset = fiber_mult_count's finset? The filter (X < |im|) of the full-fiber-toFinset vs the subset-toFinset in fiber_mult_count: both are the {class = j ∧ X < |im|} set's... — the filter's members: class = j (from the toFinset membership) ∧ X < |im| ✓ — the SAME elements — as finsets: (hfin.toFinset).filter (fun ρ => X < |ρ.1.im|) vs (the subset .subset).toFinset — they're equal finsets by extensionality (Finset.ext + mem_filter + mem_toFinset ✓) — prove a tiny eq-lemma or just bound directly: ∑_{filtered} tailTerm ≤ (1/(4^jX²))·∑_{filtered} m (per-term ✓) ≤ (1/(4^jX²))·(fiber_mult_count's bound) — the second ≤ needs ∑_{filtered} m ≤ fiber_mult_count's finset sum: the two finsets are EQUAL (extensional) ⟹ equal sums — or just ⊆ + nonneg: filtered ⊆ multcount's finset ⟹ ∑_{filtered} m ≤ ∑_{multcount} m ✓ (avoid proving equality).\n\nHmm wait — simpler: I should restate fiber_mult_count to use the FILTER form from the start: `∑ ρ ∈ (dyadClass_fiber_finite hX0 j).toFinset.filter (fun ρ => X < |(ρ:ℂ).im|), (zeroMult ρ : ℝ) ≤ ...` — hmm but its proof's himg-bridge used the set-membership... The current fiber_mult_count (with the subset form) compiled ✓ — let me just bridge via finset equality:\n\nhave hfilter_eq : (dyadClass_fiber_finite hX0 j).toFinset.filter (fun ρ => X < |(ρ:ℂ).im|)\n    = (Set.Finite.subset (dyadClass_fiber_finite hX0 j) (t := {class = j ∧ X < |im|}) (fun ρ hρ => hρ.1)).toFinset := by\n  ext ρ\n  simp [Finset.mem_filter, Set.Finite.mem_toFinset]\n  tauto?/constructor...\nThe LHS membership: ρ ∈ toFinset.filter (X < |im|) ↔ ρ ∈ toFinset ∧ X < |im| ↔ class = j ∧ X < |im| ✓; RHS: ρ ∈ subset-toFinset ↔ class = j ∧ X < |im| ✓ — `by simp [Finset.mem_filter, Set.Finite.mem_toFinset]` should close (both sides normalize to the And) — hmm simp might need Iff forms: `by simp only [Finset.mem_filter, Set.Finite.mem_toFinset]` leaves `class = j ∧ X < |im| ↔ class = j ∧ X < |im|` — Iff.rfl-close by simp ✓.\n\nOK. Let me write the whole two lemmas now. The fiber_tail_le lemma's statement: the fiberwise tsum's fiber is `(dyadClass X) ⁻¹' {j}` as a SET of Z — the tsum is over the subtype ↥((dyadClass X)⁻¹'{j}) — and b.1 : Z, b.1.1 : ℂ: tailTerm X b.1 — b.1 is the Z-element ✓.\n\nAlso — the `Set.Finite.fintype` — the probe showed `Set.Finite.fintype : s.Finite → Fintype ↑s` ✓ (haveI).\n\nLet me write it.","signature":""},{"type":"text","text":"Now writing the fiber bound and the main tail lemma."},{"type":"tool_use","id":"Edit_420","name":"Edit","input":{"file_path":"D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiCircleBound.lean","old_string":"        have hpow : (2 : ℝ) ^ (j + 1) * X = 2 * ((2 : ℝ) ^ j * X) := by rw [pow_succ']; ring\n        rw [hpow] at h1' h2' ⊢\n        linarith [h1', h2', hA0, hlogpos]\n\nend NguyenRH1\n\nend","new_string":"        have hpow : (2 : ℝ) ^ (j + 1) * X = 2 * ((2 : ℝ) ^ j * X) := by rw [pow_succ']; ring\n        rw [hpow] at h1' h2' ⊢\n        linarith [h1', h2', hA0, hlogpos]\n\n/-- The per-fiber tail bound (in ℝ≥0∞): the sum of ofReal(tailTerm X)\nover the dyadic fiber (dyadClass X)⁻¹'{j} is at most ofReal of\n(1/(2^j X)²)·A₀·(2^{j+1}X+3)·log(3·2^{j+1}X+5). -/\nlemma fiber_tail_le {X : ℝ} (hX : 200 ≤ X) (j : ℕ) :\n    ∑' b : (dyadClass X) ⁻¹' {j}, ENNReal.ofReal (tailTerm X b.1)\n      ≤ ENNReal.ofReal ((1 / ((2 : ℝ) ^ j * X) ^ 2) *\n        (A0count * ((2 : ℝ) ^ (j + 1) * X + 3)\n          * Real.log (3 * (2 : ℝ) ^ (j + 1) * X + 5))) := by\n  classical\n  have hX0 : (0 : ℝ) < X := by linarith\n  have hfin : ((dyadClass X) ⁻¹' {j} : Set {ρ : ℂ // IsNontrivialZero ρ}).Finite :=\n    (dyadClass_fiber_finite hX0 j).subset (fun ρ hρ => hρ)\n  haveI := hfin.fintype\n  rw [tsum_fintype]\n  rw [show (∑ b : ↥((dyadClass X) ⁻¹' {j}), ENNReal.ofReal (tailTerm X b.1))\n      = ∑ ρ ∈ hfin.toFinset, ENNReal.ofReal (tailTerm X ρ) from\n      (Finset.sum_subtype hfin.toFinset (fun ρ => by rw [Set.Finite.mem_toFinset])\n        (fun ρ => ENNReal.ofReal (tailTerm X ρ))).symm]\n  rw [← ENNReal.ofReal_sum_of_nonneg (fun ρ _ => tailTerm_nonneg ρ)]\n  apply ENNReal.ofReal_le_ofReal\n  -- split off the zero-valued (|γ| ≤ X) members\n  rw [← Finset.sum_filter_add_sum_filter_not hfin.toFinset\n    (fun ρ => X < |(ρ : ℂ).im|) (tailTerm X)]\n  have hzero : ∑ ρ ∈ hfin.toFinset.filter (fun ρ => ¬ X < |(ρ : ℂ).im|), tailTerm X ρ = 0 := by\n    apply Finset.sum_eq_zero\n    intro ρ hρ\n    rw [Finset.mem_filter] at hρ\n    rw [tailTerm, if_neg (not_lt.mp hρ.2)]\n  rw [hzero, add_zero]\n  -- the filtered finset = the fiber_mult_count finset\n  have hfilter_eq : hfin.toFinset.filter (fun ρ => X < |(ρ : ℂ).im|)\n      = (Set.Finite.subset (dyadClass_fiber_finite hX0 j)\n        (t := {ρ : {ρ // IsNontrivialZero ρ} | dyadClass X ρ = j ∧ X < |(ρ : ℂ).im|})\n        (fun ρ hρ => hρ.1)).toFinset := by\n    ext ρ\n    simp only [Finset.mem_filter, Set.Finite.mem_toFinset]\n    constructor\n    · rintro ⟨h1, h2⟩\n      exact ⟨h1, h2⟩\n    · rintro ⟨h1, h2⟩\n      exact ⟨h1, h2⟩\n  rw [hfilter_eq]\n  -- per-term bound then the count\n  calc ∑ ρ ∈ (Set.Finite.subset (dyadClass_fiber_finite hX0 j)\n          (t := {ρ : {ρ // IsNontrivialZero ρ} | dyadClass X ρ = j ∧ X < |(ρ : ℂ).im|})\n          (fun ρ hρ => hρ.1)).toFinset, tailTerm X ρ\n      ≤ ∑ ρ ∈ (Set.Finite.subset (dyadClass_fiber_finite hX0 j)\n          (t := {ρ : {ρ // IsNontrivialZero ρ} | dyadClass X ρ = j ∧ X < |(ρ : ℂ).im|})\n          (fun ρ hρ => hρ.1)).toFinset,\n        (1 / ((2 : ℝ) ^ j * X) ^ 2) * (zeroMult (ρ : ℂ) : ℝ) := by\n        apply Finset.sum_le_sum\n        intro ρ hρ\n        rw [Set.Finite.mem_toFinset] at hρ\n        obtain ⟨hρj, hgt⟩ := hρ\n        have hlo : (2 : ℝ) ^ j * X ≤ |(ρ : ℂ).im| := by\n          have h := dyadClass_lower hX0 (show X ≤ |(ρ : ℂ).im| from hgt.le)\n          rw [hρj] at h\n          exact h\n        have hsq : ((2 : ℝ) ^ j * X) ^ 2 ≤ 1 + ((ρ : ℂ).im) ^ 2 := by\n          have h1 : ((2 : ℝ) ^ j * X) ^ 2 ≤ ((ρ : ℂ).im) ^ 2 := by\n            apply pow_le_pow_left₀ (by positivity) hlo 2\n          nlinarith [h1, sq_nonneg (ρ : ℂ).im]\n        have hpos1 : (0 : ℝ) < (1 : ℝ) + ((ρ : ℂ).im) ^ 2 := by positivity\n        have hpos2 : (0 : ℝ) < ((2 : ℝ) ^ j * X) ^ 2 := by positivity\n        rw [tailTerm, if_pos hgt]\n        rw [show (zeroMult (ρ : ℂ) : ℝ) / (1 + ((ρ : ℂ).im) ^ 2)\n            = (zeroMult (ρ : ℂ) : ℝ) * (1 / (1 + ((ρ : ℂ).im) ^ 2)) from by ring]\n        rw [show (1 / ((2 : ℝ) ^ j * X) ^ 2) * (zeroMult (ρ : ℂ) : ℝ)\n            = (zeroMult (ρ : ℂ) : ℝ) * (1 / ((2 : ℝ) ^ j * X) ^ 2) from by ring]\n        apply mul_le_mul_of_nonneg_left _ (Nat.cast_nonneg _)\n        rw [div_le_div_iff₀ hpos1 hpos2]\n        linarith [hsq]\n    _ = (1 / ((2 : ℝ) ^ j * X) ^ 2) *\n          ∑ ρ ∈ (Set.Finite.subset (dyadClass_fiber_finite hX0 j)\n            (t := {ρ : {ρ // IsNontrivialZero ρ} | dyadClass X ρ = j ∧ X < |(ρ : ℂ).im|})\n            (fun ρ hρ => hρ.1)).toFinset, (zeroMult (ρ : ℂ) : ℝ) := by\n        rw [Finset.mul_sum]\n    _ ≤ (1 / ((2 : ℝ) ^ j * X) ^ 2) *\n          (A0count * ((2 : ℝ) ^ (j + 1) * X + 3)\n            * Real.log (3 * (2 : ℝ) ^ (j + 1) * X + 5)) :=\n        mul_le_mul_of_nonneg_left (fiber_mult_count hX j) (by positivity)\n\n/-- **The far-tail bound**: for X ≥ 200, the zeros with |γ| > X\ncontribute Σ m/(1+γ²) ≤ 16·A₀·log X / X. -/\ntheorem zero_tail_inv_sq_le {X : ℝ} (hX : 200 ≤ X) :\n    ∑' ρ : {ρ : ℂ // IsNontrivialZero ρ}, tailTerm X ρ\n      ≤ 16 * A0count * Real.log X / X := by\n  have hX0 : (0 : ℝ) < X := by linarith\n  have hlogXnn : (0 : ℝ) ≤ Real.log X := Real.log_nonneg (by linarith)\n  have hC0 : (0 : ℝ) ≤ 16 * A0count * Real.log X / X :=\n    div_nonneg (mul_nonneg (mul_nonneg (by norm_num) A0count_pos.le) hlogXnn) hX0.le\n  rw [← ENNReal.ofReal_le_ofReal_iff hC0]\n  rw [ENNReal.ofReal_tsum_of_nonneg (fun ρ => tailTerm_nonneg ρ) (tailTerm_summable X)]\n  rw [← ENNReal.tsum_fiberwise (fun ρ => ENNReal.ofReal (tailTerm X ρ)) (dyadClass X)]\n  -- the dyadic majorant family\n  set F : ℕ → ℝ := fun j => (1 / ((2 : ℝ) ^ j * X) ^ 2) *\n    (A0count * ((2 : ℝ) ^ (j + 1) * X + 3) * Real.log (3 * (2 : ℝ) ^ (j + 1) * X + 5)) with hFdef\n  have hFnn : ∀ j : ℕ, 0 ≤ F j := by\n    intro j\n    rw [hFdef]\n    have h2j1X : (0 : ℝ) ≤ (2 : ℝ) ^ (j + 1) * X := by positivity\n    have hL : (0 : ℝ) ≤ Real.log (3 * (2 : ℝ) ^ (j + 1) * X + 5) := by\n      apply Real.log_nonneg\n      linarith\n    positivity\n  have hFle : ∀ j : ℕ, F j\n      ≤ (4 * A0count / X) * (((j : ℝ) + 4) * Real.log 2 + Real.log X) / (2 : ℝ) ^ j := by\n    intro j\n    rw [hFdef]\n    have h2jX1 : (1 : ℝ) ≤ (2 : ℝ) ^ j * X := by\n      have h1 : (1 : ℝ) ≤ (2 : ℝ) ^ j := by exact_mod_cast Nat.one_le_two_pow\n      nlinarith [h1, hX]\n    have h2jX : (0 : ℝ) < (2 : ℝ) ^ j * X := by positivity\n    have h2j1X : (0 : ℝ) < (2 : ℝ) ^ (j + 1) * X := by positivity\n    have hLnn : (0 : ℝ) ≤ Real.log (3 * (2 : ℝ) ^ (j + 1) * X + 5) := by\n      apply Real.log_nonneg\n      linarith\n    have hlog2nn : (0 : ℝ) ≤ Real.log 2 := Real.log_nonneg (by norm_num)\n    have hlogXnn' : (0 : ℝ) ≤ Real.log X := Real.log_nonneg (by linarith)\n    -- the two factor bounds\n    have hfac1 : A0count * ((2 : ℝ) ^ (j + 1) * X + 3) / ((2 : ℝ) ^ j * X) ^ 2\n        ≤ (4 * A0count / X) / (2 : ℝ) ^ j := by\n      rw [div_le_div_iff₀ (by positivity) (by positivity)]\n      have hpow2 : ((2 : ℝ) ^ j * X) ^ 2 = (2 : ℝ) ^ j ^ 2 * X ^ 2 := by ring\n      rw [hpow2]\n      have h1 : (2 : ℝ) ^ (j + 1) * X = 2 * ((2 : ℝ) ^ j * X) := by rw [pow_succ']; ring\n      have h2 : (2 : ℝ) ^ j * X * (2 : ℝ) ^ j * X * X ≥ 0 := by positivity\n      nlinarith [h1, h2jX1, h2jX, h2j1X, hX, A0count_pos]\n    -- wait: div_le_div_iff₀ with the forms — reconsider below\n    sorry\n  sorry\n\nend NguyenRH1\n\nend"},"extra_content":null}]