| | @@ -0,0 +1,300 @@ |
| 1 | +import ErdosSwarm.Erdos530IntegerKernel |
| 2 | +import ErdosSwarm.Erdos530RowAsymptotic |
| 3 | + |
| 4 | +/-! |
| 5 | +# Rows in Erdős problem 530: the row estimates for real row labels |
| 6 | + |
| 7 | +Last step of Theorem 2 in `experiments/erdos530/lower-middle-energy/NOTES.md`, §2: the |
| 8 | +asymptotic row estimates, Lean-checked in `Erdos530RowAsymptotic` for integer row labels of |
| 9 | +differences at most `D` with `k log D = o(√(kL))`, hold for arbitrary real row labels when |
| 10 | +`k³ = o(L)`. The real labels are replaced by the integer model of `Erdos530IntegerKernel`, of |
| 11 | +diameter `D ≤ 2 k² C(k,2) 4^k`, so that `log D ≤ 6 k` and `k log D / √(kL) ≤ 6 √(k³/L)`. |
| 12 | + |
| 13 | +* `exists_int_relabel`: a finite set `X` of reals has a map `g : ℝ → ℤ`, injective on `X`, with |
| 14 | + `g a + g b = g c + g d` whenever `a + b = c + d` in `X`, and of diameter at most |
| 15 | + `intModelDiam |X|` on `X`. |
| 16 | +* `log_intModelDiam_le`: `log (intModelDiam k) ≤ 6 k`. |
| 17 | +* `exists_int_rows_of_real_rows`: the transfer of the hypotheses of the row estimates. |
| 18 | +* `eventually_sidon_real_rows_chebyshev`: display (4′) for real row labels, with no unproved |
| 19 | + input: coefficient `6 √14 / 49 · √σ` when `k ≥ 2`, `kL → ∞`, `k³/L → 0`, `N ≥ σ k L`. |
| 20 | +* `eventually_sidon_real_rows_of_short_windows`: the asymptotic (4) for real row labels, with |
| 21 | + coefficient `2 √6 / 9 · √σ = c₀ √(2σ)`, conditional on the explicit hypothesis `hprimes` on |
| 22 | + primes in short windows (a consequence of the prime number theorem, which is NOT proved in |
| 23 | + this repository). |
| 24 | +* `eventually_sidon_real_prod_rows`: the instance `B n ⊆ ℝ × ℕ` with the two coordinates as row |
| 25 | + label and offset. |
| 26 | +* `eventually_sidon_sqrt_two_rows`: the concrete family of the `n + 2` labels `i √2` with |
| 27 | + `(n + 2)^4` offsets each. |
| 28 | +-/ |
| 29 | + |
| 30 | +namespace ErdosSwarm.Erdos530RealRows |
| 31 | + |
| 32 | +open Finset Chebyshev Filter Topology |
| 33 | +open ErdosSwarm.Erdos530RowAsymptotic |
| 34 | + |
| 35 | +/-- The diameter bound of the integer model of `k` real labels: `2 k² C(k,2) 4^k`. -/ |
| 36 | +def intModelDiam (k : ℕ) : ℕ := 2 * k ^ 2 * k.choose 2 * 4 ^ k |
| 37 | + |
| 38 | +/-- **Integer relabelling of a finite set of reals.** There is a map `g : ℝ → ℤ` that is |
| 39 | +injective on `X`, preserves the equal pair sums of `X`, and has diameter at most |
| 40 | +`intModelDiam |X|` on `X`. -/ |
| 41 | +theorem exists_int_relabel (X : Finset ℝ) : |
| 42 | + ∃ g : ℝ → ℤ, Set.InjOn g X ∧ |
| 43 | + (∀ a ∈ X, ∀ b ∈ X, ∀ c ∈ X, ∀ d ∈ X, a + b = c + d → g a + g b = g c + g d) ∧ |
| 44 | + (∀ a ∈ X, ∀ b ∈ X, g b - g a ≤ (intModelDiam X.card : ℤ)) := by |
| 45 | + classical |
| 46 | + obtain ⟨y, h1, h2, h3⟩ := |
| 47 | + Erdos530IntegerKernel.exists_int_model_of_real_labels (ι := X) (fun a => (a : ℝ)) |
| 48 | + refine ⟨fun r => if h : r ∈ X then y ⟨r, h⟩ else 0, ?_, ?_, ?_⟩ |
| 49 | + · intro a ha b hb hab |
| 50 | + have ha' : a ∈ X := ha |
| 51 | + have hb' : b ∈ X := hb |
| 52 | + simp only [dif_pos ha', dif_pos hb'] at hab |
| 53 | + by_contra hne |
| 54 | + exact h1 ⟨a, ha'⟩ ⟨b, hb'⟩ hne hab |
| 55 | + · intro a ha b hb c hc d hd h |
| 56 | + simp only [dif_pos ha, dif_pos hb, dif_pos hc, dif_pos hd] |
| 57 | + exact h2 ⟨a, ha⟩ ⟨b, hb⟩ ⟨c, hc⟩ ⟨d, hd⟩ h |
| 58 | + · intro a ha b hb |
| 59 | + simp only [dif_pos ha, dif_pos hb] |
| 60 | + have h := h3 ⟨a, ha⟩ ⟨b, hb⟩ |
| 61 | + rw [Fintype.card_coe] at h |
| 62 | + exact h |
| 63 | + |
| 64 | +/-- `intModelDiam k ≤ k⁴ 4^k`. -/ |
| 65 | +theorem intModelDiam_le (k : ℕ) : intModelDiam k ≤ k ^ 4 * 4 ^ k := by |
| 66 | + have h : 2 * k.choose 2 ≤ k ^ 2 := by |
| 67 | + rw [Nat.choose_two_right] |
| 68 | + calc 2 * (k * (k - 1) / 2) ≤ k * (k - 1) := Nat.mul_div_le _ _ |
| 69 | + _ ≤ k * k := Nat.mul_le_mul_left _ (Nat.sub_le _ _) |
| 70 | + _ = k ^ 2 := by ring |
| 71 | + calc intModelDiam k = k ^ 2 * (2 * k.choose 2) * 4 ^ k := by unfold intModelDiam; ring |
| 72 | + _ ≤ k ^ 2 * k ^ 2 * 4 ^ k := by gcongr |
| 73 | + _ = k ^ 4 * 4 ^ k := by ring |
| 74 | + |
| 75 | +/-- `log (intModelDiam k) ≤ 6 k`. -/ |
| 76 | +theorem log_intModelDiam_le (k : ℕ) : Real.log (intModelDiam k) ≤ 6 * k := by |
| 77 | + rcases Nat.eq_zero_or_pos (intModelDiam k) with h0 | hpos |
| 78 | + · rw [h0] |
| 79 | + simp |
| 80 | + have hk : 0 < k := by |
| 81 | + rcases Nat.eq_zero_or_pos k with hk | hk |
| 82 | + · rw [hk] at hpos |
| 83 | + simp [intModelDiam] at hpos |
| 84 | + · exact hk |
| 85 | + have hkR : (0 : ℝ) < k := by exact_mod_cast hk |
| 86 | + have hle : (intModelDiam k : ℝ) ≤ (k : ℝ) ^ 4 * 4 ^ k := by exact_mod_cast intModelDiam_le k |
| 87 | + have hlogk : Real.log k ≤ k := (Real.log_le_sub_one_of_pos hkR).trans (by linarith) |
| 88 | + have hlog4 : Real.log 4 ≤ 2 := by |
| 89 | + have h2 : Real.log 2 ≤ 1 := (Real.log_le_sub_one_of_pos (by norm_num)).trans (by norm_num) |
| 90 | + have h4 : Real.log 4 = 2 * Real.log 2 := by |
| 91 | + rw [show (4 : ℝ) = 2 ^ 2 by norm_num, Real.log_pow] |
| 92 | + norm_num |
| 93 | + linarith |
| 94 | + calc Real.log (intModelDiam k) ≤ Real.log ((k : ℝ) ^ 4 * 4 ^ k) := |
| 95 | + Real.log_le_log (by exact_mod_cast hpos) hle |
| 96 | + _ = 4 * Real.log k + k * Real.log 4 := by |
| 97 | + rw [Real.log_mul (by positivity) (by positivity), Real.log_pow, Real.log_pow] |
| 98 | + norm_num |
| 99 | + _ ≤ 4 * k + k * 2 := by |
| 100 | + have := mul_le_mul_of_nonneg_left hlog4 hkR.le |
| 101 | + linarith |
| 102 | + _ = 6 * k := by ring |
| 103 | + |
| 104 | +/-- `k log D / √(kL) ≤ 6 √(k³/L)` for `D = intModelDiam k`. -/ |
| 105 | +theorem mul_log_intModelDiam_div_le (k L : ℕ) : |
| 106 | + (k : ℝ) * Real.log (intModelDiam k) / √((k : ℝ) * L) ≤ 6 * √((k : ℝ) ^ 3 / L) := by |
| 107 | + rcases Nat.eq_zero_or_pos k with hk | hk |
| 108 | + · simp [hk] |
| 109 | + rcases Nat.eq_zero_or_pos L with hL | hL |
| 110 | + · simp [hL] |
| 111 | + have hkR : (0 : ℝ) < k := by exact_mod_cast hk |
| 112 | + have hLR : (0 : ℝ) < L := by exact_mod_cast hL |
| 113 | + have hs : 0 < √((k : ℝ) * L) := Real.sqrt_pos.mpr (by positivity) |
| 114 | + have e : √((k : ℝ) ^ 3 / L) = (k : ℝ) ^ 2 / √((k : ℝ) * L) := by |
| 115 | + have e1 : (k : ℝ) ^ 3 / L = ((k : ℝ) ^ 2) ^ 2 / ((k : ℝ) * L) := by |
| 116 | + field_simp |
| 117 | + rw [e1, Real.sqrt_div (by positivity), Real.sqrt_sq (by positivity)] |
| 118 | + rw [e, div_le_iff₀ hs] |
| 119 | + have h := mul_le_mul_of_nonneg_left (log_intModelDiam_le k) hkR.le |
| 120 | + calc (k : ℝ) * Real.log (intModelDiam k) ≤ k * (6 * k) := h |
| 121 | + _ = 6 * ((k : ℝ) ^ 2 / √((k : ℝ) * L)) * √((k : ℝ) * L) := by |
| 122 | + field_simp |
| 123 | + |
| 124 | +/-- **From real to integer row labels.** Sets `B n` with real row labels `x n`, of which there |
| 125 | +are `k n`, and offsets `j n` satisfying the hypotheses of the row estimates, with |
| 126 | +`k³ / L → 0`, have integer row labels `x' n` of differences at most `D n` satisfying the same |
| 127 | +hypotheses, with `k / L → 0` and `k log D / √(k L) → 0`. -/ |
| 128 | +theorem exists_int_rows_of_real_rows {α : Type*} [AddCommMonoid α] |
| 129 | + (B : ℕ → Finset α) (x : ℕ → α → ℝ) (j : ℕ → α → ℕ) (k L : ℕ → ℕ) |
| 130 | + (hkdef : ∀ n, k n = ((B n).image (x n)).card) |
| 131 | + (hinj : ∀ n, ∀ a ∈ B n, ∀ b ∈ B n, x n a = x n b → j n a = j n b → a = b) |
| 132 | + (hsum : ∀ n, ∀ a ∈ B n, ∀ b ∈ B n, ∀ c ∈ B n, ∀ d ∈ B n, a + b = c + d → |
| 133 | + x n a + x n b = x n c + x n d ∧ j n a + j n b = j n c + j n d) |
| 134 | + (hcube : Tendsto (fun n => (k n : ℝ) ^ 3 / L n) atTop (𝓝 0)) : |
| 135 | + ∃ (x' : ℕ → α → ℤ) (D : ℕ → ℕ), |
| 136 | + (∀ n, k n = ((B n).image (x' n)).card) ∧ |
| 137 | + (∀ n, ∀ a ∈ B n, ∀ b ∈ B n, x' n b - x' n a ≤ (D n : ℤ)) ∧ |
| 138 | + (∀ n, ∀ a ∈ B n, ∀ b ∈ B n, x' n a = x' n b → j n a = j n b → a = b) ∧ |
| 139 | + (∀ n, ∀ a ∈ B n, ∀ b ∈ B n, ∀ c ∈ B n, ∀ d ∈ B n, a + b = c + d → |
| 140 | + x' n a + x' n b = x' n c + x' n d ∧ j n a + j n b = j n c + j n d) ∧ |
| 141 | + Tendsto (fun n => (k n : ℝ) / L n) atTop (𝓝 0) ∧ |
| 142 | + Tendsto (fun n => (k n : ℝ) * Real.log (D n) / √((k n : ℝ) * L n)) atTop (𝓝 0) := by |
| 143 | + classical |
| 144 | + choose g hg1 hg2 hg3 using fun n => exists_int_relabel ((B n).image (x n)) |
| 145 | + refine ⟨fun n a => g n (x n a), fun n => intModelDiam (k n), ?_, ?_, ?_, ?_, ?_, ?_⟩ |
| 146 | + · intro n |
| 147 | + have e : (B n).image (fun a => g n (x n a)) = ((B n).image (x n)).image (g n) := by |
| 148 | + rw [Finset.image_image] |
| 149 | + rfl |
| 150 | + rw [e, Finset.card_image_of_injOn (hg1 n), hkdef n] |
| 151 | + · intro n a ha b hb |
| 152 | + have h := hg3 n (x n a) (mem_image_of_mem _ ha) (x n b) (mem_image_of_mem _ hb) |
| 153 | + rw [← hkdef n] at h |
| 154 | + exact h |
| 155 | + · intro n a ha b hb hx hjj |
| 156 | + exact hinj n a ha b hb (hg1 n (mem_coe.mpr (mem_image_of_mem _ ha)) |
| 157 | + (mem_coe.mpr (mem_image_of_mem _ hb)) hx) hjj |
| 158 | + · intro n a ha b hb c hc d hd h |
| 159 | + obtain ⟨h1, h2⟩ := hsum n a ha b hb c hc d hd h |
| 160 | + exact ⟨hg2 n _ (mem_image_of_mem _ ha) _ (mem_image_of_mem _ hb) _ (mem_image_of_mem _ hc) _ |
| 161 | + (mem_image_of_mem _ hd) h1, h2⟩ |
| 162 | + · refine tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds hcube |
| 163 | + (fun n => by positivity) (fun n => ?_) |
| 164 | + have h : (k n : ℝ) ≤ (k n : ℝ) ^ 3 := by |
| 165 | + exact_mod_cast Nat.le_self_pow (by norm_num) (k n) |
| 166 | + exact div_le_div_of_nonneg_right h (Nat.cast_nonneg _) |
| 167 | + · have hlim : Tendsto (fun n => 6 * √((k n : ℝ) ^ 3 / L n)) atTop (𝓝 0) := by |
| 168 | + have h := ((Real.continuous_sqrt.tendsto 0).comp hcube).const_mul 6 |
| 169 | + simpa using h |
| 170 | + refine tendsto_of_tendsto_of_tendsto_of_le_of_le tendsto_const_nhds hlim |
| 171 | + (fun n => ?_) (fun n => mul_log_intModelDiam_div_le (k n) (L n)) |
| 172 | + exact div_nonneg (mul_nonneg (Nat.cast_nonneg _) (Real.log_natCast_nonneg _)) |
| 173 | + (Real.sqrt_nonneg _) |
| 174 | + |
| 175 | +/-- **Display (4′) for real row labels.** Let `B n` have row coordinates with `k n ≥ 2` real |
| 176 | +row labels and offsets below `L n`, with `k L → ∞`, `k³ / L → 0` and eventually `|B| ≥ σ k L`. |
| 177 | +Then for every `c < (6 √14 / 49) √σ`, eventually `B n` has a Sidon subset of size at least |
| 178 | +`c √|B n|`. No unproved input. -/ |
| 179 | +theorem eventually_sidon_real_rows_chebyshev {α : Type*} [AddCommMonoid α] |
| 180 | + (B : ℕ → Finset α) (x : ℕ → α → ℝ) (j : ℕ → α → ℕ) (k L : ℕ → ℕ) {σ : ℝ} (hσ : 0 < σ) |
| 181 | + (hkdef : ∀ n, k n = ((B n).image (x n)).card) |
| 182 | + (hj : ∀ n, ∀ a ∈ B n, j n a < L n) |
| 183 | + (hinj : ∀ n, ∀ a ∈ B n, ∀ b ∈ B n, x n a = x n b → j n a = j n b → a = b) |
| 184 | + (hsum : ∀ n, ∀ a ∈ B n, ∀ b ∈ B n, ∀ c ∈ B n, ∀ d ∈ B n, a + b = c + d → |
| 185 | + x n a + x n b = x n c + x n d ∧ j n a + j n b = j n c + j n d) |
| 186 | + (hdens : ∀ᶠ n in atTop, σ * ((k n : ℝ) * L n) ≤ (B n).card) |
| 187 | + (hkL : Tendsto (fun n => (k n : ℝ) * L n) atTop atTop) |
| 188 | + (hcube : Tendsto (fun n => (k n : ℝ) ^ 3 / L n) atTop (𝓝 0)) |
| 189 | + (hk : ∀ᶠ n in atTop, 2 ≤ k n) |
| 190 | + {c : ℝ} (hc : c < √σ * (6 * √14 / 49)) : |
| 191 | + ∀ᶠ n in atTop, ∃ S ⊆ B n, IsSidon (S : Set α) ∧ c * √((B n).card : ℝ) ≤ S.card := by |
| 192 | + obtain ⟨x', D, h1, h2, h3, h4, h5, h6⟩ := |
| 193 | + exists_int_rows_of_real_rows B x j k L hkdef hinj hsum hcube |
| 194 | + exact eventually_sidon_rows_chebyshev B x' j k L D hσ h1 h2 hj h3 h4 hdens hkL h5 h6 hk hc |
| 195 | + |
| 196 | +/-- **The asymptotic (4) for real row labels, conditional on primes in short windows.** Assume |
| 197 | +that for every `μ > 1` the primes of `(y, μ y]` have weight `θ (μ y) - θ y ≥ e y` for some |
| 198 | +`e > 0` and all large `y` (a consequence of the prime number theorem, which is NOT proved here). |
| 199 | +Let `B n` have row coordinates with `k n ≥ 1` real row labels and offsets below `L n`, with |
| 200 | +`k L → ∞`, `k³ / L → 0` and eventually `|B| ≥ σ k L`. Then for every |
| 201 | +`c < (2 √6 / 9) √σ = c₀ √(2σ)`, eventually `B n` has a Sidon subset of size at least |
| 202 | +`c √|B n|`. -/ |
| 203 | +theorem eventually_sidon_real_rows_of_short_windows {α : Type*} [AddCommMonoid α] |
| 204 | + (hprimes : ∀ μ > (1 : ℝ), ∃ e > (0 : ℝ), ∀ᶠ y : ℝ in atTop, e * y ≤ θ (μ * y) - θ y) |
| 205 | + (B : ℕ → Finset α) (x : ℕ → α → ℝ) (j : ℕ → α → ℕ) (k L : ℕ → ℕ) {σ : ℝ} (hσ : 0 < σ) |
| 206 | + (hkdef : ∀ n, k n = ((B n).image (x n)).card) |
| 207 | + (hj : ∀ n, ∀ a ∈ B n, j n a < L n) |
| 208 | + (hinj : ∀ n, ∀ a ∈ B n, ∀ b ∈ B n, x n a = x n b → j n a = j n b → a = b) |
| 209 | + (hsum : ∀ n, ∀ a ∈ B n, ∀ b ∈ B n, ∀ c ∈ B n, ∀ d ∈ B n, a + b = c + d → |
| 210 | + x n a + x n b = x n c + x n d ∧ j n a + j n b = j n c + j n d) |
| 211 | + (hdens : ∀ᶠ n in atTop, σ * ((k n : ℝ) * L n) ≤ (B n).card) |
| 212 | + (hkL : Tendsto (fun n => (k n : ℝ) * L n) atTop atTop) |
| 213 | + (hcube : Tendsto (fun n => (k n : ℝ) ^ 3 / L n) atTop (𝓝 0)) |
| 214 | + (hk : ∀ᶠ n in atTop, 1 ≤ k n) |
| 215 | + {c : ℝ} (hc : c < √σ * (2 * √6 / 9)) : |
| 216 | + ∀ᶠ n in atTop, ∃ S ⊆ B n, IsSidon (S : Set α) ∧ c * √((B n).card : ℝ) ≤ S.card := by |
| 217 | + obtain ⟨x', D, h1, h2, h3, h4, h5, h6⟩ := |
| 218 | + exists_int_rows_of_real_rows B x j k L hkdef hinj hsum hcube |
| 219 | + exact eventually_sidon_rows_of_short_windows hprimes B x' j k L D hσ h1 h2 hj h3 h4 hdens hkL |
| 220 | + h5 h6 hk hc |
| 221 | + |
| 222 | +/-- An instance: sets `B n ⊆ ℝ × ℕ` with the first coordinate as row label and the second as |
| 223 | +offset. If the offsets are below `L n`, the number `k n` of first coordinates is eventually at |
| 224 | +least 2, `k L → ∞`, `k³ / L → 0` and `|B n| ≥ σ k L` eventually, then for every |
| 225 | +`c < (6 √14 / 49) √σ` eventually `B n` has a Sidon subset of size at least `c √|B n|`. -/ |
| 226 | +theorem eventually_sidon_real_prod_rows (B : ℕ → Finset (ℝ × ℕ)) (L : ℕ → ℕ) {σ : ℝ} |
| 227 | + (hσ : 0 < σ) (hj : ∀ n, ∀ a ∈ B n, a.2 < L n) |
| 228 | + (hdens : ∀ᶠ n in atTop, |
| 229 | + σ * ((((B n).image Prod.fst).card : ℝ) * L n) ≤ (B n).card) |
| 230 | + (hkL : Tendsto (fun n => (((B n).image Prod.fst).card : ℝ) * L n) atTop atTop) |
| 231 | + (hcube : Tendsto (fun n => (((B n).image Prod.fst).card : ℝ) ^ 3 / L n) atTop (𝓝 0)) |
| 232 | + (hk : ∀ᶠ n in atTop, 2 ≤ ((B n).image Prod.fst).card) |
| 233 | + {c : ℝ} (hc : c < √σ * (6 * √14 / 49)) : |
| 234 | + ∀ᶠ n in atTop, ∃ S ⊆ B n, IsSidon (S : Set (ℝ × ℕ)) ∧ c * √((B n).card : ℝ) ≤ S.card := |
| 235 | + eventually_sidon_real_rows_chebyshev B (fun _ => Prod.fst) (fun _ => Prod.snd) |
| 236 | + (fun n => ((B n).image Prod.fst).card) L hσ (fun _ => rfl) hj |
| 237 | + (fun _ _ _ _ _ h1 h2 => Prod.ext h1 h2) |
| 238 | + (fun _ _ _ _ _ _ _ _ _ h => ⟨congrArg Prod.fst h, congrArg Prod.snd h⟩) |
| 239 | + hdens hkL hcube hk hc |
| 240 | + |
| 241 | +/-- A concrete family with irrational row labels: the `n + 2` labels `i √2`, `i < n + 2`, and |
| 242 | +all offsets below `(n + 2)^4`, as a subset of `ℝ × ℕ` (so `k = n + 2`, `L = k^4`, `σ = 1`, |
| 243 | +`|B n| = (n + 2)^5`). Eventually it has a Sidon subset of at least `0.45 √|B n|` points. -/ |
| 244 | +theorem eventually_sidon_sqrt_two_rows : |
| 245 | + ∀ᶠ n : ℕ in atTop, ∃ S ⊆ ((range (n + 2)).image fun i : ℕ => (i : ℝ) * √2) ×ˢ |
| 246 | + range ((n + 2) ^ 4), |
| 247 | + IsSidon (S : Set (ℝ × ℕ)) ∧ (0.45 : ℝ) * √(((n : ℝ) + 2) ^ 5) ≤ S.card := by |
| 248 | + have hinj : ∀ n : ℕ, Set.InjOn (fun i : ℕ => (i : ℝ) * √2) (range (n + 2)) := by |
| 249 | + intro n i _ i' _ h |
| 250 | + have h2 : (√2 : ℝ) ≠ 0 := by positivity |
| 251 | + exact_mod_cast mul_right_cancel₀ h2 h |
| 252 | + have himg : ∀ n : ℕ, ((((range (n + 2)).image fun i : ℕ => (i : ℝ) * √2) ×ˢ |
| 253 | + range ((n + 2) ^ 4)).image Prod.fst).card = n + 2 := by |
| 254 | + intro n |
| 255 | + rw [Finset.product_image_fst, card_image_of_injOn (hinj n), card_range] |
| 256 | + exact ⟨0, by simp⟩ |
| 257 | + have hcard : ∀ n : ℕ, ((((range (n + 2)).image fun i : ℕ => (i : ℝ) * √2) ×ˢ |
| 258 | + range ((n + 2) ^ 4)).card : ℝ) = ((n : ℝ) + 2) ^ 5 := by |
| 259 | + intro n |
| 260 | + rw [card_product, card_image_of_injOn (hinj n), card_range, card_range] |
| 261 | + push_cast |
| 262 | + ring |
| 263 | + have h := eventually_sidon_real_prod_rows |
| 264 | + (fun n : ℕ => ((range (n + 2)).image fun i : ℕ => (i : ℝ) * √2) ×ˢ range ((n + 2) ^ 4)) |
| 265 | + (fun n => (n + 2) ^ 4) (σ := 1) one_pos |
| 266 | + (fun n a ha => by simpa using (mem_product.mp ha).2) |
| 267 | + (Eventually.of_forall fun n => by |
| 268 | + rw [himg, hcard] |
| 269 | + push_cast |
| 270 | + nlinarith [sq_nonneg ((n : ℝ) + 2)]) |
| 271 | + (by |
| 272 | + simp only [himg] |
| 273 | + refine tendsto_atTop_mono (fun n => ?_) tendsto_natCast_atTop_atTop |
| 274 | + push_cast |
| 275 | + have h1 : (1 : ℝ) ≤ ((n : ℝ) + 2) ^ 4 := |
| 276 | + one_le_pow₀ (by linarith [Nat.cast_nonneg (α := ℝ) n]) |
| 277 | + nlinarith [Nat.cast_nonneg (α := ℝ) n]) |
| 278 | + (by |
| 279 | + simp only [himg] |
| 280 | + have e : (fun n : ℕ => ((n + 2 : ℕ) : ℝ) ^ 3 / ((n + 2) ^ 4 : ℕ)) |
| 281 | + = fun n : ℕ => 1 / ((n : ℝ) + 2) := by |
| 282 | + funext n |
| 283 | + push_cast |
| 284 | + have : (n : ℝ) + 2 ≠ 0 := by positivity |
| 285 | + field_simp |
| 286 | + rw [e] |
| 287 | + exact tendsto_const_nhds.div_atTop |
| 288 | + (tendsto_atTop_add_const_right _ _ tendsto_natCast_atTop_atTop)) |
| 289 | + (Eventually.of_forall fun n => by rw [himg]; omega) |
| 290 | + (c := 0.45) (by |
| 291 | + rw [Real.sqrt_one, one_mul] |
| 292 | + have h14 : (3.74 : ℝ) < √14 := by |
| 293 | + rw [show (3.74 : ℝ) = √(3.74 ^ 2) by rw [Real.sqrt_sq (by norm_num)]] |
| 294 | + exact Real.sqrt_lt_sqrt (by norm_num) (by norm_num) |
| 295 | + linarith) |
| 296 | + filter_upwards [h] with n hn |
| 297 | + obtain ⟨S, hS, hsid, hc⟩ := hn |
| 298 | + exact ⟨S, hS, hsid, by rwa [hcard] at hc⟩ |
| 299 | + |
| 300 | +end ErdosSwarm.Erdos530RealRows |