Core tactics for working with Elab reflection. These will be used
by most reasonable scripts, and they may be candidates for
eventual Prelude inclusion.
Let-bind all results of completely destructuring nested tuples.
This makes them available to the hypothesis
tactic, among others.
the nested tuple to destructure
Attempt to apply a tactic. If it fails, do nothing.
Do nothing
Restrict a polymorphic type to () for contexts where it doesn't
matter. This is nice for sticking debug
in a context where
Idris can't solve the type.
Repeat a given tactic until it fails. Fails if the tactic fails on
the first attempt; succeeds otherwise.
Remember a term built with elaboration for later use. If the
current goal is h
, then remember n ty
puts a fresh hole at
the front of the queue, with the old goal h
second. The
contents of this hole end up let-bound in the scope of
h
. Return the name of the new hole, in case it will be used
later.
the name to be used to save the term
the type to inhabit
A special-purpose tactic that attempts to solve a goal using
Refl
. This is useful for ensuring that goals in fact are trivial
when developing or testing other tactics; otherwise, consider
using search
.
Refine the current goal using some term, constructing holes for
all arguments that can't be inferred. Return the list of generated
holes.
the term to apply to some number of goals
Create a new hole with a given type without changing the
focus. Return the name of the hole.
the hint to pass to gensym
the type of the new hole
Generate a unique name (using gensym
) that looks like some
previous name, for ease of debugging code generators.
Introduce as many names as possible, returning them.
Run a tactic script in a context where the type of the resulting
expression must be solvable via unification. Return the term and
its type.
a tactic script that will be run with focus on the hole
whose type is to be inferred.
Run a tactic inside of a particular hole, if it still exists. If
it has been solved, do nothing.
Run something for effects, throwing away the return value
Solve the goal using the most recent applicable hypothesis
Get the name at the head of the term, if it exists.
Get the goal type as a Raw term. Fails if there are no holes.
Remove type information from a TT
term, in a context. Fails if
de Bruijn indices are out of scope.
Remove type information from a TT
term. Fails if de Bruijn
indices are out of scope.
Use a term to solve a hole
the term that has the right type for the hole
Replace the current goal with one that's definitionally
equal. Return the name of the new goal, and ensure that it's
focused.
A type that is equivalent to the current goal
Split a pair into its projections, binding them in the context
with the supplied names. A special case of Coq's inversion
.
If the current goal is a pattern-bound variable, bind it with the
expected name. Otherwise fail.
Given one tactic that produces a list of subgoal names and another
that produces some result, run the second tactic in each hole
produced by the first and return the resulting values.
Elab has no built-in notion of "subgoals", so this simulates the
Coq or JonPRL semicolon operators.
run this tactic to produce subgoals
run this tactic in each subgoal
The underlying implementation type for the inferType operator.