Current task: —

← Session 22 — ii′-1: liCoeff pairing fix + residue machinery

#1060 assistant 2026-08-22 06:10:15.181 UTC · 1087→6214 tok open ⤢
thinking (16689 chars)
`hasDerivAt_of_tendstoLocallyUniformlyOn (hs : IsOpen s) (hf' : TendstoLocallyUniformlyOn f' g' l s) (hf : ∀ᶠ n in l, ∀ x ∈ s, HasDerivAt (f n) (f' n x) x) (hfg : ∀ x ∈ s, Tendsto (fun n => f n x) l (𝓝 (g x))) (hx : x ∈ s) : HasDerivAt g (g' x) x` — field-generic (𝕜) ✓ works for ℝ ✓. This is the interchange lemma. This gives: if the derivative sequence converges locally uniformly and the function sequence converges pointwise, the limit's derivative is the derivative-limit. For my use: - f n := fun x => logGammaSeq x n (real); f' n := digammaRealSeq (the deriv of logGammaSeq in x); g := log ∘ Real.Gamma; g' := D∞. - hfg: ∀ x ∈ Ioi 0, Tendsto (logGammaSeq x ·) atTop (𝓝 (log (Gamma x))) ✓ tendsto_log_gamma. - hf: HasDerivAt (logGammaSeq · n) (digammaRealSeq x n) x — deriv of x log n + log n! − Σ log(x+m): = log n − Σ 1/(x+m) ✓ — needs Real.Gamma... no — just deriv of logs: log(x+m) differentiable (x+m > 0 ✓) — elementary ✓. - hf': TendstoLocallyUniformlyOn digammaRealSeq D∞ atTop (Ioi 0) — the M-test work. Then HasDerivAt (log ∘ Gamma) (D∞ x) x for x > 0 ✓ — and deriv (log ∘ Gamma) x = D∞ x ✓. For ITERATED derivatives (j ≥ 1): apply the same lemma to the DERIVATIVE sequence recursively. The setup: define everything at the level of the derivative series and iterate. The cleanest induction: prove for each j ≥ 0 and x > 0: iteratedDeriv j D∞ x = (j = 0 ? D∞ x : (−1)^{j+1} j! Σ_{m≥0}(x+m)^{−(j+1)})... Hmm — actually for the FINAL goal I only need the derivatives AT x = 1/2 for j ≥ 1. But the induction needs the statement on an interval. Let me structure the iterated part as: for each j ≥ 1, the function D∞ has iteratedDeriv j D∞ x = (−1)^{j+1} j! Σ_{m≥0}(x+m)^{−(j+1)} for x > 0. Induction on j: - Base j = 1: D∞'(x) = Σ_{m≥0}(x+m)^{−2}: apply hasDerivAt_of_tendstoLocallyUniformlyOn to the series sequence: f n := the partial sums S_N(x) = −γ − 1/x + Σ_{m=1}^N (1/m − 1/(x+m)) (as functions of x); deriv S_N(x) = 1/x² + Σ_{m=1}^N 1/(x+m)² = Σ_{m=0}^N (x+m)^{−2}·... wait d/dx(1/m − 1/(x+m)) = +1/(x+m)² ✓ and d/dx(−1/x) = +1/x² ✓ — so deriv S_N(x) = Σ_{m=0}^N (x+m)^{−2} ✓; the M-test: (x+m)^{−2} ≤ m^{-2}·C on compacts ✓ locally uniform ⟹ D∞'(x) = Σ_{m≥0}(x+m)^{−2} ✓. - Step j → j+1: same applied to the j-th derivative series. Each step needs: (a) the j-th derivative series converges locally uniformly (M-test with j!·C/m^{j+1} ✓ for j ≥ 1 — for j = 0 the original series has the 1/m − 1/(x+m) cancellation ✓ handled separately); (b) pointwise convergence of the previous level ✓ (follows from the uniform convergence at the previous level); (c) HasDerivAt of each partial sum = next partial sum ✓ termwise. So the uniform structure: define for each j ≥ 1: DSer_j(x) := Σ_{m≥0} (−1)^{j+1} j! (x+m)^{−(j+1)} (the j-th derivative function), and S_N^{(j)}(x) := Σ_{m=0}^{N} (−1)^{j+1} j! (x+m)^{−(j+1)} the partial sums. Induction: iteratedDeriv j D∞ x = DSer_j(x): - The interchange at each step: HasDerivAt (DSer_j) (DSer_{j+1} x) x: apply the interchange lemma with f n := S_{n}^{(j)}, f' n := S_{n}^{(j+1)}, g := DSer_j, g' := DSer_{j+1}: - hf : HasDerivAt (S_N^{(j)}) (S_N^{(j+1)} x) x — the partial sum's derivative is the next partial sum — termwise: d/dx [(−1)^{j+1}j!(x+m)^{−(j+1)}] = (−1)^{j+1}j!·(−(j+1))(x+m)^{−(j+2)} = (−1)^{j+2}(j+1)! (x+m)^{−(j+2)} ✓ — a finite-sum deriv computation ✓. - hf' : TendstoLocallyUniformlyOn (S_N^{(j+1)}) DSer_{j+1} atTop (Ioi 0) — M-test. - hfg : pointwise S_N^{(j)} → DSer_j — from the M-test uniform convergence (implies pointwise ✓). Then HasDerivAt DSer_j (DSer_{j+1} x) x ✓ — and the iterated: deriv DSer_j = DSer_{j+1} pointwise on (0,∞) — then iteratedDeriv bookkeeping: iteratedDeriv j D∞ x: induction: iteratedDeriv 1 D∞ x = deriv D∞ x = DSer_1 x ✓ base; iteratedDeriv (j+1) D∞ x = deriv (iteratedDeriv j D∞) x = deriv (DSer_j restricted...) x — careful: iteratedDeriv (j+1) D∞ = deriv (iteratedDeriv j D∞) — the induction hypothesis gives iteratedDeriv j D∞ = DSer_j as FUNCTIONS on (0,∞)?? — pointwise on (0,∞): the functions agree on (0,∞) — deriv at x ∈ (0,∞) only sees a nhd — use `EventuallyEq.deriv` with the nhd (0,∞) — or state the induction as: iteratedDeriv j D∞ =ᶠ[𝓝 x]-ish... simpler: prove `Set.EqOn (iteratedDeriv j D∞) DSer_j (Ioi 0)` by induction with the deriv-of-equal-on-open-set: if f = g on an open set containing x, deriv f x = deriv g x — `DifferentiableOn...deriv_eq`? — `Set.EqOn.deriv`? there's `DifferentiableOn.deriv` (used in LiResidue!) — `DifferentiableOn.deriv (h : DifferentiableOn) (hs : IsOpen)... : deriv f x = derivWithin f s x`? hmm — the EqOn version: `Set.EqOn.deriv_eq`? or derivWithin_congr_set... For open s and x ∈ s: deriv f x = derivWithin f s x (IsOpen) and EqOn gives derivWithin equal ✓ — `Set.EqOn.derivWithin_eq`? `Set.EqOn.derivWithin` : f = g on s → derivWithin f s x = derivWithin g s x — exists as `Set.EqOn.derivWithin` (with hx : x ∈ s? — derivWithin_eq? — `Set.EqOn.derivWithin_eq (h : EqOn f g s) (hx : x ∈ s)`? roughly). OK manageable. So the induction structure: ```lean lemma iteratedDeriv_Dinf (j : ℕ) (hj : 1 ≤ j) {x : ℝ} (hx : 0 < x) : iteratedDeriv j Dinf x = (-1 : ℝ)^(j+1) * j ! * tsum (fun m : ℕ => (x + m)^(-(j+1) : ℤ)) ``` Hmm — the (x+m)^{−(j+1)} as zpow or 1/(x+m)^{j+1} — use 1/(x+m)^(j+1) (npow, positive base) ✓ cleaner in ℝ. This is all real analysis, well-understood. The M-test uniform convergence lemma: for the series of functions Σ_m u_m(x) with |u_m(x)| ≤ M_m on a set and Σ M_m < ∞: partial sums converge uniformly on the set: `tendstoUniformlyOn_tsum`? — let me check the name: in TsumUniformlyOn.lean — `tendstoUniformlyOn_tsum (hu : Summable u) (hf : ∀ n x, x ∈ s → ‖f n x‖ ≤ u n)?`... something like that. Then locally-uniformly-on (Ioi 0) from uniform-on-every-compact: `tendstoLocallyUniformlyOn_of_...`? there's a way via Icc covers: (0,∞) = ⋃ Icc (1/k) k... `TendstoLocallyUniformlyOn` from uniform on compacts: `tendstoLocallyUniformlyOn_of_forall_compact`? hmm — there might be `tendstoLocallyUniformlyOn_iff_tendstoUniformlyOn_of_compact`? or prove via: for each x ∈ Ioi 0, take the ball/Icc [x/2, 2x] neighborhood — TendstoLocallyUniformlyOn unfolds to: for each x ∈ s, ∃ t ∈ 𝓝[s] x, TendstoUniformlyOn ... — take t := Icc (x/2) (2x) ∩ Ioi 0... it's in 𝓝[Ioi 0] x ✓ (relative nhd). OK. Now the Complex side: - D(s) := −γ − 1/s + Σ_{m≥1} (1/m − 1/(s+m)) for s : ℂ near 1/2 — analytic on a ball around 1/2 (radius < 1/2): the series of analytic functions, locally uniformly convergent (M-test: |1/m − 1/(s+m)| = |s|/(m|s+m|) — for |s − 1/2| ≤ 1/4: |s| ≤ 3/4, |s+m| ≥ m − |s| ≥ m − 3/4 ≥ m/4 (m ≥ 1) — so ≤ (3/4)/(m·m/4) = 3/m² ✓) — analytic via TendstoLocallyUniformlyOn.differentiableOn ✓ then analyticOnNhd? DifferentiableOn on an open ball ⟹ AnalyticOnNhd (Mathlib: `DifferentiableOn.analyticOnNhd`? — for ℂ: differentiableOn on open ⟹ analyticOnNhd — `DifferentiableOn.analyticOnNhd (h : DifferentiableOn ℂ f s) (hs : IsOpen s) : AnalyticOnNhd ℂ f s`? I believe exists ✓ (used somewhere?)). - D(↑x) = ↑(D∞ x) for real x ∈ (0,∞): the tsum of casts = cast of tsum (Summable ✓) via `Complex.ofReal_tsum`? name: `Complex.ofReal_tsum : ↑(∑' n, f n) = ∑' n, ↑(f n)`? — `map_tsum` with ofRealCLM: `map_tsum Complex.ofRealCLM ...`? hmm — there's `Complex.ofReal_tsum`? I'll find it. - digamma(↑x) = ↑(D∞ x): via ψ_real bridge (the Gamma_ofReal + ofReal-deriv lemmas). - deriv (Complex.Gamma ∘ ofReal) x: HasDerivAt ofRealCLM... — ofReal as a CLM: Complex.ofRealCLM : ℝ →L[ℝ] ℂ — `Complex.ofRealCLM.hasDerivAt : HasDerivAt ofRealCLM (ofRealCLM 1) x`?? — hmm — ofRealCLM 1 = ↑1 = 1 — so HasDerivAt ofReal 1 x (`Complex.ofRealCLM_hasDerivAt`? or from LiPrincipal's usage: `Complex.ofRealCLM.hasDerivAt (x := x)` with ofRealCLM_apply — they got HasDerivAt (fun t : ℝ => (t:ℂ)) 1 x ✓). So deriv (fun x : ℝ => (↑(g x) : ℂ)) x with g : ℝ → ℝ: comp: HasDerivAt (↑∘g) (↑(g' x)·1)?? — the CLM-comp: HasDerivAt (↑) 1 (g x)... HasDerivAt.comp with ofRealCLM as the OUTER: ofRealCLM.hasDerivAt gives HasDerivAt ofRealCLM (ofRealCLM 1) (g x); then comp with hg : HasDerivAt g (g') x: HasDerivAt (ofReal ∘ g) ((ofRealCLM 1) • g')?? — order: HasDerivAt.comp (x) (hf : HasDerivAt f f' (g x)) (hg : HasDerivAt g g' x) : HasDerivAt (f ∘ g) x (g' • f')?? — for the CLM outer function... — this gives deriv (↑∘g) x = ↑(deriv g x) ✓ after pushing the smul. There might be a direct lemma `Complex.deriv_ofReal_comp`? or `ofReal_deriv`? — hmm: `Complex.ofReal_deriv`? Let me just plan on the comp dance (ofRealCLM.hasDerivAt + comp + push). - The identity principle: D = digamma on the ball around 1/2 — they agree on the real segment (1/4, 3/4) — the identity principle for analytic functions on a connected open set agreeing on a set with accumulation point: Mathlib: `AnalyticOnNhd.eq_on_of_preconnected_of_frequently_eq`? Let me look for the exact identity-principle name: `AnalyticOnNhd.eq_of_preconnected_of_frequently_eq`? or `AnalyticOnNhd.eq_of_frequently...`? — I'll grep at build time. - Then iteratedDeriv j D (1/2:ℂ) = the series termwise — the complex version of the M-test/deriv interchange: TendstoLocallyUniformlyOn.deriv ✓ iterated — for the complex functions this is cleaner (TendstoLocallyUniformlyOn.differentiableOn + .deriv both exist for ℂ ✓). - And iteratedDeriv j digamma (1/2:ℂ) = iteratedDeriv j D (1/2) via the eventual equality (D = digamma on the ball ⟹ =ᶠ[𝓝 (1/2)] ⟹ same iteratedDeriv at 1/2: `Filter.EventuallyEq.iteratedDeriv`?? — hmm — does that exist? `EventuallyEq.deriv_eq` : f =ᶠ[𝓝 x] g → deriv f x = deriv g x ✓ (used in LiResidue). For iterated: I can iterate: f =ᶠ[𝓝 x] g ⟹ deriv f =ᶠ[𝓝 x] deriv g (if both differentiable on a nhd — `Filter.EventuallyEq.deriv`? hmm — actually there's `Filter.EventuallyEq.deriv_eq` (pointwise) and for the iterated I need the eventuallyEq of the derived FUNCTIONS — `EventuallyEq.deriv`? hmm — I recall `Filter.EventuallyEq.deriv : f =ᶠ[𝓝 x] g → deriv f =ᶠ[𝓝 x] deriv g` — is that a thing? For ANALYTIC functions on an open set: f = g on a nhd of x ⟹ on that nhd derivs agree pointwise — formalize: the nhds contains a ball; on the ball f = g; so deriv f y = deriv g y for y in the ball (EventuallyEq.deriv_eq at each y ∈ ball — needs f =ᶠ[𝓝 y] g which holds since the ball is in the nhd ✓) — so deriv f =ᶠ[𝓝 x] deriv g ✓ — then iterate. I'll write a small helper: `eventuallyEq_iteratedDeriv : f =ᶠ[𝓝 x] g → (hf : AnalyticAt...) → iteratedDeriv n f x = iteratedDeriv n g x` — via induction using EventuallyEq.deriv_eq + the eventuallyEq of derivs on the nhd. There's likely `Filter.EventuallyEq.iteratedDeriv_eq`? or I'll build the induction. Hmm OK — this is a LOT of moving parts. Let me estimate the Lean surface: ~400-500 lines with several infrastructure gambles. It's 22:30. This will span into next session anyway. Let me structure it as TWO Lean deliverables: - (A-i) j = 0 case (τ₀ = −a₁) — do TONIGHT (small, all ingredients verified). - (A-ii) j ≥ 1 — start the digamma-series infrastructure; whatever completes cleanly tonight gets committed; rest next session. Actually — for (A-i): the τ₀ statement: iteratedDeriv 0 (fun s => logDeriv Gammaℝ (1+s)) 0 / 0! = logDeriv Gammaℝ 1 — so I need: logDeriv Gammaℝ 1 = −(log 4π + γ)/2 (as ℂ). Via the split: logDeriv Gammaℝ 1 = −(log π)/2 + (1/2)·digamma(1/2) — compute: logDeriv Gammaℝ 1 = deriv Gammaℝ 1 / Gammaℝ 1 = deriv Gammaℝ 1 (Gammaℝ_one : Gammaℝ 1 = 1 ✓). deriv Gammaℝ 1: Gammaℝ = π^{−s/2}·Γ(s/2): deriv at 1: deriv (π^{−s/2})·Γ(1/2) + π^{−1/2}·deriv(Γ(s/2)) at 1: = (−log π/2·π^{−1/2})·√π + π^{−1/2}·(Γ'(1/2)·(1/2)) = (−log π)/2 + (1/2)·(Γ'(1/2)/Γ(1/2))·(π^{−1/2}·√π) = −(log π)/2 + (1/2)·digamma(1/2) ✓. In Lean: the split lemma: ```lean lemma logDeriv_Gammaℝ_one_add (s : ℂ) (hs : Gammaℝ (1 + s) ≠ 0) : logDeriv Gammaℝ (1 + s) = -(Real.log π : ℂ)/2 + (1/2) * Complex.digamma ((1 + s)/2) := by rw [Gammaℝ_def] at * -- Gammaℝ w = π^(−w/2) * Gamma (w/2) ... ``` logDeriv (fun w => π^(−w/2) * Gamma (w/2)) (1+s) = logDeriv (π^(−·/2)) (1+s) + logDeriv (Gamma(·/2)) (1+s) via logDeriv_mul (needs both nonzero at the point ✓ π^{−(1+s)/2} ≠ 0 (cpow nonzero ✓ `Complex.cpow_ne_zero`? for real base π > 0 ✓) and Gamma((1+s)/2) ≠ 0 ✓ from hs and the π factor nonzero). - logDeriv (fun w => π^(−w/2)) (1+s): π^(−w/2) = Complex.cpow π (−w/2)... = exp(log π · (−w/2))... deriv: `Complex.deriv_const_cpow...`? Hmm — π^z with z = −w/2: hasDerivAt_const_cpow? — there's `Complex.hasDerivAt_const_cpow (x : ℂ) (c : ℂ)?: HasDerivAt (fun z => c^z) (c^z * log c) z`? for c real positive... Let me handle via exp: π^(−w/2) = exp (↑(log π)·(−w/2))... this is getting fiddly but standard. Actually — simpler: (fun w => π^(−w/2)) = fun w => Complex.exp (−(Real.log π)/2 * w)?? π^(−w/2) = exp(−w/2 · log π) = exp(−(log π)/2 · w) ✓ — as a composition exp ∘ (c·w) — logDeriv = c (deriv exp = exp; cancels) = −(log π)/2 ✓: logDeriv (fun w => Complex.exp (c * w)) (1+s) = (exp(c·(1+s))·c)/exp(c·(1+s)) = c — via deriv_exp ∘ comp_const_mul ✓ `Complex.deriv_exp` + `deriv_const_mul`... fine. Need: π^(−w/2) = exp(−(log π)/2 · w): Complex.cpow π (−w/2) = exp(log π · (−w/2)) via `Complex.cpow_def_of_ne_zero`? — π as ℂ: (↑π)^z = exp(z·log ↑π) for z... `Complex.cpow_def_of_ne_zero (hx : x ≠ 0) : x^y = exp (log x * y)` ✓ — with x := ↑π ≠ 0 (π > 0 ✓); log ↑π = ↑(Real.log π) (`Complex.log_ofReal`? `Complex.ofReal_log`? — `Complex.log_ofReal`? there's `Complex.ofReal_log (hx : 0 ≤ x)? : log ↑x = ↑(Real.log x)`? something ✓). And −w/2 · log π = −(log π)/2 · w ✓ ring. - logDeriv (fun w => Gamma (w/2)) (1+s) = (Gamma'( (1+s)/2 )·(1/2))/Gamma((1+s)/2) = (1/2)·digamma((1+s)/2) ✓ via comp (deriv (w/2) = 1/2) ✓. So logDeriv Gammaℝ (1+s) = −(log π)/2 + (1/2)·digamma((1+s)/2) ✓. At s = 0: digamma(1/2) = −2log2 − γ (digamma_one_half ✓ — as ℂ: −2*log 2 − γ — the statement: `Complex.digamma_one_half : digamma (1/2) = -2 * log 2 - Real.eulerMascheroniConstant` — with casts: log 2 here is Complex.log? or Real cast? from the proof: `- 2 * log 2 - Real.eulerMascheroniConstant` — the `log 2` is Complex.log 2 = ↑(Real.log 2)? — since digamma_one_half's proof used `Gamma_one_half_eq, Real.sqrt_eq_rpow, ofReal_cpow` — the result's log 2 : probably ↑(Real.log 2) — I'll see when I use it.) So logDeriv Gammaℝ 1 = −(log π)/2 + (1/2)(−2 log 2 − γ) = −(log π)/2 − log 2 − γ/2 — and lagariasA1 = (log(4π) + γ)/2 = (log 4 + log π + γ)/2 = (2 log 2 + log π + γ)/2 ✓ so −lagariasA1 = −(2log2 + log π + γ)/2 = −log 2 − (log π)/2 − γ/2 ✓✓ MATCHES. So τ₀-statement: `logDeriv Complex.Gammaℝ 1 = -(lagariasA1 : ℂ)` — wait lagariasA1 is ℝ; the final assembly (ii′-3c) needs everything as ℂ (iteratedDerivs are ℂ). The a-form (4.10) has lcoeff (ℂ) and lagariasA (ℝ) and sigmaP (ℂ) — mixing — hmm — the final identity will need lagariasA coerced to ℂ. Let me define the τ-target as ℂ-valued with ↑(lagariasA (j+1)): **Piece (A) final theorem:** ```lean theorem iteratedDeriv_logDeriv_Gammaℝ_one_add (j : ℕ) : iteratedDeriv j (fun s : ℂ => logDeriv Complex.Gammaℝ (1 + s)) 0 = ((-1 : ℂ)) ^ (j + 1) * (j ! : ℂ) * (lagariasA (j + 1) : ℝ) ``` Hmm wait — sign check: τ_j = (−1)^{j+1} a_{j+1} and iteratedDeriv j = j!·τ_j: for j = 0: iteratedDeriv 0 = the value = −a₁ ✓ (−1)^1·0!·a₁ = −a₁ ✓. For j ≥ 1: iteratedDeriv j (ΓR′/ΓR(1+·)) 0 = (1/2)·iteratedDeriv j (digamma((1+·)/2)) 0 = (1/2)·(1/2)^j·digamma^{(j)}(1/2) = (1/2)^{j+1}·(−1)^{j+1} j! Σ_{m≥0}(m+1/2)^{−(j+1)} = (1/2)^{j+1}·(−1)^{j+1} j!·2^{j+1}·lagariasA(j+1) = (−1)^{j+1} j!·lagariasA(j+1) ✓✓. The cast (↑(lagariasA (j+1)) : ℂ) — or as an ℝ statement then cast? The iteratedDeriv is ℂ — so the statement is ℂ with the cast ✓. OK. For tonight, let me do the Gammaℝ logDeriv split + the j = 0 evaluation (small), and set up the file LiArchimedean.lean with the structure. The digamma series work continues next session. Actually — wait. Let me reconsider the division of labor once more. The split lemma + j=0 are quick. The rest of (A) is the digamma series — let me at least START it tonight: the real series construction + M-test + the interchange application. Given the late hour, let me target: tonight = split + j=0 + the real-series definitions/summability lemmas; next session = the interchange + iterated + complex bridge + reindexing. Let me write LiArchimedean.lean Part 1 now: the Gammaℝ logDeriv split and the τ₀ evaluation. First check the names: Complex.cpow for π^(−s/2) in Gammaℝ_def — Gammaℝ s = π ^ (-s / 2) * Gamma (s / 2) — the π ^ (-s/2) is Complex.cpow (↑π) (−s/2) — with π : ℝ cast. For the logDeriv of the cpow factor, I'll rewrite as exp form. Names to check: `Complex.differentiableAt_Gamma` (for the quotient/deriv existence), `Complex.deriv_Gamma...`? — in Deriv.lean. Let me check Deriv.lean's contents quickly.
All key bridges exist. Checking the Gamma derivative lemmas, then writing the archimedean file's first part.
tool: Bash
input
{
  "command": "cd \"D:/Python/Quantum/zeta-23-lean/.lake/packages/mathlib\" && grep -n \"^theorem\\|^lemma\" Mathlib/Analysis/SpecialFunctions/Gamma/Deriv.lean | head -20",
  "description": "List Gamma Deriv.lean contents"
}
raw content_json (database row)
[{"type":"thinking","thinking":"`hasDerivAt_of_tendstoLocallyUniformlyOn (hs : IsOpen s) (hf' : TendstoLocallyUniformlyOn f' g' l s) (hf : ∀ᶠ n in l, ∀ x ∈ s, HasDerivAt (f n) (f' n x) x) (hfg : ∀ x ∈ s, Tendsto (fun n => f n x) l (𝓝 (g x))) (hx : x ∈ s) : HasDerivAt g (g' x) x` — field-generic (𝕜) ✓ works for ℝ ✓. This is the interchange lemma.\n\nThis gives: if the derivative sequence converges locally uniformly and the function sequence converges pointwise, the limit's derivative is the derivative-limit. For my use:\n- f n := fun x => logGammaSeq x n (real); f' n := digammaRealSeq (the deriv of logGammaSeq in x); g := log ∘ Real.Gamma; g' := D∞.\n- hfg: ∀ x ∈ Ioi 0, Tendsto (logGammaSeq x ·) atTop (𝓝 (log (Gamma x))) ✓ tendsto_log_gamma.\n- hf: HasDerivAt (logGammaSeq · n) (digammaRealSeq x n) x — deriv of x log n + log n! − Σ log(x+m): = log n − Σ 1/(x+m) ✓ — needs Real.Gamma... no — just deriv of logs: log(x+m) differentiable (x+m > 0 ✓) — elementary ✓.\n- hf': TendstoLocallyUniformlyOn digammaRealSeq D∞ atTop (Ioi 0) — the M-test work.\nThen HasDerivAt (log ∘ Gamma) (D∞ x) x for x > 0 ✓ — and deriv (log ∘ Gamma) x = D∞ x ✓.\n\nFor ITERATED derivatives (j ≥ 1): apply the same lemma to the DERIVATIVE sequence recursively. The setup: define everything at the level of the derivative series and iterate. The cleanest induction: prove for each j ≥ 0 and x > 0:\n\n  iteratedDeriv j D∞ x = (j = 0 ? D∞ x : (−1)^{j+1} j! Σ_{m≥0}(x+m)^{−(j+1)})... \n\nHmm — actually for the FINAL goal I only need the derivatives AT x = 1/2 for j ≥ 1. But the induction needs the statement on an interval. Let me structure the iterated part as: for each j ≥ 1, the function D∞ has iteratedDeriv j D∞ x = (−1)^{j+1} j! Σ_{m≥0}(x+m)^{−(j+1)} for x > 0. Induction on j:\n- Base j = 1: D∞'(x) = Σ_{m≥0}(x+m)^{−2}: apply hasDerivAt_of_tendstoLocallyUniformlyOn to the series sequence: f n := the partial sums S_N(x) = −γ − 1/x + Σ_{m=1}^N (1/m − 1/(x+m)) (as functions of x); deriv S_N(x) = 1/x² + Σ_{m=1}^N 1/(x+m)² = Σ_{m=0}^N (x+m)^{−2}·... wait d/dx(1/m − 1/(x+m)) = +1/(x+m)² ✓ and d/dx(−1/x) = +1/x² ✓ — so deriv S_N(x) = Σ_{m=0}^N (x+m)^{−2} ✓; the M-test: (x+m)^{−2} ≤ m^{-2}·C on compacts ✓ locally uniform ⟹ D∞'(x) = Σ_{m≥0}(x+m)^{−2} ✓.\n- Step j → j+1: same applied to the j-th derivative series.\n\nEach step needs: (a) the j-th derivative series converges locally uniformly (M-test with j!·C/m^{j+1} ✓ for j ≥ 1 — for j = 0 the original series has the 1/m − 1/(x+m) cancellation ✓ handled separately); (b) pointwise convergence of the previous level ✓ (follows from the uniform convergence at the previous level); (c) HasDerivAt of each partial sum = next partial sum ✓ termwise.\n\nSo the uniform structure: define for each j ≥ 1: DSer_j(x) := Σ_{m≥0} (−1)^{j+1} j! (x+m)^{−(j+1)} (the j-th derivative function), and S_N^{(j)}(x) := Σ_{m=0}^{N} (−1)^{j+1} j! (x+m)^{−(j+1)} the partial sums. Induction: iteratedDeriv j D∞ x = DSer_j(x):\n- The interchange at each step: HasDerivAt (DSer_j) (DSer_{j+1} x) x: apply the interchange lemma with f n := S_{n}^{(j)}, f' n := S_{n}^{(j+1)}, g := DSer_j, g' := DSer_{j+1}:\n  - hf : HasDerivAt (S_N^{(j)}) (S_N^{(j+1)} x) x — the partial sum's derivative is the next partial sum — termwise: d/dx [(−1)^{j+1}j!(x+m)^{−(j+1)}] = (−1)^{j+1}j!·(−(j+1))(x+m)^{−(j+2)} = (−1)^{j+2}(j+1)! (x+m)^{−(j+2)} ✓ — a finite-sum deriv computation ✓.\n  - hf' : TendstoLocallyUniformlyOn (S_N^{(j+1)}) DSer_{j+1} atTop (Ioi 0) — M-test.\n  - hfg : pointwise S_N^{(j)} → DSer_j — from the M-test uniform convergence (implies pointwise ✓).\n  Then HasDerivAt DSer_j (DSer_{j+1} x) x ✓ — and the iterated: deriv DSer_j = DSer_{j+1} pointwise on (0,∞) — then iteratedDeriv bookkeeping: iteratedDeriv j D∞ x: induction: iteratedDeriv 1 D∞ x = deriv D∞ x = DSer_1 x ✓ base; iteratedDeriv (j+1) D∞ x = deriv (iteratedDeriv j D∞) x = deriv (DSer_j restricted...) x — careful: iteratedDeriv (j+1) D∞ = deriv (iteratedDeriv j D∞) — the induction hypothesis gives iteratedDeriv j D∞ = DSer_j as FUNCTIONS on (0,∞)?? — pointwise on (0,∞): the functions agree on (0,∞) — deriv at x ∈ (0,∞) only sees a nhd — use `EventuallyEq.deriv` with the nhd (0,∞) — or state the induction as: iteratedDeriv j D∞ =ᶠ[𝓝 x]-ish... simpler: prove `Set.EqOn (iteratedDeriv j D∞) DSer_j (Ioi 0)` by induction with the deriv-of-equal-on-open-set: if f = g on an open set containing x, deriv f x = deriv g x — `DifferentiableOn...deriv_eq`? — `Set.EqOn.deriv`? there's `DifferentiableOn.deriv` (used in LiResidue!) — `DifferentiableOn.deriv (h : DifferentiableOn) (hs : IsOpen)... : deriv f x = derivWithin f s x`? hmm — the EqOn version: `Set.EqOn.deriv_eq`? or derivWithin_congr_set... For open s and x ∈ s: deriv f x = derivWithin f s x (IsOpen) and EqOn gives derivWithin equal ✓ — `Set.EqOn.derivWithin_eq`? `Set.EqOn.derivWithin` : f = g on s → derivWithin f s x = derivWithin g s x — exists as `Set.EqOn.derivWithin` (with hx : x ∈ s? — derivWithin_eq? — `Set.EqOn.derivWithin_eq (h : EqOn f g s) (hx : x ∈ s)`? roughly). OK manageable.\n\nSo the induction structure:\n```lean\nlemma iteratedDeriv_Dinf (j : ℕ) (hj : 1 ≤ j) {x : ℝ} (hx : 0 < x) :\n    iteratedDeriv j Dinf x = (-1 : ℝ)^(j+1) * j ! * tsum (fun m : ℕ => (x + m)^(-(j+1) : ℤ))\n```\nHmm — the (x+m)^{−(j+1)} as zpow or 1/(x+m)^{j+1} — use 1/(x+m)^(j+1) (npow, positive base) ✓ cleaner in ℝ.\n\nThis is all real analysis, well-understood. The M-test uniform convergence lemma: for the series of functions Σ_m u_m(x) with |u_m(x)| ≤ M_m on a set and Σ M_m < ∞: partial sums converge uniformly on the set: `tendstoUniformlyOn_tsum`? — let me check the name: in TsumUniformlyOn.lean — `tendstoUniformlyOn_tsum (hu : Summable u) (hf : ∀ n x, x ∈ s → ‖f n x‖ ≤ u n)?`... something like that. Then locally-uniformly-on (Ioi 0) from uniform-on-every-compact: `tendstoLocallyUniformlyOn_of_...`? there's a way via Icc covers: (0,∞) = ⋃ Icc (1/k) k... `TendstoLocallyUniformlyOn` from uniform on compacts: `tendstoLocallyUniformlyOn_of_forall_compact`? hmm — there might be `tendstoLocallyUniformlyOn_iff_tendstoUniformlyOn_of_compact`? or prove via: for each x ∈ Ioi 0, take the ball/Icc [x/2, 2x] neighborhood — TendstoLocallyUniformlyOn unfolds to: for each x ∈ s, ∃ t ∈ 𝓝[s] x, TendstoUniformlyOn ... — take t := Icc (x/2) (2x) ∩ Ioi 0... it's in 𝓝[Ioi 0] x ✓ (relative nhd). OK.\n\nNow the Complex side:\n- D(s) := −γ − 1/s + Σ_{m≥1} (1/m − 1/(s+m)) for s : ℂ near 1/2 — analytic on a ball around 1/2 (radius < 1/2): the series of analytic functions, locally uniformly convergent (M-test: |1/m − 1/(s+m)| = |s|/(m|s+m|) — for |s − 1/2| ≤ 1/4: |s| ≤ 3/4, |s+m| ≥ m − |s| ≥ m − 3/4 ≥ m/4 (m ≥ 1) — so ≤ (3/4)/(m·m/4) = 3/m² ✓) — analytic via TendstoLocallyUniformlyOn.differentiableOn ✓ then analyticOnNhd? DifferentiableOn on an open ball ⟹ AnalyticOnNhd (Mathlib: `DifferentiableOn.analyticOnNhd`? — for ℂ: differentiableOn on open ⟹ analyticOnNhd — `DifferentiableOn.analyticOnNhd (h : DifferentiableOn ℂ f s) (hs : IsOpen s) : AnalyticOnNhd ℂ f s`? I believe exists ✓ (used somewhere?)).\n- D(↑x) = ↑(D∞ x) for real x ∈ (0,∞): the tsum of casts = cast of tsum (Summable ✓) via `Complex.ofReal_tsum`? name: `Complex.ofReal_tsum : ↑(∑' n, f n) = ∑' n, ↑(f n)`? — `map_tsum` with ofRealCLM: `map_tsum Complex.ofRealCLM ...`? hmm — there's `Complex.ofReal_tsum`? I'll find it.\n- digamma(↑x) = ↑(D∞ x): via ψ_real bridge (the Gamma_ofReal + ofReal-deriv lemmas).\n  - deriv (Complex.Gamma ∘ ofReal) x: HasDerivAt ofRealCLM... — ofReal as a CLM: Complex.ofRealCLM : ℝ →L[ℝ] ℂ — `Complex.ofRealCLM.hasDerivAt : HasDerivAt ofRealCLM (ofRealCLM 1) x`?? — hmm — ofRealCLM 1 = ↑1 = 1 — so HasDerivAt ofReal 1 x (`Complex.ofRealCLM_hasDerivAt`? or from LiPrincipal's usage: `Complex.ofRealCLM.hasDerivAt (x := x)` with ofRealCLM_apply — they got HasDerivAt (fun t : ℝ => (t:ℂ)) 1 x ✓). So deriv (fun x : ℝ => (↑(g x) : ℂ)) x with g : ℝ → ℝ: comp: HasDerivAt (↑∘g) (↑(g' x)·1)?? — the CLM-comp: HasDerivAt (↑) 1 (g x)... HasDerivAt.comp with ofRealCLM as the OUTER: ofRealCLM.hasDerivAt gives HasDerivAt ofRealCLM (ofRealCLM 1) (g x); then comp with hg : HasDerivAt g (g') x: HasDerivAt (ofReal ∘ g) ((ofRealCLM 1) • g')?? — order: HasDerivAt.comp (x) (hf : HasDerivAt f f' (g x)) (hg : HasDerivAt g g' x) : HasDerivAt (f ∘ g) x (g' • f')?? — for the CLM outer function... — this gives deriv (↑∘g) x = ↑(deriv g x) ✓ after pushing the smul. There might be a direct lemma `Complex.deriv_ofReal_comp`? or `ofReal_deriv`? — hmm: `Complex.ofReal_deriv`? Let me just plan on the comp dance (ofRealCLM.hasDerivAt + comp + push).\n- The identity principle: D = digamma on the ball around 1/2 — they agree on the real segment (1/4, 3/4) — the identity principle for analytic functions on a connected open set agreeing on a set with accumulation point: Mathlib: `AnalyticOnNhd.eq_on_of_preconnected_of_frequently_eq`? Let me look for the exact identity-principle name: `AnalyticOnNhd.eq_of_preconnected_of_frequently_eq`? or `AnalyticOnNhd.eq_of_frequently...`? — I'll grep at build time.\n- Then iteratedDeriv j D (1/2:ℂ) = the series termwise — the complex version of the M-test/deriv interchange: TendstoLocallyUniformlyOn.deriv ✓ iterated — for the complex functions this is cleaner (TendstoLocallyUniformlyOn.differentiableOn + .deriv both exist for ℂ ✓).\n- And iteratedDeriv j digamma (1/2:ℂ) = iteratedDeriv j D (1/2) via the eventual equality (D = digamma on the ball ⟹ =ᶠ[𝓝 (1/2)] ⟹ same iteratedDeriv at 1/2: `Filter.EventuallyEq.iteratedDeriv`?? — hmm — does that exist? `EventuallyEq.deriv_eq` : f =ᶠ[𝓝 x] g → deriv f x = deriv g x ✓ (used in LiResidue). For iterated: I can iterate: f =ᶠ[𝓝 x] g ⟹ deriv f =ᶠ[𝓝 x] deriv g (if both differentiable on a nhd — `Filter.EventuallyEq.deriv`? hmm — actually there's `Filter.EventuallyEq.deriv_eq` (pointwise) and for the iterated I need the eventuallyEq of the derived FUNCTIONS — `EventuallyEq.deriv`? hmm — I recall `Filter.EventuallyEq.deriv : f =ᶠ[𝓝 x] g → deriv f =ᶠ[𝓝 x] deriv g` — is that a thing? For ANALYTIC functions on an open set: f = g on a nhd of x ⟹ on that nhd derivs agree pointwise — formalize: the nhds contains a ball; on the ball f = g; so deriv f y = deriv g y for y in the ball (EventuallyEq.deriv_eq at each y ∈ ball — needs f =ᶠ[𝓝 y] g which holds since the ball is in the nhd ✓) — so deriv f =ᶠ[𝓝 x] deriv g ✓ — then iterate. I'll write a small helper: `eventuallyEq_iteratedDeriv : f =ᶠ[𝓝 x] g → (hf : AnalyticAt...) → iteratedDeriv n f x = iteratedDeriv n g x` — via induction using EventuallyEq.deriv_eq + the eventuallyEq of derivs on the nhd. There's likely `Filter.EventuallyEq.iteratedDeriv_eq`? or I'll build the induction.\n\nHmm OK — this is a LOT of moving parts. Let me estimate the Lean surface: ~400-500 lines with several infrastructure gambles. It's 22:30. This will span into next session anyway. Let me structure it as TWO Lean deliverables:\n- (A-i) j = 0 case (τ₀ = −a₁) — do TONIGHT (small, all ingredients verified).\n- (A-ii) j ≥ 1 — start the digamma-series infrastructure; whatever completes cleanly tonight gets committed; rest next session.\n\nActually — for (A-i): the τ₀ statement: iteratedDeriv 0 (fun s => logDeriv Gammaℝ (1+s)) 0 / 0! = logDeriv Gammaℝ 1 — so I need: logDeriv Gammaℝ 1 = −(log 4π + γ)/2 (as ℂ). Via the split: logDeriv Gammaℝ 1 = −(log π)/2 + (1/2)·digamma(1/2) — compute: logDeriv Gammaℝ 1 = deriv Gammaℝ 1 / Gammaℝ 1 = deriv Gammaℝ 1 (Gammaℝ_one : Gammaℝ 1 = 1 ✓). deriv Gammaℝ 1: Gammaℝ = π^{−s/2}·Γ(s/2): deriv at 1: deriv (π^{−s/2})·Γ(1/2) + π^{−1/2}·deriv(Γ(s/2)) at 1: = (−log π/2·π^{−1/2})·√π + π^{−1/2}·(Γ'(1/2)·(1/2)) = (−log π)/2 + (1/2)·(Γ'(1/2)/Γ(1/2))·(π^{−1/2}·√π) = −(log π)/2 + (1/2)·digamma(1/2) ✓. In Lean: the split lemma:\n\n```lean\nlemma logDeriv_Gammaℝ_one_add (s : ℂ) (hs : Gammaℝ (1 + s) ≠ 0) :\n    logDeriv Gammaℝ (1 + s) = -(Real.log π : ℂ)/2 + (1/2) * Complex.digamma ((1 + s)/2) := by\n  rw [Gammaℝ_def] at *  -- Gammaℝ w = π^(−w/2) * Gamma (w/2)\n  ...\n```\nlogDeriv (fun w => π^(−w/2) * Gamma (w/2)) (1+s) = logDeriv (π^(−·/2)) (1+s) + logDeriv (Gamma(·/2)) (1+s) via logDeriv_mul (needs both nonzero at the point ✓ π^{−(1+s)/2} ≠ 0 (cpow nonzero ✓ `Complex.cpow_ne_zero`? for real base π > 0 ✓) and Gamma((1+s)/2) ≠ 0 ✓ from hs and the π factor nonzero).\n- logDeriv (fun w => π^(−w/2)) (1+s): π^(−w/2) = Complex.cpow π (−w/2)... = exp(log π · (−w/2))... deriv: `Complex.deriv_const_cpow...`? Hmm — π^z with z = −w/2: hasDerivAt_const_cpow? — there's `Complex.hasDerivAt_const_cpow (x : ℂ) (c : ℂ)?: HasDerivAt (fun z => c^z) (c^z * log c) z`? for c real positive... Let me handle via exp: π^(−w/2) = exp (↑(log π)·(−w/2))... this is getting fiddly but standard.\n  Actually — simpler: (fun w => π^(−w/2)) = fun w => Complex.exp (−(Real.log π)/2 * w)?? π^(−w/2) = exp(−w/2 · log π) = exp(−(log π)/2 · w) ✓ — as a composition exp ∘ (c·w) — logDeriv = c (deriv exp = exp; cancels) = −(log π)/2 ✓:\n  logDeriv (fun w => Complex.exp (c * w)) (1+s) = (exp(c·(1+s))·c)/exp(c·(1+s)) = c — via deriv_exp ∘ comp_const_mul ✓ `Complex.deriv_exp` + `deriv_const_mul`... fine.\n  Need: π^(−w/2) = exp(−(log π)/2 · w): Complex.cpow π (−w/2) = exp(log π · (−w/2)) via `Complex.cpow_def_of_ne_zero`? — π as ℂ: (↑π)^z = exp(z·log ↑π) for z... `Complex.cpow_def_of_ne_zero (hx : x ≠ 0) : x^y = exp (log x * y)` ✓ — with x := ↑π ≠ 0 (π > 0 ✓); log ↑π = ↑(Real.log π) (`Complex.log_ofReal`? `Complex.ofReal_log`? — `Complex.log_ofReal`? there's `Complex.ofReal_log (hx : 0 ≤ x)? : log ↑x = ↑(Real.log x)`? something ✓). And −w/2 · log π = −(log π)/2 · w ✓ ring.\n- logDeriv (fun w => Gamma (w/2)) (1+s) = (Gamma'( (1+s)/2 )·(1/2))/Gamma((1+s)/2) = (1/2)·digamma((1+s)/2) ✓ via comp (deriv (w/2) = 1/2) ✓.\nSo logDeriv Gammaℝ (1+s) = −(log π)/2 + (1/2)·digamma((1+s)/2) ✓.\n\nAt s = 0: digamma(1/2) = −2log2 − γ (digamma_one_half ✓ — as ℂ: −2*log 2 − γ — the statement: `Complex.digamma_one_half : digamma (1/2) = -2 * log 2 - Real.eulerMascheroniConstant` — with casts: log 2 here is Complex.log? or Real cast? from the proof: `- 2 * log 2 - Real.eulerMascheroniConstant` — the `log 2` is Complex.log 2 = ↑(Real.log 2)? — since digamma_one_half's proof used `Gamma_one_half_eq, Real.sqrt_eq_rpow, ofReal_cpow` — the result's log 2 : probably ↑(Real.log 2) — I'll see when I use it.)\nSo logDeriv Gammaℝ 1 = −(log π)/2 + (1/2)(−2 log 2 − γ) = −(log π)/2 − log 2 − γ/2 — and lagariasA1 = (log(4π) + γ)/2 = (log 4 + log π + γ)/2 = (2 log 2 + log π + γ)/2 ✓ so −lagariasA1 = −(2log2 + log π + γ)/2 = −log 2 − (log π)/2 − γ/2 ✓✓ MATCHES.\n\nSo τ₀-statement: `logDeriv Complex.Gammaℝ 1 = -(lagariasA1 : ℂ)` — wait lagariasA1 is ℝ; the final assembly (ii′-3c) needs everything as ℂ (iteratedDerivs are ℂ). The a-form (4.10) has lcoeff (ℂ) and lagariasA (ℝ) and sigmaP (ℂ) — mixing — hmm — the final identity will need lagariasA coerced to ℂ. Let me define the τ-target as ℂ-valued with ↑(lagariasA (j+1)):\n\n**Piece (A) final theorem:**\n```lean\ntheorem iteratedDeriv_logDeriv_Gammaℝ_one_add (j : ℕ) :\n    iteratedDeriv j (fun s : ℂ => logDeriv Complex.Gammaℝ (1 + s)) 0 =\n      ((-1 : ℂ)) ^ (j + 1) * (j ! : ℂ) * (lagariasA (j + 1) : ℝ)\n```\nHmm wait — sign check: τ_j = (−1)^{j+1} a_{j+1} and iteratedDeriv j = j!·τ_j: for j = 0: iteratedDeriv 0 = the value = −a₁ ✓ (−1)^1·0!·a₁ = −a₁ ✓. For j ≥ 1: iteratedDeriv j (ΓR′/ΓR(1+·)) 0 = (1/2)·iteratedDeriv j (digamma((1+·)/2)) 0 = (1/2)·(1/2)^j·digamma^{(j)}(1/2) = (1/2)^{j+1}·(−1)^{j+1} j! Σ_{m≥0}(m+1/2)^{−(j+1)} = (1/2)^{j+1}·(−1)^{j+1} j!·2^{j+1}·lagariasA(j+1) = (−1)^{j+1} j!·lagariasA(j+1) ✓✓.\n\nThe cast (↑(lagariasA (j+1)) : ℂ) — or as an ℝ statement then cast? The iteratedDeriv is ℂ — so the statement is ℂ with the cast ✓.\n\nOK. For tonight, let me do the Gammaℝ logDeriv split + the j = 0 evaluation (small), and set up the file LiArchimedean.lean with the structure. The digamma series work continues next session.\n\nActually — wait. Let me reconsider the division of labor once more. The split lemma + j=0 are quick. The rest of (A) is the digamma series — let me at least START it tonight: the real series construction + M-test + the interchange application. Given the late hour, let me target: tonight = split + j=0 + the real-series definitions/summability lemmas; next session = the interchange + iterated + complex bridge + reindexing.\n\nLet me write LiArchimedean.lean Part 1 now: the Gammaℝ logDeriv split and the τ₀ evaluation. First check the names: Complex.cpow for π^(−s/2) in Gammaℝ_def — Gammaℝ s = π ^ (-s / 2) * Gamma (s / 2) — the π ^ (-s/2) is Complex.cpow (↑π) (−s/2) — with π : ℝ cast. For the logDeriv of the cpow factor, I'll rewrite as exp form. Names to check: `Complex.differentiableAt_Gamma` (for the quotient/deriv existence), `Complex.deriv_Gamma...`? — in Deriv.lean. Let me check Deriv.lean's contents quickly.","signature":""},{"type":"text","text":"All key bridges exist. Checking the Gamma derivative lemmas, then writing the archimedean file's first part."},{"type":"tool_use","id":"Bash_253","name":"Bash","input":{"command":"cd \"D:/Python/Quantum/zeta-23-lean/.lake/packages/mathlib\" && grep -n \"^theorem\\|^lemma\" Mathlib/Analysis/SpecialFunctions/Gamma/Deriv.lean | head -20","description":"List Gamma Deriv.lean contents"},"extra_content":null}]