Monoids with normalization functions, gcd
, and lcm
#
This file defines extra structures on CancelCommMonoidWithZero
s, including IsDomain
s.
Main Definitions #
NormalizationMonoid
GCDMonoid
NormalizedGCDMonoid
gcdMonoid_of_gcd
,gcdMonoid_of_exists_gcd
,normalizedGCDMonoid_of_gcd
,normalizedGCDMonoid_of_exists_gcd
gcdMonoid_of_lcm
,gcdMonoid_of_exists_lcm
,normalizedGCDMonoid_of_lcm
,normalizedGCDMonoid_of_exists_lcm
For the NormalizedGCDMonoid
instances on ℕ
and ℤ
, see RingTheory.Int.Basic
.
Implementation Notes #
-
NormalizationMonoid
is defined by assigning to each element anormUnit
such that multiplying by that unit normalizes the monoid, andnormalize
is an idempotent monoid homomorphism. This definition as currently implemented does casework on0
. -
GCDMonoid
contains the definitions ofgcd
andlcm
with the usual properties. They are both determined up to a unit. -
NormalizedGCDMonoid
extendsNormalizationMonoid
, so thegcd
andlcm
are always normalized. This makesgcd
s of polynomials easier to work with, but excludes Euclidean domains, and monoids without zero. -
gcdMonoid_of_gcd
andnormalizedGCDMonoid_of_gcd
noncomputably construct aGCDMonoid
(resp.NormalizedGCDMonoid
) structure just from thegcd
and its properties. -
gcdMonoid_of_exists_gcd
andnormalizedGCDMonoid_of_exists_gcd
noncomputably construct aGCDMonoid
(resp.NormalizedGCDMonoid
) structure just from a proof that any two elements have a (not necessarily normalized)gcd
. -
gcdMonoid_of_lcm
andnormalizedGCDMonoid_of_lcm
noncomputably construct aGCDMonoid
(resp.NormalizedGCDMonoid
) structure just from thelcm
and its properties. -
gcdMonoid_of_exists_lcm
andnormalizedGCDMonoid_of_exists_lcm
noncomputably 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
Normalization monoid: multiplying with normUnit
gives a normal form for associated
elements.
- normUnit : α → αˣ
normUnit
assigns to each element of the monoid a unit of the monoid. The proposition that
normUnit
maps0
to the identity.The proposition that
normUnit
respects multiplication of non-zero elements.The proposition that
normUnit
maps units to their inverses.
Instances
Chooses an element of each associate class, by multiplying by normUnit
Equations
- One or more equations did not get rendered due to their size.
Instances For
Maps an element of Associates
back to the normalized element of its associate class
Equations
- Associates.out = Quotient.lift ⇑normalize (_ : ∀ (a x : α), a ≈ x → normalize a = normalize x)
Instances For
GCD monoid: a CancelCommMonoidWithZero
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
Associated
with the product of their GCD and LCM. 0
is left-absorbing.0
is right-absorbing.
Instances
Normalized GCD monoid: a CancelCommMonoidWithZero
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
.
- normUnit : α → αˣ
- gcd : α → α → α
- lcm : α → α → α
- gcd_mul_lcm : ∀ (a b : α), Associated (gcd a b * lcm a b) (a * b)
The GCD is normalized to itself.
The LCM is normalized to itself.
Instances
Equations
- (_ : Std.Commutative gcd) = (_ : Std.Commutative gcd)
Equations
- (_ : Std.Associative gcd) = (_ : Std.Associative gcd)
Represent a divisor of m * n
as a product of a divisor of m
and a divisor of n
.
In other words, the nonzero elements of a GCDMonoid
form a decomposition monoid
(more widely known as a pre-Schreier domain in the context of rings).
Note: In general, this representation is highly non-unique.
See Nat.prodDvdAndDvdOfDvdProd
for a constructive version on ℕ
.
Equations
- (_ : Std.Commutative lcm) = (_ : Std.Commutative lcm)
Equations
- (_ : Std.Associative lcm) = (_ : Std.Associative lcm)
Equations
- One or more equations did not get rendered due to their size.
Equations
- uniqueNormalizationMonoidOfUniqueUnits = { toInhabited := { default := normalizationMonoidOfUniqueUnits }, uniq := (_ : ∀ (x : NormalizationMonoid α), x = default) }
Equations
- (_ : Subsingleton (GCDMonoid α)) = (_ : Subsingleton (GCDMonoid α))
Equations
- (_ : Subsingleton (NormalizedGCDMonoid α)) = (_ : Subsingleton (NormalizedGCDMonoid α))
If a monoid's only unit is 1
, then it is isomorphic to its associates.
Equations
- One or more equations did not get rendered due to their size.
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
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
- normalizedGCDMonoidOfGCD gcd gcd_dvd_left gcd_dvd_right dvd_gcd normalize_gcd = let src := inferInstance; NormalizedGCDMonoid.mk normalize_gcd (_ : ∀ (a b : α), normalize (lcm a b) = lcm a b)
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
- One or more equations did not get rendered due to their size.
Instances For
Define a NormalizedGCDMonoid
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
- One or more equations did not get rendered due to their size.
Instances For
Define a NormalizedGCDMonoid
structure on a monoid just from the existence of an 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.