Current task: —

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

#1508 assistant 2026-08-23 16:03:04.306 UTC · 1692→2943 tok open ⤢
thinking (5891 chars)
`Complex.norm_intCast (n : ℤ) : ‖(n : ℂ)‖ = ‖n‖`? — line 91-92 references `norm_intCast n` — in Complex/Norm.lean line 133: `rw [norm_intCast, ← Int.cast_abs, abs_of_nonneg hn]` — so `Complex.norm_intCast : ‖(n:ℤ : ℂ)‖ = ‖(n:ℤ)‖` (the ℤ norm) and Int.norm_eq_abs : ‖n‖ = |n| as ℝ. And it's simp 1100 norm_cast for nnnorm. Likely `Complex.norm_intCast (n : ℤ) : ‖(n : ℂ)‖ = |n|`? Given Norm.lean:133 usage `rw [norm_intCast, ← Int.cast_abs]` — norm_intCast gives ‖(n:ℂ)‖ = ‖n‖ (ℤ-norm = |·| via Int.norm_eq_abs: ‖(n:ℤ)‖ = |n| where the |·| is... Int.norm_eq_abs : ‖n‖ = |↑n|?). Simplest robust approach: avoid all this — prove |k + n| ≥ 1 FIRST (pure ℤ), then chain the norms with exact_mod_cast at the end: ```lean have hZ : w ∈ Complex.integerComplement := by intro hk obtain ⟨k, rfl⟩ := hk have h2 : dist (k : ℂ) (-(n : ℂ)) < 1 / 2 := Metric.mem_ball.mp hw rw [Complex.dist_eq] at h2 -- ‖(k:ℂ) + ↑n‖ ≥ 1 unless k = −n by_cases hk0 : k = -(n : ℤ) · exact hwn (by rw [hk0]; push_cast; ring) · -- |k + n| ≥ 1 have h1 : (1 : ℤ) ≤ |k + (n : ℤ)| := Int.one_le_abs (by intro hh exact hk0 (neg_eq_of_add_eq_zero_left (by linear_combination hh))) -- convert: ‖(k:ℂ) − (−↑n)‖ = |k + n| as real have h3 : (k : ℂ) - -(n : ℂ) = ((k + (n : ℤ)) : ℂ) := by push_cast; ring rw [h3] at h2 have h4 : (1 : ℝ) ≤ ‖((k + (n : ℤ)) : ℂ)‖ := by have h5 : ‖((k + (n : ℤ)) : ℂ)‖ = (|(k + (n : ℤ))| : ℝ) := by rw [Complex.norm_intCast, Int.norm_eq_abs] -- ‖(m:ℂ)‖ = ‖m‖_ℤ = |↑m|?? check forms rw [h5] exact_mod_cast h1 linarith ``` For h5: `Complex.norm_intCast` : ‖(↑m : ℂ)‖ = ‖m‖ (NNReal-ish?) — from Complex/Basic.lean:91: `nnnorm_intCast (n : ℤ) : ‖(n : ℂ)‖₊ = ‖n‖₊ := by ext; exact norm_intCast n` — so `Complex.norm_intCast (n : ℤ) : ‖(n : ℂ)‖ = ‖n‖` (real norms). And ‖(m : ℤ)‖ (real) = |m| : `Int.norm_eq_abs : ‖n‖ = |↑n|`? From Normed/Group/Int.lean:39: `_ = |(n : ℝ)| := by simp only [Int.natCast_natAbs, Int.cast_abs]` — so Int.norm_eq_abs : ‖(n:ℤ)‖ = |(n:ℝ)| probably. So h5 := by rw [Complex.norm_intCast, Int.norm_eq_abs] : ‖(↑m:ℂ)‖ = ‖m‖ = |(m:ℝ)| ✓ — target form (|(k+(n:ℤ))| : ℝ) — the |·| on ℤ vs ℝ: Int.norm_eq_abs's RHS form: |↑n| with cast to ℝ? or |n| in ℤ?? `Int.norm_eq_abs : ‖n‖ = |n|` where |n| : ℤ then coerced?? The simp only [Int.cast_abs] suggests |n| then cast. Let me just write h5 := by rw [Complex.norm_intCast, Int.norm_eq_abs] and adjust the exact form from errors. Then h4: (1:ℝ) ≤ |((k+n:ℤ):ℝ)|: from h1 : (1:ℤ) ≤ |k+n|: exact_mod_cast h1 : (1:ℝ) ≤ (|k+(n:ℤ)| : ℝ)... the cast of |·| ℤ→ℝ: Int.cast_abs: ↑|m| = |↑m| ✓ exact_mod_cast handles ✓. Hmm — this hZ proof appears TWICE (in digammaSeriesPart_eq_sub_add_single and digamma_eq_neg_inv_add_Hsub) with identical content — factor it as a standalone lemma: ```lean /-- A point of ball(−n, 1/2) other than −n is not an integer. -/ lemma integerComplement_of_mem_ball_neg {n : ℕ} (hn : 1 ≤ n) {w : ℂ} (hw : w ∈ Metric.ball (-(n : ℂ)) (1 / 2)) (hwn : w ≠ -(n : ℂ)) : w ∈ Complex.integerComplement := by ... ``` (hn unused? — for n ≥ 1 irrelevant; keep hn for API uniformity or drop — drop it: the statement holds for n = 0 too... n = 0: ball(0, 1/2), w ≠ 0 ✓ same proof. Drop hn.) Similarly §5's hZ (ball(0,1/2), w ≠ 0): same lemma with n = 0! `integerComplement_of_mem_ball_neg (n := 0) hw hw0` — ball(−(0:ℂ), 1/2) = ball(0,1/2): −(0:ℂ)... ↑(0:ℕ) = 0: −↑0 = 0: the ball (0:ℂ)... the membership hw : w ∈ ball 0 (1/2) vs ball (−(0:ℂ)) (1/2): −(0:ℂ) reduces: -(0:ℂ) = 0 defeq? neg_zero is simp-rfl? Probably defeq (NegZeroClass). Hmm risky; keep the two separate or convert via `show`. Let me define the lemma for general (c : ℂ)... actually cleanest: a lemma for ANY point at distance < 1/2 from an integer-ish point: ```lean lemma integerComplement_of_mem_ball_neg_natCast {n : ℕ} {w : ℂ} (hw : w ∈ Metric.ball (-(n : ℂ)) (1 / 2)) (hwn : w ≠ -(n : ℂ)) : w ∈ Complex.integerComplement := by intro hk obtain ⟨k, rfl⟩ := hk have h2 : dist (k : ℂ) (-(n : ℂ)) < 1 / 2 := Metric.mem_ball.mp hw rw [Complex.dist_eq] at h2 by_cases hk0 : k = -(n : ℤ) · exact hwn (by rw [hk0]; push_cast; ring) · have h1 : (1 : ℤ) ≤ |k + (n : ℤ)| := Int.one_le_abs (by intro hh exact hk0 (neg_eq_of_add_eq_zero_left (by linear_combination hh))) have h3 : (k : ℂ) - -(n : ℂ) = ((k + (n : ℤ)) : ℂ) := by push_cast; ring rw [h3] at h2 have h4 : (1 : ℝ) ≤ ‖((k + (n : ℤ)) : ℂ)‖ := by have h5 : ‖((k + (n : ℤ)) : ℂ)‖ = (|(k + (n : ℤ))| : ℝ) := by rw [Complex.norm_intCast, Int.norm_eq_abs] rw [h5] exact_mod_cast h1 linarith ``` Check `obtain ⟨k, rfl⟩ := hk`: hk : w ∈ Set.range (Int.cast): ∃ k, Int.cast k = w: rfl-pattern: hk : ↑k = w — subst needs the equation with a LOCAL VAR on one side: w is a local var ✓ subst w (replaces w by ↑k everywhere incl hw, hwn ✓). Then hwn : (↑k:ℂ) ≠ −(↑n:ℂ): the final `exact hwn (by rw [hk0]; push_cast; ring)`: goal (↑k:ℂ) = −(↑n:ℂ): rw [hk0]: (↑(−↑n:ℤ):ℂ)... hk0 : k = −(n:ℤ): rw [hk0]: goal ((−(n:ℤ) : ℤ):ℂ) = −(↑n:ℂ): push_cast; ring ✓. Int.one_le_abs : k + ↑n ≠ 0 → 1 ≤ |k + ↑n|: the inner by: intro hh (hh : k + ↑n = 0): k = −↑n: neg_eq_of_add_eq_zero_left : a + b = 0 → a = −b ✓ hh direct: hk0 (neg_eq_of_add_eq_zero_left hh) — no linear_combination needed: `exact hk0 (neg_eq_of_add_eq_zero_left hh)` ✓. Then §5's hZ becomes: `integerComplement_of_mem_ball_neg_natCast (n := 0) (by simpa using hw) (by simpa using hw0)`? ball(−(0:ℕ):ℂ) — −(↑(0:ℕ):ℂ) = −0 = 0: simpa using hw: hw : w ∈ ball 0 (1/2); goal w ∈ ball (−(0:ℂ))... simp normalizes −(↑0) → 0 ✓. And hw0 : w ≠ 0 vs goal w ≠ −(0:ℂ): simp ✓. Fine. Now also the calc-step pin (line 686-687) and the tsum_congr. Also §5's digamma_eq_seriesPart_near_zero's hZ gets replaced by the factored lemma. Let me now rewrite both hZ blocks and the calc.
Factoring the integerComplement argument into one lemma and fixing both call sites + the calc pin.
tool: Edit
input
{
  "file_path": "D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiFEntire.lean",
  "old_string": "/-- Pole avoidance on ball(0, 1/2): w + j + 1 \u2260 0. -/\nlemma add_nat_add_one_ne_zero_of_mem_ball {w : \u2102} (hw : w \u2208 Metric.ball 0 (1 / 2)) (j : \u2115) :\n    w + (j : \u2102) + 1 \u2260 0 := by",
  "new_string": "/-- A point of ball(\u2212n, 1/2) other than \u2212n is not an integer\n(the integer lattice is 1-separated). -/\nlemma integerComplement_of_mem_ball_neg_natCast {n : \u2115} {w : \u2102}\n    (hw : w \u2208 Metric.ball (-(n : \u2102)) (1 / 2)) (hwn : w \u2260 -(n : \u2102)) :\n    w \u2208 Complex.integerComplement := by\n  intro hk\n  obtain \u27e8k, rfl\u27e9 := hk\n  have h2 : dist (k : \u2102) (-(n : \u2102)) < 1 / 2 := Metric.mem_ball.mp hw\n  rw [Complex.dist_eq] at h2\n  by_cases hk0 : k = -(n : \u2124)\n  \u00b7 exact hwn (by rw [hk0]; push_cast; ring)\n  \u00b7 have h1 : (1 : \u2124) \u2264 |k + (n : \u2124)| := Int.one_le_abs (by\n      intro hh\n      exact hk0 (neg_eq_of_add_eq_zero_left hh))\n    have h3 : (k : \u2102) - -(n : \u2102) = ((k + (n : \u2124)) : \u2102) := by push_cast; ring\n    rw [h3] at h2\n    have h4 : (1 : \u211d) \u2264 \u2016((k + (n : \u2124)) : \u2102)\u2016 := by\n      have h5 : \u2016((k + (n : \u2124)) : \u2102)\u2016 = (|(k + (n : \u2124))| : \u211d) := by\n        rw [Complex.norm_intCast, Int.norm_eq_abs]\n      rw [h5]\n      exact_mod_cast h1\n    linarith\n\n/-- Pole avoidance on ball(0, 1/2): w + j + 1 \u2260 0. -/\nlemma add_nat_add_one_ne_zero_of_mem_ball {w : \u2102} (hw : w \u2208 Metric.ball 0 (1 / 2)) (j : \u2115) :\n    w + (j : \u2102) + 1 \u2260 0 := by"
}
raw content_json (database row)
[{"type":"thinking","thinking":"`Complex.norm_intCast (n : ℤ) : ‖(n : ℂ)‖ = ‖n‖`? — line 91-92 references `norm_intCast n` — in Complex/Norm.lean line 133: `rw [norm_intCast, ← Int.cast_abs, abs_of_nonneg hn]` — so `Complex.norm_intCast : ‖(n:ℤ : ℂ)‖ = ‖(n:ℤ)‖` (the ℤ norm) and Int.norm_eq_abs : ‖n‖ = |n| as ℝ. And it's simp 1100 norm_cast for nnnorm. Likely `Complex.norm_intCast (n : ℤ) : ‖(n : ℂ)‖ = |n|`? Given Norm.lean:133 usage `rw [norm_intCast, ← Int.cast_abs]` — norm_intCast gives ‖(n:ℂ)‖ = ‖n‖ (ℤ-norm = |·| via Int.norm_eq_abs: ‖(n:ℤ)‖ = |n| where the |·| is... Int.norm_eq_abs : ‖n‖ = |↑n|?). \n\nSimplest robust approach: avoid all this — prove |k + n| ≥ 1 FIRST (pure ℤ), then chain the norms with exact_mod_cast at the end:\n\n```lean\n  have hZ : w ∈ Complex.integerComplement := by\n    intro hk\n    obtain ⟨k, rfl⟩ := hk\n    have h2 : dist (k : ℂ) (-(n : ℂ)) < 1 / 2 := Metric.mem_ball.mp hw\n    rw [Complex.dist_eq] at h2\n    -- ‖(k:ℂ) + ↑n‖ ≥ 1 unless k = −n\n    by_cases hk0 : k = -(n : ℤ)\n    · exact hwn (by rw [hk0]; push_cast; ring)\n    · -- |k + n| ≥ 1\n      have h1 : (1 : ℤ) ≤ |k + (n : ℤ)| := Int.one_le_abs (by\n        intro hh\n        exact hk0 (neg_eq_of_add_eq_zero_left (by linear_combination hh)))\n      -- convert: ‖(k:ℂ) − (−↑n)‖ = |k + n| as real\n      have h3 : (k : ℂ) - -(n : ℂ) = ((k + (n : ℤ)) : ℂ) := by push_cast; ring\n      rw [h3] at h2\n      have h4 : (1 : ℝ) ≤ ‖((k + (n : ℤ)) : ℂ)‖ := by\n        have h5 : ‖((k + (n : ℤ)) : ℂ)‖ = (|(k + (n : ℤ))| : ℝ) := by\n          rw [Complex.norm_intCast, Int.norm_eq_abs]  -- ‖(m:ℂ)‖ = ‖m‖_ℤ = |↑m|?? check forms\n        rw [h5]\n        exact_mod_cast h1\n      linarith\n```\nFor h5: `Complex.norm_intCast` : ‖(↑m : ℂ)‖ = ‖m‖ (NNReal-ish?) — from Complex/Basic.lean:91: `nnnorm_intCast (n : ℤ) : ‖(n : ℂ)‖₊ = ‖n‖₊ := by ext; exact norm_intCast n` — so `Complex.norm_intCast (n : ℤ) : ‖(n : ℂ)‖ = ‖n‖` (real norms). And ‖(m : ℤ)‖ (real) = |m| : `Int.norm_eq_abs : ‖n‖ = |↑n|`? From Normed/Group/Int.lean:39: `_ = |(n : ℝ)| := by simp only [Int.natCast_natAbs, Int.cast_abs]` — so Int.norm_eq_abs : ‖(n:ℤ)‖ = |(n:ℝ)| probably. So h5 := by rw [Complex.norm_intCast, Int.norm_eq_abs] : ‖(↑m:ℂ)‖ = ‖m‖ = |(m:ℝ)| ✓ — target form (|(k+(n:ℤ))| : ℝ) — the |·| on ℤ vs ℝ: Int.norm_eq_abs's RHS form: |↑n| with cast to ℝ? or |n| in ℤ?? `Int.norm_eq_abs : ‖n‖ = |n|` where |n| : ℤ then coerced?? The simp only [Int.cast_abs] suggests |n| then cast. Let me just write h5 := by rw [Complex.norm_intCast, Int.norm_eq_abs] and adjust the exact form from errors. Then h4: (1:ℝ) ≤ |((k+n:ℤ):ℝ)|: from h1 : (1:ℤ) ≤ |k+n|: exact_mod_cast h1 : (1:ℝ) ≤ (|k+(n:ℤ)| : ℝ)... the cast of |·| ℤ→ℝ: Int.cast_abs: ↑|m| = |↑m| ✓ exact_mod_cast handles ✓.\n\nHmm — this hZ proof appears TWICE (in digammaSeriesPart_eq_sub_add_single and digamma_eq_neg_inv_add_Hsub) with identical content — factor it as a standalone lemma:\n\n```lean\n/-- A point of ball(−n, 1/2) other than −n is not an integer. -/\nlemma integerComplement_of_mem_ball_neg {n : ℕ} (hn : 1 ≤ n) {w : ℂ}\n    (hw : w ∈ Metric.ball (-(n : ℂ)) (1 / 2)) (hwn : w ≠ -(n : ℂ)) :\n    w ∈ Complex.integerComplement := by\n  ...\n```\n(hn unused? — for n ≥ 1 irrelevant; keep hn for API uniformity or drop — drop it: the statement holds for n = 0 too... n = 0: ball(0, 1/2), w ≠ 0 ✓ same proof. Drop hn.)\n\nSimilarly §5's hZ (ball(0,1/2), w ≠ 0): same lemma with n = 0! `integerComplement_of_mem_ball_neg (n := 0) hw hw0` — ball(−(0:ℂ), 1/2) = ball(0,1/2): −(0:ℂ)... ↑(0:ℕ) = 0: −↑0 = 0: the ball (0:ℂ)... the membership hw : w ∈ ball 0 (1/2) vs ball (−(0:ℂ)) (1/2): −(0:ℂ) reduces: -(0:ℂ) = 0 defeq? neg_zero is simp-rfl? Probably defeq (NegZeroClass). Hmm risky; keep the two separate or convert via `show`. Let me define the lemma for general (c : ℂ)... actually cleanest: a lemma for ANY point at distance < 1/2 from an integer-ish point:\n\n```lean\nlemma integerComplement_of_mem_ball_neg_natCast {n : ℕ} {w : ℂ}\n    (hw : w ∈ Metric.ball (-(n : ℂ)) (1 / 2)) (hwn : w ≠ -(n : ℂ)) :\n    w ∈ Complex.integerComplement := by\n  intro hk\n  obtain ⟨k, rfl⟩ := hk\n  have h2 : dist (k : ℂ) (-(n : ℂ)) < 1 / 2 := Metric.mem_ball.mp hw\n  rw [Complex.dist_eq] at h2\n  by_cases hk0 : k = -(n : ℤ)\n  · exact hwn (by rw [hk0]; push_cast; ring)\n  · have h1 : (1 : ℤ) ≤ |k + (n : ℤ)| := Int.one_le_abs (by\n      intro hh\n      exact hk0 (neg_eq_of_add_eq_zero_left (by linear_combination hh)))\n    have h3 : (k : ℂ) - -(n : ℂ) = ((k + (n : ℤ)) : ℂ) := by push_cast; ring\n    rw [h3] at h2\n    have h4 : (1 : ℝ) ≤ ‖((k + (n : ℤ)) : ℂ)‖ := by\n      have h5 : ‖((k + (n : ℤ)) : ℂ)‖ = (|(k + (n : ℤ))| : ℝ) := by\n        rw [Complex.norm_intCast, Int.norm_eq_abs]\n      rw [h5]\n      exact_mod_cast h1\n    linarith\n```\nCheck `obtain ⟨k, rfl⟩ := hk`: hk : w ∈ Set.range (Int.cast): ∃ k, Int.cast k = w: rfl-pattern: hk : ↑k = w — subst needs the equation with a LOCAL VAR on one side: w is a local var ✓ subst w (replaces w by ↑k everywhere incl hw, hwn ✓).\n\nThen hwn : (↑k:ℂ) ≠ −(↑n:ℂ): the final `exact hwn (by rw [hk0]; push_cast; ring)`: goal (↑k:ℂ) = −(↑n:ℂ): rw [hk0]: (↑(−↑n:ℤ):ℂ)... hk0 : k = −(n:ℤ): rw [hk0]: goal ((−(n:ℤ) : ℤ):ℂ) = −(↑n:ℂ): push_cast; ring ✓.\n\nInt.one_le_abs : k + ↑n ≠ 0 → 1 ≤ |k + ↑n|: the inner by: intro hh (hh : k + ↑n = 0): k = −↑n: neg_eq_of_add_eq_zero_left : a + b = 0 → a = −b ✓ hh direct: hk0 (neg_eq_of_add_eq_zero_left hh) — no linear_combination needed: `exact hk0 (neg_eq_of_add_eq_zero_left hh)` ✓.\n\nThen §5's hZ becomes: `integerComplement_of_mem_ball_neg_natCast (n := 0) (by simpa using hw) (by simpa using hw0)`? ball(−(0:ℕ):ℂ) — −(↑(0:ℕ):ℂ) = −0 = 0: simpa using hw: hw : w ∈ ball 0 (1/2); goal w ∈ ball (−(0:ℂ))... simp normalizes −(↑0) → 0 ✓. And hw0 : w ≠ 0 vs goal w ≠ −(0:ℂ): simp ✓. Fine.\n\nNow also the calc-step pin (line 686-687) and the tsum_congr.\n\nAlso §5's digamma_eq_seriesPart_near_zero's hZ gets replaced by the factored lemma. Let me now rewrite both hZ blocks and the calc.","signature":""},{"type":"text","text":"Factoring the integerComplement argument into one lemma and fixing both call sites + the calc pin."},{"type":"tool_use","id":"Edit_169","name":"Edit","input":{"file_path":"D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiFEntire.lean","old_string":"/-- Pole avoidance on ball(0, 1/2): w + j + 1 ≠ 0. -/\nlemma add_nat_add_one_ne_zero_of_mem_ball {w : ℂ} (hw : w ∈ Metric.ball 0 (1 / 2)) (j : ℕ) :\n    w + (j : ℂ) + 1 ≠ 0 := by","new_string":"/-- A point of ball(−n, 1/2) other than −n is not an integer\n(the integer lattice is 1-separated). -/\nlemma integerComplement_of_mem_ball_neg_natCast {n : ℕ} {w : ℂ}\n    (hw : w ∈ Metric.ball (-(n : ℂ)) (1 / 2)) (hwn : w ≠ -(n : ℂ)) :\n    w ∈ Complex.integerComplement := by\n  intro hk\n  obtain ⟨k, rfl⟩ := hk\n  have h2 : dist (k : ℂ) (-(n : ℂ)) < 1 / 2 := Metric.mem_ball.mp hw\n  rw [Complex.dist_eq] at h2\n  by_cases hk0 : k = -(n : ℤ)\n  · exact hwn (by rw [hk0]; push_cast; ring)\n  · have h1 : (1 : ℤ) ≤ |k + (n : ℤ)| := Int.one_le_abs (by\n      intro hh\n      exact hk0 (neg_eq_of_add_eq_zero_left hh))\n    have h3 : (k : ℂ) - -(n : ℂ) = ((k + (n : ℤ)) : ℂ) := by push_cast; ring\n    rw [h3] at h2\n    have h4 : (1 : ℝ) ≤ ‖((k + (n : ℤ)) : ℂ)‖ := by\n      have h5 : ‖((k + (n : ℤ)) : ℂ)‖ = (|(k + (n : ℤ))| : ℝ) := by\n        rw [Complex.norm_intCast, Int.norm_eq_abs]\n      rw [h5]\n      exact_mod_cast h1\n    linarith\n\n/-- Pole avoidance on ball(0, 1/2): w + j + 1 ≠ 0. -/\nlemma add_nat_add_one_ne_zero_of_mem_ball {w : ℂ} (hw : w ∈ Metric.ball 0 (1 / 2)) (j : ℕ) :\n    w + (j : ℂ) + 1 ≠ 0 := by"},"extra_content":null}]