# mathlibdocumentation

In mathlib, we define an abelian category as a preadditive category with a zero object, kernels and cokernels, products and coproducts and in which every monomorphism and epimorphis is normal.

While virtually every interesting abelian category has a natural preadditive structure (which is why it is included in the definition), preadditivity is not actually needed: Every category that has all of the other properties appearing in the definition of an abelian category admits a preadditive structure. This is the construction we carry out in this file.

The proof proceeds in roughly five steps:

1. Prove some results (for example that all equalizers exist) that would be trivial if we already had the preadditive structure but are a bit of work without it.
2. Develop images and coimages to show that every monomorphism is the kernel of its cokernel.

The results of the first two steps are also useful for the "normal" development of abelian categories, and will be used there.

1. For every object A, define a "subtraction" morphism σ : A ⨯ A ⟶ A and use it to define subtraction on morphisms as f - g := prod.lift f g ≫ σ.
2. Prove a small number of identities about this subtraction from the definition of σ.
3. From these identities, prove a large number of other identities that imply that defining f + g := f - (0 - g) indeed gives an abelian group structure on morphisms such that composition is bilinear.

The construction is non-trivial and it is quite remarkable that this abelian group structure can be constructed purely from the existence of a few limits and colimits. What's even more impressive is that all additive structures on a category are in some sense isomorphic, so for abelian categories with a natural preadditive structure, this construction manages to "almost" reconstruct this natural structure. However, we have not formalized this isomorphism.

## References

• [F. Borceux, Handbook of Categorical Algebra 2][borceux-vol2]
@[class]
structure category_theory.non_preadditive_abelian (C : Type u)  :
Type (max u v)
• has_zero_object :
• has_zero_morphisms :
• has_kernels :
• has_cokernels :
• has_finite_products :
• has_finite_coproducts :
• normal_mono : Π {X Y : C} (f : X Y) [_inst_2 : ,
• normal_epi : Π {X Y : C} (f : X Y) [_inst_2 : ,

We call a category non_preadditive_abelian if it has a zero object, kernels, cokernels, binary products and coproducts, and every monomorphism and every epimorphism is normal.

theorem category_theory.non_preadditive_abelian.strong_epi_of_epi {C : Type u} {P Q : C} (f : P Q)  :

In a non_preadditive_abelian category, every epimorphism is strong.

def category_theory.non_preadditive_abelian.is_iso_of_mono_of_epi {C : Type u} {X Y : C} (f : X Y)  :

In a non_preadditive_abelian category, a monomorphism which is also an epimorphism is an isomorphism.

Equations
theorem category_theory.non_preadditive_abelian.pullback_of_mono {C : Type u} {X Y Z : C} (a : X Z) (b : Y Z)  :

The pullback of two monomorphisms exists.

theorem category_theory.non_preadditive_abelian.pushout_of_epi {C : Type u} {X Y Z : C} (a : X Y) (b : X Z)  :

The pushout of two epimorphisms exists.

theorem category_theory.non_preadditive_abelian.has_limit_parallel_pair {C : Type u} {X Y : C} (f g : X Y) :

The equalizer of f and g exists.

theorem category_theory.non_preadditive_abelian.has_colimit_parallel_pair {C : Type u} {X Y : C} (f g : X Y) :

The coequalizer of f and g exists.

@[instance]

A non_preadditive_abelian category has all equalizers.

@[instance]

A non_preadditive_abelian category has all coequalizers.

theorem category_theory.non_preadditive_abelian.mono_of_zero_kernel {C : Type u} {X Y : C} (f : X Y) (Z : C) :

If a zero morphism is a kernel of f, then f is a monomorphism.

theorem category_theory.non_preadditive_abelian.epi_of_zero_cokernel {C : Type u} {X Y : C} (f : X Y) (Z : C) :

If a zero morphism is a cokernel of f, then f is an epimorphism.

def category_theory.non_preadditive_abelian.zero_kernel_of_cancel_zero {C : Type u} {X Y : C} (f : X Y) :
(∀ (Z : C) (g : Z X), g f = 0g = 0)

If g ≫ f = 0 implies g = 0 for all g, then 0 : 0 ⟶ X is a kernel of f.

Equations
def category_theory.non_preadditive_abelian.zero_cokernel_of_zero_cancel {C : Type u} {X Y : C} (f : X Y) :
(∀ (Z : C) (g : Y Z), f g = 0g = 0)

If f ≫ g = 0 implies g = 0 for all g, then 0 : Y ⟶ 0 is a cokernel of f.

Equations
theorem category_theory.non_preadditive_abelian.mono_of_cancel_zero {C : Type u} {X Y : C} (f : X Y) :
(∀ (Z : C) (g : Z X), g f = 0g = 0)

If g ≫ f = 0 implies g = 0 for all g, then f is a monomorphism.

theorem category_theory.non_preadditive_abelian.epi_of_zero_cancel {C : Type u} {X Y : C} (f : X Y) :
(∀ (Z : C) (g : Y Z), f g = 0g = 0)

If f ≫ g = 0 implies g = 0 for all g, then g is a monomorphism.

def category_theory.non_preadditive_abelian.image {C : Type u} {P Q : C} :
(P Q) → C

The kernel of the cokernel of f is called the image of f.

def category_theory.non_preadditive_abelian.image.ι {C : Type u} {P Q : C} (f : P Q) :

The inclusion of the image into the codomain.

def category_theory.non_preadditive_abelian.factor_thru_image {C : Type u} {P Q : C} (f : P Q) :

There is a canonical epimorphism p : P ⟶ image f for every f.

@[simp]
theorem category_theory.non_preadditive_abelian.image.fac_assoc {C : Type u} {P Q : C} (f : P Q) {X' : C} (f' : Q X') :

@[simp]
theorem category_theory.non_preadditive_abelian.image.fac {C : Type u} {P Q : C} (f : P Q) :

f factors through its image via the canonical morphism p.

@[instance]

The map p : P ⟶ image f is an epimorphism

@[instance]

@[instance]

Equations
def category_theory.non_preadditive_abelian.coimage {C : Type u} {P Q : C} :
(P Q) → C

The cokernel of the kernel of f is called the coimage of f.

def category_theory.non_preadditive_abelian.coimage.π {C : Type u} {P Q : C} (f : P Q) :

The projection onto the coimage.

def category_theory.non_preadditive_abelian.factor_thru_coimage {C : Type u} {P Q : C} (f : P Q) :

There is a canonical monomorphism i : coimage f ⟶ Q.

f factors through its coimage via the canonical morphism p.

@[instance]

The canonical morphism i : coimage f ⟶ Q is a monomorphism

@[instance]

@[instance]

Equations

In a non_preadditive_abelian category, an epi is the cokernel of its kernel. More precisely: If f is an epimorphism and s is some limit kernel cone on f, then f is a cokernel of fork.ι s.

Equations

In a non_preadditive_abelian category, a mono is the kernel of its cokernel. More precisely: If f is a monomorphism and s is some colimit cokernel cocone on f, then f is a kernel of cofork.π s.

Equations

The composite A ⟶ A ⨯ A ⟶ cokernel (Δ A), where the first map is (𝟙 A, 0) and the second map is the canonical projection into the cokernel.

@[instance]

@[instance]

@[instance]

@[instance]

Equations
def category_theory.non_preadditive_abelian.σ {C : Type u} {A : C} :
A A A

The composite A ⨯ A ⟶ cokernel (diag A) ⟶ A given by the natural projection into the cokernel followed by the inverse of r. In the category of modules, using the normal kernels and cokernels, this map is equal to the map (a, b) ↦ a - b, hence the name σ for "subtraction".

@[simp]

@[simp]
theorem category_theory.non_preadditive_abelian.diag_σ_assoc {C : Type u} {X X' : C} (f' : X X') :

@[simp]
theorem category_theory.non_preadditive_abelian.lift_σ {C : Type u} {X : C} :

@[simp]
theorem category_theory.non_preadditive_abelian.lift_σ_assoc {C : Type u} {X X' : C} (f' : X X') :

theorem category_theory.non_preadditive_abelian.lift_map {C : Type u} {X Y : C} (f : X Y) :

theorem category_theory.non_preadditive_abelian.lift_map_assoc {C : Type u} {X Y : C} (f : X Y) {X' : C} (f' : Y Y X') :
= f f'

σ is a cokernel of Δ X.

Equations
theorem category_theory.non_preadditive_abelian.σ_comp {C : Type u} {X Y : C} (f : X Y) :

This is the key identity satisfied by σ.

def category_theory.non_preadditive_abelian.has_sub {C : Type u} {X Y : C} :
has_sub (X Y)

Subtraction of morphisms in a non_preadditive_abelian category.

Equations
def category_theory.non_preadditive_abelian.has_neg {C : Type u} {X Y : C} :
has_neg (X Y)

Negation of morphisms in a non_preadditive_abelian category.

Equations

Addition of morphisms in a non_preadditive_abelian category.

Equations
theorem category_theory.non_preadditive_abelian.sub_def {C : Type u} {X Y : C} (a b : X Y) :

theorem category_theory.non_preadditive_abelian.add_def {C : Type u} {X Y : C} (a b : X Y) :
a + b = a - -b

theorem category_theory.non_preadditive_abelian.neg_def {C : Type u} {X Y : C} (a : X Y) :
-a = 0 - a

theorem category_theory.non_preadditive_abelian.sub_zero {C : Type u} {X Y : C} (a : X Y) :
a - 0 = a

theorem category_theory.non_preadditive_abelian.sub_self {C : Type u} {X Y : C} (a : X Y) :
a - a = 0

theorem category_theory.non_preadditive_abelian.lift_sub_lift {C : Type u} {X Y : C} (a b c d : X Y) :

theorem category_theory.non_preadditive_abelian.sub_sub_sub {C : Type u} {X Y : C} (a b c d : X Y) :
a - c - (b - d) = a - b - (c - d)

theorem category_theory.non_preadditive_abelian.neg_sub {C : Type u} {X Y : C} (a b : X Y) :
-a - b = -b - a

theorem category_theory.non_preadditive_abelian.neg_neg {C : Type u} {X Y : C} (a : X Y) :
--a = a

theorem category_theory.non_preadditive_abelian.add_comm {C : Type u} {X Y : C} (a b : X Y) :
a + b = b + a

theorem category_theory.non_preadditive_abelian.add_neg {C : Type u} {X Y : C} (a b : X Y) :
a + -b = a - b

theorem category_theory.non_preadditive_abelian.add_neg_self {C : Type u} {X Y : C} (a : X Y) :
a + -a = 0

theorem category_theory.non_preadditive_abelian.neg_add_self {C : Type u} {X Y : C} (a : X Y) :
-a + a = 0

theorem category_theory.non_preadditive_abelian.neg_sub' {C : Type u} {X Y : C} (a b : X Y) :
-(a - b) = -a + b

theorem category_theory.non_preadditive_abelian.neg_add {C : Type u} {X Y : C} (a b : X Y) :
-(a + b) = -a - b

theorem category_theory.non_preadditive_abelian.sub_add {C : Type u} {X Y : C} (a b c : X Y) :
a - b + c = a - (b - c)

theorem category_theory.non_preadditive_abelian.add_assoc {C : Type u} {X Y : C} (a b c : X Y) :
a + b + c = a + (b + c)

theorem category_theory.non_preadditive_abelian.add_zero {C : Type u} {X Y : C} (a : X Y) :
a + 0 = a

theorem category_theory.non_preadditive_abelian.comp_sub {C : Type u} {X Y Z : C} (f : X Y) (g h : Y Z) :
f (g - h) = f g - f h

theorem category_theory.non_preadditive_abelian.sub_comp {C : Type u} {X Y Z : C} (f g : X Y) (h : Y Z) :
(f - g) h = f h - g h

theorem category_theory.non_preadditive_abelian.comp_add {C : Type u} (X Y Z : C) (f : X Y) (g h : Y Z) :
f (g + h) = f g + f h

theorem category_theory.non_preadditive_abelian.add_comp {C : Type u} (X Y Z : C) (f g : X Y) (h : Y Z) :
(f + g) h = f h + g h

Every non_preadditive_abelian category is preadditive.

Equations