Skip to content

Commit 8a0ee9a

Browse files
authored
fix: assigned universe metavars in grind (#11247)
This PR fixes an issue in the `grind` preprocessor. `simp` may introduce assigned (universe) metavariables (e.g., when performing zeta-reduction).
1 parent 6dd8ad1 commit 8a0ee9a

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/Lean/Meta/Tactic/Grind/Core.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,7 @@ private def processNewFactsImpl : GoalM Unit := do
335335
resetNewFacts
336336
return ()
337337
checkSystem "grind"
338-
let some next := (← popNextFact?)
339-
| return ()
338+
let some next ← popNextFact? | return ()
340339
match next with
341340
| .eq lhs rhs proof isHEq => addEqStep lhs rhs proof isHEq
342341
| .fact prop proof gen => addFactStep prop proof gen

src/Lean/Meta/Tactic/Grind/Simp.lean

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ and then applies several other preprocessing steps.
4848
def preprocess (e : Expr) : GoalM Simp.Result := do
4949
let e ← instantiateMVars e
5050
let r ← simpCore e
51-
let e' := r.expr
51+
/-
52+
**Note**: Some transformation performed by `simp` may introduce metavariables.
53+
Example: zeta-reduction. Recall that `simp` does not necessarily visit every subterm.
54+
In particular, it does not visit universe terms and does not instantiate them.
55+
-/
56+
let e' ← instantiateMVars r.expr
5257
-- Remark: `simpCore` unfolds reducible constants, but it does not consistently visit all possible subterms.
5358
-- So, we must use the following `unfoldReducible` step. It is non-op in most cases
5459
let e' ← unfoldReducible e'

0 commit comments

Comments
 (0)