| Copyright | (c) 2020 Reed Mullanix Emily Pillmore |
|---|---|
| License | BSD-style |
| Maintainer | Reed Mullanix <reedmullanix@gmail.com>, Emily Pillmore <emilypi@cohomolo.gy> |
| Stability | stable |
| Portability | non-portable |
| Safe Haskell | Safe |
| Language | Haskell2010 |
Data.Group.Free
Description
This module provides definitions for FreeGroups and FreeAbelianGroups,
along with useful combinators.
Synopsis
- newtype FreeGroup a = FreeGroup {
- runFreeGroup :: [Either a a]
- simplify :: Eq a => FreeGroup a -> FreeGroup a
- interpret :: Group g => FreeGroup g -> g
- interpret' :: Group g => FreeGroup g -> g
- present :: Group g => FreeGroup g -> (FreeGroup g -> g) -> g
- newtype FreeAbelianGroup a = FreeAbelianGroup {
- runFreeAbelian :: Map a Int
- abmap :: Ord b => (a -> b) -> FreeAbelianGroup a -> FreeAbelianGroup b
- abjoin :: Ord a => FreeAbelianGroup (FreeAbelianGroup a) -> FreeAbelianGroup a
- singleton :: a -> FreeAbelianGroup a
- abInterpret :: Group g => FreeAbelianGroup g -> g
Free groups
A representation of a free group over an alphabet a.
The intuition here is that Left a represents a "negative" a,
whereas Right a represents "positive" a.
Note: This does not perform simplification upon multiplication or construction.
To do this, one should use simplify.
Constructors
| FreeGroup | |
Fields
| |
Instances
| Monad FreeGroup Source # | |
| Functor FreeGroup Source # | |
| Applicative FreeGroup Source # | |
| Alternative FreeGroup Source # | |
| Cancelative FreeGroup Source # | |
| GroupFoldable FreeGroup Source # | |
| Eq a => Eq (FreeGroup a) Source # | |
| Ord a => Ord (FreeGroup a) Source # | |
Defined in Data.Group.Free | |
| Show a => Show (FreeGroup a) Source # | |
| Semigroup (FreeGroup a) Source # | |
| Monoid (FreeGroup a) Source # | |
| Group (FreeGroup a) Source # | |
Free group combinators
simplify :: Eq a => FreeGroup a -> FreeGroup a Source #
O(n) Simplifies a word in a free group.
Examples:
>>>simplify $ FreeGroup [Right 'a', Left 'b', Right 'c', Left 'c', Right 'b', Right 'a']FreeGroup {runFreeGroup = [Right 'a',Right 'a']}
interpret :: Group g => FreeGroup g -> g Source #
O(n) Interpret a word in a free group over some group g as an element in a group g.
Free abelian groups
newtype FreeAbelianGroup a Source #
A representation of a free abelian group over an alphabet a.
The intuition here is group elements correspond with their positive or negative multiplicities, and as such are simplified by construction.
Constructors
| FreeAbelianGroup | |
Fields
| |
Instances
Free abelian group combinators
abmap :: Ord b => (a -> b) -> FreeAbelianGroup a -> FreeAbelianGroup b Source #
Functorial fmap for a FreeAbelianGroup.
abjoin :: Ord a => FreeAbelianGroup (FreeAbelianGroup a) -> FreeAbelianGroup a Source #
Monadic join for a FreeAbelianGroup.
singleton :: a -> FreeAbelianGroup a Source #
Lift a singular value into a FreeAbelianGroup. Analogous to pure.
abInterpret :: Group g => FreeAbelianGroup g -> g Source #
Interpret a free group as a word in the underlying group g.