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 : Lean.Expr)
: Lean.Meta.Grind.EMatch.Cnstr
Matches pattern
pat
with terme
- continue
(pat : Lean.Expr)
: Lean.Meta.Grind.EMatch.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 Lean.Meta.Grind.EMatch.Cnstr
Contraints to be processed.
- gen : Nat
Maximum term generation found so far.
Partial assignment so far. Recall that pattern variables are encoded as de-Bruijn variables.
Instances For
Equations
- Lean.Meta.Grind.EMatch.instInhabitedChoice = { default := { cnstrs := default, gen := default, assignment := default } }
Equations
- Lean.Meta.Grind.EMatch.instInhabitedContext = { default := { useMT := default, thm := default } }
State for the E-matching monad
- choiceStack : List Lean.Meta.Grind.EMatch.Choice
Choices that still have to be processed.
Instances For
Equations
- Lean.Meta.Grind.EMatch.instInhabitedState = { default := { choiceStack := default } }
Equations
Instances For
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
main p₁ [.continue p₂, .continue p₃]
main p₂ [.continue p₁, .continue p₃]
main p₃ [.continue p₁, .continue p₂]
Equations
- One or more equations did not get rendered due to their size.
- Lean.Meta.Grind.EMatch.ematchTheorem.tryAll [] cs = pure ()
Instances For
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.