/-
Copyright 2025 The Formal Conjectures Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-/
import FormalConjecturesUtilSum of three cubes
An integer n : ℤ can be written as a sum of three cubes (of integers) if and only if
n is not 4 or 5 mod 9.
mathoverflow/100324
asked by user
namespace SumOfThreeCubes
variable {R : Type*} [Ring R]
The predicate that n : R is a sum of three cubes.
def IsSumOfThreeCubes (n : R) : Prop :=
∃ x y z : R, n = x^3 + y^3 + z^3
@[category test, AMS 11]
theorem isSumOfThreeCubes_2 : IsSumOfThreeCubes (2 : ℤ) :=
⟨1, 1, 0, ⊢ 2 = 1 ^ 3 + 1 ^ 3 + 0 ^ 3 All goals completed! 🐙⟩
@[category test, AMS 11]
theorem isSumOfThreeCubes_33 : IsSumOfThreeCubes (33 : ℤ) :=
⟨8866128975287528, -8778405442862239, -2736111468807040, ⊢ 33 = 8866128975287528 ^ 3 + (-8778405442862239) ^ 3 + (-2736111468807040) ^ 3 All goals completed! 🐙⟩
@[category test, AMS 11]
theorem isSumOfThreeCubes_42 : IsSumOfThreeCubes (42 : ℤ) :=
⟨-80538738812075974, 80435758145817515, 12602123297335631, ⊢ 42 = (-80538738812075974) ^ 3 + 80435758145817515 ^ 3 + 12602123297335631 ^ 3 All goals completed! 🐙⟩
@[category test, AMS 11]
theorem mod_9_of_isSumOfThreeCubes (n : ℤ) (hn : IsSumOfThreeCubes n) :
¬(n ≡ 4 [ZMOD 9] ∨ n ≡ 5 [ZMOD 9]) := n:ℤhn:IsSumOfThreeCubes n⊢ ¬(n ≡ 4 [ZMOD 9] ∨ n ≡ 5 [ZMOD 9])
n:ℤhn:IsSumOfThreeCubes n⊢ ¬(↑n = ↑4 ∨ ↑n = ↑5)
n:ℤx:ℤy:ℤz:ℤhn:n = x ^ 3 + y ^ 3 + z ^ 3⊢ ¬(↑n = ↑4 ∨ ↑n = ↑5)
n:ℤx:ℤy:ℤz:ℤhn:(fun x => ↑x) n = (fun x => ↑x) (x ^ 3 + y ^ 3 + z ^ 3) := congrArg (fun x => ↑x) _fvar.3488⊢ ¬(↑n = ↑4 ∨ ↑n = ↑5)
n:ℤx:ℤy:ℤz:ℤhn:↑n = ↑x ^ 3 + ↑y ^ 3 + ↑z ^ 3⊢ ¬(↑n = ↑4 ∨ ↑n = ↑5)
n✝:ℤx:ℤy:ℤz:ℤn:ZMod 9hn:n = ↑x ^ 3 + ↑y ^ 3 + ↑z ^ 3⊢ ¬(n = ↑4 ∨ n = ↑5)
n✝:ℤx✝:ℤy:ℤz:ℤn:ZMod 9x:ZMod 9hn:n = x ^ 3 + ↑y ^ 3 + ↑z ^ 3⊢ ¬(n = ↑4 ∨ n = ↑5)
n✝:ℤx✝:ℤy✝:ℤz:ℤn:ZMod 9x:ZMod 9y:ZMod 9hn:n = x ^ 3 + y ^ 3 + ↑z ^ 3⊢ ¬(n = ↑4 ∨ n = ↑5)
n✝:ℤx✝:ℤy✝:ℤz✝:ℤn:ZMod 9x:ZMod 9y:ZMod 9z:ZMod 9hn:n = x ^ 3 + y ^ 3 + z ^ 3⊢ ¬(n = ↑4 ∨ n = ↑5)
All goals completed! 🐙
Any rational number is a sum of three rational cubes.
First proved by Ryley in 1825, which can be found in [Ri1930]. The below parametrization is brought from the MSE answer [MSE].
[Ri1930] Richmond, H. W. "On Rational Solutions of $x^3 + y^3 + z^3 = R$." Proceedings of the Edinburgh Mathematical Society 2.2 (1930): 92-100. [MSE] Kieren MacMillan, Proving that any rational number can be represented as the sum of the cubes of three rational numbers, https://math.stackexchange.com/q/4480969
@[category research solved, AMS 11]
theorem isSumOfThreeCubesRat_any (r : ℚ) : IsSumOfThreeCubes r := r:ℚ⊢ IsSumOfThreeCubes r
r:ℚh:r = 0⊢ IsSumOfThreeCubes rr:ℚh:¬r = 0⊢ IsSumOfThreeCubes r
r:ℚh:r = 0⊢ IsSumOfThreeCubes r exact ⟨0, 0, 0, r:ℚh:r = 0⊢ r = 0 ^ 3 + 0 ^ 3 + 0 ^ 3 r:ℚh:r = 0⊢ r = 0; All goals completed! 🐙⟩
r:ℚh:¬r = 0⊢ IsSumOfThreeCubes r r:ℚh:¬r = 0x:ℚ := (r ^ 6 + 45 * r ^ 4 - 81 * r ^ 2 + 27) / (6 * r * (r ^ 2 + 3) ^ 2)⊢ IsSumOfThreeCubes r
r:ℚh:¬r = 0x:ℚ := (r ^ 6 + 45 * r ^ 4 - 81 * r ^ 2 + 27) / (6 * r * (r ^ 2 + 3) ^ 2)y:ℚ := (3 - r ^ 2) * (6 * r) / (r ^ 2 + 3) ^ 2⊢ IsSumOfThreeCubes r
r:ℚh:¬r = 0x:ℚ := (r ^ 6 + 45 * r ^ 4 - 81 * r ^ 2 + 27) / (6 * r * (r ^ 2 + 3) ^ 2)y:ℚ := (3 - r ^ 2) * (6 * r) / (r ^ 2 + 3) ^ 2z:ℚ := (r ^ 2 + 6 * r + 3) * (-r ^ 2 + 6 * r - 3) / (6 * r * (r ^ 2 + 3))⊢ IsSumOfThreeCubes r
r:ℚh:¬r = 0x:ℚ := (r ^ 6 + 45 * r ^ 4 - 81 * r ^ 2 + 27) / (6 * r * (r ^ 2 + 3) ^ 2)y:ℚ := (3 - r ^ 2) * (6 * r) / (r ^ 2 + 3) ^ 2z:ℚ := (r ^ 2 + 6 * r + 3) * (-r ^ 2 + 6 * r - 3) / (6 * r * (r ^ 2 + 3))⊢ r = x ^ 3 + y ^ 3 + z ^ 3
r:ℚh:¬r = 0x:ℚ := (r ^ 6 + 45 * r ^ 4 - 81 * r ^ 2 + 27) / (6 * r * (r ^ 2 + 3) ^ 2)y:ℚ := (3 - r ^ 2) * (6 * r) / (r ^ 2 + 3) ^ 2z:ℚ := (r ^ 2 + 6 * r + 3) * (-r ^ 2 + 6 * r - 3) / (6 * r * (r ^ 2 + 3))⊢ r =
((r ^ 6 + 45 * r ^ 4 - 81 * r ^ 2 + 27) / (6 * r * (r ^ 2 + 3) ^ 2)) ^ 3 +
((3 - r ^ 2) * (6 * r) / (r ^ 2 + 3) ^ 2) ^ 3 +
((r ^ 2 + 6 * r + 3) * (-r ^ 2 + 6 * r - 3) / (6 * r * (r ^ 2 + 3))) ^ 3
r:ℚh:¬r = 0x:ℚ := (r ^ 6 + 45 * r ^ 4 - 81 * r ^ 2 + 27) / (6 * r * (r ^ 2 + 3) ^ 2)y:ℚ := (3 - r ^ 2) * (6 * r) / (r ^ 2 + 3) ^ 2z:ℚ := (r ^ 2 + 6 * r + 3) * (-r ^ 2 + 6 * r - 3) / (6 * r * (r ^ 2 + 3))⊢ r ^ 4 * 6 ^ 3 * (r ^ 2 + 3) ^ 6 =
(r ^ 2 * (r ^ 2 * (r ^ 2 + 45) - 81) + 27) ^ 3 + r ^ 6 * 6 ^ 6 * (3 - r ^ 2) ^ 3 +
(r ^ 2 + 3) ^ 3 * (r * (r + 6) + 3) ^ 3 * (r * (-r + 6) - 3) ^ 3
All goals completed! 🐙
An integer n : ℤ can be written as a sum of three cubes (of integers) if and only if
n is not 4 or 5 mod 9.
@[category research open, AMS 11]
theorem isSumOfThreeCubes_iff_mod_9 :
answer(sorry) ↔ ∀ n : ℤ, IsSumOfThreeCubes n ↔ ¬(n ≡ 4 [ZMOD 9] ∨ n ≡ 5 [ZMOD 9]) := ⊢ True ↔ ∀ (n : ℤ), IsSumOfThreeCubes n ↔ ¬(n ≡ 4 [ZMOD 9] ∨ n ≡ 5 [ZMOD 9])
All goals completed! 🐙
end SumOfThreeCubes