Zulip Chat Archive

Stream: mathlib4

Topic: sort-valued hom in category


Kenny Lau (Oct 11 2025 at 17:25):

why does docs#CategoryTheory.Category not take Sort-valued hom?

Aaron Liu (Oct 11 2025 at 17:26):

I think it used to

Kevin Buzzard (Oct 11 2025 at 17:27):

We tried in Lean 3 and it didn't go well; AFAIK nobody tried in Lean 4.

Kenny Lau (Oct 11 2025 at 17:27):

do you remember what the problem was?

Yaël Dillies (Oct 11 2025 at 17:30):

Universe levels become more complicated, and in particular the universe unification algorithm didn't know how to solve for the universe levels in many common cases

Joël Riou (Oct 11 2025 at 17:31):

See #new members > ✔ Universe Restriction on CategoryTheory.Category @ 💬

Aaron Liu (Oct 11 2025 at 17:35):

I found mathlib3#1412

Kenny Lau (Oct 11 2025 at 17:36):

have we fixed the Category.{v} C bug yet? i.e. do we still have to write .{v} for the code to be performant?

Aaron Liu (Oct 11 2025 at 17:37):

I don't see this as a bug

Chris Henson (Oct 11 2025 at 17:57):

I've been referred to that issue and thread previously and still don't quite understand the problem. Would someone be willing to explain it again here?

Artie Khovanov (Oct 11 2025 at 23:31):

The bottom universe level - the universe of propositions - works differently to the others, which can cause problems in certain situations where Lean doesn't know whether a type is in the bottom universe. The obvious fix - which is to force these problematic types to not be in the bottom universe - causes a mess.
(did I understand right?)

Aaron Liu (Oct 11 2025 at 23:59):

Artie Khovanov said:

The bottom universe level - the universe of propositions - works differently to the others, which can cause problems in certain situations where Lean doesn't know whether a type is in the bottom universe. The obvious fix - which is to force these problematic types to not be in the bottom universe - causes a mess.
(did I understand right?)

Not sure what kind of mess you mean but this is the solution currently in mathlib and sometimes it's annoying to work with

François G. Dorais (Oct 12 2025 at 03:00):

Probably not helpful since it is counterintuitive: the basic category data should be the homomorphisms not the objects.

François G. Dorais (Oct 12 2025 at 03:01):

(That philosophy usually fixes all universe issues for me.)

Kenny Lau (Oct 12 2025 at 07:12):

@François G. Dorais we do place the homomorphisms first, which is why we have [Category.{v} C]

Kenny Lau (Oct 12 2025 at 07:13):

maybe using [Category.{v} C] will fix the problem we experienced in the past with sort-based hom?

François G. Dorais (Oct 12 2025 at 07:42):

I'm thinking about class Category {α : Sort _} (β : α → α → Sort _) where ... No need for .{v} since the homs are the principal argument.

Kenny Lau (Oct 12 2025 at 07:43):

it is expensive to unify functions

François G. Dorais (Oct 12 2025 at 07:43):

Works fine for me. But it's radically different.

François G. Dorais (Oct 12 2025 at 08:02):

I do use wrappers to ease class synthesis.

Kenny Lau (Oct 12 2025 at 08:02):

yes, we should use one-param structures

Joël Riou (Oct 12 2025 at 09:15):

It seems very unlikely that this could make it into mathlib.


Last updated: Dec 20 2025 at 21:32 UTC