| | @@ -0,0 +1,141 @@ |
| 1 | +import ErdosSwarm.Erdos530SymbolSpace |
| 2 | +import Mathlib.Analysis.Real.Sqrt |
| 3 | +import Mathlib.Analysis.SpecificLimits.Basic |
| 4 | +import Mathlib.Data.Nat.Choose.Cast |
| 5 | +import Mathlib.Tactic.LinearCombination |
| 6 | +import Mathlib.Tactic.NormNum.RealSqrt |
| 7 | + |
| 8 | +/-! |
| 9 | +# Asymptotic Sidon bounds from modular classes |
| 10 | + |
| 11 | +Section 4 of `experiments/erdos530/lower-middle-energy/NOTES.md` applies the modular |
| 12 | +separation criterion of the October 2026 sidon-palomar report (Proposition 7.2) to a |
| 13 | +restriction of a finite real set. If the input has size `N`, the odd prime satisfies |
| 14 | +`p / √N → t > 0`, and the restriction retains at least `(ρ - o(1)) N` distinct symbols, |
| 15 | +inequality (8) gives every coefficient below `ρ/t - ρ²/(2t³)` for the size of a Sidon |
| 16 | +subset on the scale `√N`. The two prime scales in §4 give its optimized and fixed-scale gains. |
| 17 | +The structural implication from popular differences to a fixed gain remains open. |
| 18 | +-/ |
| 19 | + |
| 20 | +namespace ErdosSwarm.Erdos530SymbolAsymptotic |
| 21 | + |
| 22 | +open Filter Erdos530SymbolSpace |
| 23 | +open scoped Topology |
| 24 | + |
| 25 | +private theorem tendsto_capped_density {N d : ℕ → ℕ} {ρ : ℝ} (hρ : 0 ≤ ρ) |
| 26 | + (hN : Tendsto N atTop atTop) |
| 27 | + (hd : ∀ r < ρ, ∀ᶠ n in atTop, r ≤ (d n : ℝ) / N n) : |
| 28 | + Tendsto (fun n => ((min (d n) ⌊ρ * N n⌋₊ : ℕ) : ℝ) / N n) atTop (𝓝 ρ) := by |
| 29 | + have hfloor : Tendsto (fun n => (⌊ρ * N n⌋₊ : ℝ) / N n) atTop (𝓝 ρ) := |
| 30 | + (tendsto_nat_floor_mul_div_atTop hρ).comp (tendsto_natCast_atTop_atTop.comp hN) |
| 31 | + apply tendsto_order.mpr |
| 32 | + constructor |
| 33 | + · intro r hr |
| 34 | + obtain ⟨s, hrs, hsρ⟩ := exists_between hr |
| 35 | + filter_upwards [hd s hsρ, hfloor.eventually_const_lt hr] with n hdn hfn |
| 36 | + rw [Nat.cast_min, ← min_div_div_right (Nat.cast_nonneg _)] |
| 37 | + exact lt_min (hrs.trans_le hdn) hfn |
| 38 | + · intro r hr |
| 39 | + filter_upwards [hfloor.eventually_lt_const hr] with n hfn |
| 40 | + rw [Nat.cast_min, ← min_div_div_right (Nat.cast_nonneg _)] |
| 41 | + exact (min_le_right _ _).trans_lt hfn |
| 42 | + |
| 43 | +private theorem scaled_coefficient_le {N p h : ℕ} (hN : 0 < N) (hp : 0 < p) : |
| 44 | + ((h : ℝ) / N / (p / Real.sqrt N) - |
| 45 | + ((h : ℝ) / N) ^ 2 / (2 * ((p : ℝ) / Real.sqrt N) ^ 3)) * Real.sqrt N ≤ |
| 46 | + ((h : ℝ) - (h.choose 2 : ℝ) / (p : ℝ) ^ 2) / p := by |
| 47 | + set s := Real.sqrt N |
| 48 | + have hs : 0 < s := Real.sqrt_pos.mpr (by exact_mod_cast hN) |
| 49 | + have hs2 : s ^ 2 = N := Real.sq_sqrt (Nat.cast_nonneg N) |
| 50 | + have hp' : 0 < (p : ℝ) := by exact_mod_cast hp |
| 51 | + have hchoose : (h.choose 2 : ℝ) ≤ (h : ℝ) ^ 2 / 2 := by |
| 52 | + rw [Nat.cast_choose_two] |
| 53 | + nlinarith [Nat.cast_nonneg (α := ℝ) h] |
| 54 | + calc |
| 55 | + _ = ((h : ℝ) - ((h : ℝ) ^ 2 / 2) / (p : ℝ) ^ 2) / p := by |
| 56 | + rw [← hs2] |
| 57 | + field_simp |
| 58 | + _ ≤ _ := by gcongr |
| 59 | + |
| 60 | +variable {A B : ℕ → Finset ℝ} {p : ℕ → ℕ} [∀ n, Fact (p n).Prime] |
| 61 | + (hBA : ∀ n, B n ⊆ A n) (hodd : ∀ n, p n ≠ 2) |
| 62 | + (hN : Tendsto (fun n => (A n).card) atTop atTop) |
| 63 | + |
| 64 | +include hBA hodd hN in |
| 65 | +/-- The asymptotic form of (8) for a prime sequence of any positive limiting scale `t`. |
| 66 | +The density hypothesis allows the fraction of distinct symbols to oscillate above `ρ`. -/ |
| 67 | +theorem eventually_exists_sidon_of_class_density {ρ t : ℝ} (hρ : 0 ≤ ρ) (ht : 0 < t) |
| 68 | + (hp : Tendsto (fun n => (p n : ℝ) / Real.sqrt (A n).card) atTop (𝓝 t)) |
| 69 | + (hd : ∀ r < ρ, ∀ᶠ n in atTop, r ≤ (classCount (ZMod (p n)) (B n) : ℝ) / (A n).card) |
| 70 | + (c : ℝ) (hc : c < ρ / t - ρ ^ 2 / (2 * t ^ 3)) : |
| 71 | + ∀ᶠ n in atTop, ∃ S ⊆ A n, IsSidon (S : Set ℝ) ∧ c * Real.sqrt (A n).card ≤ S.card := by |
| 72 | + let h (n : ℕ) := min (classCount (ZMod (p n)) (B n)) ⌊ρ * (A n).card⌋₊ |
| 73 | + have hh : Tendsto (fun n => (h n : ℝ) / (A n).card) atTop (𝓝 ρ) := |
| 74 | + tendsto_capped_density hρ hN hd |
| 75 | + have hlim := (hh.div hp ht.ne').sub |
| 76 | + ((hh.pow 2).div (tendsto_const_nhds.mul (hp.pow 3)) (by positivity : (2 : ℝ) * t ^ 3 ≠ 0)) |
| 77 | + filter_upwards [hlim.eventually_const_lt hc, hN.eventually_gt_atTop 0] with n hn hNn |
| 78 | + obtain ⟨S, hSA, hS, hcard⟩ := exists_sidon_subset_real_of_classCount (hodd n) |
| 79 | + (A n) (B n) (hBA n) (h n) (min_le_left _ _) |
| 80 | + refine ⟨S, hSA, hS, ?_⟩ |
| 81 | + exact (mul_le_mul_of_nonneg_right hn.le (Real.sqrt_nonneg _)).trans |
| 82 | + ((scaled_coefficient_le hNn (Fact.out : (p n).Prime).pos).trans hcard) |
| 83 | + |
| 84 | +private theorem coefficient_at_optimum {ρ : ℝ} (hρ : 0 < ρ) : |
| 85 | + ρ / Real.sqrt (3 * ρ / 2) - ρ ^ 2 / (2 * Real.sqrt (3 * ρ / 2) ^ 3) = |
| 86 | + 2 / (3 * Real.sqrt 3) * Real.sqrt (2 * ρ) := by |
| 87 | + set t := Real.sqrt (3 * ρ / 2) |
| 88 | + have ht : 0 < t := Real.sqrt_pos.mpr (by positivity) |
| 89 | + have ht2 : t ^ 2 = 3 * ρ / 2 := Real.sq_sqrt (by positivity) |
| 90 | + have hz : (0 : ℝ) < Real.sqrt 3 := by positivity |
| 91 | + have hz2 : Real.sqrt 3 ^ 2 = 3 := Real.sq_sqrt (by norm_num) |
| 92 | + have hprod : Real.sqrt 3 * Real.sqrt (2 * ρ) = 2 * t := by |
| 93 | + rw [← Real.sqrt_mul (by norm_num : (0 : ℝ) ≤ 3)] |
| 94 | + change Real.sqrt (3 * (2 * ρ)) = 2 * Real.sqrt (3 * ρ / 2) |
| 95 | + rw [show 3 * (2 * ρ) = 4 * (3 * ρ / 2) by ring, Real.sqrt_mul (by norm_num : (0 : ℝ) ≤ 4)] |
| 96 | + norm_num |
| 97 | + calc |
| 98 | + ρ / t - ρ ^ 2 / (2 * t ^ 3) = 4 / 9 * t := by |
| 99 | + rw [show ρ = (2 / 3) * t ^ 2 by linarith only [ht2]] |
| 100 | + field_simp |
| 101 | + ring |
| 102 | + _ = _ := by |
| 103 | + field_simp |
| 104 | + linear_combination 6 * Real.sqrt 3 * (-hprod) + 6 * Real.sqrt (2 * ρ) * hz2 |
| 105 | + |
| 106 | +include hBA hodd hN in |
| 107 | +/-- At `p / √N → √(3ρ/2)`, a restriction retaining `(ρ - o(1)) N` symbols gives every |
| 108 | +coefficient below `(2/(3√3))√(2ρ)`, which exceeds the universal coefficient for `ρ > 1/2`. -/ |
| 109 | +theorem eventually_exists_sidon_at_optimal_scale {ρ : ℝ} (hρ : 0 < ρ) |
| 110 | + (hp : Tendsto (fun n => (p n : ℝ) / Real.sqrt (A n).card) atTop (𝓝 (Real.sqrt (3 * ρ / 2)))) |
| 111 | + (hd : ∀ r < ρ, ∀ᶠ n in atTop, r ≤ (classCount (ZMod (p n)) (B n) : ℝ) / (A n).card) |
| 112 | + (c : ℝ) (hc : c < 2 / (3 * Real.sqrt 3) * Real.sqrt (2 * ρ)) : |
| 113 | + ∀ᶠ n in atTop, ∃ S ⊆ A n, IsSidon (S : Set ℝ) ∧ c * Real.sqrt (A n).card ≤ S.card := by |
| 114 | + apply eventually_exists_sidon_of_class_density hBA hodd hN hρ.le (Real.sqrt_pos.mpr (by positivity)) |
| 115 | + hp hd c |
| 116 | + rwa [coefficient_at_optimum hρ] |
| 117 | + |
| 118 | +private theorem coefficient_at_fixed_scale (ε : ℝ) : |
| 119 | + (1/2 + ε) / Real.sqrt (3/4) - (1/2 + ε) ^ 2 / (2 * Real.sqrt (3/4) ^ 3) = |
| 120 | + 2 / (3 * Real.sqrt 3) * (1 + ε - 2 * ε ^ 2) := by |
| 121 | + rw [Real.sqrt_div (by norm_num : (0 : ℝ) ≤ 3), show Real.sqrt 4 = 2 by norm_num] |
| 122 | + have hz := Real.sq_sqrt (by norm_num : (0 : ℝ) ≤ 3) |
| 123 | + field_simp |
| 124 | + ring_nf |
| 125 | + norm_num [hz] |
| 126 | + ring |
| 127 | + |
| 128 | +include hBA hodd hN in |
| 129 | +/-- At the single scale `p / √N → √(3/4)`, a class density of at least |
| 130 | +`1/2 + ε - o(1)` gives every coefficient below `(2/(3√3))(1+ε-2ε²)`. -/ |
| 131 | +theorem eventually_exists_sidon_at_fixed_scale {ε : ℝ} (hε : 0 < ε) |
| 132 | + (hp : Tendsto (fun n => (p n : ℝ) / Real.sqrt (A n).card) atTop (𝓝 (Real.sqrt (3 / 4)))) |
| 133 | + (hd : ∀ r < 1/2 + ε, ∀ᶠ n in atTop, |
| 134 | + r ≤ (classCount (ZMod (p n)) (B n) : ℝ) / (A n).card) |
| 135 | + (c : ℝ) (hc : c < 2 / (3 * Real.sqrt 3) * (1 + ε - 2 * ε ^ 2)) : |
| 136 | + ∀ᶠ n in atTop, ∃ S ⊆ A n, IsSidon (S : Set ℝ) ∧ c * Real.sqrt (A n).card ≤ S.card := by |
| 137 | + apply eventually_exists_sidon_of_class_density hBA hodd hN (by positivity : 0 ≤ 1/2 + ε) |
| 138 | + (Real.sqrt_pos.mpr (by norm_num)) hp hd c |
| 139 | + rwa [coefficient_at_fixed_scale] |
| 140 | + |
| 141 | +end ErdosSwarm.Erdos530SymbolAsymptotic |