/usr/share/gap/lib/grpramat.gi is in gap-libs 4r8p8-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 | #############################################################################
##
#W grpramat.gi GAP Library Franz Gähler
##
##
#Y Copyright (C) 1996, Lehrstuhl D für Mathematik, RWTH Aachen, Germany
#Y (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland
#Y Copyright (C) 2002 The GAP Group
##
## This file contains operations for matrix groups over the rationals
##
#############################################################################
##
#M IsRationalMatrixGroup( G )
##
InstallMethod( IsRationalMatrixGroup, [ IsCyclotomicMatrixGroup ],
G -> ForAll( Flat( GeneratorsOfGroup( G ) ), IsRat ) );
InstallTrueMethod( IsRationalMatrixGroup, IsIntegerMatrixGroup );
#############################################################################
##
#M IsIntegerMatrixGroup( G )
##
InstallMethod( IsIntegerMatrixGroup, [ IsCyclotomicMatrixGroup ],
function( G )
local gen;
gen := GeneratorsOfGroup( G );
return ForAll( Flat( gen ), IsInt ) and
ForAll( gen, g -> AbsInt( DeterminantMat( g ) ) = 1 );
end
);
#############################################################################
##
#M GeneralLinearGroupCons(IsMatrixGroup,n,Integers)
##
InstallMethod( GeneralLinearGroupCons,
"some generators for GL_n(Z)",
[ IsMatrixGroup, IsPosInt, IsIntegers ],
function(fil,n,ints)
local gens,mat,G;
# permutations
gens:=List(GeneratorsOfGroup(SymmetricGroup(n)),i->PermutationMat(i,n));
# sign swapper
mat:= IdentityMat(n,1);
mat[1][1]:=-1;
Add(gens,mat);
# elementary addition
if n>1 then
mat:= IdentityMat(n,1);
mat[1][2]:=1;
Add(gens,mat);
fi;
gens:=List(gens,Immutable);
G:= GroupByGenerators( gens, IdentityMat( n, 1 ) );
Setter(IsNaturalGLnZ)(G,true);
SetName(G,Concatenation("GL(",String(n),",Integers)"));
if n>1 then
SetSize(G,infinity);
SetIsFinite(G,false);
else
SetIsFinite(G,true);
SetSize(G,2);
fi;
return G;
end);
#############################################################################
##
#M SpecialLinearGroupCons(IsMatrixGroup,n,Integers)
##
InstallMethod(SpecialLinearGroupCons,"some generators for SL_n(Z)",
[IsMatrixGroup,IsPosInt,IsIntegers],
function(fil,n,ints)
local gens,mat,G;
# permutations
gens:=List(GeneratorsOfGroup(AlternatingGroup(n)),i->PermutationMat(i,n));
if n>1 then
mat:= IdentityMat(n,1);
mat{[1..2]}{[1..2]}:=[[0,1],[-1,0]];
Add(gens,mat);
# elementary addition
mat:= IdentityMat(n,1);
mat[1][2]:=1;
Add(gens,mat);
fi;
gens:=List(gens,Immutable);
G:= GroupByGenerators( gens, IdentityMat( n, 1 ) );
Setter(IsNaturalSLnZ)(G,true);
SetName(G,Concatenation("SL(",String(n),",Integers)"));
if n>1 then
SetSize(G,infinity);
SetIsFinite(G,false);
else
SetIsFinite(G,true);
SetSize(G,1);
fi;
return G;
end);
#############################################################################
##
#M \in( <g>, GL( <n>, Integers ) )
##
InstallMethod( \in,
"for matrix and GL(n,Z)", IsElmsColls,
[ IsMatrix, IsNaturalGLnZ ],
function ( g, GLnZ )
return DimensionsMat(g) = DimensionsMat(One(GLnZ))
and ForAll(Flat(g),IsInt) and DeterminantMat(g) in [-1,1];
end );
#############################################################################
##
#M \in( <g>, SL( <n>, Integers ) )
##
InstallMethod( \in,
"for matrix and SL(n,Z)", IsElmsColls,
[ IsMatrix, IsNaturalSLnZ ],
function ( g, SLnZ )
return DimensionsMat(g) = DimensionsMat(One(SLnZ))
and ForAll(Flat(g),IsInt) and DeterminantMat(g) = 1;
end );
#############################################################################
##
#M Normalizer( GLnZ, G ) . . . . . . . . . . . . . . . . .Normalizer in GLnZ
##
InstallMethod( NormalizerOp, IsIdenticalObj,
[ IsNaturalGLnZ, IsCyclotomicMatrixGroup ],
function( GLnZ, G )
return NormalizerInGLnZ( G );
end );
#############################################################################
##
#M Centralizer( GLnZ, G ) . . . . . . . . . . . . . . . .Centralizer in GLnZ
##
InstallMethod( CentralizerOp, IsIdenticalObj,
[ IsNaturalGLnZ, IsCyclotomicMatrixGroup ],
function( GLnZ, G )
return CentralizerInGLnZ( G );
end );
#############################################################################
##
#M CrystGroupDefaultAction . . . . . . . . . . . . . . RightAction initially
##
InstallValue( CrystGroupDefaultAction, RightAction );
#############################################################################
##
#M SetCrystGroupDefaultAction( <action> ) . . . . .RightAction or LeftAction
##
InstallGlobalFunction( SetCrystGroupDefaultAction, function( action )
if action = LeftAction then
MakeReadWriteGlobal( "CrystGroupDefaultAction" );
CrystGroupDefaultAction := LeftAction;
MakeReadOnlyGlobal( "CrystGroupDefaultAction" );
elif action = RightAction then
MakeReadWriteGlobal( "CrystGroupDefaultAction" );
CrystGroupDefaultAction := RightAction;
MakeReadOnlyGlobal( "CrystGroupDefaultAction" );
else
Error( "action must be either LeftAction or RightAction" );
fi;
end );
#############################################################################
##
#M IsBravaisGroup( <G> ) . . . . . . . . . . . . . . . . . . .IsBravaisGroup
##
InstallMethod( IsBravaisGroup,
[ IsCyclotomicMatrixGroup ],
function( G )
return G = BravaisGroup( G );
end );
#############################################################################
##
#M InvariantLattice( G ) . . . . .invariant lattice of rational matrix group
##
InstallMethod( InvariantLattice, "for rational matrix groups",
[ IsCyclotomicMatrixGroup ],
function( G )
local gen, dim, trn, rnd, tab, den;
if not IsRationalMatrixGroup( G ) then
TryNextMethod();
fi;
# return fail if no invariant lattice exists
gen := GeneratorsOfGroup( G );
if ForAny( gen, x -> not IsInt( TraceMat( x ) ) ) then
return fail;
fi;
if ForAny( gen, x -> AbsInt( DeterminantMat( x ) ) <> 1 ) then
return fail;
fi;
dim := DimensionOfMatrixGroup( G );
trn := Immutable( IdentityMat( dim ) );
rnd := Random( GeneratorsOfGroup( G ) );
# refine lattice until it contains its image
repeat
# if there are elements with non-integer trace,
# we will find one, sooner or later (with probability 1)
rnd := rnd * Random( gen );
if not IsInt( TraceMat( rnd ) ) then
return fail;
fi;
tab := List( gen, g -> trn * g * trn^-1 );
tab := Concatenation( tab );
tab := Filtered( tab, vec -> ForAny( vec, x -> not IsInt( x ) ) );
if Length( tab ) > 0 then
den := Lcm( List( Flat( tab ), x -> DenominatorRat( x ) ) );
tab := Concatenation( den * Immutable( IdentityMat( dim ) ),
den * tab );
tab := HermiteNormalFormIntegerMat( tab ) / den;
trn := tab{[1..dim]} * trn;
else
den := 1;
fi;
until den = 1;
return trn;
end );
#############################################################################
##
#M IsFinite( G ) . . . . . . . . . . . IsFinite for cyclotomic matrix group
##
InstallMethod( IsFinite,
"cyclotomic matrix group",
[ IsCyclotomicMatrixGroup ],
function( G )
local lat, ilat, grp, mat;
# if not rational, use the nice monomorphism into a rational matrix group
if not IsRationalMatrixGroup( G ) then
return IsFinite( Image( NiceMonomorphism( G ) ) );
fi;
# if not integer, choose basis in which it is integer
if not IsIntegerMatrixGroup( G ) then
lat := InvariantLattice( G );
if lat = fail then
return false;
fi;
ilat := lat^-1;
grp := G^(ilat);
IsFinite( grp );
# IsFinite may have set the size, so we save it
if HasSize( grp ) then
SetSize( G, Size( grp ) );
fi;
# IsFinite may have set an invariant quadratic form
if HasInvariantQuadraticForm( grp ) then
mat := InvariantQuadraticForm( grp ).matrix;
mat := ilat * mat * TransposedMat( ilat );
SetInvariantQuadraticForm( G, rec( matrix := mat ) );
fi;
return IsFinite( grp );
else
return IsFinite( G ); # now G knows it is integer
fi;
end );
#############################################################################
##
#M IsFinite( G ) . . . . . . . . . . . . . IsFinite for integer matrix group
##
#T This method should evetually be replaced or complemented by the methods
#T used in GRIM!
InstallMethod( IsFinite,
"via Minkowski kernel (short but not too efficient)",
[ IsIntegerMatrixGroup ],
function( G )
local grp, size, dim, basis, gens, gensp, orb, rep, stb, img, sch, i,
pnt, gen, tmp;
grp := G;
size := 1;
dim := DimensionOfMatrixGroup( grp );
basis := Immutable( IdentityMat( dim, GF( 2 ) ) );
for i in [1..dim] do
orb := [ basis[i] ];
gens := GeneratorsOfGroup( grp );
gensp := List(gens,i->ImmutableMatrix(2,i*Z(2),true));
rep := [ One( grp ) ];
stb := [];
for pnt in orb do
for gen in [1..Length(gens)] do
img := pnt * gensp[gen];
if not img in orb then
Add( orb, img );
tmp := rep[ Position( orb, pnt ) ] * gens[gen];
# simple test for infinite order
# Order() would be too expensive to do on all elements
if AbsInt( TraceMat( tmp ) ) > dim then
return false;
fi;
Add( rep, tmp );
else
sch := rep[ Position( orb, pnt ) ] * gens[gen]
/ rep[ Position( orb, img ) ];
if i = dim then
if sch <> One( grp ) then
if sch * sch <> One( grp ) then
return false;
fi;
if ForAny( stb, x -> x * sch <> sch * x ) then
return false;
fi;
fi;
else
# simple test for infinite order
# Order() would be too expensive to do on all elements
if AbsInt( TraceMat( sch ) ) > dim then
return false;
fi;
fi;
AddSet( stb, sch );
fi;
od;
od;
grp := GroupByGenerators( stb, One( grp ) );
size := size * Length( orb );
od;
# if we arrive here, the group is finite
SetIsFinite( grp, true );
SetSize( G, size * Size( grp ) );
return true;
end );
#############################################################################
##
#M Size( <G> ) . . . . . for cyclotomic matrix group not known to be finite
##
InstallMethod( Size,
"cyclotomic matrix group not known to be finite",
[ IsCyclotomicMatrixGroup ],
function( G )
if IsFinite( G ) then
return Size( G ); # now G knows it is finite
else
return infinity;
fi;
end );
#############################################################################
##
#M NiceMonomorphism( <G> ) . . . . . . . . . . for a cyclotomic matrix group
##
## For a *nonrational* cyclotomic matrix group, the nice monomorphism is
## defined as an isomorphism to a rational matrix group.
##
## Note that a stored nice monomorphism does *not* imply that the group is
## handled by the nice monomorphism; as for matrix groups in general,
## we want to set `IsHandledByNiceMonomorphism' only for *finite* matrix
## groups.
##
InstallMethod( NiceMonomorphism,
"for a (nonrational) cyclotomic matrix group",
[ IsCyclotomicMatrixGroup ],
function( G )
if IsRationalMatrixGroup( G ) then
TryNextMethod();
else
return BlowUpIsomorphism( G, Basis( FieldOfMatrixGroup( G ) ) );
fi;
end );
#############################################################################
##
#M IsHandledByNiceMonomorphism( <G> ) . . . . for a cyclotomic matrix group
##
## A matrix group shall be handled via nice monomorphism if and only if it
## is finite.
## We install the method here because for cyclotomic matrix groups,
## we can decide finiteness.
##
## (Note that nice monomorphisms may be used also for infinite groups,
## for example for non-rational matrix groups over the cyclotomics.)
##
InstallMethod( IsHandledByNiceMonomorphism,
"for a cyclotomic matrix group",
[ IsCyclotomicMatrixGroup ],
IsFinite );
#############################################################################
##
#M IsomorphismPermGroup( <G> ) . . . . . . . . . . for rational matrix group
##
## The only difference to the method installed for matrix groups is that
## finiteness of (finitely generated) matrix groups over the cyclotomics can
## be decided and hence no warning need to be issued.
##
InstallMethod( IsomorphismPermGroup,
"cyclotomic matrix group",
[ IsCyclotomicMatrixGroup ], 10,
function( G )
if HasNiceMonomorphism(G) and IsPermGroup(Range(NiceMonomorphism(G))) then
return RestrictedMapping(NiceMonomorphism(G),G);
elif not IsFinite(G) then
Error("Cannot compute permutation representation of infinite group");
else
return NicomorphismOfGeneralMatrixGroup(G,false,false);
fi;
end);
#############################################################################
##
## *Finite* matrix groups lie in the filter `IsHandledByNiceMonomorphism'.
## In order to make the corresponding methods for the operations involved in
## the following `RedispatchOnCondition' calls applicable for finite
## matrix groups over the cyclotomics,
## we force a finiteness check as ``last resort''.
##
RedispatchOnCondition( \in, true,
[ IsMatrix, IsCyclotomicMatrixGroup ],
[ IsObject, IsFinite ], 0 );
RedispatchOnCondition( \=, IsIdenticalObj,
[ IsCyclotomicMatrixGroup, IsCyclotomicMatrixGroup ],
[ IsFinite, IsFinite ], 0 );
RedispatchOnCondition( IndexOp, IsIdenticalObj,
[ IsCyclotomicMatrixGroup, IsCyclotomicMatrixGroup ],
[ IsFinite, IsFinite ], 0 );
RedispatchOnCondition( IndexNC, IsIdenticalObj,
[ IsCyclotomicMatrixGroup, IsCyclotomicMatrixGroup ],
[ IsFinite, IsFinite ], 0 );
RedispatchOnCondition( NormalizerOp, IsIdenticalObj,
[ IsCyclotomicMatrixGroup, IsCyclotomicMatrixGroup ],
[ IsFinite, IsFinite ], 0 );
RedispatchOnCondition( NormalClosureOp, IsIdenticalObj,
[ IsCyclotomicMatrixGroup, IsCyclotomicMatrixGroup ],
[ IsFinite, IsFinite ], 0 );
RedispatchOnCondition( CentralizerOp, true,
[ IsCyclotomicMatrixGroup, IsObject ],
[ IsFinite ], 0 );
RedispatchOnCondition( ClosureGroup, true,
[ IsCyclotomicMatrixGroup, IsObject ],
[ IsFinite ], 0 );
RedispatchOnCondition( SylowSubgroupOp, true,
[ IsCyclotomicMatrixGroup, IsPosInt ],
[ IsFinite ], 0 );
RedispatchOnCondition( ConjugacyClasses, true,
[ IsCyclotomicMatrixGroup ],
[ IsFinite ], 0 );
#T as we have installed a method for this situation,
#T no fallback is needed
# RedispatchOnCondition( IsomorphismPermGroup, true,
# [ IsCyclotomicMatrixGroup ],
# [ IsFinite ], 0 );
RedispatchOnCondition( IsomorphismPcGroup, true,
[ IsCyclotomicMatrixGroup ],
[ IsFinite ], 0 );
RedispatchOnCondition( CompositionSeries, true,
[ IsCyclotomicMatrixGroup ],
[ IsFinite ], 0 );
#############################################################################
##
#E
|