Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PreImagesSet for input sets not contained in image #48

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
This file describes changes in the GAP package 'polycyclic'.

X.YY (YYYY-MM-DD)
- Fix a bug in `PreImagesSet` which lead to a "method not found" error
if the given input set was not contained in the image of the given
homomorphism.

2.16 (2020-07-25)
- Fix a bug in `NormalIntersection` which could lead to wrong results;
this also affected other operations, such `Core`, `Intersection`
Expand Down
9 changes: 3 additions & 6 deletions gap/basic/grphoms.gi
Original file line number Diff line number Diff line change
Expand Up @@ -296,14 +296,11 @@ InstallMethod( PreImagesSet,
CollFamRangeEqFamElms,
[ IsFromPcpGHBI and IsToPcpGHBI, IsPcpGroup ],
function( hom, U )
local prei, kern;
local prei, gens, kern;
prei := List( Igs(U), x -> PreImagesRepresentative(hom,x) );
if fail in prei then
TryNextMethod();
# Potential solution: Intersect U with ImagesSource(hom)
# and then compute the preimage of that.
#gens := GeneratorsOfGroup( Intersection( ImagesSource(hom), U ) );
#prei := List( gens, x -> PreImagesRepresentative(hom,x) );
gens := GeneratorsOfGroup( Intersection( ImagesSource(hom), U ) );
prei := List( gens, x -> PreImagesRepresentative(hom,x) );
fi;
kern := Igs( KernelOfMultiplicativeGeneralMapping( hom ) );
return SubgroupByIgs( Source(hom), kern, prei );
Expand Down
13 changes: 13 additions & 0 deletions tst/bugfix.tst
Original file line number Diff line number Diff line change
Expand Up @@ -479,5 +479,18 @@ true
gap> HirschLength( Ker );
5

#
# PreImages resp. PreImagesSet used to run into a "method not found"
# error when the input set is not contained in the image of the map.
#
gap> G := AbelianPcpGroup([0]);
Pcp-group with orders [ 0 ]
gap> phi := GroupHomomorphismByImages(G,G,[G.1],[One(G)]);
[ g1 ] -> [ id ]
gap> H := PreImagesSet(phi, G);
Pcp-group with orders [ 0 ]
gap> G = H;
true

#
gap> STOP_TEST( "bugfix.tst", 10000000);