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 is3
mod4
Notations #
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.
The Gaussian integers, defined as ℤ√(-1)
.
Equations
- GaussianInt = ℤ√(-1)
Instances For
Equations
- GaussianInt.instRepr = { reprPrec := fun (x : GaussianInt) (x_1 : ℕ) => Std.Format.text "⟨" ++ repr x.re ++ Std.Format.text ", " ++ repr x.im ++ Std.Format.text "⟩" }
Equations
- GaussianInt.instCommRing = Zsqrtd.commRing
The embedding of the Gaussian integers into the complex numbers, as a ring homomorphism.
Equations
- GaussianInt.toComplex = Zsqrtd.lift ⟨Complex.I, GaussianInt.toComplex.proof_1⟩
Instances For
Equations
- GaussianInt.instCoeComplex = { coe := ⇑GaussianInt.toComplex }
Alias of GaussianInt.intCast_real_norm
.
Alias of GaussianInt.intCast_complex_norm
.
Alias of GaussianInt.abs_natCast_norm
.
Alias of GaussianInt.natCast_natAbs_norm
.
Equations
- GaussianInt.instDiv = { div := fun (x y : GaussianInt) => let n := (↑(Zsqrtd.norm y))⁻¹; let c := star y; { re := round (↑(x * c).re * n), im := round (↑(x * c).im * n) } }
Equations
- GaussianInt.instMod = { mod := fun (x y : GaussianInt) => x - y * (x / y) }
Equations
- One or more equations did not get rendered due to their size.