← Session 24 — ii′-2…4: swaps, (4.10) design, contour + website roadmap fixes
thinking (10667 chars)
No namespace in either file — so `B1`, `riemannZeta0`, `Zeta0EqZeta`, `integrableOn_of_Zeta0_fun`, `HolomorphicOn_riemannZeta`, `integrable_log_over_pow` are all root-level declarations. But wait — `B1 (x : ℝ) : ℝ := x - ⌊x⌋₊ - 1/2` — generic over `variable {𝕜 : Type*} [RCLike 𝕜]`? The def B1 shows `(x : ℝ) : ℝ` — explicit ℝ.
Now write §2 (IBP identity) and §3 (hasDerivAt). Let me draft §2 fully:
```lean
/-! ## 2. The level-2 Euler–Maclaurin identity -/
/-- Zeta23's sawtooth `B1` equals Int.fract − 1/2 on [0, ∞). -/
theorem b1_eq_fract_sub_half {x : ℝ} (hx : 0 ≤ x) : B1 x = Int.fract x - 1 / 2 := by
unfold B1 Int.fract
rw [Nat.natCast_floor_eq_intCast_floor hx]
/-- The unit-interval IBP: over each integer interval [k, k+1] (k ≥ 1),
∫ B̃₁·x^{−s−1} = (s+1)·∫ B̃₂·x^{−s−2} (boundary terms vanish: B̃₂ = 0 at
integers). -/
theorem intervalIntegral_b1_cpow (k : ℕ) (hk : 1 ≤ k) (s : ℂ) :
∫ x in (k : ℝ)..(k + 1 : ℝ), (B1 x : ℂ) * (x : ℂ) ^ (-s - 1)
= (s + 1) * ∫ x in (k : ℝ)..(k + 1 : ℝ), (b2Fun x : ℂ) * (x : ℂ) ^ (-s - 2) := by
-- work with u = ↑b2Fun, v = x^(−s−1)
have hu : ContinuousOn (fun x : ℝ => (b2Fun x : ℂ)) (Set.Icc (k : ℝ) (k+1 : ℝ)) :=
(continuous_b2Fun.ofReal).continuousOn -- Continuous.ofReal? `Continuous.ofReal`? for ↑∘f: (continuous_b2Fun).ofReal? hmm — Complex.ofRealCLM: continuous_ofReal.comp: `continuous_ofReal.comp continuous_b2Fun`? There's `Continuous.ofReal`? I'll use (continuous_b2Fun.ofReal)?? name check needed: Complex.continuous_ofReal : Continuous (↑) ✓ so continuous_ofReal.comp continuous_b2Fun ✓.
have hv : ContinuousOn (fun x : ℝ => (x : ℂ) ^ (-s - 1)) (Set.Icc (k:ℝ) (k+1:ℝ)) := by
apply ContinuousOn.cpow_const?? -- (x:ℂ)^c continuous for x ≠ 0: `ContinuousAt.ofReal_cpow_const`? or the DifferentiableAt from hasDerivAt_ofReal_cpow_const (x ≠ 0 ✓ on [k, k+1], k ≥ 1): continuous via differentiableAt... simpler: ContinuousOn from fun_prop? fun_prop with cpow_const might work given x ≠ 0 in the set: `by fun_prop (discharger := ...)`. Use: intro x hx; exact (hasDerivAt_ofReal_cpow_const (hx-ne) hr).continuousAt.continuousWithinAt — build from the HasDerivAt:
...
```
Hmm, let me carefully set the v derivative: v(x) = (x:ℂ)^(−s−1); v'(x) = (−s−1)·x^(−s−2) — from hasDerivAt_ofReal_cpow_const (hx : x ≠ 0) (hr : −s−1 ≠ 0): HasDerivAt v ((−s−1)·x^(−s−1−1)) x = (−s−1)·x^(−s−2) ✓ (−s−1−1 = −s−2 ✓ ring_nf inside the exponent — the lemma gives x^(r−1) with r = −s−1: r−1 = −s−2 ✓ as written).
The IBP lemma application:
```lean
have hIBP := intervalIntegral.integral_mul_deriv_eq_deriv_mul_of_hasDerivAt
(a := (k:ℝ)) (b := (k+1 : ℝ))
(u := fun x : ℝ => (b2Fun x : ℂ)) (u' := fun x : ℝ => (Int.fract x - 1/2 : ℂ))
(v := fun x : ℝ => (x : ℂ) ^ (-s - 1)) (v' := fun x : ℝ => -(s + 1) * (x : ℂ) ^ (-s - 2))
hu hv huu' hvv' hu'int hv'int
-- hIBP : ∫ u*v' = u b * v b − u a * v a − ∫ u'*v
```
with:
- huu' : ∀ x ∈ Ioo (min a b) (max a b) — min/max with a = k, b = k+1: min = k, max = k+1 (norm_num/simp): x ∈ Ioo k (k+1): fract x ≠ 0 (x not integer since k < x < k+1: if fract x = 0 then x = ⌊x⌋ integer, but k < x < k+1 with k integer ⟹ x ∉ ℤ ✓ — `Int.fract_ne_zero...`? fract x ≠ 0 ⟺ x ≠ ⌊x⌋ ⟺ x not integer-valued: (Int.fract_eq_zero_iff?) — `Int.fract_eq_zero : fract x = 0 ↔ x = ⌊x⌋`? and x ∈ Ioo k (k+1) ⟹ ⌊x⌋ = k (Int.floor_eq_on_Ico) ⟹ x ≠ ⌊x⌋ since x < k+1 and x > k: x = k would contradict x > k ✓).
Then (hasDerivAt_b2Fun hx).ofReal_comp ✓.
- hvv': hasDerivAt_ofReal_cpow_const (x ≠ 0 since x > k ≥ 1) (−s−1 ≠ 0? — uh oh: −s−1 ≠ 0 ⟺ s ≠ −1: our application has re s > 0, but the unit-IBP lemma is stated for all s... restrict the lemma to (hs : 0 < s.re) or (s ≠ −1)? The IBP identity per interval holds for ALL s (both sides entire-ish in s...) — but the proof via the derivative needs v differentiable... v(x) = x^(−s−1) is differentiable in x regardless ✓ — the issue is only the FORMULA r·x^(r−1) when r = 0: if s = −1 then v = x^0 = 1 constant, v' = 0 — the formula 0·x^{−1} = 0 ✓ still works but hasDerivAt_ofReal_cpow_const needs r ≠ 0. Simplest: assume (hs1 : s ≠ -1) in the unit lemma — our use has re s > 0 so fine. State: (hs : s ≠ -1).
- integrability: u' = ↑(fract−1/2): bounded (fract ∈ [0,1)) + measurable? IntervalIntegrable on [k, k+1]: fract−1/2 = B1 + cast-difference — continuousOn except at endpoints... Actually: (fract x − 1/2) on [k, k+1]: fract is continuousOn Ico(k, k+1) (continuousOn_fract ✓) — the interval [k, k+1] includes the right endpoint where fract jumps — but IntervalIntegrable only needs a.e. properties + boundedness: `IntervalIntegrable` via measurable + bounded on finite measure: AEMeasurable of fract: fract = id − ↑floor: floor measurable (Int.floor measurable: `Int.measurable_floor`? there's measurable for Int.floor? For Nat floor Zeta23 used `Int.measurable_floor`?? their B1 measurability: `Measurable.comp (fun _ _ ↦ trivial) Int.measurable_floor` — hmm that's Nat.floor? `Int.measurable_floor` exists? they used `Int.measurable_floor` — hmm their B1 uses ⌊x⌋₊ (Nat.floor) but called Int.measurable_floor?? Whatever — there IS a measurability lemma for floors. Then u' = (fract − 1/2) as ℂ: measurable ✓ bounded ✓ ⟹ IntervalIntegrable on finite interval via `IntervalIntegrable.mono_set`/`Measure.integrableOn_of_bounded` (as in their intervalIntegrable_deriv_mul_B1 proof pattern ✓ copy).
Simpler alternative: u' = ↑(B1 x) directly — Zeta23 has B1's integrability done (intervalIntegrable_deriv_mul_B1 shows the pattern: IntervalIntegrable.continuousOn_mul + integrableOn_of_bounded with M = 1/2 + aestronglyMeasurable_B1 ✓ — `aestronglyMeasurable_B1 : AEStronglyMeasurable B1` ✓ EXISTS). So use u' := fun x => (B1 x : ℂ) with the b1_eq_fract bridge only where HasDerivAt is concerned... hmm — HasDerivAt u (u' x) with u' = ↑B1 x: hasDerivAt_b2Fun gives derivative fract x − 1/2 = B1 x (x ≥ 0 ✓ on (k, k+1)) ✓ so u' x = ↑B1 x matches via b1_eq_fract_sub_half ✓.
- v' integrable: continuous ✓.
Then hIBP : ∫ x in k..k+1, ↑b2Fun x * v' x = boundary − ∫ ↑B1 x * v x. boundary: ↑b2Fun (k+1)·v − ↑b2Fun k·v = 0 ✓ (b2Fun_intCast... b2Fun (↑k+1): ↑k+1 = ↑(k+1): b2Fun_intCast (k+1 : ℤ)... push_cast: ((k:ℝ)+1) = ((k+1 : ℤ) : ℝ)? (k : ℕ) → (k:ℝ) + 1: ((k:ℝ) + 1) = (((k+1 : ℕ) : ℝ)) ✓ then Int.cast_ofNat... b2Fun_intCast expects (n : ℝ) with n : ℤ: (↑(k+1) : ℝ) with ↑(k+1 : ℕ) = ((k+1 : ℤ) : ℝ)? Int.cast_ofNat ✓. Manage.)
So ∫ ↑B1·v = −∫ ↑b2Fun·v' = −∫ ↑b2Fun·(−(s+1))x^{−s−2} = (s+1)∫↑b2Fun x^{−s−2} ✓ — v' form: v' x = (−s−1)·x^(−s−2) = −(s+1)·x^(−s−2) ✓ then ∫ b2Fun·(−(s+1))·x^{...} = −(s+1)∫ b2Fun·x^.. (integral_const_mul). Signs work out: ∫ u' v = −∫ u v' = −∫ u·(−(s+1)x^{−s−2}) = (s+1)∫ u x^{−s−2} ✓.
3. Sum over k = 1..N−1: ∫ x in 1..N = Σ_{k=1}^{N−1} ∫ x in k..k+1: induction or `intervalIntegral.integral_comp...`? There's `intervalIntegral.integral_add_adjacent_intervals`? For a clean telescope: prove by induction on N:
```lean
theorem intervalIntegral_b1_cpow_nat (N : ℕ) (s : ℂ) (hs : s ≠ -1) :
∫ x in (1:ℝ)..(N : ℝ), (B1 x : ℂ) * (x : ℂ) ^ (-s - 1)
= (s + 1) * ∫ x in (1:ℝ)..(N : ℝ), (b2Fun x : ℂ) * (x : ℂ) ^ (-s - 2) := by
induction N with
| zero => simp -- ∫ 1..0 — not zero!! intervalIntegral 1..0 = −∫ 0..1 ≠ 0. Hmm — restrict to N ≥ 1.
...
```
For N ≥ 1: induction with step ∫₁^(N+1) = ∫₁^N + ∫_N^(N+1) via `intervalIntegral.integral_add_adjacent_intervals`? hmm that's for [a,b]+[b,c]: `intervalIntegral.integral_add_adjacent_intervals (hab : IntervalIntegrable f volume a b) (hbc : IntervalIntegrable f volume b c) : ∫ x in a..b, f x + ∫ x in b..c, f x = ∫ x in a..c, f x`? Roughly. Base N = 1: ∫₁^1 = 0 = RHS ✓. Induction N → N+1 (N ≥ 1): integral over 1..(N+1) = 1..N + N..(N+1) ✓.
Both integrands IntervalIntegrable on every finite interval: B̃₁·x^.. : bounded × continuous ✓; b2Fun·x^..: continuous ✓.
4. Limit N → ∞:
```lean
theorem integral_b1_cpow_eq {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
-- Tendsto of the N-forms via intervalIntegral_tendsto_integral_Ioi
have hInt1 : IntegrableOn (fun x : ℝ => (B1 x : ℂ) * (x : ℂ) ^ (-s - 1)) (Set.Ioi 1) := by
-- from integrableOn_of_Zeta0_fun: their integrand is (⌊x⌋+1/2−x)*x^(−(s+1)) = −B̃₁·x^{−s−1}
have := integrableOn_of_Zeta0_fun (N := 1) (by norm_num) (s := s) hs
-- their form: IntegrableOn (fun x => (↑⌊x⌋ + 1/2 - ↑x) * ↑x ^ (-s - 1)) (Ioi 1)?? check the exact integrand form
...
```
The Zeta23 integrand: (⌊x⌋ + 1/2 − x) * (x:ℂ)^(−s−1)? from hasDerivAt_Zeta0Integral: `∫ x in Ioi N, (⌊x⌋ + 1/2 - x) * (x : ℂ) ^ (-z - 1)` — hmm that's Nat-floor + 1/2 − x = −B̃₁ + ... B1 = x − ⌊x⌋₊ − 1/2: so (⌊x⌋₊ + 1/2 − x) = −B1 x ✓. So their integrand = −B1·x^{−s−1} (with cpow). Our integrand B1·x^{−s−1} = −(their integrand) ✓ Integrable.neg. But the CAST details (⌊x⌋₊ vs my form) — their function uses ↑⌊x⌋ (Nat floor coerced — actually `⌊x⌋` with Nat.floor? in their context (⌊x⌋ + 1/2 − x) with ⌊x⌋₊ Nat... the display showed `(⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-z - 1)` — the ⌊x⌋ there — in EulerMaclaurin B1 it's ⌊x⌋₊. Presumably the same. Fine — integrableOn_of_Zeta0_fun gives IntegrableOn (fun x => (↑⌊x⌋₊ + 1/2 − ↑x)·(↑x)^(−s−1)) — convert to B1-form via B1 def (ring_nf + congr).
- B̃₂ integrability: `IntegrableOn (fun x => (b2Fun x : ℂ) * (x:ℂ)^(−s−2)) (Ioi 1)` for σ > −1: |integrand| ≤ (1/8)·x^{−σ−2}: build via IntegrableOn.mono' with integrableOn_Ioi_rpow_of_lt (−σ−2 < −1 ⟺ σ > −1 ✓): `integrableOn_Ioi_rpow_of_lt (hr : r < -1) (a : ℝ) : IntegrableOn (fun x => x ^ r) (Ioi a)`? — need norm: ‖↑b2Fun·x^(−s−2)‖ = |b2Fun|·x^(−σ−2) ≤ (1/8)x^(−σ−2): `IntegrableOn.mono'` with measurability (continuous B̃₂ · cpow measurable ✓).
- Tendsto: `intervalIntegral_tendsto_integral_Ioi (hint : IntegrableOn f (Ioi a)) (hx : Tendsto b l atTop) : Tendsto (fun n => ∫ x in a..b n, f x) l (𝓝 (∫ x in Ioi a, f x))`? — the Zeta23 usage: `intervalIntegral_tendsto_integral_Ioi (a := N) (b := fun n : ℕ => (n:ℝ)) (integrableOn...) tendsto_natCast_atTop_atTop` ✓ pattern confirmed.
- Match the N-form: ∫ x in 1..N — their lemma gives Tendsto (fun N => ∫ x in 1..(N:ℝ)) — with b := Nat cast ✓ exactly our N-form. Then take limits of both sides of intervalIntegral_b1_cpow_nat (Tendsto on both: RHS has the extra (s+1) const factor ✓ Tendsto.const_mul) — uniqueness of limits: `tendsto_nhds_unique`.
OK — and §3 the hasDerivAt for the B₂ integral (clone of the Zeta23 proof — the longest single block ~80 lines), §4 the identity, §5 the disc bound.
This is a lot. Let me write §2 now, compile, iterate. I'll write §3/§4/§5 after §2 is green. Writing §2 in full now.
All names confirmed (`B1`/`Zeta0EqZeta` are root-level in Zeta23). Writing §2 — the IBP identity.
tool: Edit
input
{
"replace_all": false,
"file_path": "D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiRBound.lean",
"old_string": "end NguyenRH1\n\nend",
"new_string": "/-! ## 2. The level-2 Euler\u2013Maclaurin identity -/\n\n/-- Zeta23's sawtooth `B1` equals Int.fract \u2212 1/2 on [0, \u221e). -/\ntheorem b1_eq_fract_sub_half {x : \u211d} (hx : 0 \u2264 x) : B1 x = Int.fract x - 1 / 2 := by\n unfold B1 Int.fract\n rw [Nat.natCast_floor_eq_intCast_floor hx]\n\n/-- The unit-interval IBP: over each integer interval [k, k+1] (k \u2265 1),\n\u222b B\u0303\u2081\u00b7x^{\u2212s\u22121} = (s+1)\u00b7\u222b B\u0303\u2082\u00b7x^{\u2212s\u22122} (boundary terms vanish: B\u0303\u2082 = 0 at\nthe integers). -/\ntheorem intervalIntegral_b1_cpow (k : \u2115) (hk : 1 \u2264 k) (s : \u2102) (hs : s \u2260 -1) :\n \u222b x in (k : \u211d)..(k + 1 : \u211d), (B1 x : \u2102) * (x : \u2102) ^ (-s - 1)\n = (s + 1) * \u222b x in (k : \u211d)..(k + 1 : \u211d), (b2Fun x : \u2102) * (x : \u2102) ^ (-s - 2) := by\n have hk0 : (0:\u211d) < (k : \u211d) := by exact_mod_cast hk\n have hu : ContinuousOn (fun x : \u211d => (b2Fun x : \u2102)) (Set.Icc (k : \u211d) (k + 1 : \u211d)) :=\n (continuous_ofReal.comp continuous_b2Fun).continuousOn\n have hv : ContinuousOn (fun x : \u211d => (x : \u2102) ^ (-s - 1)) (Set.Icc (k : \u211d) (k + 1 : \u211d)) := by\n intro x hx\n have hx0 : x \u2260 0 := by\n have : (k : \u211d) \u2264 x := hx.1\n linarith\n exact (hasDerivAt_ofReal_cpow_const hx0 (sub_ne_zero.mp (fun h => hs (by linarith [h]))))\n |>.continuousAt.continuousWithinAt\n have huu' : \u2200 x \u2208 Set.Ioo (min (k : \u211d) (k + 1 : \u211d)) (max (k : \u211d) (k + 1 : \u211d)),\n HasDerivAt (fun x : \u211d => (b2Fun x : \u2102)) ((Int.fract x - 1 / 2 : \u2102)) x := by\n intro x hx\n rw [min_eq_left (by linarith : (0:\u211d) \u2264 1), max_eq_right (by linarith : (0:\u211d) \u2264 1)] at hx\n have hfr : Int.fract x \u2260 0 := by\n intro h\n have hxk : \u230ax\u230b = (k : \u2124) := Int.floor_eq_on_Ico _ _\n \u27e8hx.1.le, by exact_mod_cast hx.2\u27e9\n have : x = \u230ax\u230b := by rw [Int.fract] at h; exact sub_eq_zero.mp h |>.symm \u25b8 rfl\n rw [this, hxk] at hx\n simp at hx\n linarith [hx.1]\n exact (hasDerivAt_b2Fun hfr).ofReal_comp\n have hvv' : \u2200 x \u2208 Set.Ioo (min (k : \u211d) (k + 1 : \u211d)) (max (k : \u211d) (k + 1 : \u211d)),\n HasDerivAt (fun x : \u211d => (x : \u2102) ^ (-s - 1)) ((-(s + 1)) * (x : \u2102) ^ (-s - 2)) x := by\n intro x hx\n rw [min_eq_left (by linarith : (0:\u211d) \u2264 1), max_eq_right (by linarith : (0:\u211d) \u2264 1)] at hx\n have hx0 : x \u2260 0 := by linarith [hx.1]\n have hr : (-s - 1) \u2260 0 := neg_ne_zero.mpr (fun h => hs (by linarith [neg_eq_zero.mp h]))\n convert hasDerivAt_ofReal_cpow_const hx0 hr using 2\n \u00b7 ring\n \u00b7 congr 1\n ring\n have hu'int : IntervalIntegrable (fun x : \u211d => (Int.fract x - 1 / 2 : \u2102)) volume\n (k : \u211d) (k + 1 : \u211d) := by\n apply IntervalIntegrable.of_real... -- placeholder\n sorry\n sorry\n\nend NguyenRH1\n\nend"
}
raw content_json (database row)
[{"type":"thinking","thinking":"No namespace in either file — so `B1`, `riemannZeta0`, `Zeta0EqZeta`, `integrableOn_of_Zeta0_fun`, `HolomorphicOn_riemannZeta`, `integrable_log_over_pow` are all root-level declarations. But wait — `B1 (x : ℝ) : ℝ := x - ⌊x⌋₊ - 1/2` — generic over `variable {𝕜 : Type*} [RCLike 𝕜]`? The def B1 shows `(x : ℝ) : ℝ` — explicit ℝ.\n\nNow write §2 (IBP identity) and §3 (hasDerivAt). Let me draft §2 fully:\n\n```lean\n/-! ## 2. The level-2 Euler–Maclaurin identity -/\n\n/-- Zeta23's sawtooth `B1` equals Int.fract − 1/2 on [0, ∞). -/\ntheorem b1_eq_fract_sub_half {x : ℝ} (hx : 0 ≤ x) : B1 x = Int.fract x - 1 / 2 := by\n unfold B1 Int.fract\n rw [Nat.natCast_floor_eq_intCast_floor hx]\n\n/-- The unit-interval IBP: over each integer interval [k, k+1] (k ≥ 1),\n∫ B̃₁·x^{−s−1} = (s+1)·∫ B̃₂·x^{−s−2} (boundary terms vanish: B̃₂ = 0 at\nintegers). -/\ntheorem intervalIntegral_b1_cpow (k : ℕ) (hk : 1 ≤ k) (s : ℂ) :\n ∫ x in (k : ℝ)..(k + 1 : ℝ), (B1 x : ℂ) * (x : ℂ) ^ (-s - 1)\n = (s + 1) * ∫ x in (k : ℝ)..(k + 1 : ℝ), (b2Fun x : ℂ) * (x : ℂ) ^ (-s - 2) := by\n -- work with u = ↑b2Fun, v = x^(−s−1)\n have hu : ContinuousOn (fun x : ℝ => (b2Fun x : ℂ)) (Set.Icc (k : ℝ) (k+1 : ℝ)) :=\n (continuous_b2Fun.ofReal).continuousOn -- Continuous.ofReal? `Continuous.ofReal`? for ↑∘f: (continuous_b2Fun).ofReal? hmm — Complex.ofRealCLM: continuous_ofReal.comp: `continuous_ofReal.comp continuous_b2Fun`? There's `Continuous.ofReal`? I'll use (continuous_b2Fun.ofReal)?? name check needed: Complex.continuous_ofReal : Continuous (↑) ✓ so continuous_ofReal.comp continuous_b2Fun ✓.\n have hv : ContinuousOn (fun x : ℝ => (x : ℂ) ^ (-s - 1)) (Set.Icc (k:ℝ) (k+1:ℝ)) := by\n apply ContinuousOn.cpow_const?? -- (x:ℂ)^c continuous for x ≠ 0: `ContinuousAt.ofReal_cpow_const`? or the DifferentiableAt from hasDerivAt_ofReal_cpow_const (x ≠ 0 ✓ on [k, k+1], k ≥ 1): continuous via differentiableAt... simpler: ContinuousOn from fun_prop? fun_prop with cpow_const might work given x ≠ 0 in the set: `by fun_prop (discharger := ...)`. Use: intro x hx; exact (hasDerivAt_ofReal_cpow_const (hx-ne) hr).continuousAt.continuousWithinAt — build from the HasDerivAt:\n ...\n```\n\nHmm, let me carefully set the v derivative: v(x) = (x:ℂ)^(−s−1); v'(x) = (−s−1)·x^(−s−2) — from hasDerivAt_ofReal_cpow_const (hx : x ≠ 0) (hr : −s−1 ≠ 0): HasDerivAt v ((−s−1)·x^(−s−1−1)) x = (−s−1)·x^(−s−2) ✓ (−s−1−1 = −s−2 ✓ ring_nf inside the exponent — the lemma gives x^(r−1) with r = −s−1: r−1 = −s−2 ✓ as written).\n\nThe IBP lemma application:\n```lean\n have hIBP := intervalIntegral.integral_mul_deriv_eq_deriv_mul_of_hasDerivAt\n (a := (k:ℝ)) (b := (k+1 : ℝ))\n (u := fun x : ℝ => (b2Fun x : ℂ)) (u' := fun x : ℝ => (Int.fract x - 1/2 : ℂ))\n (v := fun x : ℝ => (x : ℂ) ^ (-s - 1)) (v' := fun x : ℝ => -(s + 1) * (x : ℂ) ^ (-s - 2))\n hu hv huu' hvv' hu'int hv'int\n -- hIBP : ∫ u*v' = u b * v b − u a * v a − ∫ u'*v\n```\nwith:\n- huu' : ∀ x ∈ Ioo (min a b) (max a b) — min/max with a = k, b = k+1: min = k, max = k+1 (norm_num/simp): x ∈ Ioo k (k+1): fract x ≠ 0 (x not integer since k < x < k+1: if fract x = 0 then x = ⌊x⌋ integer, but k < x < k+1 with k integer ⟹ x ∉ ℤ ✓ — `Int.fract_ne_zero...`? fract x ≠ 0 ⟺ x ≠ ⌊x⌋ ⟺ x not integer-valued: (Int.fract_eq_zero_iff?) — `Int.fract_eq_zero : fract x = 0 ↔ x = ⌊x⌋`? and x ∈ Ioo k (k+1) ⟹ ⌊x⌋ = k (Int.floor_eq_on_Ico) ⟹ x ≠ ⌊x⌋ since x < k+1 and x > k: x = k would contradict x > k ✓).\n Then (hasDerivAt_b2Fun hx).ofReal_comp ✓.\n- hvv': hasDerivAt_ofReal_cpow_const (x ≠ 0 since x > k ≥ 1) (−s−1 ≠ 0? — uh oh: −s−1 ≠ 0 ⟺ s ≠ −1: our application has re s > 0, but the unit-IBP lemma is stated for all s... restrict the lemma to (hs : 0 < s.re) or (s ≠ −1)? The IBP identity per interval holds for ALL s (both sides entire-ish in s...) — but the proof via the derivative needs v differentiable... v(x) = x^(−s−1) is differentiable in x regardless ✓ — the issue is only the FORMULA r·x^(r−1) when r = 0: if s = −1 then v = x^0 = 1 constant, v' = 0 — the formula 0·x^{−1} = 0 ✓ still works but hasDerivAt_ofReal_cpow_const needs r ≠ 0. Simplest: assume (hs1 : s ≠ -1) in the unit lemma — our use has re s > 0 so fine. State: (hs : s ≠ -1).\n- integrability: u' = ↑(fract−1/2): bounded (fract ∈ [0,1)) + measurable? IntervalIntegrable on [k, k+1]: fract−1/2 = B1 + cast-difference — continuousOn except at endpoints... Actually: (fract x − 1/2) on [k, k+1]: fract is continuousOn Ico(k, k+1) (continuousOn_fract ✓) — the interval [k, k+1] includes the right endpoint where fract jumps — but IntervalIntegrable only needs a.e. properties + boundedness: `IntervalIntegrable` via measurable + bounded on finite measure: AEMeasurable of fract: fract = id − ↑floor: floor measurable (Int.floor measurable: `Int.measurable_floor`? there's measurable for Int.floor? For Nat floor Zeta23 used `Int.measurable_floor`?? their B1 measurability: `Measurable.comp (fun _ _ ↦ trivial) Int.measurable_floor` — hmm that's Nat.floor? `Int.measurable_floor` exists? they used `Int.measurable_floor` — hmm their B1 uses ⌊x⌋₊ (Nat.floor) but called Int.measurable_floor?? Whatever — there IS a measurability lemma for floors. Then u' = (fract − 1/2) as ℂ: measurable ✓ bounded ✓ ⟹ IntervalIntegrable on finite interval via `IntervalIntegrable.mono_set`/`Measure.integrableOn_of_bounded` (as in their intervalIntegrable_deriv_mul_B1 proof pattern ✓ copy).\n Simpler alternative: u' = ↑(B1 x) directly — Zeta23 has B1's integrability done (intervalIntegrable_deriv_mul_B1 shows the pattern: IntervalIntegrable.continuousOn_mul + integrableOn_of_bounded with M = 1/2 + aestronglyMeasurable_B1 ✓ — `aestronglyMeasurable_B1 : AEStronglyMeasurable B1` ✓ EXISTS). So use u' := fun x => (B1 x : ℂ) with the b1_eq_fract bridge only where HasDerivAt is concerned... hmm — HasDerivAt u (u' x) with u' = ↑B1 x: hasDerivAt_b2Fun gives derivative fract x − 1/2 = B1 x (x ≥ 0 ✓ on (k, k+1)) ✓ so u' x = ↑B1 x matches via b1_eq_fract_sub_half ✓. \n- v' integrable: continuous ✓.\n\nThen hIBP : ∫ x in k..k+1, ↑b2Fun x * v' x = boundary − ∫ ↑B1 x * v x. boundary: ↑b2Fun (k+1)·v − ↑b2Fun k·v = 0 ✓ (b2Fun_intCast... b2Fun (↑k+1): ↑k+1 = ↑(k+1): b2Fun_intCast (k+1 : ℤ)... push_cast: ((k:ℝ)+1) = ((k+1 : ℤ) : ℝ)? (k : ℕ) → (k:ℝ) + 1: ((k:ℝ) + 1) = (((k+1 : ℕ) : ℝ)) ✓ then Int.cast_ofNat... b2Fun_intCast expects (n : ℝ) with n : ℤ: (↑(k+1) : ℝ) with ↑(k+1 : ℕ) = ((k+1 : ℤ) : ℝ)? Int.cast_ofNat ✓. Manage.)\nSo ∫ ↑B1·v = −∫ ↑b2Fun·v' = −∫ ↑b2Fun·(−(s+1))x^{−s−2} = (s+1)∫↑b2Fun x^{−s−2} ✓ — v' form: v' x = (−s−1)·x^(−s−2) = −(s+1)·x^(−s−2) ✓ then ∫ b2Fun·(−(s+1))·x^{...} = −(s+1)∫ b2Fun·x^.. (integral_const_mul). Signs work out: ∫ u' v = −∫ u v' = −∫ u·(−(s+1)x^{−s−2}) = (s+1)∫ u x^{−s−2} ✓.\n\n3. Sum over k = 1..N−1: ∫ x in 1..N = Σ_{k=1}^{N−1} ∫ x in k..k+1: induction or `intervalIntegral.integral_comp...`? There's `intervalIntegral.integral_add_adjacent_intervals`? For a clean telescope: prove by induction on N:\n```lean\ntheorem intervalIntegral_b1_cpow_nat (N : ℕ) (s : ℂ) (hs : s ≠ -1) :\n ∫ x in (1:ℝ)..(N : ℝ), (B1 x : ℂ) * (x : ℂ) ^ (-s - 1)\n = (s + 1) * ∫ x in (1:ℝ)..(N : ℝ), (b2Fun x : ℂ) * (x : ℂ) ^ (-s - 2) := by\n induction N with\n | zero => simp -- ∫ 1..0 — not zero!! intervalIntegral 1..0 = −∫ 0..1 ≠ 0. Hmm — restrict to N ≥ 1.\n ...\n```\nFor N ≥ 1: induction with step ∫₁^(N+1) = ∫₁^N + ∫_N^(N+1) via `intervalIntegral.integral_add_adjacent_intervals`? hmm that's for [a,b]+[b,c]: `intervalIntegral.integral_add_adjacent_intervals (hab : IntervalIntegrable f volume a b) (hbc : IntervalIntegrable f volume b c) : ∫ x in a..b, f x + ∫ x in b..c, f x = ∫ x in a..c, f x`? Roughly. Base N = 1: ∫₁^1 = 0 = RHS ✓. Induction N → N+1 (N ≥ 1): integral over 1..(N+1) = 1..N + N..(N+1) ✓.\n\nBoth integrands IntervalIntegrable on every finite interval: B̃₁·x^.. : bounded × continuous ✓; b2Fun·x^..: continuous ✓.\n\n4. Limit N → ∞:\n```lean\ntheorem integral_b1_cpow_eq {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 -- Tendsto of the N-forms via intervalIntegral_tendsto_integral_Ioi\n have hInt1 : IntegrableOn (fun x : ℝ => (B1 x : ℂ) * (x : ℂ) ^ (-s - 1)) (Set.Ioi 1) := by\n -- from integrableOn_of_Zeta0_fun: their integrand is (⌊x⌋+1/2−x)*x^(−(s+1)) = −B̃₁·x^{−s−1}\n have := integrableOn_of_Zeta0_fun (N := 1) (by norm_num) (s := s) hs\n -- their form: IntegrableOn (fun x => (↑⌊x⌋ + 1/2 - ↑x) * ↑x ^ (-s - 1)) (Ioi 1)?? check the exact integrand form\n ...\n```\nThe Zeta23 integrand: (⌊x⌋ + 1/2 − x) * (x:ℂ)^(−s−1)? from hasDerivAt_Zeta0Integral: `∫ x in Ioi N, (⌊x⌋ + 1/2 - x) * (x : ℂ) ^ (-z - 1)` — hmm that's Nat-floor + 1/2 − x = −B̃₁ + ... B1 = x − ⌊x⌋₊ − 1/2: so (⌊x⌋₊ + 1/2 − x) = −B1 x ✓. So their integrand = −B1·x^{−s−1} (with cpow). Our integrand B1·x^{−s−1} = −(their integrand) ✓ Integrable.neg. But the CAST details (⌊x⌋₊ vs my form) — their function uses ↑⌊x⌋ (Nat floor coerced — actually `⌊x⌋` with Nat.floor? in their context (⌊x⌋ + 1/2 − x) with ⌊x⌋₊ Nat... the display showed `(⌊x⌋ + 1 / 2 - x) * (x : ℂ) ^ (-z - 1)` — the ⌊x⌋ there — in EulerMaclaurin B1 it's ⌊x⌋₊. Presumably the same. Fine — integrableOn_of_Zeta0_fun gives IntegrableOn (fun x => (↑⌊x⌋₊ + 1/2 − ↑x)·(↑x)^(−s−1)) — convert to B1-form via B1 def (ring_nf + congr).\n\n - B̃₂ integrability: `IntegrableOn (fun x => (b2Fun x : ℂ) * (x:ℂ)^(−s−2)) (Ioi 1)` for σ > −1: |integrand| ≤ (1/8)·x^{−σ−2}: build via IntegrableOn.mono' with integrableOn_Ioi_rpow_of_lt (−σ−2 < −1 ⟺ σ > −1 ✓): `integrableOn_Ioi_rpow_of_lt (hr : r < -1) (a : ℝ) : IntegrableOn (fun x => x ^ r) (Ioi a)`? — need norm: ‖↑b2Fun·x^(−s−2)‖ = |b2Fun|·x^(−σ−2) ≤ (1/8)x^(−σ−2): `IntegrableOn.mono'` with measurability (continuous B̃₂ · cpow measurable ✓).\n - Tendsto: `intervalIntegral_tendsto_integral_Ioi (hint : IntegrableOn f (Ioi a)) (hx : Tendsto b l atTop) : Tendsto (fun n => ∫ x in a..b n, f x) l (𝓝 (∫ x in Ioi a, f x))`? — the Zeta23 usage: `intervalIntegral_tendsto_integral_Ioi (a := N) (b := fun n : ℕ => (n:ℝ)) (integrableOn...) tendsto_natCast_atTop_atTop` ✓ pattern confirmed.\n - Match the N-form: ∫ x in 1..N — their lemma gives Tendsto (fun N => ∫ x in 1..(N:ℝ)) — with b := Nat cast ✓ exactly our N-form. Then take limits of both sides of intervalIntegral_b1_cpow_nat (Tendsto on both: RHS has the extra (s+1) const factor ✓ Tendsto.const_mul) — uniqueness of limits: `tendsto_nhds_unique`.\n\nOK — and §3 the hasDerivAt for the B₂ integral (clone of the Zeta23 proof — the longest single block ~80 lines), §4 the identity, §5 the disc bound.\n\nThis is a lot. Let me write §2 now, compile, iterate. I'll write §3/§4/§5 after §2 is green. Writing §2 in full now.","signature":""},{"type":"text","text":"All names confirmed (`B1`/`Zeta0EqZeta` are root-level in Zeta23). Writing §2 — the IBP identity."},{"type":"tool_use","id":"Edit_202","name":"Edit","input":{"replace_all":false,"file_path":"D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiRBound.lean","old_string":"end NguyenRH1\n\nend","new_string":"/-! ## 2. The level-2 Euler–Maclaurin identity -/\n\n/-- Zeta23's sawtooth `B1` equals Int.fract − 1/2 on [0, ∞). -/\ntheorem b1_eq_fract_sub_half {x : ℝ} (hx : 0 ≤ x) : B1 x = Int.fract x - 1 / 2 := by\n unfold B1 Int.fract\n rw [Nat.natCast_floor_eq_intCast_floor hx]\n\n/-- The unit-interval IBP: over each integer interval [k, k+1] (k ≥ 1),\n∫ B̃₁·x^{−s−1} = (s+1)·∫ B̃₂·x^{−s−2} (boundary terms vanish: B̃₂ = 0 at\nthe integers). -/\ntheorem intervalIntegral_b1_cpow (k : ℕ) (hk : 1 ≤ k) (s : ℂ) (hs : s ≠ -1) :\n ∫ x in (k : ℝ)..(k + 1 : ℝ), (B1 x : ℂ) * (x : ℂ) ^ (-s - 1)\n = (s + 1) * ∫ x in (k : ℝ)..(k + 1 : ℝ), (b2Fun x : ℂ) * (x : ℂ) ^ (-s - 2) := by\n have hk0 : (0:ℝ) < (k : ℝ) := by exact_mod_cast hk\n have hu : ContinuousOn (fun x : ℝ => (b2Fun x : ℂ)) (Set.Icc (k : ℝ) (k + 1 : ℝ)) :=\n (continuous_ofReal.comp continuous_b2Fun).continuousOn\n have hv : ContinuousOn (fun x : ℝ => (x : ℂ) ^ (-s - 1)) (Set.Icc (k : ℝ) (k + 1 : ℝ)) := by\n intro x hx\n have hx0 : x ≠ 0 := by\n have : (k : ℝ) ≤ x := hx.1\n linarith\n exact (hasDerivAt_ofReal_cpow_const hx0 (sub_ne_zero.mp (fun h => hs (by linarith [h]))))\n |>.continuousAt.continuousWithinAt\n have huu' : ∀ x ∈ Set.Ioo (min (k : ℝ) (k + 1 : ℝ)) (max (k : ℝ) (k + 1 : ℝ)),\n HasDerivAt (fun x : ℝ => (b2Fun x : ℂ)) ((Int.fract x - 1 / 2 : ℂ)) x := by\n intro x hx\n rw [min_eq_left (by linarith : (0:ℝ) ≤ 1), max_eq_right (by linarith : (0:ℝ) ≤ 1)] at hx\n have hfr : Int.fract x ≠ 0 := by\n intro h\n have hxk : ⌊x⌋ = (k : ℤ) := Int.floor_eq_on_Ico _ _\n ⟨hx.1.le, by exact_mod_cast hx.2⟩\n have : x = ⌊x⌋ := by rw [Int.fract] at h; exact sub_eq_zero.mp h |>.symm ▸ rfl\n rw [this, hxk] at hx\n simp at hx\n linarith [hx.1]\n exact (hasDerivAt_b2Fun hfr).ofReal_comp\n have hvv' : ∀ x ∈ Set.Ioo (min (k : ℝ) (k + 1 : ℝ)) (max (k : ℝ) (k + 1 : ℝ)),\n HasDerivAt (fun x : ℝ => (x : ℂ) ^ (-s - 1)) ((-(s + 1)) * (x : ℂ) ^ (-s - 2)) x := by\n intro x hx\n rw [min_eq_left (by linarith : (0:ℝ) ≤ 1), max_eq_right (by linarith : (0:ℝ) ≤ 1)] at hx\n have hx0 : x ≠ 0 := by linarith [hx.1]\n have hr : (-s - 1) ≠ 0 := neg_ne_zero.mpr (fun h => hs (by linarith [neg_eq_zero.mp h]))\n convert hasDerivAt_ofReal_cpow_const hx0 hr using 2\n · ring\n · congr 1\n ring\n have hu'int : IntervalIntegrable (fun x : ℝ => (Int.fract x - 1 / 2 : ℂ)) volume\n (k : ℝ) (k + 1 : ℝ) := by\n apply IntervalIntegrable.of_real... -- placeholder\n sorry\n sorry\n\nend NguyenRH1\n\nend"},"extra_content":null}]