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

All files · 159 lines · source at the verified commit

1module
2
3public import E424.DivisorMoments
4
5@[expose] public section
6
7/-!
8# Window calculus: Lemma 17 in normalised form, with all boundary terms absorbed into `edge`
9
10Proved from the statements of `S4`. `c` ranges over `[1, exp √(log lo)]`.
11-/
12
13set_option linter.style.header false
14open Finset Filter
15
16namespace E424
17
18theorem edge_pos {η N0 : ℝ} {W : Win} (h : W.Adm η N0) : 0 < W.edge :=
19 Real.rpow_pos_of_pos (by linarith [h.one_lt_log]) _
20
21theorem mu_nonneg {η N0 : ℝ} (hη : 0 < η) {W : Win} (h : W.Adm η N0) (S : Set ℕ) : 0 ≤ W.mu S :=
22 Win.E_nonneg (h.len_pos hη).le fun _ _ => ind_nonneg _
23
24theorem D_nonneg {η N0 : ℝ} (hη : 0 < η) {W : Win} (h : W.Adm η N0) (k : ℕ) : 0 ≤ W.D k :=
25 Win.E_nonneg (h.len_pos hη).le fun _ _ => ind_nonneg _
26
27/-- A dilation by `c ≤ exp √(log lo)` costs at most `edge`. -/
28theorem dilate_le_edge (η : ℝ) (hη : 0 < η) : ∃ N0 : ℝ, ∀ W : Win, W.Adm η N0 → ∀ c : ℝ, 1 ≤ c →
29 c ≤ Real.exp (Real.sqrt (Real.log W.lo)) → (Real.log c + c / W.lo) / W.len ≤ W.edge := by
30 have ev : ∀ᶠ lo : ℝ in atTop, 2 / η ≤ Real.log lo ^ (1 / 6 : ℝ) :=
31 ((tendsto_rpow_atTop (by norm_num)).comp Real.tendsto_log_atTop).eventually_ge_atTop _
32 obtain ⟨N0, hN0⟩ := eventually_atTop.mp ev
33 refine ⟨N0, fun W hW c hc hce => ?_⟩
34 have h6 := hN0 W.lo hW.le_lo
35 have hl := hW.one_lt_log
36 set l := Real.log W.lo with hldef
37 have hl0 : 0 < l := by linarith
38 have hlo := hW.lo_pos
39 have hL := hW.len_pos hη
40 have h1 : Real.log c ≤ Real.sqrt l := by
41 rw [← Real.log_exp (Real.sqrt l)]; exact Real.log_le_log (by linarith) hce
42 have hsq1 : 1 ≤ Real.sqrt l := Real.one_le_sqrt.mpr hl.le
43 have hsql : Real.sqrt l ≤ l := by
44 have := Real.sq_sqrt hl0.le; nlinarith
45 have h2 : c / W.lo ≤ 1 := by
46 rw [div_le_one hlo]
47 refine hce.trans ?_
48 calc Real.exp (Real.sqrt l) ≤ Real.exp l := Real.exp_le_exp.mpr hsql
49 _ = W.lo := Real.exp_log hlo
50 have h3 : Real.log c + c / W.lo ≤ 2 * Real.sqrt l := by linarith
51 rw [div_le_iff₀ hL]
52 refine h3.trans ?_
53 have h4 : W.edge * (η * l) ≤ W.edge * W.len :=
54 mul_le_mul_of_nonneg_left hW.le_len (edge_pos hW).le
55 refine le_trans ?_ h4
56 have h5 : W.edge * l = l ^ (1 / 2 : ℝ) * l ^ (1 / 6 : ℝ) := by
57 unfold Win.edge
58 rw [← Real.rpow_add hl0, ← hldef]
59 nth_rewrite 2 [← Real.rpow_one l]
60 rw [← Real.rpow_add hl0]; norm_num
61 have h7 : W.edge * (η * l) = η * (Real.sqrt l * l ^ (1 / 6 : ℝ)) := by
62 rw [Real.sqrt_eq_rpow, ← h5]; ring
63 rw [h7]
64 rw [div_le_iff₀ hη] at h6
65 nlinarith
66
67/-- `|E_{W/c} G - E_W G| ≤ edge` for `0 ≤ G ≤ 1`. -/
68theorem E_div_le (η : ℝ) (hη : 0 < η) : ∃ N0 : ℝ, ∀ W : Win, W.Adm η N0 → ∀ c : ℝ, 1 ≤ c →
69 c ≤ Real.exp (Real.sqrt (Real.log W.lo)) → ∀ G : ℕ → ℝ, (∀ n, 0 ≤ G n) → (∀ n, G n ≤ 1) →
70 |(W.div c).E G - W.E G| ≤ W.edge := by
71 obtain ⟨N0, h⟩ := dilate_le_edge η hη
72 refine ⟨N0, fun W hW c hc hce G h0 h1 => le_trans ?_ (h W hW c hc hce)⟩
73 have hL := hW.len_pos hη
74 unfold Win.E
75 rw [Win.len_div (by linarith), ← sub_div, abs_div, abs_of_pos hL]
76 exact div_le_div_of_nonneg_right (L17_div W hW.lo_pos hW.lo_lt.le c hc G h0 h1) hL.le
77
78/-- `E_W[G(c n)] ≤ c (E_W G + edge)`. -/
79theorem E_mul_le (η : ℝ) (hη : 0 < η) : ∃ N0 : ℝ, ∀ W : Win, W.Adm η N0 → ∀ c : ℕ, 1 ≤ c →
80 (c : ℝ) ≤ Real.exp (Real.sqrt (Real.log W.lo)) → ∀ G : ℕ → ℝ, (∀ n, 0 ≤ G n) → (∀ n, G n ≤ 1) →
81 W.E (fun n => G (c * n)) ≤ c * (W.E G + W.edge) := by
82 obtain ⟨N0, h⟩ := dilate_le_edge η hη
83 refine ⟨N0, fun W hW c hc hce G h0 h1 => ?_⟩
84 have hL := hW.len_pos hη
85 have hlo := hW.lo_pos
86 have hc1 : (1 : ℝ) ≤ c := by exact_mod_cast hc
87 have h2 := h W hW c hc1 hce
88 have h3 := L17_mul W (by linarith [hW.three_le]) hW.lo_lt.le c hc G h0 h1
89 unfold Win.E
90 rw [div_le_iff₀ hL]
91 refine h3.trans ?_
92 rw [div_le_iff₀ hL] at h2
93 have h4 : 1 / W.lo ≤ c / W.lo := by gcongr
94 have h5 : (W.sum G / W.len + W.edge) * W.len = W.sum G + W.edge * W.len := by field_simp
95 rw [mul_assoc, h5]
96 exact mul_le_mul_of_nonneg_left (by linarith) (by linarith)
97
98theorem mu_mul_le (η : ℝ) (hη : 0 < η) : ∃ N0 : ℝ, ∀ W : Win, W.Adm η N0 → ∀ c : ℕ, 1 ≤ c →
99 (c : ℝ) ≤ Real.exp (Real.sqrt (Real.log W.lo)) → ∀ S : Set ℕ,
100 W.E (fun n => ind (c * n ∈ S)) ≤ c * (W.mu S + W.edge) := by
101 obtain ⟨N0, h⟩ := E_mul_le η hη
102 exact ⟨N0, fun W hW c hc hce S => h W hW c hc hce (fun n => ind (n ∈ S))
103 (fun _ => ind_nonneg _) fun _ => ind_le_one _⟩
104
105/-- `E_W[∑_{s ∣ n} G(n/s)] ≤ m_S (E_W G + edge)`, and the reverse. -/
106theorem E_family_le (η : ℝ) (hη : 0 < η) : ∃ N0 : ℝ, ∀ W : Win, W.Adm η N0 → ∀ S : Finset ℕ,
107 (∀ s ∈ S, 1 ≤ s ∧ (s : ℝ) ≤ Real.exp (Real.sqrt (Real.log W.lo))) → ∀ G : ℕ → ℝ,
108 (∀ n, 0 ≤ G n) → (∀ n, G n ≤ 1) →
109 |W.E (fun n => ∑ s ∈ S with s ∣ n, G (n / s)) - ms S * W.E G| ≤ ms S * W.edge := by
110 obtain ⟨N0, h⟩ := E_div_le η hη
111 refine ⟨N0, fun W hW S hS G h0 h1 => ?_⟩
112 have hL := hW.len_pos hη
113 have e1 : W.E (fun n => ∑ s ∈ S with s ∣ n, G (n / s)) = ∑ s ∈ S, 1 / (s : ℝ) * (W.div s).E G := by
114 unfold Win.E
115 rw [L17_family W hW.lo_pos.le hW.lo_lt.le S (fun s hs => (hS s hs).1) fun _ => G, sum_div]
116 refine sum_congr rfl fun s hs => ?_
117 have : (s : ℝ) ≠ 0 := by have := (hS s hs).1; positivity
118 rw [Win.len_div this]; ring
119 rw [e1, ms, sum_mul, sum_mul, ← sum_sub_distrib]
120 refine (abs_sum_le_sum_abs _ _).trans (sum_le_sum fun s hs => ?_)
121 rw [← mul_sub, abs_mul, abs_of_nonneg (by positivity)]
122 refine mul_le_mul_of_nonneg_left ?_ (by positivity)
123 exact h W hW s (by exact_mod_cast (hS s hs).1) (hS s hs).2 G h0 h1
124
125/-- `c ≤ exp √(log lo)` for a fixed `c` and large `lo`. -/
126theorem const_le_exp (c : ℝ) : ∃ N0 : ℝ, ∀ lo ≥ N0, c ≤ Real.exp (Real.sqrt (Real.log lo)) := by
127 have : Tendsto (fun lo : ℝ => Real.exp (Real.sqrt (Real.log lo))) atTop atTop :=
128 Real.tendsto_exp_atTop.comp (Real.tendsto_sqrt_atTop.comp Real.tendsto_log_atTop)
129 exact eventually_atTop.mp (this.eventually_ge_atTop c)
130
131theorem small_le_edge {η N0 : ℝ} (hη : 0 < η) {W : Win} (h : W.Adm η N0) (hN : 4 / η ≤ N0) :
132 4 / (W.lo * W.len) ≤ W.edge := by
133 have hl := h.one_lt_log
134 have hlo := h.lo_pos
135 have h1 : 4 / η ≤ W.lo := hN.trans h.le_lo
136 rw [div_le_iff₀ hη] at h1
137 have h2 := h.le_len
138 have h3 : 4 * Real.log W.lo ≤ W.lo * W.len := by nlinarith
139 calc 4 / (W.lo * W.len) ≤ 4 / (4 * Real.log W.lo) := by gcongr
140 _ = Real.log W.lo ^ (-1 : ℝ) := by rw [Real.rpow_neg_one]; field_simp
141 _ ≤ W.edge := Real.rpow_le_rpow_of_exponent_le hl.le (by norm_num)
142
143theorem E_shift_le {η N0 : ℝ} (hη : 0 < η) {W : Win} (h : W.Adm η N0) (k : ℕ) (G : ℕ → ℝ) (M : ℝ)
144 (hG : ∀ n, |G n| ≤ M) : |W.E (fun n => G (n + k)) - W.E G| ≤ k * M * (4 / (W.lo * W.len)) := by
145 have hL := h.len_pos hη
146 have := L17_shift W (by linarith [h.three_le]) h.lo_lt.le k G M hG
147 unfold Win.E
148 rw [← sub_div, abs_div, abs_of_pos hL, div_le_iff₀ hL]
149 refine this.trans (le_of_eq ?_)
150 have := h.lo_pos
151 field_simp
152
153theorem one_le_of_mem_pts {η N0 : ℝ} {W : Win} (h : W.Adm η N0) {n : ℕ} (hn : n ∈ W.pts) : 1 ≤ n := by
154 have := Win.lo_lt_of_mem_pts h.lo_pos.le hn
155 have : (0 : ℝ) < n := by linarith [h.lo_pos]
156 exact_mod_cast this
157
158end E424
159