Current task: —

← Session 24 — ii′-2…4: swaps, (4.10) design, contour + website roadmap fixes

#1238 assistant 2026-08-22 17:13:03.763 UTC · 1474→6388 tok open ⤢
thinking (15122 chars)
All confirmed: - `HolomorphicOn_riemannZeta : HolomorphicOn ζ {s | s ≠ 1}` (Zeta23) ✓ - `integrable_log_over_pow (rneg : r < 0) (Npos) : IntegrableOn (fun x => ‖x^(r−1)‖·‖log x‖) (Ioi N)` ✓ - `MeasureTheory.intervalIntegral_tendsto_integral_Ioi` ✓ (the N→∞ limit) - Namespaces: the grep didn't show namespace lines — ZetaBounds.lean has no namespace? The lemmas are used unqualified within Zeta23 files with opens... `ZetaUpperBnd` was referenced as `Zeta23.FromPNTPlus...`? Earlier grep showed usage `Zeta0EqZeta Npos ...` inside ZetaBounds.lean itself. The namespace question: let me just check what namespace these live in — actually from the earlier grep of MediumPNT.lean using `‖ζ'...‖` and `ZetaUpperBnd` — the files might share `namespace Zeta23` hmm. Quick check needed at build — I'll reference them and qualify as needed. Now let me write LiRBound.lean §1 (ii′-5b). This is a big file; let me write it in pieces and compile incrementally. Start with the b2Fun machinery (self-contained). ```lean /- NguyenRH1/LiRBound.lean — tier ii′ sub-stage ii′-5 (D-067): the R-bound ... -/ import Mathlib import Zeta23.FromPNTPlus.ZetaBounds -- for Zeta0EqZeta etc. import NguyenRH1.LiContour open Zeta23 Complex Filter Topology open scoped Nat noncomputable section namespace NguyenRH1 /-! ## 1. The periodic Bernoulli primitive B̃₂ -/ /-- The second periodic Bernoulli function: B̃₂(x) = (u² − u)/2 with u = Int.fract x ∈ [0, 1). Continuous (endpoint-matched), 1-periodic, taking values in [−1/8, 0]. (The antiderivative of the sawtooth x − ⌊x⌋ − 1/2 off the integers.) -/ def b2Fun (x : ℝ) : ℝ := (Int.fract x ^ 2 - Int.fract x) / 2 ``` Wait — Int.fract for real x: `Int.fract : α → α` for α with floor... `Int.fract (x : ℝ) : ℝ = x − ⌊x⌋` ✓. Lemmas: ```lean theorem b2Fun_add_one (x : ℝ) : b2Fun (x + 1) = b2Fun x := by unfold b2Fun rw [Int.fract_add_one] theorem b2Fun_nonneg_range (x : ℝ) : -1/8 ≤ b2Fun x ∧ b2Fun x ≤ 0 := by have hu0 : 0 ≤ Int.fract x := Int.fract_nonneg x have hu1 : Int.fract x < 1 := Int.fract_lt_one x unfold b2Fun -- (u²−u)/2 = −u(1−u)/2: u(1−u) ∈ [0, 1/4] constructor · -- ≥ −1/8: u(1−u) ≤ 1/4 have : Int.fract x * (1 - Int.fract x) ≤ 1/4 := by nlinarith [sq_nonneg (Int.fract x - 1/2)] nlinarith · nlinarith ``` Hmm — (u²−u)/2 ≥ −1/8 ⟺ u²−u ≥ −1/4 ⟺ (u−1/2)² ≥ 0 ✓ nlinarith [sq_nonneg (u − 1/2)]. (u²−u)/2 ≤ 0 ⟺ u(u−1) ≤ 0 ✓ from u ≥ 0, u ≤ 1: nlinarith. ```lean theorem abs_b2Fun_le (x : ℝ) : |b2Fun x| ≤ 1/8 := by have ⟨h1, h2⟩ := b2Fun_nonneg_range x rw [abs_of_nonpos h2] linarith theorem continuous_b2Fun : Continuous b2Fun := by unfold b2Fun -- b2Fun = g ∘ Int.fract with g u = (u²−u)/2, g 0 = 0 = g 1 exact ContinuousOn.comp_fract'' (f := fun u : ℝ => (u^2 - u)/2) (by fun_prop) (by norm_num) ``` Check comp_fract'' signature: `theorem ContinuousOn.comp_fract'' {f : α → β} (h : ContinuousOn f I) (hf : f 0 = f 1) : Continuous fun x => f (fract x)` — I = Icc 0 1. So `(ContinuousOn.comp_fract'' (h) (hf))` with h : ContinuousOn (fun u => (u^2−u)/2) (Icc 0 1) — `by fun_prop`? fun_prop proves continuity of polynomial fun on a set: `by continuity`? `by fun_prop` should give ContinuousOn... maybe need `Continuous.continuousOn (by fun_prop)` or continuity tactic. hf : (0²−0)/2 = (1²−1)/2 ⟹ 0 = 0 ✓ norm_num. The resulting Continuous fun x => f (fract x) — our b2Fun x = (fract x ^ 2 − fract x)/2 = f (fract x) ✓ defeq after unfold ✓. HasDerivAt: ```lean theorem hasDerivAt_b2Fun {x : ℝ} (hx : Int.fract x ≠ 0) : HasDerivAt b2Fun (Int.fract x - 1/2) x := by have hf : HasDerivAt (Int.fract : ℝ → ℝ) 1 x := by have hIco : Set.Ico (⌊x⌋ : ℝ) (⌊x⌋ + 1) ∈ 𝓝 x := Set.Ico_mem_nhds ((Int.floor_le x).lt_of_ne (fun h => hx (by rw [Int.fract]; rw [h]; simp))) (Int.lt_floor_add_one x) ``` Hmm — Int.fract x ≠ 0 ⟺ x ≠ ⌊x⌋: Int.fract x = x − ⌊x⌋: fract = 0 ⟺ x = ⌊x⌋ ✓. The Ico_mem_nhds needs ⌊x⌋ ≤ x (floor_le ✓) but STRICT for the nhds: Ico_mem_nhds (h1 : a < x) (h2 : x < b) : Ico a b ∈ 𝓝 x ✓ so need ⌊x⌋ < x from fract ≠ 0: (Int.floor_le x).lt_of_ne (Ne.symm ...) — floor_le : ⌊x⌋ ≤ x; lt_of_ne needs ⌊x⌋ ≠ x: from hx: fract x ≠ 0: x − ⌊x⌋ ≠ 0 ⟺ x ≠ ⌊x⌋ ✓. Then on Ico, floor y = ⌊x⌋: `Int.floor_eq_on_Ico (n : ℤ) (x : α) (h : x ∈ Set.Ico n (n+1)) : ⌊x⌋ = n`? exists ✓ I think. HasDerivAt fract 1 x: fract y = y − ⌊y⌋; near x: ⌊y⌋ = ⌊x⌋: fract =ᶠ[𝓝 x] fun y => y − ↑⌊x⌋: HasDerivAt (fun y => y − c) 1: hasDerivAt_id x |>.sub_const — then congr_of_eventuallyEq: ```lean have hEq : (Int.fract : ℝ → ℝ) =ᶠ[𝓝 x] fun y => y - (⌊x⌋ : ℝ) := by filter_upwards [hIco] with y hy rw [Int.fract, Int.floor_eq_on_Ico _ _ hy] exact (hasDerivAt_id x |>.sub_const _).congr_of_eventuallyEq hEq -- hmm congr direction + the value: (1 : ℝ) − 0 = 1 ``` HasDerivAt.congr_of_eventuallyEq (h : f =ᶠ[𝓝 x] g)... `HasDerivAt.congr_of_eventuallyEq (hf : HasDerivAt f f' x) (h : f =ᶠ[𝓝 x] g) : HasDerivAt g f' x` ✓. (hasDerivAt_id x).sub_const (c) : HasDerivAt (fun y => y − c) (1 − 0) x — 1−0 needs simp to 1: `.sub_const` gives HasDerivAt (fun y => y − c) (1 − 0)? Hmm: (hasDerivAt_id x).sub_const c : HasDerivAt (fun y => y − c) (1 - 0) x — the derivative value 1−0 — simp only [sub_zero] to get 1. Fine — iterate at compile. ```lean unfold b2Fun -- ((fract)² − fract)/2: deriv = (2·fract·1 − 1)/2 = fract − 1/2 have := (hf.pow 2).sub hf |>.div_const 2 -- HasDerivAt (fun x => (fract x^2 − fract x)/2) ((2*fract x*1 − 1)/2) convert this using 1 -- align derivative value: (2u·1 − u... hmm (hf.pow 2) : HasDerivAt fract² (2·fract x^(2-1)·1) = (2·fract x)·1... ring -- (2u−1)/2 = u − 1/2 ✓ ``` Careful with the exact forms; will iterate. Then §2 — the IBP identity. Structure: ```lean /-! ## 2. The level-2 Euler–Maclaurin identity for ζ -/ -- B1 (Zeta23) equals fract − 1/2 on [0, ∞): theorem b1_eq_fract_sub_half {x : ℝ} (hx : 0 ≤ x) : EulerMaclaurin.B1 x = Int.fract x - 1/2 := ... ``` Hmm — B1's full name/namespace: from EulerMaclaurin.lean — the grep didn't show a namespace line! Let me check if EulerMaclaurin.lean has `namespace` — the earlier grep "^namespace" found nothing? The grep output only showed... it printed nothing for namespace (the command `grep -n "^namespace\|^end" ... | head -4` output was empty in the earlier call for both files? Looking back: the command output showed only the sed outputs — no namespace lines printed ⟹ NO namespace in those files — so B1, Zeta0EqZeta etc. are ROOT-level (or Zeta23 root?). They might be just plain root declarations. ZetaUpperBnd referenced plainly. OK — so `B1`, `Zeta0EqZeta` (wait — `riemannZeta0`, `Zeta0EqZeta`) at root namespace. Hmm — but there could be name collisions... fine. B1 def: `B1 (x : ℝ) : ℝ := x - ⌊x⌋₊ - 1/2`. Nat floor. For 0 ≤ x: ⌊x⌋₊ = ⌊x⌋ (Int): lemma: `Nat.floor_eq_int_floor`? Search: `Nat.floor_eq_iff`, `Int.floor_natCast`... The right conversion: `Nat.floor_int (hx : 0 ≤ x) : ⌊x⌋₊ = ⌊x⌋.toNat`? hmm. There's `Nat.floor_eq_intFloor`? Let me just grep for the Nat-Int floor conversion at build. Common: `Nat.floor_eq_iff`, `Int.floor_natCast`, `Nat.floor_ofNat`... The cleanest: `Int.natCast_floor_eq_natFloor`? I'll grep in a minute. The IBP identity: ```lean theorem integral_b1_cpow_eq_integral_b2 {s : ℂ} (hs : 0 < s.re) : ∫ x in Set.Ioi (1:ℝ), (B1 x : ℂ) * (x : ℂ) ^ (-s - 1) = (s + 1) * ∫ x in Set.Ioi (1:ℝ), (b2Fun x : ℂ) * (x : ℂ) ^ (-s - 2) := by ``` Proof skeleton: 1. For each integer N ≥ 1: ∫ x in (1:ℝ)..N, ↑B̃₁·x^{−s−1} = (s+1)·∫ x in 1..N, ↑B̃₂·x^{−s−2}: - Split into unit intervals [k, k+1] (k = 1..N−1): `intervalIntegral.integral_add_adjacent_intervals`? hmm — summing ∫ₖ^{k+1} over k∈Finset.range... there's a lemma for ∫ₐ^b splitting at integers? Simplest: induction on N using ∫₁^(N+1) = ∫₁^N + ∫_N^(N+1) (`intervalIntegral.integral_add_adjacent_intervals`? that's for three points: ∫ₐ^b + ∫_b^c = ∫ₐ^c — `intervalIntegral.integral_add_adjacent_intervals (hab : IntervalIntegrable f volume a b) (hbc : ...)` ✓). Induction: base N = 1: ∫₁^1 = 0 both sides ✓. Step: add the IBP'd unit piece. - Unit piece: ∫ x in k..(k+1), ↑B̃₁ x * x^(−s−1) = (s+1)·∫ x in k..(k+1), ↑B̃₂ x * x^(−s−2): via integral_mul_deriv_eq_deriv_mul_of_hasDerivAt with u = ↑b2Fun, u' = ↑(fract−1/2), v = x^(−s−1), v' = −(s+1)x^(−s−2): ∫ u' v + u v' = u v |: the lemma form: `∫ x in a..b, u' x * v x + u x * v' x = u b * v b - u a * v a` (integral_deriv_mul_eq_sub_of_hasDerivAt ✓). At k+1, k (integers ≥ 1): b2Fun = 0 (fract = 0) ⟹ boundary 0. So ∫ u'v + ∫ uv' = 0 ⟹ ∫ u'v = −∫ uv' = −∫ b2Fun·(−(s+1)x^{−s−2}) = (s+1)∫b2Fun x^{−s−2} ✓. And u' = ↑(fract x − 1/2) vs the B1 form: ↑(B1 x) = ↑(x − ⌊x⌋₊ − 1/2) = ↑(fract x − 1/2) for x ≥ 0 ✓ (B1-eq lemma). Integrability: u' = fract−1/2 bounded measurable ✓ on the finite interval; v continuous ✓. `IntervalIntegrable` of each + products. HasDerivAt u on Ioo(k, k+1): fract x ≠ 0 there ✓ (fract x = 0 ⟺ x integer). v's HasDerivAt: x^(−s−1) at x > 0: Zeta23 has `ZetaSum_aux1φderiv`-style or Mathlib `HasDerivAt.cpow_const`? `hasDerivAt_cpow_const`? For (x:ℂ)^c with real x > 0: `Complex.hasDerivAt_cpow_const`? There's `hasDerivAt_cpow_const`? Hmm — Zeta23's `Real.differentiableAt_cpow_const_of_ne` (seen at ZetaBounds.lean:533!) — `Real.differentiableAt_cpow_const_of_ne (s : ℂ) {x : ℝ} (xpos : 0 < x) : DifferentiableAt ℝ (fun x => (x:ℂ)^s) x` — differentiableAt but I need the derivative VALUE: HasDerivAt (fun x => (x:ℂ)^c) (c·x^(c−1)) x — the formula: d/dx x^c = c·x^{c−1} for real x > 0: Mathlib: `hasDerivAt_cpow_const`? there's `Real.hasDerivAt_cpow_const`? or `Complex.hasDerivAt_cpow_const (x) (hx : 0 < x)?`... Hmm — there's `hasDerivAt_cpow_const (c : ℂ) {x : ℝ} (hx : 0 < x) : HasDerivAt (fun x => (x:ℂ)^c) (c * x^(c−1)) x`? I think `Complex.hasDerivAt_cpow_const` exists with something like that. Check at build. 2. N → ∞ both sides: - LHS: ∫ x in 1..N, ↑B̃₁ x^(−s−1) → ∫ x in Ioi 1, ... via intervalIntegral_tendsto_integral_Ioi (needs IntegrableOn on Ioi 1: |B̃₁ x^{−s−1}| ≤ (1/2)x^{−σ−1} integrable for σ > 0 ✓ — `integrableOn_of_Zeta0_fun`-style; Zeta23 has `integrableOn_of_Zeta0_fun` for THEIR integrand (⌊x⌋+1/2−x)x^{−s−1} = −B̃₁·x^{−s−1} ✓ EXACTLY our integrand up to sign!! `integrableOn_of_Zeta0_fun {N} (N_pos) {s} (s_re_gt : 0 < s.re) : IntegrableOn ... (Ioi N)` ✓). - RHS: B̃₂ version: IntegrableOn of ↑b2Fun·x^{−s−2} on Ioi 1 for σ > −1: |·| ≤ (1/8)x^{−σ−2} ✓ build a small integrability lemma (mirror integrableOn_of_Zeta0_fun's proof or bound directly: Continuous(B̃₂)·measurable × power integrable: `integrableOn_Ioi_rpow_of_lt`? (x^a integrable on Ioi 1 ⟺ a < −1 ✓ Mathlib has `integrableOn_Ioi_rpow_of_lt` ✓). - Tendsto along NATURALS N → ∞ (the boundary-vanishing needs integer N ✓ that's why atTop ℕ): intervalIntegral_tendsto_integral_Ioi with b := fun n : ℕ => (n:ℝ) ✓ (as in their proof: (b := fun n ↦ (n:ℝ)) tendsto_natCast_atTop_atTop ✓). 3. §3 — hasDerivAt of the B₂ parameter integral for re s > −1. Clone of hasDerivAt_Zeta0Integral: ```lean theorem hasDerivAt_b2Integral {s : ℂ} (hs : -1 < s.re) : HasDerivAt (fun z => ∫ x in Set.Ioi (1:ℝ), (b2Fun x : ℂ) * (x : ℂ) ^ (-z - 2)) (∫ x in Set.Ioi (1:ℝ), (b2Fun x : ℂ) * (x : ℂ) ^ (-s - 2) * (-Real.log x)) s ``` via hasDerivAt_integral_of_dominated_loc_of_deriv_le with ε = (s.re + 1)/2, bound x^{−(s.re+3)/2}·|log x| — integrable via integrable_log_over_pow (r := −(s.re+1)/2 < 0 ✓: their form: ‖x^(r−1)‖·‖log x‖ with r−1 = −(s.re+3)/2 ⟹ r = −(s.re+1)/2 ✓ < 0). 4. §4 — the extended identity via identity principle: ```lean theorem riemannZeta_eq_level2 {s : ℂ} (hs : -1 < s.re) (hs1 : s ≠ 1) : riemannZeta s = 1/2 + 1/(s - 1) - s * (s + 1) * ∫ x in Set.Ioi (1:ℝ), (b2Fun x : ℂ) * (x : ℂ)^(-s - 2) := by ``` Proof: - On V := {re > 0, ≠ 1}: ζ(s) = ζ₀ 1 s (Zeta0EqZeta) = 1/2 + 1/(s−1) − s∫B̃₁... wait ζ₀ 1 s = Σ_{range 2} + (−1^(1−s))/(1−s) + (−1^(−s))/2 + s∫(⌊x⌋+1/2−x)x^{−s−1}: simplify: sum = 1 (0^s = 0 junk + 1); (−1^(1−s))/(1−s): (1:ℂ)^(1−s) = 1 (one_cpow) ✓: = −1/(1−s) = 1/(s−1); (−1^(−s))/2 = −1/2. And (⌊x⌋+1/2−x) = −B̃₁: s∫(−B̃₁)x^{−s−1} = −s∫B̃₁x^{−s−1}. So ζ₀ 1 s = 1/2 + 1/(s−1) − s∫B̃₁x^{−s−1} = 1/2 + 1/(s−1) − s(s+1)∫B̃₂x^{−s−2} (by §2) ✓ on V. - Both sides analytic on U := {s | −1 < re s ∧ s ≠ 1}: - LHS: HolomorphicOn_riemannZeta.mono ✓. - RHS: the B₂ integral hasDerivAt everywhere on U (§3) ⟹ DifferentiableOn ⟹ analyticOnNhd (DifferentiableOn.analyticOnNhd, U open? {−1 < re} open ✓ minus {1} open ✓). - Preconnected: U = {−1<re} ∩ {≠1}: half-plane minus point — path-connected: mimic Zeta23's isPathConnected_aux (they proved it for {z ≠ 1 ∧ 0 < re}!). Generalize: their proof is for 0 < re; mine needs −1 < re — copy their proof with the shift (or find a slicker way: {−1<re} ∖ {1}: IsConnected via... the Zeta23 proof uses explicit paths — copy & adapt). - Agree on V ⊆ U with accumulation: eventuallyEq at 2? V is open nonempty ⊂ U; the eqOn_of_preconnected_of_eventuallyEq needs agreement in a NEIGHBORHOOD of a point: at s = 2: V ∈ 𝓝 2 ✓ (V open, 2 ∈ V) so agreement on V gives eventuallyEq at 2 ✓. Use AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq (as in Zeta0EqZeta proof) — signature: (hf : AnalyticOnNhd f U) (hg : AnalyticOnNhd g U) (hU : IsPreconnected U) (hx : x ∈ U) (hfg : f =ᶠ[𝓝 x] g)?? their usage: `AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq f_an g_an preconU h2 ?_ s_mem` — h2 : (2:ℂ) ∈ U, then ?_ is the eventuallyEq at 2, then s_mem — returns eqOn. ✓ copy that. 5. §5 — the disc bound: ```lean theorem norm_riemannZeta_le_of_mem_closedBall {t : ℝ} (ht : 10 ≤ |t|) {s : ℂ} (hs : s ∈ Metric.closedBall (2 + t * Complex.I) (5/2)) : ‖riemannZeta s‖ ≤ 3/4 * |t| ^ 2 := by ``` - re s ≥ 2 − 5/2 = −1/2 > −1 ✓ (disc); s ≠ 1 (|im s − t| ≤ 5/2, |t| ≥ 10 ⟹ |im s| ≥ 7.5 ≠ 0) ✓. - Apply the rep: ‖ζ s‖ ≤ 1/2 + 1/‖s−1‖ + ‖s‖‖s+1‖·(1/8)/(re s + 1): - the integral: ‖∫ ↑b2Fun x^{−s−2}‖ ≤ ∫ (1/8)x^{−σ−2} = (1/8)/(σ+1) ✓ (norm_integral_le_integral_norm + the rpow integral: ∫₁^∞ x^{−σ−2}dx = 1/(σ+1): `integral_Ioi_rpow_of_lt`? name: `integral_rpow_of_lt`? For Ioi 1: ∫ x^c on Ioi 1 = −1/(c+1) for c < −1: `integrableOn_Ioi_rpow_of_lt` + `integral_Ioi_rpow_of_lt`? I'll find. Or bound directly via intervalIntegral limit.) - ‖s‖ ≤ |t| + 9/2 (‖s‖ ≤ ‖2+it‖ + 5/2 ≤ 2+|t|+5/2 ✓ via norm triangle + ‖2+it‖ ≤ 2+|t|: norm_le_abs_re_add_abs_im). - ‖s+1‖ ≤ |t| + 11/2. - ‖s−1‖ ≥ |t| ≥ 10: 1/‖s−1‖ ≤ 1/10. Hmm: ‖s−1‖ ≥ |im(s−1)| = |t| ✓ abs_im_le_norm. - re s + 1 ≥ 1/2 ⟹ 1/(re s+1) ≤ 2. So ‖ζ‖ ≤ 1/2 + 1/10 + (|t|+9/2)(|t|+11/2)/4 — then ≤ 3/4·|t|² for |t| ≥ 10 by nlinarith-style expansion: (|t|+9/2)(|t|+11/2)/4 = (t² + 10|t| + 99/4)/4 = t²/4 + 2.5|t| + 6.1875; +0.6: total ≤ t²/4 + 2.5|t| + 6.8 ≤ (3/4)t² ⟺ t²/2 ≥ 2.5|t| + 6.8 ⟸ |t| ≥ 10: t²/2 ≥ 50: 2.5·10 + 6.8 = 31.8 ≤ 50 ✓. nlinarith can do with the right hints (|t| ≥ 10, t² ≥ 100...). That's the full ii′-5b plan. It's chunky — maybe 400-600 lines of Lean. Let me start writing. First the b2Fun section, compile, then IBP, then hasDerivAt, then identity, then the bound. I'll build incrementally, compiling after each section. One check — Nat/Int floor conversion lemma name. grep:
All pieces confirmed. One last name check (Nat↔Int floor conversion), then I start writing LiRBound.lean.
tool: Bash
input
{
  "command": "cd D:/Python/Quantum/zeta-23-lean/.lake/packages/mathlib && grep -rn \"theorem floor_natCast\\|natFloor_eq\\|theorem Int.floor_natCast\\|natCast_floor\" Mathlib/Algebra/Order/Floor/Ring.lean Mathlib/Algebra/Order/Floor/Defs.lean 2>/dev/null | head -6; grep -rn \"Nat.floor_eq_int_floor\\|floor_natFloor\\|natFloor\" Mathlib/Algebra/Order/Floor/Ring.lean | head -6",
  "description": "Find Nat/Int floor conversion lemma"
}
raw content_json (database row)
[{"type":"thinking","thinking":"All confirmed:\n- `HolomorphicOn_riemannZeta : HolomorphicOn ζ {s | s ≠ 1}` (Zeta23) ✓\n- `integrable_log_over_pow (rneg : r < 0) (Npos) : IntegrableOn (fun x => ‖x^(r−1)‖·‖log x‖) (Ioi N)` ✓\n- `MeasureTheory.intervalIntegral_tendsto_integral_Ioi` ✓ (the N→∞ limit)\n- Namespaces: the grep didn't show namespace lines — ZetaBounds.lean has no namespace? The lemmas are used unqualified within Zeta23 files with opens... `ZetaUpperBnd` was referenced as `Zeta23.FromPNTPlus...`? Earlier grep showed usage `Zeta0EqZeta Npos ...` inside ZetaBounds.lean itself. The namespace question: let me just check what namespace these live in — actually from the earlier grep of MediumPNT.lean using `‖ζ'...‖` and `ZetaUpperBnd` — the files might share `namespace Zeta23` hmm. Quick check needed at build — I'll reference them and qualify as needed.\n\nNow let me write LiRBound.lean §1 (ii′-5b). This is a big file; let me write it in pieces and compile incrementally. Start with the b2Fun machinery (self-contained).\n\n```lean\n/-\nNguyenRH1/LiRBound.lean — tier ii′ sub-stage ii′-5 (D-067): the R-bound\n...\n-/\nimport Mathlib\nimport Zeta23.FromPNTPlus.ZetaBounds   -- for Zeta0EqZeta etc.\nimport NguyenRH1.LiContour\n\nopen Zeta23 Complex Filter Topology\nopen scoped Nat\n\nnoncomputable section\n\nnamespace NguyenRH1\n\n/-! ## 1. The periodic Bernoulli primitive B̃₂ -/\n\n/-- The second periodic Bernoulli function: B̃₂(x) = (u² − u)/2 with\nu = Int.fract x ∈ [0, 1). Continuous (endpoint-matched), 1-periodic,\ntaking values in [−1/8, 0]. (The antiderivative of the sawtooth\nx − ⌊x⌋ − 1/2 off the integers.) -/\ndef b2Fun (x : ℝ) : ℝ := (Int.fract x ^ 2 - Int.fract x) / 2\n```\n\nWait — Int.fract for real x: `Int.fract : α → α` for α with floor... `Int.fract (x : ℝ) : ℝ = x − ⌊x⌋` ✓.\n\nLemmas:\n\n```lean\ntheorem b2Fun_add_one (x : ℝ) : b2Fun (x + 1) = b2Fun x := by\n  unfold b2Fun\n  rw [Int.fract_add_one]\n\ntheorem b2Fun_nonneg_range (x : ℝ) : -1/8 ≤ b2Fun x ∧ b2Fun x ≤ 0 := by\n  have hu0 : 0 ≤ Int.fract x := Int.fract_nonneg x\n  have hu1 : Int.fract x < 1 := Int.fract_lt_one x\n  unfold b2Fun\n  -- (u²−u)/2 = −u(1−u)/2: u(1−u) ∈ [0, 1/4]\n  constructor\n  · -- ≥ −1/8: u(1−u) ≤ 1/4\n    have : Int.fract x * (1 - Int.fract x) ≤ 1/4 := by\n      nlinarith [sq_nonneg (Int.fract x - 1/2)]\n    nlinarith\n  · nlinarith\n```\n\nHmm — (u²−u)/2 ≥ −1/8 ⟺ u²−u ≥ −1/4 ⟺ (u−1/2)² ≥ 0 ✓ nlinarith [sq_nonneg (u − 1/2)].\n(u²−u)/2 ≤ 0 ⟺ u(u−1) ≤ 0 ✓ from u ≥ 0, u ≤ 1: nlinarith.\n\n```lean\ntheorem abs_b2Fun_le (x : ℝ) : |b2Fun x| ≤ 1/8 := by\n  have ⟨h1, h2⟩ := b2Fun_nonneg_range x\n  rw [abs_of_nonpos h2]\n  linarith\n\ntheorem continuous_b2Fun : Continuous b2Fun := by\n  unfold b2Fun\n  -- b2Fun = g ∘ Int.fract with g u = (u²−u)/2, g 0 = 0 = g 1\n  exact ContinuousOn.comp_fract'' (f := fun u : ℝ => (u^2 - u)/2) (by fun_prop) (by norm_num)\n```\nCheck comp_fract'' signature: `theorem ContinuousOn.comp_fract'' {f : α → β} (h : ContinuousOn f I) (hf : f 0 = f 1) : Continuous fun x => f (fract x)` — I = Icc 0 1. So `(ContinuousOn.comp_fract'' (h) (hf))` with h : ContinuousOn (fun u => (u^2−u)/2) (Icc 0 1) — `by fun_prop`? fun_prop proves continuity of polynomial fun on a set: `by continuity`? `by fun_prop` should give ContinuousOn... maybe need `Continuous.continuousOn (by fun_prop)` or continuity tactic. hf : (0²−0)/2 = (1²−1)/2 ⟹ 0 = 0 ✓ norm_num.\nThe resulting Continuous fun x => f (fract x) — our b2Fun x = (fract x ^ 2 − fract x)/2 = f (fract x) ✓ defeq after unfold ✓.\n\nHasDerivAt:\n```lean\ntheorem hasDerivAt_b2Fun {x : ℝ} (hx : Int.fract x ≠ 0) :\n    HasDerivAt b2Fun (Int.fract x - 1/2) x := by\n  have hf : HasDerivAt (Int.fract : ℝ → ℝ) 1 x := by\n    have hIco : Set.Ico (⌊x⌋ : ℝ) (⌊x⌋ + 1) ∈ 𝓝 x :=\n      Set.Ico_mem_nhds ((Int.floor_le x).lt_of_ne (fun h => hx (by rw [Int.fract]; rw [h]; simp))) (Int.lt_floor_add_one x)\n```\nHmm — Int.fract x ≠ 0 ⟺ x ≠ ⌊x⌋: Int.fract x = x − ⌊x⌋: fract = 0 ⟺ x = ⌊x⌋ ✓. The Ico_mem_nhds needs ⌊x⌋ ≤ x (floor_le ✓) but STRICT for the nhds: Ico_mem_nhds (h1 : a < x) (h2 : x < b) : Ico a b ∈ 𝓝 x ✓ so need ⌊x⌋ < x from fract ≠ 0: (Int.floor_le x).lt_of_ne (Ne.symm ...) — floor_le : ⌊x⌋ ≤ x; lt_of_ne needs ⌊x⌋ ≠ x: from hx: fract x ≠ 0: x − ⌊x⌋ ≠ 0 ⟺ x ≠ ⌊x⌋ ✓.\n    Then on Ico, floor y = ⌊x⌋: `Int.floor_eq_on_Ico (n : ℤ) (x : α) (h : x ∈ Set.Ico n (n+1)) : ⌊x⌋ = n`? exists ✓ I think.\n    HasDerivAt fract 1 x: fract y = y − ⌊y⌋; near x: ⌊y⌋ = ⌊x⌋: fract =ᶠ[𝓝 x] fun y => y − ↑⌊x⌋: HasDerivAt (fun y => y − c) 1: hasDerivAt_id x |>.sub_const — then congr_of_eventuallyEq:\n```lean\n    have hEq : (Int.fract : ℝ → ℝ) =ᶠ[𝓝 x] fun y => y - (⌊x⌋ : ℝ) := by\n      filter_upwards [hIco] with y hy\n      rw [Int.fract, Int.floor_eq_on_Ico _ _ hy]\n    exact (hasDerivAt_id x |>.sub_const _).congr_of_eventuallyEq hEq  -- hmm congr direction + the value: (1 : ℝ) − 0 = 1\n```\nHasDerivAt.congr_of_eventuallyEq (h : f =ᶠ[𝓝 x] g)... `HasDerivAt.congr_of_eventuallyEq (hf : HasDerivAt f f' x) (h : f =ᶠ[𝓝 x] g) : HasDerivAt g f' x` ✓. (hasDerivAt_id x).sub_const (c) : HasDerivAt (fun y => y − c) (1 − 0) x — 1−0 needs simp to 1: `.sub_const` gives HasDerivAt (fun y => y − c) (1 − 0)? Hmm: (hasDerivAt_id x).sub_const c : HasDerivAt (fun y => y − c) (1 - 0) x — the derivative value 1−0 — simp only [sub_zero] to get 1. Fine — iterate at compile.\n```lean\n  unfold b2Fun\n  -- ((fract)² − fract)/2: deriv = (2·fract·1 − 1)/2 = fract − 1/2\n  have := (hf.pow 2).sub hf |>.div_const 2  -- HasDerivAt (fun x => (fract x^2 − fract x)/2) ((2*fract x*1 − 1)/2)\n  convert this using 1  -- align derivative value: (2u·1 − u... hmm (hf.pow 2) : HasDerivAt fract² (2·fract x^(2-1)·1) = (2·fract x)·1... \n  ring  -- (2u−1)/2 = u − 1/2 ✓\n```\nCareful with the exact forms; will iterate.\n\nThen §2 — the IBP identity. Structure:\n\n```lean\n/-! ## 2. The level-2 Euler–Maclaurin identity for ζ -/\n\n-- B1 (Zeta23) equals fract − 1/2 on [0, ∞):\ntheorem b1_eq_fract_sub_half {x : ℝ} (hx : 0 ≤ x) : EulerMaclaurin.B1 x = Int.fract x - 1/2 := ...\n```\nHmm — B1's full name/namespace: from EulerMaclaurin.lean — the grep didn't show a namespace line! Let me check if EulerMaclaurin.lean has `namespace` — the earlier grep \"^namespace\" found nothing? The grep output only showed... it printed nothing for namespace (the command `grep -n \"^namespace\\|^end\" ... | head -4` output was empty in the earlier call for both files? Looking back: the command output showed only the sed outputs — no namespace lines printed ⟹ NO namespace in those files — so B1, Zeta0EqZeta etc. are ROOT-level (or Zeta23 root?). They might be just plain root declarations. ZetaUpperBnd referenced plainly. OK — so `B1`, `Zeta0EqZeta` (wait — `riemannZeta0`, `Zeta0EqZeta`) at root namespace. Hmm — but there could be name collisions... fine.\n\nB1 def: `B1 (x : ℝ) : ℝ := x - ⌊x⌋₊ - 1/2`. Nat floor. For 0 ≤ x: ⌊x⌋₊ = ⌊x⌋ (Int): lemma: `Nat.floor_eq_int_floor`? Search: `Nat.floor_eq_iff`, `Int.floor_natCast`... The right conversion: `Nat.floor_int (hx : 0 ≤ x) : ⌊x⌋₊ = ⌊x⌋.toNat`? hmm. There's `Nat.floor_eq_intFloor`? Let me just grep for the Nat-Int floor conversion at build. Common: `Nat.floor_eq_iff`, `Int.floor_natCast`, `Nat.floor_ofNat`... The cleanest: `Int.natCast_floor_eq_natFloor`? I'll grep in a minute.\n\nThe IBP identity:\n\n```lean\ntheorem integral_b1_cpow_eq_integral_b2 {s : ℂ} (hs : 0 < s.re) :\n    ∫ x in Set.Ioi (1:ℝ), (B1 x : ℂ) * (x : ℂ) ^ (-s - 1)\n      = (s + 1) * ∫ x in Set.Ioi (1:ℝ), (b2Fun x : ℂ) * (x : ℂ) ^ (-s - 2) := by\n```\nProof skeleton:\n1. For each integer N ≥ 1: ∫ x in (1:ℝ)..N, ↑B̃₁·x^{−s−1} = (s+1)·∫ x in 1..N, ↑B̃₂·x^{−s−2}:\n   - Split into unit intervals [k, k+1] (k = 1..N−1): `intervalIntegral.integral_add_adjacent_intervals`? hmm — summing ∫ₖ^{k+1} over k∈Finset.range... there's a lemma for ∫ₐ^b splitting at integers? Simplest: induction on N using ∫₁^(N+1) = ∫₁^N + ∫_N^(N+1) (`intervalIntegral.integral_add_adjacent_intervals`? that's for three points: ∫ₐ^b + ∫_b^c = ∫ₐ^c — `intervalIntegral.integral_add_adjacent_intervals (hab : IntervalIntegrable f volume a b) (hbc : ...)` ✓). Induction: base N = 1: ∫₁^1 = 0 both sides ✓. Step: add the IBP'd unit piece.\n   - Unit piece: ∫ x in k..(k+1), ↑B̃₁ x * x^(−s−1) = (s+1)·∫ x in k..(k+1), ↑B̃₂ x * x^(−s−2):\n     via integral_mul_deriv_eq_deriv_mul_of_hasDerivAt with u = ↑b2Fun, u' = ↑(fract−1/2), v = x^(−s−1), v' = −(s+1)x^(−s−2):\n     ∫ u' v + u v' = u v |: the lemma form: `∫ x in a..b, u' x * v x + u x * v' x = u b * v b - u a * v a` (integral_deriv_mul_eq_sub_of_hasDerivAt ✓). At k+1, k (integers ≥ 1): b2Fun = 0 (fract = 0) ⟹ boundary 0. So ∫ u'v + ∫ uv' = 0 ⟹ ∫ u'v = −∫ uv' = −∫ b2Fun·(−(s+1)x^{−s−2}) = (s+1)∫b2Fun x^{−s−2} ✓.\n     And u' = ↑(fract x − 1/2) vs the B1 form: ↑(B1 x) = ↑(x − ⌊x⌋₊ − 1/2) = ↑(fract x − 1/2) for x ≥ 0 ✓ (B1-eq lemma).\n     Integrability: u' = fract−1/2 bounded measurable ✓ on the finite interval; v continuous ✓. `IntervalIntegrable` of each + products.\n     HasDerivAt u on Ioo(k, k+1): fract x ≠ 0 there ✓ (fract x = 0 ⟺ x integer).\n     v's HasDerivAt: x^(−s−1) at x > 0: Zeta23 has `ZetaSum_aux1φderiv`-style or Mathlib `HasDerivAt.cpow_const`? `hasDerivAt_cpow_const`? For (x:ℂ)^c with real x > 0: `Complex.hasDerivAt_cpow_const`? There's `hasDerivAt_cpow_const`? Hmm — Zeta23's `Real.differentiableAt_cpow_const_of_ne` (seen at ZetaBounds.lean:533!) — `Real.differentiableAt_cpow_const_of_ne (s : ℂ) {x : ℝ} (xpos : 0 < x) : DifferentiableAt ℝ (fun x => (x:ℂ)^s) x` — differentiableAt but I need the derivative VALUE: HasDerivAt (fun x => (x:ℂ)^c) (c·x^(c−1)) x — the formula: d/dx x^c = c·x^{c−1} for real x > 0: Mathlib: `hasDerivAt_cpow_const`? there's `Real.hasDerivAt_cpow_const`? or `Complex.hasDerivAt_cpow_const (x) (hx : 0 < x)?`... Hmm — there's `hasDerivAt_cpow_const (c : ℂ) {x : ℝ} (hx : 0 < x) : HasDerivAt (fun x => (x:ℂ)^c) (c * x^(c−1)) x`? I think `Complex.hasDerivAt_cpow_const` exists with something like that. Check at build.\n2. N → ∞ both sides:\n   - LHS: ∫ x in 1..N, ↑B̃₁ x^(−s−1) → ∫ x in Ioi 1, ... via intervalIntegral_tendsto_integral_Ioi (needs IntegrableOn on Ioi 1: |B̃₁ x^{−s−1}| ≤ (1/2)x^{−σ−1} integrable for σ > 0 ✓ — `integrableOn_of_Zeta0_fun`-style; Zeta23 has `integrableOn_of_Zeta0_fun` for THEIR integrand (⌊x⌋+1/2−x)x^{−s−1} = −B̃₁·x^{−s−1} ✓ EXACTLY our integrand up to sign!! `integrableOn_of_Zeta0_fun {N} (N_pos) {s} (s_re_gt : 0 < s.re) : IntegrableOn ... (Ioi N)` ✓).\n   - RHS: B̃₂ version: IntegrableOn of ↑b2Fun·x^{−s−2} on Ioi 1 for σ > −1: |·| ≤ (1/8)x^{−σ−2} ✓ build a small integrability lemma (mirror integrableOn_of_Zeta0_fun's proof or bound directly: Continuous(B̃₂)·measurable × power integrable: `integrableOn_Ioi_rpow_of_lt`? (x^a integrable on Ioi 1 ⟺ a < −1 ✓ Mathlib has `integrableOn_Ioi_rpow_of_lt` ✓).\n   - Tendsto along NATURALS N → ∞ (the boundary-vanishing needs integer N ✓ that's why atTop ℕ): intervalIntegral_tendsto_integral_Ioi with b := fun n : ℕ => (n:ℝ) ✓ (as in their proof: (b := fun n ↦ (n:ℝ)) tendsto_natCast_atTop_atTop ✓).\n\n3. §3 — hasDerivAt of the B₂ parameter integral for re s > −1. Clone of hasDerivAt_Zeta0Integral:\n```lean\ntheorem hasDerivAt_b2Integral {s : ℂ} (hs : -1 < s.re) :\n    HasDerivAt (fun z => ∫ x in Set.Ioi (1:ℝ), (b2Fun x : ℂ) * (x : ℂ) ^ (-z - 2))\n      (∫ x in Set.Ioi (1:ℝ), (b2Fun x : ℂ) * (x : ℂ) ^ (-s - 2) * (-Real.log x)) s\n```\nvia hasDerivAt_integral_of_dominated_loc_of_deriv_le with ε = (s.re + 1)/2, bound x^{−(s.re+3)/2}·|log x| — integrable via integrable_log_over_pow (r := −(s.re+1)/2 < 0 ✓: their form: ‖x^(r−1)‖·‖log x‖ with r−1 = −(s.re+3)/2 ⟹ r = −(s.re+1)/2 ✓ < 0).\n\n4. §4 — the extended identity via identity principle:\n```lean\ntheorem riemannZeta_eq_level2 {s : ℂ} (hs : -1 < s.re) (hs1 : s ≠ 1) :\n    riemannZeta s = 1/2 + 1/(s - 1) - s * (s + 1) * ∫ x in Set.Ioi (1:ℝ), (b2Fun x : ℂ) * (x : ℂ)^(-s - 2) := by\n```\nProof: \n- On V := {re > 0, ≠ 1}: ζ(s) = ζ₀ 1 s (Zeta0EqZeta) = 1/2 + 1/(s−1) − s∫B̃₁... wait ζ₀ 1 s = Σ_{range 2} + (−1^(1−s))/(1−s) + (−1^(−s))/2 + s∫(⌊x⌋+1/2−x)x^{−s−1}: simplify: sum = 1 (0^s = 0 junk + 1); (−1^(1−s))/(1−s): (1:ℂ)^(1−s) = 1 (one_cpow) ✓: = −1/(1−s) = 1/(s−1); (−1^(−s))/2 = −1/2. And (⌊x⌋+1/2−x) = −B̃₁: s∫(−B̃₁)x^{−s−1} = −s∫B̃₁x^{−s−1}. So ζ₀ 1 s = 1/2 + 1/(s−1) − s∫B̃₁x^{−s−1} = 1/2 + 1/(s−1) − s(s+1)∫B̃₂x^{−s−2} (by §2) ✓ on V.\n- Both sides analytic on U := {s | −1 < re s ∧ s ≠ 1}: \n  - LHS: HolomorphicOn_riemannZeta.mono ✓.\n  - RHS: the B₂ integral hasDerivAt everywhere on U (§3) ⟹ DifferentiableOn ⟹ analyticOnNhd (DifferentiableOn.analyticOnNhd, U open? {−1 < re} open ✓ minus {1} open ✓).\n- Preconnected: U = {−1<re} ∩ {≠1}: half-plane minus point — path-connected: mimic Zeta23's isPathConnected_aux (they proved it for {z ≠ 1 ∧ 0 < re}!). Generalize: their proof is for 0 < re; mine needs −1 < re — copy their proof with the shift (or find a slicker way: {−1<re} ∖ {1}: IsConnected via... the Zeta23 proof uses explicit paths — copy & adapt).\n- Agree on V ⊆ U with accumulation: eventuallyEq at 2? V is open nonempty ⊂ U; the eqOn_of_preconnected_of_eventuallyEq needs agreement in a NEIGHBORHOOD of a point: at s = 2: V ∈ 𝓝 2 ✓ (V open, 2 ∈ V) so agreement on V gives eventuallyEq at 2 ✓. Use AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq (as in Zeta0EqZeta proof) — signature: (hf : AnalyticOnNhd f U) (hg : AnalyticOnNhd g U) (hU : IsPreconnected U) (hx : x ∈ U) (hfg : f =ᶠ[𝓝 x] g)?? their usage: `AnalyticOnNhd.eqOn_of_preconnected_of_eventuallyEq f_an g_an preconU h2 ?_ s_mem` — h2 : (2:ℂ) ∈ U, then ?_ is the eventuallyEq at 2, then s_mem — returns eqOn. ✓ copy that.\n\n5. §5 — the disc bound:\n```lean\ntheorem norm_riemannZeta_le_of_mem_closedBall {t : ℝ} (ht : 10 ≤ |t|) {s : ℂ}\n    (hs : s ∈ Metric.closedBall (2 + t * Complex.I) (5/2)) :\n    ‖riemannZeta s‖ ≤ 3/4 * |t| ^ 2 := by\n```\n- re s ≥ 2 − 5/2 = −1/2 > −1 ✓ (disc); s ≠ 1 (|im s − t| ≤ 5/2, |t| ≥ 10 ⟹ |im s| ≥ 7.5 ≠ 0) ✓.\n- Apply the rep: ‖ζ s‖ ≤ 1/2 + 1/‖s−1‖ + ‖s‖‖s+1‖·(1/8)/(re s + 1):\n  - the integral: ‖∫ ↑b2Fun x^{−s−2}‖ ≤ ∫ (1/8)x^{−σ−2} = (1/8)/(σ+1) ✓ (norm_integral_le_integral_norm + the rpow integral: ∫₁^∞ x^{−σ−2}dx = 1/(σ+1): `integral_Ioi_rpow_of_lt`? name: `integral_rpow_of_lt`? For Ioi 1: ∫ x^c on Ioi 1 = −1/(c+1) for c < −1: `integrableOn_Ioi_rpow_of_lt` + `integral_Ioi_rpow_of_lt`? I'll find. Or bound directly via intervalIntegral limit.)\n  - ‖s‖ ≤ |t| + 9/2 (‖s‖ ≤ ‖2+it‖ + 5/2 ≤ 2+|t|+5/2 ✓ via norm triangle + ‖2+it‖ ≤ 2+|t|: norm_le_abs_re_add_abs_im).\n  - ‖s+1‖ ≤ |t| + 11/2.\n  - ‖s−1‖ ≥ |t| ≥ 10: 1/‖s−1‖ ≤ 1/10. Hmm: ‖s−1‖ ≥ |im(s−1)| = |t| ✓ abs_im_le_norm.\n  - re s + 1 ≥ 1/2 ⟹ 1/(re s+1) ≤ 2.\n  So ‖ζ‖ ≤ 1/2 + 1/10 + (|t|+9/2)(|t|+11/2)/4 — then ≤ 3/4·|t|² for |t| ≥ 10 by nlinarith-style expansion: (|t|+9/2)(|t|+11/2)/4 = (t² + 10|t| + 99/4)/4 = t²/4 + 2.5|t| + 6.1875; +0.6: total ≤ t²/4 + 2.5|t| + 6.8 ≤ (3/4)t² ⟺ t²/2 ≥ 2.5|t| + 6.8 ⟸ |t| ≥ 10: t²/2 ≥ 50: 2.5·10 + 6.8 = 31.8 ≤ 50 ✓. nlinarith can do with the right hints (|t| ≥ 10, t² ≥ 100...).\n\nThat's the full ii′-5b plan. It's chunky — maybe 400-600 lines of Lean. Let me start writing. First the b2Fun section, compile, then IBP, then hasDerivAt, then identity, then the bound. I'll build incrementally, compiling after each section.\n\nOne check — Nat/Int floor conversion lemma name. grep:","signature":""},{"type":"text","text":"All pieces confirmed. One last name check (Nat↔Int floor conversion), then I start writing LiRBound.lean."},{"type":"tool_use","id":"Bash_189","name":"Bash","input":{"command":"cd D:/Python/Quantum/zeta-23-lean/.lake/packages/mathlib && grep -rn \"theorem floor_natCast\\|natFloor_eq\\|theorem Int.floor_natCast\\|natCast_floor\" Mathlib/Algebra/Order/Floor/Ring.lean Mathlib/Algebra/Order/Floor/Defs.lean 2>/dev/null | head -6; grep -rn \"Nat.floor_eq_int_floor\\|floor_natFloor\\|natFloor\" Mathlib/Algebra/Order/Floor/Ring.lean | head -6","description":"Find Nat/Int floor conversion lemma"},"extra_content":null}]