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:
prime_iff_mod_four_eq_three_of_nat_prime: A prime natural number is prime inℤ[i]if and only if it is3mod4
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).
Instances For
The embedding of the Gaussian integers into the complex numbers, as a ring homomorphism.
Instances For
@[simp]
@[simp]
@[simp]
@[simp]
@[simp]
theorem
GaussianInt.toComplex_star
(x : GaussianInt)
:
toComplex (star x) = (starRingEnd ℂ) (toComplex x)
@[simp]
@[simp]
@[simp]
theorem
GaussianInt.intCast_real_norm
(x : GaussianInt)
:
↑(Zsqrtd.norm x) = Complex.normSq (toComplex x)
@[simp]
theorem
GaussianInt.intCast_complex_norm
(x : GaussianInt)
:
↑(Zsqrtd.norm x) = ↑(Complex.normSq (toComplex x))
@[simp]
theorem
GaussianInt.natCast_natAbs_norm
{α : Type u_1}
[AddGroupWithOne α]
(x : GaussianInt)
:
↑(Zsqrtd.norm x).natAbs = ↑(Zsqrtd.norm x)
theorem
GaussianInt.natAbs_norm_eq
(x : GaussianInt)
:
(Zsqrtd.norm x).natAbs = x.re.natAbs * x.re.natAbs + x.im.natAbs * x.im.natAbs
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)) }
@[implicit_reducible]
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