-
Notifications
You must be signed in to change notification settings - Fork 1
/
tactics.v
34 lines (30 loc) · 944 Bytes
/
tactics.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Require Export Coq.Logic.ProofIrrelevance.
(*General Purpose tactics*)
Ltac inv H := inversion H; subst; clear H.
Ltac copy H :=
match type of H with
|?x => assert(x) by auto
end.
Ltac invertHyp :=
match goal with
|H:exists x, ?P |- _ => inv H; try invertHyp
|H: ?P /\ ?Q |- _ => inv H; try invertHyp
end.
Ltac solveByInv :=
match goal with
|H:_ |- _ => solve[inv H]
end.
(*proof irrelevance*)
Ltac proofsEq :=
match goal with
|H:?x, H':?x |- _ => (assert(H = H') by eapply proof_irrelevance); subst
end.
(*If inversion produces the same hypothesis, skip it, otherwise invert all equalities*)
Ltac invertEq :=
match goal with
|H:?a = ?b |- _ => let n := fresh
in inversion H as n; match type of n with
|?a = ?b => fail
end
|H:?a = ?b |- _ => inv H
end.