← Session 27 — ii′-5c/5d: Davenport disc + FE-reflection bounds
thinking (6229 chars)
The integer case now compiles (no error there). Only hsplit remains: `rw [h]` didn't close the goal. The goal after: `∑' (n : ℕ), ((↑n + 1) * (A + ↑n + 1))⁻¹ = ∑ n ∈ Finset.range N, ((↑n + 1) * (A + ↑n + 1))⁻¹ + ∑' (n : ℕ), ((↑(n + N) + 1) * (A + ↑(n + N) + 1))⁻¹` — so rw [h] didn't even REWRITE (goal unchanged) — h's RHS pattern `∑' i, f i` with f the lambda... After simp only [] at h, h's RHS should be `∑' n, ((↑n+1)*(A+↑n+1))⁻¹` matching the goal's LHS. But the rw didn't fire — so h's form after simp still differs. The difference might be the NAT-add: the lemma's f (i + k) — with the beta — hmm — actually maybe `Summable.sum_add_tsum_nat_add` produces `∑' i, f (i + N)` where the elaborator eta-contracts?? Or the issue is that `simp only [] at h` errored "no progress" (if h's applications are already reduced by the elaborator) — but then no error... The error shows just "unsolved goals" — so the block's tactics all "ran" but the goal remains — the rw [h] failed silently?? No — rw failure would error. UNLESS: `simp only [] at h` errored "made no progress" and that's... no error for it shown. Hmm — wait, actually if simp only [] at h FAILED with "no progress", that's an ERROR which would show. Not shown. So simp only [] at h worked (did beta), then rw [h] — pattern h.RHS = ∑' i, (lambda-body-applied) — matches goal LHS — rewrites to h.LHS = (sum + shifted-tsum): then the goal should be h.LHS = my tail-form — if those differ syntactically, rw leaves the goal `h.LHS = goal.RHS` UNSOLVED (rw doesn't fail — it rewrites and then fails to close by rfl, leaving the unsolved goal!). So the residual must be a form mismatch between h.LHS and my stated head+tail. The displayed residual goal is my ORIGINAL goal — meaning rw [h] rewrote and un-rw'd? No — "unsolved goals" shows the CURRENT goal after all tactics = my original goal — so rw [h] didn't change anything?? rw failing to find the pattern raises an ERROR ("did not find occurrence") — not shown. I'm confused.
Let me just look at the raw error more carefully — "error: unsolved goals case hsplit ... ⊢ [my original goal]" — this means after the by-block's tactics, the goal is my original hsplit statement — i.e., `rw [h]` left it unchanged and rfl couldn't close. This happens when rw [h] rewrites and the result isn't rfl — OR when rw [h] failed to match and... no, non-matching rw errors. Hmm — OR: `simp only [] at h` consumed... whatever. Let me stop guessing and get h's actual form: add a `trace` or just try a completely different proof:
```
have hsplit : ... := by
have h := hker_summ.sum_add_tsum_nat_add N
rw [← h]
```
with the GOAL stated using the same function variable trick: state hsplit as:
`∑' n, f n = ∑ i ∈ range N, f i + ∑' n, f (n + N)` where f := fun n => ((↑n+1)*(A+↑n+1))⁻¹ — via `let f := ...`?? Let me try the most mechanical:
```
have hsplit : (∑' n : ℕ, (((n : ℝ) + 1) * (A + (n : ℝ) + 1))⁻¹)
= ∑ n ∈ Finset.range N, (((n : ℝ) + 1) * (A + (n : ℝ) + 1))⁻¹
+ ∑' n : ℕ, ((((n + N : ℕ) : ℝ) + 1) * (A + ((n + N : ℕ) : ℝ) + 1))⁻¹) := by
have h := hker_summ.sum_add_tsum_nat_add N
-- h : (∑ i ∈ range N, f i) + ∑' i, f (i+N) = ∑' i, f i
rw [← h]
· rfl -- hmm no
```
The issue is definitely the beta/forms. NEW IDEA — avoid hsplit entirely: I don't need the EXACT split equality; I need the BOUND: ∑' kernel ≤ (1+log N)/A + 1/N. Prove it directly:
```
have hkernel_bound : (∑' n : ℕ, (((n : ℝ) + 1) * (A + (n : ℝ) + 1))⁻¹) ≤ (2 + Real.log (A+1)) / A := by
have hsplit' : (∑' n : ℕ, (((n : ℝ) + 1) * (A + (n : ℝ) + 1))⁻¹)
≤ ∑ n ∈ Finset.range N, (((n : ℝ) + 1) * (A + (n : ℝ) + 1))⁻¹ + 1 / (N : ℝ) := by
-- ∑' f = ∑_{<N} f + ∑'_{≥N} f and bound the tail by the telescope
have hsplit := hker_summ.sum_add_tsum_nat_add N -- hmm still needed
...
```
still needs the split equality. OK alternative formulation of the split equality via tsum_eq_sum_add_tsum...: Actually — the cleanest existing Mathlib form: `tsum_eq_sum_add_tsum_nat_add`?? hmm from the doc comment: "∑ i ∈ range k, f i + ∑' i, f (i + k) = ∑' i, f i ∈ sum_add_tsum_nat_add" — the PRIMED version from NNReal usage was sum_add_tsum_nat_add'. There might be `tsum_eq_sum_add_tsum_nat_add (f) (k) (hf)`?? no. Use the NNReal-observed form: `hf.sum_add_tsum_nat_add' k`?? The NNReal lemma at line 196-198: `theorem sum_add_tsum_nat_add {f : ℕ → ℝ≥0} (k : ℕ) (hf : Summable f) : ... := (((summable_nat_add_iff k).2 hf).sum_add_tsum_nat_add').symm` — so the underlying: `Summable.sum_add_tsum_nat_add' (hf : Summable (fun n => f (n + k)))`? — wait: ((summable_nat_add_iff k).2 hf) : Summable (fun n => f (n+k)) and .sum_add_tsum_nat_add' : ... hmm that's a method on the SHIFTED summable: `Summable.sum_add_tsum_nat_add' (h : Summable fun n => f (n + k)) : ∑' n, f (n + k) + ∑ i ∈ range k, f i = ∑' i, f i`? The direction/priming is getting confusing. Let me just READ the actual to_additive-generated statement... it's generated; the multiplicative source at line 233: `Multipliable.prod_mul_tprod_nat_add (k) (h) : (∏ i ∈ range k, f i) * ∏' i, f (i+k) = ∏' i, f i` — additive: `Summable.sum_add_tsum_nat_add (k : ℕ) (h : Summable f) : (∑ i ∈ range k, f i) + ∑' i, f (i + k) = ∑' i, f i`. My call `hker_summ.sum_add_tsum_nat_add N` — dot-notation: hker_summ (Summable) fills... the FIRST explicit arg is (k : ℕ) — dot notation fills the first explicit arg whose type matches the RECEIVER's head constant: hker_summ : Summable ... — the args are (k : ℕ) (h : Summable f) — hker_summ matches `h` (the Summable one), N fills k ✓. So h : (∑ i ∈ range N, f i) + ∑' i, f (i+N) = ∑' i, f i ✓.
The failure must be purely beta. Let me test what h actually is by making Lean print it — quicker: replace the hsplit proof with `exact h.symm` after a simpa:
```
have h := hker_summ.sum_add_tsum_nat_add N
-- try simpa using h.symm
simpa using h.symm
```
simpa beta-reduces by default and matches up to simp-normal form ✓. `simpa using h.symm` — the simp normal forms of the goal and h.symm should coincide (beta + nothing else changes). If the forms differ only by beta, simpa closes ✓. Try that. If it fails, the error will show the normal-form mismatch.
The hsplit residual is a beta-redex mismatch. Switching to `simpa`.
tool: Edit
input
{
"file_path": "D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiDigammaLeft.lean",
"old_string": " have h := hker_summ.sum_add_tsum_nat_add N\n simp only [] at h\n rw [h]",
"new_string": " have h := hker_summ.sum_add_tsum_nat_add N\n simpa using h.symm"
}
raw content_json (database row)
[{"type":"thinking","thinking":"The integer case now compiles (no error there). Only hsplit remains: `rw [h]` didn't close the goal. The goal after: `∑' (n : ℕ), ((↑n + 1) * (A + ↑n + 1))⁻¹ = ∑ n ∈ Finset.range N, ((↑n + 1) * (A + ↑n + 1))⁻¹ + ∑' (n : ℕ), ((↑(n + N) + 1) * (A + ↑(n + N) + 1))⁻¹` — so rw [h] didn't even REWRITE (goal unchanged) — h's RHS pattern `∑' i, f i` with f the lambda... After simp only [] at h, h's RHS should be `∑' n, ((↑n+1)*(A+↑n+1))⁻¹` matching the goal's LHS. But the rw didn't fire — so h's form after simp still differs. The difference might be the NAT-add: the lemma's f (i + k) — with the beta — hmm — actually maybe `Summable.sum_add_tsum_nat_add` produces `∑' i, f (i + N)` where the elaborator eta-contracts?? Or the issue is that `simp only [] at h` errored \"no progress\" (if h's applications are already reduced by the elaborator) — but then no error... The error shows just \"unsolved goals\" — so the block's tactics all \"ran\" but the goal remains — the rw [h] failed silently?? No — rw failure would error. UNLESS: `simp only [] at h` errored \"made no progress\" and that's... no error for it shown. Hmm — wait, actually if simp only [] at h FAILED with \"no progress\", that's an ERROR which would show. Not shown. So simp only [] at h worked (did beta), then rw [h] — pattern h.RHS = ∑' i, (lambda-body-applied) — matches goal LHS — rewrites to h.LHS = (sum + shifted-tsum): then the goal should be h.LHS = my tail-form — if those differ syntactically, rw leaves the goal `h.LHS = goal.RHS` UNSOLVED (rw doesn't fail — it rewrites and then fails to close by rfl, leaving the unsolved goal!). So the residual must be a form mismatch between h.LHS and my stated head+tail. The displayed residual goal is my ORIGINAL goal — meaning rw [h] rewrote and un-rw'd? No — \"unsolved goals\" shows the CURRENT goal after all tactics = my original goal — so rw [h] didn't change anything?? rw failing to find the pattern raises an ERROR (\"did not find occurrence\") — not shown. I'm confused.\n\nLet me just look at the raw error more carefully — \"error: unsolved goals case hsplit ... ⊢ [my original goal]\" — this means after the by-block's tactics, the goal is my original hsplit statement — i.e., `rw [h]` left it unchanged and rfl couldn't close. This happens when rw [h] rewrites and the result isn't rfl — OR when rw [h] failed to match and... no, non-matching rw errors. Hmm — OR: `simp only [] at h` consumed... whatever. Let me stop guessing and get h's actual form: add a `trace` or just try a completely different proof:\n\n```\n have hsplit : ... := by\n have h := hker_summ.sum_add_tsum_nat_add N\n rw [← h]\n```\nwith the GOAL stated using the same function variable trick: state hsplit as:\n`∑' n, f n = ∑ i ∈ range N, f i + ∑' n, f (n + N)` where f := fun n => ((↑n+1)*(A+↑n+1))⁻¹ — via `let f := ...`?? Let me try the most mechanical: \n\n```\n have hsplit : (∑' n : ℕ, (((n : ℝ) + 1) * (A + (n : ℝ) + 1))⁻¹)\n = ∑ n ∈ Finset.range N, (((n : ℝ) + 1) * (A + (n : ℝ) + 1))⁻¹\n + ∑' n : ℕ, ((((n + N : ℕ) : ℝ) + 1) * (A + ((n + N : ℕ) : ℝ) + 1))⁻¹) := by\n have h := hker_summ.sum_add_tsum_nat_add N\n -- h : (∑ i ∈ range N, f i) + ∑' i, f (i+N) = ∑' i, f i\n rw [← h]\n · rfl -- hmm no\n```\nThe issue is definitely the beta/forms. NEW IDEA — avoid hsplit entirely: I don't need the EXACT split equality; I need the BOUND: ∑' kernel ≤ (1+log N)/A + 1/N. Prove it directly:\n```\n have hkernel_bound : (∑' n : ℕ, (((n : ℝ) + 1) * (A + (n : ℝ) + 1))⁻¹) ≤ (2 + Real.log (A+1)) / A := by\n have hsplit' : (∑' n : ℕ, (((n : ℝ) + 1) * (A + (n : ℝ) + 1))⁻¹)\n ≤ ∑ n ∈ Finset.range N, (((n : ℝ) + 1) * (A + (n : ℝ) + 1))⁻¹ + 1 / (N : ℝ) := by\n -- ∑' f = ∑_{<N} f + ∑'_{≥N} f and bound the tail by the telescope\n have hsplit := hker_summ.sum_add_tsum_nat_add N -- hmm still needed\n ...\n```\nstill needs the split equality. OK alternative formulation of the split equality via tsum_eq_sum_add_tsum...: Actually — the cleanest existing Mathlib form: `tsum_eq_sum_add_tsum_nat_add`?? hmm from the doc comment: \"∑ i ∈ range k, f i + ∑' i, f (i + k) = ∑' i, f i ∈ sum_add_tsum_nat_add\" — the PRIMED version from NNReal usage was sum_add_tsum_nat_add'. There might be `tsum_eq_sum_add_tsum_nat_add (f) (k) (hf)`?? no. Use the NNReal-observed form: `hf.sum_add_tsum_nat_add' k`?? The NNReal lemma at line 196-198: `theorem sum_add_tsum_nat_add {f : ℕ → ℝ≥0} (k : ℕ) (hf : Summable f) : ... := (((summable_nat_add_iff k).2 hf).sum_add_tsum_nat_add').symm` — so the underlying: `Summable.sum_add_tsum_nat_add' (hf : Summable (fun n => f (n + k)))`? — wait: ((summable_nat_add_iff k).2 hf) : Summable (fun n => f (n+k)) and .sum_add_tsum_nat_add' : ... hmm that's a method on the SHIFTED summable: `Summable.sum_add_tsum_nat_add' (h : Summable fun n => f (n + k)) : ∑' n, f (n + k) + ∑ i ∈ range k, f i = ∑' i, f i`? The direction/priming is getting confusing. Let me just READ the actual to_additive-generated statement... it's generated; the multiplicative source at line 233: `Multipliable.prod_mul_tprod_nat_add (k) (h) : (∏ i ∈ range k, f i) * ∏' i, f (i+k) = ∏' i, f i` — additive: `Summable.sum_add_tsum_nat_add (k : ℕ) (h : Summable f) : (∑ i ∈ range k, f i) + ∑' i, f (i + k) = ∑' i, f i`. My call `hker_summ.sum_add_tsum_nat_add N` — dot-notation: hker_summ (Summable) fills... the FIRST explicit arg is (k : ℕ) — dot notation fills the first explicit arg whose type matches the RECEIVER's head constant: hker_summ : Summable ... — the args are (k : ℕ) (h : Summable f) — hker_summ matches `h` (the Summable one), N fills k ✓. So h : (∑ i ∈ range N, f i) + ∑' i, f (i+N) = ∑' i, f i ✓. \n\nThe failure must be purely beta. Let me test what h actually is by making Lean print it — quicker: replace the hsplit proof with `exact h.symm` after a simpa:\n```\n have h := hker_summ.sum_add_tsum_nat_add N\n -- try simpa using h.symm\n simpa using h.symm\n```\nsimpa beta-reduces by default and matches up to simp-normal form ✓. `simpa using h.symm` — the simp normal forms of the goal and h.symm should coincide (beta + nothing else changes). If the forms differ only by beta, simpa closes ✓. Try that. If it fails, the error will show the normal-form mismatch.","signature":""},{"type":"text","text":"The hsplit residual is a beta-redex mismatch. Switching to `simpa`."},{"type":"tool_use","id":"Edit_326","name":"Edit","input":{"file_path":"D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiDigammaLeft.lean","old_string":" have h := hker_summ.sum_add_tsum_nat_add N\n simp only [] at h\n rw [h]","new_string":" have h := hker_summ.sum_add_tsum_nat_add N\n simpa using h.symm"},"extra_content":null}]