Library search #
This file defines tactics exact?
and apply?
,
(formerly known as library_search
)
and a term elaborator exact?%
that tries to find a lemma
solving the current goal
(subgoals are solved using solveByElim
).
example : x < x + 1 := exact?%
example : Nat := by exact?
Configuration for DiscrTree
.
Equations
- Mathlib.Tactic.LibrarySearch.discrTreeConfig = { iota := true, beta := true, proj := Lean.Meta.ProjReductionKind.yesWithDelta, zeta := true }
Instances For
A "modifier" for a declaration.
none
indicates the original declaration,mp
indicates that (possibly after binders) the declaration is an↔
, and we want to consider the forward direction,mpr
similarly, but for the backward direction.
- none: Mathlib.Tactic.LibrarySearch.DeclMod
- mp: Mathlib.Tactic.LibrarySearch.DeclMod
- mpr: Mathlib.Tactic.LibrarySearch.DeclMod
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Prepare the discrimination tree entries for a lemma.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Construct the discrimination tree of all lemmas.
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
Retrieve the current current of lemmas.
Shortcut for calling solveByElim
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Try applying the given lemma (with symmetry modifier) to the goal,
then try to close subsequent goals using solveByElim
.
If solveByElim
succeeds, we return []
as the list of new subgoals,
otherwise the full list of subgoals.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns a lazy list of the results of applying a library lemma,
then calling solveByElim
on the resulting goals.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Run librarySearchCore
on both the goal and symm
applied to the goal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A type synonym for our subgoal ranking algorithm.
Instances For
Equations
- Mathlib.Tactic.LibrarySearch.instOrdSubgoalRankType = let_fun this := lexOrd; lexOrd
Returns a tuple:
- are there no remaining goals?
- how many local hypotheses were used?
- how many goals remain, negated?
Larger values (i.e. no remaining goals, more local hypotheses, fewer remaining goals) are better.
Equations
- Mathlib.Tactic.LibrarySearch.subgoalRanking goal subgoals = do let __do_lift ← Lean.Meta.countLocalHypsUsed (Lean.Expr.mvar goal) pure (List.isEmpty subgoals, __do_lift, -↑(List.length subgoals))
Instances For
Sort the incomplete results from librarySearchCore
according to
- the number of local hypotheses used (the more the better) and
- the number of remaining subgoals (the fewer the better).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Try to solve the goal either by:
- calling
solveByElim
- or applying a library lemma then calling
solveByElim
on the resulting goals.
If it successfully closes the goal, returns none
.
Otherwise, it returns some a
, where a : Array (MetavarContext × List MVarId)
,
with an entry for each library lemma which was successfully applied,
containing the metavariable context after the application, and a list of the subsidiary goals.
(Always succeeds, and the metavariable context stored in the monad is reverted, unless the goal was completely solved.)
(Note that if solveByElim
solves some but not all subsidiary goals,
this is not currently tracked.)
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.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Mathlib.Tactic.LibrarySearch.«termExact?%» = Lean.ParserDescr.node `Mathlib.Tactic.LibrarySearch.termExact?% 1024 (Lean.ParserDescr.symbol "exact?%")