← Session 33 — ii′-3b/3c crux + F-D finding; Lagarias letter package
thinking (51273 chars)
All confirmed:
- `zetaA := Function.update (fun w => (w - 1) * riemannZeta w) 1 1`; `zetaA_apply (hw : w ≠ 1) : zetaA w = (w−1)*riemannZeta w`.
- `logDeriv_Gammaℝ_one_add (hs : Gamma ((1+s)/2) ≠ 0) (hs2 : ∀ m, (1+s)/2 ≠ −m) : logDeriv Gammaℝ (1+s) = −(log π)/2 + (1/2)*digamma ((1+s)/2)`.
- `hLiExt_analyticAt_zero : AnalyticAt ℂ hLiExt 0`.
- `zetaA_ne_zero_near_one : ∀ᶠ w in 𝓝 1, zetaA w ≠ 0`.
- `zetaA_analyticAt_of_ne (hw : w ≠ 1) : AnalyticAt ℂ zetaA w`.
For deriv zetaA (1+s) — I need deriv of zetaA at the point 1+s (s ≠ 0). Via the EventuallyEq with (w−1)*ζ near 1+s: deriv zetaA (1+s) = deriv (fun w => (w−1)*riemannZeta w) (1+s) [EventuallyEq.deriv_eq] = ζ(1+s) + s·deriv ζ (1+s) [deriv_mul: deriv ((w−1)*ζ) = deriv(w−1)·ζ + (w−1)·deriv ζ; deriv (w−1) = 1].
deriv_mul: `deriv_mul (hf : DifferentiableAt 𝕜 f x) (hg : DifferentiableAt 𝕜 g x) : deriv (f * g) x = deriv f x * g x + f x * deriv g x`. With f = fun w => w−1, g = riemannZeta at x = 1+s: DifferentiableAt (w−1) ✓; differentiableAt_riemannZeta (h : s ≠ 1)? Signature: differentiableAt_riemannZeta {s : ℂ} (hs : s ≠ 1)? Used in LiMoments:210 as (differentiableAt_riemannZeta h1) with h1 : s ≠ 1. At 1+s: need 1+s ≠ 1 ⟺ s ≠ 0 ✓.
So deriv zetaA (1+s) = 1·ζ(1+s) + s·ζ′(1+s) — wait the functions: zetaA = update ... — the deriv of zetaA vs deriv of the underlying (w−1)*ζ: they agree on a punctured nbd of 1+s (zetaA_apply on eventually_ne_nhds). So:
```
have hzeq : (fun w : ℂ => (w - 1) * riemannZeta w) =ᶠ[𝓝 (1+s)] zetaA := by
filter_upwards [eventually_ne_nhds (show (1:ℂ)+s ≠ 1 from ...)] with z hz
exact (zetaA_apply hz).symm
have hderiv_zetaA : deriv zetaA (1 + s) = riemannZeta (1 + s) + s * deriv riemannZeta (1 + s) := by
rw [← hzeq.deriv_eq] -- deriv (fun w => (w−1)*ζ w) (1+s) = ...
-- hmm direction: hzeq.deriv_eq : deriv (fun w => (w−1)*ζ w) (1+s) = deriv zetaA (1+s)
rw [hzeq.deriv_eq] -- rewrites deriv zetaA (1+s) → deriv (fun w => (w−1)*ζ w) (1+s)
-- then deriv_mul
have hf : DifferentiableAt ℂ (fun w : ℂ => w - 1) (1 + s) := differentiableAt_id.sub_const 1
have hg : DifferentiableAt ℂ riemannZeta (1 + s) := differentiableAt_riemannZeta (by ...)
rw [deriv_mul hf hg]
have h1 : deriv (fun w : ℂ => w - 1) (1 + s) = 1 := by
rw [(hasDerivAt_id' (1+s)).sub_const 1 |>.deriv]; simp -- deriv (w−1) = 1−0 = 1
rw [h1]
ring
```
Note EventuallyEq.deriv_eq : f₁ =ᶠ[𝓝 x] f → deriv f₁ x = deriv f x — the probe shows {f f₁} with f₁ =ᶠ f giving deriv f₁ = deriv f. hzeq : (fun w => (w−1)*ζ w) =ᶠ zetaA, so hzeq.deriv_eq : deriv (fun w => (w−1)*ζ w) (1+s) = deriv zetaA (1+s). rw [← hzeq.deriv_eq]?? I want to rewrite `deriv zetaA (1+s)` (in my goal) to `deriv (fun w => (w−1)*ζ w) (1+s)`: that's rewriting with the equation RIGHT-to-LEFT: rw [← hzeq.deriv_eq] — since hzeq.deriv_eq : LHS = RHS with LHS = deriv (product), rewriting ← replaces RHS (deriv zetaA) by LHS (deriv product) ✓.
Then deriv_mul on the product: goal after ← rw: deriv (fun w => (w−1)*ζ w) (1+s) = ζ(1+s) + s*ζ′(1+s). Hmm — the product function as written: (fun w => (w - 1) * riemannZeta w) — pointwise mul of (fun w => w−1) and ζ. deriv_mul hf hg : deriv (f * g) x = ... where f * g is Pi.mul — the lambda (fun w => (w−1)*ζ w) is defeq to (fun w => w−1) * (fun w => ζ w)... rw [deriv_mul hf hg] needs syntactic match? deriv_mul's LHS is deriv (f * g) x with f g implicit — unifier against deriv (fun w => (w−1) * riemannZeta w) (1+s): HOU f := fun w => w−1, g := riemannZeta — Pi.mul defeq; rw unification might handle it (deriv_mul is a common rw). If it fails, bridge with a `show` or hsplit-rfl. Let me preemptively bridge:
```
have hsplit : (fun w : ℂ => (w - 1) * riemannZeta w) =
(fun w : ℂ => w - 1) * riemannZeta := rfl
rw [hsplit, deriv_mul hf hg]
```
✓ safe.
deriv (fun w => w−1) (1+s) = 1: ((hasDerivAt_id' (1+s)).sub_const 1).deriv : deriv (fun w => w−1) (1+s) = 1 − 0; simp closes? `rw [((hasDerivAt_id' (1 + s)).sub_const 1).deriv]` gives goal `1 - 0 = riemannZeta ...` hmm no — I structured: rw [h1] where h1 : deriv (fun w => w−1) (1+s) = 1. Then goal: 1 * ζ(1+s) + s * ζ′(1+s) = ζ(1+s) + s*ζ′(1+s) — ring? Wait the goal RHS I wrote was `riemannZeta (1+s) + s * deriv riemannZeta (1+s)`. After deriv_mul: deriv f·g + f·deriv g = 1·ζ(1+s) + ((1+s)−1)·ζ′(1+s) = ζ(1+s) + s·ζ′(1+s): ring ✓.
h1 : deriv (fun w : ℂ => w - 1) (1 + s) = 1:
```
have h1 : deriv (fun w : ℂ => w - 1) (1 + s) = 1 := by
have h := ((hasDerivAt_id' (1 + s)).sub_const 1).deriv
rw [h] -- goal becomes 1 - 0 = 1? no: h : deriv (fun w => w−1) (1+s) = 1 − 0; rw [h] changes goal to 1 − 0 = 1; norm_num/simp closes? rw auto-tries rfl: 1 − 0 = 1 is not rfl syntactically. Use: rw [h]; norm_num? or:
simpa using h
```
`simpa using h` ✓.
OK. Now also the (4.10-a) algebra assembly. Let me define the plan for the assembly lemma:
```
theorem lagarias_4_10_a (hZC : ZeroCountProp) {k : ℕ} (hk : 1 ≤ k) :
lcoeff (k - 1) = ((-1 : ℂ)) ^ k * ((lagariasA k : ℝ) + sigmaP k) + ((-1 : ℂ)) ^ (k - 1) := by
obtain ⟨m, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (by omega : k ≠ 0) -- k = m+1
```
Nat.exists_eq_succ_of_ne_zero : k ≠ 0 → ∃ m, k = m+1 ✓. Then k−1 = m (Nat.add_sub_cancel), (−1)^{k−1} = (−1)^m, lagariasA k = lagariasA (m+1), sigmaP k = sigmaP (m+1).
Goal: lcoeff m = (−1)^{m+1} · (a_{m+1} + sigmaP (m+1)) + (−1)^m.
Chain:
- hM := sigmaP_eq_neg_iteratedDeriv_gFun_div hZC (show 1 ≤ m+1 by omega) : sigmaP (m+1) = −iteratedDeriv m gFun 0 / (m! : ℂ). (k−1 with k = m+1: Nat.add_sub_cancel rewrites (m+1−1) → m ✓ need to rw.)
- hFE := iteratedDeriv_gFun_zero m : iteratedDeriv m gFun 0 = (−1)^{m+1} · iteratedDeriv m gFun 1.
- hExp := iteratedDeriv_gFun_one hZC m : iteratedDeriv m gFun 1 = (−1)^m·m! − m!·lcoeff m + (−1)^{m+1}·m!·a_{m+1}.
Substitute: sigmaP (m+1) = −[(−1)^{m+1}·((−1)^m·m! − m!·c_m + (−1)^{m+1}·m!·a_{m+1})]/m!.
Let me expand: −(−1)^{m+1}·(−1)^m·m! = −(−1)^{2m+1}·m! = −(−1)·m! = m!; −(−1)^{m+1}·(−m!·c_m) = (−1)^{m+1}·m!·c_m; −(−1)^{m+1}·(−1)^{m+1}·m!·a = −m!·a.
So sigmaP (m+1) = [m! + (−1)^{m+1}·m!·c_m − m!·a_{m+1}]/m! = 1 + (−1)^{m+1}·c_m − a_{m+1}.
Then (−1)^{m+1}·c_m = sigmaP (m+1) − 1 + a_{m+1}; c_m = (−1)^{m+1}·(sigmaP (m+1) + a_{m+1}) − (−1)^{m+1}·...
goal: c_m = (−1)^{m+1}(a_{m+1} + σ) + (−1)^m.
Check: (−1)^{m+1}·c_m = (−1)^{m+1}·[(−1)^{m+1}(a+σ) + (−1)^m] = (a+σ) + (−1)^{2m+1} = a + σ − 1 ✓ matches sigmaP = 1 + (−1)^{m+1}c − a rearranged. ✓
Lean assembly:
```
have hM := sigmaP_eq_neg_iteratedDeriv_gFun_div hZC (m + 1) (Nat.le_add_left 1 m)??
```
hmm signature: sigmaP_eq_neg_iteratedDeriv_gFun_div (hZC) {k} (hk : 1 ≤ k) — k implicit. So `sigmaP_eq_neg_iteratedDeriv_gFun_div hZC (k := m + 1) (by omega)`. Its statement: sigmaP (m+1) = −iteratedDeriv (m+1−1) gFun 0 / ((m+1−1)! : ℂ). rw [Nat.add_sub_cancel] at hM → sigmaP (m+1) = −iteratedDeriv m gFun 0 / (m! : ℂ).
Then `linear_combination`? The final goal is c_m = ...; the hyps are hM (σ = ...), hFE (G0 = ...), hExp (G1 = ...). The relation is purely linear-algebraic over ℂ IF we treat (−1)-powers correctly: the problem: linear_combination normalizes ring expressions; (−1)^{2m+1} etc. are ring-normalizable? (−1)^{m}·(−1)^{m+1} = (−1)^{2m+1} — ring can combine exponents: x^m * x^(m+1) = x^(2m+1) ✓ ring handles. And (−1)^{2m+1} = −1? ring does NOT evaluate that (−1)^{2m+1} = −1 — (−1)^{2m+1} is (−1)·((−1)^2)^m = (−1)·1^m = −1 — ring CAN do this? ring normalizes (−1)^{2m+1} as (−1)^{2m+1}... it doesn't simplify powers of −1 with variable exponents. Hmm. So the (−1)^{even} = 1 steps need manual lemmas:
hsign1 : ((-1:ℂ))^m * ((-1:ℂ))^m = 1:
```
have hsq : ∀ m : ℕ, ((-1:ℂ)) ^ m * ((-1:ℂ)) ^ m = 1 := by
intro m
rw [← pow_add, ← two_mul, pow_mul, show ((-1:ℂ))^2 = 1 by norm_num, one_pow]
```
hsign2 : ((-1:ℂ))^(m+1) * ((-1:ℂ))^m = -1: = (−1)^{2m+1}: rw [← pow_add, show m+1+m = 2*m+1 by ring, pow_add, pow_mul, show ((-1:ℂ))^2=1, one_pow, pow_one]... gives (−1)^1 = −1 ✓.
Then do the algebra via explicit rewrites + linear_combination with the sign haves as hypotheses... linear_combination can use haves: the identity needed:
From hM/hFE/hExp: σ = −((−1)^{m+1}·G1)/m! where G1 = (−1)^m·m! − m!·c + (−1)^{m+1}·m!·a.
Let me denote s := (−1:ℂ)^m, t := (−1:ℂ)^{m+1}. Then s·s = 1 (hsq), t·s = −1 (hsign2), t = −s? also t·t = 1: (−1)^{2m+2} = 1 ✓ (another instance of hsq with m+1).
σ = −(t·G1)/F where F = m!, G1 = s·F − F·c + t·F·a.
−t·G1 = −t·s·F + t·F·c − t·t·F·a = −(−1)·F + t·F·c − 1·F·a = F + t·F·c − F·a.
σ = (F + t·F·c − F·a)/F = 1 + t·c − a (F ≠ 0).
Goal: c = t·(a + σ) + s.
t·(a+σ) + s = t·a + t·σ + s = t·a + t·(1 + t·c − a) + s = t·a + t + t·t·c − t·a + s = t + c + s = c + (t + s) = c + 0 ✓ (t + s = (−1)^{m+1} + (−1)^m = 0).
linear_combination with hyps hM hFE hExp hsq hsign2 ht_s (t = −s or t+s=0): the issue is the DIVISION by F = (m! : ℂ). linear_combination handles field expressions? linear_combination works over commutative rings; ℂ is a field — linear_combination normalizes over fields? It uses ring_nf which handles division by atoms: σ = −(t·G1)/F — as an atom F with F⁻¹... The combination: goal c − (t·(a+σ) + s) = Σ coeff·(hyp_lhs − hyp_rhs). With hyp hM: σ + (t·G0)/F = 0... this gets messy with divisions.
Cleaner: clear denominators manually. F := (m ! : ℂ) ≠ 0 (Nat.cast_ne_zero.mpr (Nat.factorial_ne_zero m)). Multiply hM by F: F·σ = −G0·... hM : σ = −G0/F → F·σ = −G0 (field_simp or mul_div_cancel). Let me structure:
```
have hF : ((m ! : ℕ) : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.factorial_ne_zero m)
have hM := sigmaP_eq_neg_iteratedDeriv_gFun_div hZC (k := m + 1) (by omega)
rw [Nat.add_sub_cancel] at hM
have hM2 : (m ! : ℂ) * sigmaP (m + 1) = -iteratedDeriv m gFun 0 := by
rw [hM]
field_simp [hF] -- hmm: F * (−G0/F) = −G0: mul_neg_div?
```
F * (−G0 / F): −G0/F = −(G0/F) → F·(−(G0/F)) = −(F·(G0/F)) = −G0 via mul_div_cancel₀. field_simp [hF] should close `F * (−G0 / F) = −G0` outright (banked: field_simp closes goals). ✓
hFE : G0 = t·G1 (t := (−1)^{m+1}).
hExp : G1 = s·F − F·c + t·F·a where the actual form from iteratedDeriv_gFun_one: I'll state hExp's RHS as ((−1:ℂ))^m * (m ! : ℂ) − (m ! : ℂ) * lcoeff m + ((−1:ℂ))^(m+1) * (m ! : ℂ) * (lagariasA (m+1) : ℝ).
Then the goal: c = t·(a + σ) + s where c := lcoeff m, a := (lagariasA (m+1) : ℝ) cast to ℂ, σ := sigmaP (m+1), s := (−1)^m, t := (−1)^{m+1}.
linear_combination with:
- hM2 : F·σ = −G0
- hFE : G0 = t·G1
- hExp : G1 = s·F − F·c + t·F·a
- hsq : s·s = 1, htt : t·t = 1, hts : t·s = −1 (or t+s = 0)
Goal − target combo: c − (t·(a+σ) + s) =? combination of (hyp_lhs − hyp_rhs)'s.
Let me solve for coefficients α1..α6 over ℂ as rational functions in atoms F, c, a, σ, s, t, G0, G1 with relations:
(1) F·σ + G0 = 0 [hM2]
(2) G0 − t·G1 = 0 [hFE]
(3) G1 − s·F + F·c − t·F·a = 0 [hExp]
(4) s·s − 1 = 0 [hsq]
(5) t·t − 1 = 0 [htt]
(6) t·s + 1 = 0 [hts]
We want: c − t·a − t·σ − s.
Eliminate G0, G1: G0 = −F·σ (from 1); G1 = G0/t = −F·σ/t (from 2); (3): −F·σ/t − s·F + F·c − t·F·a = 0. Multiply by t: −F·σ·(t/t)−...: t·(−F·σ/t) = −F·σ (needs t ≠ 0...). This is where ring-normalization with the relation polys does it via Gröbner — linear_combination uses ring_nf with the given hypotheses as linear combos only (not Gröbner). linear_combination e: checks (goal_lhs − goal_rhs) − e = 0 via ring where e is a linear combination of hypothesis differences with CONSTANT coefficients (actually coefficients can be terms). The relations (4)-(6) are quadratic — usable as hyps multiplied by something: e.g. (t·s + 1)·X.
Let me directly find the combination:
Want: c − t·a − t·σ − s.
Start from (3): F·c = −G1 + s·F + t·F·a... hmm let me solve forward:
G1 = s·F − F·c + t·F·a [from 3]
G0 = t·G1 = t·s·F − t·F·c + t·t·F·a = (ts)F − t·F·c + (t²)F·a = −F − t·F·c + F·a [using 5,6]
(1): F·σ = −G0 = F + t·F·c − F·a ⟹ σ = 1 + t·c − a [÷F — as a ring identity: F·σ = F·(1 + t·c − a), need F ≠ 0 to divide — linear_combination can't divide! So multiply the GOAL by F and prove F·(goal) then... or accept goal with F:
Trick: prove F·c = F·(t·(a+σ)+s) then use mul_left_cancel₀ hF.
F·t·(a+σ) + F·s = F·t·a + F·t·σ + F·s.
F·t·σ = t·(F·σ) = t·(F + t·F·c − F·a) = t·F + t²·F·c − t·F·a = t·F + F·c − t·F·a.
Sum: F·t·a + (t·F + F·c − t·F·a) + F·s = F·c + F·(t+s) = F·c + F·0 = F·c ✓ (t+s = 0: hts' : t + s = 0).
So: F·c = F·t·a + F·t·σ + F·s — as a linear combination:
F·c − F·t·a − F·t·σ − F·s
= [F·t·σ − t·F − F·c + t·F·a side...]
Combination: goal' : F·c = F·(t·(a+σ)+s).
goal'_lhs − goal'_rhs = F·c − F·t·a − F·t·σ − F·s.
Hyps (as lhs−rhs): h1 := F·σ + G0, h2 := G0 − t·G1, h3 := G1 − s·F + F·c − t·F·a, h5 := t·t − 1, h6 := t·s + 1, hts' := t + s − 0.
Try: combo = α·h1 + β·h2 + γ·h3 + δ·h5 + ε·h6 + ζ·hts'.
We need to eliminate G0: α·G0 + β·G0 = 0 → β = −α.
Eliminate G1: −β·t·G1 + γ·G1 = 0 → γ = β·t = −α·t.
c terms: γ·F·c = c·(F coefficient): want F·c: −α·t·F·c = F·c → α = −1/t. Hmm t isn't invertible in the coefficient ring... but t·t = 1 so 1/t = t — but linear_combination coefficients are just terms; using α := −t is fine (it's a term):
α = −t: β = t; γ = t·t = t² (as a term (−(−1)^{m+1})·... whatever, terms fine).
Check: α·h1 = −t·F·σ − t·G0; β·h2 = t·G0 − t²·G1; γ·h3 = t²·G1 − t²·s·F + t²·F·c − t³·F·a.
Sum so far: −t·F·σ − t²·s·F + t²·F·c − t³·F·a.
Want: F·c − F·t·a − F·t·σ − F·s.
Difference (want − sum): F·c − F·t·a − F·s − [−t²·s·F + t²·F·c − t³·F·a]
= F·c·(1 − t²) − F·t·a·(1 − t²) − F·s·(1 − t²)... wait: −F·s − t²·s·F·(−1) = −F·s + t²·s·F = −F·s(1 − t²). And −F·t·a + t³·F·a = −F·t·a(1 − t²). And F·c − t²F·c = F·c(1−t²).
Difference = (1−t²)·(F·c − F·t·a − F·s) = −(t²−1)·F·(c − t·a − s) = −h5·F·(c − t·a − s)... hmm h5 = t²−1 (as lhs−rhs: t·t−1). So difference = −F·(c − t·a − s)·h5? That's circular (contains c). Hmm — that's wrong; linear combination must equal EXACTLY goal diff. Let me redo: I want goal_diff = combo. goal_diff = F·c − F·t·a − F·t·σ − F·s. I found combo(α..γ) = −t·F·σ − t²·s·F + t²·F·c − t³·F·a.
goal_diff − combo = F·c − F·t·a − F·s + t²·s·F − t²·F·c + t³·F·a
= F·c(1−t²) + F·a(t³−t) + F·s(t²−1)
= −(t²−1)·F·c + t(t²−1)·F·a + (t²−1)·F·s
= (t²−1)·F·(−c + t·a + s) — STILL contains c. Bad — the combo as chosen can't work with only these hyps; I need an additional term to kill the residual. Residual = (t²−1)·F·(−c + t·a + s). Hmm the c in the residual is the problem — need ANOTHER c-containing hyp. But all c info comes from h3...
I think the issue: I haven't used hts' (t+s=0) yet and made an arithmetic slip. Let me recompute carefully.
goal_diff = F·c − t·F·a − t·F·σ − s·F.
h1 := F·σ + G0 (i.e., lhs−rhs of hM2: F·σ − (−G0) = F·σ + G0)
h2 := G0 − t·G1
h3 := G1 − (s·F − F·c + t·F·a) = G1 − s·F + F·c − t·F·a
h5 := t·t − 1
h6 := t·s + 1
h7 := t + s
Choose combo = A·h1 + B·h2 + C·h3 + D·h5 + E·h6 + G·h7 where A..G are TERMS.
G0 coeff: A + B = 0 → B = −A.
G1 coeff: −t·B + C = 0 → C = t·B = −t·A.
σ coeff: F·A; goal has −t·F·σ → A = −t.
Then B = t, C = t·t = t².
c coeff: C·F·c = t²·F·c. Goal: F·c. Residual c: F·c·(1 − t²) — must be killed by D·h5: D·(t²−1)... h5 has no F: D·(t²−1) contributes D·t² − D. To cancel F·c·(1−t²): need D ⊇ −F·c·... D is a term — can include c! D := F·c? Then D·h5 = F·c·(t²−1) ✓ cancels the c residual.
a terms: combo: C·(−t·F·a) = −t³·F·a. Goal: −t·F·a. Residual: −t·F·a + t³·F·a = t·F·a·(t²−1) → killed by D·h5? D·h5 = F·c(t²−1) — different atom (c vs a). Not killed. Add to D: D := F·c + t·F·a? Then D·h5 = (F·c + t·F·a)(t²−1) ✓ kills both c and a residuals.
s terms: combo: C·(−s·F) = −t²·s·F. Goal: −s·F. Residual: −s·F + t²·s·F = s·F·(t²−1) → D += s·F.
t·σ: A·h1 gives −t·F·σ ✓ matches goal exactly.
Remaining: G·h7 + E·h6 — so far unused. Current total:
combo(A,B,C,D) = −t·(F·σ+G0) + t·(G0−t·G1) + t²·(G1−s·F+F·c−t·F·a) + (F·c+t·F·a+s·F)·(t²−1)
= −t·F·σ − t·G0 + t·G0 − t²·G1 + t²·G1 − t²·s·F + t²·F·c − t³·F·a + F·c·t² − F·c + t·F·a·t² − t·F·a + s·F·t² − s·F
= −t·F·σ − t²·s·F + t²·F·c − t³·F·a + t²·F·c − F·c + t³·F·a − t·F·a + t²·s·F − s·F
= −t·F·σ + 2t²·F·c − F·c − t·F·a − s·F.
goal_diff = F·c − t·F·a − t·F·σ − s·F.
combo − goal_diff = 2t²·F·c − 2F·c = 2F·c·(t²−1) — STILL a residual! I double-counted: t²·F·c appears twice (once from C·h3, once from D·h5's expansion). D·h5 = (F·c + t·F·a + s·F)·(t²−1) = F·c·t² − F·c + ... so total F·c terms: t²F·c (from C·h3) + t²F·c − F·c (from D·h5) = 2t²F·c − F·c. To get exactly F·c: I need the c-coefficient total = 1. Sources of F·c: C·h3 contributes C·F·c (atom-coeff C = t²); D·h5 contributes D_c·(t²−1) where D_c is the c-part of D. Total: t² + (t²−1)·(D_c/(F·c))... Let me parametrize D := u·F·c + v·t·F·a + w·s·F and solve:
F·c coeff: t² + u·(t²−1) = 1 → u·(t²−1) = 1−t² → u = −1. ✓ (as before)
F·a coeff: from C·h3: −t³; from D·h5: v·t·(t²−1) → total should be −t: −t³ + v·t·(t²−1) = −t → v·t·(t²−1) = t³−t = t(t²−1) → v = 1 ✓.
s·F coeff: from C·h3: −t²; from D·h5: w·(t²−1) → total −1: −t² + w·(t²−1) = −1 → w = 1 ✓.
So D := −F·c + t·F·a + s·F. Then:
combo = −t·h1 + t·h2 + t²·h3 + (−F·c + t·F·a + s·F)·h5
c total: t² + (−1)(t²−1) = t² − t² + 1 = 1 ✓
a total: −t³ + t(t²−1) = −t³ + t³ − t = −t ✓
s total: −t² + (t²−1) = −1 ✓
σ: −t ✓
And h6/h7 unused!
So: goal' (F·c = F·(t·(a+σ)+s)) follows by:
linear_combination (-t)·hM2 + t·hFE + t²·hExp + (−F·c + t·F·a + s·F)·ht_sq
where ht_sq : t*t = 1.
Then final step: c = t·(a+σ) + s via mul_left_cancel₀ hF:
```
have hgoal : (m ! : ℂ) * lcoeff m = (m ! : ℂ) * (((-1:ℂ))^(m+1) * ((lagariasA (m+1) : ℝ)) + sigmaP (m+1)) + ((-1:ℂ))^m) := by
linear_combination ...
```
Hmm wait — goal' RHS: F·(t·(a+σ) + s) = F·t·a + F·t·σ + F·s — the linear_combination goal must be stated in the multiplied form. Then:
```
exact mul_left_cancel₀ hF hgoal
```
where the final goal after the F-multiplied version: lcoeff m = t·(a+σ) + s — need hgoal : F·lcoeff m = F·(t·(a+σ)+s): but my linear_combination derivation has goal' LHS F·c and RHS F·t·a + F·t·σ + F·s — is F·(t·(a+σ)+s) ring-equal to that? Yes but the hypothesis form must match for mul_left_cancel₀: mul_left_cancel₀ : a ≠ 0 → a * b = a * c → b = c. hgoal's RHS must be literally F·(t·(a+σ)+s) — linear_combination closes goals up to RING equivalence, so stating hgoal with the factored RHS is fine ✓.
Then mul_left_cancel₀ hF hgoal : lcoeff m = t·(a+σ)+s — matches the final goal if stated in that form. The final goal after obtain ⟨m, rfl⟩: lcoeff (m+1−1) = (−1)^{m+1}·((lagariasA (m+1):ℝ) + sigmaP (m+1)) + (−1)^{m+1−1}: rw [Nat.add_sub_cancel] → lcoeff m = (−1)^{m+1}·(a+σ) + (−1)^m ✓.
Wait — the cast: (lagariasA k : ℝ) in my statement — lagariasA : ℕ → ℝ. In the goal over ℂ: (↑(lagariasA (m+1)) : ℂ)? I wrote the statement as `((-1 : ℂ)) ^ k * ((lagariasA k : ℝ) + sigmaP k)` — with (lagariasA k : ℝ) + sigmaP k : the + between ℝ and ℂ — needs a cast: elaborates as (↑(lagariasA k) + sigmaP k : ℂ) via coercion ✓ (same as iteratedDeriv_logDeriv_Gammaℝ's (lagariasA (j+1) : ℝ) in a ℂ product ✓).
And hExp (iteratedDeriv_gFun_one) produces (lagariasA (m+1) : ℝ) as a ℂ-cast factor ✓ consistent.
Now — sign identities needed:
- ht_sq : ((-1:ℂ))^(m+1) * ((-1:ℂ))^(m+1) = 1: via hsq-general lemma (m+1 instance).
- The linear_combination uses ONLY hM2, hFE, hExp, ht_sq — the hsq (s·s=1) and hts (t·s=−1) aren't needed per my derivation! Let me double check: in the combination I used h5 := t·t−1 only. ✓
Let me re-verify the expansion by hand one more time with actual atoms:
combo := (−t)·(F·σ + G0) + (t)·(G0 − t·G1) + (t²)·(G1 − s·F + F·c − t·F·a) + (−F·c + t·F·a + s·F)·(t² − 1)
Expand:
−t·F·σ − t·G0 + t·G0 − t²·G1 + t²·G1 − t²·s·F + t²·F·c − t³·F·a − F·c·t² + F·c + t·F·a·t² − t·F·a + s·F·t² − s·F
= −t·F·σ + 0 + 0 − t²·s·F + t²·F·c − t³·F·a − t²·F·c + F·c + t³·F·a − t·F·a + t²·s·F − s·F
= −t·F·σ + F·c − t·F·a − s·F ✓✓
= goal'_diff (F·c − t·F·a − t·F·σ − s·F) ✓
So linear_combination ((-(-1:ℂ)^(m+1)) * hM2 + ((-1:ℂ)^(m+1)) * hFE + ((-1:ℂ)^(m+1))^2 * hExp + (-(m!:ℂ)*lcoeff m + (-1:ℂ)^(m+1)*(m!:ℂ)*(lagariasA (m+1):ℝ) + (-1:ℂ)^m*(m!:ℂ)) * ht_sq)... careful with what t² means as a coefficient term: I can write the coefficient as ((-1:ℂ)^(m+1))^2 — ring will normalize. Actually simpler to write coefficients in s/t form and let ring_nf normalize — linear_combination accepts arbitrary terms as coefficients ✓.
Hmm wait — one subtlety: hExp (iteratedDeriv_gFun_one) has form G1 = s·F − F·c + t·F·a where the actual statement I'll prove is:
iteratedDeriv m gFun 1 = ((−1:ℂ))^m·(m!:ℂ) − (m!:ℂ)·lcoeff m + ((−1:ℂ))^{m+1}·(m!:ℂ)·(lagariasA (m+1):ℝ)
so h3 := G1 − s·F + F·c − t·F·a ✓ matches (as lhs−rhs: G1 − (s·F − F·c + t·F·a) = G1 − s·F + F·c − t·F·a ✓ ring-normalizes).
And hFE : G0 = t·G1 — my iteratedDeriv_gFun_zero states: iteratedDeriv m gFun 0 = ((−1:ℂ))^(m+1) * iteratedDeriv m gFun 1 ✓ (h2 := G0 − t·G1 ✓).
And hM2 : (m!:ℂ)·sigmaP (m+1) = −iteratedDeriv m gFun 0 (h1 := F·σ + G0 ✓).
ht_sq : ((−1:ℂ))^(m+1) * ((−1:ℂ))^(m+1) = 1:
```
have ht_sq : ((-1:ℂ)) ^ (m + 1) * ((-1:ℂ)) ^ (m + 1) = 1 := by
rw [← pow_add, show (m + 1) + (m + 1) = 2 * (m + 1) by ring, pow_mul,
show ((-1:ℂ)) ^ 2 = 1 by norm_num, one_pow]
```
Now remaining sub-lemmas to build:
(1) `iteratedDeriv_gFun_zero` (FE relation) — via hid + iteratedDeriv_comp_const_sub + iteratedDeriv_neg.
(2) `gFun_one_add_eventuallyEq` — the punctured logDeriv algebra + continuity upgrade.
(3) `iteratedDeriv_gFun_one` — comp_add_const + congr + add splits + 3 pieces (zpow, hLiExt, logDeriv_Gammaℝ — wait no: the third piece value comes from iteratedDeriv_logDeriv_Gammaℝ directly! I don't need ContDiffAt of the third piece for its VALUE — but I DO need ContDiffAt for the iteratedDeriv_add splits).
(4) `lagarias_4_10_a` — the linear_combination assembly.
(5) The crux `sf_eq_resW1`.
For (3)'s splits: ContDiffAt of:
- (fun s => (1+s)⁻¹): analyticAt at 0: (analyticAt_const.add analyticAt_id)... write as 1/(1+s): analyticAt_const.div (analyticAt_const.add analyticAt_id) (by norm_num : (1:ℂ)+0 ≠ 0). Wait 1+s at s=0 is 1+0; analyticAt_const.div h1 h2 where h1 : AnalyticAt (fun _ => 1), h2 : AnalyticAt (fun s => 1+s) 0, and (1+0) ≠ 0. ✓ .contDiffAt.
- hLiExt: hLiExt_analyticAt_zero.contDiffAt ✓.
- (fun s => logDeriv Gammaℝ (1+s)): use ContDiffAt.congr_of_eventuallyEq with the digamma form? OR build AnalyticAt directly: AnalyticAt ℂ (fun s => logDeriv Gammaℝ (1+s)) 0 — logDeriv Gammaℝ at 1: (analyticAt Gammaℝ 1).deriv.div (analyticAt Gammaℝ 1) (Gammaℝ_one ▸ ne). AnalyticAt Gammaℝ at 1: hmm — is there a direct lemma? `Complex.analyticAt_Gammaℝ`? Not sure. Alternative: differentiableAt_Gammaℝ_of_not_neg_nat gives DifferentiableAt at points s with ∀ m, s/2 ≠ −m? — DifferentiableAt on an open set ⟹ AnalyticOnNhd: the pattern used for xiL: (differentiable_xiL.differentiableOn.analyticOnNhd isOpen_univ). For Gammaℝ: need DifferentiableOn ℂ Gammaℝ (ball 1 (1/2)) say — every point of ball 1 (1/2) has the not-neg-nat property: for w ∈ ball 1 (1/2): w/2 ∈ ball (1/2) (1/4): re(w/2) > 1/4 > 0 ≥ −m... re(w/2) > 0 ⟹ w/2 ≠ −(m:ℂ) for all m (re(−m) = −m ≤ 0). Hmm wait — differentiableAt_Gammaℝ_of_not_neg_nat's hypothesis: let me check its signature (in LiCircleBound). Then:
```
have hG_an : AnalyticAt ℂ Complex.Gammaℝ 1 := by
have hd : DifferentiableOn ℂ Complex.Gammaℝ (Metric.ball 1 (1/2)) := by
intro w hw
apply (differentiableAt_Gammaℝ_of_not_neg_nat ?_).differentiableWithinAt
intro m
-- w/2 ≠ −m since re(w/2) > 0
...
exact (hd.analyticOnNhd Metric.isOpen_ball) 1 (Metric.mem_ball_self (by norm_num))
```
Hmm — wait, actually differentiableAt_Gammaℝ_of_not_neg_nat's hypothesis was about s/2 (in LiMoments line 188-189: `differentiableAt_Gammaℝ_of_not_neg_nat hhalf` with hhalf : ∀ m : ℕ, s / 2 ≠ -(m : ℂ)). ✓. Then:
logDeriv Gammaℝ at 1: (hG_an.deriv).div hG_an (by rw [Complex.Gammaℝ_one]; norm_num) : AnalyticAt (fun w => deriv Gammaℝ w / Gammaℝ w) 1 — and logDeriv Gammaℝ = fun w => deriv Gammaℝ w / Gammaℝ w — is that the def? logDeriv f = deriv f / f — yes `logDeriv : (𝕜 → 𝕜') → 𝕜 → 𝕜' := fun f x => deriv f x / f x` — actually logDeriv f x = f⁻¹ * deriv? No: `logDeriv f x = deriv f x / f x`? In Mathlib: logDeriv f = fun x => deriv f x / f x. Hmm — logDeriv_apply : logDeriv f x = deriv f x / f x? There's `logDeriv_apply : logDeriv f a = (deriv f a)/(f a)`? gFun_continuousAt wrote it as ((analyticAt_xiL s).deriv).div (analyticAt_xiL s) hs : AnalyticAt (fun x => deriv xiL x / xiL x)? and then .continuousAt : ContinuousAt gFun s — defeq between gFun = logDeriv xiL and fun x => deriv xiL x / xiL x ✓ (used defeq assignment at line 252). ✓ Same pattern works for Gammaℝ.
Then comp with (1+·): AnalyticAt.comp with (analyticAt_const.add analyticAt_id) : AnalyticAt (fun s => logDeriv Gammaℝ (1+s)) 0 — via AnalyticAt.comp_of_eq (h at 1+0 = 1) pattern or AnalyticAt.comp (h1 : AnalyticAt f (g 0)) (h2 : AnalyticAt g 0) : AnalyticAt (f ∘ g) 0 then rfl-bridge:
```
have h1 : AnalyticAt ℂ (fun w : ℂ => deriv Complex.Gammaℝ w / Complex.Gammaℝ w) 1 := ...
have h2 : AnalyticAt ℂ (fun s : ℂ => 1 + s) 0 := analyticAt_const.add analyticAt_id
have h3 := h1.comp_of_eq h2 (by norm_num : (1:ℂ) + 0 = 1)
have heq : ((fun w : ℂ => deriv Complex.Gammaℝ w / Complex.Gammaℝ w) ∘ fun s : ℂ => 1 + s) =
fun s => logDeriv Complex.Gammaℝ (1 + s) := rfl
rw [heq] at h3
exact h3.contDiffAt
```
AnalyticAt.comp_of_eq signature — used at LiArchimedean:152: `hG.comp_of_eq haffine (by show (1 + (0:ℂ))/2 = 1/2; ring)` ✓.
Is ((fun w => deriv Gammaℝ w / Gammaℝ w) ∘ (fun s => 1+s)) = fun s => logDeriv Gammaℝ (1+s) rfl? logDeriv Gammaℝ (1+s) unfolds to deriv Gammaℝ (1+s)/Gammaℝ (1+s) — and the comp beta-reduces to that ✓ rfl (logDeriv is a def; defeq by delta+beta ✓).
Hmm — is logDeriv REALLY fun f x => deriv f x / f x? Check: Mathlib's `logDeriv (f : 𝕜 → 𝕜') (a : 𝕜) : 𝕜' := deriv f a / f a`? I recall `logDeriv f a = (f a)⁻¹ * deriv f a`?? No — logDeriv_apply : logDeriv f a = deriv f a / f a. Let me trust the gFun_continuousAt usage: ((analyticAt_xiL s).deriv).div (analyticAt_xiL s) hs was assigned to ContinuousAt gFun s via defeq ✓ — AnalyticAt.div produces fun x => f x / g x (f/g pointwise = div) ✓. So yes.
(2) gFun_one_add_eventuallyEq — the big punctured algebra. Structure:
```
lemma gFun_one_add_punctured :
∀ᶠ s in 𝓝[≠] (0 : ℂ), gFun (1 + s) =
(1 + s)⁻¹ + hLiExt s + logDeriv Complex.Gammaℝ (1 + s) := by
-- eventually facts on 𝓝[≠] 0:
-- s ≠ 0 (self_mem_nhdsWithin)
-- zetaA (1+s) ≠ 0 eventually (zetaA_ne_zero_near_one comp tendsto (1+s)→1)
-- s ≠ −1 eventually (eventually_ne_nhds : 0 ≠ −1)
-- Gammaℝ (1+s) ≠ 0 eventually (Gammaℝ 1 = 1, continuity)
-- ζ(1+s) ≠ 0 from zetaA (1+s) = s·ζ(1+s), s ≠ 0
filter_upwards [self_mem_nhdsWithin, hZA, hne1, hΓ] with s hs0 hZAs hs1 hΓs
-- main algebra:
have hζs : riemannZeta (1 + s) ≠ 0 := by
intro hζ
have e := zetaA_apply (show (1:ℂ)+s ≠ 1 by ...)
rw [hζ, mul_zero] at e -- hmm e : zetaA (1+s) = s * ζ(1+s) = 0...
```
wait zetaA_apply (hw : w ≠ 1): zetaA (1+s) = ((1+s)−1)·ζ(1+s) = s·ζ(1+s). rw [hζ, mul_zero] at e: e : zetaA (1+s) = s * 0?? No: e : zetaA (1+s) = ((1+s)−1)*riemannZeta (1+s); rw [hζ] at e → zetaA (1+s) = ((1+s)−1)*0; mul_zero → zetaA (1+s) = 0 → hZAs e. ✓ (the (1+s)−1 needs simplifying? mul_zero matches _*0 ✓ regardless.)
Then:
```
have hs1' : (1:ℂ) + s ≠ 1 := by
intro h
have h2 : s = 0 := by linear_combination h
exact hs0 h2
have hs0' : (1:ℂ) + s ≠ 0 := by
intro h
apply hs1 -- hs1 : s ≠ -1
linear_combination h
-- xiL product form near 1+s
have hopen : IsOpen ({0}ᶜ ∩ {1}ᶜ : Set ℂ) := isOpen_compl_singleton.inter isOpen_compl_singleton
have hexp : xiL =ᶠ[𝓝 (1 + s)] (fun t => (t * (t - 1) / 2) * completedRiemannZeta t) := by
filter_upwards [hopen.mem_nhds ⟨hs0', hs1'⟩] with t ht
exact xiL_eq_mul ht.1 ht.2
have hΓdiff : DifferentiableAt ℂ Complex.Gammaℝ (1 + s) :=
differentiableAt_Gammaℝ_of_not_neg_nat (fun m => ...) -- need ∀ m, (1+s)/2 ≠ −m
```
Hmm — differentiableAt_Gammaℝ_of_not_neg_nat's hypothesis form: in LiMoments:159-170 good_half_ne_neg_nat produces ∀ m : ℕ, s/2 ≠ −(m:ℂ) from (s ≠ 0, ∀ n ≥ 1, s ≠ −2n). Here at point 1+s: need ∀ m, (1+s)/2 ≠ −(m:ℂ): since s near 0, (1+s)/2 near 1/2, re > 0 eventually. So include in the eventually facts: ∀ᶠ s in 𝓝 0, ∀ m : ℕ, (1+s)/2 ≠ −(m:ℂ) — via the re > 0 open-set argument (like LiArchimedean:165-182). Then:
- hΓdiff : DifferentiableAt Gammaℝ (1+s) ✓
- also needed for logDeriv Gammaℝ — fine.
- hΓ0 : Gammaℝ (1+s) ≠ 0 — from the eventually hΓ (continuity at Gammaℝ 1 = 1).
have hΛeq : completedRiemannZeta =ᶠ[𝓝 (1+s)] (fun t => Complex.Gammaℝ t * riemannZeta t) := by
filter_upwards [hΓdiff.continuousAt.eventually_ne hΓ0, eventually_ne_nhds hs0'] with t htΓ ht0
rw [riemannZeta_def_of_ne_zero ht0]
field_simp [htΓ]
(same as gFun_eq_momentB's hΛeq.)
have hlog : logDeriv xiL (1 + s) = logDeriv (fun t => (t * (t - 1) / 2) * completedRiemannZeta t) (1 + s) := by
rw [logDeriv_apply, logDeriv_apply, hexp.deriv_eq, hexp.eq_of_nhds]
-- goal: gFun (1+s) = (1+s)⁻¹ + hLiExt s + logDeriv Gammaℝ (1+s)
-- gFun (1+s) = logDeriv xiL (1+s) by rfl/defeq — use `show`:
show logDeriv xiL (1 + s) = _ -- defeq unfold of gFun
rw [hlog]
-- logDeriv_mul splits (mirror gFun_eq_momentB):
have hP : DifferentiableAt ℂ (fun t : ℂ => t * (t - 1) / 2) (1 + s) := ...
have hΛ : DifferentiableAt ℂ completedRiemannZeta (1 + s) := differentiableAt_completedZeta hs0' hs1'
have hP0 : (1 + s) * ((1 + s) - 1) / 2 ≠ 0 := div_ne_zero (mul_ne_zero hs0' (sub_ne_zero.mpr hs1')) two_ne_zero
have hΛ0 : completedRiemannZeta (1 + s) ≠ 0 := by
rw [Ne, RvM.completedRiemannZeta_eq_zero_iff]
rintro h
exact hζs h.1
rw [logDeriv_mul (f := fun t : ℂ => t * (t - 1) / 2) (g := completedRiemannZeta) _ hP0 hΛ0 hP hΛ]
-- hPlog at 1+s: logDeriv (t(t−1)/2) (1+s) = 1/(1+s) + 1/s
have hPlog : logDeriv (fun t : ℂ => t * (t - 1) / 2) (1 + s) = 1 / (1 + s) + 1 / s := by
rw [logDeriv_apply]
have hderiv : deriv (fun t : ℂ => t * (t - 1) / 2) (1 + s) = (1 + s) - 1 / 2 := by
have h2' : HasDerivAt (fun t : ℂ => t * (t - 1) / 2) ((1 * ((1+s) - 1) + (1+s) * 1) / 2) (1+s) :=
((hasDerivAt_id' (1+s)).mul ((hasDerivAt_id' (1+s)).sub_const 1)).div_const 2
rw [h2'.deriv]
ring
rw [hderiv]
field_simp [hs0', hs0] -- hmm: ((1+s) − 1/2) / ((1+s)·s/2) = 1/(1+s) + 1/s
ring
rw [hPlog]
```
Wait — careful: hPlog's target: logDeriv ... = 1/(1+s) + 1/s. logDeriv_apply gives deriv/value: ((1+s) − 1/2)/((1+s)((1+s)−1)/2). (1+s)−1 = s. field_simp [hs0', hs0]: need (1+s) ≠ 0 ✓ hs0', s ≠ 0 ✓ hs0 (hs0 : s ≠ 0 from self_mem_nhdsWithin). Also the value (1+s)((1+s)−1)/2 has (1+s)−1 which needs rewriting to s for field_simp to see s... field_simp might handle (1+s)−1 as atom ≠ 0: sub_ne_zero.mpr hs1' : (1+s)−1 ≠ 0 ✓ — pass that too: field_simp [hs0', sub_ne_zero.mpr hs1']. Then ring. But then the result is in terms of (1+s)−1: 1/(1+s) + 1/((1+s)−1)?? My target says 1/s — hmm: target RHS 1/(1+s) + 1/s; the computed LHS after field_simp: ((1+s) − 1/2)·2 = ((1+s)·((1+s)−1))·(1/(1+s) + 1/s)? ring normalizes both sides treating (1+s) and s and ((1+s)−1) as atoms — 1/((1+s)−1) vs 1/s are DIFFERENT atoms! ring won't know (1+s)−1 = s. Fix: rewrite (1+s)−1 = s first: have es : (1+s)−1 = s := by ring; rw [es] at the value spots... The expression: deriv-value/func-value where func-value = (1+s)*((1+s)−1)/2. rw [show ((1:ℂ)+s)−1 = s by ring] — rewrites (1+s)−1 → s. Then field_simp [hs0', hs0], ring ✓.
-- hlogΛ at 1+s:
have hlogΛ : logDeriv completedRiemannZeta (1 + s) =
logDeriv Complex.Gammaℝ (1 + s) + logDeriv riemannZeta (1 + s) := by
have heq : logDeriv completedRiemannZeta (1 + s) =
logDeriv (fun t => Complex.Gammaℝ t * riemannZeta t) (1 + s) := by
rw [logDeriv_apply, logDeriv_apply, hΛeq.deriv_eq, hΛeq.eq_of_nhds]
rw [heq, logDeriv_mul (f := Complex.Gammaℝ) (g := riemannZeta) _ hΓ0 hζs hΓdiff
(differentiableAt_riemannZeta hs1')]
rw [hlogΛ]
-- now: 1/(1+s) + 1/s + (logDeriv Gammaℝ (1+s) + logDeriv riemannZeta (1+s)) = (1+s)⁻¹ + hLiExt s + logDeriv Gammaℝ (1+s)
-- the hLiExt identity:
have hE : hLiExt s = 1 / s + logDeriv riemannZeta (1 + s) := by
rw [hLiExt_of_ne hs0]
-- (1 − hLi (1+s))/s = 1/s + logDeriv ζ (1+s)
have hh : hLi (1 + s) = 1 - s * (deriv zetaA (1 + s) / zetaA (1 + s)) := by
rw [hLi]
congr 1
ring -- (1+s)−1 = s
rw [hh]
-- (1 − (1 − s·X))/s = X
have hX : (1 - (1 - s * (deriv zetaA (1 + s) / zetaA (1 + s)))) / s =
deriv zetaA (1 + s) / zetaA (1 + s) := by
field_simp [hs0]
rw [hX]
-- deriv zetaA (1+s)/zetaA (1+s) = 1/s + logDeriv ζ (1+s)
have hzA_ne : zetaA (1 + s) ≠ 0 := hZAs
have hzeq : (fun w : ℂ => (w - 1) * riemannZeta w) =ᶠ[𝓝 (1 + s)] zetaA := by
filter_upwards [eventually_ne_nhds hs1'] with z hz
exact (zetaA_apply hz).symm
have hderiv_zetaA : deriv zetaA (1 + s) =
riemannZeta (1 + s) + s * deriv riemannZeta (1 + s) := by
rw [← hzeq.deriv_eq]
have hsplit : (fun w : ℂ => (w - 1) * riemannZeta w) =
(fun w : ℂ => w - 1) * riemannZeta := rfl
rw [hsplit, deriv_mul (differentiableAt_id.sub_const 1) (differentiableAt_riemannZeta hs1')]
have h1 : deriv (fun w : ℂ => w - 1) (1 + s) = 1 := by
simpa using ((hasDerivAt_id' (1 + s)).sub_const 1).deriv
rw [h1]
ring_nf -- 1·ζ + ((1+s)−1)·ζ′ = ζ + s·ζ′: ring might not simplify (1+s)−1 → s inside atoms... (1+s)−1 appears as a factor: ((1+s)−1)·ζ′; ring normalizes (1+s)−1 to s ✓ (sub is ring op) ✓ plain ring works: 1*X + (1+s−1)*Y = X + s*Y ✓ ring.
rw [hderiv_zetaA, zetaA_apply hs1']
-- (ζ + s·ζ′)/(s·ζ) = 1/s + ζ′/ζ
rw [logDeriv_apply]
field_simp [hs0, hζs]
ring
rw [hE]
-- final: 1/(1+s) + 1/s + (Γ + Z) = (1+s)⁻¹ + (1/s + Z) + Γ
rw [one_div]
ring
```
Wait — at the end after rw [hPlog, hlogΛ, hE], goal: 1/(1+s) + 1/s + (logDeriv Gammaℝ (1+s) + logDeriv riemannZeta (1+s)) = (1+s)⁻¹ + (1/s + logDeriv riemannZeta (1+s)) + logDeriv Gammaℝ (1+s). rw [one_div] converts 1/(1+s) → (1+s)⁻¹... and also 1/s → s⁻¹ (both sides — consistent). Then ring ✓.
Hmm wait — order issue: the goal BEFORE rw [hE] is `1/(1+s) + 1/s + (Γ + Z) = (1+s)⁻¹ + hLiExt s + Γ`. rw [hE] rewrites hLiExt s → 1/s + Z: RHS becomes (1+s)⁻¹ + (1/s + Z) + Γ ✓. rw [one_div]: rewrites the FIRST 1/? occurrence — 1/(1+s) on LHS → (1+s)⁻¹. Only first unifier + all identical instances: 1/(1+s) and 1/s are different. RHS already has (1+s)⁻¹ and 1/s. So need one_div applied to 1/(1+s) only... rw [one_div] first match: 1/(1+s)? Term traversal: LHS first ✓ likely. But 1/s also matches 1/?x pattern with x := s — different instance, not rewritten by the same rw. So after rw [one_div]: LHS (1+s)⁻¹ + 1/s + (Γ+Z), RHS (1+s)⁻¹ + (1/s + Z) + Γ. ring ✓ closes.
Alternatively skip one_div: state the lemma's RHS with 1/(1+s) instead of (1+s)⁻¹! The iteratedDeriv piece for (1+s)⁻¹ — I'll use the zpow lemma which produces... let me keep the RHS as `1 / (1 + s)` everywhere and for the derivative piece: iteratedDeriv m (fun s => 1/(1+s)) 0 = (−1)^m·m!: via the zpow lemma with the one_div bridge:
```
have hpiece1 : iteratedDeriv m (fun s : ℂ => 1 / (1 + s)) 0 = ((-1:ℂ))^m * (m ! : ℂ) := by
have e : (fun s : ℂ => 1 / (1 + s)) = fun s : ℂ => (s + 1) ^ (-1 : ℤ) := by
funext s
rw [zpow_neg_one, one_div]
congr 1
ring -- 1+s = s+1
rw [e, iteratedDeriv_zpow_neg_one m 1 (by norm_num : (0:ℂ) + 1 ≠ 0)]
rw [zero_add, one_zpow, mul_one] -- (0+1)^(−m−1) = 1
```
iteratedDeriv_zpow_neg_one m c hs : iteratedDeriv m (fun s => (s+c)^(−1:ℤ)) s = (−1)^m·m!·(s+c)^(−m−1). At s = 0, c = 1: (−1)^m·m!·(0+1)^(−(m:ℤ)−1). rw [zero_add]: (1:ℂ)^(−(m:ℤ)−1); one_zpow: 1. mul_one ✓. Result: (−1)^m · m! · 1 → after mul_one: (−1)^m·m! ✓.
So state the eventuallyEq RHS as `1 / (1 + s) + hLiExt s + logDeriv Complex.Gammaℝ (1 + s)` — no ⁻¹ anywhere, no one_div needed... but the hPlog gives 1/(1+s) directly ✓ and final ring: 1/(1+s) + 1/s + (Γ+Z) = 1/(1+s) + (1/s+Z) + Γ — pure associativity/commutativity ring ✓ no inverses needed.
(3) iteratedDeriv_gFun_one:
```
lemma iteratedDeriv_gFun_one (hZC : ZeroCountProp) (m : ℕ) :
iteratedDeriv m gFun 1 =
((-1:ℂ))^m * (m ! : ℂ) - (m ! : ℂ) * lcoeff m +
((-1:ℂ))^(m+1) * (m ! : ℂ) * (lagariasA (m+1) : ℝ) := by
have hcomp := congr_fun (iteratedDeriv_comp_add_const m gFun (1 : ℂ)) 0
rw [zero_add] at hcomp
-- hcomp : iteratedDeriv m (fun z => gFun (z + 1)) 0 = iteratedDeriv m gFun 1
rw [← hcomp]
-- goal: iteratedDeriv m (fun z => gFun (z+1)) 0 = RHS
have e0 : (fun z : ℂ => gFun (z + 1)) = fun s : ℂ => gFun (1 + s) :=
funext fun s => by rw [add_comm]
rw [e0, iteratedDeriv_congr_of_eventuallyEq (gFun_one_add_eventuallyEq hZC) m]
-- split into the three pieces
have h1 : ContDiffAt ℂ m (fun s : ℂ => 1 / (1 + s)) 0 := by
have ha : AnalyticAt ℂ (fun s : ℂ => 1 / (1 + s)) 0 :=
analyticAt_const.div (analyticAt_const.add analyticAt_id) (by norm_num)
exact ha.contDiffAt
have h2 : ContDiffAt ℂ m hLiExt 0 := hLiExt_analyticAt_zero.contDiffAt
have h3 : ContDiffAt ℂ m (fun s : ℂ => logDeriv Complex.Gammaℝ (1 + s)) 0 := ...
have hsplit : (fun s : ℂ => 1 / (1 + s) + hLiExt s + logDeriv Complex.Gammaℝ (1 + s)) =
(fun s : ℂ => 1 / (1 + s)) + hLiExt + (fun s : ℂ => logDeriv Complex.Gammaℝ (1 + s)) := rfl
rw [hsplit, iteratedDeriv_add (h1.add h2) h3, iteratedDeriv_add h1 h2]
rw [hpiece1, iteratedDeriv_hLiExt m, iteratedDeriv_logDeriv_Gammaℝ m]
ring -- assemble: (−1)^m·m! + (−m!·lcoeff m) + (−1)^{m+1}·m!·a = RHS ✓ ring
```
Wait — iteratedDeriv_hLiExt m : iteratedDeriv m hLiExt 0 = −(m!:ℂ)*lcoeff m ✓ matches the middle term.
iteratedDeriv_logDeriv_Gammaℝ m : ... = (−1)^{m+1}·m!·↑(lagariasA (m+1)) ✓.
Sum: (−1)^m·m! + (−(m!·c)) + (−1)^{m+1}·m!·a — goal RHS: (−1)^m·m! − m!·c + (−1)^{m+1}·m!·a ✓ ring closes.
Also — the eventuallyEq statement's RHS must match hsplit's LHS: my gFun_one_add_eventuallyEq RHS: fun s => 1/(1+s) + hLiExt s + logDeriv Gammaℝ (1+s) ✓ and hsplit claims that lambda = Pi-add form by rfl ✓.
And `gFun_one_add_eventuallyEq` (the upgraded full-nhd version) as described: punctured + continuity + eq_of_eventuallyEq_nhd_ne + by_cases.
Continuity at 0 of the RHS:
```
have hGcont : ContinuousAt (fun s : ℂ => 1 / (1 + s) + hLiExt s + logDeriv Complex.Gammaℝ (1 + s)) 0 := by
have hc1 : ContinuousAt (fun s : ℂ => 1 / (1 + s)) 0 := by
apply ContinuousAt.div continuousAt_const (continuousAt_const.add continuousAt_id)
norm_num
have hc2 : ContinuousAt hLiExt 0 := hLiExt_analyticAt_zero.continuousAt
have hc3 : ContinuousAt (fun s : ℂ => logDeriv Complex.Gammaℝ (1 + s)) 0 := (the AnalyticAt from h3).continuousAt
exact (hc1.add hc2).add hc3
```
Hmm — ContinuousAt.add produces Pi.add functions — the defeq assignment trick (banked gotcha): `have hGcont : ContinuousAt (fun s => A s + B s + C s) 0 := (hc1.add hc2).add hc3` — defeq ✓.
ContinuousAt.div: `ContinuousAt.div (hf : ContinuousAt f x) (hg : ContinuousAt g x) (h0 : g x ≠ 0) : ContinuousAt (f / g) x`. f/g = fun s => 1/(1+s) defeq to (fun _ => 1)/(fun s => 1+s) ✓.
norm_num for (1:ℂ)+0 ≠ 0: `by norm_num : (1 : ℂ) + 0 ≠ 0` ✓.
F continuity: fun s => gFun (1+s): gFun_continuousAt 1 (xiL 1 = 1/2 ≠ 0) comp:
```
have hFcont : ContinuousAt (fun s : ℂ => gFun (1 + s)) 0 := by
have hg : ContinuousAt gFun 1 := gFun_continuousAt 1 (by rw [xiL_one]; norm_num)
have hc : ContinuousAt (fun s : ℂ => 1 + s) 0 := continuousAt_const.add continuousAt_id
have hcomp := hg.comp hc -- ContinuousAt (gFun ∘ (1+·)) 0
have heq : (gFun ∘ fun s : ℂ => 1 + s) = fun s : ℂ => gFun (1 + s) := rfl
rw [heq] at hcomp
exact hcomp
```
ContinuousAt.comp : ContinuousAt g (f x) → ContinuousAt f x → ContinuousAt (g ∘ f) x ✓ (g at f 0 = 1+0 = 1: need gFun continuous at 1+0 = 1 — hg is at 1; comp needs ContinuousAt gFun ((fun s => 1+s) 0) = gFun (1+0) — defeq 1+0 = 1? (1:ℂ)+0 reduces to 1 ✓ defeq should unify).
Hmm — ContinuousAt.comp signature: `theorem ContinuousAt.comp {g : β → γ} {f : α → β} {x : α} (hg : ContinuousAt g (f x)) (hf : ContinuousAt f x) : ContinuousAt (g ∘ f) x`. hg : ContinuousAt gFun 1; needs ContinuousAt gFun ((fun s => 1+s) 0) = ContinuousAt gFun (1+0): is 1 defeq (1:ℂ)+0? Yes (add zero reduces). `hg.comp hc` — unification up to defeq ✓ should work.
Then the upgrade:
```
lemma gFun_one_add_eventuallyEq (hZC : ZeroCountProp) :
(fun s : ℂ => gFun (1 + s)) =ᶠ[𝓝 (0 : ℂ)]
fun s => 1 / (1 + s) + hLiExt s + logDeriv Complex.Gammaℝ (1 + s) := by
have hp := gFun_one_add_punctured
have hpt : gFun (1 + 0) = 1 / (1 + 0) + hLiExt 0 + logDeriv Complex.Gammaℝ (1 + 0) :=
eq_of_eventuallyEq_nhd_ne hFcont hGcont hp
rw [eventually_nhdsWithin_iff] at hp
filter_upwards [hp] with s hs
by_cases h0 : s = 0
· subst h0
exact hpt
· exact hs h0
```
Note hZC is actually unused for this lemma! The punctured identity doesn't need the perimeter. Drop the hZC argument. ✓ (gFun_one_add_punctured needs no perimeter.)
eq_of_eventuallyEq_nhd_ne signature (LiMoments:245): {F G : ℂ → ℂ} {s₀ : ℂ} (hF : ContinuousAt F s₀) (hG : ContinuousAt G s₀) (h : F =ᶠ[𝓝[≠] s₀] G) : F s₀ = G s₀ — F := fun s => gFun (1+s), G := the RHS lambda ✓. The conclusion F 0 = G 0: gFun (1+0) = 1/(1+0) + hLiExt 0 + logDeriv Gammaℝ (1+0) — hpt used after subst h0: goal gFun (1+0)... wait after subst h0 (s := 0): goal (fun s => gFun (1+s)) 0 = (fun s => ...) 0 — beta-redexes: gFun (1+0) = 1/(1+0) + hLiExt 0 + logDeriv Gammaℝ (1+0) — hpt has exactly this if stated with (1+0)... eq_of_eventuallyEq_nhd_ne gives F s₀ = G s₀ with s₀ := 0: F 0 = (fun s => gFun (1+s)) 0 — a beta-redex: gFun (1+0)? F 0 where F = fun s => gFun (1+s): F 0 ≡ gFun (1+0) defeq. `exact hpt` should unify up to defeq ✓.
Now — where to put these? New file LiCrux.lean (ii′-3c). Imports: NguyenRH1.LiMoments (has LiTightR, LiSwaps, LiResidue, LiDigamma, LiReflect transitively), LiArchimedean (iteratedDeriv_logDeriv_Gammaℝ, logDeriv_Gammaℝ_one_add), LiZetaCoeff (iteratedDeriv_hLiExt, hLiExt_analyticAt_zero, hLiExt_of_ne). LiMoments already imports LiResidue (hLi, lcoeff, ResW1) and LiSwaps (lagariasA, sigmaP, sInfty_eq_sum, liCoeff_eq_sum_sigma) — via LiSwaps ✓. Sf is in LiSkeleton — LiMoments imports LiTightR which imports...? Sf's def is in LiSkeleton:2429. Does LiTightR import LiSkeleton? Probably yes (Sf/Bn FAlt used in 5f? no...). Let me check LiTightR's imports. For the crux lemma I need Sf (LiSkeleton), SInfty (LiSkeleton), sInfty_eq_sum (LiSwaps), liCoeff_eq_sum_sigma (LiSwaps), ResW1_eq_sum (LiResidue), lagarias_4_10_a (new). So LiCrux imports: LiMoments, LiArchimedean, LiZetaCoeff, LiSkeleton.
The crux:
```
theorem sf_eq_resW1 (hZC : ZeroCountProp) {n : ℕ} (hn : 1 ≤ n) :
(ResW1 n).re = Sf n := by
have h10 : lcoeff_sum...
-- ℂ identity:
have hid : ResW1 n = ((SInfty n : ℝ) : ℂ) + 1 - liCoeff n := by
rw [ResW1_eq_sum]
-- Σ_{j=1}^n C(n,j)·lcoeff (j−1) = Σ C(n,j)·[(−1)^j (a_j + σ_j) + (−1)^{j−1}]
rw [Finset.sum_congr rfl (fun j hj => by
rw [lagarias_4_10_a hZC (show 1 ≤ j from ...)]
...)]
```
Hmm — Finset.sum_congr to rewrite each term: term j: (n.choose j : ℂ) * lcoeff (j−1). With 4.10-a: lcoeff (j−1) = (−1)^j·(a_j + σ_j) + (−1)^{j−1}. Need j ≥ 1: hj ∈ Icc 1 n → 1 ≤ j ✓ (Finset.mem_Icc.mp hj).1.
Then sum splits:
Σ_j C·[(−1)^j(a_j+σ_j) + (−1)^{j−1}] = Σ_j (−1)^j·C·a_j + Σ_j (−1)^j·C·σ_j + Σ_j (−1)^{j−1}·C [ring per term + Finset.sum_add].
- S1 : Σ_{j∈Icc 1 n} (−1:ℂ)^j·C(n,j)·(lagariasA j : ℝ) = ((SInfty n : ℝ):ℂ): from sInfty_eq_sum n hn : SInfty n = Σ (−1:ℝ)^j·(C:ℝ)·a_j over ℝ; cast: ((SInfty n):ℂ) = Σ ((−1:ℝ)^j·...)... push_cast on the congrArg (fun x : ℝ => (x:ℂ)) of sInfty_eq_sum:
```
have hS : ((SInfty n : ℝ) : ℂ) = ∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^j * (n.choose j : ℂ) * (lagariasA j : ℝ) := by
have h := congrArg (fun x : ℝ => (x : ℂ)) (sInfty_eq_sum n hn)
rw [map_sum] at h -- or push_cast
...
```
push_cast [sInfty_eq_sum n hn]? Cleaner:
```
have h := sInfty_eq_sum n hn
have h2 : ((SInfty n : ℝ) : ℂ) = ((∑ j ∈ Finset.Icc 1 n, (-1:ℝ)^j * (n.choose j : ℝ) * lagariasA j : ℝ) : ℂ) := by rw [h]
push_cast at h2
-- h2 : ((SInfty n):ℂ) = Σ j, (↑((−1)^j))·... — push_cast normalizes casts: (↑((-1:ℝ)^j)) = (-1:ℂ)^j etc.
exact h2 -- up to matching forms
```
push_cast at h2 should give exactly the ℂ sum with (−1:ℂ)^j, (n.choose j : ℂ), (↑(lagariasA j) : ℂ) ✓. The term shape in my sum-split: (−1:ℂ)^j·C·(a_j : ℝ) — same ✓.
- S2 : Σ_{j} (−1:ℂ)^j·C·sigmaP j = −liCoeff n: liCoeff_eq_sum_sigma n : liCoeff n = Σ (−1:ℂ)^{j+1}·C·σ_j. So Σ (−1)^j C σ = Σ −(−1)^{j+1} C σ = −liCoeff:
```
have hL : (∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^j * (n.choose j : ℂ) * sigmaP j) = -liCoeff n := by
rw [liCoeff_eq_sum_sigma] -- hmm: liCoeff n = Σ (−1)^{j+1} C σ
rw [Finset.sum_neg_distrib]?? or:
rw [show (∀ ...)] — per term: (−1)^j·C·σ = −((−1)^{j+1}·C·σ) (ring: (−1)^{j+1} = −(−1)^j ✓ ring normalizes pow_succ)
rw [← Finset.sum_neg_distrib] -- Σ −f = −Σ f
apply Finset.sum_congr rfl
intro j hj
ring -- −((−1)^{j+1}·C·σ) = (−1)^j·C·σ? (−1)^{j+1} = (−1)^j·(−1) ✓ ring
```
Direction: goal Σ (−1)^j C σ = −liCoeff n. rw [liCoeff_eq_sum_sigma]: RHS −liCoeff n → −Σ (−1)^{j+1} C σ. rw [← Finset.sum_neg_distrib]: −Σ f → Σ (−f): Σ (−((−1)^{j+1} C σ)) = ... wait direction: Finset.sum_neg_distrib : Σ (−f) = −Σ f. ← rewrites −Σ f to Σ −f ✓. Goal: Σ (−1)^j C σ = Σ −((−1)^{j+1} C σ). sum_congr + ring ✓.
- S3 : Σ_{j=1}^n (−1:ℂ)^{j−1}·C(n,j) = 1: Σ_{j=1}^n (−1)^{j−1} C(n,j) = −Σ_{j=1}^n (−1)^j C(n,j) = −[(Σ_{j=0}^n (−1)^j C(n,j)) − 1] = −[0 − 1] = 1 (n ≥ 1: (1−1)^n = 0).
Mathlib: `Int.neg_one_pow_sum_choose_eq_zero`? or `add_pow_neg_one`? There's `sum_range_choose_neg_one_pow`? Hmm: the identity Σ_{j=0}^n (−1)^j C(n,j) = 0 for n ≥ 1: Mathlib `sum_range_neg_one_pow_choose_eq_zero`? Not sure of name. Alternative: use `add_pow` : (x+y)^n = Σ C(n,j) x^j y^{n−j} with x = −1, y = 1: ((−1)+1)^n = 0 = Σ C(n,j)·(−1)^j·1 = Σ_{j∈range(n+1)} C(n,j)(−1)^j. Then peel j=0 term = 1: Σ_{j∈Icc 1 n} = Σ_{range(n+1)} − {0}: Ico relationship: range(n+1) = {0} ∪ Icc 1 n (for n ≥ 1): Finset.range_eq_Ico, Ico 0 (n+1) = {0} ∪ Icc 1 n?
Let me do:
```
have hbinom : (∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^j * (n.choose j : ℂ)) = -1 := by
have h := add_pow (-1 : ℂ) 1 n -- ((−1)+1)^n = Σ_{j∈range(n+1)} C(n,j)·(−1)^j·1^{n−j}
rw [neg_add_cancel, zero_pow (by omega : n ≠ 0)] at h
-- h : 0 = Σ_{j∈range(n+1)} C(n,j)·(−1)^j·1^{n−j}
-- normalize the summand: C·(−1)^j·1 = C·(−1)^j
rw [Finset.sum_congr rfl (fun j _ => by rw [one_pow, mul_one])] at h
-- peel j = 0: range(n+1) = insert 0 (Icc 1 n)
rw [show Finset.range (n+1) = insert 0 (Finset.Icc 1 n) from by
ext j
simp [Finset.mem_range, Finset.mem_Icc]
omega] at h
rw [Finset.sum_insert (by simp)] at h
-- h : 0 = C(n,0)·(−1)^0 + Σ_{j∈Icc 1 n} C(n,j)·(−1)^j = 1 + Σ
rw [Nat.choose_zero_right, pow_zero, mul_one] at h -- hmm C(n,0) = 1: Nat.choose_zero_right : n.choose 0 = 1; cast: ((1:ℕ):ℂ)
-- h : 0 = 1 + Σ_{Icc}
...goal: Σ_{Icc} (−1)^j·C = −1: my sum is (−1)^j * C vs h's C * (−1)^j — mul_comm per term
```
Getting long. The summand forms: my target Σ (−1:ℂ)^{j−1}·C: relate to Σ (−1)^j·C via per-term (−1)^{j−1} = −(−1)^j (j ≥ 1: (−1)^{j−1}·(−1) = (−1)^j ✓ ring with pow_succ' or: (−1:ℂ)^{j-1} = -(−1:ℂ)^j — needs j ≥ 1: (−1)^j = (−1)^{j−1+1} = (−1)^{j−1}·(−1): ring can do j−1+1 = j? For j : ℕ with j ≥ 1, ring_nf handles Nat subtraction? NO — ring doesn't handle ℕ truncated sub! Need: (−1:ℂ)^{j-1} = -(−1:ℂ)^j given 1 ≤ j:
```
have hsign : ∀ j : ℕ, 1 ≤ j → ((-1:ℂ))^(j-1) = -((-1:ℂ))^j := by
intro j hj
have e : j - 1 + 1 = j := by omega
calc ((-1:ℂ))^(j-1) = ((-1:ℂ))^(j-1) * 1 := by rw [mul_one]
_ = -(((-1:ℂ))^(j-1) * (-1:ℂ)) := by ring
_ = -((-1:ℂ))^(j-1+1) := by rw [pow_succ] -- hmm direction: pow_succ: a^(n+1) = a^n * a; so a^(j−1)*a = a^(j−1+1): ← pow_succ
_ = -((-1:ℂ))^j := by rw [e]
```
✓ (pow_succ : a^(n+1) = a^n * a — ← pow_succ rewrites a^n·a → a^(n+1) ✓.)
So S3 : Σ_{j∈Icc 1 n} (−1)^{j−1}·C = −Σ (−1)^j C = −(−1) = 1:
```
have hS3 : (∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^(j-1) * (n.choose j : ℂ)) = 1 := by
rw [Finset.sum_congr rfl (fun j hj => hsign j (Finset.mem_Icc.mp hj).1)] -- rewrites the family? sum_congr produces an equation; rw with it? Finset.sum_congr rfl h : Σ f = Σ g — as rw rule: use `rw [Finset.sum_congr rfl (fun j hj => hsign j ...)]` — hmm sum_congr's conclusion is an equation between two specific sums; rw [that] rewrites the goal's matching sum ✓ pattern works (used before? simpler: trans via have).
```
Cleaner:
```
have e : (∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^(j-1) * (n.choose j : ℂ)) =
∑ j ∈ Finset.Icc 1 n, -((-1:ℂ)^j * (n.choose j : ℂ)) :=
Finset.sum_congr rfl (fun j hj => by rw [hsign j (Finset.mem_Icc.mp hj).1, neg_mul])
rw [e, Finset.sum_neg_distrib, hbinom, neg_neg]
```
Then the crux assembly:
```
have hid : ResW1 n = ((SInfty n : ℝ) : ℂ) + 1 - liCoeff n := by
rw [ResW1_eq_sum]
have hterms : (∑ j ∈ Finset.Icc 1 n, (n.choose j : ℂ) * lcoeff (j - 1)) =
(∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^j * (n.choose j : ℂ) * (lagariasA j : ℝ)) +
(∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^j * (n.choose j : ℂ) * sigmaP j) +
(∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^(j-1) * (n.choose j : ℂ)) := by
rw [← Finset.sum_add, ← Finset.sum_add]
apply Finset.sum_congr rfl
intro j hj
have hj1 : 1 ≤ j := (Finset.mem_Icc.mp hj).1
rw [lagarias_4_10_a hZC hj1]
ring
rw [hterms, hS, hL, hS3]
-- ((SInfty):ℂ) + (−liCoeff) + 1 = ((SInfty):ℂ) + 1 − liCoeff ✓ ring
ring
-- take re:
rw [hid]
simp [Sf] -- (((SInfty):ℂ) + 1 − liCoeff n).re = SInfty + 1 − (liCoeff n).re
```
The .re: (ResW1 n).re = Sf n: rw [hid]: (((SInfty n : ℝ):ℂ) + 1 − liCoeff n).re = Sf n. Sf n := SInfty n + 1 − (liCoeff n).re. LHS: Complex.sub_re/add_re/ofReal_re/one_re: ((X:ℂ) + 1 − Y).re = X.re + 1 − Y.re... where X = ↑(SInfty n): X.re = SInfty n (Complex.ofReal_re). simp [Complex.add_re, Complex.sub_re, Complex.ofReal_re, Complex.one_re, Sf] should close. Or:
```
rw [hid, Sf]
simp only [Complex.sub_re, Complex.add_re, Complex.ofReal_re, Complex.one_re]
```
Wait — the 4.10-a's cast in the per-term rw: lagarias_4_10_a hZC hj1 : lcoeff (j−1) = (−1:ℂ)^j * ((lagariasA j : ℝ) + sigmaP j) + (−1:ℂ)^(j−1) — with k := j (needs the k−1 = j−1 forms matching: statement is lcoeff (k−1) = (−1)^k·(a_k + σ_k) + (−1)^{k−1}: at k := j ✓ directly matches, no Nat.add_sub_cancel needed).
Term ring: C·[(−1)^j·(a+σ) + (−1)^{j−1}] = (−1)^j·C·a + (−1)^j·C·σ + (−1)^{j−1}·C ✓ ring (a here = ↑(lagariasA j) — ring treats as atom ✓).
Now, one important check on lagarias_4_10_a's statement: sigmaP k with k := m+1 vs the use at k := j — fine, general.
Also: (4.10-a) needs hZC — the full crux sf_eq_resW1 then takes hZC ✓.
Plan the file: LiCrux.lean:
- imports: Mathlib, NguyenRH1.LiMoments, NguyenRH1.LiArchimedean, NguyenRH1.LiZetaCoeff, NguyenRH1.LiSkeleton.
Check LiSkeleton import chain: LiSkeleton imports what? It defines Sf/SInfty/liCoeff. liCoeff_eq_sum_sigma (LiSwaps) uses liCoeff from LiSkeleton? LiSwaps imports LiSkeleton presumably. And SInfty in LiSkeleton:380. sInfty_eq_sum in LiSwaps uses SInfty ✓.
Order in file:
1. gFun_one_sub (the function identity, FE) → iteratedDeriv_gFun_zero.
2. gFun_one_add_punctured.
3. gFun_one_add_eventuallyEq.
4. iteratedDeriv_gFun_one.
5. lagarias_4_10_a.
6. sf_eq_resW1.
Let me also double check `differentiableAt_Gammaℝ_of_not_neg_nat` signature (grep LiCircleBound).
All pieces confirmed. Checking `differentiableAt_Gammaℝ_of_not_neg_nat`'s exact signature, then writing LiCrux.lean.
tool: Grep ok
input
{
"pattern": "lemma differentiableAt_Gamma\u211d_of_not_neg_nat|theorem differentiableAt_Gamma\u211d_of_not_neg_nat",
"path": "D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1",
"output_mode": "content",
"-n": true,
"-A": 4
}
result 2026-08-25 03:33:28Z → 2026-08-28 05:06:50Z
mode='content' num_files=0 filenames=[] content='D:\\Python\\Quantum\\web\\dashboard\\templates\\dashboard\\ledger.html:17: <td>{{ r.date }}</td>\nD:\\Python\\Quantum\\web\\dashboard\\templates\\dashboard\\home.html:66: <span class="muted">Track {{ latest.track }} · {{ latest.date }} ·\nD:\\Python\\Quantum\\web\\dashboard\\templates\\dashboard\\conversation_session.html:8: {{ session.created_at }} → {{ session.updated_at }} ·\nD:\\Python\\Quantum\\web\\dashboard\\templates\\dashboard\\experiments.html:22: <td>{{ e.date }}</td>\nD:\\Python\\Quantum\\web\\dashboard\\templates\\dashboard\\dashboard.html:70: <tr><td>{{ s.id }}</td><td>{{ s.date }}</td>\nD:\\Python\\Quantum\\web\\dashboard\\templates\\dashboard\\experiment_detail.html:8:<p class="muted">{{ exp.date }} · {{ exp.row_count }} rows · script' num_lines=6 num_matches=None applied_limit=None applied_offset=None
raw content_json (database row)
[{"type":"thinking","thinking":"All confirmed:\n- `zetaA := Function.update (fun w => (w - 1) * riemannZeta w) 1 1`; `zetaA_apply (hw : w ≠ 1) : zetaA w = (w−1)*riemannZeta w`.\n- `logDeriv_Gammaℝ_one_add (hs : Gamma ((1+s)/2) ≠ 0) (hs2 : ∀ m, (1+s)/2 ≠ −m) : logDeriv Gammaℝ (1+s) = −(log π)/2 + (1/2)*digamma ((1+s)/2)`.\n- `hLiExt_analyticAt_zero : AnalyticAt ℂ hLiExt 0`.\n- `zetaA_ne_zero_near_one : ∀ᶠ w in 𝓝 1, zetaA w ≠ 0`.\n- `zetaA_analyticAt_of_ne (hw : w ≠ 1) : AnalyticAt ℂ zetaA w`.\n\nFor deriv zetaA (1+s) — I need deriv of zetaA at the point 1+s (s ≠ 0). Via the EventuallyEq with (w−1)*ζ near 1+s: deriv zetaA (1+s) = deriv (fun w => (w−1)*riemannZeta w) (1+s) [EventuallyEq.deriv_eq] = ζ(1+s) + s·deriv ζ (1+s) [deriv_mul: deriv ((w−1)*ζ) = deriv(w−1)·ζ + (w−1)·deriv ζ; deriv (w−1) = 1].\n\nderiv_mul: `deriv_mul (hf : DifferentiableAt 𝕜 f x) (hg : DifferentiableAt 𝕜 g x) : deriv (f * g) x = deriv f x * g x + f x * deriv g x`. With f = fun w => w−1, g = riemannZeta at x = 1+s: DifferentiableAt (w−1) ✓; differentiableAt_riemannZeta (h : s ≠ 1)? Signature: differentiableAt_riemannZeta {s : ℂ} (hs : s ≠ 1)? Used in LiMoments:210 as (differentiableAt_riemannZeta h1) with h1 : s ≠ 1. At 1+s: need 1+s ≠ 1 ⟺ s ≠ 0 ✓.\n\nSo deriv zetaA (1+s) = 1·ζ(1+s) + s·ζ′(1+s) — wait the functions: zetaA = update ... — the deriv of zetaA vs deriv of the underlying (w−1)*ζ: they agree on a punctured nbd of 1+s (zetaA_apply on eventually_ne_nhds). So:\n```\nhave hzeq : (fun w : ℂ => (w - 1) * riemannZeta w) =ᶠ[𝓝 (1+s)] zetaA := by\n filter_upwards [eventually_ne_nhds (show (1:ℂ)+s ≠ 1 from ...)] with z hz\n exact (zetaA_apply hz).symm\nhave hderiv_zetaA : deriv zetaA (1 + s) = riemannZeta (1 + s) + s * deriv riemannZeta (1 + s) := by\n rw [← hzeq.deriv_eq] -- deriv (fun w => (w−1)*ζ w) (1+s) = ...\n -- hmm direction: hzeq.deriv_eq : deriv (fun w => (w−1)*ζ w) (1+s) = deriv zetaA (1+s)\n rw [hzeq.deriv_eq] -- rewrites deriv zetaA (1+s) → deriv (fun w => (w−1)*ζ w) (1+s)\n -- then deriv_mul\n have hf : DifferentiableAt ℂ (fun w : ℂ => w - 1) (1 + s) := differentiableAt_id.sub_const 1\n have hg : DifferentiableAt ℂ riemannZeta (1 + s) := differentiableAt_riemannZeta (by ...)\n rw [deriv_mul hf hg]\n have h1 : deriv (fun w : ℂ => w - 1) (1 + s) = 1 := by\n rw [(hasDerivAt_id' (1+s)).sub_const 1 |>.deriv]; simp -- deriv (w−1) = 1−0 = 1\n rw [h1]\n ring\n```\nNote EventuallyEq.deriv_eq : f₁ =ᶠ[𝓝 x] f → deriv f₁ x = deriv f x — the probe shows {f f₁} with f₁ =ᶠ f giving deriv f₁ = deriv f. hzeq : (fun w => (w−1)*ζ w) =ᶠ zetaA, so hzeq.deriv_eq : deriv (fun w => (w−1)*ζ w) (1+s) = deriv zetaA (1+s). rw [← hzeq.deriv_eq]?? I want to rewrite `deriv zetaA (1+s)` (in my goal) to `deriv (fun w => (w−1)*ζ w) (1+s)`: that's rewriting with the equation RIGHT-to-LEFT: rw [← hzeq.deriv_eq] — since hzeq.deriv_eq : LHS = RHS with LHS = deriv (product), rewriting ← replaces RHS (deriv zetaA) by LHS (deriv product) ✓.\n\nThen deriv_mul on the product: goal after ← rw: deriv (fun w => (w−1)*ζ w) (1+s) = ζ(1+s) + s*ζ′(1+s). Hmm — the product function as written: (fun w => (w - 1) * riemannZeta w) — pointwise mul of (fun w => w−1) and ζ. deriv_mul hf hg : deriv (f * g) x = ... where f * g is Pi.mul — the lambda (fun w => (w−1)*ζ w) is defeq to (fun w => w−1) * (fun w => ζ w)... rw [deriv_mul hf hg] needs syntactic match? deriv_mul's LHS is deriv (f * g) x with f g implicit — unifier against deriv (fun w => (w−1) * riemannZeta w) (1+s): HOU f := fun w => w−1, g := riemannZeta — Pi.mul defeq; rw unification might handle it (deriv_mul is a common rw). If it fails, bridge with a `show` or hsplit-rfl. Let me preemptively bridge:\n```\n have hsplit : (fun w : ℂ => (w - 1) * riemannZeta w) =\n (fun w : ℂ => w - 1) * riemannZeta := rfl\n rw [hsplit, deriv_mul hf hg]\n```\n✓ safe.\n\nderiv (fun w => w−1) (1+s) = 1: ((hasDerivAt_id' (1+s)).sub_const 1).deriv : deriv (fun w => w−1) (1+s) = 1 − 0; simp closes? `rw [((hasDerivAt_id' (1 + s)).sub_const 1).deriv]` gives goal `1 - 0 = riemannZeta ...` hmm no — I structured: rw [h1] where h1 : deriv (fun w => w−1) (1+s) = 1. Then goal: 1 * ζ(1+s) + s * ζ′(1+s) = ζ(1+s) + s*ζ′(1+s) — ring? Wait the goal RHS I wrote was `riemannZeta (1+s) + s * deriv riemannZeta (1+s)`. After deriv_mul: deriv f·g + f·deriv g = 1·ζ(1+s) + ((1+s)−1)·ζ′(1+s) = ζ(1+s) + s·ζ′(1+s): ring ✓.\n\nh1 : deriv (fun w : ℂ => w - 1) (1 + s) = 1:\n```\nhave h1 : deriv (fun w : ℂ => w - 1) (1 + s) = 1 := by\n have h := ((hasDerivAt_id' (1 + s)).sub_const 1).deriv\n rw [h] -- goal becomes 1 - 0 = 1? no: h : deriv (fun w => w−1) (1+s) = 1 − 0; rw [h] changes goal to 1 − 0 = 1; norm_num/simp closes? rw auto-tries rfl: 1 − 0 = 1 is not rfl syntactically. Use: rw [h]; norm_num? or:\n simpa using h\n```\n`simpa using h` ✓.\n\nOK. Now also the (4.10-a) algebra assembly. Let me define the plan for the assembly lemma:\n\n```\ntheorem lagarias_4_10_a (hZC : ZeroCountProp) {k : ℕ} (hk : 1 ≤ k) :\n lcoeff (k - 1) = ((-1 : ℂ)) ^ k * ((lagariasA k : ℝ) + sigmaP k) + ((-1 : ℂ)) ^ (k - 1) := by\n obtain ⟨m, rfl⟩ := Nat.exists_eq_succ_of_ne_zero (by omega : k ≠ 0) -- k = m+1\n```\nNat.exists_eq_succ_of_ne_zero : k ≠ 0 → ∃ m, k = m+1 ✓. Then k−1 = m (Nat.add_sub_cancel), (−1)^{k−1} = (−1)^m, lagariasA k = lagariasA (m+1), sigmaP k = sigmaP (m+1).\n\nGoal: lcoeff m = (−1)^{m+1} · (a_{m+1} + sigmaP (m+1)) + (−1)^m.\n\nChain:\n- hM := sigmaP_eq_neg_iteratedDeriv_gFun_div hZC (show 1 ≤ m+1 by omega) : sigmaP (m+1) = −iteratedDeriv m gFun 0 / (m! : ℂ). (k−1 with k = m+1: Nat.add_sub_cancel rewrites (m+1−1) → m ✓ need to rw.)\n- hFE := iteratedDeriv_gFun_zero m : iteratedDeriv m gFun 0 = (−1)^{m+1} · iteratedDeriv m gFun 1.\n- hExp := iteratedDeriv_gFun_one hZC m : iteratedDeriv m gFun 1 = (−1)^m·m! − m!·lcoeff m + (−1)^{m+1}·m!·a_{m+1}.\n\nSubstitute: sigmaP (m+1) = −[(−1)^{m+1}·((−1)^m·m! − m!·c_m + (−1)^{m+1}·m!·a_{m+1})]/m!.\n\nLet me expand: −(−1)^{m+1}·(−1)^m·m! = −(−1)^{2m+1}·m! = −(−1)·m! = m!; −(−1)^{m+1}·(−m!·c_m) = (−1)^{m+1}·m!·c_m; −(−1)^{m+1}·(−1)^{m+1}·m!·a = −m!·a.\nSo sigmaP (m+1) = [m! + (−1)^{m+1}·m!·c_m − m!·a_{m+1}]/m! = 1 + (−1)^{m+1}·c_m − a_{m+1}.\nThen (−1)^{m+1}·c_m = sigmaP (m+1) − 1 + a_{m+1}; c_m = (−1)^{m+1}·(sigmaP (m+1) + a_{m+1}) − (−1)^{m+1}·... \n\ngoal: c_m = (−1)^{m+1}(a_{m+1} + σ) + (−1)^m.\nCheck: (−1)^{m+1}·c_m = (−1)^{m+1}·[(−1)^{m+1}(a+σ) + (−1)^m] = (a+σ) + (−1)^{2m+1} = a + σ − 1 ✓ matches sigmaP = 1 + (−1)^{m+1}c − a rearranged. ✓\n\nLean assembly: \n```\n have hM := sigmaP_eq_neg_iteratedDeriv_gFun_div hZC (m + 1) (Nat.le_add_left 1 m)?? \n```\nhmm signature: sigmaP_eq_neg_iteratedDeriv_gFun_div (hZC) {k} (hk : 1 ≤ k) — k implicit. So `sigmaP_eq_neg_iteratedDeriv_gFun_div hZC (k := m + 1) (by omega)`. Its statement: sigmaP (m+1) = −iteratedDeriv (m+1−1) gFun 0 / ((m+1−1)! : ℂ). rw [Nat.add_sub_cancel] at hM → sigmaP (m+1) = −iteratedDeriv m gFun 0 / (m! : ℂ).\n\nThen `linear_combination`? The final goal is c_m = ...; the hyps are hM (σ = ...), hFE (G0 = ...), hExp (G1 = ...). The relation is purely linear-algebraic over ℂ IF we treat (−1)-powers correctly: the problem: linear_combination normalizes ring expressions; (−1)^{2m+1} etc. are ring-normalizable? (−1)^{m}·(−1)^{m+1} = (−1)^{2m+1} — ring can combine exponents: x^m * x^(m+1) = x^(2m+1) ✓ ring handles. And (−1)^{2m+1} = −1? ring does NOT evaluate that (−1)^{2m+1} = −1 — (−1)^{2m+1} is (−1)·((−1)^2)^m = (−1)·1^m = −1 — ring CAN do this? ring normalizes (−1)^{2m+1} as (−1)^{2m+1}... it doesn't simplify powers of −1 with variable exponents. Hmm. So the (−1)^{even} = 1 steps need manual lemmas:\n\nhsign1 : ((-1:ℂ))^m * ((-1:ℂ))^m = 1:\n```\nhave hsq : ∀ m : ℕ, ((-1:ℂ)) ^ m * ((-1:ℂ)) ^ m = 1 := by\n intro m\n rw [← pow_add, ← two_mul, pow_mul, show ((-1:ℂ))^2 = 1 by norm_num, one_pow]\n```\nhsign2 : ((-1:ℂ))^(m+1) * ((-1:ℂ))^m = -1: = (−1)^{2m+1}: rw [← pow_add, show m+1+m = 2*m+1 by ring, pow_add, pow_mul, show ((-1:ℂ))^2=1, one_pow, pow_one]... gives (−1)^1 = −1 ✓.\n\nThen do the algebra via explicit rewrites + linear_combination with the sign haves as hypotheses... linear_combination can use haves: the identity needed:\n\nFrom hM/hFE/hExp: σ = −((−1)^{m+1}·G1)/m! where G1 = (−1)^m·m! − m!·c + (−1)^{m+1}·m!·a.\n\nLet me denote s := (−1:ℂ)^m, t := (−1:ℂ)^{m+1}. Then s·s = 1 (hsq), t·s = −1 (hsign2), t = −s? also t·t = 1: (−1)^{2m+2} = 1 ✓ (another instance of hsq with m+1).\n\nσ = −(t·G1)/F where F = m!, G1 = s·F − F·c + t·F·a.\n−t·G1 = −t·s·F + t·F·c − t·t·F·a = −(−1)·F + t·F·c − 1·F·a = F + t·F·c − F·a.\nσ = (F + t·F·c − F·a)/F = 1 + t·c − a (F ≠ 0).\nGoal: c = t·(a + σ) + s.\nt·(a+σ) + s = t·a + t·σ + s = t·a + t·(1 + t·c − a) + s = t·a + t + t·t·c − t·a + s = t + c + s = c + (t + s) = c + 0 ✓ (t + s = (−1)^{m+1} + (−1)^m = 0).\n\nlinear_combination with hyps hM hFE hExp hsq hsign2 ht_s (t = −s or t+s=0): the issue is the DIVISION by F = (m! : ℂ). linear_combination handles field expressions? linear_combination works over commutative rings; ℂ is a field — linear_combination normalizes over fields? It uses ring_nf which handles division by atoms: σ = −(t·G1)/F — as an atom F with F⁻¹... The combination: goal c − (t·(a+σ) + s) = Σ coeff·(hyp_lhs − hyp_rhs). With hyp hM: σ + (t·G0)/F = 0... this gets messy with divisions. \n\nCleaner: clear denominators manually. F := (m ! : ℂ) ≠ 0 (Nat.cast_ne_zero.mpr (Nat.factorial_ne_zero m)). Multiply hM by F: F·σ = −G0·... hM : σ = −G0/F → F·σ = −G0 (field_simp or mul_div_cancel). Let me structure:\n\n```\n have hF : ((m ! : ℕ) : ℂ) ≠ 0 := Nat.cast_ne_zero.mpr (Nat.factorial_ne_zero m)\n have hM := sigmaP_eq_neg_iteratedDeriv_gFun_div hZC (k := m + 1) (by omega)\n rw [Nat.add_sub_cancel] at hM\n have hM2 : (m ! : ℂ) * sigmaP (m + 1) = -iteratedDeriv m gFun 0 := by\n rw [hM]\n field_simp [hF] -- hmm: F * (−G0/F) = −G0: mul_neg_div? \n```\nF * (−G0 / F): −G0/F = −(G0/F) → F·(−(G0/F)) = −(F·(G0/F)) = −G0 via mul_div_cancel₀. field_simp [hF] should close `F * (−G0 / F) = −G0` outright (banked: field_simp closes goals). ✓\n\nhFE : G0 = t·G1 (t := (−1)^{m+1}).\nhExp : G1 = s·F − F·c + t·F·a where the actual form from iteratedDeriv_gFun_one: I'll state hExp's RHS as ((−1:ℂ))^m * (m ! : ℂ) − (m ! : ℂ) * lcoeff m + ((−1:ℂ))^(m+1) * (m ! : ℂ) * (lagariasA (m+1) : ℝ).\n\nThen the goal: c = t·(a + σ) + s where c := lcoeff m, a := (lagariasA (m+1) : ℝ) cast to ℂ, σ := sigmaP (m+1), s := (−1)^m, t := (−1)^{m+1}.\n\nlinear_combination with:\n- hM2 : F·σ = −G0\n- hFE : G0 = t·G1\n- hExp : G1 = s·F − F·c + t·F·a\n- hsq : s·s = 1, htt : t·t = 1, hts : t·s = −1 (or t+s = 0)\n\nGoal − target combo: c − (t·(a+σ) + s) =? combination of (hyp_lhs − hyp_rhs)'s.\n\nLet me solve for coefficients α1..α6 over ℂ as rational functions in atoms F, c, a, σ, s, t, G0, G1 with relations:\n(1) F·σ + G0 = 0 [hM2]\n(2) G0 − t·G1 = 0 [hFE]\n(3) G1 − s·F + F·c − t·F·a = 0 [hExp]\n(4) s·s − 1 = 0 [hsq]\n(5) t·t − 1 = 0 [htt]\n(6) t·s + 1 = 0 [hts]\n\nWe want: c − t·a − t·σ − s.\n\nEliminate G0, G1: G0 = −F·σ (from 1); G1 = G0/t = −F·σ/t (from 2); (3): −F·σ/t − s·F + F·c − t·F·a = 0. Multiply by t: −F·σ·(t/t)−...: t·(−F·σ/t) = −F·σ (needs t ≠ 0...). This is where ring-normalization with the relation polys does it via Gröbner — linear_combination uses ring_nf with the given hypotheses as linear combos only (not Gröbner). linear_combination e: checks (goal_lhs − goal_rhs) − e = 0 via ring where e is a linear combination of hypothesis differences with CONSTANT coefficients (actually coefficients can be terms). The relations (4)-(6) are quadratic — usable as hyps multiplied by something: e.g. (t·s + 1)·X.\n\nLet me directly find the combination:\nWant: c − t·a − t·σ − s.\nStart from (3): F·c = −G1 + s·F + t·F·a... hmm let me solve forward:\nG1 = s·F − F·c + t·F·a [from 3]\nG0 = t·G1 = t·s·F − t·F·c + t·t·F·a = (ts)F − t·F·c + (t²)F·a = −F − t·F·c + F·a [using 5,6]\n(1): F·σ = −G0 = F + t·F·c − F·a ⟹ σ = 1 + t·c − a [÷F — as a ring identity: F·σ = F·(1 + t·c − a), need F ≠ 0 to divide — linear_combination can't divide! So multiply the GOAL by F and prove F·(goal) then... or accept goal with F:\n\nTrick: prove F·c = F·(t·(a+σ)+s) then use mul_left_cancel₀ hF. \nF·t·(a+σ) + F·s = F·t·a + F·t·σ + F·s.\nF·t·σ = t·(F·σ) = t·(F + t·F·c − F·a) = t·F + t²·F·c − t·F·a = t·F + F·c − t·F·a.\nSum: F·t·a + (t·F + F·c − t·F·a) + F·s = F·c + F·(t+s) = F·c + F·0 = F·c ✓ (t+s = 0: hts' : t + s = 0).\n\nSo: F·c = F·t·a + F·t·σ + F·s — as a linear combination:\nF·c − F·t·a − F·t·σ − F·s \n= [F·t·σ − t·F − F·c + t·F·a side...] \n\nCombination: goal' : F·c = F·(t·(a+σ)+s). \ngoal'_lhs − goal'_rhs = F·c − F·t·a − F·t·σ − F·s.\nHyps (as lhs−rhs): h1 := F·σ + G0, h2 := G0 − t·G1, h3 := G1 − s·F + F·c − t·F·a, h5 := t·t − 1, h6 := t·s + 1, hts' := t + s − 0.\n\nTry: combo = α·h1 + β·h2 + γ·h3 + δ·h5 + ε·h6 + ζ·hts'.\nWe need to eliminate G0: α·G0 + β·G0 = 0 → β = −α.\nEliminate G1: −β·t·G1 + γ·G1 = 0 → γ = β·t = −α·t.\nc terms: γ·F·c = c·(F coefficient): want F·c: −α·t·F·c = F·c → α = −1/t. Hmm t isn't invertible in the coefficient ring... but t·t = 1 so 1/t = t — but linear_combination coefficients are just terms; using α := −t is fine (it's a term):\nα = −t: β = t; γ = t·t = t² (as a term (−(−1)^{m+1})·... whatever, terms fine).\nCheck: α·h1 = −t·F·σ − t·G0; β·h2 = t·G0 − t²·G1; γ·h3 = t²·G1 − t²·s·F + t²·F·c − t³·F·a.\nSum so far: −t·F·σ − t²·s·F + t²·F·c − t³·F·a.\nWant: F·c − F·t·a − F·t·σ − F·s.\nDifference (want − sum): F·c − F·t·a − F·s − [−t²·s·F + t²·F·c − t³·F·a]\n= F·c·(1 − t²) − F·t·a·(1 − t²) − F·s·(1 − t²)... wait: −F·s − t²·s·F·(−1) = −F·s + t²·s·F = −F·s(1 − t²). And −F·t·a + t³·F·a = −F·t·a(1 − t²). And F·c − t²F·c = F·c(1−t²).\nDifference = (1−t²)·(F·c − F·t·a − F·s) = −(t²−1)·F·(c − t·a − s) = −h5·F·(c − t·a − s)... hmm h5 = t²−1 (as lhs−rhs: t·t−1). So difference = −F·(c − t·a − s)·h5? That's circular (contains c). Hmm — that's wrong; linear combination must equal EXACTLY goal diff. Let me redo: I want goal_diff = combo. goal_diff = F·c − F·t·a − F·t·σ − F·s. I found combo(α..γ) = −t·F·σ − t²·s·F + t²·F·c − t³·F·a. \n\ngoal_diff − combo = F·c − F·t·a − F·s + t²·s·F − t²·F·c + t³·F·a\n= F·c(1−t²) + F·a(t³−t) + F·s(t²−1)\n= −(t²−1)·F·c + t(t²−1)·F·a + (t²−1)·F·s\n= (t²−1)·F·(−c + t·a + s) — STILL contains c. Bad — the combo as chosen can't work with only these hyps; I need an additional term to kill the residual. Residual = (t²−1)·F·(−c + t·a + s). Hmm the c in the residual is the problem — need ANOTHER c-containing hyp. But all c info comes from h3... \n\nI think the issue: I haven't used hts' (t+s=0) yet and made an arithmetic slip. Let me recompute carefully.\n\ngoal_diff = F·c − t·F·a − t·F·σ − s·F.\n\nh1 := F·σ + G0 (i.e., lhs−rhs of hM2: F·σ − (−G0) = F·σ + G0)\nh2 := G0 − t·G1\nh3 := G1 − (s·F − F·c + t·F·a) = G1 − s·F + F·c − t·F·a\nh5 := t·t − 1\nh6 := t·s + 1\nh7 := t + s\n\nChoose combo = A·h1 + B·h2 + C·h3 + D·h5 + E·h6 + G·h7 where A..G are TERMS.\n\nG0 coeff: A + B = 0 → B = −A.\nG1 coeff: −t·B + C = 0 → C = t·B = −t·A.\nσ coeff: F·A; goal has −t·F·σ → A = −t.\nThen B = t, C = t·t = t².\nc coeff: C·F·c = t²·F·c. Goal: F·c. Residual c: F·c·(1 − t²) — must be killed by D·h5: D·(t²−1)... h5 has no F: D·(t²−1) contributes D·t² − D. To cancel F·c·(1−t²): need D ⊇ −F·c·... D is a term — can include c! D := F·c? Then D·h5 = F·c·(t²−1) ✓ cancels the c residual. \na terms: combo: C·(−t·F·a) = −t³·F·a. Goal: −t·F·a. Residual: −t·F·a + t³·F·a = t·F·a·(t²−1) → killed by D·h5? D·h5 = F·c(t²−1) — different atom (c vs a). Not killed. Add to D: D := F·c + t·F·a? Then D·h5 = (F·c + t·F·a)(t²−1) ✓ kills both c and a residuals.\ns terms: combo: C·(−s·F) = −t²·s·F. Goal: −s·F. Residual: −s·F + t²·s·F = s·F·(t²−1) → D += s·F.\nt·σ: A·h1 gives −t·F·σ ✓ matches goal exactly.\nRemaining: G·h7 + E·h6 — so far unused. Current total:\ncombo(A,B,C,D) = −t·(F·σ+G0) + t·(G0−t·G1) + t²·(G1−s·F+F·c−t·F·a) + (F·c+t·F·a+s·F)·(t²−1)\n= −t·F·σ − t·G0 + t·G0 − t²·G1 + t²·G1 − t²·s·F + t²·F·c − t³·F·a + F·c·t² − F·c + t·F·a·t² − t·F·a + s·F·t² − s·F\n= −t·F·σ − t²·s·F + t²·F·c − t³·F·a + t²·F·c − F·c + t³·F·a − t·F·a + t²·s·F − s·F\n= −t·F·σ + 2t²·F·c − F·c − t·F·a − s·F.\n\ngoal_diff = F·c − t·F·a − t·F·σ − s·F. \n\ncombo − goal_diff = 2t²·F·c − 2F·c = 2F·c·(t²−1) — STILL a residual! I double-counted: t²·F·c appears twice (once from C·h3, once from D·h5's expansion). D·h5 = (F·c + t·F·a + s·F)·(t²−1) = F·c·t² − F·c + ... so total F·c terms: t²F·c (from C·h3) + t²F·c − F·c (from D·h5) = 2t²F·c − F·c. To get exactly F·c: I need the c-coefficient total = 1. Sources of F·c: C·h3 contributes C·F·c (atom-coeff C = t²); D·h5 contributes D_c·(t²−1) where D_c is the c-part of D. Total: t² + (t²−1)·(D_c/(F·c))... Let me parametrize D := u·F·c + v·t·F·a + w·s·F and solve:\n\nF·c coeff: t² + u·(t²−1) = 1 → u·(t²−1) = 1−t² → u = −1. ✓ (as before)\nF·a coeff: from C·h3: −t³; from D·h5: v·t·(t²−1) → total should be −t: −t³ + v·t·(t²−1) = −t → v·t·(t²−1) = t³−t = t(t²−1) → v = 1 ✓.\ns·F coeff: from C·h3: −t²; from D·h5: w·(t²−1) → total −1: −t² + w·(t²−1) = −1 → w = 1 ✓.\nSo D := −F·c + t·F·a + s·F. Then:\ncombo = −t·h1 + t·h2 + t²·h3 + (−F·c + t·F·a + s·F)·h5\nc total: t² + (−1)(t²−1) = t² − t² + 1 = 1 ✓\na total: −t³ + t(t²−1) = −t³ + t³ − t = −t ✓\ns total: −t² + (t²−1) = −1 ✓\nσ: −t ✓\nAnd h6/h7 unused!\n\nSo: goal' (F·c = F·(t·(a+σ)+s)) follows by:\nlinear_combination (-t)·hM2 + t·hFE + t²·hExp + (−F·c + t·F·a + s·F)·ht_sq\nwhere ht_sq : t*t = 1.\n\nThen final step: c = t·(a+σ) + s via mul_left_cancel₀ hF:\n```\n have hgoal : (m ! : ℂ) * lcoeff m = (m ! : ℂ) * (((-1:ℂ))^(m+1) * ((lagariasA (m+1) : ℝ)) + sigmaP (m+1)) + ((-1:ℂ))^m) := by\n linear_combination ...\n```\nHmm wait — goal' RHS: F·(t·(a+σ) + s) = F·t·a + F·t·σ + F·s — the linear_combination goal must be stated in the multiplied form. Then:\n```\n exact mul_left_cancel₀ hF hgoal\n```\nwhere the final goal after the F-multiplied version: lcoeff m = t·(a+σ) + s — need hgoal : F·lcoeff m = F·(t·(a+σ)+s): but my linear_combination derivation has goal' LHS F·c and RHS F·t·a + F·t·σ + F·s — is F·(t·(a+σ)+s) ring-equal to that? Yes but the hypothesis form must match for mul_left_cancel₀: mul_left_cancel₀ : a ≠ 0 → a * b = a * c → b = c. hgoal's RHS must be literally F·(t·(a+σ)+s) — linear_combination closes goals up to RING equivalence, so stating hgoal with the factored RHS is fine ✓.\n\nThen mul_left_cancel₀ hF hgoal : lcoeff m = t·(a+σ)+s — matches the final goal if stated in that form. The final goal after obtain ⟨m, rfl⟩: lcoeff (m+1−1) = (−1)^{m+1}·((lagariasA (m+1):ℝ) + sigmaP (m+1)) + (−1)^{m+1−1}: rw [Nat.add_sub_cancel] → lcoeff m = (−1)^{m+1}·(a+σ) + (−1)^m ✓.\n\nWait — the cast: (lagariasA k : ℝ) in my statement — lagariasA : ℕ → ℝ. In the goal over ℂ: (↑(lagariasA (m+1)) : ℂ)? I wrote the statement as `((-1 : ℂ)) ^ k * ((lagariasA k : ℝ) + sigmaP k)` — with (lagariasA k : ℝ) + sigmaP k : the + between ℝ and ℂ — needs a cast: elaborates as (↑(lagariasA k) + sigmaP k : ℂ) via coercion ✓ (same as iteratedDeriv_logDeriv_Gammaℝ's (lagariasA (j+1) : ℝ) in a ℂ product ✓).\n\nAnd hExp (iteratedDeriv_gFun_one) produces (lagariasA (m+1) : ℝ) as a ℂ-cast factor ✓ consistent.\n\nNow — sign identities needed:\n- ht_sq : ((-1:ℂ))^(m+1) * ((-1:ℂ))^(m+1) = 1: via hsq-general lemma (m+1 instance).\n- The linear_combination uses ONLY hM2, hFE, hExp, ht_sq — the hsq (s·s=1) and hts (t·s=−1) aren't needed per my derivation! Let me double check: in the combination I used h5 := t·t−1 only. ✓ \n\nLet me re-verify the expansion by hand one more time with actual atoms:\ncombo := (−t)·(F·σ + G0) + (t)·(G0 − t·G1) + (t²)·(G1 − s·F + F·c − t·F·a) + (−F·c + t·F·a + s·F)·(t² − 1)\n\nExpand:\n−t·F·σ − t·G0 + t·G0 − t²·G1 + t²·G1 − t²·s·F + t²·F·c − t³·F·a − F·c·t² + F·c + t·F·a·t² − t·F·a + s·F·t² − s·F\n= −t·F·σ + 0 + 0 − t²·s·F + t²·F·c − t³·F·a − t²·F·c + F·c + t³·F·a − t·F·a + t²·s·F − s·F\n= −t·F·σ + F·c − t·F·a − s·F ✓✓\n\n= goal'_diff (F·c − t·F·a − t·F·σ − s·F) ✓ \n\nSo linear_combination ((-(-1:ℂ)^(m+1)) * hM2 + ((-1:ℂ)^(m+1)) * hFE + ((-1:ℂ)^(m+1))^2 * hExp + (-(m!:ℂ)*lcoeff m + (-1:ℂ)^(m+1)*(m!:ℂ)*(lagariasA (m+1):ℝ) + (-1:ℂ)^m*(m!:ℂ)) * ht_sq)... careful with what t² means as a coefficient term: I can write the coefficient as ((-1:ℂ)^(m+1))^2 — ring will normalize. Actually simpler to write coefficients in s/t form and let ring_nf normalize — linear_combination accepts arbitrary terms as coefficients ✓.\n\nHmm wait — one subtlety: hExp (iteratedDeriv_gFun_one) has form G1 = s·F − F·c + t·F·a where the actual statement I'll prove is:\niteratedDeriv m gFun 1 = ((−1:ℂ))^m·(m!:ℂ) − (m!:ℂ)·lcoeff m + ((−1:ℂ))^{m+1}·(m!:ℂ)·(lagariasA (m+1):ℝ)\nso h3 := G1 − s·F + F·c − t·F·a ✓ matches (as lhs−rhs: G1 − (s·F − F·c + t·F·a) = G1 − s·F + F·c − t·F·a ✓ ring-normalizes).\n\nAnd hFE : G0 = t·G1 — my iteratedDeriv_gFun_zero states: iteratedDeriv m gFun 0 = ((−1:ℂ))^(m+1) * iteratedDeriv m gFun 1 ✓ (h2 := G0 − t·G1 ✓).\n\nAnd hM2 : (m!:ℂ)·sigmaP (m+1) = −iteratedDeriv m gFun 0 (h1 := F·σ + G0 ✓).\n\nht_sq : ((−1:ℂ))^(m+1) * ((−1:ℂ))^(m+1) = 1:\n```\nhave ht_sq : ((-1:ℂ)) ^ (m + 1) * ((-1:ℂ)) ^ (m + 1) = 1 := by\n rw [← pow_add, show (m + 1) + (m + 1) = 2 * (m + 1) by ring, pow_mul,\n show ((-1:ℂ)) ^ 2 = 1 by norm_num, one_pow]\n```\n\nNow remaining sub-lemmas to build:\n(1) `iteratedDeriv_gFun_zero` (FE relation) — via hid + iteratedDeriv_comp_const_sub + iteratedDeriv_neg.\n(2) `gFun_one_add_eventuallyEq` — the punctured logDeriv algebra + continuity upgrade.\n(3) `iteratedDeriv_gFun_one` — comp_add_const + congr + add splits + 3 pieces (zpow, hLiExt, logDeriv_Gammaℝ — wait no: the third piece value comes from iteratedDeriv_logDeriv_Gammaℝ directly! I don't need ContDiffAt of the third piece for its VALUE — but I DO need ContDiffAt for the iteratedDeriv_add splits).\n(4) `lagarias_4_10_a` — the linear_combination assembly.\n(5) The crux `sf_eq_resW1`.\n\nFor (3)'s splits: ContDiffAt of:\n- (fun s => (1+s)⁻¹): analyticAt at 0: (analyticAt_const.add analyticAt_id)... write as 1/(1+s): analyticAt_const.div (analyticAt_const.add analyticAt_id) (by norm_num : (1:ℂ)+0 ≠ 0). Wait 1+s at s=0 is 1+0; analyticAt_const.div h1 h2 where h1 : AnalyticAt (fun _ => 1), h2 : AnalyticAt (fun s => 1+s) 0, and (1+0) ≠ 0. ✓ .contDiffAt.\n- hLiExt: hLiExt_analyticAt_zero.contDiffAt ✓.\n- (fun s => logDeriv Gammaℝ (1+s)): use ContDiffAt.congr_of_eventuallyEq with the digamma form? OR build AnalyticAt directly: AnalyticAt ℂ (fun s => logDeriv Gammaℝ (1+s)) 0 — logDeriv Gammaℝ at 1: (analyticAt Gammaℝ 1).deriv.div (analyticAt Gammaℝ 1) (Gammaℝ_one ▸ ne). AnalyticAt Gammaℝ at 1: hmm — is there a direct lemma? `Complex.analyticAt_Gammaℝ`? Not sure. Alternative: differentiableAt_Gammaℝ_of_not_neg_nat gives DifferentiableAt at points s with ∀ m, s/2 ≠ −m? — DifferentiableAt on an open set ⟹ AnalyticOnNhd: the pattern used for xiL: (differentiable_xiL.differentiableOn.analyticOnNhd isOpen_univ). For Gammaℝ: need DifferentiableOn ℂ Gammaℝ (ball 1 (1/2)) say — every point of ball 1 (1/2) has the not-neg-nat property: for w ∈ ball 1 (1/2): w/2 ∈ ball (1/2) (1/4): re(w/2) > 1/4 > 0 ≥ −m... re(w/2) > 0 ⟹ w/2 ≠ −(m:ℂ) for all m (re(−m) = −m ≤ 0). Hmm wait — differentiableAt_Gammaℝ_of_not_neg_nat's hypothesis: let me check its signature (in LiCircleBound). Then:\n```\nhave hG_an : AnalyticAt ℂ Complex.Gammaℝ 1 := by\n have hd : DifferentiableOn ℂ Complex.Gammaℝ (Metric.ball 1 (1/2)) := by\n intro w hw\n apply (differentiableAt_Gammaℝ_of_not_neg_nat ?_).differentiableWithinAt\n intro m\n -- w/2 ≠ −m since re(w/2) > 0\n ...\n exact (hd.analyticOnNhd Metric.isOpen_ball) 1 (Metric.mem_ball_self (by norm_num))\n```\nHmm — wait, actually differentiableAt_Gammaℝ_of_not_neg_nat's hypothesis was about s/2 (in LiMoments line 188-189: `differentiableAt_Gammaℝ_of_not_neg_nat hhalf` with hhalf : ∀ m : ℕ, s / 2 ≠ -(m : ℂ)). ✓. Then:\nlogDeriv Gammaℝ at 1: (hG_an.deriv).div hG_an (by rw [Complex.Gammaℝ_one]; norm_num) : AnalyticAt (fun w => deriv Gammaℝ w / Gammaℝ w) 1 — and logDeriv Gammaℝ = fun w => deriv Gammaℝ w / Gammaℝ w — is that the def? logDeriv f = deriv f / f — yes `logDeriv : (𝕜 → 𝕜') → 𝕜 → 𝕜' := fun f x => deriv f x / f x` — actually logDeriv f x = f⁻¹ * deriv? No: `logDeriv f x = deriv f x / f x`? In Mathlib: logDeriv f = fun x => deriv f x / f x. Hmm — logDeriv_apply : logDeriv f x = deriv f x / f x? There's `logDeriv_apply : logDeriv f a = (deriv f a)/(f a)`? gFun_continuousAt wrote it as ((analyticAt_xiL s).deriv).div (analyticAt_xiL s) hs : AnalyticAt (fun x => deriv xiL x / xiL x)? and then .continuousAt : ContinuousAt gFun s — defeq between gFun = logDeriv xiL and fun x => deriv xiL x / xiL x ✓ (used defeq assignment at line 252). ✓ Same pattern works for Gammaℝ.\n\nThen comp with (1+·): AnalyticAt.comp with (analyticAt_const.add analyticAt_id) : AnalyticAt (fun s => logDeriv Gammaℝ (1+s)) 0 — via AnalyticAt.comp_of_eq (h at 1+0 = 1) pattern or AnalyticAt.comp (h1 : AnalyticAt f (g 0)) (h2 : AnalyticAt g 0) : AnalyticAt (f ∘ g) 0 then rfl-bridge:\n```\nhave h1 : AnalyticAt ℂ (fun w : ℂ => deriv Complex.Gammaℝ w / Complex.Gammaℝ w) 1 := ...\nhave h2 : AnalyticAt ℂ (fun s : ℂ => 1 + s) 0 := analyticAt_const.add analyticAt_id\nhave h3 := h1.comp_of_eq h2 (by norm_num : (1:ℂ) + 0 = 1)\nhave heq : ((fun w : ℂ => deriv Complex.Gammaℝ w / Complex.Gammaℝ w) ∘ fun s : ℂ => 1 + s) =\n fun s => logDeriv Complex.Gammaℝ (1 + s) := rfl\nrw [heq] at h3\nexact h3.contDiffAt\n```\nAnalyticAt.comp_of_eq signature — used at LiArchimedean:152: `hG.comp_of_eq haffine (by show (1 + (0:ℂ))/2 = 1/2; ring)` ✓.\n\nIs ((fun w => deriv Gammaℝ w / Gammaℝ w) ∘ (fun s => 1+s)) = fun s => logDeriv Gammaℝ (1+s) rfl? logDeriv Gammaℝ (1+s) unfolds to deriv Gammaℝ (1+s)/Gammaℝ (1+s) — and the comp beta-reduces to that ✓ rfl (logDeriv is a def; defeq by delta+beta ✓).\n\nHmm — is logDeriv REALLY fun f x => deriv f x / f x? Check: Mathlib's `logDeriv (f : 𝕜 → 𝕜') (a : 𝕜) : 𝕜' := deriv f a / f a`? I recall `logDeriv f a = (f a)⁻¹ * deriv f a`?? No — logDeriv_apply : logDeriv f a = deriv f a / f a. Let me trust the gFun_continuousAt usage: ((analyticAt_xiL s).deriv).div (analyticAt_xiL s) hs was assigned to ContinuousAt gFun s via defeq ✓ — AnalyticAt.div produces fun x => f x / g x (f/g pointwise = div) ✓. So yes.\n\n(2) gFun_one_add_eventuallyEq — the big punctured algebra. Structure:\n\n```\nlemma gFun_one_add_punctured :\n ∀ᶠ s in 𝓝[≠] (0 : ℂ), gFun (1 + s) =\n (1 + s)⁻¹ + hLiExt s + logDeriv Complex.Gammaℝ (1 + s) := by\n -- eventually facts on 𝓝[≠] 0:\n -- s ≠ 0 (self_mem_nhdsWithin)\n -- zetaA (1+s) ≠ 0 eventually (zetaA_ne_zero_near_one comp tendsto (1+s)→1)\n -- s ≠ −1 eventually (eventually_ne_nhds : 0 ≠ −1)\n -- Gammaℝ (1+s) ≠ 0 eventually (Gammaℝ 1 = 1, continuity)\n -- ζ(1+s) ≠ 0 from zetaA (1+s) = s·ζ(1+s), s ≠ 0\n filter_upwards [self_mem_nhdsWithin, hZA, hne1, hΓ] with s hs0 hZAs hs1 hΓs\n -- main algebra:\n have hζs : riemannZeta (1 + s) ≠ 0 := by\n intro hζ\n have e := zetaA_apply (show (1:ℂ)+s ≠ 1 by ...)\n rw [hζ, mul_zero] at e -- hmm e : zetaA (1+s) = s * ζ(1+s) = 0... \n```\nwait zetaA_apply (hw : w ≠ 1): zetaA (1+s) = ((1+s)−1)·ζ(1+s) = s·ζ(1+s). rw [hζ, mul_zero] at e: e : zetaA (1+s) = s * 0?? No: e : zetaA (1+s) = ((1+s)−1)*riemannZeta (1+s); rw [hζ] at e → zetaA (1+s) = ((1+s)−1)*0; mul_zero → zetaA (1+s) = 0 → hZAs e. ✓ (the (1+s)−1 needs simplifying? mul_zero matches _*0 ✓ regardless.)\n\nThen:\n```\n have hs1' : (1:ℂ) + s ≠ 1 := by\n intro h\n have h2 : s = 0 := by linear_combination h\n exact hs0 h2\n have hs0' : (1:ℂ) + s ≠ 0 := by\n intro h\n apply hs1 -- hs1 : s ≠ -1\n linear_combination h\n -- xiL product form near 1+s\n have hopen : IsOpen ({0}ᶜ ∩ {1}ᶜ : Set ℂ) := isOpen_compl_singleton.inter isOpen_compl_singleton\n have hexp : xiL =ᶠ[𝓝 (1 + s)] (fun t => (t * (t - 1) / 2) * completedRiemannZeta t) := by\n filter_upwards [hopen.mem_nhds ⟨hs0', hs1'⟩] with t ht\n exact xiL_eq_mul ht.1 ht.2\n have hΓdiff : DifferentiableAt ℂ Complex.Gammaℝ (1 + s) :=\n differentiableAt_Gammaℝ_of_not_neg_nat (fun m => ...) -- need ∀ m, (1+s)/2 ≠ −m\n```\nHmm — differentiableAt_Gammaℝ_of_not_neg_nat's hypothesis form: in LiMoments:159-170 good_half_ne_neg_nat produces ∀ m : ℕ, s/2 ≠ −(m:ℂ) from (s ≠ 0, ∀ n ≥ 1, s ≠ −2n). Here at point 1+s: need ∀ m, (1+s)/2 ≠ −(m:ℂ): since s near 0, (1+s)/2 near 1/2, re > 0 eventually. So include in the eventually facts: ∀ᶠ s in 𝓝 0, ∀ m : ℕ, (1+s)/2 ≠ −(m:ℂ) — via the re > 0 open-set argument (like LiArchimedean:165-182). Then:\n - hΓdiff : DifferentiableAt Gammaℝ (1+s) ✓\n - also needed for logDeriv Gammaℝ — fine.\n - hΓ0 : Gammaℝ (1+s) ≠ 0 — from the eventually hΓ (continuity at Gammaℝ 1 = 1).\n\n have hΛeq : completedRiemannZeta =ᶠ[𝓝 (1+s)] (fun t => Complex.Gammaℝ t * riemannZeta t) := by\n filter_upwards [hΓdiff.continuousAt.eventually_ne hΓ0, eventually_ne_nhds hs0'] with t htΓ ht0\n rw [riemannZeta_def_of_ne_zero ht0]\n field_simp [htΓ]\n (same as gFun_eq_momentB's hΛeq.)\n \n have hlog : logDeriv xiL (1 + s) = logDeriv (fun t => (t * (t - 1) / 2) * completedRiemannZeta t) (1 + s) := by\n rw [logDeriv_apply, logDeriv_apply, hexp.deriv_eq, hexp.eq_of_nhds]\n \n -- goal: gFun (1+s) = (1+s)⁻¹ + hLiExt s + logDeriv Gammaℝ (1+s)\n -- gFun (1+s) = logDeriv xiL (1+s) by rfl/defeq — use `show`:\n show logDeriv xiL (1 + s) = _ -- defeq unfold of gFun\n rw [hlog]\n -- logDeriv_mul splits (mirror gFun_eq_momentB):\n have hP : DifferentiableAt ℂ (fun t : ℂ => t * (t - 1) / 2) (1 + s) := ...\n have hΛ : DifferentiableAt ℂ completedRiemannZeta (1 + s) := differentiableAt_completedZeta hs0' hs1'\n have hP0 : (1 + s) * ((1 + s) - 1) / 2 ≠ 0 := div_ne_zero (mul_ne_zero hs0' (sub_ne_zero.mpr hs1')) two_ne_zero\n have hΛ0 : completedRiemannZeta (1 + s) ≠ 0 := by\n rw [Ne, RvM.completedRiemannZeta_eq_zero_iff]\n rintro h\n exact hζs h.1\n rw [logDeriv_mul (f := fun t : ℂ => t * (t - 1) / 2) (g := completedRiemannZeta) _ hP0 hΛ0 hP hΛ]\n -- hPlog at 1+s: logDeriv (t(t−1)/2) (1+s) = 1/(1+s) + 1/s\n have hPlog : logDeriv (fun t : ℂ => t * (t - 1) / 2) (1 + s) = 1 / (1 + s) + 1 / s := by\n rw [logDeriv_apply]\n have hderiv : deriv (fun t : ℂ => t * (t - 1) / 2) (1 + s) = (1 + s) - 1 / 2 := by\n have h2' : HasDerivAt (fun t : ℂ => t * (t - 1) / 2) ((1 * ((1+s) - 1) + (1+s) * 1) / 2) (1+s) :=\n ((hasDerivAt_id' (1+s)).mul ((hasDerivAt_id' (1+s)).sub_const 1)).div_const 2\n rw [h2'.deriv]\n ring\n rw [hderiv]\n field_simp [hs0', hs0] -- hmm: ((1+s) − 1/2) / ((1+s)·s/2) = 1/(1+s) + 1/s\n ring\n rw [hPlog]\n```\nWait — careful: hPlog's target: logDeriv ... = 1/(1+s) + 1/s. logDeriv_apply gives deriv/value: ((1+s) − 1/2)/((1+s)((1+s)−1)/2). (1+s)−1 = s. field_simp [hs0', hs0]: need (1+s) ≠ 0 ✓ hs0', s ≠ 0 ✓ hs0 (hs0 : s ≠ 0 from self_mem_nhdsWithin). Also the value (1+s)((1+s)−1)/2 has (1+s)−1 which needs rewriting to s for field_simp to see s... field_simp might handle (1+s)−1 as atom ≠ 0: sub_ne_zero.mpr hs1' : (1+s)−1 ≠ 0 ✓ — pass that too: field_simp [hs0', sub_ne_zero.mpr hs1']. Then ring. But then the result is in terms of (1+s)−1: 1/(1+s) + 1/((1+s)−1)?? My target says 1/s — hmm: target RHS 1/(1+s) + 1/s; the computed LHS after field_simp: ((1+s) − 1/2)·2 = ((1+s)·((1+s)−1))·(1/(1+s) + 1/s)? ring normalizes both sides treating (1+s) and s and ((1+s)−1) as atoms — 1/((1+s)−1) vs 1/s are DIFFERENT atoms! ring won't know (1+s)−1 = s. Fix: rewrite (1+s)−1 = s first: have es : (1+s)−1 = s := by ring; rw [es] at the value spots... The expression: deriv-value/func-value where func-value = (1+s)*((1+s)−1)/2. rw [show ((1:ℂ)+s)−1 = s by ring] — rewrites (1+s)−1 → s. Then field_simp [hs0', hs0], ring ✓.\n\n -- hlogΛ at 1+s:\n have hlogΛ : logDeriv completedRiemannZeta (1 + s) =\n logDeriv Complex.Gammaℝ (1 + s) + logDeriv riemannZeta (1 + s) := by\n have heq : logDeriv completedRiemannZeta (1 + s) =\n logDeriv (fun t => Complex.Gammaℝ t * riemannZeta t) (1 + s) := by\n rw [logDeriv_apply, logDeriv_apply, hΛeq.deriv_eq, hΛeq.eq_of_nhds]\n rw [heq, logDeriv_mul (f := Complex.Gammaℝ) (g := riemannZeta) _ hΓ0 hζs hΓdiff\n (differentiableAt_riemannZeta hs1')]\n rw [hlogΛ]\n -- now: 1/(1+s) + 1/s + (logDeriv Gammaℝ (1+s) + logDeriv riemannZeta (1+s)) = (1+s)⁻¹ + hLiExt s + logDeriv Gammaℝ (1+s)\n -- the hLiExt identity:\n have hE : hLiExt s = 1 / s + logDeriv riemannZeta (1 + s) := by\n rw [hLiExt_of_ne hs0]\n -- (1 − hLi (1+s))/s = 1/s + logDeriv ζ (1+s)\n have hh : hLi (1 + s) = 1 - s * (deriv zetaA (1 + s) / zetaA (1 + s)) := by\n rw [hLi]\n congr 1\n ring -- (1+s)−1 = s\n rw [hh]\n -- (1 − (1 − s·X))/s = X\n have hX : (1 - (1 - s * (deriv zetaA (1 + s) / zetaA (1 + s)))) / s =\n deriv zetaA (1 + s) / zetaA (1 + s) := by\n field_simp [hs0]\n rw [hX]\n -- deriv zetaA (1+s)/zetaA (1+s) = 1/s + logDeriv ζ (1+s)\n have hzA_ne : zetaA (1 + s) ≠ 0 := hZAs\n have hzeq : (fun w : ℂ => (w - 1) * riemannZeta w) =ᶠ[𝓝 (1 + s)] zetaA := by\n filter_upwards [eventually_ne_nhds hs1'] with z hz\n exact (zetaA_apply hz).symm\n have hderiv_zetaA : deriv zetaA (1 + s) =\n riemannZeta (1 + s) + s * deriv riemannZeta (1 + s) := by\n rw [← hzeq.deriv_eq]\n have hsplit : (fun w : ℂ => (w - 1) * riemannZeta w) =\n (fun w : ℂ => w - 1) * riemannZeta := rfl\n rw [hsplit, deriv_mul (differentiableAt_id.sub_const 1) (differentiableAt_riemannZeta hs1')]\n have h1 : deriv (fun w : ℂ => w - 1) (1 + s) = 1 := by\n simpa using ((hasDerivAt_id' (1 + s)).sub_const 1).deriv\n rw [h1]\n ring_nf -- 1·ζ + ((1+s)−1)·ζ′ = ζ + s·ζ′: ring might not simplify (1+s)−1 → s inside atoms... (1+s)−1 appears as a factor: ((1+s)−1)·ζ′; ring normalizes (1+s)−1 to s ✓ (sub is ring op) ✓ plain ring works: 1*X + (1+s−1)*Y = X + s*Y ✓ ring.\n rw [hderiv_zetaA, zetaA_apply hs1']\n -- (ζ + s·ζ′)/(s·ζ) = 1/s + ζ′/ζ\n rw [logDeriv_apply]\n field_simp [hs0, hζs]\n ring\n rw [hE]\n -- final: 1/(1+s) + 1/s + (Γ + Z) = (1+s)⁻¹ + (1/s + Z) + Γ\n rw [one_div]\n ring\n```\nWait — at the end after rw [hPlog, hlogΛ, hE], goal: 1/(1+s) + 1/s + (logDeriv Gammaℝ (1+s) + logDeriv riemannZeta (1+s)) = (1+s)⁻¹ + (1/s + logDeriv riemannZeta (1+s)) + logDeriv Gammaℝ (1+s). rw [one_div] converts 1/(1+s) → (1+s)⁻¹... and also 1/s → s⁻¹ (both sides — consistent). Then ring ✓.\n\nHmm wait — order issue: the goal BEFORE rw [hE] is `1/(1+s) + 1/s + (Γ + Z) = (1+s)⁻¹ + hLiExt s + Γ`. rw [hE] rewrites hLiExt s → 1/s + Z: RHS becomes (1+s)⁻¹ + (1/s + Z) + Γ ✓. rw [one_div]: rewrites the FIRST 1/? occurrence — 1/(1+s) on LHS → (1+s)⁻¹. Only first unifier + all identical instances: 1/(1+s) and 1/s are different. RHS already has (1+s)⁻¹ and 1/s. So need one_div applied to 1/(1+s) only... rw [one_div] first match: 1/(1+s)? Term traversal: LHS first ✓ likely. But 1/s also matches 1/?x pattern with x := s — different instance, not rewritten by the same rw. So after rw [one_div]: LHS (1+s)⁻¹ + 1/s + (Γ+Z), RHS (1+s)⁻¹ + (1/s + Z) + Γ. ring ✓ closes.\n\nAlternatively skip one_div: state the lemma's RHS with 1/(1+s) instead of (1+s)⁻¹! The iteratedDeriv piece for (1+s)⁻¹ — I'll use the zpow lemma which produces... let me keep the RHS as `1 / (1 + s)` everywhere and for the derivative piece: iteratedDeriv m (fun s => 1/(1+s)) 0 = (−1)^m·m!: via the zpow lemma with the one_div bridge:\n```\nhave hpiece1 : iteratedDeriv m (fun s : ℂ => 1 / (1 + s)) 0 = ((-1:ℂ))^m * (m ! : ℂ) := by\n have e : (fun s : ℂ => 1 / (1 + s)) = fun s : ℂ => (s + 1) ^ (-1 : ℤ) := by\n funext s\n rw [zpow_neg_one, one_div]\n congr 1\n ring -- 1+s = s+1\n rw [e, iteratedDeriv_zpow_neg_one m 1 (by norm_num : (0:ℂ) + 1 ≠ 0)]\n rw [zero_add, one_zpow, mul_one] -- (0+1)^(−m−1) = 1\n```\niteratedDeriv_zpow_neg_one m c hs : iteratedDeriv m (fun s => (s+c)^(−1:ℤ)) s = (−1)^m·m!·(s+c)^(−m−1). At s = 0, c = 1: (−1)^m·m!·(0+1)^(−(m:ℤ)−1). rw [zero_add]: (1:ℂ)^(−(m:ℤ)−1); one_zpow: 1. mul_one ✓. Result: (−1)^m · m! · 1 → after mul_one: (−1)^m·m! ✓.\n\nSo state the eventuallyEq RHS as `1 / (1 + s) + hLiExt s + logDeriv Complex.Gammaℝ (1 + s)` — no ⁻¹ anywhere, no one_div needed... but the hPlog gives 1/(1+s) directly ✓ and final ring: 1/(1+s) + 1/s + (Γ+Z) = 1/(1+s) + (1/s+Z) + Γ — pure associativity/commutativity ring ✓ no inverses needed. \n\n(3) iteratedDeriv_gFun_one:\n```\nlemma iteratedDeriv_gFun_one (hZC : ZeroCountProp) (m : ℕ) :\n iteratedDeriv m gFun 1 =\n ((-1:ℂ))^m * (m ! : ℂ) - (m ! : ℂ) * lcoeff m +\n ((-1:ℂ))^(m+1) * (m ! : ℂ) * (lagariasA (m+1) : ℝ) := by\n have hcomp := congr_fun (iteratedDeriv_comp_add_const m gFun (1 : ℂ)) 0\n rw [zero_add] at hcomp\n -- hcomp : iteratedDeriv m (fun z => gFun (z + 1)) 0 = iteratedDeriv m gFun 1\n rw [← hcomp]\n -- goal: iteratedDeriv m (fun z => gFun (z+1)) 0 = RHS\n have e0 : (fun z : ℂ => gFun (z + 1)) = fun s : ℂ => gFun (1 + s) :=\n funext fun s => by rw [add_comm]\n rw [e0, iteratedDeriv_congr_of_eventuallyEq (gFun_one_add_eventuallyEq hZC) m]\n -- split into the three pieces\n have h1 : ContDiffAt ℂ m (fun s : ℂ => 1 / (1 + s)) 0 := by\n have ha : AnalyticAt ℂ (fun s : ℂ => 1 / (1 + s)) 0 :=\n analyticAt_const.div (analyticAt_const.add analyticAt_id) (by norm_num)\n exact ha.contDiffAt\n have h2 : ContDiffAt ℂ m hLiExt 0 := hLiExt_analyticAt_zero.contDiffAt\n have h3 : ContDiffAt ℂ m (fun s : ℂ => logDeriv Complex.Gammaℝ (1 + s)) 0 := ...\n have hsplit : (fun s : ℂ => 1 / (1 + s) + hLiExt s + logDeriv Complex.Gammaℝ (1 + s)) =\n (fun s : ℂ => 1 / (1 + s)) + hLiExt + (fun s : ℂ => logDeriv Complex.Gammaℝ (1 + s)) := rfl\n rw [hsplit, iteratedDeriv_add (h1.add h2) h3, iteratedDeriv_add h1 h2]\n rw [hpiece1, iteratedDeriv_hLiExt m, iteratedDeriv_logDeriv_Gammaℝ m]\n ring -- assemble: (−1)^m·m! + (−m!·lcoeff m) + (−1)^{m+1}·m!·a = RHS ✓ ring\n```\nWait — iteratedDeriv_hLiExt m : iteratedDeriv m hLiExt 0 = −(m!:ℂ)*lcoeff m ✓ matches the middle term.\niteratedDeriv_logDeriv_Gammaℝ m : ... = (−1)^{m+1}·m!·↑(lagariasA (m+1)) ✓.\nSum: (−1)^m·m! + (−(m!·c)) + (−1)^{m+1}·m!·a — goal RHS: (−1)^m·m! − m!·c + (−1)^{m+1}·m!·a ✓ ring closes.\n\nAlso — the eventuallyEq statement's RHS must match hsplit's LHS: my gFun_one_add_eventuallyEq RHS: fun s => 1/(1+s) + hLiExt s + logDeriv Gammaℝ (1+s) ✓ and hsplit claims that lambda = Pi-add form by rfl ✓.\n\nAnd `gFun_one_add_eventuallyEq` (the upgraded full-nhd version) as described: punctured + continuity + eq_of_eventuallyEq_nhd_ne + by_cases.\n\nContinuity at 0 of the RHS: \n```\nhave hGcont : ContinuousAt (fun s : ℂ => 1 / (1 + s) + hLiExt s + logDeriv Complex.Gammaℝ (1 + s)) 0 := by\n have hc1 : ContinuousAt (fun s : ℂ => 1 / (1 + s)) 0 := by\n apply ContinuousAt.div continuousAt_const (continuousAt_const.add continuousAt_id)\n norm_num\n have hc2 : ContinuousAt hLiExt 0 := hLiExt_analyticAt_zero.continuousAt\n have hc3 : ContinuousAt (fun s : ℂ => logDeriv Complex.Gammaℝ (1 + s)) 0 := (the AnalyticAt from h3).continuousAt\n exact (hc1.add hc2).add hc3\n```\nHmm — ContinuousAt.add produces Pi.add functions — the defeq assignment trick (banked gotcha): `have hGcont : ContinuousAt (fun s => A s + B s + C s) 0 := (hc1.add hc2).add hc3` — defeq ✓.\n\nContinuousAt.div: `ContinuousAt.div (hf : ContinuousAt f x) (hg : ContinuousAt g x) (h0 : g x ≠ 0) : ContinuousAt (f / g) x`. f/g = fun s => 1/(1+s) defeq to (fun _ => 1)/(fun s => 1+s) ✓.\n\nnorm_num for (1:ℂ)+0 ≠ 0: `by norm_num : (1 : ℂ) + 0 ≠ 0` ✓.\n\nF continuity: fun s => gFun (1+s): gFun_continuousAt 1 (xiL 1 = 1/2 ≠ 0) comp:\n```\nhave hFcont : ContinuousAt (fun s : ℂ => gFun (1 + s)) 0 := by\n have hg : ContinuousAt gFun 1 := gFun_continuousAt 1 (by rw [xiL_one]; norm_num)\n have hc : ContinuousAt (fun s : ℂ => 1 + s) 0 := continuousAt_const.add continuousAt_id\n have hcomp := hg.comp hc -- ContinuousAt (gFun ∘ (1+·)) 0\n have heq : (gFun ∘ fun s : ℂ => 1 + s) = fun s : ℂ => gFun (1 + s) := rfl\n rw [heq] at hcomp\n exact hcomp\n```\nContinuousAt.comp : ContinuousAt g (f x) → ContinuousAt f x → ContinuousAt (g ∘ f) x ✓ (g at f 0 = 1+0 = 1: need gFun continuous at 1+0 = 1 — hg is at 1; comp needs ContinuousAt gFun ((fun s => 1+s) 0) = gFun (1+0) — defeq 1+0 = 1? (1:ℂ)+0 reduces to 1 ✓ defeq should unify).\n\nHmm — ContinuousAt.comp signature: `theorem ContinuousAt.comp {g : β → γ} {f : α → β} {x : α} (hg : ContinuousAt g (f x)) (hf : ContinuousAt f x) : ContinuousAt (g ∘ f) x`. hg : ContinuousAt gFun 1; needs ContinuousAt gFun ((fun s => 1+s) 0) = ContinuousAt gFun (1+0): is 1 defeq (1:ℂ)+0? Yes (add zero reduces). `hg.comp hc` — unification up to defeq ✓ should work.\n\nThen the upgrade:\n```\nlemma gFun_one_add_eventuallyEq (hZC : ZeroCountProp) :\n (fun s : ℂ => gFun (1 + s)) =ᶠ[𝓝 (0 : ℂ)]\n fun s => 1 / (1 + s) + hLiExt s + logDeriv Complex.Gammaℝ (1 + s) := by\n have hp := gFun_one_add_punctured\n have hpt : gFun (1 + 0) = 1 / (1 + 0) + hLiExt 0 + logDeriv Complex.Gammaℝ (1 + 0) :=\n eq_of_eventuallyEq_nhd_ne hFcont hGcont hp\n rw [eventually_nhdsWithin_iff] at hp\n filter_upwards [hp] with s hs\n by_cases h0 : s = 0\n · subst h0\n exact hpt\n · exact hs h0\n```\nNote hZC is actually unused for this lemma! The punctured identity doesn't need the perimeter. Drop the hZC argument. ✓ (gFun_one_add_punctured needs no perimeter.)\n\neq_of_eventuallyEq_nhd_ne signature (LiMoments:245): {F G : ℂ → ℂ} {s₀ : ℂ} (hF : ContinuousAt F s₀) (hG : ContinuousAt G s₀) (h : F =ᶠ[𝓝[≠] s₀] G) : F s₀ = G s₀ — F := fun s => gFun (1+s), G := the RHS lambda ✓. The conclusion F 0 = G 0: gFun (1+0) = 1/(1+0) + hLiExt 0 + logDeriv Gammaℝ (1+0) — hpt used after subst h0: goal gFun (1+0)... wait after subst h0 (s := 0): goal (fun s => gFun (1+s)) 0 = (fun s => ...) 0 — beta-redexes: gFun (1+0) = 1/(1+0) + hLiExt 0 + logDeriv Gammaℝ (1+0) — hpt has exactly this if stated with (1+0)... eq_of_eventuallyEq_nhd_ne gives F s₀ = G s₀ with s₀ := 0: F 0 = (fun s => gFun (1+s)) 0 — a beta-redex: gFun (1+0)? F 0 where F = fun s => gFun (1+s): F 0 ≡ gFun (1+0) defeq. `exact hpt` should unify up to defeq ✓.\n\nNow — where to put these? New file LiCrux.lean (ii′-3c). Imports: NguyenRH1.LiMoments (has LiTightR, LiSwaps, LiResidue, LiDigamma, LiReflect transitively), LiArchimedean (iteratedDeriv_logDeriv_Gammaℝ, logDeriv_Gammaℝ_one_add), LiZetaCoeff (iteratedDeriv_hLiExt, hLiExt_analyticAt_zero, hLiExt_of_ne). LiMoments already imports LiResidue (hLi, lcoeff, ResW1) and LiSwaps (lagariasA, sigmaP, sInfty_eq_sum, liCoeff_eq_sum_sigma) — via LiSwaps ✓. Sf is in LiSkeleton — LiMoments imports LiTightR which imports...? Sf's def is in LiSkeleton:2429. Does LiTightR import LiSkeleton? Probably yes (Sf/Bn FAlt used in 5f? no...). Let me check LiTightR's imports. For the crux lemma I need Sf (LiSkeleton), SInfty (LiSkeleton), sInfty_eq_sum (LiSwaps), liCoeff_eq_sum_sigma (LiSwaps), ResW1_eq_sum (LiResidue), lagarias_4_10_a (new). So LiCrux imports: LiMoments, LiArchimedean, LiZetaCoeff, LiSkeleton.\n\nThe crux:\n```\ntheorem sf_eq_resW1 (hZC : ZeroCountProp) {n : ℕ} (hn : 1 ≤ n) :\n (ResW1 n).re = Sf n := by\n have h10 : lcoeff_sum... \n -- ℂ identity:\n have hid : ResW1 n = ((SInfty n : ℝ) : ℂ) + 1 - liCoeff n := by\n rw [ResW1_eq_sum]\n -- Σ_{j=1}^n C(n,j)·lcoeff (j−1) = Σ C(n,j)·[(−1)^j (a_j + σ_j) + (−1)^{j−1}]\n rw [Finset.sum_congr rfl (fun j hj => by\n rw [lagarias_4_10_a hZC (show 1 ≤ j from ...)] \n ...)]\n```\nHmm — Finset.sum_congr to rewrite each term: term j: (n.choose j : ℂ) * lcoeff (j−1). With 4.10-a: lcoeff (j−1) = (−1)^j·(a_j + σ_j) + (−1)^{j−1}. Need j ≥ 1: hj ∈ Icc 1 n → 1 ≤ j ✓ (Finset.mem_Icc.mp hj).1.\n\nThen sum splits:\nΣ_j C·[(−1)^j(a_j+σ_j) + (−1)^{j−1}] = Σ_j (−1)^j·C·a_j + Σ_j (−1)^j·C·σ_j + Σ_j (−1)^{j−1}·C [ring per term + Finset.sum_add].\n\n- S1 : Σ_{j∈Icc 1 n} (−1:ℂ)^j·C(n,j)·(lagariasA j : ℝ) = ((SInfty n : ℝ):ℂ): from sInfty_eq_sum n hn : SInfty n = Σ (−1:ℝ)^j·(C:ℝ)·a_j over ℝ; cast: ((SInfty n):ℂ) = Σ ((−1:ℝ)^j·...)... push_cast on the congrArg (fun x : ℝ => (x:ℂ)) of sInfty_eq_sum:\n```\nhave hS : ((SInfty n : ℝ) : ℂ) = ∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^j * (n.choose j : ℂ) * (lagariasA j : ℝ) := by\n have h := congrArg (fun x : ℝ => (x : ℂ)) (sInfty_eq_sum n hn)\n rw [map_sum] at h -- or push_cast\n ... \n```\npush_cast [sInfty_eq_sum n hn]? Cleaner: \n```\nhave h := sInfty_eq_sum n hn\nhave h2 : ((SInfty n : ℝ) : ℂ) = ((∑ j ∈ Finset.Icc 1 n, (-1:ℝ)^j * (n.choose j : ℝ) * lagariasA j : ℝ) : ℂ) := by rw [h]\npush_cast at h2\n-- h2 : ((SInfty n):ℂ) = Σ j, (↑((−1)^j))·... — push_cast normalizes casts: (↑((-1:ℝ)^j)) = (-1:ℂ)^j etc.\nexact h2 -- up to matching forms\n```\npush_cast at h2 should give exactly the ℂ sum with (−1:ℂ)^j, (n.choose j : ℂ), (↑(lagariasA j) : ℂ) ✓. The term shape in my sum-split: (−1:ℂ)^j·C·(a_j : ℝ) — same ✓.\n\n- S2 : Σ_{j} (−1:ℂ)^j·C·sigmaP j = −liCoeff n: liCoeff_eq_sum_sigma n : liCoeff n = Σ (−1:ℂ)^{j+1}·C·σ_j. So Σ (−1)^j C σ = Σ −(−1)^{j+1} C σ = −liCoeff:\n```\nhave hL : (∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^j * (n.choose j : ℂ) * sigmaP j) = -liCoeff n := by\n rw [liCoeff_eq_sum_sigma] -- hmm: liCoeff n = Σ (−1)^{j+1} C σ\n rw [Finset.sum_neg_distrib]?? or:\n rw [show (∀ ...)] — per term: (−1)^j·C·σ = −((−1)^{j+1}·C·σ) (ring: (−1)^{j+1} = −(−1)^j ✓ ring normalizes pow_succ) \n rw [← Finset.sum_neg_distrib] -- Σ −f = −Σ f\n apply Finset.sum_congr rfl\n intro j hj\n ring -- −((−1)^{j+1}·C·σ) = (−1)^j·C·σ? (−1)^{j+1} = (−1)^j·(−1) ✓ ring\n```\nDirection: goal Σ (−1)^j C σ = −liCoeff n. rw [liCoeff_eq_sum_sigma]: RHS −liCoeff n → −Σ (−1)^{j+1} C σ. rw [← Finset.sum_neg_distrib]: −Σ f → Σ (−f): Σ (−((−1)^{j+1} C σ)) = ... wait direction: Finset.sum_neg_distrib : Σ (−f) = −Σ f. ← rewrites −Σ f to Σ −f ✓. Goal: Σ (−1)^j C σ = Σ −((−1)^{j+1} C σ). sum_congr + ring ✓.\n\n- S3 : Σ_{j=1}^n (−1:ℂ)^{j−1}·C(n,j) = 1: Σ_{j=1}^n (−1)^{j−1} C(n,j) = −Σ_{j=1}^n (−1)^j C(n,j) = −[(Σ_{j=0}^n (−1)^j C(n,j)) − 1] = −[0 − 1] = 1 (n ≥ 1: (1−1)^n = 0).\nMathlib: `Int.neg_one_pow_sum_choose_eq_zero`? or `add_pow_neg_one`? There's `sum_range_choose_neg_one_pow`? Hmm: the identity Σ_{j=0}^n (−1)^j C(n,j) = 0 for n ≥ 1: Mathlib `sum_range_neg_one_pow_choose_eq_zero`? Not sure of name. Alternative: use `add_pow` : (x+y)^n = Σ C(n,j) x^j y^{n−j} with x = −1, y = 1: ((−1)+1)^n = 0 = Σ C(n,j)·(−1)^j·1 = Σ_{j∈range(n+1)} C(n,j)(−1)^j. Then peel j=0 term = 1: Σ_{j∈Icc 1 n} = Σ_{range(n+1)} − {0}: Ico relationship: range(n+1) = {0} ∪ Icc 1 n (for n ≥ 1): Finset.range_eq_Ico, Ico 0 (n+1) = {0} ∪ Icc 1 n? \n\nLet me do:\n```\nhave hbinom : (∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^j * (n.choose j : ℂ)) = -1 := by\n have h := add_pow (-1 : ℂ) 1 n -- ((−1)+1)^n = Σ_{j∈range(n+1)} C(n,j)·(−1)^j·1^{n−j}\n rw [neg_add_cancel, zero_pow (by omega : n ≠ 0)] at h\n -- h : 0 = Σ_{j∈range(n+1)} C(n,j)·(−1)^j·1^{n−j}\n -- normalize the summand: C·(−1)^j·1 = C·(−1)^j\n rw [Finset.sum_congr rfl (fun j _ => by rw [one_pow, mul_one])] at h\n -- peel j = 0: range(n+1) = insert 0 (Icc 1 n)\n rw [show Finset.range (n+1) = insert 0 (Finset.Icc 1 n) from by\n ext j\n simp [Finset.mem_range, Finset.mem_Icc]\n omega] at h\n rw [Finset.sum_insert (by simp)] at h\n -- h : 0 = C(n,0)·(−1)^0 + Σ_{j∈Icc 1 n} C(n,j)·(−1)^j = 1 + Σ\n rw [Nat.choose_zero_right, pow_zero, mul_one] at h -- hmm C(n,0) = 1: Nat.choose_zero_right : n.choose 0 = 1; cast: ((1:ℕ):ℂ)\n -- h : 0 = 1 + Σ_{Icc}\n ...goal: Σ_{Icc} (−1)^j·C = −1: my sum is (−1)^j * C vs h's C * (−1)^j — mul_comm per term\n```\nGetting long. The summand forms: my target Σ (−1:ℂ)^{j−1}·C: relate to Σ (−1)^j·C via per-term (−1)^{j−1} = −(−1)^j (j ≥ 1: (−1)^{j−1}·(−1) = (−1)^j ✓ ring with pow_succ' or: (−1:ℂ)^{j-1} = -(−1:ℂ)^j — needs j ≥ 1: (−1)^j = (−1)^{j−1+1} = (−1)^{j−1}·(−1): ring can do j−1+1 = j? For j : ℕ with j ≥ 1, ring_nf handles Nat subtraction? NO — ring doesn't handle ℕ truncated sub! Need: (−1:ℂ)^{j-1} = -(−1:ℂ)^j given 1 ≤ j: \n```\nhave hsign : ∀ j : ℕ, 1 ≤ j → ((-1:ℂ))^(j-1) = -((-1:ℂ))^j := by\n intro j hj\n have e : j - 1 + 1 = j := by omega\n calc ((-1:ℂ))^(j-1) = ((-1:ℂ))^(j-1) * 1 := by rw [mul_one]\n _ = -(((-1:ℂ))^(j-1) * (-1:ℂ)) := by ring\n _ = -((-1:ℂ))^(j-1+1) := by rw [pow_succ] -- hmm direction: pow_succ: a^(n+1) = a^n * a; so a^(j−1)*a = a^(j−1+1): ← pow_succ\n _ = -((-1:ℂ))^j := by rw [e]\n```\n✓ (pow_succ : a^(n+1) = a^n * a — ← pow_succ rewrites a^n·a → a^(n+1) ✓.)\n\nSo S3 : Σ_{j∈Icc 1 n} (−1)^{j−1}·C = −Σ (−1)^j C = −(−1) = 1:\n```\nhave hS3 : (∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^(j-1) * (n.choose j : ℂ)) = 1 := by\n rw [Finset.sum_congr rfl (fun j hj => hsign j (Finset.mem_Icc.mp hj).1)] -- rewrites the family? sum_congr produces an equation; rw with it? Finset.sum_congr rfl h : Σ f = Σ g — as rw rule: use `rw [Finset.sum_congr rfl (fun j hj => hsign j ...)]` — hmm sum_congr's conclusion is an equation between two specific sums; rw [that] rewrites the goal's matching sum ✓ pattern works (used before? simpler: trans via have).\n```\nCleaner:\n```\nhave e : (∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^(j-1) * (n.choose j : ℂ)) =\n ∑ j ∈ Finset.Icc 1 n, -((-1:ℂ)^j * (n.choose j : ℂ)) :=\n Finset.sum_congr rfl (fun j hj => by rw [hsign j (Finset.mem_Icc.mp hj).1, neg_mul])\nrw [e, Finset.sum_neg_distrib, hbinom, neg_neg]\n```\n\nThen the crux assembly:\n```\nhave hid : ResW1 n = ((SInfty n : ℝ) : ℂ) + 1 - liCoeff n := by\n rw [ResW1_eq_sum]\n have hterms : (∑ j ∈ Finset.Icc 1 n, (n.choose j : ℂ) * lcoeff (j - 1)) =\n (∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^j * (n.choose j : ℂ) * (lagariasA j : ℝ)) +\n (∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^j * (n.choose j : ℂ) * sigmaP j) +\n (∑ j ∈ Finset.Icc 1 n, (-1:ℂ)^(j-1) * (n.choose j : ℂ)) := by\n rw [← Finset.sum_add, ← Finset.sum_add]\n apply Finset.sum_congr rfl\n intro j hj\n have hj1 : 1 ≤ j := (Finset.mem_Icc.mp hj).1\n rw [lagarias_4_10_a hZC hj1]\n ring\n rw [hterms, hS, hL, hS3]\n -- ((SInfty):ℂ) + (−liCoeff) + 1 = ((SInfty):ℂ) + 1 − liCoeff ✓ ring\n ring\n-- take re:\nrw [hid]\nsimp [Sf] -- (((SInfty):ℂ) + 1 − liCoeff n).re = SInfty + 1 − (liCoeff n).re\n```\nThe .re: (ResW1 n).re = Sf n: rw [hid]: (((SInfty n : ℝ):ℂ) + 1 − liCoeff n).re = Sf n. Sf n := SInfty n + 1 − (liCoeff n).re. LHS: Complex.sub_re/add_re/ofReal_re/one_re: ((X:ℂ) + 1 − Y).re = X.re + 1 − Y.re... where X = ↑(SInfty n): X.re = SInfty n (Complex.ofReal_re). simp [Complex.add_re, Complex.sub_re, Complex.ofReal_re, Complex.one_re, Sf] should close. Or:\n```\nrw [hid, Sf]\nsimp only [Complex.sub_re, Complex.add_re, Complex.ofReal_re, Complex.one_re]\n```\n\nWait — the 4.10-a's cast in the per-term rw: lagarias_4_10_a hZC hj1 : lcoeff (j−1) = (−1:ℂ)^j * ((lagariasA j : ℝ) + sigmaP j) + (−1:ℂ)^(j−1) — with k := j (needs the k−1 = j−1 forms matching: statement is lcoeff (k−1) = (−1)^k·(a_k + σ_k) + (−1)^{k−1}: at k := j ✓ directly matches, no Nat.add_sub_cancel needed).\n\nTerm ring: C·[(−1)^j·(a+σ) + (−1)^{j−1}] = (−1)^j·C·a + (−1)^j·C·σ + (−1)^{j−1}·C ✓ ring (a here = ↑(lagariasA j) — ring treats as atom ✓).\n\nNow, one important check on lagarias_4_10_a's statement: sigmaP k with k := m+1 vs the use at k := j — fine, general.\n\nAlso: (4.10-a) needs hZC — the full crux sf_eq_resW1 then takes hZC ✓.\n\nPlan the file: LiCrux.lean:\n- imports: Mathlib, NguyenRH1.LiMoments, NguyenRH1.LiArchimedean, NguyenRH1.LiZetaCoeff, NguyenRH1.LiSkeleton.\n\nCheck LiSkeleton import chain: LiSkeleton imports what? It defines Sf/SInfty/liCoeff. liCoeff_eq_sum_sigma (LiSwaps) uses liCoeff from LiSkeleton? LiSwaps imports LiSkeleton presumably. And SInfty in LiSkeleton:380. sInfty_eq_sum in LiSwaps uses SInfty ✓.\n\nOrder in file:\n1. gFun_one_sub (the function identity, FE) → iteratedDeriv_gFun_zero.\n2. gFun_one_add_punctured.\n3. gFun_one_add_eventuallyEq.\n4. iteratedDeriv_gFun_one.\n5. lagarias_4_10_a.\n6. sf_eq_resW1.\n\nLet me also double check `differentiableAt_Gammaℝ_of_not_neg_nat` signature (grep LiCircleBound).","signature":""},{"type":"text","text":"All pieces confirmed. Checking `differentiableAt_Gammaℝ_of_not_neg_nat`'s exact signature, then writing LiCrux.lean."},{"type":"tool_use","id":"Grep_100","name":"Grep","input":{"pattern":"lemma differentiableAt_Gammaℝ_of_not_neg_nat|theorem differentiableAt_Gammaℝ_of_not_neg_nat","path":"D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1","output_mode":"content","-n":true,"-A":4},"extra_content":null}]