Documentation

LeanCourse.MIL.C06_Structures.S03_Building_the_Gaussian_Integers

theorem GaussInt.ext_iff {x : GaussInt} {y : GaussInt} :
x = y x.re = y.re x.im = y.im
theorem GaussInt.ext {x : GaussInt} {y : GaussInt} (re : x.re = y.re) (im : x.im = y.im) :
x = y
structure GaussInt :
Instances For
    Equations
    Equations
    Equations
    Equations
    Equations
    theorem GaussInt.zero_def :
    0 = { re := 0, im := 0 }
    theorem GaussInt.one_def :
    1 = { re := 1, im := 0 }
    theorem GaussInt.add_def (x : GaussInt) (y : GaussInt) :
    x + y = { re := x.re + y.re, im := x.im + y.im }
    theorem GaussInt.neg_def (x : GaussInt) :
    -x = { re := -x.re, im := -x.im }
    theorem GaussInt.mul_def (x : GaussInt) (y : GaussInt) :
    x * y = { re := x.re * y.re - x.im * y.im, im := x.re * y.im + x.im * y.re }
    @[simp]
    @[simp]
    @[simp]
    @[simp]
    @[simp]
    theorem GaussInt.add_re (x : GaussInt) (y : GaussInt) :
    (x + y).re = x.re + y.re
    @[simp]
    theorem GaussInt.add_im (x : GaussInt) (y : GaussInt) :
    (x + y).im = x.im + y.im
    @[simp]
    theorem GaussInt.neg_re (x : GaussInt) :
    (-x).re = -x.re
    @[simp]
    theorem GaussInt.neg_im (x : GaussInt) :
    (-x).im = -x.im
    @[simp]
    theorem GaussInt.mul_re (x : GaussInt) (y : GaussInt) :
    (x * y).re = x.re * y.re - x.im * y.im
    @[simp]
    theorem GaussInt.mul_im (x : GaussInt) (y : GaussInt) :
    (x * y).im = x.re * y.im + x.im * y.re
    @[simp]
    theorem GaussInt.sub_re (x : GaussInt) (y : GaussInt) :
    (x - y).re = x.re - y.re
    @[simp]
    theorem GaussInt.sub_im (x : GaussInt) (y : GaussInt) :
    (x - y).im = x.im - y.im
    def Int.div' (a : ) (b : ) :
    Equations
    • a.div' b = (a + b / 2) / b
    Instances For
      def Int.mod' (a : ) (b : ) :
      Equations
      • a.mod' b = (a + b / 2) % b - b / 2
      Instances For
        theorem Int.div'_add_mod' (a : ) (b : ) :
        b * a.div' b + a.mod' b = a
        theorem Int.abs_mod'_le (a : ) (b : ) (h : 0 < b) :
        |a.mod' b| b / 2
        theorem Int.mod'_eq (a : ) (b : ) :
        a.mod' b = a - b * a.div' b
        theorem sq_add_sq_eq_zero {α : Type u_1} [LinearOrderedRing α] (x : α) (y : α) :
        x ^ 2 + y ^ 2 = 0 x = 0 y = 0
        Equations
        • x.norm = x.re ^ 2 + x.im ^ 2
        Instances For
          @[simp]
          theorem GaussInt.norm_nonneg (x : GaussInt) :
          0 x.norm
          theorem GaussInt.norm_eq_zero (x : GaussInt) :
          x.norm = 0 x = 0
          theorem GaussInt.norm_pos (x : GaussInt) :
          0 < x.norm x 0
          theorem GaussInt.norm_mul (x : GaussInt) (y : GaussInt) :
          (x * y).norm = x.norm * y.norm
          Equations
          • x.conj = { re := x.re, im := -x.im }
          Instances For
            @[simp]
            theorem GaussInt.conj_re (x : GaussInt) :
            x.conj.re = x.re
            @[simp]
            theorem GaussInt.conj_im (x : GaussInt) :
            x.conj.im = -x.im
            theorem GaussInt.norm_conj (x : GaussInt) :
            x.conj.norm = x.norm
            Equations
            Equations
            theorem GaussInt.div_def (x : GaussInt) (y : GaussInt) :
            x / y = { re := (x * y.conj).re.div' y.norm, im := (x * y.conj).im.div' y.norm }
            theorem GaussInt.mod_def (x : GaussInt) (y : GaussInt) :
            x % y = x - y * (x / y)
            theorem GaussInt.norm_mod_lt (x : GaussInt) {y : GaussInt} (hy : y 0) :
            (x % y).norm < y.norm
            theorem GaussInt.coe_natAbs_norm (x : GaussInt) :
            x.norm.natAbs = x.norm
            theorem GaussInt.natAbs_norm_mod_lt (x : GaussInt) (y : GaussInt) (hy : y 0) :
            (x % y).norm.natAbs < y.norm.natAbs
            theorem GaussInt.not_norm_mul_left_lt_norm (x : GaussInt) {y : GaussInt} (hy : y 0) :
            ¬(x * y).norm.natAbs < x.norm.natAbs
            Equations
            • One or more equations did not get rendered due to their size.