| 1 |
(* Some tests of the Search command *) |
| 2 |
|
| 3 |
Search le. (* app nodes *) |
| 4 |
Search bool. (* no apps *) |
| 5 |
Search (@eq nat). (* complex pattern *) |
| 6 |
Search (@eq _ _ true). |
| 7 |
Search (@eq _ _ _) true -false. (* andb_prop *) |
| 8 |
Search (@eq _ _ _) true -false "prop" -"intro". (* andb_prop *) |
| 9 |
|
| 10 |
Definition newdef := fun x:nat => x. |
| 11 |
|
| 12 |
Goal forall n:nat, n <> newdef n -> newdef n <> n -> False. |
| 13 |
cut False. |
| 14 |
intros _ n h h'. |
| 15 |
Search n. (* search hypothesis *) |
| 16 |
Search newdef. (* search hypothesis *) |
| 17 |
Search ( _ <> newdef _). (* search hypothesis, pattern *) |
| 18 |
Search ( _ <> newdef _) -"h'". (* search hypothesis, pattern *) |
| 19 |
|
| 20 |
1:Search newdef. |
| 21 |
2:Search newdef. |
| 22 |
|
| 23 |
Fail 3:Search newdef. |
| 24 |
Fail 1-2:Search newdef. |
| 25 |
Fail all:Search newdef. |
| 26 |
Abort. |
| 27 |
|
| 28 |
Goal forall n (P:nat -> Prop), P n -> ~P n -> False. |
| 29 |
intros n P h h'. |
| 30 |
Search P. (* search hypothesis also for patterns *) |
| 31 |
Search (P _). (* search hypothesis also for patterns *) |
| 32 |
Search (P n). (* search hypothesis also for patterns *) |
| 33 |
Search (P _) -"h'". (* search hypothesis also for patterns *) |
| 34 |
Search (P _) -not. (* search hypothesis also for patterns *) |
| 35 |
|
| 36 |
Abort. |
| 37 |
|
| 38 |
Module M. |
| 39 |
Section S. |
| 40 |
Variable A:Type. |
| 41 |
Variable a:A. |
| 42 |
Theorem Thm (b:A) : True. |
| 43 |
Search A. (* Test search in hypotheses *) |
| 44 |
Abort. |
| 45 |
End S. |
| 46 |
End M. |
| 47 |
|
| 48 |
(* Reproduce the example of the doc *) |
| 49 |
|
| 50 |
Search "_assoc". |
| 51 |
Search "+". |
| 52 |
Search hyp:bool -headhyp:bool. |
| 53 |
Search concl:bool -headconcl:bool. |
| 54 |
Search [ is:Definition headconcl:nat | is:Lemma (_ + _) ]. |
| 55 |
|
| 56 |
(* used to print something between search outputs, otherwise we can't |
| 57 |
tell which lines are from which command *) |
| 58 |
Require Import Ltac2.Printf. |
| 59 |
|
| 60 |
Module BlacklistLocals. |
| 61 |
Axiom T : Type. |
| 62 |
Axiom t : T. |
| 63 |
Local Definition t_alias := t. |
| 64 |
|
| 65 |
Ltac2 Eval printf "should say both t and t_alias". |
| 66 |
Search T. |
| 67 |
End BlacklistLocals. |
| 68 |
|
| 69 |
Ltac2 Eval printf "should say only t". |
| 70 |
Search BlacklistLocals.T. |
| 71 |
|
| 72 |
Unset Search Blacklist Locals. |
| 73 |
Ltac2 Eval printf "should say both t and t_alias". |
| 74 |
Search BlacklistLocals.T. |