|
| 1 | +/- |
| 2 | +Copyright (c) 2025 Snir Broshi. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Snir Broshi, Michael Stoll |
| 5 | +-/ |
| 6 | +import Mathlib.NumberTheory.FLT.Three |
| 7 | + |
| 8 | +/-! |
| 9 | +# Euler's sum of powers conjecture |
| 10 | +
|
| 11 | +Euler's sum of powers conjecture says that at least n nth powers of positive integers |
| 12 | +are required to sum to an nth power of a positive integer. |
| 13 | +
|
| 14 | +This was an attempt to generalize Fermat's Last Theorem, |
| 15 | +which is the special case of summing 2 nth powers. |
| 16 | +
|
| 17 | +We demonstrate the connection with FLT, prove that it's true for `n ≤ 3`, |
| 18 | +and provide counterexamples for `n = 4` and `n = 5`. |
| 19 | +The status of the conjecture for `n ≥ 6` is unknown. |
| 20 | +
|
| 21 | +https://en.wikipedia.org/wiki/Euler%27s_sum_of_powers_conjecture |
| 22 | +http://euler.free.fr/ |
| 23 | +
|
| 24 | +## TODO |
| 25 | +
|
| 26 | +* Formalize Elkies's construction of infinitely many coprime counterexamples for `n = 4` |
| 27 | + https://www.ams.org/journals/mcom/1988-51-184/S0025-5718-1988-0930224-9/S0025-5718-1988-0930224-9.pdf |
| 28 | +-/ |
| 29 | + |
| 30 | + |
| 31 | +namespace Counterexample |
| 32 | + |
| 33 | +/-- Euler's sum of powers conjecture over a given semiring with a specific exponent. -/ |
| 34 | +abbrev SumOfPowersConjectureWith (R : Type*) [Semiring R] (n : ℕ) : Prop := |
| 35 | + ∀ (a : List R) (b : R), 2 ≤ a.length → 0 ∉ a → b ≠ 0 → |
| 36 | + (a.map (· ^ n)).sum = b ^ n → n ≤ a.length |
| 37 | + |
| 38 | +/-- Euler's sum of powers conjecture over the naturals for a given exponent. -/ |
| 39 | +abbrev SumOfPowersConjectureFor (n : ℕ) : Prop := SumOfPowersConjectureWith ℕ n |
| 40 | + |
| 41 | +/-- Euler's sum of powers conjecture over the naturals. -/ |
| 42 | +abbrev SumOfPowersConjecture : Prop := ∀ n, SumOfPowersConjectureFor n |
| 43 | + |
| 44 | +/-- Euler's sum of powers conjecture over a given semiring with a specific exponent implies FLT. -/ |
| 45 | +theorem fermatLastTheoremWith_of_sumOfPowersConjectureWith (R : Type*) [Semiring R] : |
| 46 | + ∀ n ≥ 3, SumOfPowersConjectureWith R n → FermatLastTheoremWith R n := by |
| 47 | + intro n hn conj a b c ha hb hc hsum |
| 48 | + have : n ≤ 2 := conj [a, b] c (by simp) (by simp [ha.symm, hb.symm]) hc (by simpa) |
| 49 | + cutsat |
| 50 | + |
| 51 | +/-- Euler's sum of powers conjecture over the naturals implies FLT. -/ |
| 52 | +theorem fermatLastTheorem_of_sumOfPowersConjecture : SumOfPowersConjecture → FermatLastTheorem := |
| 53 | + fun conj n hn ↦ fermatLastTheoremWith_of_sumOfPowersConjectureWith ℕ n hn <| conj n |
| 54 | + |
| 55 | +/-- For `n = 3`, Euler's sum of powers conjecture over a given semiring is equivalent to FLT. -/ |
| 56 | +theorem sumOfPowersConjectureWith_three_iff_fermatLastTheoremWith_three (R : Type*) [Semiring R] : |
| 57 | + SumOfPowersConjectureWith R 3 ↔ FermatLastTheoremWith R 3 := by |
| 58 | + refine ⟨fermatLastTheoremWith_of_sumOfPowersConjectureWith R 3 (by rfl), ?_⟩ |
| 59 | + intro FLT a b ha ha₀ hb₀ hsum |
| 60 | + contrapose! hsum |
| 61 | + have ⟨x, y, hxy⟩ := a.length_eq_two.mp <| by cutsat |
| 62 | + simp [hxy, FLT x y b (by grind) (by grind) hb₀] |
| 63 | + |
| 64 | +/-- Euler's sum of powers conjecture over the naturals is true for `n ≤ 3`. -/ |
| 65 | +theorem sumOfPowersConjectureFor_le_three : ∀ n ≤ 3, SumOfPowersConjectureFor n := by |
| 66 | + intro n hn |
| 67 | + by_cases h3 : n = 3 |
| 68 | + · exact h3 ▸ (sumOfPowersConjectureWith_three_iff_fermatLastTheoremWith_three _).mpr |
| 69 | + fermatLastTheoremThree |
| 70 | + cutsat |
| 71 | + |
| 72 | +/-- Given a ring homomorphism from `R` to `S` with no nontrivial zeros, |
| 73 | +the conjecture over `S` implies the conjecture over `R`. -/ |
| 74 | +lemma sumOfPowersConjecture_of_ringHom {R S : Type*} [Semiring R] [Semiring S] {f : R →+* S} |
| 75 | + (hf : ∀ x, f x = 0 → x = 0) {n : ℕ} (conj : SumOfPowersConjectureWith S n) : |
| 76 | + SumOfPowersConjectureWith R n := by |
| 77 | + intro a b ha ha₀ hb hsum |
| 78 | + have h : (· ^ n) ∘ f = f ∘ (· ^ n) := by ext; simp |
| 79 | + convert conj (a.map f) (f b) ?_ ?_ ?_ (by simp [h, hsum, List.sum_map_hom]) <;> grind |
| 80 | + |
| 81 | +/-- Given an injective ring homomorphism from `R` to `S`, |
| 82 | +the conjecture over `S` implies the conjecture over `R`. -/ |
| 83 | +lemma sumOfPowersConjecture_of_injective {R S : Type*} [Semiring R] [Semiring S] {f : R →+* S} |
| 84 | + (hf : Function.Injective f) {n : ℕ} (h : SumOfPowersConjectureWith S n) : |
| 85 | + SumOfPowersConjectureWith R n := |
| 86 | + sumOfPowersConjecture_of_ringHom (fun _ _ ↦ hf <| by rwa [map_zero]) h |
| 87 | + |
| 88 | +/-- |
| 89 | +The first counterexample was found by Leon J. Lander and Thomas R. Parkin in 1966 |
| 90 | +through a computer search, disproving the conjecture. |
| 91 | +https://www.ams.org/journals/bull/1966-72-06/S0002-9904-1966-11654-3/S0002-9904-1966-11654-3.pdf |
| 92 | +This is also the smallest counterexample for `n = 5`. |
| 93 | +-/ |
| 94 | +theorem sumOfPowersConjectureFor_five_false : ¬SumOfPowersConjectureFor 5 := by |
| 95 | + intro conj |
| 96 | + let a := [27, 84, 110, 133] |
| 97 | + let b := 144 |
| 98 | + have : 5 ≤ 4 := conj a b (by simp [a]) (by simp [a]) (by simp) (by decide) |
| 99 | + cutsat |
| 100 | + |
| 101 | +/-- |
| 102 | +The first counterexample for `n = 4` was found by Noam D. Elkies in October 1988: |
| 103 | +`a := [2_682_440, 15_365_639, 18_796_760]`, `b := 20_615_673` |
| 104 | +https://www.ams.org/journals/mcom/1988-51-184/S0025-5718-1988-0930224-9/S0025-5718-1988-0930224-9.pdf |
| 105 | +In this paper, Elkies constructs infinitely many solutions to `a^4 + b^4 + c^4 = d^4` for coprime |
| 106 | +`a, b, c, d`, which provide infinitely many coprime counterexamples for the case `n = 4`. |
| 107 | +Here we use the smallest counterexample for `n = 4`, which was found a month later by Roger E. Frye |
| 108 | +https://ieeexplore.ieee.org/document/74138 |
| 109 | +-/ |
| 110 | +theorem sumOfPowersConjectureFor_four_false : ¬SumOfPowersConjectureFor 4 := by |
| 111 | + intro conj |
| 112 | + let a := [95_800, 217_519, 414_560] |
| 113 | + let b := 422_481 |
| 114 | + have : 4 ≤ 3 := conj a b (by simp [a]) (by simp [a]) (by simp) (by decide) |
| 115 | + cutsat |
| 116 | + |
| 117 | +/-- |
| 118 | +For all `(k, m, n)` we define the Diophantine equation `∑ x_i ^ k = ∑ y_i ^ k` |
| 119 | +where `x` and `y` are disjoint with length `m` and `n` respectively. |
| 120 | +This is a generalization of the diophantine equation of Euler's sum of powers conjecture. |
| 121 | +-/ |
| 122 | +abbrev ExistsEqualSumsOfLikePowersFor (R : Type*) [Semiring R] (k m n : ℕ) : Prop := |
| 123 | + ∃ (x y : List R), (x.length = m) ∧ (y.length = n) ∧ (0 ∉ x) ∧ (0 ∉ y) ∧ (List.Disjoint x y) ∧ |
| 124 | + (x.map (· ^ k)).sum = (y.map (· ^ k)).sum |
| 125 | + |
| 126 | +/-- Euler's sum of powers conjecture for `k` restricts solutions for `(k, m, 1)`. -/ |
| 127 | +theorem existsEqualSumsOfLikePowersFor_of_sumOfPowersConjectureWith (R : Type*) [Semiring R] |
| 128 | + (k m : ℕ) (hm : 2 ≤ m) : |
| 129 | + SumOfPowersConjectureWith R k → ExistsEqualSumsOfLikePowersFor R k m 1 → k ≤ m := by |
| 130 | + intro conj ⟨x, y, hx, hy, hx₀, hy₀, hdisj, hsum⟩ |
| 131 | + simp only [List.map_cons, List.map_nil, List.sum_cons, List.sum_nil, add_zero, |
| 132 | + List.eq_cons_of_length_one hy] at hsum |
| 133 | + exact hx ▸ conj x (y.get ⟨0, _⟩) (by cutsat) hx₀ (by grind) hsum |
| 134 | + |
| 135 | +/-- |
| 136 | +After the first counterexample was found, Leon J. Lander, Thomas R. Parkin, and John Selfridge |
| 137 | +made a similar conjecture that is not amenable to the counterexamples found so far. |
| 138 | +The status of this conjecture is unknown. |
| 139 | +https://en.wikipedia.org/wiki/Lander,_Parkin,_and_Selfridge_conjecture |
| 140 | +https://www.ams.org/journals/mcom/1967-21-099/S0025-5718-1967-0222008-0/S0025-5718-1967-0222008-0.pdf |
| 141 | +-/ |
| 142 | +abbrev LanderParkinSelfridgeConjecture (R : Type*) [Semiring R] (k m n : ℕ) : Prop := |
| 143 | + ExistsEqualSumsOfLikePowersFor R k m n → k ≤ m + n |
| 144 | + |
| 145 | +/-- Euler's sum of powers conjecture for `k` implies the Lander, Parkin, and Selfridge conjecture |
| 146 | +for `(k, m, 1)`. -/ |
| 147 | +theorem LanderParkinSelfridgeConjecture_of_sumOfPowersConjectureWith (R : Type*) [Semiring R] |
| 148 | + (k m : ℕ) (hm : 2 ≤ m) : |
| 149 | + SumOfPowersConjectureWith R k → LanderParkinSelfridgeConjecture R k m 1 := by |
| 150 | + intro conj hsum |
| 151 | + have := existsEqualSumsOfLikePowersFor_of_sumOfPowersConjectureWith R k m hm conj hsum |
| 152 | + cutsat |
| 153 | + |
| 154 | +end Counterexample |
0 commit comments