numhask-0.10.1.1: A numeric class hierarchy.
Safe HaskellSafe-Inferred
LanguageHaskell2010

NumHask.Algebra.Ring

Description

Ring classes

Synopsis

Documentation

class (Additive a, Multiplicative a) => Distributive a Source #

Distributive

\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

Instances details
Distributive Int16 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Distributive Int32 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Distributive Int64 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Distributive Int8 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Distributive Word16 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Distributive Word32 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Distributive Word64 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Distributive Word8 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Distributive Integer Source # 
Instance details

Defined in NumHask.Algebra.Ring

Distributive Natural Source # 
Instance details

Defined in NumHask.Algebra.Ring

Distributive Bool Source # 
Instance details

Defined in NumHask.Algebra.Ring

Distributive Double Source # 
Instance details

Defined in NumHask.Algebra.Ring

Distributive Float Source # 
Instance details

Defined in NumHask.Algebra.Ring

Distributive Int Source # 
Instance details

Defined in NumHask.Algebra.Ring

Distributive Word Source # 
Instance details

Defined in NumHask.Algebra.Ring

(Distributive a, Subtractive a) => Distributive (Complex a) Source # 
Instance details

Defined in NumHask.Data.Complex

(Ord a, Signed a, Integral a, Ring a) => Distributive (Ratio a) Source # 
Instance details

Defined in NumHask.Data.Rational

Distributive b => Distributive (a -> b) Source # 
Instance details

Defined in NumHask.Algebra.Ring

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

Instances details
(Distributive a, Subtractive a) => Ring a Source # 
Instance details

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

Minimal complete definition

Nothing

Methods

star :: a -> a Source #

plus :: a -> a Source #

Instances

Instances details
StarSemiring b => StarSemiring (a -> b) Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

star :: (a -> b) -> a -> b Source #

plus :: (a -> b) -> 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

Instances details
KleeneAlgebra b => KleeneAlgebra (a -> b) Source # 
Instance details

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".

Minimal complete definition

Nothing

Methods

adj :: a -> a Source #

Instances

Instances details
InvolutiveRing Int16 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

adj :: Int16 -> Int16 Source #

InvolutiveRing Int32 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

adj :: Int32 -> Int32 Source #

InvolutiveRing Int64 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

adj :: Int64 -> Int64 Source #

InvolutiveRing Int8 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

adj :: Int8 -> Int8 Source #

InvolutiveRing Word16 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

adj :: Word16 -> Word16 Source #

InvolutiveRing Word32 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

adj :: Word32 -> Word32 Source #

InvolutiveRing Word64 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

adj :: Word64 -> Word64 Source #

InvolutiveRing Word8 Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

adj :: Word8 -> Word8 Source #

InvolutiveRing Integer Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

adj :: Integer -> Integer Source #

InvolutiveRing Natural Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

adj :: Natural -> Natural Source #

InvolutiveRing Double Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

adj :: Double -> Double Source #

InvolutiveRing Float Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

adj :: Float -> Float Source #

InvolutiveRing Int Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

adj :: Int -> Int Source #

InvolutiveRing Word Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

adj :: Word -> Word Source #

(Distributive a, Subtractive a) => InvolutiveRing (Complex a) Source # 
Instance details

Defined in NumHask.Data.Complex

Methods

adj :: Complex a -> Complex a Source #

InvolutiveRing b => InvolutiveRing (a -> b) Source # 
Instance details

Defined in NumHask.Algebra.Ring

Methods

adj :: (a -> b) -> a -> b Source #

two :: (Multiplicative a, Additive a) => a Source #

Defining two requires adding the multiplicative unital to itself. In other words, the concept of two is a Ring one.

>>> two
2