Debian Codegraph @

doc/ref/chap42.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5
6 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
7 <head>
8 <title>GAP (ref) - Chapter 42: Permutations</title>
9 <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
10 <meta name="generator" content="GAPDoc2HTML" />
11 <link rel="stylesheet" type="text/css" href="manual.css" />
12 <script src="manual.js" type="text/javascript"></script>
13 <script type="text/javascript">overwriteStyle();</script>
14 </head>
15 <body class="chap42" onload="jscontent()">
16
17
18 <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>
19
20 <div class="chlinkprevnexttop">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp; <a href="chap0.html#contents">[Contents]</a>&nbsp; &nbsp;<a href="chap41.html">[Previous Chapter]</a>&nbsp; &nbsp;<a href="chap43.html">[Next Chapter]</a>&nbsp; </div>
21
22 <p id="mathjaxlink" class="pcenter"><a href="chap42_mj.html">[MathJax on]</a></p>
23 <p><a id="X80F808307A2D5AB8" name="X80F808307A2D5AB8"></a></p>
24 <div class="ChapSects"><a href="chap42.html#X80F808307A2D5AB8">42 <span class="Heading">Permutations</span></a>
25 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap42.html#X80F07BE2811D4BAC">42.1 <span class="Heading">IsPerm (Filter)</span></a>
26 </span>
27 <div class="ContSSBlock">
28 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X7AA69C6686FC49EA">42.1-1 IsPerm</a></span>
29 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X82069E437D2DF9AA">42.1-2 IsPermCollection</a></span>
30 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X819628B083B3939B">42.1-3 PermutationsFamily</a></span>
31 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X83C711557DEB4B36">42.1-4 PERM_INVERSE_THRESHOLD</a></span>
32 </div></div>
33 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap42.html#X7A21DE5779D21A6D">42.2 <span class="Heading">Comparison of Permutations</span></a>
34 </span>
35 <div class="ContSSBlock">
36 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X7CEC03A9808E2E7C"><code>42.2-1 \=</code></a></span>
37 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X7BC944F57A04AFF2">42.2-2 DistancePerms</a></span>
38 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X83A917F67D45C7EA">42.2-3 SmallestGeneratorPerm</a></span>
39 </div></div>
40 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap42.html#X82C255E2821C0721">42.3 <span class="Heading">Moved Points of Permutations</span></a>
41 </span>
42 <div class="ContSSBlock">
43 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X84EF0A697F7A87DC">42.3-1 SmallestMovedPoint</a></span>
44 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X84AA603987C94AC0">42.3-2 LargestMovedPoint</a></span>
45 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X85E61B9C7A6B0CCA">42.3-3 MovedPoints</a></span>
46 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X85E7B1E28430F49E">42.3-4 NrMovedPoints</a></span>
47 </div></div>
48 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap42.html#X79BE80267F4AA2B0">42.4 <span class="Heading">Sign and Cycle Structure</span></a>
49 </span>
50 <div class="ContSSBlock">
51 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X7BE5011B7C0DB704">42.4-1 SignPerm</a></span>
52 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X7944D1447804A69A">42.4-2 CycleStructurePerm</a></span>
53 </div></div>
54 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap42.html#X7B3194EC869D936D">42.5 <span class="Heading">Creating Permutations</span></a>
55 </span>
56 <div class="ContSSBlock">
57 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X7A9DCFD986958C1E">42.5-1 ListPerm</a></span>
58 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X78D611D17EA6E3BC">42.5-2 PermList</a></span>
59 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X8087DCC780B9656A">42.5-3 MappingPermListList</a></span>
60 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X7EF8388E7DA8E600">42.5-4 RestrictedPerm</a></span>
61 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X80665A5D800CAFE1">42.5-5 CycleFromList</a></span>
62 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap42.html#X8353AB8987E35DF3">42.5-6 AsPermutation</a></span>
63 </div></div>
64 </div>
65
66 <h3>42 <span class="Heading">Permutations</span></h3>
67
68 <p><strong class="pkg">GAP</strong> offers a data type <em>permutation</em> to describe the elements of permutation groups.</p>
69
70 <p>The points on which permutations in <strong class="pkg">GAP</strong> act are the positive integers up to a certain architecture dependent limit, and the image of a point <span class="SimpleMath">i</span> under a permutation <span class="SimpleMath">p</span> is written <span class="SimpleMath">i^p</span>, which is expressed as <span class="SimpleMath">i</span><code class="code">^</code><span class="SimpleMath">p</span> in <strong class="pkg">GAP</strong>. (This action is also implemented by the function <code class="func">OnPoints</code> (<a href="chap41.html#X7FE417DD837987B4"><span class="RefLink">41.2-1</span></a>).) If <span class="SimpleMath">i</span><code class="code">^</code><span class="SimpleMath">p</span> is different from <span class="SimpleMath">i</span>, we say that <span class="SimpleMath">i</span> is <em>moved</em> by <span class="SimpleMath">p</span>, otherwise it is <em>fixed</em>. Permutations in <strong class="pkg">GAP</strong> are entered and displayed in cycle notation, such as <code class="code">(1,2,3)(4,5)</code>.</p>
71
72 <p>The preimage of the point <span class="SimpleMath">i</span> under the permutation <span class="SimpleMath">p</span> can be computed as <span class="SimpleMath">i</span><code class="code">/</code><span class="SimpleMath">p</span>, see <code class="func">PERM_INVERSE_THRESHOLD</code> (<a href="chap42.html#X83C711557DEB4B36"><span class="RefLink">42.1-4</span></a>).</p>
73
74 <p>For arithmetic operations for permutations and their precedence, see <a href="chap31.html#X7A2914307963E370"><span class="RefLink">31.12</span></a>.</p>
75
76 <p>In the names of the <strong class="pkg">GAP</strong> functions that deal with permutations, the word <q>Permutation</q> is usually abbreviated to <q>Perm</q>, to save typing. For example, the category test function for permutations is <code class="func">IsPerm</code> (<a href="chap42.html#X7AA69C6686FC49EA"><span class="RefLink">42.1-1</span></a>).</p>
77
78 <p><a id="X80F07BE2811D4BAC" name="X80F07BE2811D4BAC"></a></p>
79
80 <h4>42.1 <span class="Heading">IsPerm (Filter)</span></h4>
81
82 <p>Internally, <strong class="pkg">GAP</strong> stores a permutation as a list of the <span class="SimpleMath">d</span> images of the integers <span class="SimpleMath">1, ..., d</span>, where the <q>internal degree</q> <span class="SimpleMath">d</span> is the largest integer moved by the permutation or bigger. When a permutation is read in cycle notation, <span class="SimpleMath">d</span> is always set to the largest moved integer, but a bigger <span class="SimpleMath">d</span> can result from a multiplication of two permutations, because the product is not shortened if it fixes <span class="SimpleMath">d</span>. The images are stored all as <span class="SimpleMath">16</span>-bit integers or all as <span class="SimpleMath">32</span>-bit integers, depending on whether <span class="SimpleMath">d ≤ 65536</span> or not. For example, if <span class="SimpleMath">m≥ 65536</span>, the permutation <span class="SimpleMath">(1, 2, ..., m)</span> has internal degree <span class="SimpleMath">d=m</span> and takes <span class="SimpleMath">4m</span> bytes of memory for storage. But --- since the internal degree is not reduced --- this means that the identity permutation <code class="code">()</code> calculated as <span class="SimpleMath">(1, 2, ..., m) * (1, 2, ..., m)^{-1}</span> also takes <span class="SimpleMath">4m</span> bytes of storage. It can take even more because the internal list has sometimes room for more than <span class="SimpleMath">d</span> images.</p>
83
84 <p>On 32-bit systems, the limit on the degree of permutations is, for technical reasons, <span class="SimpleMath">2^28-1</span>. On 64-bit systems, it is <span class="SimpleMath">2^32-1</span> because only a 32-bit integer is used to represent each image internally. Error messages should be given if any command would require creating a permutation exceeding this limit.</p>
85
86 <p>The operation <code class="func">RestrictedPerm</code> (<a href="chap42.html#X7EF8388E7DA8E600"><span class="RefLink">42.5-4</span></a>) reduces the storage degree of its result and therefore can be used to save memory if intermediate calculations in large degree result in a small degree result.</p>
87
88 <p>Permutations do not belong to a specific group. That means that one can work with permutations without defining a permutation group that contains them.</p>
89
90
91 <div class="example"><pre>
92 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">(1,2,3);</span>
93 (1,2,3)
94 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">(1,2,3) * (2,3,4);</span>
95 (1,3)(2,4)
96 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">17^(2,5,17,9,8);</span>
97 9
98 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">OnPoints(17,(2,5,17,9,8));</span>
99 9
100 </pre></div>
101
102 <p>The operation <code class="func">Permuted</code> (<a href="chap21.html#X7B5A19098406347A"><span class="RefLink">21.20-17</span></a>) can be used to permute the entries of a list according to a permutation.</p>
103
104 <p><a id="X7AA69C6686FC49EA" name="X7AA69C6686FC49EA"></a></p>
105
106 <h5>42.1-1 IsPerm</h5>
107
108 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsPerm</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
109 <p>Each <em>permutation</em> in <strong class="pkg">GAP</strong> lies in the category <code class="func">IsPerm</code>. Basic operations for permutations are <code class="func">LargestMovedPoint</code> (<a href="chap42.html#X84AA603987C94AC0"><span class="RefLink">42.3-2</span></a>), multiplication of two permutations via <code class="code">*</code>, and exponentiation <code class="code">^</code> with first argument a positive integer <span class="SimpleMath">i</span> and second argument a permutation <span class="SimpleMath">π</span>, the result being the image <span class="SimpleMath">i^π</span> of the point <span class="SimpleMath">i</span> under <span class="SimpleMath">π</span>.</p>
110
111 <p><a id="X82069E437D2DF9AA" name="X82069E437D2DF9AA"></a></p>
112
113 <h5>42.1-2 IsPermCollection</h5>
114
115 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsPermCollection</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
116 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsPermCollColl</code>( <var class="Arg">obj</var> )</td><td class="tdright">(&nbsp;category&nbsp;)</td></tr></table></div>
117 <p>are the categories for collections of permutations and collections of collections of permutations, respectively.</p>
118
119 <p><a id="X819628B083B3939B" name="X819628B083B3939B"></a></p>
120
121 <h5>42.1-3 PermutationsFamily</h5>
122
123 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PermutationsFamily</code></td><td class="tdright">(&nbsp;family&nbsp;)</td></tr></table></div>
124 <p>is the family of all permutations.</p>
125
126 <p><a id="X83C711557DEB4B36" name="X83C711557DEB4B36"></a></p>
127
128 <h5>42.1-4 PERM_INVERSE_THRESHOLD</h5>
129
130 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PERM_INVERSE_THRESHOLD</code></td><td class="tdright">(&nbsp;global variable&nbsp;)</td></tr></table></div>
131 <p>For permutations of degree up to <code class="code">PERM_INVERSE_THRESHOLD</code> whenever the inverse image of a point under a permutations is needed, the entire inverse is computed and stored. Otherwise, if the inverse is not stored, the point is traced around the cycle it is part of to find the inverse image. This takes time when it happens, and uses memory, but saves time on a variety of subsequent computations. This threshold can be adjusted by simply assigning to the variable. The default is 10000.</p>
132
133 <p><a id="X7A21DE5779D21A6D" name="X7A21DE5779D21A6D"></a></p>
134
135 <h4>42.2 <span class="Heading">Comparison of Permutations</span></h4>
136
137 <p><a id="X7CEC03A9808E2E7C" name="X7CEC03A9808E2E7C"></a></p>
138
139 <h5><code>42.2-1 \=</code></h5>
140
141 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; \=</code>( <var class="Arg">p1</var>, <var class="Arg">p2</var> )</td><td class="tdright">(&nbsp;method&nbsp;)</td></tr></table></div>
142 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; \&lt;</code>( <var class="Arg">p1</var>, <var class="Arg">p2</var> )</td><td class="tdright">(&nbsp;method&nbsp;)</td></tr></table></div>
143 <p>Two permutations are equal if they move the same points and all these points have the same images under both permutations.</p>
144
145 <p>The permutation <var class="Arg">p1</var> is smaller than <var class="Arg">p2</var> if <var class="Arg">p1</var> <span class="SimpleMath">≠</span> <var class="Arg">p2</var> and <span class="SimpleMath">i^{<var class="Arg">p1</var>} &lt; i^{<var class="Arg">p2</var>}</span>, where <span class="SimpleMath">i</span> is the smallest point with <span class="SimpleMath">i^{<var class="Arg">p1</var>} ≠ i^{<var class="Arg">p2</var>}</span>. Therefore the identity permutation is the smallest permutation, see also Section <a href="chap31.html#X7B3BC7BA7BB2646D"><span class="RefLink">31.11</span></a>.</p>
146
147 <p>Permutations can be compared with certain other <strong class="pkg">GAP</strong> objects, see <a href="chap4.html#X7A274A1F8553B7E6"><span class="RefLink">4.13</span></a> for the details.</p>
148
149
150 <div class="example"><pre>
151 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">(1,2,3) = (2,3,1);</span>
152 true
153 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">(1,2,3) * (2,3,4) = (1,3)(2,4);</span>
154 true
155 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">(1,2,3) &lt; (1,3,2); # 1^(1,2,3) = 2 &lt; 3 = 1^(1,3,2)</span>
156 true
157 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">(1,3,2,4) &lt; (1,3,4,2); # 2^(1,3,2,4) = 4 &gt; 1 = 2^(1,3,4,2)</span>
158 false
159 </pre></div>
160
161 <p><a id="X7BC944F57A04AFF2" name="X7BC944F57A04AFF2"></a></p>
162
163 <h5>42.2-2 DistancePerms</h5>
164
165 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DistancePerms</code>( <var class="Arg">perm1</var>, <var class="Arg">perm2</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
166 <p>returns the number of points for which <var class="Arg">perm1</var> and <var class="Arg">perm2</var> have different images. This should always produce the same result as <code class="code">NrMovedPoints(<var class="Arg">perm1</var>/<var class="Arg">perm2</var>)</code> but some methods may be much faster than this form, since no new permutation needs to be created.</p>
167
168 <p><a id="X83A917F67D45C7EA" name="X83A917F67D45C7EA"></a></p>
169
170 <h5>42.2-3 SmallestGeneratorPerm</h5>
171
172 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SmallestGeneratorPerm</code>( <var class="Arg">perm</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
173 <p>is the smallest permutation that generates the same cyclic group as the permutation <var class="Arg">perm</var>. This is very efficient, even when <var class="Arg">perm</var> has large order.</p>
174
175
176 <div class="example"><pre>
177 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SmallestGeneratorPerm( (1,4,3,2) );</span>
178 (1,2,3,4)
179 </pre></div>
180
181 <p><a id="X82C255E2821C0721" name="X82C255E2821C0721"></a></p>
182
183 <h4>42.3 <span class="Heading">Moved Points of Permutations</span></h4>
184
185 <p><a id="X84EF0A697F7A87DC" name="X84EF0A697F7A87DC"></a></p>
186
187 <h5>42.3-1 SmallestMovedPoint</h5>
188
189 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SmallestMovedPoint</code>( <var class="Arg">perm</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
190 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SmallestMovedPoint</code>( <var class="Arg">C</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
191 <p>is the smallest positive integer that is moved by <var class="Arg">perm</var> if such an integer exists, and <code class="func">infinity</code> (<a href="chap18.html#X8511B8DF83324C27"><span class="RefLink">18.2-1</span></a>) if <var class="Arg">perm</var> is the identity. For <var class="Arg">C</var> a collection or list of permutations, the smallest value of <code class="func">SmallestMovedPoint</code> for the elements of <var class="Arg">C</var> is returned (and <code class="func">infinity</code> (<a href="chap18.html#X8511B8DF83324C27"><span class="RefLink">18.2-1</span></a>) if <var class="Arg">C</var> is empty).</p>
192
193 <p><a id="X84AA603987C94AC0" name="X84AA603987C94AC0"></a></p>
194
195 <h5>42.3-2 LargestMovedPoint</h5>
196
197 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LargestMovedPoint</code>( <var class="Arg">perm</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
198 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LargestMovedPoint</code>( <var class="Arg">C</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
199 <p>For a permutation <var class="Arg">perm</var>, this attribute contains the largest positive integer which is moved by <var class="Arg">perm</var> if such an integer exists, and <code class="code">0</code> if <var class="Arg">perm</var> is the identity. For <var class="Arg">C</var> a collection or list of permutations, the largest value of <code class="func">LargestMovedPoint</code> for the elements of <var class="Arg">C</var> is returned (and <code class="code">0</code> if <var class="Arg">C</var> is empty).</p>
200
201 <p><a id="X85E61B9C7A6B0CCA" name="X85E61B9C7A6B0CCA"></a></p>
202
203 <h5>42.3-3 MovedPoints</h5>
204
205 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; MovedPoints</code>( <var class="Arg">perm</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
206 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; MovedPoints</code>( <var class="Arg">C</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
207 <p>is the proper set of the positive integers moved by at least one permutation in the collection <var class="Arg">C</var>, respectively by the permutation <var class="Arg">perm</var>.</p>
208
209 <p><a id="X85E7B1E28430F49E" name="X85E7B1E28430F49E"></a></p>
210
211 <h5>42.3-4 NrMovedPoints</h5>
212
213 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NrMovedPoints</code>( <var class="Arg">perm</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
214 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; NrMovedPoints</code>( <var class="Arg">C</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
215 <p>is the number of positive integers that are moved by <var class="Arg">perm</var>, respectively by at least one element in the collection <var class="Arg">C</var>. (The actual moved points are returned by <code class="func">MovedPoints</code> (<a href="chap42.html#X85E61B9C7A6B0CCA"><span class="RefLink">42.3-3</span></a>).)</p>
216
217
218 <div class="example"><pre>
219 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SmallestMovedPointPerm((4,5,6)(7,2,8));</span>
220 2
221 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LargestMovedPointPerm((4,5,6)(7,2,8));</span>
222 8
223 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrMovedPointsPerm((4,5,6)(7,2,8));</span>
224 6
225 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">MovedPoints([(2,3,4),(7,6,3),(5,47)]);</span>
226 [ 2, 3, 4, 5, 6, 7, 47 ]
227 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NrMovedPoints([(2,3,4),(7,6,3),(5,47)]);</span>
228 7
229 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SmallestMovedPoint([(2,3,4),(7,6,3),(5,47)]);</span>
230 2
231 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LargestMovedPoint([(2,3,4),(7,6,3),(5,47)]);</span>
232 47
233 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LargestMovedPoint([()]);</span>
234 0
235 </pre></div>
236
237 <p><a id="X79BE80267F4AA2B0" name="X79BE80267F4AA2B0"></a></p>
238
239 <h4>42.4 <span class="Heading">Sign and Cycle Structure</span></h4>
240
241 <p><a id="X7BE5011B7C0DB704" name="X7BE5011B7C0DB704"></a></p>
242
243 <h5>42.4-1 SignPerm</h5>
244
245 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SignPerm</code>( <var class="Arg">perm</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
246 <p>The <em>sign</em> of a permutation <var class="Arg">perm</var> is defined as <span class="SimpleMath">(-1)^k</span> where <span class="SimpleMath">k</span> is the number of cycles of <var class="Arg">perm</var> of even length.</p>
247
248 <p>The sign is a homomorphism from the symmetric group onto the multiplicative group <span class="SimpleMath">{ +1, -1 }</span>, the kernel of which is the alternating group.</p>
249
250 <p><a id="X7944D1447804A69A" name="X7944D1447804A69A"></a></p>
251
252 <h5>42.4-2 CycleStructurePerm</h5>
253
254 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CycleStructurePerm</code>( <var class="Arg">perm</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
255 <p>is the cycle structure (i.e. the numbers of cycles of different lengths) of the permutation <var class="Arg">perm</var>. This is encoded in a list <span class="SimpleMath">l</span> in the following form: The <span class="SimpleMath">i</span>-th entry of <span class="SimpleMath">l</span> contains the number of cycles of <var class="Arg">perm</var> of length <span class="SimpleMath">i+1</span>. If <var class="Arg">perm</var> contains no cycles of length <span class="SimpleMath">i+1</span> it is not bound. Cycles of length 1 are ignored.</p>
256
257
258 <div class="example"><pre>
259 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SignPerm((1,2,3)(4,5));</span>
260 -1
261 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">CycleStructurePerm((1,2,3)(4,5,9,7,8));</span>
262 [ , 1,, 1 ]
263 </pre></div>
264
265 <p><a id="X7B3194EC869D936D" name="X7B3194EC869D936D"></a></p>
266
267 <h4>42.5 <span class="Heading">Creating Permutations</span></h4>
268
269 <p><a id="X7A9DCFD986958C1E" name="X7A9DCFD986958C1E"></a></p>
270
271 <h5>42.5-1 ListPerm</h5>
272
273 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ListPerm</code>( <var class="Arg">perm</var>[, <var class="Arg">n</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
274 <p>is a list <span class="SimpleMath">l</span> that contains the images of the positive integers from 1 to <var class="Arg">n</var> under the permutation <var class="Arg">perm</var>. That means that <span class="SimpleMath">l</span><code class="code">[</code><span class="SimpleMath">i</span><code class="code">]</code> <span class="SimpleMath">= i</span><code class="code">^</code><var class="Arg">perm</var>, where <span class="SimpleMath">i</span> lies between 1 and <var class="Arg">n</var>.</p>
275
276 <p>If the optional second argument <var class="Arg">n</var> is omitted then the largest point moved by <var class="Arg">perm</var> is used (see <code class="func">LargestMovedPoint</code> (<a href="chap42.html#X84AA603987C94AC0"><span class="RefLink">42.3-2</span></a>)).</p>
277
278 <p><a id="X78D611D17EA6E3BC" name="X78D611D17EA6E3BC"></a></p>
279
280 <h5>42.5-2 PermList</h5>
281
282 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PermList</code>( <var class="Arg">list</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
283 <p>is the permutation <span class="SimpleMath">π</span> that moves points as described by the list <var class="Arg">list</var>. That means that <span class="SimpleMath">i^π =</span> <var class="Arg">list</var><code class="code">[</code><span class="SimpleMath">i</span><code class="code">]</code> if <span class="SimpleMath">i</span> lies between <span class="SimpleMath">1</span> and the length of <var class="Arg">list</var>, and <span class="SimpleMath">i^π = i</span> if <span class="SimpleMath">i</span> is larger than the length of the list <var class="Arg">list</var>. <code class="func">PermList</code> will return <code class="keyw">fail</code> if <var class="Arg">list</var> does not define a permutation, i.e., if <var class="Arg">list</var> is not dense, or if <var class="Arg">list</var> contains a positive integer twice, or if <var class="Arg">list</var> contains an integer not in the range <code class="code">[ 1 .. Length( <var class="Arg">list</var> ) ]</code>, or if <var class="Arg">list</var> contains non-integer entries, etc.</p>
284
285 <p><a id="X8087DCC780B9656A" name="X8087DCC780B9656A"></a></p>
286
287 <h5>42.5-3 MappingPermListList</h5>
288
289 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; MappingPermListList</code>( <var class="Arg">src</var>, <var class="Arg">dst</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
290 <p>Let <var class="Arg">src</var> and <var class="Arg">dst</var> be lists of positive integers of the same length, such that there is a permutation <span class="SimpleMath">π</span> such that <code class="code">OnTuples(<var class="Arg">src</var>,</code> <span class="SimpleMath">π</span><code class="code">) = <var class="Arg">dst</var></code>. <code class="func">MappingPermListList</code> returns such a permutation (i. e., <var class="Arg">src</var><code class="code">[</code><span class="SimpleMath">i</span><code class="code">]^</code><span class="SimpleMath">π =</span> <var class="Arg">dst</var><code class="code">[</code><span class="SimpleMath">i</span><code class="code">]</code> holds), with the property that <span class="SimpleMath">π</span> fixes any point which is not in <var class="Arg">src</var> or <var class="Arg">dst</var>. If there are several such permutations, it is not specified which of them <code class="func">MappingPermListList</code> returns. If there is no such permutation, then <code class="func">MappingPermListList</code> returns <code class="keyw">fail</code>.</p>
291
292 <p><a id="X7EF8388E7DA8E600" name="X7EF8388E7DA8E600"></a></p>
293
294 <h5>42.5-4 RestrictedPerm</h5>
295
296 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RestrictedPerm</code>( <var class="Arg">perm</var>, <var class="Arg">list</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
297 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RestrictedPermNC</code>( <var class="Arg">perm</var>, <var class="Arg">list</var> )</td><td class="tdright">(&nbsp;operation&nbsp;)</td></tr></table></div>
298 <p><code class="func">RestrictedPerm</code> returns the new permutation that acts on the points in the list <var class="Arg">list</var> in the same way as the permutation <var class="Arg">perm</var>, and that fixes those points that are not in <var class="Arg">list</var>. The resulting permutation is stored internally of degree given by the maximal entry of <var class="Arg">list</var>. <var class="Arg">list</var> must be a list of positive integers such that for each <span class="SimpleMath">i</span> in <var class="Arg">list</var> the image <span class="SimpleMath">i</span><code class="code">^</code><var class="Arg">perm</var> is also in <var class="Arg">list</var>, i.e., <var class="Arg">list</var> must be the union of cycles of <var class="Arg">perm</var>.</p>
299
300 <p><code class="func">RestrictedPermNC</code> does not check whether <var class="Arg">list</var> is a union of cycles.</p>
301
302
303 <div class="example"><pre>
304 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ListPerm((3,4,5));</span>
305 [ 1, 2, 4, 5, 3 ]
306 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">PermList([1,2,4,5,3]);</span>
307 (3,4,5)
308 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">MappingPermListList([2,5,1,6],[7,12,8,2]);</span>
309 (1,8,5,12,6,2,7)
310 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">RestrictedPerm((1,2)(3,4),[3..5]);</span>
311 (3,4)
312 </pre></div>
313
314 <p><a id="X80665A5D800CAFE1" name="X80665A5D800CAFE1"></a></p>
315
316 <h5>42.5-5 CycleFromList</h5>
317
318 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CycleFromList</code>( <var class="Arg">list</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
319 <p>For the given dense, duplicate-free list of positive integers <span class="SimpleMath">[a_1, a_2, ..., a_n]</span> return the <span class="SimpleMath">n</span>-cycle <span class="SimpleMath">(a_1,a_2,...,a_n)</span>. For the empty list the trivial permutation <span class="SimpleMath">()</span> is returned.</p>
320
321 <p>If the given <var class="Arg">list</var> contains duplicates or holes, return <code class="keyw">fail</code>.</p>
322
323
324 <div class="example"><pre>
325 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">CycleFromList( [1,2,3,4] );</span>
326 (1,2,3,4)
327 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">CycleFromList( [3,2,6,4,5] );</span>
328 (2,6,4,5,3)
329 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">CycleFromList( [2,3,2] );</span>
330 fail
331 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">CycleFromList( [1,,3] );</span>
332 fail
333 </pre></div>
334
335 <p><a id="X8353AB8987E35DF3" name="X8353AB8987E35DF3"></a></p>
336
337 <h5>42.5-6 AsPermutation</h5>
338
339 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; AsPermutation</code>( <var class="Arg">f</var> )</td><td class="tdright">(&nbsp;attribute&nbsp;)</td></tr></table></div>
340 <p>Returns: A permutation or <code class="keyw">fail</code>.</p>
341
342 <p>Partial permutations and transformations which define permutations (mathematically) can be converted into <strong class="pkg">GAP</strong> permutations using <code class="code">AsPermutation</code>; see Chapters <a href="chap53.html#X860026B880BCB2A5"><span class="RefLink">53</span></a> and <a href="chap54.html#X7D6495F77B8A77BD"><span class="RefLink">54</span></a> for more details about transformations and partial permutations.</p>
343
344
345 <dl>
346 <dt><strong class="Mark">for partial permutations</strong></dt>
347 <dd><p>If the partial permutation <var class="Arg">f</var> is a permutation of its image, then <code class="code">AsPermutation</code> returns this permutation. If <var class="Arg">f</var> does not permute its image, then <code class="keyw">fail</code> is returned.</p>
348
349 </dd>
350 <dt><strong class="Mark">for transformations</strong></dt>
351 <dd><p>A transformation is a permutation if and only if its rank equals its degree. If a transformation in <strong class="pkg">GAP</strong> is a permutation, then <code class="code">AsPermutation</code> returns this permutation. If <var class="Arg">f</var> is not a permutation, then <code class="keyw">fail</code> is returned.</p>
352
353 </dd>
354 </dl>
355 <p>The function <code class="func">Permutation</code> (<a href="chap41.html#X7807A33381DCAB26"><span class="RefLink">41.9-1</span></a>) can also be used to convert partial permutations and transformations into permutations where appropriate.</p>
356
357
358 <div class="example"><pre>
359 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:=PartialPerm( [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ],</span>
360 <span class="GAPprompt">&gt;</span> <span class="GAPinput">[ 2, 7, 9, 4, 1, 10, 5, 6, 3, 8 ] );</span>
361 (1,2,7,5)(3,9)(4)(6,10,8)
362 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">AsPermutation(f);</span>
363 (1,2,7,5)(3,9)(6,10,8)
364 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:= PartialPerm( [ 1, 2, 3, 4, 5, 7, 8 ], [ 5, 3, 8, 1, 9, 4, 10 ] );</span>
365 [2,3,8,10][7,4,1,5,9]
366 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">AsPermutation(f);</span>
367 fail
368 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:=Transformation( [ 5, 8, 3, 5, 8, 6, 2, 2, 7, 8 ] );;</span>
369 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">AsPermutation(f);</span>
370 fail
371 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:=Transformation( [ 1, 3, 6, 6, 2, 10, 2, 3, 10, 5 ] );;</span>
372 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">AsPermutation(f);</span>
373 fail
374 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">f:=Transformation( [ 2, 7, 9, 4, 1, 10, 5, 6, 3, 8 ] );</span>
375 Transformation( [ 2, 7, 9, 4, 1, 10, 5, 6, 3, 8 ] )
376 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">AsPermutation(f);</span>
377 (1,2,7,5)(3,9)(6,10,8)</pre></div>
378
379
380 <div class="chlinkprevnextbot">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp; <a href="chap0.html#contents">[Contents]</a>&nbsp; &nbsp;<a href="chap41.html">[Previous Chapter]</a>&nbsp; &nbsp;<a href="chap43.html">[Next Chapter]</a>&nbsp; </div>
381
382
383 <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>
384
385 <hr />
386 <p class="foot">generated by <a href="https://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
387 </body>
388 </html>