| | @@ -0,0 +1,120 @@ |
| 1 | +import ErdosSwarm.Erdos530BoxOccupancy |
| 2 | +import ErdosSwarm.Erdos530DigitLevel |
| 3 | + |
| 4 | +/-! |
| 5 | +# Sidon subsets of augmented digit levels for Erdős problem 530 |
| 6 | + |
| 7 | +A largest squared-norm level of the base-16 digit box contains a Sidon subset |
| 8 | +of size greater than `(11/20) √N` for all sufficiently large dimensions. |
| 9 | +Here `N` counts the level together with the two progressions at scale `4 ^ r`. |
| 10 | +The dimension threshold works for every choice among tied levels. |
| 11 | +-/ |
| 12 | + |
| 13 | +namespace ErdosSwarm.Erdos530DigitLevel |
| 14 | + |
| 15 | +open Filter Finset |
| 16 | + |
| 17 | +/-- The interval from zero to `H` and its multiples by `H` share the two |
| 18 | +endpoints of the interval, so together they have exactly `2 * H` points. -/ |
| 19 | +theorem card_digit_progressions {H : ℕ} (hH : 0 < H) : |
| 20 | + (range (H + 1) ∪ (range (H + 1)).image (H * ·)).card = 2 * H := by |
| 21 | + have hinter : range (H + 1) ∩ (range (H + 1)).image (H * ·) = (range 2).image (H * ·) := by |
| 22 | + ext x |
| 23 | + simp only [mem_inter, mem_range, mem_image] |
| 24 | + constructor |
| 25 | + · rintro ⟨hx, j, _, rfl⟩ |
| 26 | + have hj : j ≤ 1 := Nat.le_of_mul_le_mul_left (by simpa using Nat.le_of_lt_succ hx) hH |
| 27 | + exact ⟨j, by omega, rfl⟩ |
| 28 | + · rintro ⟨j, hj, rfl⟩ |
| 29 | + have hx : H * j ≤ H := by simpa using Nat.mul_le_mul_left H (show j ≤ 1 by omega) |
| 30 | + exact ⟨by omega, j, by omega, rfl⟩ |
| 31 | + have hc := card_union_add_card_inter (range (H + 1)) ((range (H + 1)).image (H * ·)) |
| 32 | + rw [hinter, card_image_of_injective _ (mul_right_injective₀ hH.ne'), |
| 33 | + card_image_of_injective _ (mul_right_injective₀ hH.ne'), card_range, card_range] at hc |
| 34 | + omega |
| 35 | + |
| 36 | +private theorem pow_eight_le_of_max {r t : ℕ} |
| 37 | + (hmax : ∀ s, (digitLevel r s).card ≤ (digitLevel r t).card) : |
| 38 | + 8 ^ r ≤ (49 * r + 1) * (digitLevel r t).card := by |
| 39 | + obtain ⟨s, _, _, hs⟩ := exists_max_digitLevel r |
| 40 | + exact hs.trans (Nat.mul_le_mul_left _ (hmax s)) |
| 41 | + |
| 42 | +/-- The relative increase from adjoining the progressions, uniform over all largest levels. -/ |
| 43 | +theorem card_ratio_augmentedDigitLevel_of_max {r t : ℕ} |
| 44 | + (hmax : ∀ s, (digitLevel r s).card ≤ (digitLevel r t).card) : |
| 45 | + 1 ≤ ((augmentedDigitLevel r t).card : ℝ) / (digitLevel r t).card ∧ |
| 46 | + ((augmentedDigitLevel r t).card : ℝ) / (digitLevel r t).card ≤ |
| 47 | + 1 + 2 * (49 * (r : ℝ) + 1) / 2 ^ r := by |
| 48 | + have hmean := pow_eight_le_of_max hmax |
| 49 | + have hn : 0 < (digitLevel r t).card := Nat.pos_of_ne_zero fun hz => by simp [hz] at hmean |
| 50 | + have hn' : (0 : ℝ) < (digitLevel r t).card := by exact_mod_cast hn |
| 51 | + have hsub : digitLevel r t ⊆ augmentedDigitLevel r t := |
| 52 | + fun _ ha => mem_union_left _ (mem_union_left _ ha) |
| 53 | + refine ⟨(one_le_div hn').2 (by exact_mod_cast card_le_card hsub), (div_le_iff₀ hn').2 ?_⟩ |
| 54 | + have hcard : (augmentedDigitLevel r t).card ≤ (digitLevel r t).card + 2 * 4 ^ r := by |
| 55 | + unfold augmentedDigitLevel |
| 56 | + rw [union_assoc] |
| 57 | + exact (card_union_le _ _).trans_eq (by rw [card_digit_progressions (by positivity)]) |
| 58 | + have hcross : (4 : ℝ) ^ r * 2 ^ r ≤ (49 * (r : ℝ) + 1) * (digitLevel r t).card := by |
| 59 | + rw [← mul_pow] |
| 60 | + exact_mod_cast hmean |
| 61 | + calc |
| 62 | + ((augmentedDigitLevel r t).card : ℝ) ≤ (digitLevel r t).card + 2 * (4 : ℝ) ^ r := by |
| 63 | + exact_mod_cast hcard |
| 64 | + _ ≤ _ := by |
| 65 | + rw [add_mul, one_mul, add_le_add_iff_left, div_mul_eq_mul_div, le_div_iff₀ (by positivity)] |
| 66 | + linarith only [hcross] |
| 67 | + |
| 68 | +/-- From dimension 19 onward the added fraction is at most `1/256`. -/ |
| 69 | +private theorem level_overhead_le {r : ℕ} (hr : 19 ≤ r) : 512 * (49 * r + 1) ≤ 2 ^ r := by |
| 70 | + induction r, hr using Nat.le_induction with |
| 71 | + | base => decide |
| 72 | + | succ r hr ih => rw [pow_succ]; omega |
| 73 | + |
| 74 | +/-- Every largest digit level contains a Sidon subset exceeding `(11/20) √N`, |
| 75 | +where `N` is the cardinality after adjoining both progressions. -/ |
| 76 | +theorem eventually_exists_sidon_subset_of_max_digitLevel : |
| 77 | + ∀ᶠ r : ℕ in atTop, ∀ t : ℕ, (∀ s, (digitLevel r s).card ≤ (digitLevel r t).card) → |
| 78 | + ∃ S ⊆ digitLevel r t, IsSidon (S : Set ℕ) ∧ |
| 79 | + (11 / 20 : ℝ) * Real.sqrt (augmentedDigitLevel r t).card < S.card := by |
| 80 | + obtain ⟨n₀, h₀⟩ := Erdos530BoxOccupancy.exists_threshold_sidon_subset_of_eight_digit_level.{0} |
| 81 | + filter_upwards [eventually_ge_atTop 19, |
| 82 | + (tendsto_pow_atTop_atTop_of_one_lt (by decide : 1 < (4 : ℕ))).eventually_ge_atTop n₀] |
| 83 | + with r hr hn₀ |
| 84 | + intro t hmax |
| 85 | + let n := (digitLevel r t).card |
| 86 | + let N := (augmentedDigitLevel r t).card |
| 87 | + have hsmall := level_overhead_le hr |
| 88 | + have hsize : 4 ^ r ≤ n := by |
| 89 | + refine Nat.le_of_mul_le_mul_left (c := 2 ^ r) ?_ (by positivity) |
| 90 | + calc |
| 91 | + 2 ^ r * 4 ^ r = 8 ^ r := by norm_num [← mul_pow] |
| 92 | + _ ≤ (49 * r + 1) * n := pow_eight_le_of_max hmax |
| 93 | + _ ≤ 2 ^ r * n := Nat.mul_le_mul_right _ (by omega) |
| 94 | + have repr (a : digitLevel r t) : ∃ x ∈ Behrend.sphere r 8 t, Behrend.map 16 x = a.val := |
| 95 | + mem_image.mp a.property |
| 96 | + choose digits hsphere hencode using repr |
| 97 | + obtain ⟨hinj, hdigit, hsums⟩ := digit_model_of_encoding digits |
| 98 | + (fun a => Behrend.sphere_subset_box (hsphere a)) hencode |
| 99 | + obtain ⟨S, hSB, hS, hbound⟩ := |
| 100 | + h₀ n (hn₀.trans hsize) (digitLevel r t) rfl _ hinj hdigit hsums (t := (t : ℤ)) (by |
| 101 | + intro a |
| 102 | + exact_mod_cast (mem_filter.mp (hsphere a)).2) |
| 103 | + have hn : (0 : ℝ) < n := by exact_mod_cast (pow_pos (by decide : 0 < (4 : ℕ)) r).trans_le hsize |
| 104 | + have herror : 2 * (49 * (r : ℝ) + 1) / 2 ^ r ≤ 1 / 256 := by |
| 105 | + apply (div_le_iff₀ (by positivity)).2 |
| 106 | + have h : (512 : ℝ) * (49 * r + 1) ≤ 2 ^ r := by exact_mod_cast hsmall |
| 107 | + linarith only [h] |
| 108 | + have hN : (N : ℝ) ≤ (257 / 256) * n := (div_le_iff₀ hn).mp |
| 109 | + ((card_ratio_augmentedDigitLevel_of_max hmax).2.trans (by linarith only [herror])) |
| 110 | + refine ⟨S, hSB, hS, lt_of_lt_of_le ?_ hbound⟩ |
| 111 | + change (11 / 20 : ℝ) * Real.sqrt N < (6671 / 12105 : ℝ) * Real.sqrt n |
| 112 | + apply (sq_lt_sq₀ (by positivity) (by positivity)).mp |
| 113 | + rw [mul_pow, mul_pow, Real.sq_sqrt (Nat.cast_nonneg N), Real.sq_sqrt hn.le] |
| 114 | + calc |
| 115 | + _ ≤ (11 / 20 : ℝ) ^ 2 * (257 / 256 * n) := mul_le_mul_of_nonneg_left hN (sq_nonneg _) |
| 116 | + _ < _ := by |
| 117 | + rw [← mul_assoc] |
| 118 | + exact mul_lt_mul_of_pos_right (by norm_num) hn |
| 119 | + |
| 120 | +end ErdosSwarm.Erdos530DigitLevel |