Debian Codegraph @

test-suite/success/PCase.v

raw
1
2 (** Some tests of patterns containing matchs ending with joker branches.
3 Cf. the new form of the [constr_pattern] constructor [PCase]
4 in [pretyping/pattern.ml] *)
5
6 (* A universal match matcher *)
7
8 Ltac kill_match :=
9 match goal with
10 |- context [ match ?x with _ => _ end ] => destruct x
11 end.
12
13 (* A match matcher restricted to a given type : nat *)
14
15 Ltac kill_match_nat :=
16 match goal with
17 |- context [ match ?x in nat with _ => _ end ] => destruct x
18 end.
19
20 (* Another way to restrict to a given type : give a branch *)
21
22 Ltac kill_match_nat2 :=
23 match goal with
24 |- context [ match ?x with S _ => _ | _ => _ end ] => destruct x
25 end.
26
27 (* This should act only on empty match *)
28
29 Ltac kill_match_empty :=
30 match goal with
31 |- context [ match ?x with end ] => destruct x
32 end.
33
34 Lemma test1 (b:bool) : if b then True else O=O.
35 Proof.
36 Fail kill_match_nat.
37 Fail kill_match_nat2.
38 Fail kill_match_empty.
39 kill_match. exact I. exact eq_refl.
40 Qed.
41
42 Lemma test2a (n:nat) : match n with O => True | S n => (n = n) end.
43 Proof.
44 Fail kill_match_empty.
45 kill_match_nat. exact I. exact eq_refl.
46 Qed.
47
48 Lemma test2b (n:nat) : match n with O => True | S n => (n = n) end.
49 Proof.
50 kill_match_nat2. exact I. exact eq_refl.
51 Qed.
52
53 Lemma test2c (n:nat) : match n with O => True | S n => (n = n) end.
54 Proof.
55 kill_match. exact I. exact eq_refl.
56 Qed.
57
58 Lemma test3a (f:False) : match f return Prop with end.
59 Proof.
60 kill_match_empty.
61 Qed.
62
63 Lemma test3b (f:False) : match f return Prop with end.
64 Proof.
65 kill_match.
66 Qed.