Morphisms from equations between objects. #
When working categorically, sometimes one encounters an equation h : X = Y
between objects.
Your initial aversion to this is natural and appropriate: you're in for some trouble, and if there is another way to approach the problem that won't rely on this equality, it may be worth pursuing.
You have two options:
- Use the equality
h
as one normally would in Lean (e.g. usingrw
andsubst
). This may immediately cause difficulties, because in category theory everything is dependently typed, and equations between objects quickly lead to nasty goals witheq.rec
. - Promote
h
to a morphism usingeqToHom h : X ⟶ Y
, oreqToIso h : X ≅ Y
.
This file introduces various simp
lemmas which in favourable circumstances
result in the various eqToHom
morphisms to drop out at the appropriate moment!
An equality X = Y
gives us a morphism X ⟶ Y
.
It is typically better to use this, rather than rewriting by the equality then using 𝟙 _
which usually leads to dependent type theory hell.
Equations
- CategoryTheory.eqToHom p = Eq.mpr (_ : (X ⟶ Y) = (Y ⟶ Y)) (CategoryTheory.CategoryStruct.id Y)
Instances For
We can push eqToHom
to the left through families of morphisms.
A variant on eqToHom_naturality
that helps Lean identify the families f
and g
.
A variant on eqToHom_naturality
that helps Lean identify the families f
and g
.
Reducible form of congrArg_mpr_hom_left
If we (perhaps unintentionally) perform equational rewriting on
the source object of a morphism,
we can replace the resulting _.mpr f
term by a composition with an eqToHom
.
It may be advisable to introduce any necessary eqToHom
morphisms manually,
rather than relying on this lemma firing.
Reducible form of congrArg_mpr_hom_right
If we (perhaps unintentionally) perform equational rewriting on
the target object of a morphism,
we can replace the resulting _.mpr f
term by a composition with an eqToHom
.
It may be advisable to introduce any necessary eqToHom
morphisms manually,
rather than relying on this lemma firing.
An equality X = Y
gives us an isomorphism X ≅ Y
.
It is typically better to use this, rather than rewriting by the equality then using Iso.refl _
which usually leads to dependent type theory hell.
Equations
- CategoryTheory.eqToIso p = CategoryTheory.Iso.mk (CategoryTheory.eqToHom p) (CategoryTheory.eqToHom (_ : Y = X))
Instances For
Proving equality between functors. This isn't an extensionality lemma, because usually you don't really want to do this.
Two morphisms are conjugate via eqToHom if and only if they are heterogeneously equal.
Proving equality between functors using heterogeneous equality.
This is not always a good idea as a @[simp]
lemma,
as we lose the ability to use results that interact with F
,
e.g. the naturality of a natural transformation.
In some files it may be appropriate to use local attribute [simp] eqToHom_map
, however.
See the note on eqToHom_map
regarding using this as a simp
lemma.