Zulip Chat Archive

Stream: Is there code for X?

Topic: isomorphism of functors


Aaron Liu (Nov 18 2025 at 21:12):

Is there a way to say two functors are isomorphic? That is, given two functors F and G I want the type of natural isomorphisms between F and G. This is talking about docs#LawfulFunctor, not those category-theory functors. Ideally I would want this to be as universe-polymorphic as possible, so the domain and codomain of F and G can be four different universes (I guess if they're in different universes this would be saying the one functor naturally extends the other functor into the higher universe).

Yaël Dillies (Nov 18 2025 at 21:18):

Have you considered turning the Type functors into category theory functors, then use categorical isomorphisms?

Aaron Liu (Nov 18 2025 at 21:19):

that sound like a lot of work and also not universe polymorphic

Yaël Dillies (Nov 18 2025 at 21:19):

I agree, but whether universe polymorphism is worth fighting for depends on your application: What's your application?

Yaël Dillies (Nov 18 2025 at 21:20):

To be clear, my suggestion works today:

Aaron Liu (Nov 18 2025 at 21:21):

For defining CGT#GameFunctor

Yaël Dillies (Nov 18 2025 at 21:21):

@loogle Functor, CategoryTheory.Functor

Aaron Liu (Nov 18 2025 at 21:21):

well not the definition but using the fact that it's a quotient of a polynomial functor

Yaël Dillies (Nov 18 2025 at 21:22):

Can you clearly say what two functors you want to state are isomorphic?

Aaron Liu (Nov 18 2025 at 21:23):

The CGT#GameFunctor and the quotient of the polynomial functor in the QPF instance we put on it

Aaron Liu (Nov 18 2025 at 21:23):

across all the universes

Yaël Dillies (Nov 18 2025 at 21:34):

Great, but can you give their types? I see GameFunctor : Type (u + 1) -> Type (u + 1). What about the other one?

Matt Diamond (Nov 18 2025 at 21:38):

not sure why loogle didn't work above but I'm guessing Yael was trying to surface docs#CategoryTheory.ofTypeFunctor

Aaron Liu (Nov 18 2025 at 21:39):

probably I think it will be Type v -> Type (max v (u + 1))

Matt Diamond (Nov 18 2025 at 21:40):

ofTypeFunctor seems to support universe polymorphic functors? but I could be misreading it

Aaron Liu (Nov 18 2025 at 21:40):

Yaël Dillies said:

@loogle Functor, CategoryTheory.Functor

@loogle Functor, CategoryTheory.Functor

loogle (Nov 18 2025 at 21:40):

:search: CategoryTheory.ofTypeFunctor

Matt Diamond (Nov 18 2025 at 21:40):

yeah, that's what I thought

Aaron Liu (Nov 18 2025 at 21:41):

Matt Diamond said:

ofTypeFunctor seems to support universe polymorphic functors? but I could be misreading it

But surely we don't support natural isomorphisms between functors with different source/target categories

Aaron Liu (Nov 18 2025 at 21:42):

so if I have a functor Type u -> Type v and another one Type u' -> Type v' then I don't expect to be able to state that they're compatible using the category theory machinery since they're different types

Matt Diamond (Nov 18 2025 at 21:43):

you're probably right but I would confirm by looking at docs#CategoryTheory.Functor.category, which is what you end up doing the iso in

Matt Diamond (Nov 18 2025 at 21:43):

yeah that's true, C and D are fixed

Matt Diamond (Nov 18 2025 at 21:44):

alright yeah, not universe polymorphic then

Christian Merten (Nov 19 2025 at 08:45):

The battle tested way is to suitably compose with docs#CategoryTheory.uliftFunctor.

Aaron Liu (Nov 19 2025 at 11:01):

then I have ulifts everywhere

Aaron Liu (Nov 19 2025 at 11:01):

I guess it's not impossible to work with

Aaron Liu (Nov 19 2025 at 11:01):

so now I have to import category theory too?

Yaël Dillies (Nov 19 2025 at 11:02):

Why do you need universes? Is it not enough to talk about your second functor when v := u + 1?

Aaron Liu (Nov 19 2025 at 11:03):

For coinduction it took a lot of effort to make it universe polymorphic

Aaron Liu (Nov 19 2025 at 11:04):

so I'm thinking can I upstream some of this into QPF but then this requires refactoring it to be bundled

Aaron Liu (Nov 19 2025 at 11:04):

so I want to say that the bundled QPF is iso to the nicer description

Yaël Dillies (Nov 19 2025 at 11:07):

What do you want to do with the isomorphism? What is its envisioned application?

Aaron Liu (Nov 19 2025 at 11:08):

Transfer the coinduction principle across it

Aaron Liu (Nov 19 2025 at 11:09):

I guess another perspective would be transfer the cofixpoint across

Aaron Liu (Nov 19 2025 at 11:09):

The one functor has a terminal coalgebra so the other functor also does since it's isomorphic

Aaron Liu (Nov 19 2025 at 11:09):

oh and probably the same thing dually for the initial algebra

Yaël Dillies (Nov 19 2025 at 11:14):

So do you really need a way to state the isomorphism? Why don't simply write down the natural transformation by hand both ways?

Aaron Liu (Nov 19 2025 at 11:14):

That's the plan

Aaron Liu (Nov 19 2025 at 11:15):

I was hoping there would be a way to write lemmas about this though

Aaron Liu (Nov 19 2025 at 11:15):

lemmas which don't only apply to my one specific natiso

Yaël Dillies (Nov 19 2025 at 11:15):

This seems to be a niche enough application that writing one off lemmas seems fine

Aaron Liu (Nov 19 2025 at 11:18):

Christian Merten said:

The battle tested way is to suitably compose with docs#CategoryTheory.uliftFunctor.

I don't think that works, because the source categories are also in different universes, and ulift only lifts up so the direction of composition means I can only push these source universes down, which loses information about what happens to big types

Aaron Liu (Nov 19 2025 at 11:19):

there's also no good candidate for which universe I would descend to, there's no universe min like there is a max


Last updated: Dec 20 2025 at 21:32 UTC