Rename Data.Tensor.swap to swap'

This commit is contained in:
Kiana Sheibani 2023-03-07 22:28:38 -05:00
parent be4985714d
commit 6c46279ec7
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
5 changed files with 19 additions and 19 deletions

View file

@ -30,7 +30,7 @@ import Data.Profunctor.Types
||| `ten` is generally expected to implement `(Tensor ten i, Symmetric ten)`. ||| `ten` is generally expected to implement `(Tensor ten i, Symmetric ten)`.
||| |||
||| Laws: ||| Laws:
||| * `costrongl = costrongr . dimap swap swap` ||| * `costrongl = costrongr . dimap swap' swap'`
||| * `costrongl . dimap unitr.rightToLeft unitr.leftToRight = id` ||| * `costrongl . dimap unitr.rightToLeft unitr.leftToRight = id`
||| * `costrongl . lmap (mapSnd f) = costrongl . rmap (mapSnd f)` ||| * `costrongl . lmap (mapSnd f) = costrongl . rmap (mapSnd f)`
||| * `costrongr . costrongr = costrongr . dimap assocl assocr` ||| * `costrongr . costrongr = costrongr . dimap assocl assocr`

View file

@ -141,12 +141,12 @@ Functor (FreeMapping p a) where
export export
GenStrong Pair (FreeMapping p) where GenStrong Pair (FreeMapping p) where
strongr (MkFM l m r) = MkFM @{Compose} (map l) m (map r) strongr (MkFM l m r) = MkFM @{Compose} (map l) m (map r)
strongl = dimap Builtin.swap Builtin.swap . strongr {p=FreeMapping p} strongl = dimap swap' swap' . strongr {p=FreeMapping p}
export export
GenStrong Either (FreeMapping p) where GenStrong Either (FreeMapping p) where
strongr (MkFM l m r) = MkFM @{Compose} (map l) m (map r) strongr (MkFM l m r) = MkFM @{Compose} (map l) m (map r)
strongl = dimap Tensor.swap Tensor.swap . strongr {p=FreeMapping p} strongl = dimap swap' swap' . strongr {p=FreeMapping p}
export export
Closed (FreeMapping p) where Closed (FreeMapping p) where

View file

@ -27,7 +27,7 @@ import Data.Profunctor.Types
||| `ten` is generally expected to implement `(Tensor ten i, Symmetric ten)`. ||| `ten` is generally expected to implement `(Tensor ten i, Symmetric ten)`.
||| |||
||| Laws: ||| Laws:
||| * `strongl = dimap swap swap . strongr` ||| * `strongl = dimap swap' swap' . strongr`
||| * `dimap unitr.rightToLeft unitr.leftToRight . strongl = id` ||| * `dimap unitr.rightToLeft unitr.leftToRight . strongl = id`
||| * `lmap (mapSnd f) . strongl = rmap (mapSnd f) . strongl` ||| * `lmap (mapSnd f) . strongl = rmap (mapSnd f) . strongl`
||| * `strongr . strongr = dimap assocr assocl . strongr` ||| * `strongr . strongr = dimap assocr assocl . strongr`
@ -161,8 +161,8 @@ Tensor ten i => ProfunctorComonad (GenTambara ten) where
export export
Associative ten => Symmetric ten => Profunctor p => GenStrong ten (GenTambara ten p) where Associative ten => Symmetric ten => Profunctor p => GenStrong ten (GenTambara ten p) where
strongl (MkTambara p) = MkTambara $ dimap assocr assocl p strongl (MkTambara p) = MkTambara $ dimap assocr assocl p
strongr (MkTambara p) = MkTambara $ dimap (assocr . mapFst swap) strongr (MkTambara p) = MkTambara $ dimap (assocr . mapFst swap')
(mapFst swap . assocl) p (mapFst swap' . assocl) p
export export
Bifunctor ten => Profunctor p => Functor (GenTambara ten p a) where Bifunctor ten => Profunctor p => Functor (GenTambara ten p a) where
@ -223,10 +223,10 @@ export
projoin (MkPastro {x=x',y=y',z=z'} l' (MkPastro {x,y,z} l m r) r') = MkPastro ll m rr projoin (MkPastro {x=x',y=y',z=z'} l' (MkPastro {x,y,z} l m r) r') = MkPastro ll m rr
where where
ll : y `ten` (z' `ten` z) -> b ll : y `ten` (z' `ten` z) -> b
ll = l' . mapFst l . assocl . mapSnd swap ll = l' . mapFst l . assocl . mapSnd swap'
rr : a -> x `ten` (z' `ten` z) rr : a -> x `ten` (z' `ten` z)
rr = mapSnd swap . assocr . mapFst r . r' rr = mapSnd swap' . assocr . mapFst r . r'
export export
ProfunctorAdjunction (GenPastro ten) (GenTambara ten) where ProfunctorAdjunction (GenPastro ten) (GenTambara ten) where
@ -244,9 +244,9 @@ export
strongr (MkPastro {x,y,z} l m r) = MkPastro l' m r' strongr (MkPastro {x,y,z} l m r) = MkPastro l' m r'
where where
l' : y `ten` (c `ten` z) -> c `ten` b l' : y `ten` (c `ten` z) -> c `ten` b
l' = swap . mapFst l . assocl . mapSnd swap l' = swap' . mapFst l . assocl . mapSnd swap'
r' : c `ten` a -> x `ten` (c `ten` z) r' : c `ten` a -> x `ten` (c `ten` z)
r' = mapSnd swap . assocr . mapFst r . swap r' = mapSnd swap' . assocr . mapFst r . swap'
||| The monad generated by the reflective subcategory of profunctors that ||| The monad generated by the reflective subcategory of profunctors that

View file

@ -128,12 +128,12 @@ Profunctor p => Profunctor (CofreeTraversing p) where
export export
Profunctor p => GenStrong Pair (CofreeTraversing p) where Profunctor p => GenStrong Pair (CofreeTraversing p) where
strongr (MkCFT p) = MkCFT (p @{Compose @{%search} @{TraversablePair}}) strongr (MkCFT p) = MkCFT (p @{Compose @{%search} @{TraversablePair}})
strongl = dimap Builtin.swap Builtin.swap . strongr {p=CofreeTraversing p} strongl = dimap swap' swap' . strongr {p=CofreeTraversing p}
export export
Profunctor p => GenStrong Either (CofreeTraversing p) where Profunctor p => GenStrong Either (CofreeTraversing p) where
strongr (MkCFT p) = MkCFT (p @{Compose {f=Either c}}) strongr (MkCFT p) = MkCFT (p @{Compose {f=Either c}})
strongl = dimap swap swap . strongr {p=CofreeTraversing p} strongl = dimap swap' swap' . strongr {p=CofreeTraversing p}
export export
Profunctor p => Traversing (CofreeTraversing p) where Profunctor p => Traversing (CofreeTraversing p) where
@ -182,12 +182,12 @@ Profunctor (FreeTraversing p) where
export export
GenStrong Pair (FreeTraversing p) where GenStrong Pair (FreeTraversing p) where
strongr (MkFT l m r) = MkFT @{Compose @{TraversablePair}} (map l) m (map r) strongr (MkFT l m r) = MkFT @{Compose @{TraversablePair}} (map l) m (map r)
strongl = dimap Builtin.swap Builtin.swap . strongr {p=FreeTraversing p} strongl = dimap swap' swap' . strongr {p=FreeTraversing p}
export export
GenStrong Either (FreeTraversing p) where GenStrong Either (FreeTraversing p) where
strongr (MkFT l m r) = MkFT @{Compose {t=Either c}} (map l) m (map r) strongr (MkFT l m r) = MkFT @{Compose {t=Either c}} (map l) m (map r)
strongl = dimap swap swap . strongr {p=FreeTraversing p} strongl = dimap swap' swap' . strongr {p=FreeTraversing p}
export export
Traversing (FreeTraversing p) where Traversing (FreeTraversing p) where

View file

@ -34,11 +34,11 @@ interface Bifunctor ten => Associative ten where
||| The bifunctor `ten` is generally also associative. ||| The bifunctor `ten` is generally also associative.
public export public export
interface Bifunctor ten => Symmetric ten where interface Bifunctor ten => Symmetric ten where
swap : a `ten` b -> b `ten` a swap' : a `ten` b -> b `ten` a
swap = symmetric.leftToRight swap' = symmetric.leftToRight
symmetric : a `ten` b <=> b `ten` a symmetric : a `ten` b <=> b `ten` a
symmetric = MkEquivalence swap swap symmetric = MkEquivalence swap' swap'
||| A tensor product is an associative bifunctor that has an identity element ||| A tensor product is an associative bifunctor that has an identity element
@ -65,7 +65,7 @@ Associative Pair where
export export
Symmetric Pair where Symmetric Pair where
swap = Builtin.swap swap' = swap
export export
Tensor Pair () where Tensor Pair () where
@ -90,7 +90,7 @@ Associative Either where
export export
Symmetric Either where Symmetric Either where
swap = either Right Left swap' = either Right Left
export export
Tensor Either Void where Tensor Either Void where