Documentation

Lean.Meta.Tactic.Grind.EMatch

This module implements a simple E-matching procedure as a backtracking search.

We represent an E-matching problem as a list of constraints.

  • match (pat e : Expr) : Cnstr

    Matches pattern pat with term e

  • continue (pat : Expr) : Cnstr

    This constraint is used to encode multi-patterns.

Instances For

    Choice point for the backtracking search. The state of the procedure contains a stack of choices.

    • cnstrs : List Cnstr

      Contraints to be processed.

    • gen : Nat

      Maximum term generation found so far.

    • assignment : Array Expr

      Partial assignment so far. Recall that pattern variables are encoded as de-Bruijn variables.

    Instances For

      Context for the E-matching monad.

      • useMT : Bool

        useMT is true if we are using the mod-time optimization. It is always set to false for new EMatchTheorems.

      • EMatchTheorem being processed.

      Instances For

        State for the E-matching monad

        • choiceStack : List Choice

          Choices that still have to be processed.

        Instances For
          def Lean.Meta.Grind.EMatch.M.run' {α : Type} (x : M α) :
          Equations
          • x.run' = (x { useMT := true, thm := default }).run' { choiceStack := [] }
          Instances For
            Equations
            • One or more equations did not get rendered due to their size.
            Instances For

              When using the mod-time optimization with multi-patterns, we must start ematching at each different pattern. That is, if we have [p₁, p₂, p₃], we must execute

              Equations
              Instances For

                Performs one round of E-matching, and returns new instances.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Performs one round of E-matching, and assert new instances.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For