| | @@ -0,0 +1,63 @@ |
| 1 | +import FormalConjectures.ErdosProblems.«5» |
| 2 | +import ErdosSwarm.Erdos5Lower |
| 3 | +import ErdosSwarm.Erdos5Telescope |
| 4 | + |
| 5 | +/-! |
| 6 | +# Erdős #5: normalized gaps are at least `c > 0` infinitely often |
| 7 | + |
| 8 | +If `normalizedGap n < c` for all large `n`, the gaps telescope to `p_N − 2 ≤ C₀ + c · N · log N`, |
| 9 | +which contradicts `le_nth_prime` (`c' · N · log N ≤ p_N`) once `c = c' / 2`. |
| 10 | +-/ |
| 11 | + |
| 12 | +open Real Filter Erdos5 |
| 13 | + |
| 14 | +namespace ErdosSwarm.Erdos5 |
| 15 | + |
| 16 | +theorem frequently_le_normalizedGap : ∃ c > (0 : ℝ), ∃ᶠ n : ℕ in atTop, c ≤ normalizedGap n := by |
| 17 | + obtain ⟨c', hc', hlow⟩ := le_nth_prime |
| 18 | + refine ⟨c' / 2, by positivity, ?_⟩ |
| 19 | + intro hev |
| 20 | + simp only [not_le] at hev |
| 21 | + obtain ⟨N₀, hN₀⟩ := eventually_atTop.1 (hev.and (eventually_ge_atTop 2)) |
| 22 | + set C₀ : ℝ := ∑ n ∈ Finset.range N₀, (primeGap n : ℝ) |
| 23 | + -- The partial sums of the gaps are at most `C₀ + (c'/2) · N · log N`. |
| 24 | + have hsum : ∀ N, N₀ ≤ N → |
| 25 | + ((Nat.nth Nat.Prime N : ℕ) : ℝ) - 2 ≤ C₀ + c' / 2 * N * Real.log N := by |
| 26 | + intro N hN |
| 27 | + have h2 : 2 ≤ Nat.nth Nat.Prime N := (Nat.prime_nth_prime N).two_le |
| 28 | + have htel := sum_primeGap N |
| 29 | + have hcast : ((Nat.nth Nat.Prime N : ℕ) : ℝ) - 2 = ∑ n ∈ Finset.range N, (primeGap n : ℝ) := by |
| 30 | + rw [← Nat.cast_sum, htel, Nat.cast_sub h2]; norm_num |
| 31 | + rw [hcast, ← Finset.sum_range_add_sum_Ico _ hN] |
| 32 | + gcongr |
| 33 | + have hlogN : 0 ≤ Real.log N := Real.log_natCast_nonneg N |
| 34 | + calc ∑ n ∈ Finset.Ico N₀ N, (primeGap n : ℝ) |
| 35 | + ≤ ∑ n ∈ Finset.Ico N₀ N, c' / 2 * Real.log N := by |
| 36 | + apply Finset.sum_le_sum |
| 37 | + intro n hn |
| 38 | + rw [Finset.mem_Ico] at hn |
| 39 | + obtain ⟨hlt, hn2⟩ := hN₀ n hn.1 |
| 40 | + have hlogpos : 0 < Real.log n := Real.log_pos (by exact_mod_cast hn2) |
| 41 | + rw [normalizedGap, div_lt_iff₀ hlogpos] at hlt |
| 42 | + have : Real.log n ≤ Real.log N := |
| 43 | + Real.log_le_log (by exact_mod_cast (by omega : 0 < n)) (by exact_mod_cast hn.2.le) |
| 44 | + nlinarith |
| 45 | + _ = (N - N₀ : ℕ) * (c' / 2 * Real.log N) := by |
| 46 | + rw [Finset.sum_const, Nat.card_Ico, nsmul_eq_mul] |
| 47 | + _ ≤ c' / 2 * N * Real.log N := by |
| 48 | + have : ((N - N₀ : ℕ) : ℝ) ≤ N := by exact_mod_cast Nat.sub_le N N₀ |
| 49 | + have : 0 ≤ c' / 2 * Real.log N := by positivity |
| 50 | + nlinarith |
| 51 | + -- `N · log N → ∞` contradicts the two bounds. |
| 52 | + have htend : Tendsto (fun N : ℕ => (N : ℝ) * Real.log N) atTop atTop := |
| 53 | + (tendsto_natCast_atTop_atTop.atTop_mul_atTop₀ |
| 54 | + (Real.tendsto_log_atTop.comp tendsto_natCast_atTop_atTop)) |
| 55 | + obtain ⟨N, hN1, hN2, hN3⟩ := (hlow.and ((eventually_ge_atTop N₀).and |
| 56 | + (htend.eventually_gt_atTop (2 * (C₀ + 2) / c')))).exists |
| 57 | + have h := hsum N hN2 |
| 58 | + have : c' / 2 * (N * Real.log N) > C₀ + 2 := by |
| 59 | + have := (div_lt_iff₀ hc').1 hN3 |
| 60 | + linarith |
| 61 | + nlinarith |
| 62 | + |
| 63 | +end ErdosSwarm.Erdos5 |