module Cat.Abelian.Base where
Abelian categoriesπ
This module defines the sequence of properties which βwork up toβ abelian categories: Ab-enriched categories, pre-additive categories, pre-abelian categories, and abelian categories. Each concept builds on the last by adding a new categorical property on top of a precategory.
Ab-enriched categoriesπ
An category is one where each set carries the structure of an Abelian group, such that the composition map is bilinear, hence extending to an Abelian group homomorphism
where the term on the left is the tensor product of the corresponding As the name implies, every such category has a canonical (made monoidal using but we do not use the language of enriched category theory in our development of Abelian categories.
record Ab-category {o β} (C : Precategory o β) : Type (o β lsuc β) where
open Cat C public
field
: β A B β Abelian-group-on (Hom A B)
Abelian-group-on-hom
_+_ : β {A B} (f g : Hom A B) β Hom A B
= Abelian-group-on-hom _ _ .Abelian-group-on._*_ f g
f + g
: β {A B} β Hom A B
0m = Abelian-group-on-hom _ _ .Abelian-group-on.1g
0m
: β A B β Abelian-group β
Hom-grp = (el (Hom A B) (Hom-set A B)) , Abelian-group-on-hom A B
Hom-grp A B
field
-- Composition is multilinear:
β-linear-l: β {A B C} (f g : Hom B C) (h : Hom A B)
β (f β h) + (g β h) β‘ (f + g) β h
β-linear-r: β {A B C} (f : Hom B C) (g h : Hom A B)
β (f β g) + (f β h) β‘ f β (g + h)
: β {A B C} β Ab.Hom (Hom-grp B C β Hom-grp A B) (Hom-grp A C)
βmap {A} {B} {C} =
βmap (Hom-grp B C) (Hom-grp A B) (Hom-grp A C)
from-bilinear-map (record { map = _β_
; pres-*l = Ξ» x y z β sym (β-linear-l x y z)
; pres-*r = Ξ» x y z β sym (β-linear-r x y z)
})
module Hom {A B} = Abelian-group-on (Abelian-group-on-hom A B) renaming (_β»ΒΉ to inverse)
open Hom
using (zero-diff)
renaming (_β_ to _-_)
public
Note that from multilinearity of composition, it follows that the addition of and composition1 operations satisfy familiar algebraic identities, e.g.Β etc.
: β {A B C} {f : Hom B C} β f β 0m {A} {B} β‘ 0m
β-zero-r {f = f} =
β-zero-r .intror Hom.inverser β©
f β 0m β‘β¨ Hom(f β 0m - f β 0m) β‘β¨ Hom.associative β©
f β 0m + (f β 0m + f β 0m) - f β 0m β‘β¨ ap (_- f β 0m) (β-linear-r _ _ _) β©
(f β (0m + 0m)) - f β 0m β‘β¨ ap ((_- f β 0m) β (f β_)) Hom.idl β©
(f β 0m) - f β 0m β‘β¨ Hom.inverser β©
0m β
: β {A B C} {f : Hom A B} β 0m β f β‘ 0m {A} {C}
β-zero-l {f = f} =
β-zero-l .introl Hom.inversel β©
0m β f β‘β¨ Hom(Hom.inverse (0m β f) + 0m β f) + 0m β f β‘β¨ sym Hom.associative β©
.inverse (0m β f) + (0m β f + 0m β f) β‘β¨ ap (Hom.inverse (0m β f) +_) (β-linear-l _ _ _) β©
Hom.inverse (0m β f) + ((0m + 0m) β f) β‘β¨ ap ((Hom.inverse (0m β f) +_) β (_β f)) Hom.idl β©
Hom.inverse (0m β f) + (0m β f) β‘β¨ Hom.inversel β©
Hom
0m β
neg-β-l: β {A B C} {g : Hom B C} {h : Hom A B}
β Hom.inverse (g β h) β‘ Hom.inverse g β h
{g = g} {h} = monoid-inverse-unique Hom.has-is-monoid (g β h) _ _
neg-β-l .inversel
Hom(β-linear-l _ _ _ β ap (_β h) Hom.inverser β β-zero-l)
neg-β-r: β {A B C} {g : Hom B C} {h : Hom A B}
β Hom.inverse (g β h) β‘ g β Hom.inverse h
{g = g} {h} = monoid-inverse-unique Hom.has-is-monoid (g β h) _ _
neg-β-r .inversel
Hom(β-linear-r _ _ _ β ap (g β_) Hom.inverser β β-zero-r)
β-minus-l: β {A B C} (f g : Hom B C) (h : Hom A B)
β (f β h) - (g β h) β‘ (f - g) β h
=
β-minus-l f g h (f β h +_) neg-β-l β©
f β h - g β h β‘β¨ ap (Hom.inverse g β h) β‘β¨ β-linear-l _ _ _ β©
f β h + (f - g) β h β
β-minus-r: β {A B C} (f : Hom B C) (g h : Hom A B)
β (f β g) - (f β h) β‘ f β (g - h)
=
β-minus-r f g h (f β g +_) neg-β-r β©
f β g - f β h β‘β¨ ap (f β Hom.inverse h) β‘β¨ β-linear-r _ _ _ β©
f β g + (g - h) β f β
Before moving on, we note the following property of If is an object s.t. then is a zero object.
module _ {o β} {C : Precategory o β} (A : Ab-category C) where
private module A = Ab-category A
: β {X} β A.id {X} β‘ A.0m β is-zero C X
id-zeroβzero .is-zero.has-is-initial B = contr A.0m Ξ» h β sym $
id-zeroβzero idm .intror refl β©
h β‘β¨ A.β A.id β‘β¨ A.reflβ©ββ¨ idm β©
h A.β A.0m β‘β¨ A.β-zero-r β©
h A.0m β
A.is-zero.has-is-terminal x = contr A.0m Ξ» h β sym $
id-zeroβzero idm .introl refl β©
h β‘β¨ A.id A.β h β‘β¨ idm A.β©ββ¨refl β©
A.0m A.β h β‘β¨ A.β-zero-l β©
A.0m β A
Perhaps the simplest example of an is.. any ring! In the same way that a monoid is a category with one object, and a group is a groupoid with one object, a ring is a ringoid with one object; Ringoid being another word for rather than a horizontal categorification of the drummer for the Beatles. The next simplest example is itself:
module _ where
open Ab-category
: β {β} β Ab-category (Ab β)
Ab-ab-category .Abelian-group-on-hom A B = Ab.Abelian-group-on-hom A B
Ab-ab-category .β-linear-l f g h = trivial!
Ab-ab-category .β-linear-r f g h = ext Ξ» _ β
Ab-ab-category (f .preserves .is-group-hom.pres-β _ _) sym
Additive categoriesπ
An is additive when its underlying category has a terminal object and finite products; By the yoga above, this implies that the terminal object is also a zero object, and the finite products coincide with finite coproducts.
record is-additive {o β} (C : Precategory o β) : Type (o β lsuc β) where
field has-ab : Ab-category C
open Ab-category has-ab public
field
: Terminal C
has-terminal : β A B β Product C A B
has-prods
: Zero C
β
.Zero.β
= has-terminal .Terminal.top
β
.Zero.has-is-zero = id-zeroβzero has-ab $
β
(has-terminal .Terminal.hasβ€ _) _ _
is-contrβis-prop module β
= Zero β
: β {A B} β β
.zeroβ {A} {B} β‘ 0m
0m-unique = apβ _β_ (β
.hasβ₯ _ .paths _) refl β β-zero-l 0m-unique
Coincidence of finite products and finite coproducts leads to an object commonly called a (finite) biproduct. The coproduct coprojections are given by the pair of maps
respectively, and the comultiplication of and is given by We can calculate, for the first coprojection followed by comultiplication,
and analogously for the second coprojection followed by comultiplication.
: β A B β Coproduct C A B
has-coprods = coprod where
has-coprods A B open Coproduct
open is-coproduct
module Prod = Product (has-prods A B)
: Coproduct C A B
coprod .coapex = Prod.apex
coprod .inβ = Prod.β¨ id , 0m β©
coprod .inβ = Prod.β¨ 0m , id β©
coprod .has-is-coproduct .[_,_] f g = f β Prod.Οβ + g β Prod.Οβ
coprod .has-is-coproduct .inββfactor {inj0 = inj0} {inj1} =
coprod (inj0 β Prod.Οβ + inj1 β Prod.Οβ) β Prod.β¨ id , 0m β© β‘β¨ sym (β-linear-l _ _ _) β©
((inj0 β Prod.Οβ) β Prod.β¨ id , 0m β© + _) β‘β¨ Hom.elimr (pullr Prod.Οββfactor β β-zero-r) β©
(inj0 β Prod.Οβ) β Prod.β¨ id , 0m β© β‘β¨ cancelr Prod.Οββfactor β©
inj0 β.has-is-coproduct .inββfactor {inj0 = inj0} {inj1} =
coprod (inj0 β Prod.Οβ + inj1 β Prod.Οβ) β Prod.β¨ 0m , id β© β‘β¨ sym (β-linear-l _ _ _) β©
(_ + (inj1 β Prod.Οβ) β Prod.β¨ 0m , id β©) β‘β¨ Hom.eliml (pullr Prod.Οββfactor β β-zero-r) β©
(inj1 β Prod.Οβ) β Prod.β¨ 0m , id β© β‘β¨ cancelr Prod.Οββfactor β©
inj1 β
For uniqueness, we use distributivity of composition over addition of morphisms and the universal property of the product to establish the desired equation. Check it out:
.has-is-coproduct .unique {inj0 = inj0} {inj1} other p q = sym $
coprod .Οβ + inj1 β Prod.Οβ β‘β¨ apβ _+_ (pushl (sym p)) (pushl (sym q)) β©
inj0 β Prod(other β Prod.β¨ id , 0m β© β Prod.Οβ) + (other β Prod.β¨ 0m , id β© β Prod.Οβ) β‘β¨ β-linear-r _ _ _ β©
(Prod.β¨ id , 0m β© β Prod.Οβ + Prod.β¨ 0m , id β© β Prod.Οβ) β‘β¨ elimr lemma β©
other β
other βwhere
: Prod.β¨ id , 0m β© β Prod.Οβ + Prod.β¨ 0m , id β© β Prod.Οβ
lemma
β‘ id= Prod.uniqueβ {pr1 = Prod.Οβ} {pr2 = Prod.Οβ}
lemma (sym (β-linear-r _ _ _) β apβ _+_ (cancell Prod.Οββfactor) (pulll Prod.Οββfactor β β-zero-l) β Hom.elimr refl)
(sym (β-linear-r _ _ _) β apβ _+_ (pulll Prod.Οββfactor β β-zero-l) (cancell Prod.Οββfactor) β Hom.eliml refl)
(elimr refl)
(elimr refl)
Pre-abelian & abelian categoriesπ
An additive category is pre-abelian when it additionally has kernels and cokernels, hence binary equalisers and coequalisers where one of the maps is zero.
record is-pre-abelian {o β} (C : Precategory o β) : Type (o β lsuc β) where
field has-additive : is-additive C
open is-additive has-additive public
field
: β {A B} (f : Hom A B) β Kernel C β
f
kernel : β {A B} (f : Hom A B) β Coequaliser C 0m f
cokernel
module Ker {A B} (f : Hom A B) = Kernel (kernel f)
module Coker {A B} (f : Hom A B) = Coequaliser (cokernel f)
Every morphism in a preabelian category admits a canonical decomposition as
where, as indicated, the map is an epimorphism (indeed a regular epimorphism, since it is a cokernel) and the map is a regular monomorphism.
decompose: β {A B} (f : Hom A B)
β Ξ£[ f' β Hom (Coker.coapex (Ker.kernel f)) (Ker.ker (Coker.coeq f)) ]
(f β‘ Ker.kernel (Coker.coeq f) β f' β Coker.coeq (Ker.kernel f))
{A} {B} f = map , sym path
decompose where
: Hom (Coker.coapex (Ker.kernel f)) B
proj' = Coker.universal (Ker.kernel f) {e' = f} $ sym path proj'
: Hom (Coker.coapex (Ker.kernel f)) (Ker.ker (Coker.coeq f))
map = Ker.universal (Coker.coeq f) {e' = proj'} $ sym path map
The existence of the map and indeed of the maps and follow from the universal properties of kernels and cokernels. The map is the canonical quotient map and the map is the canonical subobject inclusion
A pre-abelian category is abelian when the map in the above decomposition is an isomorphism.
record is-abelian {o β} (C : Precategory o β) : Type (o β lsuc β) where
field has-is-preab : is-pre-abelian C
open is-pre-abelian has-is-preab public
field
coker-kerβker-coker: β {A B} (f : Hom A B) β is-invertible (decompose f .fst)
This implies in particular that any monomorphism is a kernel, and every epimorphism is a cokernel. Letβs investigate the case for βevery mono is a kernelβ first: Suppose that is some monomorphism; Weβll show that itβs isomorphic to in the slice category
module _ {A B} (f : Hom A B) (monic : is-monic f) where
private
module m = Cat (Slice C B)
The map is obtained as the composite
where the isomorphism is our canonical map from before.
: m.Hom (cut f) (cut (Ker.kernel (Coker.coeq f)))
fβkercoker ./-Hom.map = decompose f .fst β Coker.coeq (Ker.kernel f)
fβkercoker ./-Hom.commutes = sym (decompose f .snd) fβkercoker
Conversely, map is the composite
where the second map arises from the universal property of the cokernel: We can map out of it with the map since (using that is mono), we have from
: m.Hom (cut (Ker.kernel (Coker.coeq f))) (cut f)
kercokerβf ./-Hom.map =
kercokerβf .universal (Ker.kernel f) {e' = id} (monic _ _ path) β
Coker.is-invertible.inv
coker-kerβker-coker f where abstract
: f β id β 0m β‘ f β id β Ker.kernel f
path =
path (f β_) (eliml refl) β β-zero-r β©
f β id β 0m β‘β¨ ap .zero-βr _ β 0m-unique β©
0m β‘Λβ¨ β
(β
.zeroβ β Ker.kernel f) β‘Λβ¨ Ker.equal f β©
.kernel f β‘β¨ ap (f β_) (introl refl) β©
f β Ker.kernel f β f β id β Ker
This is indeed a map in the slice using that both isomorphisms and coequalisers are epic to make progress.
./-Hom.commutes = path where
kercokerβf =
lemma (Coker.coeq _) (Coker.has-is-coeq _) _ _ $
is-coequaliserβis-epic (Coker.factors _)
pullr
Β·Β· elimr refl(decompose f .snd β assoc _ _ _)
Β·Β·
=
path (coker-kerβker-coker _) _ _ $
invertibleβepic (f β Coker.universal _ _ β _) β decompose f .fst β‘β¨ apβ _β_ (assoc _ _ _) refl β©
((f β Coker.universal _ _) β _) β decompose f .fst β‘β¨ cancelr (coker-kerβker-coker _ .is-invertible.invr) β©
.universal _ _ β‘β¨ lemma β©
f β Coker.kernel _ β decompose f .fst β Ker
Using the universal property of the cokernel (both uniqueness and universality), we establish that the maps defined above are inverses in thus assemble into an isomorphism in the slice.
: cut f m.β
cut (Ker.kernel (Coker.coeq f))
monoβkernel = m.make-iso fβkercoker kercokerβf fβkcβf kcβfβkc where
monoβkernel : fβkercoker m.β kercokerβf β‘ m.id
fβkcβf = ext $
fβkcβf (decompose f .fst β Coker.coeq _) β Coker.universal _ _ β _ β‘β¨ cancel-inner lemma β©
.fst β _ β‘β¨ coker-kerβker-coker f .is-invertible.invl β©
decompose f
id βwhere
= Coker.uniqueβ _
lemma {e' = Coker.coeq (Ker.kernel f)}
(β-zero-r β sym (sym (Coker.coequal _) β β-zero-r))
(pullr (Coker.factors (Ker.kernel f)) β elimr refl)
(eliml refl)
: kercokerβf m.β fβkercoker β‘ m.id
kcβfβkc = ext $
kcβfβkc (Coker.universal _ _ β _) β decompose f .fst β Coker.coeq _ β‘β¨ cancel-inner (coker-kerβker-coker f .is-invertible.invr) β©
.universal _ _ β Coker.coeq _ β‘β¨ Coker.factors _ β©
Coker id β
βmultiplicationββ©οΈ