Categories #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
Defines a category, as a type class parametrised by the type of objects.
Notations #
Introduces notations
X ⟶ Y
for the morphism spaces (type as\hom
),𝟙 X
for the identity morphism onX
(type as\b1
),f ≫ g
for composition in the 'arrows' convention (type as\gg
).
Users may like to add f ⊚ g
for composition in the standard convention, using
local notation f ` ⊚ `:80 g:80 := category.comp g f -- type as \oo
The typeclass category C
describes morphisms associated to objects of type C : Type u
.
The universe levels of the objects and morphisms are independent, and will often need to be
specified explicitly, as category.{v} C
.
Typically any concrete example will either be a small_category
, where v = u
,
which can be introduced as
universes u
variables {C : Type u} [small_category C]
or a large_category
, where u = v+1
, which can be introduced as
universes u
variables {C : Type (u+1)} [large_category C]
In order for the library to handle these cases uniformly,
we generally work with the unconstrained category.{v u}
,
for which objects live in Type u
and morphisms live in Type v
.
Because the universe parameter u
for the objects can be inferred from C
when we write category C
, while the universe parameter v
for the morphisms
can not be automatically inferred, through the category theory library
we introduce universe parameters with morphism levels listed first,
as in
universes v u
or
universes v₁ v₂ u₁ u₂
when multiple independent universes are needed.
This has the effect that we can simply write category.{v} C
(that is, only specifying a single parameter) while u
will be inferred.
Often, however, it's not even necessary to include the .{v}
.
(Although it was in earlier versions of Lean.)
If it is omitted a "free" universe will be used.
A preliminary structure on the way to defining a category, containing the data, but none of the axioms.
Instances of this typeclass
- category_theory.category.to_category_struct
- category_theory.bicategory.to_category_struct
- category_theory.limits.wide_pullback_shape.struct
- category_theory.limits.wide_pushout_shape.struct
- category_theory.single_obj.category_struct
- category_theory.locally_discrete.category_theory.category_struct
- category_theory.monad.algebra.category_theory.category_struct
- category_theory.comonad.coalgebra.category_theory.category_struct
- category_theory.Kleisli.category_struct
- category_theory.bicone_category_struct
- category_theory.sigma.sigma_hom.sigma.category_theory.category_struct
- category_theory.oplax_nat_trans.category_theory.oplax_functor.category_theory.category_struct
- category_theory.endofunctor.algebra.category_theory.category_struct
- category_theory.endofunctor.coalgebra.category_theory.category_struct
Instances of other typeclasses for category_theory.category_struct
- category_theory.category_struct.has_sizeof_inst
- to_category_struct : category_theory.category_struct obj
- id_comp' : (∀ {X Y : obj} (f : X ⟶ Y), 𝟙 X ≫ f = f) . "obviously"
- comp_id' : (∀ {X Y : obj} (f : X ⟶ Y), f ≫ 𝟙 Y = f) . "obviously"
- assoc' : (∀ {W X Y Z : obj} (f : W ⟶ X) (g : X ⟶ Y) (h : Y ⟶ Z), (f ≫ g) ≫ h = f ≫ g ≫ h) . "obviously"
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 large_category
and small_category
.)
See https://stacks.math.columbia.edu/tag/0014.
Instances of this typeclass
- category_theory.groupoid.to_category
- preorder.small_category
- category_theory.strict_bicategory.category
- category_theory.locally_discrete.hom_small_category
- category_theory.ulift_category
- category_theory.functor.category
- category_theory.induced_category.category
- category_theory.full_subcategory.category
- category_theory.functor.ess_image_subcategory.category
- category_theory.category.opposite
- category_theory.prod
- category_theory.uniform_prod
- category_theory.pi
- category_theory.pi'
- category_theory.pi.sum_elim_category
- category_theory.types
- category_theory.comma_category
- category_theory.arrow.category
- category_theory.discrete_category
- category_theory.prod_category_instance_1
- category_theory.prod_category_instance_2
- category_theory.limits.cone.category
- category_theory.limits.cocone.category
- category_theory.ulift_hom.category
- category_theory.as_small.small_category
- category_theory.limits.wide_pullback_shape.category
- category_theory.limits.wide_pushout_shape.category
- category_theory.bicategory.hom_category
- category_theory.Cat.str
- category_theory.Cat.category
- category_theory.skeleton.category
- category_theory.small_category_small_model
- category_theory.shrink_homs.category_theory.category
- category_theory.structured_arrow.category
- category_theory.costructured_arrow.category
- category_theory.over.category
- category_theory.under.category
- category_theory.bundled_hom.category
- Mon.large_category
- AddMon.large_category
- CommMon.large_category
- AddCommMon.large_category
- Group.large_category
- AddGroup.large_category
- CommGroup.large_category
- AddCommGroup.large_category
- category_theory.single_obj.category
- category_theory.free_monoidal_category.category_free_monoidal_category
- category_theory.quotient.category
- category_theory.paths.category_paths
- category_theory.free_bicategory.hom_category
- category_theory.monoidal_nat_trans.category_lax_monoidal_functor
- category_theory.monoidal_nat_trans.category_monoidal_functor
- category_theory.lax_braided_functor.category_lax_braided_functor
- category_theory.braided_functor.category_braided_functor
- category_theory.monoidal.transported.category
- category_theory.fin_category.category_as_type
- category_theory.LeftExactFunctor.category
- category_theory.RightExactFunctor.category
- category_theory.ExactFunctor.category
- category_theory.limits.walking_parallel_pair_hom_category
- category_theory.AdditiveFunctor.category
- category_theory.monoidal_of_chosen_finite_products.monoidal_of_chosen_finite_products_synonym.category
- Action.category_theory.category
- Module.Module_category
- category_theory.mono_over.category
- category_theory.subobject.category
- category_theory.category_Free
- Rep.large_category
- fgModule.large_category
- fdRep.large_category
- category_theory.graded_object.category_of_graded_objects
- homological_complex.category_theory.category
- Fintype.category_theory.category
- Fintype.skeleton.category_theory.small_category
- Preord.large_category
- PartOrd.large_category
- FinPartOrd.large_category
- Lat.category_theory.large_category
- LinOrd.large_category
- NonemptyFinLinOrd.large_category
- simplex_category.small_category
- simplex_category.truncated.small_category
- category_theory.simplicial_object.category
- category_theory.simplicial_object.truncated.category
- category_theory.simplicial_object.augmented.category
- category_theory.cosimplicial_object.category
- category_theory.cosimplicial_object.truncated.category
- category_theory.cosimplicial_object.augmented.category
- category_theory.idempotents.karoubi.category_theory.category
- Top.large_category
- category_theory.category_of_elements
- category_theory.limits.walking_multicospan.category_theory.small_category
- category_theory.limits.walking_multispan.category_theory.small_category
- sSet.large_category
- sSet.truncated.large_category
- homotopy_category.category
- category_theory.monad.category
- category_theory.comonad.category
- category_theory.monad.algebra.EilenbergMoore
- category_theory.comonad.coalgebra.EilenbergMoore
- Meas.large_category
- category_theory.Groupoid.category
- UniformSpace.large_category
- CpltSepUniformSpace.category
- SemiRing.large_category
- Ring.large_category
- CommSemiRing.large_category
- CommRing.large_category
- TopCommRing.category_theory.category
- Born.category_theory.large_category
- CompHaus.category
- Frm.large_category
- Locale.large_category
- category_theory.kleisli.kleisli.category
- category_theory.cokleisli.cokleisli.category
- category_theory.Kleisli.category
- Profinite.category
- Compactum.category
- topological_space.open_nhds.open_nhds_category
- Top.presheaf.category
- category_theory.SheafOfTypes.category_theory.category
- category_theory.Sheaf.category_theory.category
- Top.sheaf.category
- category_theory.bicone_category
- category_theory.bicone_small_category
- Top.presheaf.sheaf_condition.opens_le_cover.category
- category_theory.pairwise.category_theory.category
- category_theory.subterminals.category
- category_theory.grothendieck.category_theory.category
- category_theory.with_terminal.category_theory.category
- category_theory.with_initial.category_theory.category
- category_theory.differential_object.category_of_differential_objects
- category_theory.morphism_property.functors_inverting.category
- category_theory.action_category.category
- category_theory.sigma.sigma
- category_theory.component.category
- category_theory.sum
- category_theory.oplax_nat_trans.category
- category_theory.End_monoidal.category
- category_theory.endofunctor.algebra.category_theory.category
- category_theory.endofunctor.coalgebra.category_theory.category
- category_theory.groupoid.free.category_theory.free_groupoid.category_theory.category
- category_theory.limits.walking_parallel_family.category
- category_theory.Mat_.category_theory.category
- category_theory.Mat.category
- Pointed.large_category
- Bipointed.large_category
- Twop.large_category
- category_theory.Quiv.category
- category_theory.rel
- PartialFun.large_category
- category_theory.Cat.has_limits.category_objects
- category_theory.Cat.has_limits.category_theory.limits.limit.category_theory.category
- category_theory.morphism_property.localization.category
- category_theory.pretriangulated.triangle_category
- Mon_.category_theory.category
- Bimod.category_theory.category
- category_theory.monoidal_opposite.monoidal_opposite_category
- Mod_.category_theory.category
- category_theory.center.category_theory.category
- CommMon_.category_theory.category
- Algebra.category_theory.category
- category_theory.category_forget_enrichment
- SemiNormedGroup.large_category
- SemiNormedGroup₁.category_theory.large_category
- BddOrd.large_category
- SemilatSup.category_theory.large_category
- SemilatInf.category_theory.large_category
- BddLat.category_theory.large_category
- DistLat.large_category
- BddDistLat.category_theory.large_category
- HeytAlg.large_category
- BoolAlg.category_theory.large_category
- FinBddDistLat.large_category
- FinBoolAlg.large_category
- CompleteLat.category_theory.large_category
- ωCPO.large_category
- category_theory.obj.category
- simplicial_object.split.category_theory.category
- local_cohomology.self_le_radical.category
- GroupWithZero.category_theory.large_category
- BoolRing.large_category
- Magma.large_category
- AddMagma.large_category
- Semigroup.large_category
- AddSemigroup.large_category
- algebraic_geometry.PresheafedSpace.category_of_PresheafedSpaces
- algebraic_geometry.SheafedSpace.category_theory.category
- algebraic_geometry.LocallyRingedSpace.category_theory.category
- algebraic_geometry.Scheme.category_theory.category
- algebraic_geometry.AffineScheme.category
Instances of other typeclasses for category_theory.category
- category_theory.category.has_sizeof_inst
A large_category
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.
A small_category
has objects and morphisms in the same universe level.
postcompose an equation between morphisms by another morphism
precompose an equation between morphisms by another morphism
A morphism f
is an epimorphism if it can be "cancelled" when precomposed:
f ≫ g = f ≫ h
implies g = h
.
See https://stacks.math.columbia.edu/tag/003B.
Instances of this typeclass
- category_theory.is_iso.epi_of_iso
- category_theory.is_split_epi.epi
- category_theory.epi_of_strong_epi
- category_theory.regular_epi.epi
- category_theory.category_struct.id.epi
- category_theory.unop_epi_of_mono
- category_theory.op_epi_of_mono
- category_theory.arrow.epi_right
- category_theory.functor.map_epi
- category_theory.limits.colim_map_epi'
- category_theory.limits.colim_map_epi
- category_theory.structured_arrow.epi_hom_mk
- category_theory.costructured_arrow.epi_hom_mk
- category_theory.under.epi_right_of_epi
- category_theory.limits.coprod.epi_desc_of_epi_left
- category_theory.limits.coprod.epi_desc_of_epi_right
- category_theory.limits.coprod.map_epi
- category_theory.limits.pushout.inl_of_epi
- category_theory.limits.pushout.inr_of_epi
- category_theory.limits.epi_coprod_to_pushout
- category_theory.limits.coequalizer.π_epi
- category_theory.limits.sigma.map_epi
- category_theory.limits.factor_thru_image.category_theory.epi
- category_theory.limits.image.pre_comp_epi_of_epi
- category_theory.limits.has_zero_object.category_theory.epi
- category_theory.limits.cokernel.desc_epi
- category_theory.limits.biprod.epi_desc_of_epi_left
- category_theory.limits.biprod.epi_desc_of_epi_right
- category_theory.preadditive.has_neg.neg.category_theory.epi
- category_theory.linear.has_smul.smul.category_theory.epi
- category_theory.limits.map_π_epi
- category_theory.limits.colimit_quotient_coproduct_epi
- category_theory.abelian.epi_factor_thru_coimage
- category_theory.non_preadditive_abelian.category_theory.abelian.factor_thru_image.category_theory.epi
- category_theory.non_preadditive_abelian.epi_r
- category_theory.abelian.factor_thru_image.category_theory.epi
- category_theory.abelian.epi_pullback_of_epi_f
- category_theory.abelian.epi_pullback_of_epi_g
- Module.epi_as_hom''_mkq
- category_theory.costructured_arrow.epi_left_of_epi
- category_theory.limits.factor_thru_image_subobject.category_theory.epi
- category_theory.limits.image_subobject_comp_le_epi_of_epi
- image_to_kernel_epi_of_zero_of_mono
- image_to_kernel_epi_of_epi_of_zero
- category_theory.exact.epi
- category_theory.limits.factor_thru_kernel_subobject.epi
- category_theory.limits.kernel.lift.epi
- category_theory.projective_presentation.epi
- category_theory.projective.π_epi
- simplex_category.σ.category_theory.epi
- simplex_category.category_theory.limits.factor_thru_image.category_theory.epi
- category_theory.limits.multicoequalizer.sigma_π.category_theory.epi
- category_theory.ProjectiveResolution.epi
- category_theory.ProjectiveResolution.f.category_theory.epi
- category_theory.abelian.homology_c_to_k.category_theory.epi
- category_theory.glue_data.π_epi
- category_theory.Sheaf.hom.epi_of_presheaf_epi
- localization.epi
- localization.epi'
- Top.presheaf.submonoid_presheaf.to_localization_presheaf.category_theory.epi
- Top.presheaf.to_total_quotient_presheaf.epi
- category_theory.grothendieck_topology.to_image_sheaf.category_theory.epi
- category_theory.limits.wide_coequalizer.π_epi
- SemiNormedGroup.explicit_cokernel_π.epi
- simplicial_object.splitting.index_set.e.category_theory.epi
- category_theory.splitting.retraction.category_theory.epi
- algebraic_geometry.structure_sheaf.to_basic_open_epi
- algebraic_geometry.SheafedSpace.base.category_theory.epi
- algebraic_geometry.Scheme.open_cover.base.category_theory.epi
A morphism f
is a monomorphism if it can be "cancelled" when postcomposed:
g ≫ f = h ≫ f
implies g = h
.
See https://stacks.math.columbia.edu/tag/003B.
Instances of this typeclass
- category_theory.is_iso.mono_of_iso
- category_theory.is_split_mono.mono
- category_theory.mono_of_strong_mono
- category_theory.limits.initial.mono_from
- category_theory.regular_mono.mono
- category_theory.category_struct.id.mono
- category_theory.unop_mono_of_epi
- category_theory.op_mono_of_epi
- category_theory.arrow.mono_left
- category_theory.functor.map_mono
- category_theory.limits.lim_map_mono'
- category_theory.limits.lim_map_mono
- category_theory.structured_arrow.mono_hom_mk
- category_theory.costructured_arrow.mono_hom_mk
- category_theory.over.mono_left_of_mono
- category_theory.limits.prod.mono_lift_of_mono_left
- category_theory.limits.prod.mono_lift_of_mono_right
- category_theory.limits.prod.map_mono
- category_theory.limits.pullback.fst_of_mono
- category_theory.limits.pullback.snd_of_mono
- category_theory.limits.mono_pullback_to_prod
- category_theory.limits.equalizer.ι_mono
- category_theory.limits.pi.map_mono
- category_theory.limits.mono_factorisation.m_mono
- category_theory.limits.image.ι.category_theory.mono
- category_theory.limits.image.lift_mono
- category_theory.limits.image.pre_comp_mono
- category_theory.limits.has_zero_object.category_theory.mono
- category_theory.limits.kernel.lift_mono
- category_theory.limits.biprod.mono_lift_of_mono_left
- category_theory.limits.biprod.mono_lift_of_mono_right
- category_theory.preadditive.has_neg.neg.category_theory.mono
- category_theory.linear.has_smul.smul.category_theory.mono
- category_theory.limits.types.image.ι.category_theory.mono
- category_theory.limits.limit_subobject_product_mono
- category_theory.abelian.mono_factor_thru_image
- category_theory.non_preadditive_abelian.category_theory.abelian.factor_thru_coimage.category_theory.mono
- category_theory.non_preadditive_abelian.mono_Δ
- category_theory.non_preadditive_abelian.mono_r
- category_theory.abelian.factor_thru_coimage.category_theory.mono
- category_theory.abelian.mono_pushout_of_mono_f
- category_theory.abelian.mono_pushout_of_mono_g
- Module.mono_as_hom'_subtype
- category_theory.structured_arrow.mono_right_of_mono
- category_theory.mono_over.mono
- category_theory.mono_comp
- category_theory.subobject.arrow_mono
- category_theory.subobject.of_le.category_theory.mono
- category_theory.subobject.of_le_mk.mono
- category_theory.subobject.of_mk_le.mono
- category_theory.subobject.of_mk_le_mk.mono
- category_theory.subobject.wide_pullback_ι_mono
- image_to_kernel.mono
- category_theory.abelian.category_theory.limits.cokernel.desc.category_theory.mono
- simplex_category.δ.category_theory.mono
- category_theory.limits.multiequalizer.ι_pi.category_theory.mono
- category_theory.abelian.homology_c_to_k.category_theory.mono
- category_theory.glue_data.f_mono
- Top.glue_data.ι_mono
- category_theory.sieve.functor_inclusion_is_mono
- category_theory.presheaf_mono_of_mono
- Top.presheaf.to_total_quotient_presheaf.category_theory.mono
- category_theory.grothendieck_topology.subpresheaf.ι.category_theory.mono
- category_theory.grothendieck_topology.subpresheaf.hom_of_le.category_theory.mono
- category_theory.grothendieck_topology.image_sheaf_ι.category_theory.mono
- category_theory.simple_subobject_arrow.mono
- category_theory.limits.coprod.inl.mono
- category_theory.limits.coprod.inr.mono
- category_theory.injective_presentation.mono
- category_theory.injective.ι_mono
- category_theory.InjectiveResolution.mono
- category_theory.InjectiveResolution.f.category_theory.mono
- category_theory.initial.mono_to
- category_theory.limits.mono_coprod.category_theory.limits.coprod.inl.category_theory.mono
- category_theory.limits.mono_coprod.category_theory.limits.coprod.inr.category_theory.mono
- category_theory.limits.wide_equalizer.ι_mono
- category_theory.limits.coprod.inl.category_theory.mono
- category_theory.limits.coprod.inr.category_theory.mono
- algebraic_topology.dold_kan.algebraic_topology.inclusion_of_Moore_complex_map.category_theory.mono
- category_theory.splitting.section.category_theory.mono
- AddCommGroup.image.ι.category_theory.mono
- Module.image.ι.category_theory.mono
- algebraic_geometry.PresheafedSpace.of_restrict_mono
- algebraic_geometry.PresheafedSpace.is_open_immersion.mono
- algebraic_geometry.SheafedSpace.is_open_immersion.category_theory.mono
- algebraic_geometry.LocallyRingedSpace.is_open_immersion.mono
- algebraic_geometry.is_open_immersion.mono
Many proofs in the category theory library use the dsimp, simp
pattern,
which typically isn't necessary elsewhere.
One would usually hope that the same effect could be achieved simply with simp
.
The essential issue is that composition of morphisms involves dependent types.
When you have a chain of morphisms being composed, say f : X ⟶ Y
and g : Y ⟶ Z
,
then simp
can operate succesfully on the morphisms
(e.g. if f
is the identity it can strip that off).
However if we have an equality of objects, say Y = Y'
,
then simp
can't operate because it would break the typing of the composition operations.
We rarely have interesting equalities of objects
(because that would be "evil" --- anything interesting should be expressed as an isomorphism
and tracked explicitly),
except of course that we have plenty of definitional equalities of objects.
dsimp
can apply these safely, even inside a composition.
After dsimp
has cleared up the object level, simp
can resume work on the morphism level ---
but without the dsimp
step, because simp
looks at expressions syntactically,
the relevant lemmas might not fire.
There's no bound on how many times you potentially could have to switch back and forth,
if the simp
introduced new objects we again need to dsimp
.
In practice this does occur, but only rarely, because simp
tends to shorten chains of compositions
(i.e. not introduce new objects at all).