# Documentation

Mathlib.CategoryTheory.Category.Basic

# Categories #

Defines a category, as a type class parametrised by the type of objects.

## Notations #

Introduces notations

• X ⟶ Y⟶ Y for the morphism spaces (type as \hom),
• 𝟙 X for the identity morphism on X (type as \b1),
• f ≫ g≫ g for composition in the 'arrows' convention (type as \gg).

Users may like to add f ⊚ g⊚ g for composition in the standard convention, using

local notation f  ⊚ :80 g:80 := category.comp g f    -- type as \oo
⊚ :80 g:80 := category.comp g f    -- type as \oo


## Porting note #

I am experimenting with using the aesop tactic as a replacement for tidy.

A wrapper for ext that will fail if it does not make progress.

Equations
• One or more equations did not get rendered due to their size.
class CategoryTheory.CategoryStruct (obj : Type u) extends :
Type (maxu(v+1))
• The identity morphism on an object.

id : (X : obj) → X X
• Composition of morphisms in a category, written f ≫ g≫ g.

comp : {X Y Z : obj} → (X Y) → (Y Z) → (X Z)

A preliminary structure on the way to defining a category, containing the data, but none of the axioms.

Instances

Notation for the identity morphism in a category.

Equations

Notation for composition of morphisms in a category.

Equations

A thin wrapper for aesop which adds the CategoryTheory rule set and allows aesop to look through semireducible definitions when calling intros. This tactic fails when it is unable to solve the goal, making it suitable for use in auto-params.

Equations
• One or more equations did not get rendered due to their size.

A variant of aesop_cat which does not fail when it is unable to solve the goal. Use this only for exploration! Nonterminal aesop is even worse than nonterminal simp.

Equations
• One or more equations did not get rendered due to their size.
class CategoryTheory.Category (obj : Type u) extends :
Type (maxu(v+1))

The typeclass Category C describes morphisms associated to objects of type C. The universe levels of the objects and morphisms are unconstrained, and will often need to be specified explicitly, as Category.{v} C. (See also LargeCategory and SmallCategory.)

Instances
@[inline]
abbrev CategoryTheory.LargeCategory (C : Type (u+1)) :
Type (u+1)

A LargeCategory has objects in one universe level higher than the universe level of the morphisms. It is useful for examples such as the category of types, or the category of groups, etc.

Equations
@[inline]
abbrev CategoryTheory.SmallCategory (C : Type u) :
Type (u+1)

A SmallCategory has objects and morphisms in the same universe level.

Equations
theorem CategoryTheory.eq_whisker {C : Type u} [inst : ] {X : C} {Y : C} {Z : C} {f : X Y} {g : X Y} (w : f = g) (h : Y Z) :
f h = g h

postcompose an equation between morphisms by another morphism

theorem CategoryTheory.whisker_eq {C : Type u} [inst : ] {X : C} {Y : C} {Z : C} (f : X Y) {g : Y Z} {h : Y Z} (w : g = h) :
f g = f h

precompose an equation between morphisms by another morphism

Notation for whiskering an equation by a morphism (on the right). If f g : X ⟶ Y⟶ Y and w : f = g and h : Y ⟶ Z⟶ Z, then w =≫ h : f ≫ h = g ≫ h≫ h : f ≫ h = g ≫ h≫ h = g ≫ h≫ h.

Equations
• One or more equations did not get rendered due to their size.

Notation for whiskering an equation by a morphism (on the left). If g h : Y ⟶ Z⟶ Z and w : g = h and h : X ⟶ Y⟶ Y, then f ≫= w : f ≫ g = f ≫ h≫= w : f ≫ g = f ≫ h≫ g = f ≫ h≫ h.

Equations
• One or more equations did not get rendered due to their size.
theorem CategoryTheory.eq_of_comp_left_eq {C : Type u} [inst : ] {X : C} {Y : C} {f : X Y} {g : X Y} (w : ∀ {Z : C} (h : Y Z), f h = g h) :
f = g
theorem CategoryTheory.eq_of_comp_right_eq {C : Type u} [inst : ] {Y : C} {Z : C} {f : Y Z} {g : Y Z} (w : ∀ {X : C} (h : X Y), h f = h g) :
f = g
theorem CategoryTheory.eq_of_comp_left_eq' {C : Type u} [inst : ] {X : C} {Y : C} (f : X Y) (g : X Y) (w : (fun {Z} h => f h) = fun {Z} h => g h) :
f = g
theorem CategoryTheory.eq_of_comp_right_eq' {C : Type u} [inst : ] {Y : C} {Z : C} (f : Y Z) (g : Y Z) (w : (fun {X} h => h f) = fun {X} h => h g) :
f = g
theorem CategoryTheory.id_of_comp_left_id {C : Type u} [inst : ] {X : C} (f : X X) (w : ∀ {Y : C} (g : X Y), f g = g) :
f = 𝟙 X
theorem CategoryTheory.id_of_comp_right_id {C : Type u} [inst : ] {X : C} (f : X X) (w : ∀ {Y : C} (g : Y X), g f = g) :
f = 𝟙 X
theorem CategoryTheory.comp_ite {C : Type u} [inst : ] {P : Prop} [inst : ] {X : C} {Y : C} {Z : C} (f : X Y) (g : Y Z) (g' : Y Z) :
(f if P then g else g') = if P then f g else f g'
theorem CategoryTheory.ite_comp {C : Type u} [inst : ] {P : Prop} [inst : ] {X : C} {Y : C} {Z : C} (f : X Y) (f' : X Y) (g : Y Z) :
(if P then f else f') g = if P then f g else f' g
theorem CategoryTheory.comp_dite {C : Type u} [inst : ] {P : Prop} [inst : ] {X : C} {Y : C} {Z : C} (f : X Y) (g : P → (Y Z)) (g' : ¬P → (Y Z)) :
(f if h : P then g h else g' h) = if h : P then f g h else f g' h
theorem CategoryTheory.dite_comp {C : Type u} [inst : ] {P : Prop} [inst : ] {X : C} {Y : C} {Z : C} (f : P → (X Y)) (f' : ¬P → (X Y)) (g : Y Z) :
(if h : P then f h else f' h) g = if h : P then f h g else f' h g
class CategoryTheory.Epi {C : Type u} [inst : ] {X : C} {Y : C} (f : X Y) :
• A morphism f is an epimorphism if it can be cancelled when precomposed.

left_cancellation : ∀ {Z : C} (g h : Y Z), f g = f hg = h

A morphism f is an epimorphism if it can be cancelled when precomposed: f ≫ g = f ≫ h≫ g = f ≫ h≫ h implies g = h.

Instances
class CategoryTheory.Mono {C : Type u} [inst : ] {X : C} {Y : C} (f : X Y) :
• A morphism f is an monomorphism if it can be cancelled when postcomposed.

right_cancellation : ∀ {Z : C} (g h : Z X), g f = h fg = h

A morphism f is a monomorphism if it can be cancelled when postcomposed: g ≫ f = h ≫ f≫ f = h ≫ f≫ f implies g = h`.

Instances
instance CategoryTheory.instEpiIdToCategoryStruct {C : Type u} [inst : ] (X : C) :
Equations
instance CategoryTheory.instMonoIdToCategoryStruct {C : Type u} [inst : ] (X : C) :
Equations
theorem CategoryTheory.cancel_epi {C : Type u} [inst : ] {X : C} {Y : C} {Z : C} (f : X Y) [inst : ] {g : Y Z} {h : Y Z} :
f g = f h g = h
theorem CategoryTheory.cancel_mono {C : Type u} [inst : ] {X : C} {Y : C} {Z : C} (f : X Y) [inst : ] {g : Z X} {h : Z X} :
g f = h f g = h
theorem CategoryTheory.cancel_epi_id {C : Type u} [inst : ] {X : C} {Y : C} (f : X Y) [inst : ] {h : Y Y} :
f h = f h = 𝟙 Y
theorem CategoryTheory.cancel_mono_id {C : Type u} [inst : ] {X : C} {Y : C} (f : X Y) [inst : ] {g : X X} :
g f = f g = 𝟙 X
theorem CategoryTheory.epi_comp {C : Type u} [inst : ] {X : C} {Y : C} {Z : C} (f : X Y) [inst : ] (g : Y Z) [inst : ] :
theorem CategoryTheory.mono_comp {C : Type u} [inst : ] {X : C} {Y : C} {Z : C} (f : X Y) [inst : ] (g : Y Z) [inst : ] :
theorem CategoryTheory.mono_of_mono {C : Type u} [inst : ] {X : C} {Y : C} {Z : C} (f : X Y) (g : Y Z) [inst : CategoryTheory.Mono (f g)] :
theorem CategoryTheory.mono_of_mono_fac {C : Type u} [inst : ] {X : C} {Y : C} {Z : C} {f : X Y} {g : Y Z} {h : X Z} [inst : ] (w : f g = h) :
theorem CategoryTheory.epi_of_epi {C : Type u} [inst : ] {X : C} {Y : C} {Z : C} (f : X Y) (g : Y Z) [inst : CategoryTheory.Epi (f g)] :
theorem CategoryTheory.epi_of_epi_fac {C : Type u} [inst : ] {X : C} {Y : C} {Z : C} {f : X Y} {g : Y Z} {h : X Z} [inst : ] (w : f g = h) :
instance CategoryTheory.uliftCategory (C : Type u) [inst : ] :
Equations
• = CategoryTheory.Category.mk