Skip to content

Commit

Permalink
Add EvaluateExtRepObjWord change EvaluateWord
Browse files Browse the repository at this point in the history
Added new method EvaluateExtRepObjWord to help when dealing with ExtRep objects. Reduced the three methods for EvaluateWord to two methods that have less restrictive filters.
  • Loading branch information
ChristopherRussell committed Jan 17, 2018
1 parent 0bb1e13 commit 90c65b2
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 19 deletions.
7 changes: 3 additions & 4 deletions gap/main/orbits.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
#############################################################################
##

DeclareOperation("EvaluateWord", [IsBipartitionCollection, IsList]);
DeclareOperation("EvaluateWord", [IsPartialPermCollection, IsList]);
DeclareOperation("EvaluateWord",
[IsReesZeroMatrixSemigroupElementCollection, IsList]);
DeclareOperation("EvaluateWord", [IsMultiplicativeElementCollection, IsList]);
DeclareOperation("EvaluateExtRepObjWord",
[IsMultiplicativeElementCollection, IsList]);
DeclareOperation("TraceSchreierTreeOfSCCForward",
[IsOrbit, IsPosInt, IsPosInt]);
DeclareOperation("TraceSchreierTreeOfSCCBack",
Expand Down
54 changes: 39 additions & 15 deletions gap/main/orbits.gi
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ function(o, limit)
return o;
end);

InstallMethod(EvaluateWord, "for bipartition coll and list of integers",
[IsBipartitionCollection, IsList],
InstallMethod(EvaluateWord,
"for multiplicative element with one coll and list of integers",
[IsMultiplicativeElementWithOneCollection, IsList],
function(gens, w)
local i, res;
if Length(w) = 0 then
Expand All @@ -172,31 +173,54 @@ function(gens, w)
return res;
end);

InstallMethod(EvaluateWord, "for partial perm coll and list of integers",
[IsPartialPermCollection, IsList],
InstallMethod(EvaluateWord,
"for multiplicative element coll and list of integers",
[IsMultiplicativeElementCollection, IsList],
function(gens, w)
local i, res;
if Length(w) = 0 then
return One(gens);
return SEMIGROUPS.UniversalFakeOne;
fi;
res := gens[AbsInt(w[1])] ^ SignInt(w[1]);
for i in [2 .. Length(w)] do
for i in [2 .. Length(w)] do
res := res * gens[AbsInt(w[i])] ^ SignInt(w[i]);
od;
return res;
end);

InstallMethod(EvaluateWord,
"for Rees 0-matrix semigroup element collection and a list of positive ints",
[IsReesZeroMatrixSemigroupElementCollection, IsList],
InstallMethod(EvaluateExtRepObjWord,
"for a multiplicative element coll and list of integers",
[IsMultiplicativeElementCollection, IsList],
function(gens, w)
local i, res;
if Length(w) = 0 then
return SEMIGROUPS.UniversalFakeOne;
local res, i;
if Length(w) = 0 then
ErrorNoReturn("Semigroups: EvaluateExtRepObjWord, the second argument ",
"must be a non-empty list");
elif Length(w) mod 2 = 1 then
ErrorNoReturn("Semigroups: EvaluateExtRepObjWord, the second argument ",
"must be a list of even length");
fi;
res := gens[w[1]];
for i in [2 .. Length(w)] do
res := res * gens[w[i]];
res := gens[AbsInt(w[1])] ^ w[2];
for i in [3, 5 .. Length(w) - 1] do
res := res * gens[AbsInt(w[i])] ^ w[i + 1];
od;
return res;
end);

InstallMethod(EvaluateExtRepObjWord,
"for a multiplicative element with one coll and list of integers",
[IsMultiplicativeElementWithOneCollection, IsList],
function(gens, w)
local res, i;
if Length(w) = 0 then
return One(gens);
elif Length(w) mod 2 = 1 then
ErrorNoReturn("Semigroups: EvaluateExtRepObjWord, the second argument ",
"must be a list of even length");
fi;
res := gens[AbsInt(w[1])] ^ w[2];
for i in [3, 5 .. Length(w) - 1] do
res := res * gens[AbsInt(w[i])] ^ w[i + 1];
od;
return res;
end);
Expand Down
17 changes: 17 additions & 0 deletions tst/standard/semifp.tst
Original file line number Diff line number Diff line change
Expand Up @@ -2121,6 +2121,23 @@ true
gap> ForAll(tst{[1 .. 10]}, S -> BruteForceInverseCheck(IsomorphismFpSemigroup(S)));
true

# Test EvaluateExtRepObjWord
gap> F := FreeSemigroup(4);;
gap> x := EvaluateExtRepObjWord(Generators(F), [1, 4, 2, 5, 3, 1, 2, 1]);
s1^4*s2^5*s3*s2
gap> ExtRepOfObj(x) = [1, 4, 2, 5, 3, 1, 2, 1];
true
gap> EvaluateExtRepObjWord(Generators(F), []);
Error, Semigroups: EvaluateExtRepObjWord, the second argument must be a non-em\
pty list
gap> F := FreeMonoid(4);;
gap> x := EvaluateExtRepObjWord(Generators(F), [1, 4, 2, 5, 3, 1, 2, 1]);
m1^4*m2^5*m3*m2
gap> ExtRepOfObj(x) = [1, 4, 2, 5, 3, 1, 2, 1];
true
gap> EvaluateExtRepObjWord(Generators(F), []);
<identity ...>

#T# SEMIGROUPS_UnbindVariables
gap> Unbind(BruteForceInverseCheck);
gap> Unbind(BruteForceIsoCheck);
Expand Down

0 comments on commit 90c65b2

Please sign in to comment.