Zulip Chat Archive
Stream: mathlib4
Topic: Qq with mkFreshLevelMVar
Eric Wieser (Jul 13 2023 at 12:10):
Is there a way to make this work?
def FinEta.prove (m n : ℕ) : MetaM (Expr × Expr) :=
do
let u ← mkFreshLevelMVar
let α ← mkFreshExprMVarQ q(Sort $u) (userName := `α)
sorry
It complains with "incompatible metavariable _uniq.1356"
Thomas Murrills (Jul 13 2023 at 12:54):
I don't fully understand why, but Level
s seem to transcend (anti)quotation in Qq. That means that this no longer complains once we also include the required Qq type annotation:
def FinEta.prove (m n : ℕ) : MetaM (Expr × Expr) := do
let u ← mkFreshLevelMVar
let α ← mkFreshExprMVarQ (q(Sort u) : Q(Type u)) (userName := `α)
sorry
However, since I don't understand why it works, I can't guarantee some other error won't pop up later. But at least it's a start :)
Eric Wieser (Jul 13 2023 at 13:06):
Indeed, duplicating my types everywhere seemed to solve the problem
Eric Wieser (Jul 13 2023 at 13:06):
(The code in question is FinEta.prove
from #5863)
Wojciech Nawrocki (Jul 13 2023 at 17:20):
Note that universe levels are not dollar-quoted (issue). One can also write
def FinEta.prove (m n : ℕ) : MetaM (Expr × Expr) :=
do
let u ← mkFreshLevelMVar
let α ← mkFreshExprMVarQ (u := u.succ) q(Sort u) (userName := `α)
sorry
Last updated: Dec 20 2023 at 11:08 UTC