Skip to content

Commit

Permalink
Adjust constructors for An and Sn to new precedence rules
Browse files Browse the repository at this point in the history
  • Loading branch information
stevelinton authored and fingolfin committed May 28, 2019
1 parent b5adf7d commit 77aa046
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 17 deletions.
2 changes: 2 additions & 0 deletions grp/basic.gd
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ end );
## </ManSection>
##
DeclareConstructor( "AlternatingGroupCons", [ IsGroup, IsInt ] );
DeclareConstructor( "AlternatingGroupCons", [ IsGroup, IsDenseList ] );


#############################################################################
Expand Down Expand Up @@ -693,6 +694,7 @@ end );
## </ManSection>
##
DeclareConstructor( "SymmetricGroupCons", [ IsGroup, IsInt ] );
DeclareConstructor( "SymmetricGroupCons", [ IsGroup, IsDenseList ] );


#############################################################################
Expand Down
4 changes: 2 additions & 2 deletions grp/basicpcg.gi
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function( filter, deg )
local alt;

if 4 < deg then
Error( "<deg> must be at most 4" );
TryNextMethod();
fi;
alt := GroupByPcgs(Pcgs(AlternatingGroupCons(IsPermGroup,[1..deg])));
SetIsAlternatingGroup( alt, true );
Expand Down Expand Up @@ -396,7 +396,7 @@ InstallMethod( SymmetricGroupCons,

function( filter, deg )
if 4 < deg then
Error( "<deg> must be at most 4" );
TryNextMethod();
fi;
return GroupByPcgs(Pcgs(SymmetricGroupCons(IsPermGroup,[1..deg])));
end );
59 changes: 44 additions & 15 deletions grp/basicprm.gi
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ end);
InstallMethod( AlternatingGroupCons,
"perm group with degree",
true,
[ IsPermGroup and IsFinite,
[ IsNaturalAlternatingGroup and IsPermGroup and IsFinite,
IsInt],
0,

Expand All @@ -97,18 +97,28 @@ end );
##
#M AlternatingGroupCons( <IsPermGroup>, <dom> )
##
InstallOtherMethod( AlternatingGroupCons,

BindGlobal("ALTERNATING_GROUP_CACHE",[]);


InstallMethod( AlternatingGroupCons,
"perm group with domain",
true,
[ IsPermGroup and IsFinite,
[ IsPermGroup and IsNaturalAlternatingGroup and IsFinite,
IsDenseList ],
0,

function( filter, dom )
local alt, dl, g, l;
local alt, dl, g, l, cachable;

dom := Set(dom);
IsRange( dom );
cachable := -1;
if IsRange( dom ) and dom[1] = 1 and (Length(dom) = 1 or dom[2] = 2) then
cachable := Length(dom);
if IsBound(ALTERNATING_GROUP_CACHE[cachable]) then
return ALTERNATING_GROUP_CACHE[cachable];
fi;
fi;
if Length(dom) < 3 then
alt := GroupByGenerators( [], () );
SetSize( alt, 1 );
Expand Down Expand Up @@ -143,6 +153,10 @@ function( filter, dom )
fi;
SetIsAlternatingGroup( alt, true );
SetIsNaturalAlternatingGroup( alt, true );
if cachable > -1 then
ALTERNATING_GROUP_CACHE[cachable] := alt;
fi;

return alt;
end );

Expand All @@ -155,7 +169,7 @@ InstallMethod( AlternatingGroupCons,
true,
[ IsPermGroup and IsRegular and IsFinite,
IsInt],
0,
-RankFilter(IsRegular)-1,

function( filter, deg )
if deg<0 then TryNextMethod();fi;
Expand All @@ -173,12 +187,12 @@ InstallOtherMethod( AlternatingGroupCons,
true,
[ IsPermGroup and IsRegular and IsFinite,
IsDenseList ],
0,
-RankFilter(IsRegular)-1,

function( filter, dom )
local alt;

alt := AlternatingGroupCons( IsPermGroup, dom );
alt := AlternatingGroupCons( IsNaturalAlternatingGroup, dom );
alt := Action( alt, AsList(alt), OnRight );
SetIsAlternatingGroup( alt, true );
return alt;
Expand Down Expand Up @@ -359,26 +373,37 @@ InstallMethod( SymmetricGroupCons,

function( filter, deg )
if deg<0 then TryNextMethod();fi;
return SymmetricGroupCons( IsPermGroup, [ 1 .. deg ] );
return SymmetricGroupCons( IsPermGroup and IsNaturalSymmetricGroup, [ 1 .. deg ] );
end );


#############################################################################
##
#M SymmetricGroupCons( <IsPermGroup>, <dom> )
##

BindGlobal("SYMMETRIC_GROUP_CACHE", []);


InstallOtherMethod( SymmetricGroupCons,
"perm group with domain",
true,
[ IsPermGroup and IsFinite,
[ IsPermGroup and IsFinite and IsNaturalSymmetricGroup,
IsDenseList ],
0,

function( filters, dom )
local sym, g;
local cachable, sym, g;

dom := Set(dom);
IsRange( dom );
cachable := -1;
if IsRange( dom ) and dom[1] = 1 and (Length(dom) = 1 or dom[2] = 2) then
cachable := Length(dom);
if IsBound(SYMMETRIC_GROUP_CACHE[cachable]) then
return SYMMETRIC_GROUP_CACHE[cachable];
fi;
fi;

if Length(dom) < 2 then
sym := GroupByGenerators( [], () );
SetSize( sym, 1 );
Expand All @@ -402,6 +427,9 @@ function( filters, dom )
SetIsPrimitiveAffine( sym, Length( dom ) < 5 );
SetIsSymmetricGroup( sym, true );
SetIsNaturalSymmetricGroup( sym, true );
if cachable > -1 then
SYMMETRIC_GROUP_CACHE[cachable] := sym;
fi;
return sym;
end );

Expand All @@ -415,7 +443,7 @@ InstallMethod( SymmetricGroupCons,
true,
[ IsPermGroup and IsRegular and IsFinite,
IsInt],
0,
-RankFilter(IsRegular)-1,

function( filter, deg )
if deg<0 then TryNextMethod();fi;
Expand All @@ -433,12 +461,13 @@ InstallOtherMethod( SymmetricGroupCons,
true,
[ IsPermGroup and IsRegular and IsFinite,
IsDenseList ],
0,
-RankFilter(IsRegular)-1,


function( filter, dom )
local alt;

alt := SymmetricGroupCons( IsPermGroup, dom );
alt := SymmetricGroupCons( IsPermGroup and IsNaturalSymmetricGroup, dom );
alt := Action( alt, AsList(alt), OnRight );
SetIsSymmetricGroup( alt, true );
return alt;
Expand Down

0 comments on commit 77aa046

Please sign in to comment.