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/LowBand/L36Aux.lean

All files · 140 lines · source at the verified commit

1module
2
3public import E424.LowBand.Defs
4public import E424.DivisorMoments.Moments
5public import E424.LowBand.L37Aux
6
7@[expose] public section
8
9/-!
10# Section 9: helpers for Lemma 36
11
12`cs_avg`: Cauchy-Schwarz on an interval. `sum_div_le_int`: a log-weighted sum is at most twice an integral.
13`dilate_sum_le`: the substitution `n = s z`, summed over a family.
14-/
15
16set_option linter.style.header false
17open Finset MeasureTheory
18
19namespace E424
20
21theorem cs_avg {h : ℝ → ℝ} {a b ς Λ : ℝ} (hab : a ≤ b) (hi : IntervalIntegrable h volume a b)
22 (hi2 : IntervalIntegrable (fun x => h x ^ 2) volume a b) (hς : 0 ≤ ς) (hL : b - a ≤ Λ)
23 (hV : ∫ x in a..b, h x ^ 2 ≤ ς * Λ) : ∫ x in a..b, |h x| ≤ Real.sqrt ς * Λ := by
24 rcases hab.eq_or_lt with rfl | hlt
25 · rw [intervalIntegral.integral_same]
26 exact mul_nonneg (Real.sqrt_nonneg _) (by linarith)
27 set I := ∫ x in a..b, |h x| with hI
28 set V := ∫ x in a..b, h x ^ 2 with hVd
29 have hl : 0 < b - a := sub_pos.mpr hlt
30 have hI0 : 0 ≤ I := intervalIntegral.integral_nonneg hab fun x _ => abs_nonneg _
31 set m := I / (b - a) with hm
32 have hkey : 0 ≤ V - 2 * m * I + m ^ 2 * (b - a) := by
33 have h0 : 0 ≤ ∫ x in a..b, (h x ^ 2 - 2 * m * |h x| + m ^ 2) := by
34 refine intervalIntegral.integral_nonneg hab fun x _ => ?_
35 have : h x ^ 2 - 2 * m * |h x| + m ^ 2 = (|h x| - m) ^ 2 := by rw [sub_sq, sq_abs]; ring
36 rw [this]; positivity
37 rw [intervalIntegral.integral_add (hi2.sub (hi.abs.const_mul _)) intervalIntegrable_const,
38 intervalIntegral.integral_sub hi2 (hi.abs.const_mul _), intervalIntegral.integral_const_mul,
39 intervalIntegral.integral_const, smul_eq_mul] at h0
40 linarith
41 have hmI : m * (b - a) = I := by rw [hm]; field_simp
42 have hsq : I ^ 2 ≤ V * (b - a) := by
43 have : m ^ 2 * (b - a) = m * I := by rw [← hmI]; ring
44 rw [this] at hkey
45 have : 0 ≤ (V - m * I) * (b - a) := mul_nonneg (by linarith) hl.le
46 nlinarith
47 have hΛ : 0 ≤ Λ := by linarith
48 have h2 : I ^ 2 ≤ (Real.sqrt ς * Λ) ^ 2 := by
49 rw [mul_pow, Real.sq_sqrt hς]
50 have : V * (b - a) ≤ (ς * Λ) * Λ :=
51 mul_le_mul hV hL hl.le (mul_nonneg hς hΛ)
52 nlinarith
53 exact le_of_sq_le_sq h2 (mul_nonneg (Real.sqrt_nonneg _) hΛ)
54
55/-- The cell `[log n, log (n+1)]` has length between `1/(2n)` and `1/n`. -/
56theorem log_cell {n : ℕ} (hn : 1 ≤ n) : 1 / (2 * (n : ℝ)) ≤ Real.log (n + 1 : ℕ) - Real.log n ∧
57 Real.log (n + 1 : ℕ) - Real.log n ≤ 1 / n := by
58 have hn0 : (1 : ℝ) ≤ n := by exact_mod_cast hn
59 have h1 : (0 : ℝ) < n := by linarith
60 rw [← Real.log_div (by positivity) h1.ne']
61 have e : ((n + 1 : ℕ) : ℝ) / n = 1 + 1 / n := by push_cast; field_simp
62 constructor
63 · have := Real.one_sub_inv_le_log_of_pos (x := ((n + 1 : ℕ) : ℝ) / n) (by positivity)
64 refine le_trans ?_ this
65 push_cast
66 rw [inv_div, one_sub_div (by positivity), div_le_div_iff₀ (by positivity) (by positivity)]
67 linarith
68 · rw [e]
69 have := Real.log_le_sub_one_of_pos (x := 1 + 1 / (n : ℝ)) (by positivity)
70 linarith
71
72theorem sum_div_le_int {g : ℕ → ℝ} {ψ : ℝ → ℝ} {A B : ℕ} (hA : 1 ≤ A) (hAB : A ≤ B) (h0 : ∀ n, 0 ≤ g n)
73 (hψ : IntervalIntegrable ψ volume (Real.log A) (Real.log B))
74 (hg : ∀ n ∈ Ico A B, ∀ x, Real.log n < x → x < Real.log (n + 1 : ℕ) → g n ≤ ψ x) :
75 ∑ n ∈ Ico A B, g n / n ≤ 2 * ∫ x in Real.log A..Real.log B, ψ x := by
76 have hmono : ∀ k l : ℕ, 1 ≤ k → k ≤ l → Real.log k ≤ Real.log l := fun k l hk hkl =>
77 Real.log_le_log (by exact_mod_cast hk) (by exact_mod_cast hkl)
78 have hii : ∀ k ∈ Set.Ico A B, IntervalIntegrable ψ volume (Real.log k) (Real.log (k + 1 : ℕ)) := by
79 intro k hk
80 refine hψ.mono_set ?_
81 rw [Set.uIcc_of_le (hmono _ _ (hA.trans hk.1) (by omega)), Set.uIcc_of_le (hmono _ _ hA hAB)]
82 exact Set.Icc_subset_Icc (hmono _ _ hA hk.1) (hmono _ _ (by have := hk.1; omega) hk.2)
83 have h2 := intervalIntegral.sum_integral_adjacent_intervals_Ico (f := ψ)
84 (a := fun k : ℕ => Real.log k) (μ := volume) (m := A) (n := B) hAB hii
85 rw [← h2, mul_sum]
86 refine sum_le_sum fun n hn => ?_
87 have hn' := mem_Ico.mp hn
88 have hn1 : 1 ≤ n := hA.trans hn'.1
89 have hc := (log_cell hn1).1
90 have hle := hmono n (n + 1) hn1 (by omega)
91 have h3 : ∫ x in Real.log n..Real.log (n + 1 : ℕ), g n ≤ ∫ x in Real.log n..Real.log (n + 1 : ℕ), ψ x :=
92 intervalIntegral.integral_mono_on_of_le_Ioo hle intervalIntegrable_const (hii n ⟨hn'.1, hn'.2⟩)
93 fun x hx => hg n hn x hx.1 hx.2
94 rw [intervalIntegral.integral_const, smul_eq_mul] at h3
95 have h4 : 1 / (2 * (n : ℝ)) * g n ≤ (Real.log (n + 1 : ℕ) - Real.log n) * g n :=
96 mul_le_mul_of_nonneg_right hc (h0 n)
97 have h5 : g n / n = 2 * (1 / (2 * (n : ℝ)) * g n) := by
98 have : (n : ℝ) ≠ 0 := by positivity
99 field_simp
100 linarith
101
102/-- `∑_s s⁻¹ ∑_z G(s, s z)/z ≤ ∑_{n ∈ P} n⁻¹ ∑_{s ∣ n} G(s, n)`. -/
103theorem dilate_sum_le {S Z P : Finset ℕ} {G : ℕ → ℕ → ℝ} (hG : ∀ s n, 0 ≤ G s n) (hS : ∀ s ∈ S, 1 ≤ s)
104 (hP : ∀ s ∈ S, ∀ z ∈ Z, s * z ∈ P) :
105 ∑ s ∈ S, 1 / (s : ℝ) * ∑ z ∈ Z, G s (s * z) / z ≤ ∑ n ∈ P, (∑ s ∈ S with s ∣ n, G s n) / n := by
106 have hR : ∑ n ∈ P, (∑ s ∈ S with s ∣ n, G s n) / n = ∑ s ∈ S, ∑ n ∈ P with s ∣ n, G s n / n := by
107 simp_rw [sum_div, sum_filter]
108 exact sum_comm
109 rw [hR]
110 refine sum_le_sum fun s hs => ?_
111 rw [mul_sum]
112 have h1 : ∑ z ∈ Z, 1 / (s : ℝ) * (G s (s * z) / z) = ∑ n ∈ Z.image (s * ·), G s n / n := by
113 rw [sum_image (fun x _ y _ h => Nat.eq_of_mul_eq_mul_left (hS s hs) h)]
114 refine sum_congr rfl fun z _ => ?_
115 push_cast
116 rw [one_div, div_eq_mul_inv, div_eq_mul_inv, mul_inv]; ring
117 rw [h1]
118 refine sum_le_sum_of_subset_of_nonneg (fun n hn => ?_) fun n _ _ => div_nonneg (hG s n) n.cast_nonneg
119 obtain ⟨z, hz, rfl⟩ := mem_image.mp hn
120 exact mem_filter.mpr ⟨hP s hs z hz, dvd_mul_right s z⟩
121
122/-- `F ∘ ⌊exp⌋ - φ` and its square are integrable when `φ` is continuous on the interval. -/
123theorem ii_F_sub {φ : ℝ → ℝ} {a b : ℝ} (hab : a ≤ b) (hφ : ContinuousOn φ (Set.Icc a b)) :
124 IntervalIntegrable (fun x => F ⌊Real.exp x⌋₊ - φ x) volume a b ∧
125 IntervalIntegrable (fun x => (F ⌊Real.exp x⌋₊ - φ x) ^ 2) volume a b := by
126 have hF := Sm35.integrable_floor_exp (g := F) (B := 1)
127 (fun n => by rw [abs_of_nonneg (F_nonneg n)]; exact F_le_one n) a b
128 have hF2 := Sm35.integrable_floor_exp (g := fun n => F n ^ 2) (B := 1)
129 (fun n => by rw [abs_of_nonneg (sq_nonneg _)]; exact pow_le_one₀ (F_nonneg n) (F_le_one n)) a b
130 have hφi : IntervalIntegrable φ volume a b := hφ.intervalIntegrable_of_Icc hab
131 have hφ2 : IntervalIntegrable (fun x => φ x ^ 2) volume a b :=
132 (hφ.pow 2).intervalIntegrable_of_Icc hab
133 refine ⟨hF.sub hφi, ?_⟩
134 have hp : IntervalIntegrable (fun x => F ⌊Real.exp x⌋₊ * φ x) volume a b :=
135 hF.mul_continuousOn (by rwa [Set.uIcc_of_le hab])
136 refine ((hF2.sub (hp.const_mul 2)).add hφ2).congr fun x _ => ?_
137 ring
138
139end E424
140