Zulip Chat Archive

Stream: mathlib4

Topic: Obj component in `Cat`


Dean Young (Aug 16 2023 at 18:44):

Mathlib has Cat (which I've imported from Category.Cat). How do you access the object component of a particular term t : Cat?

Jason Rute (Aug 16 2023 at 19:53):

I think it is exposed via t.α. More specifically, docs#CategoryTheory.Cat is the type made up of every docs#CategoryTheory.Bundled t containing a type α : Type u and some category structure str : Category α on α. So t.α is the carrier (object component) for the category t.str. (Note, the carrier is not a data field in the class docs#CategoryTheory.Category, but a parameter of Category, which is why Cat and Bundle look the way they do.)

Jason Rute (Aug 16 2023 at 20:00):

import Mathlib.CategoryTheory.Category.Cat

#check fun (t : CategoryTheory.Cat) => ((t.α : Type _), (t.str : CategoryTheory.Category t.α))

Eric Wieser (Aug 16 2023 at 20:11):

I think you're supposed to just cast, which inserts the automatically:

import Mathlib.CategoryTheory.Category.Cat

#check fun t : CategoryTheory.Cat => ((t : Type _), (inferInstance : CategoryTheory.Category t))

Dean Young (Aug 16 2023 at 22:55):

Thanks this is great.


Last updated: Dec 20 2023 at 11:08 UTC