Unique factorization #
Main Definitions #
WfDvdMonoid
holds forMonoid
s for which a strict divisibility relation is well-founded.UniqueFactorizationMonoid
holds forWfDvdMonoid
s whereIrreducible
is equivalent toPrime
To do #
- set up the complete lattice structure on
FactorSet
.
Well-foundedness of the strict version of |, which is equivalent to the descending chain condition on divisibility and to the ascending chain condition on principal ideals in an integral domain.
- wellFounded_dvdNotUnit : WellFounded DvdNotUnit
Instances
Equations
- (_ : WfDvdMonoid α) = (_ : WfDvdMonoid α)
Equations
- (_ : WfDvdMonoid (Associates α)) = (_ : WfDvdMonoid (Associates α))
unique factorization monoids.
These are defined as CancelCommMonoidWithZero
s with well-founded strict divisibility
relations, but this is equivalent to more familiar definitions:
Each element (except zero) is uniquely represented as a multiset of irreducible factors. Uniqueness is only up to associated elements.
Each element (except zero) is non-uniquely represented as a multiset of prime factors.
To define a UFD using the definition in terms of multisets
of irreducible factors, use the definition of_exists_unique_irreducible_factors
To define a UFD using the definition in terms of multisets
of prime factors, use the definition of_exists_prime_factors
- wellFounded_dvdNotUnit : WellFounded DvdNotUnit
- irreducible_iff_prime : ∀ {a : α}, Irreducible a ↔ Prime a
Instances
Can't be an instance because it would cause a loop ufm → WfDvdMonoid → ufm → ...
.
Equations
- (_ : UniqueFactorizationMonoid (Associates α)) = (_ : UniqueFactorizationMonoid (Associates α))
If an irreducible has a prime factorization, then it is an associate of one of its prime factors.
Noncomputably determines the multiset of prime factors.
Equations
- UniqueFactorizationMonoid.factors a = if h : a = 0 then 0 else Classical.choose (_ : ∃ (f : Multiset α), (∀ b ∈ f, Prime b) ∧ Associated (Multiset.prod f) a)
Instances For
Noncomputably determines the multiset of prime factors.
Equations
Instances For
An arbitrary choice of factors of x : M
is exactly the (unique) normalized set of factors,
if M
has a trivial group of units.
Noncomputably defines a normalizationMonoid
structure on a UniqueFactorizationMonoid
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- UniqueFactorizationMonoid.instInhabitedNormalizationMonoid = { default := UniqueFactorizationMonoid.normalizationMonoid }
Euclid's lemma: if a ∣ b * c
and a
and c
have no common prime factors, a ∣ b
.
Compare IsCoprime.dvd_of_dvd_mul_left
.
Euclid's lemma: if a ∣ b * c
and a
and b
have no common prime factors, a ∣ c
.
Compare IsCoprime.dvd_of_dvd_mul_right
.
If a ≠ 0, b
are elements of a unique factorization domain, then dividing
out their common factor c'
gives a'
and b'
with no factors in common.
The multiplicity of an irreducible factor of a nonzero element is exactly the number of times
the normalized factor occurs in the normalizedFactors
.
See also count_normalizedFactors_eq
which expands the definition of multiplicity
to produce a specification for count (normalizedFactors _) _
..
The number of times an irreducible factor p
appears in normalizedFactors x
is defined by
the number of times it divides x
.
See also multiplicity_eq_count_normalizedFactors
if n
is given by multiplicity p x
.
The number of times an irreducible factor p
appears in normalizedFactors x
is defined by
the number of times it divides x
. This is a slightly more general version of
UniqueFactorizationMonoid.count_normalizedFactors_eq
that allows p = 0
.
See also multiplicity_eq_count_normalizedFactors
if n
is given by multiplicity p x
.
If P
holds for units and powers of primes,
and P x ∧ P y
for coprime x, y
implies P (x * y)
,
then P
holds on a product of powers of distinct primes.
If P
holds for 0
, units and powers of primes,
and P x ∧ P y
for coprime x, y
implies P (x * y)
,
then P
holds on all a : α
.
If f
maps p ^ i
to (f p) ^ i
for primes p
, and f
is multiplicative on coprime elements, then f
is multiplicative on all products of primes.
If f
maps p ^ i
to (f p) ^ i
for primes p
, and f
is multiplicative on coprime elements, then f
is multiplicative everywhere.
See also IsCoprime.dvd_of_dvd_mul_left
.
See also IsCoprime.dvd_of_dvd_mul_right
.
See also IsCoprime.mul_dvd
.
FactorSet α
representation elements of unique factorization domain as multisets.
Multiset α
produced by normalizedFactors
are only unique up to associated elements, while the
multisets in FactorSet α
are unique by equality and restricted to irreducible elements. This
gives us a representation of each element as a unique multisets (or the added ⊤ for 0), which has a
complete lattice structure. Infimum is the greatest common divisor and supremum is the least common
multiple.
Equations
- Associates.FactorSet α = WithTop (Multiset { a : Associates α // Irreducible a })
Instances For
Evaluates the product of a FactorSet
to be the product of the corresponding multiset,
or 0
if there is none.
Equations
- Associates.FactorSet.prod x = match x with | none => 0 | some s => Multiset.prod (Multiset.map Subtype.val s)
Instances For
bcount p s
is the multiplicity of p
in the FactorSet s
(with bundled p
)
Equations
- Associates.bcount p x = match x with | none => 0 | some s => Multiset.count p s
Instances For
count p s
is the multiplicity of the irreducible p
in the FactorSet s
.
If p
is not irreducible, count p s
is defined to be 0
.
Equations
- Associates.count p = if hp : Irreducible p then Associates.bcount { val := p, property := hp } else 0
Instances For
membership in a FactorSet (bundled version)
Equations
- Associates.BfactorSetMem x✝ x = match x✝, x with | x, none => True | p, some l => p ∈ l
Instances For
FactorSetMem p s
is the predicate that the irreducible p
is a member of
s : FactorSet α
.
If p
is not irreducible, p
is not a member of any FactorSet
.
Equations
- Associates.FactorSetMem p s = if hp : Irreducible p then Associates.BfactorSetMem { val := p, property := hp } s else False
Instances For
Equations
- Associates.instMembershipAssociatesToMonoidToMonoidWithZeroToCommMonoidWithZeroFactorSet = { mem := Associates.FactorSetMem }
This returns the multiset of irreducible factors as a FactorSet
,
a multiset of irreducible associates WithTop
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
This returns the multiset of irreducible factors of an associate as a FactorSet
,
a multiset of irreducible associates WithTop
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Associates.instSupAssociatesToMonoidToMonoidWithZeroToCommMonoidWithZero = { sup := fun (a b : Associates α) => Associates.FactorSet.prod (Associates.factors a ⊔ Associates.factors b) }
Equations
- Associates.instInfAssociatesToMonoidToMonoidWithZeroToCommMonoidWithZero = { inf := fun (a b : Associates α) => Associates.FactorSet.prod (Associates.factors a ⊓ Associates.factors b) }
Equations
- One or more equations did not get rendered due to their size.
The only divisors of prime powers are prime powers. See eq_pow_find_of_dvd_irreducible_pow
for an explicit expression as a p-power (without using count
).
The only divisors of prime powers are prime powers.
toGCDMonoid
constructs a GCD monoid out of a unique factorization domain.
Equations
- One or more equations did not get rendered due to their size.
Instances For
toNormalizedGCDMonoid
constructs a GCD monoid out of a normalization on a
unique factorization domain.
Equations
- One or more equations did not get rendered due to their size.
Instances For
If y
is a nonzero element of a unique factorization monoid with finitely
many units (e.g. ℤ
, Ideal (ring_of_integers K)
), it has finitely many divisors.
Equations
- One or more equations did not get rendered due to their size.
Instances For
This returns the multiset of irreducible factors as a Finsupp
.
Equations
- factorization n = Multiset.toFinsupp (UniqueFactorizationMonoid.normalizedFactors n)
Instances For
The support of factorization n
is exactly the Finset of normalized factors
For nonzero a
and b
, the power of p
in a * b
is the sum of the powers in a
and b
For any p
, the power of p
in x^n
is n
times the power in x