| | @@ -0,0 +1,97 @@ |
| 1 | +import ErdosSwarm.Erdos30Chebyshev |
| 2 | + |
| 3 | +/-! |
| 4 | +# Chebyshev bounds from the factorial ratio |
| 5 | + |
| 6 | +Suppose the log factorial ratio `T(n)` at scale `30n`, divided by `n`, tends to `C`. |
| 7 | +Rounding `x/30` down gives the eventual lower bound `L*x ≤ ψ x` for every `L < C/30`. |
| 8 | +Rounding up in the recurrence `ψ (30n) ≤ T(n) + ψ (5n)` bounds the limit superior |
| 9 | +`S` of `ψ x / x` by `C/30 + S/6`. This gives the upper slope `C/25`. |
| 10 | +The Stirling limit in `ErdosSwarm.Erdos30Stirling` supplies `C` for the prime-power |
| 11 | +interval argument in Erdős Problem 30. |
| 12 | +-/ |
| 13 | + |
| 14 | +namespace ErdosSwarm.Erdos30 |
| 15 | + |
| 16 | +open Chebyshev Filter |
| 17 | + |
| 18 | +/-- Transfer the limit from the integer index to the real argument after rounding. -/ |
| 19 | +private theorem tendsto_chebyshevLogRatio_rounded {C : ℝ} {n : ℝ → ℕ} |
| 20 | + (hT : Tendsto (fun k : ℕ => chebyshevLogRatio k / (k : ℝ)) atTop (nhds C)) |
| 21 | + (hn : Tendsto n atTop atTop) |
| 22 | + (hscale : Tendsto (fun x => (n x : ℝ) / x) atTop (nhds (1 / 30))) : |
| 23 | + Tendsto (fun x => chebyshevLogRatio (n x) / x) atTop (nhds (C / 30)) := by |
| 24 | + rw [div_eq_mul_one_div C 30] |
| 25 | + refine ((hT.comp hn).mul hscale).congr' ?_ |
| 26 | + filter_upwards [hn.eventually (eventually_gt_atTop 0)] with x hx |
| 27 | + exact div_mul_div_cancel₀ (Nat.cast_ne_zero.mpr hx.ne') |
| 28 | + |
| 29 | +/-- Every slope below `C/30` is an eventual lower bound for `ψ` on the real line. -/ |
| 30 | +theorem eventually_mul_le_psi {C L : ℝ} |
| 31 | + (hT : Tendsto (fun n : ℕ => chebyshevLogRatio n / (n : ℝ)) atTop (nhds C)) |
| 32 | + (hL : L < C / 30) : ∀ᶠ x : ℝ in atTop, L * x ≤ ψ x := by |
| 33 | + let n (x : ℝ) := ⌊(1 / 30 : ℝ) * x⌋₊ |
| 34 | + have hn : Tendsto n atTop atTop := |
| 35 | + tendsto_nat_floor_atTop.comp (tendsto_id.const_mul_atTop (by norm_num : (0 : ℝ) < 1 / 30)) |
| 36 | + have hlim := tendsto_chebyshevLogRatio_rounded hT hn |
| 37 | + (tendsto_nat_floor_mul_div_atTop (by norm_num : (0 : ℝ) ≤ 1 / 30)) |
| 38 | + filter_upwards [hlim.eventually_const_lt hL, eventually_gt_atTop 0] with x hlow hx |
| 39 | + have hfloor : 30 * (n x : ℝ) ≤ x := by |
| 40 | + have h := Nat.floor_le (show 0 ≤ (1 / 30 : ℝ) * x by positivity) |
| 41 | + dsimp [n] |
| 42 | + linarith only [h] |
| 43 | + exact ((lt_div_iff₀ hx).mp hlow).le.trans |
| 44 | + ((chebyshevLogRatio_le_psi (n x)).trans (psi_mono hfloor)) |
| 45 | + |
| 46 | +/-- Every slope above `C/25` is an eventual upper bound for `ψ` on the real line. -/ |
| 47 | +theorem eventually_psi_le_mul {C U : ℝ} |
| 48 | + (hT : Tendsto (fun n : ℕ => chebyshevLogRatio n / (n : ℝ)) atTop (nhds C)) |
| 49 | + (hU : C / 25 < U) : ∀ᶠ x : ℝ in atTop, ψ x ≤ U * x := by |
| 50 | + let f (x : ℝ) := ψ x / x |
| 51 | + let S := limsup f atTop |
| 52 | + have hbdd : IsBoundedUnder (· ≤ ·) atTop f := by |
| 53 | + apply isBoundedUnder_of_eventually_le (a := Real.log 4 + 4) |
| 54 | + filter_upwards [eventually_gt_atTop (0 : ℝ)] with x hx |
| 55 | + exact (div_le_iff₀ hx).mpr (psi_le_const_mul_self hx.le) |
| 56 | + have hcobdd : IsCoboundedUnder (· ≤ ·) atTop f := by |
| 57 | + apply IsBoundedUnder.isCoboundedUnder_le |
| 58 | + apply isBoundedUnder_of_eventually_ge (a := 0) |
| 59 | + filter_upwards [eventually_gt_atTop (0 : ℝ)] with x hx |
| 60 | + exact div_nonneg (psi_nonneg x) hx.le |
| 61 | + let n (x : ℝ) := ⌈(1 / 30 : ℝ) * x⌉₊ |
| 62 | + have hn : Tendsto n atTop atTop := |
| 63 | + tendsto_nat_ceil_atTop.comp (tendsto_id.const_mul_atTop (by norm_num : (0 : ℝ) < 1 / 30)) |
| 64 | + have hscale : Tendsto (fun x => (n x : ℝ) / x) atTop (nhds (1 / 30)) := |
| 65 | + tendsto_nat_ceil_mul_div_atTop (by norm_num) |
| 66 | + have hfive : Tendsto (fun x => 5 * (n x : ℝ)) atTop atTop := |
| 67 | + (tendsto_natCast_atTop_atTop.comp hn).const_mul_atTop (by norm_num) |
| 68 | + have step (V : ℝ) (hV : S < V) : S ≤ C / 30 + V / 6 := by |
| 69 | + have hlim := (tendsto_chebyshevLogRatio_rounded hT hn hscale).add |
| 70 | + (hscale.const_mul (5 * V)) |
| 71 | + have hle : f ≤ᶠ[atTop] (fun x => chebyshevLogRatio (n x) / x + 5 * V * ((n x : ℝ) / x)) := by |
| 72 | + filter_upwards [hfive.eventually (eventually_lt_of_limsup_lt hV hbdd), |
| 73 | + hn.eventually (eventually_gt_atTop 0), eventually_gt_atTop (0 : ℝ)] with x hsmall hnpos hx |
| 74 | + have harg : x ≤ 30 * (n x : ℝ) := by |
| 75 | + have h := Nat.le_ceil ((1 / 30 : ℝ) * x) |
| 76 | + dsimp [n] |
| 77 | + linarith only [h] |
| 78 | + have hrec := psi_sub_le_chebyshevLogRatio (n x) |
| 79 | + have hnreal : 0 < (n x : ℝ) := by exact_mod_cast hnpos |
| 80 | + have hsmall' := (div_lt_iff₀ (by positivity : 0 < 5 * (n x : ℝ))).mp hsmall |
| 81 | + dsimp [f] |
| 82 | + rw [← mul_div_assoc, ← add_div, div_le_div_iff_of_pos_right hx] |
| 83 | + linarith only [psi_mono harg, hrec, hsmall'] |
| 84 | + calc S ≤ _ := limsup_le_limsup hle hcobdd hlim.isBoundedUnder_le |
| 85 | + _ = C / 30 + 5 * V * (1 / 30) := hlim.limsup_eq |
| 86 | + _ = _ := by ring |
| 87 | + have hS : S ≤ C / 25 := by |
| 88 | + have : 6 * (S - C / 30) ≤ S := by |
| 89 | + apply le_of_forall_gt_imp_ge_of_dense |
| 90 | + intro V hV |
| 91 | + linarith only [step V hV] |
| 92 | + linarith only [this] |
| 93 | + filter_upwards [eventually_lt_of_limsup_lt (hS.trans_lt hU) hbdd, |
| 94 | + eventually_gt_atTop (0 : ℝ)] with x h hx |
| 95 | + exact ((div_lt_iff₀ hx).mp h).le |
| 96 | + |
| 97 | +end ErdosSwarm.Erdos30 |