/usr/share/gap/pkg/Polycyclic/gap/basic/pcpgrps.gi is in gap-polycyclic 2.11-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 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 | #############################################################################
##
#W pcpgrps.gi Polycyc Bettina Eick
##
#############################################################################
##
#F Create a pcp group by collector
##
## The trivial group is missing.
##
InstallGlobalFunction( PcpGroupByCollectorNC, function( coll )
local n, l, e, f, G, rels;
n := coll![ PC_NUMBER_OF_GENERATORS ];
if n > 0 then
l := IdentityMat( n );
fi;
e := List( [1..n], x -> PcpElementByExponentsNC( coll, l[x] ) );
f := PcpElementByGenExpListNC( coll, [] );
G := GroupWithGenerators( e, f );
SetCgs( G, e );
SetIsWholeFamily( G, true );
if 0 in RelativeOrders( coll ) then
SetIsFinite( G, false );
else
SetIsFinite( G, true );
SetSize( G, Product( RelativeOrders( coll ) ) );
fi;
return G;
end );
InstallGlobalFunction( PcpGroupByCollector, function( coll )
UpdatePolycyclicCollector( coll );
if not IsConfluent( coll ) then
return fail;
else
return PcpGroupByCollectorNC( coll );
fi;
end );
#############################################################################
##
#F Print( <G> )
##
InstallMethod( PrintObj, "for a pcp group", [ IsPcpGroup ],
function( G )
Print("Pcp-group with orders ", List( Igs(G), RelativeOrderPcp ) );
end );
InstallMethod( ViewObj, "for a pcp group", [ IsPcpGroup ], SUM_FLAGS,
function( G )
Print("Pcp-group with orders ", List( Igs(G), RelativeOrderPcp ) );
end );
#############################################################################
##
#M Igs( <pcpgrp> )
#M Ngs( <pcpgrp> )
#M Cgs( <pcpgrp> )
##
InstallMethod( Igs, [ IsPcpGroup ],
function( G )
if HasCgs( G ) then return Cgs(G); fi;
if HasNgs( G ) then return Ngs(G); fi;
return Igs( GeneratorsOfGroup(G) );
end );
InstallMethod( Ngs, [ IsPcpGroup ],
function( G )
if HasCgs( G ) then return Cgs(G); fi;
return Ngs( Igs( GeneratorsOfGroup(G) ) );
end );
InstallMethod( Cgs, [ IsPcpGroup ],
function( G )
return Cgs( Igs( GeneratorsOfGroup(G) ) );
end );
#############################################################################
##
#M Membershiptest for pcp groups
##
InstallMethod( \in, "for a pcp element and a pcp group",
IsElmsColls, [IsPcpElement, IsPcpGroup],
function( g, G )
return ReducedByIgs( Igs(G), g ) = One(G);
end );
#############################################################################
##
#M Random( G )
##
InstallMethod( Random, "for a pcp group", [ IsPcpGroup ],
function( G )
local pcp, rel, g, i;
pcp := Pcp(G);
rel := RelativeOrdersOfPcp( pcp );
g := [];
for i in [1..Length(rel)] do
if rel[i] = 0 then
g[i] := Random( Integers );
else
g[i] := Random( [0..rel[i]-1] );
fi;
od;
return MappedVector( g, pcp );
end );
#############################################################################
##
#M SubgroupByIgs( G, igs [, gens] )
##
## create a subgroup and set igs. If gens is given, compute pcs defined
## by <gens, pcs> and use this. Note: this function does not check if the
## generators are in G.
##
InstallGlobalFunction( SubgroupByIgs,
function( arg )
local U, pcs;
if Length( arg ) = 3 then
pcs := AddToIgs( arg[2], arg[3] );
else
pcs := arg[2];
fi;
U := SubgroupNC( Parent(arg[1]), pcs );
SetIgs( U, pcs );
return U;
end);
#############################################################################
##
#M SubgroupByIgsAndIgs( G, fac, nor )
##
## fac and nor are igs for a factor and a normal subgroup. This function
## computes an igs for the subgroups generated by fac and nor and sets it
## in the subgroup. This is a no-check function
##
SubgroupByIgsAndIgs := function( G, fac, nor )
return SubgroupByIgs( G, AddIgsToIgs( fac, nor ) );
end;
#############################################################################
##
#M IsSubset for pcp groups
##
InstallMethod( IsSubset, "for pcp groups",
IsIdenticalObj, [ IsPcpGroup, IsPcpGroup ], SUM_FLAGS,
function( H, U )
if Parent(U) = H then return true; fi;
return ForAll( GeneratorsOfGroup(U), x -> x in H );
end );
#############################################################################
##
#M IsNormal( H, U ) . . . . . . . . . . . . . . .test if U is normalized by H
##
InstallMethod( IsNormalOp, "for pcp groups",
IsIdenticalObj, [ IsPcpGroup, IsPcpGroup ],
function( H, U )
local u, h;
for h in GeneratorsOfPcp( Pcp(H, U)) do
for u in Igs(U) do
if not u^h in U then return false; fi;
od;
od;
return true;
end );
#############################################################################
##
#M Size( <pcpgrp> )
##
InstallMethod( Size, [ IsPcpGroup ],
function( G )
local pcs, rel;
pcs := Igs( G );
rel := List( pcs, RelativeOrderPcp );
if ForAny( rel, x -> x = 0 ) then
return infinity;
else
return Product( rel );
fi;
end );
#############################################################################
##
#M CanComputeIndex( <pcpgrp>, <pcpgrp> )
#M CanComputeSize( <pcpgrp> )
#M CanComputeSizeAnySubgroup( <pcpgrp> )
##
InstallMethod( CanComputeIndex, IsIdenticalObj, [IsPcpGroup, IsPcpGroup], ReturnTrue );
InstallTrueMethod( CanComputeSize, IsPcpGroup );
InstallTrueMethod( CanComputeSizeAnySubgroup, IsPcpGroup );
#############################################################################
##
#M IndexNC/Index( <pcpgrp>, <pcpgrp> )
##
InstallMethod( IndexNC, "for pcp groups",
IsIdenticalObj, [IsPcpGroup, IsPcpGroup],
function( H, U )
local pcp, rel;
pcp := Pcp( H, U );
rel := RelativeOrdersOfPcp( pcp );
if ForAny( rel, x -> x = 0 ) then
return infinity;
else
return Product( rel );
fi;
end );
InstallMethod( IndexOp, "for pcp groups",
IsIdenticalObj, [IsPcpGroup, IsPcpGroup],
function( H, U )
if not IsSubgroup( H, U ) then
Error("H must be contained in G");
fi;
return IndexNC( H, U );
end );
#############################################################################
##
#M <pcpgrp> = <pcpgrp>
##
InstallMethod( \=, "for pcp groups",
IsIdenticalObj, [IsPcpGroup, IsPcpGroup],
function( G, H )
return Cgs( G ) = Cgs( H );
end);
#############################################################################
##
#M ClosureGroup( <pcpgrp>, <pcpgrp> )
##
InstallMethod( ClosureGroup, "for pcp groups",
IsIdenticalObj, [IsPcpGroup, IsPcpGroup],
function( G, H )
local P;
P := PcpGroupByCollectorNC( Collector(G) );
return SubgroupByIgs( P, Igs(G), GeneratorsOfGroup(H) );
end );
#############################################################################
##
#F HirschLength( <G> )
##
InstallMethod( HirschLength, [ IsPcpGroup ],
function( G )
local pcs, rel;
pcs := Igs( G );
rel := List( pcs, RelativeOrderPcp );
return Length( Filtered( rel, x -> x = 0 ) );
end );
#############################################################################
##
#M CommutatorSubgroup( G, H )
##
InstallMethod( CommutatorSubgroup, "for pcp groups",
IsIdenticalObj, [ IsPcpGroup, IsPcpGroup],
function( G, H )
local pcsG, pcsH, coms, i, j, U, u;
pcsG := Igs(G);
pcsH := Igs(H);
# if G = H then we need fewer commutators
coms := [];
if pcsG = pcsH then
for i in [1..Length(pcsG)] do
for j in [1..i-1] do
Add( coms, Comm( pcsG[i], pcsH[j] ) );
od;
od;
coms := Igs( coms );
U := SubgroupByIgs( Parent(G), coms );
else
for u in pcsG do
coms := AddToIgs( coms, List( pcsH, x -> Comm( u, x ) ) );
od;
U := SubgroupByIgs( Parent(G), coms );
# In order to conjugate with fewer elements, compute <U,V>. If one is
# normal than we do not need the normal closure, see Glasby 1987.
if not (IsBound( G!.isNormal ) and G!.isNormal) and
not (IsBound( H!.isNormal ) and H!.isNormal) then
U := NormalClosure( ClosureGroup( G, H ), U );
fi;
fi;
return U;
end );
#############################################################################
##
#M DerivedSubgroup( G )
##
InstallMethod( DerivedSubgroup, "for a pcp group",
[ IsPcpGroup ], G -> CommutatorSubgroup(G, G) );
#############################################################################
##
#M PRump( G, p ). . . . . smallest normal subgroup N of G with G/N elementary
## abelian p-group.
##
InstallMethod( PRumpOp, "for a pcp group and a prime",
[IsPcpGroup, IsPosInt],
function( G, p )
local D, pcp, new;
D := DerivedSubgroup(G);
pcp := Pcp( G, D );
new := List( pcp, x -> x^p );
return SubgroupByIgs( G, Igs(D), new );
end );
#############################################################################
##
#M IsNilpotentGroup( <pcpgrp> )
##
InstallMethod( IsNilpotentGroup, "for a pcp group with known lower central series",
[ IsPcpGroup and HasLowerCentralSeriesOfGroup ],
function( G )
local lcs;
lcs := LowerCentralSeriesOfGroup( G );
return IsTrivial( lcs[ Length(lcs) ] );
end );
InstallMethod( IsNilpotentGroup, "for a pcp group",
[IsPcpGroup],
function( G )
local l, U, V, pcp, n;
l := HirschLength(G);
U := ShallowCopy( G );
repeat
# take next term of lc series
U!.isNormal := true;
V := CommutatorSubgroup( G, U );
# if we arrive at the trivial group
if Size( V ) = 1 then return true; fi;
# get quotient U/V
pcp := Pcp( U, V );
# if U=V then the series has terminated at a non-trivial group
if Length( pcp ) = 0 then
return false;
fi;
# get the Hirsch length of U/V
n := Length( Filtered( RelativeOrdersOfPcp( pcp ), x -> x = 0));
# compare it with l
if n = 0 and l <> 0 then return false; fi;
l := l - n;
# iterate
U := ShallowCopy( V );
until false;
end );
#############################################################################
##
#M IsElementaryAbelian( <pcpgrp> )
##
InstallMethod( IsElementaryAbelian, "for a pcp group",
[ IsPcpGroup ],
function( G )
local rel, p;
if not IsFinite(G) or not IsAbelian(G) then return false; fi;
rel := List( Igs(G), RelativeOrderPcp );
if Length(Set(rel)) > 1 then return false; fi;
if ForAny( rel, x -> not IsPrime(x) ) then return false; fi;
p := rel[1];
return ForAll( RelativeOrdersOfPcp( Pcp( G, "snf" ) ), x -> x = p );
end );
#############################################################################
##
#F AbelianInvariants( <pcpgrp > )
##
InstallMethod( AbelianInvariants, "for a pcp group",
[ IsPcpGroup ],
function( G )
return AbelianInvariantsOfList( RelativeOrdersOfPcp( Pcp(G, DerivedSubgroup(G), "snf") ) );
end );
InstallMethod( AbelianInvariants, "for an abelian pcp group",
[IsPcpGroup and IsAbelian],
function( G )
return AbelianInvariantsOfList( RelativeOrdersOfPcp( Pcp(G, "snf") ) );
end );
#############################################################################
##
#M CanEasilyComputeWithIndependentGensAbelianGroup( <pcpgrp> )
##
if IsBound(CanEasilyComputeWithIndependentGensAbelianGroup) then
# CanEasilyComputeWithIndependentGensAbelianGroup was introduced in GAP 4.5.x
InstallTrueMethod(CanEasilyComputeWithIndependentGensAbelianGroup,
IsPcpGroup and IsAbelian);
fi;
BindGlobal( "ComputeIndependentGeneratorsOfAbelianPcpGroup", function ( G )
local pcp, id, mat, base, ord, i, g, o, cf, j;
# Get a pcp in Smith normal form
if not IsBound( G!.snfpcp ) then
pcp := Pcp(G, "snf");
G!.snfpcp := pcp;
else
pcp := G!.snfpcp;
fi;
if IsBound( G!.indgens ) and IsBound( G!.indgenmat ) then
return;
fi;
# Unfortunately, this is not *quite* what we need; in order to match
# the Abelian invariants, we now have to further refine the generator
# list to ensure only generators of prime power order are in the list.
id := IdentityMat( Length(pcp) );
mat := [];
base := [];
ord := [];
for i in [1..Length(pcp)] do
g := pcp[i];
o := Order(g);
if o = 1 then continue; fi;
if o = infinity then
Add(base, g);
Add(mat, id[i]);
Add(ord, 0);
continue;
fi;
cf:=Collected(Factors(o));
if Length(cf) > 1 then
for j in cf do
j := j[1]^j[2];
Add(base, g^(o/j));
Add(mat, id[i] * (j/o mod j));
Add(ord, j);
od;
else
Add(base, g);
Add(mat, id[i]);
Add(ord, o);
fi;
od;
SortParallel(ShallowCopy(ord),base);
SortParallel(ord,mat);
mat := TransposedMat( mat );
G!.indgens := base;
G!.indgenmat := mat;
end );
#############################################################################
##
#A IndependentGeneratorsOfAbelianGroup( <A> )
##
InstallMethod(IndependentGeneratorsOfAbelianGroup, "for an abelian pcp group",
[IsPcpGroup and IsAbelian],
function( G )
if not IsBound( G!.indgens ) then
ComputeIndependentGeneratorsOfAbelianPcpGroup( G );
fi;
return G!.indgens;
end );
#############################################################################
##
#O IndependentGeneratorExponents( <G>, <g> )
##
if IsBound( IndependentGeneratorExponents ) then
# IndependentGeneratorExponents was introduced in GAP 4.5.x
InstallMethod(IndependentGeneratorExponents, "for an abelian pcp group and an element",
IsCollsElms,
[IsPcpGroup and IsAbelian, IsPcpElement],
function( G, elm )
local exp, rels, i;
# Ensure everything has been set up
if not IsBound( G!.indgenmat ) then
ComputeIndependentGeneratorsOfAbelianPcpGroup( G );
fi;
# Convert elm into an exponent vector with respect to a snf pcp
exp := ExponentsByPcp( G!.snfpcp, elm );
rels := AbelianInvariants( G );
# Convert the exponent vector with respect to pcp into one
# with respect to our independent abelian generators.
exp := exp * G!.indgenmat;
for i in [1..Length(exp)] do
if rels[i] > 0 then exp[i] := exp[i] mod rels[i]; fi;
od;
return exp;
end);
fi;
#############################################################################
##
#F NormalClosure( K, U )
##
InstallMethod( NormalClosureOp, "for pcp groups",
IsIdenticalObj, [IsPcpGroup, IsPcpGroup],
function( K, U )
local tmpN, newN, done, id, gensK, pcsN, k, n, c, N;
# take initial pcs
pcsN := ShallowCopy( Cgs(U) );
if Length( pcsN ) = 0 then return U; fi;
# take generating sets
id := One( K );
gensK := GeneratorsOfGroup(K);
gensK := List( gensK, x -> ReducedByIgs( pcsN, x ) );
gensK := Filtered( gensK, x -> x <> id );
done := false;
repeat
done := true;
tmpN := ShallowCopy( pcsN );
for k in gensK do
for n in tmpN do
c := ReducedByIgs( pcsN, Comm( k, n ) );
if c <> id then
newN := AddToIgs( pcsN, [c] );
if newN <> pcsN then
done := false;
pcsN := Cgs( newN );
fi;
fi;
od;
od;
#Print(Length(pcsN)," obtained \n");
until done;
# set up result
return SubgroupByIgs( Parent(U), pcsN );
end);
#############################################################################
##
#F ExponentsByRels . . . . . . . . . . . . . . .elements written as exponents
##
ExponentsByRels := function( rel )
local exp, idm, i, t, j, e, f;
exp := [List( rel, x -> 0 )];
idm := IdentityMat( Length( rel ) );
for i in Reversed( [1..Length(rel)] ) do
t := [];
for j in [1..rel[i]] do
for e in exp do
f := ShallowCopy( e );
f[i] := j-1;
Add( t, f );
od;
od;
exp := t;
od;
return exp;
end;
|