Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Synopsis
- type FreeAlgebra a f = (FreeSemimodule a f, Algebra a (Rep f))
- class Semiring a => Algebra a b where
- diag :: FreeAlgebra a f => (f ** f) a -> f a
- (.*.) :: FreeAlgebra a f => f a -> f a -> f a
- type FreeUnital a f = (FreeAlgebra a f, Unital a (Rep f))
- class Algebra a b => Unital a b where
- unit :: FreeUnital a f => a -> f a
- unit' :: FreeUnital a f => f a
- type FreeCoalgebra a f = (FreeSemimodule a f, Coalgebra a (Rep f))
- class Semiring a => Coalgebra a c where
- cojoined :: (c -> a) -> c -> c -> a
- codiagonal :: Tran a (c, c) c
- codiag :: FreeCoalgebra a f => f a -> (f ** f) a
- convolve :: Algebra a b => Coalgebra a c => Tran a b c -> Tran a b c -> Tran a b c
- type FreeCounital a f = (FreeCoalgebra a f, Counital a (Rep f))
- class Coalgebra a c => Counital a c where
- counit :: FreeCounital a f => f a -> a
- type FreeBialgebra a f = (FreeAlgebra a f, FreeCoalgebra a f, Bialgebra a (Rep f))
- class (Unital a b, Counital a b) => Bialgebra a b
- newtype Tran a b c = Tran {
- runTran :: (c -> a) -> b -> a
- type Endo a b = Tran a b b
- image :: Semiring a => (b -> [(a, c)]) -> Tran a b c
- (!#) :: Free f => Free g => Tran a (Rep f) (Rep g) -> g a -> f a
- (#!) :: Free f => Free g => g a -> Tran a (Rep f) (Rep g) -> f a
- (!#!) :: Tran a c d -> Tran a b c -> Tran a b d
- dimap' :: (b1 -> b2) -> (c1 -> c2) -> Tran a b2 c1 -> Tran a b1 c2
- lmap' :: (b1 -> b2) -> Tran a b2 c -> Tran a b1 c
- rmap' :: (c1 -> c2) -> Tran a b c1 -> Tran a b c2
- invmap :: (a1 -> a2) -> (a2 -> a1) -> Tran a1 b c -> Tran a2 b c
- braid :: Tran a (b, c) (c, b)
- cobraid :: Tran a (b + c) (c + b)
- split :: (b -> (b1, b2)) -> Tran a b1 c -> Tran a b2 c -> Tran a b c
- cosplit :: ((c1 + c2) -> c) -> Tran a b c1 -> Tran a b c2 -> Tran a b c
- projl :: Free f => Free g => (f ++ g) a -> f a
- projr :: Free f => Free g => (f ++ g) a -> g a
- compl :: Free f1 => Free f2 => Free g => Tran a (Rep f1) (Rep f2) -> (f2 ** g) a -> (f1 ** g) a
- compr :: Free f => Free g1 => Free g2 => Tran a (Rep g1) (Rep g2) -> (f ** g2) a -> (f ** g1) a
- complr :: Free f1 => Free f2 => Free g1 => Free g2 => Tran a (Rep f1) (Rep f2) -> Tran a (Rep g1) (Rep g2) -> (f2 ** g2) a -> (f1 ** g1) a
Algebras
type FreeAlgebra a f = (FreeSemimodule a f, Algebra a (Rep f)) Source #
An algebra over a free module f.
Note that this is distinct from a free algebra.
class Semiring a => Algebra a b where Source #
An algebra algebra over a semiring.
Note that the algebra needn't be associative.
Nothing
Instances
Semiring a => Algebra a IntSet Source # | |
Semiring a => Algebra a () Source # | |
Semiring r => Algebra r E4 Source # | |
Semiring r => Algebra r E3 Source # | |
Semiring r => Algebra r E2 Source # | |
Semiring r => Algebra r E1 Source # | |
(Semiring a, Ord b) => Algebra a (Set b) Source # | |
Semiring a => Algebra a (Seq b) Source # | |
Semiring a => Algebra a [b] Source # | Tensor algebra on b.
|
(Algebra a b1, Algebra a b2) => Algebra a (b1, b2) Source # | |
(Algebra a b1, Algebra a b2, Algebra a b3) => Algebra a (b1, b2, b3) Source # | |
diag :: FreeAlgebra a f => (f ** f) a -> f a Source #
(.*.) :: FreeAlgebra a f => f a -> f a -> f a infixl 7 Source #
Multiplication operator on an algebra over a free semimodule.
Caution in general (.*.) needn't be commutative, nor associative.
Unital Algebras
type FreeUnital a f = (FreeAlgebra a f, Unital a (Rep f)) Source #
A unital algebra over a free semimodule f.
class Algebra a b => Unital a b where Source #
A unital algebra over a semiring.
Nothing
Instances
Semiring a => Unital a IntSet Source # | |
Semiring a => Unital a () Source # | |
Semiring r => Unital r E4 Source # | |
Semiring r => Unital r E3 Source # | |
Semiring r => Unital r E2 Source # | |
Semiring r => Unital r E1 Source # | |
(Semiring a, Ord b) => Unital a (Set b) Source # | |
Semiring a => Unital a (Seq b) Source # | |
Semiring a => Unital a [b] Source # | |
(Unital a b1, Unital a b2) => Unital a (b1, b2) Source # | |
(Unital a b1, Unital a b2, Unital a b3) => Unital a (b1, b2, b3) Source # | |
unit :: FreeUnital a f => a -> f a Source #
Insert an element into an algebra.
>>>
V4 1 2 3 4 .*. unit two :: V4 Int
V4 2 4 6 8
unit' :: FreeUnital a f => f a Source #
Unital element of a unital algebra over a free semimodule.
>>>
unit one :: Complex Int
1 :+ 0
Coalgebras
type FreeCoalgebra a f = (FreeSemimodule a f, Coalgebra a (Rep f)) Source #
A coalgebra over a free semimodule f.
class Semiring a => Coalgebra a c where Source #
A coalgebra over a semiring.
Nothing
Instances
Semiring a => Coalgebra a IntSet Source # | The free commutative band coalgebra over Int |
Semiring a => Coalgebra a () Source # | |
Defined in Data.Semimodule.Algebra | |
Semiring r => Coalgebra r E4 Source # | |
Semiring r => Coalgebra r E3 Source # | |
Semiring r => Coalgebra r E2 Source # | |
Semiring r => Coalgebra r E1 Source # | |
(Semiring a, Ord c) => Coalgebra a (Set c) Source # | The free commutative band coalgebra |
Semiring a => Coalgebra a (Seq c) Source # | |
Semiring a => Coalgebra a [c] Source # | The tensor coalgebra on c. |
Defined in Data.Semimodule.Algebra | |
Algebra a b => Coalgebra a (b -> a) Source # | |
Defined in Data.Semimodule.Algebra | |
(Coalgebra a c1, Coalgebra a c2) => Coalgebra a (c1, c2) Source # | |
Defined in Data.Semimodule.Algebra | |
(Coalgebra a c1, Coalgebra a c2, Coalgebra a c3) => Coalgebra a (c1, c2, c3) Source # | |
Defined in Data.Semimodule.Algebra |
codiag :: FreeCoalgebra a f => f a -> (f ** f) a Source #
convolve :: Algebra a b => Coalgebra a c => Tran a b c -> Tran a b c -> Tran a b c Source #
Convolution with an associative algebra and coassociative coalgebra
Unital Coalgebras
type FreeCounital a f = (FreeCoalgebra a f, Counital a (Rep f)) Source #
A counital coalgebra over a free semimodule f.
class Coalgebra a c => Counital a c where Source #
A counital coalgebra over a semiring.
Nothing
Instances
Semiring a => Counital a IntSet Source # | |
Semiring a => Counital a () Source # | |
Semiring r => Counital r E4 Source # | |
Semiring r => Counital r E3 Source # | |
Semiring r => Counital r E2 Source # | |
Semiring r => Counital r E1 Source # | |
(Semiring a, Ord c) => Counital a (Set c) Source # | |
Semiring a => Counital a (Seq c) Source # | |
Semiring a => Counital a [c] Source # | |
Unital a b => Counital a (b -> a) Source # | |
(Counital a c1, Counital a c2) => Counital a (c1, c2) Source # | |
(Counital a c1, Counital a c2, Counital a c3) => Counital a (c1, c2, c3) Source # | |
counit :: FreeCounital a f => f a -> a Source #
Obtain an element from a coalgebra over a free semimodule.
Bialgebras
type FreeBialgebra a f = (FreeAlgebra a f, FreeCoalgebra a f, Bialgebra a (Rep f)) Source #
A bialgebra over a free semimodule f.
class (Unital a b, Counital a b) => Bialgebra a b Source #
A bialgebra over a semiring.
Instances
Semiring a => Bialgebra a () Source # | |
Defined in Data.Semimodule.Algebra | |
Semiring r => Bialgebra r E4 Source # | |
Defined in Data.Semimodule.Basis | |
Semiring r => Bialgebra r E3 Source # | |
Defined in Data.Semimodule.Basis | |
Semiring r => Bialgebra r E2 Source # | |
Defined in Data.Semimodule.Basis | |
Semiring r => Bialgebra r E1 Source # | |
Defined in Data.Semimodule.Basis | |
Semiring a => Bialgebra a (Seq b) Source # | |
Defined in Data.Semimodule.Algebra | |
Semiring a => Bialgebra a [b] Source # | |
Defined in Data.Semimodule.Algebra | |
(Bialgebra a b1, Bialgebra a b2) => Bialgebra a (b1, b2) Source # | |
Defined in Data.Semimodule.Algebra | |
(Bialgebra a b1, Bialgebra a b2, Bialgebra a b3) => Bialgebra a (b1, b2, b3) Source # | |
Defined in Data.Semimodule.Algebra |
Tran
A linear transformation between free semimodules indexed with bases b and c.
f!#
x+
y = (f!#
x) + (f!#
y) f!#
(r.*
x) = r.*
(f!#
x)
Caution: You must ensure these laws hold when using the default constructor.
Instances
type Endo a b = Tran a b b Source #
An endomorphism over a free semimodule.
>>>
one + two !# V2 1 2 :: V2 Double
V2 3.0 6.0
image :: Semiring a => (b -> [(a, c)]) -> Tran a b c Source #
Create a Tran
from a linear combination of basis vectors.
>>>
image (e2 [(2, E31),(3, E32)] [(1, E33)]) !# V3 1 1 1 :: V2 Int
V2 5 1
(!#) :: Free f => Free g => Tran a (Rep f) (Rep g) -> g a -> f a infixr 2 Source #
Apply a transformation to a vector.
(#!) :: Free f => Free g => g a -> Tran a (Rep f) (Rep g) -> f a infixl 2 Source #
Apply a transformation to a vector.
dimap' :: (b1 -> b2) -> (c1 -> c2) -> Tran a b2 c1 -> Tran a b1 c2 Source #
Tran
is a profunctor in the category of semimodules.
Caution: Arbitrary mapping functions may violate linearity.
>>>
dimap' id (e3 True True False) (arr id) !# 4 :+ 5 :: V3 Int
V3 5 5 4
invmap :: (a1 -> a2) -> (a2 -> a1) -> Tran a1 b c -> Tran a2 b c Source #
Tran
is an invariant functor.
Common linear transformations
projl :: Free f => Free g => (f ++ g) a -> f a Source #
Project onto the left-hand component of a direct sum.
projr :: Free f => Free g => (f ++ g) a -> g a Source #
Project onto the right-hand component of a direct sum.
compl :: Free f1 => Free f2 => Free g => Tran a (Rep f1) (Rep f2) -> (f2 ** g) a -> (f1 ** g) a Source #
Left (post) composition with a linear transformation.