fix: grind minor issues (#11244)

This PR fixes minor issues in `grind`. In preparation for adding `grind
-revert`.
This commit is contained in:
Leonardo de Moura 2025-11-18 14:11:20 -08:00 committed by GitHub
parent fa5d08b7de
commit 6dd8ad13e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View file

@ -91,6 +91,10 @@ where
return e'
preprocess (e : Expr) : M Expr := do
/-
**Note**: We must use `instantiateMVars` here because this function is called using the result of `inferType`.
-/
let e ← instantiateMVars e
/-
We must unfold reducible constants occurring in `prop` because the congruence closure
module in `grind` assumes they have been expanded.

View file

@ -1003,11 +1003,11 @@ def Goal.getENode? (goal : Goal) (e : Expr) : Option ENode :=
def getENode? (e : Expr) : GoalM (Option ENode) :=
return (← get).getENode? e
def throwNonInternalizedExpr (e : Expr) : CoreM α :=
def throwNonInternalizedExpr (e : Expr) : MetaM α :=
throwError "internal `grind` error, term has not been internalized{indentExpr e}"
/-- Returns node associated with `e`. It assumes `e` has already been internalized. -/
def Goal.getENode (goal : Goal) (e : Expr) : CoreM ENode := do
def Goal.getENode (goal : Goal) (e : Expr) : MetaM ENode := do
let some n := goal.enodeMap.find? { expr := e }
| throwNonInternalizedExpr e
return n
@ -1066,7 +1066,7 @@ def getRoot? (e : Expr) : GoalM (Option Expr) := do
return (← get).getRoot? e
/-- Returns the root element in the equivalence class of `e`. -/
def Goal.getRoot (goal : Goal) (e : Expr) : CoreM Expr :=
def Goal.getRoot (goal : Goal) (e : Expr) : MetaM Expr :=
return (← goal.getENode e).root
@[inline, inherit_doc Goal.getRoot]
@ -1091,7 +1091,7 @@ def Goal.getNext? (goal : Goal) (e : Expr) : Option Expr := Id.run do
return some n.next
/-- Returns the next element in the equivalence class of `e`. -/
def Goal.getNext (goal : Goal) (e : Expr) : CoreM Expr :=
def Goal.getNext (goal : Goal) (e : Expr) : MetaM Expr :=
return (← goal.getENode e).next
@[inline, inherit_doc Goal.getRoot]