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/L3log.lean

All files · 132 lines · source at the verified commit

1module
2
3public import E424.Setup
4public import E424.Setup.L3logAux
5
6@[expose] public section
7
8/-!
9# Lemma 3, logarithmic form
10
11Partial summation from `L3`. With `c n = ind (n ∈ A)` and `cum c N = ∑_{k ∈ (0, N]} c k`, `L3` gives
12`cum c N ≥ α N` for `N ≥ x0`. Abel summation then bounds `∑_{n ∈ (⌊u⌋, ⌊v⌋]} c n / n` below by
13`α (1 + log ((⌊v⌋+1)/(⌊u⌋+2))) - 1`, and `log (v/u) ≤ log 2 + log ((⌊v⌋+1)/(⌊u⌋+2))` for `u ≥ 2`.
14-/
15
16set_option linter.style.header false
17open Finset
18
19namespace E424
20
21/-- **Lemma 3**, logarithmic form. Partial summation from `L3`. -/
22theorem L3_log : ∃ α > (0 : ℝ), α ≤ 1 ∧ ∃ x0 ≥ (1 : ℝ), ∀ u v : ℝ, x0 ≤ u → u ≤ v →
23 α * Real.log (v / u) - 1 ≤ (Win.mk u v).sum fun n => ind (n ∈ A) := by
24 obtain ⟨α, hα, hα1, x0, hx0, hL3⟩ := L3
25 refine ⟨α, hα, hα1, max x0 2, le_trans (by norm_num) (le_max_right _ _), ?_⟩
26 intro u v hu huv
27 have hu2 : (2 : ℝ) ≤ u := (le_max_right _ _).trans hu
28 have hux0 : x0 ≤ u := (le_max_left _ _).trans hu
29 have hu0 : 0 < u := by linarith
30 have hv0 : 0 < v := by linarith
31 set c : ℕ → ℝ := fun n => ind (n ∈ A) with hc
32 have hsum : (Win.mk u v).sum c = ∑ n ∈ Ioc ⌊u⌋₊ ⌊v⌋₊, c n / n := rfl
33 have hcum : ∀ N : ℕ, cum c N = ((AIoc 0 (N : ℝ)).card : ℝ) := by
34 intro N
35 simp only [cum, AIoc, Nat.floor_natCast, Nat.floor_zero, hc, ind]
36 rw [Finset.card_filter]
37 push_cast
38 rfl
39 have hcle : ∀ N : ℕ, cum c N ≤ N := by
40 intro N
41 unfold cum
42 have h1 : ∀ k ∈ Ioc 0 N, c k ≤ 1 := fun k _ => by
43 rw [hc]; dsimp only; unfold ind; split_ifs <;> norm_num
44 calc ∑ k ∈ Ioc 0 N, c k ≤ ∑ _k ∈ Ioc 0 N, (1 : ℝ) := Finset.sum_le_sum h1
45 _ = N := by simp
46 have hcum_lb : ∀ N : ℕ, x0 ≤ (N : ℝ) → α * N ≤ cum c N := by
47 intro N hN
48 rw [hcum N]
49 exact hL3 (N : ℝ) hN
50 have hcpos : ∀ n : ℕ, 0 ≤ c n := fun n => by
51 rw [hc]; dsimp only; unfold ind; split_ifs <;> norm_num
52 generalize hm : ⌊u⌋₊ = m
53 generalize hN : ⌊v⌋₊ = Nv
54 have hmu : (m : ℝ) ≤ u := by rw [← hm]; exact Nat.floor_le hu0.le
55 have hum : u < (m : ℝ) + 1 := by rw [← hm]; exact Nat.lt_floor_add_one u
56 have hvN : v < (Nv : ℝ) + 1 := by rw [← hN]; exact Nat.lt_floor_add_one v
57 rw [hsum, hm, hN]
58 have hlog_nonneg : 0 ≤ Real.log (v / u) :=
59 Real.log_nonneg ((one_le_div hu0).2 huv)
60 rcases Nat.lt_or_ge m Nv with hlt | hle
61 · obtain ⟨K, rfl⟩ : ∃ K, Nv = K + 1 := ⟨Nv - 1, by omega⟩
62 have hmK : m ≤ K := by omega
63 have habel := abel c m K hmK
64 have hKpos : (0 : ℝ) < (K : ℝ) + 1 := by positivity
65 have hm1 : (m : ℝ) + 1 ≤ (K : ℝ) + 1 := by exact_mod_cast (by omega : m + 1 ≤ K + 1)
66 -- the top term: `α ≤ cum c (K+1) / (K+1)`
67 have hA : α ≤ cum c (K + 1) / ((K : ℝ) + 1) := by
68 rw [le_div_iff₀ hKpos]
69 have := hcum_lb (K + 1) (by push_cast; linarith)
70 push_cast at this
71 linarith
72 -- the bottom term: `cum c m / (m+1) ≤ 1`
73 have hB : cum c m / ((m : ℝ) + 1) ≤ 1 := by
74 rw [div_le_one (by positivity)]
75 linarith [hcle m]
76 -- the middle sum, termwise: `cum c n ≥ α n` and `1/n - 1/(n+1) ≥ 0`
77 have hC : α * ∑ n ∈ Ioc m K, 1 / ((n : ℝ) + 1)
78 ≤ ∑ n ∈ Ioc m K, cum c n * (1 / (n : ℝ) - 1 / ((n : ℝ) + 1)) := by
79 rw [Finset.mul_sum]
80 apply Finset.sum_le_sum
81 intro n hn
82 rw [Finset.mem_Ioc] at hn
83 have hn1 : (m : ℝ) + 1 ≤ (n : ℝ) := by exact_mod_cast (by omega : m + 1 ≤ n)
84 have hnx : x0 ≤ (n : ℝ) := by linarith
85 have h1 := hcum_lb n hnx
86 have hn0 : (0 : ℝ) < n := by linarith
87 have h2 : 0 ≤ 1 / (n : ℝ) - 1 / ((n : ℝ) + 1) := by
88 rw [sub_nonneg]
89 exact one_div_le_one_div_of_le hn0 (by linarith)
90 have e : α * (1 / ((n : ℝ) + 1)) = α * n * (1 / (n : ℝ) - 1 / ((n : ℝ) + 1)) := by
91 field_simp
92 ring
93 rw [e]
94 exact mul_le_mul_of_nonneg_right h1 h2
95 -- the telescoped log bound
96 have hD := log_le_sum_inv m K hmK
97 have hD' := mul_le_mul_of_nonneg_left hD hα.le
98 -- `log (v/u) ≤ log 2 + log ((K+2)/(m+2))`
99 have hm2 : (m : ℝ) + 2 ≤ 2 * u := by linarith
100 have hv2 : v ≤ (K : ℝ) + 2 := by push_cast at hvN; linarith
101 have hvu : v / u ≤ 2 * (((K : ℝ) + 2) / ((m : ℝ) + 2)) := by
102 rw [div_le_iff₀ hu0]
103 have hpos : (0 : ℝ) < (m : ℝ) + 2 := by positivity
104 calc v ≤ (K : ℝ) + 2 := hv2
105 _ = ((K : ℝ) + 2) / ((m : ℝ) + 2) * ((m : ℝ) + 2) := by field_simp
106 _ ≤ ((K : ℝ) + 2) / ((m : ℝ) + 2) * (2 * u) :=
107 mul_le_mul_of_nonneg_left hm2 (by positivity)
108 _ = 2 * (((K : ℝ) + 2) / ((m : ℝ) + 2)) * u := by ring
109 have hX : (0 : ℝ) < ((K : ℝ) + 2) / ((m : ℝ) + 2) := by positivity
110 have hlog2 : Real.log (v / u) ≤ Real.log 2 + Real.log (((K : ℝ) + 2) / ((m : ℝ) + 2)) := by
111 rw [← Real.log_mul (by norm_num) hX.ne']
112 exact Real.log_le_log (div_pos hv0 hu0) (by linarith [hvu])
113 have hl2 : Real.log 2 < 1 := by linarith [Real.log_two_lt_d9]
114 have hα2 : α * Real.log 2 ≤ α := by nlinarith
115 have hlog' := mul_le_mul_of_nonneg_left hlog2 hα.le
116 have hS := habel
117 linarith [hA, hB, hC, hD', hS, hlog', hα2]
118 · have hsum0 : ∑ n ∈ Ioc m Nv, c n / n = 0 := by
119 rw [Finset.Ioc_eq_empty (by omega)]
120 simp
121 rw [hsum0]
122 have hNm : (Nv : ℝ) ≤ m := by exact_mod_cast hle
123 have hlog1 : Real.log (v / u) ≤ 1 := by
124 have h := Real.log_le_sub_one_of_pos (div_pos hv0 hu0)
125 have e : v / u - 1 < 1 := by
126 rw [div_sub_one hu0.ne', div_lt_one hu0]
127 linarith
128 linarith
129 nlinarith
130
131end E424
132