From 6629021f4569e22ab3af0fb4560fe44321392c1a Mon Sep 17 00:00:00 2001 From: Max Horn Date: Wed, 5 Aug 2020 12:33:41 +0200 Subject: [PATCH] Fix PreImagesSet for input sets not contained in image --- CHANGES.md | 5 +++++ gap/basic/grphoms.gi | 9 +++------ tst/bugfix.tst | 13 +++++++++++++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 777ce45..cd54a0f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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` diff --git a/gap/basic/grphoms.gi b/gap/basic/grphoms.gi index c908280..ab97e11 100644 --- a/gap/basic/grphoms.gi +++ b/gap/basic/grphoms.gi @@ -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 ); diff --git a/tst/bugfix.tst b/tst/bugfix.tst index 393390e..12f353f 100644 --- a/tst/bugfix.tst +++ b/tst/bugfix.tst @@ -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);