Skip to content

Commit

Permalink
FIX: Cleanup (Isomorphism)SimplifiedFpGroup
Browse files Browse the repository at this point in the history
- Avoid code duplication between isomorphism and group method.
- Resolve issue with calling MappedWord on empty generator set.
- Added tests for simplification

This fixes #2911
  • Loading branch information
hulpke authored and fingolfin committed Oct 25, 2018
1 parent d4d604a commit 10b7b42
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 68 deletions.
64 changes: 44 additions & 20 deletions lib/ghomfp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -915,36 +915,48 @@ local H, pres,map,mapi,opt;

# perform Tietze transformations.
opt:=TzOptions(pres);
if ValueOption("expandLimit")<>fail then
opt.expandLimit:=ValueOption("expandLimit");
else
opt.expandLimit:=120; # do not grow too much.
fi;
if ValueOption("eliminationsLimit")<>fail then
opt.eliminationsLimit:=ValueOption("eliminationsLimit");
else
opt.eliminationsLimit:=20; # do not be too greedy
fi;
if ValueOption("lengthLimit")<>fail then
opt.lengthLimit:=ValueOption("lengthLimit");
else
opt.lengthLimit:=Int(3*pres!.tietze[TZ_TOTAL]); # not too big.
fi;

if ValueOption("protected")<>fail then
opt.expandLimit:=ValueOption("protected");
fi;

opt.printLevel:=InfoLevel(InfoFpGroup);
TzInitGeneratorImages(pres);
TzGoGo( pres );
if ValueOption("easy")=true then
# case of old `SimplifiedFpGroup`, use default strategy parameters
TzGo( pres );
else
# Somewhat tuned strategy parameters
if ValueOption("expandLimit")<>fail then
opt.expandLimit:=ValueOption("expandLimit");
else
opt.expandLimit:=120; # do not grow too much.
fi;
if ValueOption("eliminationsLimit")<>fail then
opt.eliminationsLimit:=ValueOption("eliminationsLimit");
else
opt.eliminationsLimit:=20; # do not be too greedy
fi;
if ValueOption("lengthLimit")<>fail then
opt.lengthLimit:=ValueOption("lengthLimit");
else
opt.lengthLimit:=Int(3*pres!.tietze[TZ_TOTAL]); # not too big.
fi;
TzGoGo( pres );
fi;

# reconvert the Tietze presentation to a group presentation.
H := FpGroupPresentation( pres );
map:=GroupHomomorphismByImagesNC(G,H,GeneratorsOfGroup(G),
List(TzImagesOldGens(pres),
i->MappedWord(i,GeneratorsOfPresentation(pres),
GeneratorsOfGroup(H))));

if Length(GeneratorsOfGroup(H))>0 then
map:=List(TzImagesOldGens(pres),
i->MappedWord(i,GeneratorsOfPresentation(pres),
GeneratorsOfGroup(H)));
else
map:=List(TzImagesOldGens(pres),y->One(H));
fi;

map:=GroupHomomorphismByImagesNC(G,H,GeneratorsOfGroup(G),map);

mapi:=GroupHomomorphismByImagesNC(H,G,GeneratorsOfGroup(H),
List(TzPreImagesNewGens(pres),
Expand All @@ -958,6 +970,18 @@ local H, pres,map,mapi,opt;
return map;
end );

#############################################################################
##
#M SimplifiedFpGroup( <FpGroup> ) . . . . . . . . . simplify the FpGroup by
#M Tietze transformations
##
## `SimplifiedFpGroup' returns a group isomorphic to the given one with a
## presentation which has been tried to simplify via Tietze transformations.
##
InstallGlobalFunction( SimplifiedFpGroup, function ( G )
return Range(IsomorphismSimplifiedFpGroup(G:easy));
end);

#############################################################################
##
#M NaturalHomomorphismByNormalSubgroup(<G>,<N>)
Expand Down
48 changes: 0 additions & 48 deletions lib/tietze.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1180,54 +1180,6 @@ InstallGlobalFunction( RemoveRelator, function ( T, n )
end );


#############################################################################
##
#M SimplifiedFpGroup( <FpGroup> ) . . . . . . . . . sinplify the FpGroup by
#M Tietze transformations
##
## `SimplifiedFpGroup' returns a group isomorphic to the given one with a
## presentation which has been tried to simplify via Tietze transformations.
##
InstallGlobalFunction( SimplifiedFpGroup, function ( G )

local H, T,map,mapi;

# check the given argument to be a finitely presented group.
if not ( IsSubgroupFpGroup( G ) and IsGroupOfFamily( G ) ) then
Error( "argument must be a finitely presented group" );
fi;

# convert the given group presentation to a Tietze presentation.
T := PresentationFpGroup( G, 0 );

# perform Tietze transformations.
TzInitGeneratorImages(T);
TzGo( T );

# reconvert the Tietze presentation to a group presentation.
H := FpGroupPresentation( T );

# translate info
map:=GroupHomomorphismByImagesNC(G,H,GeneratorsOfGroup(G),
List(TzImagesOldGens(T),
i->MappedWord(i,GeneratorsOfPresentation(T),
GeneratorsOfGroup(H))));

mapi:=GroupHomomorphismByImagesNC(H,G,GeneratorsOfGroup(H),
List(TzPreImagesNewGens(T),
i->MappedWord(i,OldGeneratorsOfPresentation(T),
GeneratorsOfGroup(G))));

SetIsBijective(map,true);
SetInverseGeneralMapping(map,mapi);
SetInverseGeneralMapping(mapi,map);
ProcessEpimorphismToNewFpGroup(map);

# return the resulting group.
return H;
end );


#############################################################################
##
#M AbstractWordTietzeWord( <word>, <fgens> ) . . . . convert a Tietze word
Expand Down
12 changes: 12 additions & 0 deletions tst/testinstall/grpfp.tst
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ gap> Print( Collected( List( l, x -> Index( c2, x ) ) ), "\n" );
gap> Print( Collected( List( LowIndexSubgroupsFpGroup( g, s, 5 ),
> x -> Index( c2, x ) ) ), "\n" );
[ [ 12, 1 ], [ 24, 1 ], [ 48, 1 ] ]

# Tietze simplifications
gap> F:=FreeGroup("a");;
gap> SimplifiedFpGroup(F/[GeneratorsOfGroup(F)[1]]);
<fp group on the generators [ ]>
gap> F:=FreeGroup("a","b","c");;
gap> rels:=ParseRelators(F,"a2,b3,c4,abC");
[ a^2, b^3, c^4, a*b*c^-1 ]
gap> IsomorphismSimplifiedFpGroup(F/rels);
[ a, b, c ] -> [ c*b^-1, b, c ]

#
gap> STOP_TEST( "grpfp.tst", 1);

#############################################################################
Expand Down

0 comments on commit 10b7b42

Please sign in to comment.