Zulip Chat Archive
Stream: new members
Topic: universe polymorphism in Expressions
Edward van de Meent (Jan 08 2025 at 12:28):
I was trying to write a command with the functionality suggested in #mathlib4 > All instances satisfied by a type , while keeping the metaprogramming book by the hand, when i realised that i can't find how/if the environment knows that a certain declaration has universe polymorphism... does the ConstantInfo
somehow contain this information?
Marcus Rossel (Jan 08 2025 at 12:34):
I think if ConstantInfo.numLevelParams
is 0
, you shouldn't have any universe level parameters, so no universe polymorphism.
Edward van de Meent (Jan 08 2025 at 12:35):
aha!
Edward van de Meent (Jan 08 2025 at 12:36):
another relevant bit is docs#Lean.Level.param, i think
Marcus Rossel (Jan 08 2025 at 12:59):
Edward van de Meent said:
another relevant bit is docs#Lean.Level.param, i think
Yeah, I guess that depends on whether you're looking at declarations or Expr
s. If you're looking at Expr
s, you also need to consider docs#Lean.Level.mvar for polymorphism.
Edward van de Meent (Jan 08 2025 at 13:00):
i'd hope there are no level mvars in Environment.constants
, tho
Edward van de Meent (Jan 08 2025 at 13:01):
or mvars at all
Edward van de Meent (Jan 08 2025 at 13:02):
since they're the ones that should have been checked by the kernel
Marcus Rossel (Jan 08 2025 at 13:07):
Based on this explanation of how elaboration of universe levels works, I believe that's correct.
Last updated: May 02 2025 at 03:31 UTC