Free abelian groups #
The free abelian group on a type α
, defined as the abelianisation of
the free group on α
.
The free abelian group on α
can be abstractly defined as the left adjoint of the
forgetful functor from abelian groups to types. Alternatively, one could define
it as the functions α → ℤ
which send all but finitely many (a : α)
to 0
,
under pointwise addition. In this file, it is defined as the abelianisation
of the free group on α
. All the constructions and theorems required to show
the adjointness of the construction and the forgetful functor are proved in this
file, but the category-theoretic adjunction statement is in
algebra.category.Group.adjunctions
.
Main definitions #
Here we use the following variables: (α β : Type*) (A : Type*) [add_comm_group A]
-
free_abelian_group α
: the free abelian group on a typeα
. As an abelian group it isα →₀ ℤ
, the functions fromα
toℤ
such that all but finitely many elements get mapped to zero, however this is not how it is implemented. -
lift f : free_abelian_group α →+ A
: the group homomorphism induced by the mapf : α → A
. -
map (f : α → β) : free_abelian_group α →+ free_abelian_group β
: functoriality offree_abelian_group
-
instance [monoid α] : semigroup (free_abelian_group α)
-
instance [comm_monoid α] : comm_ring (free_abelian_group α)
It has been suggested that we would be better off refactoring this file
and using finsupp
instead.
Implementation issues #
The definition is def free_abelian_group : Type u := additive $ abelianization $ free_group α
Chris Hughes has suggested that this all be rewritten in terms of finsupp
.
Johan Commelin has written all the API relating the definition to finsupp
in the lean-liquid repo.
The lemmas map_pure
, map_of
, map_zero
, map_add
, map_neg
and map_sub
are proved about the functor.map
<$>
construction, and need α
and β
to
be in the same universe. But
free_abelian_group.map (f : α → β)
is defined to be the add_group
homomorphism free_abelian_group α →+ free_abelian_group β
(with α
and β
now
allowed to be in different universes), so (map f).map_add
etc can be used to prove that free_abelian_group.map
preserves addition. The
functions map_id
, map_id_apply
, map_comp
, map_comp_apply
and map_of_apply
are about free_abelian_group.map
.
The free abelian group on a type.
Equations
Equations
- free_abelian_group.inhabited α = {default := 0}
The canonical map from α to free_abelian_group α
Equations
The map free_abelian_group α →+ A
induced by a map of types α → A
.
If g : free_abelian_group X
and A
is an abelian group then lift_add_group_hom g
is the additive group homomorphism sending a function X → A
to the term of type A
corresponding to the evaluation of the induced map free_abelian_group X → A
at g
.
Equations
- free_abelian_group.lift_add_group_hom β a = add_monoid_hom.mk' (λ (f : α → β), ⇑(⇑free_abelian_group.lift f) a) _
Equations
If f : free_abelian_group (α → β)
, then f <*>
is an additive morphism
free_abelian_group α →+ free_abelian_group β
.
Equations
The additive group homomorphism free_abelian_group α →+ free_abelian_group β
induced from a
map α → β
Equations
Equations
- free_abelian_group.semigroup α = {mul := λ (x : free_abelian_group α), ⇑(⇑free_abelian_group.lift (λ (x₂ : α), ⇑(⇑free_abelian_group.lift (λ (x₁ : α), free_abelian_group.of (x₁ * x₂))) x)), mul_assoc := _}
Equations
- free_abelian_group.ring α = {add := add_comm_group.add (free_abelian_group.add_comm_group α), add_assoc := _, zero := add_comm_group.zero (free_abelian_group.add_comm_group α), zero_add := _, add_zero := _, nsmul := add_comm_group.nsmul (free_abelian_group.add_comm_group α), nsmul_zero' := _, nsmul_succ' := _, neg := add_comm_group.neg (free_abelian_group.add_comm_group α), sub := add_comm_group.sub (free_abelian_group.add_comm_group α), sub_eq_add_neg := _, zsmul := add_comm_group.zsmul (free_abelian_group.add_comm_group α), zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _, add_left_neg := _, add_comm := _, mul := semigroup.mul (free_abelian_group.semigroup α), mul_assoc := _, one := free_abelian_group.of 1, one_mul := _, mul_one := _, npow := monoid.npow._default (free_abelian_group.of 1) semigroup.mul _ _, npow_zero' := _, npow_succ' := _, left_distrib := _, right_distrib := _}
free_abelian_group.of
is a monoid_hom
when α
is a monoid
.
Equations
- free_abelian_group.of_mul_hom = {to_fun := free_abelian_group.of α, map_one' := _, map_mul' := _}
If f
preserves multiplication, then so does lift f
.
Equations
- free_abelian_group.comm_ring α = {add := ring.add (free_abelian_group.ring α), add_assoc := _, zero := ring.zero (free_abelian_group.ring α), zero_add := _, add_zero := _, nsmul := ring.nsmul (free_abelian_group.ring α), nsmul_zero' := _, nsmul_succ' := _, neg := ring.neg (free_abelian_group.ring α), sub := ring.sub (free_abelian_group.ring α), sub_eq_add_neg := _, zsmul := ring.zsmul (free_abelian_group.ring α), zsmul_zero' := _, zsmul_succ' := _, zsmul_neg' := _, add_left_neg := _, add_comm := _, mul := ring.mul (free_abelian_group.ring α), mul_assoc := _, one := ring.one (free_abelian_group.ring α), one_mul := _, mul_one := _, npow := ring.npow (free_abelian_group.ring α), npow_zero' := _, npow_succ' := _, left_distrib := _, right_distrib := _, mul_comm := _}
Equations
- free_abelian_group.pempty_unique = {to_inhabited := {default := 0}, uniq := free_abelian_group.pempty_unique._proof_1}
The free abelian group on a type with one term is isomorphic to ℤ
.
Equations
- free_abelian_group.punit_equiv T = {to_fun := ⇑(⇑free_abelian_group.lift (λ (_x : T), 1)), inv_fun := λ (n : ℤ), n • free_abelian_group.of default, left_inv := _, right_inv := _, map_add' := _}
Isomorphic types have isomorphic free abelian groups.
Equations
- free_abelian_group.equiv_of_equiv f = {to_fun := ⇑(free_abelian_group.map ⇑f), inv_fun := ⇑(free_abelian_group.map ⇑(f.symm)), left_inv := _, right_inv := _, map_add' := _}