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?
Equations
- Lean.Meta.LibrarySearch.instDecidableEqDeclMod x✝ y✝ = if h : x✝.toCtorIdx = y✝.toCtorIdx then isTrue ⋯ else isFalse ⋯
Equations
Equations
LibrarySearch has an extension mechanism for replacing the function used to find candidate lemmas.
We drop .star
and Eq * * *
from the discriminator trees because
they match too much.
Equations
- One or more equations did not get rendered due to their size.
Interleave x y interleaves the elements of x and y until one is empty and then returns final elements in other list.
Equations
- One or more equations did not get rendered due to their size.
Called to abort speculative execution in library search.
Returns true if this is an abort speculation exception.
A library search candidate using symmetry includes the goal to solve, the metavar context for that goal, and the name and orientation of a rule to try using with goal.
Run searchFn
on both the goal and symm
applied to the goal.
Equations
- One or more equations did not get rendered due to their size.
Sequentially invokes a tactic act
on each value in candidates on the current state.
The tactic act
should return a list of meta-variables that still need to be resolved.
If this list is empty, then no variables remain to be solved, and tryOnEach
returns
none
with the environment set so each goal is resolved.
If the action throws an internal exception with the abortSpeculationId
id then
further computation is stopped and intermediate results returned. If any other
exception is thrown, then it is silently discarded.
Equations
- One or more equations did not get rendered due to their size.
Tries to solve the goal either by:
- calling
tactic true
- or applying a library lemma then calling
tactic false
on the resulting goals.
Typically here tactic
is solveByElim
,
with the Bool
flag indicating whether it may retry with exfalso
.
If it successfully closes the goal, returns none
.
Otherwise, it returns some a
, where a : Array (List MVarId × MetavarContext)
,
with an entry for each library lemma which was successfully applied,
containing a list of the subsidiary goals, and the metavariable context after the application.
(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.