Unique factorization #
Main Definitions #
wf_dvd_monoid
holds formonoid
s for which a strict divisibility relation is well-founded.unique_factorization_monoid
holds forwf_dvd_monoid
s whereirreducible
is equivalent toprime
To do #
- set up the complete lattice structure on
factor_set
.
- well_founded_dvd_not_unit : well_founded dvd_not_unit
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.
- to_wf_dvd_monoid : wf_dvd_monoid α
- irreducible_iff_prime : ∀ {a : α}, irreducible a ↔ prime a
unique factorization monoids.
These are defined as cancel_comm_monoid_with_zero
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
Can't be an instance because it would cause a loop ufm → wf_dvd_monoid → ufm → ...
.
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
- unique_factorization_monoid.factors a = dite (a = 0) (λ (h : a = 0), 0) (λ (h : ¬a = 0), classical.some _)
Noncomputably determines the multiset of prime factors.
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 normalization_monoid
structure on a unique_factorization_monoid
.
Equations
- unique_factorization_monoid.normalization_monoid = normalization_monoid_of_monoid_hom_right_inverse {to_fun := λ (a : associates α), ite (a = 0) 0 (multiset.map (classical.some unique_factorization_monoid.normalization_monoid._proof_1) (unique_factorization_monoid.normalized_factors a)).prod, map_one' := _, map_mul' := _} unique_factorization_monoid.normalization_monoid._proof_4
Euclid's lemma: if a ∣ b * c
and a
and c
have no common prime factors, a ∣ b
.
Compare is_coprime.dvd_of_dvd_mul_left
.
Euclid's lemma: if a ∣ b * c
and a
and b
have no common prime factors, a ∣ c
.
Compare is_coprime.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 normalized_factors
.
See also count_normalized_factors_eq
which expands the definition of multiplicity
to produce a specification for count (normalized_factors _) _
..
The number of times an irreducible factor p
appears in normalized_factors x
is defined by
the number of times it divides x
.
See also multiplicity_eq_count_normalized_factors
if n
is given by multiplicity p x
.
factor_set α
representation elements of unique factorization domain as multisets.
multiset α
produced by normalized_factors
are only unique up to associated elements, while the
multisets in factor_set α
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 struture. Infimum is the greatest common divisor and supremum is the least common
multiple.
Equations
- associates.factor_set α = with_top (multiset {a // irreducible a})
Evaluates the product of a factor_set
to be the product of the corresponding multiset,
or 0
if there is none.
Equations
bcount p s
is the multiplicity of p
in the factor_set s
(with bundled p
)
Equations
- associates.bcount p (some s) = multiset.count p s
- associates.bcount p none = 0
count p s
is the multiplicity of the irreducible p
in the factor_set s
.
If p
is not irreducible, count p s
is defined to be 0
.
Equations
- p.count = dite (irreducible p) (λ (hp : irreducible p), associates.bcount ⟨p, hp⟩) (λ (hp : ¬irreducible p), 0)
membership in a factor_set (bundled version)
Equations
- associates.bfactor_set_mem p (some l) = (p ∈ l)
- associates.bfactor_set_mem _x ⊤ = true
factor_set_mem p s
is the predicate that the irreducible p
is a member of
s : factor_set α
.
If p
is not irreducible, p
is not a member of any factor_set
.
Equations
- p.factor_set_mem s = dite (irreducible p) (λ (hp : irreducible p), associates.bfactor_set_mem ⟨p, hp⟩ s) (λ (hp : ¬irreducible p), false)
Equations
- associates.factor_set.has_mem = {mem := associates.factor_set_mem (λ (p : associates α), dec_irr p)}
This returns the multiset of irreducible factors as a factor_set
,
a multiset of irreducible associates with_top
.
Equations
- associates.factors' a = multiset.pmap (λ (a : α) (ha : irreducible a), ⟨associates.mk a, _⟩) (unique_factorization_monoid.factors a) _
This returns the multiset of irreducible factors of an associate as a factor_set
,
a multiset of irreducible associates with_top
.
Equations
- associates.has_sup = {sup := λ (a b : associates α), (a.factors ⊔ b.factors).prod}
Equations
- associates.has_inf = {inf := λ (a b : associates α), (a.factors ⊓ b.factors).prod}
Equations
- associates.lattice = {sup := has_sup.sup associates.has_sup, le := partial_order.le associates.partial_order, lt := partial_order.lt associates.partial_order, le_refl := _, le_trans := _, lt_iff_le_not_le := _, le_antisymm := _, le_sup_left := _, le_sup_right := _, sup_le := _, inf := has_inf.inf associates.has_inf, inf_le_left := _, inf_le_right := _, le_inf := _}
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.
to_gcd_monoid
constructs a GCD monoid out of a unique factorization domain.
Equations
- unique_factorization_monoid.to_gcd_monoid α = {gcd := λ (a b : α), quot.out (associates.mk a ⊓ associates.mk b), lcm := λ (a b : α), quot.out (associates.mk a ⊔ associates.mk b), gcd_dvd_left := _, gcd_dvd_right := _, dvd_gcd := _, gcd_mul_lcm := _, lcm_zero_left := _, lcm_zero_right := _}
to_normalized_gcd_monoid
constructs a GCD monoid out of a normalization on a
unique factorization domain.
Equations
- unique_factorization_monoid.to_normalized_gcd_monoid α = {to_normalization_monoid := {norm_unit := norm_unit _inst_3, norm_unit_zero := _, norm_unit_mul := _, norm_unit_coe_units := _}, to_gcd_monoid := {gcd := λ (a b : α), (associates.mk a ⊓ associates.mk b).out, lcm := λ (a b : α), (associates.mk a ⊔ associates.mk b).out, gcd_dvd_left := _, gcd_dvd_right := _, dvd_gcd := _, gcd_mul_lcm := _, lcm_zero_left := _, lcm_zero_right := _}, normalize_gcd := _, normalize_lcm := _}
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
- unique_factorization_monoid.fintype_subtype_dvd y hy = fintype.of_finset (finset.image (λ (s : multiset M × Mˣ), (↑(s.snd)) * s.fst.prod) ((unique_factorization_monoid.normalized_factors y).powerset.to_finset.product finset.univ)) _
This returns the multiset of irreducible factors as a finsupp
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