Zulip Chat Archive
Stream: lean4
Topic: identity functor in Cat.{uβ,vβ}
Dean Young (Aug 21 2023 at 20:23):
This code gives me an error message:
invalid field 'obj', the environment does not contain 'Quiver.Hom.obj'
π C
has type
C βΆ C
variable {C : Cat.{uβ,vβ}}
#check (π C).obj
Is seems it didn't infer the full functor but instead only a quantale. All this time I thought it was inferring the full functor.
Dean Young (Aug 21 2023 at 20:41):
Here's a similar error:
invalid field notation, type is not of the form (C ...) where C is a constant
π (AdjComDom Ο)
has type
CategoryStruct.toQuiver.1 (AdjComDom Ο) (AdjComDom Ο)
It should have type functor but it's not inferring it.
Adam Topaz (Aug 21 2023 at 20:50):
Dean Young (Aug 21 2023 at 20:57):
This is the smallest portion of code which produces the "just a quiver" error:
variable {C : Cat}
#check (π C)
#check (π C).obj
I just need the identity functor is all but it won't infer it.
Jason Rute (Aug 21 2023 at 20:59):
Itβs not a #mwe if you donβt have all the imports
Adam Topaz (Aug 21 2023 at 21:03):
import Mathlib.CategoryTheory.Category.Cat
open CategoryTheory
variable (C : Cat)
#check (π C : C β₯€ C).obj
Adam Topaz (Aug 21 2023 at 21:05):
The issue you're facing is that Lean4 considers π C
as a morphism in Cat
, as opposed to a functor. Of course morphisms in Cat
are defined as the type of functors, but Lean4 has a hard time distinguishing the two without hints. If you want the identity functor as a functor, you can use π C
. E.g.:
import Mathlib.CategoryTheory.Category.Cat
open CategoryTheory
variable (C : Cat)
example : π C = π C := rfl
Last updated: Dec 20 2023 at 11:08 UTC