Copyright | (c) 2020-2021 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-Inferred |
Language | Haskell2010 |
This module provides definitions for the FreeProduct
of two groups,
along with useful combinators.
Synopsis
- newtype FreeProduct g h = FreeProduct {
- runFreeProduct :: Seq (Either g h)
- simplify :: (Eq g, Eq h, Monoid g, Monoid h) => FreeProduct g h -> FreeProduct g h
- coproduct :: Monoid m => (a -> m) -> (b -> m) -> FreeProduct a b -> m
- injl :: a -> FreeProduct a b
- injr :: b -> FreeProduct a b
Documentation
newtype FreeProduct g h Source #
The free product on two alphabets
Note: This does not perform simplification upon multiplication or construction.
To do this, one should use simplify
.
FreeProduct | |
|
Instances
simplify :: (Eq g, Eq h, Monoid g, Monoid h) => FreeProduct g h -> FreeProduct g h Source #
O(n) Simplifies a word in a FreeProduct
.
This means that we get rid of any identity elements, and perform multiplication of neighboring g
s and h
s.
coproduct :: Monoid m => (a -> m) -> (b -> m) -> FreeProduct a b -> m Source #
The FreeProduct
of two Monoid
s is a coproduct in the category of monoids (and by extension, the category of groups).
injl :: a -> FreeProduct a b Source #
Left injection of an alphabet a
into a free product.
injr :: b -> FreeProduct a b Source #
Right injection of an alphabet b
into a free product.