Copyright | (c) 2020 Emily Pillmore |
---|---|
License | BSD-style |
Maintainer | Emily Pillmore <emilypi@cohomolo.gy>, Reed Mullanix <reedmullanix@gmail.com> |
Stability | stable |
Portability | non-portable |
Safe Haskell | Safe |
Language | Haskell2010 |
Synopsis
- class Monoid m => Group m where
- minus :: Group a => a -> a -> a
- gtimes :: (Group a, Integral n) => n -> a -> a
- (><) :: Group a => a -> a -> a
- conjugate :: Group a => a -> a -> a
- unconjugate :: Group a => a -> a -> a
- pattern Conjugate :: Group a => (a, a) -> (a, a)
- pattern Inverse :: Group g => g -> g
- pattern IdentityElem :: (Eq m, Monoid m) => m
- data Abelianizer a
- abelianize :: (Eq g, Group g) => g -> g -> Abelianizer g
- commutate :: Group g => g -> g -> g
- pattern Abelianized :: (Eq g, Group g) => g -> (g, g)
- pattern Quotiented :: (Eq g, Group g) => (g, g)
- class Group g => Abelian g
Groups
The typeclass of groups (types with an associative binary operation that
has an identity, and all inverses, i.e. a Monoid
with all inverses),
representing the structural symmetries of a mathematical object.
Instances should satisfy the following:
- Right identity
x
<>
mempty
= x- Left identity
mempty
<>
x = x- Associativity
x
<>
(y<>
z) = (x<>
y)<>
z- Concatenation
mconcat
=foldr
(<>
)mempty
- Right inverses
x
<>
invert
x =mempty
- Left inverses
invert
x<>
x =mempty
Some types can be viewed as a group in more than one way,
e.g. both addition and multiplication on numbers.
In such cases we often define newtype
s and make those instances
of Group
, e.g. Sum
and Product
.
Often in practice such differences between addition and
multiplication-like operations matter (e.g. when defining rings), and
so, classes "additive" (the underlying operation is addition-like) and
"multiplicative" group classes are provided in vis AdditiveGroup
and
MultiplicativeGroup
.
Categorically, Group
s may be viewed single-object groupoids.
class Monoid m => Group m where #
Instances
Group combinators
(><) :: Group a => a -> a -> a infixr 6 Source #
Apply (
, commuting its arguments. When the group is abelian,
<>
)a <> b
is identically b <> a
.
Conjugation
conjugate :: Group a => a -> a -> a Source #
Conjugate an element of a group by another element. When the group is abelian, conjugation is the identity.
Symbolically, this is \( (g,a) \mapsto gag^{-1} \).
Examples:
>>>
let x = Sum (3 :: Int)
>>>
conjugate x x
Sum {getSum = 3}
unconjugate :: Group a => a -> a -> a Source #
Apply an inverse conjugate to a conjugated element.
unconjugate . conjugate = id conjugate . unconjugate = id
Examples:
>>>
let x = Sum (3 :: Int)
>>>
unconjugate x (conjugate x x)
Sum {getSum = 3}
pattern Conjugate :: Group a => (a, a) -> (a, a) Source #
Bidirectional pattern for conjugation by a group element
Note: When the underlying Group
is abelian, this
pattern is the identity.
Elements
pattern IdentityElem :: (Eq m, Monoid m) => m Source #
Bidirectional pattern for the identity element.
Abelianization
data Abelianizer a Source #
Quotient a pair of group elements by their commutator.
The of the quotient \( G / [G,G] \) forms an abelian group, and Abelianizer
forms a functor from the category of groups to the category of Abelian groups.
This functor is left adjoint to the inclusion functor \( Ab \rightarrow Grp \),
forming a monad in \( Grp \).
Instances
abelianize :: (Eq g, Group g) => g -> g -> Abelianizer g Source #
Quotient a pair of group elements by their commutator.
Ranging over the entire group, this operation constructs the quotient of the group by its commutator sub-group \( G / [G,G] \).
pattern Abelianized :: (Eq g, Group g) => g -> (g, g) Source #
A unidirectional pattern synonym for elements of a group modulo commutators which are not the identity.
pattern Quotiented :: (Eq g, Group g) => (g, g) Source #
A unidirectional pattern synonym for elements of a group modulo commutators which are the identity.