Documentation

Lean.Meta.Sym.Grind

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 goalmkGoal 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.

Instances For
    Instances For

      Introduces num binders from the goal's target.

      Instances For

        Introduces binders with the specified names.

        Instances For
          Instances For

            Applies a backward rule, returning subgoals on success.

            Instances For
              Instances For

                Simplifies the goal using the given methods.

                Instances For

                  Like simp, but returns the original goal unchanged when no progress is made.

                  Instances For

                    Internalizes the next num hypotheses from the local context into the grind state (e.g., its E-graph).

                    Instances For

                      Internalizes all (un-internalized) hypotheses from the local context into the grind state.

                      Instances For
                        Instances For

                          Attempts to close the goal using grind. Returns .closed on success, or .failed with the first subgoal that failed to be closed.

                          Instances For

                            Closes the goal if its target matches a hypothesis. Returns true on success.

                            Instances For