← Session 27 — ii′-5c/5d: Davenport disc + FE-reflection bounds
thinking (6672 chars)
- `Finset.Ico_succ_left_eq_Ioo (a b) : Ico (succ a) b = Ioo a b` (SuccPred, for succ-orders — for ℕ: succ a = a+1: `Ico (a+1) b = Ioo a b`? the statement uses succ a — for ℕ, `Nat.succ_eq_add_one`: the lemma might display as Ico (succ a)... in the ℕ instance succ a = a + 1 but maybe not syntactically. Risky.
- `Finset.Ico_succ_left_eq_erase_Ico : Ico a.succ b = erase (Ico a b) a` (Nat.lean:135) — for ℕ: Ico (a+1) b = (Ico a b).erase a — so the INVERSE: (Ico j₀ m).erase j₀ = Ico (j₀+1) m via this reversed: (Ico a b).erase a = Ico a.succ b = Ico (a+1) b: `Finset.Ico_succ_left_eq_erase_Ico : Ico a.succ b = erase (Ico a b) a` — so .symm : (Ico a b).erase a = Ico a.succ b. So my `rw [Finset.Ico_erase_left]` failed because Ico_erase_left doesn't exist — wait it didn't error unknown-identifier... the error at 619 shows the residual with Ioo — so Ico_erase_left EXISTS but gives `Ioo`?? The residual: `∑ x ∈ Finset.Ioo j₀ m` — so after my rws, the erase became Ioo j₀ m. So Finset.Ico_erase_left : (Ico a b).erase a = Ioo a b in this Mathlib. Then I need Ioo j₀ m = Ico (j₀+1) m: via Ico_succ_left_eq_Ioo.symm : Ioo a b = Ico (succ a) b: and succ a = a+1 for ℕ: hmm the succ form. Let me just change hrest_r's sum to the Ioo form: reindex over Ioo j₀ m via `Finset.sum_Ioo_eq_sum_range`: `∑ i ∈ Ioo a b, f i = ∑ i ∈ range (b−a−1), f (a+1+i)`? check that exists... OR — simpler — replace the whole add_sum_erase approach: peel via sum_range forms throughout. The RIGHT side is ∑ j ∈ Ico j₀ m: convert to range FIRST: ∑ j ∈ Ico j₀ m, f j = ∑ i ∈ range (m − j₀), f (j₀ + i) [sum_Ico_eq_sum_range] = f j₀ + ∑ i ∈ range (m−j₀−1), f (j₀+1+i) [sum_range_succ on range (m−j₀) = insert... range (m−j₀) with m−j₀ ≥ 1: ∑ i ∈ range (m−j₀), g i = g 0 + ∑ i ∈ range (m−j₀−1), g (i+1)?? that's sum_range_succ' hmm: `Finset.sum_range_succ' : ∑ i ∈ range (n+1), f i = f 0 + ∑ i ∈ range n, f (i+1)` ✓ EXISTS. So:
```
have hright : ... := by
rw [Finset.sum_Ico_eq_sum_range] -- ∑ i ∈ range (m − j₀), f (j₀ + i)
conv_lhs => rw [show m - j₀ = (m - j₀ - 1) + 1 by omega] -- hmm range (m−j₀) = range ((m−j₀−1)+1)
rw [Finset.sum_range_succ'] -- f (j₀+0) + ∑ i ∈ range (m−j₀−1), f (j₀+(i+1))
-- f (j₀+0) = f j₀: the first term
...
```
then bound: f j₀ ≤ 1/c (hfirst_r); the rest ≤ harmonic via recip_norm_le_right (j₀+1+i: j₀+1 ≤ j₀+1+i ✓ (hj : j₀+1 ≤ j)): the term ((j₀+1+i) − j₀ : ℕ) = i+1 ✓. The casts: f (j₀ + i) with f j := ‖(w + ↑j)⁻¹‖: fine.
So restructure hright entirely via range forms:
```
have hright : ∑ j ∈ Finset.Ico j₀ m, ‖(w + (j : ℂ))⁻¹‖ ≤ 1 / c + (1 + Real.log m) := by
rw [Finset.sum_Ico_eq_sum_range]
conv_lhs => rw [show m - j₀ = (m - j₀ - 1) + 1 by omega]
rw [Finset.sum_range_succ']
-- goal: ‖(w + ↑(j₀ + 0))⁻¹‖ + ∑ i ∈ range (m−j₀−1), ‖(w + ↑(j₀ + (i+1)))⁻¹‖ ≤ 1/c + (1 + log m)
rw [add_zero] -- hmm the j₀ + 0: simp forms
...
```
Hmm the term forms: after sum_Ico_eq_sum_range, the summand is (fun j => ‖(w + ↑j)⁻¹‖) (j₀ + i) — beta redex again! And after sum_range_succ' — more redexes. The beta-redex issue from before... `simp only []` after the rewrites to beta-reduce. Let me write:
```
have hright : ∑ j ∈ Finset.Ico j₀ m, ‖(w + (j : ℂ))⁻¹‖ ≤ 1 / c + (1 + Real.log m) := by
rw [Finset.sum_Ico_eq_sum_range]
conv_lhs => rw [show m - j₀ = (m - j₀ - 1) + 1 by omega]
rw [Finset.sum_range_succ']
simp only []
-- now: ‖(w + ↑(j₀+0))⁻¹‖ + ∑ i ∈ range (m−j₀−1), ‖(w + ↑(j₀+(i+1)))⁻¹‖ ≤ ...
rw [add_zero]
have hcast : ∀ i : ℕ, ((j₀ + (i + 1) : ℕ) : ℂ) = (j₀ : ℂ) + ((i : ℂ) + 1) := by
intro i; push_cast; ring
-- hmm actually I don't need this; the recip_norm_le_right's j is (j₀ + (i+1)) : ℕ and its conclusion's ((j − j₀ : ℕ):ℝ)⁻¹ with j := j₀+(i+1): (j₀+(i+1))−j₀ = i+1 ✓
calc ‖(w + (j₀ : ℂ))⁻¹‖ + ∑ i ∈ Finset.range (m - j₀ - 1), ‖(w + ((j₀ + (i + 1) : ℕ)) : ℂ)⁻¹‖
≤ 1 / c + ∑ i ∈ Finset.range (m - j₀ - 1), ((i : ℝ) + 1)⁻¹ := by
apply add_le_add hfirst_r
apply Finset.sum_le_sum
intro i _
have h1 := recip_norm_le_right hdist hj₀ (j := j₀ + (i + 1)) (by omega)
-- h1 : ‖(w + ↑(j₀+(i+1)))⁻¹‖ ≤ (((j₀+(i+1)) − j₀ : ℕ):ℝ)⁻¹ and (j₀+(i+1))−j₀ = i+1
have h2 : (j₀ + (i + 1)) - j₀ = i + 1 := by omega
rw [h2] at h1
have h3 : (((i + 1 : ℕ)) : ℝ)⁻¹ = ((i : ℝ) + 1)⁻¹ := by
rw [Nat.cast_add_one]
rw [h3] at h1 -- hmm direction: h1's RHS ((i+1:ℕ):ℝ)⁻¹ → ((i:ℝ)+1)⁻¹: rw [Nat.cast_add_one] at h1 turns ↑(i+1) into ↑i+1 ✓
exact h1
_ ≤ 1 / c + (1 + Real.log (m - j₀ - 1)) := by
gcongr -- 1/c + Σ ≤ 1/c + (1+log(m−j₀−1)): the sum ≤ via hHarm
exact hHarm _
_ ≤ 1 / c + (1 + Real.log m) := by
gcongr -- mono
exact hlogmono0 (by omega : m - j₀ - 1 ≤ m) hm1
```
Hmm the gcongr on `1/c + X ≤ 1/c + Y`: side goal X ≤ Y ✓ then the exact provides it. But gcongr's convention... add_le_add_left (h : X ≤ Y) (1/c) — per swapped convention: b + a ≤ c + a — 1/c on the right ✓: so `exact add_le_add_left (hHarm _) _`? no wait: X + (1/c)?? my sum is `1 / c + ∑...`: constant on the LEFT: per swapped convention that's add_le_add_RIGHT (h : b ≤ c) (a) : a + b ≤ a + c ✓. Ugh the swapped convention. Use: `refine add_le_add_right ?_ _; exact hHarm _`. Hmm — risk. Let me use gcongr with the exact fallback... Actually safest: linarith can't (sums are atoms with different bounds). Use:
```
_ ≤ 1 / c + (1 + Real.log (m - j₀ - 1)) := by
have h := hHarm (m - j₀ - 1)
-- the sum-form match: my sum is over range (m − j₀ − 1) with ((i:ℝ)+1)⁻¹ — hHarm's form ✓
-- 1/c + Σ ≤ 1/c + (1+log): via add_le_add_left? per swap: add_le_add_left (h : b ≤ c) (a) : b + a ≤ c + a: my form: const LEFT (1/c + Σ): swapped: add_le_add_right (h) (a) : a + b ≤ a + c ✓:
exact add_le_add_right h _
_ ≤ 1 / c + (1 + Real.log m) := add_le_add_right (hlogmono0 (by omega : m - j₀ - 1 ≤ m) hm1) _
```
Wait — `add_le_add_right h _` : per the SWAPPED convention (journal-025): add_le_add_right (h : b ≤ c) (a) : a + b ≤ a + c — my goal: (1/c) + Σ ≤ (1/c) + (1+log(...)): the constant 1/c on the LEFT, varying Σ on the right: a := 1/c, b := Σ, c' := 1+log: a + b ≤ a + c' ✓ = add_le_add_right h _ ✓ with h : Σ ≤ 1+log. OK.
Hmm — this add_le_add convention keeps tripping me. Let me double check from the 5d journal note: "add_le_add_left (h : b ≤ c) (a) : b + a ≤ c + a; add_le_add_right (h : b ≤ c) (a) : a + b ≤ a + c" — so add_le_add_right (h : b ≤ c) (a) : a + b ≤ a + c ✓ as I just used.
OK — let me now rewrite hright entirely (replacing the add_sum_erase version).
Restructuring hright via range-forms (avoiding the erase/Ico friction).
tool: Read ok
input
{
"file_path": "D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiDigammaLeft.lean",
"offset": 596,
"limit": 32
}
result 2026-08-23 10:58:15Z → 2026-08-23 10:58:15Z
{
"type": "text",
"file": {
"filePath": "D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiDigammaLeft.lean",
"content": " have hpos : (0 : \u211d) < \u2016w + (j\u2080 : \u2102)\u2016 := lt_of_lt_of_le hc (hdist j\u2080)\n exact (inv_le_inv\u2080 hpos hc).mpr (hdist j\u2080)\n have hrest_r : \u2211 j \u2208 Finset.Ico (j\u2080 + 1) m, \u2016(w + (j : \u2102))\u207b\u00b9\u2016 \u2264 1 + Real.log m := by\n calc \u2211 j \u2208 Finset.Ico (j\u2080 + 1) m, \u2016(w + (j : \u2102))\u207b\u00b9\u2016\n \u2264 \u2211 j \u2208 Finset.Ico (j\u2080 + 1) m, ((j - j\u2080 : \u2115) : \u211d)\u207b\u00b9 :=\n Finset.sum_le_sum fun j hj => recip_norm_le_right hdist hj\u2080 (by\n rw [Finset.mem_Ico] at hj; exact hj.1)\n _ = \u2211 i \u2208 Finset.range (m - (j\u2080 + 1)), ((i : \u211d) + 1)\u207b\u00b9 := by\n rw [Finset.sum_Ico_eq_sum_range]\n apply Finset.sum_congr rfl\n intro i _\n have h1 : (j\u2080 + 1 + i) - j\u2080 = i + 1 := by omega\n rw [h1, Nat.cast_add_one]\n _ \u2264 1 + Real.log (m - (j\u2080 + 1)) := hHarm _\n _ \u2264 1 + Real.log m := by\n have hK : ((m - (j\u2080 + 1) : \u2115) : \u211d) = (m : \u211d) - ((j\u2080 : \u211d) + 1) := by\n rw [Nat.cast_sub (by omega : j\u2080 + 1 \u2264 m)]\n push_cast\n ring\n rw [\u2190 hK]\n exact hlogmono0 (by omega : m - (j\u2080 + 1) \u2264 m) hm1\n have hright : \u2211 j \u2208 Finset.Ico j\u2080 m, \u2016(w + (j : \u2102))\u207b\u00b9\u2016 \u2264 1 / c + (1 + Real.log m) := by\n calc \u2211 j \u2208 Finset.Ico j\u2080 m, \u2016(w + (j : \u2102))\u207b\u00b9\u2016\n = \u2016(w + (j\u2080 : \u2102))\u207b\u00b9\u2016 + \u2211 j \u2208 Finset.Ico (j\u2080 + 1) m, \u2016(w + (j : \u2102))\u207b\u00b9\u2016 := by\n rw [\u2190 Finset.add_sum_erase _ _ (Finset.left_mem_Ico.mpr (by omega : j\u2080 < m)),\n Finset.Ico_erase_left]\n _ \u2264 1 / c + (1 + Real.log m) := add_le_add hfirst_r hrest_r\n -- LEFT side\n have hleft : \u2211 j \u2208 Finset.range j\u2080, \u2016(w + (j : \u2102))\u207b\u00b9\u2016 \u2264 1 / c + (1 + Real.log m) := by\n by_cases hj\u20800 : j\u2080 = 0\n \u00b7 rw [hj\u20800]\n simp only [Finset.range_zero, Finset.sum_empty]",
"numLines": 32,
"startLine": 596,
"totalLines": 678
}
}
raw content_json (database row)
[{"type":"thinking","thinking":"- `Finset.Ico_succ_left_eq_Ioo (a b) : Ico (succ a) b = Ioo a b` (SuccPred, for succ-orders — for ℕ: succ a = a+1: `Ico (a+1) b = Ioo a b`? the statement uses succ a — for ℕ, `Nat.succ_eq_add_one`: the lemma might display as Ico (succ a)... in the ℕ instance succ a = a + 1 but maybe not syntactically. Risky.\n- `Finset.Ico_succ_left_eq_erase_Ico : Ico a.succ b = erase (Ico a b) a` (Nat.lean:135) — for ℕ: Ico (a+1) b = (Ico a b).erase a — so the INVERSE: (Ico j₀ m).erase j₀ = Ico (j₀+1) m via this reversed: (Ico a b).erase a = Ico a.succ b = Ico (a+1) b: `Finset.Ico_succ_left_eq_erase_Ico : Ico a.succ b = erase (Ico a b) a` — so .symm : (Ico a b).erase a = Ico a.succ b. So my `rw [Finset.Ico_erase_left]` failed because Ico_erase_left doesn't exist — wait it didn't error unknown-identifier... the error at 619 shows the residual with Ioo — so Ico_erase_left EXISTS but gives `Ioo`?? The residual: `∑ x ∈ Finset.Ioo j₀ m` — so after my rws, the erase became Ioo j₀ m. So Finset.Ico_erase_left : (Ico a b).erase a = Ioo a b in this Mathlib. Then I need Ioo j₀ m = Ico (j₀+1) m: via Ico_succ_left_eq_Ioo.symm : Ioo a b = Ico (succ a) b: and succ a = a+1 for ℕ: hmm the succ form. Let me just change hrest_r's sum to the Ioo form: reindex over Ioo j₀ m via `Finset.sum_Ioo_eq_sum_range`: `∑ i ∈ Ioo a b, f i = ∑ i ∈ range (b−a−1), f (a+1+i)`? check that exists... OR — simpler — replace the whole add_sum_erase approach: peel via sum_range forms throughout. The RIGHT side is ∑ j ∈ Ico j₀ m: convert to range FIRST: ∑ j ∈ Ico j₀ m, f j = ∑ i ∈ range (m − j₀), f (j₀ + i) [sum_Ico_eq_sum_range] = f j₀ + ∑ i ∈ range (m−j₀−1), f (j₀+1+i) [sum_range_succ on range (m−j₀) = insert... range (m−j₀) with m−j₀ ≥ 1: ∑ i ∈ range (m−j₀), g i = g 0 + ∑ i ∈ range (m−j₀−1), g (i+1)?? that's sum_range_succ' hmm: `Finset.sum_range_succ' : ∑ i ∈ range (n+1), f i = f 0 + ∑ i ∈ range n, f (i+1)` ✓ EXISTS. So:\n```\n have hright : ... := by\n rw [Finset.sum_Ico_eq_sum_range] -- ∑ i ∈ range (m − j₀), f (j₀ + i)\n conv_lhs => rw [show m - j₀ = (m - j₀ - 1) + 1 by omega] -- hmm range (m−j₀) = range ((m−j₀−1)+1)\n rw [Finset.sum_range_succ'] -- f (j₀+0) + ∑ i ∈ range (m−j₀−1), f (j₀+(i+1))\n -- f (j₀+0) = f j₀: the first term\n ...\n```\nthen bound: f j₀ ≤ 1/c (hfirst_r); the rest ≤ harmonic via recip_norm_le_right (j₀+1+i: j₀+1 ≤ j₀+1+i ✓ (hj : j₀+1 ≤ j)): the term ((j₀+1+i) − j₀ : ℕ) = i+1 ✓. The casts: f (j₀ + i) with f j := ‖(w + ↑j)⁻¹‖: fine.\n\nSo restructure hright entirely via range forms:\n```\n have hright : ∑ j ∈ Finset.Ico j₀ m, ‖(w + (j : ℂ))⁻¹‖ ≤ 1 / c + (1 + Real.log m) := by\n rw [Finset.sum_Ico_eq_sum_range]\n conv_lhs => rw [show m - j₀ = (m - j₀ - 1) + 1 by omega]\n rw [Finset.sum_range_succ']\n -- goal: ‖(w + ↑(j₀ + 0))⁻¹‖ + ∑ i ∈ range (m−j₀−1), ‖(w + ↑(j₀ + (i+1)))⁻¹‖ ≤ 1/c + (1 + log m)\n rw [add_zero] -- hmm the j₀ + 0: simp forms\n ...\n```\nHmm the term forms: after sum_Ico_eq_sum_range, the summand is (fun j => ‖(w + ↑j)⁻¹‖) (j₀ + i) — beta redex again! And after sum_range_succ' — more redexes. The beta-redex issue from before... `simp only []` after the rewrites to beta-reduce. Let me write:\n```\n have hright : ∑ j ∈ Finset.Ico j₀ m, ‖(w + (j : ℂ))⁻¹‖ ≤ 1 / c + (1 + Real.log m) := by\n rw [Finset.sum_Ico_eq_sum_range]\n conv_lhs => rw [show m - j₀ = (m - j₀ - 1) + 1 by omega]\n rw [Finset.sum_range_succ']\n simp only []\n -- now: ‖(w + ↑(j₀+0))⁻¹‖ + ∑ i ∈ range (m−j₀−1), ‖(w + ↑(j₀+(i+1)))⁻¹‖ ≤ ...\n rw [add_zero]\n have hcast : ∀ i : ℕ, ((j₀ + (i + 1) : ℕ) : ℂ) = (j₀ : ℂ) + ((i : ℂ) + 1) := by\n intro i; push_cast; ring\n -- hmm actually I don't need this; the recip_norm_le_right's j is (j₀ + (i+1)) : ℕ and its conclusion's ((j − j₀ : ℕ):ℝ)⁻¹ with j := j₀+(i+1): (j₀+(i+1))−j₀ = i+1 ✓\n calc ‖(w + (j₀ : ℂ))⁻¹‖ + ∑ i ∈ Finset.range (m - j₀ - 1), ‖(w + ((j₀ + (i + 1) : ℕ)) : ℂ)⁻¹‖\n ≤ 1 / c + ∑ i ∈ Finset.range (m - j₀ - 1), ((i : ℝ) + 1)⁻¹ := by\n apply add_le_add hfirst_r\n apply Finset.sum_le_sum\n intro i _\n have h1 := recip_norm_le_right hdist hj₀ (j := j₀ + (i + 1)) (by omega)\n -- h1 : ‖(w + ↑(j₀+(i+1)))⁻¹‖ ≤ (((j₀+(i+1)) − j₀ : ℕ):ℝ)⁻¹ and (j₀+(i+1))−j₀ = i+1\n have h2 : (j₀ + (i + 1)) - j₀ = i + 1 := by omega\n rw [h2] at h1\n have h3 : (((i + 1 : ℕ)) : ℝ)⁻¹ = ((i : ℝ) + 1)⁻¹ := by\n rw [Nat.cast_add_one]\n rw [h3] at h1 -- hmm direction: h1's RHS ((i+1:ℕ):ℝ)⁻¹ → ((i:ℝ)+1)⁻¹: rw [Nat.cast_add_one] at h1 turns ↑(i+1) into ↑i+1 ✓\n exact h1\n _ ≤ 1 / c + (1 + Real.log (m - j₀ - 1)) := by\n gcongr -- 1/c + Σ ≤ 1/c + (1+log(m−j₀−1)): the sum ≤ via hHarm\n exact hHarm _\n _ ≤ 1 / c + (1 + Real.log m) := by\n gcongr -- mono\n exact hlogmono0 (by omega : m - j₀ - 1 ≤ m) hm1\n```\nHmm the gcongr on `1/c + X ≤ 1/c + Y`: side goal X ≤ Y ✓ then the exact provides it. But gcongr's convention... add_le_add_left (h : X ≤ Y) (1/c) — per swapped convention: b + a ≤ c + a — 1/c on the right ✓: so `exact add_le_add_left (hHarm _) _`? no wait: X + (1/c)?? my sum is `1 / c + ∑...`: constant on the LEFT: per swapped convention that's add_le_add_RIGHT (h : b ≤ c) (a) : a + b ≤ a + c ✓. Ugh the swapped convention. Use: `refine add_le_add_right ?_ _; exact hHarm _`. Hmm — risk. Let me use gcongr with the exact fallback... Actually safest: linarith can't (sums are atoms with different bounds). Use:\n```\n _ ≤ 1 / c + (1 + Real.log (m - j₀ - 1)) := by\n have h := hHarm (m - j₀ - 1)\n -- the sum-form match: my sum is over range (m − j₀ − 1) with ((i:ℝ)+1)⁻¹ — hHarm's form ✓\n -- 1/c + Σ ≤ 1/c + (1+log): via add_le_add_left? per swap: add_le_add_left (h : b ≤ c) (a) : b + a ≤ c + a: my form: const LEFT (1/c + Σ): swapped: add_le_add_right (h) (a) : a + b ≤ a + c ✓:\n exact add_le_add_right h _\n _ ≤ 1 / c + (1 + Real.log m) := add_le_add_right (hlogmono0 (by omega : m - j₀ - 1 ≤ m) hm1) _\n```\nWait — `add_le_add_right h _` : per the SWAPPED convention (journal-025): add_le_add_right (h : b ≤ c) (a) : a + b ≤ a + c — my goal: (1/c) + Σ ≤ (1/c) + (1+log(...)): the constant 1/c on the LEFT, varying Σ on the right: a := 1/c, b := Σ, c' := 1+log: a + b ≤ a + c' ✓ = add_le_add_right h _ ✓ with h : Σ ≤ 1+log. OK.\n\nHmm — this add_le_add convention keeps tripping me. Let me double check from the 5d journal note: \"add_le_add_left (h : b ≤ c) (a) : b + a ≤ c + a; add_le_add_right (h : b ≤ c) (a) : a + b ≤ a + c\" — so add_le_add_right (h : b ≤ c) (a) : a + b ≤ a + c ✓ as I just used.\n\nOK — let me now rewrite hright entirely (replacing the add_sum_erase version).","signature":""},{"type":"text","text":"Restructuring hright via range-forms (avoiding the erase/Ico friction)."},{"type":"tool_use","id":"Read_410","name":"Read","input":{"file_path":"D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiDigammaLeft.lean","offset":596,"limit":32},"extra_content":null}]