| 1 |
(* Test printing of Tactic Notation *) |
| 2 |
|
| 3 |
Tactic Notation "a" constr(x) := apply x. |
| 4 |
Tactic Notation "e" constr(x) := exact x. |
| 5 |
|
| 6 |
Ltac f H := split; [a H|e H]. |
| 7 |
Print Ltac f. |
| 8 |
|
| 9 |
(* Test printing of match context *) |
| 10 |
(* Used to fail after translator removal (see BZ#1070) *) |
| 11 |
|
| 12 |
Ltac g := match goal with |- context [if ?X then _ else _ ] => case X end. |
| 13 |
Print Ltac g. |
| 14 |
|
| 15 |
(* Test an error message (BZ#5390) *) |
| 16 |
Lemma myid (P : Prop) : P <-> P. |
| 17 |
Proof. split; auto. Qed. |
| 18 |
|
| 19 |
Goal True -> (True /\ True) -> True. |
| 20 |
Proof. |
| 21 |
intros H. |
| 22 |
Fail intros [H%myid ?]. |
| 23 |
Fail destruct 1 as [H%myid ?]. |
| 24 |
Abort. |
| 25 |
|
| 26 |
|
| 27 |
(* Test that assert_succeeds only runs a tactic once *) |
| 28 |
Ltac should_not_loop := idtac + should_not_loop. |
| 29 |
Goal True. |
| 30 |
assert_succeeds should_not_loop. |
| 31 |
assert_succeeds (idtac "a" + idtac "b"). (* should only output "a" *) |
| 32 |
Abort. |
| 33 |
|
| 34 |
(* assert_succeeds preserves the error *) |
| 35 |
Goal True. |
| 36 |
Fail assert_succeeds exact False. |
| 37 |
Abort. |
| 38 |
|
| 39 |
Module IntroWildcard. |
| 40 |
|
| 41 |
Theorem foo : { p:nat*nat & p = (0,0) } -> True. |
| 42 |
Fail intros ((n,_),H). |
| 43 |
Abort. |
| 44 |
|
| 45 |
End IntroWildcard. |
| 46 |
|
| 47 |
Module ApplyIn. |
| 48 |
|
| 49 |
Ltac test a b c d e := apply a, b in c as [], d, e as ->. |
| 50 |
Print test. |
| 51 |
|
| 52 |
End ApplyIn. |