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 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438
|
#############################################################################
##
## This file is part of GAP, a system for computational discrete algebra.
## This file's authors include Alexander Hulpke.
##
## Copyright of GAP belongs to its developers, whose names are too numerous
## to list here. Please refer to the COPYRIGHT file for details.
##
## SPDX-License-Identifier: GPL-2.0-or-later
##
#############################################################################
##
## methods for homomorphisms that map the standard generators -- no
## rewriting necessary
#############################################################################
##
#M ImagesRepresentative( <hom>, <elm> )
##
InstallMethod( ImagesRepresentative,
"map from fp group or free group, use 'MappedWord'",
FamSourceEqFamElm, [ IsFromFpGroupStdGensGeneralMappingByImages,
IsMultiplicativeElementWithInverse ], 0,
function( hom, elm )
local mapi;
mapi:=MappingGeneratorsImages(hom);
return MappedWord(elm,mapi[1],mapi[2]);
end);
#############################################################################
##
#M IsSingleValued
##
InstallMethod( IsSingleValued,
"map from fp group or free group on arbitrary gens: rewrite",
true,
[IsFromFpGroupGeneralMappingByImages and HasMappingGeneratorsImages],0,
function(hom)
local m, fp, s, sg, o, gi;
m:=MappingGeneratorsImages(hom);
fp:=IsomorphismFpGroupByGenerators(Source(hom),m[1]);
s:=Image(fp);
sg:=FreeGeneratorsOfFpGroup(s);
o:=One(Range(hom));
gi:=m[2];
return ForAll(RelatorsOfFpGroup(s),i->MappedWord(i,sg,gi)=o);
end);
InstallMethod( IsSingleValued,
"map from whole fp group or free group, given on std. gens: test relators",
true,
[IsFromFpGroupStdGensGeneralMappingByImages],0,
function(hom)
local s,sg,o,gi;
s:=Source(hom);
if not IsWholeFamily(s) then
TryNextMethod();
fi;
if IsFreeGroup(s) then
return true;
fi;
sg:=FreeGeneratorsOfFpGroup(s);
o:=One(Range(hom));
# take the images corresponding to the free gens in case of reordering or
# duplicates
#gi:=MappingGeneratorsImages(hom)[2]{ListPerm(PermList(hom!.genpositions)^-1,
# Length(hom!.genpositions))};
gi:=[];
gi{hom!.genpositions}:=MappingGeneratorsImages(hom)[2];
return ForAll(RelatorsOfFpGroup(s),i->MappedWord(i,sg,gi)=o);
end);
InstallMethod( IsSingleValued,
"map from whole fp group or free group to perm, std. gens: test relators",
true,
[IsFromFpGroupStdGensGeneralMappingByImages and
IsToPermGroupGeneralMappingByImages],0,
function(hom)
local s, bas, gi, l, p, rel, start, i;
s:=Source(hom);
if not IsWholeFamily(s) then
TryNextMethod();
fi;
if IsFreeGroup(s) then
return true;
fi;
bas:=BaseStabChain(StabChainMutable(Range(hom)));
# take the images corresponding to the free gens in case of reordering or
# duplicates
#gi:=MappingGeneratorsImages(hom)[2]{ListPerm(PermList(hom!.genpositions)^-1,
# Length(hom!.genpositions))};
gi:=[];
gi{hom!.genpositions}:=MappingGeneratorsImages(hom)[2];
for rel in RelatorsOfFpGroup(s) do
l:=LetterRepAssocWord(rel);
for start in bas do
p:=start;
for i in l do
if i>0 then
p:=p^gi[i];
else
p:=p/gi[-i];
fi;
od;
if p<>start then
return false;
fi;
od;
od;
return true;
end);
#############################################################################
##
#M KernelOfMultiplicativeGeneralMapping( <hom> )
##
InstallMethod( KernelOfMultiplicativeGeneralMapping,
"from fp/free group, std. gens., to perm group",
true, [ IsFromFpGroupGeneralMapping
and IsToPermGroupGeneralMappingByImages ],0,
function(hom)
local f,p,t,orbs,o,cor,u;
f:=Source(hom);
if not (HasIsWholeFamily(f) and IsWholeFamily(f)) then
TryNextMethod();
fi;
t:=List(GeneratorsOfGroup(f),i->Image(hom,i));
p:=SubgroupNC(Range(hom),t);
Assert(1,GeneratorsOfGroup(p)=t);
# construct coset table
t:=[];
orbs:=OrbitsDomain(p,MovedPoints(p));
cor:=f;
for o in orbs do
u:=SubgroupOfWholeGroupByQuotientSubgroup(FamilyObj(f),
p,Core(p,Stabilizer(p,o[1])));
cor:=Intersection(cor,u);
od;
if IsIdenticalObj(cor,f) then # in case we get a wrong parent
SetIsNormalInParent(cor,true);
fi;
return cor;
end);
#############################################################################
##
## methods for arbitrary mappings. We must use rewriting.
##
#############################################################################
##
#F SecondaryImagesAugmentedCosetTable(<aug>,<gens>,<genimages>)
##
InstallGlobalFunction(SecondaryImagesAugmentedCosetTable,function(aug)
local si,sw,i,ug,tt,p;
if not IsBound(aug.secondaryImages) then
# set the secondary generators images
si:=[];
ug:=List(aug.homgens,UnderlyingElement);
tt:=GeneratorTranslationAugmentedCosetTable(aug);
sw:=SecondaryGeneratorWordsAugmentedCosetTable(aug);
for i in [1..Length(tt)] do
# get the word representative for the secondary generator
p:=Position(ug,UnderlyingElement(sw[i]));
if p<>fail then
Add(si,aug.homgenims[p]);
else
# its not. We must map the image from the primary generators images.
# For this we use that their images must be given already in `si', as
# the primary generators come first.
Add(si,MappedWord(tt[i],aug.primarySubgroupGenerators,
si{[1..Length(aug.primarySubgroupGenerators)]}));
fi;
od;
aug.secondaryImages:=si;
fi;
return aug.secondaryImages;
end);
# test whether evaluating all the secondary images might be sensible.
InstallGlobalFunction(TrySecondaryImages,function(aug)
local p;
p:=aug.primaryImages;
if Length(p)>0 and (
# would it cost too much storage, to store all secondary generators?
(IsPerm(p[1]) and ForAll(p,i->LargestMovedPoint(i)<50)) or
(IsNBitsPcWordRep(p[1])) ) then
aug.secondaryImages:=ShallowCopy(p);
fi;
end);
#############################################################################
##
#M CosetTableFpHom(<hom>)
##
InstallMethod(CosetTableFpHom,"for fp homomorphisms",true,
[ IsFromFpGroupGeneralMappingByImages and IsGroupGeneralMappingByImages],0,
function(hom)
local aug,hgu,mapi,w;
# source group with suitable generators
aug:=false;
mapi:=MappingGeneratorsImages(hom);
hgu:=List(mapi[1],UnderlyingElement);
# construct augmented coset table
w:=FamilyObj(mapi[1])!.wholeGroup;
aug:=NEWTC_CosetEnumerator(FreeGeneratorsOfFpGroup(w),
RelatorsOfFpGroup(w),
hgu,
true);
aug.homgens:=mapi[1];
aug.homgenims:=mapi[2];
# assign the primary generator images
aug.primaryImages:=List(aug.subgens,
i->aug.homgenims[Position(hgu,i)]);
# TODO: possibly re-use an existing augmented table stored already
TrySecondaryImages(aug);
return aug;
end);
#############################################################################
##
#M ImagesRepresentative( <hom>, <elm> )
##
InstallMethod( ImagesRepresentative, "map from (sub)fp group, rewrite",
FamSourceEqFamElm,
[ IsFromFpGroupGeneralMappingByImages and IsGroupGeneralMappingByImages,
IsMultiplicativeElementWithInverse ], 0,
function( hom, word )
local aug,si,r,i,j,ct,cft,c,f,g,ind,e,eval;
# catch trivial group
if HasMappingGeneratorsImages(hom)
and Length(MappingGeneratorsImages(hom)[1])=0 then
return One(Range(hom));
fi;
# get a coset table
aug:=CosetTableFpHom(hom);
r:=One(Range(hom));
if IsBound(aug.secondaryImages) then
si:=aug.secondaryImages;
elif IsBound(aug.primaryImages) then
si:=aug.primaryImages;
else
Error("no decoding possible");
fi;
word:=UnderlyingElement(word);
if IsBound(aug.isNewAugmentedTable) then
eval:=function(i)
local w,j;
w:=One(si[1]);
if not IsBound(si[i]) then
for j in aug.secondary[i] do
if j<0 then
w:=w/eval(-j);
else
w:=w*eval(j);
fi;
od;
si[i]:=w;
fi;
return si[i];
end;
for i in NEWTC_Rewrite(aug,1,LetterRepAssocWord(word)) do
if i<0 then r:=r/eval(-i);
else r:=r*eval(i);
fi;
od;
return r;
fi;
# old version
# instead of calling `RewriteWord', we rewrite locally in the images.
# this ought to be a bit faster and better on memory.
ct := aug.cosetTable;
cft := aug.cosetFactorTable;
# translation table for group generators to numbers
if not IsBound(aug.transtab) then
# should do better, also cope with inverses
aug.transtab:=List(aug.groupGenerators,i->GeneratorSyllable(i,1));
fi;
c:=1; # current coset
if not IsLetterAssocWordRep(word) then
# syllable version
for i in [1..NrSyllables(word)] do
g:=GeneratorSyllable(word,i);
e:=ExponentSyllable(word,i);
if e<0 then
ind:=2*aug.transtab[g];
e:=-e;
else
ind:=2*aug.transtab[g]-1;
fi;
for j in [1..e] do
# apply the generator, collect cofactor
f:=cft[ind][c]; # cofactor
if f>0 then
r:=r*DecodedTreeEntry(aug.tree,si,f);
elif f<0 then
r:=r/DecodedTreeEntry(aug.tree,si,-f);
fi;
c:=ct[ind][c]; # new coset number
od;
od;
else
# letter version
word:=LetterRepAssocWord(word);
for i in [1..Length(word)] do
g:=word[i];
if g<0 then
g:=-g;
ind:=2*aug.transtab[g];
else
ind:=2*aug.transtab[g]-1;
fi;
# apply the generator, collect cofactor
f:=cft[ind][c]; # cofactor
if f>0 then
r:=r*DecodedTreeEntry(aug.tree,si,f);
elif f<0 then
r:=r/DecodedTreeEntry(aug.tree,si,-f);
fi;
c:=ct[ind][c]; # new coset number
od;
fi;
# make sure we got back to start
if c<>1 then
Error("<elm> is not contained in the source group");
fi;
return r;
end);
InstallMethod( ImagesRepresentative,
"simple tests on equal words to check whether the `generators' are mapped",
FamSourceEqFamElm,
[ IsFromFpGroupGeneralMappingByImages and IsGroupGeneralMappingByImages,
IsMultiplicativeElementWithInverse ],
# this is a better method than the previous, as it will probably avoid
# rewriting.
1,
function( hom, elm )
local ue,p,mapi;
ue:=UnderlyingElement(elm);
if IsLetterAssocWordRep(ue) and IsOne(ue) then
return One(Range(hom));
fi;
mapi:=MappingGeneratorsImages(hom);
p:=PositionProperty(mapi[1],i->IsIdenticalObj(UnderlyingElement(i),ue));
if p<>fail then
return mapi[2][p];
fi;
ue:=ue^-1;
p:=PositionProperty(mapi[1],i->IsIdenticalObj(UnderlyingElement(i),ue));
if p<>fail then
return mapi[2][p]^-1;
fi;
TryNextMethod();
end);
#############################################################################
##
#M KernelOfMultiplicativeGeneralMapping( <hom> )
##
InstallMethod( KernelOfMultiplicativeGeneralMapping, "hom from fp grp", true,
[ IsFromFpGroupGeneralMapping and IsGroupGeneralMapping], 0,
function(hom)
local k;
k:=PreImage(hom,TrivialSubgroup(Range(hom)));
if HasIsSurjective(hom) and IsSurjective( hom ) and
HasIndexInWholeGroup( Source(hom) )
and HasRange(hom) # surjective action homomorphisms do not store
# the range by default
and HasSize( Range( hom ) ) then
SetIndexInWholeGroup( k,
IndexInWholeGroup( Source(hom) ) * Size( Range(hom) ));
fi;
return k;
end);
#############################################################################
##
#M CoKernelOfMultiplicativeGeneralMapping( <hom> )
##
InstallMethod( CoKernelOfMultiplicativeGeneralMapping, "GHBI from fp grp", true,
[ IsFromFpGroupGeneralMappingByImages
and IsGroupGeneralMappingByImages ], 0,
function(map)
local so,fp,isofp,rels,mapi;
# the mapping is on the std. generators. So we just have to evaluate the
# relators in the generators on the genimages and take the normal closure.
so:=Source(map);
mapi:=MappingGeneratorsImages(map);
if Length(GeneratorsOfGroup(so))=0
or ForAll(GeneratorsOfGroup(so),x->IsOne(UnderlyingElement(x))) then
rels:=ShallowCopy(mapi[2]);
else
isofp:=IsomorphismFpGroupByGeneratorsNC(so,mapi[1],"F");
fp:=Range(isofp);
rels:=RelatorsOfFpGroup(fp);
rels:=List(rels,i->MappedWord(i,FreeGeneratorsOfFpGroup(fp),mapi[2]));
fi;
return NormalClosure(Range(map),SubgroupNC(Range(map),rels));
end);
InstallGlobalFunction(KuKGenerators,
function(G,beta,alpha)
local q,r,tg,dtg,pemb,ugens,g,gi,d,o,gens,genims,i,gr,img,l,mapi;
q:=Range(beta);
d:=NrMovedPoints(q);
# transversal (sorted)
#better: orbit algo
#r:=ShallowCopy(RightTransversal(q,qu));
#Sort(r,function(a,b) return 1^a<1^b;end);
#r:=List(r,i->PreImagesRepresentative(beta,i));
# compute transversal with short words from orbit algorithm on points
o:=[1];
mapi:=MappingGeneratorsImages(beta);
gens:=mapi[1];
genims:=mapi[2];
gr:=[1..Length(gens)];
r:=[One(gens[1])];
i:=1;
while i<=Length(o) do
for g in gr do
img:=o[i]^genims[g];
if not img in o then
Add(o,img);
Add(r,r[i]*gens[g]);
fi;
od;
i:=i+1;
od;
SortParallel(o,r); # indices in right position -- this *is* important
# because we use the index to get the transversal representative!
tg:=Range(alpha);
if IsPermGroup(tg) then
pemb:=IdentityMapping(tg);
dtg:=LargestMovedPoint(Range(pemb));
elif Size(tg)<20 then
pemb:=IsomorphismPermGroup(tg);
dtg:=LargestMovedPoint(Range(pemb));
else
pemb:=IdentityMapping(tg);
dtg:=-1;
fi;
if dtg=0 then
dtg:=1; # the darn trivial group again.
fi;
# images of the generators in the wreath
ugens:=[];
for g in GeneratorsOfGroup(G) do
gi:=ImagesRepresentative(beta,g);
l:=[];
for i in [1..d] do
Info(InfoFpGroup,3,"KuK coset ",i," @",g);
l[i]:=ImagesRepresentative(pemb,
ImagesRepresentative(alpha,r[i]*g/r[i^gi]));
od;
Add(ugens,WreathElm(dtg,l,gi) );
od;
return ugens;
end);
#############################################################################
##
#M InducedRepFpGroup(<hom>,<u> )
##
## induce <hom> def. on <u> up to the full group
InstallGlobalFunction(InducedRepFpGroup,function(thom,s)
local w,c,q,chom,u;
w:=FamilyObj(s)!.wholeGroup;
# permutation action on the cosets
c:=CosetTableInWholeGroup(s);
c:=List(c{[1,3..Length(c)-1]},PermList);
q:=Group(c,()); # `c' arose from `PermList'
chom:=GroupHomomorphismByImagesNC(w,q,GeneratorsOfGroup(w),c);
if Size(q)=1 then
# degenerate case
return thom;
else
u:=KuKGenerators(w,chom,thom);
fi;
q:=GroupWithGenerators(u,()); # `u' arose from `KuKGenerators'
return GroupHomomorphismByImagesNC(w,q,GeneratorsOfGroup(w),u);
end);
BindGlobal("IsTransPermStab1",function(G,U)
return IsPermGroup(G) and IsTransitive(G,MovedPoints(G))
and (1 in MovedPoints(G)) and Length(Orbit(U,1))=1
and Size(G)/Size(U)=Length(MovedPoints(G));
end);
#############################################################################
##
#M PreImagesSet( <hom>, <u> )
##
InstallMethod( PreImagesSet, "map from (sub)group of fp group",
CollFamRangeEqFamElms,
[ IsFromFpGroupHomomorphism,IsGroup ],0,
function(hom,u)
local s,gens,t,p,w,c,q,chom,tg,thom,hi,i,lp,max;
s:=Source(hom);
gens:= GeneratorsOfGroup( s );
if Length( gens ) = 0 then
return s;
elif HasIsWholeFamily(s) and IsWholeFamily(s) then
t:=List(gens,i->Image(hom,i));
if IsPermGroup(Range(hom)) and LargestMovedPoint(t)<>NrMovedPoints(t) then
c:=MappingPermListList(MovedPoints(t),[1..NrMovedPoints(t)]);
t:=List(t,i->i^c);
u:=u^c;
else
c:=false;
fi;
p:=GroupWithGenerators(t);
if HasImagesSource(hom) and HasSize(Image(hom)) then
SetSize(p,Size(Image(hom)));
fi;
if c=false then
SetParent(p,Range(hom));
fi;
if HasIsSurjective(hom) and IsSurjective(hom) then
SetIndexInParent(p,1);
fi;
return SubgroupOfWholeGroupByQuotientSubgroup(FamilyObj(s),p,u);
fi;
w:=FamilyObj(s)!.wholeGroup;
# permutation action on the cosets
if IsBound(s!.quot) and IsTransPermStab1(s!.quot,s!.sub) then
q:=s!.quot;
c:=GeneratorsOfGroup(q);
else
c:=CosetTableInWholeGroup(s);
c:=List(c{[1,3..Length(c)-1]},PermList);
q:=Group(c,()); # `c' arose from `PermList'
if IsBound(s!.quot) and HasSize(s!.quot) then
# transfer size information
StabChainOp(q,rec(limit:=Size(s!.quot)));
fi;
fi;
chom:=GroupHomomorphismByImagesNC(w,q,GeneratorsOfGroup(w),c);
# action on cosets of U
hi:=Image(hom);
if Index(hi,u)<>infinity then
t:=CosetTableBySubgroup(hi,u);
t:=List(t{[1,3..Length(t)-1]},PermList);
tg:=Group(t,()); # `t' arose from `PermList'
thom:=hom*GroupHomomorphismByImagesNC(hi,tg,GeneratorsOfGroup(hi),t);
# don't use size -- could be expensive
if ForAll(GeneratorsOfGroup(q),IsOne) then
# degenerate case
u:=List(GeneratorsOfGroup(w),i->ImageElm(thom,i));
u:=GroupWithGenerators(u,());
else
u:=KuKGenerators(w,chom,thom);
# could the group be too expensive?
if (not IsBound(s!.quot)) or
(IsPermGroup(s!.quot)
and Size(s!.quot)>10^50 and NrMovedPoints(s!.quot)>10000) then
t:=[];
max:=LargestMovedPoint(u);
for i in u do
#Add(t,ListPerm(i));
lp:=ListPerm(i);
while Length(lp)<max do Add(lp,Length(lp)+1);od;
Add(t,lp);
#Add(t,ListPerm(i^-1));
lp:=ListPerm(i^-1);
while Length(lp)<max do Add(lp,Length(lp)+1);od;
Add(t,lp);
od;
return SubgroupOfWholeGroupByCosetTable(FamilyObj(s),t);
fi;
u:=GroupWithGenerators(u,()); # `u' arose from `KuKGenerators'
# indicate wreath structure
StabChainOp(u,rec(limit:=Size(tg)^NrMovedPoints(q)*Size(q)));
fi;
else
#[hi:u] might be infinite
u:=WreathProduct(hi,q);
Error("infinite");
fi;
return SubgroupOfWholeGroupByQuotientSubgroup(FamilyObj(s),u,Stabilizer(u,1));
end);
#############################################################################
##
#M IsConjugatorIsomorphism( <hom> )
##
InstallMethod( IsConjugatorIsomorphism,
"for a f.p. group general mapping",
true,
[ IsGroupGeneralMapping ], 1,
# There is no filter to test whether source and range of a homomorphism
# are f.p. groups.
# So we have to test explicitly and make this method
# higher ranking than the default one in `ghom.gi'.
function( hom )
local s, r, G, genss, rep;
s:= Source( hom );
if not IsSubgroupFpGroup( s ) then
TryNextMethod();
elif not ( IsGroupHomomorphism( hom ) and IsBijective( hom ) ) then
return false;
elif IsEndoGeneralMapping( hom ) and IsInnerAutomorphism( hom ) then
return true;
fi;
r:= Range( hom );
# Check whether source and range are in the same family.
if FamilyObj( s ) <> FamilyObj( r ) then
return false;
fi;
# Compute a conjugator in the full f.p. group.
G:= FamilyObj( s )!.wholeGroup;
genss:= GeneratorsOfGroup( s );
rep:= RepresentativeAction( G, genss, List( genss,
i -> ImagesRepresentative( hom, i ) ), OnTuples );
# Return the result.
if rep <> fail then
Assert( 1, ForAll( genss, i -> Image( hom, i ) = i^rep ) );
SetConjugatorOfConjugatorIsomorphism( hom, rep );
return true;
else
return false;
fi;
end );
#############################################################################
##
#M CompositionMapping2( <hom1>, <hom2> ) . . . . . . . . . . . . via images
##
## we override the method for group homomorphisms, to transfer the coset
## table information as well.
InstallMethod( CompositionMapping2,
"for gp. hom. and fp. hom, transferring the coset table",
FamSource1EqFamRange2,
[ IsGroupHomomorphism,
IsGroupHomomorphism and IsFromFpGroupGeneralMappingByImages and
HasCosetTableFpHom], 0,
function( hom1, hom2 )
local map,tab,tab2,i;
if IsNiceMonomorphism(hom2) then
# this is unlikely, but who knows of the things to come...
TryNextMethod();
fi;
if not IsSubset(Source(hom1),ImagesSource(hom2)) then
TryNextMethod();
fi;
map:=MappingGeneratorsImages(hom2);
map:=GroupGeneralMappingByImagesNC( Source( hom2 ), Range( hom1 ),
map[1], List( map[2], img ->
ImagesRepresentative( hom1, img ) ) );
SetIsMapping(map,true);
tab:=CosetTableFpHom(hom2);
tab2:=CopiedAugmentedCosetTable(tab);
tab2.primaryImages:=[];
for i in [1..Length(tab.primaryImages)] do
if IsBound(tab.primaryImages[i]) then
tab2.primaryImages[i]:=ImagesRepresentative(hom1,tab.primaryImages[i]);
fi;
od;
TrySecondaryImages(tab2);
SetCosetTableFpHom(map,tab2);
return map;
end);
#############################################################################
##
## methods for homomorphisms to fp groups.
#############################################################################
##
#M PreImagesRepresentative
##
InstallMethod( PreImagesRepresentative,
"hom. to standard generators of fp group, using 'MappedWord'",
FamRangeEqFamElm,
[IsToFpGroupHomomorphismByImages,IsMultiplicativeElementWithInverse],
# there is no filter indicating the images are standard generators, so we
# must rank higher than the default.
1,
function(hom,elm)
local mapi;
mapi:=MappingGeneratorsImages(hom);
# check, whether we map to the standard generators
if not (HasIsWholeFamily(Range(hom)) and IsWholeFamily(Range(hom)) and
Set(FreeGeneratorsOfFpGroup(Range(hom)))
=Set(GeneratorsOfGroup(Range(hom)),UnderlyingElement) and
IsIdenticalObj(mapi[2],GeneratorsOfGroup(Range(hom))) and
ForAll(List(mapi[2],i->LetterRepAssocWord(UnderlyingElement(i))),
i->Length(i)=1 and i[1]>0) ) then
TryNextMethod();
fi;
if Length(mapi[2])=0 then
mapi:=One(Source(hom));
else
mapi:=MappedWord(elm,mapi[2],mapi[1]);
fi;
return mapi;
end);
#############################################################################
##
## methods to construct homomorphisms to fp groups
##
InstallOtherMethod(IsomorphismFpGroup,"subgroups of fp group",true,
[IsSubgroupFpGroup,IsString],0,
function(u,str)
local aug,w,pres,f,fam,opt;
if HasIsWholeFamily(u) and IsWholeFamily(u) then
return IdentityMapping(u);
fi;
# catch trivial case of rank 0 group
if Length(GeneratorsOfGroup(FamilyObj(u)!.wholeGroup))=0 then
return IsomorphismFpGroup(FamilyObj(u)!.wholeGroup,str);
elif Length( GeneratorsOfGroup( u ) ) = 0 or
( HasIsTrivial( u ) and IsTrivial( u ) ) then
return GroupHomomorphismByImages( u, FreeGroup( 0 ), [], [] );
fi;
# get an augmented coset table from the group. Since we don't care about
# any particular generating set, we let the function chose.
aug:=AugmentedCosetTableInWholeGroup(u);
Info( InfoFpGroup, 1, "Presentation with ",
Length(aug.subgroupGenerators), " generators");
# create a tietze object to reduce the presentation a bit
if not IsBound(aug.subgroupRelators) then
aug.subgroupRelators := RewriteSubgroupRelators( aug, aug.groupRelators);
fi;
# as the presentation might be rather long, we do not decode all secondary
# generators and their images, but will do it ``on the fly'' when
# rewriting.
aug:=CopiedAugmentedCosetTable(aug);
pres := PresentationAugmentedCosetTable( aug, "y",0# printlevel
,true) ;# initialize tracking before the `1or2' routine!
opt:=TzOptions(pres);
if ValueOption("expandLimit")<>fail then
opt.expandLimit:=ValueOption("expandLimit");
else
opt.expandLimit:=108; # do not grow too much.
fi;
if ValueOption("eliminationsLimit")<>fail then
opt.eliminationsLimit:=ValueOption("eliminationsLimit");
else
opt.eliminationsLimit:=20; # do not be too greedy
fi;
if ValueOption("lengthLimit")<>fail then
opt.lengthLimit:=ValueOption("lengthLimit");
else
opt.lengthLimit:=Int(3/2*pres!.tietze[TZ_TOTAL]); # not too big.
fi;
if ValueOption("generatorsLimit")<>fail then
opt.generatorsLimit:=ValueOption("generatorsLimit");
fi;
TzOptions(pres).printLevel:=InfoLevel(InfoFpGroup);
if ValueOption("cheap")=true then
TzGo(pres);
else
TzEliminateRareOcurrences(pres,50);
TzGoGo(pres); # cleanup
fi;
# new free group
f:=FpGroupPresentation(pres,str);
# images for the old primary generators
aug.primaryImages:=Immutable(List(
TzImagesOldGens(pres){[1..Length(aug.primaryGeneratorWords)]},
i->MappedWord(i,GeneratorsOfPresentation(pres),GeneratorsOfGroup(f))));
TrySecondaryImages(aug);
# generator numbers of the new generators
w:=List(TzPreImagesNewGens(pres),
i->aug.treeNumbers[Position(OldGeneratorsOfPresentation(pres),i)]);
# and the corresponding words in the original group
w:=List(w,i->TreeRepresentedWord(aug.primaryGeneratorWords,aug.tree,i));
if not IsWord(One(u)) then
fam:=ElementsFamily(FamilyObj(u));
w:=List(w,i->ElementOfFpGroup(fam,i));
fi;
# write the homomorphism in terms of the image's free generators
# (so preimages are cheap)
# this object cannot test whether it is a proper mapping, so skip
# safety assertions that could be triggered by the construction process
f:=GroupHomomorphismByImagesNC(u,f,w,GeneratorsOfGroup(f):noassert);
# but give it `aug' as coset table, so we will use rewriting for images
SetCosetTableFpHom(f,aug);
SetIsBijective(f,true);
return f;
end);
InstallOtherMethod(IsomorphismFpGroupByGeneratorsNC,"subgroups of fp group",
IsFamFamX,
[IsSubgroupFpGroup,IsList and IsMultiplicativeElementWithInverseCollection,
IsObject],0,
function(u,gens,nam)
local aug,w,pres,f,trace;
trace:=[];
if HasIsWholeFamily(u) and IsWholeFamily(u) and
IsIdenticalObj(gens,GeneratorsOfGroup(u)) then
return IdentityMapping(u);
fi;
# get an augmented coset table from the group. It must be compatible with
# `gens', so we must always use MTC.
# use new MTC
w:=FamilyObj(u)!.wholeGroup;
aug:=NEWTC_CosetEnumerator(FreeGeneratorsOfFpGroup(w),
RelatorsOfFpGroup(w),
List(gens,UnderlyingElement),
true,trace);
pres:=NEWTC_PresentationMTC(aug,1,nam);
if Length(GeneratorsOfPresentation(pres))>Length(gens) then
aug:=NEWTC_CosetEnumerator(FreeGeneratorsOfFpGroup(w),
RelatorsOfFpGroup(w),
List(gens,UnderlyingElement),
true,trace);
pres:=NEWTC_PresentationMTC(aug,0,nam);
fi;
# check that we have the exact generators as we want and no rearrangement
# or so happened.
Assert(0,Length(GeneratorsOfPresentation(pres))=Length(gens)
and pres!.primarywords=[1..Length(gens)]);
# new free group
f:=FpGroupPresentation(pres);
aug.homgens:=gens;
aug.homgenims:=GeneratorsOfGroup(f);
aug.primaryImages:=GeneratorsOfGroup(f);
aug.secondaryImages:=ShallowCopy(GeneratorsOfGroup(f));
f:=GroupHomomorphismByImagesNC(u,f,gens,GeneratorsOfGroup(f):noassert);
# tell f, that `aug' can be used as its coset table
SetCosetTableFpHom(f,aug);
SetIsBijective(f,true);
return f;
end);
#############################################################################
##
#F IsomorphismSimplifiedFpGroup(G)
##
##
InstallMethod(IsomorphismSimplifiedFpGroup,"using tietze transformations",
true,[IsSubgroupFpGroup],0,
function ( G )
local H, pres,map,mapi,opt;
# check the given argument to be a finitely presented group.
if not ( IsSubgroupFpGroup( G ) and IsGroupOfFamily( G ) ) then
Error( "argument must be a finitely presented group" );
fi;
# convert the given group presentation to a Tietze presentation.
pres := PresentationFpGroup( G, 0 );
# perform Tietze transformations.
opt:=TzOptions(pres);
if ValueOption("protected")<>fail then
opt.protected:=ValueOption("protected");
fi;
opt.printLevel:=InfoLevel(InfoFpGroup);
TzInitGeneratorImages(pres);
if ValueOption("easy")=true then
# case of old `SimplifiedFpGroup`, use default strategy parameters
TzGo( pres );
else
# Somewhat tuned strategy parameters
if ValueOption("expandLimit")<>fail then
opt.expandLimit:=ValueOption("expandLimit");
else
opt.expandLimit:=120; # do not grow too much.
fi;
if ValueOption("eliminationsLimit")<>fail then
opt.eliminationsLimit:=ValueOption("eliminationsLimit");
else
opt.eliminationsLimit:=20; # do not be too greedy
fi;
if ValueOption("lengthLimit")<>fail then
opt.lengthLimit:=ValueOption("lengthLimit");
else
opt.lengthLimit:=Int(3*pres!.tietze[TZ_TOTAL]); # not too big.
fi;
TzGoGo( pres );
fi;
# reconvert the Tietze presentation to a group presentation.
H := FpGroupPresentation( pres );
UseIsomorphismRelation( G, H );
if Length(GeneratorsOfGroup(H))>0 then
map:=List(TzImagesOldGens(pres),
i->MappedWord(i,GeneratorsOfPresentation(pres),
GeneratorsOfGroup(H)));
else
map:=List(TzImagesOldGens(pres),y->One(H));
fi;
map:=GroupHomomorphismByImagesNC(G,H,GeneratorsOfGroup(G),map);
mapi:=GroupHomomorphismByImagesNC(H,G,GeneratorsOfGroup(H),
List(TzPreImagesNewGens(pres),
i->MappedWord(i,OldGeneratorsOfPresentation(pres),
GeneratorsOfGroup(G))));
SetIsBijective(map,true);
SetInverseGeneralMapping(map,mapi);
SetInverseGeneralMapping(mapi,map);
ProcessEpimorphismToNewFpGroup(map);
return map;
end );
#############################################################################
##
#M SimplifiedFpGroup( <FpGroup> ) . . . . . . . . . simplify the FpGroup by
#M Tietze transformations
##
## `SimplifiedFpGroup' returns a group isomorphic to the given one with a
## presentation which has been tried to simplify via Tietze transformations.
##
InstallGlobalFunction( SimplifiedFpGroup, function ( G )
return Range(IsomorphismSimplifiedFpGroup(G:easy));
end);
#############################################################################
##
#M NaturalHomomorphismByNormalSubgroup(<G>,<N>)
##
InstallMethod(NaturalHomomorphismByNormalSubgroupOp,
"for subgroups of fp groups",IsIdenticalObj,
[IsSubgroupFpGroup, IsSubgroupFpGroup],0,
function(G,N)
local T,m;
# try to use rewriting if the index is not too big.
if IndexInWholeGroup(G)>1 and IndexInWholeGroup(G)<=1000
and HasGeneratorsOfGroup(N) and not
HasCosetTableInWholeGroup(N) then
T:=IsomorphismFpGroup(G);
return T*NaturalHomomorphismByNormalSubgroup(Image(T,G),Image(T,N));
fi;
if not HasCosetTableInWholeGroup(N) and not
IsSubgroupOfWholeGroupByQuotientRep(N) then
# try to compute a coset table
T:=TryCosetTableInWholeGroup(N:silent:=true);
if T=fail then
if not (HasIsWholeFamily(G) and IsWholeFamily(G)) then
TryNextMethod(); # can't do
fi;
# did not succeed - do the stupid thing
m:=CosetTableDefaultMaxLimit;
repeat
m:=m*1000;
T:=TryCosetTableInWholeGroup(N:silent:=true,max:=m);
until T<>fail;
fi;
fi;
return NaturalHomomorphismByNormalSubgroupNC(G,
AsSubgroupOfWholeGroupByQuotient(N));
end);
InstallMethod(NaturalHomomorphismByNormalSubgroupOp,
"for subgroups of fp groups by quotient rep.",IsIdenticalObj,
[IsSubgroupFpGroup,
IsSubgroupFpGroup and IsSubgroupOfWholeGroupByQuotientRep ],0,
function(G,N)
local Q,B,Ggens,gens,hom;
Q:=N!.quot;
Ggens:=GeneratorsOfGroup(G);
# generators of G in image
gens:=List(Ggens,elm->
MappedWord(UnderlyingElement(elm),
FreeGeneratorsOfWholeGroup(N),GeneratorsOfGroup(Q)));
B:=SubgroupNC(Q,gens);
hom:=NaturalHomomorphismByNormalSubgroupNC(B,N!.sub);
gens:=List(gens,i->ImageElm(hom,i));
hom:=GroupHomomorphismByImagesNC(G,Range(hom),Ggens,gens);
SetKernelOfMultiplicativeGeneralMapping(hom,N);
return hom;
end);
InstallMethod(NaturalHomomorphismByNormalSubgroupOp,
"trivial image fp case",IsIdenticalObj,
[IsSubgroupFpGroup,
IsSubgroupFpGroup and IsWholeFamily ],0,
function(G,N)
local Q,Ggens,gens,hom;
Ggens:=GeneratorsOfGroup(G);
# generators of G in image
gens:=List(Ggens,elm->()); # a new group is created
Q:=GroupWithGenerators(gens, ());
hom:=GroupHomomorphismByImagesNC(G,Q,Ggens,gens);
SetKernelOfMultiplicativeGeneralMapping(hom,N);
return hom;
end);
#########################################################
##
#M MaximalAbelianQuotient(<fp group>)
##
##
InstallMethod(MaximalAbelianQuotient,"whole fp group",
true, [IsSubgroupFpGroup and IsWholeFamily], 0,
function(f)
local m,s,g,i,j,gen,img,hom,d,pos;
# since f is the full group, exponent sums are with respect to its
# generators.
m:=List(RelatorsOfFpGroup(f),ExponentSums);
if Length(m)>0 then
m:=ReducedRelationMat(m);
s:=NormalFormIntMat(m,25); # 9+16: SNF with transforms, destructive
d:=DiagonalOfMat(s.normal);
pos:=Filtered([1..Length(d)],x->d[x]<>1);
d:=d{pos};
SetAbelianInvariants(f,d);
# Make abelian group
g:=AbelianGroup(d);
SetAbelianInvariants(g,d);
if not IsFinite(g) then SetReducedMultiplication(g);fi;
gen:=ListWithIdenticalEntries(Length(m[1]),One(g));
gen{pos}:=GeneratorsOfGroup(g);
s:=s.coltrans;
img:=[];
for i in [1..Length(s)] do
m:=Identity(g);
for j in [1..Length(gen)] do
m:=m*gen[j]^s[i][j];
od;
Add(img,m);
od;
else
g:=AbelianGroup(ListWithIdenticalEntries(Length(GeneratorsOfGroup(f)),0));
SetIsFinite(g,Length(GeneratorsOfGroup(f))=0);
img:=GeneratorsOfGroup(g);
SetAbelianInvariants(f,ListWithIdenticalEntries(Length(GeneratorsOfGroup(f)),0));
SetIsAbelian(g,true);
fi;
hom:=GroupHomomorphismByImagesNC(f,g,GeneratorsOfGroup(f),img);
SetIsSurjective(hom,true);
return hom;
end);
InstallMethod(MaximalAbelianQuotient,
"for subgroups of finitely presented groups, fallback",
true, [IsSubgroupFpGroup], -1,
function(U)
local phi, m;
# do cheaper Tietze (and thus do not store)
phi:=AttributeValueNotSet(IsomorphismFpGroup,U:
eliminationsLimit:=50,
generatorsLimit:=Length(GeneratorsOfGroup(Parent(U)))*LogInt(IndexInWholeGroup(U),2),
cheap);
m:=MaximalAbelianQuotient(Image(phi));
SetAbelianInvariants(U,AbelianInvariants(Image(phi)));
return phi*m;
end);
InstallMethod(MaximalAbelianQuotient,
"subgroups of fp., rewrite", true, [IsSubgroupFpGroup], 0,
function(u)
local iso;
if (HasIsWholeFamily(u) and IsWholeFamily(u))
# catch trivial case of rank 0 group
or Length(GeneratorsOfGroup(FamilyObj(u)!.wholeGroup))=0 then
TryNextMethod();
fi;
iso:=IsomorphismFpGroup(u);
return iso*MaximalAbelianQuotient(Range(iso));
end);
#InstallMethod(MaximalAbelianQuotient,
# "subgroups of fp. abelian rewriting", true, [IsSubgroupFpGroup], 0,
#function(u)
#local aug,r,sec,expwrd,rels,ab,s,m,img,gen,i,j,t1,t2,tn,d,pos;
# if (HasIsWholeFamily(u) and IsWholeFamily(u))
# # catch trivial case of rank 0 group
# or Length(GeneratorsOfGroup(FamilyObj(u)!.wholeGroup))=0 then
# TryNextMethod();
# fi;
#
# # get an augmented coset table from the group. Since we don't care about
# # any particular generating set, we let the function chose.
# aug:=AugmentedCosetTableInWholeGroup(u);
#
# aug:=CopiedAugmentedCosetTable(aug);
#
# r:=Length(aug.primaryGeneratorWords);
# Info( InfoFpGroup, 1, "Abelian presentation with ",
# Length(aug.subgroupGenerators), " generators");
#
# # make vectors
# expwrd:=function(l)
# local v,i;
# v:=ListWithIdenticalEntries(r,0);
# for i in l do
# if i>0 then v:=v+sec[i];
# else v:=v-sec[-i];fi;
# od;
# return v;
# end;
#
# # do GeneratorTranslation abelianized
# sec:=ShallowCopy(IdentityMat(r,1)); # initialize so next command works
#
# t1:=aug.tree[1];
# t2:=aug.tree[2];
# tn:=aug.treeNumbers;
# if Length(tn)>0 then
# for i in [Length(sec)+1..Maximum(tn)] do
# sec[i]:=sec[AbsInt(t1[i])]*SignInt(t1[i])
# +sec[AbsInt(t2[i])]*SignInt(t2[i]);
# od;
# fi;
#
# sec:=sec{aug.treeNumbers};
#
# # now make relators abelian
# rels:=[];
# rels:=RewriteSubgroupRelators( aug, aug.groupRelators);
# rels:=List(rels,expwrd);
#
# rels:=ReducedRelationMat(rels);
# if Length(rels)=0 then
# Add(rels,ListWithIdenticalEntries(r,0));
# fi;
# s:=NormalFormIntMat(rels,25); # 9+16: SNF with transforms, destructive
# d:=DiagonalOfMat(s.normal);
# pos:=Filtered([1..Length(d)],x->d[x]<>1);
# d:=d{pos};
# ab:=AbelianGroup(d);
# SetAbelianInvariants(u,d);
# SetAbelianInvariants(ab,d);
# if not IsFinite(ab) then SetReducedMultiplication(ab);fi;
#
# gen:=ListWithIdenticalEntries(Length(rels[1]),One(ab));
# gen{pos}:=GeneratorsOfGroup(ab);
#
# s:=s.coltrans;
# img:=[];
# for i in [1..Length(s)] do
# m:=One(ab);
# for j in [1..Length(gen)] do
# m:=m*gen[j]^s[i][j];
# od;
# Add(img,m);
# od;
# aug.primaryImages:=img;
# if ForAll(img,IsOne) then
# sec:=List(sec,x->img[1]);
# else
# sec:=List(sec,x->LinearCombinationPcgs(img,x));
# fi;
# aug.secondaryImages:=sec;
#
# m:=List(aug.primaryGeneratorWords,x->ElementOfFpGroup(FamilyObj(One(u)),x));
# m:=GroupHomomorphismByImagesNC(u,ab,m,img:noassert);
#
# # but give it `aug' as coset table, so we will use rewriting for images
# SetCosetTableFpHom(m,aug);
#
# SetIsSurjective(m,true);
#
# return m;
#end);
# u must be a subgroup of the image of home
InstallGlobalFunction(
LargerQuotientBySubgroupAbelianization,function(hom,u)
local v,aiu,aiv,G,primes,irrel,ma,mau,a,k,gens,imgs,q,dec,deco,piv,co;
v:=PreImage(hom,u);
aiu:=AbelianInvariants(u);
G:= FamilyObj(v)!.wholeGroup;
aiv:=AbelianInvariantsSubgroupFpGroup( G, v:cheap:=false );
if aiv=fail then
ma:=MaximalAbelianQuotient(v);
aiv:=AbelianInvariants(Image(ma,v));
fi;
if aiu=aiv then
return fail;
fi;
# are there irrelevant primes?
primes:=Union(List(Union(aiu, aiv), PrimeDivisors));
irrel:=Filtered(primes,x->Filtered(aiv,z->IsInt(z/x))=
Filtered(aiu,z->IsInt(z/x)));
Info(InfoFpGroup,1,"Larger by factor ",Product(aiv)/Product(aiu));
ma:=MaximalAbelianQuotient(v);
mau:=MaximalAbelianQuotient(u);
a:=Image(ma);
k:=TrivialSubgroup(a);
for primes in irrel do
k:=ClosureGroup(k,GeneratorsOfGroup(SylowSubgroup(a,primes)));
od;
if Size(k)>1 then
ma:=ma*NaturalHomomorphismByNormalSubgroup(a,k);
a:=Image(ma);
k:=TrivialSubgroup(Image(mau));
for primes in irrel do
k:=ClosureGroup(k,GeneratorsOfGroup(SylowSubgroup(Image(mau),primes)));
od;
mau:=mau*NaturalHomomorphismByNormalSubgroup(Image(mau),k);
fi;
gens:=SmallGeneratingSet(a);
imgs:=List(gens,x->Image(mau,Image(hom,PreImagesRepresentative(ma,x))));
q:=GroupHomomorphismByImages(a,Image(mau),gens,imgs);
k:=KernelOfMultiplicativeGeneralMapping(q);
# generators of prime power orders but larger powers first (to have pivots
# on larger order elements)
gens:=Reversed(IndependentGeneratorsOfAbelianGroup(a));
aiv:=List(gens,Order);
dec:=EpimorphismFromFreeGroup(Group(gens));
deco:=function(x)
local i;
x:=ExponentSums(PreImagesRepresentative(dec,x));
for i in [1..Length(aiv)] do
x[i]:=x[i] mod aiv[i];
od;
return x;
end;
k:=Filtered(HermiteNormalFormIntegerMat(List(GeneratorsOfGroup(k),deco)),
x->not IsZero(x));
piv:=List(k,PositionNonZero);
# k is the kernel we have. We want to find a subgroup intersecting
# trivially with k. This is given by the non-pivot positions (and we
# cannot do better).
co:=SubgroupNC(a,gens{Difference([1..Length(gens)],piv)});
if ValueOption("cheap")=true then
# take also all pivots but last (larger order ones)
co:=ClosureSubgroup(co,gens{piv{[1..Length(piv)-1]}});
fi;
Info(InfoFpGroup,2,"Degree larger ",Index(a,co));
return PreImage(ma,co);
end);
DeclareRepresentation("IsModuloPcgsFpGroupRep",
IsModuloPcgs and IsPcgsDefaultRep, [ "hom", "impcgs", "groups" ] );
InstallMethod(ModuloPcgs,"subgroups fp",true,
[IsSubgroupFpGroup,IsSubgroupFpGroup],0,
function(M,N)
local hom,pcgs,impcgs;
hom:=NaturalHomomorphismByNormalSubgroupNC(M,N);
hom:=hom*IsomorphismSpecialPcGroup(Image(hom,M));
impcgs:=FamilyPcgs(Image(hom,M));
pcgs:=PcgsByPcSequenceCons(IsPcgsDefaultRep,IsModuloPcgsFpGroupRep,
ElementsFamily(FamilyObj(M)),
List(impcgs,i->PreImagesRepresentative(hom,i)),
[]
);
pcgs!.hom:=hom;
pcgs!.impcgs:=impcgs;
pcgs!.groups:=[M,N];
if IsFiniteOrdersPcgs(impcgs) then
SetIsFiniteOrdersPcgs(pcgs,true);
fi;
if IsPrimeOrdersPcgs(impcgs) then
SetIsPrimeOrdersPcgs(pcgs,true);
fi;
return pcgs;
end);
InstallMethod(NumeratorOfModuloPcgs,"fp",true,[IsModuloPcgsFpGroupRep],0,
p->GeneratorsOfGroup(p!.groups[1]));
InstallMethod(DenominatorOfModuloPcgs,"fp",true,[IsModuloPcgsFpGroupRep],0,
p->GeneratorsOfGroup(p!.groups[2]));
InstallMethod(RelativeOrders,"fp",true,[IsModuloPcgsFpGroupRep],0,
p->RelativeOrders(p!.impcgs));
InstallMethod(RelativeOrderOfPcElement,"fp",IsCollsElms,
[IsModuloPcgsFpGroupRep,IsMultiplicativeElementWithInverse],0,
function(p,e)
return RelativeOrderOfPcElement(p!.impcgs,ImagesRepresentative(p!.hom,e));
end);
InstallMethod(ExponentsOfPcElement,"fp",IsCollsElms,
[IsModuloPcgsFpGroupRep,IsMultiplicativeElementWithInverse],0,
function(p,e)
return ExponentsOfPcElement(p!.impcgs,ImagesRepresentative(p!.hom,e));
end);
InstallMethod(EpimorphismFromFreeGroup,"general",true,
[IsGroup and HasGeneratorsOfGroup],0,
function(G)
local F,str;
str:=ValueOption("names");
if IsList(str) and ForAll(str,IsString) and
Length(str)=Length(GeneratorsOfGroup(G)) then
F:=FreeGroup(str);
else
if not IsString(str) then
str:="x";
fi;
F:=FreeGroup(Length(GeneratorsOfGroup(G)),str);
fi;
return
GroupHomomorphismByImagesNC(F,G,GeneratorsOfGroup(F),GeneratorsOfGroup(G));
end);
InstallGlobalFunction(ProcessEpimorphismToNewFpGroup,
function(hom)
local s,r,fam,fas,fpf,mapi;
if not (HasIsSurjective(hom) and IsSurjective(hom)) then
Info(InfoWarning,1,"fp eipimorphism is created in strange way, bail out");
return; # hom might be ill defined.
fi;
s:=Source(hom);
r:=Range(hom);
mapi:=MappingGeneratorsImages(hom);
if mapi[2]<>GeneratorsOfGroup(r) then
return; # the method does not apply here. One could try to deal with the
#extra generators separately, but that is too much work for what is
#intended as a minor hint.
fi;
# Transfer some knowledge about the source group to its image.
if HasIsMapping(hom) and IsMapping(hom) then
if HasIsInjective(hom) and IsInjective(hom) then
UseIsomorphismRelation(s, r);
elif HasKernelOfMultiplicativeGeneralMapping(hom) then
UseFactorRelation(s, KernelOfMultiplicativeGeneralMapping(hom), r);
else
UseFactorRelation(s, fail, r);
fi;
fi;
s:=SubgroupNC(s,mapi[1]);
fam:=FamilyObj(One(r));
fas:=FamilyObj(One(s));
if IsPermCollection(s) or IsMatrixCollection(s)
or IsPcGroup(s) or CanEasilyCompareElements(s) then
# in the long run this should be the inverse of the source restricted
# mapping (or the corestricted inverse) but that does not work well with
# current homomorphism code, thus build new map.
#fpf:=InverseGeneralMapping(hom);
fpf:=GroupHomomorphismByImagesNC(r,s,mapi[2],mapi[1]);
elif IsFpGroup(s) and HasFPFaithHom(fas) then
#fpf:=InverseGeneralMapping(hom)*FPFaithHom(fas);
fpf:=GroupHomomorphismByImagesNC(r,s,mapi[2],List(mapi[1],x->Image(FPFaithHom(fas),x)));
else
fpf:=fail;
fi;
if fpf<>fail then
SetEpimorphismFromFreeGroup(ImagesSource(fpf),fpf);
SetFPFaithHom(fam,fpf);
SetFPFaithHom(r,fpf);
if IsPermGroup(s) then SetIsomorphismPermGroup(r,fpf);fi;
if IsPcGroup(s) then SetIsomorphismPcGroup(r,fpf);fi;
fi;
end);
|