← Session 30 — ii′-5e squeeze capstone + 5f perimeter repair
thinking (14976 chars)
- `tsum_split_finset (hf : Summable f) (s : Finset ι) : ∑' i, f i = ∑ i ∈ s, f i + ∑' i, (if i ∈ s then 0 else f i)` — over ℝ-valued f. The series is ℂ-valued (seriesTerm is ℂ). Need the ℂ version — the proof pattern works for any normed group; check if tsum_split_finset is stated for ℝ only. It says {f : ι → ℝ}. For ℂ I'll need a ℂ analog (copy the proof pattern or generalize — easiest: write the ℂ version inline in LiTightR via tsum_eq_sum + the if-zeroed summable).
Actually, hmm: maybe simpler to phrase the difference-series split via the SUBTYPE filter: seriesFun is ∑' over {ρ // IsNontrivialZero ρ}. The near set as a subtype finset: nearZerosSub t : Finset {ρ // IsNontrivialZero ρ} := (zeroAbsWindow... hmm. Let me think about what the capstone statement's near sum looks like: `∑ ρ ∈ nearZeros t, (zeroMult ρ : ℂ) / (s - ρ)` (Finset ℂ sum, matching LiDisc's capstone). The series split: seriesFun s − seriesFun s₀ = Σ' all m(1/(s−ρ) − 1/(s₀−ρ)). Split the tsum by the subtype finset {ρ : subtype | (ρ:ℂ) ∈ nearZeros t}:
Σ'all = Σ_{subtype near} + Σ'_{not-near}.
And Σ_{subtype near} (fun ρ => m·(1/(s−ρ) − 1/(s₀−ρ))) = Σ_{ρ ∈ nearZeros t} m·(1/(s−ρ) − 1/(s₀−ρ)) (the subtype-to-ambient finset sum bridge: Finset.sum_subtype... `Finset.sum_subtype (s : Finset α) {p : α → Prop} (h : ∀ x, x ∈ s ↔ p x) (f : {x // p x} → β) : ∑ x : {x // p x}, f x = ...`? There's `Finset.sum_subtype` hmm or for our direction: the subtype finset is s.subtype p := {x : {x // p x} | (x:α) ∈ s}. `Finset.sum_subtype (s : Finset α) (h : ∀ x, x ∈ s ↔ p x) (f)`: ∑ x in s.subtype p, f x = ∑ x in s, ... hmm the standard: `Finset.sum_subtype (s : Finset α) {p : α → Prop} [DecidablePred p] (h : ∀ x, x ∈ s ↔ p x) (f : {a // p a} → β) : ∑ x : {a // p a}, f x = ∑ x ∈ s, if h' : p x then f ⟨x, h'⟩ else 0`? Something like that. Or use `Finset.sum_finset_coe`... There might be a cleaner route: `Finset.sum_attach`? Hmm.
Alternative cleaner: define the near sum directly over the subtype finset nearZerosSub t := (zeroAbsWindowSub t).filter... Let me define:
```lean
def nearZerosSub (t : ℝ) : Finset {ρ : ℂ // IsNontrivialZero ρ} :=
(finite-of-subtype).toFinset.filter (fun ρ => |ρ.1.im − t| < 1)
```
hmm — the subtype's finite-in-balls machinery: LiCircleBound had `finite_subtype_norm_lt` — and the near subtype: {ρ : subtype | |im − t| < 1} is finite (contained in a norm ball: ‖ρ‖ ≤ |im|+1 ≤ |t|+2). So:
```lean
def nearZerosSub (t : ℝ) : Finset {ρ : ℂ // IsNontrivialZero ρ} :=
(finite_subtype_norm_lt (|t| + 3)).toFinset.filter fun ρ => |ρ.1.im − t| < 1
```
wait — need the filter to catch exactly the near zeros: the toFinset contains all subtype zeros with ‖ρ‖ < |t|+3; a near zero has ‖ρ‖ = √(re²+γ²) ≤ 1+|γ| ≤ 1+|t|+1 = |t|+2 < |t|+3 ✓ so the filter over that ball captures all near zeros ✓ (any near zero not in the ball would be missed — but ‖ρ‖ < |t|+3 covers all near ✓). Hmm — but for the sum bridge I need: Σ over nearZerosSub = Σ over nearZeros (ℂ-finset). And the split: Σ' over subtype = Σ nearZerosSub + Σ' complement.
This subtype/ambient bridging is fiddly but routine. Given context budget, let me now write the 5f-i file with:
1. `diffSeries` def + summability + the seriesFun difference identity.
2. The near/far split + the subtype-ambient bridge.
3. The R(s) identity (the six-piece decomposition).
4. Pieces 1, 2, 4, 5.
5. Leave pieces 3, 6 as `sorry`-free separate lemmas with the assembly taking them as hypotheses? NO — no sorries allowed. Better: structure the file so pieces 3 and 6 are their own theorems proved in 5f-ii, and the capstone assembly in 5f-iii. For THIS session, build: the identity + pieces 1, 2, 4, 5 as standalone lemmas + commit. The capstone comes in 5f-iii when all pieces exist.
Hmm — wait, actually, let me reconsider the diffSeries summability: seriesSummable gives Summable (seriesTerm s) for each s. Summable (fun ρ => seriesTerm s ρ − seriesTerm s₀ ρ) = Summable.sub seriesSummable seriesSummable ✓. And tsum_sub: ∑' (f − g) = ∑' f − ∑' g ✓. Termwise: seriesTerm s ρ − seriesTerm s₀ ρ = m·(1/(s−ρ) − 1/(s₀−ρ)): ring-ish: m·(1/(s−ρ)+1/ρ) − m·(1/(s₀−ρ)+1/ρ) = m·(1/(s−ρ) − 1/(s₀−ρ)) — by ring (field-free: it's just add/sub of the products — ring works over ℂ with the divisions as atoms? The identity m·(a+b) − m·(c+b) = m·(a−c) is pure ring ✓ with a,b,c atoms ✓).
Define diffSeriesTerm s s₀ ρ := (zeroMult ρ : ℂ)·(1/(s−ρ) − 1/(s₀−ρ)) hmm wait — actually simpler to keep everything in the seriesTerm difference form and only introduce the (s₀−s)/((s−ρ)(s₀−ρ)) form in piece 3.
The identity lemma:
```lean
theorem seriesFun_sub_seriesFun (s s₀ : ℂ) :
seriesFun s - seriesFun s₀ = ∑' ρ : {ρ // IsNontrivialZero ρ},
(zeroMult ρ : ℂ) * (1 / (s - ρ.1) - 1 / (s₀ - ρ.1)) := by
rw [seriesFun, seriesFun, ← tsum_sub seriesSummable seriesSummable]
exact tsum_congr fun ρ => by rw [seriesTerm, seriesTerm]; ring
```
seriesSummable's signature: from LiSeries — `seriesSummable (s : ℂ)? : Summable (seriesTerm s)`? Let me check: "seriesSummable at EVERY s" — theorem seriesSummable (s : ℂ) : Summable (fun ρ => seriesTerm s ρ)? approx. And tsum_sub (hf : Summable f) (hg : Summable g) : ∑' i, (f i − g i) = ∑' f − ∑' g — so ← direction: ∑' f − ∑' g = ∑' (f−g) ✓. And the congr: seriesTerm s ρ − seriesTerm s₀ ρ = m·(1/(s−ρ) − 1/(s₀−ρ)) by ring ✓ (divisions as atoms — ring handles: m*(a+b) − m*(c+b) = m*(a−c) ✓ pure ring identity in variables a = 1/(s−ρ), b = 1/ρ, c = 1/(s₀−ρ) ✓).
Then the R-identity:
```lean
theorem Rexpr_eq (hZC : ZeroCountProp) {t : ℝ} (ht : 10 ≤ t) {s : ℂ} (him : s.im = t)
(hζ : riemannZeta s ≠ 0) ... :
logDeriv riemannZeta s - ∑ ρ ∈ nearZeros t, (zeroMult ρ : ℂ) / (s - ρ)
= logDeriv riemannZeta (2 + t * I) - nearSum₀ + farSum - (1/s − 1/s₀) − ...
```
hmm — wait. Actually do I even need the IDENTITY as a separate lemma? The capstone: ‖R(s)‖ ≤ ... — the proof: rw the identity then norm-chain. Let me structure:
```lean
/-- The reference-point decomposition of the R-expression. -/
theorem Rexpr_decomp (hZC : ZeroCountProp) {s s₀ : ℂ}
(hs : riemannZeta s ≠ 0) (hs0 : s ≠ 0) (hs1 : s ≠ 1)
(hst : ∀ n : ℕ, 1 ≤ n → s ≠ -2 * (n : ℂ))
(hs₀ : riemannZeta s₀ ≠ 0) (hs₀0 : s₀ ≠ 0) (hs₀1 : s₀ ≠ 1)
(hs₀t : ∀ n : ℕ, 1 ≤ n → s₀ ≠ -2 * (n : ℂ))
(t : ℝ) :
logDeriv riemannZeta s - ∑ ρ ∈ nearZeros t, (zeroMult ρ : ℂ) / (s - ρ)
= logDeriv riemannZeta s₀
- ∑ ρ ∈ nearZeros t, (zeroMult ρ : ℂ) / (s₀ - ρ)
+ (∑' ρ : {ρ // IsNontrivialZero ρ}, if (ρ : ℂ) ∈ nearZeros t then 0 else
(zeroMult ρ : ℂ) * (1 / (s - ρ.1) - 1 / (s₀ - ρ.1)))
- (1 / s - 1 / s₀) - (1 / (s - 1) - 1 / (s₀ - 1))
- (Complex.digamma (s / 2) - Complex.digamma (s₀ / 2)) / 2 := ...
```
Wait — the split needs the tsum over the subtype split by membership in nearZeros t (a Finset ℂ, membership of ρ.1). tsum_split_finset is over ℝ — need the ℂ version. Let me just prove a local ℂ tsum_split via tsum_eq_sum:
```lean
lemma tsum_split_finset_complex {ι : Type*} [DecidableEq ι] {f : ι → ℂ} (hf : Summable f)
(s : Finset ι) : ∑' i, f i = ∑ i ∈ s, f i + ∑' i, if i ∈ s then 0 else f i := ...
```
Copy LiCircleBound's proof (it's ~15 lines: Summable.of_norm_bounded for the if-parts + tsum_add + tsum_eq_sum). OR — check if LiCircleBound's tsum_split_finset generalizes: it's stated for ℝ. The proof: Summable (if i ∈ s then f i else 0) via of_norm_bounded hf.norm... For ℂ same proof works with the right generality — I'll write the ℂ variant in LiTightR (or better: check whether the existing one is used... it might already exist generically somewhere. Whatever — 15 lines.)
Hmm, wait — actually maybe I can avoid the ℂ split: the identity R(s) = ... doesn't need the tsum SPLIT at the identity level — I can bound ‖R(s)‖ by first writing:
R(s) = [logDeriv ζ s₀] + [−Σ_near m/(s₀−ρ)] + [Σ'_all m(1/(s−ρ)−1/(s₀−ρ)) − Σ_near m(1/(s−ρ) − 1/(s₀−ρ))...] — no, the far sum IS the difference. The identity:
Σ'_all diff = Σ_near diff + Σ'_far diff (split)
R(s) = logDeriv ζ s − Σ_near m/(s−ρ)
= [logDeriv ζ s₀ + (seriesFun s − seriesFun s₀) − (1/s−1/s₀) − ... ] − Σ_near m/(s−ρ)
= logDeriv ζ s₀ + Σ'_all diff − Σ_near m/(s−ρ) − elems
= logDeriv ζ s₀ + Σ_near diff + Σ'_far diff − Σ_near m/(s−ρ) − elems
= logDeriv ζ s₀ + Σ_near m·(1/(s−ρ) − 1/(s₀−ρ)) − Σ_near m/(s−ρ) + Σ'_far diff − elems
= logDeriv ζ s₀ − Σ_near m/(s₀−ρ) + Σ'_far diff − elems ✓.
So the identity needs: (i) the two partialFraction_identity instances, (ii) seriesFun difference = Σ'_all diff, (iii) the tsum split (ℂ), (iv) the subtype↔ambient bridge for the near sums: Σ over the subtype finset {ρ : subtype | ρ.1 ∈ nearZeros t} of f = Σ over nearZeros t of f∘coe. For (iv): Finset.sum_subtype? The lemma: `Finset.sum_subtype (s : Finset α) (h : ∀ x, x ∈ s ↔ p x) (f : {x // p x} → β) : ∑ x : {x // p x}, f x = ∑ x ∈ s, ...` hmm actually I recall: `Finset.sum_subtype (s : Finset α) {p : α → Prop} [DecidablePred p] (h : ∀ x, x ∈ s ↔ p x) (f : {a // p a} → β) : ∑ x : {a // p a}, f x = ∑ x ∈ s with hp : p x... ` no. The actual Mathlib lemma: `Finset.sum_subtype : ∑ x ∈ s.subtype p, f x = ∑ x ∈ s, if h : p x then f ⟨x, h⟩ else 0`? There's `Finset.sum_subtype (s : Finset α) {p} (h : ∀ x, x ∈ s ↔ p x) (f : {x // p x} → M) : ∑ x : {x // p x}, f x = ∑ x ∈ s.attach... ` hmm. Let me look at it: Mathlib has `Finset.sum_subtype`:
```
theorem Finset.sum_subtype {p : α → Prop} [DecidablePred p] {F : Type*} [AddCommMonoid F]
(s : Finset α) (h : ∀ x, x ∈ s ↔ p x) (f : { x // p x } → F) :
∑ x : { x // p x }, f x = ∑ x ∈ s, if h' : p x then f ⟨x, h'⟩ else 0 := ...
```
Hmm no — the sum on the LHS is over the TYPE {x // p x} which requires a Fintype instance. The right form: `∑ x in s.subtype p, f x = ∑ x in s, ...`? For our case: the subtype finset is `nearZerosSub t := (something).toFinset.filter ...`. Ugh.
Cleaner: keep the near sums in the SUBTYPE throughout the identity, and bridge to the ambient nearZeros only at the capstone. I.e., define:
```lean
def nearZerosSub (t : ℝ) : Finset {ρ : ℂ // IsNontrivialZero ρ} :=
((finite_subtype_norm_lt (|t| + 3)).toFinset).filter (fun ρ => |ρ.1.im − t| < 1)
```
Hmm — finite_subtype_norm_lt (X : ℝ) : {ρ : subtype | ‖ρ.1‖ < X}.Finite (from LiSeries, used in 5e). Then the near-sum over nearZerosSub. Bridge to ambient: Σ ρ ∈ nearZerosSub t, f ρ.1 = Σ ρ ∈ nearZeros t, f ρ — via Finset.sum_subtype-like: nearZerosSub t is the filter of a toFinset of a subtype finite set; the ambient nearZeros t is a filter of zeroDiscFinset. The membership correspondence: ρ.1 ∈ nearZeros t ↔ IsNontrivialZero ρ.1 ∧ |ρ.1.im − t| < 1 (via zeroDiscFinset's mem + the disc containment) — and ρ ∈ nearZerosSub t ↔ (ρ.1 near). Then the sum bridge: `Finset.sum_subtype`... Actually the cleanest: use `Finset.sum_finset_coe`? hmm. There's `Finset.sum_coe_sort`: `∑ x : s, f x = ∑ x ∈ s, f x` where the LHS is over the coercion of s to a type (s : Finset α) → (s : Type*) — ∑ x : ↥s, f x.1 = ∑ x ∈ s, f x ✓ THAT's the bridge: `Finset.sum_coe_sort (s : Finset α) (f : α → β) : ∑ x : s, f x = ∑ x ∈ s, f x`? Signature: `Finset.sum_coe_sort (s : Finset α) (f : s → M)?`... Hmm — actually for the near sum I can work the other direction: prove the identity with the near sums over the subtype finset nearZerosSub, and for the capstone statement rewrite Σ over nearZeros t as Σ over nearZerosSub t via sum_coe_sort-style bridges ONCE.
Honestly — the near-sum form in the capstone matches LiDisc's capstone: `∑ ρ ∈ nearZeros t, (zeroMult ρ : ℂ) / (s - ρ)`. To minimize bridging pain, maybe restate the capstone's near sum as a subtype sum: `∑ ρ ∈ nearZerosSub t, (zeroMult ρ.1 : ℂ) / (s - ρ.1)`. The ii′-6 consumer doesn't exist yet — I'm free to choose the form! The subtype form is actually CLEANER for the consumer (the series is subtype-based). DECISION: the capstone's near sum is over `nearZerosSub t` (the subtype finset). No ambient bridge needed at all.
Let me define nearZerosSub carefully. Requirements: ρ ∈ nearZerosSub t ↔ |ρ.1.im − t| < 1 (for subtype ρ). Via filter over a containing toFinset: any near subtype zero has ‖ρ.1‖ ≤ √(re² + im²) ≤ re + |im| ≤ 1 + (|t| + 1) = |t| + 2. So:
def nearZerosSub (t : ℝ) : Finset {ρ : ℂ // IsNontrivialZero ρ} :=
(finite_subtype_norm_lt (|t| + 3)).toFinset.filter (fun ρ => |ρ.1.im − t| < 1)
mem: ρ ∈ nearZerosSub t ↔ ρ ∈ toFinset ∧ near. ρ ∈ (finite_subtype_norm_lt X).toFinset ↔ ‖ρ.1‖ < X. For the mem characterization: ρ ∈ nearZerosSub t ↔ |ρ.1.im − t| < 1 — forward: trivial (filter). Backward: need ‖ρ.1‖ < |t| + 3 from |im − t| < 1: ‖ρ.1‖ ≤ |re| + |im| ≤ 1 + (|t|+1) = |t|+2 < |t|+3 ✓ (‖ρ‖ ≤ |re ρ| + |im ρ| via norm ≤ ...: ‖z‖ = √(re²+im²) ≤ |re| + |im| — lemma: Complex.norm_le_abs_re_add_abs_im ✓ exists I believe; re ρ ∈ (0,1) from IsNontrivialZero; |im| ≤ |im − t| + |t| ≤ 1 + |t| ✓).
finite_subtype_norm_lt — check the exact name in LiSeries/LiCircleBound: from 5e-iii: "finite_subtype_norm_lt" — used: `(finite_subtype_norm_lt 4).subset ...` at lowZeros def: `(finite_subtype_norm_lt 4)` : {ρ : subtype | ‖ρ.1‖ < 4}.Finite? The lowZeros def used `(finite_subtype_norm_lt 4).subset (fun ρ hρ => lt_of_le_of_lt ...)` — so finite_subtype_norm_lt X : {ρ // IsNontrivialZero ρ ∧ ‖ρ‖ < X}? hmm — the lowZeros def: `(show {ρ : {ρ // IsNontrivialZero ρ} | ‖(ρ : ℂ)‖ ≤ 3}.Finite from (finite_subtype_norm_lt 4).subset (fun ρ hρ => lt_of_le_of_lt (show ‖(ρ:ℂ)‖ ≤ 3 from hρ) (by norm_num)))`. So finite_subtype_norm_lt 4 : {ρ : subtype | ‖ρ.1‖ < 4}.Finite where hρ : ‖ρ.1‖ ≤ 3 → ‖ρ.1‖ < 4 via the subset's hρ — the subset fn takes hρ : ρ ∈ {‖ρ‖ ≤ 3}... wait the subset direction: (finite_subtype_norm_lt 4) is the Finiteness of {‖ρ‖ < 4}; .subset (fun ρ hρ => ...) : {‖ρ‖ ≤ 3} ⊆ {‖ρ‖ < 4} where hρ : ρ ∈ {‖ρ‖ ≤ 3} i.e. ‖ρ‖ ≤ 3, and the fn returns lt_of_le_of_lt hρ (3 < 4) : ‖ρ‖ < 4 ✓. OK so finite_subtype_norm_lt (X) : {ρ : {ρ // IsNontrivialZero ρ} | ‖ρ.1‖ < X}.Finite ✓.
Now the split form: Σ'_subtype diff = Σ_{nearZerosSub} diff + Σ'_{if-not-near} diff. With tsum_split_finset_complex (the ℂ variant) at the subtype.
OK — I have a clear picture of 5f-i. Given context budget, let me now write the file with:
1. tsum_split_finset_complex (ℂ variant).
2. nearZerosSub + mem characterization.
3. seriesFun_sub_seriesFun (the difference identity).
4. Rexpr_decomp (the six-piece identity).
5. Piece 1: dirichletC2 ≤ 0.995 (the integral bound).
6. Piece 2: near sum at s₀ ≤ P1-count.
7. Pieces 4, 5: the elementary reciprocals.
Pieces 3, 6 and the assembly in later chunks. Actually — piece 1's integral bound is the meatiest of these. Let me check what integral comparison machinery exists. Actually — simpler for piece 1: I need Σ_{n≥4} log n/n² ≤ (log 3 + 1)/3. Route: the function f(x) = log x/x² is decreasing on [3, ∞) (deriv = (1−2 log x)/x³ < 0 for x > e^{1/2}). The comparison: Σ_{n≥4} f(n) ≤ ∫₃^∞ f. Mathlib: is there `Real.tsum_le_integral_of_decreasing`? Let me grep quickly. There's `integral_test` machinery in Mathlib.Analysis... Let me search.
Checking piece-1 machinery (integral comparison for the tail) before writing.
tool: Bash
input
{
"command": "M=D:/Python/Quantum/zeta-23-lean/.lake/packages/mathlib/Mathlib; grep -rn \"tsum_le_integral\\|sum_le_integral\" $M --include=\"*.lean\" | grep -i \"theorem\\|lemma\" | head -8; echo ===; grep -rn \"theorem.*integral.*log.*div.*pow\\|integral_log_div\" $M/Analysis/SpecialFunctions/Integrals.lean 2>/dev/null | head -4",
"description": "Search for series-integral comparison lemmas"
}
raw content_json (database row)
[{"type":"thinking","thinking":"- `tsum_split_finset (hf : Summable f) (s : Finset ι) : ∑' i, f i = ∑ i ∈ s, f i + ∑' i, (if i ∈ s then 0 else f i)` — over ℝ-valued f. The series is ℂ-valued (seriesTerm is ℂ). Need the ℂ version — the proof pattern works for any normed group; check if tsum_split_finset is stated for ℝ only. It says {f : ι → ℝ}. For ℂ I'll need a ℂ analog (copy the proof pattern or generalize — easiest: write the ℂ version inline in LiTightR via tsum_eq_sum + the if-zeroed summable).\n\nActually, hmm: maybe simpler to phrase the difference-series split via the SUBTYPE filter: seriesFun is ∑' over {ρ // IsNontrivialZero ρ}. The near set as a subtype finset: nearZerosSub t : Finset {ρ // IsNontrivialZero ρ} := (zeroAbsWindow... hmm. Let me think about what the capstone statement's near sum looks like: `∑ ρ ∈ nearZeros t, (zeroMult ρ : ℂ) / (s - ρ)` (Finset ℂ sum, matching LiDisc's capstone). The series split: seriesFun s − seriesFun s₀ = Σ' all m(1/(s−ρ) − 1/(s₀−ρ)). Split the tsum by the subtype finset {ρ : subtype | (ρ:ℂ) ∈ nearZeros t}:\n Σ'all = Σ_{subtype near} + Σ'_{not-near}.\nAnd Σ_{subtype near} (fun ρ => m·(1/(s−ρ) − 1/(s₀−ρ))) = Σ_{ρ ∈ nearZeros t} m·(1/(s−ρ) − 1/(s₀−ρ)) (the subtype-to-ambient finset sum bridge: Finset.sum_subtype... `Finset.sum_subtype (s : Finset α) {p : α → Prop} (h : ∀ x, x ∈ s ↔ p x) (f : {x // p x} → β) : ∑ x : {x // p x}, f x = ...`? There's `Finset.sum_subtype` hmm or for our direction: the subtype finset is s.subtype p := {x : {x // p x} | (x:α) ∈ s}. `Finset.sum_subtype (s : Finset α) (h : ∀ x, x ∈ s ↔ p x) (f)`: ∑ x in s.subtype p, f x = ∑ x in s, ... hmm the standard: `Finset.sum_subtype (s : Finset α) {p : α → Prop} [DecidablePred p] (h : ∀ x, x ∈ s ↔ p x) (f : {a // p a} → β) : ∑ x : {a // p a}, f x = ∑ x ∈ s, if h' : p x then f ⟨x, h'⟩ else 0`? Something like that. Or use `Finset.sum_finset_coe`... There might be a cleaner route: `Finset.sum_attach`? Hmm.\n\nAlternative cleaner: define the near sum directly over the subtype finset nearZerosSub t := (zeroAbsWindowSub t).filter... Let me define:\n```lean\ndef nearZerosSub (t : ℝ) : Finset {ρ : ℂ // IsNontrivialZero ρ} :=\n (finite-of-subtype).toFinset.filter (fun ρ => |ρ.1.im − t| < 1)\n```\nhmm — the subtype's finite-in-balls machinery: LiCircleBound had `finite_subtype_norm_lt` — and the near subtype: {ρ : subtype | |im − t| < 1} is finite (contained in a norm ball: ‖ρ‖ ≤ |im|+1 ≤ |t|+2). So:\n```lean\ndef nearZerosSub (t : ℝ) : Finset {ρ : ℂ // IsNontrivialZero ρ} :=\n (finite_subtype_norm_lt (|t| + 3)).toFinset.filter fun ρ => |ρ.1.im − t| < 1\n```\nwait — need the filter to catch exactly the near zeros: the toFinset contains all subtype zeros with ‖ρ‖ < |t|+3; a near zero has ‖ρ‖ = √(re²+γ²) ≤ 1+|γ| ≤ 1+|t|+1 = |t|+2 < |t|+3 ✓ so the filter over that ball captures all near zeros ✓ (any near zero not in the ball would be missed — but ‖ρ‖ < |t|+3 covers all near ✓). Hmm — but for the sum bridge I need: Σ over nearZerosSub = Σ over nearZeros (ℂ-finset). And the split: Σ' over subtype = Σ nearZerosSub + Σ' complement.\n\nThis subtype/ambient bridging is fiddly but routine. Given context budget, let me now write the 5f-i file with:\n1. `diffSeries` def + summability + the seriesFun difference identity.\n2. The near/far split + the subtype-ambient bridge.\n3. The R(s) identity (the six-piece decomposition).\n4. Pieces 1, 2, 4, 5.\n5. Leave pieces 3, 6 as `sorry`-free separate lemmas with the assembly taking them as hypotheses? NO — no sorries allowed. Better: structure the file so pieces 3 and 6 are their own theorems proved in 5f-ii, and the capstone assembly in 5f-iii. For THIS session, build: the identity + pieces 1, 2, 4, 5 as standalone lemmas + commit. The capstone comes in 5f-iii when all pieces exist.\n\nHmm — wait, actually, let me reconsider the diffSeries summability: seriesSummable gives Summable (seriesTerm s) for each s. Summable (fun ρ => seriesTerm s ρ − seriesTerm s₀ ρ) = Summable.sub seriesSummable seriesSummable ✓. And tsum_sub: ∑' (f − g) = ∑' f − ∑' g ✓. Termwise: seriesTerm s ρ − seriesTerm s₀ ρ = m·(1/(s−ρ) − 1/(s₀−ρ)): ring-ish: m·(1/(s−ρ)+1/ρ) − m·(1/(s₀−ρ)+1/ρ) = m·(1/(s−ρ) − 1/(s₀−ρ)) — by ring (field-free: it's just add/sub of the products — ring works over ℂ with the divisions as atoms? The identity m·(a+b) − m·(c+b) = m·(a−c) is pure ring ✓ with a,b,c atoms ✓).\n\nDefine diffSeriesTerm s s₀ ρ := (zeroMult ρ : ℂ)·(1/(s−ρ) − 1/(s₀−ρ)) hmm wait — actually simpler to keep everything in the seriesTerm difference form and only introduce the (s₀−s)/((s−ρ)(s₀−ρ)) form in piece 3.\n\nThe identity lemma:\n```lean\ntheorem seriesFun_sub_seriesFun (s s₀ : ℂ) :\n seriesFun s - seriesFun s₀ = ∑' ρ : {ρ // IsNontrivialZero ρ},\n (zeroMult ρ : ℂ) * (1 / (s - ρ.1) - 1 / (s₀ - ρ.1)) := by\n rw [seriesFun, seriesFun, ← tsum_sub seriesSummable seriesSummable]\n exact tsum_congr fun ρ => by rw [seriesTerm, seriesTerm]; ring\n```\nseriesSummable's signature: from LiSeries — `seriesSummable (s : ℂ)? : Summable (seriesTerm s)`? Let me check: \"seriesSummable at EVERY s\" — theorem seriesSummable (s : ℂ) : Summable (fun ρ => seriesTerm s ρ)? approx. And tsum_sub (hf : Summable f) (hg : Summable g) : ∑' i, (f i − g i) = ∑' f − ∑' g — so ← direction: ∑' f − ∑' g = ∑' (f−g) ✓. And the congr: seriesTerm s ρ − seriesTerm s₀ ρ = m·(1/(s−ρ) − 1/(s₀−ρ)) by ring ✓ (divisions as atoms — ring handles: m*(a+b) − m*(c+b) = m*(a−c) ✓ pure ring identity in variables a = 1/(s−ρ), b = 1/ρ, c = 1/(s₀−ρ) ✓).\n\nThen the R-identity:\n```lean\ntheorem Rexpr_eq (hZC : ZeroCountProp) {t : ℝ} (ht : 10 ≤ t) {s : ℂ} (him : s.im = t)\n (hζ : riemannZeta s ≠ 0) ... :\n logDeriv riemannZeta s - ∑ ρ ∈ nearZeros t, (zeroMult ρ : ℂ) / (s - ρ)\n = logDeriv riemannZeta (2 + t * I) - nearSum₀ + farSum - (1/s − 1/s₀) − ... \n```\nhmm — wait. Actually do I even need the IDENTITY as a separate lemma? The capstone: ‖R(s)‖ ≤ ... — the proof: rw the identity then norm-chain. Let me structure:\n\n```lean\n/-- The reference-point decomposition of the R-expression. -/\ntheorem Rexpr_decomp (hZC : ZeroCountProp) {s s₀ : ℂ}\n (hs : riemannZeta s ≠ 0) (hs0 : s ≠ 0) (hs1 : s ≠ 1)\n (hst : ∀ n : ℕ, 1 ≤ n → s ≠ -2 * (n : ℂ))\n (hs₀ : riemannZeta s₀ ≠ 0) (hs₀0 : s₀ ≠ 0) (hs₀1 : s₀ ≠ 1)\n (hs₀t : ∀ n : ℕ, 1 ≤ n → s₀ ≠ -2 * (n : ℂ))\n (t : ℝ) :\n logDeriv riemannZeta s - ∑ ρ ∈ nearZeros t, (zeroMult ρ : ℂ) / (s - ρ)\n = logDeriv riemannZeta s₀\n - ∑ ρ ∈ nearZeros t, (zeroMult ρ : ℂ) / (s₀ - ρ)\n + (∑' ρ : {ρ // IsNontrivialZero ρ}, if (ρ : ℂ) ∈ nearZeros t then 0 else\n (zeroMult ρ : ℂ) * (1 / (s - ρ.1) - 1 / (s₀ - ρ.1)))\n - (1 / s - 1 / s₀) - (1 / (s - 1) - 1 / (s₀ - 1))\n - (Complex.digamma (s / 2) - Complex.digamma (s₀ / 2)) / 2 := ...\n```\nWait — the split needs the tsum over the subtype split by membership in nearZeros t (a Finset ℂ, membership of ρ.1). tsum_split_finset is over ℝ — need the ℂ version. Let me just prove a local ℂ tsum_split via tsum_eq_sum:\n\n```lean\nlemma tsum_split_finset_complex {ι : Type*} [DecidableEq ι] {f : ι → ℂ} (hf : Summable f)\n (s : Finset ι) : ∑' i, f i = ∑ i ∈ s, f i + ∑' i, if i ∈ s then 0 else f i := ...\n```\nCopy LiCircleBound's proof (it's ~15 lines: Summable.of_norm_bounded for the if-parts + tsum_add + tsum_eq_sum). OR — check if LiCircleBound's tsum_split_finset generalizes: it's stated for ℝ. The proof: Summable (if i ∈ s then f i else 0) via of_norm_bounded hf.norm... For ℂ same proof works with the right generality — I'll write the ℂ variant in LiTightR (or better: check whether the existing one is used... it might already exist generically somewhere. Whatever — 15 lines.)\n\nHmm, wait — actually maybe I can avoid the ℂ split: the identity R(s) = ... doesn't need the tsum SPLIT at the identity level — I can bound ‖R(s)‖ by first writing:\nR(s) = [logDeriv ζ s₀] + [−Σ_near m/(s₀−ρ)] + [Σ'_all m(1/(s−ρ)−1/(s₀−ρ)) − Σ_near m(1/(s−ρ) − 1/(s₀−ρ))...] — no, the far sum IS the difference. The identity:\nΣ'_all diff = Σ_near diff + Σ'_far diff (split)\nR(s) = logDeriv ζ s − Σ_near m/(s−ρ)\n = [logDeriv ζ s₀ + (seriesFun s − seriesFun s₀) − (1/s−1/s₀) − ... ] − Σ_near m/(s−ρ)\n = logDeriv ζ s₀ + Σ'_all diff − Σ_near m/(s−ρ) − elems\n = logDeriv ζ s₀ + Σ_near diff + Σ'_far diff − Σ_near m/(s−ρ) − elems\n = logDeriv ζ s₀ + Σ_near m·(1/(s−ρ) − 1/(s₀−ρ)) − Σ_near m/(s−ρ) + Σ'_far diff − elems\n = logDeriv ζ s₀ − Σ_near m/(s₀−ρ) + Σ'_far diff − elems ✓.\nSo the identity needs: (i) the two partialFraction_identity instances, (ii) seriesFun difference = Σ'_all diff, (iii) the tsum split (ℂ), (iv) the subtype↔ambient bridge for the near sums: Σ over the subtype finset {ρ : subtype | ρ.1 ∈ nearZeros t} of f = Σ over nearZeros t of f∘coe. For (iv): Finset.sum_subtype? The lemma: `Finset.sum_subtype (s : Finset α) (h : ∀ x, x ∈ s ↔ p x) (f : {x // p x} → β) : ∑ x : {x // p x}, f x = ∑ x ∈ s, ...` hmm actually I recall: `Finset.sum_subtype (s : Finset α) {p : α → Prop} [DecidablePred p] (h : ∀ x, x ∈ s ↔ p x) (f : {a // p a} → β) : ∑ x : {a // p a}, f x = ∑ x ∈ s with hp : p x... ` no. The actual Mathlib lemma: `Finset.sum_subtype : ∑ x ∈ s.subtype p, f x = ∑ x ∈ s, if h : p x then f ⟨x, h⟩ else 0`? There's `Finset.sum_subtype (s : Finset α) {p} (h : ∀ x, x ∈ s ↔ p x) (f : {x // p x} → M) : ∑ x : {x // p x}, f x = ∑ x ∈ s.attach... ` hmm. Let me look at it: Mathlib has `Finset.sum_subtype`:\n```\ntheorem Finset.sum_subtype {p : α → Prop} [DecidablePred p] {F : Type*} [AddCommMonoid F]\n (s : Finset α) (h : ∀ x, x ∈ s ↔ p x) (f : { x // p x } → F) :\n ∑ x : { x // p x }, f x = ∑ x ∈ s, if h' : p x then f ⟨x, h'⟩ else 0 := ...\n```\nHmm no — the sum on the LHS is over the TYPE {x // p x} which requires a Fintype instance. The right form: `∑ x in s.subtype p, f x = ∑ x in s, ...`? For our case: the subtype finset is `nearZerosSub t := (something).toFinset.filter ...`. Ugh.\n\nCleaner: keep the near sums in the SUBTYPE throughout the identity, and bridge to the ambient nearZeros only at the capstone. I.e., define:\n```lean\ndef nearZerosSub (t : ℝ) : Finset {ρ : ℂ // IsNontrivialZero ρ} :=\n ((finite_subtype_norm_lt (|t| + 3)).toFinset).filter (fun ρ => |ρ.1.im − t| < 1)\n```\nHmm — finite_subtype_norm_lt (X : ℝ) : {ρ : subtype | ‖ρ.1‖ < X}.Finite (from LiSeries, used in 5e). Then the near-sum over nearZerosSub. Bridge to ambient: Σ ρ ∈ nearZerosSub t, f ρ.1 = Σ ρ ∈ nearZeros t, f ρ — via Finset.sum_subtype-like: nearZerosSub t is the filter of a toFinset of a subtype finite set; the ambient nearZeros t is a filter of zeroDiscFinset. The membership correspondence: ρ.1 ∈ nearZeros t ↔ IsNontrivialZero ρ.1 ∧ |ρ.1.im − t| < 1 (via zeroDiscFinset's mem + the disc containment) — and ρ ∈ nearZerosSub t ↔ (ρ.1 near). Then the sum bridge: `Finset.sum_subtype`... Actually the cleanest: use `Finset.sum_finset_coe`? hmm. There's `Finset.sum_coe_sort`: `∑ x : s, f x = ∑ x ∈ s, f x` where the LHS is over the coercion of s to a type (s : Finset α) → (s : Type*) — ∑ x : ↥s, f x.1 = ∑ x ∈ s, f x ✓ THAT's the bridge: `Finset.sum_coe_sort (s : Finset α) (f : α → β) : ∑ x : s, f x = ∑ x ∈ s, f x`? Signature: `Finset.sum_coe_sort (s : Finset α) (f : s → M)?`... Hmm — actually for the near sum I can work the other direction: prove the identity with the near sums over the subtype finset nearZerosSub, and for the capstone statement rewrite Σ over nearZeros t as Σ over nearZerosSub t via sum_coe_sort-style bridges ONCE.\n\nHonestly — the near-sum form in the capstone matches LiDisc's capstone: `∑ ρ ∈ nearZeros t, (zeroMult ρ : ℂ) / (s - ρ)`. To minimize bridging pain, maybe restate the capstone's near sum as a subtype sum: `∑ ρ ∈ nearZerosSub t, (zeroMult ρ.1 : ℂ) / (s - ρ.1)`. The ii′-6 consumer doesn't exist yet — I'm free to choose the form! The subtype form is actually CLEANER for the consumer (the series is subtype-based). DECISION: the capstone's near sum is over `nearZerosSub t` (the subtype finset). No ambient bridge needed at all.\n\nLet me define nearZerosSub carefully. Requirements: ρ ∈ nearZerosSub t ↔ |ρ.1.im − t| < 1 (for subtype ρ). Via filter over a containing toFinset: any near subtype zero has ‖ρ.1‖ ≤ √(re² + im²) ≤ re + |im| ≤ 1 + (|t| + 1) = |t| + 2. So:\n\ndef nearZerosSub (t : ℝ) : Finset {ρ : ℂ // IsNontrivialZero ρ} :=\n (finite_subtype_norm_lt (|t| + 3)).toFinset.filter (fun ρ => |ρ.1.im − t| < 1)\n\nmem: ρ ∈ nearZerosSub t ↔ ρ ∈ toFinset ∧ near. ρ ∈ (finite_subtype_norm_lt X).toFinset ↔ ‖ρ.1‖ < X. For the mem characterization: ρ ∈ nearZerosSub t ↔ |ρ.1.im − t| < 1 — forward: trivial (filter). Backward: need ‖ρ.1‖ < |t| + 3 from |im − t| < 1: ‖ρ.1‖ ≤ |re| + |im| ≤ 1 + (|t|+1) = |t|+2 < |t|+3 ✓ (‖ρ‖ ≤ |re ρ| + |im ρ| via norm ≤ ...: ‖z‖ = √(re²+im²) ≤ |re| + |im| — lemma: Complex.norm_le_abs_re_add_abs_im ✓ exists I believe; re ρ ∈ (0,1) from IsNontrivialZero; |im| ≤ |im − t| + |t| ≤ 1 + |t| ✓).\n\nfinite_subtype_norm_lt — check the exact name in LiSeries/LiCircleBound: from 5e-iii: \"finite_subtype_norm_lt\" — used: `(finite_subtype_norm_lt 4).subset ...` at lowZeros def: `(finite_subtype_norm_lt 4)` : {ρ : subtype | ‖ρ.1‖ < 4}.Finite? The lowZeros def used `(finite_subtype_norm_lt 4).subset (fun ρ hρ => lt_of_le_of_lt ...)` — so finite_subtype_norm_lt X : {ρ // IsNontrivialZero ρ ∧ ‖ρ‖ < X}? hmm — the lowZeros def: `(show {ρ : {ρ // IsNontrivialZero ρ} | ‖(ρ : ℂ)‖ ≤ 3}.Finite from (finite_subtype_norm_lt 4).subset (fun ρ hρ => lt_of_le_of_lt (show ‖(ρ:ℂ)‖ ≤ 3 from hρ) (by norm_num)))`. So finite_subtype_norm_lt 4 : {ρ : subtype | ‖ρ.1‖ < 4}.Finite where hρ : ‖ρ.1‖ ≤ 3 → ‖ρ.1‖ < 4 via the subset's hρ — the subset fn takes hρ : ρ ∈ {‖ρ‖ ≤ 3}... wait the subset direction: (finite_subtype_norm_lt 4) is the Finiteness of {‖ρ‖ < 4}; .subset (fun ρ hρ => ...) : {‖ρ‖ ≤ 3} ⊆ {‖ρ‖ < 4} where hρ : ρ ∈ {‖ρ‖ ≤ 3} i.e. ‖ρ‖ ≤ 3, and the fn returns lt_of_le_of_lt hρ (3 < 4) : ‖ρ‖ < 4 ✓. OK so finite_subtype_norm_lt (X) : {ρ : {ρ // IsNontrivialZero ρ} | ‖ρ.1‖ < X}.Finite ✓.\n\nNow the split form: Σ'_subtype diff = Σ_{nearZerosSub} diff + Σ'_{if-not-near} diff. With tsum_split_finset_complex (the ℂ variant) at the subtype.\n\nOK — I have a clear picture of 5f-i. Given context budget, let me now write the file with:\n1. tsum_split_finset_complex (ℂ variant).\n2. nearZerosSub + mem characterization.\n3. seriesFun_sub_seriesFun (the difference identity).\n4. Rexpr_decomp (the six-piece identity).\n5. Piece 1: dirichletC2 ≤ 0.995 (the integral bound).\n6. Piece 2: near sum at s₀ ≤ P1-count.\n7. Pieces 4, 5: the elementary reciprocals.\n\nPieces 3, 6 and the assembly in later chunks. Actually — piece 1's integral bound is the meatiest of these. Let me check what integral comparison machinery exists. Actually — simpler for piece 1: I need Σ_{n≥4} log n/n² ≤ (log 3 + 1)/3. Route: the function f(x) = log x/x² is decreasing on [3, ∞) (deriv = (1−2 log x)/x³ < 0 for x > e^{1/2}). The comparison: Σ_{n≥4} f(n) ≤ ∫₃^∞ f. Mathlib: is there `Real.tsum_le_integral_of_decreasing`? Let me grep quickly. There's `integral_test` machinery in Mathlib.Analysis... Let me search.","signature":""},{"type":"text","text":"Checking piece-1 machinery (integral comparison for the tail) before writing."},{"type":"tool_use","id":"Bash_131","name":"Bash","input":{"command":"M=D:/Python/Quantum/zeta-23-lean/.lake/packages/mathlib/Mathlib; grep -rn \"tsum_le_integral\\|sum_le_integral\" $M --include=\"*.lean\" | grep -i \"theorem\\|lemma\" | head -8; echo ===; grep -rn \"theorem.*integral.*log.*div.*pow\\|integral_log_div\" $M/Analysis/SpecialFunctions/Integrals.lean 2>/dev/null | head -4","description":"Search for series-integral comparison lemmas"},"extra_content":null}]