The free product of groups or monoids #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
Given an ι
-indexed family M
of monoids, we define their free product (categorical coproduct)
free_product M
. When ι
and all M i
have decidable equality, the free product bijects with the
type word M
of reduced words. This bijection is constructed by defining an action of
free_product M
on word M
.
When M i
are all groups, free_product M
is also a group (and the coproduct in the category of
groups).
Main definitions #
free_product M
: the free product, defined as a quotient of a free monoid.free_product.of {i} : M i →* free_product M
.free_product.lift : (Π {i}, M i →* N) ≃ (free_product M →* N)
: the universal property.free_product.word M
: the type of reduced words.free_product.word.equiv M : free_product M ≃ word M
.free_product.neword M i j
: an inductive description of non-empty words with first letter fromM i
and last letter fromM j
, together with an API (singleton
,append
,head
,tail
,to_word
,prod
,inv
). Used in the proof of the Ping-Pong-lemma.free_product.lift_injective_of_ping_pong
: The Ping-Pong-lemma, proving injectivity of thelift
. See the documentation of that theorem for more information.
Remarks #
There are many answers to the question "what is the free product of a family M
of monoids?", and
they are all equivalent but not obviously equivalent. We provide two answers. The first, almost
tautological answer is given by free_product M
, which is a quotient of the type of words in the
alphabet Σ i, M i
. It's straightforward to define and easy to prove its universal property. But
this answer is not completely satisfactory, because it's difficult to tell when two elements
x y : free_product M
are distinct since free_product M
is defined as a quotient.
The second, maximally efficient answer is given by word M
. An element of word M
is a word in the
alphabet Σ i, M i
, where the letter ⟨i, 1⟩
doesn't occur and no adjacent letters share an index
i
. Since we only work with reduced words, there is no need for quotienting, and it is easy to tell
when two elements are distinct. However it's not obvious that this is even a monoid!
We prove that every element of free_product M
can be represented by a unique reduced word, i.e.
free_product M
and word M
are equivalent types. This means that word M
can be given a monoid
structure, and it lets us tell when two elements of free_product M
are distinct.
There is also a completely tautological, maximally inefficient answer given by
algebra.category.Mon.colimits
. Whereas free_product M
at least ensures that (any instance of)
associativity holds by reflexivity, in this answer associativity holds because of quotienting. Yet
another answer, which is constructively more satisfying, could be obtained by showing that
free_product.rel
is confluent.
References #
- of_one : ∀ {ι : Type u_1} {M : ι → Type u_2} [_inst_1 : Π (i : ι), monoid (M i)] (i : ι), free_product.rel M (free_monoid.of ⟨i, 1⟩) 1
- of_mul : ∀ {ι : Type u_1} {M : ι → Type u_2} [_inst_1 : Π (i : ι), monoid (M i)] {i : ι} (x y : M i), free_product.rel M (free_monoid.of ⟨i, x⟩ * free_monoid.of ⟨i, y⟩) (free_monoid.of ⟨i, x * y⟩)
A relation on the free monoid on alphabet Σ i, M i
, relating ⟨i, 1⟩
with 1
and
⟨i, x⟩ * ⟨i, y⟩
with ⟨i, x * y⟩
.
The free product (categorical coproduct) of an indexed family of monoids.
Equations
- free_product M = (con_gen (free_product.rel M)).quotient
- to_list : list (Σ (i : ι), M i)
- ne_one : ∀ (l : Σ (i : ι), M i), l ∈ self.to_list → l.snd ≠ 1
- chain_ne : list.chain' (λ (l l' : Σ (i : ι), M i), l.fst ≠ l'.fst) self.to_list
The type of reduced words. A reduced word cannot contain a letter 1
, and no two adjacent
letters can come from the same summand.
Instances for free_product.word
- free_product.word.has_sizeof_inst
- free_product.word.inhabited
- free_product.word.summand_action
- free_product.word.mul_action
The inclusion of a summand into the free product.
Equations
- free_product.of = {to_fun := λ (x : M i), ⇑((con_gen (free_product.rel M)).mk') (free_monoid.of ⟨i, x⟩), map_one' := _, map_mul' := _}
A map out of the free product corresponds to a family of maps out of the summands. This is the universal property of the free product, charaterizing it as a categorical coproduct.
Equations
- free_product.lift = {to_fun := λ (fi : Π (i : ι), M i →* N), (con_gen (free_product.rel M)).lift (⇑free_monoid.lift (λ (p : Σ (i : ι), M i), ⇑(fi p.fst) p.snd)) _, inv_fun := λ (f : free_product M →* N) (i : ι), f.comp free_product.of, left_inv := _, right_inv := _}
Equations
- free_product.has_inv G = {inv := mul_opposite.unop ∘ ⇑(⇑free_product.lift (λ (i : ι), (⇑monoid_hom.op free_product.of).comp (mul_equiv.inv' (G i)).to_monoid_hom))}
Equations
- free_product.group G = {mul := monoid.mul (free_product.monoid G), mul_assoc := _, one := monoid.one (free_product.monoid G), one_mul := _, mul_one := _, npow := monoid.npow (free_product.monoid G), npow_zero' := _, npow_succ' := _, inv := has_inv.inv (free_product.has_inv G), div := div_inv_monoid.div._default monoid.mul _ monoid.one _ _ monoid.npow _ _ has_inv.inv, div_eq_mul_inv := _, zpow := div_inv_monoid.zpow._default monoid.mul _ monoid.one _ _ monoid.npow _ _ has_inv.inv, zpow_zero' := _, zpow_succ' := _, zpow_neg' := _, mul_left_inv := _}
Equations
- free_product.word.inhabited = {default := free_product.word.empty (λ (i : ι), _inst_1 i)}
A reduced word determines an element of the free product, given by multiplication.
fst_idx w
is some i
if the first letter of w
is ⟨i, m⟩
with m : M i
. If w
is empty
then it's none
.
- head : M i
- tail : free_product.word M
- fst_idx_ne : self.tail.fst_idx ≠ option.some i
Given an index i : ι
, pair M i
is the type of pairs (head, tail)
where head : M i
and
tail : word M
, subject to the constraint that first letter of tail
can't be ⟨i, m⟩
.
By prepending head
to tail
, one obtains a new word. We'll show that any word can be uniquely
obtained in this way.
Instances for free_product.word.pair
- free_product.word.pair.has_sizeof_inst
- free_product.word.pair.inhabited
Equations
- free_product.word.pair.inhabited M i = {default := {head := 1, tail := free_product.word.empty (λ (i : ι), _inst_1 i), fst_idx_ne := _}}
Given a pair (head, tail)
, we can form a word by prepending head
to tail
, except if head
is 1 : M i
then we have to just return word
since we need the result to be reduced.
The equivalence between words and pairs. Given a word, it decomposes it as a pair by removing
the first letter if it comes from M i
. Given a pair, it prepends the head to the tail.
Equations
- free_product.word.equiv_pair i = {to_fun := λ (w : free_product.word M), (equiv_pair_aux i w).val, inv_fun := free_product.word.rcons i, left_inv := _, right_inv := _}
Equations
- free_product.word.summand_action i = {to_has_smul := {smul := λ (m : M i) (w : free_product.word M), free_product.word.rcons {head := m * (⇑(free_product.word.equiv_pair i) w).head, tail := (⇑(free_product.word.equiv_pair i) w).tail, fst_idx_ne := _}}, one_smul := _, mul_smul := _}
Equations
Each element of the free product corresponds to a unique reduced word.
Equations
- free_product.word.equiv = {to_fun := λ (m : free_product M), m • free_product.word.empty, inv_fun := λ (w : free_product.word M), w.prod, left_inv := _, right_inv := _}
Equations
- free_product.word.decidable_eq = function.injective.decidable_eq free_product.word.decidable_eq._proof_1
- singleton : Π {ι : Type u_1} {M : ι → Type u_2} [_inst_1 : Π (i : ι), monoid (M i)] {i : ι} (x : M i), x ≠ 1 → free_product.neword M i i
- append : Π {ι : Type u_1} {M : ι → Type u_2} [_inst_1 : Π (i : ι), monoid (M i)] {i j k l : ι}, free_product.neword M i j → j ≠ k → free_product.neword M k l → free_product.neword M i l
A neword M i j
is a representation of a non-empty reduced words where the first letter comes
from M i
and the last letter comes from M j
. It can be constructed from singletons and via
concatentation, and thus provides a useful induction principle.
Instances for free_product.neword
- free_product.neword.has_sizeof_inst
The list represented by a given neword
The first letter of a neword
The last letter of a neword
Every nonempty word M
can be constructed as a neword M i j
A non-empty reduced word determines an element of the free product, given by multiplication.
One can replace the first letter in a non-empty reduced word by an element of the same group
Equations
- free_product.neword.replace_head x h (w₁.append hne w₂) = (free_product.neword.replace_head x h w₁).append hne w₂
- free_product.neword.replace_head x h (free_product.neword.singleton _x_1 _x_2) = free_product.neword.singleton x h
One can multiply an element from the left to a non-empty reduced word if it does not cancel with the first element in the word.
Equations
- w.mul_head x hnotone = free_product.neword.replace_head (x * w.head) hnotone w
The inverse of a non-empty reduced word
The Ping-Pong-Lemma.
Given a group action of G
on X
so that the H i
acts in a specific way on disjoint subsets
X i
we can prove that lift f
is injective, and thus the image of lift f
is isomorphic to the
free product of the H i
.
Often the Ping-Pong-Lemma is stated with regard to subgroups H i
that generate the whole group;
we generalize to arbitrary group homomorphisms f i : H i →* G
and do not require the group to be
generated by the images.
Usually the Ping-Pong-Lemma requires that one group H i
has at least three elements. This
condition is only needed if # ι = 2
, and we accept 3 ≤ # ι
as an alternative.
The free product of free groups is itself a free group
Equations
- free_product.is_free_group G = {generators := Σ (i : ι), is_free_group.generators (G i), mul_equiv := (⇑free_group.lift (λ (x : Σ (i : ι), is_free_group.generators (G i)), ⇑free_product.of (is_free_group.of x.snd))).to_mul_equiv (⇑free_product.lift (λ (i : ι), ⇑is_free_group.lift (λ (x : is_free_group.generators (G i)), free_group.of ⟨i, x⟩))) _ _}
A free group is a free product of copies of the free_group over one generator.
Equations
- free_group_equiv_free_product = (⇑free_group.lift (λ (i : ι), ⇑free_product.of (free_group.of unit.star()))).to_mul_equiv (⇑free_product.lift (λ (i : ι), ⇑free_group.lift (λ (pstar : unit), free_group.of i))) free_group_equiv_free_product._proof_1 free_group_equiv_free_product._proof_2
The Ping-Pong-Lemma.
Given a group action of G
on X
so that the generators of the free groups act in specific
ways on disjoint subsets X i
and Y i
we can prove that lift f
is injective, and thus the image
of lift f
is isomorphic to the free group.
Often the Ping-Pong-Lemma is stated with regard to group elements that generate the whole group;
we generalize to arbitrary group homomorphisms from the free group to G
and do not require the
group to be generated by the elements.