annotate incl.urs @ 15:6ebc2ca594b7
Sql.insertIfMissing and deleteByKey (partly from Ron de Bruijn)
author |
Adam Chlipala <adam@chlipala.net> |
date |
Sun, 11 Dec 2011 14:04:34 -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
|