Open eric-wieser opened 10 months ago
I don't understand the motivation here. slim_check
should not be sampling from higher universes in the first place.
e.g.
import Std
example : ∃ (α : Type _) (l : List α), l ≠ l ++ l := by
refine ⟨Int, ?_⟩
refine ⟨[37], ?_⟩
simp
That example is a bit misleading, because Lean unifies the _
to 0
. It fails if you use Type u
.
leanprover-community/mathlib4#9135 makes slim_check
work on that statement, but it can't easily be generalized to do work in the IO
monad unless we make the change suggested in this RFC.
How would you ever make use of a higher-universe IO
if main
etc. remain in IO.{0}
?
Making EStateM.bind
universe-polymorphic, as I do in https://github.com/leanprover/lean4/pull/3010, is sufficient I think. You wouldn't be able to use do notation to jump between universes, but you could call EStateM.bind
directly, or an IO.bind
wrapper for it.
Proposal
Right now, we have
IO : Type → Type
. This RFC suggests we change toIO : Type u → Type u
.This RFC does not suggest:
User Experience: How does this feature improve the user experience?
IO.ofExcept
will not get weird universe errors if they pass in anExcept
from a higher universeIO
monad and a hand-rolledIOButHigherUniverse
Beneficiaries: Which Lean users and projects benefit most from this feature/change?
slim_check
, which currently, in order to sample from types in higher universes, needs the monad itself to produce values in those universesULiftable
infrastructure would be usable withIO
; currently it cannot be becauseIO
doesn't form a family of types over universes.Maintainability: Will this change streamline code maintenance or simplify its structure?
(a b : Type u)
s with(a : Type u) (b : Type v)
; the consequences are negligible.Community Feedback
Some initial discussion, which suggests some benefit would arise even from just changing
IO
to allow higher universes: https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/universe.20polymorphic.20IO/near/282494539Impact
Add :+1: to issues you consider important. If others benefit from the changes in this proposal being added, please ask them to add :+1: to it.