Zulip Chat Archive
Stream: mathlib4
Topic: Kernel error with category theory and aesop_cat
Gareth Ma (Aug 05 2025 at 23:36):
In the proof below, when I replace the proof of hom_inv_id by := by aesop_cat (or omitting the field), I get a Lean kernel error (test online). Any idea why? It seems there are some size issues :/
import Mathlib
open CategoryTheory Category Limits Functor
variable
{C D E : Type u} [Category C] [Category D] [Category E]
{F : C ⥤ E} {K : C ⥤ D} (R : D ⥤ E) (ε : K ⋙ R ⟶ F)
[R.IsRightKanExtension ε]
lemma CategoryTheory.Functor.liftOfIsRightKanExtension_existsUnique (G : D ⥤ E) (β : K ⋙ G ⟶ F) :
∃! η, whiskerLeft K η ≫ ε = β :=
(R.isUniversalOfIsRightKanExtension ε).existsUnique (RightExtension.mk G β)
noncomputable def homEquivOfIsRightKanExtension' :
yoneda.obj R ≅ ((whiskeringLeft C D E).obj K).op ⋙ yoneda.obj F where
hom := {
app := fun G ↦ (R.homEquivOfIsRightKanExtension ε G.unop).toFun
naturality := by
unfold homEquivOfIsRightKanExtension
aesop_cat
}
inv := {
app := fun G ↦ (R.homEquivOfIsRightKanExtension ε G.unop).invFun
naturality := fun _ _ _ ↦ by
ext1 δ
unfold homEquivOfIsRightKanExtension
exact (liftOfIsRightKanExtension_existsUnique ..).unique
(liftOfIsRightKanExtension_fac ..) (by aesop_cat)
}
hom_inv_id := by ext; simp
inv_hom_id := by ext; simp
Gareth Ma (Aug 05 2025 at 23:36):
Wait, no error with aesop
Aaron Liu (Aug 05 2025 at 23:37):
My guess is universe metavariables
Gareth Ma (Aug 05 2025 at 23:37):
But I made everything Type u already
Gareth Ma (Aug 05 2025 at 23:37):
Oh do I have to specify universes of morphisms as well or something
Aaron Liu (Aug 05 2025 at 23:37):
But you didn't make them all Category.{v}
Gareth Ma (Aug 05 2025 at 23:38):
Okay yeah that fixes it
Kenny Lau (Aug 05 2025 at 23:38):
Note that specifying the universes fixes it:
import Mathlib
open CategoryTheory Category Limits Functor
universe v₁ v₂ v₃ u
variable
{C D E : Type u} [Category.{v₁} C] [Category.{v₂} D] [Category.{v₃} E]
{F : C ⥤ E} {K : C ⥤ D} (R : D ⥤ E) (ε : K ⋙ R ⟶ F)
[R.IsRightKanExtension ε]
lemma CategoryTheory.Functor.liftOfIsRightKanExtension_existsUnique (G : D ⥤ E) (β : K ⋙ G ⟶ F) :
∃! η, whiskerLeft K η ≫ ε = β :=
(R.isUniversalOfIsRightKanExtension ε).existsUnique (RightExtension.mk G β)
noncomputable def homEquivOfIsRightKanExtension' :
yoneda.obj R ≅ ((whiskeringLeft C D E).obj K).op ⋙ yoneda.obj F where
hom := {
app := fun G ↦ (R.homEquivOfIsRightKanExtension ε G.unop).toFun
naturality := by
unfold homEquivOfIsRightKanExtension
aesop_cat
}
inv := {
app := fun G ↦ (R.homEquivOfIsRightKanExtension ε G.unop).invFun
naturality := fun _ _ _ ↦ by
ext1 δ
unfold homEquivOfIsRightKanExtension
exact (liftOfIsRightKanExtension_existsUnique ..).unique
(liftOfIsRightKanExtension_fac ..) (by aesop_cat)
}
hom_inv_id := by aesop_cat
inv_hom_id := by ext; simp
Kenny Lau (Aug 05 2025 at 23:39):
do the u's have to be the same?
Gareth Ma (Aug 05 2025 at 23:39):
It seems to complain if not
Kenny Lau (Aug 05 2025 at 23:39):
basically you always want to remember the idiom [Category.{v} C]
Kenny Lau (Aug 05 2025 at 23:39):
that will keep you out of troubles
Gareth Ma (Aug 05 2025 at 23:40):
Right but that's so confusing, in your code your v are all different
Gareth Ma (Aug 05 2025 at 23:40):
How's that different from omitting them
Kenny Lau (Aug 05 2025 at 23:40):
Lean universe is magic
Aaron Liu (Aug 05 2025 at 23:40):
Gareth Ma said:
How's that different from omitting them
You don't get to set v = u
Aaron Liu (Aug 05 2025 at 23:40):
but if you omit them then it can be anything (including u)
Kenny Lau (Aug 05 2025 at 23:41):
and also max (max (v1+1) (v2+2)) (u+37)
Gareth Ma (Aug 05 2025 at 23:42):
ummmm hmmm okay
Last updated: Dec 20 2025 at 21:32 UTC