/usr/share/gap/doc/ref/chap56.html is in gap-doc 4r7p5-2.
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 | <?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 56: Rings</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="chap56" 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="chap55.html">[Previous Chapter]</a> <a href="chap57.html">[Next Chapter]</a> </div>
<p id="mathjaxlink" class="pcenter"><a href="chap56_mj.html">[MathJax on]</a></p>
<p><a id="X81897F6082CACB59" name="X81897F6082CACB59"></a></p>
<div class="ChapSects"><a href="chap56.html#X81897F6082CACB59">56 <span class="Heading">Rings</span></a>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap56.html#X839FC48687C25FCD">56.1 <span class="Heading">Generating Rings</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X80FD843C8221DAC9">56.1-1 IsRing</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X820B172A860A5B1A">56.1-2 <span class="Heading">Ring</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X83AFFCC77DE6ABDA">56.1-3 <span class="Heading">DefaultRing</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7D736E027DFD8961">56.1-4 RingByGenerators</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X839E609480495E27">56.1-5 DefaultRingByGenerators</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7D0428D87E63288C">56.1-6 GeneratorsOfRing</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X860E4AC78520D27E">56.1-7 Subring</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X819B0AFE79C78C34">56.1-8 <span class="Heading">ClosureRing</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X8350500B8576F833">56.1-9 Quotient</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap56.html#X782EC7877DA864C9">56.2 <span class="Heading">Ideals in Rings</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7C486A7C821D79F0">56.2-1 TwoSidedIdeal</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7C8E196478C7431A">56.2-2 TwoSidedIdealNC</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7DF623847B338850">56.2-3 IsTwoSidedIdeal</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X86C998178690DAE0">56.2-4 TwoSidedIdealByGenerators</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X82D8B07281EB0AC7">56.2-5 LeftIdealByGenerators</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X858EAEAF87751428">56.2-6 RightIdealByGenerators</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X86AAF5F9800E97EE">56.2-7 GeneratorsOfTwoSidedIdeal</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7B20BD2B7FAFBD64">56.2-8 GeneratorsOfLeftIdeal</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X80F2239F8653FF74">56.2-9 GeneratorsOfRightIdeal</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X81D81D027C2F8D06">56.2-10 LeftActingRingOfIdeal</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X83D9D7408706B69A">56.2-11 AsLeftIdeal</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap56.html#X790DD00586F9B8B8">56.3 <span class="Heading">Rings With One</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7E601FBD8020A0F3">56.3-1 IsRingWithOne</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X80942A318417366E">56.3-2 <span class="Heading">RingWithOne</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X851115EC79B8C393">56.3-3 RingWithOneByGenerators</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7F9F122C831BCDD1">56.3-4 GeneratorsOfRingWithOne</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7D0BADF178D4DDF8">56.3-5 SubringWithOne</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap56.html#X797F5869874BDBFB">56.4 <span class="Heading">Properties of Rings</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X87A7D5B584713B52">56.4-1 IsIntegralRing</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X789A917085DB7527">56.4-2 IsUniqueFactorizationRing</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7D4BB44187C55BF2">56.4-3 IsLDistributive</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X79A5AEE786AED315">56.4-4 IsRDistributive</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X86716D4F7B968604">56.4-5 IsDistributive</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X82DECD237D49D937">56.4-6 IsAnticommutative</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7EC0FEC88535E8CC">56.4-7 IsZeroSquaredRing</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X799BEF8581971A13">56.4-8 IsJacobianRing</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap56.html#X8130085978A9B3C4">56.5 <span class="Heading">Units and Factorizations</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X85CBFBAE78DE72E8">56.5-1 IsUnit</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X853C045B7BA6A580">56.5-2 Units</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7B307F217DDC7E20">56.5-3 IsAssociated</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7A69C9097E17D161">56.5-4 Associates</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7B1A9A4C7C59FB36">56.5-5 StandardAssociate</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7EB6803C789E027D">56.5-6 StandardAssociateUnit</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7CD7C64A7D961A18">56.5-7 IsIrreducibleRingElement</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7AA107AE7F79C6D8">56.5-8 IsPrime</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X82D6EDC685D12AE2">56.5-9 Factors</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X8559CC7B80C479F1">56.5-10 PadicValuation</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap56.html#X7F12BB99865EB7BF">56.6 <span class="Heading">Euclidean Rings</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X808B8E8E80D48E4A">56.6-1 IsEuclideanRing</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X784234088350D4E4">56.6-2 EuclideanDegree</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7A93FA788318B147">56.6-3 EuclideanQuotient</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7B5E9639865E91BA">56.6-4 EuclideanRemainder</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X876B7532801A1B35">56.6-5 QuotientRemainder</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap56.html#X7E9CF2C07C4A6CEE">56.7 <span class="Heading">Gcd and Lcm</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7DE207718456F98F">56.7-1 <span class="Heading">Gcd</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7836D50F8341D6E1">56.7-2 GcdOp</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7ABB91EF838075EF">56.7-3 <span class="Heading">GcdRepresentation</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X81392E7F84956341">56.7-4 GcdRepresentationOp</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X836DB8B47A0219FB">56.7-5 ShowGcd</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7ABA92057DD6C7AF">56.7-6 <span class="Heading">Lcm</span></a>
</span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7FB6C5A67AC1E8C1">56.7-7 LcmOp</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X8555913A83D716A4">56.7-8 QuotientMod</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X805A35D684B7A952">56.7-9 PowerMod</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X87711E6F8024A358">56.7-10 InterpolatedPolynomial</a></span>
</div></div>
<div class="ContSect"><span class="tocline"><span class="nocss"> </span><a href="chap56.html#X7B13484581169439">56.8 <span class="Heading">Homomorphisms of Rings</span></a>
</span>
<div class="ContSSBlock">
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7DE9CC5B877C91DA">56.8-1 RingGeneralMappingByImages</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X78C1016284F08026">56.8-2 RingHomomorphismByImages</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X7D01646A7CCBEDBB">56.8-3 RingHomomorphismByImagesNC</a></span>
<span class="ContSS"><br /><span class="nocss"> </span><a href="chap56.html#X83D53D98809EC461">56.8-4 NaturalHomomorphismByIdeal</a></span>
</div></div>
</div>
<h3>56 <span class="Heading">Rings</span></h3>
<p>This chapter deals with domains that are additive groups (see <code class="func">IsAdditiveGroup</code> (<a href="chap55.html#X7B8FBD9082CE271B"><span class="RefLink">55.1-6</span></a>) closed under multiplication <code class="code">*</code>. Such a domain, if <code class="code">*</code> and <code class="code">+</code> are distributive, is called a <em>ring</em> in <strong class="pkg">GAP</strong>. Each division ring, field (see <a href="chap58.html#X80A8E676814A19FD"><span class="RefLink">58</span></a>), or algebra (see <a href="chap62.html#X7DDBF6F47A2E021C"><span class="RefLink">62</span></a>) is a ring. Important examples of rings are the integers (see <a href="chap14.html#X853DF11B80068ED5"><span class="RefLink">14</span></a>) and matrix rings.</p>
<p>In the case of a <em>ring-with-one</em>, additional multiplicative structure is present, see <code class="func">IsRingWithOne</code> (<a href="chap56.html#X7E601FBD8020A0F3"><span class="RefLink">56.3-1</span></a>). There is a little support in <strong class="pkg">GAP</strong> for rings that have no additional structure: it is possible to perform some computations for small finite rings; infinite rings are handled by <strong class="pkg">GAP</strong> in an acceptable way in the case that they are algebras.</p>
<p>Also, the <strong class="pkg">SONATA</strong> package provides support for near-rings, and a related functionality for multiplicative semigroups of near-rings is available in the <strong class="pkg">Smallsemi</strong> package.</p>
<p>Several functions for ring elements, such as <code class="func">IsPrime</code> (<a href="chap56.html#X7AA107AE7F79C6D8"><span class="RefLink">56.5-8</span></a>) and <code class="func">Factors</code> (<a href="chap56.html#X82D6EDC685D12AE2"><span class="RefLink">56.5-9</span></a>), are defined only relative to a ring <var class="Arg">R</var>, which can be entered as an optional argument; if <var class="Arg">R</var> is omitted then a <em>default ring</em> is formed from the ring elements given as arguments, see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>).</p>
<p><a id="X839FC48687C25FCD" name="X839FC48687C25FCD"></a></p>
<h4>56.1 <span class="Heading">Generating Rings</span></h4>
<p><a id="X80FD843C8221DAC9" name="X80FD843C8221DAC9"></a></p>
<h5>56.1-1 IsRing</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsRing</code>( <var class="Arg">R</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>A <em>ring</em> in <strong class="pkg">GAP</strong> is an additive group (see <code class="func">IsAdditiveGroup</code> (<a href="chap55.html#X7B8FBD9082CE271B"><span class="RefLink">55.1-6</span></a>)) that is also a magma (see <code class="func">IsMagma</code> (<a href="chap35.html#X87D3F38B7EAB13FA"><span class="RefLink">35.1-1</span></a>)), such that addition <code class="code">+</code> and multiplication <code class="code">*</code> are distributive, see <code class="func">IsDistributive</code> (<a href="chap56.html#X86716D4F7B968604"><span class="RefLink">56.4-5</span></a>).</p>
<p>The multiplication need <em>not</em> be associative (see <code class="func">IsAssociative</code> (<a href="chap35.html#X7C83B5A47FD18FB7"><span class="RefLink">35.4-7</span></a>)). For example, a Lie algebra (see <a href="chap64.html#X78559D4C800AF58A"><span class="RefLink">64</span></a>) is regarded as a ring in <strong class="pkg">GAP</strong>.</p>
<p><a id="X820B172A860A5B1A" name="X820B172A860A5B1A"></a></p>
<h5>56.1-2 <span class="Heading">Ring</span></h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Ring</code>( <var class="Arg">r</var>, <var class="Arg">s</var>, <var class="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">‣ Ring</code>( <var class="Arg">coll</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>In the first form <code class="func">Ring</code> returns the smallest ring that contains all the elements <var class="Arg">r</var>, <var class="Arg">s</var>, <span class="SimpleMath">...</span> In the second form <code class="func">Ring</code> returns the smallest ring that contains all the elements in the collection <var class="Arg">coll</var>. If any element is not an element of a ring or if the elements lie in no common ring an error is raised.</p>
<p><code class="func">Ring</code> differs from <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>) in that it returns the smallest ring in which the elements lie, while <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>) may return a larger ring if that makes sense.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">Ring( 2, E(4) );</span>
<ring with 2 generators>
</pre></div>
<p><a id="X83AFFCC77DE6ABDA" name="X83AFFCC77DE6ABDA"></a></p>
<h5>56.1-3 <span class="Heading">DefaultRing</span></h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DefaultRing</code>( <var class="Arg">r</var>, <var class="Arg">s</var>, <var class="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">‣ DefaultRing</code>( <var class="Arg">coll</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>In the first form <code class="func">DefaultRing</code> returns a ring that contains all the elements <var class="Arg">r</var>, <var class="Arg">s</var>, <span class="SimpleMath">...</span> etc. In the second form <code class="func">DefaultRing</code> returns a ring that contains all the elements in the collection <var class="Arg">coll</var>. If any element is not an element of a ring or if the elements lie in no common ring an error is raised.</p>
<p>The ring returned by <code class="func">DefaultRing</code> need not be the smallest ring in which the elements lie. For example for elements from cyclotomic fields, <code class="func">DefaultRing</code> may return the ring of integers of the smallest cyclotomic field in which the elements lie, which need not be the smallest ring overall, because the elements may in fact lie in a smaller number field which is itself not a cyclotomic field.</p>
<p>(For the exact definition of the default ring of a certain type of elements, look at the corresponding method installation.)</p>
<p><code class="func">DefaultRing</code> is used by ring functions such as <code class="func">Quotient</code> (<a href="chap56.html#X8350500B8576F833"><span class="RefLink">56.1-9</span></a>), <code class="func">IsPrime</code> (<a href="chap56.html#X7AA107AE7F79C6D8"><span class="RefLink">56.5-8</span></a>), <code class="func">Factors</code> (<a href="chap56.html#X82D6EDC685D12AE2"><span class="RefLink">56.5-9</span></a>), or <code class="func">Gcd</code> (<a href="chap56.html#X7DE207718456F98F"><span class="RefLink">56.7-1</span></a>) if no explicit ring is given.</p>
<p><code class="func">Ring</code> (<a href="chap56.html#X820B172A860A5B1A"><span class="RefLink">56.1-2</span></a>) differs from <code class="func">DefaultRing</code> in that it returns the smallest ring in which the elements lie, while <code class="func">DefaultRing</code> may return a larger ring if that makes sense.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">DefaultRing( 2, E(4) );</span>
GaussianIntegers
</pre></div>
<p><a id="X7D736E027DFD8961" name="X7D736E027DFD8961"></a></p>
<h5>56.1-4 RingByGenerators</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RingByGenerators</code>( <var class="Arg">C</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">RingByGenerators</code> returns the ring generated by the elements in the collection <var class="Arg">C</var>, i. e., the closure of <var class="Arg">C</var> under addition, multiplication, and taking additive inverses.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">RingByGenerators([ 2, E(4) ]);</span>
<ring with 2 generators>
</pre></div>
<p><a id="X839E609480495E27" name="X839E609480495E27"></a></p>
<h5>56.1-5 DefaultRingByGenerators</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ DefaultRingByGenerators</code>( <var class="Arg">coll</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>For a collection <var class="Arg">coll</var>, returns a default ring in which <var class="Arg">coll</var> is contained.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">DefaultRingByGenerators([ 2, E(4) ]);</span>
GaussianIntegers
</pre></div>
<p><a id="X7D0428D87E63288C" name="X7D0428D87E63288C"></a></p>
<h5>56.1-6 GeneratorsOfRing</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ GeneratorsOfRing</code>( <var class="Arg">R</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p><code class="func">GeneratorsOfRing</code> returns a list of elements such that the ring <var class="Arg">R</var> is the closure of these elements under addition, multiplication, and taking additive inverses.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">R:=Ring( 2, 1/2 );</span>
<ring with 2 generators>
<span class="GAPprompt">gap></span> <span class="GAPinput">GeneratorsOfRing( R );</span>
[ 2, 1/2 ]
</pre></div>
<p><a id="X860E4AC78520D27E" name="X860E4AC78520D27E"></a></p>
<h5>56.1-7 Subring</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Subring</code>( <var class="Arg">R</var>, <var class="Arg">gens</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">‣ SubringNC</code>( <var class="Arg">R</var>, <var class="Arg">gens</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>returns the ring with parent <var class="Arg">R</var> generated by the elements in <var class="Arg">gens</var>. When the second form, <code class="func">SubringNC</code> is used, it is <em>not</em> checked whether all elements in <var class="Arg">gens</var> lie in <var class="Arg">R</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">R:= Integers;</span>
Integers
<span class="GAPprompt">gap></span> <span class="GAPinput">S:= Subring( R, [ 4, 6 ] );</span>
<ring with 1 generators>
<span class="GAPprompt">gap></span> <span class="GAPinput">Parent( S );</span>
Integers
</pre></div>
<p><a id="X819B0AFE79C78C34" name="X819B0AFE79C78C34"></a></p>
<h5>56.1-8 <span class="Heading">ClosureRing</span></h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ClosureRing</code>( <var class="Arg">R</var>, <var class="Arg">r</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">‣ ClosureRing</code>( <var class="Arg">R</var>, <var class="Arg">S</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>For a ring <var class="Arg">R</var> and either an element <var class="Arg">r</var> of its elements family or a ring <var class="Arg">S</var>, <code class="func">ClosureRing</code> returns the ring generated by both arguments.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">ClosureRing( Integers, E(4) );</span>
<ring-with-one, with 2 generators>
</pre></div>
<p><a id="X8350500B8576F833" name="X8350500B8576F833"></a></p>
<h5>56.1-9 Quotient</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Quotient</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var>, <var class="Arg">s</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">Quotient</code> returns the quotient of the two ring elements <var class="Arg">r</var> and <var class="Arg">s</var> in the ring <var class="Arg">R</var>, if given, and otherwise in their default ring (see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>)). It returns <code class="keyw">fail</code> if the quotient does not exist in the respective ring.</p>
<p>(To perform the division in the quotient field of a ring, use the quotient operator <code class="code">/</code>.)</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">Quotient( 2, 3 );</span>
fail
<span class="GAPprompt">gap></span> <span class="GAPinput">Quotient( 6, 3 );</span>
2
</pre></div>
<p><a id="X782EC7877DA864C9" name="X782EC7877DA864C9"></a></p>
<h4>56.2 <span class="Heading">Ideals in Rings</span></h4>
<p>A <em>left ideal</em> in a ring <span class="SimpleMath">R</span> is a subring of <span class="SimpleMath">R</span> that is closed under multiplication with elements of <span class="SimpleMath">R</span> from the left.</p>
<p>A <em>right ideal</em> in a ring <span class="SimpleMath">R</span> is a subring of <span class="SimpleMath">R</span> that is closed under multiplication with elements of <span class="SimpleMath">R</span> from the right.</p>
<p>A <em>two-sided ideal</em> or simply <em>ideal</em> in a ring <span class="SimpleMath">R</span> is both a left ideal and a right ideal in <span class="SimpleMath">R</span>.</p>
<p>So being a (left/right/two-sided) ideal is not a property of a domain but refers to the acting ring(s). Hence we must ask, e. g., <code class="code">IsIdeal( </code><span class="SimpleMath">R, I</span><code class="code"> )</code> if we want to know whether the ring <span class="SimpleMath">I</span> is an ideal in the ring <span class="SimpleMath">R</span>. The property <code class="func">IsTwoSidedIdealInParent</code> (<a href="chap56.html#X7DF623847B338850"><span class="RefLink">56.2-3</span></a>) can be used to store whether a ring is an ideal in its parent.</p>
<p>(Whenever the term <code class="code">"Ideal"</code> occurs in an identifier without a specifying prefix <code class="code">"Left"</code> or <code class="code">"Right"</code>, this means the same as <code class="code">"TwoSidedIdeal"</code>. Conversely, any occurrence of <code class="code">"TwoSidedIdeal"</code> can be substituted by <code class="code">"Ideal"</code>.)</p>
<p>For any of the above kinds of ideals, there is a notion of generators, namely <code class="func">GeneratorsOfLeftIdeal</code> (<a href="chap56.html#X7B20BD2B7FAFBD64"><span class="RefLink">56.2-8</span></a>), <code class="func">GeneratorsOfRightIdeal</code> (<a href="chap56.html#X80F2239F8653FF74"><span class="RefLink">56.2-9</span></a>), and <code class="func">GeneratorsOfTwoSidedIdeal</code> (<a href="chap56.html#X86AAF5F9800E97EE"><span class="RefLink">56.2-7</span></a>). The acting rings can be accessed as <code class="func">LeftActingRingOfIdeal</code> (<a href="chap56.html#X81D81D027C2F8D06"><span class="RefLink">56.2-10</span></a>) and <code class="func">RightActingRingOfIdeal</code> (<a href="chap56.html#X81D81D027C2F8D06"><span class="RefLink">56.2-10</span></a>), respectively. Note that ideals are detected from known values of these attributes, especially it is assumed that whenever a domain has both a left and a right acting ring then these two are equal.</p>
<p>Note that we cannot use <code class="func">LeftActingDomain</code> (<a href="chap57.html#X86F070E0807DC34E"><span class="RefLink">57.1-11</span></a>) and <code class="code">RightActingDomain</code> here, since ideals in algebras are themselves vector spaces, and such a space can of course also be a module for an action from the right. In order to make the usual vector space functionality automatically available for ideals, we have to distinguish the left and right module structure from the additional closure properties of the ideal.</p>
<p>Further note that the attributes denoting ideal generators and acting ring are used to create ideals if this is explicitly wanted, but the ideal relation in the sense of <code class="func">IsTwoSidedIdeal</code> (<a href="chap56.html#X7DF623847B338850"><span class="RefLink">56.2-3</span></a>) is of course independent of the presence of the attribute values.</p>
<p>Ideals are constructed with <code class="func">LeftIdeal</code> (<a href="chap56.html#X7C486A7C821D79F0"><span class="RefLink">56.2-1</span></a>), <code class="func">RightIdeal</code> (<a href="chap56.html#X7C486A7C821D79F0"><span class="RefLink">56.2-1</span></a>), <code class="func">TwoSidedIdeal</code> (<a href="chap56.html#X7C486A7C821D79F0"><span class="RefLink">56.2-1</span></a>). Principal ideals of the form <span class="SimpleMath">x * R</span>, <span class="SimpleMath">R * x</span>, <span class="SimpleMath">R * x * R</span> can also be constructed with a simple multiplication.</p>
<p>Currently many methods for dealing with ideals need linear algebra to work, so they are mainly applicable to ideals in algebras.</p>
<p><a id="X7C486A7C821D79F0" name="X7C486A7C821D79F0"></a></p>
<h5>56.2-1 TwoSidedIdeal</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ TwoSidedIdeal</code>( <var class="Arg">R</var>, <var class="Arg">gens</var>[, <var class="Arg">"basis"</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">‣ Ideal</code>( <var class="Arg">R</var>, <var class="Arg">gens</var>[, <var class="Arg">"basis"</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">‣ LeftIdeal</code>( <var class="Arg">R</var>, <var class="Arg">gens</var>[, <var class="Arg">"basis"</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">‣ RightIdeal</code>( <var class="Arg">R</var>, <var class="Arg">gens</var>[, <var class="Arg">"basis"</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>Let <var class="Arg">R</var> be a ring, and <var class="Arg">gens</var> a list of collection of elements in <var class="Arg">R</var>. <code class="func">TwoSidedIdeal</code>, <code class="func">LeftIdeal</code>, and <code class="func">RightIdeal</code> return the two-sided, left, or right ideal, respectively, <span class="SimpleMath">I</span> in <var class="Arg">R</var> that is generated by <var class="Arg">gens</var>. The ring <var class="Arg">R</var> can be accessed as <code class="func">LeftActingRingOfIdeal</code> (<a href="chap56.html#X81D81D027C2F8D06"><span class="RefLink">56.2-10</span></a>) or <code class="func">RightActingRingOfIdeal</code> (<a href="chap56.html#X81D81D027C2F8D06"><span class="RefLink">56.2-10</span></a>) (or both) of <span class="SimpleMath">I</span>.</p>
<p>If <var class="Arg">R</var> is a left <span class="SimpleMath">F</span>-module then also <span class="SimpleMath">I</span> is a left <span class="SimpleMath">F</span>-module, in particular the <code class="func">LeftActingDomain</code> (<a href="chap57.html#X86F070E0807DC34E"><span class="RefLink">57.1-11</span></a>) values of <var class="Arg">R</var> and <span class="SimpleMath">I</span> are equal.</p>
<p>If the optional argument <code class="code">"basis"</code> is given then <var class="Arg">gens</var> are assumed to be a list of basis vectors of <span class="SimpleMath">I</span> viewed as a free <span class="SimpleMath">F</span>-module. (This is mainly applicable to ideals in algebras.) In this case, it is <em>not</em> checked whether <var class="Arg">gens</var> really is linearly independent and whether <var class="Arg">gens</var> is a subset of <var class="Arg">R</var>.</p>
<p><code class="func">Ideal</code> is simply a synonym of <code class="func">TwoSidedIdeal</code>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">R:= Integers;;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">I:= Ideal( R, [ 2 ] );</span>
<two-sided ideal in Integers, (1 generators)>
</pre></div>
<p><a id="X7C8E196478C7431A" name="X7C8E196478C7431A"></a></p>
<h5>56.2-2 TwoSidedIdealNC</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ TwoSidedIdealNC</code>( <var class="Arg">R</var>, <var class="Arg">gens</var>[, <var class="Arg">"basis"</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">‣ IdealNC</code>( <var class="Arg">R</var>, <var class="Arg">gens</var>[, <var class="Arg">"basis"</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">‣ LeftIdealNC</code>( <var class="Arg">R</var>, <var class="Arg">gens</var>[, <var class="Arg">"basis"</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">‣ RightIdealNC</code>( <var class="Arg">R</var>, <var class="Arg">gens</var>[, <var class="Arg">"basis"</var>] )</td><td class="tdright">( function )</td></tr></table></div>
<p>The effects of <code class="func">TwoSidedIdealNC</code>, <code class="func">LeftIdealNC</code>, and <code class="func">RightIdealNC</code> are the same as <code class="func">TwoSidedIdeal</code> (<a href="chap56.html#X7C486A7C821D79F0"><span class="RefLink">56.2-1</span></a>), <code class="func">LeftIdeal</code> (<a href="chap56.html#X7C486A7C821D79F0"><span class="RefLink">56.2-1</span></a>), and <code class="func">RightIdeal</code> (<a href="chap56.html#X7C486A7C821D79F0"><span class="RefLink">56.2-1</span></a>), respectively, but they do not check whether all entries of <var class="Arg">gens</var> lie in <var class="Arg">R</var>.</p>
<p><a id="X7DF623847B338850" name="X7DF623847B338850"></a></p>
<h5>56.2-3 IsTwoSidedIdeal</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsTwoSidedIdeal</code>( <var class="Arg">R</var>, <var class="Arg">I</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">‣ IsLeftIdeal</code>( <var class="Arg">R</var>, <var class="Arg">I</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">‣ IsRightIdeal</code>( <var class="Arg">R</var>, <var class="Arg">I</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">‣ IsTwoSidedIdealInParent</code>( <var class="Arg">I</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">‣ IsLeftIdealInParent</code>( <var class="Arg">I</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">‣ IsRightIdealInParent</code>( <var class="Arg">I</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>The properties <code class="func">IsTwoSidedIdealInParent</code> etc., are attributes of the ideal, and once known they are stored in the ideal.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">A:= FullMatrixAlgebra( Rationals, 3 );</span>
( Rationals^[ 3, 3 ] )
<span class="GAPprompt">gap></span> <span class="GAPinput">I:= Ideal( A, [ Random( A ) ] );</span>
<two-sided ideal in ( Rationals^[ 3, 3 ] ), (1 generators)>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsTwoSidedIdeal( A, I );</span>
true
</pre></div>
<p><a id="X86C998178690DAE0" name="X86C998178690DAE0"></a></p>
<h5>56.2-4 TwoSidedIdealByGenerators</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ TwoSidedIdealByGenerators</code>( <var class="Arg">R</var>, <var class="Arg">gens</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">‣ IdealByGenerators</code>( <var class="Arg">R</var>, <var class="Arg">gens</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">TwoSidedIdealByGenerators</code> returns the ring that is generated by the elements of the collection <var class="Arg">gens</var> under addition, multiplication, and multiplication with elements of the ring <var class="Arg">R</var> from the left and from the right.</p>
<p><var class="Arg">R</var> can be accessed by <code class="func">LeftActingRingOfIdeal</code> (<a href="chap56.html#X81D81D027C2F8D06"><span class="RefLink">56.2-10</span></a>) or <code class="func">RightActingRingOfIdeal</code> (<a href="chap56.html#X81D81D027C2F8D06"><span class="RefLink">56.2-10</span></a>), <var class="Arg">gens</var> can be accessed by <code class="func">GeneratorsOfTwoSidedIdeal</code> (<a href="chap56.html#X86AAF5F9800E97EE"><span class="RefLink">56.2-7</span></a>).</p>
<p><a id="X82D8B07281EB0AC7" name="X82D8B07281EB0AC7"></a></p>
<h5>56.2-5 LeftIdealByGenerators</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ LeftIdealByGenerators</code>( <var class="Arg">R</var>, <var class="Arg">gens</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">LeftIdealByGenerators</code> returns the ring that is generated by the elements of the collection <var class="Arg">gens</var> under addition, multiplication, and multiplication with elements of the ring <var class="Arg">R</var> from the left.</p>
<p><var class="Arg">R</var> can be accessed by <code class="func">LeftActingRingOfIdeal</code> (<a href="chap56.html#X81D81D027C2F8D06"><span class="RefLink">56.2-10</span></a>), <var class="Arg">gens</var> can be accessed by <code class="func">GeneratorsOfLeftIdeal</code> (<a href="chap56.html#X7B20BD2B7FAFBD64"><span class="RefLink">56.2-8</span></a>).</p>
<p><a id="X858EAEAF87751428" name="X858EAEAF87751428"></a></p>
<h5>56.2-6 RightIdealByGenerators</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RightIdealByGenerators</code>( <var class="Arg">R</var>, <var class="Arg">gens</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">RightIdealByGenerators</code> returns the ring that is generated by the elements of the collection <var class="Arg">gens</var> under addition, multiplication, and multiplication with elements of the ring <var class="Arg">R</var> from the right.</p>
<p><var class="Arg">R</var> can be accessed by <code class="func">RightActingRingOfIdeal</code> (<a href="chap56.html#X81D81D027C2F8D06"><span class="RefLink">56.2-10</span></a>), <var class="Arg">gens</var> can be accessed by <code class="func">GeneratorsOfRightIdeal</code> (<a href="chap56.html#X80F2239F8653FF74"><span class="RefLink">56.2-9</span></a>).</p>
<p><a id="X86AAF5F9800E97EE" name="X86AAF5F9800E97EE"></a></p>
<h5>56.2-7 GeneratorsOfTwoSidedIdeal</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ GeneratorsOfTwoSidedIdeal</code>( <var class="Arg">I</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">‣ GeneratorsOfIdeal</code>( <var class="Arg">I</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>is a list of generators for the ideal <var class="Arg">I</var>, with respect to the action of the rings that are stored as the values of <code class="func">LeftActingRingOfIdeal</code> (<a href="chap56.html#X81D81D027C2F8D06"><span class="RefLink">56.2-10</span></a>) and <code class="func">RightActingRingOfIdeal</code> (<a href="chap56.html#X81D81D027C2F8D06"><span class="RefLink">56.2-10</span></a>), from the left and from the right, respectively.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">A:= FullMatrixAlgebra( Rationals, 3 );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">I:= Ideal( A, [ One( A ) ] );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">GeneratorsOfIdeal( I );</span>
[ [ [ 1, 0, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] ]
</pre></div>
<p><a id="X7B20BD2B7FAFBD64" name="X7B20BD2B7FAFBD64"></a></p>
<h5>56.2-8 GeneratorsOfLeftIdeal</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ GeneratorsOfLeftIdeal</code>( <var class="Arg">I</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>is a list of generators for the left ideal <var class="Arg">I</var>, with respect to the action from the left of the ring that is stored as the value of <code class="func">LeftActingRingOfIdeal</code> (<a href="chap56.html#X81D81D027C2F8D06"><span class="RefLink">56.2-10</span></a>).</p>
<p><a id="X80F2239F8653FF74" name="X80F2239F8653FF74"></a></p>
<h5>56.2-9 GeneratorsOfRightIdeal</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ GeneratorsOfRightIdeal</code>( <var class="Arg">I</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>is a list of generators for the right ideal <var class="Arg">I</var>, with respect to the action from the right of the ring that is stored as the value of <code class="func">RightActingRingOfIdeal</code> (<a href="chap56.html#X81D81D027C2F8D06"><span class="RefLink">56.2-10</span></a>).</p>
<p><a id="X81D81D027C2F8D06" name="X81D81D027C2F8D06"></a></p>
<h5>56.2-10 LeftActingRingOfIdeal</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ LeftActingRingOfIdeal</code>( <var class="Arg">I</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">‣ RightActingRingOfIdeal</code>( <var class="Arg">I</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p>returns the left (resp. right) acting ring of an ideal <var class="Arg">I</var>.</p>
<p><a id="X83D9D7408706B69A" name="X83D9D7408706B69A"></a></p>
<h5>56.2-11 AsLeftIdeal</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ AsLeftIdeal</code>( <var class="Arg">R</var>, <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">‣ AsRightIdeal</code>( <var class="Arg">R</var>, <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">‣ AsTwoSidedIdeal</code>( <var class="Arg">R</var>, <var class="Arg">S</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>Let <var class="Arg">S</var> be a subring of the ring <var class="Arg">R</var>.</p>
<p>If <var class="Arg">S</var> is a left ideal in <var class="Arg">R</var> then <code class="func">AsLeftIdeal</code> returns this left ideal, otherwise <code class="keyw">fail</code> is returned.</p>
<p>If <var class="Arg">S</var> is a right ideal in <var class="Arg">R</var> then <code class="func">AsRightIdeal</code> returns this right ideal, otherwise <code class="keyw">fail</code> is returned.</p>
<p>If <var class="Arg">S</var> is a two-sided ideal in <var class="Arg">R</var> then <code class="func">AsTwoSidedIdeal</code> returns this two-sided ideal, otherwise <code class="keyw">fail</code> is returned.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">A:= FullMatrixAlgebra( Rationals, 3 );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">B:= DirectSumOfAlgebras( A, A );</span>
<algebra over Rationals, with 6 generators>
<span class="GAPprompt">gap></span> <span class="GAPinput">C:= Subalgebra( B, Basis( B ){[1..9]} );</span>
<algebra over Rationals, with 9 generators>
<span class="GAPprompt">gap></span> <span class="GAPinput">I:= AsTwoSidedIdeal( B, C );</span>
<two-sided ideal in <algebra of dimension 18 over Rationals>,
(9 generators)>
</pre></div>
<p><a id="X790DD00586F9B8B8" name="X790DD00586F9B8B8"></a></p>
<h4>56.3 <span class="Heading">Rings With One</span></h4>
<p><a id="X7E601FBD8020A0F3" name="X7E601FBD8020A0F3"></a></p>
<h5>56.3-1 IsRingWithOne</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsRingWithOne</code>( <var class="Arg">R</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>A <em>ring-with-one</em> in <strong class="pkg">GAP</strong> is a ring (see <code class="func">IsRing</code> (<a href="chap56.html#X80FD843C8221DAC9"><span class="RefLink">56.1-1</span></a>)) that is also a magma-with-one (see <code class="func">IsMagmaWithOne</code> (<a href="chap35.html#X86071DE7835F1C7C"><span class="RefLink">35.1-2</span></a>)).</p>
<p>Note that the identity and the zero of a ring-with-one need <em>not</em> be distinct. This means that a ring that consists only of its zero element can be regarded as a ring-with-one.</p>
<p>This is especially useful in the case of finitely presented rings, in the sense that each factor of a ring-with-one is again a ring-with-one.</p>
<p><a id="X80942A318417366E" name="X80942A318417366E"></a></p>
<h5>56.3-2 <span class="Heading">RingWithOne</span></h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RingWithOne</code>( <var class="Arg">r</var>, <var class="Arg">s</var>, <var class="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">‣ RingWithOne</code>( <var class="Arg">coll</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>In the first form <code class="func">RingWithOne</code> returns the smallest ring with one that contains all the elements <var class="Arg">r</var>, <var class="Arg">s</var>, <span class="SimpleMath">...</span> In the second form <code class="func">RingWithOne</code> returns the smallest ring with one that contains all the elements in the collection <var class="Arg">C</var>. If any element is not an element of a ring or if the elements lie in no common ring an error is raised.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">RingWithOne( [ 4, 6 ] );</span>
Integers
</pre></div>
<p><a id="X851115EC79B8C393" name="X851115EC79B8C393"></a></p>
<h5>56.3-3 RingWithOneByGenerators</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RingWithOneByGenerators</code>( <var class="Arg">coll</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">RingWithOneByGenerators</code> returns the ring-with-one generated by the elements in the collection <var class="Arg">coll</var>, i. e., the closure of <var class="Arg">coll</var> under addition, multiplication, taking additive inverses, and taking the identity of an element.</p>
<p><a id="X7F9F122C831BCDD1" name="X7F9F122C831BCDD1"></a></p>
<h5>56.3-4 GeneratorsOfRingWithOne</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ GeneratorsOfRingWithOne</code>( <var class="Arg">R</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p><code class="func">GeneratorsOfRingWithOne</code> returns a list of elements such that the ring <var class="Arg">R</var> is the closure of these elements under addition, multiplication, taking additive inverses, and taking the identity element <code class="code">One( <var class="Arg">R</var> )</code>.</p>
<p><var class="Arg">R</var> itself need <em>not</em> be known to be a ring-with-one.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">R:= RingWithOne( [ 4, 6 ] );</span>
Integers
<span class="GAPprompt">gap></span> <span class="GAPinput">GeneratorsOfRingWithOne( R );</span>
[ 1 ]
</pre></div>
<p><a id="X7D0BADF178D4DDF8" name="X7D0BADF178D4DDF8"></a></p>
<h5>56.3-5 SubringWithOne</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ SubringWithOne</code>( <var class="Arg">R</var>, <var class="Arg">gens</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">‣ SubringWithOneNC</code>( <var class="Arg">R</var>, <var class="Arg">gens</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>returns the ring with one with parent <var class="Arg">R</var> generated by the elements in <var class="Arg">gens</var>. When the second form, <code class="func">SubringWithOneNC</code> is used, it is <em>not</em> checked whether all elements in <var class="Arg">gens</var> lie in <var class="Arg">R</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">R:= SubringWithOne( Integers, [ 4, 6 ] );</span>
Integers
<span class="GAPprompt">gap></span> <span class="GAPinput">Parent( R );</span>
Integers
</pre></div>
<p><a id="X797F5869874BDBFB" name="X797F5869874BDBFB"></a></p>
<h4>56.4 <span class="Heading">Properties of Rings</span></h4>
<p><a id="X87A7D5B584713B52" name="X87A7D5B584713B52"></a></p>
<h5>56.4-1 IsIntegralRing</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsIntegralRing</code>( <var class="Arg">R</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>A ring-with-one <var class="Arg">R</var> is integral if it is commutative, contains no nontrivial zero divisors, and if its identity is distinct from its zero.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsIntegralRing( Integers );</span>
true
</pre></div>
<p><a id="X789A917085DB7527" name="X789A917085DB7527"></a></p>
<h5>56.4-2 IsUniqueFactorizationRing</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsUniqueFactorizationRing</code>( <var class="Arg">R</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>A ring <var class="Arg">R</var> is called a <em>unique factorization ring</em> if it is an integral ring (see <code class="func">IsIntegralRing</code> (<a href="chap56.html#X87A7D5B584713B52"><span class="RefLink">56.4-1</span></a>)), and every nonzero element has a unique factorization into irreducible elements, i.e., a unique representation as product of irreducibles (see <code class="func">IsIrreducibleRingElement</code> (<a href="chap56.html#X7CD7C64A7D961A18"><span class="RefLink">56.5-7</span></a>)). Unique in this context means unique up to permutations of the factors and up to multiplication of the factors by units (see <code class="func">Units</code> (<a href="chap56.html#X853C045B7BA6A580"><span class="RefLink">56.5-2</span></a>)).</p>
<p>Mathematically, a field should therefore also be a unique factorization ring, since every nonzero element is a unit. In <strong class="pkg">GAP</strong>, however, at least at present fields do not lie in the filter <code class="func">IsUniqueFactorizationRing</code>, since operations such as <code class="func">Factors</code> (<a href="chap56.html#X82D6EDC685D12AE2"><span class="RefLink">56.5-9</span></a>), <code class="func">Gcd</code> (<a href="chap56.html#X7DE207718456F98F"><span class="RefLink">56.7-1</span></a>), <code class="func">StandardAssociate</code> (<a href="chap56.html#X7B1A9A4C7C59FB36"><span class="RefLink">56.5-5</span></a>) and so on do not apply to fields (the results would be trivial, and not especially useful) and methods which require their arguments to lie in <code class="func">IsUniqueFactorizationRing</code> expect these operations to work.</p>
<p>(Note that we cannot install a subset maintained method for this filter since the factorization of an element needs not exist in a subring. As an example, consider the subring <span class="SimpleMath">4 ℕ + 1</span> of the ring <span class="SimpleMath">4 ℤ + 1</span>; in the subring, the element <span class="SimpleMath">3 ⋅ 3 ⋅ 11 ⋅ 7</span> has the two factorizations <span class="SimpleMath">33 ⋅ 21 = 9 ⋅ 77</span>, but in the large ring there is the unique factorization <span class="SimpleMath">(-3) ⋅ (-3) ⋅ (-11) ⋅ (-7)</span>, and it is easy to see that every element in <span class="SimpleMath">4 ℤ + 1</span> has a unique factorization.)</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsUniqueFactorizationRing( PolynomialRing( Rationals, 1 ) );</span>
true
</pre></div>
<p><a id="X7D4BB44187C55BF2" name="X7D4BB44187C55BF2"></a></p>
<h5>56.4-3 IsLDistributive</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsLDistributive</code>( <var class="Arg">C</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>is <code class="keyw">true</code> if the relation <span class="SimpleMath">a * ( b + c ) = ( a * b ) + ( a * c )</span> holds for all elements <span class="SimpleMath">a</span>, <span class="SimpleMath">b</span>, <span class="SimpleMath">c</span> in the collection <var class="Arg">C</var>, and <code class="keyw">false</code> otherwise.</p>
<p><a id="X79A5AEE786AED315" name="X79A5AEE786AED315"></a></p>
<h5>56.4-4 IsRDistributive</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsRDistributive</code>( <var class="Arg">C</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>is <code class="keyw">true</code> if the relation <span class="SimpleMath">( a + b ) * c = ( a * c ) + ( b * c )</span> holds for all elements <span class="SimpleMath">a</span>, <span class="SimpleMath">b</span>, <span class="SimpleMath">c</span> in the collection <var class="Arg">C</var>, and <code class="keyw">false</code> otherwise.</p>
<p><a id="X86716D4F7B968604" name="X86716D4F7B968604"></a></p>
<h5>56.4-5 IsDistributive</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsDistributive</code>( <var class="Arg">C</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>is <code class="keyw">true</code> if the collection <var class="Arg">C</var> is both left and right distributive (see <code class="func">IsLDistributive</code> (<a href="chap56.html#X7D4BB44187C55BF2"><span class="RefLink">56.4-3</span></a>), <code class="func">IsRDistributive</code> (<a href="chap56.html#X79A5AEE786AED315"><span class="RefLink">56.4-4</span></a>)), and <code class="keyw">false</code> otherwise.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsDistributive( Integers );</span>
true
</pre></div>
<p><a id="X82DECD237D49D937" name="X82DECD237D49D937"></a></p>
<h5>56.4-6 IsAnticommutative</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsAnticommutative</code>( <var class="Arg">R</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>is <code class="keyw">true</code> if the relation <span class="SimpleMath">a * b = - b * a</span> holds for all elements <span class="SimpleMath">a</span>, <span class="SimpleMath">b</span> in the ring <var class="Arg">R</var>, and <code class="keyw">false</code> otherwise.</p>
<p><a id="X7EC0FEC88535E8CC" name="X7EC0FEC88535E8CC"></a></p>
<h5>56.4-7 IsZeroSquaredRing</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsZeroSquaredRing</code>( <var class="Arg">R</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>is <code class="keyw">true</code> if <span class="SimpleMath">a * a</span> is the zero element of the ring <var class="Arg">R</var> for all <span class="SimpleMath">a</span> in <var class="Arg">R</var>, and <code class="keyw">false</code> otherwise.</p>
<p><a id="X799BEF8581971A13" name="X799BEF8581971A13"></a></p>
<h5>56.4-8 IsJacobianRing</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsJacobianRing</code>( <var class="Arg">R</var> )</td><td class="tdright">( property )</td></tr></table></div>
<p>is <code class="keyw">true</code> if the Jacobi identity holds in the ring <var class="Arg">R</var>, and <code class="keyw">false</code> otherwise. The Jacobi identity means that <span class="SimpleMath">x * (y * z) + z * (x * y) + y * (z * x)</span> is the zero element of <var class="Arg">R</var>, for all elements <span class="SimpleMath">x</span>, <span class="SimpleMath">y</span>, <span class="SimpleMath">z</span> in <var class="Arg">R</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">L:= FullMatrixLieAlgebra( GF( 5 ), 7 );</span>
<Lie algebra over GF(5), with 13 generators>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsJacobianRing( L );</span>
true
</pre></div>
<p><a id="X8130085978A9B3C4" name="X8130085978A9B3C4"></a></p>
<h4>56.5 <span class="Heading">Units and Factorizations</span></h4>
<p><a id="X85CBFBAE78DE72E8" name="X85CBFBAE78DE72E8"></a></p>
<h5>56.5-1 IsUnit</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsUnit</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">IsUnit</code> returns <code class="keyw">true</code> if <var class="Arg">r</var> is a unit in the ring <var class="Arg">R</var>, if given, and otherwise in its default ring (see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>)). If <var class="Arg">r</var> is not a unit then <code class="keyw">false</code> is returned.</p>
<p>An element <var class="Arg">r</var> is called a <em>unit</em> in a ring <var class="Arg">R</var>, if <var class="Arg">r</var> has an inverse in <var class="Arg">R</var>.</p>
<p><code class="func">IsUnit</code> may call <code class="func">Quotient</code> (<a href="chap56.html#X8350500B8576F833"><span class="RefLink">56.1-9</span></a>).</p>
<p><a id="X853C045B7BA6A580" name="X853C045B7BA6A580"></a></p>
<h5>56.5-2 Units</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Units</code>( <var class="Arg">R</var> )</td><td class="tdright">( attribute )</td></tr></table></div>
<p><code class="func">Units</code> returns the group of units of the ring <var class="Arg">R</var>. This may either be returned as a list or as a group.</p>
<p>An element <span class="SimpleMath">r</span> is called a <em>unit</em> of a ring <span class="SimpleMath">R</span> if <span class="SimpleMath">r</span> has an inverse in <span class="SimpleMath">R</span>. It is easy to see that the set of units forms a multiplicative group.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">Units( GaussianIntegers );</span>
[ -1, 1, -E(4), E(4) ]
<span class="GAPprompt">gap></span> <span class="GAPinput">Units( GF( 16 ) );</span>
<group with 1 generators>
</pre></div>
<p><a id="X7B307F217DDC7E20" name="X7B307F217DDC7E20"></a></p>
<h5>56.5-3 IsAssociated</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsAssociated</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var>, <var class="Arg">s</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">IsAssociated</code> returns <code class="keyw">true</code> if the two ring elements <var class="Arg">r</var> and <var class="Arg">s</var> are associated in the ring <var class="Arg">R</var>, if given, and otherwise in their default ring (see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>)). If the two elements are not associated then <code class="keyw">false</code> is returned.</p>
<p>Two elements <var class="Arg">r</var> and <var class="Arg">s</var> of a ring <var class="Arg">R</var> are called <em>associated</em> if there is a unit <span class="SimpleMath">u</span> of <var class="Arg">R</var> such that <var class="Arg">r</var> <span class="SimpleMath">u =</span><var class="Arg">s</var>.</p>
<p><a id="X7A69C9097E17D161" name="X7A69C9097E17D161"></a></p>
<h5>56.5-4 Associates</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Associates</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">Associates</code> returns the set of associates of <var class="Arg">r</var> in the ring <var class="Arg">R</var>, if given, and otherwise in its default ring (see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>)).</p>
<p>Two elements <var class="Arg">r</var> and <span class="SimpleMath">s</span> of a ring <span class="SimpleMath">R</span> are called <em>associated</em> if there is a unit <span class="SimpleMath">u</span> of <span class="SimpleMath">R</span> such that <span class="SimpleMath"><var class="Arg">r</var> u = s</span>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">Associates( Integers, 2 );</span>
[ -2, 2 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">Associates( GaussianIntegers, 2 );</span>
[ -2, 2, -2*E(4), 2*E(4) ]
</pre></div>
<p><a id="X7B1A9A4C7C59FB36" name="X7B1A9A4C7C59FB36"></a></p>
<h5>56.5-5 StandardAssociate</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ StandardAssociate</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">StandardAssociate</code> returns the standard associate of the ring element <var class="Arg">r</var> in the ring <var class="Arg">R</var>, if given, and otherwise in its default ring (see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>)).</p>
<p>The <em>standard associate</em> of a ring element <var class="Arg">r</var> of <var class="Arg">R</var> is an associated element of <var class="Arg">r</var> which is, in a ring dependent way, distinguished among the set of associates of <var class="Arg">r</var>. For example, in the ring of integers the standard associate is the absolute value.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">x:= Indeterminate( Rationals, "x" );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">StandardAssociate( -x^2-x+1 );</span>
x^2+x-1
</pre></div>
<p><a id="X7EB6803C789E027D" name="X7EB6803C789E027D"></a></p>
<h5>56.5-6 StandardAssociateUnit</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ StandardAssociateUnit</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">StandardAssociateUnit</code> returns a unit in the ring <var class="Arg">R</var> such that the ring element <var class="Arg">r</var> times this unit equals the standard associate of <var class="Arg">r</var> in <var class="Arg">R</var>.</p>
<p>If <var class="Arg">R</var> is not given, the default ring of <var class="Arg">r</var> is used instead. (see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>)).</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">y:= Indeterminate( Rationals, "y" );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">r:= -y^2-y+1;</span>
-y^2-y+1
<span class="GAPprompt">gap></span> <span class="GAPinput">StandardAssociateUnit( r );</span>
-1
<span class="GAPprompt">gap></span> <span class="GAPinput">StandardAssociateUnit( r ) * r = StandardAssociate( r );</span>
true
</pre></div>
<p><a id="X7CD7C64A7D961A18" name="X7CD7C64A7D961A18"></a></p>
<h5>56.5-7 IsIrreducibleRingElement</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsIrreducibleRingElement</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">IsIrreducibleRingElement</code> returns <code class="keyw">true</code> if the ring element <var class="Arg">r</var> is irreducible in the ring <var class="Arg">R</var>, if given, and otherwise in its default ring (see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>)). If <var class="Arg">r</var> is not irreducible then <code class="keyw">false</code> is returned.</p>
<p>An element <var class="Arg">r</var> of a ring <var class="Arg">R</var> is called <em>irreducible</em> if <var class="Arg">r</var> is not a unit in <var class="Arg">R</var> and if there is no nontrivial factorization of <var class="Arg">r</var> in <var class="Arg">R</var>, i.e., if there is no representation of <var class="Arg">r</var> as product <span class="SimpleMath">s t</span> such that neither <span class="SimpleMath">s</span> nor <span class="SimpleMath">t</span> is a unit (see <code class="func">IsUnit</code> (<a href="chap56.html#X85CBFBAE78DE72E8"><span class="RefLink">56.5-1</span></a>)). Each prime element (see <code class="func">IsPrime</code> (<a href="chap56.html#X7AA107AE7F79C6D8"><span class="RefLink">56.5-8</span></a>)) is irreducible.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsIrreducibleRingElement( Integers, 2 );</span>
true
</pre></div>
<p><a id="X7AA107AE7F79C6D8" name="X7AA107AE7F79C6D8"></a></p>
<h5>56.5-8 IsPrime</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsPrime</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">IsPrime</code> returns <code class="keyw">true</code> if the ring element <var class="Arg">r</var> is a prime in the ring <var class="Arg">R</var>, if given, and otherwise in its default ring (see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>)). If <var class="Arg">r</var> is not a prime then <code class="keyw">false</code> is returned.</p>
<p>An element <var class="Arg">r</var> of a ring <var class="Arg">R</var> is called <em>prime</em> if for each pair <span class="SimpleMath">s</span> and <span class="SimpleMath">t</span> such that <var class="Arg">r</var> divides <span class="SimpleMath">s t</span> the element <var class="Arg">r</var> divides either <span class="SimpleMath">s</span> or <span class="SimpleMath">t</span>. Note that there are rings where not every irreducible element (see <code class="func">IsIrreducibleRingElement</code> (<a href="chap56.html#X7CD7C64A7D961A18"><span class="RefLink">56.5-7</span></a>)) is a prime.</p>
<p><a id="X82D6EDC685D12AE2" name="X82D6EDC685D12AE2"></a></p>
<h5>56.5-9 Factors</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Factors</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">Factors</code> returns the factorization of the ring element <var class="Arg">r</var> in the ring <var class="Arg">R</var>, if given, and otherwise in in its default ring (see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>)). The factorization is returned as a list of primes (see <code class="func">IsPrime</code> (<a href="chap56.html#X7AA107AE7F79C6D8"><span class="RefLink">56.5-8</span></a>)). Each element in the list is a standard associate (see <code class="func">StandardAssociate</code> (<a href="chap56.html#X7B1A9A4C7C59FB36"><span class="RefLink">56.5-5</span></a>)) except the first one, which is multiplied by a unit as necessary to have <code class="code">Product( Factors( <var class="Arg">R</var>, <var class="Arg">r</var> ) ) = <var class="Arg">r</var></code>. This list is usually also sorted, thus smallest prime factors come first. If <var class="Arg">r</var> is a unit or zero, <code class="code">Factors( <var class="Arg">R</var>, <var class="Arg">r</var> ) = [ <var class="Arg">r</var> ]</code>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">x:= Indeterminate( GF(2), "x" );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">pol:= x^2+x+1;</span>
x^2+x+Z(2)^0
<span class="GAPprompt">gap></span> <span class="GAPinput">Factors( pol );</span>
[ x^2+x+Z(2)^0 ]
<span class="GAPprompt">gap></span> <span class="GAPinput">Factors( PolynomialRing( GF(4) ), pol );</span>
[ x+Z(2^2), x+Z(2^2)^2 ]
</pre></div>
<p><a id="X8559CC7B80C479F1" name="X8559CC7B80C479F1"></a></p>
<h5>56.5-10 PadicValuation</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ PadicValuation</code>( <var class="Arg">r</var>, <var class="Arg">p</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">PadicValuation</code> is the operation to compute the <var class="Arg">p</var>-adic valuation of a ring element <var class="Arg">r</var>.</p>
<p><a id="X7F12BB99865EB7BF" name="X7F12BB99865EB7BF"></a></p>
<h4>56.6 <span class="Heading">Euclidean Rings</span></h4>
<p><a id="X808B8E8E80D48E4A" name="X808B8E8E80D48E4A"></a></p>
<h5>56.6-1 IsEuclideanRing</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ IsEuclideanRing</code>( <var class="Arg">R</var> )</td><td class="tdright">( category )</td></tr></table></div>
<p>A ring <span class="SimpleMath">R</span> is called a Euclidean ring if it is an integral ring and there exists a function <span class="SimpleMath">δ</span>, called the Euclidean degree, from <span class="SimpleMath">R-{0_R}</span> to the nonnegative integers, such that for every pair <span class="SimpleMath">r ∈ R</span> and <span class="SimpleMath">s ∈ R-{0_R}</span> there exists an element <span class="SimpleMath">q</span> such that either <span class="SimpleMath">r - q s = 0_R</span> or <span class="SimpleMath">δ(r - q s) < δ( s )</span>. In <strong class="pkg">GAP</strong> the Euclidean degree <span class="SimpleMath">δ</span> is implicitly built into a ring and cannot be changed. The existence of this division with remainder implies that the Euclidean algorithm can be applied to compute a greatest common divisor of two elements, which in turn implies that <span class="SimpleMath">R</span> is a unique factorization ring.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">IsEuclideanRing( GaussianIntegers );</span>
true
</pre></div>
<p><a id="X784234088350D4E4" name="X784234088350D4E4"></a></p>
<h5>56.6-2 EuclideanDegree</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ EuclideanDegree</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">EuclideanDegree</code> returns the Euclidean degree of the ring element <var class="Arg">r</var> in the ring <var class="Arg">R</var>, if given, and otherwise in its default ring (see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>)).</p>
<p>The ring <var class="Arg">R</var> must be a Euclidean ring (see <code class="func">IsEuclideanRing</code> (<a href="chap56.html#X808B8E8E80D48E4A"><span class="RefLink">56.6-1</span></a>)).</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">EuclideanDegree( GaussianIntegers, 3 );</span>
9
</pre></div>
<p><a id="X7A93FA788318B147" name="X7A93FA788318B147"></a></p>
<h5>56.6-3 EuclideanQuotient</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ EuclideanQuotient</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var>, <var class="Arg">m</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">EuclideanQuotient</code> returns the Euclidean quotient of the ring elements <var class="Arg">r</var> and <var class="Arg">m</var> in the ring <var class="Arg">R</var>, if given, and otherwise in their default ring (see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>)).</p>
<p>The ring <var class="Arg">R</var> must be a Euclidean ring (see <code class="func">IsEuclideanRing</code> (<a href="chap56.html#X808B8E8E80D48E4A"><span class="RefLink">56.6-1</span></a>)), otherwise an error is signalled.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">EuclideanQuotient( 8, 3 );</span>
2
</pre></div>
<p><a id="X7B5E9639865E91BA" name="X7B5E9639865E91BA"></a></p>
<h5>56.6-4 EuclideanRemainder</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ EuclideanRemainder</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var>, <var class="Arg">m</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">EuclideanRemainder</code> returns the Euclidean remainder of the ring element <var class="Arg">r</var> modulo the ring element <var class="Arg">m</var> in the ring <var class="Arg">R</var>, if given, and otherwise in their default ring (see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>)).</p>
<p>The ring <var class="Arg">R</var> must be a Euclidean ring (see <code class="func">IsEuclideanRing</code> (<a href="chap56.html#X808B8E8E80D48E4A"><span class="RefLink">56.6-1</span></a>)), otherwise an error is signalled.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">EuclideanRemainder( 8, 3 );</span>
2
</pre></div>
<p><a id="X876B7532801A1B35" name="X876B7532801A1B35"></a></p>
<h5>56.6-5 QuotientRemainder</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ QuotientRemainder</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var>, <var class="Arg">m</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">QuotientRemainder</code> returns the Euclidean quotient and the Euclidean remainder of the ring elements <var class="Arg">r</var> and <var class="Arg">m</var> in the ring <var class="Arg">R</var>, if given, and otherwise in their default ring (see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>)). The result is a pair of ring elements.</p>
<p>The ring <var class="Arg">R</var> must be a Euclidean ring (see <code class="func">IsEuclideanRing</code> (<a href="chap56.html#X808B8E8E80D48E4A"><span class="RefLink">56.6-1</span></a>)), otherwise an error is signalled.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">QuotientRemainder( GaussianIntegers, 8, 3 );</span>
[ 3, -1 ]
</pre></div>
<p><a id="X7E9CF2C07C4A6CEE" name="X7E9CF2C07C4A6CEE"></a></p>
<h4>56.7 <span class="Heading">Gcd and Lcm</span></h4>
<p><a id="X7DE207718456F98F" name="X7DE207718456F98F"></a></p>
<h5>56.7-1 <span class="Heading">Gcd</span></h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Gcd</code>( [<var class="Arg">R</var>, ]<var class="Arg">r1</var>, <var class="Arg">r2</var>, <var class="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">‣ Gcd</code>( [<var class="Arg">R</var>, ]<var class="Arg">list</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p><code class="func">Gcd</code> returns the greatest common divisor of the ring elements <var class="Arg">r1</var>, <var class="Arg">r2</var>, <span class="SimpleMath">...</span> resp. of the ring elements in the list <var class="Arg">list</var> in the ring <var class="Arg">R</var>, if given, and otherwise in their default ring, see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>).</p>
<p><code class="func">Gcd</code> returns the standard associate (see <code class="func">StandardAssociate</code> (<a href="chap56.html#X7B1A9A4C7C59FB36"><span class="RefLink">56.5-5</span></a>)) of the greatest common divisors.</p>
<p>A divisor of an element <span class="SimpleMath">r</span> in the ring <span class="SimpleMath">R</span> is an element <span class="SimpleMath">d∈ R</span> such that <span class="SimpleMath">r</span> is a multiple of <span class="SimpleMath">d</span>. A common divisor of the elements <span class="SimpleMath">r_1, r_2, ...</span> in the ring <span class="SimpleMath">R</span> is an element <span class="SimpleMath">d∈ R</span> which is a divisor of each <span class="SimpleMath">r_1, r_2, ...</span>. A greatest common divisor <span class="SimpleMath">d</span> in addition has the property that every other common divisor of <span class="SimpleMath">r_1, r_2, ...</span> is a divisor of <span class="SimpleMath">d</span>.</p>
<p>Note that this in particular implies the following: For the zero element <span class="SimpleMath">z</span> of <var class="Arg">R</var>, we have <code class="code">Gcd( <var class="Arg">r</var>, </code><span class="SimpleMath">z</span><code class="code"> ) = Gcd( </code><span class="SimpleMath">z</span><code class="code">, <var class="Arg">r</var> ) = StandardAssociate( <var class="Arg">r</var> )</code> and <code class="code">Gcd( </code><span class="SimpleMath">z</span><code class="code">, </code><span class="SimpleMath">z</span><code class="code"> ) = </code><span class="SimpleMath">z</span>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">Gcd( Integers, [ 10, 15 ] );</span>
5
</pre></div>
<p><a id="X7836D50F8341D6E1" name="X7836D50F8341D6E1"></a></p>
<h5>56.7-2 GcdOp</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ GcdOp</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var>, <var class="Arg">s</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">GcdOp</code> is the operation to compute the greatest common divisor of two ring elements <var class="Arg">r</var>, <var class="Arg">s</var> in the ring <var class="Arg">R</var> or in their default ring.</p>
<p><a id="X7ABB91EF838075EF" name="X7ABB91EF838075EF"></a></p>
<h5>56.7-3 <span class="Heading">GcdRepresentation</span></h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ GcdRepresentation</code>( [<var class="Arg">R</var>, ]<var class="Arg">r1</var>, <var class="Arg">r2</var>, <var class="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">‣ GcdRepresentation</code>( [<var class="Arg">R</var>, ]<var class="Arg">list</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p><code class="func">GcdRepresentation</code> returns a representation of the greatest common divisor of the ring elements <var class="Arg">r1</var>, <var class="Arg">r2</var>, <span class="SimpleMath">...</span> resp. of the ring elements in the list <var class="Arg">list</var> in the Euclidean ring <var class="Arg">R</var>, if given, and otherwise in their default ring, see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>).</p>
<p>A representation of the gcd <span class="SimpleMath">g</span> of the elements <span class="SimpleMath">r_1, r_2, ...</span> of a ring <span class="SimpleMath">R</span> is a list of ring elements <span class="SimpleMath">s_1, s_2, ...</span> of <span class="SimpleMath">R</span>, such that <span class="SimpleMath">g = s_1 r_1 + s_2 r_2 + ⋯</span>. Such representations do not exist in all rings, but they do exist in Euclidean rings (see <code class="func">IsEuclideanRing</code> (<a href="chap56.html#X808B8E8E80D48E4A"><span class="RefLink">56.6-1</span></a>)), which can be shown using the Euclidean algorithm, which in fact can compute those coefficients.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">a:= Indeterminate( Rationals, "a" );;</span>
<span class="GAPprompt">gap></span> <span class="GAPinput">GcdRepresentation( a^2+1, a^3+1 );</span>
[ -1/2*a^2-1/2*a+1/2, 1/2*a+1/2 ]
</pre></div>
<p><code class="func">Gcdex</code> (<a href="chap14.html#X8775930486BD0C5B"><span class="RefLink">14.3-5</span></a>) provides similar functionality over the integers.</p>
<p><a id="X81392E7F84956341" name="X81392E7F84956341"></a></p>
<h5>56.7-4 GcdRepresentationOp</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ GcdRepresentationOp</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var>, <var class="Arg">s</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">GcdRepresentationOp</code> is the operation to compute the representation of the greatest common divisor of two ring elements <var class="Arg">r</var>, <var class="Arg">s</var> in the Euclidean ring <var class="Arg">R</var> or in their default ring, respectively.</p>
<p><a id="X836DB8B47A0219FB" name="X836DB8B47A0219FB"></a></p>
<h5>56.7-5 ShowGcd</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ ShowGcd</code>( <var class="Arg">a</var>, <var class="Arg">b</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p>This function takes two elements <var class="Arg">a</var> and <var class="Arg">b</var> of an Euclidean ring and returns their greatest common divisor. It will print out the steps performed by the Euclidean algorithm, as well as the rearrangement of these steps to express the gcd as a ring combination of <var class="Arg">a</var> and <var class="Arg">b</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">ShowGcd(192,42);</span>
192=4*42 + 24
42=1*24 + 18
24=1*18 + 6
18=3*6 + 0
The Gcd is 6
= 1*24 -1*18
= -1*42 + 2*24
= 2*192 -9*42
6
</pre></div>
<p><a id="X7ABA92057DD6C7AF" name="X7ABA92057DD6C7AF"></a></p>
<h5>56.7-6 <span class="Heading">Lcm</span></h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ Lcm</code>( [<var class="Arg">R</var>, ]<var class="Arg">r1</var>, <var class="Arg">r2</var>, <var class="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">‣ Lcm</code>( [<var class="Arg">R</var>, ]<var class="Arg">list</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p><code class="func">Lcm</code> returns the least common multiple of the ring elements <var class="Arg">r1</var>, <var class="Arg">r2</var>, <span class="SimpleMath">...</span> resp. of the ring elements in the list <var class="Arg">list</var> in the ring <var class="Arg">R</var>, if given, and otherwise in their default ring, see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>).</p>
<p><code class="func">Lcm</code> returns the standard associate (see <code class="func">StandardAssociate</code> (<a href="chap56.html#X7B1A9A4C7C59FB36"><span class="RefLink">56.5-5</span></a>)) of the least common multiples.</p>
<p>A least common multiple of the elements <span class="SimpleMath">r_1, r_2, ...</span> of the ring <span class="SimpleMath">R</span> is an element <span class="SimpleMath">m</span> that is a multiple of <span class="SimpleMath">r_1, r_2, ...</span>, and every other multiple of these elements is a multiple of <span class="SimpleMath">m</span>.</p>
<p>Note that this in particular implies the following: For the zero element <span class="SimpleMath">z</span> of <var class="Arg">R</var>, we have <code class="code">Lcm( <var class="Arg">r</var>, </code><span class="SimpleMath">z</span><code class="code"> ) = Lcm( </code><span class="SimpleMath">z</span><code class="code">, <var class="Arg">r</var> ) = StandardAssociate( <var class="Arg">r</var> )</code> and <code class="code">Lcm( </code><span class="SimpleMath">z</span><code class="code">, </code><span class="SimpleMath">z</span><code class="code"> ) = </code><span class="SimpleMath">z</span>.</p>
<p><a id="X7FB6C5A67AC1E8C1" name="X7FB6C5A67AC1E8C1"></a></p>
<h5>56.7-7 LcmOp</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ LcmOp</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var>, <var class="Arg">s</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">LcmOp</code> is the operation to compute the least common multiple of two ring elements <var class="Arg">r</var>, <var class="Arg">s</var> in the ring <var class="Arg">R</var> or in their default ring, respectively.</p>
<p>The default methods for this uses the equality <span class="SimpleMath">lcm( m, n ) = m*n / gcd( m, n )</span> (see <code class="func">GcdOp</code> (<a href="chap56.html#X7836D50F8341D6E1"><span class="RefLink">56.7-2</span></a>)).</p>
<p><a id="X8555913A83D716A4" name="X8555913A83D716A4"></a></p>
<h5>56.7-8 QuotientMod</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ QuotientMod</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var>, <var class="Arg">s</var>, <var class="Arg">m</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">QuotientMod</code> returns the quotient of the ring elements <var class="Arg">r</var> and <var class="Arg">s</var> modulo the ring element <var class="Arg">m</var> in the ring <var class="Arg">R</var>, if given, and otherwise in their default ring, see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>).</p>
<p><var class="Arg">R</var> must be a Euclidean ring (see <code class="func">IsEuclideanRing</code> (<a href="chap56.html#X808B8E8E80D48E4A"><span class="RefLink">56.6-1</span></a>)) so that <code class="func">EuclideanRemainder</code> (<a href="chap56.html#X7B5E9639865E91BA"><span class="RefLink">56.6-4</span></a>) can be applied. If the modular quotient does not exist (i.e. when <var class="Arg">s</var> and <var class="Arg">m</var> are not coprime), <code class="keyw">fail</code> is returned.</p>
<p>The quotient <span class="SimpleMath">q</span> of <var class="Arg">r</var> and <var class="Arg">s</var> modulo <var class="Arg">m</var> is an element of <var class="Arg">R</var> such that <span class="SimpleMath">q <var class="Arg">s</var> = <var class="Arg">r</var></span> modulo <span class="SimpleMath">m</span>, i.e., such that <span class="SimpleMath">q <var class="Arg">s</var> - <var class="Arg">r</var></span> is divisible by <var class="Arg">m</var> in <var class="Arg">R</var> and that <span class="SimpleMath">q</span> is either zero (if <var class="Arg">r</var> is divisible by <var class="Arg">m</var>) or the Euclidean degree of <span class="SimpleMath">q</span> is strictly smaller than the Euclidean degree of <var class="Arg">m</var>.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">QuotientMod( 7, 2, 3 );</span>
2
</pre></div>
<p><a id="X805A35D684B7A952" name="X805A35D684B7A952"></a></p>
<h5>56.7-9 PowerMod</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ PowerMod</code>( [<var class="Arg">R</var>, ]<var class="Arg">r</var>, <var class="Arg">e</var>, <var class="Arg">m</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">PowerMod</code> returns the <var class="Arg">e</var>-th power of the ring element <var class="Arg">r</var> modulo the ring element <var class="Arg">m</var> in the ring <var class="Arg">R</var>, if given, and otherwise in their default ring, see <code class="func">DefaultRing</code> (<a href="chap56.html#X83AFFCC77DE6ABDA"><span class="RefLink">56.1-3</span></a>). <var class="Arg">e</var> must be an integer.</p>
<p><var class="Arg">R</var> must be a Euclidean ring (see <code class="func">IsEuclideanRing</code> (<a href="chap56.html#X808B8E8E80D48E4A"><span class="RefLink">56.6-1</span></a>)) so that <code class="func">EuclideanRemainder</code> (<a href="chap56.html#X7B5E9639865E91BA"><span class="RefLink">56.6-4</span></a>) can be applied to its elements.</p>
<p>If <var class="Arg">e</var> is positive the result is <var class="Arg">r</var><code class="code">^</code><var class="Arg">e</var> modulo <var class="Arg">m</var>. If <var class="Arg">e</var> is negative then <code class="func">PowerMod</code> first tries to find the inverse of <var class="Arg">r</var> modulo <var class="Arg">m</var>, i.e., <span class="SimpleMath">i</span> such that <span class="SimpleMath">i <var class="Arg">r</var> = 1</span> modulo <var class="Arg">m</var>. If the inverse does not exist an error is signalled. If the inverse does exist <code class="func">PowerMod</code> returns <code class="code">PowerMod( <var class="Arg">R</var>, <var class="Arg">i</var>, -<var class="Arg">e</var>, <var class="Arg">m</var> )</code>.</p>
<p><code class="func">PowerMod</code> reduces the intermediate values modulo <var class="Arg">m</var>, improving performance drastically when <var class="Arg">e</var> is large and <var class="Arg">m</var> small.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">PowerMod( 12, 100000, 7 );</span>
2
</pre></div>
<p><a id="X87711E6F8024A358" name="X87711E6F8024A358"></a></p>
<h5>56.7-10 InterpolatedPolynomial</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ InterpolatedPolynomial</code>( <var class="Arg">R</var>, <var class="Arg">x</var>, <var class="Arg">y</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">InterpolatedPolynomial</code> returns, for given lists <var class="Arg">x</var>, <var class="Arg">y</var> of elements in a ring <var class="Arg">R</var> of the same length <span class="SimpleMath">n</span>, say, the unique polynomial of degree less than <span class="SimpleMath">n</span> which has value <var class="Arg">y</var>[<span class="SimpleMath">i</span>] at <var class="Arg">x</var><span class="SimpleMath">[i]</span>, for all <span class="SimpleMath">i ∈ { 1, ..., n }</span>. Note that the elements in <var class="Arg">x</var> must be distinct.</p>
<div class="example"><pre>
<span class="GAPprompt">gap></span> <span class="GAPinput">InterpolatedPolynomial( Integers, [ 1, 2, 3 ], [ 5, 7, 0 ] );</span>
-9/2*x^2+31/2*x-6
</pre></div>
<p><a id="X7B13484581169439" name="X7B13484581169439"></a></p>
<h4>56.8 <span class="Heading">Homomorphisms of Rings</span></h4>
<p>A <em>ring homomorphism</em> is a mapping between two rings that respects addition and multiplication.</p>
<p>Currently <strong class="pkg">GAP</strong> supports ring homomorphisms between finite rings (using straightforward methods) and ring homomorphisms with additional structures, where source and range are in fact algebras and where also the linear structure is respected, see <a href="chap62.html#X7E94B857847F95C1"><span class="RefLink">62.10</span></a>.</p>
<p><a id="X7DE9CC5B877C91DA" name="X7DE9CC5B877C91DA"></a></p>
<h5>56.8-1 RingGeneralMappingByImages</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RingGeneralMappingByImages</code>( <var class="Arg">R</var>, <var class="Arg">S</var>, <var class="Arg">gens</var>, <var class="Arg">imgs</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>is a general mapping from the ring <var class="Arg">A</var> to the ring <var class="Arg">S</var>. This general mapping is defined by mapping the entries in the list <var class="Arg">gens</var> (elements of <var class="Arg">R</var>) to the entries in the list <var class="Arg">imgs</var> (elements of <var class="Arg">S</var>), and taking the additive and multiplicative closure.</p>
<p><var class="Arg">gens</var> need not generate <var class="Arg">R</var> as a ring, and if the specification does not define an additive and multiplicative mapping then the result will be multivalued. Hence, in general it is not a mapping.</p>
<p><a id="X78C1016284F08026" name="X78C1016284F08026"></a></p>
<h5>56.8-2 RingHomomorphismByImages</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RingHomomorphismByImages</code>( <var class="Arg">R</var>, <var class="Arg">S</var>, <var class="Arg">gens</var>, <var class="Arg">imgs</var> )</td><td class="tdright">( function )</td></tr></table></div>
<p><code class="func">RingHomomorphismByImages</code> returns the ring homomorphism with source <var class="Arg">R</var> and range <var class="Arg">S</var> that is defined by mapping the list <var class="Arg">gens</var> of generators of <var class="Arg">R</var> to the list <var class="Arg">imgs</var> of images in <var class="Arg">S</var>.</p>
<p>If <var class="Arg">gens</var> does not generate <var class="Arg">R</var> or if the homomorphism does not exist (i.e., if mapping the generators describes only a multi-valued mapping) then <code class="keyw">fail</code> is returned.</p>
<p>One can avoid the checks by calling <code class="func">RingHomomorphismByImagesNC</code> (<a href="chap56.html#X7D01646A7CCBEDBB"><span class="RefLink">56.8-3</span></a>), and one can construct multi-valued mappings with <code class="func">RingGeneralMappingByImages</code> (<a href="chap56.html#X7DE9CC5B877C91DA"><span class="RefLink">56.8-1</span></a>).</p>
<p><a id="X7D01646A7CCBEDBB" name="X7D01646A7CCBEDBB"></a></p>
<h5>56.8-3 RingHomomorphismByImagesNC</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ RingHomomorphismByImagesNC</code>( <var class="Arg">R</var>, <var class="Arg">S</var>, <var class="Arg">gens</var>, <var class="Arg">imgs</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p><code class="func">RingHomomorphismByImagesNC</code> is the operation that is called by the function <code class="func">RingHomomorphismByImages</code> (<a href="chap56.html#X78C1016284F08026"><span class="RefLink">56.8-2</span></a>). Its methods may assume that <var class="Arg">gens</var> generates <var class="Arg">R</var> as a ring and that the mapping of <var class="Arg">gens</var> to <var class="Arg">imgs</var> defines a ring homomorphism. Results are unpredictable if these conditions do not hold.</p>
<p>For creating a possibly multi-valued mapping from <var class="Arg">R</var> to <var class="Arg">S</var> that respects addition and multiplication, <code class="func">RingGeneralMappingByImages</code> (<a href="chap56.html#X7DE9CC5B877C91DA"><span class="RefLink">56.8-1</span></a>) can be used.</p>
<p><a id="X83D53D98809EC461" name="X83D53D98809EC461"></a></p>
<h5>56.8-4 NaturalHomomorphismByIdeal</h5>
<div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">‣ NaturalHomomorphismByIdeal</code>( <var class="Arg">R</var>, <var class="Arg">I</var> )</td><td class="tdright">( operation )</td></tr></table></div>
<p>is the homomorphism of rings provided by the natural projection map of <var class="Arg">R</var> onto the quotient ring <var class="Arg">R</var>/<var class="Arg">I</var>. This map can be used to take pre-images in the original ring from elements in the quotient.</p>
<div class="chlinkprevnextbot"> <a href="chap0.html">[Top of Book]</a> <a href="chap0.html#contents">[Contents]</a> <a href="chap55.html">[Previous Chapter]</a> <a href="chap57.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>
|