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 = ⋯.mpr (CategoryTheory.CategoryStruct.id Y)
Instances For
Two morphisms are conjugate via eqToHom if and only if they are heterogeneously equal. Note this used to be in the Functor namespace, where it doesn't belong.
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 = { hom := CategoryTheory.eqToHom p, inv := CategoryTheory.eqToHom ⋯, hom_inv_id := ⋯, inv_hom_id := ⋯ }
Instances For
Equations
- ⋯ = ⋯
Proving equality between functors. This isn't an extensionality lemma, because usually you don't really want to do this.
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 attribute [local simp] eqToHom_map
, however.
See the note on eqToHom_map
regarding using this as a simp
lemma.