From 6b649aba925b6f7462da07599fe67ebb12a3460e Mon Sep 17 00:00:00 2001 From: Samuel Mimram Date: Wed, 28 Jul 2004 21:54:47 +0000 Subject: Imported Upstream version 8.0pl1 --- test-suite/success/Case13.v | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test-suite/success/Case13.v (limited to 'test-suite/success/Case13.v') diff --git a/test-suite/success/Case13.v b/test-suite/success/Case13.v new file mode 100644 index 00000000..71c9191d --- /dev/null +++ b/test-suite/success/Case13.v @@ -0,0 +1,33 @@ +(* 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. + +(* Unification and coercions inside patterns *) +Check [x:(option nat)]Cases x of None => O | (Some O) => O | _ => O end. + +(* Coercion up to delta-conversion, and unification *) +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. -- cgit v1.2.3