Debian Codegraph @

src/Util/Tactics/Forward.v

raw
1 (** [forward H] specializes non-dependent binders in a hypothesis [H]
2 with side-conditions. Side-conditions come after the main goal,
3 like with [replace] and [rewrite].
4
5 [eforward H] is like [forward H], but also specializes dependent
6 binders with evars.
7
8 Both tactics do nothing on hypotheses they cannot handle. *)
9 Ltac forward_step H :=
10 match type of H with
11 | ?A -> ?B => let a := fresh in cut A; [ intro a; specialize (H a); clear a | ]
12 end.
13 Ltac eforward_step H :=
14 match type of H with
15 | _ => forward_step H
16 | forall x : ?A, _
17 => let x_or_fresh := fresh x in
18 evar (x_or_fresh : A);
19 specialize (H x_or_fresh); subst x_or_fresh
20 end.
21 Ltac forward H := try (forward_step H; [ forward H | .. ]).
22 Ltac eforward H := try (eforward_step H; [ eforward H | .. ]).