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 usingeq_to_hom h : X ⟶ Y
, oreq_to_iso h : X ≅ Y
.
This file introduces various simp
lemmas which in favourable circumstances
result in the various eq_to_hom
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
- category_theory.eq_to_hom p = _.mpr (𝟙 Y)
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 eq_to_hom
.
It may be advisable to introduce any necessary eq_to_hom
morphisms manually,
rather than relying on this lemma firing.
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 eq_to_hom
.
It may be advisable to introduce any necessary eq_to_hom
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
- category_theory.eq_to_iso p = {hom := category_theory.eq_to_hom p, inv := category_theory.eq_to_hom _, hom_inv_id' := _, inv_hom_id' := _}
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 eq_to_hom if and only if they are heterogeneously equal. -
Proving equality between functors using heterogeneous equality.