changeset 1434:44f78d6fec29

Make 'ex' kind-generic
author Adam Chlipala <adam@chlipala.net>
date Fri, 11 Mar 2011 18:36:24 -0500
parents 66092ce45a76
children 740e167cd4eb
files lib/ur/top.ur lib/ur/top.urs
diffstat 2 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lib/ur/top.ur	Thu Mar 10 20:22:03 2011 -0500
+++ b/lib/ur/top.ur	Fri Mar 11 18:36:24 2011 -0500
@@ -61,13 +61,15 @@
 
 con mapU = K ==> fn f :: K => map (fn _ :: Unit => f)
 
-con ex = fn tf :: (Type -> Type) =>
-            res ::: Type -> (choice :: Type -> tf choice -> res) -> res
+con ex = K ==> fn tf :: (K -> Type) =>
+            res ::: Type -> (choice :: K -> tf choice -> res) -> res
 
-fun ex [tf :: (Type -> Type)] [choice :: Type] (body : tf choice) : ex tf =
- fn [res] (f : choice :: Type -> tf choice -> res) =>
+fun ex_intro [K] [tf :: K -> Type] [choice :: K] (body : tf choice) : ex tf =
+ fn [res] (f : choice :: K -> tf choice -> res) =>
     f [choice] body
 
+fun ex_elim [K] [tf ::: K -> Type] (v : ex tf) [res ::: Type] = @@v [res]
+
 fun compose [t1 ::: Type] [t2 ::: Type] [t3 ::: Type]
             (f1 : t2 -> t3) (f2 : t1 -> t2) (x : t1) = f1 (f2 x)
 
--- a/lib/ur/top.urs	Thu Mar 10 20:22:03 2011 -0500
+++ b/lib/ur/top.urs	Fri Mar 11 18:36:24 2011 -0500
@@ -31,10 +31,10 @@
 
 con mapU = K ==> fn f :: K => map (fn _ :: Unit => f)
 
-con ex = fn tf :: (Type -> Type) =>
-            res ::: Type -> (choice :: Type -> tf choice -> res) -> res
+con ex :: K --> (K -> Type) -> Type
 
-val ex : tf :: (Type -> Type) -> choice :: Type -> tf choice -> ex tf
+val ex_intro : K --> tf :: (K -> Type) -> choice :: K -> tf choice -> ex tf
+val ex_elim : K --> tf ::: (K -> Type) -> ex tf -> res ::: Type -> (choice :: K -> tf choice -> res) -> res
 
 val compose : t1 ::: Type -> t2 ::: Type -> t3 ::: Type
               -> (t2 -> t3) -> (t1 -> t2) -> (t1 -> t3)