← Session 22 — ii′-1: liCoeff pairing fix + residue machinery
thinking (16803 chars)
Committed (8bd8c9b) — fully clean (0 warnings/errors). Wait — 964 insertions, 711 deletions — that reflects the rewrite churn.
Remaining for piece (A):
1. The affine comp: iteratedDeriv j (fun s => F((1+s)/2)) 0 = (1/2)^j · iteratedDeriv j F (1/2).
2. The final τ_j assembly in LiArchimedean.lean:
iteratedDeriv j (fun s => logDeriv Gammaℝ (1+s)) 0 = (−1)^{j+1}·j!·↑(lagariasA (j+1)).
For the affine comp, the cleanest form: (1+s)/2 — write it as the composition φ(s) = (1+s)/2. Let me prove:
```lean
lemma iteratedDeriv_one_add_div_two (F : ℂ → ℂ) (j : ℕ) (hF : AnalyticAt ℂ F (1 / 2)) :
iteratedDeriv j (fun s : ℂ => F ((1 + s) / 2)) 0 =
(1 / 2 : ℂ) ^ j * iteratedDeriv j F (1 / 2) := by
induction j with
| zero => simp [iteratedDeriv_zero]
| succ j ih =>
rw [iteratedDeriv_succ, iteratedDeriv_succ]
-- deriv (iteratedDeriv j (F∘φ)) 0 — replace the function by its local closed form
...
```
The induction at the point: the IH gives the pointwise value at 0 only — for the deriv I need the function equality on a nhd. As before, prove the eventualEq version:
```lean
| succ j ih =>
-- on a nhd of 0, iteratedDeriv j (F∘φ) = fun s => (1/2)^j · iteratedDeriv j F (φ s)
have hFan : ∀ᶠ s in 𝓝 (0:ℂ), AnalyticAt ℂ F ((1+s)/2) := by
have hcont : ContinuousAt (fun s : ℂ => (1+s)/2) 0 :=
(continuousAt_id.add continuousAt_const).div continuousAt_const
have hT : Tendsto (fun s : ℂ => (1+s)/2) (𝓝 0) (𝓝 ((1+(0:ℂ))/2)) := hcont.tendsto
have h1 : ((1:ℂ)+(0:ℂ))/2 = 1/2 := by ring
rw [h1] at hT
exact hT.eventually hF.eventually_analyticAt
have hev : (fun s => iteratedDeriv j (fun t : ℂ => F ((1 + t) / 2)) s) =ᶠ[𝓝 (0:ℂ)]
(fun s => (1/2:ℂ)^j * iteratedDeriv j F ((1+s)/2)) := by
filter_upwards [hFan] with s hs
-- the pointwise statement at s — but ih is at 0... — need the generalization
```
As before, the induction must generalize the point. Let me prove a general-point version directly:
```lean
lemma iteratedDeriv_one_add_div_two_at (F : ℂ → ℂ) (j : ℕ) {s : ℂ}
(hF : AnalyticAt ℂ F ((1 + s) / 2)) (hFn : ∀ᶠ t in 𝓝 s, AnalyticAt ℂ F ((1 + t) / 2)) :
iteratedDeriv j (fun t : ℂ => F ((1 + t) / 2)) s =
(1 / 2 : ℂ) ^ j * iteratedDeriv j F ((1 + s) / 2) := by
induction j generalizing s with
| zero => simp [iteratedDeriv_zero]
| succ j ih =>
rw [iteratedDeriv_succ, iteratedDeriv_succ]
have hev : (fun t => iteratedDeriv j (fun u : ℂ => F ((1 + u) / 2)) t) =ᶠ[𝓝 s]
(fun t => (1/2:ℂ)^j * iteratedDeriv j F ((1+t)/2)) := by
filter_upwards [hFn] with t ht
exact ih ht (ht.eventually_analyticAt.eventually_nhds?? ...)
```
Hmm — the ih at t needs: AnalyticAt F ((1+t)/2) [ht ✓] and ∀ᶠ u in 𝓝 t, AnalyticAt F ((1+u)/2) [from ht.eventually_analyticAt composed with the continuity of (1+u)/2 at t — Tendsto (fun u => (1+u)/2) (𝓝 t) (𝓝 ((1+t)/2)) then .eventually ht.eventually_analyticAt ✓].
Then:
```lean
rw [hev.deriv_eq]
-- deriv (fun t => (1/2)^j · iteratedDeriv j F ((1+t)/2)) s = (1/2)^j · (1/2) · iteratedDeriv (j+1) F ((1+s)/2)
rw [deriv_const_mul]
· -- deriv (iteratedDeriv j F ∘ φ) s = deriv (iteratedDeriv j F) (φ s) · (1/2) = iteratedDeriv (j+1) F (φ s) · (1/2)
have hc : HasDerivAt (fun t : ℂ => (1 + t) / 2) (1 / 2) s := by
simpa using ((hasDerivAt_id s).add (hasDerivAt_const s (1:ℂ))).div_const (2:ℂ)
have hd : HasDerivAt (iteratedDeriv j F) (iteratedDeriv (j+1) F ((1+s)/2)) ((1+s)/2) := by
rw [← iteratedDeriv_succ]
exact (analyticAt_iteratedDeriv hF j).deriv.differentiableAt.hasDerivAt -- need AnalyticAt (iteratedDeriv j F) at the point — via my induction helper? AnalyticAt.deriv j times...
have hcomp := hd.comp s hc
-- hcomp : HasDerivAt (iteratedDeriv j F ∘ φ) ((1/2)·... ) — the comp deriv form
...
```
The hcomp's derivative: hd.comp s hc : HasDerivAt (iteratedDeriv j F ∘ φ) (deriv-form) — the ℂ comp gives f' * g' = iteratedDeriv (j+1) F ((1+s)/2) * (1/2) ✓ (from the LiPrincipal evidence: f' * g' — outer * inner). Then the function bridge (iteratedDeriv j F ∘ φ) = fun t => iteratedDeriv j F ((1+t)/2) rfl ✓. Then:
hcomp.deriv : deriv (iteratedDeriv j F ∘ φ) s = iteratedDeriv (j+1) F ((1+s)/2) * (1/2) — hmm — wait the comp's function: hd's function is iteratedDeriv j F and hc's is φ := fun t => (1+t)/2 — comp gives (iteratedDeriv j F) ∘ φ ✓.
Then deriv_const_mul: deriv (fun t => (1/2)^j · X t) s = (1/2)^j · deriv X s with X := fun t => iteratedDeriv j F ((1+t)/2) — so total: (1/2)^j · (iteratedDeriv (j+1) F ((1+s)/2) · (1/2)) = (1/2)^{j+1}·iteratedDeriv (j+1) F ((1+s)/2) ✓ via pow_succ + ring.
The deriv_const_mul's side condition: DifferentiableAt (fun t => iteratedDeriv j F ((1+t)/2)) s — from hcomp.differentiableAt ✓ — pass it.
Let me structure:
```lean
rw [hev.deriv_eq]
have hcomp : HasDerivAt (fun t : ℂ => iteratedDeriv j F ((1 + t) / 2))
(iteratedDeriv (j + 1) F ((1 + s) / 2) * (1 / 2)) s := by
have hc : HasDerivAt (fun t : ℂ => (1 + t) / 2) (1 / 2) s := by
simpa using ((hasDerivAt_id s).add (hasDerivAt_const s (1:ℂ))).div_const (2:ℂ)
have hd : HasDerivAt (iteratedDeriv j F) (iteratedDeriv (j + 1) F ((1 + s) / 2))
((1 + s) / 2) := by
rw [← iteratedDeriv_succ]
exact (analyticAt_iteratedDeriv hF j).deriv.differentiableAt.hasDerivAt
have hcomp := hd.comp s hc
have heq : (iteratedDeriv j F ∘ fun t : ℂ => (1 + t) / 2) =
fun t => iteratedDeriv j F ((1 + t) / 2) := rfl
rw [heq] at hcomp
-- the comp's derivative form — f' * g' or g' * f'?
exact hcomp
rw [deriv_const_mul _ hcomp.differentiableAt, hcomp.deriv]
rw [pow_succ]
ring
```
The `analyticAt_iteratedDeriv` — need a helper: AnalyticAt F x → AnalyticAt (iteratedDeriv j F) x — prove inline via induction with AnalyticAt.deriv (iteratedDeriv_succ):
```lean
lemma AnalyticAt.iteratedDeriv {F : ℂ → ℂ} {x : ℂ} (hF : AnalyticAt ℂ F x) (n : ℕ) :
AnalyticAt ℂ (iteratedDeriv n F) x := by
induction n with
| zero => simpa [iteratedDeriv_zero] using hF
| succ n ih =>
rw [iteratedDeriv_succ]
exact ih.deriv
```
✓ — name it without the AnalyticAt. prefix to avoid namespace issues... — actually declaring `lemma AnalyticAt.iteratedDeriv` inside my namespace NguyenRH1 — extends the AnalyticAt namespace — allowed (dot-notation works) ✓ — hmm — or name it `AnalyticAt_iteratedDeriv`. Let me use the plain name to be safe.
And the comp derivative order: hd.comp s hc — from the ℂ chain rule HasDerivAt.comp: (hf : HasDerivAt f f' (g x)) (hg : HasDerivAt g g' x) : HasDerivAt (f ∘ g) (f' * g')?? or (g' • f')? — from LiPrincipal's HIntegral_deriv evidence: h1.comp x h2 gave `deriv G p * 1` after mul_one — so the form was (f' * g') with g' = 1 ✓ — so comp gives f' * g' = iteratedDeriv (j+1) F (pt) * (1/2) ✓ as I wrote.
Also the div_const: `(hasDerivAt_id s).add (hasDerivAt_const s (1:ℂ))` — HasDerivAt (fun t => t + 1) (1 + 0)?? — then .div_const 2 — the (1+0)/2... — let me use: HasDerivAt (fun t : ℂ => (1+t)/2) (1/2) s:
(fun t => (1+t)/2) = (fun t => 1 + t) / 2-ish — via HasDerivAt.div_const: (hasDerivAt_const s 1).add (hasDerivAt_id s) : HasDerivAt (fun t => 1 + t) (0 + 1) s — then .div_const (2:ℂ) : HasDerivAt (fun t => (1+t)/2) ((0+1)/2) s — (0+1)/2 = 1/2 — simpa ✓:
```lean
have hc : HasDerivAt (fun t : ℂ => (1 + t) / 2) (1 / 2) s := by
have h := ((hasDerivAt_const s (1 : ℂ)).add (hasDerivAt_id s)).div_const (2 : ℂ)
simpa using h
```
✓.
OK. And then the FINAL assembly (in LiArchimedean.lean — it has the split). The capstone theorem:
```lean
/-- The archimedean Taylor coefficients (D-066 piece A): for all j ≥ 0,
iteratedDeriv j (fun s => logDeriv Gammaℝ (1+s)) 0 = (−1)^{j+1}·j!·a_{j+1}. -/
theorem iteratedDeriv_logDeriv_Gammaℝ (j : ℕ) :
iteratedDeriv j (fun s : ℂ => logDeriv Complex.Gammaℝ (1 + s)) 0 =
((-1 : ℂ)) ^ (j + 1) * (j ! : ℂ) * (lagariasA (j + 1) : ℝ) := by
rcases Nat.eq_zero_or_pos j with hj0 | hj0
· subst hj0
rw [iteratedDeriv_zero]
rw [lagariasA, if_pos rfl]
simp [logDeriv_Gammaℝ_one] -- value: −a₁ = (−1)^1·0!·a₁ ✓
· -- j ≥ 1
have hj : 1 ≤ j := hj0
-- the eventual split near 0
have hev : (fun s : ℂ => logDeriv Complex.Gammaℝ (1 + s)) =ᶠ[𝓝 (0:ℂ)]
(fun s => -(Real.log Real.pi : ℂ) / 2 + (1 / 2) * Complex.digamma ((1 + s) / 2)) := by
-- the hypotheses of logDeriv_Gammaℝ_one_add hold on a small ball around 0
have hGamma_ne : ∀ᶠ s in 𝓝 (0:ℂ), Complex.Gamma ((1 + s) / 2) ≠ 0 := by
have hcont : ContinuousAt (fun s : ℂ => Complex.Gamma ((1 + s) / 2)) 0 := by
apply ContinuousAt.comp _ (continuousAt_id.add continuousAt_const |>.div continuousAt_const)
-- Gamma continuous at 1/2
...
...
...
```
This needs: Gamma((1+s)/2) ≠ 0 near 0 — from Gamma(1/2) ≠ 0 + continuity of the composition at 0 — Complex.continuousAt_Gamma (s) (hs : ∀ m, s ≠ −m) at 1/2 ✓ (Derivative.lean:88: continuousAt_Gamma (s) (hs : ∀ m : ℕ, s ≠ −m) : ContinuousAt Gamma s ✓). The composition: fun s => Gamma((1+s)/2) at 0: Gamma(1/2) ≠ 0 — then eventually_ne via Tendsto: Tendsto (fun s => Gamma((1+s)/2)) (𝓝 0) (𝓝 (Gamma(1/2))) — via ContinuousAt.comp — ContinuousAt.comp (hf : ContinuousAt f (g x)) (hg : ContinuousAt g x) ✓. Then (tendsto).eventually_ne (Gamma(1/2) ≠ 0) : ∀ᶠ s in 𝓝 0, Gamma((1+s)/2) ≠ 0 ✓ — via `Tendsto.eventually_ne`? — `Filter.Tendsto.eventually_ne (h : Tendsto f l (𝓝 a)) (ha : a ≠ 0) : ∀ᶠ x in l, f x ≠ 0` ✓ (used in LiResidue: riemannZeta_residue_one.eventually_ne ✓).
And the pole-free: ∀ᶠ s in 𝓝 0, ∀ m, (1+s)/2 ≠ −↑m: from re((1+s)/2) near 1/2 > 0: the set {s | 0 < ((1+s)/2).re} is open ∋ 0 (re((1+0)/2) = 1/2 > 0 ✓ continuity of re∘((1+·)/2)) — so ∀ᶠ s, 0 < re((1+s)/2) — then (1+s)/2 ≠ −↑m (re > 0 vs re(−↑m) ≤ 0) ✓. The ∀-m inside the eventually: ∀ᶠ s in 𝓝 0, ∀ m : ℕ, (1+s)/2 ≠ −↑m — since the condition is s-dependent only through re > 0: ∀ᶠ s, 0 < re((1+s)/2) and pointwise 0 < re(z) ⟹ ∀ m, z ≠ −↑m ✓:
```lean
have hpole : ∀ᶠ s in 𝓝 (0:ℂ), ∀ m : ℕ, (1 + s) / 2 ≠ -(m : ℂ) := by
have hcont : ContinuousAt (fun s : ℂ => (((1 + s) / 2).re)) 0 := by
exact (Complex.continuous_re.continuousAt.comp ...) -- re is continuous
...
```
Hmm — let me simplify: the set U₀ := {s : ℂ | 0 < ((1+s)/2).re} — contains 0 (re((1+0)/2) = 1/2 > 0 ✓) — is it open? (fun s => ((1+s)/2).re) continuous (Complex.continuous_re.comp (affine)) — preimage of Ioi 0 ✓ open ✓ — so U₀ ∈ 𝓝 0 (IsOpen.mem_nhds) — and for s ∈ U₀: ∀ m, (1+s)/2 ≠ −↑m (since re(−↑m) = −↑m ≤ 0 < re) ✓. So:
```lean
have hpole : ∀ᶠ s in 𝓝 (0:ℂ), ∀ m : ℕ, (1 + s) / 2 ≠ -(m : ℂ) := by
have hopen : IsOpen {s : ℂ | 0 < (((1 + s) / 2).re)} := by
have hcont : Continuous (fun s : ℂ => (((1 + s) / 2).re)) :=
Complex.continuous_re.comp ((continuous_id.add continuous_const).div continuous_const)
exact isOpen_Ioi.preimage hcont
have hmem : (0 : ℂ) ∈ {s : ℂ | 0 < (((1 + s) / 2).re)} := by
simp -- ((1+0)/2).re = 1/2 > 0
filter_upwards [hopen.mem_nhds hmem] with s hs
intro m hmeq
rw [hmeq] at hs
simp at hs -- re(−↑m) = −↑m ≤ 0 contradicts 0 < −↑m
have hm : (0 : ℝ) ≤ (m : ℝ) := Nat.cast_nonneg m
linarith
```
The `simp` at hmem: ((1+0)/2).re — simp normalizes (1+0)/2 → 1/2 and its re → 1/2 > 0 ✓ hopefully (Complex.div_re? — simp computes the re of numerals ✓). And hs at hmeq: ((−↑m)).re — hmm hs : 0 < ((1+s)/2).re with hmeq : (1+s)/2 = −↑m — rw [hmeq] at hs : 0 < ((−↑m):ℂ).re — simp: (−↑m).re → −(↑m).re → −↑m — hs : 0 < −↑m — linarith with hm ✓.
Then hev := eventually_of_mem (ball-intersection of the two eventuallys + the ball for hGamma_ne)... — combine: hev := (hGamma_ne.and hpole).mono (fun s ⟨h1, h2⟩ => logDeriv_Gammaℝ_one_add h1 h2) — with the eventuallys combined via Filter.Eventually.and ✓.
Then:
```lean
rw [iteratedDeriv_congr_of_eventuallyEq hev]
-- iteratedDeriv j (const + (1/2)·digamma((1+·)/2)) 0 — the const dies (j ≥ 1)
have hsplit2 : (fun s : ℂ => -(Real.log Real.pi : ℂ) / 2 + (1 / 2) * Complex.digamma ((1 + s) / 2)) =
(fun _ : ℂ => -(Real.log Real.pi : ℂ) / 2) +
(fun s => (1 / 2) * Complex.digamma ((1 + s) / 2)) := rfl
rw [hsplit2]
rw [iteratedDeriv_add (contDiff_const.contDiffAt) (the digamma comp's ContDiffAt)]
rw [iteratedDeriv_const, if_neg (by omega : j ≠ 0), zero_add]
-- iteratedDeriv j ((1/2)·digamma∘φ) 0 = (1/2)·(1/2)^j·digamma^{(j)}(1/2)
rw [iteratedDeriv_const_mul] -- needs ContDiffAt of the comp
rw [iteratedDeriv_one_add_div_two_at Complex.digamma j digamma-analytic-at-half (the eventually)]
-- = (1/2)·(1/2)^j·[(−1)^{j+1} j! Σ] — then reindexing + algebra
rw [iteratedDeriv_digamma_half j hj]
-- the reindexing: Σ_{m≥0}(1/2+↑m)^{−(j+1)} = 2^{j+1}·lagariasA(j+1)-cast — hmm — my reindexing lemma is about (2↑m+1)^(−(j+1)) — need the (1/2+↑m) → (2↑m+1) scaling: (1/2+↑m)^{−(j+1)} = 2^{j+1}·(1+2↑m)^{−(j+1)} = 2^{j+1}·(2↑m+1)^{−(j+1)}...
```
Hmm — wait — I have tsum_two_mul_add_one_inv_pow : ∑' m, (2↑m+1)^(−(j+1)) = ↑(lagariasA(j+1)) — and the series at 1/2 is Σ (1/2+↑m)^{−(j+1)} — the scaling: (1/2+↑m) = (1+2↑m)/2 = (2↑m+1)/2 — so (1/2+↑m)^{−(j+1)} = 2^{j+1}·(2↑m+1)^{−(j+1)} — per-term. So Σ_{m≥0}(1/2+↑m)^{−(j+1)} = 2^{j+1}·Σ(2↑m+1)^{−(j+1)} = 2^{j+1}·↑lagariasA(j+1) ✓.
The per-term scaling lemma: ((1/2:ℂ)+↑m)^{−(j+1)} = (2:ℂ)^{j+1}·(2↑m+1)^{−(j+1)}:
(1/2+↑m) = (2↑m+1)/2 [ring]; then ((2↑m+1)/2)^{−(j+1)} = 2^{j+1}·(2↑m+1)^{−(j+1)}: via div_zpow? — (a/b)^q zpow: `div_zpow`? — there's `div_zpow : (a/b)^n = a^n/b^n` for zpow? — probably `div_zpow : (a / b) ^ (n : ℤ) = a ^ n / b ^ n` ✓ — then (2↑m+1)^{−(j+1)}/2^{−(j+1)} = (2↑m+1)^{−(j+1)}·2^{j+1} — via zpow_neg + ... — let me handle: ((2↑m+1)/2)^q = (2↑m+1)^q/2^q [div_zpow] and 2^q with q = −(j+1): 2^{−(j+1)} = (2^{j+1})⁻¹ — so the term = (2↑m+1)^q·(2^{j+1}) — via field_simp/ring with zpow forms... — ugh — let me write the per-term as:
```lean
have hscale : ∀ m : ℕ, ((1 / 2 : ℂ) + ↑m) ^ (-(j : ℤ) - 1) =
(2 : ℂ) ^ (j + 1) * ((2 : ℂ) * ↑m + 1) ^ (-(j : ℤ) - 1) := by
intro m
have e : ((1 / 2 : ℂ) + ↑m) = ((2 : ℂ) * ↑m + 1) / 2 := by push_cast; ring
rw [e, div_zpow] -- hmm div_zpow : (a/b)^n = a^n / b^n for n : ℤ?
rw [show ((2 : ℂ)) ^ (-(j : ℤ) - 1) = ((2 : ℂ) ^ (j + 1))⁻¹ from by
rw [show (-(j : ℤ) - 1 : ℤ) = -(((j + 1 : ℕ) : ℤ)) by push_cast; ring, zpow_neg, zpow_natCast]]
field_simp
ring
```
Hmm — `div_zpow` — let me check it exists... — there should be `div_zpow : (a / b) ^ (n : ℤ) = a ^ n / b ^ n` ✓ (I believe — alongside div_pow). Then the goal: (2↑m+1)^q / 2^q = 2^{j+1}·(2↑m+1)^q with q := −(j+1): = (2↑m+1)^q·(2^q)⁻¹-form... — field_simp then ring — with zpow's as atoms — field_simp might not handle zpow well — alternative: 2^q = (2^{j+1})⁻¹ via the show ✓ then the equation: (2↑m+1)^q / (2^{j+1})⁻¹ = 2^{j+1}·(2↑m+1)^q — i.e. X/C⁻¹ = C·X — by rw [div_eq_mul_inv, inv_inv, mul_comm]?? — X/C⁻¹ = X·(C⁻¹)⁻¹ = X·C [inv_inv ✓] — then = C·X [mul_comm] ✓:
```lean
rw [e, div_zpow]
rw [show ((2 : ℂ)) ^ (-(j : ℤ) - 1) = ((2 : ℂ) ^ (j + 1))⁻¹ from by
rw [show (-(j : ℤ) - 1 : ℤ) = -(((j + 1 : ℕ) : ℤ)) by push_cast; ring, zpow_neg, zpow_natCast]]
rw [div_eq_mul_inv, inv_inv, mul_comm]
```
✓ deterministic.
Then:
Σ_{m≥0} (1/2+↑m)^{−(j+1)} = Σ 2^{j+1}·(2↑m+1)^{−(j+1)} [tsum_congr hscale] = 2^{j+1}·Σ (2↑m+1)^{−(j+1)} [tsum_mul_left] = 2^{j+1}·↑(lagariasA(j+1)) [tsum_two_mul_add_one_inv_pow j hj] ✓.
And the final constant assembly: (1/2)·(1/2)^j·(−1)^{j+1}·j!·[2^{j+1}·↑lagariasA] = (−1)^{j+1}·j!·↑lagariasA — since (1/2)·(1/2)^j·2^{j+1} = 2^{−(j+1)}·2^{j+1} = 1 — the 2-powers: (2:ℂ)^{j+1}·(1/2)^{j+1}·(1/2)... — (1/2)·(1/2)^j = (1/2)^{j+1} = 2^{−(j+1)} — and 2^{j+1}·2^{−(j+1)} = 1 — the ℂ forms: (1/2:ℂ)^{j+1}·(2:ℂ)^{j+1} = 1 — via mul_pow: (2·(1/2))^{j+1} = 1^{j+1} = 1 ✓. The ring with the zpow/npow mix — let me manage: the final goal after all rewrites:
(1/2)·((1/2)^j·(−1)^{j+1}·j!·(2^{j+1}·↑lagariasA(j+1))) = (−1)^{j+1}·j!·↑lagariasA(j+1)
— hmm — actually the (1/2)^j form from iteratedDeriv_one_add_div_two_at — and the (1/2) from the const_mul — let me just make the ending: have h2pow : (1/2:ℂ)·(1/2:ℂ)^j·(2:ℂ)^(j+1) = 1 := by rw [show (1/2:ℂ)·(1/2:ℂ)^j = (1/2:ℂ)^(j+1) from by ring]; rw [← mul_pow]; simp — (2·(1/2))^{j+1} = (1)^{j+1} = 1 ✓ simp — hmm (2·(1/2)) = 1 — `mul_one_div`? — 2·(1/2) = 1 — simp/norm_num ✓. Then the goal: ... — let me leave to ring with h2pow as a rewrite:
```lean
rw [h2pow-multiplied-forms]...
```
Getting long. Let me just carefully assemble. OK — writing the final section now (the affine comp + the assembly) — appending to LiDigamma.lean the affine comp, and adding the capstone to LiArchimedean.lean.
Now the final stretch: the affine comp lemma + the capstone. Appending the affine comp to LiDigamma.lean.
tool: Bash ok
input
{
"command": "cd \"D:/Python/Quantum\" && cat >> research/lean/NguyenRH1/NguyenRH1/LiDigamma.lean << 'EOF'\n\n/-- AnalyticAt is preserved by iteratedDeriv. -/\nlemma analyticAt_iteratedDeriv {F : \u2102 \u2192 \u2102} {x : \u2102} (hF : AnalyticAt \u2102 F x) (n : \u2115) :\n AnalyticAt \u2102 (iteratedDeriv n F) x := by\n induction n with\n | zero => simpa [iteratedDeriv_zero] using hF\n | succ n ih =>\n rw [iteratedDeriv_succ]\n exact ih.deriv\n\n/-- The affine comp: iterated derivatives of F((1+s)/2) at s. -/\nlemma iteratedDeriv_one_add_div_two (F : \u2102 \u2192 \u2102) (j : \u2115) {s : \u2102}\n (hF : AnalyticAt \u2102 F ((1 + s) / 2))\n (hFn : \u2200\u1da0 t in \ud835\udcdd s, AnalyticAt \u2102 F ((1 + t) / 2)) :\n iteratedDeriv j (fun t : \u2102 => F ((1 + t) / 2)) s =\n (1 / 2 : \u2102) ^ j * iteratedDeriv j F ((1 + s) / 2) := by\n induction j generalizing s with\n | zero => simp [iteratedDeriv_zero]\n | succ j ih =>\n rw [iteratedDeriv_succ, iteratedDeriv_succ]\n have hev : (fun t => iteratedDeriv j (fun u : \u2102 => F ((1 + u) / 2)) t) =\u1da0[\ud835\udcdd s]\n (fun t => (1 / 2 : \u2102) ^ j * iteratedDeriv j F ((1 + t) / 2)) := by\n filter_upwards [hFn] with t ht\n have hcont : Tendsto (fun u : \u2102 => (1 + u) / 2) (\ud835\udcdd t) (\ud835\udcdd ((1 + t) / 2)) := by\n have hc : ContinuousAt (fun u : \u2102 => (1 + u) / 2) t :=\n (continuousAt_id.add continuousAt_const).div continuousAt_const\n exact hc.tendsto\n exact ih ht (hcont.eventually ht.eventually_analyticAt)\n rw [hev.deriv_eq]\n have hcomp : HasDerivAt (fun t : \u2102 => iteratedDeriv j F ((1 + t) / 2))\n (iteratedDeriv (j + 1) F ((1 + s) / 2) * (1 / 2)) s := by\n have hc : HasDerivAt (fun t : \u2102 => (1 + t) / 2) (1 / 2) s := by\n have h := ((hasDerivAt_const s (1 : \u2102)).add (hasDerivAt_id s)).div_const (2 : \u2102)\n simpa using h\n have hd : HasDerivAt (iteratedDeriv j F) (iteratedDeriv (j + 1) F ((1 + s) / 2))\n ((1 + s) / 2) := by\n rw [\u2190 iteratedDeriv_succ]\n exact (analyticAt_iteratedDeriv hF j).deriv.differentiableAt.hasDerivAt\n have hc2 := hd.comp s hc\n have heq : (iteratedDeriv j F \u2218 fun t : \u2102 => (1 + t) / 2) =\n fun t => iteratedDeriv j F ((1 + t) / 2) := rfl\n rw [heq] at hc2\n exact hc2\n rw [deriv_const_mul _ hcomp.differentiableAt, hcomp.deriv]\n rw [pow_succ]\n ring\n\n/-- The scaling: (1/2 + m)^{-(j+1)} = 2^{j+1}\u00b7(2m+1)^{-(j+1)}. -/\nlemma zpow_half_add_nat_scale (j : \u2115) (m : \u2115) :\n ((1 / 2 : \u2102) + \u2191m) ^ (-(j : \u2124) - 1) =\n (2 : \u2102) ^ (j + 1) * ((2 : \u2102) * \u2191m + 1) ^ (-(j : \u2124) - 1) := by\n have e : ((1 / 2 : \u2102) + \u2191m) = ((2 : \u2102) * \u2191m + 1) / 2 := by push_cast; ring\n rw [e, div_zpow]\n rw [show ((2 : \u2102)) ^ (-(j : \u2124) - 1) = ((2 : \u2102) ^ (j + 1))\u207b\u00b9 from by\n rw [show (-(j : \u2124) - 1 : \u2124) = -(((j + 1 : \u2115) : \u2124)) by push_cast; ring, zpow_neg, zpow_natCast]]\n rw [div_eq_mul_inv, inv_inv, mul_comm]\n\n/-- The (1/2+m)-series equals 2^{j+1}\u00b7lagariasA(j+1) (as \u2102). -/\nlemma tsum_half_add_nat_zpow (j : \u2115) (hj : 1 \u2264 j) :\n (\u2211' m : \u2115, ((1 / 2 : \u2102) + \u2191m) ^ (-(j : \u2124) - 1)) = (2 : \u2102) ^ (j + 1) * (lagariasA (j + 1) : \u211d) := by\n rw [tsum_congr (fun m => zpow_half_add_nat_scale j m)]\n rw [tsum_mul_left, tsum_two_mul_add_one_inv_pow j hj]\n\n/-- **The archimedean Taylor coefficients of digamma at 1/2** (j \u2265 1):\niteratedDeriv j digamma (1/2) = (\u22121)^{j+1}\u00b7j!\u00b72^{j+1}\u00b7lagariasA(j+1). -/\nlemma iteratedDeriv_digamma_half_value (j : \u2115) (hj : 1 \u2264 j) :\n iteratedDeriv j Complex.digamma ((1 : \u2102) / 2) =\n ((-1 : \u2102)) ^ (j + 1) * (j ! : \u2102) * ((2 : \u2102) ^ (j + 1) * (lagariasA (j + 1) : \u211d)) := by\n rw [iteratedDeriv_digamma_half j hj, tsum_half_add_nat_zpow j hj]\n\nend NguyenRH1\nEOF\ncd research/lean/NguyenRH1 && export PATH=\"$HOME/.elan/bin:$PATH\" && lake env lean NguyenRH1/LiDigamma.lean 2>&1 | grep -v \"^$\" | head -25",
"description": "Append affine comp + scaling and compile",
"timeout": 600000
}
result 2026-08-22 10:37:51Z → 2026-08-22 10:38:17Z
Try this:
[apply] ring_nf
The `ring` tactic failed to close the goal. Use `ring_nf` to obtain a normal form.
Note that `ring` works primarily in *commutative* rings. If you have a noncommutative ring, abelian group or module, consider using `noncomm_ring`, `abel` or `module` instead.
NguyenRH1/LiDigamma.lean:990:10: error: Type mismatch
ContinuousAt.div (ContinuousAt.add continuousAt_id continuousAt_const) continuousAt_const
has type
?m.296 ≠ 0 → ContinuousAt ((id + fun x => ?m.280) / fun x => ?m.296) ?m.295
but is expected to have type
ContinuousAt (fun u => (1 + u) / 2) t
NguyenRH1/LiDigamma.lean:1001:12: error: Tactic `rewrite` failed: Did not find an occurrence of the pattern
deriv (iteratedDeriv ?m.526 ?m.527)
in the target expression
HasDerivAt (iteratedDeriv j F) (iteratedDeriv (j + 1) F ((1 + s) / 2)) ((1 + s) / 2)
F : ℂ → ℂ
j : ℕ
ih :
∀ {s : ℂ},
AnalyticAt ℂ F ((1 + s) / 2) →
(∀ᶠ (t : ℂ) in 𝓝 s, AnalyticAt ℂ F ((1 + t) / 2)) →
iteratedDeriv j (fun t => F ((1 + t) / 2)) s = (1 / 2) ^ j * iteratedDeriv j F ((1 + s) / 2)
s : ℂ
hF : AnalyticAt ℂ F ((1 + s) / 2)
raw content_json (database row)
[{"type":"thinking","thinking":"Committed (8bd8c9b) — fully clean (0 warnings/errors). Wait — 964 insertions, 711 deletions — that reflects the rewrite churn.\n\nRemaining for piece (A): \n1. The affine comp: iteratedDeriv j (fun s => F((1+s)/2)) 0 = (1/2)^j · iteratedDeriv j F (1/2).\n2. The final τ_j assembly in LiArchimedean.lean:\n iteratedDeriv j (fun s => logDeriv Gammaℝ (1+s)) 0 = (−1)^{j+1}·j!·↑(lagariasA (j+1)).\n\nFor the affine comp, the cleanest form: (1+s)/2 — write it as the composition φ(s) = (1+s)/2. Let me prove:\n```lean\nlemma iteratedDeriv_one_add_div_two (F : ℂ → ℂ) (j : ℕ) (hF : AnalyticAt ℂ F (1 / 2)) :\n iteratedDeriv j (fun s : ℂ => F ((1 + s) / 2)) 0 =\n (1 / 2 : ℂ) ^ j * iteratedDeriv j F (1 / 2) := by\n induction j with\n | zero => simp [iteratedDeriv_zero]\n | succ j ih =>\n rw [iteratedDeriv_succ, iteratedDeriv_succ]\n -- deriv (iteratedDeriv j (F∘φ)) 0 — replace the function by its local closed form\n ...\n```\nThe induction at the point: the IH gives the pointwise value at 0 only — for the deriv I need the function equality on a nhd. As before, prove the eventualEq version:\n```lean\n | succ j ih =>\n -- on a nhd of 0, iteratedDeriv j (F∘φ) = fun s => (1/2)^j · iteratedDeriv j F (φ s)\n have hFan : ∀ᶠ s in 𝓝 (0:ℂ), AnalyticAt ℂ F ((1+s)/2) := by\n have hcont : ContinuousAt (fun s : ℂ => (1+s)/2) 0 :=\n (continuousAt_id.add continuousAt_const).div continuousAt_const\n have hT : Tendsto (fun s : ℂ => (1+s)/2) (𝓝 0) (𝓝 ((1+(0:ℂ))/2)) := hcont.tendsto\n have h1 : ((1:ℂ)+(0:ℂ))/2 = 1/2 := by ring\n rw [h1] at hT\n exact hT.eventually hF.eventually_analyticAt\n have hev : (fun s => iteratedDeriv j (fun t : ℂ => F ((1 + t) / 2)) s) =ᶠ[𝓝 (0:ℂ)]\n (fun s => (1/2:ℂ)^j * iteratedDeriv j F ((1+s)/2)) := by\n filter_upwards [hFan] with s hs\n -- the pointwise statement at s — but ih is at 0... — need the generalization\n```\nAs before, the induction must generalize the point. Let me prove a general-point version directly:\n```lean\nlemma iteratedDeriv_one_add_div_two_at (F : ℂ → ℂ) (j : ℕ) {s : ℂ}\n (hF : AnalyticAt ℂ F ((1 + s) / 2)) (hFn : ∀ᶠ t in 𝓝 s, AnalyticAt ℂ F ((1 + t) / 2)) :\n iteratedDeriv j (fun t : ℂ => F ((1 + t) / 2)) s =\n (1 / 2 : ℂ) ^ j * iteratedDeriv j F ((1 + s) / 2) := by\n induction j generalizing s with\n | zero => simp [iteratedDeriv_zero]\n | succ j ih =>\n rw [iteratedDeriv_succ, iteratedDeriv_succ]\n have hev : (fun t => iteratedDeriv j (fun u : ℂ => F ((1 + u) / 2)) t) =ᶠ[𝓝 s]\n (fun t => (1/2:ℂ)^j * iteratedDeriv j F ((1+t)/2)) := by\n filter_upwards [hFn] with t ht\n exact ih ht (ht.eventually_analyticAt.eventually_nhds?? ...)\n```\nHmm — the ih at t needs: AnalyticAt F ((1+t)/2) [ht ✓] and ∀ᶠ u in 𝓝 t, AnalyticAt F ((1+u)/2) [from ht.eventually_analyticAt composed with the continuity of (1+u)/2 at t — Tendsto (fun u => (1+u)/2) (𝓝 t) (𝓝 ((1+t)/2)) then .eventually ht.eventually_analyticAt ✓].\nThen:\n```lean\n rw [hev.deriv_eq]\n -- deriv (fun t => (1/2)^j · iteratedDeriv j F ((1+t)/2)) s = (1/2)^j · (1/2) · iteratedDeriv (j+1) F ((1+s)/2)\n rw [deriv_const_mul]\n · -- deriv (iteratedDeriv j F ∘ φ) s = deriv (iteratedDeriv j F) (φ s) · (1/2) = iteratedDeriv (j+1) F (φ s) · (1/2)\n have hc : HasDerivAt (fun t : ℂ => (1 + t) / 2) (1 / 2) s := by\n simpa using ((hasDerivAt_id s).add (hasDerivAt_const s (1:ℂ))).div_const (2:ℂ)\n have hd : HasDerivAt (iteratedDeriv j F) (iteratedDeriv (j+1) F ((1+s)/2)) ((1+s)/2) := by\n rw [← iteratedDeriv_succ]\n exact (analyticAt_iteratedDeriv hF j).deriv.differentiableAt.hasDerivAt -- need AnalyticAt (iteratedDeriv j F) at the point — via my induction helper? AnalyticAt.deriv j times...\n have hcomp := hd.comp s hc\n -- hcomp : HasDerivAt (iteratedDeriv j F ∘ φ) ((1/2)·... ) — the comp deriv form\n ...\n```\nThe hcomp's derivative: hd.comp s hc : HasDerivAt (iteratedDeriv j F ∘ φ) (deriv-form) — the ℂ comp gives f' * g' = iteratedDeriv (j+1) F ((1+s)/2) * (1/2) ✓ (from the LiPrincipal evidence: f' * g' — outer * inner). Then the function bridge (iteratedDeriv j F ∘ φ) = fun t => iteratedDeriv j F ((1+t)/2) rfl ✓. Then:\nhcomp.deriv : deriv (iteratedDeriv j F ∘ φ) s = iteratedDeriv (j+1) F ((1+s)/2) * (1/2) — hmm — wait the comp's function: hd's function is iteratedDeriv j F and hc's is φ := fun t => (1+t)/2 — comp gives (iteratedDeriv j F) ∘ φ ✓.\nThen deriv_const_mul: deriv (fun t => (1/2)^j · X t) s = (1/2)^j · deriv X s with X := fun t => iteratedDeriv j F ((1+t)/2) — so total: (1/2)^j · (iteratedDeriv (j+1) F ((1+s)/2) · (1/2)) = (1/2)^{j+1}·iteratedDeriv (j+1) F ((1+s)/2) ✓ via pow_succ + ring.\n\nThe deriv_const_mul's side condition: DifferentiableAt (fun t => iteratedDeriv j F ((1+t)/2)) s — from hcomp.differentiableAt ✓ — pass it.\n\nLet me structure:\n```lean\n rw [hev.deriv_eq]\n have hcomp : HasDerivAt (fun t : ℂ => iteratedDeriv j F ((1 + t) / 2))\n (iteratedDeriv (j + 1) F ((1 + s) / 2) * (1 / 2)) s := by\n have hc : HasDerivAt (fun t : ℂ => (1 + t) / 2) (1 / 2) s := by\n simpa using ((hasDerivAt_id s).add (hasDerivAt_const s (1:ℂ))).div_const (2:ℂ)\n have hd : HasDerivAt (iteratedDeriv j F) (iteratedDeriv (j + 1) F ((1 + s) / 2))\n ((1 + s) / 2) := by\n rw [← iteratedDeriv_succ]\n exact (analyticAt_iteratedDeriv hF j).deriv.differentiableAt.hasDerivAt\n have hcomp := hd.comp s hc\n have heq : (iteratedDeriv j F ∘ fun t : ℂ => (1 + t) / 2) =\n fun t => iteratedDeriv j F ((1 + t) / 2) := rfl\n rw [heq] at hcomp\n -- the comp's derivative form — f' * g' or g' * f'?\n exact hcomp\n rw [deriv_const_mul _ hcomp.differentiableAt, hcomp.deriv]\n rw [pow_succ]\n ring\n```\nThe `analyticAt_iteratedDeriv` — need a helper: AnalyticAt F x → AnalyticAt (iteratedDeriv j F) x — prove inline via induction with AnalyticAt.deriv (iteratedDeriv_succ):\n```lean\nlemma AnalyticAt.iteratedDeriv {F : ℂ → ℂ} {x : ℂ} (hF : AnalyticAt ℂ F x) (n : ℕ) :\n AnalyticAt ℂ (iteratedDeriv n F) x := by\n induction n with\n | zero => simpa [iteratedDeriv_zero] using hF\n | succ n ih =>\n rw [iteratedDeriv_succ]\n exact ih.deriv\n```\n✓ — name it without the AnalyticAt. prefix to avoid namespace issues... — actually declaring `lemma AnalyticAt.iteratedDeriv` inside my namespace NguyenRH1 — extends the AnalyticAt namespace — allowed (dot-notation works) ✓ — hmm — or name it `AnalyticAt_iteratedDeriv`. Let me use the plain name to be safe.\n\nAnd the comp derivative order: hd.comp s hc — from the ℂ chain rule HasDerivAt.comp: (hf : HasDerivAt f f' (g x)) (hg : HasDerivAt g g' x) : HasDerivAt (f ∘ g) (f' * g')?? or (g' • f')? — from LiPrincipal's HIntegral_deriv evidence: h1.comp x h2 gave `deriv G p * 1` after mul_one — so the form was (f' * g') with g' = 1 ✓ — so comp gives f' * g' = iteratedDeriv (j+1) F (pt) * (1/2) ✓ as I wrote.\n\nAlso the div_const: `(hasDerivAt_id s).add (hasDerivAt_const s (1:ℂ))` — HasDerivAt (fun t => t + 1) (1 + 0)?? — then .div_const 2 — the (1+0)/2... — let me use: HasDerivAt (fun t : ℂ => (1+t)/2) (1/2) s: \n (fun t => (1+t)/2) = (fun t => 1 + t) / 2-ish — via HasDerivAt.div_const: (hasDerivAt_const s 1).add (hasDerivAt_id s) : HasDerivAt (fun t => 1 + t) (0 + 1) s — then .div_const (2:ℂ) : HasDerivAt (fun t => (1+t)/2) ((0+1)/2) s — (0+1)/2 = 1/2 — simpa ✓:\n```lean\n have hc : HasDerivAt (fun t : ℂ => (1 + t) / 2) (1 / 2) s := by\n have h := ((hasDerivAt_const s (1 : ℂ)).add (hasDerivAt_id s)).div_const (2 : ℂ)\n simpa using h\n```\n✓.\n\nOK. And then the FINAL assembly (in LiArchimedean.lean — it has the split). The capstone theorem:\n\n```lean\n/-- The archimedean Taylor coefficients (D-066 piece A): for all j ≥ 0,\n iteratedDeriv j (fun s => logDeriv Gammaℝ (1+s)) 0 = (−1)^{j+1}·j!·a_{j+1}. -/\ntheorem iteratedDeriv_logDeriv_Gammaℝ (j : ℕ) :\n iteratedDeriv j (fun s : ℂ => logDeriv Complex.Gammaℝ (1 + s)) 0 =\n ((-1 : ℂ)) ^ (j + 1) * (j ! : ℂ) * (lagariasA (j + 1) : ℝ) := by\n rcases Nat.eq_zero_or_pos j with hj0 | hj0\n · subst hj0\n rw [iteratedDeriv_zero]\n rw [lagariasA, if_pos rfl]\n simp [logDeriv_Gammaℝ_one] -- value: −a₁ = (−1)^1·0!·a₁ ✓\n · -- j ≥ 1\n have hj : 1 ≤ j := hj0\n -- the eventual split near 0\n have hev : (fun s : ℂ => logDeriv Complex.Gammaℝ (1 + s)) =ᶠ[𝓝 (0:ℂ)]\n (fun s => -(Real.log Real.pi : ℂ) / 2 + (1 / 2) * Complex.digamma ((1 + s) / 2)) := by\n -- the hypotheses of logDeriv_Gammaℝ_one_add hold on a small ball around 0\n have hGamma_ne : ∀ᶠ s in 𝓝 (0:ℂ), Complex.Gamma ((1 + s) / 2) ≠ 0 := by\n have hcont : ContinuousAt (fun s : ℂ => Complex.Gamma ((1 + s) / 2)) 0 := by\n apply ContinuousAt.comp _ (continuousAt_id.add continuousAt_const |>.div continuousAt_const)\n -- Gamma continuous at 1/2\n ...\n ...\n ...\n```\nThis needs: Gamma((1+s)/2) ≠ 0 near 0 — from Gamma(1/2) ≠ 0 + continuity of the composition at 0 — Complex.continuousAt_Gamma (s) (hs : ∀ m, s ≠ −m) at 1/2 ✓ (Derivative.lean:88: continuousAt_Gamma (s) (hs : ∀ m : ℕ, s ≠ −m) : ContinuousAt Gamma s ✓). The composition: fun s => Gamma((1+s)/2) at 0: Gamma(1/2) ≠ 0 — then eventually_ne via Tendsto: Tendsto (fun s => Gamma((1+s)/2)) (𝓝 0) (𝓝 (Gamma(1/2))) — via ContinuousAt.comp — ContinuousAt.comp (hf : ContinuousAt f (g x)) (hg : ContinuousAt g x) ✓. Then (tendsto).eventually_ne (Gamma(1/2) ≠ 0) : ∀ᶠ s in 𝓝 0, Gamma((1+s)/2) ≠ 0 ✓ — via `Tendsto.eventually_ne`? — `Filter.Tendsto.eventually_ne (h : Tendsto f l (𝓝 a)) (ha : a ≠ 0) : ∀ᶠ x in l, f x ≠ 0` ✓ (used in LiResidue: riemannZeta_residue_one.eventually_ne ✓).\nAnd the pole-free: ∀ᶠ s in 𝓝 0, ∀ m, (1+s)/2 ≠ −↑m: from re((1+s)/2) near 1/2 > 0: the set {s | 0 < ((1+s)/2).re} is open ∋ 0 (re((1+0)/2) = 1/2 > 0 ✓ continuity of re∘((1+·)/2)) — so ∀ᶠ s, 0 < re((1+s)/2) — then (1+s)/2 ≠ −↑m (re > 0 vs re(−↑m) ≤ 0) ✓. The ∀-m inside the eventually: ∀ᶠ s in 𝓝 0, ∀ m : ℕ, (1+s)/2 ≠ −↑m — since the condition is s-dependent only through re > 0: ∀ᶠ s, 0 < re((1+s)/2) and pointwise 0 < re(z) ⟹ ∀ m, z ≠ −↑m ✓:\n```lean\n have hpole : ∀ᶠ s in 𝓝 (0:ℂ), ∀ m : ℕ, (1 + s) / 2 ≠ -(m : ℂ) := by\n have hcont : ContinuousAt (fun s : ℂ => (((1 + s) / 2).re)) 0 := by\n exact (Complex.continuous_re.continuousAt.comp ...) -- re is continuous\n ...\n```\nHmm — let me simplify: the set U₀ := {s : ℂ | 0 < ((1+s)/2).re} — contains 0 (re((1+0)/2) = 1/2 > 0 ✓) — is it open? (fun s => ((1+s)/2).re) continuous (Complex.continuous_re.comp (affine)) — preimage of Ioi 0 ✓ open ✓ — so U₀ ∈ 𝓝 0 (IsOpen.mem_nhds) — and for s ∈ U₀: ∀ m, (1+s)/2 ≠ −↑m (since re(−↑m) = −↑m ≤ 0 < re) ✓. So:\n```lean\n have hpole : ∀ᶠ s in 𝓝 (0:ℂ), ∀ m : ℕ, (1 + s) / 2 ≠ -(m : ℂ) := by\n have hopen : IsOpen {s : ℂ | 0 < (((1 + s) / 2).re)} := by\n have hcont : Continuous (fun s : ℂ => (((1 + s) / 2).re)) :=\n Complex.continuous_re.comp ((continuous_id.add continuous_const).div continuous_const)\n exact isOpen_Ioi.preimage hcont\n have hmem : (0 : ℂ) ∈ {s : ℂ | 0 < (((1 + s) / 2).re)} := by\n simp -- ((1+0)/2).re = 1/2 > 0\n filter_upwards [hopen.mem_nhds hmem] with s hs\n intro m hmeq\n rw [hmeq] at hs\n simp at hs -- re(−↑m) = −↑m ≤ 0 contradicts 0 < −↑m\n have hm : (0 : ℝ) ≤ (m : ℝ) := Nat.cast_nonneg m\n linarith\n```\nThe `simp` at hmem: ((1+0)/2).re — simp normalizes (1+0)/2 → 1/2 and its re → 1/2 > 0 ✓ hopefully (Complex.div_re? — simp computes the re of numerals ✓). And hs at hmeq: ((−↑m)).re — hmm hs : 0 < ((1+s)/2).re with hmeq : (1+s)/2 = −↑m — rw [hmeq] at hs : 0 < ((−↑m):ℂ).re — simp: (−↑m).re → −(↑m).re → −↑m — hs : 0 < −↑m — linarith with hm ✓.\n\nThen hev := eventually_of_mem (ball-intersection of the two eventuallys + the ball for hGamma_ne)... — combine: hev := (hGamma_ne.and hpole).mono (fun s ⟨h1, h2⟩ => logDeriv_Gammaℝ_one_add h1 h2) — with the eventuallys combined via Filter.Eventually.and ✓.\n\nThen:\n```lean\n rw [iteratedDeriv_congr_of_eventuallyEq hev]\n -- iteratedDeriv j (const + (1/2)·digamma((1+·)/2)) 0 — the const dies (j ≥ 1)\n have hsplit2 : (fun s : ℂ => -(Real.log Real.pi : ℂ) / 2 + (1 / 2) * Complex.digamma ((1 + s) / 2)) =\n (fun _ : ℂ => -(Real.log Real.pi : ℂ) / 2) +\n (fun s => (1 / 2) * Complex.digamma ((1 + s) / 2)) := rfl\n rw [hsplit2]\n rw [iteratedDeriv_add (contDiff_const.contDiffAt) (the digamma comp's ContDiffAt)]\n rw [iteratedDeriv_const, if_neg (by omega : j ≠ 0), zero_add]\n -- iteratedDeriv j ((1/2)·digamma∘φ) 0 = (1/2)·(1/2)^j·digamma^{(j)}(1/2)\n rw [iteratedDeriv_const_mul] -- needs ContDiffAt of the comp\n rw [iteratedDeriv_one_add_div_two_at Complex.digamma j digamma-analytic-at-half (the eventually)]\n -- = (1/2)·(1/2)^j·[(−1)^{j+1} j! Σ] — then reindexing + algebra\n rw [iteratedDeriv_digamma_half j hj]\n -- the reindexing: Σ_{m≥0}(1/2+↑m)^{−(j+1)} = 2^{j+1}·lagariasA(j+1)-cast — hmm — my reindexing lemma is about (2↑m+1)^(−(j+1)) — need the (1/2+↑m) → (2↑m+1) scaling: (1/2+↑m)^{−(j+1)} = 2^{j+1}·(1+2↑m)^{−(j+1)} = 2^{j+1}·(2↑m+1)^{−(j+1)}...\n```\n\nHmm — wait — I have tsum_two_mul_add_one_inv_pow : ∑' m, (2↑m+1)^(−(j+1)) = ↑(lagariasA(j+1)) — and the series at 1/2 is Σ (1/2+↑m)^{−(j+1)} — the scaling: (1/2+↑m) = (1+2↑m)/2 = (2↑m+1)/2 — so (1/2+↑m)^{−(j+1)} = 2^{j+1}·(2↑m+1)^{−(j+1)} — per-term. So Σ_{m≥0}(1/2+↑m)^{−(j+1)} = 2^{j+1}·Σ(2↑m+1)^{−(j+1)} = 2^{j+1}·↑lagariasA(j+1) ✓.\n\nThe per-term scaling lemma: ((1/2:ℂ)+↑m)^{−(j+1)} = (2:ℂ)^{j+1}·(2↑m+1)^{−(j+1)}:\n (1/2+↑m) = (2↑m+1)/2 [ring]; then ((2↑m+1)/2)^{−(j+1)} = 2^{j+1}·(2↑m+1)^{−(j+1)}: via div_zpow? — (a/b)^q zpow: `div_zpow`? — there's `div_zpow : (a/b)^n = a^n/b^n` for zpow? — probably `div_zpow : (a / b) ^ (n : ℤ) = a ^ n / b ^ n` ✓ — then (2↑m+1)^{−(j+1)}/2^{−(j+1)} = (2↑m+1)^{−(j+1)}·2^{j+1} — via zpow_neg + ... — let me handle: ((2↑m+1)/2)^q = (2↑m+1)^q/2^q [div_zpow] and 2^q with q = −(j+1): 2^{−(j+1)} = (2^{j+1})⁻¹ — so the term = (2↑m+1)^q·(2^{j+1}) — via field_simp/ring with zpow forms... — ugh — let me write the per-term as:\n```lean\n have hscale : ∀ m : ℕ, ((1 / 2 : ℂ) + ↑m) ^ (-(j : ℤ) - 1) =\n (2 : ℂ) ^ (j + 1) * ((2 : ℂ) * ↑m + 1) ^ (-(j : ℤ) - 1) := by\n intro m\n have e : ((1 / 2 : ℂ) + ↑m) = ((2 : ℂ) * ↑m + 1) / 2 := by push_cast; ring\n rw [e, div_zpow] -- hmm div_zpow : (a/b)^n = a^n / b^n for n : ℤ?\n rw [show ((2 : ℂ)) ^ (-(j : ℤ) - 1) = ((2 : ℂ) ^ (j + 1))⁻¹ from by\n rw [show (-(j : ℤ) - 1 : ℤ) = -(((j + 1 : ℕ) : ℤ)) by push_cast; ring, zpow_neg, zpow_natCast]]\n field_simp\n ring\n```\nHmm — `div_zpow` — let me check it exists... — there should be `div_zpow : (a / b) ^ (n : ℤ) = a ^ n / b ^ n` ✓ (I believe — alongside div_pow). Then the goal: (2↑m+1)^q / 2^q = 2^{j+1}·(2↑m+1)^q with q := −(j+1): = (2↑m+1)^q·(2^q)⁻¹-form... — field_simp then ring — with zpow's as atoms — field_simp might not handle zpow well — alternative: 2^q = (2^{j+1})⁻¹ via the show ✓ then the equation: (2↑m+1)^q / (2^{j+1})⁻¹ = 2^{j+1}·(2↑m+1)^q — i.e. X/C⁻¹ = C·X — by rw [div_eq_mul_inv, inv_inv, mul_comm]?? — X/C⁻¹ = X·(C⁻¹)⁻¹ = X·C [inv_inv ✓] — then = C·X [mul_comm] ✓:\n```lean\n rw [e, div_zpow]\n rw [show ((2 : ℂ)) ^ (-(j : ℤ) - 1) = ((2 : ℂ) ^ (j + 1))⁻¹ from by\n rw [show (-(j : ℤ) - 1 : ℤ) = -(((j + 1 : ℕ) : ℤ)) by push_cast; ring, zpow_neg, zpow_natCast]]\n rw [div_eq_mul_inv, inv_inv, mul_comm]\n```\n✓ deterministic.\n\nThen:\n Σ_{m≥0} (1/2+↑m)^{−(j+1)} = Σ 2^{j+1}·(2↑m+1)^{−(j+1)} [tsum_congr hscale] = 2^{j+1}·Σ (2↑m+1)^{−(j+1)} [tsum_mul_left] = 2^{j+1}·↑(lagariasA(j+1)) [tsum_two_mul_add_one_inv_pow j hj] ✓.\n\nAnd the final constant assembly: (1/2)·(1/2)^j·(−1)^{j+1}·j!·[2^{j+1}·↑lagariasA] = (−1)^{j+1}·j!·↑lagariasA — since (1/2)·(1/2)^j·2^{j+1} = 2^{−(j+1)}·2^{j+1} = 1 — the 2-powers: (2:ℂ)^{j+1}·(1/2)^{j+1}·(1/2)... — (1/2)·(1/2)^j = (1/2)^{j+1} = 2^{−(j+1)} — and 2^{j+1}·2^{−(j+1)} = 1 — the ℂ forms: (1/2:ℂ)^{j+1}·(2:ℂ)^{j+1} = 1 — via mul_pow: (2·(1/2))^{j+1} = 1^{j+1} = 1 ✓. The ring with the zpow/npow mix — let me manage: the final goal after all rewrites:\n (1/2)·((1/2)^j·(−1)^{j+1}·j!·(2^{j+1}·↑lagariasA(j+1))) = (−1)^{j+1}·j!·↑lagariasA(j+1)\n — hmm — actually the (1/2)^j form from iteratedDeriv_one_add_div_two_at — and the (1/2) from the const_mul — let me just make the ending: have h2pow : (1/2:ℂ)·(1/2:ℂ)^j·(2:ℂ)^(j+1) = 1 := by rw [show (1/2:ℂ)·(1/2:ℂ)^j = (1/2:ℂ)^(j+1) from by ring]; rw [← mul_pow]; simp — (2·(1/2))^{j+1} = (1)^{j+1} = 1 ✓ simp — hmm (2·(1/2)) = 1 — `mul_one_div`? — 2·(1/2) = 1 — simp/norm_num ✓. Then the goal: ... — let me leave to ring with h2pow as a rewrite:\n```lean\n rw [h2pow-multiplied-forms]...\n```\nGetting long. Let me just carefully assemble. OK — writing the final section now (the affine comp + the assembly) — appending to LiDigamma.lean the affine comp, and adding the capstone to LiArchimedean.lean.","signature":""},{"type":"text","text":"Now the final stretch: the affine comp lemma + the capstone. Appending the affine comp to LiDigamma.lean."},{"type":"tool_use","id":"Bash_530","name":"Bash","input":{"command":"cd \"D:/Python/Quantum\" && cat >> research/lean/NguyenRH1/NguyenRH1/LiDigamma.lean << 'EOF'\n\n/-- AnalyticAt is preserved by iteratedDeriv. -/\nlemma analyticAt_iteratedDeriv {F : ℂ → ℂ} {x : ℂ} (hF : AnalyticAt ℂ F x) (n : ℕ) :\n AnalyticAt ℂ (iteratedDeriv n F) x := by\n induction n with\n | zero => simpa [iteratedDeriv_zero] using hF\n | succ n ih =>\n rw [iteratedDeriv_succ]\n exact ih.deriv\n\n/-- The affine comp: iterated derivatives of F((1+s)/2) at s. -/\nlemma iteratedDeriv_one_add_div_two (F : ℂ → ℂ) (j : ℕ) {s : ℂ}\n (hF : AnalyticAt ℂ F ((1 + s) / 2))\n (hFn : ∀ᶠ t in 𝓝 s, AnalyticAt ℂ F ((1 + t) / 2)) :\n iteratedDeriv j (fun t : ℂ => F ((1 + t) / 2)) s =\n (1 / 2 : ℂ) ^ j * iteratedDeriv j F ((1 + s) / 2) := by\n induction j generalizing s with\n | zero => simp [iteratedDeriv_zero]\n | succ j ih =>\n rw [iteratedDeriv_succ, iteratedDeriv_succ]\n have hev : (fun t => iteratedDeriv j (fun u : ℂ => F ((1 + u) / 2)) t) =ᶠ[𝓝 s]\n (fun t => (1 / 2 : ℂ) ^ j * iteratedDeriv j F ((1 + t) / 2)) := by\n filter_upwards [hFn] with t ht\n have hcont : Tendsto (fun u : ℂ => (1 + u) / 2) (𝓝 t) (𝓝 ((1 + t) / 2)) := by\n have hc : ContinuousAt (fun u : ℂ => (1 + u) / 2) t :=\n (continuousAt_id.add continuousAt_const).div continuousAt_const\n exact hc.tendsto\n exact ih ht (hcont.eventually ht.eventually_analyticAt)\n rw [hev.deriv_eq]\n have hcomp : HasDerivAt (fun t : ℂ => iteratedDeriv j F ((1 + t) / 2))\n (iteratedDeriv (j + 1) F ((1 + s) / 2) * (1 / 2)) s := by\n have hc : HasDerivAt (fun t : ℂ => (1 + t) / 2) (1 / 2) s := by\n have h := ((hasDerivAt_const s (1 : ℂ)).add (hasDerivAt_id s)).div_const (2 : ℂ)\n simpa using h\n have hd : HasDerivAt (iteratedDeriv j F) (iteratedDeriv (j + 1) F ((1 + s) / 2))\n ((1 + s) / 2) := by\n rw [← iteratedDeriv_succ]\n exact (analyticAt_iteratedDeriv hF j).deriv.differentiableAt.hasDerivAt\n have hc2 := hd.comp s hc\n have heq : (iteratedDeriv j F ∘ fun t : ℂ => (1 + t) / 2) =\n fun t => iteratedDeriv j F ((1 + t) / 2) := rfl\n rw [heq] at hc2\n exact hc2\n rw [deriv_const_mul _ hcomp.differentiableAt, hcomp.deriv]\n rw [pow_succ]\n ring\n\n/-- The scaling: (1/2 + m)^{-(j+1)} = 2^{j+1}·(2m+1)^{-(j+1)}. -/\nlemma zpow_half_add_nat_scale (j : ℕ) (m : ℕ) :\n ((1 / 2 : ℂ) + ↑m) ^ (-(j : ℤ) - 1) =\n (2 : ℂ) ^ (j + 1) * ((2 : ℂ) * ↑m + 1) ^ (-(j : ℤ) - 1) := by\n have e : ((1 / 2 : ℂ) + ↑m) = ((2 : ℂ) * ↑m + 1) / 2 := by push_cast; ring\n rw [e, div_zpow]\n rw [show ((2 : ℂ)) ^ (-(j : ℤ) - 1) = ((2 : ℂ) ^ (j + 1))⁻¹ from by\n rw [show (-(j : ℤ) - 1 : ℤ) = -(((j + 1 : ℕ) : ℤ)) by push_cast; ring, zpow_neg, zpow_natCast]]\n rw [div_eq_mul_inv, inv_inv, mul_comm]\n\n/-- The (1/2+m)-series equals 2^{j+1}·lagariasA(j+1) (as ℂ). -/\nlemma tsum_half_add_nat_zpow (j : ℕ) (hj : 1 ≤ j) :\n (∑' m : ℕ, ((1 / 2 : ℂ) + ↑m) ^ (-(j : ℤ) - 1)) = (2 : ℂ) ^ (j + 1) * (lagariasA (j + 1) : ℝ) := by\n rw [tsum_congr (fun m => zpow_half_add_nat_scale j m)]\n rw [tsum_mul_left, tsum_two_mul_add_one_inv_pow j hj]\n\n/-- **The archimedean Taylor coefficients of digamma at 1/2** (j ≥ 1):\niteratedDeriv j digamma (1/2) = (−1)^{j+1}·j!·2^{j+1}·lagariasA(j+1). -/\nlemma iteratedDeriv_digamma_half_value (j : ℕ) (hj : 1 ≤ j) :\n iteratedDeriv j Complex.digamma ((1 : ℂ) / 2) =\n ((-1 : ℂ)) ^ (j + 1) * (j ! : ℂ) * ((2 : ℂ) ^ (j + 1) * (lagariasA (j + 1) : ℝ)) := by\n rw [iteratedDeriv_digamma_half j hj, tsum_half_add_nat_zpow j hj]\n\nend NguyenRH1\nEOF\ncd research/lean/NguyenRH1 && export PATH=\"$HOME/.elan/bin:$PATH\" && lake env lean NguyenRH1/LiDigamma.lean 2>&1 | grep -v \"^$\" | head -25","description":"Append affine comp + scaling and compile","timeout":600000},"extra_content":null}]