aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2011-03-11 18:36:24 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2011-03-11 18:36:24 -0500
commit91d85e65b0c7ecd17e2fed6883499a74cf2f8821 (patch)
treeeef1f57a1b9f7b844700972a66388ac3a6e16c2a
parent1fe0be9d980e9a4a47874680e4ac4ee1de6dd374 (diff)
Make 'ex' kind-generic
-rw-r--r--lib/ur/top.ur10
-rw-r--r--lib/ur/top.urs6
2 files changed, 9 insertions, 7 deletions
diff --git a/lib/ur/top.ur b/lib/ur/top.ur
index 21522310..01dd4479 100644
--- a/lib/ur/top.ur
+++ b/lib/ur/top.ur
@@ -61,13 +61,15 @@ con thd3 = K1 ==> K2 ==> K3 ==> fn t :: (K1 * K2 * K3) => t.3
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)
diff --git a/lib/ur/top.urs b/lib/ur/top.urs
index 0af3e09c..50526f43 100644
--- a/lib/ur/top.urs
+++ b/lib/ur/top.urs
@@ -31,10 +31,10 @@ con thd3 = K1 ==> K2 ==> K3 ==> fn t :: (K1 * K2 * K3) => t.3
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)