Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Ring classes
Synopsis
- class (Additive a, Multiplicative a) => Distributive a
- class (Distributive a, Subtractive a) => Ring a
- class Distributive a => StarSemiring a where
- class (StarSemiring a, Idempotent a) => KleeneAlgebra a
- class Distributive a => InvolutiveRing a where
- adj :: a -> a
- two :: (Multiplicative a, Additive a) => a
Documentation
class (Additive a, Multiplicative a) => Distributive a Source #
\a b c -> a * (b + c) == a * b + a * c
\a b c -> (a + b) * c == a * c + b * c
\a -> zero * a == zero
\a -> a * zero == zero
The sneaking in of the Absorption laws here glosses over the possibility that the multiplicative zero element does not have to correspond with the additive unital zero.
Instances
class (Distributive a, Subtractive a) => Ring a Source #
A Ring is an abelian group under addition (Unital
, Associative
, Commutative
, Invertible
) and monoidal under multiplication (Unital
, Associative
), and where multiplication distributes over addition.
\a -> zero + a == a \a -> a + zero == a \a b c -> (a + b) + c == a + (b + c) \a b -> a + b == b + a \a -> a - a == zero \a -> negate a == zero - a \a -> negate a + a == zero \a -> a + negate a == zero \a -> one * a == a \a -> a * one == a \a b c -> (a * b) * c == a * (b * c) \a b c -> a * (b + c) == a * b + a * c \a b c -> (a + b) * c == a * c + b * c \a -> zero * a == zero \a -> a * zero == zero
Instances
(Distributive a, Subtractive a) => Ring a Source # | |
Defined in NumHask.Algebra.Ring |
class Distributive a => StarSemiring a where Source #
A StarSemiring is a semiring with an additional unary operator (star) satisfying:
\a -> star a == one + a * star a
Nothing
Instances
StarSemiring b => StarSemiring (a -> b) Source # | |
class (StarSemiring a, Idempotent a) => KleeneAlgebra a Source #
A Kleene Algebra is a Star Semiring with idempotent addition.
a * x + x = a ==> star a * x + x = x x * a + x = a ==> x * star a + x = x
Instances
KleeneAlgebra b => KleeneAlgebra (a -> b) Source # | |
Defined in NumHask.Algebra.Ring |
class Distributive a => InvolutiveRing a where Source #
Involutive Ring
adj (a + b) ==> adj a + adj b adj (a * b) ==> adj a * adj b adj one ==> one adj (adj a) ==> a
Note: elements for which adj a == a
are called "self-adjoint".
Nothing