annotate incl.urs @ 6:799f43bce62b
Import some code from iwl
author |
Adam Chlipala <adam@chlipala.net> |
date |
Tue, 14 Dec 2010 10:33:24 -0500 |
parents |
943410267fad |
children |
|
rev |
line source |
adam@5
|
1 (** A record inclusion predicate *)
|
adam@5
|
2
|
adam@5
|
3 con incl :: K --> {K} -> {K} -> Type
|
adam@5
|
4
|
adam@5
|
5 val incl : K --> r1 :: {K} -> r2 :: {K} -> [r1 ~ r2] => incl r1 (r1 ++ r2)
|
adam@5
|
6 val proj : r1 ::: {Type} -> r2 ::: {Type} -> incl r1 r2 -> $r2 -> $r1
|
adam@5
|
7
|
adam@5
|
8 val inv1 : K --> nm :: Name -> t :: K -> r :: {K} -> r' :: {K}
|
adam@5
|
9 -> [[nm] ~ r] =>
|
adam@5
|
10 f :: (Name -> K -> {K} -> Type)
|
adam@5
|
11 -> incl ([nm = t] ++ r) r'
|
adam@5
|
12 -> (nm :: Name -> t :: K -> r :: {K} -> [[nm] ~ r] => f nm t ([nm = t] ++ r))
|
adam@5
|
13 -> f nm t r'
|
adam@5
|
14 val inv2 : K --> nm :: Name -> t :: K -> r :: {K} -> r' :: {K}
|
adam@5
|
15 -> [[nm] ~ r] =>
|
adam@5
|
16 incl ([nm = t] ++ r) r' -> incl r r'
|
adam@5
|
17
|
adam@5
|
18 val fold : K --> tf :: ({K} -> Type) -> r ::: {K}
|
adam@5
|
19 -> (nm :: Name -> v :: K -> r' :: {K}
|
adam@5
|
20 -> [[nm] ~ r'] => incl ([nm = v] ++ r') r -> tf r' -> tf ([nm = v] ++ r'))
|
adam@5
|
21 -> tf []
|
adam@5
|
22 -> folder r -> tf r
|