State : Cont -> Type "State" as defined in https://arxiv.org/abs/2403.13001 and open games
Given a shape of any container, state can be defined
Visibility: public exportCostate : Cont -> Type- Visibility: public export
toState : c .Shp -> State c- Visibility: public export
fromState : State c -> c .Shp- Visibility: public export
fromCostate : Costate c -> (x : c .Shp) -> c .Pos x- Visibility: public export
toCostate : ((x : c .Shp) -> c .Pos x) -> Costate c- Visibility: public export
fromNapCostateToState : Costate (Nap (c .Shp)) -> State c- Visibility: public export
fromStateToNapCostate : State c -> Costate (Nap (c .Shp))- Visibility: public export
pushDown : Cont -> Cont- Visibility: public export
pushIntoContinuation : (d >< p) =%> l -> p =%> (pushDown d >@ l)- Visibility: public export
leftUnit : (Scalar >< c) =%> c- Visibility: public export
rightUnit : (c >< Scalar) =%> c- Visibility: public export
leftUnitInv : c =%> (Scalar >< c)- Visibility: public export
rightUnitInv : c =%> (c >< Scalar)- Visibility: public export
assocL : ((a >< b) >< c) =%> (a >< (b >< c))- Visibility: public export
assocR : (a >< (b >< c)) =%> ((a >< b) >< c)- Visibility: public export
swap : (a >< b) =%> (b >< a)- Visibility: public export
leftUnit : (Scalar >@ c) =%> c- Visibility: public export
rightUnit : (c >@ Scalar) =%> c- Visibility: public export
leftUnitInv : c =%> (Scalar >@ c)- Visibility: public export
rightUnitInv : c =%> (c >@ Scalar)- Visibility: public export
elim : (c >+< c) =%> c- Visibility: public export
duoidal : ((c >@ d) >< (e >@ f)) =%> ((c >< e) >@ (d >< f)) Interaction between composition and tensor product
Visibility: public exportdistribute : (c >< e) =%> s -> (c >< (e >@ g)) =%> (s >@ g) Specific distributive law we need
Visibility: public exportextMap : c =%> d -> Ext c a -> Ext d a Ext is a functor of type Cont -> [Type, Type]
On objects it maps a container to a polynomial functor
On morphisms it maps a dependent lens to a natural transformation
This is the action on morphisms
Visibility: public exportwrapIntoVector : c =%> d -> Tensor [c] =%> Tensor [d] Wraps a dependent lens `c =%> d`
into one of type `c >@ Scalar =%> d >@ Scalar`
Needed because `c >@ Scalar` isn't automatically reduced to `c`
Visibility: public exportwrapIntoVectorHancock : c =%> d -> HancockTensor [c] =%> HancockTensor [d] Wraps a dependent lens `c =%> d`
into one of type `c >< Scalar =%> d >< Scalar`
Needed because `c >< Scalar` isn't automatically reduced to `c`
Visibility: public exportcubicalShapeHelper : All IsCubical shape -> List Nat Helper function allowing `shape` in `cubicalShape` to have zero annotation
Visibility: public exportcubicalShape : (0 shape : List Cont) -> All IsCubical shape => List Nat Given a list of cubical containers, return the list of their dimensions
Visibility: public exportsize : (0 shape : List Cont) -> All IsCubical shape => Nat Size of a list of cubical containers is the product of their dimensions
Visibility: public exportflattenCubical : {auto ac : All IsCubical shape} -> LayoutOrder -> Tensor shape =%> Vect (size shape) Layout-aware dependent lens flattening a cubical tensor
Visibility: public exportunflattenCubical : {auto ac : All IsCubical shape} -> LayoutOrder -> Vect (size shape) =%> Tensor shape Layout-aware dependent lens unflattening a tensor
Visibility: public exportrecastFlattenedTensor : {auto oldAc : All IsCubical oldShape} -> {auto newAc : All IsCubical newShape} -> size oldShape = size newShape => Vect (size oldShape) =%> Vect (size newShape) This is simply a rewrite!
Visibility: public exportreshape : {auto oldAc : All IsCubical oldShape} -> {auto newAc : All IsCubical newShape} -> LayoutOrder -> size oldShape = size newShape => Tensor oldShape =%> Tensor newShape Reshapes a cubical tensor by first flattening it to a linear representation,
casting the type to the new shape, and then unflattening it back
Is generic over layout order
Visibility: public exporttransposeLens : IsNaperian c => IsNaperian d => (c >@ d) =%> (d >@ c)- Visibility: public export
transpose : IsNaperian c => IsNaperian d => Tensor [c, d] =%> Tensor [d, c] This and the above function should be one and the same, up to rebracketing
Visibility: public exporthancockTensorNaperianShape : All IsNaperian shape => (HancockTensor shape) .Shp- Visibility: public export
tensorNaperianShape : All IsNaperian shape => (Tensor shape) .Shp Helper to compute the unique shape of Tensor when all containers are Naperian
Visibility: public exporthancockTensorPosEq : All IsNaperian shape => (HancockTensor shape) .Pos x = (HancockTensor shape) .Pos y Analogous to `naperianPosEq` but for the HancockTensor structure
We can't use `naperianPosEq` directly because the shape of the resulting
container is not Unit, it is only isomorphic to it
Visibility: public exporttransformToHancock : All IsNaperian shape => Tensor shape =%> HancockTensor shape Tensor shape is isomorphic to HancockTensor shape when all containers in
the shape are Naperian. This is one arrow of that isomorphism
Visibility: public exportEmptyExtEq : IsNaperian c => Ext c () = ()- Visibility: public export
inorderBackward : (b : BinTreeShape) -> Fin (numNodesAndLeaves b) -> BinTreePos b- Visibility: public export
inorder : BinTree =%> List- Visibility: public export
inorderBackward : (b : BinTreeShape) -> Fin (numNodes b) -> BinTreePosNode b- Visibility: public export
inorder : BinTreeNode =%> List Traverses a binary tree container in order, producing a list container
Visibility: public exportpreorderBinTreeNode : (b : BinTreeShape) -> Fin (numNodes b) -> BinTreePosNode b- Visibility: public export
maybeToList : Maybe =%> List- Visibility: public export
Sample : MonadSample m => IsSucc n => (m <!> Sample n) =%> Scalar- Visibility: public export
handleEffect : Monad m => (m <!> effect) =%> Scalar -> a =%> effect -> (m <!> a) =%> Scalar- Visibility: public export