module SP2GP (
groupBeta,
) where
import SP2GP.Generators
import SP2GP.Relations
import SemigroupPresentation
import qualified GroupPresentation as GP
sp2gp ::
MonadFail m =>
Gens ->
Rels ->
SemigroupPresentation ->
m GP.GroupPresentation
sp2gp :: Gens -> Rels -> SemigroupPresentation -> m GroupPresentation
sp2gp Gens
gs Rels
rs' SemigroupPresentation
sp = do
GeneratorsDescr
gd <- Gens -> SemigroupPresentation -> m GeneratorsDescr
forall (m :: * -> *).
MonadFail m =>
Gens -> SemigroupPresentation -> m GeneratorsDescr
gens Gens
gs SemigroupPresentation
sp
Relations
rs <- Rels -> GeneratorsDescr -> SemigroupPresentation -> m Relations
forall (m :: * -> *).
MonadFail m =>
Rels -> GeneratorsDescr -> SemigroupPresentation -> m Relations
rels Rels
rs' GeneratorsDescr
gd SemigroupPresentation
sp
GroupPresentation -> m GroupPresentation
forall (m :: * -> *) a. Monad m => a -> m a
return (GroupPresentation -> m GroupPresentation)
-> GroupPresentation -> m GroupPresentation
forall a b. (a -> b) -> a -> b
$ Relations -> GeneratorsDescr -> GroupPresentation
GP.groupPresentation Relations
rs GeneratorsDescr
gd
groupBeta :: MonadFail m => SemigroupPresentation -> m GP.GroupPresentation
groupBeta :: SemigroupPresentation -> m GroupPresentation
groupBeta =
Gens -> Rels -> SemigroupPresentation -> m GroupPresentation
forall (m :: * -> *).
MonadFail m =>
Gens -> Rels -> SemigroupPresentation -> m GroupPresentation
sp2gp [
StrGetter -> Gen
group (StrGetter
strGeneratorsStrGetter
-> ((Set String -> Const (Set String) (Set String))
-> Set String -> Const (Set String) (Set String))
-> StrGetter
forall b c a. (b -> c) -> (a -> b) -> a -> c
.String -> Getter (Set String) (Set String)
filterByFormat(String
"q{}")),
String -> Gen
simple String
"s",
StrGetter -> Gen
group (StrGetter
strGeneratorsStrGetter
-> ((Set String -> Const (Set String) (Set String))
-> Set String -> Const (Set String) (Set String))
-> StrGetter
forall b c a. (b -> c) -> (a -> b) -> a -> c
.String -> Getter (Set String) (Set String)
filterByFormat(String
"s{}")),
String
"r_{}" String -> StrGetter -> Gen
`from` StrGetter
strNumRelations,
String -> Gen
simple String
"x t k"
] [[[
String
"x s_B" String -> String -> Rel
=== String
"s_B x^2",
String
"r_i s_B" String -> String -> Rel
=== String
"s_B x r_i x",
String
"r_i^-1 F_i^# q_i_1 G_i r_i" String -> String -> Rel
=== String
"H_i^# q_i_2 K_i",
String
"t r_i" String -> String -> Rel
=== String
"r_i t",
String
"t x" String -> String -> Rel
=== String
"x t",
String
"k r_i" String -> String -> Rel
=== String
"r_i k",
String
"k x" String -> String -> Rel
=== String
"x k",
String
"k q^-1 t q" String -> String -> Rel
=== String
"q^-1 t q k"
] Rels -> (Rels -> Rel) -> Rel
forall a b. a -> (a -> b) -> b
& Range String StrGetter -> Rels -> Rel
forall v c. RangeClass v c => Range v c -> Rels -> Rel
for' (
String
"{s_B}" String -> StrGetter -> Range String StrGetter
forall v c. RangeClass v c => v -> c -> Range v c
`in'`
(StrGetter
strGeneratorsStrGetter
-> ((Set String -> Const (Set String) (Set String))
-> Set String -> Const (Set String) (Set String))
-> StrGetter
forall b c a. (b -> c) -> (a -> b) -> a -> c
.String -> Getter (Set String) (Set String)
filterByFormat(String
"s_{}")((Set String -> Const (Set String) (Set String))
-> Set String -> Const (Set String) (Set String))
-> ((Set String -> Const (Set String) (Set String))
-> Set String -> Const (Set String) (Set String))
-> (Set String -> Const (Set String) (Set String))
-> Set String
-> Const (Set String) (Set String)
forall b c a. (b -> c) -> (a -> b) -> a -> c
.String -> Getter (Set String) (Set String)
insertGen(String
"s")))
] Rels -> (Rels -> Rel) -> Rel
forall a b. a -> (a -> b) -> b
& Range
(String, Rel)
(StrGetter,
(Set (Pair StrGWord)
-> Const (Set (Pair StrGWord)) (Set (Pair StrGWord)))
-> SemigroupPresentation
-> Const (Set (Pair StrGWord)) SemigroupPresentation)
-> Rels -> Rel
forall v c. RangeClass v c => Range v c -> Rels -> Rel
for' (
(String
"r_{i}", String
"F_i q{_i_1} G_i" String -> String -> Rel
=== String
"H_i q{_i_2} K_i") (String, Rel)
-> (StrGetter,
(Set (Pair StrGWord)
-> Const (Set (Pair StrGWord)) (Set (Pair StrGWord)))
-> SemigroupPresentation
-> Const (Set (Pair StrGWord)) SemigroupPresentation)
-> Range
(String, Rel)
(StrGetter,
(Set (Pair StrGWord)
-> Const (Set (Pair StrGWord)) (Set (Pair StrGWord)))
-> SemigroupPresentation
-> Const (Set (Pair StrGWord)) SemigroupPresentation)
forall v c. RangeClass v c => v -> c -> Range v c
`in'`
(StrGetter
strNumRelations, (Set (Pair StrGWord)
-> Const (Set (Pair StrGWord)) (Set (Pair StrGWord)))
-> SemigroupPresentation
-> Const (Set (Pair StrGWord)) SemigroupPresentation
strRelations((Set (Pair StrGWord)
-> Const (Set (Pair StrGWord)) (Set (Pair StrGWord)))
-> SemigroupPresentation
-> Const (Set (Pair StrGWord)) SemigroupPresentation)
-> ((Set (Pair StrGWord)
-> Const (Set (Pair StrGWord)) (Set (Pair StrGWord)))
-> Set (Pair StrGWord)
-> Const (Set (Pair StrGWord)) (Set (Pair StrGWord)))
-> (Set (Pair StrGWord)
-> Const (Set (Pair StrGWord)) (Set (Pair StrGWord)))
-> SemigroupPresentation
-> Const (Set (Pair StrGWord)) SemigroupPresentation
forall b c a. (b -> c) -> (a -> b) -> a -> c
.(StrGWord -> StrGWord)
-> Getter (Set (Pair StrGWord)) (Set (Pair StrGWord))
forall b a.
Ord b =>
(a -> b) -> Getter (Set (Pair a)) (Set (Pair b))
forAll((String, String) -> StrGWord -> StrGWord
replaceGenerator(String
"h", String
"s")))
)
]