# Documentation

Mathlib.CategoryTheory.Filtered.Basic

# Filtered categories #

A category is filtered if every finite diagram admits a cocone. We give a simple characterisation of this condition as

1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions are equal, and
3. there exists some object.

Filtered colimits are often better behaved than arbitrary colimits. See CategoryTheory/Limits/Types for some details.

Filtered categories are nice because colimits indexed by filtered categories tend to be easier to describe than general colimits (and more often preserved by functors).

In this file we show that any functor from a finite category to a filtered category admits a cocone:

• cocone_nonempty [FinCategory J] [IsFiltered C] (F : J ⥤ C) : Nonempty (Cocone F) More generally, for any finite collection of objects and morphisms between them in a filtered category (even if not closed under composition) there exists some object Z receiving maps from all of them, so that all the triangles (one edge from the finite set, two from morphisms to Z) commute. This formulation is often more useful in practice and is available via sup_exists, which takes a finset of objects, and an indexed family (indexed by source and target) of finsets of morphisms.

Furthermore, we give special support for two diagram categories: The bowtie and the tulip. This is because these shapes show up in the proofs that forgetful functors of algebraic categories (e.g. MonCat, CommRingCat, ...) preserve filtered colimits.

All of the above API, except for the bowtie and the tulip, is also provided for cofiltered categories.

In CategoryTheory.Limits.FilteredColimitCommutesFiniteLimit we show that filtered colimits commute with finite limits.

• cocone_objs : ∀ (X Y : C), Z x x, True

for every pair of objects there exists another object "to the right"

• cocone_maps : ∀ ⦃X Y : C⦄ (f g : X Y),

for every pair of parallel morphisms there exists a morphism to the right so the compositions are equal

A category IsFilteredOrEmpty if

1. for every pair of objects there exists another object "to the right", and
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions are equal.
Instances
class CategoryTheory.IsFiltered (C : Type u) extends :
• cocone_objs : ∀ (X Y : C), Z x x, True
• cocone_maps : ∀ ⦃X Y : C⦄ (f g : X Y),
• Nonempty :

a filtered category must be non empty

A category IsFiltered if

1. for every pair of objects there exists another object "to the right",
2. for every pair of parallel morphisms there exists a morphism to the right so the compositions are equal, and
3. there exists some object.

See https://stacks.math.columbia.edu/tag/002V. (They also define a diagram being filtered.)

Instances
instance CategoryTheory.isFilteredOrEmpty_of_directed_le (α : Type u) [] [IsDirected α fun x x_1 => x x_1] :
instance CategoryTheory.isFiltered_of_directed_le_nonempty (α : Type u) [] [IsDirected α fun x x_1 => x x_1] [] :
noncomputable def CategoryTheory.IsFiltered.max {C : Type u} (j : C) (j' : C) :
C

max j j' is an arbitrary choice of object to the right of both j and j', whose existence is ensured by IsFiltered.

Instances For
noncomputable def CategoryTheory.IsFiltered.leftToMax {C : Type u} (j : C) (j' : C) :

leftToMax j j' is an arbitrary choice of morphism from j to max j j', whose existence is ensured by IsFiltered.

Instances For
noncomputable def CategoryTheory.IsFiltered.rightToMax {C : Type u} (j : C) (j' : C) :

rightToMax j j' is an arbitrary choice of morphism from j' to max j j', whose existence is ensured by IsFiltered.

Instances For
noncomputable def CategoryTheory.IsFiltered.coeq {C : Type u} {j : C} {j' : C} (f : j j') (f' : j j') :
C

coeq f f', for morphisms f f' : j ⟶ j', is an arbitrary choice of object which admits a morphism coeqHom f f' : j' ⟶ coeq f f' such that coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'. Its existence is ensured by IsFiltered.

Instances For
noncomputable def CategoryTheory.IsFiltered.coeqHom {C : Type u} {j : C} {j' : C} (f : j j') (f' : j j') :

coeqHom f f', for morphisms f f' : j ⟶ j', is an arbitrary choice of morphism coeqHom f f' : j' ⟶ coeq f f' such that coeq_condition : f ≫ coeqHom f f' = f' ≫ coeqHom f f'. Its existence is ensured by IsFiltered.

Instances For
theorem CategoryTheory.IsFiltered.coeq_condition_assoc {C : Type u} {j : C} {j' : C} (f : j j') (f' : j j') {Z : C} (h : ) :
theorem CategoryTheory.IsFiltered.coeq_condition {C : Type u} {j : C} {j' : C} (f : j j') (f' : j j') :

coeq_condition f f', for morphisms f f' : j ⟶ j', is the proof that f ≫ coeqHom f f' = f' ≫ coeqHom f f'.

theorem CategoryTheory.IsFilteredOrEmpty.of_right_adjoint {C : Type u} {D : Type u₁} [] {L : } {R : } (h : L R) :

If C is filtered or emtpy, and we have a functor R : C ⥤ D with a left adjoint, then D is filtered or empty.

theorem CategoryTheory.IsFilteredOrEmpty.of_isRightAdjoint {C : Type u} {D : Type u₁} [] (R : ) :

If C is filtered or empty, and we have a right adjoint functor R : C ⥤ D, then D is filtered or empty.

theorem CategoryTheory.IsFilteredOrEmpty.of_equivalence {C : Type u} {D : Type u₁} [] (h : C D) :

Being filtered or empty is preserved by equivalence of categories.

theorem CategoryTheory.IsFiltered.sup_objs_exists {C : Type u} (O : ) :
S, ∀ {X : C}, X ONonempty (X S)

Any finite collection of objects in a filtered category has an object "to the right".

theorem CategoryTheory.IsFiltered.sup_exists {C : Type u} (O : ) (H : Finset ((X : C) ×' (Y : C) ×' (_ : X O) ×' (_ : Y O) ×' (X Y))) :
S T, ∀ {X Y : C} (mX : X O) (mY : Y O) {f : X Y}, { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } HCategoryTheory.CategoryStruct.comp f (T Y mY) = T X mX

Given any Finset of objects {X, ...} and indexed collection of Finsets of morphisms {f, ...} in C, there exists an object S, with a morphism T X : X ⟶ S from each X, such that the triangles commute: f ≫ T Y = T X, for f : X ⟶ Y in the Finset.

noncomputable def CategoryTheory.IsFiltered.sup {C : Type u} (O : ) (H : Finset ((X : C) ×' (Y : C) ×' (_ : X O) ×' (_ : Y O) ×' (X Y))) :
C

An arbitrary choice of object "to the right" of a finite collection of objects O and morphisms H, making all the triangles commute.

Instances For
noncomputable def CategoryTheory.IsFiltered.toSup {C : Type u} (O : ) (H : Finset ((X : C) ×' (Y : C) ×' (_ : X O) ×' (_ : Y O) ×' (X Y))) {X : C} (m : X O) :

The morphisms to sup O H.

Instances For
theorem CategoryTheory.IsFiltered.toSup_commutes {C : Type u} (O : ) (H : Finset ((X : C) ×' (Y : C) ×' (_ : X O) ×' (_ : Y O) ×' (X Y))) {X : C} {Y : C} (mX : X O) (mY : Y O) {f : X Y} (mf : { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } H) :

The triangles of consisting of a morphism in H and the maps to sup O H commute.

theorem CategoryTheory.IsFiltered.cocone_nonempty {C : Type u} {J : Type v} (F : ) :

If we have IsFiltered C, then for any functor F : J ⥤ C with FinCategory J, there exists a cocone over F.

noncomputable def CategoryTheory.IsFiltered.cocone {C : Type u} {J : Type v} (F : ) :

An arbitrary choice of cocone over F : J ⥤ C, for FinCategory J and IsFiltered C.

Instances For
theorem CategoryTheory.IsFiltered.of_right_adjoint {C : Type u} {D : Type u₁} [] {L : } {R : } (h : L R) :

If C is filtered, and we have a functor R : C ⥤ D with a left adjoint, then D is filtered.

theorem CategoryTheory.IsFiltered.of_isRightAdjoint {C : Type u} {D : Type u₁} [] (R : ) :

If C is filtered, and we have a right adjoint functor R : C ⥤ D, then D is filtered.

theorem CategoryTheory.IsFiltered.of_equivalence {C : Type u} {D : Type u₁} [] (h : C D) :

Being filtered is preserved by equivalence of categories.

noncomputable def CategoryTheory.IsFiltered.max₃ {C : Type u} (j₁ : C) (j₂ : C) (j₃ : C) :
C

max₃ j₁ j₂ j₃ is an arbitrary choice of object to the right of j₁, j₂ and j₃, whose existence is ensured by IsFiltered.

Instances For
noncomputable def CategoryTheory.IsFiltered.firstToMax₃ {C : Type u} (j₁ : C) (j₂ : C) (j₃ : C) :
j₁

firstToMax₃ j₁ j₂ j₃ is an arbitrary choice of morphism from j₁ to max₃ j₁ j₂ j₃, whose existence is ensured by IsFiltered.

Instances For
noncomputable def CategoryTheory.IsFiltered.secondToMax₃ {C : Type u} (j₁ : C) (j₂ : C) (j₃ : C) :
j₂

secondToMax₃ j₁ j₂ j₃ is an arbitrary choice of morphism from j₂ to max₃ j₁ j₂ j₃, whose existence is ensured by IsFiltered.

Instances For
noncomputable def CategoryTheory.IsFiltered.thirdToMax₃ {C : Type u} (j₁ : C) (j₂ : C) (j₃ : C) :
j₃

thirdToMax₃ j₁ j₂ j₃ is an arbitrary choice of morphism from j₃ to max₃ j₁ j₂ j₃, whose existence is ensured by IsFiltered.

Instances For
noncomputable def CategoryTheory.IsFiltered.coeq₃ {C : Type u} {j₁ : C} {j₂ : C} (f : j₁ j₂) (g : j₁ j₂) (h : j₁ j₂) :
C

coeq₃ f g h, for morphisms f g h : j₁ ⟶ j₂, is an arbitrary choice of object which admits a morphism coeq₃Hom f g h : j₂ ⟶ coeq₃ f g h such that coeq₃_condition₁, coeq₃_condition₂ and coeq₃_condition₃ are satisfied. Its existence is ensured by IsFiltered.

Instances For
noncomputable def CategoryTheory.IsFiltered.coeq₃Hom {C : Type u} {j₁ : C} {j₂ : C} (f : j₁ j₂) (g : j₁ j₂) (h : j₁ j₂) :
j₂

coeq₃Hom f g h, for morphisms f g h : j₁ ⟶ j₂, is an arbitrary choice of morphism j₂ ⟶ coeq₃ f g h such that coeq₃_condition₁, coeq₃_condition₂ and coeq₃_condition₃ are satisfied. Its existence is ensured by IsFiltered.

Instances For
theorem CategoryTheory.IsFiltered.coeq₃_condition₁ {C : Type u} {j₁ : C} {j₂ : C} (f : j₁ j₂) (g : j₁ j₂) (h : j₁ j₂) :
theorem CategoryTheory.IsFiltered.coeq₃_condition₂ {C : Type u} {j₁ : C} {j₂ : C} (f : j₁ j₂) (g : j₁ j₂) (h : j₁ j₂) :
theorem CategoryTheory.IsFiltered.coeq₃_condition₃ {C : Type u} {j₁ : C} {j₂ : C} (f : j₁ j₂) (g : j₁ j₂) (h : j₁ j₂) :
theorem CategoryTheory.IsFiltered.span {C : Type u} {i : C} {j : C} {j' : C} (f : i j) (f' : i j') :
k g g',

For every span j ⟵ i ⟶ j', there exists a cocone j ⟶ k ⟵ j' such that the square commutes.

theorem CategoryTheory.IsFiltered.bowtie {C : Type u} {j₁ : C} {j₂ : C} {k₁ : C} {k₂ : C} (f₁ : j₁ k₁) (g₁ : j₁ k₂) (f₂ : j₂ k₁) (g₂ : j₂ k₂) :
s α β,

Given a "bowtie" of morphisms

 j₁   j₂
|\  /|
| \/ |
| /\ |
|/  \∣
vv  vv
k₁  k₂


in a filtered category, we can construct an object s and two morphisms from k₁ and k₂ to s, making the resulting squares commute.

theorem CategoryTheory.IsFiltered.tulip {C : Type u} {j₁ : C} {j₂ : C} {j₃ : C} {k₁ : C} {k₂ : C} {l : C} (f₁ : j₁ k₁) (f₂ : j₂ k₁) (f₃ : j₂ k₂) (f₄ : j₃ k₂) (g₁ : j₁ l) (g₂ : j₃ l) :
s α β γ,

Given a "tulip" of morphisms

 j₁    j₂    j₃
|\   / \   / |
| \ /   \ /  |
|  vv    vv  |
\  k₁    k₂ /
\         /
\       /
\     /
\   /
v v
l


in a filtered category, we can construct an object s and three morphisms from k₁, k₂ and l to s, making the resulting squares commute.

• cone_objs : ∀ (X Y : C), W x x, True

for every pair of objects there exists another object "to the left"

• cone_maps : ∀ ⦃X Y : C⦄ (f g : X Y),

for every pair of parallel morphisms there exists a morphism to the left so the compositions are equal

A category IsCofilteredOrEmpty if

1. for every pair of objects there exists another object "to the left", and
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions are equal.
Instances
class CategoryTheory.IsCofiltered (C : Type u) extends :
• cone_objs : ∀ (X Y : C), W x x, True
• cone_maps : ∀ ⦃X Y : C⦄ (f g : X Y),
• Nonempty :

a cofiltered category must be non empty

A category IsCofiltered if

1. for every pair of objects there exists another object "to the left",
2. for every pair of parallel morphisms there exists a morphism to the left so the compositions are equal, and
3. there exists some object.
Instances
instance CategoryTheory.isCofilteredOrEmpty_of_directed_ge (α : Type u) [] [IsDirected α fun x x_1 => x x_1] :
instance CategoryTheory.isCofiltered_of_directed_ge_nonempty (α : Type u) [] [IsDirected α fun x x_1 => x x_1] [] :
noncomputable def CategoryTheory.IsCofiltered.min {C : Type u} (j : C) (j' : C) :
C

min j j' is an arbitrary choice of object to the left of both j and j', whose existence is ensured by IsCofiltered.

Instances For
noncomputable def CategoryTheory.IsCofiltered.minToLeft {C : Type u} (j : C) (j' : C) :

minToLeft j j' is an arbitrary choice of morphism from min j j' to j, whose existence is ensured by IsCofiltered.

Instances For
noncomputable def CategoryTheory.IsCofiltered.minToRight {C : Type u} (j : C) (j' : C) :

minToRight j j' is an arbitrary choice of morphism from min j j' to j', whose existence is ensured by IsCofiltered.

Instances For
noncomputable def CategoryTheory.IsCofiltered.eq {C : Type u} {j : C} {j' : C} (f : j j') (f' : j j') :
C

eq f f', for morphisms f f' : j ⟶ j', is an arbitrary choice of object which admits a morphism eqHom f f' : eq f f' ⟶ j such that eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'. Its existence is ensured by IsCofiltered.

Instances For
noncomputable def CategoryTheory.IsCofiltered.eqHom {C : Type u} {j : C} {j' : C} (f : j j') (f' : j j') :

eqHom f f', for morphisms f f' : j ⟶ j', is an arbitrary choice of morphism eqHom f f' : eq f f' ⟶ j such that eq_condition : eqHom f f' ≫ f = eqHom f f' ≫ f'. Its existence is ensured by IsCofiltered.

Instances For
theorem CategoryTheory.IsCofiltered.eq_condition_assoc {C : Type u} {j : C} {j' : C} (f : j j') (f' : j j') {Z : C} (h : j' Z) :
theorem CategoryTheory.IsCofiltered.eq_condition {C : Type u} {j : C} {j' : C} (f : j j') (f' : j j') :

eq_condition f f', for morphisms f f' : j ⟶ j', is the proof that eqHom f f' ≫ f = eqHom f f' ≫ f'.

theorem CategoryTheory.IsCofiltered.cospan {C : Type u} {i : C} {j : C} {j' : C} (f : j i) (f' : j' i) :
k g g',

For every cospan j ⟶ i ⟵ j', there exists a cone j ⟵ k ⟶ j' such that the square commutes.

theorem CategoryTheory.Functor.ranges_directed {C : Type u} (F : ) (j : C) :
Directed (fun x x_1 => x x_1) fun f => Set.range (F.map f.snd)
theorem CategoryTheory.IsCofilteredOrEmpty.of_left_adjoint {C : Type u} {D : Type u₁} [] {L : } {R : } (h : L R) :

If C is cofiltered or empty, and we have a functor L : C ⥤ D with a right adjoint, then D is cofiltered or empty.

theorem CategoryTheory.IsCofilteredOrEmpty.of_isLeftAdjoint {C : Type u} {D : Type u₁} [] (L : ) :

If C is cofiltered or empty, and we have a left adjoint functor L : C ⥤ D, then D is cofiltered or empty.

theorem CategoryTheory.IsCofilteredOrEmpty.of_equivalence {C : Type u} {D : Type u₁} [] (h : C D) :

Being cofiltered or empty is preserved by equivalence of categories.

theorem CategoryTheory.IsCofiltered.inf_objs_exists {C : Type u} (O : ) :
S, ∀ {X : C}, X ONonempty (S X)

Any finite collection of objects in a cofiltered category has an object "to the left".

theorem CategoryTheory.IsCofiltered.inf_exists {C : Type u} (O : ) (H : Finset ((X : C) ×' (Y : C) ×' (_ : X O) ×' (_ : Y O) ×' (X Y))) :
S T, ∀ {X Y : C} (mX : X O) (mY : Y O) {f : X Y}, { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } HCategoryTheory.CategoryStruct.comp (T X mX) f = T Y mY

Given any Finset of objects {X, ...} and indexed collection of Finsets of morphisms {f, ...} in C, there exists an object S, with a morphism T X : S ⟶ X from each X, such that the triangles commute: T X ≫ f = T Y, for f : X ⟶ Y in the Finset.

noncomputable def CategoryTheory.IsCofiltered.inf {C : Type u} (O : ) (H : Finset ((X : C) ×' (Y : C) ×' (_ : X O) ×' (_ : Y O) ×' (X Y))) :
C

An arbitrary choice of object "to the left" of a finite collection of objects O and morphisms H, making all the triangles commute.

Instances For
noncomputable def CategoryTheory.IsCofiltered.infTo {C : Type u} (O : ) (H : Finset ((X : C) ×' (Y : C) ×' (_ : X O) ×' (_ : Y O) ×' (X Y))) {X : C} (m : X O) :

The morphisms from inf O H.

Instances For
theorem CategoryTheory.IsCofiltered.infTo_commutes {C : Type u} (O : ) (H : Finset ((X : C) ×' (Y : C) ×' (_ : X O) ×' (_ : Y O) ×' (X Y))) {X : C} {Y : C} (mX : X O) (mY : Y O) {f : X Y} (mf : { fst := X, snd := { fst := Y, snd := { fst := mX, snd := { fst := mY, snd := f } } } } H) :

The triangles consisting of a morphism in H and the maps from inf O H commute.

theorem CategoryTheory.IsCofiltered.cone_nonempty {C : Type u} {J : Type w} (F : ) :

If we have IsCofiltered C, then for any functor F : J ⥤ C with FinCategory J, there exists a cone over F.

noncomputable def CategoryTheory.IsCofiltered.cone {C : Type u} {J : Type w} (F : ) :

An arbitrary choice of cone over F : J ⥤ C, for FinCategory J and IsCofiltered C.

Instances For
theorem CategoryTheory.IsCofiltered.of_left_adjoint {C : Type u} {D : Type u₁} [] {L : } {R : } (h : L R) :

If C is cofiltered, and we have a functor L : C ⥤ D with a right adjoint, then D is cofiltered.

theorem CategoryTheory.IsCofiltered.of_isLeftAdjoint {C : Type u} {D : Type u₁} [] (L : ) :

If C is cofiltered, and we have a left adjoint functor L : C ⥤ D, then D is cofiltered.

theorem CategoryTheory.IsCofiltered.of_equivalence {C : Type u} {D : Type u₁} [] (h : C D) :

Being cofiltered is preserved by equivalence of categories.

If Cᵒᵖ is filtered or empty, then C is cofiltered or empty.

If Cᵒᵖ is cofiltered or empty, then C is filtered or empty.

If Cᵒᵖ is filtered, then C is cofiltered.

If Cᵒᵖ is cofiltered, then C is filtered.