/usr/share/gap/doc/ref/chap54.html is in gap-doc 4r7p9-1.
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 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>GAP (ref) - Chapter 54: Partial permutations</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="generator" content="GAPDoc2HTML" />
<link rel="stylesheet" type="text/css" href="manual.css" />
<script src="manual.js" type="text/javascript"></script>
<script type="text/javascript">overwriteStyle();</script>
</head>
<body class="chap54" onload="jscontent()">
<div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a> <a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="chap5.html">5</a> <a href="chap6.html">6</a> <a href="chap7.html">7</a> <a href="chap8.html">8</a> <a href="chap9.html">9</a> <a href="chap10.html">10</a> <a href="chap11.html">11</a> <a href="chap12.html">12</a> <a href="chap13.html">13</a> <a href="chap14.html">14</a> <a href="chap15.html">15</a> <a href="chap16.html">16</a> <a href="chap17.html">17</a> <a href="chap18.html">18</a> <a href="chap19.html">19</a> <a href="chap20.html">20</a> <a href="chap21.html">21</a> <a href="chap22.html">22</a> <a href="chap23.html">23</a> <a href="chap24.html">24</a> <a href="chap25.html">25</a> <a href="chap26.html">26</a> <a href="chap27.html">27</a> <a href="chap28.html">28</a> <a href="chap29.html">29</a> <a href="chap30.html">30</a> <a href="chap31.html">31</a> <a href="chap32.html">32</a> <a href="chap33.html">33</a> <a href="chap34.html">34</a> <a href="chap35.html">35</a> <a href="chap36.html">36</a> <a href="chap37.html">37</a> <a href="chap38.html">38</a> <a href="chap39.html">39</a> <a href="chap40.html">40</a> <a href="chap41.html">41</a> <a href="chap42.html">42</a> <a href="chap43.html">43</a> <a href="chap44.html">44</a> <a href="chap45.html">45</a> <a href="chap46.html">46</a> <a href="chap47.html">47</a> <a href="chap48.html">48</a> <a href="chap49.html">49</a> <a href="chap50.html">50</a> <a href="chap51.html">51</a> <a href="chap52.html">52</a> <a href="chap53.html">53</a> <a href="chap54.html">54</a> <a href="chap55.html">55</a> <a href="chap56.html">56</a> <a href="chap57.html">57</a> <a href="chap58.html">58</a> <a href="chap59.html">59</a> <a href="chap60.html">60</a> <a href="chap61.html">61</a> <a href="chap62.html">62</a> <a href="chap63.html">63</a> <a href="chap64.html">64</a> <a href="chap65.html">65</a> <a href="chap66.html">66</a> <a href="chap67.html">67</a> <a href="chap68.html">68</a> <a href="chap69.html">69</a> <a href="chap70.html">70</a> <a href="chap71.html">71</a> <a href="chap72.html">72</a> <a href="chap73.html">73</a> <a href="chap74.html">74</a> <a href="chap75.html">75</a> <a href="chap76.html">76</a> <a href="chap77.html">77</a> <a href="chap78.html">78</a> <a href="chap79.html">79</a> <a href="chap80.html">80</a> <a href="chap81.html">81</a> <a href="chap82.html">82</a> <a href="chap83.html">83</a> <a href="chap84.html">84</a> <a href="chap85.html">85</a> <a href="chap86.html">86</a> <a href="chap87.html">87</a> <a href="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
<div class="chlinkprevnexttop"> <a href="chap0.html">[Top of Book]</a> <a href="chap0.html#contents">[Contents]</a> <a href="chap53.html">[Previous Chapter]</a> <a href="chap55.html">[Next Chapter]</a> </div>
<p id="mathjaxlink" class="pcenter"><a href="chap54_mj.html">[MathJax on]</a></p>
<p><a id="X7D6495F77B8A77BD" name="X7D6495F77B8A77BD"></a></p>
<div class="ChapSects"><a href="chap54.html#X7D6495F77B8A77BD">54 <span class="Heading">Partial permutations</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap54.html#X87B0D6657A3F2B0E">54.1 <span class="Heading">The family and categories of partial permutations</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7EECE133792B30FC">54.1-1 IsPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X8262A827790DD1CC">54.1-2 IsPartialPermCollection</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7E63D17780F64FBA">54.1-3 PartialPermFamily</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap54.html#X7B9D451D7FDA1DD8">54.2 <span class="Heading">Creating partial permutations</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X8538BAE77F2FB2F8">54.2-1 PartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X81188D9F83F64222">54.2-2 PartialPermOp</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X80ABBF4883C79060">54.2-3 RestrictedPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X849668DD7B0B9E3B">54.2-4 JoinOfPartialPerms</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X81E2B6977E28CD00">54.2-5 MeetOfPartialPerms</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X80EFB142817A0A9F">54.2-6 EmptyPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7E6ADC8583C31530">54.2-7 <span class="Heading">RandomPartialPerm</span></a>
</span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap54.html#X8779F0997D0FDA78">54.3 <span class="Heading">Attributes for partial permutations</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X8612A4DC864E7959">54.3-1 DegreeOfPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X8413D0EF7DEE1FFF">54.3-2 CodegreeOfPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7C1ABD8A80E95B39">54.3-3 RankOfPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X784A14F787E041D7">54.3-4 DomainOfPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7CD84B107831E0FC">54.3-5 ImageOfPartialPermCollection</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X8333293F87F654FA">54.3-6 ImageListOfPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7F0724A07A14DCF7">54.3-7 ImageSetOfPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X82AAFF938623422E">54.3-8 FixedPointsOfPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X82FE981A87FAA2DC">54.3-9 MovedPoints</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7FAF969C84CDC742">54.3-10 NrFixedPoints</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X81F5C64E7DAD27A7">54.3-11 NrMovedPoints</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X84A49C977E1E29AA">54.3-12 SmallestMovedPoint</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7D4290A785ABC86D">54.3-13 LargestMovedPoint</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X85280F1A7B1014BA">54.3-14 SmallestImageOfMovedPoint</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7A95CD437BC1CB1A">54.3-15 LargestImageOfMovedPoint</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X873A9F717DA75CBC">54.3-16 IndexPeriodOfPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7C04AA377F080722">54.3-17 SmallestIdempotentPower</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X8185065E788BDD0D">54.3-18 ComponentsOfPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7CB51EB67FFA95E9">54.3-19 NrComponentsOfPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7AAAAE4082B30E18">54.3-20 ComponentRepsOfPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7A8FB86C78C49F85">54.3-21 LeftOne</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X857FC10C81507E8B">54.3-22 One</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X83B6AE4881C7253B">54.3-23 Zero</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap54.html#X8585AA8B78E9CDFB">54.4 <span class="Heading">Changing the representation of a partial permutation</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X81B32CB182489ACA">54.4-1 AsPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X87EC67747B260E98">54.4-2 AsPartialPerm</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap54.html#X848CD855802C6CE1">54.5 <span class="Heading">Operators and operations for partial permutations</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X8382A0F8875CEB08">54.5-1 PermLeftQuoPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7C7F5EAB7E9A381D">54.5-2 PreImagePartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X797A6CC084068219">54.5-3 ComponentPartialPermInt</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X87B1ED93785257C1">54.5-4 NaturalLeqPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X81BD69307D294A1C">54.5-5 ShortLexLeqPartialPerm</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X83560BE678ACF855">54.5-6 TrimPartialPerm</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap54.html#X7849595B81D063EE">54.6 <span class="Heading">Displaying partial permutations</span></a>
</span>
</div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap54.html#X7CCC82E07A73EB55">54.7 <span class="Heading">Semigroups and inverse semigroups of partial permutations</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7D161674800B50E0">54.7-1 IsPartialPermSemigroup</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7D7F0BAB82F0D820">54.7-2 DegreeOfPartialPermSemigroup</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X81D271B380995F8A">54.7-3 SymmetricInverseSemigroup</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7C8AEA50834060DD">54.7-4 IsSymmetricInverseSemigroup</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X7EA51F087CF7621F">54.7-5 NaturalPartialOrder</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap54.html#X857F68DF7EDA3BE4">54.7-6 IsomorphismPartialPermMonoid</a></span>
</div></div>
</div>
<h3>54 <span class="Heading">Partial permutations</span></h3>
<p>This chapter describes the functions in <strong class="pkg">GAP</strong> for partial permutations.</p>
<p>A <em>partial permutation</em> in <strong class="pkg">GAP</strong> is simply an injective function from any finite set of positive integers to any other finite set of positive integers. The largest point on which a partial permutation can be defined, and the largest value that the image of such a point can have, are defined by certain architecture dependent limits.</p>
<p>Every inverse semigroup is isomorphic to an inverse semigroup of partial permutations and, as such, partial permutations are to inverse semigroup theory what permutations are to group theory and transformations are to semigroup theory. In this way, partial permutations are the elements of inverse partial permutation semigroups.</p>
<p>A partial permutations in <strong class="pkg">GAP</strong> acts on a finite set of positive integers on the right. The image of a point <code class="code">i</code> under a partial permutation <code class="code">f</code> is expressed as <code class="code">i^f</code> in <strong class="pkg">GAP</strong>. This action is also implemented by the function <code class="func">OnPoints</code> (<a href="chap41.html#X7FE417DD837987B4"><span class="RefLink">41.2-1</span></a>). The preimage of a point <code class="code">i</code> under the partial permutation <code class="code">f</code> can be computed using <code class="code">i/f</code> without constructing the inverse of <code class="code">f</code>. Partial permutations in <strong class="pkg">GAP</strong> are created using the operations described in Section <a href="chap54.html#X7B9D451D7FDA1DD8"><span class="RefLink">54.2</span></a>. Partial permutations are, by default, displayed in component notation, which is described in Section <a href="chap54.html#X7849595B81D063EE"><span class="RefLink">54.6</span></a>.</p>
<p>The fundamental attributes of a partial permutation are:</p>
<dl>
<dt><strong class="Mark">Domain</strong></dt>
<dd><p>The <em>domain</em> of a partial permutation is just the set of positive integers where it is defined; see <code class="func">DomainOfPartialPerm</code> (<a href="chap54.html#X784A14F787E041D7"><span class="RefLink">54.3-4</span></a>). We will denote the domain of a partial permutation <code class="code">f</code> by dom(<code class="code">f</code>).</p>
</dd>
<dt><strong class="Mark">Degree</strong></dt>
<dd><p>The <em>degree</em> of a partial permutation <code class="code">f</code> is just the largest positive integer where <code class="code">f</code> is defined. In other words, the degree of <code class="code">f</code> is the largest element in the domain of <code class="code">f</code>; see <code class="func">DegreeOfPartialPerm</code> (<a href="chap54.html#X8612A4DC864E7959"><span class="RefLink">54.3-1</span></a>).</p>
</dd>
<dt><strong class="Mark">Image list</strong></dt>
<dd><p>The <em>image list</em> of a partial permutation <code class="code">f</code> is the list <code class="code">[i_1^f, i_2^f, .. , i_n^f]</code> where the domain of <code class="code">f</code> is <code class="code">[i_1, i_2, .., i_n]</code> see <code class="func">ImageListOfPartialPerm</code> (<a href="chap54.html#X8333293F87F654FA"><span class="RefLink">54.3-6</span></a>). For example, the partial perm sending <code class="code">1</code> to <code class="code">5</code> and <code class="code">2</code> to <code class="code">4</code> has image list <code class="code">[ 5, 4 ]</code>.</p>
</dd>
<dt><strong class="Mark">Image set</strong></dt>
<dd><p>The <em>image set</em> of a partial permutation <code class="code">f</code> is just the set of points in the image list (i.e. the image list after it has been sorted into increasing order); see <code class="func">ImageSetOfPartialPerm</code> (<a href="chap54.html#X7F0724A07A14DCF7"><span class="RefLink">54.3-7</span></a>). We will denote the image set of a partial permutation <code class="code">f</code> by im(<code class="code">f</code>).</p>
</dd>
<dt><strong class="Mark">Codegree</strong></dt>
<dd><p>The <em>codegree</em> of a partial permutation <code class="code">f</code> is just the largest positive integer of the form <code class="code">i^f</code> for any <code class="code">i</code> in the domain of <code class="code">f</code>. In other words, the codegree of <code class="code">f</code> is the largest element in the image of <code class="code">f</code>; see <code class="func">CodegreeOfPartialPerm</code> (<a href="chap54.html#X8413D0EF7DEE1FFF"><span class="RefLink">54.3-2</span></a>).</p>
</dd>
<dt><strong class="Mark">Rank</strong></dt>
<dd><p>The <em>rank</em> of a partial permutation <code class="code">f</code> is the size of its domain, or equivalently the size of its image set or image list; see <code class="func">RankOfPartialPerm</code> (<a href="chap54.html#X7C1ABD8A80E95B39"><span class="RefLink">54.3-3</span></a>).</p>
</dd>
</dl>
<p>A <em>functional digraph</em> is a directed graph where every vertex has out-degree <code class="code">1</code>. A partial permutation <var class="Arg">f</var> can be thought of as a functional digraph with vertices <code class="code">[1..DegreeOfPartialPerm(f)]</code> and edges from <code class="code">i</code> to <code class="code">i^f</code> for every <code class="code">i</code>. A <em>component</em> of a partial permutation is defined as a component of the corresponding functional digraph. More specifically, <code class="code">i</code> and <code class="code">j</code> are in the same component if and only if there are <span class="SimpleMath">i=v_0, v_1, ..., v_n=j</span> such that either <span class="SimpleMath">v_k+1=v_k^f</span> or <span class="SimpleMath">v_k=v_k+1^f</span> for all <code class="code">k</code>.</p>
<p>If <code class="code">S</code> is a semigroup and <code class="code">s</code> is an element of <code class="code">S</code>, then an element <code class="code">t</code> in <code class="code">S</code> is a <em>semigroup inverse</em> for <code class="code">s</code> if <code class="code">s*t*s=s</code> and <code class="code">t*s*t=t</code>; see, for example, <code class="func">InverseOfTransformation</code> (<a href="chap53.html#X860306EB7FAAD2D4"><span class="RefLink">53.5-13</span></a>). A semigroup in which every element has a unique semigroup inverse is called an <em>inverse semigroup</em>.</p>
<p>Every partial permutation belongs to a symmetric inverse monoid; see <code class="func">SymmetricInverseSemigroup</code> (<a href="chap54.html#X81D271B380995F8A"><span class="RefLink">54.7-3</span></a>). Inverse semigroups of partial permutations are hence inverse subsemigroups of the symmetric inverse monoids.</p>
<p>The inverse <code class="code">f^-1</code> of a partial permutation <code class="code">f</code> is simply the partial permutation that maps <code class="code">i^f</code> to <code class="code">i</code> for all <code class="code">i</code> in the image of <code class="code">f</code>. It follows that the domain of <code class="code">f^-1</code> equals the image of <code class="code">f</code> and that the image of <code class="code">f^-1</code> equals the domain of <code class="code">f</code>. The inverse <code class="code">f^-1</code> is the unique partial permutation with the property that <code class="code">f*f^-1*f=f</code> and <code class="code">f^-1*f*f^-1=f^-1</code>. In other words, <code class="code">f^-1</code> is the unique semigroup inverse of <code class="code">f</code> in the symmetric inverse monoid.</p>
<p>If <code class="code">f</code> and <code class="code">g</code> are partial permutations, then the domain and image of the product are:</p>
<p class="pcenter">
\textrm{dom}(fg)=(\textrm{im}(f)\cap \textrm{dom}(g))f^{-1}\textrm{ and }
\textrm{im}(fg)=(\textrm{im}(f)\cap \textrm{dom}(g))g
</p>
<p>A partial permutation is an idempotent if and only if it is the identity function on its domain. The products <code class="code">f*f^-1</code> and <code class="code">f^-1*f</code> are just the identity functions on the domain and image of <code class="code">f</code>, respectively. It follows that <code class="code">f*f^-1</code> is a left identity for <code class="code">f</code> and <code class="code">f^-1*f</code> is a right identity. These products will be referred to here as the <em>left one</em> and <em>right one</em> of the partial permutation <code class="code">f</code>; see <code class="func">LeftOne</code> (<a href="chap54.html#X7A8FB86C78C49F85"><span class="RefLink">54.3-21</span></a>). The <em>one</em> of a partial permutation is just the identity on the union of its domain and its image, and the <em>zero</em> of a partial permutation is just the empty partial permutation; see <code class="func">One</code> (<a href="chap54.html#X857FC10C81507E8B"><span class="RefLink">54.3-22</span></a>) and <code class="func">Zero</code> (<a href="chap54.html#X83B6AE4881C7253B"><span class="RefLink">54.3-23</span></a>).</p>
<p>If <code class="code">S</code> is an arbitrary inverse semigroup, the <em>natural partial order</em> on <code class="code">S</code> is defined as follows: for elements <code class="code">x</code> and <code class="code">y</code> of <code class="code">S</code> we say <code class="code">x</code><span class="SimpleMath">≤</span><code class="code">y</code> if there exists an idempotent element <code class="code">e</code> in <code class="code">S</code> such that <code class="code">x=ey</code>. In the context of the symmetric inverse monoid, a partial permutation <code class="code">f</code> is less than or equal to a partial permutation <code class="code">g</code> in the natural partial order if and only if <code class="code">f</code> is a restriction of <code class="code">g</code>. The natural partial order is a meet semilattice, in other words, every pair of elements has a greatest lower bound; see <code class="func">MeetOfPartialPerms</code> (<a href="chap54.html#X81E2B6977E28CD00"><span class="RefLink">54.2-5</span></a>).</p>
<p>Note that unlike permutations, partial permutations do not fix unspecified points but are simply undefined on such points; see Chapter <a href="chap42.html#X80F808307A2D5AB8"><span class="RefLink">42</span></a>. Similar to permutations, and unlike transformations, it is possible to multiply any two partial permutations in <strong class="pkg">GAP</strong>.</p>
<p>Internally, <strong class="pkg">GAP</strong> stores a partial permutation <code class="code">f</code> as a list consisting of the codegree of <code class="code">f</code> and the images <code class="code">i^f</code> of the points <code class="code">i</code> that are less than or equal to the degree of <code class="code">f</code>; the value <code class="code">0</code> is stored where <code class="code">i^f</code> is undefined. The domain and image set of <code class="code">f</code> are also stored after either of these values is computed. When the codegree of a partial permutation <code class="code">f</code> is less than 65536, the codegree and images <code class="code">i^f</code> are stored as 16-bit integers, the domain and image set are subobjects of <code class="code">f</code> which are immutable plain lists of <strong class="pkg">GAP</strong> integers. When the codegree of <code class="code">f</code> is greater than or equal to 65536, the codegree and images are stored as 32-bit integers; the domain and image set are stored in the same way as before. A partial permutation belongs to <code class="code">IsPPerm2Rep</code> if it is stored using 16-bit integers and to <code class="code">IsPPerm4Rep</code> otherwise.</p>
<p>In the names of the <strong class="pkg">GAP</strong> functions that deal with partial permutations, the word "Permutation" is usually abbreviated to "Perm", to save typing. For example, the category test function for partial permutations is <code class="func">IsPartialPerm</code> (<a href="chap54.html#X7EECE133792B30FC"><span class="RefLink">54.1-1</span></a>).</p>
<p><a id="X87B0D6657A3F2B0E" name="X87B0D6657A3F2B0E"></a></p>
<h4>54.1 <span class="Heading">The family and categories of partial permutations</span></h4>
<p><a id="X7EECE133792B30FC" name="X7EECE133792B30FC"></a></p>
<h5>54.1-1 IsPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsPartialPerm</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>Returns: <code class="keyw">true</code> or <code class="keyw">false</code>.</p>
<p>Every partial permutation in <strong class="pkg">GAP</strong> belongs to the category <code class="code">IsPartialPerm</code>. Basic operations for partial permutations are <code class="func">DomainOfPartialPerm</code> (<a href="chap54.html#X784A14F787E041D7"><span class="RefLink">54.3-4</span></a>), <code class="func">ImageListOfPartialPerm</code> (<a href="chap54.html#X8333293F87F654FA"><span class="RefLink">54.3-6</span></a>), <code class="func">ImageSetOfPartialPerm</code> (<a href="chap54.html#X7F0724A07A14DCF7"><span class="RefLink">54.3-7</span></a>), <code class="func">RankOfPartialPerm</code> (<a href="chap54.html#X7C1ABD8A80E95B39"><span class="RefLink">54.3-3</span></a>), <code class="func">DegreeOfPartialPerm</code> (<a href="chap54.html#X8612A4DC864E7959"><span class="RefLink">54.3-1</span></a>), multiplication of two partial permutations is via <code class="keyw">*</code>, and exponentiation with the first argument a positive integer <code class="code">i</code> and second argument a partial permutation <code class="code">f</code> where the result is the image <code class="code">i^f</code> of the point <code class="code">i</code> under <code class="code">f</code>. The inverse of a partial permutation <code class="code">f</code> can be obtains using <code class="code">f^-1</code>.</p>
<p><a id="X8262A827790DD1CC" name="X8262A827790DD1CC"></a></p>
<h5>54.1-2 IsPartialPermCollection</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsPartialPermCollection</code>( <var class="Arg">obj</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>Every collection of partial permutations belongs to the category <code class="code">IsPartialPermCollection</code>. For example, a semigroup of partial permutations belongs in <code class="code">IsPartialPermCollection</code>.</p>
<p><a id="X7E63D17780F64FBA" name="X7E63D17780F64FBA"></a></p>
<h5>54.1-3 PartialPermFamily</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ PartialPermFamily</code></td><td class="tdright">( family )</td></tr></table></div>
<p>The family of all partial permutations is <code class="code">PartialPermFamily</code></p>
<p><a id="X7B9D451D7FDA1DD8" name="X7B9D451D7FDA1DD8"></a></p>
<h4>54.2 <span class="Heading">Creating partial permutations</span></h4>
<p>There are several ways of creating partial permutations in <strong class="pkg">GAP</strong>, which are described in this section.</p>
<p><a id="X8538BAE77F2FB2F8" name="X8538BAE77F2FB2F8"></a></p>
<h5>54.2-1 PartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ PartialPerm</code>( <var class="Arg">dom</var>, <var class="Arg">img</var> )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ PartialPerm</code>( <var class="Arg">list</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: A partial permutation.</p>
<p>Partial permutations can be created in two ways: by giving the domain and the image, or the dense image list.</p>
<dl>
<dt><strong class="Mark">Domain and image</strong></dt>
<dd><p>The partial permutation defined by a domain <var class="Arg">dom</var> and image <var class="Arg">img</var>, where <var class="Arg">dom</var> is a set of positive integers and <var class="Arg">img</var> is a duplicate free list of positive integers, maps <var class="Arg">dom</var><code class="code">[i]</code> to <var class="Arg">img</var><code class="code">[i]</code>. For example, the partial permutation mapping <code class="code">1</code> and <code class="code">5</code> to <code class="code">20</code> and <code class="code">2</code> can be created using:</p>
<div class="example"><pre>PartialPerm([1,5],[20,2]); </pre></div>
<p>In this setting, <code class="code">PartialPerm</code> is the analogue in the context of partial permutations of <code class="func">MappingPermListList</code> (<a href="chap42.html#X8087DCC780B9656A"><span class="RefLink">42.5-3</span></a>).</p>
</dd>
<dt><strong class="Mark">Dense image list</strong></dt>
<dd><p>The partial permutation defined by a dense image list <var class="Arg">list</var>, maps the positive integer <code class="code">i</code> to <var class="Arg">list</var><code class="code">[i]</code> if <var class="Arg">list</var><code class="code">[i]<>0</code> and is undefined at <code class="code">i</code> if <var class="Arg">list</var><code class="code">[i]=0</code>. For example, the partial permutation mapping <code class="code">1</code> and <code class="code">5</code> to <code class="code">20</code> and <code class="code">2</code> can be created using:</p>
<div class="example"><pre>PartialPerm([20,0,0,0,2]);</pre></div>
<p>In this setting, <code class="code">PartialPerm</code> is the analogue in the context of partial permutations of <code class="func">PermList</code> (<a href="chap42.html#X78D611D17EA6E3BC"><span class="RefLink">42.5-2</span></a>).</p>
</dd>
</dl>
<p>Regardless of which of these two methods are used to create a partial permutation in <strong class="pkg">GAP</strong> the internal representation is the same.</p>
<p>If the largest point in the domain is larger than the rank of the partial permutation, then using the dense image list to define the partial permutation will require less typing; otherwise using the domain and the image will require less typing. For example, the partial permutation mapping <code class="code">10000</code> to <code class="code">1</code> can be defined using:</p>
<div class="example"><pre>PartialPerm([10000], [1]);</pre></div>
<p>but using the dense image list would require a list with <code class="code">9999</code> entries equal to <code class="code">0</code> and the final entry equal to <code class="code">1</code>. On the other hand, the identity on <code class="code">[1,2,3,4,6]</code> can be defined using:</p>
<div class="example"><pre>PartialPerm([1,2,3,4,0,6]);</pre></div>
<p>Please note that a partial permutation in <strong class="pkg">GAP</strong> is never a permutation nor is a permutation ever a partial permutation. For example, the permutation <code class="code">(1,4,2)</code> fixes <code class="code">3</code> but the partial permutation <code class="code">PartialPerm([4,1,0,2]);</code> is not defined on <code class="code">3</code>.</p>
<p><a id="X81188D9F83F64222" name="X81188D9F83F64222"></a></p>
<h5>54.2-2 PartialPermOp</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ PartialPermOp</code>( <var class="Arg">obj</var>, <var class="Arg">list</var>[, <var class="Arg">func</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ PartialPermOpNC</code>( <var class="Arg">obj</var>, <var class="Arg">list</var>[, <var class="Arg">func</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: A partial permutation or <code class="keyw">fail</code>.</p>
<p><code class="code">PartialPermOp</code> returns the partial permutation that corresponds to the action of the object <var class="Arg">obj</var> on the domain or list <var class="Arg">list</var> via the function <var class="Arg">func</var>. If the optional third argument <var class="Arg">func</var> is not specified, then the action <code class="func">OnPoints</code> (<a href="chap41.html#X7FE417DD837987B4"><span class="RefLink">41.2-1</span></a>) is used by default. Note that the returned partial permutation refers to the positions in <var class="Arg">list</var> even if <var class="Arg">list</var> itself consists of integers.</p>
<p>This function is the analogue in the context of partial permutations of <code class="func">Permutation</code> (<a href="../../doc/ref/chap41.html#X7807A33381DCAB26"><span class="RefLink">Reference: Permutation</span></a>) or <code class="func">TransformationOp</code> (<a href="chap53.html#X7C2A3FC9782F2099"><span class="RefLink">53.2-5</span></a>).</p>
<p>If <var class="Arg">obj</var> does not map the elements of <var class="Arg">list</var> injectively, then <code class="keyw">fail</code> is returned.</p>
<p><code class="code">PartialPermOpNC</code> does not check that <var class="Arg">obj</var> maps elements of <var class="Arg">list</var> injectively or that a partial permutation is defined by the action of <var class="Arg">obj</var> on <var class="Arg">list</var> via <var class="Arg">func</var>. This function should be used only with caution, in situations where it is guaranteed that the arguments have the required properties.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=Transformation( [ 9, 10, 4, 2, 10, 5, 9, 10, 9, 6 ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">PartialPermOp(f, [ 6 .. 8 ], OnPoints);</span>
[1,4][2,5][3,6]</pre></div>
<p><a id="X80ABBF4883C79060" name="X80ABBF4883C79060"></a></p>
<h5>54.2-3 RestrictedPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RestrictedPartialPerm</code>( <var class="Arg">f</var>, <var class="Arg">set</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A partial permutation.</p>
<p><code class="code">RestrictedPartialPerm</code> returns a new partial permutation that acts on the points in the set of positive integers <var class="Arg">set</var> in the same way as the partial permutation <var class="Arg">f</var>, and that is undefined on those points that are not in <var class="Arg">set</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 3, 4, 7, 8, 9 ], [ 9, 4, 1, 6, 2, 8 ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">RestrictedPartialPerm(f, [ 2, 3, 6, 10 ] );</span>
[3,4]</pre></div>
<p><a id="X849668DD7B0B9E3B" name="X849668DD7B0B9E3B"></a></p>
<h5>54.2-4 JoinOfPartialPerms</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ JoinOfPartialPerms</code>( <var class="Arg">arg</var> )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ JoinOfIdempotentPartialPermsNC</code>( <var class="Arg">arg</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: A partial permutation or <code class="keyw">fail</code>.</p>
<p>The join of partial permutations <var class="Arg">f</var> and <var class="Arg">g</var> is just the join, or supremum, of <var class="Arg">f</var> and <var class="Arg">g</var> under the natural partial ordering of partial permutations.</p>
<p><code class="code">JoinOfPartialPerms</code> returns the union of the partial permutations in its argument if this defines a partial permutation, and <code class="keyw">fail</code> if it is not. The argument <var class="Arg">arg</var> can be a partial permutation collection or a number of partial permutations.</p>
<p>The function <code class="code">JoinOfIdempotentPartialPermsNC</code> returns the join of its argument which is assumed to be a collection of idempotent partial permutations or a number of idempotent partial permutations. It is not checked that the arguments are idempotents. The performance of this function is higher than <code class="code">JoinOfPartialPerms</code> when it is known <em>a priori</em> that the argument consists of idempotents.</p>
<p>The union of <var class="Arg">f</var> and <var class="Arg">g</var> is a partial permutation if and only if <var class="Arg">f</var> and <var class="Arg">g</var> agree on the intersection dom(<var class="Arg">f</var>)<span class="SimpleMath">∩</span> dom(<var class="Arg">g</var>) of their domains and the images of dom(<var class="Arg">f</var>)<span class="SimpleMath">∖</span> dom(<var class="Arg">g</var>) and dom(<var class="Arg">g</var>)<span class="SimpleMath">∖</span> dom(<var class="Arg">f</var>) under <var class="Arg">f</var> and <var class="Arg">g</var>, respectively, are disjoint.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 6, 8, 10 ], [ 2, 6, 7, 9, 1, 5 ] );</span>
[3,7][8,1,2,6,9][10,5]
<span class="GAPprompt">gap></span> <span class="GAPinput">g:=PartialPerm( [ 11, 12, 14, 16, 18, 19 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 17, 20, 11, 19, 14, 12 ] );</span>
[16,19,12,20][18,14,11,17]
<span class="GAPprompt">gap></span> <span class="GAPinput">JoinOfPartialPerms(f, g);</span>
[3,7][8,1,2,6,9][10,5][16,19,12,20][18,14,11,17]
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 4, 5, 6, 7 ], [ 5, 7, 3, 1, 4 ] );</span>
[6,1,5,3](4,7)
<span class="GAPprompt">gap></span> <span class="GAPinput">g:=PartialPerm( [ 100 ], [ 1 ] );</span>
[100,1]
<span class="GAPprompt">gap></span> <span class="GAPinput">JoinOfPartialPerms(f, g);</span>
fail
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 3, 4 ], [ 3, 2, 4 ] );</span>
[1,3,2](4)
<span class="GAPprompt">gap></span> <span class="GAPinput">g:=PartialPerm( [ 1, 2, 4 ], [ 2, 3, 4 ] );</span>
[1,2,3](4)
<span class="GAPprompt">gap></span> <span class="GAPinput">JoinOfPartialPerms(f, g);</span>
fail
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1 ], [ 2 ] ); </span>
[1,2]
<span class="GAPprompt">gap></span> <span class="GAPinput">JoinOfPartialPerms(f, f^-1);</span>
(1,2)</pre></div>
<p><a id="X81E2B6977E28CD00" name="X81E2B6977E28CD00"></a></p>
<h5>54.2-5 MeetOfPartialPerms</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ MeetOfPartialPerms</code>( <var class="Arg">arg</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A partial permutation.</p>
<p>The meet of partial permutations <var class="Arg">f</var> and <var class="Arg">g</var> is just the meet, or infimum, of <var class="Arg">f</var> and <var class="Arg">g</var> under the natural partial ordering of partial permutations. In other words, the meet is the greatest partial permuation which is a restriction of both <var class="Arg">f</var> and <var class="Arg">g</var>.</p>
<p>Note that unlike the join of partial permutations, the meet always exists.</p>
<p><code class="code">MeetOfPartialPerms</code> returns the meet of the partial permutations in its argument. The argument <var class="Arg">arg</var> can be a partial permutation collection or a number of partial permutations.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 6, 100000 ], [ 2, 6, 7, 1, 5 ] );</span>
[3,7][100000,5](1,2,6)
<span class="GAPprompt">gap></span> <span class="GAPinput">g:=PartialPerm( [ 1, 2, 3, 4, 6 ], [ 2, 4, 6, 1, 5 ] );</span>
[3,6,5](1,2,4)
<span class="GAPprompt">gap></span> <span class="GAPinput">MeetOfPartialPerms(f, g);</span>
[1,2]
<span class="GAPprompt">gap></span> <span class="GAPinput">g:=PartialPerm( [ 1, 2, 3, 5, 6, 7, 9, 10 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 4, 10, 5, 6, 7, 1, 3, 2 ] );</span>
[9,3,5,6,7,1,4](2,10)
<span class="GAPprompt">gap></span> <span class="GAPinput">MeetOfPartialPerms(f, g);</span>
<empty partial perm></pre></div>
<p><a id="X80EFB142817A0A9F" name="X80EFB142817A0A9F"></a></p>
<h5>54.2-6 EmptyPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ EmptyPartialPerm</code>( )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: The empty partial permutation.</p>
<p>The empty partial permutation is returned by this function when it is called with no arguments. This is just short hand for <code class="code">PartialPerm([]);</code>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">EmptyPartialPerm();</span>
<empty partial perm></pre></div>
<p><a id="X7E6ADC8583C31530" name="X7E6ADC8583C31530"></a></p>
<h5>54.2-7 <span class="Heading">RandomPartialPerm</span></h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RandomPartialPerm</code>( <var class="Arg">n</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RandomPartialPerm</code>( <var class="Arg">set</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RandomPartialPerm</code>( <var class="Arg">dom</var>, <var class="Arg">img</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A random partial permutation.</p>
<p>In its first form, <code class="code">RandomPartialPerm</code> returns a randomly chosen partial permutation where points in the domain and image are bounded above by the positive integer <var class="Arg">n</var>.</p>
<div class="example"><pre><span class="GAPprompt">gap></span> <span class="GAPinput">RandomPartialPerm(10); </span>
[2,9][4,1,6,5][7,3](8)</pre></div>
<p>In its second form, <code class="code">RandomPartialPerm</code> returns a randomly chosen partial permutation with points in the domain and image contained in the set of positive integers <var class="Arg">set</var>.</p>
<div class="example"><pre><span class="GAPprompt">gap></span> <span class="GAPinput">RandomPartialPerm([1,2,3,1000]);</span>
[2,3,1000](1)</pre></div>
<p>In its third form, <code class="code">RandomPartialPerm</code> creates a randomly chosen partial permutation with domain contained in the set of positive integers <var class="Arg">dom</var> and image contained in the set of positive integers <var class="Arg">img</var>. The arguments <var class="Arg">dom</var> and <var class="Arg">img</var> do not have to have equal length.</p>
<p>Note that it is not guarenteed in either of these cases that partial permutations are chosen with a uniform distribution.</p>
<p><a id="X8779F0997D0FDA78" name="X8779F0997D0FDA78"></a></p>
<h4>54.3 <span class="Heading">Attributes for partial permutations</span></h4>
<p>In this section we describe the functions available in <strong class="pkg">GAP</strong> for finding various attributes of partial permutations.</p>
<p><a id="X8612A4DC864E7959" name="X8612A4DC864E7959"></a></p>
<h5>54.3-1 DegreeOfPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DegreeOfPartialPerm</code>( <var class="Arg">f</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DegreeOfPartialPermCollection</code>( <var class="Arg">coll</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>Returns: A non-negative integer.</p>
<p>The <em>degree</em> of a partial permutation <var class="Arg">f</var> is the largest positive integer where it is defined, i.e. the maximum element in the domain of <var class="Arg">f</var>.</p>
<p>The degree a collection of partial permutations <var class="Arg">coll</var> is the largest degree of any partial permutation in <var class="Arg">coll</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 6, 8, 10 ], [ 2, 6, 7, 9, 1, 5 ] );</span>
[3,7][8,1,2,6,9][10,5]
<span class="GAPprompt">gap></span> <span class="GAPinput">DegreeOfPartialPerm(f);</span>
10</pre></div>
<p><a id="X8413D0EF7DEE1FFF" name="X8413D0EF7DEE1FFF"></a></p>
<h5>54.3-2 CodegreeOfPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ CodegreeOfPartialPerm</code>( <var class="Arg">f</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ CodegreeOfPartialPermCollection</code>( <var class="Arg">coll</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>Returns: A non-negative integer.</p>
<p>The <em>codegree</em> of a partial permutation <var class="Arg">f</var> is the largest positive integer in its image.</p>
<p>The codegree a collection of partial permutations <var class="Arg">coll</var> is the largest codegree of any partial permutation in <var class="Arg">coll</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 4, 5, 8, 10 ], [ 7, 1, 4, 3, 2, 6, 5 ] );</span>
[8,6][10,5,2,1,7](3,4)
<span class="GAPprompt">gap></span> <span class="GAPinput">CodegreeOfPartialPerm(f);</span>
7</pre></div>
<p><a id="X7C1ABD8A80E95B39" name="X7C1ABD8A80E95B39"></a></p>
<h5>54.3-3 RankOfPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RankOfPartialPerm</code>( <var class="Arg">f</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RankOfPartialPermCollection</code>( <var class="Arg">coll</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>Returns: A non-negative integer.</p>
<p>The <em>rank</em> of a partial permutation <var class="Arg">f</var> is the size of its domain, or equivalently the size of its image set or image list.</p>
<p>The rank of a partial permutation collection <var class="Arg">coll</var> is the size of the union of the domains of the elements of <var class="Arg">coll</var>, or equivalently, the total number of points on which the elements of <var class="Arg">coll</var> act. Note that this is value may not the same as the size of the union of the images of the elements in <var class="Arg">coll</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 4, 6, 8, 9 ], [ 7, 10, 1, 9, 4, 2 ] );</span>
[6,9,2,10][8,4,1,7]
<span class="GAPprompt">gap></span> <span class="GAPinput">RankOfPartialPerm(f);</span>
6</pre></div>
<p><a id="X784A14F787E041D7" name="X784A14F787E041D7"></a></p>
<h5>54.3-4 DomainOfPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DomainOfPartialPerm</code>( <var class="Arg">f</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DomainOfPartialPermCollection</code>( <var class="Arg">f</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A set of positive integers (maybe empty).</p>
<p>The <em>domain</em> of a partial permutation <var class="Arg">f</var> is the set of positive integers where <var class="Arg">f</var> is defined.</p>
<p>The domain of a partial permutation collection <var class="Arg">coll</var> is the union of the domains of its elements.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 6, 8, 10 ], [ 2, 6, 7, 9, 1, 5 ] );</span>
[3,7][8,1,2,6,9][10,5]
<span class="GAPprompt">gap></span> <span class="GAPinput">DomainOfPartialPerm(f);</span>
[ 1, 2, 3, 6, 8, 10 ]</pre></div>
<p><a id="X7CD84B107831E0FC" name="X7CD84B107831E0FC"></a></p>
<h5>54.3-5 ImageOfPartialPermCollection</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ImageOfPartialPermCollection</code>( <var class="Arg">coll</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A set of positive integers (maybe empty).</p>
<p>The <em>image</em> of a partial permutation collection <var class="Arg">coll</var> is the union of the images of its elements.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">S:=SymmetricInverseSemigroup(5); </span>
<symmetric inverse semigroup on 5 pts>
<span class="GAPprompt">gap></span> <span class="GAPinput">ImageOfPartialPermCollection(GeneratorsOfInverseSemigroup(S));</span>
[ 1, 2, 3, 4, 5 ]</pre></div>
<p><a id="X8333293F87F654FA" name="X8333293F87F654FA"></a></p>
<h5>54.3-6 ImageListOfPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ImageListOfPartialPerm</code>( <var class="Arg">f</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: The list of images of a partial permutation.</p>
<p>The <em>image list</em> of a partial permutation <var class="Arg">f</var> is the list of images of the elements of the domain <var class="Arg">f</var> where <code class="code">ImageListOfPartialPerm(<var class="Arg">f</var>)[i]=DomainOfPartialPerm(<var class="Arg">f</var>)[i]^<var class="Arg">f</var></code> for any <code class="code">i</code> in the range from <code class="code">1</code> to the rank of <var class="Arg">f</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 4, 5, 8, 10 ], [ 7, 1, 4, 3, 2, 6, 5 ] );</span>
[8,6][10,5,2,1,7](3,4)
<span class="GAPprompt">gap></span> <span class="GAPinput">ImageListOfPartialPerm(f);</span>
[ 7, 1, 4, 3, 2, 6, 5 ]</pre></div>
<p><a id="X7F0724A07A14DCF7" name="X7F0724A07A14DCF7"></a></p>
<h5>54.3-7 ImageSetOfPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ImageSetOfPartialPerm</code>( <var class="Arg">f</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>Returns: The image set of a partial permutation.</p>
<p>The <em>image set</em> of a partial permutation <code class="code">f</code> is just the set of points in the image list (i.e. the image list after it has been sorted into increasing order).</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 5, 7, 10 ], [ 10, 2, 3, 5, 7, 6 ] );</span>
[1,10,6](2)(3)(5)(7)
<span class="GAPprompt">gap></span> <span class="GAPinput">ImageSetOfPartialPerm(f);</span>
[ 2, 3, 5, 6, 7, 10 ]</pre></div>
<p><a id="X82AAFF938623422E" name="X82AAFF938623422E"></a></p>
<h5>54.3-8 FixedPointsOfPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ FixedPointsOfPartialPerm</code>( <var class="Arg">f</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ FixedPointsOfPartialPerm</code>( <var class="Arg">coll</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A set of positive integers.</p>
<p><code class="code">FixedPointsOfPartialPerm</code> returns the set of points <code class="code">i</code> in the domain of the partial permutation <var class="Arg">f</var> such that <code class="code">i^<var class="Arg">f</var>=i</code>.</p>
<p>When the argument is a collection of partial permutations <var class="Arg">coll</var>, <code class="code">FixedPointsOfPartialPerm</code> returns the set of points fixed by every element of the collection of partial permutations <var class="Arg">coll</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 1, 2, 3, 5, 6, 8, 10, 11, 14, 17, 20, 21, 22, 24, 25, 26, 32 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 30, 20, 29, 24, 9, 14, 26, 5, 25, 15, 11, 6, 35, 2, 10, 19, 23 ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">FixedPointsOfPartialPerm(f);</span>
[ ]
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm([1..10]);;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">FixedPointsOfPartialPerm(f);</span>
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]</pre></div>
<p><a id="X82FE981A87FAA2DC" name="X82FE981A87FAA2DC"></a></p>
<h5>54.3-9 MovedPoints</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ MovedPoints</code>( <var class="Arg">f</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ MovedPoints</code>( <var class="Arg">coll</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A set of positive integers.</p>
<p><code class="code">MovedPoints</code> returns the set of points <code class="code">i</code> in the domain of the partial permutation <var class="Arg">f</var> such that <code class="code">i^<var class="Arg">f</var><>i</code>.</p>
<p>When the argument is a collection of partial permutations <var class="Arg">coll</var>, <code class="code">MovedPoints</code> returns the set of points moved by some element of the collection of partial permutations <var class="Arg">coll</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 1, 2, 3, 5, 6, 8, 10, 11, 14, 17, 20, 21, 22, 24, 25, 26, 32 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 30, 20, 29, 24, 9, 14, 26, 5, 25, 15, 11, 6, 35, 2, 10, 19, 23 ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">FixedPointsOfPartialPerm(f);</span>
[ ]
<span class="GAPprompt">gap></span> <span class="GAPinput">MovedPoints(f);</span>
[ 1, 2, 3, 5, 6, 8, 10, 11, 14, 17, 20, 21, 22, 24, 25, 26, 32 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm([1..10]);;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">FixedPointsOfPartialPerm(f);</span>
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">MovedPoints(f);</span>
[ ]</pre></div>
<p><a id="X7FAF969C84CDC742" name="X7FAF969C84CDC742"></a></p>
<h5>54.3-10 NrFixedPoints</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NrFixedPoints</code>( <var class="Arg">f</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NrFixedPoints</code>( <var class="Arg">coll</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A positive integer.</p>
<p><code class="code">NrFixedPoints</code> returns the number of points <code class="code">i</code> in the domain of the partial permutation <var class="Arg">f</var> such that <code class="code">i^<var class="Arg">f</var>=i</code>.</p>
<p>When the argument is a collection of partial permutations <var class="Arg">coll</var>, <code class="code">NrFixedPoints</code> returns the number of points fixed by every element of the collection of partial permutations <var class="Arg">coll</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 1, 2, 3, 5, 6, 8, 10, 11, 14, 17, 20, 21, 22, 24, 25, 26, 32 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 30, 20, 29, 24, 9, 14, 26, 5, 25, 15, 11, 6, 35, 2, 10, 19, 23 ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">NrFixedPoints(f);</span>
0
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm([1..10]);;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">NrFixedPoints(f);</span>
10</pre></div>
<p><a id="X81F5C64E7DAD27A7" name="X81F5C64E7DAD27A7"></a></p>
<h5>54.3-11 NrMovedPoints</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NrMovedPoints</code>( <var class="Arg">f</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NrMovedPoints</code>( <var class="Arg">coll</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A positive integer.</p>
<p><code class="code">NrMovedPoints</code> returns the number of points <code class="code">i</code> in the domain of the partial permutation <var class="Arg">f</var> such that <code class="code">i^<var class="Arg">f</var><>i</code>.</p>
<p>When the argument is a collection of partial permutations <var class="Arg">coll</var>, <code class="code">NrMovedPoints</code> returns the number of points moved by some element of the collection of partial permutations <var class="Arg">coll</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 1, 2, 3, 5, 6, 8, 10, 11, 14, 17, 20, 21, 22, 24, 25, 26, 32 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 30, 20, 29, 24, 9, 14, 26, 5, 25, 15, 11, 6, 35, 2, 10, 19, 23 ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">NrMovedPoints(f);</span>
17
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm([1..10]);;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">NrMovedPoints(f);</span>
0</pre></div>
<p><a id="X84A49C977E1E29AA" name="X84A49C977E1E29AA"></a></p>
<h5>54.3-12 SmallestMovedPoint</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SmallestMovedPoint</code>( <var class="Arg">f</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SmallestMovedPoint</code>( <var class="Arg">coll</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A positive integer or <code class="keyw">infinity</code>.</p>
<p><code class="code">SmallestMovedPoint</code> returns the smallest positive integer <code class="code">i</code> such that <code class="code">i^<var class="Arg">f</var><>i</code> if such an <code class="code">i</code> exists. If <var class="Arg">f</var> is an identity partial permutation, then <code class="keyw">infinity</code> is returned.</p>
<p>If the argument is a collection of partial permutations <var class="Arg">coll</var>, then the smallest point which is moved by at least one element of <var class="Arg">coll</var> is returned, if such a point exists. If <var class="Arg">coll</var> only contains identity partial permutations, then <code class="code">SmallestMovedPoint</code> returns <code class="keyw">infinity</code>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 1, 2, 3, 5, 6, 8, 10, 11, 14, 17, 20, 21, 22, 24, 25, 26, 32 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 30, 20, 29, 24, 9, 14, 26, 5, 25, 15, 11, 6, 35, 2, 10, 19, 23 ] );</span>
[1,30][3,29][8,14,25,10,26,19][17,15][21,6,9][22,35][32,23]
(2,20,11,5,24)
<span class="GAPprompt">gap></span> <span class="GAPinput">SmallestMovedPoint(f);</span>
1
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm([1..10]);;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">SmallestMovedPoint(f);</span>
infinity</pre></div>
<p><a id="X7D4290A785ABC86D" name="X7D4290A785ABC86D"></a></p>
<h5>54.3-13 LargestMovedPoint</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ LargestMovedPoint</code>( <var class="Arg">f</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ LargestMovedPoint</code>( <var class="Arg">coll</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A positive integer or <code class="keyw">infinity</code>.</p>
<p><code class="code">LargestMovedPoint</code> returns the largest positive integers <code class="code">i</code> such that <code class="code">i^<var class="Arg">f</var><>i</code> if such an <code class="code">i</code> exists. If <var class="Arg">f</var> is the identity partial permutation, then <code class="code">0</code> is returned.</p>
<p>If the argument is a collection of partial permutations <var class="Arg">coll</var>, then the largest point which is moved by at least one element of <var class="Arg">coll</var> is returned, if such a point exists. If <var class="Arg">coll</var> only contains identity partial permutations, then <code class="code">LargestMovedPoint</code> returns <code class="code">0</code>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 1, 2, 3, 5, 6, 8, 10, 11, 14, 17, 20, 21, 22, 24, 25, 26, 32 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 30, 20, 29, 24, 9, 14, 26, 5, 25, 15, 11, 6, 35, 2, 10, 19, 23 ] );</span>
[1,30][3,29][8,14,25,10,26,19][17,15][21,6,9][22,35][32,23]
(2,20,11,5,24)
<span class="GAPprompt">gap></span> <span class="GAPinput">LargestMovedPoint(f);</span>
32
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm([1..10]);;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">LargestMovedPoint(f);</span>
0</pre></div>
<p><a id="X85280F1A7B1014BA" name="X85280F1A7B1014BA"></a></p>
<h5>54.3-14 SmallestImageOfMovedPoint</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SmallestImageOfMovedPoint</code>( <var class="Arg">f</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SmallestImageOfMovedPoint</code>( <var class="Arg">coll</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A positive integer or <code class="keyw">infinity</code>.</p>
<p><code class="code">SmallestImageOfMovedPoint</code> returns the smallest positive integer <code class="code">i^<var class="Arg">f</var></code> such that <code class="code">i^<var class="Arg">f</var><>i</code> if such an <code class="code">i</code> exists. If <var class="Arg">f</var> is the identity partial permutation, then <code class="keyw">infinity</code> is returned.</p>
<p>If the argument is a collection of partial permutations <var class="Arg">coll</var>, then the smallest integer which is the image a point moved by at least one element of <var class="Arg">coll</var> is returned, if such a point exists. If <var class="Arg">coll</var> only contains identity partial permutations, then <code class="code">SmallestImageOfMovedPoint</code> returns <code class="keyw">infinity</code>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">S:=SymmetricInverseSemigroup(5);</span>
<symmetric inverse semigroup on 5 pts>
<span class="GAPprompt">gap></span> <span class="GAPinput">SmallestImageOfMovedPoint(S);</span>
1
<span class="GAPprompt">gap></span> <span class="GAPinput">S:=Semigroup(PartialPerm([10..100], [10..100]));;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">SmallestImageOfMovedPoint(S);</span>
infinity
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 6 ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">SmallestImageOfMovedPoint(f);</span>
6</pre></div>
<p><a id="X7A95CD437BC1CB1A" name="X7A95CD437BC1CB1A"></a></p>
<h5>54.3-15 LargestImageOfMovedPoint</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ LargestImageOfMovedPoint</code>( <var class="Arg">f</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ LargestImageOfMovedPoint</code>( <var class="Arg">coll</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A positive integer.</p>
<p><code class="code">LargestImageOfMovedPoint</code> returns the largest positive integer <code class="code">i^<var class="Arg">f</var></code> such that <code class="code">i^<var class="Arg">f</var><>i</code> if such an <code class="code">i</code> exists. If <var class="Arg">f</var> is an identity partial permutation, then <code class="code">0</code> is returned.</p>
<p>If the argument is a collection of partial permutations <var class="Arg">coll</var>, then the largest integer which is the image of a point moved by at least one element of <var class="Arg">coll</var> is returned, if such a point exists. If <var class="Arg">coll</var> only contains identity partial permutations, then <code class="code">LargestImageOfMovedPoint</code> returns <code class="code">0</code>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">S:=SymmetricInverseSemigroup(5);</span>
<symmetric inverse semigroup on 5 pts>
<span class="GAPprompt">gap></span> <span class="GAPinput">LargestImageOfMovedPoint(S);</span>
5
<span class="GAPprompt">gap></span> <span class="GAPinput">S:=Semigroup(PartialPerm([10..100], [10..100]));;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">LargestImageOfMovedPoint(S);</span>
0
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 6 ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">LargestImageOfMovedPoint(f);</span>
6</pre></div>
<p><a id="X873A9F717DA75CBC" name="X873A9F717DA75CBC"></a></p>
<h5>54.3-16 IndexPeriodOfPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IndexPeriodOfPartialPerm</code>( <var class="Arg">f</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>Returns: A pair of positive integers.</p>
<p>Returns the least positive integers <code class="code">m, r</code> such that <code class="code"><var class="Arg">f</var>^(m+r)=<var class="Arg">f</var>^m</code>, which are known as the <em>index</em> and <em>period</em> of the partial permutation <var class="Arg">f</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 5, 6, 7, 8, 11, 12, 16, 19 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 9, 18, 20, 11, 5, 16, 8, 19, 14, 13, 1 ] );</span>
[2,18][3,20][6,5,11,19,1,9][7,16,13][12,14](8)
<span class="GAPprompt">gap></span> <span class="GAPinput">IndexPeriodOfPartialPerm(f);</span>
[ 6, 1 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">f^6=f^7;</span>
true</pre></div>
<p><a id="X7C04AA377F080722" name="X7C04AA377F080722"></a></p>
<h5>54.3-17 SmallestIdempotentPower</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SmallestIdempotentPower</code>( <var class="Arg">f</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>Returns: A positive integer.</p>
<p>This function returns the least positive integer <code class="code">n</code> such that the partial permutation <code class="code"><var class="Arg">f</var>^n</code> is an idempotent. The smallest idempotent power of <var class="Arg">f</var> is the least multiple of the period of <var class="Arg">f</var> that is greater than or equal to the index of <var class="Arg">f</var>; see <code class="func">IndexPeriodOfPartialPerm</code> (<a href="chap54.html#X873A9F717DA75CBC"><span class="RefLink">54.3-16</span></a>).</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 4, 5, 7, 8, 10, 11, 13, 18, 19, 20 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 5, 1, 7, 3, 10, 2, 12, 14, 11, 16, 6, 9, 15 ] );</span>
[4,3,7,2,1,5,10,14][8,12][13,16][18,6][19,9][20,15](11)
<span class="GAPprompt">gap></span> <span class="GAPinput">SmallestIdempotentPower(f);</span>
8
<span class="GAPprompt">gap></span> <span class="GAPinput">f^8;</span>
<identity partial perm on [ 11 ]></pre></div>
<p><a id="X8185065E788BDD0D" name="X8185065E788BDD0D"></a></p>
<h5>54.3-18 ComponentsOfPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ComponentsOfPartialPerm</code>( <var class="Arg">f</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>Returns: A list of lists of positive integer.</p>
<p><code class="code">ComponentsOfPartialPerm</code> returns a list of the components of the partial permutation <var class="Arg">f</var>. Each component is a subset of the domain of <var class="Arg">f</var>, and the union of the components equals the domain.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 4, 5, 7, 8, 10, 11, 12, 13, 19 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 20, 4, 6, 19, 9, 14, 3, 12, 17, 5, 15, 13 ] );</span>
[1,20][2,4,19,13,15][7,14][8,3,6][10,12,5,9][11,17]
<span class="GAPprompt">gap></span> <span class="GAPinput">ComponentsOfPartialPerm(f);</span>
[ [ 1, 20 ], [ 2, 4, 19, 13, 15 ], [ 7, 14 ], [ 8, 3, 6 ],
[ 10, 12, 5, 9 ], [ 11, 17 ] ]</pre></div>
<p><a id="X7CB51EB67FFA95E9" name="X7CB51EB67FFA95E9"></a></p>
<h5>54.3-19 NrComponentsOfPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NrComponentsOfPartialPerm</code>( <var class="Arg">f</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>Returns: A positive integer.</p>
<p><code class="code">NrComponentsOfPartialPerm</code> returns the number of components of the partial permutation <var class="Arg">f</var> on its domain.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 4, 5, 7, 8, 10, 11, 12, 13, 19 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 20, 4, 6, 19, 9, 14, 3, 12, 17, 5, 15, 13 ] );</span>
[1,20][2,4,19,13,15][7,14][8,3,6][10,12,5,9][11,17]
<span class="GAPprompt">gap></span> <span class="GAPinput">NrComponentsOfPartialPerm(f);</span>
6</pre></div>
<p><a id="X7AAAAE4082B30E18" name="X7AAAAE4082B30E18"></a></p>
<h5>54.3-20 ComponentRepsOfPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ComponentRepsOfPartialPerm</code>( <var class="Arg">f</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p><code class="code">ComponentRepsOfPartialPerm</code> returns the representatives, in the following sense, of the components of the partial permutation <var class="Arg">f</var>. For every <code class="code">i</code> in the domain of <var class="Arg">f</var> there exists a representative <code class="code">j</code> and a positive integer <code class="code">k</code> such that <code class="code">i^(<var class="Arg">f</var>^k)=j</code>. Unlike transformations, there is exactly one representative for every component of <var class="Arg">f</var>. <code class="code">ComponentRepsOfPartialPerm</code> returns the least number of representatives.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 4, 5, 7, 8, 10, 11, 12, 13, 19 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 20, 4, 6, 19, 9, 14, 3, 12, 17, 5, 15, 13 ] );</span>
[1,20][2,4,19,13,15][7,14][8,3,6][10,12,5,9][11,17]
<span class="GAPprompt">gap></span> <span class="GAPinput">ComponentRepsOfPartialPerm(f);</span>
[ 1, 2, 7, 8, 10, 11 ]</pre></div>
<p><a id="X7A8FB86C78C49F85" name="X7A8FB86C78C49F85"></a></p>
<h5>54.3-21 LeftOne</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ LeftOne</code>( <var class="Arg">f</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RightOne</code>( <var class="Arg">f</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>Returns: A partial permutation.</p>
<p><code class="code">LeftOne</code> returns the identity partial permutation <code class="code">e</code> such that the domain and image of <code class="code">e</code> equal the domain of the partial permutation <var class="Arg">f</var> and such that <code class="code">e*<var class="Arg">f</var>=f</code>.</p>
<p><code class="code">RightOne</code> returns the identity partial permutation <code class="code">e</code> such that the domain and image of <code class="code">e</code> equal the image of <var class="Arg">f</var> and such that <code class="code"><var class="Arg">f</var>*e=f</code>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 4, 5, 6, 7 ], [ 10, 1, 6, 5, 8, 7 ] ); </span>
[2,1,10][4,6,8](5)(7)
<span class="GAPprompt">gap></span> <span class="GAPinput">RightOne(f);</span>
<identity partial perm on [ 1, 5, 6, 7, 8, 10 ]>
<span class="GAPprompt">gap></span> <span class="GAPinput">LeftOne(f);</span>
<identity partial perm on [ 1, 2, 4, 5, 6, 7 ]></pre></div>
<p><a id="X857FC10C81507E8B" name="X857FC10C81507E8B"></a></p>
<h5>54.3-22 One</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ One</code>( <var class="Arg">f</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: A partial permutation.</p>
<p>As described in <code class="func">OneImmutable</code> (<a href="../../doc/ref/chap31.html#X8046262384895B2A"><span class="RefLink">Reference: OneImmutable</span></a>), <code class="code">One</code> returns the multiplicative neutral element of the partial permutation <var class="Arg">f</var>, which is the identity partial permutation on the union of the domain and image of <var class="Arg">f</var>. Equivalently, the one of <var class="Arg">f</var> is the join of the right one and left one of <var class="Arg">f</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm([ 1, 2, 3, 4, 5, 7, 10 ], [ 3, 7, 9, 6, 1, 10, 2 ]);;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">One(f);</span>
<identity partial perm on [ 1, 2, 3, 4, 5, 6, 7, 9, 10 ]></pre></div>
<p><a id="X83B6AE4881C7253B" name="X83B6AE4881C7253B"></a></p>
<h5>54.3-23 Zero</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Zero</code>( <var class="Arg">f</var> )</td><td class="tdright">( method )</td></tr></table></div>
<p>Returns: The empty partial permutation.</p>
<p>As described in <code class="func">ZeroImmutable</code> (<a href="../../doc/ref/chap31.html#X8040AC7A79FFC442"><span class="RefLink">Reference: ZeroImmutable</span></a>), <code class="code">Zero</code> returns the multiplicative zero element of the partial permutation <var class="Arg">f</var>, which is the empty partial permutation.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm([ 1, 2, 3, 4, 5, 7, 10 ], [ 3, 7, 9, 6, 1, 10, 2 ]);;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">Zero(f);</span>
<empty partial perm></pre></div>
<p><a id="X8585AA8B78E9CDFB" name="X8585AA8B78E9CDFB"></a></p>
<h4>54.4 <span class="Heading">Changing the representation of a partial permutation</span></h4>
<p>It is possible that a partial permutation in <strong class="pkg">GAP</strong> can be represented by other types of objects, or that other types of <strong class="pkg">GAP</strong> objects can be represented by partial permutations. Partial permutations which are mathematically permutations can be converted into permutations in <strong class="pkg">GAP</strong> using the function <code class="func">AsPermutation</code> (<a href="chap42.html#X8353AB8987E35DF3"><span class="RefLink">42.5-5</span></a>). Similarly, a partial permutation can be converted into a transformation using <code class="func">AsTransformation</code> (<a href="chap53.html#X7C5360B2799943F3"><span class="RefLink">53.3-1</span></a>).</p>
<p>In this section we describe functions for converting other types of objects in <strong class="pkg">GAP</strong> into partial permutations.</p>
<p><a id="X81B32CB182489ACA" name="X81B32CB182489ACA"></a></p>
<h5>54.4-1 AsPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ AsPartialPerm</code>( <var class="Arg">f</var>, <var class="Arg">set</var> )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ AsPartialPerm</code>( <var class="Arg">f</var> )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ AsPartialPerm</code>( <var class="Arg">f</var>, <var class="Arg">n</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: A partial permutation.</p>
<p>A permutation <var class="Arg">f</var> defines a partial permutation when it is restricted to any finite set of positive integers. <code class="code">AsPartialPerm</code> can be used to obtain this partial permutation.</p>
<p>There are several possible arguments for <code class="code">AsPartialPerm</code>:</p>
<dl>
<dt><strong class="Mark">for a permutation and set of positive integers</strong></dt>
<dd><p><code class="code">AsPartialPerm</code> returns the partial permutation that equals <var class="Arg">f</var> on the set of positive integers <var class="Arg">set</var> and that is undefined on every other positive integer.</p>
<p>Note that as explained in <code class="func">PartialPerm</code> (<a href="chap54.html#X8538BAE77F2FB2F8"><span class="RefLink">54.2-1</span></a>) <em>a permutation is never a partial permutation</em> in <strong class="pkg">GAP</strong>, please keep this in mind when using <code class="code">AsPartialPerm</code>.</p>
</dd>
<dt><strong class="Mark">for a permutation</strong></dt>
<dd><p><code class="code">AsPartialPerm</code> returns the partial permutation that agrees with <var class="Arg">f</var> on <code class="code">[1..LargestMovedPoint(<var class="Arg">f</var>)]</code> and that is not defined on any other positive integer.</p>
</dd>
<dt><strong class="Mark">for a permutation and a positive integer</strong></dt>
<dd><p><code class="code">AsPartialPerm</code> returns the partial permutation that agrees with <var class="Arg">f</var> on <code class="code">[1..<var class="Arg">n</var>]</code>, when <var class="Arg">n</var> is a positive integer, and that is not defined on any other positive integer.</p>
</dd>
</dl>
<p>The operation <code class="func">PartialPermOp</code> (<a href="chap54.html#X81188D9F83F64222"><span class="RefLink">54.2-2</span></a>) can also be used to convert permutations into partial permutations.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=(2,8,19,9,14,10,20,17,4,13,12,3,5,7,18,16);;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">AsPartialPerm(f);</span>
(1)(2,8,19,9,14,10,20,17,4,13,12,3,5,7,18,16)(6)(11)(15)
<span class="GAPprompt">gap></span> <span class="GAPinput">AsPartialPerm(f, [ 1, 2, 3 ] );</span>
[2,8][3,5](1)</pre></div>
<p><a id="X87EC67747B260E98" name="X87EC67747B260E98"></a></p>
<h5>54.4-2 AsPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ AsPartialPerm</code>( <var class="Arg">f</var>, <var class="Arg">set</var> )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ AsPartialPerm</code>( <var class="Arg">f</var>, <var class="Arg">n</var> )</td><td class="tdright">( function )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ AsPartialPerm</code>( <var class="Arg">f</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: A partial permutation or <code class="keyw">fail</code>.</p>
<p>A transformation <var class="Arg">f</var> defines a partial permutation when it is restricted to a set of positive integers where it is injective. <code class="code">AsPartialPerm</code> can be used to obtain this partial permutation.</p>
<p>There are several possible arguments for <code class="code">AsPartialPerm</code>:</p>
<dl>
<dt><strong class="Mark">for a transformation and set of positive integers</strong></dt>
<dd><p><code class="code">AsPartialPerm</code> returns the partial permutation obtained by restricting <var class="Arg">f</var> to the set of positive integers <var class="Arg">set</var> when:</p>
<ul>
<li><p><var class="Arg">set</var> contains no elements exceeding the degree of <var class="Arg">f</var>;</p>
</li>
<li><p><var class="Arg">f</var> is injective on <var class="Arg">set</var>.</p>
</li>
</ul>
</dd>
<dt><strong class="Mark">for a transformation and a positive integer</strong></dt>
<dd><p><code class="code">AsPartialPerm</code> returns the partial permutation that agrees with <var class="Arg">f</var> on <code class="code">[1..<var class="Arg">n</var>]</code> when <var class="Arg">A</var> is a positive integer and this set satisfies the conditions given above.</p>
</dd>
<dt><strong class="Mark">for a transformation</strong></dt>
<dd><p>Let <code class="code">n</code> denote the degree of <var class="Arg">f</var>. If <code class="code">n^<var class="Arg">f</var>=n</code> and <var class="Arg">f</var> is injective on those <code class="code">i</code> such that <code class="code">i^<var class="Arg">f</var><>n</code>, then <code class="code">AsPartialPerm</code> returns the partial permutation obtained by restricting <var class="Arg">f</var> to those <code class="code">i</code> such that <code class="code">i^<var class="Arg">f</var><>n</code>.</p>
</dd>
</dl>
<p><code class="code">AsPartialPerm</code> returns <code class="keyw">fail</code> if the arguments do not describe a partial permutation.</p>
<p>The operation <code class="func">PartialPermOp</code> (<a href="chap54.html#X81188D9F83F64222"><span class="RefLink">54.2-2</span></a>) can also be used to convert transformations into partial permutations.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=Transformation( [ 8, 3, 5, 9, 6, 2, 9, 7, 9 ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">AsPartialPerm(f);</span>
[1,8,7](2,3,5,6)
<span class="GAPprompt">gap></span> <span class="GAPinput">AsPartialPerm(f, 3);</span>
[1,8][2,3,5]
<span class="GAPprompt">gap></span> <span class="GAPinput">AsPartialPerm(f, [ 2 .. 4 ] );</span>
[2,3,5][4,9]
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=Transformation( [ 2, 10, 2, 4, 4, 7, 6, 9, 10, 1 ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">AsPartialPerm(f);</span>
fail</pre></div>
<p><a id="X848CD855802C6CE1" name="X848CD855802C6CE1"></a></p>
<h4>54.5 <span class="Heading">Operators and operations for partial permutations</span></h4>
<dl>
<dt><strong class="Mark"><code class="code"><var class="Arg">f</var> ^ -1</code></strong></dt>
<dd><p>returns the inverse of the partial permutation <var class="Arg">f</var>.</p>
</dd>
<dt><strong class="Mark"><code class="code"><var class="Arg">i</var> ^ <var class="Arg">f</var></code></strong></dt>
<dd><p>returns the image of the positive integer <var class="Arg">i</var> under the partial permutation <var class="Arg">f</var> if it is defined and <code class="code">0</code> if it is not.</p>
</dd>
<dt><strong class="Mark"><code class="code"><var class="Arg">i</var> / <var class="Arg">f</var></code></strong></dt>
<dd><p>returns the preimage of the positive integer <var class="Arg">i</var> under the partial permutation <var class="Arg">f</var> if it is defined and <code class="code">0</code> if it is not. Note that the inverse of <var class="Arg">f</var> is not calculated to find the preimage of <var class="Arg">i</var>.</p>
</dd>
<dt><strong class="Mark"><code class="code"><var class="Arg">f</var> ^ <var class="Arg">g</var></code></strong></dt>
<dd><p>returns <code class="code"><var class="Arg">g</var>^-1*<var class="Arg">f</var>*<var class="Arg">g</var></code> when <var class="Arg">f</var> is a partial permutation and <var class="Arg">g</var> is a permutation or partial permutation; see <code class="func">\^</code> (<a href="chap31.html#X8481C9B97B214C23"><span class="RefLink">31.12-1</span></a>). This operation requires essentially the same number of steps as multiplying partial permutations, which is around one third as many as inverting and multiplying twice.</p>
</dd>
<dt><strong class="Mark"><code class="code"><var class="Arg">f</var> * <var class="Arg">g</var></code></strong></dt>
<dd><p>returns the composition of <var class="Arg">f</var> and <var class="Arg">g</var> when <var class="Arg">f</var> and <var class="Arg">g</var> are partial permutations or permutations. The product of a permutation and a partial permutation is returned as a partial permutation.</p>
</dd>
<dt><strong class="Mark"><code class="code"><var class="Arg">f</var> / <var class="Arg">g</var></code></strong></dt>
<dd><p>returns <code class="code"><var class="Arg">f</var>*<var class="Arg">g</var>^-1</code> when <var class="Arg">f</var> is a partial permutation and <var class="Arg">g</var> is a permutation or partial permutation. This operation requires essentially the same number of steps as multiplying partial permutations, which is approximately half that required to first invert <var class="Arg">g</var> and then take the produce with <var class="Arg">f</var>.</p>
</dd>
<dt><strong class="Mark"><code class="code">LQUO(<var class="Arg">g</var>, <var class="Arg">f</var>)</code></strong></dt>
<dd><p>returns <code class="code"><var class="Arg">g</var>^-1*<var class="Arg">f</var></code> when <var class="Arg">f</var> is a partial permutation and <var class="Arg">g</var> is a permutation or partial permutation. This operation requires essentially the same number of steps as multiplying partial permutations, which is approximately half that required to first invert <var class="Arg">g</var> and then take the produce with <var class="Arg">f</var>.</p>
</dd>
<dt><strong class="Mark"><code class="code"><var class="Arg">f</var> < <var class="Arg">g</var></code></strong></dt>
<dd><p>returns <code class="keyw">true</code> if the image of <var class="Arg">f</var> on the range from 1 to the degree of <var class="Arg">f</var> is lexicographically less than the corresponding image for <var class="Arg">g</var> and <code class="keyw">false</code> if it is not. See <code class="func">NaturalLeqPartialPerm</code> (<a href="chap54.html#X87B1ED93785257C1"><span class="RefLink">54.5-4</span></a>) and <code class="func">ShortLexLeqPartialPerm</code> (<a href="chap54.html#X81BD69307D294A1C"><span class="RefLink">54.5-5</span></a>) for additional orders for partial permutations.</p>
</dd>
<dt><strong class="Mark"><code class="code"><var class="Arg">f</var> = <var class="Arg">g</var></code></strong></dt>
<dd><p>returns <code class="keyw">true</code> if the partial permutation <var class="Arg">f</var> equals the partial permutation <var class="Arg">g</var> and returns <code class="keyw">false</code> if it does not.</p>
</dd>
</dl>
<p><a id="X8382A0F8875CEB08" name="X8382A0F8875CEB08"></a></p>
<h5>54.5-1 PermLeftQuoPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ PermLeftQuoPartialPerm</code>( <var class="Arg">f</var>, <var class="Arg">g</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ PermLeftQuoPartialPermNC</code>( <var class="Arg">f</var>, <var class="Arg">g</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A permutation.</p>
<p>Returns the permutation on the image set of <var class="Arg">f</var> induced by <code class="code"><var class="Arg">f</var>^-1*<var class="Arg">g</var></code> when the partial permutations <var class="Arg">f</var> and <var class="Arg">g</var> have equal domain and image set.</p>
<p><code class="code">PermLeftQuoPartialPerm</code> verifies that <var class="Arg">f</var> and <var class="Arg">g</var> have equal domains and image sets, and returns an error if they do not. <code class="code">PermLeftQuoPartialPermNC</code> does no checks.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 4, 5, 7 ], [ 7, 9, 10, 4, 2, 5 ] );</span>
[1,7,5,2,9][3,10](4)
<span class="GAPprompt">gap></span> <span class="GAPinput">g:=PartialPerm( [ 1, 2, 3, 4, 5, 7 ], [ 7, 4, 9, 2, 5, 10 ] );</span>
[1,7,10][3,9](2,4)(5)
<span class="GAPprompt">gap></span> <span class="GAPinput">PermLeftQuoPartialPerm(f, g);</span>
(2,5,10,9,4)</pre></div>
<p><a id="X7C7F5EAB7E9A381D" name="X7C7F5EAB7E9A381D"></a></p>
<h5>54.5-2 PreImagePartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ PreImagePartialPerm</code>( <var class="Arg">f</var>, <var class="Arg">i</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A positive integer or <code class="keyw">fail</code>.</p>
<p><code class="code">PreImagePartialPerm</code> returns the preimage of the positive integer <var class="Arg">i</var> under the partial permutation <var class="Arg">f</var> if <var class="Arg">i</var> belongs to the image of <var class="Arg">f</var>. If <var class="Arg">i</var> does not belong to the image of <var class="Arg">f</var>, then <code class="keyw">fail</code> is returned.</p>
<p>The same result can be obtained by using <code class="code"><var class="Arg">i</var>/<var class="Arg">f</var></code> as described in Section <a href="chap54.html#X848CD855802C6CE1"><span class="RefLink">54.5</span></a>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 5, 9, 10 ], [ 5, 10, 7, 8, 9, 1 ] );</span>
[2,10,1,5,8][3,7](9)
<span class="GAPprompt">gap></span> <span class="GAPinput">PreImagePartialPerm(f, 8);</span>
5
<span class="GAPprompt">gap></span> <span class="GAPinput">PreImagePartialPerm(f, 5);</span>
1
<span class="GAPprompt">gap></span> <span class="GAPinput">PreImagePartialPerm(f, 1);</span>
10
<span class="GAPprompt">gap></span> <span class="GAPinput">PreImagePartialPerm(f, 10);</span>
2
<span class="GAPprompt">gap></span> <span class="GAPinput">PreImagePartialPerm(f, 2); </span>
fail</pre></div>
<p><a id="X797A6CC084068219" name="X797A6CC084068219"></a></p>
<h5>54.5-3 ComponentPartialPermInt</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ComponentPartialPermInt</code>( <var class="Arg">f</var>, <var class="Arg">i</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: A set of positive integers.</p>
<p><code class="code">ComponentPartialPermInt</code> returns the elements of the component of <var class="Arg">f</var> containing <var class="Arg">i</var> that can be obtained by repeatedly applying <var class="Arg">f</var> to <var class="Arg">i</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 4, 5, 6, 7, 8, 10, 14, 15, 16, 17, 18 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 11, 4, 14, 16, 15, 3, 20, 8, 17, 19, 1, 6, 12 ] );</span>
[2,4,14,17,6,15,19][5,16,1,11][7,3][10,8,20][18,12]
<span class="GAPprompt">gap></span> <span class="GAPinput">ComponentPartialPermInt(f, 4);</span>
[ 4, 14, 17, 6, 15, 19 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">ComponentPartialPermInt(f, 3);</span>
[ ]
<span class="GAPprompt">gap></span> <span class="GAPinput">ComponentPartialPermInt(f, 10);</span>
[ 10, 8, 20 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">ComponentPartialPermInt(f, 100);</span>
[ ]</pre></div>
<p><a id="X87B1ED93785257C1" name="X87B1ED93785257C1"></a></p>
<h5>54.5-4 NaturalLeqPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NaturalLeqPartialPerm</code>( <var class="Arg">f</var>, <var class="Arg">g</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: <code class="keyw">true</code> or <code class="keyw">false</code>.</p>
<p>The <em>natural partial order</em> <span class="SimpleMath">≤</span> on an inverse semigroup <code class="code">S</code> is defined by <code class="code">s</code><span class="SimpleMath">≤</span><code class="code">t</code> if there exists an idempotent <code class="code">e</code> in <code class="code">S</code> such that <code class="code">s=et</code>. Hence if <var class="Arg">f</var> and <var class="Arg">g</var> are partial permutations, then <var class="Arg">f</var><span class="SimpleMath">≤</span><var class="Arg">g</var> if and only if <var class="Arg">f</var> is a restriction of <var class="Arg">g</var>; see <code class="func">RestrictedPartialPerm</code> (<a href="chap54.html#X80ABBF4883C79060"><span class="RefLink">54.2-3</span></a>).</p>
<p><code class="code">NaturalLeqPartialPerm</code> returns <code class="keyw">true</code> if <var class="Arg">f</var> is a restriction of <var class="Arg">g</var> and <code class="keyw">false</code> if it is not. Note that since this is a partial order and not a total order, it is possible that <var class="Arg">f</var> and <var class="Arg">g</var> are incomparable with respect to the natural partial order.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 16, 17, 18, 19 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 3, 12, 14, 4, 11, 18, 17, 2, 9, 5, 15, 8, 20, 10, 19 ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">g:=RestrictedPartialPerm(f, [ 1, 2, 3, 9, 13, 20 ] );</span>
[1,3,14][2,12]
<span class="GAPprompt">gap></span> <span class="GAPinput">NaturalLeqPartialPerm(g,f);</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">NaturalLeqPartialPerm(f,g);</span>
false
<span class="GAPprompt">gap></span> <span class="GAPinput">g:=PartialPerm( [ 1, 2, 3, 4, 5, 8, 10 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 7, 1, 4, 3, 2, 6, 5 ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">NaturalLeqPartialPerm(f, g);</span>
false
<span class="GAPprompt">gap></span> <span class="GAPinput">NaturalLeqPartialPerm(g, f);</span>
false</pre></div>
<p><a id="X81BD69307D294A1C" name="X81BD69307D294A1C"></a></p>
<h5>54.5-5 ShortLexLeqPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ShortLexLeqPartialPerm</code>( <var class="Arg">f</var>, <var class="Arg">g</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: <code class="keyw">true</code> or <code class="keyw">false</code>.</p>
<p><code class="code">ShortLexLeqPartialPerm</code> returns <code class="keyw">true</code> if the concatenation of the domain and image list of <var class="Arg">f</var> is short-lex less than the corresponding concatenation for <var class="Arg">g</var> and <code class="keyw">false</code> otherwise.</p>
<p>Note that this is not the natural partial order on partial permutation or the same as comparing <var class="Arg">f</var> and <var class="Arg">g</var> using <code class="code">\<</code>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 4, 6, 7, 8, 10 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 3, 8, 1, 9, 4, 10, 5, 6 ] );</span>
[2,8,5][7,10,6,4,9](1,3)
<span class="GAPprompt">gap></span> <span class="GAPinput">g:=PartialPerm( [ 1, 2, 3, 4, 5, 8, 10 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 7, 1, 4, 3, 2, 6, 5 ] );</span>
[8,6][10,5,2,1,7](3,4)
<span class="GAPprompt">gap></span> <span class="GAPinput">f<g;</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">g<f;</span>
false
<span class="GAPprompt">gap></span> <span class="GAPinput">ShortLexLeqPartialPerm(f, g);</span>
false
<span class="GAPprompt">gap></span> <span class="GAPinput">ShortLexLeqPartialPerm(g, f);</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">NaturalLeqPartialPerm(f, g);</span>
false
<span class="GAPprompt">gap></span> <span class="GAPinput">NaturalLeqPartialPerm(g, f);</span>
false</pre></div>
<p><a id="X83560BE678ACF855" name="X83560BE678ACF855"></a></p>
<h5>54.5-6 TrimPartialPerm</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ TrimPartialPerm</code>( <var class="Arg">f</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>Returns: Nothing.</p>
<p>It can happen that the internal representation of a partial permutation uses more memory than necessary. For example, by composing a partial permutation with codegree less than 65536 with a partial permutation with codegree greater than 65535. It is possible that the resulting partial permutation <var class="Arg">f</var> has its codegree and images stored as 32-bit integers, while none of its image points exceeds 65536. The purpose of this function is to change the internal representation of such an <var class="Arg">f</var> from using 32-bit to using 16-bit integers.</p>
<p>Note that the partial permutation <var class="Arg">f</var> is changed in-place, and nothing is returned by this function.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2 ], [ 3, 4 ] )</span>
<span class="GAPprompt">></span> <span class="GAPinput">*PartialPerm( [ 3, 5 ], [ 3, 100000 ] );</span>
[1,3]
<span class="GAPprompt">gap></span> <span class="GAPinput">IsPPerm4Rep(f);</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">TrimPartialPerm(f); f;</span>
[1,3]
<span class="GAPprompt">gap></span> <span class="GAPinput">IsPPerm4Rep(f);</span>
false</pre></div>
<p><a id="X7849595B81D063EE" name="X7849595B81D063EE"></a></p>
<h4>54.6 <span class="Heading">Displaying partial permutations</span></h4>
<p>It is possible to change the way that <strong class="pkg">GAP</strong> displays partial permutations using the user preferences <code class="code">PartialPermDisplayLimit</code> and <code class="code">NotationForPartialPerms</code>; see Section <code class="func">UserPreference</code> (<a href="chap3.html#X7B0AD104839B6C3C"><span class="RefLink">3.2-3</span></a>) for more information about user preferences.</p>
<p>If <code class="code">f</code> is a partial permutation of rank <code class="code">r</code> exceeding the value of the user preference <code class="code">PartialPermDisplayLimit</code>, then <code class="code">f</code> is displayed as:</p>
<div class="example"><pre><partial perm on r pts with degree m, codegree n></pre></div>
<p>where the degree and codegree are <code class="code">m</code> and <code class="code">n</code>, respectively. The idea is to abbreviated the display of partial permutations defined on many points. The default value for the <code class="code">PartialPermDisplayLimit</code> is <code class="code">100</code>.</p>
<p>If the rank of <code class="code">f</code> does not exceed the value of <code class="code">PartialPermDisplayLimit</code>, then how <code class="code">f</code> is displayed depends on the value of the user preference <code class="code">NotationForPartialPerms</code> except in the case that <code class="code">f</code> is the empty partial permutation or an identity partial permutation.</p>
<p>There are three possible values for <code class="code">NotationForPartialPerms</code> user preference, which are described below.</p>
<dl>
<dt><strong class="Mark">component</strong></dt>
<dd><p>Similar to permutations, and unlike transformations, partial permutations can be expressed as products of disjoint permutations and chains. A <em>chain</em> is a list <code class="code">c</code> of some length <code class="code">n</code> such that:</p>
<ul>
<li><p><code class="code">c[1]</code> is an element of the domain of <var class="Arg">f</var> but not the image</p>
</li>
<li><p><code class="code">c[i]^<var class="Arg">f</var>=c[i+1]</code> for all <code class="code">i</code> in the range from <code class="code">1</code> to <code class="code">n-1</code>.</p>
</li>
<li><p><code class="code">c[n]</code> is in the image of <var class="Arg">f</var> but not the domain.</p>
</li>
</ul>
<p>In the display, permutations are displayed as they usually are in <strong class="pkg">GAP</strong>, except that fixed points are displayed enclosed in round brackets, and chains are displayed enclosed in square brackets.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 16, 17, 18, 19 ],</span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 3, 12, 14, 4, 11, 18, 17, 2, 9, 5, 15, 8, 20, 10, 19 ]);;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">PrettyPrintPP(f);</span>
[1,3,14][16,8,2,12,15](4)(5,11)[6,18,10,9][7,17,20](19)</pre></div>
<p>This option is the most compact way to display a partial permutation and is the default value of the user preference <code class="code">NotationForPartialPerms</code>.</p>
</dd>
<dt><strong class="Mark">domainimage</strong></dt>
<dd><p>With this option a partial permutation <code class="code">f</code> is displayed in the format: <code class="code">DomainOfPartialPerm(<var class="Arg">f</var>)-> ImageListOfPartialPerm(<var class="Arg">f</var>)</code>.</p>
<div class="example"><pre><span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 4, 5, 6, 7 ], [ 10, 1, 6, 5, 8, 7 ]);</span>
[ 1, 2, 4, 5, 6, 7 ] -> [ 10, 1, 6, 5, 8, 7 ]</pre></div>
</dd>
<dt><strong class="Mark">input</strong></dt>
<dd><p>With this option a partial permutation <var class="Arg">f</var> is displayed as: <code class="code">PartialPerm(DomainOfPartialPerm(<var class="Arg">f</var>), ImageListOfPartialPerm(<var class="Arg">f</var>))</code> which corresponds to the input (of the first type described in <code class="func">PartialPerm</code> (<a href="chap54.html#X8538BAE77F2FB2F8"><span class="RefLink">54.2-1</span></a>)).</p>
<div class="example"><pre><span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 5, 6, 9, 10 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 4, 7, 3, 8, 2, 1, 6 ] );</span>
PartialPerm( [ 1, 2, 3, 5, 6, 9, 10 ], [ 4, 7, 3, 8, 2, 1, 6 ] )</pre></div>
</dd>
</dl>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">SetUserPreference("PartialPermDisplayLimit", 12); </span>
<span class="GAPprompt">gap></span> <span class="GAPinput">UserPreference("PartialPermDisplayLimit");</span>
12
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm([1,2,3,4,5,6], [6,7,1,4,3,2]);</span>
[5,3,1,6,2,7](4)
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 16, 17, 18, 19 ], </span>
<span class="GAPprompt">></span> <span class="GAPinput">[ 3, 12, 14, 4, 11, 18, 17, 2, 9, 5, 15, 8, 20, 10, 19 ] );</span>
<partial perm on 15 pts with degree 19, codegree 20>
<span class="GAPprompt">gap></span> <span class="GAPinput">SetUserPreference("PartialPermDisplayLimit", 100);</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">f;</span>
[1,3,14][6,18,10,9][7,17,20][16,8,2,12,15](4)(5,11)(19)
<span class="GAPprompt">gap></span> <span class="GAPinput">UserPreference("NotationForPartialPerms");</span>
"component"
<span class="GAPprompt">gap></span> <span class="GAPinput">SetUserPreference("NotationForPartialPerms", "domainimage");</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">f;</span>
[ 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 16, 17, 18, 19 ] ->
[ 3, 12, 14, 4, 11, 18, 17, 2, 9, 5, 15, 8, 20, 10, 19 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">SetUserPreference("NotationForPartialPerms", "input");</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">f;</span>
PartialPerm(
[ 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 16, 17, 18, 19 ],
[ 3, 12, 14, 4, 11, 18, 17, 2, 9, 5, 15, 8, 20, 10, 19 ] )</pre></div>
<p><a id="X7CCC82E07A73EB55" name="X7CCC82E07A73EB55"></a></p>
<h4>54.7 <span class="Heading">Semigroups and inverse semigroups of partial permutations</span></h4>
<p>As mentioned at the start of the chapter, every inverse semigroup is isomorphic to a semigroup of partial permutations, and in this section we describe the functions in <strong class="pkg">GAP</strong> specific to partial perms semigroups. For more information about semigroups and inverse semigroups see Chapter <a href="chap51.html#X8665D8737FDD5B10"><span class="RefLink">51</span></a>.</p>
<p>The <strong class="pkg">Semigroups</strong> package contains many additional functions and methods for computing with semigroups of partial permutations. In particular, <strong class="pkg">Semigroups</strong> contains more efficient methods than those available in the <strong class="pkg">GAP</strong> library (and in many cases more efficient than any other software) for creating semigroups of transformations, calculating their Green's classes, size, elements, group of units, minimal ideal, small generating sets, testing membership, finding the inverses of a regular element, factorizing elements over the generators, and more.</p>
<p>Since a partial permutation semigroup is also a partial permutation collection, there are special methods for <code class="func">DomainOfPartialPermCollection</code> (<a href="chap54.html#X784A14F787E041D7"><span class="RefLink">54.3-4</span></a>), <code class="func">ImageOfPartialPermCollection</code> (<a href="chap54.html#X7CD84B107831E0FC"><span class="RefLink">54.3-5</span></a>), <code class="func">FixedPointsOfPartialPerm</code> (<a href="chap54.html#X82AAFF938623422E"><span class="RefLink">54.3-8</span></a>), <code class="func">MovedPoints</code> (<a href="chap54.html#X82FE981A87FAA2DC"><span class="RefLink">54.3-9</span></a>), <code class="func">NrFixedPoints</code> (<a href="chap54.html#X7FAF969C84CDC742"><span class="RefLink">54.3-10</span></a>), <code class="func">NrMovedPoints</code> (<a href="chap54.html#X81F5C64E7DAD27A7"><span class="RefLink">54.3-11</span></a>), <code class="func">LargestMovedPoint</code> (<a href="chap54.html#X7D4290A785ABC86D"><span class="RefLink">54.3-13</span></a>), and <code class="func">SmallestMovedPoint</code> (<a href="chap54.html#X84A49C977E1E29AA"><span class="RefLink">54.3-12</span></a>) when applied to a partial permutation semigroup.</p>
<p><a id="X7D161674800B50E0" name="X7D161674800B50E0"></a></p>
<h5>54.7-1 IsPartialPermSemigroup</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsPartialPermSemigroup</code>( <var class="Arg">obj</var> )</td><td class="tdright">( property )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsPartialPermMonoid</code>( <var class="Arg">obj</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>Returns: <code class="keyw">true</code> or <code class="keyw">false</code>.</p>
<p>A <em>partial perm semigroup</em> is simply a semigroup consisting of partial permutations, which may or may not be an inverse semigroup. An object <var class="Arg">obj</var> in <strong class="pkg">GAP</strong> is a partial perm semigroup if and only if it satisfies <code class="func">IsSemigroup</code> (<a href="chap51.html#X7B412E5B8543E9B7"><span class="RefLink">51.1-1</span></a>) and <code class="func">IsPartialPermCollection</code> (<a href="chap54.html#X8262A827790DD1CC"><span class="RefLink">54.1-2</span></a>).</p>
<p>A <em>partial perm monoid</em> is a monoid consisting of partial permutations. An object in <strong class="pkg">GAP</strong> is a partial perm monoid if it satisfies <code class="func">IsMonoid</code> (<a href="chap51.html#X861C523483C6248C"><span class="RefLink">51.2-1</span></a>) and <code class="func">IsPartialPermCollection</code> (<a href="chap54.html#X8262A827790DD1CC"><span class="RefLink">54.1-2</span></a>).</p>
<p>Note that it is possible for a partial perm semigroup to have a multiplicative neutral element (i.e. an identity element) but not to satisfy <code class="code">IsPartialPermMonoid</code>. For example,</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 6, 8, 10 ], [ 2, 6, 7, 9, 1, 5 ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">S:=Semigroup(f, One(f));</span>
<commutative partial perm monoid on 9 pts with 1 generator>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsMonoid(S);</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">IsPartialPermMonoid(S);</span>
true</pre></div>
<p>Note that unlike transformation semigroups, the <code class="func">One</code> (<a href="chap31.html#X8046262384895B2A"><span class="RefLink">31.10-2</span></a>) of a partial permutation semigroup must coincide with the multiplicative neutral element, if either exists.</p>
<p>For more details see <code class="func">IsMagmaWithOne</code> (<a href="chap35.html#X86071DE7835F1C7C"><span class="RefLink">35.1-2</span></a>).</p>
<p><a id="X7D7F0BAB82F0D820" name="X7D7F0BAB82F0D820"></a></p>
<h5>54.7-2 DegreeOfPartialPermSemigroup</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DegreeOfPartialPermSemigroup</code>( <var class="Arg">S</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ CodegreeOfPartialPermSemigroup</code>( <var class="Arg">S</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RankOfPartialPermSemigroup</code>( <var class="Arg">S</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>Returns: A non-negative integer.</p>
<p>The <em>degree</em> of a partial permutation semigroup <var class="Arg">S</var> is the largest degree of any partial permutation in <var class="Arg">S</var>.</p>
<p>The <em>codegree</em> of a partial permutation semigroup <var class="Arg">S</var> is the largest positive integer in its image.</p>
<p>The <em>rank</em> of a partial permutation semigroup <var class="Arg">S</var> is the number of points on which it acts.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">S:=Semigroup( PartialPerm( [ 1, 2 ], [ 10000, 3 ] ) );</span>
<commutative partial perm semigroup on 2 pts with 1 generator>
<span class="GAPprompt">gap></span> <span class="GAPinput">DegreeOfPartialPermSemigroup(S);</span>
2
<span class="GAPprompt">gap></span> <span class="GAPinput">CodegreeOfPartialPermSemigroup(S);</span>
10000
<span class="GAPprompt">gap></span> <span class="GAPinput">RankOfPartialPermSemigroup(S);</span>
2</pre></div>
<p><a id="X81D271B380995F8A" name="X81D271B380995F8A"></a></p>
<h5>54.7-3 SymmetricInverseSemigroup</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SymmetricInverseSemigroup</code>( <var class="Arg">n</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SymmetricInverseMonoid</code>( <var class="Arg">n</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: The symmetric inverse semigroup of degree <var class="Arg">n</var>.</p>
<p>If <var class="Arg">n</var> is a non-negative integer, then <code class="code">SymmetricInverseSemigroup</code> returns the inverse semigroup consisting of all partial permutations with degree and codegree at most <var class="Arg">n</var>. Note that <var class="Arg">n</var> must be non-negative, but in particular, can equal <code class="code">0</code>.</p>
<p>The symmetric inverse semigroup has <span class="SimpleMath">∑_r=0^nnchoose r^2⋅ r!</span> elements and is generated by any set that of partial permutations that generate the symmetric group on <var class="Arg">n</var> points and any partial permutation of rank <code class="code"><var class="Arg">n</var>-1</code>.</p>
<p><code class="code">SymmetricInverseMonoid</code> is a synonym for <code class="code">SymmetricInverseSemigroup</code>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">S:=SymmetricInverseSemigroup(5);</span>
<symmetric inverse semigroup on 5 pts>
<span class="GAPprompt">gap></span> <span class="GAPinput">Size(S);</span>
1546</pre></div>
<p><a id="X7C8AEA50834060DD" name="X7C8AEA50834060DD"></a></p>
<h5>54.7-4 IsSymmetricInverseSemigroup</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsSymmetricInverseSemigroup</code>( <var class="Arg">S</var> )</td><td class="tdright">( property )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsSymmetricInverseMonoid</code>( <var class="Arg">S</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>Returns: <code class="keyw">true</code> or <code class="keyw">false</code>.</p>
<p>If the partial perm semigroup <var class="Arg">S</var> of degree and codegree <var class="Arg">n</var> equals the symmetric inverse semigroup on <var class="Arg">n</var> points, then <code class="code">IsSymmetricInverseSemigroup</code> return <code class="keyw">true</code> and otherwise it returns <code class="keyw">false</code>.</p>
<p><code class="code">IsSymmetricInverseMonoid</code> is a synonym of <code class="code">IsSymmetricInverseSemigroup</code>. It is common in the literature for the symmetric inverse monoid to be referred to as the symmetric inverse semigroup.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">S:=Semigroup( AsPartialPerm((1,3,4,2), 5), AsPartialPerm((1,3,5), 5),</span>
<span class="GAPprompt">></span> <span class="GAPinput">PartialPerm( [ 1, 2, 3, 4 ] ) );</span>
<partial perm semigroup on 5 pts with 3 generators>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsSymmetricInverseSemigroup(S);</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">S;</span>
<symmetric inverse semigroup on 5 pts></pre></div>
<p><a id="X7EA51F087CF7621F" name="X7EA51F087CF7621F"></a></p>
<h5>54.7-5 NaturalPartialOrder</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NaturalPartialOrder</code>( <var class="Arg">S</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ReverseNaturalPartialOrder</code>( <var class="Arg">S</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>Returns: The natural partial order on an inverse semigroup.</p>
<p>The <em>natural partial order</em> <span class="SimpleMath">≤</span> on an inverse semigroup <var class="Arg">S</var> is defined by <code class="code">s</code><span class="SimpleMath">≤</span><code class="code">t</code> if there exists an idempotent <code class="code">e</code> in <var class="Arg">S</var> such that <code class="code">s=et</code>. Hence if <code class="code">f</code> and <code class="code">g</code> are partial permutations, then <code class="code">f</code><span class="SimpleMath">≤</span><code class="code">g</code> if and only if <code class="code">f</code> is a restriction of <code class="code">g</code>; see <code class="func">RestrictedPartialPerm</code> (<a href="chap54.html#X80ABBF4883C79060"><span class="RefLink">54.2-3</span></a>).</p>
<p><code class="code">NaturalPartialOrder</code> returns the natural partial order on the inverse semigroup of partial permutations <var class="Arg">S</var> as a list of sets of positive integers where entry <code class="code">i</code> in <code class="code">NaturalPartialOrder(<var class="Arg">S</var>)</code> is the set of positions in <code class="code">Elements(<var class="Arg">S</var>)</code> of elements which are less than <code class="code">Elements(<var class="Arg">S</var>)[i]</code>. See also <code class="func">NaturalLeqPartialPerm</code> (<a href="chap54.html#X87B1ED93785257C1"><span class="RefLink">54.5-4</span></a>).</p>
<p><code class="code">ReverseNaturalPartialOrder</code> returns the reverse of the natural partial order on the inverse semigroup of partial permutations <var class="Arg">S</var> as a list of sets of positive integers where entry <code class="code">i</code> in <code class="code">ReverseNaturalPartialOrder(<var class="Arg">S</var>)</code> is the set of positions in <code class="code">Elements(<var class="Arg">S</var>)</code> of elements which are greater than <code class="code">Elements(<var class="Arg">S</var>)[i]</code>. See also <code class="func">NaturalLeqPartialPerm</code> (<a href="chap54.html#X87B1ED93785257C1"><span class="RefLink">54.5-4</span></a>).</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">S:=InverseSemigroup([ PartialPerm( [ 1, 3 ], [ 1, 3 ] ),</span>
<span class="GAPprompt">></span> <span class="GAPinput">PartialPerm( [ 1, 2 ], [ 3, 2 ] ) ] );</span>
<inverse partial perm semigroup on 3 pts with 2 generators>
<span class="GAPprompt">gap></span> <span class="GAPinput">Size(S);</span>
11
<span class="GAPprompt">gap></span> <span class="GAPinput">NaturalPartialOrder(S);</span>
[ [ ], [ 1 ], [ 1 ], [ 1 ], [ 1, 2, 4 ], [ 1, 3, 4 ], [ 1 ], [ 1 ],
[ 1, 4, 7 ], [ 1, 4, 8 ], [ 1, 2, 8 ] ]
<span class="GAPprompt">gap></span> <span class="GAPinput">NaturalLeqPartialPerm(Elements(S)[4], Elements(S)[10]);</span>
true
<span class="GAPprompt">gap></span> <span class="GAPinput">NaturalLeqPartialPerm(Elements(S)[4], Elements(S)[1]); </span>
false</pre></div>
<p><a id="X857F68DF7EDA3BE4" name="X857F68DF7EDA3BE4"></a></p>
<h5>54.7-6 IsomorphismPartialPermMonoid</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsomorphismPartialPermMonoid</code>( <var class="Arg">S</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsomorphismPartialPermSemigroup</code>( <var class="Arg">S</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Returns: An isomorphism.</p>
<p><code class="code">IsomorphismPartialPermSemigroup(<var class="Arg">S</var>)</code> returns an isomorphism from the inverse semigroup or group <var class="Arg">S</var> to an inverse semigroup of partial permutations.</p>
<p><code class="code">IsomorphismPartialPermMonoid(<var class="Arg">S</var>)</code> returns an isomorphism from the inverse monoid or group <var class="Arg">S</var> to an inverse monoid of partial permutations.</p>
<p>We only describe <code class="code">IsomorphismPartialPermMonoid</code>, the corresponding statements for <code class="code">IsomorphismPartialPermSemigroup</code> also hold.</p>
<dl>
<dt><strong class="Mark">Partial permutation semigroups</strong></dt>
<dd><p>If <var class="Arg">S</var> is a partial permutation semigroup that does not satisfy <code class="func">IsMonoid</code> (<a href="../../doc/ref/chap51.html#X861C523483C6248C"><span class="RefLink">Reference: IsMonoid</span></a>) but where <code class="code">MultiplicativeNeutralElement(<var class="Arg">S</var>)<>fail</code>, then <code class="code">IsomorphismPartialPermMonoid(<var class="Arg">S</var>)</code> returns an isomorphism from <var class="Arg">S</var> to an inverse monoid of partial permutations.</p>
</dd>
<dt><strong class="Mark">Permutation groups</strong></dt>
<dd><p>If <var class="Arg">S</var> is a permutation group, then <code class="code">IsomorphismPartialPermMonoid</code> returns an isomorphism from <var class="Arg">S</var> to an inverse monoid of partial permutations on the set <code class="code">MovedPoints(<var class="Arg">S</var>)</code> obtained using <code class="func">AsPartialPerm</code> (<a href="chap54.html#X81B32CB182489ACA"><span class="RefLink">54.4-1</span></a>). The inverse of this isomorphism is obtained using <code class="func">AsPermutation</code> (<a href="chap42.html#X8353AB8987E35DF3"><span class="RefLink">42.5-5</span></a>).</p>
</dd>
<dt><strong class="Mark">Transformation semigroups</strong></dt>
<dd><p>If <var class="Arg">S</var> is a transformation semigroup satisfying <code class="func">IsInverseMonoid</code> (<a href="chap51.html#X83F1529479D56665"><span class="RefLink">51.4-8</span></a>), then <code class="code">IsomorphismPartialPermMonoid</code> returns an isomorphism from <var class="Arg">S</var> to an inverse monoid of partial permutations on a subset of <code class="code">[1..DegreeOfTransformationSemigroup(<var class="Arg">S</var>)]</code>.</p>
</dd>
</dl>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">S:=InverseSemigroup( </span>
<span class="GAPprompt">></span> <span class="GAPinput">PartialPerm( [ 1, 2, 3, 4, 5 ], [ 4, 2, 3, 1, 5 ] ),</span>
<span class="GAPprompt">></span> <span class="GAPinput">PartialPerm( [ 1, 2, 4, 5 ], [ 3, 1, 4, 2 ] ) );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsMonoid(S); </span>
false
<span class="GAPprompt">gap></span> <span class="GAPinput">iso:=IsomorphismPartialPermMonoid(S);</span>
MappingByFunction( <inverse partial perm semigroup on 5 pts
with 2 generators>, <inverse partial perm monoid on 5 pts
with 2 generators>, function( object ) ... end, function( object ) ..\
. end )
<span class="GAPprompt">gap></span> <span class="GAPinput">Size(S);</span>
508
<span class="GAPprompt">gap></span> <span class="GAPinput">Size(Range(iso));</span>
508
<span class="GAPprompt">gap></span> <span class="GAPinput">G:=Group((1,2)(3,8)(4,6)(5,7), (1,3,4,7)(2,5,6,8), (1,4)(2,6)(3,7)(5,8));;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsomorphismPartialPermSemigroup(G);</span>
MappingByFunction( Group([ (1,2)(3,8)(4,6)(5,7), (1,3,4,7)
(2,5,6,8), (1,4)(2,6)(3,7)(5,8) ]), <inverse partial perm semigroup
on 8 pts
with 3 generators>, function( p ) ... end, function( f ) ... end )
<span class="GAPprompt">gap></span> <span class="GAPinput">S:=Semigroup(Transformation( [ 2, 5, 1, 7, 3, 7, 7 ] ), </span>
<span class="GAPprompt">></span> <span class="GAPinput">Transformation( [ 3, 6, 5, 7, 2, 1, 7 ] ) );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">iso:=IsomorphismPartialPermMonoid(S);;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">MultiplicativeNeutralElement(S)^iso;</span>
<identity partial perm on [ 1, 2, 3, 5, 6, 7 ]>
<span class="GAPprompt">gap></span> <span class="GAPinput">One(Range(iso));</span>
<identity partial perm on [ 1, 2, 3, 5, 6, 7 ]>
<span class="GAPprompt">gap></span> <span class="GAPinput">MovedPoints(Range(iso));</span>
[ 1, 2, 3, 5, 6 ]</pre></div>
<div class="chlinkprevnextbot"> <a href="chap0.html">[Top of Book]</a> <a href="chap0.html#contents">[Contents]</a> <a href="chap53.html">[Previous Chapter]</a> <a href="chap55.html">[Next Chapter]</a> </div>
<div class="chlinkbot"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a> <a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="chap5.html">5</a> <a href="chap6.html">6</a> <a href="chap7.html">7</a> <a href="chap8.html">8</a> <a href="chap9.html">9</a> <a href="chap10.html">10</a> <a href="chap11.html">11</a> <a href="chap12.html">12</a> <a href="chap13.html">13</a> <a href="chap14.html">14</a> <a href="chap15.html">15</a> <a href="chap16.html">16</a> <a href="chap17.html">17</a> <a href="chap18.html">18</a> <a href="chap19.html">19</a> <a href="chap20.html">20</a> <a href="chap21.html">21</a> <a href="chap22.html">22</a> <a href="chap23.html">23</a> <a href="chap24.html">24</a> <a href="chap25.html">25</a> <a href="chap26.html">26</a> <a href="chap27.html">27</a> <a href="chap28.html">28</a> <a href="chap29.html">29</a> <a href="chap30.html">30</a> <a href="chap31.html">31</a> <a href="chap32.html">32</a> <a href="chap33.html">33</a> <a href="chap34.html">34</a> <a href="chap35.html">35</a> <a href="chap36.html">36</a> <a href="chap37.html">37</a> <a href="chap38.html">38</a> <a href="chap39.html">39</a> <a href="chap40.html">40</a> <a href="chap41.html">41</a> <a href="chap42.html">42</a> <a href="chap43.html">43</a> <a href="chap44.html">44</a> <a href="chap45.html">45</a> <a href="chap46.html">46</a> <a href="chap47.html">47</a> <a href="chap48.html">48</a> <a href="chap49.html">49</a> <a href="chap50.html">50</a> <a href="chap51.html">51</a> <a href="chap52.html">52</a> <a href="chap53.html">53</a> <a href="chap54.html">54</a> <a href="chap55.html">55</a> <a href="chap56.html">56</a> <a href="chap57.html">57</a> <a href="chap58.html">58</a> <a href="chap59.html">59</a> <a href="chap60.html">60</a> <a href="chap61.html">61</a> <a href="chap62.html">62</a> <a href="chap63.html">63</a> <a href="chap64.html">64</a> <a href="chap65.html">65</a> <a href="chap66.html">66</a> <a href="chap67.html">67</a> <a href="chap68.html">68</a> <a href="chap69.html">69</a> <a href="chap70.html">70</a> <a href="chap71.html">71</a> <a href="chap72.html">72</a> <a href="chap73.html">73</a> <a href="chap74.html">74</a> <a href="chap75.html">75</a> <a href="chap76.html">76</a> <a href="chap77.html">77</a> <a href="chap78.html">78</a> <a href="chap79.html">79</a> <a href="chap80.html">80</a> <a href="chap81.html">81</a> <a href="chap82.html">82</a> <a href="chap83.html">83</a> <a href="chap84.html">84</a> <a href="chap85.html">85</a> <a href="chap86.html">86</a> <a href="chap87.html">87</a> <a href="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
<hr />
<p class="foot">generated by <a href="http://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
</body>
</html>
|