| 1 |
(* in clause pattern *) |
| 2 |
Require Import TestSuite.vector. |
| 3 |
Check (fun n (x: Vector.t True (S n)) => |
| 4 |
match x in Vector.t _ (S m) return True with |
| 5 |
|Vector.cons _ h _ _ => h |
| 6 |
end). |
| 7 |
|
| 8 |
(* Notation *) |
| 9 |
Notation "A \dots n" := (Vector.t A n) (at level 200). |
| 10 |
Check (fun m (x: Vector.t nat m) => |
| 11 |
match x in _ \dots k return Vector.t nat (S k) with |
| 12 |
| Vector.nil _ => Vector.cons _ 0 _ (Vector.nil _) |
| 13 |
| Vector.cons _ h _ t => Vector.cons _ h _ (Vector.cons _ h _ t) |
| 14 |
end). |
| 15 |
|
| 16 |
(* N should be a variable and not the inductiveRef *) |
| 17 |
Inductive N := Constr. |
| 18 |
Theorem foo : forall (n m : nat) (pf : n = m), |
| 19 |
match pf in _ = N with |
| 20 |
| eq_refl => unit |
| 21 |
end. |
| 22 |
Abort. |
| 23 |
|
| 24 |
(* Check redundant clause is removed *) |
| 25 |
Inductive I : nat * nat -> Type := C : I (0,0). |
| 26 |
Check fun x : I (1,1) => match x in I (y,z) return y = z with C => eq_refl end. |
| 27 |
|
| 28 |
(* An example of non-local inference of the type of an impossible case *) |
| 29 |
Check (fun y n (x:Vector.t nat (S n)) => match x with Vector.cons _ a _ _ => a | _ => y end) 2. |