Documentation

Mathlib.NumberTheory.Zsqrtd.GaussianInt

Gaussian integers #

The Gaussian integers are complex integer, complex numbers whose real and imaginary parts are both integers.

Main definitions #

The Euclidean domain structure on ℤ[i] is defined in this file.

The homomorphism GaussianInt.toComplex into the complex numbers is also defined in this file.

See also #

See NumberTheory.Zsqrtd.QuadraticReciprocity for:

Notation #

This file uses the local notation ℤ[i] for GaussianInt

Implementation notes #

Gaussian integers are implemented using the more general definition Zsqrtd, the type of integers adjoined a square root of d, in this case -1. The definition is reducible, so that properties and definitions about Zsqrtd can easily be used.

@[reducible, inline]

The Gaussian integers, defined as ℤ√(-1).

Equations
    Instances For

      The embedding of the Gaussian integers into the complex numbers, as a ring homomorphism.

      Equations
        Instances For
          theorem GaussianInt.toComplex_def' (x y : ) :
          toComplex { re := x, im := y } = x + y * Complex.I
          @[deprecated GaussianInt.intCast_re (since := "2025-08-31")]

          Alias of GaussianInt.intCast_re.

          @[deprecated GaussianInt.intCast_im (since := "2025-08-31")]

          Alias of GaussianInt.intCast_im.

          @[simp]
          theorem GaussianInt.re_toComplex (x y : ) :
          (toComplex { re := x, im := y }).re = x
          @[deprecated GaussianInt.re_toComplex (since := "2025-08-31")]
          theorem GaussianInt.toComplex_re (x y : ) :
          (toComplex { re := x, im := y }).re = x

          Alias of GaussianInt.re_toComplex.

          @[simp]
          theorem GaussianInt.im_toComplex (x y : ) :
          (toComplex { re := x, im := y }).im = y
          @[deprecated GaussianInt.im_toComplex (since := "2025-08-31")]
          theorem GaussianInt.toComplex_im (x y : ) :
          (toComplex { re := x, im := y }).im = y

          Alias of GaussianInt.im_toComplex.

          theorem GaussianInt.div_def (x y : GaussianInt) :
          x / y = { re := round ((x * star y).re / (Zsqrtd.norm y)), im := round ((x * star y).im / (Zsqrtd.norm y)) }
          @[deprecated GaussianInt.toComplex_re_div (since := "2025-08-31")]

          Alias of GaussianInt.toComplex_re_div.

          @[deprecated GaussianInt.toComplex_im_div (since := "2025-08-31")]

          Alias of GaussianInt.toComplex_im_div.

          theorem GaussianInt.mod_def (x y : GaussianInt) :
          x % y = x - y * (x / y)
          theorem GaussianInt.sq_add_sq_of_nat_prime_of_not_irreducible (p : ) [hp : Fact (Nat.Prime p)] (hpi : ¬Irreducible p) :
          ∃ (a : ) (b : ), a ^ 2 + b ^ 2 = p