Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
The Group hierarchy
Synopsis
- class Magma a where
- (⊕) :: a -> a -> a
- class Magma a => Unital a where
- unit :: a
- class Magma a => Associative a
- class Magma a => Commutative a
- class Magma a => Absorbing a where
- absorb :: a
- class Magma a => Invertible a where
- inv :: a -> a
- class Magma a => Idempotent a
- type Group a = (Associative a, Unital a, Invertible a)
- type AbelianGroup a = (Associative a, Unital a, Invertible a, Commutative a)
Documentation
A Magma is a tuple (T,magma) consisting of
- a type a, and
- a function (magma) :: T -> T -> T
The mathematical laws for a magma are:
- magma is defined for all possible pairs of type T, and
- magma is closed in the set of all possible values of type T
or, more tersly,
∀ a, b ∈ T: a ⊕ b ∈ T
These laws are true by construction in haskell: the type signature of ⊕
and the above mathematical laws are synonyms.
class Magma a => Unital a where Source #
A Unital Magma is a magma with an identity element (the unit).
unit ⊕ a = a a ⊕ unit = a
class Magma a => Associative a Source #
An Associative Magma
(a ⊕ b) ⊕ c = a ⊕ (b ⊕ c)
Instances
Associative b => Associative (a -> b) Source # | |
Defined in NumHask.Algebra.Group |
class Magma a => Commutative a Source #
A Commutative Magma is a Magma where the binary operation is commutative.
a ⊕ b = b ⊕ a
Instances
Commutative b => Commutative (a -> b) Source # | |
Defined in NumHask.Algebra.Group |
class Magma a => Absorbing a where Source #
An Absorbing is a Magma with an Absorbing Element
a ⊕ absorb = absorb
class Magma a => Invertible a where Source #
An Invertible Magma
∀ a,b ∈ T: inv a ⊕ (a ⊕ b) = b = (b ⊕ a) ⊕ inv a
Instances
Invertible b => Invertible (a -> b) Source # | |
Defined in NumHask.Algebra.Group |
class Magma a => Idempotent a Source #
An Idempotent Magma is a magma where every element is Idempotent.
a ⊕ a = a
Instances
Idempotent b => Idempotent (a -> b) Source # | |
Defined in NumHask.Algebra.Group |
type Group a = (Associative a, Unital a, Invertible a) Source #
A Group is a Associative, Unital and Invertible Magma.
type AbelianGroup a = (Associative a, Unital a, Invertible a, Commutative a) Source #
An Abelian Group is an Associative, Unital, Invertible and Commutative Magma . In other words, it is a Commutative Group