Zulip Chat Archive

Stream: lean4

Topic: How are type universes handled in Lean 4 compared to MLTT?


Junseong O (Sep 20 2025 at 04:12):

In Martin-LΓΆf type theory, if we have A : Type u, then we also have A : Type (u+1) (by cumulativity).
However, in Lean 4, for example, Nat : Type (i.e. Nat : Type 0) does not seem to coerce naturally to Type 1, Type 2, or higher universes.
Could someone explain the formal aspects of Lean 4’s type universe system and how it differs from the usual presentation in classical type theory?

Lawrence Wu (llllvvuu) (Sep 20 2025 at 04:18):

in practice you can do docs#ULift

Junseong O (Sep 20 2025 at 04:28):

Oh I see!! Thank you so much :+1:

Junseong O (Sep 20 2025 at 04:32):

But isn’t this just introducing a new type inductively, rather than a judgment that the same type also belongs to a higher universe?

πš πš˜πš“πšŒπš’πšŽπšŒπš‘ πš—πšŠπš πš›πš˜πšŒπš”πš’ (Sep 20 2025 at 04:48):

Yeah, Lean does not have cumulative universes. We can use ULift, but that is not the same as having cumulativity. Consider A : Type 0 and B : A -> Type 1 so that (a : A) -> B a : Type 1. Then ULift.{2} A : Type 2 and ULift.{2} B : Type 2 and ULift.{2} ((a : A) -> B a) : Type 2. Now we can ask, is ULift.{2} ((a : A) -> B a) = (a : ULift.{2} A) -> ULift.{2} (B a.down), i.e., are the two types provably equal? The answer is no. In a type theory with cumulativity there is no question to be asked because ULifts are silent/not recorded in the terms.

πš πš˜πš“πšŒπš’πšŽπšŒπš‘ πš—πšŠπš πš›πš˜πšŒπš”πš’ (Sep 20 2025 at 04:51):

Note also that inductive and Pi type formation in Lean is implicitly cumulative. In the example above we get (a : A) -> B a : Type 1 even though A : Type 0. This is basically what lets Lean get away without having general cumulativity, and is the reason why we don't have to use ULift all the time. It would be unusable without this feature.

Junseong O (Sep 20 2025 at 05:05):

I see, thank you for the explanation. From which book (or resource) can I learn all the rules of Lean 4 as a formal language?

πš πš˜πš“πšŒπš’πšŽπšŒπš‘ πš—πšŠπš πš›πš˜πšŒπš”πš’ (Sep 20 2025 at 05:15):

#leantt is the most precise afaik.

Junseong O (Sep 20 2025 at 05:27):

Thank you!


Last updated: Dec 20 2025 at 21:32 UTC