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.
Equations
- One or more equations did not get rendered due to their size.
Equations
- GaussianInt.instCommRing = Zsqrtd.commRing
The embedding of the Gaussian integers into the complex numbers, as a ring homomorphism.
Equations
- GaussianInt.toComplex = Zsqrtd.lift { val := Complex.I, property := GaussianInt.toComplex.proof_1 }
Instances For
Equations
theorem
GaussianInt.toComplex_def
(x : GaussianInt)
:
GaussianInt.toComplex x = ↑x.re + ↑x.im * Complex.I
theorem
GaussianInt.toComplex_def'
(x : ℤ)
(y : ℤ)
:
GaussianInt.toComplex { re := x, im := y } = ↑x + ↑y * Complex.I
theorem
GaussianInt.toComplex_def₂
(x : GaussianInt)
:
GaussianInt.toComplex x = { re := ↑x.re, im := ↑x.im }
@[simp]
@[simp]
@[simp]
theorem
GaussianInt.toComplex_re
(x : ℤ)
(y : ℤ)
:
(GaussianInt.toComplex { re := x, im := y }).re = ↑x
@[simp]
theorem
GaussianInt.toComplex_im
(x : ℤ)
(y : ℤ)
:
(GaussianInt.toComplex { re := x, im := y }).im = ↑y
@[simp]
theorem
GaussianInt.toComplex_star
(x : GaussianInt)
:
GaussianInt.toComplex (star x) = (starRingEnd ℂ) (GaussianInt.toComplex x)
@[simp]
theorem
GaussianInt.toComplex_inj
{x : GaussianInt}
{y : GaussianInt}
:
GaussianInt.toComplex x = GaussianInt.toComplex y ↔ x = y
@[simp]
@[simp]
theorem
GaussianInt.int_cast_real_norm
(x : GaussianInt)
:
↑(Zsqrtd.norm x) = Complex.normSq (GaussianInt.toComplex x)
@[simp]
theorem
GaussianInt.int_cast_complex_norm
(x : GaussianInt)
:
↑(Zsqrtd.norm x) = ↑(Complex.normSq (GaussianInt.toComplex x))
theorem
GaussianInt.abs_coe_nat_norm
(x : GaussianInt)
:
↑(Int.natAbs (Zsqrtd.norm x)) = Zsqrtd.norm x
@[simp]
theorem
GaussianInt.nat_cast_natAbs_norm
{α : Type u_1}
[Ring α]
(x : GaussianInt)
:
↑(Int.natAbs (Zsqrtd.norm x)) = ↑(Zsqrtd.norm x)
theorem
GaussianInt.natAbs_norm_eq
(x : GaussianInt)
:
Int.natAbs (Zsqrtd.norm x) = Int.natAbs x.re * Int.natAbs x.re + Int.natAbs x.im * Int.natAbs x.im
Equations
- One or more equations did not get rendered due to their size.
theorem
GaussianInt.toComplex_div_re
(x : GaussianInt)
(y : GaussianInt)
:
(GaussianInt.toComplex (x / y)).re = ↑(round (GaussianInt.toComplex x / GaussianInt.toComplex y).re)
theorem
GaussianInt.toComplex_div_im
(x : GaussianInt)
(y : GaussianInt)
:
(GaussianInt.toComplex (x / y)).im = ↑(round (GaussianInt.toComplex x / GaussianInt.toComplex y).im)
theorem
GaussianInt.normSq_le_normSq_of_re_le_of_im_le
{x : ℂ}
{y : ℂ}
(hre : |x.re| ≤ |y.re|)
(him : |x.im| ≤ |y.im|)
:
theorem
GaussianInt.normSq_div_sub_div_lt_one
(x : GaussianInt)
(y : GaussianInt)
:
Complex.normSq (GaussianInt.toComplex x / GaussianInt.toComplex y - GaussianInt.toComplex (x / y)) < 1
Equations
- GaussianInt.instModGaussianInt = { mod := fun (x y : GaussianInt) => x - y * (x / y) }
theorem
GaussianInt.norm_mod_lt
(x : GaussianInt)
{y : GaussianInt}
(hy : y ≠ 0)
:
Zsqrtd.norm (x % y) < Zsqrtd.norm y
theorem
GaussianInt.natAbs_norm_mod_lt
(x : GaussianInt)
{y : GaussianInt}
(hy : y ≠ 0)
:
Int.natAbs (Zsqrtd.norm (x % y)) < Int.natAbs (Zsqrtd.norm y)
theorem
GaussianInt.norm_le_norm_mul_left
(x : GaussianInt)
{y : GaussianInt}
(hy : y ≠ 0)
:
Int.natAbs (Zsqrtd.norm x) ≤ Int.natAbs (Zsqrtd.norm (x * y))
Equations
Equations
- One or more equations did not get rendered due to their size.