| | @@ -6,7 +6,8 @@ import Mathlib.NumberTheory.Chebyshev |
| 6 | 6 | |
| 7 | 7 | The logarithm of `(30n)! n! / ((15n)! (10n)! (6n)!)` counts the von Mangoldt |
| 8 | 8 | weight of a subset of the integers up to `30n`. This subset includes every |
| 9 | | −integer in `(5n, 30n]`. The bounds give a finite input to the prime-power |
| 9 | +integer in `(5n, 30n]`. At the scale `210n`, it also includes `(21n, 30n]`. |
| 10 | +The bounds give a finite input to the prime-power |
| 10 | 11 | interval argument for the Sidon lower bound. |
| 11 | 12 | -/ |
| 12 | 13 | |
| | @@ -68,26 +69,63 @@ private theorem chebyshevLogRatio_eq_sum (n : ℕ) : |
| 68 | 69 | show 30 * n / 5 = 6 * n by omega] |
| 69 | 70 | ring |
| 70 | 71 | |
| 72 | +private theorem psi_sub_eq_sum_Ioc {a b : ℕ} (hab : a ≤ b) : |
| 73 | + Chebyshev.psi (b : ℝ) - Chebyshev.psi (a : ℝ) = ∑ d ∈ Ioc a b, Λ d := by |
| 74 | + simp only [Chebyshev.psi, Nat.floor_natCast] |
| 75 | + rw [← sum_Ioc_consecutive (fun d => Λ d) (Nat.zero_le _) hab, add_sub_cancel_left] |
| 76 | + |
| 77 | +private theorem sum_le_chebyshevLogRatio {n : ℕ} {s : Finset ℕ} |
| 78 | + (hs : s ⊆ Ioc 0 (30 * n)) (hw : ∀ d ∈ s, weight (30 * n / d) = 1) : |
| 79 | + ∑ d ∈ s, Λ d ≤ chebyshevLogRatio n := by |
| 80 | + rw [chebyshevLogRatio_eq_sum] |
| 81 | + calc |
| 82 | + _ = ∑ d ∈ s, Λ d * (weight (30 * n / d) : ℝ) := by |
| 83 | + exact sum_congr rfl fun d hd => by simp [hw d hd] |
| 84 | + _ ≤ _ := by |
| 85 | + refine sum_le_sum_of_subset_of_nonneg hs fun d _ _ => ?_ |
| 86 | + exact mul_nonneg vonMangoldt_nonneg (by exact_mod_cast (weight_bounds (30 * n / d)).1) |
| 87 | + |
| 88 | +private theorem weight_eq_one_of_mem_top {n d : ℕ} (hd : d ∈ Ioc (5 * n) (30 * n)) : |
| 89 | + weight (30 * n / d) = 1 := by |
| 90 | + obtain ⟨hsmall, hlarge⟩ := mem_Ioc.mp hd |
| 91 | + have hdpos : 0 < d := by omega |
| 92 | + exact weight_eq_one (Nat.div_pos hlarge hdpos) ((Nat.div_lt_iff_lt_mul hdpos).mpr (by omega)) |
| 93 | + |
| 71 | 94 | /-- All von Mangoldt weight in `(5n, 30n]` occurs in the log factorial ratio. -/ |
| 72 | 95 | theorem psi_sub_le_chebyshevLogRatio (n : ℕ) : |
| 73 | 96 | Chebyshev.psi (30 * (n : ℝ)) - Chebyshev.psi (5 * (n : ℝ)) ≤ chebyshevLogRatio n := by |
| 74 | | − have hle : 5 * n ≤ 30 * n := by omega |
| 75 | | − calc |
| 76 | | − _ = ∑ d ∈ Ioc (5 * n) (30 * n), Λ d := by |
| 77 | | − norm_cast |
| 78 | | − simp only [Chebyshev.psi, Nat.floor_natCast] |
| 79 | | − rw [← sum_Ioc_consecutive (fun d => Λ d) (Nat.zero_le _) hle, add_sub_cancel_left] |
| 80 | | − _ = ∑ d ∈ Ioc (5 * n) (30 * n), Λ d * (weight (30 * n / d) : ℝ) := by |
| 81 | | − refine sum_congr rfl fun d hd => ?_ |
| 82 | | − obtain ⟨hsmall, hlarge⟩ := mem_Ioc.mp hd |
| 97 | + norm_cast |
| 98 | + rw [psi_sub_eq_sum_Ioc (show 5 * n ≤ 30 * n by omega)] |
| 99 | + exact sum_le_chebyshevLogRatio (Ioc_subset_Ioc_left (Nat.zero_le _)) |
| 100 | + fun _ hd => weight_eq_one_of_mem_top hd |
| 101 | + |
| 102 | +open Chebyshev in |
| 103 | +/-- At scale `210n`, both `(35n, 210n]` and `(21n, 30n]` contribute their full von Mangoldt |
| 104 | +weight. On the second interval the integer quotient is `7`, `8`, or `9`. -/ |
| 105 | +theorem psi_sub_add_psi_sub_le_chebyshevLogRatio (n : ℕ) : |
| 106 | + ψ (210 * (n : ℝ)) - ψ (35 * (n : ℝ)) + (ψ (30 * (n : ℝ)) - ψ (21 * (n : ℝ))) ≤ |
| 107 | + chebyshevLogRatio (7 * n) := by |
| 108 | + have hdis : Disjoint (Ioc (35 * n) (210 * n)) (Ioc (21 * n) (30 * n)) := by |
| 109 | + refine disjoint_left.mpr fun d hd₁ hd₂ => ?_ |
| 110 | + obtain ⟨h₁, -⟩ := mem_Ioc.mp hd₁ |
| 111 | + obtain ⟨-, h₂⟩ := mem_Ioc.mp hd₂ |
| 112 | + omega |
| 113 | + norm_cast |
| 114 | + rw [psi_sub_eq_sum_Ioc (show 35 * n ≤ 210 * n by omega), |
| 115 | + psi_sub_eq_sum_Ioc (show 21 * n ≤ 30 * n by omega), ← sum_union hdis] |
| 116 | + apply sum_le_chebyshevLogRatio |
| 117 | + · intro d hd |
| 118 | + rcases mem_union.mp hd with h | h <;> obtain ⟨hl, hu⟩ := mem_Ioc.mp h <;> |
| 119 | + exact mem_Ioc.mpr ⟨by omega, by omega⟩ |
| 120 | + · intro d hd |
| 121 | + rcases mem_union.mp hd with h | h |
| 122 | + · apply weight_eq_one_of_mem_top |
| 123 | + simpa only [← Nat.mul_assoc] using h |
| 124 | + · obtain ⟨hl, hu⟩ := mem_Ioc.mp h |
| 83 | 125 | have hdpos : 0 < d := by omega |
| 84 | | − have hpos := Nat.div_pos hlarge hdpos |
| 85 | | − have hlt : 30 * n / d < 6 := (Nat.div_lt_iff_lt_mul hdpos).mpr (by omega) |
| 86 | | − simp [weight_eq_one hpos hlt] |
| 87 | | − _ ≤ ∑ d ∈ Ioc 0 (30 * n), Λ d * (weight (30 * n / d) : ℝ) := by |
| 88 | | − refine sum_le_sum_of_subset_of_nonneg (Ioc_subset_Ioc_left (Nat.zero_le _)) fun d _ _ => ?_ |
| 89 | | − exact mul_nonneg vonMangoldt_nonneg (by exact_mod_cast (weight_bounds (30 * n / d)).1) |
| 90 | | − _ = _ := (chebyshevLogRatio_eq_sum n).symm |
| 126 | + have h₇ : 7 ≤ 30 * (7 * n) / d := (Nat.le_div_iff_mul_le hdpos).mpr (by omega) |
| 127 | + have h₁₀ : 30 * (7 * n) / d < 10 := (Nat.div_lt_iff_lt_mul hdpos).mpr (by omega) |
| 128 | + exact (show ∀ k : Fin 10, 7 ≤ k.val → weight k.val = 1 by decide) ⟨_, h₁₀⟩ h₇ |
| 91 | 129 | |
| 92 | 130 | /-- Each von Mangoldt weight up to `30n` occurs at most once in the log factorial ratio. -/ |
| 93 | 131 | theorem chebyshevLogRatio_le_psi (n : ℕ) : |