# Documentation

Mathlib.CategoryTheory.DiscreteCategory

# Discrete categories #

We define Discrete α as a structure containing a term a : α for any type α, and use this type alias to provide a SmallCategory instance whose only morphisms are the identities.

There is an annoying technical difficulty that it has turned out to be inconvenient to allow categories with morphisms living in Prop, so instead of defining X ⟶ Y in Discrete α as X = Y, one might define it as PLift (X = Y). In fact, to allow Discrete α to be a SmallCategory (i.e. with morphisms in the same universe as the objects), we actually define the hom type X ⟶ Y as ULift (PLift (X = Y)).

Discrete.functor promotes a function f : I → C (for any category C) to a functor Discrete.functor f : Discrete I ⥤ C.

Similarly, Discrete.natTrans and Discrete.natIso promote I-indexed families of morphisms, or I-indexed families of isomorphisms to natural transformations or natural isomorphism.

We show equivalences of types are the same as (categorical) equivalences of the corresponding discrete categories.

theorem CategoryTheory.Discrete.ext_iff {α : Type u₁} (x : ) (y : ) :
x = y x.as = y.as
theorem CategoryTheory.Discrete.ext {α : Type u₁} (x : ) (y : ) (as : x.as = y.as) :
x = y
structure CategoryTheory.Discrete (α : Type u₁) :
Type u₁
• as : α

A wrapper for promoting any type to a category, with the only morphisms being equalities.

A wrapper for promoting any type to a category, with the only morphisms being equalities.

Instances For
@[simp]
theorem CategoryTheory.Discrete.mk_as {α : Type u₁} (X : ) :
{ as := X.as } = X
@[simp]
theorem CategoryTheory.discreteEquiv_apply {α : Type u₁} (self : ) :
CategoryTheory.discreteEquiv self = self.as
@[simp]
theorem CategoryTheory.discreteEquiv_symm_apply_as {α : Type u₁} (as : α) :
(CategoryTheory.discreteEquiv.symm as).as = as

Discrete α is equivalent to the original type α.

Instances For
instance CategoryTheory.discreteCategory (α : Type u₁) :

The "Discrete" category on a type, whose morphisms are equalities.

Because we do not allow morphisms in Prop (only in Type), somewhat annoyingly we have to define X ⟶ Y as ULift (PLift (X = Y)).

A simple tactic to run cases on any Discrete α hypotheses.

Instances For

Use:

attribute [local aesop safe tactic (rule_sets [CategoryTheory])]
CategoryTheory.Discrete.discreteCases


to locally gives aesop_cat the ability to call cases on Discrete and (_ : Discrete _) ⟶ (_ : Discrete _) hypotheses.

Instances For
theorem CategoryTheory.Discrete.eq_of_hom {α : Type u₁} {X : } {Y : } (i : X Y) :
X.as = Y.as

Extract the equation from a morphism in a discrete category.

@[inline, reducible]
abbrev CategoryTheory.Discrete.eqToHom {α : Type u₁} {X : } {Y : } (h : X.as = Y.as) :
X Y

Promote an equation between the wrapped terms in X Y : Discrete α to a morphism X ⟶ Y in the discrete category.

Instances For
@[inline, reducible]
abbrev CategoryTheory.Discrete.eqToIso {α : Type u₁} {X : } {Y : } (h : X.as = Y.as) :
X Y

Promote an equation between the wrapped terms in X Y : Discrete α to an isomorphism X ≅ Y in the discrete category.

Instances For
@[inline, reducible]
abbrev CategoryTheory.Discrete.eqToHom' {α : Type u₁} {a : α} {b : α} (h : a = b) :
{ as := a } { as := b }

A variant of eqToHom that lifts terms to the discrete category.

Instances For
@[inline, reducible]
abbrev CategoryTheory.Discrete.eqToIso' {α : Type u₁} {a : α} {b : α} (h : a = b) :
{ as := a } { as := b }

A variant of eqToIso that lifts terms to the discrete category.

Instances For
@[simp]
theorem CategoryTheory.Discrete.id_def {α : Type u₁} (X : ) :
{ down := { down := (_ : X.as = X.as) } } =
instance CategoryTheory.Discrete.instIsIsoDiscreteDiscreteCategory {I : Type u₁} {i : } {j : } (f : i j) :
def CategoryTheory.Discrete.functor {C : Type u₂} [] {I : Type u₁} (F : IC) :

Any function I → C gives a functor Discrete I ⥤ C.

Instances For
@[simp]
theorem CategoryTheory.Discrete.functor_obj {C : Type u₂} [] {I : Type u₁} (F : IC) (i : I) :
().obj { as := i } = F i
theorem CategoryTheory.Discrete.functor_map {C : Type u₂} [] {I : Type u₁} (F : IC) {i : } (f : i i) :
@[simp]
theorem CategoryTheory.Discrete.functorComp_hom_app {C : Type u₂} [] {I : Type u₁} {J : Type u₁'} (f : JC) (g : IJ) (X : ) :
().hom.app X = CategoryTheory.CategoryStruct.id (().obj X)
@[simp]
theorem CategoryTheory.Discrete.functorComp_inv_app {C : Type u₂} [] {I : Type u₁} {J : Type u₁'} (f : JC) (g : IJ) (X : ) :
().inv.app X = CategoryTheory.CategoryStruct.id (().obj X)
def CategoryTheory.Discrete.functorComp {C : Type u₂} [] {I : Type u₁} {J : Type u₁'} (f : JC) (g : IJ) :

The discrete functor induced by a composition of maps can be written as a composition of two discrete functors.

Instances For
@[simp]
theorem CategoryTheory.Discrete.natTrans_app {C : Type u₂} [] {I : Type u₁} {F : } {G : } (f : (i : ) → F.obj i G.obj i) (i : ) :
().app i = f i
def CategoryTheory.Discrete.natTrans {C : Type u₂} [] {I : Type u₁} {F : } {G : } (f : (i : ) → F.obj i G.obj i) :
F G

For functors out of a discrete category, a natural transformation is just a collection of maps, as the naturality squares are trivial.

Instances For
@[simp]
theorem CategoryTheory.Discrete.natIso_inv_app {C : Type u₂} [] {I : Type u₁} {F : } {G : } (f : (i : ) → F.obj i G.obj i) (X : ) :
().inv.app X = (f X).inv
@[simp]
theorem CategoryTheory.Discrete.natIso_hom_app {C : Type u₂} [] {I : Type u₁} {F : } {G : } (f : (i : ) → F.obj i G.obj i) (X : ) :
().hom.app X = (f X).hom
def CategoryTheory.Discrete.natIso {C : Type u₂} [] {I : Type u₁} {F : } {G : } (f : (i : ) → F.obj i G.obj i) :
F G

For functors out of a discrete category, a natural isomorphism is just a collection of isomorphisms, as the naturality squares are trivial.

Instances For
@[simp]
theorem CategoryTheory.Discrete.natIso_app {C : Type u₂} [] {I : Type u₁} {F : } {G : } (f : (i : ) → F.obj i G.obj i) (i : ) :
().app i = f i
def CategoryTheory.Discrete.natIsoFunctor {C : Type u₂} [] {I : Type u₁} {F : } :
F CategoryTheory.Discrete.functor (F.obj CategoryTheory.Discrete.mk)

Every functor F from a discrete category is naturally isomorphic (actually, equal) to discrete.functor (F.obj).

Instances For
def CategoryTheory.Discrete.compNatIsoDiscrete {C : Type u₂} [] {I : Type u₁} {D : Type u₃} [] (F : IC) (G : ) :

Composing discrete.functor F with another functor G amounts to composing F with G.obj

Instances For
@[simp]
theorem CategoryTheory.Discrete.equivalence_inverse {I : Type u₁} {J : Type u₂} (e : I J) :
().inverse = CategoryTheory.Discrete.functor (CategoryTheory.Discrete.mk e.symm)
@[simp]
theorem CategoryTheory.Discrete.equivalence_functor {I : Type u₁} {J : Type u₂} (e : I J) :
().functor = CategoryTheory.Discrete.functor (CategoryTheory.Discrete.mk e)
@[simp]
theorem CategoryTheory.Discrete.equivalence_unitIso {I : Type u₁} {J : Type u₂} (e : I J) :
().unitIso = CategoryTheory.Discrete.natIso fun i => CategoryTheory.eqToIso (_ : ().obj i = (CategoryTheory.Functor.comp (CategoryTheory.Discrete.functor (CategoryTheory.Discrete.mk e)) (CategoryTheory.Discrete.functor (CategoryTheory.Discrete.mk e.symm))).obj i)
@[simp]
theorem CategoryTheory.Discrete.equivalence_counitIso {I : Type u₁} {J : Type u₂} (e : I J) :
().counitIso = CategoryTheory.Discrete.natIso fun j => CategoryTheory.eqToIso (_ : (CategoryTheory.Functor.comp (CategoryTheory.Discrete.functor (CategoryTheory.Discrete.mk e.symm)) (CategoryTheory.Discrete.functor (CategoryTheory.Discrete.mk e))).obj j = ().obj j)
def CategoryTheory.Discrete.equivalence {I : Type u₁} {J : Type u₂} (e : I J) :

We can promote a type-level Equiv to an equivalence between the corresponding discrete categories.

Instances For
@[simp]
theorem CategoryTheory.Discrete.equivOfEquivalence_apply {α : Type u₁} {β : Type u₂} :
∀ (a : α), = (CategoryTheory.Discrete.as h.functor.obj CategoryTheory.Discrete.mk) a
@[simp]
theorem CategoryTheory.Discrete.equivOfEquivalence_symm_apply {α : Type u₁} {β : Type u₂} :
∀ (a : β), a = (CategoryTheory.Discrete.as h.inverse.obj CategoryTheory.Discrete.mk) a
def CategoryTheory.Discrete.equivOfEquivalence {α : Type u₁} {β : Type u₂} :
α β

We can convert an equivalence of discrete categories to a type-level Equiv.

Instances For
@[simp]
theorem CategoryTheory.Discrete.opposite_functor_obj_as (α : Type u₁) (X : ) :
(().functor.obj X).as = X.unop.as
@[simp]
theorem CategoryTheory.Discrete.opposite_inverse_obj (α : Type u₁) :
∀ (a : ), ().inverse.obj a =

A discrete category is equivalent to its opposite category.

Instances For
@[simp]
theorem CategoryTheory.Discrete.functor_map_id {J : Type v₁} {C : Type u₂} [] (F : ) {j : } (f : j j) :