Monoids with normalization functions, gcd, and lcm #
This file defines extra structures on CommMonoidWithZeros.
Main Definitions #
NormalizationMonoidStrongNormalizationMonoidGCDMonoidIsGCDMonoidNormalizedGCDMonoidStrongNormalizedGCDMonoidgcdMonoidOfGCD,gcdMonoidOfExistsGCD,normalizedGCDMonoidOfGCD,normalizedGCDMonoidOfExistsGCDgcdMonoidOfLCM,gcdMonoidOfExistsLCM,normalizedGCDMonoidOfLCM,normalizedGCDMonoidOfExistsLCM
For the NormalizedGCDMonoid instances on ℕ and ℤ, see Mathlib/Algebra/GCDMonoid/Nat.lean.
Implementation Notes #
NormalizationMonoidis defined by assigning to each element anormUnitsuch that multiplying by that unit normalizes the monoid, andnormalizeis an idempotent function. This definition as currently implemented does casework on0.StrongNormalizationMonoidfurther requiresnormalizeto be a monoid homomorphism.GCDMonoidcontains the definitions ofgcdandlcmwith the usual properties. They are both determined up to a unit.IsGCDMonoidis the predicate for the existence of aGCDMonoidstructure.NormalizedGCDMonoidextendsNormalizationMonoid, so thegcdandlcmare always normalized. This makesgcds of polynomials easier to work with, but excludes Euclidean domains, and monoids without zero.StrongNormalizedGCDMonoidsimilarly extendsStrongNormalizationMonoid.gcdMonoidOfGCDandnormalizedGCDMonoidOfGCDnoncomputably construct aGCDMonoid(resp.NormalizedGCDMonoid) structure just from thegcdand its properties.gcdMonoidOfExistsGCDandnormalizedGCDMonoidOfExistsGCDnoncomputably construct aGCDMonoid(resp.NormalizedGCDMonoid) structure just from a proof that any two elements have a (not necessarily normalized)gcd.gcdMonoidOfLCMandnormalizedGCDMonoidOfLCMnoncomputably construct aGCDMonoid(resp.NormalizedGCDMonoid) structure just from thelcmand its properties.gcdMonoidOfExistsLCMandnormalizedGCDMonoidOfExistsLCMnoncomputably construct aGCDMonoid(resp.NormalizedGCDMonoid) structure just from a proof that any two elements have a (not necessarily normalized)lcm.
TODO #
- Port GCD facts about nats, definition of coprime
- Generalize normalization monoids to commutative (cancellative) monoids with or without zero
Tags #
divisibility, gcd, lcm, normalize
Construct a NormalizationMonoid from a right inverse of Associates.mk.
Equations
- NormalizationMonoid.ofRightInverse out mk_out out_one = { normUnit := fun (a : α) => if a = 0 then 1 else Exists.choose ⋯, normUnit_zero := ⋯, normUnit_one := ⋯, normUnit_mul_units := ⋯ }
Instances For
A cancellative monoid with zero always admits a NormalizationMonoid structure.
Strong normalization monoid: multiplying with normUnit gives a normal form for associated
elements. It is stronger in that it ensures the normalization map is a monoid homomorphism.
The proposition that
normUnitrespects multiplication of non-zero elements.The proposition that
normUnitmaps units to their inverses.
Instances
Chooses an element of each associate class, by multiplying by normUnit
Instances For
Maps an element of Associates back to the normalized element of its associate class
Equations
Instances For
normalize in a StrongNormalizationMonoid as a MonoidWithZeroHom.
Equations
- normalizeHom = { toFun := normalize, map_zero' := ⋯, map_one' := ⋯, map_mul' := ⋯ }
Instances For
GCD monoid: a cancellative CommMonoidWithZero with gcd (greatest common divisor) and
lcm (least common multiple) operations, determined up to a unit. The type class focuses on gcd
and we derive the corresponding lcm facts from gcd.
- gcd : α → α → α
The greatest common divisor between two elements.
- lcm : α → α → α
The least common multiple between two elements.
The GCD is a divisor of the first element.
The GCD is a divisor of the second element.
Any common divisor of both elements is a divisor of the GCD.
- gcd_mul_lcm (a b : α) : Associated (gcd a b * lcm a b) (a * b)
The product of two elements is
Associatedwith the product of their GCD and LCM. 0is left-absorbing.0is right-absorbing.
Instances
Existence of a GCDMonoid structure on a CommMonoidWithZero.
- intro {α : Type u_2} [CommMonoidWithZero α] : ∀ (a : GCDMonoid α), IsGCDMonoid α
Instances
Normalized GCD monoid: a cancellative CommMonoidWithZero 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
Strong normalized GCD monoid: a NormalizedGCDMonoid whose normalize function is a
monoid homomorphism.
Instances
Equations
- instNormalizedGCDMonoidOfStrongNormalizedGCDMonoid α = { toNormalizationMonoid := inst✝.toNormalizationMonoid, toGCDMonoid := inst✝.toGCDMonoid, normalize_gcd := ⋯, normalize_lcm := ⋯ }
Represent a divisor of m * n as a product of a divisor of m and a divisor of n.
Note: In general, this representation is highly non-unique.
See Nat.dvdProdDvdOfDvdProd for a constructive version on ℕ.
Alias of dvd_lcm_of_dvd_left.
Alias of dvd_lcm_of_dvd_right.
Equations
- instStrongNormalizationMonoid = { normUnit := fun (x : α) => 1, normUnit_zero := ⋯, normUnit_one := ⋯, normUnit_mul_units := ⋯, normUnit_mul := ⋯, normUnit_coe_units := ⋯ }
Alias of instStrongNormalizationMonoid.
Instances For
Equations
- instUniqueNormalizationMonoid = { default := inferInstance, uniq := ⋯ }
Equations
- instUniqueStrongNormalizationMonoid = { default := inferInstance, uniq := ⋯ }
If a monoid's only unit is 1, then it is isomorphic to its associates.
Equations
- associatesEquivOfUniqueUnits = { toFun := Associates.out, invFun := Associates.mk, left_inv := ⋯, right_inv := ⋯, map_mul' := ⋯ }
Instances For
Define NormalizationMonoid on a structure from a MonoidHom inverse to Associates.mk.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Alias of strongNormalizationMonoidOfMonoidHomRightInverse.
Define NormalizationMonoid on a structure from a MonoidHom inverse to Associates.mk.
Equations
Instances For
Define GCDMonoid on a structure just from the gcd and its properties.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Define NormalizedGCDMonoid on a structure just from the gcd and its properties.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Define GCDMonoid on a structure just from the lcm and its properties.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Define NormalizedGCDMonoid on a structure just from the lcm and its properties.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Define a GCDMonoid structure on a monoid just from the existence of a gcd.
Equations
- gcdMonoidOfExistsGCD h = gcdMonoidOfGCD (fun (a b : α) => Classical.choose ⋯) ⋯ ⋯ ⋯
Instances For
Define a NormalizedGCDMonoid structure on a monoid just from the existence of a gcd.
Equations
- normalizedGCDMonoidOfExistsGCD h = normalizedGCDMonoidOfGCD (fun (a b : α) => normalize (Classical.choose ⋯)) ⋯ ⋯ ⋯ ⋯
Instances For
Define a StrongNormalizedGCDMonoid structure on a monoid just from
the existence of a gcd.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Define a GCDMonoid structure on a monoid just from the existence of an lcm.
Equations
- gcdMonoidOfExistsLCM h = gcdMonoidOfLCM (fun (a b : α) => Classical.choose ⋯) ⋯ ⋯ ⋯
Instances For
Define a NormalizedGCDMonoid structure on a monoid just from the existence of an lcm.
Equations
- normalizedGCDMonoidOfExistsLCM h = normalizedGCDMonoidOfLCM (fun (a b : α) => normalize (Classical.choose ⋯)) ⋯ ⋯ ⋯ ⋯
Instances For
Define a StrongNormalizedGCDMonoid structure on a monoid just from
the existence of a lcm.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.