| 1 |
(* Thinning introduction hypothesis must be done after all introductions *) |
| 2 |
(* Submitted by Guillaume Melquiond (BZ#1000) *) |
| 3 |
|
| 4 |
Goal forall A, A -> True. |
| 5 |
intros _ _. |
| 6 |
Abort. |
| 7 |
|
| 8 |
(* This did not work until March 2013, because of underlying "red" *) |
| 9 |
Goal (fun x => True -> True) 0. |
| 10 |
intro H. |
| 11 |
Abort. |
| 12 |
|
| 13 |
(* This should still work, with "intro" calling "hnf" *) |
| 14 |
Goal (fun f => True -> f 0 = f 0) (fun x => x). |
| 15 |
intro H. |
| 16 |
match goal with [ |- 0 = 0 ] => reflexivity end. |
| 17 |
Abort. |
| 18 |
|
| 19 |
(* Somewhat related: This did not work until March 2013 *) |
| 20 |
Goal (fun f => f 0 = f 0) (fun x => x). |
| 21 |
hnf. |
| 22 |
match goal with [ |- 0 = 0 ] => reflexivity end. |
| 23 |
Abort. |
| 24 |
|
| 25 |
(* Fixing behavior of "*" and "**" in branches, so that they do not |
| 26 |
introduce more than what the branch expects them to introduce at most *) |
| 27 |
Goal forall n p, n + p = 0. |
| 28 |
intros [|*]; intro p. |
| 29 |
Abort. |
| 30 |
|
| 31 |
(* Check non-interference of "_" with name generation *) |
| 32 |
Goal True -> True -> True. |
| 33 |
intros _ ?. |
| 34 |
exact H. |
| 35 |
Qed. |
| 36 |
|
| 37 |
(* A short test about introduction pattern pat%c *) |
| 38 |
Goal (True -> 0=0) -> True /\ False -> 0=0. |
| 39 |
intros H (H1%H,_). |
| 40 |
exact H1. |
| 41 |
Qed. |
| 42 |
|
| 43 |
(* A test about bugs in 8.5beta2 *) |
| 44 |
Goal (True -> 0=0) -> True /\ False -> False -> 0=0. |
| 45 |
intros H H0 H1. |
| 46 |
destruct H0 as (a%H,_). |
| 47 |
(* Check that H0 is removed (was bugged in 8.5beta2) *) |
| 48 |
Fail clear H0. |
| 49 |
(* Check position of newly created hypotheses when using pat%c (was |
| 50 |
left at top in 8.5beta2) *) |
| 51 |
match goal with H:_ |- _ => clear H end. (* clear H1:False *) |
| 52 |
match goal with H:_ |- _ => exact H end. (* check that next hyp shows 0=0 *) |
| 53 |
Qed. |
| 54 |
|
| 55 |
Goal (True -> 0=0) -> True -> 0=0. |
| 56 |
intros H H1%H. |
| 57 |
exact H1. |
| 58 |
Qed. |
| 59 |
|
| 60 |
Goal forall n, n = S n -> 0=0. |
| 61 |
intros n H%n_Sn. |
| 62 |
destruct H. |
| 63 |
Qed. |
| 64 |
|
| 65 |
(* Another check about generated names and cleared hypotheses with |
| 66 |
pat%c patterns *) |
| 67 |
Goal (True -> 0=0 /\ 1=1) -> True -> 0=0. |
| 68 |
intros H (H1,?)%H. |
| 69 |
change (1=1) in H0. |
| 70 |
exact H1. |
| 71 |
Qed. |
| 72 |
|
| 73 |
(* Checking iterated pat%c1...%cn introduction patterns and side conditions *) |
| 74 |
|
| 75 |
Goal forall A B C D:Prop, (A -> B -> C) -> (C -> D) -> B -> A -> D. |
| 76 |
intros * H H0 H1. |
| 77 |
intros H2%H%H0. |
| 78 |
- exact H2. |
| 79 |
- exact H1. |
| 80 |
Qed. |
| 81 |
|
| 82 |
(* Bug found by Enrico *) |
| 83 |
|
| 84 |
Goal forall x : nat, True. |
| 85 |
intros y%(fun x => x). |
| 86 |
Abort. |
| 87 |
|
| 88 |
(* Fixing a bug in the order of side conditions of a "->" step *) |
| 89 |
|
| 90 |
Goal (True -> 1=0) -> 1=1. |
| 91 |
intros ->. |
| 92 |
- reflexivity. |
| 93 |
- exact I. |
| 94 |
Qed. |
| 95 |
|
| 96 |
Goal forall x, (True -> x=0) -> 0=x. |
| 97 |
intros x ->. |
| 98 |
- reflexivity. |
| 99 |
- exact I. |
| 100 |
Qed. |
| 101 |
|
| 102 |
(* Fixing a bug when destructing a type with let-ins in the constructor *) |
| 103 |
|
| 104 |
Inductive I := C : let x:=1 in x=1 -> I. |
| 105 |
Goal I -> True. |
| 106 |
intros [x H]. (* Was failing in 8.5 *) |
| 107 |
Abort. |
| 108 |
|
| 109 |
(* Ensuring that the (pat1,...,patn) intropatterns has the expected size, up |
| 110 |
to skipping let-ins *) |
| 111 |
|
| 112 |
Goal I -> 1=1. |
| 113 |
intros (H). (* This skips x *) |
| 114 |
exact H. |
| 115 |
Qed. |
| 116 |
|
| 117 |
Goal I -> 1=1. |
| 118 |
Fail intros (x,H,H'). |
| 119 |
Fail intros [|]. |
| 120 |
intros (x,H). |
| 121 |
exact H. |
| 122 |
Qed. |
| 123 |
|
| 124 |
Goal Acc le 0 -> True. |
| 125 |
Fail induction 1 as (n,H). (* Induction hypothesis is missing *) |
| 126 |
induction 1 as (n,H,IH). |
| 127 |
exact Logic.I. |
| 128 |
Qed. |
| 129 |
|
| 130 |
(* Make "intro"/"intros" progress on existential variables *) |
| 131 |
|
| 132 |
Module Evar. |
| 133 |
|
| 134 |
Goal exists (A:Prop), A. |
| 135 |
eexists. |
| 136 |
unshelve (intro y). |
| 137 |
- exact nat. |
| 138 |
- exact (y=y). |
| 139 |
- auto. |
| 140 |
Qed. |
| 141 |
|
| 142 |
Goal exists (A:Prop), A. |
| 143 |
eexists. |
| 144 |
unshelve (intros x). |
| 145 |
- exact nat. |
| 146 |
- exact (x=x). |
| 147 |
- auto. |
| 148 |
Qed. |
| 149 |
|
| 150 |
Definition d := ltac:(let x := fresh in intro x; exact (x*x)). |
| 151 |
|
| 152 |
Definition d' : nat -> _ := ltac:(intros;exact 0). |
| 153 |
|
| 154 |
End Evar. |
| 155 |
|
| 156 |
Module Wildcard. |
| 157 |
|
| 158 |
(* We check that the wildcard internal name does not interfere with |
| 159 |
user fresh names (currently the prefix is "_H") *) |
| 160 |
|
| 161 |
Goal nat -> bool -> nat -> bool. |
| 162 |
intros _ ?_H ?_H. |
| 163 |
exact _H. |
| 164 |
Qed. |
| 165 |
|
| 166 |
End Wildcard. |
| 167 |
|
| 168 |
Module SimplNever. |
| 169 |
|
| 170 |
Fixpoint arrow n X := |
| 171 |
match n with |
| 172 |
| 0 => X |
| 173 |
| S n => X -> arrow n X |
| 174 |
end. |
| 175 |
|
| 176 |
Arguments arrow : simpl never. |
| 177 |
|
| 178 |
Goal arrow 1 False. |
| 179 |
intro H. |
| 180 |
exact H. |
| 181 |
Qed. |
| 182 |
|
| 183 |
End SimplNever. |