| | @@ -0,0 +1,260 @@ |
| 1 | +import ErdosSwarm.Erdos530Gap103.Assembly |
| 2 | +import ErdosSwarm.Erdos530Gap75.Data |
| 3 | +import ErdosSwarm.Erdos530Gap75.HeavyPacking |
| 4 | + |
| 5 | +/-! |
| 6 | +# A fixed-level refinement for the 74/75 bound in Erdős #530 |
| 7 | + |
| 8 | +This file proves F1, F3 and F4 of |
| 9 | +`experiments/erdos530/upper-fixed-level/NOTES.md`. The initial fingerprint family comes |
| 10 | +from the construction of Phal and Gemini, *An Upper Bound Below sqrt(N) for Guaranteed |
| 11 | +Sidon Subsets of N-Element Sets*, §4, via `Erdos530Gap103.Assembly`. A single refinement |
| 12 | +at level `2^48` gives a cover conditional on `OutsiderBound48`. The outsider estimate |
| 13 | +itself (F2), `Cover75At512` and `visible_gap_75` remain open at this stage. |
| 14 | +-/ |
| 15 | + |
| 16 | +namespace ErdosSwarm.Erdos530Gap75.FixedLevel |
| 17 | + |
| 18 | +open Finset ErdosSwarm.Erdos530Gap |
| 19 | +open ErdosSwarm.Erdos530Gap103 (tau iso adjacentPairs edgeFreeQuadruples hits_mono discard |
| 20 | + initialFamily exceptional_card_32 leaf_census fixed_card_le_of_level leaf_count_of_level leaves) |
| 21 | + |
| 22 | +set_option exponentiation.threshold 1024 |
| 23 | + |
| 24 | +/-- At threshold `1000·√m`, all but at most `m/4000000` points of the outsider pool |
| 25 | +have at most one listed isometry. The discard bound holds for every subset of those points. -/ |
| 26 | +theorem incidence_sqrt {M : ℕ} {U S B₀ : Finset ℕ} {G : SimpleGraph ℕ} (hSU : S ⊆ U) |
| 27 | + (hsid : IsSidon (S : Set ℕ)) (hind : G.IsIndepSet (S : Set ℕ)) |
| 28 | + (hle : (S.card : ℝ) ≤ Real.sqrt M) |
| 29 | + (hB₀ : B₀ ⊆ U \ S) (hb₀ : (B₀.card : ℝ) ≤ Real.sqrt M / 3) : |
| 30 | + ∃ Z ⊆ B₀, (Z.card : ℝ) ≤ Real.sqrt M / 4000000 ∧ |
| 31 | + ∀ B ⊆ B₀ \ Z, ∃ (P : Finset (ℕ × ℕ)) (g : ℕ → Bool × ℤ), P ⊆ B ×ˢ S ∧ |
| 32 | + (((B ×ˢ S) \ P).card : ℝ) ≤ |
| 33 | + (13 / 2 + 2000 * Real.sqrt (Real.sqrt M)) * (adjacentPairs G U).card + |
| 34 | + 48 * (edgeFreeQuadruples G U).card + |
| 35 | + 2 * (Real.sqrt M * Real.sqrt (Real.sqrt M)) + 2 / 3 * Real.sqrt M ∧ |
| 36 | + (∀ p ∈ P, ∀ a ∈ S, ∀ a' ∈ S, ((a : ℤ) - a').natAbs ≠ ((p.1 : ℤ) - p.2).natAbs) ∧ |
| 37 | + ∀ p ∈ P, ∀ p' ∈ P, p ≠ p' → |
| 38 | + ((p.1 : ℤ) - p.2).natAbs = ((p'.1 : ℤ) - p'.2).natAbs → |
| 39 | + (p'.1 : ℤ) = iso (g p.1) p.2 ∧ (p'.2 : ℤ) = iso (g p.1) p.1 := by |
| 40 | + set m := Real.sqrt (M : ℝ) |
| 41 | + by_cases hempty : B₀ = ∅ |
| 42 | + · subst B₀ |
| 43 | + refine ⟨∅, Subset.rfl, by simp; positivity, ?_⟩ |
| 44 | + intro B hB |
| 45 | + have : B = ∅ := subset_empty.mp (hB.trans sdiff_subset) |
| 46 | + subst B |
| 47 | + refine ⟨∅, fun _ => (false, 0), empty_subset _, ?_, by simp, by simp⟩ |
| 48 | + simp only [empty_product, empty_sdiff, card_empty, Nat.cast_zero] |
| 49 | + positivity |
| 50 | + have hm : 0 < m := by |
| 51 | + have hpos : (0 : ℝ) < B₀.card := by |
| 52 | + exact_mod_cast card_pos.mpr (nonempty_iff_ne_empty.mpr hempty) |
| 53 | + linarith only [hpos, hb₀] |
| 54 | + obtain ⟨Λ, Z, hZ, hsize, hinv, hlight, huniq⟩ := |
| 55 | + packed_heavy_list_sqrt (B := B₀) hsid (β := 1/3) (h := 1000) hm (by norm_num) |
| 56 | + (by norm_num) (by norm_num) (by linarith only [hb₀]) |
| 57 | + refine ⟨Z, hZ, hsize.trans (by linarith only [hm]), ?_⟩ |
| 58 | + intro B hB |
| 59 | + have hBB₀ : B ⊆ B₀ := hB.trans sdiff_subset |
| 60 | + obtain ⟨P, g, hP, hdisc, hmiss, hrepeat⟩ := discard hSU hsid hind (hBB₀.trans hB₀) hinv |
| 61 | + (fun g hg => (Nat.cast_le.mpr (card_le_card (hits_mono hBB₀ g))).trans_lt (hlight g hg)) |
| 62 | + (fun x hx g hg g' hg' h1 h2 => huniq x (hB hx) g hg g' hg' |
| 63 | + (hits_mono hBB₀ g h1) (hits_mono hBB₀ g' h2)) |
| 64 | + refine ⟨P, g, hP, hdisc.trans ?_, hmiss, hrepeat⟩ |
| 65 | + have hb : (B.card : ℝ) ≤ m / 3 := (Nat.cast_le.mpr (card_le_card hBB₀)).trans hb₀ |
| 66 | + have hroot₁ : √(2 * (B.card : ℝ)) ≤ √m := Real.sqrt_le_sqrt (by linarith only [hb, hm]) |
| 67 | + have hroot₂ : √((S.card : ℝ) + B.card) ≤ 2 * √m := by |
| 68 | + apply Real.sqrt_le_iff.mpr ⟨by positivity, ?_⟩ |
| 69 | + rw [mul_pow, Real.sq_sqrt hm.le] |
| 70 | + linarith only [hle, hb, hm] |
| 71 | + linarith only [mul_le_mul hle hroot₁ (Real.sqrt_nonneg _) hm.le, |
| 72 | + mul_le_mul hb hroot₂ (Real.sqrt_nonneg _) (by positivity : 0 ≤ m / 3), |
| 73 | + hb, mul_nonneg hm.le (Real.sqrt_nonneg m)] |
| 74 | + |
| 75 | +/-- The outsider estimate on the live set of a level-`2^48` refinement of a container with |
| 76 | +at most `5m` points. -/ |
| 77 | +def OutsiderBound48 (M : ℕ) (b : ℝ) : Prop := |
| 78 | + ∀ {U S : Finset ℕ} {G : SimpleGraph ℕ}, U ⊆ host M → S ⊆ U → |
| 79 | + IsSidon (S : Set ℕ) → G.IsIndepSet (S : Set ℕ) → |
| 80 | + ((adjacentPairs G U).card : ℝ) ≤ 5 * 2 ^ 48 * Real.sqrt M → |
| 81 | + ((edgeFreeQuadruples G U).card : ℝ) ≤ 5 / 4 * (2 ^ 144 + 8 * 2 ^ 96) * Real.sqrt M → |
| 82 | + (S.card : ℝ) ≤ Real.sqrt M → |
| 83 | + (1 - tau - 90 / 2 ^ 48) * Real.sqrt M ≤ S.card → |
| 84 | + ((U \ S).card : ℝ) < b |
| 85 | + |
| 86 | +open ErdosSwarm.Erdos530Gap.Refinement (follow) |
| 87 | + |
| 88 | +/-- For a Sidon set following this leaf, complete the recorded set to the seed size |
| 89 | +with independent live points. The remaining live points are exactly the outsiders. -/ |
| 90 | +private theorem fixed_leaf_size {M : ℕ} {C S : Finset ℕ} {b width : ℝ} |
| 91 | + (outsiders : OutsiderBound48 M b) (hwidth : (1 - tau) * Real.sqrt M + 1 + b ≤ width) |
| 92 | + (hm : (2 : ℝ) ^ 256 ≤ Real.sqrt M) (hC : C ⊆ host M) |
| 93 | + (hn : (C.card : ℝ) ≤ 5 * Real.sqrt M) (hSC : S ⊆ C) (hsid : IsSidon (S : Set ℕ)) |
| 94 | + (hk : seedSize M tau ≤ S.card) : |
| 95 | + let L := (follow C (2 ^ 48) S).1.leaf |
| 96 | + S ⊆ L.fixed ∪ L.live ∧ L.fixed ∪ L.live ⊆ C ∧ ((L.fixed ∪ L.live).card : ℝ) ≤ width := by |
| 97 | + classical |
| 98 | + let l : ℕ := 2 ^ 48 |
| 99 | + let F := (follow C l S).1.fixed |
| 100 | + let U := (follow C l S).1.live |
| 101 | + let G := (follow C l S).1.leaf.graph |
| 102 | + have hl : 3 ≤ l := by norm_num [l] |
| 103 | + obtain ⟨_, _, ⟨hcov, hind⟩, hinside, hdisj, _⟩ := refinement_path C S l hl hSC hsid |
| 104 | + refine ⟨hcov, hinside, ?_⟩ |
| 105 | + change ((F ∪ U).card : ℝ) ≤ width |
| 106 | + have hF : (F.card : ℝ) ≤ 90 / 2 ^ 48 * Real.sqrt M := calc |
| 107 | + _ ≤ 18 / 2 ^ 48 * (C.card : ℝ) := fixed_card_le_of_level hl (by norm_num [l]) hSC hsid |
| 108 | + _ ≤ 18 / 2 ^ 48 * (5 * Real.sqrt M) := by gcongr |
| 109 | + _ = _ := by ring |
| 110 | + have hkle : (1 - tau) * Real.sqrt M ≤ (seedSize M tau : ℝ) := Nat.le_ceil _ |
| 111 | + have hklt : (seedSize M tau : ℝ) < (1 - tau) * Real.sqrt M + 1 := |
| 112 | + Nat.ceil_lt_add_one (mul_nonneg (by norm_num [tau]) (Real.sqrt_nonneg _)) |
| 113 | + have hFk : F.card ≤ seedSize M tau := by |
| 114 | + have hcoef : (90 : ℝ) / 2 ^ 48 ≤ 1 - tau := by norm_num [tau] |
| 115 | + exact_mod_cast (hF.trans (mul_le_mul_of_nonneg_right hcoef (Real.sqrt_nonneg _))).trans hkle |
| 116 | + have hcap : S.card ≤ F.card + (S ∩ U).card := by |
| 117 | + have hsub : S ⊆ F ∪ (S ∩ U) := by |
| 118 | + rw [union_inter_distrib_left] |
| 119 | + exact subset_inter subset_union_right hcov |
| 120 | + exact (card_le_card hsub).trans (card_union_le _ _) |
| 121 | + obtain ⟨S', hS', hcard⟩ := |
| 122 | + exists_subset_card_eq (show seedSize M tau - F.card ≤ (S ∩ U).card by omega) |
| 123 | + have hS'U : S' ⊆ U := hS'.trans inter_subset_right |
| 124 | + have hsize : (S'.card : ℝ) = (seedSize M tau : ℝ) - F.card := by |
| 125 | + rw [hcard, Nat.cast_sub hFk] |
| 126 | + obtain ⟨hedges, hquads⟩ := leaf_census C S l hl hSC hsid |
| 127 | + have he : ((adjacentPairs G U).card : ℝ) ≤ C.card * (l : ℝ) := by exact_mod_cast hedges |
| 128 | + have hq : 4 * ((edgeFreeQuadruples G U).card : ℝ) ≤ |
| 129 | + C.card * ((l : ℝ) ^ 3 + 8 * (l : ℝ) ^ 2) := by |
| 130 | + exact_mod_cast hquads |
| 131 | + have hlreal : (l : ℝ) = 2 ^ 48 := by norm_num [l] |
| 132 | + rw [hlreal] at he hq |
| 133 | + have hout := outsiders (U := U) (S := S') (G := G) |
| 134 | + ((subset_union_right.trans hinside).trans hC) hS'U |
| 135 | + (Set.IsSidon.subset hsid (hS'.trans inter_subset_left)) (hind.mono (coe_subset.mpr hS')) |
| 136 | + (by linarith only [he, hn]) (by norm_num1 at hq ⊢; linarith only [hq, hn]) |
| 137 | + (by |
| 138 | + have hround : 1 ≤ tau * Real.sqrt M := by norm_num [tau]; linarith only [hm] |
| 139 | + linarith only [hsize, hklt, hround, Nat.cast_nonneg (α := ℝ) F.card]) |
| 140 | + (by linarith only [hsize, hkle, hF]) |
| 141 | + have hsplit : (F ∪ U).card = seedSize M tau + (U \ S').card := by |
| 142 | + have hunion : (F ∪ U).card = F.card + U.card := card_union_of_disjoint hdisj |
| 143 | + have hrest := card_sdiff_add_card_eq_card hS'U |
| 144 | + omega |
| 145 | + rw [hsplit, Nat.cast_add] |
| 146 | + linarith only [hout, hklt, hwidth] |
| 147 | + |
| 148 | +open private initial_count initial_cover from ErdosSwarm.Erdos530Gap103.Assembly in |
| 149 | +/-- Refine each initial container once at level `2^48`. The outsider estimate controls |
| 150 | +the width, while the recorded fraction `18/2^48` controls the number of leaves. -/ |
| 151 | +theorem cover_of_outsider_bound48 {M : ℕ} {b width : ℝ} (outsiders : OutsiderBound48 M b) |
| 152 | + (hwidth : (1 - tau) * Real.sqrt M + 1 + b ≤ width) |
| 153 | + (hm : (2 : ℝ) ^ 256 ≤ Real.sqrt M) : |
| 154 | + ∃ 𝒞 : Finset (Finset ℕ), |
| 155 | + (𝒞.card : ℝ) ≤ Real.exp (coverLog M tau + |
| 156 | + 18 / 2 ^ 48 * (5 * Real.sqrt M) * (1 - Real.log (18 / 2 ^ 48))) ∧ |
| 157 | + (∀ C ∈ 𝒞, C ⊆ host M ∧ (C.card : ℝ) ≤ width) ∧ |
| 158 | + ∀ S ⊆ host M, IsSidon (S : Set ℕ) → seedSize M tau ≤ S.card → ∃ C ∈ 𝒞, S ⊆ C := by |
| 159 | + classical |
| 160 | + let ρ : ℝ := 18 / 2 ^ 48 |
| 161 | + let cost := ρ * (5 * Real.sqrt M) * (1 - Real.log ρ) |
| 162 | + let out (T : Finset ℕ) : Finset (Finset ℕ) := |
| 163 | + (leaves (extension M T) (2 ^ 48)).image fun L => L.fixed ∪ L.live |
| 164 | + let 𝒞 := ((initialFamily M).biUnion out).filter fun C => |
| 165 | + C ⊆ host M ∧ (C.card : ℝ) ≤ width |
| 166 | + have hρ : 0 < ρ := by norm_num [ρ] |
| 167 | + have hρ₁ : ρ ≤ 1 := by norm_num [ρ] |
| 168 | + have hcount (T) (hT : T ∈ initialFamily M) : ((out T).card : ℝ) ≤ Real.exp cost := by |
| 169 | + refine (Nat.cast_le.mpr card_image_le).trans ((leaf_count_of_level (extension M T) |
| 170 | + (l := 2 ^ 48) (by norm_num) hρ hρ₁ (by norm_num [ρ])).trans (Real.exp_le_exp.mpr ?_)) |
| 171 | + exact mul_le_mul_of_nonneg_right (mul_le_mul_of_nonneg_left (mem_filter.mp hT).2.2 hρ.le) |
| 172 | + (by linarith only [Real.log_nonpos hρ.le hρ₁]) |
| 173 | + have hM : 2 ≤ M := by |
| 174 | + have hsq := Real.sq_sqrt (Nat.cast_nonneg (α := ℝ) M) |
| 175 | + exact_mod_cast (show (2 : ℝ) ≤ M by nlinarith only [hm, hsq]) |
| 176 | + refine ⟨𝒞, ?_, fun C hC => (mem_filter.mp hC).2, ?_⟩ |
| 177 | + · calc (𝒞.card : ℝ) ≤ (((initialFamily M).biUnion out).card : ℝ) := |
| 178 | + Nat.cast_le.mpr (card_filter_le _ _) |
| 179 | + _ ≤ ∑ T ∈ initialFamily M, ((out T).card : ℝ) := by exact_mod_cast card_biUnion_le |
| 180 | + _ ≤ ∑ _T ∈ initialFamily M, Real.exp cost := sum_le_sum hcount |
| 181 | + _ = (initialFamily M).card * Real.exp cost := by simp |
| 182 | + _ ≤ Real.exp (coverLog M tau) * Real.exp cost := |
| 183 | + mul_le_mul_of_nonneg_right (initial_count hM) (Real.exp_nonneg _) |
| 184 | + _ = _ := (Real.exp_add _ _).symm |
| 185 | + · intro S hS hsid hk |
| 186 | + obtain ⟨S₀, h₀, hk₀⟩ := exists_subset_card_eq hk |
| 187 | + have hscale : 10 ^ 14 / tau ^ 2 ≤ Real.sqrt M := le_trans (by norm_num [tau]) hm |
| 188 | + obtain ⟨T, hT, hT₀⟩ := |
| 189 | + initial_cover (@exceptional_card_32) hscale (h₀.trans hS) (Set.IsSidon.subset hsid h₀) hk₀ |
| 190 | + have hSC : S ⊆ extension M T := fun x hx => |
| 191 | + mem_filter.mpr ⟨hS hx, Set.IsSidon.subset hsid (insert_subset hx (hT₀.trans h₀))⟩ |
| 192 | + obtain ⟨hcovers, hinside, hwidth'⟩ := fixed_leaf_size outsiders hwidth hm |
| 193 | + (filter_subset _ _) (mem_filter.mp hT).2.2 hSC hsid hk |
| 194 | + refine ⟨_, mem_filter.mpr ⟨mem_biUnion.mpr ⟨T, hT, mem_image.mpr |
| 195 | + ⟨_, mem_image.mpr ⟨S, mem_filter.mpr ⟨mem_powerset.mpr hSC, hsid⟩, rfl⟩, rfl⟩⟩, |
| 196 | + hinside.trans (filter_subset _ _), hwidth'⟩, hcovers⟩ |
| 197 | + |
| 198 | +/-- Put `y = m^(1/32) ≥ 256`. Then `log M ≤ 64y` and cubing the fingerprint |
| 199 | +rate gives `q ≤ 296/y^10`. The resulting cost per point decreases with `y`. -/ |
| 200 | +private theorem fingerprint_cost {M : ℕ} (hm : (2 : ℝ) ^ 256 ≤ Real.sqrt M) : |
| 201 | + coverLog M tau ≤ (37888 / 256 ^ 9 + 64 / 256 ^ 31) * Real.sqrt M := by |
| 202 | + let y := Real.sqrt M ^ (1 / 32 : ℝ) |
| 203 | + have hm₀ : 0 < Real.sqrt M := lt_of_lt_of_le (by norm_num) hm |
| 204 | + have hy₀ : 0 < y := Real.rpow_pos_of_pos hm₀ _ |
| 205 | + have hy32 : y ^ 32 = Real.sqrt M := by |
| 206 | + dsimp only [y] |
| 207 | + rw [← Real.rpow_mul_natCast hm₀.le] |
| 208 | + norm_num |
| 209 | + have hy : 256 ≤ y := by |
| 210 | + apply le_of_pow_le_pow_left₀ (n := 32) (by decide) hy₀.le |
| 211 | + rw [hy32] |
| 212 | + exact le_trans (by norm_num) hm |
| 213 | + have hlog : Real.log M ≤ 64 * y := by |
| 214 | + have hM : (y ^ 32) ^ 2 = (M : ℝ) := by rw [hy32, Real.sq_sqrt (Nat.cast_nonneg _)] |
| 215 | + rw [← hM, Real.log_pow, Real.log_pow] |
| 216 | + norm_num only [Nat.cast_ofNat] |
| 217 | + linarith only [Real.log_le_sub_one_of_pos hy₀] |
| 218 | + have hrate : fingerprintRate M tau ≤ 296 / y ^ 10 := by |
| 219 | + apply le_of_pow_le_pow_left₀ (n := 3) (by decide) (by positivity) |
| 220 | + have hbase : 0 ≤ 3240000 * Real.log M / (tau * Real.sqrt M) := by unfold tau; positivity |
| 221 | + calc |
| 222 | + fingerprintRate M tau ^ 3 = 3240000 * Real.log M / (tau * y ^ 32) := by |
| 223 | + unfold fingerprintRate |
| 224 | + rw [← Real.rpow_mul_natCast hbase, hy32] |
| 225 | + norm_num |
| 226 | + _ ≤ 3240000 * (64 * y) / (tau * y ^ 32) := by unfold tau; gcongr |
| 227 | + _ = (6635520000 / y) / y ^ 30 := by unfold tau; field_simp; ring |
| 228 | + _ ≤ 296 ^ 3 / y ^ 30 := by |
| 229 | + apply div_le_div_of_nonneg_right _ (by positivity) |
| 230 | + apply (div_le_iff₀ hy₀).mpr |
| 231 | + linarith only [hy] |
| 232 | + _ = (296 / y ^ 10) ^ 3 := by rw [div_pow, ← pow_mul] |
| 233 | + calc |
| 234 | + coverLog M tau ≤ (2 * (296 / y ^ 10) * y ^ 32 + 1) * (64 * y) := by |
| 235 | + unfold coverLog |
| 236 | + rw [← hy32] |
| 237 | + gcongr |
| 238 | + _ = (37888 / y ^ 9 + 64 / y ^ 31) * y ^ 32 := by field_simp; ring |
| 239 | + _ ≤ _ := by rw [← hy32]; gcongr |
| 240 | + |
| 241 | +/-- At `√M ≥ 2^256` the initial fingerprints and the recorded sets together fit in |
| 242 | +the logarithmic budget `outerRate · √M`. -/ |
| 243 | +theorem fixed_count_le {M : ℕ} (hm : (2 : ℝ) ^ 256 ≤ Real.sqrt M) : |
| 244 | + coverLog M tau + 18 / 2 ^ 48 * (5 * Real.sqrt M) * (1 - Real.log (18 / 2 ^ 48)) ≤ |
| 245 | + outerRate * Real.sqrt M := by |
| 246 | + have h18 : 4 * Real.log 2 ≤ Real.log 18 := calc |
| 247 | + _ = Real.log ((2 : ℝ) ^ (4 : ℕ)) := by rw [Real.log_pow]; norm_num |
| 248 | + _ ≤ Real.log 18 := Real.log_le_log (by norm_num) (by norm_num) |
| 249 | + have hlog : 1 - Real.log (18 / 2 ^ 48) ≤ 1 + 44 * (7 / 10 : ℝ) := by |
| 250 | + rw [Real.log_div (by norm_num) (by norm_num), Real.log_pow] |
| 251 | + have h2 : Real.log 2 ≤ 7 / 10 := Real.log_two_lt_d9.le.trans (by norm_num) |
| 252 | + linarith only [h18, h2] |
| 253 | + calc |
| 254 | + _ ≤ (37888 / 256 ^ 9 + 64 / 256 ^ 31 + 18 / 2 ^ 48 * 5 * (1 + 44 * (7 / 10))) * |
| 255 | + Real.sqrt M := by |
| 256 | + linarith only [fingerprint_cost hm, mul_le_mul_of_nonneg_left hlog |
| 257 | + (by positivity : 0 ≤ 18 / 2 ^ 48 * (5 * Real.sqrt M))] |
| 258 | + _ ≤ _ := mul_le_mul_of_nonneg_right (by norm_num [outerRate]) (Real.sqrt_nonneg _) |
| 259 | + |
| 260 | +end ErdosSwarm.Erdos530Gap75.FixedLevel |