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 computation of all maximal subgroups (under specific circumstances, an incomplete list was returned) #4396

Merged
merged 1 commit into from
Apr 14, 2021
Merged
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 lib/csetgrp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ local erg,nerg,perm,i,e,c,sel;
nerg:=[];
for e in erg do
sel:=Filtered(Difference([1..Length(from)],Union(e)),x->from[x]<=i);
c:=NrCombinations(sel);
if c>10^7 then
Info(InfoPerformance,1,"Performance warning: Trying ",c,
" combinations");
fi;
for c in Combinations(sel) do
if Sum(from{c})=i then
Add(nerg,Concatenation(e,[c]));
Expand Down
4 changes: 2 additions & 2 deletions lib/gpprmsya.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2476,7 +2476,7 @@ local G,max,dom,n,A,S,issn,p,i,j,m,k,powdec,pd,gps,v,invol,sel,mf,l,prim;
return max;
end);

InstallMethod( TryMaximalSubgroupClassReps, "symmetric", true,
InstallMethod( CalcMaximalSubgroupClassReps, "symmetric", true,
[ IsNaturalSymmetricGroup and IsFinite], OVERRIDENICE,
function ( G )
local m;
Expand All @@ -2488,7 +2488,7 @@ local m;
fi;
end);

InstallMethod( TryMaximalSubgroupClassReps, "alternating", true,
InstallMethod( CalcMaximalSubgroupClassReps, "alternating", true,
[ IsNaturalAlternatingGroup and IsFinite], OVERRIDENICE,
function ( G )
local m;
Expand Down
6 changes: 4 additions & 2 deletions lib/grp.gd
Original file line number Diff line number Diff line change
Expand Up @@ -1234,11 +1234,13 @@ DeclareAttribute( "MaximalSubgroups", IsGroup );
##
DeclareAttribute("MaximalSubgroupClassReps",IsGroup);

# functions to calculate maximal subgroups (or fail if not possible)
DeclareOperation("CalcMaximalSubgroupClassReps",[IsGroup]);
DeclareGlobalFunction("TryMaximalSubgroupClassReps");
# utility attribute: Allow use with limiting options, so could hold `fail'.
DeclareAttribute("TryMaximalSubgroupClassReps",IsGroup,"mutable");
DeclareAttribute("StoredPartialMaxSubs",IsGroup,"mutable");

# utility function in maximal subgroups code
DeclareGlobalFunction("TryMaxSubgroupTainter");
DeclareGlobalFunction("DoMaxesTF");

# make this an operation to allow for overloading and TryNextMethod();
Expand Down
70 changes: 43 additions & 27 deletions lib/grp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1460,24 +1460,7 @@ InstallMethod(MaximalSubgroupClassReps,"default, catch dangerous options",
true,[IsGroup],0,
function(G)
local H,a,m,i,l;
# easy case, go without options
if not HasTryMaximalSubgroupClassReps(G) then
return TryMaximalSubgroupClassReps(G:
# as if options were unset
cheap:=fail,intersize:=fail,inmax:=fail,nolattice:=fail);
fi;

# hard case -- `Try` is stored
if not IsBound(G!.maxsubtrytaint) or G!.maxsubtrytaint=false then
# stored and untainted, just go on
return TryMaximalSubgroupClassReps(G);
fi;

# compute anew for new group to avoid taint
H:=Group(GeneratorsOfGroup(G),One(G));
for i in [Size,IsNaturalAlternatingGroup,IsNaturalSymmetricGroup] do
if Tester(i)(G) then Setter(i)(H,i(G));fi;
od;
# use ``try'' and set flags so that a known partial result is not used
m:=TryMaximalSubgroupClassReps(H:
cheap:=false,intersize:=false,inmax:=false,nolattice:=false);
l:=[];
Expand All @@ -1488,22 +1471,55 @@ local H,a,m,i,l;
od;

# now we know list is untained, store
SetTryMaximalSubgroupClassReps(G,l);
return l;

end);

InstallMethod(TryMaximalSubgroupClassReps,"fetch known correct data",true,
[IsGroup and HasMaximalSubgroupClassReps],SUM_FLAGS,
MaximalSubgroupClassReps);

InstallGlobalFunction(TryMaxSubgroupTainter,function(G)
if ForAny(["cheap","intersize","inmax","nolattice"],
x->not ValueOption(x) in [fail,false]) then
G!.maxsubtrytaint:=true;
# handle various options and flags
InstallGlobalFunction(TryMaximalSubgroupClassReps,
function(G)
local cheap,nolattice,intersize,attr,kill,i,flags,sup,sub,l;
if HasMaximalSubgroupClassReps(G) then
return MaximalSubgroupClassReps(G);
fi;
# the four possible options
cheap:=ValueOption("cheap");
if cheap=fail then cheap:=false;fi;
nolattice:=ValueOption("nolattice");
if nolattice=fail then nolattice:=false;fi;
intersize:=ValueOption("intersize");
if intersize=fail then intersize:=false;fi;
#inmax:=ValueOption("inmax"); # should have no impact on validity of stored
attr:=StoredPartialMaxSubs(G);
# now find whether any stored information matches and which ones would be
# superseded
kill:=[];
for i in [1..Length(attr)] do
flags:=attr[i][1];
# could use this stored result
sup:=flags[3]=false or (IsInt(intersize) and intersize<=flags[3]);
# would supersede the stored result
sub:=intersize=false or (IsInt(flags[3]) and intersize>=flags[3]);
sup:=sup and (cheap or not flags[1]);
sub:=sub and (not cheap or flags[1]);
sup:=sup and (nolattice or not flags[2]);
sub:=sub and (not nolattice or flags[2]);
if sup then return attr[i][2];fi; # use stored
if sub then AddSet(kill,i);fi; # use stored
od;
l:=CalcMaximalSubgroupClassReps(G);
Add(attr,Immutable([[cheap,nolattice,intersize],l]));
# finally kill superseded ones (by replacing with last, which possibly was
# just added)
for i in Reversed(Set(kill)) do
attr[i]:=attr[Length(attr)];
Unbind(attr[Length(attr)]);
od;
return l;
end);

InstallMethod(StoredPartialMaxSubs,"set",true,[IsGroup],0,x->[]);

#############################################################################
##
#M NrConjugacyClasses( <G> ) . . no. of conj. classes of elements in a group
Expand Down
14 changes: 7 additions & 7 deletions lib/grplatt.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1778,11 +1778,10 @@ end);
#F MaximalSubgroupClassReps(<G>) . . . . reps of conjugacy classes of
#F maximal subgroups
##
InstallMethod(TryMaximalSubgroupClassReps,"using lattice",true,[IsGroup],0,
InstallMethod(CalcMaximalSubgroupClassReps,"using lattice",true,[IsGroup],0,
function (G)
local maxs,lat;

TryMaxSubgroupTainter(G);
if ValueOption("nolattice")=true then return fail;fi;
#AH special AG treatment
if not HasIsSolvableGroup(G) and IsSolvableGroup(G) then
Expand Down Expand Up @@ -3033,11 +3032,6 @@ InstallMethod(TomDataAlmostSimpleRecognition,"generic",true,
[IsGroup],0,
function(G)
local T,t,hom,inf,nam,i,aut;
# avoid the isomorphism test falling back
if ValueOption("cheap")=true and IsInt(ValueOption("intersize")) and
ValueOption("intersize")<=Size(G) then
return fail;
fi;

T:=PerfectResiduum(G);
inf:=DataAboutSimpleGroup(T);
Expand Down Expand Up @@ -3090,6 +3084,12 @@ end);

InstallGlobalFunction(TomDataMaxesAlmostSimple,function(G)
local recog,m;
# avoid the isomorphism test falling back
if ValueOption("cheap")=true and IsInt(ValueOption("intersize")) and
ValueOption("intersize")<=Size(G) then
return fail;
fi;

recog:=TomDataAlmostSimpleRecognition(G);
if recog=fail then
return fail;
Expand Down
3 changes: 1 addition & 2 deletions lib/grpnice.gi
Original file line number Diff line number Diff line change
Expand Up @@ -685,11 +685,10 @@ GroupSeriesMethodByNiceMonomorphism( LowerCentralSeriesOfGroup,
##
#M MaximalSubgroupClassReps( <G> )
##
InstallOtherMethod( TryMaximalSubgroupClassReps,
InstallOtherMethod( CalcMaximalSubgroupClassReps,
"handled by nice monomorphism, transfer tainter", true, [IsGroup], 0,
function( G )
local nice, img, sub,i;
TryMaxSubgroupTainter(G);
nice := NiceMonomorphism(G);
img := ShallowCopy(TryMaximalSubgroupClassReps( NiceObject(G) ));
for i in [1..Length(img)] do
Expand Down
5 changes: 2 additions & 3 deletions lib/grppcatr.gi
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ end;
MAXSUBS_BY_PCGS:=function( G )
local spec, first, max, i, new;

TryMaxSubgroupTainter(G);
spec := SpecialPcgs(G);
first := LGFirst( spec );
max := [];
Expand All @@ -385,15 +384,15 @@ end;
##
#M MaximalSubgroupClassReps( <G> )
##
InstallMethod( TryMaximalSubgroupClassReps,
InstallMethod( CalcMaximalSubgroupClassReps,
"pcgs computable groups using special pcgs",
true,
[ IsGroup and CanEasilyComputePcgs and IsFinite ],
0,
MAXSUBS_BY_PCGS);

#fallback
InstallMethod( TryMaximalSubgroupClassReps,
InstallMethod( CalcMaximalSubgroupClassReps,
"pcgs computable groups using special pcgs",
true,
[ IsGroup and IsSolvableGroup and IsFinite ],
Expand Down
8 changes: 5 additions & 3 deletions lib/maxsub.gi
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,6 @@ local G,types,ff,maxes,lmax,q,d,dorb,dorbt,i,dorbc,dorba,dn,act,comb,smax,soc,
a1emb,a2emb,anew,wnew,e1,e2,emb,a1,a2,mm;

G:=arg[1];
TryMaxSubgroupTainter(G);

# which kinds of maxes do we want to get
if Length(arg)>1 then
Expand Down Expand Up @@ -999,8 +998,11 @@ end);
InstallMethod(MaximalSubgroupClassReps,"TF method",true,
[IsGroup and IsFinite and CanComputeFittingFree],OVERRIDENICE,DoMaxesTF);

InstallMethod(TryMaximalSubgroupClassReps,"TF method",true,
[IsGroup and IsFinite and CanComputeFittingFree],OVERRIDENICE,DoMaxesTF);
InstallMethod(CalcMaximalSubgroupClassReps,"TF method",true,
[IsGroup and IsFinite and CanComputeFittingFree],OVERRIDENICE,
function(G)
return DoMaxesTF(G);
end);

#InstallMethod(MaximalSubgroupClassReps,"perm group",true,
# [IsPermGroup and IsFinite],0,DoMaxesTF);
Expand Down
3 changes: 1 addition & 2 deletions lib/pcgsperm.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1424,11 +1424,10 @@ end);
##
## method for solvable perm groups -- it is cheaper to translate to a pc
## group
InstallMethod( TryMaximalSubgroupClassReps,"solvable perm group",true,
InstallMethod( CalcMaximalSubgroupClassReps,"solvable perm group",true,
[ IsPermGroup and CanEasilyComputePcgs and IsFinite ], 0,
function(G)
local hom,m;
TryMaxSubgroupTainter(G);
hom:=IsomorphismPcGroup(G);
m:=MaximalSubgroupClassReps(Image(hom));
List(m,Size); # force
Expand Down
5 changes: 5 additions & 0 deletions tst/testbugfix/2021-04-13-TryMaximals.tst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#4395, reported by Andries Brouwer
gap> g:=SimpleGroup("3D4(2)");;
gap> hs:=List(IsomorphicSubgroups(g,SymmetricGroup(4)),Image);;
gap> Length(TryMaximalSubgroupClassReps(g));
9