Skip to content

Commit

Permalink
semipperm: fix IsomorphismPPermSemigroup/Monoid
Browse files Browse the repository at this point in the history
Previously, these methods encountered unexpected errors for perm
groups with 0 generators. This adds a special case for such groups.

Resolves gap-system#1783
  • Loading branch information
wilfwilson committed Oct 19, 2017
1 parent 1fbf5de commit d3b22af
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/semipperm.gi
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,11 @@ function(G)
local dom, S;

dom := MovedPoints(G);
S := InverseMonoid(List(GeneratorsOfGroup(G), p -> AsPartialPerm(p, dom)));
if IsEmpty(GeneratorsOfGroup(G)) then
S := InverseMonoid(EmptyPartialPerm());
else
S := InverseMonoid(List(GeneratorsOfGroup(G), p -> AsPartialPerm(p, dom)));
fi;
UseIsomorphismRelation(G, S);
SetIsGroupAsSemigroup(S, true);

Expand All @@ -373,8 +377,12 @@ function(G)
local dom, S;

dom := MovedPoints(G);
S := InverseSemigroup(List(GeneratorsOfGroup(G),
p -> AsPartialPerm(p, dom)));
if IsEmpty(GeneratorsOfGroup(G)) then
S := InverseSemigroup(EmptyPartialPerm());
else
S := InverseSemigroup(List(GeneratorsOfGroup(G),
p -> AsPartialPerm(p, dom)));
fi;
UseIsomorphismRelation(G, S);
SetIsGroupAsSemigroup(S, true);

Expand Down
27 changes: 27 additions & 0 deletions tst/testbugfix/2017-10-19-IsomorphismPartialPermSemigroup.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Issue related to IsomorphismPartialPermSemigroup and
# IsomorphismPartialPermMonoid for a trivial perm group with 0 generators
# Examples reported on issue #1783 on github.com/gap-system/gap
gap> iso := [];;
gap> iso[1] := IsomorphismPartialPermSemigroup(SymmetricGroup(1));
MappingByFunction( Group(()), <trivial partial perm group of rank 0 with
1 generator>, function( p ) ... end, <Attribute "AsPermutation"> )
gap> iso[2] := IsomorphismPartialPermSemigroup(Group([()]));
MappingByFunction( Group(()), <trivial partial perm group of rank 0 with
1 generator>, function( p ) ... end, <Attribute "AsPermutation"> )
gap> iso[3] := IsomorphismPartialPermSemigroup(Group([], ()));
MappingByFunction( Group(()), <trivial partial perm group of rank 0 with
1 generator>, function( p ) ... end, <Attribute "AsPermutation"> )
gap> iso[4] := IsomorphismPartialPermMonoid(SymmetricGroup(1));
MappingByFunction( Group(()), <trivial partial perm group of rank 0 with
1 generator>, function( p ) ... end, <Attribute "AsPermutation"> )
gap> iso[5] := IsomorphismPartialPermMonoid(Group([()]));
MappingByFunction( Group(()), <trivial partial perm group of rank 0 with
1 generator>, function( p ) ... end, <Attribute "AsPermutation"> )
gap> iso[6] := IsomorphismPartialPermMonoid(Group([], ()));
MappingByFunction( Group(()), <trivial partial perm group of rank 0 with
1 generator>, function( p ) ... end, <Attribute "AsPermutation"> )
gap> ForAll(iso, map -> () ^ map = EmptyPartialPerm());
true
gap> inv := List(iso, InverseGeneralMapping);;
gap> ForAll(inv, map -> EmptyPartialPerm() ^ map = ());
true
28 changes: 28 additions & 0 deletions tst/testinstall/semipperm.tst
Original file line number Diff line number Diff line change
Expand Up @@ -333,13 +333,41 @@ gap> BruteForceIsoCheck(last);
true
gap> BruteForceInverseCheck(last2);
true
gap> IsomorphismPartialPermSemigroup(Group([()]));
MappingByFunction( Group(()), <trivial partial perm group of rank 0 with
1 generator>, function( p ) ... end, <Attribute "AsPermutation"> )
gap> BruteForceIsoCheck(last);
true
gap> BruteForceInverseCheck(last2);
true
gap> IsomorphismPartialPermSemigroup(Group([], ()));
MappingByFunction( Group(()), <trivial partial perm group of rank 0 with
1 generator>, function( p ) ... end, <Attribute "AsPermutation"> )
gap> BruteForceIsoCheck(last);
true
gap> BruteForceInverseCheck(last2);
true
gap> IsomorphismPartialPermMonoid(Group((1,2,3)));
MappingByFunction( Group([ (1,2,3) ]), <partial perm group of rank 3 with
1 generator>, function( p ) ... end, <Attribute "AsPermutation"> )
gap> BruteForceIsoCheck(last);
true
gap> BruteForceInverseCheck(last2);
true
gap> IsomorphismPartialPermMonoid(Group([()]));
MappingByFunction( Group(()), <trivial partial perm group of rank 0 with
1 generator>, function( p ) ... end, <Attribute "AsPermutation"> )
gap> BruteForceIsoCheck(last);
true
gap> BruteForceInverseCheck(last2);
true
gap> IsomorphismPartialPermMonoid(Group([], ()));
MappingByFunction( Group(()), <trivial partial perm group of rank 0 with
1 generator>, function( p ) ... end, <Attribute "AsPermutation"> )
gap> BruteForceIsoCheck(last);
true
gap> BruteForceInverseCheck(last2);
true
# Test SymmetricInverseMonoid
gap> SymmetricInverseMonoid(-1);
Expand Down

0 comments on commit d3b22af

Please sign in to comment.