Skip to content

Commit

Permalink
Sort out constructors for An and Sn in light of new precedence rules
Browse files Browse the repository at this point in the history
  • Loading branch information
stevelinton committed Feb 16, 2016
1 parent c63f245 commit f7f772a
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 @@ -156,6 +156,7 @@ end );
## </ManSection>
##
DeclareConstructor( "AlternatingGroupCons", [ IsGroup, IsInt ] );
DeclareConstructor( "AlternatingGroupCons", [ IsGroup, IsDenseList ] );


#############################################################################
Expand Down Expand Up @@ -616,6 +617,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 @@ -124,7 +124,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 @@ -393,7 +393,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 );
Expand Down
59 changes: 44 additions & 15 deletions grp/basicprm.gi
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ end);
InstallMethod( AlternatingGroupCons,
"perm group with degree",
true,
[ IsPermGroup and IsFinite,
[ IsNaturalAlternatingGroup and IsPermGroup and IsFinite,
IsInt],
0,

Expand All @@ -96,18 +96,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 @@ -142,6 +152,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 @@ -154,7 +168,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 @@ -172,12 +186,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 @@ -358,26 +372,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 @@ -400,6 +425,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 @@ -413,7 +441,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 @@ -431,12 +459,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 f7f772a

Please sign in to comment.