forked from PrincetonUniversity/VST
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLibTactics2.v
77 lines (54 loc) · 1.75 KB
/
LibTactics2.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Load loadpath.
Require Import veristar.LibTactics.
(** LibTactics1:
a couple extra tactics for writing Ssreflect-style proofs *)
Ltac terminator := auto.
(**
Ssreflect-style apply; note that use of LibTactics rapply here *)
Tactic Notation "app" :=
let H := fresh "H" in
introv H; rapply H; clear H; terminator.
(** tapp:
apply a term T to the top goal *)
Tactic Notation "tapp" constr(T) :=
let H := fresh "H" in
introv H; apply T in H; gen H; terminator.
(** tinv:
invert the top goal as intro pattern I1 *)
Tactic Notation "tinv" simple_intropattern(I1) :=
let H := fresh "H" in
introv H; inverts H as I1; terminator.
Tactic Notation "tinv0" :=
let H := fresh "H" in
introv H; inverts H; terminator.
(** tcase:
case eliminate the top goal as intro pattern I1 *)
Tactic Notation "tcase" simple_intropattern(I1) :=
let H := fresh "H" in
intro H; destruct H as I1; terminator.
Tactic Notation "tcase0" :=
let H := fresh "H" in
intro H; destruct H; terminator.
(** telim:
eliminate an inductive on the top of the goal stack as intro pattern I1 *)
Tactic Notation "telim" simple_intropattern(I1) :=
let H := fresh "H" in
intro H; induction H as I1; terminator.
Tactic Notation "telim0" :=
let H := fresh "H" in
intro H; induction H; terminator.
(** done0:
solve the goal immediately, or fail; modeled after Ssreflect "done" *)
Tactic Notation "done0" :=
trivial; hnf; intros; solve
[ do 25 (idtac; [solve [trivial | apply sym_equal; trivial]
| discriminate | contradiction | split])
| assumption
| false
| terminator
| constructor ].
(** done:
solve the goal immediately using tactic T, or fail; modeled after
Ssreflect "by" *)
Tactic Notation "done" tactic(T) :=
T; done0.