This file provides an alternative implementation for apply
to fix the so-called "apply bug".
The issue arises when the goals is a Π-type -- whether it is visible or hidden behind a definition.
For instance, consider the following proof:
example {α β} (x y z : α → β) (h₀ : x ≤ y) (h₁ : y ≤ z) : x ≤ z :=
begin
apply le_trans,
end
Because x ≤ z
is definitionally equal to ∀ i, x i ≤ z i
, apply
will fail. The alternative
definition, apply'
fixes this. When apply
would work, apply
is used and otherwise,
a different strategy is deployed
With gs
a list of proof goals, reorder_goals gs new_g
will use the new_goals
policy
new_g
to rearrange the dependent goals to either drop them, push them to the end of the list
or leave them in place. The bool
values in gs
indicates whether the goal is dependent or not.
Equations
- tactic.reorder_goals gs tactic.new_goals.all = list.map prod.snd gs
- tactic.reorder_goals gs tactic.new_goals.non_dep_only = list.map prod.snd (list.filter (coe ∘ bnot ∘ prod.fst) gs)
- tactic.reorder_goals gs tactic.new_goals.non_dep_first = tactic.reorder_goals._match_1 (list.partition (coe ∘ prod.fst) gs)
- tactic.reorder_goals._match_1 (dep, non_dep) = list.map prod.snd non_dep ++ list.map prod.snd dep