Documentation

Archive.ZagierTwoSquares

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.

structure Zagier.Triple (k : ℕ) :

A structure holding a triple of natural numbers (x, y, z) satisfying x * x + 4 * y * z = 4 * k + 1.

  • x : ℕ

    First number

  • y : ℕ

    Second number

  • z : ℕ

    Third number

  • eqn : self.x * self.x + 4 * self.y * self.z = 4 * k + 1

    The specified equation

Instances For
    theorem Zagier.Triple.ext_iff {k : ℕ} {x y : Triple k} :
    x = y ↔ x.x = y.x ∧ x.y = y.y ∧ x.z = y.z
    theorem Zagier.Triple.ext {k : ℕ} {x y : Triple k} :
    x.x = y.x → x.y = y.y → ∀ (z : x.z = y.z), x = y
    def Zagier.instDecidableEqTriple.decEq {k✝ : ℕ} (x✝ x✝¹ : Triple k✝) :
    Decidable (x✝ = x✝¹)
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      def Zagier.Triple.swap {k : ℕ} (T : Triple k) :

      The obvious involution (x, y, z) ↦ (x, z, y).

      Equations
      • T.swap = { x := T.x, y := T.z, z := T.y, eqn := ⋯ }
      Instances For
        theorem Zagier.Triple.sq_add_sq_of_swap_eq_self {k : ℕ} (T : Triple k) (sT : T.swap = T) :
        ∃ (a : ℕ) (b : ℕ), a ^ 2 + b ^ 2 = 4 * k + 1

        Fixed points of swap yield decompositions of 4 * k + 1 into two squares.

        theorem Zagier.Triple.x_ne_zero {k : ℕ} (T : Triple k) :
        T.x ≠ 0
        theorem Zagier.Triple.y_ne_zero {k : ℕ} (T : Triple k) [hk : Fact (Nat.Prime (4 * k + 1))] :
        T.y ≠ 0
        theorem Zagier.Triple.z_ne_zero {k : ℕ} (T : Triple k) [hk : Fact (Nat.Prime (4 * k + 1))] :
        T.z ≠ 0
        theorem Zagier.Triple.y_mem_Icc_one_succ {k : ℕ} (T : Triple k) [hk : Fact (Nat.Prime (4 * k + 1))] :
        theorem Zagier.Triple.z_mem_Icc_one_succ {k : ℕ} (T : Triple k) [hk : Fact (Nat.Prime (4 * k + 1))] :
        @[instance_reducible]
        instance Zagier.Triple.instFintype {k : ℕ} [hk : Fact (Nat.Prime (4 * k + 1))] :
        Equations
        • One or more equations did not get rendered due to their size.

        The complicated involution, defined piecewise according to how x compares with y - z and 2 * y.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem Zagier.Triple.eq_of_piecewise_eq_self {k : ℕ} (T : Triple k) [hk : Fact (Nat.Prime (4 * k + 1))] (mT : T.piecewise = T) :
          T = { x := 1, y := 1, z := k, eqn := ⋯ }

          The only fixed point of piecewise is (1, 1, k).

          theorem Nat.Prime.sq_add_sq' {p : ℕ} [h : Fact (Prime p)] (hp : p % 4 = 1) :
          ∃ (a : ℕ) (b : ℕ), a ^ 2 + b ^ 2 = p

          Fermat's theorem on sums of two squares (Wiedijk #20). Every prime congruent to 1 mod 4 is the sum of two squares, proved using Zagier's involutions.