/usr/share/gap/lib/grpperm.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 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 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 | ############################################################################
##
#W grpperm.gi GAP library Heiko Theißen
##
##
#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
##
#############################################################################
##
#M CanEasilyTestMembership( <permgroup> )
##
InstallTrueMethod(CanEasilyTestMembership,IsPermGroup);
#############################################################################
##
#M CanEasilyComputePcgs( <permgroup> )
##
## solvable permgroups can compute a pcgs. (The group may have been told it
## is solvable without actually doing a solvability test, so we need the
## implication.)
InstallTrueMethod(CanEasilyComputePcgs,IsPermGroup and IsSolvableGroup);
#M CanComputeSizeAnySubgroup
InstallTrueMethod(CanComputeSizeAnySubgroup,IsPermGroup);
#############################################################################
##
#M AsSubgroup( <G>, <U> ) . . . . . . . . . . . . with stab chain transfer
##
InstallMethod( AsSubgroup,"perm groups",
IsIdenticalObj, [ IsPermGroup, IsPermGroup ], 0,
function( G, U )
local S;
# test if the parent is already alright
if HasParent(U) and IsIdenticalObj(Parent(U),G) then
return U;
fi;
if not IsSubset( G, U ) then
return fail;
fi;
S:= SubgroupNC( G, GeneratorsOfGroup( U ) );
UseIsomorphismRelation( U, S );
UseSubsetRelation( U, S );
if HasStabChainMutable( U ) then
SetStabChainMutable( S, StabChainMutable( U ) );
fi;
return S;
end );
#############################################################################
##
#M CanEasilyComputeWithIndependentGensAbelianGroup( <permgroup> )
##
InstallTrueMethod(CanEasilyComputeWithIndependentGensAbelianGroup,
IsPermGroup and IsAbelian);
#############################################################################
##
#F IndependentGeneratorsAbelianPPermGroup( <P>, <p> ) . . . nice generators
##
InstallGlobalFunction( IndependentGeneratorsAbelianPPermGroup,
function ( P, p )
local inds, # independent generators, result
pows, # their powers
base, # the base of the vectorspace
size, # the size of the group generated by <inds>
orbs, # orbits
trns, # transversal
gens, # remaining generators
one, # identity of `P'
gens2, # remaining generators for next round
exp, # exponent of <P>
g, # one generator from <gens>
h, # its power
b, # basepoint
c, # other point in orbit
i, j, k; # loop variables
# initialize the list of independent generators
inds := [];
pows := [];
base := [];
size := 1;
orbs := [];
trns := [];
# gens are the generators for the remaining group
gens := GeneratorsOfGroup( P );
one:= One( P );
# loop over the exponents
exp := Maximum( List( gens, g -> LogInt( Order( g ), p ) ) );
for i in [exp,exp-1..1] do
# loop over the remaining generators
gens2 := [];
for j in [1..Length(gens)] do
g := gens[j];
h := g ^ (p^(i-1));
# reduce <g> and <h>
while h <> h^0
and IsBound(trns[SmallestMovedPoint(h)^h])
do
g := g / pows[ trns[SmallestMovedPoint(h)^h] ];
h := h / base[ trns[SmallestMovedPoint(h)^h] ];
od;
# if this is linear indepenent, add it to the generators
if h <> h^0 then
Add( inds, g );
Add( pows, g );
Add( base, h );
size := size * p^i;
b := SmallestMovedPoint(h);
if not IsBound( orbs[b] ) then
orbs[b] := [ b ];
trns[b] := [ one ];
fi;
for c in ShallowCopy(orbs[b]) do
for k in [1..p-1] do
Add( orbs[b], c ^ (h^k) );
trns[c^(h^k)] := Length(base);
od;
od;
# otherwise reduce and add to gens2
else
Add( gens2, g );
fi;
od;
# prepare for the next round
gens := gens2;
pows := List( pows,i->i^ p );
od;
# return the indepenent generators
return inds;
end );
#############################################################################
##
#M IndependentGeneratorsOfAbelianGroup( <G> ) . . . . . . . nice generators
##
InstallMethod( IndependentGeneratorsOfAbelianGroup, "for perm group",
[ IsPermGroup and IsAbelian ],
function ( G )
local inds, # independent generators, result
one, # identity of `G'
p, # prime factor of group size
gens, # generators of <p>-Sylowsubgroup
g, # one generator
o; # its order
# loop over all primes
inds := [];
one:= One( G );
for p in Union( List( GeneratorsOfGroup( G ),
g -> Factors(Order(g)) ) ) do
if p <> 1 then
# compute the generators for the Sylow <p> subgroup
gens := [];
for g in GeneratorsOfGroup( G ) do
o := Order(g);
while o mod p = 0 do o := o / p; od;
if g^o <> g^0 then Add( gens, g^o ); fi;
od;
# append the independent generators for the Sylow <p> subgroup
Append( inds,
IndependentGeneratorsAbelianPPermGroup(
GroupByGenerators( gens, one ), p ) );
fi;
od;
# Sort the independent generators by increasing order
Sort( inds, function (a,b) return Order(a) < Order(b); end );
# return the independent generators
return inds;
end );
#############################################################################
##
#F OrbitPerms( <gens>, <d> ) . . . . . . . . . . . . . orbit of permutations
##
InstallGlobalFunction( OrbitPerms, function( gens, d )
local max, orb, new, pnt, img, gen;
# get the largest point <max> moved by the group <G>
max := LargestMovedPoint( gens );
# handle fixpoints
if not d in [1..max] then
return [ d ];
fi;
# start with the singleton orbit
orb := [ d ];
new := BlistList( [1..max], [1..max] );
new[d] := false;
# loop over all points found
for pnt in orb do
# apply all generators <gen>
for gen in gens do
img := pnt ^ gen;
# add the image <img> to the orbit if it is new
if new[img] then
Add( orb, img );
new[img] := false;
fi;
od;
od;
return orb;
end );
#############################################################################
##
#F OrbitsPerms( <gens>, <D> ) . . . . . . . . . . . orbits of permutations
##
InstallGlobalFunction( OrbitsPerms, function( gens, D )
local max, dom, new, orbs, fst, orb, pnt, gen, img;
# get the largest point <max> moved by the group <G>
max := LargestMovedPoint( gens );
dom := BlistList( [1..max], D );
new := BlistList( [1..max], [1..max] );
orbs := [];
# repeat until the domain is exhausted
fst := Position( dom, true );
while fst <> fail do
# start with the singleton orbit
orb := [ fst ];
new[fst] := false;
dom[fst] := false;
# loop over all points found
for pnt in orb do
# apply all generators <gen>
for gen in gens do
img := pnt ^ gen;
# add the image <img> to the orbit if it is new
if new[img] then
Add( orb, img );
new[img] := false;
dom[img] := false;
fi;
od;
od;
# add the orbit to the list of orbits and take next point
Add( orbs, orb );
fst := Position( dom, true, fst );
od;
# add the remaining points of <D>, they are fixed
for pnt in D do
if pnt>max then
Add( orbs, [ pnt ] );
fi;
od;
return orbs;
end );
#############################################################################
##
#M SmallestMovedPoint( <C> ) . . . . . . . for a collection of permutations
##
SmallestMovedPointPerms := function( C )
local min, m, gen;
min := infinity;
for gen in C do
if not IsOne( gen ) then
m := SmallestMovedPointPerm( gen );
if m < min then
min := m;
fi;
fi;
od;
return min;
end;
InstallMethod( SmallestMovedPoint,
"for a collection of permutations",
true,
[ IsPermCollection ], 0,
SmallestMovedPointPerms );
InstallMethod( SmallestMovedPoint,
"for an empty list",
true,
[ IsList and IsEmpty ], 0,
SmallestMovedPointPerms );
#############################################################################
##
#M LargestMovedPoint( <C> ) . . . . . . . for a collection of permutations
##
LargestMovedPointPerms := function( C )
local max, m, gen;
max := 0;
for gen in C do
if not IsOne( gen ) then
m := LargestMovedPointPerm( gen );
if max < m then
max := m;
fi;
fi;
od;
return max;
end;
InstallMethod( LargestMovedPoint,
"for a collection of permutations",
true,
[ IsPermCollection ], 0,
LargestMovedPointPerms );
InstallMethod( LargestMovedPoint,
"for an empty list",
true,
[ IsList and IsEmpty ], 0,
LargestMovedPointPerms );
#############################################################################
##
#F MovedPoints( <C> ) . . . . . . . . . . for a collection of permutations
##
InstallGlobalFunction(MovedPointsPerms,function( C )
local mov, gen, pnt;
mov := [ ];
for gen in C do
if gen <> One( gen ) then
for pnt in [ SmallestMovedPoint( gen ) ..
LargestMovedPoint( gen ) ] do
if pnt ^ gen <> pnt then
mov[ pnt ] := pnt;
fi;
od;
fi;
od;
return Set( mov );
end);
InstallMethod( MovedPoints, "for a collection of permutations", true,
[ IsPermCollection ], 0,
MovedPointsPerms );
InstallMethod( MovedPoints, "for an empty list", true,
[ IsList and IsEmpty ], 0,
MovedPointsPerms );
InstallMethod( MovedPoints, "for a permutation", true, [ IsPerm ], 0,
function(p)
return MovedPointsPerms([p]);
end);
#############################################################################
##
#M NrMovedPoints( <C> ) . . . . . . . . . for a collection of permutations
##
NrMovedPointsPerms := function( C )
local mov, sma, pnt, gen;
mov := 0;
sma := SmallestMovedPoint( C );
if sma = infinity then
return 0;
fi;
for pnt in [ sma .. LargestMovedPoint( C ) ] do
for gen in C do
if pnt ^ gen <> pnt then
mov:= mov + 1;
break;
fi;
od;
od;
return mov;
end;
InstallMethod( NrMovedPoints,
"for a collection of permutations",
[ IsPermCollection ],
NrMovedPointsPerms );
InstallMethod( NrMovedPoints,
"for an empty list",
[ IsList and IsEmpty ],
NrMovedPointsPerms );
#############################################################################
##
#M LargestMovedPoint( <G> ) . . . . . . . . . . . . for a permutation group
##
InstallMethod( LargestMovedPoint,
"for a permutation group",
true,
[ IsPermGroup ], 0,
G -> LargestMovedPoint( GeneratorsOfGroup( G ) ) );
#############################################################################
##
#M SmallestMovedPoint( <G> ) . . . . . . . . . . . . for a permutation group
##
InstallMethod( SmallestMovedPoint,
"for a permutation group",
true,
[ IsPermGroup ], 0,
G -> SmallestMovedPoint( GeneratorsOfGroup( G ) ) );
#############################################################################
##
#M MovedPoints( <G> ) . . . . . . . . . . . . . . . for a permutation group
##
InstallMethod( MovedPoints,
"for a permutation group",
true,
[ IsPermGroup ], 0,
G -> MovedPoints( GeneratorsOfGroup( G ) ) );
#############################################################################
##
#M NrMovedPoints( <G> ) . . . . . . . . . . . . . . for a permutation group
##
InstallMethod( NrMovedPoints,
"for a permutation group",
true,
[ IsPermGroup ], 0,
G -> NrMovedPoints( GeneratorsOfGroup( G ) ) );
#############################################################################
##
#M BaseOfGroup( <G> )
##
InstallMethod( BaseOfGroup,
"for a permutation group",
true,
[ IsPermGroup ], 0,
G -> BaseStabChain( StabChainMutable( G ) ) );
#############################################################################
##
#M Size( <G> ) . . . . . . . . . . . . . . . . . . size of permutation group
##
InstallMethod( Size,
"for a permutation group",
true,
[ IsPermGroup ], 0,
G -> SizeStabChain( StabChainMutable( G ) ) );
#############################################################################
##
#M Enumerator( <G> ) . . . . . . . . . . . . enumerator of permutation group
##
BindGlobal( "ElementNumber_PermGroup",
function( enum, pos )
local elm, S, len, n;
S := enum!.stabChain;
elm := S.identity;
n:= pos;
pos := pos - 1;
while Length( S.genlabels ) <> 0 do
len := Length( S.orbit );
elm := LeftQuotient( InverseRepresentative
( S, S.orbit[ pos mod len + 1 ] ), elm );
pos := QuoInt( pos, len );
S := S.stabilizer;
od;
if pos <> 0 then
Error( "<enum>[", n, "] must have an assigned value" );
fi;
return elm;
end );
BindGlobal( "NumberElement_PermGroup",
function( enum, elm )
local pos, val, S, img;
if not IsPerm( elm ) then
return fail;
fi;
pos := 1;
val := 1;
S := enum!.stabChain;
while Length( S.genlabels ) <> 0 do
img := S.orbit[ 1 ] ^ elm;
#pos := pos + val * ( Position( S.orbit, img ) - 1 );
pos := pos + val * S.orbitpos[img];
#val := val * Length( S.orbit );
val := val * S.ol;
elm := elm * InverseRepresentative( S, img );
S := S.stabilizer;
od;
if elm <> S.identity then
return fail;
fi;
return pos;
end );
InstallMethod( Enumerator,
"for a permutation group",
[ IsPermGroup ],
function(G)
local e,S,i,p;
# get a good base
S:=G;
p:=[];
while Size(S)>1 do
e:=Orbits(S,MovedPoints(S));
i:=List(e,Length);
i:=Position(i,Maximum(i));
Add(p,e[i][1]);
S:=Stabilizer(S,e[i][1]);
od;
Info(InfoGroup,1,"choose base ",p);
S:=StabChainOp(G,rec(base:=p));
e:=EnumeratorByFunctions( G, rec(
ElementNumber := ElementNumber_PermGroup,
NumberElement := NumberElement_PermGroup,
Length := enum -> SizeStabChain( enum!.stabChain ),
PrintObj := function( G )
Print( "<enumerator of perm group>" );
end,
stabChain := S ) );
while Length(S.genlabels)<>0 do
S.ol:=Length(S.orbit);
S.orbitpos:=[];
for i in [1..Maximum(S.orbit)] do
p:=Position(S.orbit,i);
if p<>fail then
S.orbitpos[i]:=p-1;
fi;
od;
S:=S.stabilizer;
od;
return e;
end);
#############################################################################
##
#M Random( <G> ) . . . . . . . . . . . . . . . . . . . . . . random element
##
InstallMethod( Random,
"for a permutation group",
[ IsPermGroup ], 10,
function( G )
local S, rnd;
# go down the stabchain and multiply random representatives
S := StabChainMutable( G );
rnd := S.identity;
while Length( S.genlabels ) <> 0 do
rnd := LeftQuotient( InverseRepresentative( S,
Random( S.orbit ) ), rnd );
S := S.stabilizer;
od;
# return the random element
return rnd;
end );
#############################################################################
##
#M <g> in <G> . . . . . . . . . . . . . . . . . . . . . . . membership test
##
InstallMethod( \in,
"for a permutation, and a permutation group",
true,
[ IsPerm, IsPermGroup and HasGeneratorsOfGroup], 0,
function( g, G )
if g = One( G ) or g in GeneratorsOfGroup( G ) then
return true;
else
G := StabChainMutable( G );
return SiftedPermutation( G, g ) = G.identity;
fi;
end );
#############################################################################
##
#M ClosureGroup( <G>, <gens>, <options> ) . . . . . . closure with options
##
## The following function implements the method and may be called even with
## incomplete (temp) stabilizer chains.
BindGlobal("DoClosurePrmGp",function( G, gens, options )
local C, # closure of < <G>, <obj> >, result
P, inpar, # parent of the closure
g, # an element of gens
o, # order
newgens, # new generator list
chain; # the stabilizer chain created
options:=ShallowCopy(options); # options will be overwritten
# if all generators are in <G>, <G> is the closure
gens := Filtered( gens, gen -> not gen in G );
if IsEmpty( gens ) then
return G;
fi;
# is the closure normalizing?
if Length(gens)=1 and
ForAll(gens,i->ForAll(GeneratorsOfGroup(G),j->j^i in G)) then
g:=gens[1];
if Size(G)>1 then
o:=First(Difference(DivisorsInt(Order(g)),[1]),j->g^j in G);
options.limit:=Size(G)*o;
else
o:=First(Difference(DivisorsInt(Order(g)),[1]),j->IsOne(g^j));
options.limit:=o;
fi;
options.size:=options.limit;
#Print(options.limit,"<<\n");
fi;
# otherwise decide between random and deterministic methods
P := Parent( G );
inpar := IsSubset( P, gens );
while not inpar and not IsIdenticalObj( P, Parent( P ) ) do
P := Parent( P );
inpar := IsSubset( P, gens );
od;
if inpar then
CopyOptionsDefaults( P, options );
elif not IsBound( options.random ) then
options.random := DefaultStabChainOptions.random;
fi;
# perhaps <G> is normal in <C> with solvable factor group
#AH 5-feb-96: Disabled (see gap-dev discussion).
# if DefaultStabChainOptions.tryPcgs
# and ForAll( gens, gen -> ForAll( GeneratorsOfGroup( G ),
# g -> g ^ gen in G ) ) then
# if inpar then
# C := SubgroupNC( P,
# Concatenation( GeneratorsOfGroup( G ), gens ) );
# else
# C := GroupByGenerators
# ( Concatenation( GeneratorsOfGroup( G ), gens ) );
# fi;
# pcgs:=TryPcgsPermGroup( [ C, G ], false, false, false );
# if IsPcgs( pcgs ) then
# chain:=pcgs!.stabChain;
# if inpar then C := GroupStabChain( P, chain, true );
# else C := GroupStabChain( chain ); fi;
# SetStabChainOptions( C, rec( random := options.random ) );
#
# UseSubsetRelation( C, G );
# return C;
# fi;
# fi;
# make the base of G compatible with options.base
chain := StructuralCopy( StabChainMutable( G ) );
if IsBound( options.base ) then
ChangeStabChain( chain, options.base,
IsBound( options.reduced ) and options.reduced );
fi;
if LargestMovedPoint( Concatenation( GeneratorsOfGroup( G ),
gens ) ) <= 100 then
options := ShallowCopy( options );
options.base := BaseStabChain( chain );
for g in gens do
if SiftedPermutation( chain, g ) <> chain.identity then
StabChainStrong( chain, [ g ], options );
fi;
od;
else
chain := ClosureRandomPermGroup( chain, gens, options );
fi;
newgens:=Concatenation(GeneratorsOfGroup(G),gens);
if Length(chain.generators)<=Length(newgens) then
if inpar then C := GroupStabChain( P, chain, true );
else C := GroupStabChain( chain ); fi;
else
if inpar then C := SubgroupNC(P,newgens);
else C := Group( newgens,One(G) ); fi;
SetStabChainMutable(C,chain);
fi;
SetStabChainOptions( C, rec( random := options.random ) );
UseSubsetRelation( C, G );
return C;
end );
BindGlobal("PG_EMPTY_OPT",rec());
InstallOtherMethod( ClosureGroup,"permgroup, elements, options",
true,
[ IsPermGroup, IsList and IsPermCollection, IsRecord ], 0,
DoClosurePrmGp);
InstallOtherMethod( ClosureGroup, "empty list",true,
[ IsPermGroup, IsList and IsEmpty ], 0,
function( G, nogens )
return G;
end );
InstallMethod( ClosureGroup, "permgroup, element",true,
[ IsPermGroup, IsPerm ], 0,
function( G, g )
return DoClosurePrmGp( G, [ g ], PG_EMPTY_OPT );
end );
InstallMethod( ClosureGroup, "permgroup, elements",true,
[ IsPermGroup, IsList and IsPermCollection ], 0,
function( G, gens )
return DoClosurePrmGp( G, gens, PG_EMPTY_OPT );
end );
InstallOtherMethod( ClosureGroup, "permgroup, element, options",true,
[ IsPermGroup, IsPerm, IsRecord ], 0,
function( G, g, options )
return DoClosurePrmGp( G, [ g ], options );
end );
InstallOtherMethod( ClosureGroup, "permgroup, permgroup, options", true,
[ IsPermGroup, IsPermGroup, IsRecord ], 0,
function( G, H, options )
return DoClosurePrmGp( G, GeneratorsOfGroup( H ), options );
end );
InstallOtherMethod( ClosureGroup, "empty list and options",true,
[ IsPermGroup, IsList and IsEmpty, IsRecord ], 0,
function( G, nogens, options )
return G;
end );
#############################################################################
##
#M NormalClosureOp( <G>, <U> ) . . . . . . . . . . . . . . . . in perm group
##
BindGlobal("DoNormalClosurePermGroup",function ( G, U )
local N, # normal closure of <U> in <G>, result
chain, # stabilizer chain for the result
rchain, # restored version of <chain>, for `VerifySGS'
options, # options record for stabilizer chain construction
gensG, # generators of the group <G>
genG, # one generator of the group <G>
gensN, # generators of the group <N>
genN, # one generator of the group <N>
cnj, # conjugated of a generator of <U>
random, k, # values measuring randomness of <chain>
param, missing, correct, result, i, one;
# get a set of monoid generators of <G>
gensG := GeneratorsOfGroup( G );
one:= One( G );
# make a copy of the group to be closed
N := SubgroupNC( G, GeneratorsOfGroup(U) );
UseIsomorphismRelation(U,N);
UseSubsetRelation(U,N);
SetStabChainMutable( N, StabChainMutable( U ) );
options := ShallowCopy( StabChainOptions( U ) );
if IsBound( options.random ) then random := options.random;
else random := 1000; fi;
options.temp := true;
# make list of conjugates to be added to N
repeat
gensN := [ ];
for i in [ 1 .. 10 ] do
genG := SCRRandomSubproduct( gensG, One( G ) );
cnj := SCRRandomSubproduct( Concatenation(
GeneratorsOfGroup( N ), gensN ), One( G ) ) ^ genG;
if not cnj in N then
Add( gensN, cnj );
fi;
od;
if not IsEmpty( gensN ) then
N := ClosureGroup( N, gensN, options );
fi;
until IsEmpty( gensN );
# Guarantee that all conjugates are in the normal closure: Loop over all
# generators of N
gensN := ShallowCopy( GeneratorsOfGroup( N ) );
for genN in gensN do
# loop over the generators of G
for genG in gensG do
# make sure that the conjugated element is in the closure
cnj := genN ^ genG;
if not cnj in N then
N := ClosureGroup( N, [ cnj ], options );
Add( gensN, cnj );
fi;
od;
od;
# Verify the stabilizer chain.
chain := StabChainMutable( N );
if not IsBound( chain.orbits ) then
if IsBound( chain.aux ) then
chain := SCRRestoredRecord( chain );
fi;
result := chain.identity;
elif random = 1000 then
missing := chain.missing;
correct := chain.correct;
rchain := SCRRestoredRecord( chain );
result := VerifySGS( rchain, missing, correct );
if not IsPerm(result) then
repeat
result := SCRStrongGenTest2(chain,[0,0,1,10/chain.diam,0,0]);
until result <> one;
fi;
chain := rchain;
else
k := First([0..14],x->(3/5)^x <= 1-random/1000);
if IsBound(options.knownBase) then
param := [k,4,0,0,0,0];
else
param := [QuoInt(k,2),4,QuoInt(k+1,2),4,50,5];
fi;
if options.random <= 200 then
param[2] := 2;
param[4] := 2;
fi;
result := SCRStrongGenTest( chain, param, chain.orbits,
chain.basesize, chain.base,
chain.correct, chain.missing );
if result = chain.identity and not chain.correct then
result := SCRStrongGenTest2( chain, param );
fi;
chain := SCRRestoredRecord( chain );
fi;
SetStabChainMutable( N, chain );
if result <> chain.identity then
N := ClosureGroup( N, [ result ] );
fi;
# give N the proper randomness
StabChainOptions(N).random:=random;
# return the normal closure
UseSubsetRelation( N, U );
return N;
end );
InstallMethod( NormalClosureOp, "subgroup of perm group",
IsIdenticalObj, [ IsPermGroup, IsPermGroup ], 0,
function(G,U)
# test applicability
if not IsSubset(G,U) then
TryNextMethod();
fi;
return DoNormalClosurePermGroup(G,U);
end);
#############################################################################
##
#M ConjugateGroup( <G>, <g> ) . . . . . . . . . . . . of permutation group
##
InstallMethod( ConjugateGroup, "<P>, <g>", true, [ IsPermGroup, IsPerm ], 0,
function( G, g )
local H, S;
H := GroupByGenerators( OnTuples( GeneratorsOfGroup( G ), g ), One( G ) );
if HasStabChainMutable(G) then
S := EmptyStabChain( [ ], One( H ) );
ConjugateStabChain( StabChainMutable( G ), S, g, g );
SetStabChainMutable( H, S );
elif HasSize(G) then
SetSize(H,Size(G));
fi;
UseIsomorphismRelation( G, H );
return H;
end );
#############################################################################
##
#M CommutatorSubgroup( <U>, <V> ) . . . . . . . . . . . . . for perm groups
##
InstallMethod( CommutatorSubgroup, "permgroups", IsIdenticalObj,
[ IsPermGroup, IsPermGroup ], 0,
function( U, V )
local C, # the commutator subgroup
CUV, # closure of U,V
doneCUV, # boolean; true if CUV is computed
u, # random subproduct of U.generators
v, # random subproduct of V.generators
comm, # commutator of u,v
list, # list of commutators
i; # loop variable
# [ <U>, <V> ] = normal closure of < [ <u>, <v> ] >.
C := TrivialSubgroup( U );
doneCUV := false;
# if there are lot of generators, use random subproducts
if Length( GeneratorsOfGroup( U ) ) *
Length( GeneratorsOfGroup( V ) ) > 10 then
repeat
list := [];
for i in [1..10] do
u := SCRRandomSubproduct( GeneratorsOfGroup( U ), One( U ) );
v := SCRRandomSubproduct( GeneratorsOfGroup( V ), One( V ) );
comm := Comm( u, v );
if not comm in C then
Add( list, comm ) ;
fi;
od;
if Length(list) > 0 then
C := ClosureGroup( C, list, rec( random := 0,
temp := true ) );
if not doneCUV then
CUV := ClosureGroup( U, V );
doneCUV := true;
fi;
# force closure test
StabChainOptions(C).random:=DefaultStabChainOptions.random;
C := DoNormalClosurePermGroup( CUV, C );
fi;
until IsEmpty( list );
fi;
# do the deterministic method; it will also check correctness
list := [];
for u in GeneratorsOfGroup( U ) do
for v in GeneratorsOfGroup( V ) do
comm := Comm( u, v );
if not comm in C then
Add( list, comm );
fi;
od;
od;
if not IsEmpty( list ) then
C := ClosureGroup( C, list, rec( random := 0,
temp := true ) );
if not doneCUV then
CUV := ClosureGroup( U, V );
doneCUV := true;
fi;
# force closure test
StabChainOptions(C).random:=DefaultStabChainOptions.random;
C := DoNormalClosurePermGroup( CUV, C );
fi;
return C;
end );
#############################################################################
##
#M DerivedSubgroup( <G> ) . . . . . . . . . . . . . . of permutation group
##
InstallMethod( DerivedSubgroup,"permgrps",true, [ IsPermGroup ], 0,
function( G )
local D, # derived subgroup of <G>, result
g, h, # random subproducts of generators
comm, # their commutator
list, # list of commutators
i,j; # loop variables
# find the subgroup generated by the commutators of the generators
D := TrivialSubgroup( G );
# if there are >4 generators, use random subproducts
if Length( GeneratorsOfGroup( G ) ) > 4 then
repeat
list := [];
for i in [1..10] do
g := SCRRandomSubproduct( GeneratorsOfGroup( G ), One( G ) );
h := SCRRandomSubproduct( GeneratorsOfGroup( G ), One( G ) );
comm := Comm( g, h );
if not comm in D then
Add( list, comm );
fi;
od;
if Length(list) > 0 then
D := ClosureGroup(D,list,rec( random := 0,
temp := true ) );
# force closure test
if IsBound(StabChainOptions(G).random) then
StabChainOptions(D).random:=StabChainOptions(G).random;
else
StabChainOptions(D).random:=DefaultStabChainOptions.random;
fi;
D := DoNormalClosurePermGroup( G, D );
fi;
until list = [];
fi;
# do the deterministic method; it will also check random result
list := [];
for i in [ 2 .. Length( GeneratorsOfGroup( G ) ) ] do
for j in [ 1 .. i - 1 ] do
comm := Comm( GeneratorsOfGroup( G )[i],
GeneratorsOfGroup( G )[j] );
if not comm in D then
Add( list, comm );
fi;
od;
od;
if not IsEmpty( list ) then
D := ClosureGroup(D,list,rec( random := 0,
temp := true ) );
# give D a proper randomness
if IsBound(StabChainOptions(G).random) then
StabChainOptions(D).random:=StabChainOptions(G).random;
else
StabChainOptions(D).random:=DefaultStabChainOptions.random;
fi;
D := DoNormalClosurePermGroup( G, D );
fi;
return D;
end );
#############################################################################
##
#M IsSimpleGroup( <G> ) . . . . . . . test if a permutation group is simple
##
## This is a most interesting function. It tests whether a permutation
## group is simple by testing whether the group is perfect and then only
## looking at the size of the group and the degree of a primitive operation.
## Basically it uses the O'Nan--Scott theorem, which gives a pretty clear
## description of perfect primitive groups. This algorithm is described in
## William M. Kantor,
## Finding Composition Factors of Permutation Groups of Degree $n\leq 10^6$,
## J. Symbolic Computation, 12:517--526, 1991.
##
InstallMethod( IsSimpleGroup,"for permgrp", true, [ IsPermGroup ], 0,
function ( G )
local D, # operation domain of <G>
hom, # transitive constituent or blocks homomorphism
d, # degree of <G>
n, m, # $d = n^m$
simple, # list of orders of simple groups
transperf, # list of orders of transitive perfect groups
s, t; # loop variables
# if <G> is the trivial group, it is not simple
if IsTrivial( G ) then
return false;
fi;
# first find a transitive representation for <G>
D := Orbit( G, SmallestMovedPoint( G ) );
if not IsEqualSet( MovedPoints( G ), D ) then
hom := ActionHomomorphism( G, D,"surjective" );
if Size( G ) <> Size( Image( hom ) ) then
return false;
fi;
G := Image( hom );
fi;
# next find a primitive representation for <G>
D := Blocks( G, MovedPoints( G ) );
while Length( D ) <> 1 do
hom := ActionHomomorphism( G, D, OnSets,"surjective" );
if Size( G ) <> Size( Image( hom ) ) then
return false;
fi;
G := Image( hom );
D := Blocks( G, MovedPoints( G ) );
od;
# compute the degree $d$ and express it as $d = n^m$
D := MovedPoints( G );
d := Length( D );
n := SmallestRootInt( d );
m := LogInt( d, n );
if 10^6 < d then
Error("cannot decide whether <G> is simple or not");
fi;
# if $G = C_p$, it is simple
if IsPrimeInt( Size( G ) ) then
return true;
# if $G = A_d$, it is simple (unless $d < 5$)
elif IsNaturalAlternatingGroup(G) then
return 5 <= d;
# if $G = S_d$, it is not simple (except $S_2$)
elif IsNaturalSymmetricGroup(G) then
return 2 = d;
# if $G$ is not perfect, it is not simple (unless $G = C_p$, see above)
elif Size( DerivedSubgroup( G ) ) < Size( G ) then
return false;
# if $\|G\| = d^2$, it is not simple (Kantor's Lemma 4)
elif Size( G ) = d ^ 2 then
return false;
# if $d$ is a prime, <G> is simple
elif IsPrimeInt( d ) then
return true;
# if $G = U(4,2)$, it is simple (operation on 27 points)
elif d = 27 and Size( G ) = 25920 then
return true;
# if $G = PSL(n,q)$, it is simple (operations on prime power points)
elif ( (d = 8 and Size(G) = (7^3-7)/2 ) # PSL(2,7)
or (d = 9 and Size(G) = (8^3-8) ) # PSL(2,8)
or (d = 32 and Size(G) = (31^3-31)/2 ) # PSL(2,31)
or (d = 121 and Size(G) = 237783237120) # PSL(5,3)
or (d = 128 and Size(G) = (127^3-127)/2 ) # PSL(2,127)
or (d = 8192 and Size(G) = (8191^3-8191)/2 ) # PSL(2,8191)
or (d = 131072 and Size(G) = (131071^3-131071)/2) # PSL(2,131071)
or (d = 524288 and Size(G) = (524287^3-524287)/2)) # PSL(2,524287)
and IsTransitive( Stabilizer( G, D[1] ), Difference( D, [ D[1] ] ) )
then
return true;
# if $d$ is a prime power, <G> is not simple (except the cases above)
elif IsPrimePowerInt( d ) then
return false;
# if we don't have at least an $A_5$ acting on the top, <G> is simple
elif m < 5 then
return true;
# otherwise we must check for some special cases
else
# orders of simple subgroups of $S_n$ with primitive normalizer
simple := [ ,,,,,
[60,360],,,, # 5: A(5), A(6)
[60,360,1814400],, # 10: A(5), A(6), A(10)
[660,7920,95040,239500800],, # 12: PSL(2,11), M(11), M(12), A(12)
[1092,43589145600], # 14: PSL(2,13), A(14)
[360,2520,20160,653837184000] # 15: A(6), A(7), A(8), A(15)
];
# orders of transitive perfect subgroups of $S_m$
transperf := [ ,,,,
[60], # 5: A(5)
[60,360], # 6: A(5), A(6)
[168,2520], # 7: PSL(3,2), A(7)
[168,8168,20160] # 8: PSL(3,2), AGL(3,2), A(8)
];
# test the special cases (Kantor's Lemma 3)
for s in simple[n] do
for t in transperf[m] do
if Size( G ) mod (t * s^m) = 0
and (((t * (2*s)^m) mod Size( G ) = 0 and s <> 360)
or ((t * (4*s)^m) mod Size( G ) = 0 and s = 360))
then
return false;
fi;
od;
od;
# otherwise <G> is simple
return true;
fi;
end );
#############################################################################
##
#M IsSolvableGroup( <G> ) . . . . . . . . . . . . . . . . solvability test
##
InstallMethod( IsSolvableGroup,"for permgrp", true, [ IsPermGroup ], 0,
function(G)
local pcgs;
pcgs:=TryPcgsPermGroup( G, false, false, true );
if IsPcgs(pcgs) then
SetIndicesEANormalSteps(pcgs,pcgs!.permpcgsNormalSteps);
SetIsPcgsElementaryAbelianSeries(pcgs,true);
if not HasPcgs(G) then
SetPcgs(G,pcgs);
fi;
if not HasPcgsElementaryAbelianSeries(G) then
SetPcgsElementaryAbelianSeries(G,pcgs);
fi;
return true;
else
return false;
fi;
end);
#############################################################################
##
#M IsNilpotentGroup( <G> ) . . . . . . . . . . . . . . . . . nilpotency test
##
InstallMethod( IsNilpotentGroup,"for permgrp", true, [ IsPermGroup ], 0,
G -> IsPcgs(PcgsCentralSeries(G) ) );
#############################################################################
##
#M PcgsCentralSeries( <G> )
##
InstallOtherMethod( PcgsCentralSeries,"for permgrp", true, [ IsPermGroup ], 0,
function(G)
local pcgs;
pcgs:=TryPcgsPermGroup( G, true, false, false );
if IsPcgs(pcgs) then
SetIndicesCentralNormalSteps(pcgs,pcgs!.permpcgsNormalSteps);
SetIsPcgsCentralSeries(pcgs,true);
if not HasPcgs(G) then
SetPcgs(G,pcgs);
fi;
fi;
return pcgs;
end);
#############################################################################
##
#M PcgsPCentralSeriesPGroup( <G> )
##
InstallOtherMethod( PcgsPCentralSeriesPGroup,"for permgrp", true, [ IsPermGroup ], 0,
function(G)
local pcgs;
pcgs:=TryPcgsPermGroup( G, true, true, Factors(Size(G))[1] );
if IsPcgs(pcgs) then
SetIndicesPCentralNormalStepsPGroup(pcgs,pcgs!.permpcgsNormalSteps);
SetIsPcgsPCentralSeriesPGroup(pcgs,true);
fi;
if IsPcgs(pcgs) and not HasPcgs(G) then
SetPcgs(G,pcgs);
fi;
return pcgs;
end);
#T AH, 3/26/07: This method triggers a bug with indices. It is not clear
#T form the description why TryPcgs... should also give a drived series. Thus
#T disabled.
# #############################################################################
# ##
# #M DerivedSeriesOfGroup( <G> ) . . . . . . . . . . . . . . . derived series
# ##
# InstallMethod( DerivedSeriesOfGroup,"for permgrp", true, [ IsPermGroup ], 0,
# function( G )
# local pcgs, series;
#
# if (not DefaultStabChainOptions.tryPcgs
# or ( HasIsSolvableGroup( G ) and not IsSolvableGroup( G ) ))
# and not (HasIsSolvableGroup(G) and IsSolvableGroup(G)) then
# TryNextMethod();
# fi;
#
# pcgs := TryPcgsPermGroup( G, false, true, false );
# if not IsPcgs( pcgs ) then
# TryNextMethod();
# fi;
# SetIndicesEANormalSteps(pcgs,pcgs!.permpcgsNormalSteps);
# series := EANormalSeriesByPcgs( pcgs );
# if not HasDerivedSubgroup( G ) then
# if Length( series ) > 1 then SetDerivedSubgroup( G, series[ 2 ] );
# else SetDerivedSubgroup( G, G ); fi;
# fi;
# return series;
# end );
#############################################################################
##
#M LowerCentralSeriesOfGroup( <G> ) . . . . . . . . . lower central series
##
InstallMethod( LowerCentralSeriesOfGroup,"for permgrp", true, [ IsPermGroup ], 0,
function( G )
local pcgs, series;
if not DefaultStabChainOptions.tryPcgs
or HasIsNilpotentGroup( G ) and not IsNilpotentGroup( G )
and not (HasIsNilpotentGroup(G) and IsNilpotentGroup(G)) then
TryNextMethod();
fi;
pcgs := TryPcgsPermGroup( G, true, true, false );
if not IsPcgs( pcgs ) then
TryNextMethod();
fi;
SetIndicesCentralNormalSteps(pcgs,pcgs!.permpcgsNormalSteps);
series := CentralNormalSeriesByPcgs( pcgs );
if not HasDerivedSubgroup( G ) then
if Length( series ) > 1 then SetDerivedSubgroup( G, series[ 2 ] );
else SetDerivedSubgroup( G, G ); fi;
fi;
return series;
end );
InstallOtherMethod( ElementaryAbelianSeries, "perm group", true,
[ IsPermGroup and IsFinite],
# we want this to come *before* the method for Pcgs computable groups
RankFilter(IsPermGroup and CanEasilyComputePcgs and IsFinite)
-RankFilter(IsPermGroup and IsFinite),
function(G)
local pcgs;
pcgs:=PcgsElementaryAbelianSeries(G);
if not IsPcgs(pcgs) then
TryNextMethod();
fi;
return EANormalSeriesByPcgs(pcgs);
end);
#InstallOtherMethod( ElementaryAbelianSeries, fam -> IsIdenticalObj
# ( fam, CollectionsFamily( CollectionsFamily( PermutationsFamily ) ) ),
# [ IsList ], 0,
# function( list )
# local pcgs;
#
# if IsEmpty( list )
# or not DefaultStabChainOptions.tryPcgs
# or ( HasIsSolvableGroup( list[ 1 ] )
# and not IsSolvableGroup( list[ 1 ] ) ) then
# TryNextMethod();
## fi;
#
## pcgs := TryPcgsPermGroup( list, false, false, true );
# if not IsPcgs( pcgs ) then return fail;
# else return ElementaryAbelianSeries( pcgs ); fi;
#end );
#############################################################################
##
#M PCentralSeries( <G>, <p> ) . . . . . . . . . . . . . . p-central series
##
InstallMethod( PCentralSeriesOp,"for permgrp", true, [ IsPermGroup, IsPosInt ], 0,
function( G, p )
local pcgs;
if Length(Factors(Size(G)))>1 then
TryNextMethod();
fi;
pcgs:=PcgsPCentralSeriesPGroup(G);
if not IsPcgs(pcgs) then
TryNextMethod();
fi;
return PCentralNormalSeriesByPcgsPGroup(pcgs);
end);
#############################################################################
##
#M SylowSubgroup( <G>, <p> ) . . . . . . . . . . . . . . Sylow $p$-subgroup
##
InstallMethod( SylowSubgroupOp,"permutation groups", true,
[ IsPermGroup, IsPosInt ], 0,
function( G, p )
local S;
if not HasIsSolvableGroup(G) and IsSolvableGroup(G) then
# enforce solvable methods if we detected anew that the group is
# solvable.
return SylowSubgroupOp(G,p);
fi;
S := SylowSubgroupPermGroup( G, p );
S := GroupStabChain( G, StabChainMutable( S ) );
SetIsNilpotentGroup( S, true );
if Size(S) > 1 then
SetIsPGroup( S, true );
SetPrimePGroup( S, p );
fi;
return S;
end );
InstallGlobalFunction( SylowSubgroupPermGroup, function( G, p )
local S, # <p>-Sylow subgroup of <G>, result
q, # largest power of <p> dividing the size of <G>
D, # domain of operation of <G>
O, # one orbit of <G> in this domain
B, # blocks of the operation of <G> on <D>
f, # action homomorphism of <G> on <O> or <B>
T, # <p>-Sylow subgroup in the image of <f>
g, g2, # one <p> element of <G>
C, C2; # centralizer of <g> in <G>
# get the size of the <p>-Sylow subgroup
q := 1; while Size( G ) mod (q * p) = 0 do q := q * p; od;
# handle trivial subgroup
if q = 1 then
return TrivialSubgroup( G );
fi;
# go down in stabilizers as long as possible
S := StabChainMutable( G );
while Length( S.orbit ) mod p <> 0 do
S := S.stabilizer;
od;
G := GroupStabChain( G, S, true );
# handle full group
if q = Size( G ) then
return G;
fi;
# handle <p>-Sylow subgroups of size <p>
if q = p then
repeat g := Random( G ); until Order( g ) mod p = 0;
g := g ^ (Order( g ) / p);
return SubgroupNC( G, [ g ] );
fi;
# if the group is not transitive work with the transitive constituents
D := MovedPoints( G );
if not IsTransitive( G, D ) then
Info(InfoGroup,1,"PermSylow: transitive");
S := G;
D := ShallowCopy( D );
while q < Size( S ) do
O := Orbit( S, D[1] );
f := ActionHomomorphism( S, O,"surjective" );
T := SylowSubgroupPermGroup( Range( f ), p );
S := PreImagesSet( f, T );
SubtractSet( D, O );
od;
return S;
fi;
# if the group is not primitive work in the image first
B := Blocks( G, D );
if Length( B ) <> 1 then
Info(InfoGroup,1,"PermSylow: blocks");
f := ActionHomomorphism( G, B, OnSets,"surjective" );
T := SylowSubgroupPermGroup( Range( f ), p );
if Size( T ) < Size( Range( f ) ) then
T := PreImagesSet( f, T );
S := SylowSubgroupPermGroup( T , p) ;
return S;
fi;
fi;
# find a <p> element whose centralizer contains a full <p>-Sylow subgroup
Info(InfoGroup,1,"PermSylow: element");
repeat g := Random( G ); until Order( g ) mod p = 0;
g := g ^ (Order( g ) / p);
C := Centralizer( G, g );
while GcdInt( q, Size( C ) ) < q do
repeat g2 := Random( C ); until Order( g2 ) mod p = 0;
g2 := g2 ^ (Order( g2 ) / p);
C2 := Centralizer( G, g2 );
if GcdInt( q, Size( C ) ) < GcdInt( q, Size( C2 ) ) then
C := C2; g := g2;
fi;
od;
# the centralizer acts on the cycles of the <p> element
B := List( Cycles( g, D ), Set );
Info(InfoGroup,1,"PermSylow: cycleaction");
f := ActionHomomorphism( C, B, OnSets,"surjective" );
T := SylowSubgroupPermGroup( Range( f ), p );
S := PreImagesSet( f, T );
return S;
end );
#############################################################################
##
#M Socle( <G> ) . . . . . . . . . . . socle of primitive permutation group
##
InstallMethod( Socle,"for permgrp", true, [ IsPermGroup ], 0,
function( G )
local Omega, deg, shortcut, coll, d, m, c, ds, L, z, ord,
p, i;
Omega := MovedPoints( G );
if not IsPrimitive( G, Omega ) then
TryNextMethod();
fi;
# Affine groups first.
L := Earns( G, Omega );
if L <> fail then
return L;
fi;
deg := Length( Omega );
if deg >= 6103515625 then
TryNextMethod();
elif deg < 12960000 then
shortcut := true;
if deg >= 3125 then
coll := Collected( FactorsInt( deg ) );
d := Gcd( List( coll, c -> c[ 2 ] ) );
if d mod 5 = 0 then
m := 1;
for c in coll do
m := m * c[ 1 ] ^ ( c[ 2 ] / d );
od;
if m >= 5 then
shortcut := false;
fi;
fi;
fi;
if shortcut then
ds := DerivedSeriesOfGroup( G );
return ds[ Length( ds ) ];
fi;
fi;
coll := Collected( FactorsInt( Size( G ) ) );
if deg < 78125 then
p := coll[ Length( coll ) ][ 1 ];
else
i := Length( coll );
while coll[ i ][ 2 ] = 1 do
i := i - 1;
od;
p := coll[ i ][ 1 ];
fi;
repeat
repeat
z := Random( G );
ord := Order( z );
until ord mod p = 0;
z := z ^ ( ord / p );
until Index( G, Centralizer( G, z ) ) mod p <> 0;
L := NormalClosure( G, SubgroupNC( G, [ z ] ) );
if deg >= 78125 then
ds := DerivedSeriesOfGroup( L );
L := ds[ Length( ds ) ];
fi;
if IsSemiRegular( L, Omega ) then
L := ClosureSubgroup( L, Centralizer( G, L ) );
fi;
return L;
end );
#############################################################################
##
#M FrattiniSubgroup( <G> ) . . . . . . . . . . . . for permutation p-groups
##
InstallMethod( FrattiniSubgroup,"for permgrp", true, [ IsPermGroup ], 0,
function( G )
local fac, p, l, k, i, j;
fac := Set( FactorsInt( Size( G ) ) );
if Length( fac ) > 1 then
TryNextMethod();
elif fac[1]=1 then
return G;
fi;
p := fac[ 1 ];
l := GeneratorsOfGroup( G );
k := [ l[1]^p ];
for i in [ 2 .. Length(l) ] do
for j in [ 1 .. i-1 ] do
Add(k, Comm(l[i], l[j]));
od;
Add(k, l[i]^p);
od;
return SolvableNormalClosurePermGroup( G, k );
end );
#############################################################################
##
#M ApproximateSuborbitsStabilizerPermGroup(<G>,<pnt>) . . . approximation of
## the orbits of Stab_G(pnt) on all points of the orbit pnt^G. (As not
## all schreier generators are used, the results may be the orbits of a
## subgroup.)
##
InstallGlobalFunction( ApproximateSuborbitsStabilizerPermGroup,
function(G,punkt)
local one, orbit, trans, stab, gen, pnt, img, norb, no, i, j, changed,
processStabGen, StabGenAvailable, stgp, orblen, gens;
one:= One( G );
if HasStabChainMutable( G ) and punkt in StabChainMutable(G).orbit then
# if we already have a stab chain and bother computing the proper
# stabilizer, a trivial orbit algorithm seems best.
return Concatenation([[punkt]],
OrbitsDomain(Stabilizer(G,punkt),
Difference(MovedPoints(G),[punkt])));
# orbit:=Difference(StabChainMutable(G).orbit,[punkt]);
# stab:=Stabilizer(G,punkt));
# # catch trivial case
# if Length(stab)=0 then
# stab:=[ one ];
# fi;
# stgp:=1;
#
# processStabGen:=function()
# stgp:=stgp+1;
# if stgp>Length(stab) then
# StabGenAvailable:=false;
# fi;
# return stab[stgp-1];
# end;
else
# compute orbit and transversal
orbit := [ punkt ];
trans := [];
trans[ punkt ] := one;
stab:=[];
for pnt in orbit do
for gen in GeneratorsOfGroup(G) do
img:=pnt/gen;
if not IsBound( trans[ img ] ) then
Add( orbit, img );
trans[ img ] := gen;
fi;
od;
od;
orblen:=Length(orbit);
orbit:=orbit{[2..Length(orbit)]};
processStabGen:=function()
i:=orblen;
gen:= one;
while 1<=i do
gen:=gen*Random(GeneratorsOfGroup(G));
i:=QuoInt(i,2);
od;
while punkt^gen<>punkt do
gen:=gen*trans[punkt^gen];
od;
return gen;
end;
fi;
StabGenAvailable:=true;
# as the first approximation take a subgroup generated by three nontrivial
# Schreier generators
changed:=0;
gens:=[];
while changed<=3 and StabGenAvailable do
gen:=processStabGen();
if gen = one then
if Random([1..10])>1 then
changed:=changed+1;
fi;
else
changed:=changed+1;
Add(gens,gen);
fi;
od;
if Length(gens)=0 then
orbit:=List(orbit,i->[i]);
else
orbit:=OrbitsPerms(gens,orbit);
fi;
orbit:=List(orbit,i->Immutable(Set(i)));
#trivial case
if Length(orbit)=0 then
changed:=infinity;
else
changed:=0;
fi;
# compute suborbits, fusing iteratively under generators
while changed<=2 and StabGenAvailable do
gen:=processStabGen();
if gen = one then
if Random([1..10])>1 then
changed:=changed+1;
fi;
else
changed:=changed+1;
# fuse under gen-action
norb:=[];
for i in [1..Length(orbit)] do
if IsBound(orbit[i]) then
no:=ShallowCopy(orbit[i]);
Unbind(orbit[i]);
i:=i+1;
for pnt in no do
img:=pnt^gen;
if not img in no then
img:=First([i..Length(orbit)],j->IsBound(orbit[j])
and img in orbit[j]);
if img<>fail then
changed:=0;
UniteSet(no,orbit[img]);
Unbind(orbit[img]);
fi;
fi;
od;
Add(norb,Immutable(no));
fi;
od;
orbit:=norb;
fi;
od;
return Concatenation([[punkt]],orbit);
end );
#############################################################################
##
#M AllBlocks . . . Representatives of all block systems
##
InstallMethod( AllBlocks, "generic", [ IsPermGroup ],
function(g)
local gens, one, dom,DoBlocks,pool,subo;
DoBlocks:=function(b)
local bl,bld,i,t,n;
# find representatives of all potential suborbits
bld:=List(Filtered(subo,i->not ForAny(b,j->j in i)),i->i[1]);
bl:=[];
if not IsPrime(Length(dom)/Length(b)) then
for i in bld do
t:=Union(b,[i]);
n:=Blocks(g,dom,t);
if Length(n)>1 and #ok durch pool:ForAll(Difference(n[1],t),j->j>i) and
not n[1] in pool then
t:=n[1];
Add(pool,t);
bl:=Concatenation(bl,[t],DoBlocks(t));
fi;
od;
fi;
return bl;
end;
one:= One( g );
gens:= Filtered( GeneratorsOfGroup(g), i -> i <> one );
if Length(gens)=0 then return []; fi;
subo:=ApproximateSuborbitsStabilizerPermGroup(g,
Minimum(List(gens,SmallestMovedPoint)));
dom:=Union(subo);
pool:=[];
return DoBlocks(subo[1]);
end);
#############################################################################
##
#F SignPermGroup
##
InstallGlobalFunction( SignPermGroup, function(g)
if ForAll(GeneratorsOfGroup(g),i->SignPerm(i)=1) then
return 1;
else
return -1;
fi;
end );
CreateAllCycleStructures := function(n)
local i,j,l,m;
l:=[];
for i in Partitions(n) do
m:=[];
for j in i do
if j>1 then
if IsBound(m[j-1]) then
m[j-1]:=m[j-1]+1;
else
m[j-1]:=1;
fi;
fi;
od;
Add(l,m);
od;
return l;
end;
#############################################################################
##
#F CycleStructuresGroup(G) list of all cyclestructures occ. in a perm group
##
InstallGlobalFunction( CycleStructuresGroup, function(g)
local l,m,i, one;
l:=CreateAllCycleStructures(Length(MovedPoints(g)));
m:=List([1..Length(l)-1],i->0);
one:= One( g );
for i in ConjugacyClasses(g) do
if Representative(i) <> one then
m[Position(l,CycleStructurePerm(Representative(i)))-1]:=1;
fi;
od;
return m;
end );
#############################################################################
##
#M SmallGeneratingSet(<G>)
##
InstallMethod(SmallGeneratingSet,"random and generators subset, randsims",true,
[IsPermGroup],0,
function (G)
local i, j, U, gens,o,v,a,sel;
# remove obvious redundancies
gens := ShallowCopy(Set(GeneratorsOfGroup(G)));
o:=List(gens,Order);
SortParallel(o,gens,function(a,b) return a>b;end);
sel:=Filtered([1..Length(gens)],x->o[x]>1);
for i in [1..Length(gens)] do
if i in sel then
U:=Filtered(sel,x->x>i and IsInt(o[i]/o[x])); # potential powers
v:=[];
for j in U do
a:=SmallestMovedPoint(gens[j]);
if IsSubset(OrbitPerms([gens[i]],a),OrbitPerms([gens[j]],a)) then
Add(v,j);
fi;
od;
# v are the possible powers
for j in v do
a:=gens[i]^(o[i]/o[j]);
if ForAny(Filtered([1..o[j]],z->Gcd(z,o[j])=1),x->a^x=gens[j]) then
RemoveSet(sel,j);
fi;
od;
fi;
od;
gens:=gens{sel};
# try pc methods first
if Length(MovedPoints(G))<1000 and HasIsSolvableGroup(G)
and IsSolvableGroup(G) and Length(gens)>3 then
return MinimalGeneratingSet(G);
fi;
if Length(gens)>2 then
i:=2;
while i<=3 and i<Length(gens) do
# try to find a small generating system by random search
j:=1;
while j<=5 and i<Length(gens) do
U:=Subgroup(G,List([1..i],j->Random(G)));
StabChain(U,rec(random:=1));
if Size(U)=Size(G) then
gens:=Set(GeneratorsOfGroup(U));
fi;
j:=j+1;
od;
i:=i+1;
od;
fi;
i := 1;
if not IsAbelian(G) then
i:=i+1;
fi;
while i < Length(gens) do
# random did not improve much, try subsets
U:=Subgroup(G,gens{Difference([1..Length(gens)],[i])});
if Size(U)<Size(G) then
i:=i+1;
else
gens:=Set(GeneratorsOfGroup(U));
fi;
od;
return gens;
end);
#############################################################################
##
#M GeneratorsSmallest(<G>) . . . . . . . . . . . . . for permutation groups
##
DeclareGlobalFunction( "GeneratorsSmallestStab" );
InstallGlobalFunction( GeneratorsSmallestStab, function ( S )
local gens, # smallest generating system of <S>, result
gen, # one generator in <gens>
orb, # basic orbit of <S>
pnt, # one point in <orb>
T, # stabilizer in <S>
o2,img,oo,og; # private orbit algorithm
# handle the anchor case
if Length(S.generators) = 0 then
return [];
fi;
# now get the smallest generating system of the stabilizer
gens := GeneratorsSmallestStab( S.stabilizer );
# get the sorted orbit (the basepoint will be the first point)
orb := Set( S.orbit );
SubtractSet( orb, [S.orbit[1]] );
# handle the other points in the orbit
while Length(orb) <> 0 do
# take the smallest point (coset) and one representative
pnt := orb[1];
gen := S.identity;
while S.orbit[1] ^ gen <> pnt do
gen := LeftQuotient( S.transversal[ pnt / gen ], gen );
od;
# the next generator is the smallest element in this coset
T := S.stabilizer;
while Length(T.generators) <> 0 do
pnt := Minimum( OnTuples( T.orbit, gen ) );
while T.orbit[1] ^ gen <> pnt do
gen := LeftQuotient( T.transversal[ pnt / gen ], gen );
od;
T := T.stabilizer;
od;
# add this generator to the generators list and reduce orbit
Add( gens, gen );
#SubtractSet( orb,
# Orbit( GroupByGenerators( gens, S.identity ), S.orbit[1] ) );
# here we want to be really fast, so use a private orbit algorithm
o2:=[S.orbit[1]];
RemoveSet(orb,S.orbit[1]);
for oo in o2 do
for og in gens do
img:=oo^og;
if img in orb then
Add(o2,img);
RemoveSet(orb,img);
fi;
od;
od;
od;
# return the smallest generating system
return gens;
end );
InstallMethod(GeneratorsSmallest,"perm group via minimal stab chain",
[IsPermGroup],
function(G)
# call the recursive function to do the work
return GeneratorsSmallestStab(MinimalStabChain(G));
end);
InstallMethod(LargestElementGroup,"perm group via minimal stab chain",
[IsPermGroup],
# call the recursive function to do the work
G -> LargestElementStabChain( MinimalStabChain( G ), One( G ) ) );
#############################################################################
##
#M KnowsHowToDecompose( <G>, <gens> )
##
InstallMethod(KnowsHowToDecompose,
"perm group and generators: always true",
IsIdenticalObj,
[ IsPermGroup, IsList ],
ReturnTrue);
#############################################################################
##
#M ViewObj( <G> )
##
InstallMethod( ViewObj,
"for a permutation group",
true,
[ IsPermGroup and HasGeneratorsOfGroup ], 0,
function(G)
local gens;
gens:= GeneratorsOfGroup( G );
if 30 < Length( gens ) * LargestMovedPoint( G ) / GAPInfo.ViewLength then
Print("<permutation group");
if HasSize(G) then
Print(" of size ",Size(G));
fi;
Print( " with ", Length( gens ), " generators>" );
else
Print("Group(");
if IsEmpty( gens ) or ForAll(gens,i->Order(i)=1) then
ViewObj( One( G ) );
else
ViewObj( gens );
fi;
Print(")");
fi;
end);
#############################################################################
##
#M AsList( <G> ) elements of perm group
##
InstallMethod( AsList,"permgp: AsSSortedList", true,
[ IsPermGroup ], 0, AsSSortedList );
#############################################################################
##
#M AsSSortedList( <G> ) elements of perm group
##
InstallMethod( AsSSortedList,"via stabchain",true, [ IsPermGroup ], 0,
function( G )
return ElementsStabChain( StabChainMutable(G));
end );
InstallMethod( AsSSortedListNonstored,"via stabchain", true, [ IsPermGroup ], 0,
function( G )
return ElementsStabChain( StabChainMutable(G));
end );
#############################################################################
##
#M ONanScottType( <G> )
##
InstallMethod(ONanScottType,"primitive permgroups",true,[IsPermGroup],0,
function(G)
local dom,s,cs,t,ts,o;
dom:=MovedPoints(G);
if not IsPrimitive(G,dom) then
Error("<G> must be primitive");
fi;
s:=Socle(G);
if IsAbelian(s) then
return "1";
elif IsSimpleGroup(s) then
return "2";
elif Length(dom)=Size(s) then
return "5";
else
# now get one simple factor of the socle
cs:=CompositionSeries(s);
# if the group is diagonal, the diagonal together with a maximal socle
# normal subgroup generates the whole socle, so this normal subgroup
# acts transitively. For product type this is not the case.
t:=cs[Length(cs)-1];
if IsTransitive(t,dom) then
# type 3
if Length(cs)=3 and IsNormal(G,t) then
# intransitive on 2 components:
return "3a";
else
return "3b";
fi;
else
# type 4
ts:=Orbit(G,t);
if Length(ts)=2 and NormalClosure(G,t)<>s then
return "4a";
fi;
# find the block on the T's first: Those t which keep the orbit are
# glued together diagonally
o:=Orbit(t,dom[1]);
ts:=Filtered(ts,i->i=t or IsSubset(o,Orbit(i,dom[1])));
if Length(ts)=1 then
return "4c";
else
return "4b";
fi;
fi;
fi;
end);
#############################################################################
##
#M SocleTypePrimitiveGroup( <G> )
##
InstallMethod(SocleTypePrimitiveGroup,"primitive permgroups",true,
[IsPermGroup],0,function(G)
local s,cs,t,id,r;
s:=Socle(G);
cs:=CompositionSeries(s);
t:=cs[Length(cs)-1];
id:=IsomorphismTypeInfoFiniteSimpleGroup(t);
r:=rec(series:=id.series,
width:=Length(cs)-1,
name:=id.name);
if IsBound(id.parameter) then
r.parameter:=id.parameter;
else
r.parameter:=id.name;
fi;
return r;
end);
# this function is needed for the transitive and primitive groups libraries
BindGlobal("STGSelFunc",function(a,b)
if IsFunction(b) then
return b(a);
elif IsList(b) and not IsString(b) then
if IsList(a) and a=b then
return true;
fi;
return a in b;
else
return a=b;
fi;
end);
InstallGlobalFunction(DiagonalSocleAction,function(g,nr)
local ran,d,emb,u,act;
ran:=[1..nr];
d:=DirectProduct(List(ran,i->g));
emb:=List(ran,i->Embedding(d,i));
u:=List(GeneratorsOfGroup(g),i->Product(ran,j->Image(emb[j],i)));
u:=SubgroupNC(d,u);
act:=ActionHomomorphism(d,RightTransversal(d,u),OnRight,"surjective");
return Image(act,d);
end);
InstallGlobalFunction(ReducedPermdegree,function(g)
local dom, deg, orb, gdeg, p, ndom, s,hom;
dom:=MovedPoints(g);
deg:=Length(dom);
orb:=ShallowCopy(Orbits(g,dom));
if Length(orb)=1 then return fail;fi;
gdeg:=20*LogInt(Size(g),2); # good degree
Sort(orb,function(a,b) return Length(a)<Length(b);end);
p:=PositionProperty(orb,i->Length(i)>=gdeg);
if p=fail then p:=Length(orb);fi;
ndom:=orb[p];
if Length(ndom)*2>Length(dom) then return fail;fi;
s:=Stabilizer(g,orb[p],OnTuples);
p:=p+1;
if p>Length(orb) then p:=1;fi;
while Size(s)>1 do
while not ForAny(orb[p],j->ForAny(GeneratorsOfGroup(s),k->j^k<>j)) do
p:=p+1;
if p>Length(orb) then p:=1;fi;
od;
ndom:=Union(ndom,orb[p]);
s:=Stabilizer(s,orb[p],OnTuples);
od;
if Length(ndom)*2>Length(dom) then return fail;fi;
hom:=ActionHomomorphism(g,ndom,"surjective");
SetIsInjective(hom,true);
SetSize(Image(hom),Size(g));
return hom;
end);
#############################################################################
##
#E
|