diff --git a/lib/pquot.gd b/lib/pquot.gd index bd7d1ff8ba..08db21cc1c 100644 --- a/lib/pquot.gd +++ b/lib/pquot.gd @@ -26,11 +26,11 @@ DeclareGlobalFunction( "AbelianPQuotient" ); ############################################################################# ## -#F PQuotient(,

[, ][, ][, ]) . . pq of an fp group +#F PQuotient(,

[, ][, ][, ] : noninteractive) . . pq of an fp group ## ## <#GAPDoc Label="PQuotient"> ## -## +## ## ## ## computes a factor p-group of a finitely presented group F @@ -57,16 +57,21 @@ DeclareGlobalFunction( "AbelianPQuotient" ); ## In case F does not have a largest factor p-group, ## the algorithm will not terminate. ##

-## By default the algorithm computes only with factor groups of order at -## most p^{256}. If the parameter logord is present, it will -## compute with factor groups of order at most p^{logord}. -## If this parameter is specified, then the parameter c must also be -## given. The present -## implementation produces an error message if the order of a -## p-quotient exceeds p^{256} or p^{logord}, -## respectively. -## Note that the order of intermediate p-groups may be larger than -## the final order of a p-quotient. +## By default the value of the paramter logord is set to 256. +## If the parameter logord is specified, then the parameter c must also be +## given. +## The algorithm only computes with factor groups of order +## at most p^{logord}. +## If the order of a factor group exceeds p^{logord}, +## the behaviour of the algorithm depends on the option +## noninteractive: if it is present, the current implementation +## produces an error message; otherwise it returns fail. +## Note that the order of intermediate p-groups, which are constructed by the algorithm +## during the computation, may be larger than the final order of a p-quotient +## in the series. Thus a p-quotient is not necessarily computed +## even if its order does not exceed p^{logord}. +## However, for the first quotient we can guarantee that it is found, +## if the order does not exceed p^{logord}. ##

## The parameter ctype determines the type of collector that is used ## for computations within the factor p-group. diff --git a/lib/pquot.gi b/lib/pquot.gi index 9c788ccd1e..f2cceb51e5 100644 --- a/lib/pquot.gi +++ b/lib/pquot.gi @@ -1310,7 +1310,9 @@ end ); ############################################################################# ## -#F AbelianPQuotient . . . . . . . . . . . initialize an abelian p-quotient +#F AbelianPQuotient . . . . . . . . try to initialize an abelian p-quotient +## +## Return true if we are successful, return false otherwise. ## InstallGlobalFunction( AbelianPQuotient, function( qs ) @@ -1342,6 +1344,9 @@ function( qs ) generators := DifferenceLists( [1..n], trailers ); ## Their images are the first d generators. + if Length(gens) < d then + return false; + fi; qs!.images{ generators } := gens{[1..d]}; ## Fix their definitions. @@ -1367,6 +1372,8 @@ function( qs ) qs!.collector![SCP_WEIGHTS]{[1..qs!.numberOfGenerators]} := [1..qs!.numberOfGenerators] * 0 + 1; + return true; + end ); ############################################################################# @@ -1376,7 +1383,8 @@ end ); InstallGlobalFunction( PQuotient, function( arg ) - local G, p, cl, ngens, collector, qs, t,noninteractive; + local G, p, cl, ngens, collector, qs, t,noninteractive, + isAbelianPQuotientSucessful; ## First we parse the arguments to this function @@ -1453,7 +1461,20 @@ function( arg ) LengthOfDescendingSeries(qs)+1, " quotient" ); t := Runtime(); - AbelianPQuotient( qs ); + isAbelianPQuotientSucessful := AbelianPQuotient( qs ); + if not isAbelianPQuotientSucessful then + if noninteractive then + return fail; + else + Error( "Collector not large enough ", + "to define generators for abelian p-quotient.\n", + "To return the current quotient (of class ", + LengthOfDescendingSeries(qs), ") type `return;' ", + "and `quit;' otherwise.\n" ); + + return qs; + fi; + fi; Info( InfoQuotientSystem, 1, " rank of this layer: ", RanksOfDescendingSeries(qs)[LengthOfDescendingSeries(qs)], diff --git a/tst/testbugfix/2024-10-15-PQuotient.tst b/tst/testbugfix/2024-10-15-PQuotient.tst new file mode 100644 index 0000000000..41aff2fb62 --- /dev/null +++ b/tst/testbugfix/2024-10-15-PQuotient.tst @@ -0,0 +1,10 @@ +# see +gap> F := FreeGroup(["a", "b"]);; +gap> a := F.1;; +gap> b := F.1;; +gap> p := 5;; +gap> G := F / [a^p, b^p, Comm(a,b)];; +gap> PQuotient(G, p, 1, 2 : noninteractive) <> fail; +true +gap> PQuotient(G, p, 1, 1 : noninteractive) = fail; +true