diff --git a/lib/ghompcgs.gi b/lib/ghompcgs.gi index 389faafb1d..f17db8b36c 100644 --- a/lib/ghompcgs.gi +++ b/lib/ghompcgs.gi @@ -511,7 +511,11 @@ InstallMethod( PreImagesRepresentative, "method for pcgs hom", function( hom, elm ) local pcgsR, exp, imgs, pre, i; - # precompute pcgs + if not elm in ImagesSource( hom ) then + return fail; + fi; + + # Precompute a pcgs for the *image* of 'hom'. InversePcgs( hom ); pcgsR := hom!.rangePcgs; diff --git a/tst/testinstall/grppc.tst b/tst/testinstall/grppc.tst index 40dd277b6e..f526eba327 100644 --- a/tst/testinstall/grppc.tst +++ b/tst/testinstall/grppc.tst @@ -183,5 +183,26 @@ true gap> IsIdenticalObj( Range( iso ), ImagesSource( iso ) ); true +# +gap> G:= AbelianGroup( IsPcGroup, [ 3, 3, 3 ] );; +gap> S:= AbelianGroup( IsPcGroup, [ 3, 3 ] );; +gap> f:= GroupHomomorphismByImages( G, S, GeneratorsOfGroup( G ), +> [ GeneratorsOfGroup( S )[1], One( S ), One( S ) ] );; +gap> x:= GeneratorsOfGroup( S )[2];; +gap> x in Range( f ) and not x in Image( f ); +true +gap> PreImagesRepresentative( f, x ); +fail +gap> G:= AbelianGroup( IsPcGroup, [ 3, 3 ] );; +gap> S:= AbelianGroup( IsPcGroup, [ 3 ] );; +gap> f:= GroupHomomorphismByImages( G, S, GeneratorsOfGroup( G ), +> [ One( S ), One( S ) ] );; +gap> x:= GeneratorsOfGroup( S )[1]; +f1 +gap> x in Range( f ) and not x in Image( f ); +true +gap> PreImagesRepresentative( f, x ); +fail + # that's all, folks gap> STOP_TEST( "grppc.tst" );