# Documentation

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 epimorphism 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. Even more remarkably, since abelian categories admit exactly one preadditive structure (see subsingletonPreadditiveOfHasBinaryBiproducts), the construction manages to exactly reconstruct any natural preadditive structure the category may have.

## References #

• [F. Borceux, Handbook of Categorical Algebra 2][borceux-vol2]

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

• zero : (X Y : C) → Zero (X Y)
• comp_zero : ∀ {X Y : C} (f : X Y) (Z : C),
• zero_comp : ∀ (X : C) {Y Z : C} (f : Y Z),
• normalMonoOfMono : {X Y : C} → (f : X Y) → [inst : ] →
• normalEpiOfEpi : {X Y : C} → (f : X Y) → [inst : ] →
• has_zero_object :
• has_kernels :
• has_cokernels :
• has_finite_products :
• has_finite_coproducts :
Instances

The map p : P ⟶ image f is an epimorphism

Equations
• =
instance CategoryTheory.NonPreadditiveAbelian.isIso_factorThruImage {C : Type u} {P : C} {Q : C} (f : P Q) :
Equations
• =

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

Equations
• =
instance CategoryTheory.NonPreadditiveAbelian.isIso_factorThruCoimage {C : Type u} {P : C} {Q : C} (f : P Q) :
Equations
• =
def CategoryTheory.NonPreadditiveAbelian.epiIsCokernelOfKernel {C : Type u} {X : C} {Y : C} {f : X Y} (s : ) :

In a NonPreadditiveAbelian 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
• One or more equations did not get rendered due to their size.
Instances For
def CategoryTheory.NonPreadditiveAbelian.monoIsKernelOfCokernel {C : Type u} {X : C} {Y : C} {f : X Y} (s : ) :

In a NonPreadditiveAbelian 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
• One or more equations did not get rendered due to their size.
Instances For
@[inline, reducible]

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.

Equations
• One or more equations did not get rendered due to their size.
Instances For
Equations
• =
Equations
• =
Equations
• =
Equations
• =
@[inline, reducible]
abbrev CategoryTheory.NonPreadditiveAbelian.σ {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".

Equations
• One or more equations did not get rendered due to their size.
Instances For
theorem CategoryTheory.NonPreadditiveAbelian.diag_σ {C : Type u} {X : C} :
@[simp]
theorem CategoryTheory.NonPreadditiveAbelian.lift_σ_assoc {C : Type u} {X : C} {Z : C} (h : X Z) :
@[simp]
theorem CategoryTheory.NonPreadditiveAbelian.lift_σ {C : Type u} {X : C} :
theorem CategoryTheory.NonPreadditiveAbelian.lift_map_assoc {C : Type u} {X : C} {Y : C} (f : X Y) {Z : C} (h : Y Y Z) :
theorem CategoryTheory.NonPreadditiveAbelian.lift_map {C : Type u} {X : C} {Y : C} (f : X Y) :

σ is a cokernel of Δ X.

Equations
• One or more equations did not get rendered due to their size.
Instances For
theorem CategoryTheory.NonPreadditiveAbelian.σ_comp {C : Type u} {X : C} {Y : C} (f : X Y) :

This is the key identity satisfied by σ.

def CategoryTheory.NonPreadditiveAbelian.hasSub {C : Type u} {X : C} {Y : C} :
Sub (X Y)

Subtraction of morphisms in a NonPreadditiveAbelian category.

Equations
• One or more equations did not get rendered due to their size.
Instances For
def CategoryTheory.NonPreadditiveAbelian.hasNeg {C : Type u} {X : C} {Y : C} :
Neg (X Y)

Negation of morphisms in a NonPreadditiveAbelian category.

Equations
• CategoryTheory.NonPreadditiveAbelian.hasNeg = { neg := fun (f : X Y) => 0 - f }
Instances For
def CategoryTheory.NonPreadditiveAbelian.hasAdd {C : Type u} {X : C} {Y : C} :

Addition of morphisms in a NonPreadditiveAbelian category.

Equations
• CategoryTheory.NonPreadditiveAbelian.hasAdd = { add := fun (f g : X Y) => f - -g }
Instances For
theorem CategoryTheory.NonPreadditiveAbelian.sub_def {C : Type u} {X : C} {Y : C} (a : X Y) (b : X Y) :
a - b = CategoryTheory.CategoryStruct.comp CategoryTheory.NonPreadditiveAbelian.σ
theorem CategoryTheory.NonPreadditiveAbelian.add_def {C : Type u} {X : C} {Y : C} (a : X Y) (b : X Y) :
a + b = a - -b
theorem CategoryTheory.NonPreadditiveAbelian.neg_def {C : Type u} {X : C} {Y : C} (a : X Y) :
-a = 0 - a
theorem CategoryTheory.NonPreadditiveAbelian.sub_zero {C : Type u} {X : C} {Y : C} (a : X Y) :
a - 0 = a
theorem CategoryTheory.NonPreadditiveAbelian.sub_self {C : Type u} {X : C} {Y : C} (a : X Y) :
a - a = 0
theorem CategoryTheory.NonPreadditiveAbelian.lift_sub_lift {C : Type u} {X : C} {Y : C} (a : X Y) (b : X Y) (c : X Y) (d : X Y) :
theorem CategoryTheory.NonPreadditiveAbelian.sub_sub_sub {C : Type u} {X : C} {Y : C} (a : X Y) (b : X Y) (c : X Y) (d : X Y) :
a - c - (b - d) = a - b - (c - d)
theorem CategoryTheory.NonPreadditiveAbelian.neg_sub {C : Type u} {X : C} {Y : C} (a : X Y) (b : X Y) :
-a - b = -b - a
theorem CategoryTheory.NonPreadditiveAbelian.neg_neg {C : Type u} {X : C} {Y : C} (a : X Y) :
- -a = a
theorem CategoryTheory.NonPreadditiveAbelian.add_comm {C : Type u} {X : C} {Y : C} (a : X Y) (b : X Y) :
a + b = b + a
theorem CategoryTheory.NonPreadditiveAbelian.add_neg {C : Type u} {X : C} {Y : C} (a : X Y) (b : X Y) :
a + -b = a - b
theorem CategoryTheory.NonPreadditiveAbelian.add_neg_self {C : Type u} {X : C} {Y : C} (a : X Y) :
a + -a = 0
theorem CategoryTheory.NonPreadditiveAbelian.neg_add_self {C : Type u} {X : C} {Y : C} (a : X Y) :
-a + a = 0
theorem CategoryTheory.NonPreadditiveAbelian.neg_sub' {C : Type u} {X : C} {Y : C} (a : X Y) (b : X Y) :
-(a - b) = -a + b
theorem CategoryTheory.NonPreadditiveAbelian.neg_add {C : Type u} {X : C} {Y : C} (a : X Y) (b : X Y) :
-(a + b) = -a - b
theorem CategoryTheory.NonPreadditiveAbelian.sub_add {C : Type u} {X : C} {Y : C} (a : X Y) (b : X Y) (c : X Y) :
a - b + c = a - (b - c)
theorem CategoryTheory.NonPreadditiveAbelian.add_assoc {C : Type u} {X : C} {Y : C} (a : X Y) (b : X Y) (c : X Y) :
a + b + c = a + (b + c)
theorem CategoryTheory.NonPreadditiveAbelian.add_zero {C : Type u} {X : C} {Y : C} (a : X Y) :
a + 0 = a
theorem CategoryTheory.NonPreadditiveAbelian.comp_sub {C : Type u} {X : C} {Y : C} {Z : C} (f : X Y) (g : Y Z) (h : Y Z) :
theorem CategoryTheory.NonPreadditiveAbelian.sub_comp {C : Type u} {X : C} {Y : C} {Z : C} (f : X Y) (g : X Y) (h : Y Z) :
theorem CategoryTheory.NonPreadditiveAbelian.comp_add {C : Type u} (X : C) (Y : C) (Z : C) (f : X Y) (g : Y Z) (h : Y Z) :
theorem CategoryTheory.NonPreadditiveAbelian.add_comp {C : Type u} (X : C) (Y : C) (Z : C) (f : X Y) (g : X Y) (h : Y Z) :

Every NonPreadditiveAbelian category is preadditive.

Equations