This journal is in preparation. Submissions are open as a pilot and the editorial board is being formed. Articles marked Demonstration show the format only.
Journal of Machine-Verified MathematicsPeer-reviewed mathematics with machine-checked proofs, for the age of AI

E424/Setup/L3logAux.lean

All files · 75 lines · source at the verified commit

1module
2
3public import Mathlib
4
5@[expose] public section
6
7/-!
8# Lemma 3, logarithmic form: discrete partial summation
9
10For `c : ℕ → ℝ`, `cum c N = ∑_{k ∈ (0, N]} c k`.
11* `abel`: partial summation of `∑_{n ∈ (m, K+1]} c n / n` against the counting function.
12* `log_le_sum_inv`: `∑_{n ∈ (m, K]} 1/(n+1) ≥ log ((K+2)/(m+2))`, by telescoping `1/k ≥ log (1 + 1/k)`.
13-/
14
15set_option linter.style.header false
16
17namespace E424
18
19/-- Cumulative sum `∑_{k ∈ (0, N]} c k`. -/
20noncomputable def cum (c : ℕ → ℝ) (N : ℕ) : ℝ := ∑ k ∈ Finset.Ioc 0 N, c k
21
22lemma cum_succ (c : ℕ → ℝ) (N : ℕ) : cum c (N + 1) = cum c N + c (N + 1) := by
23 unfold cum
24 rw [Finset.sum_Ioc_succ_top (Nat.zero_le N)]
25
26/-- Partial summation for `∑_{n ∈ (m, K+1]} c n / n`, for `m ≤ K`. -/
27lemma abel (c : ℕ → ℝ) (m : ℕ) (K : ℕ) (hK : m ≤ K) :
28 ∑ n ∈ Finset.Ioc m (K + 1), c n / n
29 = cum c (K + 1) / ((K : ℝ) + 1) - cum c m / ((m : ℝ) + 1)
30 + ∑ n ∈ Finset.Ioc m K, cum c n * (1 / (n : ℝ) - 1 / ((n : ℝ) + 1)) := by
31 induction K, hK using Nat.le_induction with
32 | base =>
33 rw [Finset.sum_Ioc_succ_top le_rfl, Finset.Ioc_self, Finset.sum_empty, cum_succ]
34 push_cast
35 ring
36 | succ K hK ih =>
37 rw [Finset.sum_Ioc_succ_top (hK.trans (Nat.le_succ K)), ih,
38 Finset.sum_Ioc_succ_top hK, cum_succ c (K + 1)]
39 push_cast
40 field_simp
41 ring
42
43/-- Telescoping: `∑_{n ∈ (m, K]} 1/(n+1) ≥ log ((K+2)/(m+2))`, for `m ≤ K`. -/
44lemma log_le_sum_inv (m : ℕ) (K : ℕ) (hK : m ≤ K) :
45 Real.log (((K : ℝ) + 2) / ((m : ℝ) + 2)) ≤ ∑ n ∈ Finset.Ioc m K, 1 / ((n : ℝ) + 1) := by
46 induction K, hK using Nat.le_induction with
47 | base =>
48 rw [Finset.Ioc_self, Finset.sum_empty, div_self (by positivity), Real.log_one]
49 | succ K hK ih =>
50 rw [Finset.sum_Ioc_succ_top hK]
51 have hK0 : (0 : ℝ) < (K : ℝ) + 2 := by positivity
52 have hK1 : (0 : ℝ) < (K : ℝ) + 3 := by positivity
53 have hm0 : (0 : ℝ) < (m : ℝ) + 2 := by positivity
54 have hstep : Real.log ((((K + 1 : ℕ) : ℝ) + 2) / ((m : ℝ) + 2))
55 = Real.log (((K : ℝ) + 2) / ((m : ℝ) + 2)) + Real.log (((K : ℝ) + 3) / ((K : ℝ) + 2)) := by
56 rw [← Real.log_mul (by positivity) (by positivity)]
57 congr 1
58 push_cast
59 field_simp
60 ring
61 have hle : Real.log (((K : ℝ) + 3) / ((K : ℝ) + 2)) ≤ 1 / ((K : ℝ) + 2) := by
62 have h := Real.log_le_sub_one_of_pos (div_pos hK1 hK0)
63 have e : ((K : ℝ) + 3) / ((K : ℝ) + 2) - 1 = 1 / ((K : ℝ) + 2) := by
64 field_simp
65 ring
66 linarith
67 have hterm : (1 : ℝ) / (((K + 1 : ℕ) : ℝ) + 1) = 1 / ((K : ℝ) + 2) := by
68 congr 1
69 push_cast
70 ring
71 rw [hstep, hterm]
72 linarith
73
74end E424
75