comparison eq.urs @ 6:799f43bce62b

Import some code from iwl
author Adam Chlipala <adam@chlipala.net>
date Tue, 14 Dec 2010 10:33:24 -0500
parents
children
comparison
equal deleted inserted replaced
5:943410267fad 6:799f43bce62b
1 (** A constructor equality predicate *)
2
3 con eq :: K --> K -> K -> Type
4
5 val refl : K --> t ::: K -> eq t t
6 val sym : K --> t1 ::: K -> t2 ::: K -> eq t1 t2 -> eq t2 t1
7 val trans : K --> t1 ::: K -> t2 ::: K -> t3 ::: K -> eq t1 t2 -> eq t2 t3 -> eq t1 t3
8
9 val cast : K --> t1 ::: K -> t2 ::: K -> eq t1 t2 -> f :: (K -> Type) -> f t1 -> f t2
10
11 val fold : K --> tf :: ({K} -> Type) -> r ::: {K}
12 -> (pre :: {K} -> nm :: Name -> v :: K -> post :: {K} -> [pre ~ post] => [[nm] ~ pre ++ post] =>
13 eq r (pre ++ [nm = v] ++ post) -> tf post -> tf ([nm = v] ++ post))
14 -> tf [] -> folder r -> tf r
15
16 val foldUR : tr :: Type -> tf :: ({Unit} -> Type) -> r ::: {Unit}
17 -> (pre :: {Unit} -> nm :: Name -> post :: {Unit} -> [pre ~ post] => [[nm] ~ pre ++ post] =>
18 eq r (pre ++ [nm] ++ post) -> tr -> tf post -> tf ([nm] ++ post))
19 -> tf [] -> folder r -> $(mapU tr r) -> tf r
20
21 val foldR : K --> tr :: (K -> Type) -> tf :: ({K} -> Type) -> r ::: {K}
22 -> (pre :: {K} -> nm :: Name -> t :: K -> post :: {K} -> [pre ~ post] => [[nm] ~ pre ++ post] =>
23 eq r (pre ++ [nm = t] ++ post) -> tr t -> tf post -> tf ([nm = t] ++ post))
24 -> tf [] -> folder r -> $(map tr r) -> tf r
25
26 val foldR2 : K --> tr1 :: (K -> Type) -> tr2 :: (K -> Type) -> tf :: ({K} -> Type) -> r ::: {K}
27 -> (pre :: {K} -> nm :: Name -> t :: K -> post :: {K} -> [pre ~ post] => [[nm] ~ pre ++ post] =>
28 eq r (pre ++ [nm = t] ++ post) -> tr1 t -> tr2 t -> tf post -> tf ([nm = t] ++ post))
29 -> tf [] -> folder r -> $(map tr1 r) -> $(map tr2 r) -> tf r
30
31 val foldR3 : K --> tr1 :: (K -> Type) -> tr2 :: (K -> Type) -> tr3 :: (K -> Type) -> tf :: ({K} -> Type) -> r ::: {K}
32 -> (pre :: {K} -> nm :: Name -> t :: K -> post :: {K} -> [pre ~ post] => [[nm] ~ pre ++ post] =>
33 eq r (pre ++ [nm = t] ++ post) -> tr1 t -> tr2 t -> tr3 t -> tf post -> tf ([nm = t] ++ post))
34 -> tf [] -> folder r -> $(map tr1 r) -> $(map tr2 r) -> $(map tr3 r) -> tf r
35
36 val foldR4 : K --> tr1 :: (K -> Type) -> tr2 :: (K -> Type) -> tr3 :: (K -> Type) -> tr4 :: (K -> Type) -> tf :: ({K} -> Type) -> r ::: {K}
37 -> (pre :: {K} -> nm :: Name -> t :: K -> post :: {K} -> [pre ~ post] => [[nm] ~ pre ++ post] =>
38 eq r (pre ++ [nm = t] ++ post) -> tr1 t -> tr2 t -> tr3 t -> tr4 t -> tf post -> tf ([nm = t] ++ post))
39 -> tf [] -> folder r -> $(map tr1 r) -> $(map tr2 r) -> $(map tr3 r) -> $(map tr4 r) -> tf r
40
41 val mp : K --> tr :: (K -> Type) -> tf :: (K -> Type) -> r ::: {K}
42 -> (nm :: Name -> t :: K -> rest :: {K} -> [[nm] ~ rest] =>
43 eq r ([nm = t] ++ rest) -> tr t -> tf t)
44 -> folder r -> $(map tr r) -> $(map tf r)