numhask-0.11.1.0: A numeric class hierarchy.
Safe HaskellSafe-Inferred
LanguageGHC2021

NumHask.Algebra.Ring

Description

Ring classes

Synopsis

Documentation

type Distributive a = (Additive a, Multiplicative 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.

type Ring a = (Distributive a, Subtractive 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

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

star | plus

Methods

star :: a -> a Source #

plus :: a -> a 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

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 #

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