← Session 30 — ii′-5e squeeze capstone + 5f perimeter repair
thinking (6842 chars)
I see the membership bridge pattern: `Set.Finite.mem_toFinset hfin : ρ ∈ hfin.toFinset ↔ ρ ∈ zeroWindow a` — takes just hfin (one explicit arg). ✓
Now make the edits:
**Edit 1 — LiContour.lean**: add `one_le_zeroMult` + strengthen `ZeroCountProp`.
For the def:
```lean
/-- [PERIMETER — Trudgian 2014 N(T)/S(T), D-062 §4] The unit-window
zero-count bound: the multiplicity-weighted count of nontrivial zeros
with ordinates in [t, t+1] is at most Ĉ₀(t+1) (t ≥ 2). Declared
counting input; Ĉ₀ = `C0hat` is D-056 §2's honest majorant
(LiSkeleton).
[Erratum 2026-08-23 (session 035): strengthened from the unweighted
set-card form `Nat.card (zeroWindow t) ≤ Ĉ₀(t+1)` to the mult-weighted
form — Trudgian's N(T) counts zeros with multiplicity, and the
mult-weighted form is what 5f/ii′-6's near sums (zeroMult-weighted)
consume. The set-card bound follows (card ≤ Σ mult); both consumers
adapted (exists_zero_avoiding_T, exists_gapCircle_radius).] -/
def ZeroCountProp : Prop :=
∀ t : ℝ, 2 ≤ t →
(((zeroWindow_finite t).toFinset.sum fun ρ => zeroMult ρ) : ℝ) ≤ C0hat (t + 1)
```
**Edit 2 — exists_zero_avoiding_T's hWFcard**:
```lean
have hWFcard : (WF.card : ℝ) ≤ C0hat (a + 1) := by
have h1 := hZC a ha
-- h1 : ((hfin.toFinset.sum fun ρ => zeroMult ρ) : ℝ) ≤ C0hat (a+1)
have h2 : WF.card ≤ WF.sum (fun ρ => zeroMult ρ) := by
rw [Finset.card_eq_sum_ones]
apply Finset.sum_le_sum
intro ρ hρ
exact one_le_zeroMult ((hWFmem ρ).mp hρ).1
have h3 : (WF.card : ℝ) ≤ ((WF.sum fun ρ => zeroMult ρ) : ℝ) := Nat.cast_le.mpr h2
exact h3.trans h1
```
Careful: hZC a ha gives `((zeroWindow_finite a).toFinset.sum ... : ℝ) ≤ ...` and WF := hfin.toFinset where hfin := zeroWindow_finite a. WF is `set ... with hWF_def` — so WF's definition is hfin.toFinset = (zeroWindow_finite a).toFinset. h1's finset: (zeroWindow_finite a).toFinset — the SAME proof term hfin? `hfin := zeroWindow_finite a` (a have, so hfin is a local hyp of type (zeroWindow a).Finite; hfin.toFinset). hZC's term uses (zeroWindow_finite a).toFinset — with the proof `zeroWindow_finite a` vs the local `hfin`. Are they syntactically equal? hfin is a local variable of type (zeroWindow a).Finite; (zeroWindow_finite a) is the proof term. hfin ≠ proof term syntactically. BUT Set.Finite.toFinset — is it proof-irrelevant-dependent? Set.Finite.toFinset {s} (h : s.Finite) : Finset ℂ — the VALUE depends on the proof h only up to proof irrelevance — two different proofs of the same s.Finite give EQUAL finsets by proof irrelevance (the content is determined by s). But Lean's defeq: toFinset uses Classical.choice internally; hfin.toFinset vs (zeroWindow_finite a).toFinset — these are different TERMS but equal by proof irrelevance (propext/choice): actually `Set.Finite.toFinset` is defined via `hs.some`... For the terms to be defeq: toFinset hfin vs toFinset (zeroWindow_finite a) — h : Finite proofs are Props, and any two proofs of the same Prop are defeq (proof irrelevance is DEFINITIONAL in Lean 4? Proof irrelevance is definitional for terms in Prop: any two proofs of the same proposition are definitionally equal ✓). So hfin.toFinset ≡ (zeroWindow_finite a).toFinset definitionally ✓ — and with set, WF := hfin.toFinset, so the h1 term is defeq to the WF version. `h3.trans h1` typechecks up to defeq ✓. Also `.mp hρ` with hWFmem's iff — hρ : ρ ∈ WF; hWFmem ρ : ρ ∈ WF ↔ ρ ∈ zeroWindow a — wait hWFmem is stated about hfin.toFinset; WF is set to that; the iff displays with WF folded? hWFmem := fun ρ => Set.Finite.mem_toFinset hfin : ∀ ρ, ρ ∈ hfin.toFinset ↔ ... With set WF := hfin.toFinset, occurrences fold — my hWFmem definition was written by them AFTER set, so it's stated with WF? No — it's written `∀ ρ : ℂ, ρ ∈ WF ↔ ρ ∈ zeroWindow a` and proved by `fun ρ => Set.Finite.mem_toFinset hfin` — defeq ✓ (this is existing code, works).
So in my h2: (hWFmem ρ).mp hρ : ρ ∈ zeroWindow a; .1 : IsNontrivialZero ρ ✓.
For `Finset.card_eq_sum_ones : s.card = ∑ x ∈ s, 1` ✓ standard name.
Then h3.trans h1 — h3 : (WF.card:ℝ) ≤ ((WF.sum fun ρ => zeroMult ρ):ℝ); h1 : (((zeroWindow_finite a).toFinset.sum ...) : ℝ) ≤ C0hat (a+1) — the middle terms must be defeq: WF.sum f vs (zeroWindow_finite a).toFinset.sum f — WF ≡ hfin.toFinset ≡ (zeroWindow_finite a).toFinset by proof-irrel ✓. `exact h3.trans h1` — trans elaborates: h3 : a ≤ b, h1 : b' ≤ c, needs b ≡ b' defeq ✓ should unify.
**Edit 3 — LiGapCircles three steps** (same pattern):
```lean
have hW1card : (W1.card : ℝ) ≤ C0hat (4 * (k : ℝ) + 3 / 2 + 1) := by
have h1 := hZC _ h2t1
have h2 : W1.card ≤ W1.sum (fun ρ => zeroMult ρ) := by
rw [Finset.card_eq_sum_ones]
apply Finset.sum_le_sum
intro ρ hρ
exact one_le_zeroMult ((Set.Finite.mem_toFinset _ _).mp hρ |>.1)
```
Hmm — membership for W1: hρ : ρ ∈ W1 where W1 := (zeroWindow_finite (4*(k:ℝ)+3/2)).toFinset. `(Set.Finite.mem_toFinset _ _).mp hρ` — signature: the existing code used `Set.ncard_eq_toFinset_card _ _` with two args (s and the finite proof). For mem_toFinset: Mathlib's `Set.Finite.mem_toFinset` signature? In LiContour line 175: `Set.Finite.mem_toFinset hfin` — ONE explicit arg (hfin). So mem_toFinset takes hs only (s implicit). Then `(Set.Finite.mem_toFinset _).mp hρ`? But the _ must be inferred from hρ's type ρ ∈ W1 — W1 is set-folded; unification ρ ∈ ?hs.toFinset =?= ρ ∈ W1 requires unfolding W1's let-value — unification may fail with set (the local def might not unfold during typechecking of `_`). Safer in LiGapCircles: provide the proof term explicitly: `(Set.Finite.mem_toFinset (zeroWindow_finite (4 * (k : ℝ) + 3 / 2))).mp hρ` — but hρ : ρ ∈ W1 vs expected ρ ∈ (zeroWindow_finite ...).toFinset — defeq via the set-let ✓ usually accepted (set variables are let-bound, defeq transparent).
Hmm, actually with `set`, the occurrences in the goal are replaced and a definitional equality is registered; typechecking `.mp hρ` against expected type ρ ∈ (proof).toFinset: Lean must unify W1 ≡ (zeroWindow_finite _).toFinset — since W1 is a let-variable with that value, whnf unfolds ✓ works.
Let me write it with explicit finite proofs:
```lean
exact one_le_zeroMult (((Set.Finite.mem_toFinset
(zeroWindow_finite (4 * (k : ℝ) + 3 / 2))).mp hρ).1)
```
Wait — mem_toFinset's argument: is it (hs : s.Finite) with s implicit? LiContour:175 `Set.Finite.mem_toFinset hfin` ✓ one arg. Good.
For W2, W3 the same with their proof terms.
Now — after editing ZeroCountProp, ALSO update the docstring references: LiContour.lean line 12 (header comment about ZeroCountProp), and check anywhere else referencing the card form. Also the LiGapCircles header comment (line ~5-16 mentions the perimeter).
Also check: does anything else use `Nat.card (zeroWindow ...)`? grep after edits.
Let me also check `Finset.card_eq_sum_ones` exists in this Mathlib: grep.
Membership-bridge pattern confirmed (`Set.Finite.mem_toFinset hfin`). Verifying `Finset.card_eq_sum_ones`, then making the edits.
tool: Bash
input
{
"command": "M=D:/Python/Quantum/zeta-23-lean/.lake/packages/mathlib/Mathlib; grep -rn \"theorem card_eq_sum_ones\" $M/Algebra/BigOperators/*.lean $M/Algebra/BigOperators/**/*.lean 2>/dev/null | head -2; grep -rn \"theorem analyticOrderAt_ne_zero\\|AnalyticAt.analyticOrderAt_ne_zero\" $M/Analysis/Analytic/*.lean | head -3; grep -rn \"theorem ENat.toNat_pos\\|lemma toNat_pos\" $M/Data/ENat/*.lean $M/Mathlib/Data/ENat*.lean 2>/dev/null | head -3",
"description": "Verify card_eq_sum_ones, analyticOrderAt_ne_zero, ENat.toNat_pos"
}
raw content_json (database row)
[{"type":"thinking","thinking":"I see the membership bridge pattern: `Set.Finite.mem_toFinset hfin : ρ ∈ hfin.toFinset ↔ ρ ∈ zeroWindow a` — takes just hfin (one explicit arg). ✓\n\nNow make the edits:\n\n**Edit 1 — LiContour.lean**: add `one_le_zeroMult` + strengthen `ZeroCountProp`.\n\nFor the def: \n```lean\n/-- [PERIMETER — Trudgian 2014 N(T)/S(T), D-062 §4] The unit-window\nzero-count bound: the multiplicity-weighted count of nontrivial zeros\nwith ordinates in [t, t+1] is at most Ĉ₀(t+1) (t ≥ 2). Declared\ncounting input; Ĉ₀ = `C0hat` is D-056 §2's honest majorant\n(LiSkeleton).\n[Erratum 2026-08-23 (session 035): strengthened from the unweighted\nset-card form `Nat.card (zeroWindow t) ≤ Ĉ₀(t+1)` to the mult-weighted\nform — Trudgian's N(T) counts zeros with multiplicity, and the\nmult-weighted form is what 5f/ii′-6's near sums (zeroMult-weighted)\nconsume. The set-card bound follows (card ≤ Σ mult); both consumers\nadapted (exists_zero_avoiding_T, exists_gapCircle_radius).] -/\ndef ZeroCountProp : Prop :=\n ∀ t : ℝ, 2 ≤ t →\n (((zeroWindow_finite t).toFinset.sum fun ρ => zeroMult ρ) : ℝ) ≤ C0hat (t + 1)\n```\n\n**Edit 2 — exists_zero_avoiding_T's hWFcard**:\n```lean\n have hWFcard : (WF.card : ℝ) ≤ C0hat (a + 1) := by\n have h1 := hZC a ha\n -- h1 : ((hfin.toFinset.sum fun ρ => zeroMult ρ) : ℝ) ≤ C0hat (a+1)\n have h2 : WF.card ≤ WF.sum (fun ρ => zeroMult ρ) := by\n rw [Finset.card_eq_sum_ones]\n apply Finset.sum_le_sum\n intro ρ hρ\n exact one_le_zeroMult ((hWFmem ρ).mp hρ).1\n have h3 : (WF.card : ℝ) ≤ ((WF.sum fun ρ => zeroMult ρ) : ℝ) := Nat.cast_le.mpr h2\n exact h3.trans h1\n```\nCareful: hZC a ha gives `((zeroWindow_finite a).toFinset.sum ... : ℝ) ≤ ...` and WF := hfin.toFinset where hfin := zeroWindow_finite a. WF is `set ... with hWF_def` — so WF's definition is hfin.toFinset = (zeroWindow_finite a).toFinset. h1's finset: (zeroWindow_finite a).toFinset — the SAME proof term hfin? `hfin := zeroWindow_finite a` (a have, so hfin is a local hyp of type (zeroWindow a).Finite; hfin.toFinset). hZC's term uses (zeroWindow_finite a).toFinset — with the proof `zeroWindow_finite a` vs the local `hfin`. Are they syntactically equal? hfin is a local variable of type (zeroWindow a).Finite; (zeroWindow_finite a) is the proof term. hfin ≠ proof term syntactically. BUT Set.Finite.toFinset — is it proof-irrelevant-dependent? Set.Finite.toFinset {s} (h : s.Finite) : Finset ℂ — the VALUE depends on the proof h only up to proof irrelevance — two different proofs of the same s.Finite give EQUAL finsets by proof irrelevance (the content is determined by s). But Lean's defeq: toFinset uses Classical.choice internally; hfin.toFinset vs (zeroWindow_finite a).toFinset — these are different TERMS but equal by proof irrelevance (propext/choice): actually `Set.Finite.toFinset` is defined via `hs.some`... For the terms to be defeq: toFinset hfin vs toFinset (zeroWindow_finite a) — h : Finite proofs are Props, and any two proofs of the same Prop are defeq (proof irrelevance is DEFINITIONAL in Lean 4? Proof irrelevance is definitional for terms in Prop: any two proofs of the same proposition are definitionally equal ✓). So hfin.toFinset ≡ (zeroWindow_finite a).toFinset definitionally ✓ — and with set, WF := hfin.toFinset, so the h1 term is defeq to the WF version. `h3.trans h1` typechecks up to defeq ✓. Also `.mp hρ` with hWFmem's iff — hρ : ρ ∈ WF; hWFmem ρ : ρ ∈ WF ↔ ρ ∈ zeroWindow a — wait hWFmem is stated about hfin.toFinset; WF is set to that; the iff displays with WF folded? hWFmem := fun ρ => Set.Finite.mem_toFinset hfin : ∀ ρ, ρ ∈ hfin.toFinset ↔ ... With set WF := hfin.toFinset, occurrences fold — my hWFmem definition was written by them AFTER set, so it's stated with WF? No — it's written `∀ ρ : ℂ, ρ ∈ WF ↔ ρ ∈ zeroWindow a` and proved by `fun ρ => Set.Finite.mem_toFinset hfin` — defeq ✓ (this is existing code, works).\n\nSo in my h2: (hWFmem ρ).mp hρ : ρ ∈ zeroWindow a; .1 : IsNontrivialZero ρ ✓.\n\nFor `Finset.card_eq_sum_ones : s.card = ∑ x ∈ s, 1` ✓ standard name.\n\nThen h3.trans h1 — h3 : (WF.card:ℝ) ≤ ((WF.sum fun ρ => zeroMult ρ):ℝ); h1 : (((zeroWindow_finite a).toFinset.sum ...) : ℝ) ≤ C0hat (a+1) — the middle terms must be defeq: WF.sum f vs (zeroWindow_finite a).toFinset.sum f — WF ≡ hfin.toFinset ≡ (zeroWindow_finite a).toFinset by proof-irrel ✓. `exact h3.trans h1` — trans elaborates: h3 : a ≤ b, h1 : b' ≤ c, needs b ≡ b' defeq ✓ should unify.\n\n**Edit 3 — LiGapCircles three steps** (same pattern):\n```lean\n have hW1card : (W1.card : ℝ) ≤ C0hat (4 * (k : ℝ) + 3 / 2 + 1) := by\n have h1 := hZC _ h2t1\n have h2 : W1.card ≤ W1.sum (fun ρ => zeroMult ρ) := by\n rw [Finset.card_eq_sum_ones]\n apply Finset.sum_le_sum\n intro ρ hρ\n exact one_le_zeroMult ((Set.Finite.mem_toFinset _ _).mp hρ |>.1)\n```\nHmm — membership for W1: hρ : ρ ∈ W1 where W1 := (zeroWindow_finite (4*(k:ℝ)+3/2)).toFinset. `(Set.Finite.mem_toFinset _ _).mp hρ` — signature: the existing code used `Set.ncard_eq_toFinset_card _ _` with two args (s and the finite proof). For mem_toFinset: Mathlib's `Set.Finite.mem_toFinset` signature? In LiContour line 175: `Set.Finite.mem_toFinset hfin` — ONE explicit arg (hfin). So mem_toFinset takes hs only (s implicit). Then `(Set.Finite.mem_toFinset _).mp hρ`? But the _ must be inferred from hρ's type ρ ∈ W1 — W1 is set-folded; unification ρ ∈ ?hs.toFinset =?= ρ ∈ W1 requires unfolding W1's let-value — unification may fail with set (the local def might not unfold during typechecking of `_`). Safer in LiGapCircles: provide the proof term explicitly: `(Set.Finite.mem_toFinset (zeroWindow_finite (4 * (k : ℝ) + 3 / 2))).mp hρ` — but hρ : ρ ∈ W1 vs expected ρ ∈ (zeroWindow_finite ...).toFinset — defeq via the set-let ✓ usually accepted (set variables are let-bound, defeq transparent).\n\nHmm, actually with `set`, the occurrences in the goal are replaced and a definitional equality is registered; typechecking `.mp hρ` against expected type ρ ∈ (proof).toFinset: Lean must unify W1 ≡ (zeroWindow_finite _).toFinset — since W1 is a let-variable with that value, whnf unfolds ✓ works.\n\nLet me write it with explicit finite proofs:\n```lean\n exact one_le_zeroMult (((Set.Finite.mem_toFinset\n (zeroWindow_finite (4 * (k : ℝ) + 3 / 2))).mp hρ).1)\n```\n\nWait — mem_toFinset's argument: is it (hs : s.Finite) with s implicit? LiContour:175 `Set.Finite.mem_toFinset hfin` ✓ one arg. Good.\n\nFor W2, W3 the same with their proof terms.\n\nNow — after editing ZeroCountProp, ALSO update the docstring references: LiContour.lean line 12 (header comment about ZeroCountProp), and check anywhere else referencing the card form. Also the LiGapCircles header comment (line ~5-16 mentions the perimeter).\n\nAlso check: does anything else use `Nat.card (zeroWindow ...)`? grep after edits.\n\nLet me also check `Finset.card_eq_sum_ones` exists in this Mathlib: grep.","signature":""},{"type":"text","text":"Membership-bridge pattern confirmed (`Set.Finite.mem_toFinset hfin`). Verifying `Finset.card_eq_sum_ones`, then making the edits."},{"type":"tool_use","id":"Bash_91","name":"Bash","input":{"command":"M=D:/Python/Quantum/zeta-23-lean/.lake/packages/mathlib/Mathlib; grep -rn \"theorem card_eq_sum_ones\" $M/Algebra/BigOperators/*.lean $M/Algebra/BigOperators/**/*.lean 2>/dev/null | head -2; grep -rn \"theorem analyticOrderAt_ne_zero\\|AnalyticAt.analyticOrderAt_ne_zero\" $M/Analysis/Analytic/*.lean | head -3; grep -rn \"theorem ENat.toNat_pos\\|lemma toNat_pos\" $M/Data/ENat/*.lean $M/Mathlib/Data/ENat*.lean 2>/dev/null | head -3","description":"Verify card_eq_sum_ones, analyticOrderAt_ne_zero, ENat.toNat_pos"},"extra_content":null}]