| | @@ -0,0 +1,89 @@ |
| 1 | +import Mathlib.Combinatorics.Additive.AP.Three.Defs |
| 2 | +import Mathlib.Algebra.Order.BigOperators.Group.Finset |
| 3 | + |
| 4 | +/-! |
| 5 | +# How many points of a three-AP-free set can lie on arithmetic progressions? |
| 6 | + |
| 7 | +In the digit example of `experiments/erdos530/lower-middle-energy/NOTES.md` §6, a |
| 8 | +three-AP-free set `B` is enlarged by a finite set `G`. Among the indices of any |
| 9 | +nonconstant length-`L` arithmetic progression, those that hit `B` are themselves |
| 10 | +three-AP-free. Each row therefore contributes at most `rothNumberNat L` points of `B`. |
| 11 | +The points of `G` contribute at most `G.card` across the entire union of rows. |
| 12 | + |
| 13 | +For the explicit bound in §6, the Roth number of eight is four. Subadditivity of the |
| 14 | +Roth number gives four points per complete block and at most four more in the last block. |
| 15 | +-/ |
| 16 | + |
| 17 | +namespace ErdosSwarm.Erdos530Progression |
| 18 | + |
| 19 | +open Finset |
| 20 | + |
| 21 | +/-- The sharp maximum on eight consecutive sites. -/ |
| 22 | +theorem rothNumberNat_eight : rothNumberNat 8 = 4 := by decide +kernel |
| 23 | + |
| 24 | +/-- Split a length-`L` interval into blocks of eight and a final shorter block. -/ |
| 25 | +theorem rothNumberNat_le_blocks (L : ℕ) : |
| 26 | + rothNumberNat L ≤ 4 * (L / 8) + min 4 (L % 8) := by |
| 27 | + have blocks (q : ℕ) : rothNumberNat (8 * q) ≤ 4 * q := by |
| 28 | + induction q with |
| 29 | + | zero => simp |
| 30 | + | succ q ih => |
| 31 | + rw [Nat.mul_succ, Nat.mul_succ] |
| 32 | + exact (rothNumberNat_add_le _ _).trans (Nat.add_le_add ih rothNumberNat_eight.le) |
| 33 | + have tail : rothNumberNat (L % 8) ≤ min 4 (L % 8) := |
| 34 | + le_min ((rothNumberNat.monotone (Nat.mod_lt L (by decide : 0 < 8)).le).trans |
| 35 | + rothNumberNat_eight.le) (rothNumberNat_le _) |
| 36 | + calc |
| 37 | + rothNumberNat L = rothNumberNat (8 * (L / 8) + L % 8) := by rw [Nat.div_add_mod] |
| 38 | + _ ≤ _ := rothNumberNat_add_le _ _ |
| 39 | + _ ≤ _ := Nat.add_le_add (blocks _) tail |
| 40 | + |
| 41 | +/-- A three-term progression among the occupied indices would give one in `B`. -/ |
| 42 | +theorem card_filter_progression_le_rothNumberNat {B : Finset ℕ} (hB : ThreeAPFree (B : Set ℕ)) |
| 43 | + (a d L : ℕ) (hd : 0 < d) : |
| 44 | + ((range L).filter fun i => a + d * i ∈ B).card ≤ rothNumberNat L := by |
| 45 | + apply ThreeAPFree.le_addRothNumber _ (filter_subset _ _) |
| 46 | + intro i hi j hj k hk h |
| 47 | + have heq : (a + d * i) + (a + d * k) = (a + d * j) + (a + d * j) := by |
| 48 | + simp only [add_add_add_comm a _ a, ← Nat.mul_add, h] |
| 49 | + exact Nat.eq_of_mul_eq_mul_left hd (Nat.add_left_cancel |
| 50 | + (hB (mem_filter.mp hi).2 (mem_filter.mp hj).2 (mem_filter.mp hk).2 heq)) |
| 51 | + |
| 52 | +/-- An explicit occupancy bound for one progression, including the incomplete block. -/ |
| 53 | +theorem card_filter_progression_le {B : Finset ℕ} (hB : ThreeAPFree (B : Set ℕ)) |
| 54 | + (a d L : ℕ) (hd : 0 < d) : |
| 55 | + ((range L).filter fun i => a + d * i ∈ B).card ≤ 4 * (L / 8) + min 4 (L % 8) := |
| 56 | + (card_filter_progression_le_rothNumberNat hB a d L hd).trans (rothNumberNat_le_blocks L) |
| 57 | + |
| 58 | +/-- Each row contributes at most the Roth number of its length. All exceptional points |
| 59 | +are charged to `G` once, even when the rows overlap. -/ |
| 60 | +theorem card_union_inter_progressions_le_rothNumberNat {B : Finset ℕ} (hB : ThreeAPFree (B : Set ℕ)) |
| 61 | + (G : Finset ℕ) (P : Finset (ℕ × ℕ)) (hP : ∀ p ∈ P, 0 < p.2) (L : ℕ) : |
| 62 | + ((B ∪ G).filter fun n => ∃ p ∈ P, ∃ i < L, n = p.1 + p.2 * i).card ≤ |
| 63 | + P.card * rothNumberNat L + G.card := by |
| 64 | + let hits (p : ℕ × ℕ) := (range L).filter fun i => p.1 + p.2 * i ∈ B |
| 65 | + let row (p : ℕ × ℕ) := (hits p).image fun i => p.1 + p.2 * i |
| 66 | + have hsub : (B ∪ G).filter (fun n => ∃ p ∈ P, ∃ i < L, n = p.1 + p.2 * i) ⊆ |
| 67 | + P.biUnion row ∪ G := by |
| 68 | + intro n hn |
| 69 | + obtain ⟨hBG, p, hp, i, hi, rfl⟩ := mem_filter.mp hn |
| 70 | + rcases mem_union.mp hBG with h | h |
| 71 | + · exact mem_union_left _ (mem_biUnion.mpr |
| 72 | + ⟨p, hp, mem_image.mpr ⟨i, mem_filter.mpr ⟨mem_range.mpr hi, h⟩, rfl⟩⟩) |
| 73 | + · exact mem_union_right _ h |
| 74 | + refine (card_le_card hsub).trans ((card_union_le _ _).trans (Nat.add_le_add_right ?_ _)) |
| 75 | + calc |
| 76 | + (P.biUnion row).card ≤ ∑ p ∈ P, (row p).card := card_biUnion_le |
| 77 | + _ ≤ ∑ _p ∈ P, rothNumberNat L := sum_le_sum fun p hp => |
| 78 | + card_image_le.trans (card_filter_progression_le_rothNumberNat hB p.1 p.2 L (hP p hp)) |
| 79 | + _ = _ := by simp |
| 80 | + |
| 81 | +/-- The finite progression estimate of §6 for `B ∪ G` and a family of length-`L` rows. -/ |
| 82 | +theorem card_union_inter_progressions_le {B : Finset ℕ} (hB : ThreeAPFree (B : Set ℕ)) |
| 83 | + (G : Finset ℕ) (P : Finset (ℕ × ℕ)) (hP : ∀ p ∈ P, 0 < p.2) (L : ℕ) : |
| 84 | + ((B ∪ G).filter fun n => ∃ p ∈ P, ∃ i < L, n = p.1 + p.2 * i).card ≤ |
| 85 | + P.card * (4 * (L / 8) + min 4 (L % 8)) + G.card := |
| 86 | + (card_union_inter_progressions_le_rothNumberNat hB G P hP L).trans |
| 87 | + (Nat.add_le_add_right (Nat.mul_le_mul_left _ (rothNumberNat_le_blocks L)) _) |
| 88 | + |
| 89 | +end ErdosSwarm.Erdos530Progression |