Skip to content

Commit

Permalink
Improved IsIsomorphicSemigroup Method (#1023)
Browse files Browse the repository at this point in the history
* Some template improvements

* More example isomorph code

* Added the isomtest file created in the meeting yesterday

* Fixed some (but not all) syntax errors

* Added reminder of which packages to load

* Removed useless comments

* Commented out code that doesn't work yet

* Added function to make some random Rees matrix semigroups.

* Added testing function to compare isomorphism functions.

* Improved testing function

* Made testing function compare both isomorphic and non-isomorphic semigroups.

* Added testing both isomorphism methods against comparing canonical multiplication tables

* Finished writing IsIsomorphicRMS function, ready to add it to isomorph.gi

* Added new isomorphism function to isomorph.gi

* Added tests to isomorph.tst for new function

* Added local variables used in test

* Deleted isomtest.g

* Fixed code styling

* Fixed styling in test file

* Changed order of processes to improve performance

* Added test to make sure function works on simple semigroups that aren't RMS already

* Remove slower code

* Final tweaks

---------

Co-authored-by: James D. Mitchell <[email protected]>
  • Loading branch information
tillman-froehlich and james-d-mitchell authored Jul 29, 2024
1 parent c922565 commit fecdb4c
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 3 deletions.
60 changes: 59 additions & 1 deletion gap/attributes/isomorph.gi
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,65 @@ end);

InstallMethod(IsIsomorphicSemigroup, "for semigroups",
[IsSemigroup, IsSemigroup],
{S, T} -> IsomorphismSemigroups(S, T) <> fail);
function(R, S)
local uR, uS, map, mat, next, row, entry, isoR, rmsR, isoS, rmsS;

if not (IsFinite(R) and IsSimpleSemigroup(R)
and IsFinite(S) and IsSimpleSemigroup(S)) then
return IsomorphismSemigroups(R, S) <> fail;
fi;

# Note that when experimenting the method for IsomorphismSemigroups for Rees
# 0-matrix semigroups is faster than the analogue of the below code, and so
# we do not special case finite 0-simple semigroups.

# Take an isomorphism of R to an RMS if appropriate
if not (IsReesMatrixSemigroup(R) and IsWholeFamily(R)
and IsPermGroup(UnderlyingSemigroup(R))) then
isoR := IsomorphismReesMatrixSemigroupOverPermGroup(R);
rmsR := Range(isoR);
else
rmsR := R;
fi;
# Take an isomorphism of S to an RMS if appropriate
if not (IsReesMatrixSemigroup(S) and IsWholeFamily(S)
and IsPermGroup(UnderlyingSemigroup(S))) then
isoS := IsomorphismReesMatrixSemigroupOverPermGroup(S);
rmsS := Range(isoS);
else
rmsS := S;
fi;

if Length(Rows(rmsR)) <> Length(Rows(rmsS))
or (Length(Columns(rmsR)) <> Length(Columns(rmsS))) then
return false;
fi;

uR := UnderlyingSemigroup(rmsR);
uS := UnderlyingSemigroup(rmsS);

# uS and uR must be groups because we made them so above.
map := IsomorphismGroups(uS, uR);
if map = fail then
return false;
fi;

# Make sure underlying groups are the same, and then compare
# canonical Rees matrix semigroups of both R and S
mat := [];
for row in Matrix(rmsS) do
next := [];
for entry in row do
Add(next, entry ^ map);
od;
Add(mat, next);
od;

rmsR := CanonicalReesMatrixSemigroup(rmsR);
rmsS := ReesMatrixSemigroup(uR, mat);
rmsS := CanonicalReesMatrixSemigroup(rmsS);
return Matrix(rmsR) = Matrix(rmsS);
end);

InstallMethod(IsomorphismSemigroups, "for finite simple semigroups",
[IsSimpleSemigroup and IsFinite, IsSimpleSemigroup and IsFinite],
Expand Down
2 changes: 1 addition & 1 deletion gap/attributes/isorms.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ function(S)
end);

InstallMethod(CanonicalReesMatrixSemigroup,
"for a Rees 0-matrix semigroup",
"for a Rees matrix semigroup",
[IsReesMatrixSemigroup],
function(S)
local G, mat;
Expand Down
40 changes: 39 additions & 1 deletion tst/standard/attributes/isomorph.tst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
##

#@local A, BruteForceInverseCheck, BruteForceIsoCheck, F, G, S, T, U, V, inv
#@local map, x, y
#@local map, x, y, M, N, R, L
gap> START_TEST("Semigroups package: standard/attributes/isomorph.tst");
gap> LoadPackage("semigroups", false);;

Expand Down Expand Up @@ -118,6 +118,44 @@ gap> T := JonesMonoid(4);
gap> IsIsomorphicSemigroup(S, T);
false

# isomorph: IsIsomorphicSemigroup, for finite simple semigroups
gap> M := [[(1, 2, 3), ()], [(), ()], [(), ()]];
[ [ (1,2,3), () ], [ (), () ], [ (), () ] ]
gap> N := [[(1, 3, 2), ()], [(), (1, 2, 3)], [(1, 3, 2), (1, 3, 2)]];
[ [ (1,3,2), () ], [ (), (1,2,3) ], [ (1,3,2), (1,3,2) ] ]
gap> R := ReesMatrixSemigroup(AlternatingGroup([1 .. 3]), M);
<Rees matrix semigroup 2x3 over Alt( [ 1 .. 3 ] )>
gap> S := ReesMatrixSemigroup(Group([(1, 2, 3)]), N);
<Rees matrix semigroup 2x3 over Group([ (1,2,3) ])>
gap> IsIsomorphicSemigroup(R, S);
true
gap> R := SemigroupByMultiplicationTable(MultiplicationTable(R));;
gap> S := SemigroupByMultiplicationTable(MultiplicationTable(S));;
gap> IsIsomorphicSemigroup(R, S);
true
gap> L := [[(), ()], [(), ()], [(1, 2, 3), ()]];
[ [ (), () ], [ (), () ], [ (1,2,3), () ] ]
gap> T := ReesMatrixSemigroup(SymmetricGroup([1 .. 3]), L);
<Rees matrix semigroup 2x3 over Sym( [ 1 .. 3 ] )>
gap> IsIsomorphicSemigroup(S, T);
false
gap> IsIsomorphicSemigroup(T, T);
true
gap> M := [[(1, 2, 3), ()], [(), ()], [(), ()]];
[ [ (1,2,3), () ], [ (), () ], [ (), () ] ]
gap> N := [[(1, 3, 2), ()], [(), (1, 2, 3)]];
[ [ (1,3,2), () ], [ (), (1,2,3) ] ]
gap> R := ReesMatrixSemigroup(AlternatingGroup([1 .. 3]), M);;
gap> S := ReesMatrixSemigroup(AlternatingGroup([1 .. 3]), N);;
gap> IsIsomorphicSemigroup(R, S);
false
gap> R := ReesMatrixSemigroup(AlternatingGroup([1 .. 5]),
> [[(), ()], [(), (1, 3, 2, 4, 5)]]);;
gap> S := ReesMatrixSemigroup(AlternatingGroup([1 .. 5]),
> [[(1, 5, 4, 3, 2), ()], [(1, 4, 5), (1, 4)(3, 5)]]);;
gap> IsIsomorphicSemigroup(R, S);
false

# isomorph: IsomorphismSemigroups, for infinite semigroup(s)
gap> S := FreeSemigroup(1);;
gap> T := TrivialSemigroup();;
Expand Down

0 comments on commit fecdb4c

Please sign in to comment.