0 | module Data.Container.Base.Morphism.Definition
4 | import Data.Container.Base.Object.Definition
22 | public export prefix 0 %!
23 | public export prefix 0 &!
24 | public export prefix 0 :!
28 | namespace DependentLenses
32 | data (=%>) : (c1, c2 : Cont) -> Type where
33 | (!%) : ((x : c1.Shp) -> (y : c2.Shp ** (c2.Pos y -> c1.Pos x))) -> c1 =%> c2
38 | (%!) : c1 =%> c2 -> (x : c1.Shp) -> (y : c2.Shp ** (c2.Pos y -> c1.Pos x))
43 | (.fwd) : c1 =%> c2 -> c1.Shp -> c2.Shp
44 | (.fwd) f x = ((%! f) x).fst
47 | (.bwd) : (f : c1 =%> c2) -> (x : c1.Shp) -> c2.Pos (f.fwd x) -> c1.Pos x
48 | (.bwd) f x y' = ((%! f) x).snd y'
52 | compDepLens : a =%> b -> b =%> c -> a =%> c
53 | compDepLens (!% f) (!% g) = !% \x => let (
b ** kb)
= f x
57 | (%>>) : a =%> b -> b =%> c -> a =%> c
62 | id = !% \x => (
x ** id)
73 | lensInputs : {c, d : Cont} -> c =%> d -> Cont
74 | lensInputs lens = (x : c.Shp) !> d.Pos (lens.fwd x)
77 | namespace DependentCharts
81 | data (=&>) : (c1, c2 : Cont) -> Type where
82 | (!&) : ((x : c1.Shp) -> (y : c2.Shp ** (c1.Pos x -> c2.Pos y))) -> c1 =&> c2
87 | (&!) : c1 =&> c2 -> (x : c1.Shp) -> (y : c2.Shp ** (c1.Pos x -> c2.Pos y))
93 | (.fwd) : c1 =&> c2 -> c1.Shp -> c2.Shp
94 | (.fwd) f = \x => ((&! f) x).fst
97 | (.bwd) : (f : c1 =&> c2) -> (x : c1.Shp) -> c1.Pos x -> c2.Pos (f.fwd x)
98 | (.bwd) f = \x => ((&! f) x).snd
101 | compDepChart : a =&> b -> b =&> c -> a =&> c
102 | compDepChart f g = !& \x => let (
b ** kb)
= (&! f) x
103 | (
c ** kc)
= (&! g) b
107 | (&>>) : a =&> b -> b =&> c -> a =&> c
108 | (&>>) = compDepChart
112 | id = !& \x => (
x ** id)
115 | namespace Cartesian
120 | data (=:>) : (c1, c2 : Cont) -> Type where
121 | (!:) : ((x : c1.Shp) -> (y : c2.Shp ** Iso (c1.Pos x) (c2.Pos y)))
124 | %name (=:>)
f, g, h
127 | (:!) : c1 =:> c2 -> ((x : c1.Shp) -> (y : c2.Shp ** Iso (c1.Pos x) (c2.Pos y)))
128 | (:!) (!: f) x = f x
132 | (:%) : c1 =:> c2 -> c1 =%> c2
133 | (:%) (!: f) = !% \x => let (
y ** ky)
= f x in (
y ** backward ky)
137 | (:&) : c1 =:> c2 -> c1 =&> c2
138 | (:&) (!: f) = !& \x => let (
y ** ky)
= f x in (
y ** forward ky)
145 | valuedIn : Cont -> Type -> Cont
146 | valuedIn c r = (s : c.Shp) !> (c.Pos s -> r)
151 | chartToLens : {c1, c2 : Cont} -> {r : Type}
153 | -> (c1 `valuedIn` r) =%> (c2 `valuedIn` r)
154 | chartToLens f = !% \x => let (
y ** ky)
= (((&!) f) x)