Grind Goal API for Symbolic Simulation #
This module provides an API for building symbolic simulation engines and
verification condition generators on top of grind. It wraps Sym operations
to work with grind's Goal type, enabling users to carry grind state
through symbolic execution while using lightweight Sym operations for
the main loop.
Typical usage pattern #
let goal ← mkGoal mvarId
let .goal xs goal ← goal.introN 2 | failure
let .goal goal ← goal.simp methods | failure
let goal ← goal.internalizeAll
-- ... symbolic execution loop using goal.apply ...
let .closed ← goal.grind | failure
Design #
Operations like introN, apply, and simp run in SymM for performance.
internalize and grind run in GrindM to access the E-graph.
Creates a Goal from an MVarId, applying Sym preprocessing.
Preprocessing ensures the goal is compatible with Sym operations.
Equations
- Lean.Meta.Grind.mkGoal mvarId = do let mvarId ← liftM (Lean.Meta.Sym.preprocessMVar mvarId) Lean.Meta.Grind.mkGoalCore mvarId
Instances For
- failed : IntrosResult
- goal (newDecls : Array FVarId) (goal : Goal) : IntrosResult
Instances For
Introduces num binders from the goal's target.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Introduces binders with the specified names.
Equations
- One or more equations did not get rendered due to their size.
Instances For
- failed : ApplyResult
- goals (subgoals : List Goal) : ApplyResult
Instances For
Applies a backward rule, returning subgoals on success.
Equations
- One or more equations did not get rendered due to their size.
Instances For
- noProgress : SimpGoalResult
- closed : SimpGoalResult
- goal (goal : Goal) : SimpGoalResult
Instances For
Simplifies the goal using the given methods.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Like simp, but returns the original goal unchanged when no progress is made.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Internalizes the next num hypotheses from the local context into the grind state (e.g., its E-graph).
Equations
- goal.internalize num = Lean.Meta.Grind.processHypotheses goal (some num)
Instances For
Internalizes all (un-internalized) hypotheses from the local context into the grind state.
Equations
- goal.internalizeAll = Lean.Meta.Grind.processHypotheses goal
Instances For
- failed (goal : Goal) : GrindResult
- closed : GrindResult
Instances For
Closes the goal if its target matches a hypothesis.
Returns true on success.
Equations
- goal.assumption = goal.mvarId.assumptionCore