📄 stdgen.gi
字号:
od;
if pos2 <= linelen and line[ pos2 ] <> '(' then
word:= line{ [ initlen+1 .. pos2-1 ] };
try:= ShallowCopy( list );
for j in [ 1 .. Length( list ) ] do
if not IsBound( try[j] ) then
try[j]:= word;
fi;
od;
try:= Concatenation( try );
if try = line{ [ 1 .. pos-1 ] } then
scr:= [];
found:= StringToStraightLineProgram( word, gensnames, scr );
if found then
Add( script, [ scr[1][1], list, int ] );
fi;
fi;
fi;
if found then
break;
fi;
fi;
od;
if not found then
# Check for a relation.
if line[1] <> '|' then
return fail;
fi;
pos:= Position( line, '=' );
if pos = fail then
return fail;
fi;
if line[ pos-1 ] <> '|' then
return fail;
fi;
int:= Int( line{ [ pos+1 .. Length( line ) ] } );
if int = fail then
return fail;
fi;
word:= [];
if not StringToStraightLineProgram( line{ [ 2 .. pos-2 ] },
gensnames, word ) then
return fail;
fi;
# Create a straight line program if brackets were found.
if Length( word ) = 1 then
word:= word[1][1];
Add( word, int );
Add( script, word );
else
Add( script, [ [ 1 .. Length( gensnames ) ],
StraightLineProgram( word, Length( gensnames ) ),
int ] );
fi;
fi;
fi;
k:= k+1;
od;
# Return the result;
return script;
end );
#############################################################################
##
#V StandardGeneratorsFunctions
##
InstallValue( StandardGeneratorsFunctions, [] );
CentralizerOrder := function( G, g ) return Size( Centralizer( G, g ) ); end;
Append( StandardGeneratorsFunctions, [ CentralizerOrder, [ "|C(",,")|" ] ] );
#############################################################################
##
#F IsStandardGeneratorsOfGroup( <info>, <G>, <gens> )
##
InstallGlobalFunction( IsStandardGeneratorsOfGroup, function( info, G, gens )
local script,
i,
line,
g,
next,
linelen,
j;
# Initialize, and start the loop.
script:= info.script;
for i in [ 1 .. Length( script ) ] do
Info( InfoGroup, 3,
"StandardGenerators: inspecting line ", i );
line:= script[i];
if IsList( line[2] ) and IsString( line[2][1] ) then
# condition line.
# First compute the element to be checked.
if IsEmpty( line[1] ) then
g:= One( G );
elif not IsBound( gens[ line[1][1] ] ) then
return false;
else
g:= gens[ line[1][1] ];
if line[1][2] <> 1 then
g:= g ^ line[1][2];
fi;
for j in [ 3, 5 .. Length( line[1] ) - 1 ] do
if not IsBound( gens[ line[1][j] ] ) then
return false;
fi;
next:= gens[ line[1][j] ];
if line[1][ j+1 ] <> 1 then
next:= next ^ line[1][ j+1 ];
fi;
g:= g * next;
od;
fi;
# Next compute the value under the function, and compare.
if StandardGeneratorsFunctions[ Position(
StandardGeneratorsFunctions, line[2] ) - 1 ]( G,
g ) <> line[3] then
return false;
fi;
elif Length( line ) <= 3 and IsInt( line[2] ) then
# definition line
if not IsBound( gens[ line[1] ] )
or ( Length( line ) = 2 and Order( gens[ line[1] ] ) <> line[2] )
or ( Length( line ) = 3 and Order( gens[ line[1] ] )
<> line[2] / Gcd( line[2], line[3] ) ) then
return false;
fi;
else
# relation line
linelen:= Length( line );
if linelen = 3 then
if Order( ResultOfStraightLineProgram( line[2], gens{ line[1] } ) )
<> line[3] then
return false;
fi;
else
g:= gens[ line[1] ]^line[2];
for j in [ 3, 5 .. linelen-2 ] do
next:= gens[ line[j] ];
if line[ j+1 ] <> 1 then
next:= next^line[ j+1 ];
fi;
g:= g * next;
od;
if Order( g ) <> line[ linelen ] then
return false;
fi;
fi;
fi;
od;
# All conditions are satisfied.
return true;
end );
#############################################################################
##
#F StandardGeneratorsOfGroup( <info>, <G>[, <randfunc>] )
##
InstallGlobalFunction( StandardGeneratorsOfGroup, function( arg )
local info,
G,
randfunc,
gens,
script,
len,
i,
line,
g,
next,
linelen,
j;
# Get and check the arguments.
if Length( arg ) = 2 and IsRecord( arg[1] ) and IsGroup( arg[2] ) then
info := arg[1];
G := arg[2];
randfunc := PseudoRandom;
elif Length( arg ) = 3 and IsRecord( arg[1] ) and IsGroup( arg[2] )
and IsFunction( arg[3] ) then
info := arg[1];
G := arg[2];
randfunc := arg[3];
else
Error( "usage: StandardGenerators( <info>, <G>[, <randfunc>] )" );
fi;
# Initialize, and start the loop.
if not IsBound( info.script ) then
if not IsBound( info.description ) then
Error( "need at least a component `script' or `description'" );
else
info.script:= ScriptFromString( info.description );
fi;
fi;
script:= info.script;
len:= Length( script );
i:= 1;
gens:= [];
while i <= len do
Info( InfoGroup, 3,
"StandardGenerators: inspecting line ", i );
line:= script[i];
if IsList( line[2] ) and IsString( line[2][1] ) then
# condition line.
# First compute the element to be checked.
if IsEmpty( line[1] ) then
g:= One( G );
elif not IsBound( gens[ line[1][1] ] ) then
Error( "definition of ", Ordinal( line[1][1] ),
" generator missing before line ", i );
else
g:= gens[ line[1][1] ];
if line[1][2] <> 1 then
g:= g ^ line[1][2];
fi;
for j in [ 3, 5 .. Length( line[1] ) - 1 ] do
if not IsBound( gens[ line[1][j] ] ) then
Error( "definition of ", Ordinal( line[1][j] ),
" generator missing before line ", i );
fi;
next:= gens[ line[1][j] ];
if line[1][ j+1 ] <> 1 then
next:= next ^ line[1][ j+1 ];
fi;
g:= g * next;
od;
fi;
# Next compute the value under the function, and compare.
if StandardGeneratorsFunctions[ Position(
StandardGeneratorsFunctions, line[2] ) - 1 ]( G,
g ) <> line[3] then
gens:= [];
i:= 0;
fi;
elif Length( line ) <= 3 and IsInt( line[2] ) then
# definition line
if IsBound( gens[ line[1] ] ) then
Error( Ordinal( line[1] ),
" generator defined a second time in line ", i );
fi;
repeat
g:= randfunc( G );
until Order( g ) = line[2];
if IsBound( line[3] ) and line[3] <> 1 then
g:= g^line[3];
fi;
gens[ line[1] ]:= g;
else
# relation line
linelen:= Length( line );
if linelen = 3 then
g:= ResultOfStraightLineProgram( line[2], gens{ line[1] } );
else
g:= gens[ line[1] ]^line[2];
for j in [ 3, 5 .. linelen-2 ] do
g:= g * gens[ line[j] ]^line[ j+1 ];
od;
fi;
if Order( g ) <> line[ linelen ] then
gens:= [];
i:= 0;
fi;
fi;
# Inspect the next line.
i:= i + 1;
od;
# Return the result.
return gens;
end );
#############################################################################
##
#E
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -