/usr/share/gap/grp/glzmodmz.gi is in gap-libs 4r6p5-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 | #############################################################################
##
#W glzmodmz.gi GAP library Stefan Kohl
#W Alexander Hulpke
##
##
#Y Copyright (C) 2011 The GAP Group
##
## This file contains the functionality for constructing clasical groups over
## residue class rings.
##
#############################################################################
##
#F SizeOfGLdZmodmZ( <d>, <m> ) . . . . . . Size of the group GL(<d>,Z/<m>Z)
##
## Computes the order of the group `GL( <d>, Integers mod <m> )' for
## positive integers <d> and <m> > 1.
##
InstallGlobalFunction( SizeOfGLdZmodmZ,
function ( d, m )
local size, pow, p, q, k, i;
if not (IsPosInt(d) and IsInt(m) and m > 1)
then Error("GL(",d,",Integers mod ",m,") is not a well-defined group, ",
"resp. not supported.\n");
fi;
size := 1;
for pow in Collected(Factors(m)) do
p := pow[1]; k := pow[2]; q := p^k;
size := size * Product([d*k - d .. d*k - 1], i -> q^d - p^i);
od;
return size;
end );
#############################################################################
##
#M SpecialLinearGroupCons( IsNaturalSL, <d>, Integers mod <m> )
##
InstallMethod( SpecialLinearGroupCons,
"natural SL for dimension and residue class ring",
[ IsMatrixGroup and IsFinite, IsPosInt,
IsRing and IsFinite and IsZmodnZObjNonprimeCollection ],
function ( filter, d, R )
local G, gens, g, m, T;
m := Size(R);
if R <> Integers mod m or m = 1 then TryNextMethod(); fi;
if IsPrime(m) then return SpecialLinearGroupCons(IsMatrixGroup,d,m); fi;
if d = 1
then gens := [IdentityMat(d,R)];
else gens := List(GeneratorsOfGroup(SymmetricGroup(d)),
g -> PermutationMat(g,d) * One(R));
for g in gens do
if DeterminantMat(g) <> One(R) then g[1] := -g[1]; fi;
od;
T := IdentityMat(d,R); T[1][2] := One(R); Add(gens,T);
fi;
G := GroupByGenerators(gens);
SetName(G,Concatenation("SL(",String(d),",Z/",String(m),"Z)"));
SetIsNaturalSL(G,true);
SetDimensionOfMatrixGroup(G,d);
SetIsFinite(G,true);
SetSize(G,SizeOfGLdZmodmZ(d,m)/Phi(m));
return G;
end );
#############################################################################
##
#M GeneralLinearGroupCons( IsNaturalGL, <d>, Integers mod <m> )
##
InstallMethod( GeneralLinearGroupCons,
"natural GL for dimension and residue class ring",
[ IsMatrixGroup and IsFinite, IsPosInt,
IsRing and IsFinite and IsZmodnZObjNonprimeCollection ],
function ( filter, d, R )
local G, gens, g, m, T, D;
m := Size(R);
if R <> Integers mod m or m = 1 then TryNextMethod(); fi;
if IsPrime(m) then return GeneralLinearGroupCons(IsMatrixGroup,d,m); fi;
if d = 1
then gens := List(GeneratorsOfGroup(Units(R)), g -> [[g]]);
else gens := List(GeneratorsOfGroup(SymmetricGroup(d)),
g -> PermutationMat(g,d) * One(R));
T := IdentityMat(d,R); T[1][2] := One(R); Add(gens,T);
for g in GeneratorsOfGroup(Units(R)) do
D := IdentityMat(d,R); D[1][1] := g; Add(gens,D);
od;
fi;
G := GroupByGenerators(gens);
SetName(G,Concatenation("GL(",String(d),",Z/",String(m),"Z)"));
SetIsNaturalGL(G,true);
SetDimensionOfMatrixGroup(G,d);
SetIsFinite(G,true);
SetSize(G,SizeOfGLdZmodmZ(d,m));
return G;
end );
BindGlobal("OrderMatrixIntegerResidue",function(p,a,M)
local f,M2,o,e,MM,i;
MM:=M;
f:=GF(p);
M2:=ImmutableMatrix(f,List(M,x->List(x,y->Int(y)*One(f))));
o:=Order(M2);
M:=M^o;
e:=p;
i:=1;
while i<a do
i:=i+1;
e:=e*p;
M2:=M-M^0;
if ForAny(M2,x->ForAny(x,x->Int(x) mod e<>0)) then
o:=o*p;
M:=M^p;
fi;
od;
Assert(1,IsOne(M));
return o;
end);
InstallGlobalFunction("ConstructFormPreservingGroup",function(arg)
local oper,n,R,o,nrit,
q,p,field,zero,one,oner,a,f,pp,b,d,fb,btf,eq,r,i,j,e,k,ogens,gens,gensi,
bp,sol,
g,prev,proper,fp,ho,evrels,hom,bas,basm,em,ngens,addmat,sub,transpose;
oper:=arg[1];
R:=arg[Length(arg)];
n:=arg[Length(arg)-1];
q:=Size(R);
if not IsPrimePowerInt(q) then
TryNextMethod();
fi;
p:=Factors(q)[1];
if p=2 then return fail;fi;
field:=GF(p);
zero:=Zero(field);
one:=One(field);
if Length(arg)=3 then
g:=oper(n,p);
else
g:=oper(arg[2],n,p);
fi;
# get the form and get the correct -1's
f:=InvariantBilinearForm(g).matrix;
transpose:=not ForAll(GeneratorsOfGroup(g),
x->TransposedMat(x)*f*x=f);
if transpose then
Info(InfoGroup,1,"transpose!");
if HasSize(g) then
e:=Size(g);
else
e:=fail;
fi;
g:=Group(List(GeneratorsOfGroup(g),TransposedMat));
if e<>fail then
SetSize(g,e);
fi;
fi;
#IsomorphismFpGroup(g); # force hom for next steps
f:=List(f,r->List(r,Int));
for i in [1..n] do
for j in [1..n] do
if f[i][j]=p-1 then
f[i][j]:=-1;
fi;
od;
od;
nrit:=0;
pp:=p; # previous p
while pp<q do
nrit:=nrit+1;
prev:=g;
if HasIsomorphismFpGroup(prev) then
hom:=IsomorphismFpGroup(prev);
fp:=Range(hom);
ogens:=List(GeneratorsOfGroup(fp),
x->List(PreImagesRepresentative(hom,x)));
else
fp:=fail;
ogens:=GeneratorsOfGroup(prev);
fi;
ogens:=List(ogens,x->List(x,r->List(r,Int)));
gens:=[];
for bp in [1..Length(ogens)+1] do
if bp<=Length(ogens) then
b:=ogens[bp];
else
b:=One(ogens[1]);
fi;
d:=(TransposedMat(b)*f*b-f)*1/pp;
# solve D+E^T*F*B+B^T*F*E=0
fb:=f*b;
btf:=TransposedMat(b)*f;
eq:=[];
r:=[];
for i in [1..n] do
for j in [1..n] do
# eq for entry i,j
e:=ListWithIdenticalEntries(n^2,zero);
for k in [1..n] do
e[(k-1)*n+i]:=e[(k-1)*n+i]+fb[k][j];
e[(k-1)*n+j]:=e[(k-1)*n+j]+btf[i][k];
od;
Add(eq,e);
#RHS is -d entry
Add(r,-d[i][j]*one);
od;
od;
eq:=TransposedMat(eq); # columns were corresponding to variables
if bp<=Length(ogens) then
# lift generator
sol:=SolutionMat(eq,r);
# matrix from it
sol:=List([1..n],x->sol{[(x-1)*n+1..x*n]});
sol:=List(sol,x->List(x,Int));
Add(gens,b+pp*sol);
else
# we know all gens
oner:=One(Integers mod (pp*p));
gens:=List(gens,x->x*oner);
g:=Group(gens);
# d will be zero, so homogeneous
sol:=NullspaceMat(eq);
#Info(InfoGroup,1,"extend by dim",Length(sol));
proper:=p^Length(sol)*Size(prev); # proper order of group
if ValueOption("avoidkerneltest")<>true then
# vector space in kernel that is generated
bas:=[];
basm:=[];
sub:=VectorSpace(field,bas,Zero(e));
addmat:=function(em)
local c;
e:=List(em,r->List(r,Int))-b;
e:=1/pp*e;
e:=Concatenation(e)*one;
if p<257 then
ConvertToVectorRep(e,p);
fi;
if not e in sub then
Add(bas,e);
Add(basm,em);
sub:=VectorSpace(field,bas);
fi;
end;
if fp<>fail then
# evaluate relators
evrels:=RelatorsOfFpGroup(fp);
i:=1;
while i<=Length(evrels) and Length(bas)<Length(sol) do
em:=MappedWord(evrels[i],FreeGeneratorsOfFpGroup(fp),gens);
addmat(em);
i:=i+1;
od;
else
evrels:=Source(EpimorphismFromFreeGroup(prev));
repeat
j:=PseudoRandom(evrels:radius:=10);
k:=MappedWord(j,GeneratorsOfGroup(evrels),GeneratorsOfGroup(prev));
o:=OrderMatrixIntegerResidue(p,nrit,k);
k:=MappedWord(j,GeneratorsOfGroup(evrels),gens)^o;
until not IsOne(k);
addmat(k);
fi;
# close under action
gensi:=List(gens,Inverse);
i:=1;
while i<=Length(basm) and Length(bas)<Length(sol) do
for j in [1..Length(gens)] do
#em:=basm[i]^j;
em:=gensi[j]*basm[i]*gens[j];
addmat(em);
od;
i:=i+1;
od;
if Length(bas)=Length(sol) then
Info(InfoGroup,1,"kernel generated ",Length(bas));
else
Info(InfoGroup,1,"kernel partially generated ",Length(bas));
ngens:=ShallowCopy(gens);
i:=Iterator(sol); # just run through basis as linear
while Length(bas)<Length(sol) do
e:=NextIterator(i);
e:=List(e,Int);
e:=b+pp*List([1..n],x->e{[(x-1)*n+1..x*n]});
addmat(e);
if e=basm[Length(basm)] then
# was added
Add(ngens,e);
g:=Group(ngens);
Info(InfoGroup,1,"added generator");
fi;
od;
fi;
if fp <>fail then
# extend presentation
bas:=Basis(sub,bas);
RUN_IN_GGMBI:=true;
hom:=GroupGeneralMappingByImagesNC(g,fp,gens,GeneratorsOfGroup(fp));
hom:=LiftFactorFpHom(hom,g,"M",SubgroupNC(g,basm),rec(
pcgs:=basm,
prime:=p,
decomp:=function(em)
local e;
e:=List(em,r->List(r,Int))-b;
e:=1/pp*e;
e:=Concatenation(e)*one;
return List(Coefficients(bas,e),Int);
end
));
RUN_IN_GGMBI:=false;
#simplify Image to avoid explosion of generator number
fp:=Range(hom);
if true then
# remove redundant generators
e:=PresentationFpGroup(fp);
TzOptions(e).printLevel:=0;
j:=Filtered(Reversed([1..Length(e!.generators)]),
x->not MappingGeneratorsImages(hom)[1][x] in ngens);
j:=e!.generators{j};
TzInitGeneratorImages(e);
for i in j do
TzEliminate(e,i);
od;
fp:=FpGroupPresentation(e);
j:=MappingGeneratorsImages(hom);
k:=TzPreImagesNewGens(e);
k:=List(k,x->j[1][Position(OldGeneratorsOfPresentation(e),x)]);
RUN_IN_GGMBI:=true;
hom:=GroupHomomorphismByImagesNC(g,fp,
k,
GeneratorsOfGroup(fp));
RUN_IN_GGMBI:=false;
fi;
SetIsomorphismFpGroup(g,hom);
fi;
fi;
SetSize(g,Size(prev)*Size(field)^Length(sol));
fi;
od;
pp:=pp*p;
od;
if transpose then
e:=Size(g);
g:=Group(List(GeneratorsOfGroup(g),TransposedMat));
SetSize(g,e);
fi;
SetInvariantBilinearForm(g,rec(matrix:=f*oner));
return g;
end);
#############################################################################
##
#M SymplecticGroupCons( <IsMatrixGroup>, <d>, Integers mod <q> )
##
InstallOtherMethod( SymplecticGroupCons,
"symplectic group for dimension and residue class ring for prime powers",
[ IsMatrixGroup and IsFinite, IsPosInt,
IsRing and IsFinite and IsZmodnZObjNonprimeCollection ],
function ( filter, n, R )
local g;
g:=ConstructFormPreservingGroup(SP,n,R);
SetName(g,Concatenation("Sp(",String(n),",Z/",String(Size(R)),"Z)"));
return g;
end);
#############################################################################
##
#M GeneralOrthogonalGroupCons ( <IsMatrixGroup>, <d>, Integers mod <q> )
##
InstallOtherMethod( GeneralOrthogonalGroupCons,
"GO for dimension and residue class ring for prime powers",
[ IsMatrixGroup and IsFinite, IsInt,IsPosInt,
IsRing and IsFinite and IsZmodnZObjNonprimeCollection ],
function ( filter, sign,n, R )
local g;
if sign=0 then
g:=ConstructFormPreservingGroup(GO,n,R);
SetName(g,Concatenation("GO(",String(n),",Z/",String(Size(R)),"Z)"));
else
g:=ConstructFormPreservingGroup(GO,sign,n,R);
SetName(g,Concatenation("GO(",String(sign),",",String(n),
",Z/",String(Size(R)),"Z)"));
fi;
return g;
end);
#############################################################################
##
#M SpecialOrthogonalGroupCons( <IsMatrixGroup>, <d>, Integers mod <q> )
##
InstallOtherMethod( SpecialOrthogonalGroupCons,
"GO for dimension and residue class ring for prime powers",
[ IsMatrixGroup and IsFinite, IsInt,IsPosInt,
IsRing and IsFinite and IsZmodnZObjNonprimeCollection ],
function ( filter, sign,n, R )
local g;
if sign=0 then
g:=ConstructFormPreservingGroup(SO,n,R);
if g=fail then TryNextMethod();fi;
SetName(g,Concatenation("SO(",String(n),",Z/",String(Size(R)),"Z)"));
else
g:=ConstructFormPreservingGroup(SO,sign,n,R);
if g=fail then TryNextMethod();fi;
SetName(g,Concatenation("SO(",String(sign),",",String(n),
",Z/",String(Size(R)),"Z)"));
fi;
return g;
end);
#############################################################################
##
#E glzmodmz.gi . . . . . . . . . . . . . . . . . . . . . . . . . . ends here
|