Documentation

Mathlib.Algebra.EuclideanDomain.Defs

Euclidean domains #

This file introduces Euclidean domains and provides the extended Euclidean algorithm. To be precise, a slightly more general version is provided which is sometimes called a transfinite Euclidean domain and differs in the fact that the degree function need not take values in but can take values in any well-ordered set. Transfinite Euclidean domains were introduced by Motzkin and examples which don't satisfy the classical notion were provided independently by Hiblot and Nagata.

Main definitions #

Main statements #

See Algebra.EuclideanDomain.Basic for most of the theorems about Euclidean domains, including Bézout's lemma.

See Algebra.EuclideanDomain.Instances for the fact that is a Euclidean domain, as is any field.

Notation #

denotes the well founded relation on the Euclidean domain, e.g. in the example of the polynomial ring over a field, p ≺ q for polynomials p and q if and only if the degree of p is less than the degree of q.

Implementation details #

Instead of working with a valuation, EuclideanDomain is implemented with the existence of a well founded relation r on the integral domain R, which in the example of would correspond to setting i ≺ j for integers i and j if the absolute value of i is smaller than the absolute value of j.

References #

Tags #

Euclidean domain, transfinite Euclidean domain, Bézout's lemma

class EuclideanDomain (R : Type u) extends CommRing , Nontrivial :

A EuclideanDomain is a non-trivial commutative ring with a division and a remainder, satisfying b * (a / b) + a % b = a. The definition of a Euclidean domain usually includes a valuation function R → ℕ. This definition is slightly generalised to include a well founded relation r with the property that r (a % b) b, instead of a valuation.

Instances
    Equations
    • EuclideanDomain.wellFoundedRelation = { rel := EuclideanDomain.r, wf := (_ : WellFounded EuclideanDomain.r) }
    Instances For
      Equations
      • EuclideanDomain.instDiv = { div := EuclideanDomain.quotient }
      Equations
      • EuclideanDomain.instMod = { mod := EuclideanDomain.remainder }
      theorem EuclideanDomain.div_add_mod {R : Type u} [EuclideanDomain R] (a : R) (b : R) :
      b * (a / b) + a % b = a
      theorem EuclideanDomain.mod_add_div {R : Type u} [EuclideanDomain R] (a : R) (b : R) :
      a % b + b * (a / b) = a
      theorem EuclideanDomain.mod_add_div' {R : Type u} [EuclideanDomain R] (m : R) (k : R) :
      m % k + m / k * k = m
      theorem EuclideanDomain.div_add_mod' {R : Type u} [EuclideanDomain R] (m : R) (k : R) :
      m / k * k + m % k = m
      theorem EuclideanDomain.mod_eq_sub_mul_div {R : Type u_1} [EuclideanDomain R] (a : R) (b : R) :
      a % b = a - b * (a / b)
      theorem EuclideanDomain.mod_lt {R : Type u} [EuclideanDomain R] (a : R) {b : R} :
      b 0EuclideanDomain.r (a % b) b
      theorem EuclideanDomain.mul_right_not_lt {R : Type u} [EuclideanDomain R] {a : R} (b : R) (h : a 0) :
      @[simp]
      theorem EuclideanDomain.mod_zero {R : Type u} [EuclideanDomain R] (a : R) :
      a % 0 = a
      theorem EuclideanDomain.lt_one {R : Type u} [EuclideanDomain R] (a : R) :
      EuclideanDomain.r a 1a = 0
      theorem EuclideanDomain.val_dvd_le {R : Type u} [EuclideanDomain R] (a : R) (b : R) :
      b aa 0¬EuclideanDomain.r a b
      @[simp]
      theorem EuclideanDomain.div_zero {R : Type u} [EuclideanDomain R] (a : R) :
      a / 0 = 0
      theorem EuclideanDomain.GCD.induction {R : Type u} [EuclideanDomain R] {P : RRProp} (a : R) (b : R) (H0 : ∀ (x : R), P 0 x) (H1 : ∀ (a b : R), a 0P (b % a) aP a b) :
      P a b
      def EuclideanDomain.gcd {R : Type u} [EuclideanDomain R] [DecidableEq R] (a : R) (b : R) :
      R

      gcd a b is a (non-unique) element such that gcd a b ∣ a gcd a b ∣ b, and for any element c such that c ∣ a and c ∣ b, then c ∣ gcd a b

      Equations
      Instances For
        def EuclideanDomain.xgcdAux {R : Type u} [EuclideanDomain R] [DecidableEq R] (r : R) (s : R) (t : R) (r' : R) (s' : R) (t' : R) :
        R × R × R

        An implementation of the extended GCD algorithm. At each step we are computing a triple (r, s, t), where r is the next value of the GCD algorithm, to compute the greatest common divisor of the input (say x and y), and s and t are the coefficients in front of x and y to obtain r (i.e. r = s * x + t * y). The function xgcdAux takes in two triples, and from these recursively computes the next triple:

        xgcdAux (r, s, t) (r', s', t') = xgcdAux (r' % r, s' - (r' / r) * s, t' - (r' / r) * t) (r, s, t)
        
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          @[simp]
          theorem EuclideanDomain.xgcd_zero_left {R : Type u} [EuclideanDomain R] [DecidableEq R] {s : R} {t : R} {r' : R} {s' : R} {t' : R} :
          EuclideanDomain.xgcdAux 0 s t r' s' t' = (r', s', t')
          theorem EuclideanDomain.xgcdAux_rec {R : Type u} [EuclideanDomain R] [DecidableEq R] {r : R} {s : R} {t : R} {r' : R} {s' : R} {t' : R} (h : r 0) :
          EuclideanDomain.xgcdAux r s t r' s' t' = EuclideanDomain.xgcdAux (r' % r) (s' - r' / r * s) (t' - r' / r * t) r s t
          def EuclideanDomain.xgcd {R : Type u} [EuclideanDomain R] [DecidableEq R] (x : R) (y : R) :
          R × R

          Use the extended GCD algorithm to generate the a and b values satisfying gcd x y = x * a + y * b.

          Equations
          Instances For
            def EuclideanDomain.gcdA {R : Type u} [EuclideanDomain R] [DecidableEq R] (x : R) (y : R) :
            R

            The extended GCD a value in the equation gcd x y = x * a + y * b.

            Equations
            Instances For
              def EuclideanDomain.gcdB {R : Type u} [EuclideanDomain R] [DecidableEq R] (x : R) (y : R) :
              R

              The extended GCD b value in the equation gcd x y = x * a + y * b.

              Equations
              Instances For
                def EuclideanDomain.lcm {R : Type u} [EuclideanDomain R] [DecidableEq R] (x : R) (y : R) :
                R

                lcm a b is a (non-unique) element such that a ∣ lcm a b b ∣ lcm a b, and for any element c such that a ∣ c and b ∣ c, then lcm a b ∣ c

                Equations
                Instances For