| | @@ -1,10 +1,10 @@ |
| 1 | 1 | import ErdosSwarm.Erdos30FactorialPrimeInterval |
| 2 | | −import ErdosSwarm.Erdos530BoxSpan |
| 2 | +import ErdosSwarm.Erdos530LevelSpan |
| 3 | 3 | import ErdosSwarm.Erdos530SymbolSpace |
| 4 | 4 | import ErdosSwarm.Erdos530TripleSpan |
| 5 | 5 | |
| 6 | 6 | /-! |
| 7 | | −# A uniform Sidon bound for eight-digit boxes |
| 7 | +# Uniform Sidon bounds for eight-digit boxes and their squared-norm levels |
| 8 | 8 | |
| 9 | 9 | Sections 2–3 of `experiments/erdos530/lower-middle-energy2/box-occupancy/NOTES.md`. |
| 10 | 10 | The finite triple-span estimate retains the endpoint coefficient at finite |
| | @@ -92,21 +92,94 @@ theorem le_spanCoefficient_64 {x : ℝ} (hlo : 7 / 6 ≤ x) (hhi : x ≤ 9 / 7) |
| 92 | 92 | apply (le_div_iff₀ (by positivity)).2 |
| 93 | 93 | nlinarith only [hprod] |
| 94 | 94 | |
| 95 | | −/-- The prime and its threshold depend only on `n`. -/ |
| 96 | | −private theorem eventually_box_prime : |
| 97 | | − ∀ᶠ n : ℕ in atTop, ∃ p : ℕ, p.Prime ∧ 7 < p ∧ |
| 95 | +/-- For a squared-norm level, the right endpoint of the prime interval |
| 96 | +also gives the smallest coefficient. -/ |
| 97 | +theorem le_spanCoefficient_16 {x : ℝ} (hlo : 7 / 6 ≤ x) (hhi : x ≤ 9 / 7) : |
| 98 | + 6671 / 12105 ≤ spanCoefficient 16 x := by |
| 99 | + have hx : 0 < x := by linarith |
| 100 | + have hquad : 0 < 15248 * x ^ 2 - 8064 * x - 9415 := by |
| 101 | + nlinarith only [sq_nonneg (x - 7 / 6), hlo] |
| 102 | + have hprod := mul_nonneg (by linarith : 0 ≤ 9 - 7 * x) hquad.le |
| 103 | + unfold spanCoefficient |
| 104 | + apply (le_div_iff₀ (by positivity)).2 |
| 105 | + nlinarith only [hprod] |
| 106 | + |
| 107 | +/-- The same interval supplies a prime above any fixed cutoff for all |
| 108 | +sufficiently large cardinalities. -/ |
| 109 | +private theorem eventually_box_prime (cutoff : ℕ) : |
| 110 | + ∀ᶠ n : ℕ in atTop, ∃ p : ℕ, p.Prime ∧ cutoff < p ∧ |
| 98 | 111 | 7 / 6 ≤ (p : ℝ) / Real.sqrt n ∧ (p : ℝ) / Real.sqrt n ≤ 9 / 7 := by |
| 99 | 112 | have hs : Tendsto (fun n : ℕ => Real.sqrt n) atTop atTop := |
| 100 | 113 | Real.tendsto_sqrt_atTop.comp tendsto_natCast_atTop_atTop |
| 101 | 114 | have hy := hs.const_mul_atTop (by norm_num : (0 : ℝ) < 9 / 7) |
| 102 | 115 | filter_upwards [hy.eventually Erdos30.eventually_exists_prime_457_div_500, |
| 103 | | − hs.eventually_ge_atTop 8] with n ⟨p, hp, hlo, hhi⟩ hs8 |
| 116 | + hs.eventually_ge_atTop ((cutoff : ℝ) + 1)] with n ⟨p, hp, hlo, hhi⟩ hcut |
| 104 | 117 | change 457 / 500 * (9 / 7 * Real.sqrt n) < (p : ℝ) at hlo |
| 105 | 118 | change (p : ℝ) ≤ 9 / 7 * Real.sqrt n at hhi |
| 106 | | − change 8 ≤ Real.sqrt n at hs8 |
| 119 | + change (cutoff : ℝ) + 1 ≤ Real.sqrt n at hcut |
| 120 | + have hcutoff : 0 ≤ (cutoff : ℝ) := Nat.cast_nonneg _ |
| 107 | 121 | have hspos : 0 < Real.sqrt n := by linarith |
| 108 | 122 | refine ⟨p, hp, ?_, (le_div_iff₀ hspos).2 (by linarith), (div_le_iff₀ hspos).2 hhi⟩ |
| 109 | | − exact_mod_cast (by linarith : (7 : ℝ) < p) |
| 123 | + exact_mod_cast (by linarith : (cutoff : ℝ) < p) |
| 124 | + |
| 125 | +section Reduction |
| 126 | + |
| 127 | +open scoped Classical |
| 128 | +variable {α : Type*} {A : Finset α} {r p : ℕ} |
| 129 | + |
| 130 | +/-- Reduction of the digit labels, extended to the ambient type for (1). -/ |
| 131 | +private noncomputable def modDigits (p : ℕ) (f : A → Fin r → ℤ) (a : α) (i : Fin r) : ZMod p := |
| 132 | + if ha : a ∈ A then (f ⟨a, ha⟩ i : ZMod p) else 0 |
| 133 | + |
| 134 | +private theorem modDigits_val [Fact p.Prime] (hp : 7 < p) {f : A → Fin r → ℤ} |
| 135 | + (hbox : ∀ a i, 0 ≤ f a i ∧ f a i ≤ 7) (a : A) (i : Fin r) : |
| 136 | + ((modDigits p f a i).val : ℤ) = f a i := by |
| 137 | + rw [modDigits, dif_pos a.property, ZMod.val_intCast, |
| 138 | + Int.emod_eq_of_lt (hbox a i).1 (by have := (hbox a i).2; omega)] |
| 139 | + |
| 140 | +private theorem modDigits_box [Fact p.Prime] (hp : 7 < p) {f : A → Fin r → ℤ} |
| 141 | + (hbox : ∀ a i, 0 ≤ f a i ∧ f a i ≤ 7) : |
| 142 | + ∀ x ∈ A.image (modDigits p f), ∀ i, (x i).val < 8 := by |
| 143 | + intro x hx i |
| 144 | + obtain ⟨a, ha, rfl⟩ := mem_image.mp hx |
| 145 | + exact_mod_cast (modDigits_val hp hbox ⟨a, ha⟩ i).trans_lt |
| 146 | + ((hbox ⟨a, ha⟩ i).2.trans_lt (by decide : (7 : ℤ) < 8)) |
| 147 | + |
| 148 | +/-- Transfer any triple-span cap for the reduced labels to the source, |
| 149 | +keeping the finite correction in (1). -/ |
| 150 | +private theorem exists_sidon_subset_of_modDigits_span [AddCommMonoid α] [Fact p.Prime] |
| 151 | + (hp : 7 < p) (hn : 3 ≤ A.card) (f : A → Fin r → ℤ) (hinj : Function.Injective f) |
| 152 | + (hbox : ∀ a i, 0 ≤ f a i ∧ f a i ≤ 7) (hsums : Erdos530SymbolSpace.PreservesSums A f) |
| 153 | + {M c : ℝ} (hM : 2 ≤ M) (hlo : 7 / 6 ≤ (p : ℝ) / Real.sqrt A.card) |
| 154 | + (hc : c ≤ spanCoefficient M ((p : ℝ) / Real.sqrt A.card)) |
| 155 | + (hcap : ∀ T ∈ (A.image (modDigits p f)).powersetCard 3, |
| 156 | + (Erdos530ProjectionMoments.spanCount (ZMod p) (A.image (modDigits p f)) T : ℝ) ≤ M) : |
| 157 | + ∃ S ⊆ A, IsSidon (S : Set α) ∧ c * Real.sqrt A.card ≤ S.card := by |
| 158 | + have hginj : Set.InjOn (modDigits p f) (A : Set α) := by |
| 159 | + intro a ha b hb hab |
| 160 | + have heq : f ⟨a, ha⟩ = f ⟨b, hb⟩ := by |
| 161 | + funext i |
| 162 | + rw [← modDigits_val hp hbox ⟨a, ha⟩ i, ← modDigits_val hp hbox ⟨b, hb⟩ i] |
| 163 | + exact congrArg (fun z : ZMod p => (z.val : ℤ)) (congrFun hab i) |
| 164 | + exact congrArg Subtype.val (hinj heq) |
| 165 | + obtain ⟨S, hSA, hS, hbound⟩ := |
| 166 | + Erdos530TripleSpan.exists_sidon_subset_of_triple_span_bound (p := p) (by omega) |
| 167 | + A hn (modDigits p f) hginj (by |
| 168 | + intro a ha b hb c hc d hd habcd |
| 169 | + funext i |
| 170 | + have h := congrFun (hsums ⟨a, ha⟩ ⟨b, hb⟩ ⟨c, hc⟩ ⟨d, hd⟩ habcd) i |
| 171 | + simpa only [Pi.add_apply, modDigits, dif_pos ha, dif_pos hb, dif_pos hc, dif_pos hd, |
| 172 | + Int.cast_add] using congrArg (fun z : ℤ => (z : ZMod p)) h) M hcap |
| 173 | + let x := (p : ℝ) / Real.sqrt A.card |
| 174 | + have hxlo : 7 / 6 ≤ x := hlo |
| 175 | + have hs : 0 < Real.sqrt A.card := Real.sqrt_pos.2 (by exact_mod_cast (by omega : 0 < A.card)) |
| 176 | + have hpx : (p : ℝ) = x * Real.sqrt A.card := (div_mul_cancel₀ _ hs.ne').symm |
| 177 | + have hx2 : 1 ≤ x ^ 2 := by nlinarith only [hxlo, sq_nonneg (x - 1)] |
| 178 | + refine ⟨S, hSA, hS, (mul_le_mul_of_nonneg_right hc hs.le).trans ?_⟩ |
| 179 | + exact spanCoefficient_mul_sqrt_le_of_finite_bound hn (by linarith) hpx |
| 180 | + (hM.trans (le_mul_of_one_le_right (by linarith) hx2)) hbound |
| 181 | + |
| 182 | +end Reduction |
| 110 | 183 | |
| 111 | 184 | universe u |
| 112 | 185 | |
| | @@ -118,48 +191,40 @@ theorem exists_threshold_sidon_subset_of_eight_digit_box : |
| 118 | 191 | (A : Finset α), A.card = n → ∀ f : A → Fin r → ℤ, Function.Injective f → |
| 119 | 192 | (∀ a i, 0 ≤ f a i ∧ f a i ≤ 7) → Erdos530SymbolSpace.PreservesSums A f → |
| 120 | 193 | ∃ S ⊆ A, IsSidon (S : Set α) ∧ (25655 / 47097 : ℝ) * Real.sqrt n ≤ S.card := by |
| 121 | | − classical |
| 122 | | − obtain ⟨n₀, h₀⟩ := eventually_atTop.mp (eventually_box_prime.and (eventually_ge_atTop 3)) |
| 194 | + obtain ⟨n₀, h₀⟩ := eventually_atTop.mp ((eventually_box_prime 7).and (eventually_ge_atTop 3)) |
| 123 | 195 | refine ⟨n₀, ?_⟩ |
| 124 | | − intro n hn α _ r A hA f hinj hbox hsums |
| 125 | | − obtain ⟨⟨p, hp, hp7, hlo, hhi⟩, hn3⟩ := h₀ n hn |
| 196 | + rintro n hn α _ r A rfl f hinj hbox hsums |
| 197 | + obtain ⟨⟨p, hp, hp7, hlo, hhi⟩, hn3⟩ := h₀ _ hn |
| 126 | 198 | let : Fact p.Prime := ⟨hp⟩ |
| 127 | | − let g (a : α) (i : Fin r) : ZMod p := if ha : a ∈ A then (f ⟨a, ha⟩ i : ZMod p) else 0 |
| 128 | | − have hg (a : A) (i : Fin r) : g a i = (f a i : ZMod p) := dif_pos a.property |
| 129 | | − have hval (a : A) (i : Fin r) : ((g a i).val : ℤ) = f a i := by |
| 130 | | − rw [hg, ZMod.val_intCast, Int.emod_eq_of_lt (hbox a i).1 (by have := (hbox a i).2; omega)] |
| 131 | | − have hginj : Set.InjOn g (A : Set α) := by |
| 132 | | − intro a ha b hb hab |
| 133 | | − have heq : f ⟨a, ha⟩ = f ⟨b, hb⟩ := by |
| 134 | | − funext i |
| 135 | | − rw [← hval ⟨a, ha⟩ i, ← hval ⟨b, hb⟩ i] |
| 136 | | − exact congrArg (fun z : ZMod p => (z.val : ℤ)) (congrFun hab i) |
| 137 | | − exact congrArg Subtype.val (hinj heq) |
| 138 | | − have hboxg : ∀ x ∈ A.image g, ∀ i, (x i).val < 8 := by |
| 139 | | − intro x hx i |
| 199 | + apply exists_sidon_subset_of_modDigits_span hp7 hn3 f hinj hbox hsums |
| 200 | + (by norm_num : (2 : ℝ) ≤ 64) hlo (le_spanCoefficient_64 hlo hhi) |
| 201 | + intro T hT |
| 202 | + exact_mod_cast Erdos530BoxSpan.spanCount_le_64_of_digit_box (modDigits_box hp7 hbox) hT |
| 203 | + |
| 204 | +/-- On a single integer squared-norm level, the cap of 16 gives a Sidon |
| 205 | +subset of size at least `(6671/12105) √n`. The threshold is uniform in the |
| 206 | +source, dimension, digit map and level. -/ |
| 207 | +theorem exists_threshold_sidon_subset_of_eight_digit_level : |
| 208 | + ∃ n₀ : ℕ, ∀ n ≥ n₀, ∀ {α : Type u} [AddCommMonoid α] {r : ℕ} |
| 209 | + (A : Finset α), A.card = n → ∀ f : A → Fin r → ℤ, Function.Injective f → |
| 210 | + (∀ a i, 0 ≤ f a i ∧ f a i ≤ 7) → Erdos530SymbolSpace.PreservesSums A f → |
| 211 | + ∀ {t : ℤ}, (∀ a, ∑ i, f a i ^ 2 = t) → |
| 212 | + ∃ S ⊆ A, IsSidon (S : Set α) ∧ (6671 / 12105 : ℝ) * Real.sqrt n ≤ S.card := by |
| 213 | + obtain ⟨n₀, h₀⟩ := eventually_atTop.mp ((eventually_box_prime 98).and (eventually_ge_atTop 3)) |
| 214 | + refine ⟨n₀, ?_⟩ |
| 215 | + rintro n hn α _ r A rfl f hinj hbox hsums t hlevel |
| 216 | + obtain ⟨⟨p, hp, hp98, hlo, hhi⟩, hn3⟩ := h₀ _ hn |
| 217 | + let : Fact p.Prime := ⟨hp⟩ |
| 218 | + have hp7 : 7 < p := by omega |
| 219 | + apply exists_sidon_subset_of_modDigits_span hp7 hn3 f hinj hbox hsums |
| 220 | + (by norm_num : (2 : ℝ) ≤ 16) hlo (le_spanCoefficient_16 hlo hhi) |
| 221 | + intro T hT |
| 222 | + have hnorm (x) (hx : x ∈ A.image (modDigits p f)) : ∑ i, (x i).val ^ 2 = t.toNat := by |
| 140 | 223 | obtain ⟨a, ha, rfl⟩ := mem_image.mp hx |
| 141 | | − have hv : ((g a i).val : ℤ) = f ⟨a, ha⟩ i := hval ⟨a, ha⟩ i |
| 142 | | − exact_mod_cast hv.trans_lt ((hbox ⟨a, ha⟩ i).2.trans_lt (by decide : (7 : ℤ) < 8)) |
| 143 | | − obtain ⟨S, hSA, hS, hbound⟩ := |
| 144 | | − Erdos530TripleSpan.exists_sidon_subset_of_triple_span_bound (p := p) (by omega) |
| 145 | | − A (hA ▸ hn3) g hginj (by |
| 146 | | − intro a ha b hb c hc d hd habcd |
| 147 | | − funext i |
| 148 | | − have h := congrFun (hsums ⟨a, ha⟩ ⟨b, hb⟩ ⟨c, hc⟩ ⟨d, hd⟩ habcd) i |
| 149 | | − simpa only [Pi.add_apply, g, dif_pos ha, dif_pos hb, dif_pos hc, dif_pos hd, Int.cast_add] |
| 150 | | − using congrArg (fun z : ℤ => (z : ZMod p)) h) 64 (by |
| 151 | | − intro T hT |
| 152 | | − exact_mod_cast Erdos530BoxSpan.spanCount_le_64_of_digit_box hboxg hT) |
| 153 | | − rw [hA] at hbound |
| 154 | | − let x := (p : ℝ) / Real.sqrt n |
| 155 | | − have hxlo : 7 / 6 ≤ x := hlo |
| 156 | | − have hs : 0 < Real.sqrt n := Real.sqrt_pos.2 (by exact_mod_cast (by omega : 0 < n)) |
| 157 | | − have hpx : (p : ℝ) = x * Real.sqrt n := (div_mul_cancel₀ _ hs.ne').symm |
| 158 | | − refine ⟨S, hSA, hS, ?_⟩ |
| 159 | | − calc |
| 160 | | − (25655 / 47097 : ℝ) * Real.sqrt n ≤ spanCoefficient 64 x * Real.sqrt n := |
| 161 | | − mul_le_mul_of_nonneg_right (le_spanCoefficient_64 hlo hhi) hs.le |
| 162 | | − _ ≤ S.card := spanCoefficient_mul_sqrt_le_of_finite_bound hn3 (by linarith) hpx |
| 163 | | − (by nlinarith only [hxlo, sq_nonneg (x - 1)]) hbound |
| 224 | + have h : ((∑ i, (modDigits p f a i).val ^ 2 : ℕ) : ℤ) = t := by |
| 225 | + simpa only [Nat.cast_sum, Nat.cast_pow, modDigits_val hp7 hbox ⟨a, ha⟩] using hlevel ⟨a, ha⟩ |
| 226 | + exact congrArg Int.toNat h |
| 227 | + exact_mod_cast Erdos530LevelSpan.spanCount_le_16_of_digit_level hp98 |
| 228 | + (modDigits_box hp7 hbox) hnorm hT |
| 164 | 229 | |
| 165 | 230 | end ErdosSwarm.Erdos530BoxOccupancy |