aboutsummaryrefslogtreecommitdiffhomepage
path: root/test-suite/success/Case13.v
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2001-12-11 10:33:44 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2001-12-11 10:33:44 +0000
commit5d6dbff8ad773605edf49b1a56133bad7d620356 (patch)
treeb30fe93d1b6245937b92e5f21a8b3d3b287f0e13 /test-suite/success/Case13.v
parentc4a1f8efca6008e98837f15b5b4508486937543a (diff)
Test des coercions dans les motifs
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@2284 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'test-suite/success/Case13.v')
-rw-r--r--test-suite/success/Case13.v36
1 files changed, 36 insertions, 0 deletions
diff --git a/test-suite/success/Case13.v b/test-suite/success/Case13.v
new file mode 100644
index 000000000..06149b3fa
--- /dev/null
+++ b/test-suite/success/Case13.v
@@ -0,0 +1,36 @@
+(* Check coercions in patterns *)
+
+Inductive I : Set :=
+ C1 : nat -> I
+| C2 : I -> I.
+
+Coercion C1 : nat >-> I.
+
+(* Coercion at the root of pattern *)
+Check [x]Cases x of (C2 n) => O | O => O | (S n) => n end.
+
+(* Coercion not at the root of pattern *)
+Check [x]Cases x of (C2 O) => O | _ => O end.
+
+(* TODO: insert unification inside patterns to get these examples working
+
+Check [x:(option nat)]Cases x of None => O | (Some O) => O | _ => O end.
+
+(* Coercion up to delta-conversion *)
+Coercion somenat := (Some nat).
+Check [x]Cases x of None => O | O => O | (S n) => n end.
+
+*)
+
+(* Coercions with parameters *)
+Inductive listn : nat-> Set :=
+ niln : (listn O)
+| consn : (n:nat)nat->(listn n) -> (listn (S n)).
+
+Inductive I' : nat -> Set :=
+ C1' : (n:nat) (listn n) -> (I' n)
+| C2' : (n:nat) (I' n) -> (I' n).
+
+Coercion C1' : listn >-> I'.
+Check [x:(I' O)]Cases x of (C2' _ _) => O | niln => O | _ => O end.
+Check [x:(I' O)]Cases x of (C2' _ niln) => O | _ => O end.