Euclidean domains #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
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 #
euclidean_domain: Defines Euclidean domain with functionsquotientandremainder. Instances ofhas_divandhas_modare provided, so that one can writea = b * (a / b) + a % b.gcd: defines the greatest common divisors of two elements of a Euclidean domain.xgcd: given two elementsa b : R,xgcd a bdefines the pair(x, y)such thatx * a + y * b = gcd a b.lcm: defines the lowest common multiple of two elementsaandbof a Euclidean domain asa * b / (gcd a b)
Main statements #
See algebra.euclidean_domain.basic for most of the theorems about Euclidean domains,
including Bézout's lemma.
See algebra.euclidean_domain.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, euclidean_domain 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 #
- Th. Motzkin, The Euclidean algorithm
- J.-J. Hiblot, Des anneaux euclidiens dont le plus petit algorithme n'est pas à valeurs finies
- M. Nagata, On Euclid algorithm
Tags #
Euclidean domain, transfinite Euclidean domain, Bézout's lemma
- to_comm_ring : comm_ring R
- to_nontrivial : nontrivial R
- quotient : R → R → R
- quotient_zero : ∀ (a : R), euclidean_domain.quotient a 0 = 0
- remainder : R → R → R
- quotient_mul_add_remainder_eq : ∀ (a b : R), b * euclidean_domain.quotient a b + euclidean_domain.remainder a b = a
- r : R → R → Prop
- r_well_founded : well_founded euclidean_domain.r
- remainder_lt : ∀ (a : R) {b : R}, b ≠ 0 → euclidean_domain.r (euclidean_domain.remainder a b) b
- mul_left_not_lt : ∀ (a : R) {b : R}, b ≠ 0 → ¬euclidean_domain.r (a * b) a
A euclidean_domain is an 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 of this typeclass
Instances of other typeclasses for euclidean_domain
- euclidean_domain.has_sizeof_inst
Equations
- euclidean_domain.has_div = {div := euclidean_domain.quotient _inst_1}
Equations
- euclidean_domain.has_mod = {mod := euclidean_domain.remainder _inst_1}
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
- euclidean_domain.gcd a = λ (b : R), ite (a = 0) b (euclidean_domain.gcd (b % a) a)
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 xgcd_aux takes in two triples, and from these recursively computes the next triple:
xgcd_aux (r, s, t) (r', s', t') = xgcd_aux (r' % r, s' - (r' / r) * s, t' - (r' / r) * t) (r, s, t)
Use the extended GCD algorithm to generate the a and b values
satisfying gcd x y = x * a + y * b.
Equations
- euclidean_domain.xgcd x y = (euclidean_domain.xgcd_aux x 1 0 y 0 1).snd
The extended GCD a value in the equation gcd x y = x * a + y * b.
Equations
- euclidean_domain.gcd_a x y = (euclidean_domain.xgcd x y).fst
The extended GCD b value in the equation gcd x y = x * a + y * b.
Equations
- euclidean_domain.gcd_b x y = (euclidean_domain.xgcd x y).snd
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
- euclidean_domain.lcm x y = x * y / euclidean_domain.gcd x y