algebra-3.1: Constructive abstract algebra

Safe Haskell | None

Numeric.Algebra.Class

Contents

- Multiplicative Semigroups
- Semirings
- Left and Right Modules
- Additive Monoids
- Associative algebras
- Coassociative coalgebras

Synopsis

- class Multiplicative r where
  - (*) :: r -> r -> r
  - pow1p :: Whole n => r -> n -> r
  - productWith1 :: Foldable1 f => (a -> r) -> f a -> r
- pow1pIntegral :: (Integral r, Integral n) => r -> n -> r
- product1 :: (Foldable1 f, Multiplicative r) => f r -> r
- class (Additive r, Abelian r, Multiplicative r) => Semiring r
- class (Semiring r, Additive m) => LeftModule r m where
  - (.*) :: r -> m -> m
- class (Semiring r, Additive m) => RightModule r m where
  - (*.) :: m -> r -> m
- class (LeftModule r m, RightModule r m) => Module r m
- class (LeftModule Natural m, RightModule Natural m) => Monoidal m where
  - zero :: m
  - sinnum :: Whole n => n -> m -> m
  - sumWith :: Foldable f => (a -> m) -> f a -> m
- sum :: (Foldable f, Monoidal m) => f m -> m
- sinnumIdempotent :: (Integral n, Idempotent r, Monoidal r) => n -> r -> r
- class Semiring r => Algebra r a where
  - mult :: (a -> a -> r) -> a -> r
- class Semiring r => Coalgebra r c where
  - comult :: (c -> r) -> c -> c -> r

# Multiplicative Semigroups

class Multiplicative r where Source

A multiplicative semigroup

Methods

(*) :: r -> r -> rSource

pow1p :: Whole n => r -> n -> rSource

productWith1 :: Foldable1 f => (a -> r) -> f a -> rSource

Instances

Multiplicative Bool |
Multiplicative Int |
Multiplicative Int8 |
Multiplicative Int16 |
Multiplicative Int32 |
Multiplicative Int64 |
Multiplicative Integer |
Multiplicative Word |
Multiplicative Word8 |
Multiplicative Word16 |
Multiplicative Word32 |
Multiplicative Word64 |
Multiplicative () |
Multiplicative Natural |
Multiplicative Euclidean |
(Commutative r, Rng r) => Multiplicative (Complex r) |
(TriviallyInvolutive r, Rng r) => Multiplicative (Quaternion r) |
(Commutative r, Rng r) => Multiplicative (Dual r) |
(Commutative k, Semiring k) => Multiplicative (Hyper' k) |
(Commutative k, Semiring k) => Multiplicative (Hyper k) |
(Commutative r, Rng r) => Multiplicative (Dual' r) |
Multiplicative (BasisCoblade m) |
(TriviallyInvolutive r, Semiring r) => Multiplicative (Quaternion' r) |
(Commutative k, Rng k) => Multiplicative (Trig k) |
Additive r => Multiplicative (Exp r) |
Multiplicative (End r) |
Multiplicative r => Multiplicative (Opposite r) |
Rng r => Multiplicative (RngRing r) |
Monoidal r => Multiplicative (ZeroRng r) |
Algebra r a => Multiplicative (a -> r) |
(Multiplicative a, Multiplicative b) => Multiplicative (a, b) |
(HasTrie a, Algebra r a) => Multiplicative (:->: a r) |
Multiplicative (Rect i j) |
Coalgebra r m => Multiplicative (Covector r m) |
(Multiplicative a, Multiplicative b, Multiplicative c) => Multiplicative (a, b, c) |
Coalgebra r m => Multiplicative (Map r b m) |
(Multiplicative a, Multiplicative b, Multiplicative c, Multiplicative d) => Multiplicative (a, b, c, d) |
(Multiplicative a, Multiplicative b, Multiplicative c, Multiplicative d, Multiplicative e) => Multiplicative (a, b, c, d, e) |

pow1pIntegral :: (Integral r, Integral n) => r -> n -> rSource

product1 :: (Foldable1 f, Multiplicative r) => f r -> rSource

# Semirings

class (Additive r, Abelian r, Multiplicative r) => Semiring r Source

A pair of an additive abelian semigroup, and a multiplicative semigroup, with the distributive laws:

     a(b + c) = ab + ac -- left distribution (we are a LeftNearSemiring)
     (a + b)c = ac + bc -- right distribution (we are a [Right]NearSemiring)

Common notation includes the laws for additive and multiplicative identity in semiring.

If you want that, look at `Rig` instead.

Ideally we'd use the cyclic definition:

     class (LeftModule r r, RightModule r r, Additive r, Abelian r, Multiplicative r) => Semiring r

to enforce that every semiring r is an r-module over itself, but Haskell doesn't like that.

Instances

Semiring Bool |
Semiring Int |
Semiring Int8 |
Semiring Int16 |
Semiring Int32 |
Semiring Int64 |
Semiring Integer |
Semiring Word |
Semiring Word8 |
Semiring Word16 |
Semiring Word32 |
Semiring Word64 |
Semiring () |
Semiring Natural |
Semiring Euclidean |
(Commutative r, Rng r) => Semiring (Complex r) |
(TriviallyInvolutive r, Rng r) => Semiring (Quaternion r) |
(Commutative r, Rng r) => Semiring (Dual r) |
(Commutative k, Semiring k) => Semiring (Hyper' k) |
(Commutative k, Semiring k) => Semiring (Hyper k) |
(Commutative r, Rng r) => Semiring (Dual' r) |
Semiring (BasisCoblade m) |
(TriviallyInvolutive r, Semiring r) => Semiring (Quaternion' r) |
(Commutative k, Rng k) => Semiring (Trig k) |
(Abelian r, Monoidal r) => Semiring (End r) |
Semiring r => Semiring (Opposite r) |
Rng r => Semiring (RngRing r) |
(Monoidal r, Abelian r) => Semiring (ZeroRng r) |
Algebra r a => Semiring (a -> r) |
(Semiring a, Semiring b) => Semiring (a, b) |
(HasTrie a, Algebra r a) => Semiring (:->: a r) |
Coalgebra r m => Semiring (Covector r m) |
(Semiring a, Semiring b, Semiring c) => Semiring (a, b, c) |
Coalgebra r m => Semiring (Map r b m) |
(Semiring a, Semiring b, Semiring c, Semiring d) => Semiring (a, b, c, d) |
(Semiring a, Semiring b, Semiring c, Semiring d, Semiring e) => Semiring (a, b, c, d, e) |

# Left and Right Modules

class (Semiring r, Additive m) => LeftModule r m where Source

Methods

(.*) :: r -> m -> mSource

Instances

LeftModule Integer Int |
LeftModule Integer Int8 |
LeftModule Integer Int16 |
LeftModule Integer Int32 |
LeftModule Integer Int64 |
LeftModule Integer Integer |
LeftModule Integer Word |
LeftModule Integer Word8 |
LeftModule Integer Word16 |
LeftModule Integer Word32 |
LeftModule Integer Word64 |
LeftModule Integer Euclidean |
Additive m => LeftModule () m |
Semiring r => LeftModule r () |
LeftModule Natural Bool |
LeftModule Natural Int |
LeftModule Natural Int8 |
LeftModule Natural Int16 |
LeftModule Natural Int32 |
LeftModule Natural Int64 |
LeftModule Natural Integer |
LeftModule Natural Word |
LeftModule Natural Word8 |
LeftModule Natural Word16 |
LeftModule Natural Word32 |
LeftModule Natural Word64 |
LeftModule Natural Natural |
LeftModule Natural Euclidean |
Division r => LeftModule Integer (Log r) |
(Abelian r, Group r) => LeftModule Integer (RngRing r) |
Group r => LeftModule Integer (ZeroRng r) |
LeftModule r s => LeftModule r (Complex s) |
LeftModule r s => LeftModule r (Quaternion s) |
LeftModule r s => LeftModule r (Dual s) |
LeftModule r s => LeftModule r (Hyper' s) |
LeftModule r s => LeftModule r (Hyper s) |
LeftModule r s => LeftModule r (Dual' s) |
LeftModule r s => LeftModule r (Quaternion' s) |
LeftModule r s => LeftModule r (Trig s) |
LeftModule r m => LeftModule r (End m) |
RightModule r s => LeftModule r (Opposite s) |
LeftModule Natural (BasisCoblade m) |
Unital r => LeftModule Natural (Log r) |
(Abelian r, Monoidal r) => LeftModule Natural (RngRing r) |
Monoidal r => LeftModule Natural (ZeroRng r) |
(LeftModule r a, LeftModule r b) => LeftModule r (a, b) |
(HasTrie e, LeftModule r m) => LeftModule r (:->: e m) |
LeftModule r m => LeftModule r (e -> m) |
LeftModule r s => LeftModule r (Covector s m) |
(LeftModule r a, LeftModule r b, LeftModule r c) => LeftModule r (a, b, c) |
LeftModule r s => LeftModule r (Map s b m) |
(LeftModule r a, LeftModule r b, LeftModule r c, LeftModule r d) => LeftModule r (a, b, c, d) |
(LeftModule r a, LeftModule r b, LeftModule r c, LeftModule r d, LeftModule r e) => LeftModule r (a, b, c, d, e) |
(Commutative r, Rng r) => LeftModule (Complex r) (Complex r) |
(TriviallyInvolutive r, Rng r) => LeftModule (Quaternion r) (Quaternion r) |
(Commutative r, Rng r) => LeftModule (Dual r) (Dual r) |
(Commutative r, Semiring r) => LeftModule (Hyper' r) (Hyper' r) |
(Commutative r, Semiring r) => LeftModule (Hyper r) (Hyper r) |
(Commutative r, Rng r) => LeftModule (Dual' r) (Dual' r) |
(TriviallyInvolutive r, Rng r) => LeftModule (Quaternion' r) (Quaternion' r) |
(Commutative r, Rng r) => LeftModule (Trig r) (Trig r) |
(Monoidal m, Abelian m) => LeftModule (End m) (End m) |
Semiring r => LeftModule (Opposite r) (Opposite r) |
Rng s => LeftModule (RngRing s) (RngRing s) |
Coalgebra r m => LeftModule (Covector r m) (Covector r m) |
Coalgebra r m => LeftModule (Map r b m) (Map r b m) |

class (Semiring r, Additive m) => RightModule r m where Source

Methods

(*.) :: m -> r -> mSource

Instances

RightModule Integer Int |
RightModule Integer Int8 |
RightModule Integer Int16 |
RightModule Integer Int32 |
RightModule Integer Int64 |
RightModule Integer Integer |
RightModule Integer Word |
RightModule Integer Word8 |
RightModule Integer Word16 |
RightModule Integer Word32 |
RightModule Integer Word64 |
RightModule Integer Euclidean |
Additive m => RightModule () m |
Semiring r => RightModule r () |
RightModule Natural Bool |
RightModule Natural Int |
RightModule Natural Int8 |
RightModule Natural Int16 |
RightModule Natural Int32 |
RightModule Natural Int64 |
RightModule Natural Integer |
RightModule Natural Word |
RightModule Natural Word8 |
RightModule Natural Word16 |
RightModule Natural Word32 |
RightModule Natural Word64 |
RightModule Natural Natural |
RightModule Natural Euclidean |
Division r => RightModule Integer (Log r) |
(Abelian r, Group r) => RightModule Integer (RngRing r) |
Group r => RightModule Integer (ZeroRng r) |
RightModule r s => RightModule r (Complex s) |
RightModule r s => RightModule r (Quaternion s) |
RightModule r s => RightModule r (Dual s) |
RightModule r s => RightModule r (Hyper' s) |
RightModule r s => RightModule r (Hyper s) |
RightModule r s => RightModule r (Dual' s) |
RightModule r s => RightModule r (Quaternion' s) |
RightModule r s => RightModule r (Trig s) |
RightModule r m => RightModule r (End m) |
LeftModule r s => RightModule r (Opposite s) |
RightModule Natural (BasisCoblade m) |
Unital r => RightModule Natural (Log r) |
(Abelian r, Monoidal r) => RightModule Natural (RngRing r) |
Monoidal r => RightModule Natural (ZeroRng r) |
(RightModule r a, RightModule r b) => RightModule r (a, b) |
(HasTrie e, RightModule r m) => RightModule r (:->: e m) |
RightModule r m => RightModule r (e -> m) |
RightModule r s => RightModule r (Covector s m) |
(RightModule r a, RightModule r b, RightModule r c) => RightModule r (a, b, c) |
RightModule r s => RightModule r (Map s b m) |
(RightModule r a, RightModule r b, RightModule r c, RightModule r d) => RightModule r (a, b, c, d) |
(RightModule r a, RightModule r b, RightModule r c, RightModule r d, RightModule r e) => RightModule r (a, b, c, d, e) |
(Commutative r, Rng r) => RightModule (Complex r) (Complex r) |
(TriviallyInvolutive r, Rng r) => RightModule (Quaternion r) (Quaternion r) |
(Commutative r, Rng r) => RightModule (Dual r) (Dual r) |
(Commutative r, Semiring r) => RightModule (Hyper' r) (Hyper' r) |
(Commutative r, Semiring r) => RightModule (Hyper r) (Hyper r) |
(Commutative r, Rng r) => RightModule (Dual' r) (Dual' r) |
(TriviallyInvolutive r, Rng r) => RightModule (Quaternion' r) (Quaternion' r) |
(Commutative r, Rng r) => RightModule (Trig r) (Trig r) |
(Monoidal m, Abelian m) => RightModule (End m) (End m) |
Semiring r => RightModule (Opposite r) (Opposite r) |
Rng s => RightModule (RngRing s) (RngRing s) |
Coalgebra r m => RightModule (Covector r m) (Covector r m) |
Coalgebra r m => RightModule (Map r b m) (Map r b m) |

class (LeftModule r m, RightModule r m) => Module r m Source

Instances

(LeftModule r m, RightModule r m) => Module r m |

# Additive Monoids

class (LeftModule Natural m, RightModule Natural m) => Monoidal m where Source

An additive monoid

     zero + a = a = a + zero

Methods

zero :: mSource

sinnum :: Whole n => n -> m -> mSource

sumWith :: Foldable f => (a -> m) -> f a -> mSource

Instances

Monoidal Bool |
Monoidal Int |
Monoidal Int8 |
Monoidal Int16 |
Monoidal Int32 |
Monoidal Int64 |
Monoidal Integer |
Monoidal Word |
Monoidal Word8 |
Monoidal Word16 |
Monoidal Word32 |
Monoidal Word64 |
Monoidal () |
Monoidal Natural |
Monoidal Euclidean |
Monoidal r => Monoidal (Complex r) |
Monoidal r => Monoidal (Quaternion r) |
Monoidal r => Monoidal (Dual r) |
Monoidal r => Monoidal (Hyper' r) |
Monoidal r => Monoidal (Hyper r) |
Monoidal r => Monoidal (Dual' r) |
Monoidal (BasisCoblade m) |
Monoidal r => Monoidal (Quaternion' r) |
Monoidal r => Monoidal (Trig r) |
Unital r => Monoidal (Log r) |
Monoidal r => Monoidal (End r) |
Monoidal r => Monoidal (Opposite r) |
(Abelian r, Monoidal r) => Monoidal (RngRing r) |
Monoidal r => Monoidal (ZeroRng r) |
Monoidal r => Monoidal (e -> r) |
(Monoidal a, Monoidal b) => Monoidal (a, b) |
(HasTrie e, Monoidal r) => Monoidal (:->: e r) |
Monoidal s => Monoidal (Covector s a) |
(Monoidal a, Monoidal b, Monoidal c) => Monoidal (a, b, c) |
Monoidal s => Monoidal (Map s b a) |
(Monoidal a, Monoidal b, Monoidal c, Monoidal d) => Monoidal (a, b, c, d) |
(Monoidal a, Monoidal b, Monoidal c, Monoidal d, Monoidal e) => Monoidal (a, b, c, d, e) |

sum :: (Foldable f, Monoidal m) => f m -> mSource

sinnumIdempotent :: (Integral n, Idempotent r, Monoidal r) => n -> r -> rSource

# Associative algebras

class Semiring r => Algebra r a where Source

An associative algebra built with a free module over a semiring

Methods

mult :: (a -> a -> r) -> a -> rSource

Instances

Algebra () a |
Semiring r => Algebra r IntSet |
Semiring r => Algebra r () |
Rng k => Algebra k ComplexBasis |
(TriviallyInvolutive r, Rng r) => Algebra r QuaternionBasis | the quaternion algebra
Rng k => Algebra k DualBasis |
(Commutative k, Semiring k) => Algebra k HyperBasis' |
Semiring k => Algebra k HyperBasis | the trivial diagonal algebra
Semiring k => Algebra k DualBasis' |
(TriviallyInvolutive r, Semiring r) => Algebra r QuaternionBasis' | the trivial diagonal algebra
(Commutative k, Rng k) => Algebra k TrigBasis |
(Semiring r, Monoidal r, Partitionable a) => Algebra r (IntMap a) |
(Semiring r, Ord a) => Algebra r (Set a) |
Semiring r => Algebra r (Seq a) | The tensor algebra
Semiring r => Algebra r [a] | The tensor algebra
(Commutative r, Monoidal r, Semiring r, LocallyFiniteOrder a) => Algebra r (Interval a) |
(Algebra r a, Algebra r b) => Algebra r (a, b) |
(Semiring r, Monoidal r, Ord a, Partitionable b) => Algebra r (Map a b) |
(Algebra r a, Algebra r b, Algebra r c) => Algebra r (a, b, c) |
(Algebra r a, Algebra r b, Algebra r c, Algebra r d) => Algebra r (a, b, c, d) |
(Algebra r a, Algebra r b, Algebra r c, Algebra r d, Algebra r e) => Algebra r (a, b, c, d, e) |

# Coassociative coalgebras

class Semiring r => Coalgebra r c where Source

Methods

comult :: (c -> r) -> c -> c -> rSource

Instances

Semiring r => Coalgebra r IntSet | the free commutative band coalgebra over Int
Semiring r => Coalgebra r () |
Rng k => Coalgebra k ComplexBasis |
(TriviallyInvolutive r, Rng r) => Coalgebra r QuaternionBasis | the trivial diagonal coalgebra
Rng k => Coalgebra k DualBasis |
(Commutative k, Monoidal k, Semiring k) => Coalgebra k HyperBasis' |
(Commutative k, Semiring k) => Coalgebra k HyperBasis | the hyperbolic trigonometric coalgebra
Rng k => Coalgebra k DualBasis' |
(TriviallyInvolutive r, Rng r) => Coalgebra r QuaternionBasis' | dual quaternion comultiplication
(Commutative k, Rng k) => Coalgebra k TrigBasis |
(Semiring r, Additive b) => Coalgebra r (IntMap b) | the free commutative coalgebra over a set and Int
(Semiring r, Ord a) => Coalgebra r (Set a) | the free commutative band coalgebra
Semiring r => Coalgebra r (Seq a) | The tensor Hopf algebra
Semiring r => Coalgebra r [a] | The tensor Hopf algebra
(Commutative r, Monoidal r, Semiring r, PartialSemigroup a) => Coalgebra r (Morphism a) |
(Eq a, Commutative r, Monoidal r, Semiring r) => Coalgebra r (Interval' a) |
Eigenmetric r m => Coalgebra r (BasisCoblade m) |
(Semiring r, Ord a, Additive b) => Coalgebra r (Map a b) | the free commutative coalgebra over a set and a given semigroup
(Coalgebra r a, Coalgebra r b) => Coalgebra r (a, b) |
(HasTrie m, Algebra r m) => Coalgebra r (:->: m r) |
Algebra r m => Coalgebra r (m -> r) | Every coalgebra gives rise to an algebra by vector space duality classically. Sadly, it requires vector space duality, which we cannot use constructively. The dual argument only relies in the fact that any constructive coalgebra can only inspect a finite number of coefficients, which we CAN exploit.
(Coalgebra r a, Coalgebra r b, Coalgebra r c) => Coalgebra r (a, b, c) |
(Coalgebra r a, Coalgebra r b, Coalgebra r c, Coalgebra r d) => Coalgebra r (a, b, c, d) |
(Coalgebra r a, Coalgebra r b, Coalgebra r c, Coalgebra r d, Coalgebra r e) => Coalgebra r (a, b, c, d, e) |