Category instances for algebraic structures that use bundled homs. #
Many algebraic structures in Lean initially used unbundled homs (e.g. a bare function between types,
along with an IsMonoidHom
typeclass), but the general trend is towards using bundled homs.
This file provides a basic infrastructure to define concrete categories using bundled homs, and define forgetful functors between them.
Class for bundled homs. Note that the arguments order follows that of lemmas for MonoidHom
.
This way we can use ⟨@MonoidHom.toFun, @MonoidHom.id ...⟩
in an instance.
- toFun : {α β : Type u} → (Iα : c α) → (Iβ : c β) → hom Iα Iβ → α → β
the underlying map of a bundled morphism
- id : {α : Type u} → (I : c α) → hom I I
the identity as a bundled morphism
- comp : {α β γ : Type u} → (Iα : c α) → (Iβ : c β) → (Iγ : c γ) → hom Iβ Iγ → hom Iα Iβ → hom Iα Iγ
composition of bundled morphisms
- hom_ext : ∀ {α β : Type u} (Iα : c α) (Iβ : c β), Function.Injective (self.toFun Iα Iβ)
a bundled morphism is determined by the underlying map
compatibility with identities
- comp_toFun : ∀ {α β γ : Type u} (Iα : c α) (Iβ : c β) (Iγ : c γ) (f : hom Iα Iβ) (g : hom Iβ Iγ), self.toFun Iα Iγ (self.comp Iα Iβ Iγ g f) = self.toFun Iβ Iγ g ∘ self.toFun Iα Iβ f
compatibility with the composition
Instances
Every @BundledHom c _
defines a category with objects in Bundled c
.
This instance generates the type-class problem BundledHom ?m
.
Currently that is not a problem, as there are almost no instances of BundledHom
.
Equations
A category given by BundledHom
is a concrete category.
Equations
- One or more equations did not get rendered due to their size.
A version of HasForget₂.mk'
for categories defined using @BundledHom
.
Equations
- CategoryTheory.BundledHom.mkHasForget₂ obj map h_map = CategoryTheory.HasForget₂.mk' (CategoryTheory.Bundled.map obj) ⋯ (fun {X Y : CategoryTheory.Bundled c} => map) ⋯
Instances For
The hom
corresponding to first forgetting along F
, then taking the hom
associated to c
.
For typical usage, see the construction of CommMonCat
from MonCat
.
Equations
- CategoryTheory.BundledHom.MapHom hom F iα iβ = hom (F iα) (F iβ)
Instances For
Construct the CategoryTheory.BundledHom
induced by a map between type classes.
This is useful for building categories such as CommMonCat
from MonCat
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
We use the empty ParentProjection
class to label functions like CommMonoid.toMonoid
,
which we would like to use to automatically construct BundledHom
instances from.
Once we've set up MonCat
as the category of bundled monoids,
this allows us to set up CommMonCat
by defining an instance
instance : ParentProjection (CommMonoid.toMonoid) := ⟨⟩
Instances
Equations
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.