module Cat.Abelian.Base whereAbelian 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
Abelian-group-on-hom : β A B β Abelian-group-on (Hom A B)
_+_ : β {A B} (f g : Hom A B) β Hom A B
f + g = Abelian-group-on-hom _ _ .Abelian-group-on._*_ f g
0m : β {A B} β Hom A B
0m = Abelian-group-on-hom _ _ .Abelian-group-on.1g
Hom-grp : β A B β Abelian-group β
Hom-grp A B = (el (Hom A B) (Hom-set A B)) , Abelian-group-on-hom 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)
βmap : β {A B C} β Ab.Hom (Hom-grp B C β Hom-grp A B) (Hom-grp A C)
βmap {A} {B} {C} =
from-bilinear-map (Hom-grp B C) (Hom-grp A B) (Hom-grp A C)
(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 _-_)
publicNote that from multilinearity of composition, it follows that the addition of and composition1 operations satisfy familiar algebraic identities, e.g.Β etc.
β-zero-r : β {A B C} {f : Hom B C} β f β 0m {A} {B} β‘ 0m
β-zero-r {f = f} =
f β 0m β‘β¨ Hom.intror Hom.inverser β©
f β 0m + (f β 0m - f β 0m) β‘β¨ Hom.associative β©
(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 β
β-zero-l : β {A B C} {f : Hom A B} β 0m β f β‘ 0m {A} {C}
β-zero-l {f = f} =
0m β f β‘β¨ Hom.introl Hom.inversel β©
(Hom.inverse (0m β f) + 0m β f) + 0m β f β‘β¨ sym Hom.associative β©
Hom.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 β©
0m β
neg-β-l
: β {A B C} {g : Hom B C} {h : Hom A B}
β Hom.inverse (g β h) β‘ Hom.inverse g β h
neg-β-l {g = g} {h} = monoid-inverse-unique Hom.has-is-monoid (g β h) _ _
Hom.inversel
(β-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
neg-β-r {g = g} {h} = monoid-inverse-unique Hom.has-is-monoid (g β h) _ _
Hom.inversel
(β-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 - g β h β‘β¨ ap (f β h +_) neg-β-l β©
f β h + (Hom.inverse g β h) β‘β¨ β-linear-l _ _ _ β©
(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 - f β h β‘β¨ ap (f β g +_) neg-β-r β©
f β g + (f β Hom.inverse h) β‘β¨ β-linear-r _ _ _ β©
f β (g - h) β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
id-zeroβzero : β {X} β A.id {X} β‘ A.0m β is-zero C X
id-zeroβzero idm .is-zero.has-is-initial B = contr A.0m Ξ» h β sym $
h β‘β¨ A.intror refl β©
h A.β A.id β‘β¨ A.reflβ©ββ¨ idm β©
h A.β A.0m β‘β¨ A.β-zero-r β©
A.0m β
id-zeroβzero idm .is-zero.has-is-terminal x = contr A.0m Ξ» h β sym $
h β‘β¨ A.introl refl β©
A.id A.β h β‘β¨ idm A.β©ββ¨refl β©
A.0m A.β h β‘β¨ A.β-zero-l β©
A.0m β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-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 Ξ» _ β
sym (f .preserves .is-group-hom.pres-β _ _)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
no-eta-equality
field
has-ab : Ab-category C
has-terminal : Terminal C
has-prods : Binary-products C
open Ab-category has-ab public
has-zero : Zero C
has-zero .Zero.β
= has-terminal .Terminal.top
has-zero .Zero.has-is-zero = id-zeroβzero has-ab $
is-contrβis-prop (has-terminal .Terminal.hasβ€ _) _ _
open Zero has-zero public
0m-unique : β {A B} β zeroβ {A} {B} β‘ 0m
0m-unique = apβ _β_ (Β‘-unique 0m) refl β β-zero-lCoincidence 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.
open Binary-products has-prods
has-coprods : Binary-coproducts C
has-coprods .Binary-coproducts._ββ_ = _ββ_
has-coprods .Binary-coproducts.ΞΉβ = β¨ id , 0m β©
has-coprods .Binary-coproducts.ΞΉβ = β¨ 0m , id β©
has-coprods .Binary-coproducts.[_,_] f g = f β Οβ + g β Οβ
has-coprods .Binary-coproducts.[]βΞΉβ {inj0 = f} {g} =
(f β Οβ + g β Οβ) β β¨ id , 0m β© β‘β¨ sym (β-linear-l _ _ _) β©
(f β Οβ) β β¨ id , 0m β© + _ β‘β¨ Hom.elimr (pullr Οβββ¨β© β β-zero-r) β©
(f β Οβ) β β¨ id , 0m β© β‘β¨ cancelr Οβββ¨β© β©
f β
has-coprods .Binary-coproducts.[]βΞΉβ {inj0 = f} {g} =
(f β Οβ + g β Οβ) β β¨ 0m , id β© β‘β¨ sym (β-linear-l _ _ _) β©
_ + (g β Οβ) β β¨ 0m , id β© β‘β¨ Hom.eliml (pullr Οβββ¨β© β β-zero-r) β©
(g β Οβ) β β¨ 0m , id β© β‘β¨ cancelr Οβββ¨β© β©
g β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-coprods .Binary-coproducts.[]-unique {inj0 = f} {g} {other} p q = sym $
f β Οβ + g β Οβ β‘β¨ apβ _+_ (pushl (sym p)) (pushl (sym q)) β©
(other β β¨ id , 0m β© β Οβ) + (other β β¨ 0m , id β© β Οβ) β‘β¨ β-linear-r _ _ _ β©
other β (β¨ id , 0m β© β Οβ + β¨ 0m , id β© β Οβ) β‘β¨ elimr lemma β©
other β
where
lemma : β¨ id , 0m β© β Οβ + β¨ 0m , id β© β Οβ
β‘ id
lemma = β¨β©-uniqueβ {pr1 = Οβ} {pr2 = Οβ}
(sym (β-linear-r _ _ _) β apβ _+_ (cancell Οβββ¨β©) (pulll Οβββ¨β© β β-zero-l) β Hom.elimr refl)
(sym (β-linear-r _ _ _) β apβ _+_ (pulll Οβββ¨β© β β-zero-l) (cancell Οβββ¨β©) β Hom.eliml refl)
(elimr refl)
(elimr refl)
open Binary-coproducts has-coprodsThus every additive category is semiadditive.
has-biprods : Binary-biproducts C
has-biprods .Binary-biproducts._ββ_ = _ββ_
has-biprods .Binary-biproducts.Οβ = Οβ
has-biprods .Binary-biproducts.Οβ = Οβ
has-biprods .Binary-biproducts.β¨_,_β© = β¨_,_β©
has-biprods .Binary-biproducts.Οβββ¨β© = Οβββ¨β©
has-biprods .Binary-biproducts.Οβββ¨β© = Οβββ¨β©
has-biprods .Binary-biproducts.β¨β©-unique = β¨β©-unique
has-biprods .Binary-biproducts.ΞΉβ = ΞΉβ
has-biprods .Binary-biproducts.ΞΉβ = ΞΉβ
has-biprods .Binary-biproducts.[_,_] = [_,_]
has-biprods .Binary-biproducts.[]βΞΉβ = []βΞΉβ
has-biprods .Binary-biproducts.[]βΞΉβ = []βΞΉβ
has-biprods .Binary-biproducts.[]-unique = []-unique
has-biprods .Binary-biproducts.ΟΞΉβ = Οβββ¨β©
has-biprods .Binary-biproducts.ΟΞΉβ = Οβββ¨β©
has-biprods .Binary-biproducts.ΞΉΟ-comm =
ΞΉβ β Οβ β ΞΉβ β Οβ β‘β¨ reflβ©ββ¨ pulll Οβββ¨β© β©
ΞΉβ β 0m β Οβ β‘β¨ pulll β-zero-r β β-zero-l β©
0m β‘Λβ¨ pulll β-zero-r β β-zero-l β©
ΞΉβ β 0m β Οβ β‘Λβ¨ reflβ©ββ¨ pulll Οβββ¨β© β©
ΞΉβ β Οβ β ΞΉβ β Οβ β
additiveβsemiadditive : is-semiadditive C
additiveβsemiadditive .is-semiadditive.has-zero = has-zero
additiveβsemiadditive .is-semiadditive.has-biproducts = has-biprods
open is-semiadditive additiveβsemiadditive using (_+β_) publicAs described there, every semiadditive
category has its own enrichment in commutative monoids. Since we
already know that the zero morphisms agree (0m-unique), it would be natural to expect
that the additions also agree; this is straightforward to check by
linearity.
enrichments-agree : β {A B} {f g : Hom A B} β f +β g β‘ f + g
enrichments-agree {f = f} {g} =
(id β Οβ + id β Οβ) β (f ββ g) β Ξ΄ β‘β¨ apβ _+_ (idl _) (idl _) β©ββ¨refl β©
(Οβ + Οβ) β (f ββ g) β Ξ΄ β‘Λβ¨ β-linear-l _ _ _ β©
(Οβ β (f ββ g) β Ξ΄ + Οβ β (f ββ g) β Ξ΄) β‘β¨ apβ _+_ (pulll Οβββ¨β© β cancelr Οβββ¨β©) (pulll Οβββ¨β© β cancelr Οβββ¨β©) β©
f + g βTherefore, in order to get an additive category from a semiadditive category, it suffices to ask for inverses for every morphism, so that each becomes a group.
semiadditive+groupβadditive
: (inv : β {A B} β Hom A B β Hom A B)
β (invl : β {A B} {f : Hom A B} β inv f +β f β‘ zeroβ)
β is-additive C
semiadditive+groupβadditive inv invl .is-additive.has-ab = ab where
mk : β {A B} β make-abelian-group (Hom A B)
mk .make-abelian-group.ab-is-set = hlevel 2
mk .make-abelian-group.mul = _+β_
mk .make-abelian-group.inv = inv
mk .make-abelian-group.1g = zeroβ
mk .make-abelian-group.idl _ = +-idl
mk .make-abelian-group.assoc _ _ _ = +-assoc
mk .make-abelian-group.invl _ = invl
mk .make-abelian-group.comm _ _ = +-comm
ab : Ab-category C
ab .Ab-category.Abelian-group-on-hom _ _ = to-abelian-group-on mk
ab .Ab-category.β-linear-l _ _ _ = β-linear-l
ab .Ab-category.β-linear-r _ _ _ = β-linear-r
semiadditive+groupβadditive inv invl .is-additive.has-terminal = terminal
semiadditive+groupβadditive inv invl .is-additive.has-prods = productsPre-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
kernel : β {A B} (f : Hom A B) β Kernel C has-zero f
cokernel : β {A B} (f : Hom A B) β Coequaliser C 0m f
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.coequ f)) ]
(f β‘ Ker.kernel (Coker.coequ f) β f' β Coker.coequ (Ker.kernel f))
decompose {A} {B} f = map , sym path
where
proj' : Hom (Coker.coapex (Ker.kernel f)) B
proj' = Coker.universal (Ker.kernel f) {e' = f} $ sym path map : Hom (Coker.coapex (Ker.kernel f)) (Ker.ker (Coker.coequ f))
map = Ker.universal (Coker.coequ f) {e' = proj'} $ sym pathThe 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.
fβkercoker : m.Hom (cut f) (cut (Ker.kernel (Coker.coequ f)))
fβkercoker ./-Hom.map = decompose f .fst β Coker.coequ (Ker.kernel f)
fβkercoker ./-Hom.commutes = sym (decompose f .snd)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
kercokerβf : m.Hom (cut (Ker.kernel (Coker.coequ f))) (cut f)
kercokerβf ./-Hom.map =
Coker.universal (Ker.kernel f) {e' = id} (monic _ _ path) β
coker-kerβker-coker f .is-invertible.inv
where abstract
path : f β id β 0m β‘ f β id β Ker.kernel f
path =
f β id β 0m β‘β¨ ap (f β_) (eliml refl) β β-zero-r β©
0m β‘Λβ¨ zero-βr _ β 0m-unique β©
(zeroβ β Ker.kernel f) β‘Λβ¨ Ker.equal f β©
f β Ker.kernel f β‘β¨ ap (f β_) (introl refl) β©
f β id β Ker.kernel f βThis is indeed a map in the slice using that both isomorphisms and coequalisers are epic to make progress.
kercokerβf ./-Hom.commutes = path where
lemma =
is-coequaliserβis-epic (Coker.coequ _) (Coker.has-is-coeq _) _ _ $
pullr (Coker.factors _)
Β·Β· elimr refl
Β·Β· (decompose f .snd β assoc _ _ _)
path =
invertibleβepic (coker-kerβker-coker _) _ _ $
(f β Coker.universal _ _ β _) β decompose f .fst β‘β¨ apβ _β_ (assoc _ _ _) refl β©
((f β Coker.universal _ _) β _) β decompose f .fst β‘β¨ cancelr (coker-kerβker-coker _ .is-invertible.invr) β©
f β Coker.universal _ _ β‘β¨ lemma β©
Ker.kernel _ β decompose f .fst β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.
monoβkernel : cut f m.β
cut (Ker.kernel (Coker.coequ f))
monoβkernel = m.make-iso fβkercoker kercokerβf fβkcβf kcβfβkc where
fβkcβf : fβkercoker m.β kercokerβf β‘ m.id
fβkcβf = ext $
(decompose f .fst β Coker.coequ _) β Coker.universal _ _ β _ β‘β¨ cancel-inner lemma β©
decompose f .fst β _ β‘β¨ coker-kerβker-coker f .is-invertible.invl β©
id β
where
lemma = Coker.uniqueβ _
{e' = Coker.coequ (Ker.kernel f)}
(β-zero-r β sym (sym (Coker.coequal _) β β-zero-r))
(pullr (Coker.factors (Ker.kernel f)) β elimr refl)
(eliml refl)
kcβfβkc : kercokerβf m.β fβkercoker β‘ m.id
kcβfβkc = ext $
(Coker.universal _ _ β _) β decompose f .fst β Coker.coequ _ β‘β¨ cancel-inner (coker-kerβker-coker f .is-invertible.invr) β©
Coker.universal _ _ β Coker.coequ _ β‘β¨ Coker.factors _ β©
id ββmultiplicationββ©οΈ