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/Tools/T4Aux.lean

All files · 139 lines · source at the verified commit

1module
2
3public import E424.Tools.T11
4
5@[expose] public section
6
7/-!
8# Erdős 424: helpers for tool T4 (mean value of Dirichlet polynomials).
9Elementary bounds on the triangle kernel over integers in `[N, 16 N]`, and the Schur test.
10-/
11
12set_option linter.style.header false
13open Finset
14
15namespace E424
16
17lemma tri_neg_arg (Q u : ℝ) : tri Q (-u) = tri Q u := by
18 unfold tri; rw [abs_neg]
19
20lemma tri_nonneg' (Q u : ℝ) (hQ : 0 < Q) : 0 ≤ tri Q u := by
21 unfold tri
22 exact mul_nonneg hQ.le (le_max_left _ _)
23
24lemma tri_le_self (Q u : ℝ) (hQ : 0 < Q) : tri Q u ≤ Q := by
25 unfold tri
26 refine mul_le_of_le_one_right hQ.le (max_le zero_le_one ?_)
27 nlinarith [abs_nonneg u]
28
29/-- Outside the window `Q |u| < 1` the triangle vanishes. -/
30lemma tri_ne_zero_imp (Q u : ℝ) (hQ : 0 < Q) (h : tri Q u ≠ 0) : Q * |u| < 1 := by
31 by_contra hc
32 push_neg at hc
33 apply h
34 apply tri_eq_zero Q u hQ
35 rw [inv_eq_one_div, div_le_iff₀ hQ]
36 linarith
37
38/-- Logarithm comparison: `(y - x) / y ≤ log y - log x` for `0 < x ≤ y`. -/
39lemma log_sub_ge' (x y : ℝ) (hx : 0 < x) (hxy : x ≤ y) : (y - x) / y ≤ Real.log y - Real.log x := by
40 have hy : 0 < y := lt_of_lt_of_le hx hxy
41 have h := Real.one_sub_inv_le_log_of_pos (div_pos hy hx)
42 rw [Real.log_div hy.ne' hx.ne'] at *
43 have e : (y - x) / y = 1 - (y / x)⁻¹ := by
44 field_simp
45 rw [e]
46 linarith
47
48/-- `|log m - log n| ≥ |m - n| / (16 N)` on `[N, 16 N]`. -/
49lemma abs_log_sub_ge (N m n : ℝ) (hN : 1 ≤ N) (hm : N ≤ m) (hn : N ≤ n)
50 (hm' : m ≤ 16 * N) (hn' : n ≤ 16 * N) :
51 |m - n| / (16 * N) ≤ |Real.log m - Real.log n| := by
52 have hm0 : 0 < m := by linarith
53 have hn0 : 0 < n := by linarith
54 rcases le_total m n with h | h
55 · have h1 := log_sub_ge' m n hm0 h
56 have h2 : (n - m) / (16 * N) ≤ (n - m) / n :=
57 div_le_div_of_nonneg_left (by linarith) hn0 hn'
58 have hl : Real.log m ≤ Real.log n := Real.log_le_log hm0 h
59 rw [abs_sub_comm m n, abs_of_nonneg (by linarith : (0 : ℝ) ≤ n - m),
60 abs_of_nonpos (by linarith : Real.log m - Real.log n ≤ 0)]
61 linarith
62 · have h1 := log_sub_ge' n m hn0 h
63 have h2 : (m - n) / (16 * N) ≤ (m - n) / m :=
64 div_le_div_of_nonneg_left (by linarith) hm0 hm'
65 have hl : Real.log n ≤ Real.log m := Real.log_le_log hn0 h
66 rw [abs_of_nonneg (by linarith : (0 : ℝ) ≤ m - n),
67 abs_of_nonneg (by linarith : (0 : ℝ) ≤ Real.log m - Real.log n)]
68 linarith
69
70/-- Row sums of the Dirichlet kernel: for `c ∈ [N, 16 N]` and `s ⊆ [N, 16 N]`,
71`∑_{m ∈ s} tri Q (log m - log c) ≤ 32 N + 3 Q`. Only the `≈ 16 N / Q` integers near `c` contribute. -/
72lemma row_sum_le (N Q : ℝ) (hN : 1 ≤ N) (hQ : 0 < Q) (s : Finset ℕ) (c : ℕ)
73 (hs : ∀ m ∈ s, N ≤ (m : ℝ) ∧ (m : ℝ) ≤ 16 * N) (hc : N ≤ (c : ℝ) ∧ (c : ℝ) ≤ 16 * N) :
74 ∑ m ∈ s, tri Q (Real.log m - Real.log c) ≤ 32 * N + 3 * Q := by
75 set R : ℕ := ⌈16 * N / Q⌉₊ with hR
76 set W : Finset ℕ := Finset.Icc (c - R) (c + R) with hW
77 have hpt : ∀ m ∈ s, tri Q (Real.log m - Real.log c) ≤ if m ∈ W then Q else 0 := by
78 intro m hm
79 split_ifs with hmW
80 · exact tri_le_self Q _ hQ
81 · rcases eq_or_ne (tri Q (Real.log m - Real.log c)) 0 with h0 | hne
82 · exact h0.le
83 exfalso
84 have hlt := tri_ne_zero_imp Q _ hQ hne
85 have hab := abs_log_sub_ge N m c hN (hs m hm).1 hc.1 (hs m hm).2 hc.2
86 have e1 : Q * (|(m : ℝ) - c| / (16 * N)) ≤ Q * |Real.log m - Real.log c| :=
87 mul_le_mul_of_nonneg_left hab hQ.le
88 have e3 : Q * |(m : ℝ) - c| < 16 * N := by
89 have h := lt_of_le_of_lt e1 hlt
90 rw [mul_div_assoc', div_lt_one (by linarith)] at h
91 linarith
92 have e4 : |(m : ℝ) - c| < R := by
93 have : |(m : ℝ) - c| < 16 * N / Q := (lt_div_iff₀ hQ).mpr (by linarith)
94 exact lt_of_lt_of_le this (Nat.le_ceil _)
95 rw [abs_sub_lt_iff] at e4
96 apply hmW
97 rw [hW, Finset.mem_Icc]
98 have h5 : m < c + R := by exact_mod_cast (by linarith [e4.1] : (m : ℝ) < c + R)
99 have h6 : c < m + R := by exact_mod_cast (by linarith [e4.2] : (c : ℝ) < m + R)
100 omega
101 have hcard : (W.card : ℝ) ≤ 2 * R + 1 := by
102 have : W.card ≤ 2 * R + 1 := by rw [hW, Nat.card_Icc]; omega
103 exact_mod_cast this
104 have hRle : (R : ℝ) ≤ 16 * N / Q + 1 := (Nat.ceil_lt_add_one (by positivity)).le
105 calc ∑ m ∈ s, tri Q (Real.log m - Real.log c)
106 ≤ ∑ m ∈ s, (if m ∈ W then Q else 0) := Finset.sum_le_sum hpt
107 _ = ∑ m ∈ s ∩ W, Q := Finset.sum_ite_mem _ _ _
108 _ ≤ ∑ m ∈ W, Q := Finset.sum_le_sum_of_subset_of_nonneg Finset.inter_subset_right
109 (fun _ _ _ => hQ.le)
110 _ = (W.card : ℝ) * Q := by rw [Finset.sum_const, nsmul_eq_mul]
111 _ ≤ (2 * R + 1) * Q := mul_le_mul_of_nonneg_right hcard hQ.le
112 _ ≤ (2 * (16 * N / Q + 1) + 1) * Q := mul_le_mul_of_nonneg_right (by linarith) hQ.le
113 _ = 32 * N + 3 * Q := by field_simp; ring
114
115/-- Schur test for a kernel with row and column sums at most `B`. -/
116lemma schur_bound (s : Finset ℕ) (b : ℕ → ℝ) (K : ℕ → ℕ → ℝ) (hK : ∀ m n, 0 ≤ K m n) (B : ℝ)
117 (hrow : ∀ m ∈ s, ∑ n ∈ s, K m n ≤ B) (hcol : ∀ n ∈ s, ∑ m ∈ s, K m n ≤ B) :
118 ∑ m ∈ s, ∑ n ∈ s, b m * b n * K m n ≤ B * ∑ m ∈ s, b m ^ 2 := by
119 have h1 : ∑ m ∈ s, ∑ n ∈ s, b m * b n * K m n ≤
120 ∑ m ∈ s, ∑ n ∈ s, (b m ^ 2 * K m n + b n ^ 2 * K m n) / 2 := by
121 apply Finset.sum_le_sum; intro m _
122 apply Finset.sum_le_sum; intro n _
123 nlinarith [mul_nonneg (sq_nonneg (b m - b n)) (hK m n)]
124 have h2 : ∑ m ∈ s, ∑ n ∈ s, (b m ^ 2 * K m n + b n ^ 2 * K m n) / 2 =
125 (∑ m ∈ s, b m ^ 2 * ∑ n ∈ s, K m n + ∑ n ∈ s, b n ^ 2 * ∑ m ∈ s, K m n) / 2 := by
126 simp only [← Finset.sum_div, Finset.sum_add_distrib, Finset.mul_sum]
127 rw [Finset.sum_comm (f := fun m n => b n ^ 2 * K m n)]
128 have h3 : ∑ m ∈ s, b m ^ 2 * ∑ n ∈ s, K m n ≤ B * ∑ m ∈ s, b m ^ 2 := by
129 rw [Finset.mul_sum]
130 apply Finset.sum_le_sum; intro m hm
131 exact mul_le_mul_of_nonneg_left (hrow m hm) (sq_nonneg _) |>.trans_eq (by ring)
132 have h4 : ∑ n ∈ s, b n ^ 2 * ∑ m ∈ s, K m n ≤ B * ∑ m ∈ s, b m ^ 2 := by
133 rw [Finset.mul_sum]
134 apply Finset.sum_le_sum; intro n hn
135 exact mul_le_mul_of_nonneg_left (hcol n hn) (sq_nonneg _) |>.trans_eq (by ring)
136 linarith
137
138end E424
139