solve_by_elim #
A depth-first search backwards reasoner.
solve_by_elim
takes a list of lemmas, and repeating tries to apply
these against
the goals, recursively acting on any generated subgoals.
It accepts a variety of configuration options described below, enabling
- backtracking across multiple goals,
- pruning the search tree, and
- invoking other tactics before or after trying to apply lemmas.
At present it has no "premise selection", and simply tries the supplied lemmas in order at each step of the search.
apply_assumption
looks for an assumption of the form ... → ∀ _, ... → head
where head
matches the current goal.
If this fails, apply_assumption
will call symmetry
and try again.
If this also fails, apply_assumption
will call exfalso
and try again,
so that if there is an assumption of the form P → ¬ Q
, the new tactic state
will have two goals, P
and Q
.
Optional arguments:
lemmas
: a list of expressions to apply, instead of the local constantstac
: a tactic to run on each subgoal after applying an assumption; if this tactic fails, the corresponding assumption will be rejected and the next one will be attempted.
solve_by_elim
calls apply
on the main goal to find an assumption whose head matches
and then repeatedly calls apply
on the generated subgoals until no subgoals remain,
performing at most max_depth
recursive steps.
solve_by_elim
discharges the current goal or fails.
solve_by_elim
performs back-tracking if subgoals can not be solved.
By default, the assumptions passed to apply
are the local context, rfl
, trivial
,
congr_fun
and congr_arg
.
The assumptions can be modified with similar syntax as for simp
:
solve_by_elim [h₁, h₂, ..., hᵣ]
also applies the named lemmas.solve_by_elim with attr₁ ... attrᵣ
also applies all lemmas tagged with the specified attributes.solve_by_elim only [h₁, h₂, ..., hᵣ]
does not include the local context,rfl
,trivial
,congr_fun
, orcongr_arg
unless they are explicitly included.solve_by_elim [-id_1, ... -id_n]
uses the default assumptions, removing the specified ones.
solve_by_elim*
tries to solve all goals together, using backtracking if a solution for one goal
makes other goals impossible.
optional arguments passed via a configuration argument as solve_by_elim { ... }
- max_depth: number of attempts at discharging generated sub-goals
- discharger: a subsidiary tactic to try at each step when no lemmas apply
(e.g.
cc
may be helpful). - pre_apply: a subsidiary tactic to run at each step before applying lemmas (e.g.
intros
). - accept: a subsidiary tactic
list expr → tactic unit
that at each step, before any lemmas are applied, is passed the original proof terms as reported byget_goals
whensolve_by_elim
started (but which may by now have been partially solved by previousapply
steps). If theaccept
tactic fails,solve_by_elim
will abort searching the current branch and backtrack. This may be used to filter results, either at every step of the search, or filtering complete results (by testing for the absence of metavariables, and then the filtering condition).