| | @@ -0,0 +1,180 @@ |
| 1 | +import ErdosSwarm.Erdos530Gap78.Data |
| 2 | +import ErdosSwarm.Erdos530Gap103.Parameters |
| 3 | +import Mathlib.Analysis.SpecialFunctions.Log.Deriv |
| 4 | + |
| 5 | +/-! |
| 6 | +# The pair-tail estimate for the 77/78 upper bound in Erdős #530 |
| 7 | + |
| 8 | +The exponential moment in `experiments/erdos530/upper-smaller-k2/tail78_check.py` |
| 9 | +has two graph coefficients. We enclose their logarithms and the log tilt by a |
| 10 | +cubic Taylor estimate. The graph-size hypothesis bounds the resulting affine |
| 11 | +function on the three ranges cut out by `λ = 4/10⁶` and `λ = 7/(96·32)`. |
| 12 | +For the container count we use `Erdos530Gap103.entropy_and_error_103`, which |
| 13 | +bounds the fingerprint count from Phal and Gemini, *An Upper Bound Below sqrt(N) |
| 14 | +for Guaranteed Sidon Subsets of N-Element Sets*, §4, together with the record count. |
| 15 | +-/ |
| 16 | + |
| 17 | +namespace ErdosSwarm.Erdos530Gap78 |
| 18 | + |
| 19 | +open ErdosSwarm.Erdos530Gap |
| 20 | + |
| 21 | +noncomputable section |
| 22 | + |
| 23 | +set_option exponentiation.threshold 1024 |
| 24 | + |
| 25 | +private abbrev momentA : ℝ := |
| 26 | + let q := 1 - (delta : ℝ) |
| 27 | + 1 - q + q * tilt |
| 28 | + |
| 29 | +private abbrev momentB : ℝ := |
| 30 | + let q := 1 - (delta : ℝ) |
| 31 | + (1 - q) ^ 2 + (1 - (1 - q) ^ 2) * tilt |
| 32 | + |
| 33 | +/-- Third-order Taylor bounds for `log z` on `1 ≤ z < 2`. -/ |
| 34 | +private theorem log_cubic_bounds {z : ℝ} (h₁ : 1 ≤ z) (h₂ : z < 2) : |
| 35 | + let x := z - 1 |
| 36 | + let t := x - x ^ 2 / 2 + x ^ 3 / 3 |
| 37 | + let r := x ^ 4 / (1 - x) |
| 38 | + t - r ≤ Real.log z ∧ Real.log z ≤ t + r := by |
| 39 | + have habs : |1 - z| = z - 1 := abs_sub_comm 1 z ▸ abs_of_nonneg (sub_nonneg.mpr h₁) |
| 40 | + have h := Real.abs_log_sub_add_sum_range_le (x := 1 - z) (by rw [habs]; linarith) 3 |
| 41 | + rw [habs, sub_sub_cancel] at h |
| 42 | + norm_num [Finset.sum_range_succ] at h |
| 43 | + obtain ⟨hl, hu⟩ := abs_le.mp h |
| 44 | + dsimp only |
| 45 | + constructor <;> linarith only [hl, hu] |
| 46 | + |
| 47 | +/-- Round the coefficient of the negative term down and the two positive |
| 48 | +coefficients up, with common denominator `10¹¹`. -/ |
| 49 | +private theorem moment_log_bounds : |
| 50 | + 29995500 / 10 ^ 11 ≤ Real.log tilt ∧ |
| 51 | + Real.log (momentA ^ 2 / momentB) ≤ 27821545 / 10 ^ 11 ∧ |
| 52 | + Real.log (momentB / momentA) ≤ 1066533 / 10 ^ 11 := by |
| 53 | + have hy := log_cubic_bounds (z := tilt) (by norm_num [tilt]) (by norm_num [tilt]) |
| 54 | + have ha := log_cubic_bounds (z := momentA ^ 2 / momentB) |
| 55 | + (by norm_num [momentA, momentB, tilt, delta]) (by norm_num [momentA, momentB, tilt, delta]) |
| 56 | + have hb := log_cubic_bounds (z := momentB / momentA) |
| 57 | + (by norm_num [momentA, momentB, tilt, delta]) (by norm_num [momentA, momentB, tilt, delta]) |
| 58 | + exact ⟨le_trans (by norm_num [tilt]) hy.1, |
| 59 | + ha.2.trans (by norm_num [momentA, momentB, tilt, delta]), |
| 60 | + hb.2.trans (by norm_num [momentA, momentB, tilt, delta])⟩ |
| 61 | + |
| 62 | +/-- Uniform allowances for the interval bound, fixed vertices and refined-pair count. -/ |
| 63 | +private theorem scale_bounds {m : ℝ} (hm : (2 : ℝ) ^ 360 ≤ m) : |
| 64 | + 52 * m ^ (-(1 / 8 : ℝ)) ≤ 1 / 1000 ∧ |
| 65 | + 64 * m ^ (27 / 32 : ℝ) ≤ m / 10 ^ 9 ∧ refinedLog m ≤ m / 10 ^ 10 := by |
| 66 | + have hm₁ : 1 ≤ m := le_trans (by norm_num) hm |
| 67 | + have hm₀ : 0 < m := lt_of_lt_of_le zero_lt_one hm₁ |
| 68 | + have hlarge : (2 : ℝ) ^ 45 ≤ m ^ (1 / 8 : ℝ) := by |
| 69 | + apply le_of_pow_le_pow_left₀ (n := 8) (by decide) (by positivity) |
| 70 | + rw [← pow_mul, ← Real.rpow_mul_natCast hm₀.le] |
| 71 | + change (2 : ℝ) ^ 360 ≤ m ^ ((1 / 8 : ℝ) * 8) |
| 72 | + rwa [show (1 / 8 : ℝ) * 8 = 1 by norm_num, Real.rpow_one] |
| 73 | + have hdecay : m ^ (-(1 / 8 : ℝ)) ≤ 1 / 2 ^ 45 := by |
| 74 | + rw [Real.rpow_neg hm₀.le, ← one_div] |
| 75 | + gcongr |
| 76 | + have hseven : m ^ (7 / 8 : ℝ) ≤ (1 / 2 ^ 45) * m := by |
| 77 | + rw [show (7 / 8 : ℝ) = -(1 / 8 : ℝ) + 1 by norm_num, Real.rpow_add hm₀, Real.rpow_one] |
| 78 | + exact mul_le_mul_of_nonneg_right hdecay hm₀.le |
| 79 | + have hpow := Real.rpow_le_rpow_of_exponent_le hm₁ (by norm_num : (27 / 32 : ℝ) ≤ 7 / 8) |
| 80 | + refine ⟨by linarith only [hdecay], by linarith only [hpow, hseven, hm₀], ?_⟩ |
| 81 | + have hlog := Real.log_le_rpow_div hm₀.le (by norm_num : 0 < (1 / 32 : ℝ)) |
| 82 | + have hfactor : 1 + 5 / 16 * Real.log m ≤ 11 * m ^ (1 / 32 : ℝ) := by |
| 83 | + linarith only [hlog, Real.one_le_rpow hm₁ (by norm_num : 0 ≤ (1 / 32 : ℝ))] |
| 84 | + calc |
| 85 | + refinedLog m ≤ 24 * m ^ (27 / 32 : ℝ) * (11 * m ^ (1 / 32 : ℝ)) := by |
| 86 | + unfold refinedLog |
| 87 | + gcongr |
| 88 | + _ = 264 * (m ^ (27 / 32 : ℝ) * m ^ (1 / 32 : ℝ)) := by ring |
| 89 | + _ = 264 * m ^ (7 / 8 : ℝ) := by rw [← Real.rpow_add hm₀]; norm_num |
| 90 | + _ ≤ m / 10 ^ 10 := by linarith only [hseven, hm₀] |
| 91 | + |
| 92 | +/-- For `a/m ≥ 1 − 4/10⁶`, use the interval bound on `a`. For |
| 93 | +`a/m ≤ 1 − 7/3072`, use the outer width. In between, set `λ = 1 − a/m`. -/ |
| 94 | +private theorem affine_tail {m a n : ℝ} (hm : 0 < m) (ha : a ≤ (1 + 1 / 1000) * m) |
| 95 | + (hn : n ≤ (1 + 7 / 32) * m) |
| 96 | + (hsize : ∀ lam : ℝ, 4 / 10 ^ 6 ≤ lam → lam ≤ 1 / 100 → |
| 97 | + (1 - lam) * m ≤ a → n < (1 + 96 * lam) * m) : |
| 98 | + -(31 / 32 - 1 / 10 ^ 9) * m * (29995500 / 10 ^ 11) + |
| 99 | + a * (27821545 / 10 ^ 11) + n * (1066533 / 10 ^ 11) ≤ -m / 10 ^ 9 := by |
| 100 | + by_cases htop : (1 - 4 / 10 ^ 6) * m ≤ a |
| 101 | + · have hw := hsize (4 / 10 ^ 6) le_rfl (by norm_num) htop |
| 102 | + linarith only [hm, ha, hw] |
| 103 | + by_cases hleft : a ≤ (1 - 7 / 3072) * m |
| 104 | + · linarith only [hm, hn, hleft] |
| 105 | + let lam := 1 - a / m |
| 106 | + have heq : (1 - lam) * m = a := by |
| 107 | + dsimp only [lam] |
| 108 | + rw [sub_sub_cancel, div_mul_cancel₀ _ hm.ne'] |
| 109 | + have hlo : 4 / 10 ^ 6 ≤ lam := by |
| 110 | + have h := (div_le_iff₀ hm).mpr (not_le.mp htop).le |
| 111 | + dsimp [lam] |
| 112 | + linarith only [h] |
| 113 | + have hhi : lam ≤ 7 / 3072 := by |
| 114 | + have h := (le_div_iff₀ hm).mpr (not_le.mp hleft).le |
| 115 | + dsimp [lam] |
| 116 | + linarith only [h] |
| 117 | + have hw := hsize lam hlo (hhi.trans (by norm_num)) heq.le |
| 118 | + linarith only [hm, not_le.mp hleft, heq, hw] |
| 119 | + |
| 120 | +/-- For every admissible pair at `√M ≥ 2^360`, the exponential-moment tail |
| 121 | +times the number of containers and refined pairs is less than `1/4`. -/ |
| 122 | +theorem pair_tail_78 {M : ℕ} (hm : (2 : ℝ) ^ 360 ≤ Real.sqrt M) {α n : ℕ} |
| 123 | + (hα : (α : ℝ) ≤ (1 + 52 * Real.sqrt M ^ (-(1 / 8 : ℝ))) * Real.sqrt M) |
| 124 | + (hn : (n : ℝ) ≤ (1 + K * tau) * Real.sqrt M) |
| 125 | + (hsize : ∀ lam : ℝ, 4 / 10 ^ 6 ≤ lam → lam ≤ 1 / 100 → |
| 126 | + (1 - lam) * Real.sqrt M ≤ α → (n : ℝ) < (1 + 96 * lam) * Real.sqrt M) : |
| 127 | + let q := 1 - (delta : ℝ) |
| 128 | + let A := 1 - q + q * tilt |
| 129 | + let B := (1 - q) ^ 2 + (1 - (1 - q) ^ 2) * tilt |
| 130 | + Real.exp (coverLog M tau + Erdos530Gap103.recordLog (Real.sqrt M) + |
| 131 | + refinedLog (Real.sqrt M)) * |
| 132 | + (tilt ^ (-((seedSize M tau : ℝ) - 64 * Real.sqrt M ^ (27 / 32 : ℝ))) * |
| 133 | + (A ^ 2 / B) ^ α * (B / A) ^ n) < 1 / 4 := by |
| 134 | + set m := Real.sqrt (M : ℝ) |
| 135 | + change Real.exp (coverLog M tau + Erdos530Gap103.recordLog m + refinedLog m) * |
| 136 | + (tilt ^ (-((seedSize M tau : ℝ) - 64 * m ^ (27 / 32 : ℝ))) * |
| 137 | + (momentA ^ 2 / momentB) ^ α * (momentB / momentA) ^ n) < 1 / 4 |
| 138 | + have hm₁ : 1 ≤ m := le_trans (by norm_num) hm |
| 139 | + have hm₀ := zero_lt_one.trans_le hm₁ |
| 140 | + obtain ⟨herr, hfixed, hrefined⟩ := scale_bounds hm |
| 141 | + have ha := hα.trans (mul_le_mul_of_nonneg_right (add_le_add le_rfl herr) hm₀.le) |
| 142 | + have hn' : (n : ℝ) ≤ (1 + 7 / 32) * m := by |
| 143 | + norm_num [K, tau, Erdos530Gap103.tau] at hn ⊢ |
| 144 | + exact hn |
| 145 | + have hmain := affine_tail hm₀ ha hn' hsize |
| 146 | + have hcounts : coverLog M tau + Erdos530Gap103.recordLog m + refinedLog m ≤ |
| 147 | + m / (2 * 10 ^ 9) := by |
| 148 | + have hc := (Erdos530Gap103.entropy_and_error_103 (M := M) hm).2 |
| 149 | + change coverLog M tau + Erdos530Gap103.recordLog m + refinementLog m < |
| 150 | + (Erdos530Gap103.tail ^ 2 - Erdos530Gap103.reserve) * m at hc |
| 151 | + have hr : 0 ≤ refinementLog m := by |
| 152 | + have hlog := Real.log_nonneg hm₁ |
| 153 | + unfold refinementLog |
| 154 | + positivity |
| 155 | + norm_num [Erdos530Gap103.tail, Erdos530Gap103.reserve] at hc |
| 156 | + linarith only [hc, hr, hrefined, hm₀] |
| 157 | + have hk : (1 - tau) * m ≤ (seedSize M tau : ℝ) := Nat.le_ceil _ |
| 158 | + rw [show 1 - tau = 31 / 32 by norm_num [tau, Erdos530Gap103.tau]] at hk |
| 159 | + have hseed : (31 / 32 - 1 / 10 ^ 9) * m ≤ (seedSize M tau : ℝ) - 64 * m ^ (27 / 32 : ℝ) := by |
| 160 | + linarith only [hk, hfixed] |
| 161 | + obtain ⟨hy, hA, hB⟩ := moment_log_bounds |
| 162 | + have hseed₀ : 0 ≤ (31 / 32 - 1 / 10 ^ 9) * m := mul_nonneg (by norm_num) hm₀.le |
| 163 | + have hneg := mul_le_mul hseed hy (by norm_num) (hseed₀.trans hseed) |
| 164 | + have hlogA := mul_le_mul_of_nonneg_left hA (Nat.cast_nonneg α : 0 ≤ (α : ℝ)) |
| 165 | + have hlogB := mul_le_mul_of_nonneg_left hB (Nat.cast_nonneg n : 0 ≤ (n : ℝ)) |
| 166 | + have hy₀ : 0 < tilt := by norm_num [tilt] |
| 167 | + have hA₀ : 0 < momentA ^ 2 / momentB := by norm_num [momentA, momentB, tilt, delta] |
| 168 | + have hB₀ : 0 < momentB / momentA := by norm_num [momentA, momentB, tilt, delta] |
| 169 | + apply (Real.log_lt_log_iff (by positivity) (by norm_num)).mp |
| 170 | + rw [Real.log_mul (Real.exp_pos _).ne' (by positivity), Real.log_exp, |
| 171 | + Real.log_mul (by positivity) (pow_pos hB₀ n).ne', |
| 172 | + Real.log_mul (Real.rpow_pos_of_pos hy₀ _).ne' (pow_pos hA₀ α).ne', |
| 173 | + Real.log_rpow hy₀, Real.log_pow, Real.log_pow, |
| 174 | + show Real.log (1 / 4 : ℝ) = -Real.log 4 by rw [one_div, Real.log_inv]] |
| 175 | + have hfour := Real.log_le_sub_one_of_pos (by norm_num : (0 : ℝ) < 4) |
| 176 | + linarith only [hcounts, hmain, hneg, hlogA, hlogB, hm, hfour] |
| 177 | + |
| 178 | +end |
| 179 | + |
| 180 | +end ErdosSwarm.Erdos530Gap78 |