Monoids with normalization functions, gcd
, and lcm
This file defines extra structures on comm_cancel_monoid_with_zero
s, including integral_domain
s.
Main Definitions
Implementation Notes
normalization_monoid
is defined by assigning to each element anorm_unit
such that multiplying by that unit normalizes the monoid, andnormalize
is an idempotent monoid homomorphism. This definition as currently implemented does casework on0
.gcd_monoid
extendsnormalization_monoid
, so thegcd
andlcm
are always normalized. This makesgcd
s of polynomials easier to work with, but excludes Euclidean domains, and monoids without zero.
TODO
- Provide a GCD monoid instance for
ℕ
, port GCD facts about nats, definition of coprime - Generalize normalization monoids to commutative (cancellative) monoids with or without zero
- Generalize GCD monoid to not require normalization in all cases
Tags
divisibility, gcd, lcm, normalize
- norm_unit : α → units α
- norm_unit_zero : normalization_monoid.norm_unit 0 = 1
- norm_unit_mul : ∀ {a b : α}, a ≠ 0 → b ≠ 0 → normalization_monoid.norm_unit (a * b) = normalization_monoid.norm_unit a * normalization_monoid.norm_unit b
- norm_unit_coe_units : ∀ (u : units α), normalization_monoid.norm_unit ↑u = u⁻¹
Normalization monoid: multiplying with norm_unit
gives a normal form for associated elements.
Chooses an element of each associate class, by multiplying by norm_unit
Maps an element of associates
back to the normalized element of its associate class
Equations
- associates.out = quotient.lift ⇑normalize associates.out._proof_1
- norm_unit : α → units α
- norm_unit_zero : gcd_monoid.norm_unit 0 = 1
- norm_unit_mul : ∀ {a b : α}, a ≠ 0 → b ≠ 0 → gcd_monoid.norm_unit (a * b) = gcd_monoid.norm_unit a * gcd_monoid.norm_unit b
- norm_unit_coe_units : ∀ (u : units α), gcd_monoid.norm_unit ↑u = u⁻¹
- gcd : α → α → α
- lcm : α → α → α
- gcd_dvd_left : ∀ (a b : α), gcd_monoid.gcd a b ∣ a
- gcd_dvd_right : ∀ (a b : α), gcd_monoid.gcd a b ∣ b
- dvd_gcd : ∀ {a b c_1 : α}, a ∣ c_1 → a ∣ b → a ∣ gcd_monoid.gcd c_1 b
- normalize_gcd : ∀ (a b : α), ⇑normalize (gcd_monoid.gcd a b) = gcd_monoid.gcd a b
- gcd_mul_lcm : ∀ (a b : α), gcd_monoid.gcd a b * gcd_monoid.lcm a b = ⇑normalize (a * b)
- lcm_zero_left : ∀ (a : α), gcd_monoid.lcm 0 a = 0
- lcm_zero_right : ∀ (a : α), gcd_monoid.lcm a 0 = 0
GCD monoid: a comm_cancel_monoid_with_zero
with normalization and gcd
(greatest common divisor) and lcm
(least common multiple) operations. In this setting gcd
and
lcm
form a bounded lattice on the associated elements where gcd
is the infimum, lcm
is the
supremum, 1
is bottom, and 0
is top. The type class focuses on gcd
and we derive the
corresponding lcm
facts from gcd
.
Instances
Equations
Equations
Equations
Equations
Equations
- int.normalization_monoid = {norm_unit := λ (a : ℤ), ite (0 ≤ a) 1 (-1), norm_unit_zero := int.normalization_monoid._proof_1, norm_unit_mul := int.normalization_monoid._proof_2, norm_unit_coe_units := int.normalization_monoid._proof_3}
Equations
- int.gcd_monoid = {norm_unit := normalization_monoid.norm_unit int.normalization_monoid, norm_unit_zero := int.gcd_monoid._proof_1, norm_unit_mul := int.gcd_monoid._proof_2, norm_unit_coe_units := int.gcd_monoid._proof_3, gcd := λ (a b : ℤ), ↑(a.gcd b), lcm := λ (a b : ℤ), ↑(a.lcm b), gcd_dvd_left := int.gcd_monoid._proof_4, gcd_dvd_right := int.gcd_monoid._proof_5, dvd_gcd := int.gcd_monoid._proof_6, normalize_gcd := int.gcd_monoid._proof_7, gcd_mul_lcm := int.gcd_monoid._proof_8, lcm_zero_left := int.gcd_monoid._proof_9, lcm_zero_right := int.gcd_monoid._proof_10}
Maps an associate class of integers consisting of -n, n
to n : ℕ
Equations
- associates_int_equiv_nat = {to_fun := λ (z : associates ℤ), z.out.nat_abs, inv_fun := λ (n : ℕ), associates.mk ↑n, left_inv := associates_int_equiv_nat._proof_1, right_inv := associates_int_equiv_nat._proof_2}
Equations
- nat.unique_units = {to_inhabited := {default := 1}, uniq := nat.units_eq_one}
Equations
- normalization_monoid_of_unique_units = {norm_unit := λ (x : α), 1, norm_unit_zero := _, norm_unit_mul := _, norm_unit_coe_units := _}