| | @@ -0,0 +1,359 @@ |
| 1 | +import FormalConjectures.ErdosProblems.«939» |
| 2 | + |
| 3 | +/-! |
| 4 | +# Erdős Problem 939 |
| 5 | + |
| 6 | +The construction for exponents at least six uses the odd terms of a binomial |
| 7 | +expansion, as in the construction recorded in the discussion of |
| 8 | +<https://www.erdosproblems.com/forum/thread/939>. |
| 9 | +-/ |
| 10 | + |
| 11 | +namespace ErdosSwarm.Erdos939 |
| 12 | + |
| 13 | +open Nat Finset |
| 14 | +open scoped BigOperators |
| 15 | + |
| 16 | +private theorem full_pow (r a : ℕ) : r.Full (a ^ r) := by |
| 17 | + intro p hp |
| 18 | + obtain ⟨hprime, hdvd, _⟩ := Nat.mem_primeFactors.mp hp |
| 19 | + exact pow_dvd_pow_of_dvd (hprime.dvd_of_dvd_pow hdvd) r |
| 20 | + |
| 21 | +private theorem full_term {r q B c j : ℕ} (hj : 0 < j) (hc : c ∣ B) : |
| 22 | + r.Full (c * (q ^ r) ^ (r - j) * (B ^ r) ^ j) := by |
| 23 | + intro p hp |
| 24 | + obtain ⟨hprime, hdvd, _⟩ := Nat.mem_primeFactors.mp hp |
| 25 | + have hB (h : p ∣ B) : p ^ r ∣ (B ^ r) ^ j := |
| 26 | + (pow_dvd_pow_of_dvd h r).trans (by |
| 27 | + simpa only [pow_one] using pow_dvd_pow (B ^ r) (show 1 ≤ j by omega)) |
| 28 | + have hq (h : p ∣ (q ^ r) ^ (r - j)) : |
| 29 | + p ^ r ∣ (q ^ r) ^ (r - j) := by |
| 30 | + have hpos : 0 < r - j := by |
| 31 | + by_contra! hn |
| 32 | + simp [show r - j = 0 by omega, hprime.not_dvd_one] at h |
| 33 | + have hbase := hprime.dvd_of_dvd_pow (hprime.dvd_of_dvd_pow h) |
| 34 | + exact (pow_dvd_pow_of_dvd hbase r).trans (by |
| 35 | + simpa only [pow_one] using pow_dvd_pow (q ^ r) (show 1 ≤ r - j by omega)) |
| 36 | + rcases hprime.dvd_mul.mp hdvd with h | h |
| 37 | + · rcases hprime.dvd_mul.mp h with h | h |
| 38 | + · exact dvd_mul_of_dvd_right (hB (h.trans hc)) _ |
| 39 | + · exact dvd_mul_of_dvd_left (dvd_mul_of_dvd_right (hq h) _) _ |
| 40 | + · exact dvd_mul_of_dvd_right (hB (hprime.dvd_of_dvd_pow |
| 41 | + (hprime.dvd_of_dvd_pow h))) _ |
| 42 | + |
| 43 | +private theorem odd_binomial (r X Y d : ℕ) (h : d * Y ≤ X) : |
| 44 | + (X - d * Y) ^ r + |
| 45 | + ∑ j ∈ (range (r + 1)).filter Odd, |
| 46 | + (2 * r.choose j * d ^ j) * X ^ (r - j) * Y ^ j = |
| 47 | + (X + d * Y) ^ r := by |
| 48 | + zify [h] |
| 49 | + rw [← eq_sub_iff_add_eq'] |
| 50 | + let x : ℤ := X |
| 51 | + let y : ℤ := d * (Y : ℤ) |
| 52 | + calc |
| 53 | + _ = ∑ j ∈ range (r + 1), |
| 54 | + (y ^ j * x ^ (r - j) * (r.choose j : ℤ) - |
| 55 | + (-y) ^ j * x ^ (r - j) * (r.choose j : ℤ)) := by |
| 56 | + rw [sum_filter] |
| 57 | + apply sum_congr rfl |
| 58 | + intro j _ |
| 59 | + by_cases hj : Odd j |
| 60 | + · simp [hj, hj.neg_pow, x, y, mul_pow] |
| 61 | + ring |
| 62 | + · have he : Even j := Nat.not_odd_iff_even.mp hj |
| 63 | + simp [hj, he.neg_pow] |
| 64 | + _ = _ := by |
| 65 | + rw [sum_sub_distrib, ← add_pow, ← add_pow, add_comm y x, add_comm (-y) x, |
| 66 | + ← sub_eq_add_neg] |
| 67 | + |
| 68 | +private theorem odd_range (r : ℕ) : |
| 69 | + (range (r + 1)).filter Odd = |
| 70 | + (range ((r + 1) / 2)).image (fun i => 2 * i + 1) := by |
| 71 | + ext j |
| 72 | + simp only [mem_filter, mem_range, mem_image] |
| 73 | + constructor |
| 74 | + · rintro ⟨hj, i, hi⟩ |
| 75 | + exact ⟨i, by omega, by omega⟩ |
| 76 | + · rintro ⟨i, hi, rfl⟩ |
| 77 | + exact ⟨by omega, ⟨i, by omega⟩⟩ |
| 78 | + |
| 79 | +/-- A binomial decomposition with distinct exponent-coefficient pairs gives |
| 80 | +powerful summands with arbitrarily large total. -/ |
| 81 | +private theorem exists_of_coefficients {r d : ℕ} (hr : 1 ≤ r) (hd : 0 < d) |
| 82 | + (T : Finset (ℕ × ℕ)) (hne : T.Nonempty) (hcard : T.card + 1 = r - 2) |
| 83 | + (hT : ∀ a ∈ T, 0 < a.1 ∧ a.1 ≤ r ∧ 0 < a.2) |
| 84 | + (hsum : ∀ X Y : ℕ, d * Y ≤ X → |
| 85 | + (X - d * Y) ^ r + ∑ a ∈ T, a.2 * X ^ (r - a.1) * Y ^ a.1 = (X + d * Y) ^ r) |
| 86 | + (K : ℕ) : ∃ S ∈ _root_.Erdos939.Erdos939Sums r, K < ∑ s ∈ S, s := by |
| 87 | + classical |
| 88 | + let B := (max d (T.sup Prod.snd)).factorial |
| 89 | + have hB : 0 < B := factorial_pos _ |
| 90 | + have hdB : d ∣ B := dvd_factorial hd (le_max_left _ _) |
| 91 | + have hcB (a : ℕ × ℕ) (ha : a ∈ T) : a.2 ∣ B := |
| 92 | + dvd_factorial (hT a ha).2.2 ((le_sup ha).trans (le_max_right _ _)) |
| 93 | + obtain ⟨q, hqK, hq⟩ := exists_infinite_primes (max K (d * B ^ r + B + 2) + 1) |
| 94 | + have hqB : B < q := by omega |
| 95 | + have hqnd : ¬ q ∣ B := fun h => (not_le_of_gt hqB) (Nat.le_of_dvd hB h) |
| 96 | + let X := q ^ r |
| 97 | + let Y := B ^ r |
| 98 | + have hqX : q ≤ X := Nat.le_self_pow (by omega) q |
| 99 | + have hXY : d * Y + 1 < X := by |
| 100 | + dsimp [Y] |
| 101 | + omega |
| 102 | + let base := (X - d * Y) ^ r |
| 103 | + let term (a : ℕ × ℕ) := a.2 * X ^ (r - a.1) * Y ^ a.1 |
| 104 | + have hX : 0 < X := pow_pos hq.pos _ |
| 105 | + have hY : 0 < Y := pow_pos hB _ |
| 106 | + have hpos (a : ℕ × ℕ) (ha : a ∈ T) : 0 < term a := |
| 107 | + Nat.mul_pos (Nat.mul_pos (hT a ha).2.2 (pow_pos hX _)) (pow_pos hY _) |
| 108 | + have hv (a : ℕ × ℕ) (ha : a ∈ T) : (term a).factorization q = r * (r - a.1) := by |
| 109 | + have hnc : ¬ q ∣ a.2 := fun h => hqnd (h.trans (hcB a ha)) |
| 110 | + have hc0 := Nat.factorization_eq_zero_of_not_dvd hnc |
| 111 | + have hB0 := Nat.factorization_eq_zero_of_not_dvd hqnd |
| 112 | + unfold term X Y |
| 113 | + rw [Nat.factorization_mul (Nat.mul_ne_zero (hT a ha).2.2.ne' (pow_ne_zero _ hX.ne')) |
| 114 | + (pow_ne_zero _ hY.ne'), |
| 115 | + Nat.factorization_mul (hT a ha).2.2.ne' (pow_ne_zero _ hX.ne'), |
| 116 | + Finsupp.add_apply, Finsupp.add_apply, hc0, ← pow_mul, Nat.factorization_pow_self hq, |
| 117 | + ← pow_mul, Nat.factorization_pow, Finsupp.smul_apply, hB0] |
| 118 | + simp |
| 119 | + have hinj : Set.InjOn term (↑T : Set (ℕ × ℕ)) := by |
| 120 | + intro a ha b hb heq |
| 121 | + have hval := (hv a ha).symm.trans ((congrArg (fun n : ℕ => n.factorization q) heq).trans (hv b hb)) |
| 122 | + have hsub := Nat.eq_of_mul_eq_mul_left (by omega : 0 < r) hval |
| 123 | + have hj : a.1 = b.1 := by have := (hT a ha).2.1; have := (hT b hb).2.1; omega |
| 124 | + have hc : a.2 = b.2 := by |
| 125 | + unfold term at heq |
| 126 | + rw [← hj] at heq |
| 127 | + exact Nat.eq_of_mul_eq_mul_right (pow_pos hX _) |
| 128 | + (Nat.eq_of_mul_eq_mul_right (pow_pos hY _) heq) |
| 129 | + exact Prod.ext hj hc |
| 130 | + have hbase : 1 < base := |
| 131 | + one_lt_pow₀ (by omega : 1 < X - d * Y) (by omega) |
| 132 | + have hcop (a : ℕ × ℕ) (ha : a ∈ T) : Nat.Coprime base (term a) := by |
| 133 | + apply Nat.coprime_of_dvd |
| 134 | + intro p hp hpb hpa |
| 135 | + have hdiff : p ∣ X - d * Y := hp.dvd_of_dvd_pow hpb |
| 136 | + have hB_not (hpq : p ∣ q) : ¬ p ∣ B := by |
| 137 | + rwa [(Nat.prime_dvd_prime_iff_eq hp hq).mp hpq] |
| 138 | + have hterm : p ∣ q ∨ p ∣ B := by |
| 139 | + rcases hp.dvd_mul.mp hpa with h | h |
| 140 | + · rcases hp.dvd_mul.mp h with h | h |
| 141 | + · exact Or.inr (h.trans (hcB a ha)) |
| 142 | + · exact Or.inl (hp.dvd_of_dvd_pow (hp.dvd_of_dvd_pow h)) |
| 143 | + · exact Or.inr (hp.dvd_of_dvd_pow (hp.dvd_of_dvd_pow h)) |
| 144 | + have hdecomp : X - d * Y + d * Y = X := Nat.sub_add_cancel (by omega) |
| 145 | + have hscaled (h : p ∣ B) : p ∣ d * Y := |
| 146 | + dvd_mul_of_dvd_right (h.trans (dvd_pow_self _ (by omega))) d |
| 147 | + rcases hterm with h | h |
| 148 | + · have hXdiv : p ∣ X := h.trans (dvd_pow_self _ (by omega)) |
| 149 | + have hdy : p ∣ d * Y := (Nat.dvd_add_iff_right hdiff).mpr (by |
| 150 | + rw [hdecomp] |
| 151 | + exact hXdiv) |
| 152 | + exact hB_not h ((hp.dvd_mul.mp hdy).elim (fun h' => h'.trans hdB) |
| 153 | + (fun h' => hp.dvd_of_dvd_pow h')) |
| 154 | + · have hXdiv : p ∣ X := by |
| 155 | + simpa only [hdecomp] using Nat.dvd_add hdiff (hscaled h) |
| 156 | + exact hB_not (hp.dvd_of_dvd_pow hXdiv) h |
| 157 | + have hnot : base ∉ T.image term := by |
| 158 | + intro h |
| 159 | + obtain ⟨a, ha, heq⟩ := mem_image.mp h |
| 160 | + have hh := hcop a ha |
| 161 | + rw [heq, Nat.coprime_self] at hh |
| 162 | + omega |
| 163 | + let S := insert base (T.image term) |
| 164 | + have htotal : ∑ s ∈ S, s = (X + d * Y) ^ r := by |
| 165 | + rw [sum_insert hnot, sum_image hinj] |
| 166 | + exact hsum X Y (by omega) |
| 167 | + refine ⟨S, ⟨?_, ?_, htotal.symm ▸ full_pow r (X + d * Y), ?_⟩, ?_⟩ |
| 168 | + · rw [card_insert_of_notMem hnot, Finset.card_image_of_injOn hinj] |
| 169 | + exact hcard |
| 170 | + · obtain ⟨a, ha⟩ := hne |
| 171 | + have hb : S.gcd id ∣ base := gcd_dvd (mem_insert_self ..) |
| 172 | + have ht : S.gcd id ∣ term a := gcd_dvd (mem_insert_of_mem (mem_image_of_mem _ ha)) |
| 173 | + exact Nat.dvd_one.mp ((Nat.dvd_gcd hb ht).trans (dvd_of_eq (hcop a ha))) |
| 174 | + · intro s hs |
| 175 | + rcases mem_insert.mp hs with rfl | hs |
| 176 | + · exact ⟨by omega, full_pow r (X - d * Y)⟩ |
| 177 | + · obtain ⟨a, ha, rfl⟩ := mem_image.mp hs |
| 178 | + exact ⟨hpos a ha, full_term (hT a ha).1 (hcB a ha)⟩ |
| 179 | + · rw [htotal] |
| 180 | + exact (show K < X + d * Y by omega).trans_le (Nat.le_self_pow (by omega) _) |
| 181 | + |
| 182 | +/-- The coefficient at exponent one can be split into enough distinct positive |
| 183 | +coefficients to obtain exactly `r - 2` summands. -/ |
| 184 | +private theorem exists_coefficients (r : ℕ) (hr : 6 ≤ r) : |
| 185 | + ∃ T : Finset (ℕ × ℕ), T.Nonempty ∧ T.card + 1 = r - 2 ∧ |
| 186 | + (∀ a ∈ T, 0 < a.1 ∧ a.1 ≤ r ∧ 0 < a.2) ∧ |
| 187 | + ∀ X Y : ℕ, r ^ 2 * Y ≤ X → |
| 188 | + (X - r ^ 2 * Y) ^ r + ∑ a ∈ T, a.2 * X ^ (r - a.1) * Y ^ a.1 = |
| 189 | + (X + r ^ 2 * Y) ^ r := by |
| 190 | + classical |
| 191 | + let L := (r + 1) / 2 |
| 192 | + let t := r - 2 - L |
| 193 | + have ht : 1 ≤ t := by dsimp [t, L]; omega |
| 194 | + have htr : t ≤ r := by dsimp [t]; omega |
| 195 | + let d := r ^ 2 |
| 196 | + let C := 2 * r * d |
| 197 | + let s := ∑ i ∈ range (t - 1), (i + 1) |
| 198 | + have hs : s ≤ t * t := by |
| 199 | + calc |
| 200 | + s ≤ ∑ _i ∈ range (t - 1), t := by |
| 201 | + apply sum_le_sum |
| 202 | + intro i hi |
| 203 | + have := mem_range.mp hi |
| 204 | + omega |
| 205 | + _ ≤ t * t := by |
| 206 | + simpa using Nat.mul_le_mul_right t (Nat.sub_le t 1) |
| 207 | + have hC : s + t < C := by |
| 208 | + have hrr : t * t ≤ r * r := Nat.mul_le_mul htr htr |
| 209 | + have hsq : r ≤ r * r := Nat.le_mul_of_pos_left r (by omega) |
| 210 | + have hmul : 2 * (r * r) < (2 * r) * (r * r) := |
| 211 | + Nat.mul_lt_mul_of_pos_right (by omega) (by positivity) |
| 212 | + dsimp [C, d] |
| 213 | + rw [pow_two] |
| 214 | + omega |
| 215 | + let first (i : ℕ) : ℕ × ℕ := (1, i + 1) |
| 216 | + let last : ℕ × ℕ := (1, C - s) |
| 217 | + let rest (i : ℕ) : ℕ × ℕ := |
| 218 | + (2 * i + 3, 2 * r.choose (2 * i + 3) * d ^ (2 * i + 3)) |
| 219 | + let A := (range (t - 1)).image first |
| 220 | + let D := (range (L - 1)).image rest |
| 221 | + have hiA : Function.Injective first := by |
| 222 | + intro i j h |
| 223 | + have := congrArg Prod.snd h |
| 224 | + change i + 1 = j + 1 at this |
| 225 | + omega |
| 226 | + have hiD : Function.Injective rest := by |
| 227 | + intro i j h |
| 228 | + have := congrArg Prod.fst h |
| 229 | + change 2 * i + 3 = 2 * j + 3 at this |
| 230 | + omega |
| 231 | + have hl : last ∉ A := by |
| 232 | + rintro ha |
| 233 | + obtain ⟨i, hi, heq⟩ := mem_image.mp ha |
| 234 | + have := mem_range.mp hi |
| 235 | + have he := congrArg Prod.snd heq |
| 236 | + change i + 1 = C - s at he |
| 237 | + omega |
| 238 | + have hdisj : Disjoint (insert last A) D := by |
| 239 | + apply disjoint_left.mpr |
| 240 | + intro a ha hb |
| 241 | + obtain ⟨j, _, rfl⟩ := mem_image.mp hb |
| 242 | + rcases mem_insert.mp ha with he | he |
| 243 | + · have hh := congrArg Prod.fst he |
| 244 | + change 2 * j + 3 = 1 at hh |
| 245 | + omega |
| 246 | + · obtain ⟨i, _, h⟩ := mem_image.mp he |
| 247 | + have hh := congrArg Prod.fst h |
| 248 | + change 1 = 2 * j + 3 at hh |
| 249 | + omega |
| 250 | + refine ⟨insert last A ∪ D, ⟨last, mem_union_left _ (mem_insert_self ..)⟩, ?_, ?_, ?_⟩ |
| 251 | + · rw [card_union_of_disjoint hdisj, card_insert_of_notMem hl, |
| 252 | + card_image_of_injective _ hiA, card_image_of_injective _ hiD, card_range, card_range] |
| 253 | + dsimp [t, L] |
| 254 | + omega |
| 255 | + · intro a ha |
| 256 | + rcases mem_union.mp ha with ha | ha |
| 257 | + · rcases mem_insert.mp ha with rfl | ha |
| 258 | + · exact ⟨by simp [last], by simp [last]; omega, by change 0 < C - s; omega⟩ |
| 259 | + · obtain ⟨i, _, rfl⟩ := mem_image.mp ha |
| 260 | + simp [first] |
| 261 | + omega |
| 262 | + · obtain ⟨i, hi, rfl⟩ := mem_image.mp ha |
| 263 | + have hle : 2 * i + 3 ≤ r := by |
| 264 | + have := mem_range.mp hi |
| 265 | + dsimp [L] at this |
| 266 | + omega |
| 267 | + have hc := choose_pos hle |
| 268 | + exact ⟨by simp [rest], hle, by dsimp [rest, d]; positivity⟩ |
| 269 | + · intro X Y hXY |
| 270 | + have hL : L = (L - 1) + 1 := by dsimp [L]; omega |
| 271 | + have hodd := odd_binomial r X Y d hXY |
| 272 | + rw [odd_range, sum_image (by |
| 273 | + intro i _ j _ h |
| 274 | + change 2 * i + 1 = 2 * j + 1 at h |
| 275 | + omega)] at hodd |
| 276 | + change _ + ∑ i ∈ range L, _ = _ at hodd |
| 277 | + rw [hL, sum_range_succ'] at hodd |
| 278 | + rw [sum_union hdisj, sum_insert hl, sum_image hiA.injOn, sum_image hiD.injOn] |
| 279 | + have hsplit : |
| 280 | + (C - s) * X ^ (r - 1) * Y ^ 1 + |
| 281 | + ∑ i ∈ range (t - 1), (i + 1) * X ^ (r - 1) * Y ^ 1 = |
| 282 | + C * X ^ (r - 1) * Y ^ 1 := by |
| 283 | + rw [← sum_mul, ← sum_mul] |
| 284 | + change (C - s) * X ^ (r - 1) * Y ^ 1 + s * X ^ (r - 1) * Y ^ 1 = _ |
| 285 | + rw [← add_mul, ← add_mul, Nat.sub_add_cancel (by omega)] |
| 286 | + simp only [first, last, rest] |
| 287 | + rw [hsplit] |
| 288 | + convert hodd using 2 |
| 289 | + simp only [C, Nat.mul_zero, zero_add, Nat.choose_one_right, pow_one] |
| 290 | + rw [add_comm] |
| 291 | + congr 1 |
| 292 | + |
| 293 | +open _root_.Erdos939 (Erdos939Sums) |
| 294 | + |
| 295 | +/-- For every exponent at least six, the sums of the witnesses are unbounded. -/ |
| 296 | +theorem exists_sum_gt (r : ℕ) (hr : 6 ≤ r) (K : ℕ) : |
| 297 | + ∃ S ∈ Erdos939Sums r, K < ∑ s ∈ S, s := by |
| 298 | + obtain ⟨T, hne, hcard, hT, hsum⟩ := exists_coefficients r hr |
| 299 | + exact exists_of_coefficients (by omega) (by positivity : 0 < r ^ 2) |
| 300 | + T hne hcard hT hsum K |
| 301 | + |
| 302 | +/-- For every exponent at least six there are infinitely many witness sets. -/ |
| 303 | +theorem infinite_of_six_le (r : ℕ) (hr : 6 ≤ r) : (Erdos939Sums r).Infinite := by |
| 304 | + intro hf |
| 305 | + obtain ⟨K, hK⟩ := (hf.image (fun S : Finset ℕ => ∑ s ∈ S, s)).bddAbove |
| 306 | + obtain ⟨S, hS, hgt⟩ := exists_sum_gt r hr K |
| 307 | + exact (not_le_of_gt hgt) (hK ⟨S, hS, rfl⟩) |
| 308 | + |
| 309 | +private theorem full_mul {r a b : ℕ} (ha : r.Full a) (hb : r.Full b) : r.Full (a * b) := by |
| 310 | + intro p hp |
| 311 | + obtain ⟨hp, hdiv, hne⟩ := Nat.mem_primeFactors.mp hp |
| 312 | + rcases hp.dvd_mul.mp hdiv with h | h |
| 313 | + · have hn : a ≠ 0 := fun he => hne (by simp [he]) |
| 314 | + exact dvd_mul_of_dvd_left (ha p (Nat.mem_primeFactors.mpr ⟨hp, h, hn⟩)) b |
| 315 | + · have hn : b ≠ 0 := fun he => hne (by simp [he]) |
| 316 | + exact dvd_mul_of_dvd_right (hb p (Nat.mem_primeFactors.mpr ⟨hp, h, hn⟩)) a |
| 317 | + |
| 318 | +/-- Cambie's three summands give a witness at exponent five. -/ |
| 319 | +theorem five_nonempty : (Erdos939Sums 5).Nonempty := by |
| 320 | + let a : ℕ := 2 ^ 8 * 3 ^ 10 * 5 ^ 7 |
| 321 | + let b : ℕ := 2 ^ 12 * 23 ^ 6 |
| 322 | + let c : ℕ := 11 ^ 5 * 13 ^ 5 |
| 323 | + let S : Finset ℕ := {a, b, c} |
| 324 | + have ha : a ≠ b := by norm_num [a, b] |
| 325 | + have hac : a ≠ c := by norm_num [a, c] |
| 326 | + have hbc : b ≠ c := by norm_num [b, c] |
| 327 | + have hp (x e : ℕ) (he : 5 ≤ e) : (5 : ℕ).Full (x ^ e) := |
| 328 | + full_of_le_full 5 _ he (full_pow e x) |
| 329 | + refine ⟨S, ⟨?_, ?_, ?_, ?_⟩⟩ |
| 330 | + · simp [S, ha, hac, hbc] |
| 331 | + · have hb : S.gcd id ∣ b := gcd_dvd (mem_insert_of_mem (mem_insert_self ..)) |
| 332 | + have hc : S.gcd id ∣ c := |
| 333 | + gcd_dvd (mem_insert_of_mem (mem_insert_of_mem (mem_singleton_self _))) |
| 334 | + have hcop : Nat.Coprime b c := by decide |
| 335 | + exact Nat.dvd_one.mp ((Nat.dvd_gcd hb hc).trans (dvd_of_eq hcop)) |
| 336 | + · have hsum : a + (b + c) = 3 ^ 7 * 61 ^ 5 := by norm_num [a, b, c] |
| 337 | + have hsumS : ∑ s ∈ S, s = a + (b + c) := by |
| 338 | + simp [S, ha, hac, hbc] |
| 339 | + rw [hsumS, hsum] |
| 340 | + exact full_mul (hp 3 7 (by decide)) (full_pow 5 61) |
| 341 | + · intro n hn |
| 342 | + simp only [S, mem_insert, mem_singleton] at hn |
| 343 | + rcases hn with rfl | rfl | rfl |
| 344 | + · exact ⟨by norm_num [a], full_mul (full_mul (hp 2 8 (by decide)) (hp 3 10 (by decide))) |
| 345 | + (hp 5 7 (by decide))⟩ |
| 346 | + · exact ⟨by norm_num [b], full_mul (hp 2 12 (by decide)) (hp 23 6 (by decide))⟩ |
| 347 | + · exact ⟨by norm_num [c], full_mul (full_pow 5 11) (full_pow 5 13)⟩ |
| 348 | + |
| 349 | +/-- The existence question for all exponents reduces to the case `r = 4`. -/ |
| 350 | +theorem existence_iff_four : |
| 351 | + (∀ r ≥ 4, (Erdos939Sums r).Nonempty) ↔ (Erdos939Sums 4).Nonempty := by |
| 352 | + refine ⟨fun h => h 4 le_rfl, ?_⟩ |
| 353 | + intro h r hr |
| 354 | + rcases show r = 4 ∨ r = 5 ∨ 6 ≤ r by omega with rfl | rfl | h6 |
| 355 | + · exact h |
| 356 | + · exact five_nonempty |
| 357 | + · exact (infinite_of_six_le r h6).nonempty |
| 358 | + |
| 359 | +end ErdosSwarm.Erdos939 |