Discrete categories #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
We define discrete α
as a structure containing a term a : α
for any type α
,
and use this type alias to provide a small_category
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 small_category
(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.nat_trans
and discrete.nat_iso
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.
- as : α
A wrapper for promoting any type to a category, with the only morphisms being equalities.
Instances for category_theory.discrete
- category_theory.limits.has_zero_object.has_initial
- category_theory.limits.has_zero_object.has_terminal
- category_theory.limits.has_binary_products_of_has_binary_biproducts
- category_theory.limits.has_binary_coproducts_of_has_binary_biproducts
- category_theory.discrete.has_sizeof_inst
- category_theory.discrete_category
- category_theory.discrete.inhabited
- category_theory.discrete.subsingleton
- category_theory.discrete.unique
- category_theory.limits.has_initial_op_of_has_terminal
- category_theory.limits.has_terminal_op_of_has_initial
- category_theory.limits.has_zero_object_punit
- category_theory.limits.has_zero_morphisms_pempty
- category_theory.limits.has_zero_morphisms_punit
- category_theory.discrete_fintype
- category_theory.fin_category_discrete_of_fintype
- category_theory.limits.has_limits_of_shape_discrete
- category_theory.limits.has_colimits_of_shape_discrete
discrete α
is equivalent to the original type α
.
Equations
- category_theory.discrete_equiv = {to_fun := category_theory.discrete.as α, inv_fun := category_theory.discrete.mk α, left_inv := _, right_inv := _}
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))
.
See https://stacks.math.columbia.edu/tag/001A
Equations
- category_theory.discrete_category α = {to_category_struct := {to_quiver := {hom := λ (X Y : category_theory.discrete α), ulift (plift (X.as = Y.as))}, id := λ (X : category_theory.discrete α), {down := {down := _}}, comp := λ (X Y Z : category_theory.discrete α) (g : X ⟶ Y) (f : Y ⟶ Z), X.cases_on (λ (X : α) (g : {as := X} ⟶ Y), Y.cases_on (λ (Y : α) (f : {as := Y} ⟶ Z) (g : {as := X} ⟶ {as := Y}), Z.cases_on (λ (Z : α) (f : {as := Y} ⟶ {as := Z}), ulift.cases_on f (λ (f : plift ({as := Y}.as = {as := Z}.as)), f.cases_on (λ (f : {as := Y}.as = {as := Z}.as), f.dcases_on (λ (a : Z = Y), eq.rec (λ (f : {as := Y}.as = {as := Y}.as) (H_2 : f == _), g) _ f) _ _))) f) f g) g}, id_comp' := _, comp_id' := _, assoc' := _}
Equations
- category_theory.discrete.inhabited = {default := {as := inhabited.default _inst_1}}
Equations
Extract the equation from a morphism in a discrete category.
Promote an equation between the wrapped terms in X Y : discrete α
to a morphism X ⟶ Y
in the discrete category.
Promote an equation between the wrapped terms in X Y : discrete α
to an isomorphism X ≅ Y
in the discrete category.
Any function I → C
gives a functor discrete I ⥤ C
.
Equations
- category_theory.discrete.functor F = {obj := F ∘ category_theory.discrete.as, map := λ (X Y : category_theory.discrete I) (f : X ⟶ Y), X.cases_on (λ (X : I) (f : {as := X} ⟶ Y), Y.cases_on (λ (Y : I) (f : {as := X} ⟶ {as := Y}), ulift.cases_on f (λ (f : plift ({as := X}.as = {as := Y}.as)), f.cases_on (λ (f : {as := X}.as = {as := Y}.as), f.dcases_on (λ (a : Y = X), eq.rec (λ (f : {as := X}.as = {as := X}.as) (H_2 : f == _), 𝟙 (F X)) _ f) _ _))) f) f, map_id' := _, map_comp' := _}
Instances for category_theory.discrete.functor
The discrete functor induced by a composition of maps can be written as a composition of two discrete functors.
Equations
For functors out of a discrete category, a natural transformation is just a collection of maps, as the naturality squares are trivial.
Equations
- category_theory.discrete.nat_trans f = {app := f, naturality' := _}
For functors out of a discrete category, a natural isomorphism is just a collection of isomorphisms, as the naturality squares are trivial.
Equations
Every functor F
from a discrete category is naturally isomorphic (actually, equal) to
discrete.functor (F.obj)
.
Equations
- category_theory.discrete.nat_iso_functor = category_theory.discrete.nat_iso (λ (i : category_theory.discrete I), i.cases_on (λ (i : I), category_theory.iso.refl (F.obj {as := i})))
Composing discrete.functor F
with another functor G
amounts to composing F
with G.obj
Equations
We can promote a type-level equiv
to
an equivalence between the corresponding discrete
categories.
Equations
- category_theory.discrete.equivalence e = {functor := category_theory.discrete.functor (category_theory.discrete.mk ∘ ⇑e), inverse := category_theory.discrete.functor (category_theory.discrete.mk ∘ ⇑(e.symm)), unit_iso := category_theory.discrete.nat_iso (λ (i : category_theory.discrete I), category_theory.discrete.eq_to_iso _), counit_iso := category_theory.discrete.nat_iso (λ (j : category_theory.discrete J), category_theory.discrete.eq_to_iso _), functor_unit_iso_comp' := _}
We can convert an equivalence of discrete
categories to a type-level equiv
.
Equations
A discrete category is equivalent to its opposite category.
Equations
- category_theory.discrete.opposite α = let F : category_theory.discrete α ⥤ (category_theory.discrete α)ᵒᵖ := category_theory.discrete.functor (λ (x : α), opposite.op {as := x}) in category_theory.equivalence.mk F.left_op F (category_theory.nat_iso.of_components (λ (X : (category_theory.discrete α)ᵒᵖ), opposite.rec (λ (X : category_theory.discrete α), X.cases_on (λ (X : α), _.mpr (category_theory.iso.refl (opposite.op {as := X})))) X) _) (category_theory.discrete.nat_iso (λ (X : category_theory.discrete α), X.cases_on (λ (X : α), _.mpr (category_theory.iso.refl {as := X}))))