22 | %hide Base.Object.Instances.Const
23 | %hide Data.Vect.Quantifiers.All.index
24 | %hide Base.Morphism.Definition.DependentLenses.(=%>)
25 | %hide Base.Morphism.Instances.State.State
26 | %hide Base.Morphism.Instances.Costate.Costate
27 | %hide Base.Product.Definitions.HancockTensorProduct.(><)
30 | ||| "State" as defined in https://arxiv.org/abs/2403.13001 and open games
31 | |||
32 | ||| ┌─────────────┐
33 | ||| │ ├──► (x : c.Shp)
34 | ||| │ State │
35 | ||| │ ├◄── c.Pos x
36 | ||| └─────────────┘
50 | ||| "Costate" as defined in https://arxiv.org/abs/2403.13001 and open games
51 | |||
52 | ||| ┌─────────────┐
53 | ||| (x : c.Shp) ──►┤ │
54 | ||| │ Costate │
55 | ||| c.Pos x ◄──┤ │
56 | ||| └─────────────┘
78 | ||| If we model the idea of a container (S !> P) as a box
79 | ||| ┌──────┐
80 | ||| │ s:S │
81 | ||| ├──────┤
82 | ||| │ Ps │
83 | ||| └──────┘
84 | ||| then `pushDown` is interpreted as pushing down the container,
85 | ||| pruning anything that goes out of the box, and using `Unit` for
86 | ||| anything new that appears:
87 | ||| ┌──────┐
88 | ||| │ Unit │
89 | ||| ├──────┤
90 | ||| │ s:S │
91 | ||| └──────┘
92 | ||| Ps
93 | ||| For additive containers we need to take the free monoid
106 | where
124 | ||| This is also the categorical product since our containers are additive
158 | ||| These do not exist for ordinary containers!
159 | ||| Here we need `c` not to be erased since we're using its monoid structure
193 | -- leftUnitInv {c=MkAddCont uc} = (!% CompositionProduct.leftUnitInv) %>> ?eiei
195 | ||| Right unit inverse: c =%> c >@ I
221 | ||| Not an isomorphism, arising from duoidal structure between >@ and ><
279 | ||| Mean squared error
285 | ||| Select a shape from All to produce an Any at the given index
286 | ||| Same as `index i (allAnies shapes)` but reduces better
293 | ||| Extract the position from an AnyPos at a given index
302 | -- parameters (f : Type -> Type)
303 | -- ||| These are all of the morphisms in the cokleisli category of (f <!> -)
304 | -- public export
305 | -- MonLens : Cont -> Cont -> Type
306 | -- MonLens c d = (f <!> c) =%> d
307 | --
308 | -- public export
309 | -- counit : Monad f => f <!> c =%> c
310 | -- counit = !% \x => (x ** pure)
311 | --
312 | -- public export
313 | -- cojoin : Monad f => (f <!> c) =%> (f <!> (f <!> c))
314 | -- cojoin = !% \x => (x ** join)
317 | -- public export
318 | -- record FCoAlgCont (f : Type -> Type) where
319 | -- constructor MkFCoAlgCont
320 | -- carrier : Cont
321 | -- coalg : (a : carrier.Shp) -> f (carrier.Pos a) -> carrier.Pos a
323 | -- public export
324 | -- coAlgMorphism : (c, d : FCoAlgCont f) -> Type
325 | -- coAlgMorphism c d = c.carrier =%> d.carrier
326 | --
327 | -- convert : FCoAlgCont List -> AddCont
328 | -- convert (MkFCoAlgCont carrier coalg) = MkAddCont
329 | -- carrier
330 | -- {mon=(MkI $ \s => MkComMonoid
331 | -- (\l, r => coalg s [l, r])
332 | -- (coalg s []))}