#
Generally useful tactics.
Return the modifiers of declaration nm
with (optional) docstring newDoc
.
Currently, recursive or partial definitions are not supported, and no attributes are provided.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Make a PreDefinition taking some metadata from declaration nm
.
You can provide a new type, value and (optional) docstring, but the remaining information is taken
from nm
.
Currently only implemented for definitions and theorems. Also see docstring of toModifiers
Equations
- One or more equations did not get rendered due to their size.
Instances For
Make nm
protected.
Equations
- Lean.setProtected nm = Lean.modifyEnv fun (x : Lean.Environment) => Lean.addProtected x nm
Instances For
Introduce variables, giving them names from a specified list.
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
Extract the arguments from a simpArgs
syntax as an array of syntaxes
Equations
- One or more equations did not get rendered due to their size.
Instances For
Extract the arguments from a dsimpArgs
syntax as an array of syntaxes
Equations
- One or more equations did not get rendered due to their size.
Instances For
Extract the arguments from a withArgs
syntax as an array of syntaxes
Equations
- One or more equations did not get rendered due to their size.
Instances For
Extract the argument from a usingArg
syntax as a syntax term
Equations
- One or more equations did not get rendered due to their size.
Instances For
repeat1 tac
applies tac
to main goal at least once. If the application succeeds,
the tactic is applied recursively to the generated subgoals until it eventually fails.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Given a local context and an array of FVarIds
assumed to be in that local context, remove all
implementation details.
Equations
- Lean.Elab.Tactic.filterOutImplementationDetails lctx fvarIds = Array.filter (fun (fvar : Lean.FVarId) => !(lctx.fvarIdToDecl.find! fvar).isImplementationDetail) fvarIds 0
Instances For
Elaborate syntax for an FVarId
in the local context of the given goal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Get the array of FVarId
s in the local context of the given goal
.
If ids
is specified, elaborate them in the local context of the given goal to obtain the array of
FVarId
s.
If includeImplementationDetails
is false
(the default), we filter out implementation details
(implDecl
s and auxDecl
s) from the resulting list of FVarId
s.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Run a tactic on all goals, and always succeeds.
(This is parallel to Lean.Elab.Tactic.evalAllGoals
in core,
which takes a Syntax
rather than TacticM Unit
.
This function could be moved to core and evalAllGoals
refactored to use it.)
Equations
- One or more equations did not get rendered due to their size.
Instances For
Simulates the <;>
tactic combinator. First runs tac1
and then runs
tac2
on all newly-generated subgoals.
Equations
- Lean.Elab.Tactic.andThenOnSubgoals tac1 tac2 = Lean.Elab.Tactic.focus do tac1 Lean.Elab.Tactic.allGoals tac2
Instances For
Repeats a tactic at most n
times, stopping sooner if the
tactic fails. Always succeeds.
Equations
- Lean.Elab.Tactic.iterateAtMost 0 x = pure ()
- Lean.Elab.Tactic.iterateAtMost n.succ x = tryCatch (do x Lean.Elab.Tactic.iterateAtMost n x) fun (x : Lean.Exception) => pure ()
Instances For
iterateExactly' n t
executes t
n
times. If any iteration fails, the whole tactic fails.
Equations
- Lean.Elab.Tactic.iterateExactly' 0 x = pure ()
- Lean.Elab.Tactic.iterateExactly' n.succ x = SeqRight.seqRight x fun (x_1 : Unit) => Lean.Elab.Tactic.iterateExactly' n x
Instances For
iterateRange m n t
: Repeat the given tactic at least m
times and
at most n
times or until t
fails. Fails if t
does not run at least m
times.
Equations
- Lean.Elab.Tactic.iterateRange 0 0 x = pure ()
- Lean.Elab.Tactic.iterateRange 0 x✝ x = Lean.Elab.Tactic.iterateAtMost x✝ x
- Lean.Elab.Tactic.iterateRange a.succ x✝ x = do x Lean.Elab.Tactic.iterateRange a (x✝ - 1) x
Instances For
Repeats a tactic until it fails. Always succeeds.
iterateUntilFailureWithResults
is a helper tactic which accumulates the list of results
obtained from iterating tac
until it fails. Always succeeds.
iterateUntilFailureCount
is similar to iterateUntilFailure
except it counts
the number of successful calls to tac
. Always succeeds.
Equations
- Lean.Elab.Tactic.iterateUntilFailureCount tac = do let r ← Lean.Elab.Tactic.iterateUntilFailureWithResults tac pure r.length
Instances For
Returns the root directory which contains the package root file, e.g. Mathlib.lean
.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Returns the mathlib root directory.
Equations
- Mathlib.getMathlibDir = Mathlib.getPackageDir "Mathlib"