| 1 |
Inductive two : bool -> Prop := |
| 2 |
| Zero : two false |
| 3 |
| One : two true. |
| 4 |
|
| 5 |
Ltac dup := |
| 6 |
let H := fresh in assert (forall (P : Prop), P -> P -> P) as H by (intros; trivial); |
| 7 |
apply H; clear H. |
| 8 |
|
| 9 |
Lemma transform : two false <-> two true. |
| 10 |
Proof. split; intros _; constructor. Qed. |
| 11 |
|
| 12 |
Goal two false /\ two true /\ two false /\ two true /\ two true /\ two true. |
| 13 |
Proof. |
| 14 |
do 2 dup. |
| 15 |
- repeat split. |
| 16 |
Fail 7:idtac. |
| 17 |
Fail 2-1:idtac. |
| 18 |
1,2,4-6:idtac. |
| 19 |
2-5:exact One. |
| 20 |
par:exact Zero. |
| 21 |
- repeat split. |
| 22 |
3-6:swap 1 4. |
| 23 |
1-5:swap 1 5. |
| 24 |
1-4:exact One. |
| 25 |
all:exact Zero. |
| 26 |
- repeat split. |
| 27 |
1, 3:exact Zero. |
| 28 |
1, 2, 3, 4: exact One. |
| 29 |
- repeat split. |
| 30 |
all:apply transform. |
| 31 |
2, 4, 6:apply transform. |
| 32 |
all:apply transform. |
| 33 |
1-5:apply transform. |
| 34 |
1-6:exact One. |
| 35 |
Qed. |
| 36 |
|
| 37 |
Goal True -> True. |
| 38 |
Proof. |
| 39 |
intros y. |
| 40 |
1-1:match goal with y : _ |- _ => let x := y in idtac x end. |
| 41 |
Fail 1-1:let x := y in idtac x. |
| 42 |
1:let x := y in idtac x. |
| 43 |
exact I. |
| 44 |
Qed. |
| 45 |
|
| 46 |
Goal True /\ (True /\ True). |
| 47 |
Proof. |
| 48 |
dup. |
| 49 |
- split; only 2: (split; exact I). |
| 50 |
exact I. |
| 51 |
- split; only 2: split; exact I. |
| 52 |
Qed. |
| 53 |
|
| 54 |
Goal True -> exists (x : Prop), x. |
| 55 |
Proof. |
| 56 |
intro H; eexists ?[x]; only [x]: exact True. 1: assumption. |
| 57 |
Qed. |
| 58 |
|
| 59 |
Goal Prop. |
| 60 |
refine ?[x]. |
| 61 |
[x]: refine _. |
| 62 |
exact True. |
| 63 |
Qed. |
| 64 |
|
| 65 |
Goal True /\ True /\ True. |
| 66 |
Proof. |
| 67 |
split. 2: split. |
| 68 |
1: refine ?[A]. |
| 69 |
2: refine ?[B]. |
| 70 |
3: refine ?[C]. |
| 71 |
|
| 72 |
(* Success because all A, B, and C are on the shelf. *) |
| 73 |
[A], [B], [C]: shelve. |
| 74 |
Succeed [A], [B], [C]: exact I. |
| 75 |
|
| 76 |
(* Fails because C is shelved, but A and B are not. *) |
| 77 |
Unshelve. |
| 78 |
[C]: shelve. |
| 79 |
Fail [A], [C]: exact I. |
| 80 |
Fail [B], [C]: exact I. |
| 81 |
Fail 1, [C]: exact I. |
| 82 |
Fail 1-2, [C]: exact I. |
| 83 |
Fail [C], 2: exact I. |
| 84 |
Fail [C], 1-2: exact I. |
| 85 |
|
| 86 |
(* Success because A, B and C are unshelved. *) |
| 87 |
Unshelve. |
| 88 |
[A], [B], [C]: exact I. |
| 89 |
Qed. |
| 90 |
|
| 91 |
(* Strict focusing! *) |
| 92 |
Set Default Goal Selector "!". |
| 93 |
|
| 94 |
Goal True -> True /\ True /\ True. |
| 95 |
Proof. |
| 96 |
intro. |
| 97 |
split;only 2:split. |
| 98 |
Fail exact I. |
| 99 |
Fail !:exact I. |
| 100 |
1:exact I. |
| 101 |
- !:exact H. |
| 102 |
- exact I. |
| 103 |
Qed. |