annotate incl.ur @ 25:9f56676e7c4e

Track addition of 'style' and 'dynStyle'
author Adam Chlipala <adam@chlipala.net>
date Sun, 06 May 2012 15:16:27 -0400
parents 744bf911dcc6
children
rev   line source
adam@5 1 con incl' = K ==> fn (r1 :: {K}) (r2 :: {K}) (r' :: {K}) =>
adam@14 2 [r1 ~ r'] => {Expose : f :: ({K} -> Type) -> f r2 -> f (r1 ++ r'),
adam@14 3 Hide : f :: ({K} -> Type) -> f (r1 ++ r') -> f r2}
adam@5 4
adam@5 5 con incl = K ==> fn (r1 :: {K}) (r2 :: {K}) =>
adam@5 6 tp :: Type -> (r' :: {K} -> [r1 ~ r'] => incl' r1 r2 r' -> tp) -> tp
adam@5 7
adam@5 8 fun incl [K] [r1 :: {K}] [r2 :: {K}] [r1 ~ r2] =
adam@14 9 fn [tp :: Type] (f : r' :: {K} -> [r1 ~ r'] => incl' r1 (r1 ++ r2) r' -> tp) =>
adam@14 10 f [r2] (fn [r1 ~ r2] => {Expose = fn [f :: ({K} -> Type)] x => x,
adam@14 11 Hide = fn [f :: ({K} -> Type)] x => x})
adam@14 12
adam@5 13 fun proj [r1 ::: {Type}] [r2 ::: {Type}] (i : incl r1 r2) (r : $r2) =
adam@5 14 i [$r1] (fn [r' :: {Type}] [r1 ~ r'] (i' : incl' r1 r2 r') =>
adam@5 15 i'.Expose [fn r => $r] r --- r')
adam@5 16
adam@5 17 fun inv1 [K] [nm :: Name] [t :: K] [r :: {K}] [r' :: {K}] [[nm] ~ r]
adam@5 18 [f :: Name -> K -> {K} -> Type]
adam@5 19 (i : incl ([nm = t] ++ r) r')
adam@5 20 (f : nm :: Name -> t :: K -> r :: {K} -> [[nm] ~ r] => f nm t ([nm = t] ++ r)) =
adam@5 21 i [f nm t r'] (fn [r'' :: {K}] [[nm = t] ++ r ~ r''] (i' : incl' ([nm = t] ++ r) r' r'') =>
adam@14 22 i'.Hide [f nm t] (f [nm] [t] [r ++ r'']))
adam@5 23
adam@5 24 fun inv2 [K] [nm :: Name] [t :: K] [r :: {K}] [r' :: {K}] [[nm] ~ r]
adam@5 25 (i : incl ([nm = t] ++ r) r') =
adam@5 26 i [incl r r'] (fn [r'' :: {K}] [[nm = t] ++ r ~ r''] (i' : incl' ([nm = t] ++ r) r' r'') =>
adam@14 27 fn [tp :: Type] (f : r''' :: {K} -> [r ~ r'''] => incl' r r' r''' -> tp) =>
adam@14 28 f [[nm = t] ++ r''] (fn [r ~ [nm = t] ++ r''] =>
adam@14 29 {Expose = fn [f :: ({K} -> Type)] (x : f r') => i'.Expose [f] x,
adam@14 30 Hide = fn [f :: ({K} -> Type)] x => i'.Hide [f] x}))
adam@5 31
adam@5 32 fun fold [K] [tf :: {K} -> Type] [r ::: {K}]
adam@14 33 (f : nm :: Name -> v :: K -> r' :: {K}
adam@14 34 -> [[nm] ~ r'] => incl ([nm = v] ++ r') r -> tf r' -> tf ([nm = v] ++ r'))
adam@14 35 (i : tf []) (fl : folder r) =
adam@5 36 @Top.fold [fn r' => incl r' r -> tf r']
adam@5 37 (fn [nm :: Name] [v :: K] [r' :: {K}] [[nm] ~ r'] acc i =>
adam@14 38 f [nm] [v] [r'] i (acc (inv2 [nm] [v] [r'] [r] i)))
adam@5 39 (fn _ => i)
adam@5 40 fl (incl [r] [[]])