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 #
EuclideanDomain: Defines Euclidean domain with functionsquotientandremainder. Instances ofDivandModare 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.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 #
- [Th. Motzkin, The Euclidean algorithm][MR32592]
- [J.-J. Hiblot, Des anneaux euclidiens dont le plus petit algorithme n'est pas à valeurs finies] [MR399081]
- [M. Nagata, On Euclid algorithm][MR541021]
Tags #
Euclidean domain, transfinite Euclidean domain, Bézout's lemma
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.
- add : R → R → R
- zero : R
- mul : R → R → R
- one : R
- neg : R → R
- sub : R → R → R
- quotient : R → R → R
A division function (denoted
/) onR. This satisfies the propertyb * (a / b) + a % b = a, where%denotesremainder. Division by zero should always give zero by convention.
- remainder : R → R → R
A remainder function (denoted
%) onR. This satisfies the propertyb * (a / b) + a % b = a, where/denotesquotient. - quotient_mul_add_remainder_eq (a b : R) : b * EuclideanDomain.quotient a b + EuclideanDomain.remainder a b = a
The property that links the quotient and remainder functions. This allows us to compute GCDs and LCMs.
- r : R → R → Prop
A well-founded relation on
R, satisfyingr (a % b) b. This ensures that the GCD algorithm always terminates. - r_wellFounded : WellFounded EuclideanDomain.r
The relation
rmust be well-founded. This ensures that the GCD algorithm always terminates. An additional constraint on
r.
Instances
Equations
- EuclideanDomain.wellFoundedRelation = { rel := EuclideanDomain.r, wf := ⋯ }
Instances For
Equations
Equations
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
- EuclideanDomain.gcd a b = if a0 : a = 0 then b else have x := ⋯; EuclideanDomain.gcd (b % a) a
Instances For
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
Instances For
Use the extended GCD algorithm to generate the a and b values
satisfying gcd x y = x * a + y * b.
Equations
- EuclideanDomain.xgcd x y = (EuclideanDomain.xgcdAux x 1 0 y 0 1).snd
Instances For
The extended GCD a value in the equation gcd x y = x * a + y * b.
Equations
- EuclideanDomain.gcdA x y = (EuclideanDomain.xgcd x y).fst
Instances For
The extended GCD b value in the equation gcd x y = x * a + y * b.
Equations
- EuclideanDomain.gcdB x y = (EuclideanDomain.xgcd x y).snd
Instances For
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
- EuclideanDomain.lcm x y = x * y / EuclideanDomain.gcd x y