Zagier's "one-sentence proof" of Fermat's theorem on sums of two squares #
"The involution on the finite set S = {(x, y, z) : ℕ × ℕ × ℕ | x ^ 2 + 4 * y * z = p} defined by
(x, y, z) ↦ (x + 2 * z, z, y - x - z) if x < y - z
(2 * y - x, y, x - y + z) if y - z < x < 2 * y
(x - 2 * y, x - y + z, y) if x > 2 * y
has exactly one fixed point, so |S| is odd and the involution defined by
(x, y, z) ↦ (x, z, y) also has a fixed point." — Don Zagier
This elementary proof (Nat.Prime.sq_add_sq') is independent of Nat.Prime.sq_add_sq in
Mathlib/NumberTheory/SumTwoSquares.lean, which uses the unique factorisation of ℤ[i].
For a geometric interpretation of the piecewise involution (Zagier.complexInvo)
see Moritz Firsching's MathOverflow answer.
@[instance_reducible]