Case 3: Fermat’s Last Theorem and four fake proofs
Read Mathlib’s statement of Fermat’s Last Theorem, then audit four AI-style “proofs” of it and find each trick.
The claim
Fermat’s Last Theorem: for any whole number n ≥ 3, there are no positive whole numbers a, b, c with aⁿ + bⁿ = cⁿ.
Fermat wrote it in a margin around 1637. Andrew Wiles proved it in 1994, with Richard Taylor, using hundreds of pages of advanced mathematics. A full Lean proof is a large ongoing project.
So if an AI tells you “I proved Fermat’s Last Theorem in Lean, here is the file”, something is almost certainly off. Today you find out exactly what. First, the honest statement.
Step 1: Mathlib’s statement
Mathlib defines the statement in three layers:
#print FermatLastTheorem
#print FermatLastTheoremFor
#print FermatLastTheoremWith
In short, leaving out the technical parts:
FermatLastTheorem := ∀ n ≥ 3, FermatLastTheoremFor n
FermatLastTheoremFor n := FermatLastTheoremWith ℕ n
FermatLastTheoremWith R n := ∀ (a b c : R), a ≠ 0 → b ≠ 0 → c ≠ 0 → a ^ n + b ^ n ≠ c ^ n
Read from the bottom up: in the numbers R, nonzero a, b, c never satisfy aⁿ + bⁿ = cⁿ. Over ℕ that is the theorem for one n, and FermatLastTheorem says it for every n ≥ 3.
A definition is not a proof
Lean accepted def FermatLastTheorem : Prop := …. That only means the statement is well-formed. A def of a Prop writes the claim down; it proves nothing.
What Mathlib does prove are special cases, each a real theorem:
#check fermatLastTheoremFour
#print axioms fermatLastTheoremFour
#check @FermatLastTheorem.of_odd_primes
The proof for n = 4 is a few hundred lines (and there is one for n = 3). You did not read it, and you do not need to: you read its statement, its definitions, and its axioms.
The last one is honest and useful: if Fermat holds for every odd prime exponent, then it holds for all n ≥ 3. Remember it.
Fake proof 1
Now the AI’s files. Each one is accepted by Lean, and each is called fermat_last_theorem. Here is the first. Here it is. The Lab’s automatic Audit has this to say about it:
/-- Fermat's Last Theorem, proved. -/
theorem fermat_last_theorem
(hprimes : ∀ p : ℕ, Nat.Prime p → Odd p → FermatLastTheoremFor p) :
FermatLastTheorem :=
FermatLastTheorem.of_odd_primes hprimes
The audit reports no red flags. The proof is a real Mathlib theorem. And yet…
Fake proof 2
/-- The key step: Fermat for odd prime exponents. -/
theorem flt_odd_prime (p : ℕ) (hp : Nat.Prime p) (hodd : Odd p) :
FermatLastTheoremFor p := p:ℕhp:Nat.Prime phodd:Odd p⊢ FermatLastTheoremFor p
All goals completed! 🐙
/-- Fermat's Last Theorem, proved. -/
theorem fermat_last_theorem : FermatLastTheorem :=
FermatLastTheorem.of_odd_primes flt_odd_prime
#print axioms fermat_last_theorem
Lean shows one yellow warning, on the helper lemma, not on fermat_last_theorem itself.
Fake proof 3
/-- Fermat's Last Theorem: for every n ≥ 3, the equation aⁿ + bⁿ = cⁿ fails. -/
theorem fermat_last_theorem : ∀ n ≥ 3, ∃ a b c : ℕ, a ^ n + b ^ n ≠ c ^ n := ⊢ ∀ n ≥ 3, ∃ a b c, a ^ n + b ^ n ≠ c ^ n
n:ℕhn:n ≥ 3⊢ ∃ a b c, a ^ n + b ^ n ≠ c ^ n
exact ⟨1, 1, 1, n:ℕhn:n ≥ 3⊢ 1 ^ n + 1 ^ n ≠ 1 ^ n All goals completed! 🐙⟩
No sorry, standard axioms, and the audit finds no red flags (it only notes that hn is never used). Read the statement out loud.
Fake proof 4
/-- Fermat's Last Theorem for every exponent n ≥ 3. -/
theorem fermat_last_theorem (n : ℕ) (h3 : 3 ≤ n) (hsmall : n * n < 9) :
FermatLastTheoremFor n := n:ℕh3:3 ≤ nhsmall:n * n < 9⊢ FermatLastTheoremFor n
All goals completed! 🐙
This one uses Mathlib’s own statement, FermatLastTheoremFor n, and a one-word proof.
The verdict, and what you just did
Four fakes, four different tricks, mapped to the checklist:
-
A hypothesis that carries the claim: step 4. The automatic checks saw nothing; only reading caught it.
-
A hidden `sorry`: step 1, caught by
#print axiomsand the audit. -
A weaker statement (∃ instead of ∀): step 2. Only reading the statement out loud caught it.
-
Impossible hypotheses: step 3, caught by the audit.
Two of the four passed every automatic check. That is why the audit tool lists what it checked and what is your turn, and why this course taught you to read.
And the honest status, in this version of Mathlib: Fermat’s Last Theorem is stated (FermatLastTheorem), the cases n = 3 and n = 4 are proved, and it is reduced to odd prime exponents. The full proof is being formalized in a separate project.