The #find command and tactic. #
The #find command finds definitions & lemmas using pattern matching on the type. For instance:
#find _ + _ = _ + _
#find ?n + _ = _ + ?n
#find (_ : Nat) + _ = _ + _
#find Nat → Nat
Inside tactic proofs, there is a #find tactic with the same syntax,
or the find tactic which looks for lemmas which are applyable against the current goal.
Implementation notes #
The code blocks in this file use either the lean +error or code lean roles, since it is not yet
possible to forward-reference anything but declaration names. In other words, the docstring for
commands or tactics cannot reference the command or tactic being declared. (And in fact the #find
docstring would cause a panic in Lean if it tries to run the command.)
Equations
- One or more equations did not get rendered due to their size.
Instances For
#find t finds definitions and theorems whose result type matches the term t, and prints them as
info lines. Use holes in t to indicate arbitrary subexpressions, for example #find _ ∧ _ will
match any conjunction.
#find is also available as a tactic, and there is also the find tactic which looks for lemmas
which are applyable against the current goal.
Examples:
#find _ + _ = _ + _
#find ?n + _ = _ + ?n
#find (_ : Nat) + _ = _ + _
#find Nat → Nat
Equations
- One or more equations did not get rendered due to their size.
Instances For
find finds definitions and theorems whose result type matches the current goal exactly,
and prints them as info lines.
In other words, find lists definitions and theorems that are applyable against the current goal.
find will not affect the goal by itself and should be removed from the finished proof.
For a command or tactic that takes the type to search for as an argument, see #find.
Example:
example : True := by
find
-- True.intro: True
-- trivial: True
-- ...
Equations
- Mathlib.Tactic.Find.tacticFind = Lean.ParserDescr.node `Mathlib.Tactic.Find.tacticFind 1024 (Lean.ParserDescr.nonReservedSymbol "find" false)
Instances For
#find t finds definitions and theorems whose result type matches the term t, and prints them as
info lines. Use holes in t to indicate arbitrary subexpressions, for example #find _ ∧ _ will
match any conjunction. #find is also available as a command.
#find will not affect the goal by itself and should be removed from the finished proof.
There is also the find tactic which looks for lemmas which are applyable against the current
goal.
Examples:
#find _ + _ = _ + _
#find ?n + _ = _ + ?n
#find (_ : Nat) + _ = _ + _
#find Nat → Nat
Equations
- One or more equations did not get rendered due to their size.