| | @@ -1,9 +1,13 @@ |
| 1 | 1 | import ErdosSwarm.Erdos30Chebyshev |
| 2 | 2 | |
| 3 | 3 | /-! |
| 4 | | −# Chebyshev bounds from the factorial ratio |
| 4 | +# Chebyshev bounds from factorial sums |
| 5 | 5 | |
| 6 | | −Suppose the log factorial ratio `T(n)` at scale `30n`, divided by `n`, tends to `C`. |
| 6 | +Suppose `F(n)/n → E`. If `F(n) ≤ s*ψ(Dn)`, then `L*x ≤ ψ x` eventually for every |
| 7 | +`L < E/(sD)`. If `s*(ψ(Dn) - ψ((D/K)n)) ≤ F(n)`, then `ψ x ≤ U*x` eventually for |
| 8 | +every `U > K*E/((K-1)*s*D)`. |
| 9 | + |
| 10 | +For Chebyshev's log factorial ratio `T(n)` at scale `30n`, suppose `T(n)/n → C`. |
| 7 | 11 | Rounding `x/30` down gives the eventual lower bound `L*x ≤ ψ x` for every `L < C/30`. |
| 8 | 12 | Rounding up in the recurrence `ψ (30n) ≤ T(n) + ψ (5n)` bounds the limit superior |
| 9 | 13 | `S` of `ψ x / x` by `C/30 + S/6`. This gives the upper slope `C/25`. |
| | @@ -17,33 +21,43 @@ namespace ErdosSwarm.Erdos30 |
| 17 | 21 | |
| 18 | 22 | open Chebyshev Filter |
| 19 | 23 | |
| 20 | | −/-- Transfer the limit from the integer index to the real argument after rounding. -/ |
| 21 | | −private theorem tendsto_chebyshevLogRatio_rounded {C : ℝ} {n : ℝ → ℕ} |
| 22 | | − (hT : Tendsto (fun k : ℕ => chebyshevLogRatio k / (k : ℝ)) atTop (nhds C)) |
| 24 | +/-- Transfer the scaled sequence limit to a rounded real argument. -/ |
| 25 | +private theorem tendsto_scaled_div_rounded {F : ℕ → ℝ} {E s D : ℝ} {n : ℝ → ℕ} |
| 26 | + (hF : Tendsto (fun k : ℕ => F k / k) atTop (nhds E)) |
| 23 | 27 | (hn : Tendsto n atTop atTop) |
| 24 | | − (hscale : Tendsto (fun x => (n x : ℝ) / x) atTop (nhds (1 / 30))) : |
| 25 | | − Tendsto (fun x => chebyshevLogRatio (n x) / x) atTop (nhds (C / 30)) := by |
| 26 | | − rw [div_eq_mul_one_div C 30] |
| 27 | | − refine ((hT.comp hn).mul hscale).congr' ?_ |
| 28 | + (hscale : Tendsto (fun x => (n x : ℝ) / x) atTop (nhds (1 / D))) : |
| 29 | + Tendsto (fun x => F (n x) / s / x) atTop (nhds (E / (s * D))) := by |
| 30 | + rw [div_mul_eq_div_div_swap, div_eq_mul_one_div E D] |
| 31 | + refine (((hF.comp hn).mul hscale).div_const s).congr' ?_ |
| 28 | 32 | filter_upwards [hn.eventually (eventually_gt_atTop 0)] with x hx |
| 29 | | − exact div_mul_div_cancel₀ (Nat.cast_ne_zero.mpr hx.ne') |
| 33 | + change (F (n x) / (n x : ℝ) * ((n x : ℝ) / x)) / s = F (n x) / s / x |
| 34 | + rw [div_mul_div_cancel₀ (Nat.cast_ne_zero.mpr hx.ne'), div_right_comm] |
| 35 | + |
| 36 | +/-- Rounding down transfers `F(n) ≤ s ψ(Dn)` to every lower slope below `E/(sD)`. -/ |
| 37 | +theorem eventually_mul_le_psi_of_le_mul_psi {D : ℕ} {s E L : ℝ} {F : ℕ → ℝ} |
| 38 | + (hD : 0 < D) (hs : 0 < s) (hF : Tendsto (fun n : ℕ => F n / n) atTop (nhds E)) |
| 39 | + (hbound : ∀ n : ℕ, F n ≤ s * ψ ((D : ℝ) * n)) (hL : L < E / (s * D)) : |
| 40 | + ∀ᶠ x : ℝ in atTop, L * x ≤ ψ x := by |
| 41 | + have hD' : (0 : ℝ) < D := by exact_mod_cast hD |
| 42 | + have hinv := one_div_pos.mpr hD' |
| 43 | + let n (x : ℝ) := ⌊(1 / (D : ℝ)) * x⌋₊ |
| 44 | + have hn : Tendsto n atTop atTop := |
| 45 | + tendsto_nat_floor_atTop.comp (tendsto_id.const_mul_atTop hinv) |
| 46 | + have hlim := tendsto_scaled_div_rounded (s := s) hF hn (tendsto_nat_floor_mul_div_atTop hinv.le) |
| 47 | + filter_upwards [hlim.eventually_const_lt hL, eventually_gt_atTop (0 : ℝ)] with x hlow hx |
| 48 | + have hfloor : (n x : ℝ) ≤ x / D := by |
| 49 | + simpa only [n, div_mul_eq_mul_div, one_mul] using |
| 50 | + Nat.floor_le (show 0 ≤ 1 / (D : ℝ) * x from mul_nonneg hinv.le hx.le) |
| 51 | + calc L * x ≤ F (n x) / s := ((lt_div_iff₀ hx).mp hlow).le |
| 52 | + _ ≤ ψ ((D : ℝ) * n x) := (div_le_iff₀' hs).mpr (hbound (n x)) |
| 53 | + _ ≤ ψ x := psi_mono ((le_div_iff₀' hD').mp hfloor) |
| 30 | 54 | |
| 31 | 55 | /-- Every slope below `C/30` is an eventual lower bound for `ψ` on the real line. -/ |
| 32 | 56 | theorem eventually_mul_le_psi {C L : ℝ} |
| 33 | 57 | (hT : Tendsto (fun n : ℕ => chebyshevLogRatio n / (n : ℝ)) atTop (nhds C)) |
| 34 | 58 | (hL : L < C / 30) : ∀ᶠ x : ℝ in atTop, L * x ≤ ψ x := by |
| 35 | | − let n (x : ℝ) := ⌊(1 / 30 : ℝ) * x⌋₊ |
| 36 | | − have hn : Tendsto n atTop atTop := |
| 37 | | − tendsto_nat_floor_atTop.comp (tendsto_id.const_mul_atTop (by norm_num : (0 : ℝ) < 1 / 30)) |
| 38 | | − have hlim := tendsto_chebyshevLogRatio_rounded hT hn |
| 39 | | − (tendsto_nat_floor_mul_div_atTop (by norm_num : (0 : ℝ) ≤ 1 / 30)) |
| 40 | | − filter_upwards [hlim.eventually_const_lt hL, eventually_gt_atTop 0] with x hlow hx |
| 41 | | − have hfloor : 30 * (n x : ℝ) ≤ x := by |
| 42 | | − have h := Nat.floor_le (show 0 ≤ (1 / 30 : ℝ) * x by positivity) |
| 43 | | − dsimp [n] |
| 44 | | − linarith only [h] |
| 45 | | − exact ((lt_div_iff₀ hx).mp hlow).le.trans |
| 46 | | − ((chebyshevLogRatio_le_psi (n x)).trans (psi_mono hfloor)) |
| 59 | + exact eventually_mul_le_psi_of_le_mul_psi (D := 30) (s := 1) (by decide) zero_lt_one hT |
| 60 | + (by simpa using chebyshevLogRatio_le_psi) (by simpa using hL) |
| 47 | 61 | |
| 48 | 62 | private theorem eventually_psi_le_mul_of_limsup_lt {V : ℝ} |
| 49 | 63 | (hV : limsup (fun x : ℝ => ψ x / x) atTop < V) : ∀ᶠ x : ℝ in atTop, ψ x ≤ V * x := by |
| | @@ -60,44 +74,71 @@ private theorem isCoboundedUnder_psi_div : |
| 60 | 74 | filter_upwards [eventually_ge_atTop (0 : ℝ)] with x hx |
| 61 | 75 | exact div_nonneg (psi_nonneg x) hx |
| 62 | 76 | |
| 63 | | −/-- Every slope above `C/25` is an eventual upper bound for `ψ` on the real line. -/ |
| 64 | | −theorem eventually_psi_le_mul {C U : ℝ} |
| 65 | | − (hT : Tendsto (fun n : ℕ => chebyshevLogRatio n / (n : ℝ)) atTop (nhds C)) |
| 66 | | − (hU : C / 25 < U) : ∀ᶠ x : ℝ in atTop, ψ x ≤ U * x := by |
| 77 | +/-- Rounding up in `s (ψ(Dn) - ψ((D/K)n)) ≤ F(n)` gives the eventual upper slope |
| 78 | +`U` whenever `K E / ((K-1)sD) < U`. -/ |
| 79 | +theorem eventually_psi_le_mul_of_mul_psi_sub_le {D K : ℕ} {s E U : ℝ} {F : ℕ → ℝ} |
| 80 | + (hK : 1 < K) (hKD : K ≤ D) (hdvd : K ∣ D) (hs : 0 < s) |
| 81 | + (hF : Tendsto (fun n : ℕ => F n / n) atTop (nhds E)) |
| 82 | + (hbound : ∀ n : ℕ, s * (ψ ((D : ℝ) * n) - ψ ((D / K : ℕ) * (n : ℝ))) ≤ F n) |
| 83 | + (hU : (K : ℝ) * E / (((K : ℝ) - 1) * s * D) < U) : |
| 84 | + ∀ᶠ x : ℝ in atTop, ψ x ≤ U * x := by |
| 85 | + have hK' : (1 : ℝ) < K := by exact_mod_cast hK |
| 86 | + have hKpos : (0 : ℝ) < K := zero_lt_one.trans hK' |
| 87 | + have hD : (0 : ℝ) < D := hKpos.trans_le (by exact_mod_cast hKD) |
| 88 | + have hinv := one_div_pos.mpr hD |
| 67 | 89 | let f (x : ℝ) := ψ x / x |
| 68 | 90 | let S := limsup f atTop |
| 69 | | − let n (x : ℝ) := ⌈(1 / 30 : ℝ) * x⌉₊ |
| 91 | + let n (x : ℝ) := ⌈(1 / (D : ℝ)) * x⌉₊ |
| 70 | 92 | have hn : Tendsto n atTop atTop := |
| 71 | | − tendsto_nat_ceil_atTop.comp (tendsto_id.const_mul_atTop (by norm_num : (0 : ℝ) < 1 / 30)) |
| 72 | | − have hscale : Tendsto (fun x => (n x : ℝ) / x) atTop (nhds (1 / 30)) := |
| 73 | | − tendsto_nat_ceil_mul_div_atTop (by norm_num) |
| 74 | | − have hfive : Tendsto (fun x => 5 * (n x : ℝ)) atTop atTop := |
| 75 | | − (tendsto_natCast_atTop_atTop.comp hn).const_mul_atTop (by norm_num) |
| 76 | | − have step (V : ℝ) (hV : S < V) : S ≤ C / 30 + V / 6 := by |
| 77 | | − have hlim := (tendsto_chebyshevLogRatio_rounded hT hn hscale).add |
| 78 | | − (hscale.const_mul (5 * V)) |
| 79 | | − have hle : f ≤ᶠ[atTop] (fun x => chebyshevLogRatio (n x) / x + 5 * V * ((n x : ℝ) / x)) := by |
| 80 | | − filter_upwards [hfive.eventually (eventually_psi_le_mul_of_limsup_lt hV), |
| 93 | + tendsto_nat_ceil_atTop.comp (tendsto_id.const_mul_atTop hinv) |
| 94 | + have hscale : Tendsto (fun x => (n x : ℝ) / x) atTop (nhds (1 / (D : ℝ))) := |
| 95 | + tendsto_nat_ceil_mul_div_atTop hinv.le |
| 96 | + have hsmallArg : Tendsto (fun x => (D / K : ℕ) * (n x : ℝ)) atTop atTop := by |
| 97 | + have hpos := Nat.div_pos hKD (zero_lt_one.trans hK) |
| 98 | + exact (tendsto_natCast_atTop_atTop.comp hn).const_mul_atTop (by exact_mod_cast hpos) |
| 99 | + have step (V : ℝ) (hV : S < V) : S ≤ E / (s * D) + V / K := by |
| 100 | + have hlim := (tendsto_scaled_div_rounded (s := s) hF hn hscale).add |
| 101 | + (hscale.const_mul (V * (D / K : ℕ))) |
| 102 | + have hle : f ≤ᶠ[atTop] (fun x => |
| 103 | + F (n x) / s / x + (V * (D / K : ℕ)) * ((n x : ℝ) / x)) := by |
| 104 | + filter_upwards [hsmallArg.eventually (eventually_psi_le_mul_of_limsup_lt hV), |
| 81 | 105 | eventually_gt_atTop (0 : ℝ)] with x hsmall hx |
| 82 | | − have harg : x ≤ 30 * (n x : ℝ) := by |
| 83 | | − have h := Nat.le_ceil ((1 / 30 : ℝ) * x) |
| 84 | | − dsimp [n] |
| 85 | | − linarith only [h] |
| 86 | | − have hrec := psi_sub_le_chebyshevLogRatio (n x) |
| 106 | + have hceil : x / D ≤ (n x : ℝ) := by |
| 107 | + simpa only [n, div_mul_eq_mul_div, one_mul] using Nat.le_ceil (1 / (D : ℝ) * x) |
| 108 | + have hrec := (le_div_iff₀' hs).mpr (hbound (n x)) |
| 87 | 109 | dsimp [f] |
| 88 | 110 | rw [← mul_div_assoc, ← add_div, div_le_div_iff_of_pos_right hx] |
| 89 | | − linarith only [psi_mono harg, hrec, hsmall] |
| 111 | + linarith only [psi_mono ((div_le_iff₀' hD).mp hceil), hrec, hsmall] |
| 90 | 112 | calc S ≤ _ := limsup_le_limsup hle isCoboundedUnder_psi_div hlim.isBoundedUnder_le |
| 91 | | − _ = C / 30 + 5 * V * (1 / 30) := hlim.limsup_eq |
| 92 | | − _ = _ := by ring |
| 93 | | − have hS : S ≤ C / 25 := by |
| 94 | | − have : 6 * (S - C / 30) ≤ S := by |
| 95 | | − apply le_of_forall_gt_imp_ge_of_dense |
| 96 | | − intro V hV |
| 97 | | − linarith only [step V hV] |
| 98 | | − linarith only [this] |
| 113 | + _ = E / (s * D) + (V * (D / K : ℕ)) * (1 / (D : ℝ)) := hlim.limsup_eq |
| 114 | + _ = _ := by |
| 115 | + rw [Nat.cast_div hdvd hKpos.ne'] |
| 116 | + field_simp |
| 117 | + have hfixed : (K : ℝ) * (S - E / (s * D)) ≤ S := by |
| 118 | + apply le_of_forall_gt_imp_ge_of_dense |
| 119 | + intro V hV |
| 120 | + apply (le_div_iff₀' hKpos).mp |
| 121 | + linarith only [step V hV] |
| 122 | + have hS : S ≤ (K : ℝ) * E / (((K : ℝ) - 1) * s * D) := calc |
| 123 | + S ≤ ((K : ℝ) * (E / (s * D))) / ((K : ℝ) - 1) := by |
| 124 | + apply (le_div_iff₀ (sub_pos.mpr hK')).mpr |
| 125 | + linarith only [hfixed] |
| 126 | + _ = _ := by |
| 127 | + rw [← mul_div_assoc, div_div] |
| 128 | + ring_nf |
| 99 | 129 | exact eventually_psi_le_mul_of_limsup_lt (hS.trans_lt hU) |
| 100 | 130 | |
| 131 | +/-- Every slope above `C/25` is an eventual upper bound for `ψ` on the real line. -/ |
| 132 | +theorem eventually_psi_le_mul {C U : ℝ} |
| 133 | + (hT : Tendsto (fun n : ℕ => chebyshevLogRatio n / (n : ℝ)) atTop (nhds C)) |
| 134 | + (hU : C / 25 < U) : ∀ᶠ x : ℝ in atTop, ψ x ≤ U * x := by |
| 135 | + apply eventually_psi_le_mul_of_mul_psi_sub_le (D := 30) (K := 6) (s := 1) |
| 136 | + (by decide) (by decide) (by decide) zero_lt_one hT |
| 137 | + · simpa using psi_sub_le_chebyshevLogRatio |
| 138 | + · convert hU using 1 |
| 139 | + norm_num |
| 140 | + ring |
| 141 | + |
| 101 | 142 | /-- Counting both intervals in the factorial ratio makes every slope above `3C/77` |
| 102 | 143 | an eventual upper bound for `ψ`. -/ |
| 103 | 144 | theorem eventually_psi_le_mul_of_two_intervals {C U : ℝ} |
| | @@ -118,7 +159,8 @@ theorem eventually_psi_le_mul_of_two_intervals {C U : ℝ} |
| 118 | 159 | push_cast |
| 119 | 160 | ring |
| 120 | 161 | · norm_num |
| 121 | | − have hratio := tendsto_chebyshevLogRatio_rounded hT hseven hsevenScale |
| 162 | + have hratio := tendsto_scaled_div_rounded (s := 1) hT hseven hsevenScale |
| 163 | + simp only [div_one, one_mul] at hratio |
| 122 | 164 | have harg (a : ℝ) (ha : 0 < a) : Tendsto (fun x => a * (n x : ℝ)) atTop atTop := |
| 123 | 165 | (tendsto_natCast_atTop_atTop.comp hn).const_mul_atTop ha |
| 124 | 166 | have step (V L : ℝ) (hV : S < V) (hL : L < C / 30) : |
| | @@ -145,4 +187,18 @@ theorem eventually_psi_le_mul_of_two_intervals {C U : ℝ} |
| 145 | 187 | linarith only [step (S + ε) (C / 30 - ε) (lt_add_of_pos_right _ hε) (sub_lt_self _ hε), hε] |
| 146 | 188 | exact eventually_psi_le_mul_of_limsup_lt (hS.trans_lt hU) |
| 147 | 189 | |
| 190 | +/- The two real-argument estimates for the factorial certificate at scale 27720. -/ |
| 191 | +example {F : ℕ → ℝ} {E L : ℝ} (hF : Tendsto (fun n : ℕ => F n / n) atTop (nhds E)) |
| 192 | + (hbound : ∀ n : ℕ, F n ≤ 15 * ψ (27720 * (n : ℝ))) (hL : L < E / (15 * 27720)) : |
| 193 | + ∀ᶠ x : ℝ in atTop, L * x ≤ ψ x := |
| 194 | + eventually_mul_le_psi_of_le_mul_psi (D := 27720) (s := 15) (by decide) (by norm_num) |
| 195 | + hF hbound hL |
| 196 | + |
| 197 | +example {F : ℕ → ℝ} {E U : ℝ} (hF : Tendsto (fun n : ℕ => F n / n) atTop (nhds E)) |
| 198 | + (hbound : ∀ n : ℕ, 58 * (ψ (27720 * (n : ℝ)) - ψ (308 * (n : ℝ))) ≤ F n) |
| 199 | + (hU : 90 * E / (89 * 58 * 27720) < U) : ∀ᶠ x : ℝ in atTop, ψ x ≤ U * x := by |
| 200 | + apply eventually_psi_le_mul_of_mul_psi_sub_le (D := 27720) (K := 90) (s := 58) |
| 201 | + (by decide) (by decide) (by decide) (by norm_num) hF hbound |
| 202 | + simpa only [Nat.cast_ofNat, show (90 : ℝ) - 1 = 89 by norm_num] using hU |
| 203 | + |
| 148 | 204 | end ErdosSwarm.Erdos30 |