| 1 | module |
| 2 | |
| 3 | public import E424.ToolDefs |
| 4 | public import E424.Tools.T10 |
| 5 | public import E424.Tools.T2Aux |
| 6 | |
| 7 | @[expose] public section |
| 8 | |
| 9 | /-! |
| 10 | # Erdős 424: tool T2. Absolute existential constants; Mathlib only. |
| 11 | -/ |
| 12 | |
| 13 | set_option linter.style.header false |
| 14 | open Finset |
| 15 | |
| 16 | namespace E424 |
| 17 | |
| 18 | namespace BH |
| 19 | |
| 20 | lemma mem_primesIoc {u v : ℝ} (hu : 0 ≤ u) (hv : 0 ≤ v) {p : ℕ} : |
| 21 | p ∈ primesIoc u v ↔ u < p ∧ (p : ℝ) ≤ v ∧ p.Prime := by |
| 22 | simp [primesIoc, Nat.floor_lt hu, Nat.le_floor_iff hv, and_assoc] |
| 23 | |
| 24 | lemma fact_bound (l : ℕ) : |
| 25 | 4 * ((3 / 4 : ℝ) ^ (2 * l + 2 + 1) / ((2 * l + 2 + 1).factorial : ℝ)) ≤ 9 / 32 / 2 ^ l := by |
| 26 | have h1 : 6 * 2 ^ l ≤ (2 * l + 2 + 1).factorial := by |
| 27 | induction l with |
| 28 | | zero => decide |
| 29 | | succ l ih => |
| 30 | rw [show 2 * (l + 1) + 2 + 1 = (2 * l + 2 + 1) + 1 + 1 by ring, Nat.factorial_succ, |
| 31 | Nat.factorial_succ, pow_succ] |
| 32 | generalize (2 * l + 2 + 1).factorial = F at * |
| 33 | calc 6 * (2 ^ l * 2) = 2 * (1 * (6 * 2 ^ l)) := by ring |
| 34 | _ ≤ _ := Nat.mul_le_mul (by omega) (Nat.mul_le_mul (by omega) ih) |
| 35 | have h1' : (6 : ℝ) * 2 ^ l ≤ ((2 * l + 2 + 1).factorial : ℝ) := by exact_mod_cast h1 |
| 36 | have h2 : (3 / 4 : ℝ) ^ (2 * l + 2 + 1) ≤ 27 / 64 := by |
| 37 | rw [show 2 * l + 2 + 1 = 3 + 2 * l by ring, pow_add] |
| 38 | have : (3 / 4 : ℝ) ^ (2 * l) ≤ 1 := pow_le_one₀ (by norm_num) (by norm_num) |
| 39 | norm_num at this ⊢ |
| 40 | linarith |
| 41 | calc _ ≤ 4 * ((27 / 64 : ℝ) / (6 * 2 ^ l)) := by gcongr |
| 42 | _ = _ := by field_simp; norm_num |
| 43 | |
| 44 | lemma exists_sys {K0 : ℕ} (hK : 2 ≤ K0) |
| 45 | (hM : ∀ u v : ℝ, (K0 : ℝ) ≤ u → u ≤ v → v ≤ u ^ 2 → |
| 46 | ∑ p ∈ primesIoc u v, 1 / (p : ℝ) ≤ 3 / 4) : |
| 47 | ∀ (n l : ℕ) (z : ℝ), 1 ≤ z → z ≤ (K0 : ℝ) ^ (2 ^ n) → ∃ lp lm : Finset ℕ → ℝ, |
| 48 | Sys (fun p => 1 / (p : ℝ)) (primesIoc K0 z) (9 / 16 / 2 ^ l) (z ^ (4 * l + 8)) |
| 49 | (z ^ (4 * l + 9)) lp lm := by |
| 50 | have hK' : (2 : ℝ) ≤ K0 := by exact_mod_cast hK |
| 51 | intro n |
| 52 | induction n with |
| 53 | | zero => |
| 54 | intro l z hz hzK |
| 55 | have he : primesIoc K0 z = ∅ := by |
| 56 | refine eq_empty_of_forall_notMem fun p hp => ?_ |
| 57 | rw [mem_primesIoc (by linarith) (by linarith)] at hp |
| 58 | simp only [pow_zero, pow_one] at hzK |
| 59 | linarith [hp.1, hp.2.1] |
| 60 | rw [he] |
| 61 | exact ⟨_, _, sys_empty _ (by positivity) (one_le_pow₀ hz) (one_le_pow₀ hz)⟩ |
| 62 | | succ n ih => |
| 63 | intro l z hz hzK |
| 64 | set r := √z with hr |
| 65 | have hr1 : 1 ≤ r := Real.one_le_sqrt.2 hz |
| 66 | have hrr : r ^ 2 = z := Real.sq_sqrt (by linarith) |
| 67 | have hrz : r ≤ z := by nlinarith |
| 68 | have hrK : r ≤ (K0 : ℝ) ^ (2 ^ n) := by |
| 69 | refine Real.sqrt_le_iff.2 ⟨by positivity, ?_⟩ |
| 70 | rw [← pow_mul, ← pow_succ] |
| 71 | exact hzK |
| 72 | obtain ⟨lp, lm, hs⟩ := ih (l + 1) r hr1 hrK |
| 73 | set u := max (K0 : ℝ) r with hu |
| 74 | have hu0 : 0 ≤ u := le_max_of_le_right (by linarith) |
| 75 | have hT : ∀ p ∈ primesIoc u z, u < p ∧ (p : ℝ) ≤ z ∧ p.Prime := fun p hp => |
| 76 | (mem_primesIoc hu0 (by linarith)).1 hp |
| 77 | have hS : ∀ p ∈ primesIoc K0 r, (K0 : ℝ) < p ∧ (p : ℝ) ≤ r ∧ p.Prime := fun p hp => |
| 78 | (mem_primesIoc (by linarith) (by linarith)).1 hp |
| 79 | have hun : primesIoc K0 z = primesIoc K0 r ∪ primesIoc u z := by |
| 80 | ext p |
| 81 | rw [mem_union, mem_primesIoc (by linarith) (by linarith), |
| 82 | mem_primesIoc (by linarith) (by linarith), mem_primesIoc hu0 (by linarith), hu, max_lt_iff] |
| 83 | rcases le_or_gt (p : ℝ) r with h | h |
| 84 | · constructor |
| 85 | · rintro ⟨a, b, c⟩; exact Or.inl ⟨a, h, c⟩ |
| 86 | · rintro (⟨a, b, c⟩ | ⟨a, b, c⟩) |
| 87 | · exact ⟨a, h.trans hrz, c⟩ |
| 88 | · exact ⟨a.1, b, c⟩ |
| 89 | · constructor |
| 90 | · rintro ⟨a, b, c⟩; exact Or.inr ⟨⟨a, h⟩, b, c⟩ |
| 91 | · rintro (⟨a, b, c⟩ | ⟨a, b, c⟩) |
| 92 | · exact ⟨a, b.trans hrz, c⟩ |
| 93 | · exact ⟨a.1, b, c⟩ |
| 94 | have hd : Disjoint (primesIoc K0 r) (primesIoc u z) := by |
| 95 | refine disjoint_left.2 fun p h1 h2 => ?_ |
| 96 | have := (hT p h2).1 |
| 97 | have := (hS p h1).2.1 |
| 98 | have : r ≤ u := le_max_right _ _ |
| 99 | linarith |
| 100 | have hx01 : ∀ p : ℕ, p.Prime → 0 ≤ 1 / (p : ℝ) ∧ 1 / (p : ℝ) ≤ 1 := fun p hp => by |
| 101 | have : (1 : ℝ) ≤ p := by exact_mod_cast hp.one_le |
| 102 | exact ⟨by positivity, (div_le_one (by linarith)).2 this⟩ |
| 103 | have hL : ∑ p ∈ primesIoc u z, 1 / (p : ℝ) ≤ 3 / 4 := by |
| 104 | rcases le_or_gt u z with h | h |
| 105 | · refine hM u z (le_max_left _ _) h ?_ |
| 106 | rw [← hrr] |
| 107 | exact pow_le_pow_left₀ (by linarith) (le_max_right _ _) 2 |
| 108 | · have : primesIoc u z = ∅ := eq_empty_of_forall_notMem fun p hp => by |
| 109 | have := hT p hp |
| 110 | linarith [this.1, this.2.1] |
| 111 | rw [this]; norm_num |
| 112 | have hl := layer_tr (fun p => 1 / (p : ℝ)) (primesIoc u z) (fun p hp => hx01 p (hT p hp).2.2) |
| 113 | hL (b := 2 * l + 2) ⟨l + 1, by ring⟩ hz (fun p hp => (hT p hp).2.1) (fact_bound l) |
| 114 | have e1 : r ^ (4 * (l + 1) + 8) = z ^ (2 * l + 6) := by |
| 115 | rw [← hrr, ← pow_mul]; congr 1; ring |
| 116 | have key := sys_step hd (fun p hp => ?_) (by positivity) (by positivity) (by positivity) hs hl |
| 117 | (Qm' := z ^ (4 * l + 9)) ?_ ?_ |
| 118 | · rw [hun] |
| 119 | have e2 : r ^ (4 * (l + 1) + 8) * z ^ (2 * l + 2) = z ^ (4 * l + 8) := by |
| 120 | rw [e1, ← pow_add]; congr 1; ring |
| 121 | have e3 : (9 / 16 / 2 ^ (l + 1) + 9 / 32 / 2 ^ l : ℝ) = 9 / 16 / 2 ^ l := by |
| 122 | rw [pow_succ]; field_simp; norm_num |
| 123 | rw [e2, e3] at key |
| 124 | exact ⟨_, _, key⟩ |
| 125 | · rcases mem_union.1 hp with h | h |
| 126 | · exact hx01 p (hS p h).2.2 |
| 127 | · exact hx01 p (hT p h).2.2 |
| 128 | · calc r ^ (4 * (l + 1) + 9) * z ^ (2 * l + 2) = z ^ (2 * l + 6) * r * z ^ (2 * l + 2) := by |
| 129 | rw [← e1]; ring |
| 130 | _ ≤ z ^ (2 * l + 6) * z * z ^ (2 * l + 2) := by gcongr |
| 131 | _ = _ := by ring |
| 132 | · rw [e1]; apply le_of_eq; ring |
| 133 | |
| 134 | variable {S : Finset ℕ} |
| 135 | |
| 136 | lemma primeFactors_P (hS : ∀ p ∈ S, p.Prime) : (∏ p ∈ S, p).primeFactors = S := |
| 137 | Nat.primeFactors_prod hS |
| 138 | |
| 139 | lemma squarefree_P (hS : ∀ p ∈ S, p.Prime) : Squarefree (∏ p ∈ S, p) := by |
| 140 | induction S using Finset.induction_on with |
| 141 | | empty => simp |
| 142 | | insert a s ha ih => |
| 143 | have hs : ∀ p ∈ s, p.Prime := fun p hp => hS p (mem_insert_of_mem hp) |
| 144 | have hpa := hS a (mem_insert_self a s) |
| 145 | rw [prod_insert ha, Nat.squarefree_mul_iff] |
| 146 | refine ⟨Nat.Coprime.prod_right fun p hp => ?_, hpa.prime.squarefree, ih hs⟩ |
| 147 | exact (Nat.coprime_primes hpa (hs p hp)).2 fun h => ha (h ▸ hp) |
| 148 | |
| 149 | lemma sum_div (hS : ∀ p ∈ S, p.Prime) (G : ℕ → ℝ) : |
| 150 | ∑ d ∈ (∏ p ∈ S, p).divisors, G d = ∑ D ∈ S.powerset, G (∏ p ∈ D, p) := by |
| 151 | have hP : (∏ p ∈ S, p) ≠ 0 := prod_ne_zero_iff.2 fun p hp => (hS p hp).ne_zero |
| 152 | refine sum_nbij' (fun d => d.primeFactors) (fun D => ∏ p ∈ D, p) ?_ ?_ ?_ ?_ ?_ |
| 153 | · intro d hd |
| 154 | rw [mem_powerset] |
| 155 | have := Nat.primeFactors_mono (Nat.dvd_of_mem_divisors hd) hP |
| 156 | rwa [primeFactors_P hS] at this |
| 157 | · intro D hD |
| 158 | exact Nat.mem_divisors.2 ⟨prod_dvd_prod_of_subset _ _ _ (mem_powerset.1 hD), hP⟩ |
| 159 | · intro d hd |
| 160 | exact Nat.prod_primeFactors_of_squarefree |
| 161 | ((squarefree_P hS).squarefree_of_dvd (Nat.dvd_of_mem_divisors hd)) |
| 162 | · intro D hD |
| 163 | exact primeFactors_P fun p hp => hS p (mem_powerset.1 hD hp) |
| 164 | · intro d hd |
| 165 | rw [Nat.prod_primeFactors_of_squarefree |
| 166 | ((squarefree_P hS).squarefree_of_dvd (Nat.dvd_of_mem_divisors hd))] |
| 167 | |
| 168 | /-- The weight on integers belonging to a weight on sets of primes. -/ |
| 169 | noncomputable def wt (S : Finset ℕ) (f : Finset ℕ → ℝ) (d : ℕ) : ℝ := |
| 170 | if d ∣ ∏ p ∈ S, p then f d.primeFactors else 0 |
| 171 | |
| 172 | lemma wt_prod (hS : ∀ p ∈ S, p.Prime) (f : Finset ℕ → ℝ) {D : Finset ℕ} (hD : D ⊆ S) : |
| 173 | wt S f (∏ p ∈ D, p) = f D := by |
| 174 | rw [wt, if_pos (prod_dvd_prod_of_subset _ _ _ hD), primeFactors_P fun p hp => hS p (hD hp)] |
| 175 | |
| 176 | lemma sum_wt_dvd (hS : ∀ p ∈ S, p.Prime) (f : Finset ℕ → ℝ) (n : ℕ) : |
| 177 | ∑ d ∈ (∏ p ∈ S, p).divisors with d ∣ n, wt S f d = |
| 178 | ∑ D ∈ (S.filter (· ∣ n)).powerset, f D := by |
| 179 | rw [sum_filter, sum_div hS] |
| 180 | have : (S.filter (· ∣ n)).powerset = S.powerset.filter (fun D => ∏ p ∈ D, p ∣ n) := by |
| 181 | ext D |
| 182 | simp only [mem_powerset, mem_filter] |
| 183 | constructor |
| 184 | · intro h |
| 185 | refine ⟨h.trans (filter_subset _ _), ?_⟩ |
| 186 | exact prod_primes_dvd n (fun p hp => (hS p (mem_filter.1 (h hp)).1).prime) |
| 187 | fun p hp => (mem_filter.1 (h hp)).2 |
| 188 | · rintro ⟨h1, h2⟩ p hp |
| 189 | exact mem_filter.2 ⟨h1 hp, (dvd_prod_of_mem _ hp).trans h2⟩ |
| 190 | rw [this, sum_filter] |
| 191 | refine sum_congr rfl fun D hD => ?_ |
| 192 | rw [wt_prod hS f (mem_powerset.1 hD)] |
| 193 | |
| 194 | lemma sum_wt_div (hS : ∀ p ∈ S, p.Prime) (f : Finset ℕ → ℝ) {e : ℕ} (he : e ∣ ∏ p ∈ S, p) : |
| 195 | ∑ d ∈ (∏ p ∈ S, p).divisors with e ∣ d, wt S f d / d = |
| 196 | cs (fun p => 1 / (p : ℝ)) S f e.primeFactors := by |
| 197 | have hesq := (squarefree_P hS).squarefree_of_dvd he |
| 198 | rw [sum_filter, sum_div hS, cs, sum_filter] |
| 199 | refine sum_congr rfl fun D hD => ?_ |
| 200 | have hD' := mem_powerset.1 hD |
| 201 | rw [wt_prod hS f hD'] |
| 202 | have h1 : e ∣ ∏ p ∈ D, p ↔ e.primeFactors ⊆ D := by |
| 203 | constructor |
| 204 | · intro h |
| 205 | have := Nat.primeFactors_mono h (prod_ne_zero_iff.2 fun p hp => (hS p (hD' hp)).ne_zero) |
| 206 | rwa [primeFactors_P fun p hp => hS p (hD' hp)] at this |
| 207 | · intro h |
| 208 | rw [← Nat.prod_primeFactors_of_squarefree hesq] |
| 209 | exact prod_dvd_prod_of_subset _ _ _ h |
| 210 | simp only [h1, one_div, prod_inv_distrib, Nat.cast_prod] |
| 211 | simp only [div_eq_mul_inv] |
| 212 | |
| 213 | lemma sum_wt_div_all (hS : ∀ p ∈ S, p.Prime) (f : Finset ℕ → ℝ) : |
| 214 | ∑ d ∈ (∏ p ∈ S, p).divisors, wt S f d / d = cs (fun p => 1 / (p : ℝ)) S f ∅ := by |
| 215 | have := sum_wt_div hS f (one_dvd _) |
| 216 | simpa using this |
| 217 | |
| 218 | lemma wt_supp {f : Finset ℕ → ℝ} (hS : ∀ p ∈ S, p.Prime) {Q : ℝ} |
| 219 | (hf : ∀ D ⊆ S, f D ≠ 0 → (∏ p ∈ D, (p : ℝ)) ≤ Q) {d : ℕ} (hd : Q < d) : wt S f d = 0 := by |
| 220 | unfold wt |
| 221 | split_ifs with h |
| 222 | · by_contra hne |
| 223 | have hP : (∏ p ∈ S, p) ≠ 0 := prod_ne_zero_iff.2 fun p hp => (hS p hp).ne_zero |
| 224 | have h1 := Nat.primeFactors_mono h hP |
| 225 | rw [primeFactors_P hS] at h1 |
| 226 | have h2 := hf _ h1 hne |
| 227 | rw [← Nat.cast_prod, Nat.prod_primeFactors_of_squarefree |
| 228 | ((squarefree_P hS).squarefree_of_dvd h)] at h2 |
| 229 | linarith |
| 230 | · rfl |
| 231 | |
| 232 | end BH |
| 233 | |
| 234 | open BH |
| 235 | |
| 236 | /-- **T2**, Brun-Hooley in dimension 1 (Hooley's lower sieve with the coefficient bound). |
| 237 | `|λ⁺| ≤ 1` is not in v2 but T3 needs it. -/ |
| 238 | theorem T2_brun_hooley : ∃ c C : ℝ, ∃ K : ℕ, 0 < c ∧ 1 ≤ C ∧ 2 ≤ K ∧ |
| 239 | ∀ (K0 : ℕ) (z : ℝ), K ≤ K0 → (K0 : ℝ) ≤ z → ∃ lm lp : ℕ → ℝ, |
| 240 | (∀ d : ℕ, z ^ 12 < d → lm d = 0 ∧ lp d = 0) ∧ (∀ d, |lp d| ≤ 1) ∧ |
| 241 | (∀ n : ℕ, |
| 242 | ∑ d ∈ (∏ p ∈ primesIoc K0 z, p).divisors with d ∣ n, lm d ≤ |
| 243 | (if n.Coprime (∏ p ∈ primesIoc K0 z, p) then 1 else 0) ∧ |
| 244 | (if n.Coprime (∏ p ∈ primesIoc K0 z, p) then (1 : ℝ) else 0) ≤ |
| 245 | ∑ d ∈ (∏ p ∈ primesIoc K0 z, p).divisors with d ∣ n, lp d) ∧ |
| 246 | c * ∏ p ∈ primesIoc K0 z, (1 - 1 / (p : ℝ)) ≤ |
| 247 | ∑ d ∈ (∏ p ∈ primesIoc K0 z, p).divisors, lm d / d ∧ |
| 248 | ∑ d ∈ (∏ p ∈ primesIoc K0 z, p).divisors, lp d / d ≤ |
| 249 | C * ∏ p ∈ primesIoc K0 z, (1 - 1 / (p : ℝ)) ∧ |
| 250 | ∀ e ∈ (∏ p ∈ primesIoc K0 z, p).divisors, |
| 251 | |∑ d ∈ (∏ p ∈ primesIoc K0 z, p).divisors with e ∣ d, lm d / d| ≤ |
| 252 | C * (∏ p ∈ primesIoc K0 z, (1 - 1 / (p : ℝ))) * C ^ e.primeFactors.card / e := by |
| 253 | obtain ⟨A, hA, hMert⟩ := T10_mertens |
| 254 | refine ⟨7 / 16, 24, ⌈Real.exp (20 * A)⌉₊ + 2, by norm_num, by norm_num, by omega, ?_⟩ |
| 255 | intro K0 z hK0 hz |
| 256 | have hK2 : 2 ≤ K0 := by omega |
| 257 | have hK2' : (2 : ℝ) ≤ K0 := by exact_mod_cast hK2 |
| 258 | have hKe : Real.exp (20 * A) ≤ K0 := (Nat.le_ceil _).trans (by exact_mod_cast (by omega)) |
| 259 | have hM : ∀ u v : ℝ, (K0 : ℝ) ≤ u → u ≤ v → v ≤ u ^ 2 → |
| 260 | ∑ p ∈ primesIoc u v, 1 / (p : ℝ) ≤ 3 / 4 := by |
| 261 | intro u v hu huv hvu |
| 262 | have h1 := (abs_le.1 (hMert u v (by linarith) huv)).2 |
| 263 | have hlu : 20 * A ≤ Real.log u := (Real.le_log_iff_exp_le (by linarith)).2 (hKe.trans hu) |
| 264 | have hlu0 : 0 < Real.log u := by linarith |
| 265 | have h2 : A / Real.log u ≤ 1 / 20 := by |
| 266 | rw [div_le_div_iff₀ hlu0 (by norm_num)]; linarith |
| 267 | have h3 : Real.log v / Real.log u ≤ 2 := by |
| 268 | rw [div_le_iff₀ hlu0] |
| 269 | calc Real.log v ≤ Real.log (u ^ 2) := Real.log_le_log (by linarith) hvu |
| 270 | _ = _ := by rw [Real.log_pow]; norm_num |
| 271 | have hlv : 0 < Real.log v := Real.log_pos (by linarith) |
| 272 | have h4 := Real.log_le_log (by positivity) h3 |
| 273 | linarith [Real.log_two_lt_d9] |
| 274 | obtain ⟨n, hn⟩ := pow_unbounded_of_one_lt z (show (1 : ℝ) < K0 by linarith) |
| 275 | have hn' : z ≤ (K0 : ℝ) ^ (2 ^ n) := |
| 276 | hn.le.trans (pow_le_pow_right₀ (by linarith) Nat.lt_two_pow_self.le) |
| 277 | have hz1 : 1 ≤ z := by linarith |
| 278 | obtain ⟨lp, lm, hs⟩ := exists_sys hK2 hM n 0 z hz1 hn' |
| 279 | set S := primesIoc K0 z with hSdef |
| 280 | have hS : ∀ p ∈ S, p.Prime := fun p hp => (mem_filter.1 hp).2 |
| 281 | simp only [pow_zero, div_one, mul_zero, zero_add] at hs |
| 282 | have hV := hs.V_le |
| 283 | have hV2 := hs.le_V |
| 284 | have hr := hs.ratio |
| 285 | refine ⟨wt S lm, wt S lp, ?_, ?_, ?_, ?_, ?_, ?_⟩ |
| 286 | · intro d hd |
| 287 | have q1 : z ^ 9 ≤ z ^ 12 := pow_le_pow_right₀ hz1 (by norm_num) |
| 288 | have q2 : z ^ 8 ≤ z ^ 12 := pow_le_pow_right₀ hz1 (by norm_num) |
| 289 | exact ⟨wt_supp hS hs.supp_m (q1.trans_lt hd), wt_supp hS hs.supp_p (q2.trans_lt hd)⟩ |
| 290 | · intro d |
| 291 | unfold wt |
| 292 | split_ifs |
| 293 | · exact hs.abs_lp _ |
| 294 | · simp |
| 295 | · intro n |
| 296 | rw [sum_wt_dvd hS, sum_wt_dvd hS] |
| 297 | have hc : n.Coprime (∏ p ∈ S, p) ↔ S.filter (· ∣ n) = ∅ := by |
| 298 | rw [Nat.coprime_prod_right_iff, filter_eq_empty_iff] |
| 299 | refine forall₂_congr fun p hp => ?_ |
| 300 | rw [Nat.coprime_comm, (hS p hp).coprime_iff_not_dvd] |
| 301 | simp only [hc] |
| 302 | exact ⟨hs.lo _ (filter_subset _ _), hs.hi _ (filter_subset _ _)⟩ |
| 303 | · rw [sum_wt_div_all hS] |
| 304 | linarith |
| 305 | · rw [sum_wt_div_all hS] |
| 306 | have hV0 : 0 ≤ ∏ p ∈ S, (1 - 1 / (p : ℝ)) := prod_nonneg fun p hp => by |
| 307 | have : (1 : ℝ) ≤ p := by exact_mod_cast (hS p hp).one_le |
| 308 | rw [sub_nonneg, div_le_one (by linarith)]; exact this |
| 309 | linarith |
| 310 | · intro e he |
| 311 | have hed := Nat.dvd_of_mem_divisors he |
| 312 | have hP : (∏ p ∈ S, p) ≠ 0 := prod_ne_zero_iff.2 fun p hp => (hS p hp).ne_zero |
| 313 | rw [sum_wt_div hS lm hed] |
| 314 | have hsub := Nat.primeFactors_mono hed hP |
| 315 | rw [primeFactors_P hS] at hsub |
| 316 | have h1 := hs.coef_m _ hsub |
| 317 | have h2 : ∏ p ∈ e.primeFactors, 1 / (p : ℝ) = 1 / e := by |
| 318 | simp only [one_div, prod_inv_distrib] |
| 319 | rw [← Nat.cast_prod, Nat.prod_primeFactors_of_squarefree |
| 320 | ((squarefree_P hS).squarefree_of_dvd hed)] |
| 321 | rw [h2] at h1 |
| 322 | refine h1.trans ?_ |
| 323 | have h3 : (1 + 9 / 16) * cs (fun p => 1 / (p : ℝ)) S lp ∅ ≤ |
| 324 | 24 * ∏ p ∈ S, (1 - 1 / (p : ℝ)) := by |
| 325 | have hV0 : 0 ≤ ∏ p ∈ S, (1 - 1 / (p : ℝ)) := prod_nonneg fun p hp => by |
| 326 | have : (1 : ℝ) ≤ p := by exact_mod_cast (hS p hp).one_le |
| 327 | rw [sub_nonneg, div_le_one (by linarith)]; exact this |
| 328 | linarith |
| 329 | calc _ ≤ (24 * ∏ p ∈ S, (1 - 1 / (p : ℝ))) * (24 ^ #e.primeFactors * (1 / (e : ℝ))) := |
| 330 | mul_le_mul_of_nonneg_right h3 (by positivity) |
| 331 | _ = _ := by ring |
| 332 | |
| 333 | end E424 |
| 334 | |