(** Some tests of patterns containing matchs ending with joker branches. Cf. the new form of the [constr_pattern] constructor [PCase] in [pretyping/pattern.ml] *)
(* A universal match matcher *)
Ltac kill_match :=
match goal with
|- context [ match ?x with _ => _ end ] => destruct x
end.
(* A match matcher restricted to a given type : nat *)
Ltac kill_match_nat :=
match goal with
|- context [ match ?x in nat with _ => _ end ] => destruct x
end.
(* Another way to restrict to a given type : give a branch *)
Ltac kill_match_nat2 :=
match goal with
|- context [ match ?x with S _ => _ | _ => _ end ] => destruct x
end.
(* This should act only on empty match *)
Ltac kill_match_empty :=
match goal with
|- context [ match ?x with end ] => destruct x
end.

Lemma test2c (n:nat) : match n with O => True | S n => (n = n) end.