Equations
Instances For
Equations
Instances For
Removes the given declaration from s.
Instances For
Inserts declName ↦ prio into s.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Meta.Grind.getGlobalSymbolPriorities = do let __do_lift ← Lean.getEnv pure (Lean.ScopedEnvExtension.getState Lean.Meta.Grind.symbolPrioExt✝ __do_lift)
Instances For
Sets declName priority to be used during E-matching pattern inference
Equations
- Lean.Meta.Grind.addSymbolPriorityAttr declName attrKind prio = Lean.ScopedEnvExtension.add Lean.Meta.Grind.symbolPrioExt✝ { declName := declName, prio := prio } attrKind
Instances For
Equations
- Lean.Meta.Grind.mkOffsetPattern pat k = Lean.mkApp2 (Lean.mkConst `Lean.Grind.offset) pat (Lean.mkRawNatLit k)
Instances For
Equations
- Lean.Meta.Grind.mkEqBwdPattern u α lhs rhs = Lean.mkApp3 (Lean.mkConst `Lean.Grind.eqBwdPattern u) α lhs rhs
Instances For
Equations
- Lean.Meta.Grind.isEqBwdPattern e = e.isAppOfArity `Lean.Grind.eqBwdPattern 3
Instances For
Equations
- Lean.Meta.Grind.mkGenPattern u α h x val = Lean.mkApp4 (Lean.mkConst `Lean.Grind.genPattern u) α h x val
Instances For
Equations
- Lean.Meta.Grind.mkGenHEqPattern u α β h x val = Lean.mkApp5 (Lean.mkConst `Lean.Grind.genHEqPattern u) α β h x val
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns true if declName is the name of a match-expression congruence equation.
Equations
Instances For
- eqLhs (gen : Bool) : EMatchTheoremKind
- eqRhs (gen : Bool) : EMatchTheoremKind
- eqBoth (gen : Bool) : EMatchTheoremKind
- eqBwd : EMatchTheoremKind
- fwd : EMatchTheoremKind
- bwd (gen : Bool) : EMatchTheoremKind
- leftRight : EMatchTheoremKind
- rightLeft : EMatchTheoremKind
- default (gen : Bool) : EMatchTheoremKind
- user : EMatchTheoremKind
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Meta.Grind.instHashableEMatchTheoremKind.hash (Lean.Meta.Grind.EMatchTheoremKind.eqLhs a) = mixHash 0 (hash a)
- Lean.Meta.Grind.instHashableEMatchTheoremKind.hash (Lean.Meta.Grind.EMatchTheoremKind.eqRhs a) = mixHash 1 (hash a)
- Lean.Meta.Grind.instHashableEMatchTheoremKind.hash (Lean.Meta.Grind.EMatchTheoremKind.eqBoth a) = mixHash 2 (hash a)
- Lean.Meta.Grind.instHashableEMatchTheoremKind.hash Lean.Meta.Grind.EMatchTheoremKind.eqBwd = 3
- Lean.Meta.Grind.instHashableEMatchTheoremKind.hash Lean.Meta.Grind.EMatchTheoremKind.fwd = 4
- Lean.Meta.Grind.instHashableEMatchTheoremKind.hash (Lean.Meta.Grind.EMatchTheoremKind.bwd a) = mixHash 5 (hash a)
- Lean.Meta.Grind.instHashableEMatchTheoremKind.hash Lean.Meta.Grind.EMatchTheoremKind.leftRight = 6
- Lean.Meta.Grind.instHashableEMatchTheoremKind.hash Lean.Meta.Grind.EMatchTheoremKind.rightLeft = 7
- Lean.Meta.Grind.instHashableEMatchTheoremKind.hash (Lean.Meta.Grind.EMatchTheoremKind.default a) = mixHash 8 (hash a)
- Lean.Meta.Grind.instHashableEMatchTheoremKind.hash Lean.Meta.Grind.EMatchTheoremKind.user = 9
Instances For
Instances For
Instances For
Equations
- (Lean.Meta.Grind.EMatchTheoremKind.eqLhs true).toAttributeCore = "= gen"
- (Lean.Meta.Grind.EMatchTheoremKind.eqLhs false).toAttributeCore = "="
- (Lean.Meta.Grind.EMatchTheoremKind.eqRhs true).toAttributeCore = "=_ gen"
- (Lean.Meta.Grind.EMatchTheoremKind.eqRhs false).toAttributeCore = "=_"
- (Lean.Meta.Grind.EMatchTheoremKind.eqBoth false).toAttributeCore = "_=_"
- (Lean.Meta.Grind.EMatchTheoremKind.eqBoth true).toAttributeCore = "_=_ gen"
- Lean.Meta.Grind.EMatchTheoremKind.eqBwd.toAttributeCore = "←="
- Lean.Meta.Grind.EMatchTheoremKind.fwd.toAttributeCore = "→"
- (Lean.Meta.Grind.EMatchTheoremKind.bwd false).toAttributeCore = "←"
- (Lean.Meta.Grind.EMatchTheoremKind.bwd true).toAttributeCore = "← gen"
- Lean.Meta.Grind.EMatchTheoremKind.leftRight.toAttributeCore = "=>"
- Lean.Meta.Grind.EMatchTheoremKind.rightLeft.toAttributeCore = "<="
- (Lean.Meta.Grind.EMatchTheoremKind.default false).toAttributeCore = "."
- (Lean.Meta.Grind.EMatchTheoremKind.default true).toAttributeCore = ". gen"
- Lean.Meta.Grind.EMatchTheoremKind.user.toAttributeCore = ""
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
A theorem for heuristic instantiation based on E-matching.
It stores universe parameter names for universe polymorphic proofs. Recall that it is non-empty only when we elaborate an expression provided by the user. When
proofis just a constant, we can use the universe parameter names stored in the declaration.- proof : Expr
- numParams : Nat
Contains all symbols used in
patterns.- origin : Origin
- kind : EMatchTheoremKind
- minIndexable : Bool
Stores whether patterns were inferred using the minimal indexable subexpression condition.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Set of E-matching theorems.
Instances For
Returns true if there is a theorem with exactly the same pattern is already in s
Equations
- s.containsWithSamePatterns origin patterns = (Lean.Meta.Grind.Theorems.find s origin).any fun (thm : Lean.Meta.Grind.EMatchTheorem) => thm.patterns == patterns
Instances For
Equations
- s.getKindsFor origin = List.map (fun (x : Lean.Meta.Grind.EMatchTheorem) => x.kind) (Lean.Meta.Grind.Theorems.find s origin)
Instances For
Equations
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Auxiliary function to expand a pattern containing forbidden application symbols into a multi-pattern.
This function enhances the usability of the [grind =] attribute by automatically handling
forbidden pattern symbols. For example, consider the following theorem tagged with this attribute:
getLast?_eq_some_iff {xs : List α} {a : α} : xs.getLast? = some a ↔ ∃ ys, xs = ys ++ [a]
Here, the selected pattern is xs.getLast? = some a, but Eq is a forbidden pattern symbol.
Instead of producing an error, this function converts the pattern into a multi-pattern,
allowing the attribute to be used conveniently.
The function recursively expands patterns with forbidden symbols by splitting them into their sub-components. If the pattern does not contain forbidden symbols, it is returned as-is.
Equations
- Lean.Meta.Grind.mkGroundPattern e = Lean.mkAnnotation `grind.ground_pat e
Instances For
Equations
- Lean.Meta.Grind.groundPattern? e = Lean.annotation? `grind.ground_pat e
Instances For
Equations
Instances For
- symbolSet : Std.HashSet HeadIndex
- bvarsFound : Std.HashSet Nat
Instances For
- relevant : PatternArgKind
Argument is relevant for E-matching.
- instImplicit : PatternArgKind
Instance implicit arguments are considered support and handled using
isDefEq. - proof : PatternArgKind
Proofs are ignored during E-matching. Lean is proof irrelevant.
- typeFormer : PatternArgKind
Types and type formers are mostly ignored during E-matching, and processed using
isDefEq. However, if the argument is of the formC ..whereCis inductive type we process it as part of the pattern. Suppose we haveas bs : List α, and a pattern candidate expressionas ++ bs, i.e.,@HAppend.hAppend (List α) (List α) (List α) inst as bs. If we completely ignore the types, the pattern will just be@HAppend.hAppend _ _ _ _ #1 #0This is not ideal because the E-matcher will try it in any goal that contains
++, even if it does not even mention lists.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns an array kinds s.ts kinds[i] is the kind of the corresponding argument.
- a type (that is not a proposition) or type former (which has forward dependencies) or
- a proof, or
- an instance implicit argument
When kinds[i].isSupport is true, we say the corresponding argument is a "support" argument.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Auxiliary type for the checkCoverage function.
- ok : CheckCoverageResult
checkCoveragesucceeded - missing
(pos : List Nat)
: CheckCoverageResult
checkCoveragefailed because some of the theorem parameters are missing,poscontains their positions
Instances For
Creates an E-matching theorem for a theorem with proof proof, numParams parameters, and the given set of patterns.
Pattern variables are represented using de Bruijn indices.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Creates an E-matching theorem for declName with numParams parameters, and the given set of patterns.
Pattern variables are represented using de Bruijn indices.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a theorem with proof proof and type of the form ∀ (a_1 ... a_n), lhs = rhs,
creates an E-matching pattern for it using addEMatchTheorem n [lhs]
If normalizePattern is true, it applies the grind simplification theorems and simprocs to the pattern.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given theorem with name declName and type of the form ∀ (a_1 ... a_n), lhs = rhs,
creates an E-matching pattern for it using addEMatchTheorem n [lhs]
If normalizePattern is true, it applies the grind simplification theorems and simprocs to the
pattern.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Adds an E-matching theorem to the environment.
See mkEMatchTheorem.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Adds an E-matching equality theorem to the environment.
See mkEMatchEqTheorem.
Equations
- Lean.Meta.Grind.addEMatchEqTheorem declName = do let __do_lift ← Lean.Meta.Grind.mkEMatchEqTheorem declName Lean.ScopedEnvExtension.add Lean.Meta.Grind.ematchTheoremsExt✝ __do_lift
Instances For
Returns the E-matching theorems registered in the environment.
Equations
- Lean.Meta.Grind.getEMatchTheorems = do let __do_lift ← Lean.getEnv pure (Lean.ScopedEnvExtension.getState Lean.Meta.Grind.ematchTheoremsExt✝ __do_lift)
Instances For
Equations
- (Lean.Meta.Grind.EMatchTheoremKind.eqLhs gen).gen = gen
- (Lean.Meta.Grind.EMatchTheoremKind.eqRhs gen).gen = gen
- (Lean.Meta.Grind.EMatchTheoremKind.eqBoth gen).gen = gen
- (Lean.Meta.Grind.EMatchTheoremKind.default gen).gen = gen
- (Lean.Meta.Grind.EMatchTheoremKind.bwd gen).gen = gen
- Lean.Meta.Grind.EMatchTheoremKind.eqBwd.gen = false
- Lean.Meta.Grind.EMatchTheoremKind.fwd.gen = false
- Lean.Meta.Grind.EMatchTheoremKind.rightLeft.gen = false
- Lean.Meta.Grind.EMatchTheoremKind.leftRight.gen = false
- Lean.Meta.Grind.EMatchTheoremKind.user.gen = false
Instances For
Collects all singleton patterns in the type of the given proof.
We use this function to implement local forall expressions in a grind goal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Creates an E-match theorem using the given proof and kind.
If groundPatterns is true, it accepts patterns without pattern variables. This is useful for
theorems such as theorem evenZ : Even 0. For local theorems, we use groundPatterns := false
since the theorem is already in the grind state and there is nothing to be instantiated.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Lean.Meta.Grind.EMatchTheoremKind.user.toSyntax = Lean.throwError (Lean.toMessageData "`grind` theorem kind is not a modifier")
Instances For
Helper type for generating suggestions for grind parameters
- yes : MinIndexableMode
minIndexable := true - no : MinIndexableMode
minIndexable := false - both : MinIndexableMode
Tries with and without the minimal indexable subexpression condition, if both produce the same pattern, use the one
minIndexable := falsesince it is more compact.
Instances For
Tries different modifiers, logs info messages with modifiers that worked, but returns just the first one that worked.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Tries different modifiers, logs info messages with modifiers that worked, but stores just the first one that worked.
Remark: if backward.grind.inferPattern is true, then .default false is used.
The parameter showInfo is only taken into account when backward.grind.inferPattern is true.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.