diff --git a/lib/grpfp.gd b/lib/grpfp.gd index 7e49d9981e6..afae43f8aa1 100644 --- a/lib/grpfp.gd +++ b/lib/grpfp.gd @@ -1364,3 +1364,5 @@ DeclareGlobalFunction("MakeFpGroupToMonoidHomType1"); # used in homomorphisms DeclareGlobalName("TRIVIAL_FP_GROUP"); + +DeclareAttribute("CyclicSubgroupFpGroup", IsFpGroup); diff --git a/lib/grpfp.gi b/lib/grpfp.gi index 94a60785499..fa385fc3009 100644 --- a/lib/grpfp.gi +++ b/lib/grpfp.gi @@ -3930,6 +3930,7 @@ local fgens, # generators of the free group RelatorsOfFpGroup(G),GeneratorsOfGroup(H),true,false: cyclic:=true,limit:=1+max ); e:=NEWTC_CyclicSubgroupOrder(T); + SetCyclicSubgroupFpGroup(G, H); if e=0 then return infinity; else @@ -5518,6 +5519,18 @@ end ); InstallMethod( Enumerator,"fp gp.", true,[IsSubgroupFpGroup and IsFinite],0, G->RightTransversal(G,TrivialSubgroup(G))); +InstallMethod(Enumerator, +"for a finite subgroup of a finitely presented group with known cyclic subgroup", +[IsSubgroupFpGroup and IsFinite and HasCyclicSubgroupFpGroup], +function(G) + local H; + H := CyclicSubgroupFpGroup(G); + if Size(H) = 1 then # Checking IsTrivial is slow + TryNextMethod(); + fi; + return Concatenation(List(RightTransversal(G, H), x -> AsList(H) * x)); +end); + InstallGlobalFunction(NewmanInfinityCriterion,function(G,p) local GO,q,d,e,b,r,val,agemo,ngens; if not IsPrimeInt(p) then diff --git a/tst/testbugfix/2024-03-16-FpGroups.tst b/tst/testbugfix/2024-03-16-FpGroups.tst new file mode 100644 index 00000000000..e50983e6eb8 --- /dev/null +++ b/tst/testbugfix/2024-03-16-FpGroups.tst @@ -0,0 +1,53 @@ +gap> F:=FreeGroup(2);; f1:=F.1;; f2:=F.2;; +gap> G := F / [ f2^100, f1^2, f2*f1*f2^-99*f1^-1 ];; +gap> Size(G); +200 +gap> AsList(G); +[ , <[ [ 1, 1 ] ]|f2>, <[ [ 1, -1 ]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1, -46 ] ]|f2^-46>, + <[ [ 1, 47 ] ]|f2^47>, <[ [ 1, -47 ] ]|f2^-47>, <[ [ 1, 48 ] ]|f2^48>, + <[ [ 1, -48 ] ]|f2^-48>, <[ [ 1, 49 ] ]|f2^49>, <[ [ 1, -49 ] ]|f2^-49>, + <[ [ 1, 50 ] ]|f2^50>, f1, f2*f1, f2^-1*f1, f2^2*f1, f2^-2*f1, f2^3*f1, + f2^-3*f1, f2^4*f1, f2^-4*f1, f2^5*f1, f2^-5*f1, f2^6*f1, f2^-6*f1, f2^7*f1, + f2^-7*f1, f2^8*f1, f2^-8*f1, f2^9*f1, f2^-9*f1, f2^10*f1, f2^-10*f1, + f2^11*f1, f2^-11*f1, f2^12*f1, f2^-12*f1, f2^13*f1, f2^-13*f1, f2^14*f1, + f2^-14*f1, f2^15*f1, f2^-15*f1, f2^16*f1, f2^-16*f1, f2^17*f1, f2^-17*f1, + f2^18*f1, f2^-18*f1, f2^19*f1, f2^-19*f1, f2^20*f1, f2^-20*f1, f2^21*f1, + f2^-21*f1, f2^22*f1, f2^-22*f1, f2^23*f1, f2^-23*f1, f2^24*f1, f2^-24*f1, + f2^25*f1, f2^-25*f1, f2^26*f1, f2^-26*f1, f2^27*f1, f2^-27*f1, f2^28*f1, + f2^-28*f1, f2^29*f1, f2^-29*f1, f2^30*f1, f2^-30*f1, f2^31*f1, f2^-31*f1, + f2^32*f1, f2^-32*f1, f2^33*f1, f2^-33*f1, f2^34*f1, f2^-34*f1, f2^35*f1, + f2^-35*f1, f2^36*f1, f2^-36*f1, f2^37*f1, f2^-37*f1, f2^38*f1, f2^-38*f1, + f2^39*f1, f2^-39*f1, f2^40*f1, f2^-40*f1, f2^41*f1, f2^-41*f1, f2^42*f1, + f2^-42*f1, f2^43*f1, f2^-43*f1, f2^44*f1, f2^-44*f1, f2^45*f1, f2^-45*f1, + f2^46*f1, f2^-46*f1, f2^47*f1, f2^-47*f1, f2^48*f1, f2^-48*f1, f2^49*f1, + f2^-49*f1, f2^50*f1 ]