1
(* Check coercions in patterns *)
7
Coercion C1 : nat >-> I.
9
(* Coercion at the root of pattern *)
10
Check (fun x => match x with
16
(* Coercion not at the root of pattern *)
17
Check (fun x => match x with
22
(* Unification and coercions inside patterns *)
24
(fun x : option nat => match x with
30
(* Coercion up to delta-conversion, and unification *)
31
Coercion somenat := Some (A:=nat).
32
Check (fun x => match x with
38
(* Coercions with parameters *)
39
Inductive listn : nat -> Set :=
41
| consn : forall n : nat, nat -> listn n -> listn (S n).
43
Inductive I' : nat -> Set :=
44
| C1' : forall n : nat, listn n -> I' n
45
| C2' : forall n : nat, I' n -> I' n.
47
Coercion C1' : listn >-> I'.
48
Check (fun x : I' 0 => match x with
53
Check (fun x : I' 0 => match x with
58
(* Check insertion of coercions around matched subterm *)
61
Parameter f:> A -> nat.
63
Inductive J : Set := D : A -> J.
65
Check (fun x => match x with
70
(* Check coercions against the type of the term to match *)
71
(* Used to fail in V8.1beta *)
73
Inductive C : Set := c : C.
74
Inductive E : Set := e :> C -> E.
75
Check fun (x : E) => match x with c => e c end.
77
(* Check coercions with uniform parameters (cf bug #1168) *)
79
Inductive C' : bool -> Set := c' : C' true.
80
Inductive E' (b : bool) : Set := e' :> C' b -> E' b.
81
Check fun (x : E' true) => match x with c' => e' true c' end.