mathlib documentation


Concrete categories #

A concrete category is a category C with a fixed faithful functor forget : C ⥤ Type*. We define concrete categories using class concrete_category. In particular, we impose no restrictions on the carrier type C, so Type is a concrete category with the identity forgetful functor.

Each concrete category C comes with a canonical faithful functor forget C : C ⥤ Type*. We say that a concrete category C admits a forgetful functor to a concrete category D, if it has a functor forget₂ C D : C ⥤ D such that (forget₂ C D) ⋙ (forget D) = forget C, see class has_forget₂. Due to faithful.div_comp, it suffices to verify that forget₂.obj and forget₂.map agree with the equality above; then forget₂ will satisfy the functor laws automatically, see has_forget₂.mk'.

Two classes helping construct concrete categories in the two most common cases are provided in the files bundled_hom and unbundled_hom, see their documentation for details.

References #

See Ahrens and Lumsdaine, Displayed Categories for related work.

structure category_theory.concrete_category (C : Type u) [category_theory.category C] :
Type (max u v (w+1))

A concrete category is a category C with a fixed faithful functor forget : C ⥤ Type.

Note that concrete_category potentially depends on three independent universe levels,

  • the universe level w appearing in forget : C ⥤ Type w
  • the universe level v of the morphisms (i.e. we have a category.{v} C)
  • the universe level u of the objects (i.e C : Type u) They are specified that order, to avoid unnecessary universe annotations.
Instances of this typeclass
Instances of other typeclasses for category_theory.concrete_category
  • category_theory.concrete_category.has_sizeof_inst

The forgetful functor from a concrete category to Type u.


Provide a coercion to Type u for a concrete category. This is not marked as an instance as it could potentially apply to every type, and so is too expensive in typeclass search.

You can use it on particular examples as:

instance : has_coe_to_sort X := concrete_category.has_coe_to_sort X

Usually a bundled hom structure already has a coercion to function that works with different universes. So we don't use this as a global instance.

theorem category_theory.concrete_category.hom_ext {C : Type v} [category_theory.category C] [category_theory.concrete_category C] {X Y : C} (f g : X Y) (w : ∀ (x : X), f x = g x) :
f = g

In any concrete category, we can test equality of morphisms by pointwise evaluations.

theorem category_theory.congr_hom {C : Type v} [category_theory.category C] [category_theory.concrete_category C] {X Y : C} {f g : X Y} (h : f = g) (x : X) :
f x = g x

Analogue of congr_fun h x, when h : f = g is an equality between morphisms in a concrete category.

theorem category_theory.coe_comp {C : Type v} [category_theory.category C] [category_theory.concrete_category C] {X Y Z : C} (f : X Y) (g : Y Z) :
(f g) = g f
theorem category_theory.id_apply {C : Type v} [category_theory.category C] [category_theory.concrete_category C] {X : C} (x : X) :
(𝟙 X) x = x
theorem category_theory.comp_apply {C : Type v} [category_theory.category C] [category_theory.concrete_category C] {X Y Z : C} (f : X Y) (g : Y Z) (x : X) :
(f g) x = g (f x)
theorem category_theory.concrete_category.congr_hom {C : Type v} [category_theory.category C] [category_theory.concrete_category C] {X Y : C} {f g : X Y} (h : f = g) (x : X) :
f x = g x
theorem category_theory.concrete_category.congr_arg {C : Type v} [category_theory.category C] [category_theory.concrete_category C] {X Y : C} (f : X Y) {x x' : X} (h : x = x') :
f x = f x'

In any concrete category, injective morphisms are monomorphisms.

In any concrete category, surjective morphisms are epimorphisms.

theorem category_theory.concrete_category.has_coe_to_fun_Type {X Y : Type u} (f : X Y) :
f = f

has_forget₂ C D, where C and D are both concrete categories, provides a functor forget₂ C D : C ⥤ D and a proof that forget₂ ⋙ (forget D) = forget C.

Instances of this typeclass
Instances of other typeclasses for category_theory.has_forget₂
  • category_theory.has_forget₂.has_sizeof_inst

The forgetful functor C ⥤ D between concrete categories for which we have an instance has_forget₂ C.

def category_theory.has_forget₂.mk' {C : Type v} {D : Type v'} [category_theory.category C] [category_theory.concrete_category C] [category_theory.category D] [category_theory.concrete_category D] (obj : C → D) (h_obj : ∀ (X : C), (category_theory.forget D).obj (obj X) = (category_theory.forget C).obj X) (map : Π {X Y : C}, (X Y)(obj X obj Y)) (h_map : ∀ {X Y : C} {f : X Y}, (category_theory.forget D).map (map f) == (category_theory.forget C).map f) :

In order to construct a “partially forgetting” functor, we do not need to verify functor laws; it suffices to ensure that compositions agree with forget₂ C D ⋙ forget D = forget C.


Every forgetful functor factors through the identity functor. This is not a global instance as it is prone to creating type class resolution loops.