Debian Codegraph @

test-suite/success/match_case_pattern_variables.v

raw
1 (** Check that bound variables in case patterns are handled correctly. *)
2
3 Goal forall (ch : unit) (t : list unit) (s : list unit),
4 match s with
5 | nil => False
6 | cons a l => ch = a /\ l = t
7 end.
8 Proof.
9 intros.
10 match goal with
11 | |- match ?e with
12 | nil => ?N
13 | cons a b => ?P
14 end =>
15 let f :=
16 constr:((fun (e' : list unit) => match e' with
17 | nil => N
18 | cons a b => P
19 end))
20 in
21 change (f e)
22 end.
23 Abort.
24
25 Goal forall (ch : unit) (n : nat) (s : prod unit nat),
26 let (a, l) := s in ch = a /\ l = n.
27 Proof.
28 intros.
29 match goal with
30 | [ |- let (a, b) := ?e in ?P ] =>
31 let f := constr:((fun (e' : prod unit nat) => match e' with pair a b => P end)) in
32 change (f e)
33 end.
34 Abort.