Debian Codegraph @

doc/ref/chap85.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 85: Function-Operation-Attribute Triples</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="chap85" 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="chap84.html">[Previous Chapter]</a>&nbsp; &nbsp;<a href="chap86.html">[Next Chapter]</a>&nbsp; </div>
21
22 <p id="mathjaxlink" class="pcenter"><a href="chap85_mj.html">[MathJax on]</a></p>
23 <p><a id="X8350247A8501969F" name="X8350247A8501969F"></a></p>
24 <div class="ChapSects"><a href="chap85.html#X8350247A8501969F">85 <span class="Heading">Function-Operation-Attribute Triples</span></a>
25 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap85.html#X86F03E0D7C18C6B0">85.1 <span class="Heading">Key Dependent Operations</span></a>
26 </span>
27 <div class="ContSSBlock">
28 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap85.html#X7CABFDAA8596757E">85.1-1 KeyDependentOperation</a></span>
29 </div></div>
30 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap85.html#X78D4D0FF780C8A85">85.2 <span class="Heading">In Parent Attributes</span></a>
31 </span>
32 <div class="ContSSBlock">
33 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap85.html#X7C0E62D8813A4EE6">85.2-1 InParentFOA</a></span>
34 </div></div>
35 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap85.html#X7CD4A0867BD825F7">85.3 <span class="Heading">Operation Functions</span></a>
36 </span>
37 <div class="ContSSBlock">
38 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap85.html#X7CA3826A7EBDE208">85.3-1 OrbitsishOperation</a></span>
39 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap85.html#X7B23C48482ADB237">85.3-2 OrbitishFO</a></span>
40 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap85.html#X834E92F07DD0BF04">85.3-3 <span class="Heading">Example: Orbit and OrbitOp</span></a>
41 </span>
42 </div></div>
43 </div>
44
45 <h3>85 <span class="Heading">Function-Operation-Attribute Triples</span></h3>
46
47 <p><strong class="pkg">GAP</strong> is eager to maintain information that it has gathered about an object, possibly by lengthy calculations. The most important mechanism for information maintenance is the automatic storage and look-up that takes place for <em>attributes</em>; and this was already mentioned in section <a href="../../doc/tut/chap8.html#X7C701DBF7BAE649A"><span class="RefLink">Tutorial: Attributes</span></a>. In this chapter we will describe further mechanisms that allow storage of results that are not values of attributes.</p>
48
49 <p>The idea which is common to all sections is that certain operations, which are not themselves attributes, have an attribute associated with them. To automatically delegate tasks to the attribute, <strong class="pkg">GAP</strong> knows, in addition to the <em>operation</em> and the <em>attributes</em> also a <em>function</em>, which is <q>wrapped around</q> the other two. This <q>wrapper function</q> is called by the user and decides whether to call the operation or the attribute or possibly both. The whole <em>f</em>unction-<em>o</em>peration-<em>a</em>ttribute triple (or <em>FOA triple</em>) is set up by a single <strong class="pkg">GAP</strong> command which writes the wrapper function and already installs some methods, e.g., for the attribute to fall back on the operation. The idea is then that subsequent methods, which perform the actual computation, are installed only for the operation, whereas the wrapper function remains unaltered, and in general no additional methods for the attribute are required either.</p>
50
51 <p><a id="X86F03E0D7C18C6B0" name="X86F03E0D7C18C6B0"></a></p>
52
53 <h4>85.1 <span class="Heading">Key Dependent Operations</span></h4>
54
55 <p><a id="X7CABFDAA8596757E" name="X7CABFDAA8596757E"></a></p>
56
57 <h5>85.1-1 KeyDependentOperation</h5>
58
59 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; KeyDependentOperation</code>( <var class="Arg">name</var>, <var class="Arg">dom-req</var>, <var class="Arg">key-req</var>, <var class="Arg">key-test</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
60 <p>There are several functions that require as first argument a domain, e.g., a group, and as second argument something much simpler, e.g., a prime. <code class="func">SylowSubgroup</code> (<a href="chap39.html#X7AA351308787544C"><span class="RefLink">39.13-1</span></a>) is an example. Since its value depends on two arguments, it cannot be an attribute, yet one would like to store the Sylow subgroups once they have been computed.</p>
61
62 <p>The idea is to provide an attribute of the group, called <code class="code">ComputedSylowSubgroups</code>, and to store the groups in this list. The name implies that the value of this attribute may change in the course of a <strong class="pkg">GAP</strong> session, whenever a newly-computed Sylow subgroup is put into the list. Therefore, this is a <em>mutable attribute</em> (see <a href="chap13.html#X7C701DBF7BAE649A"><span class="RefLink">13.5</span></a>). The list contains primes in each bound odd position and a corresponding Sylow subgroup in the following even position. More precisely, if <code class="code"><var class="Arg">p</var> = ComputedSylowSubgroups( <var class="Arg">G</var> )[ <var class="Arg">even</var> - 1 ]</code> then <code class="code">ComputedSylowSubgroups( <var class="Arg">G</var> )[ <var class="Arg">even</var> ]</code> holds the value of <code class="code">SylowSubgroup( <var class="Arg">G</var>, <var class="Arg">p</var> )</code>. The pairs are sorted in increasing order of <var class="Arg">p</var>, in particular at most one Sylow <var class="Arg">p</var> subgroup of <var class="Arg">G</var> is stored for each prime <var class="Arg">p</var>. This attribute value is maintained by the function <code class="func">SylowSubgroup</code> (<a href="chap39.html#X7AA351308787544C"><span class="RefLink">39.13-1</span></a>), which calls the operation <code class="code">SylowSubgroupOp( <var class="Arg">G</var>, <var class="Arg">p</var> )</code> to do the real work, if the prime <var class="Arg">p</var> cannot be found in the list. So methods that do the real work should be installed for <code class="code">SylowSubgroupOp</code> and not for <code class="func">SylowSubgroup</code> (<a href="chap39.html#X7AA351308787544C"><span class="RefLink">39.13-1</span></a>).</p>
63
64 <p>The same mechanism works for other functions as well, e.g., for <code class="func">PCore</code> (<a href="chap39.html#X7CF497C77B1E8938"><span class="RefLink">39.11-3</span></a>), but also for <code class="func">HallSubgroup</code> (<a href="chap39.html#X7EDBA19E828CD584"><span class="RefLink">39.13-3</span></a>), where the second argument is not a prime but a set of primes.</p>
65
66 <p><code class="func">KeyDependentOperation</code> declares the two operations and the attribute as described above, with names <var class="Arg">name</var>, <var class="Arg">name</var><code class="code">Op</code>, and <code class="code">Computed</code><var class="Arg">name</var><code class="code">s</code>, as well as tester and setter operations <code class="code">Has</code><var class="Arg">name</var> and <code class="code">Set</code><var class="Arg">name</var>, respectively. Note, however, that the tester is not a filter. <var class="Arg">dom-req</var> and <var class="Arg">key-req</var> specify the required filters for the first and second argument of the operation <var class="Arg">name</var><code class="code">Op</code>, which are needed to create this operation with <code class="func">DeclareOperation</code> (<a href="chap78.html#X843F48137B899BC3"><span class="RefLink">78.1-5</span></a>). <var class="Arg">dom-req</var> is also the required filter for the corresponding attribute <code class="code">Computed</code><var class="Arg">name</var><code class="code">s</code>. The fourth argument <var class="Arg">key-test</var> is in general a function to which the second argument <var class="Arg">info</var> of <code class="code"><var class="Arg">name</var>( <var class="Arg">D</var>, <var class="Arg">info</var> )</code> will be passed. This function can perform tests on <var class="Arg">info</var>, and raise an error if appropriate.</p>
67
68 <p>For example, to set up the three objects <code class="func">SylowSubgroup</code> (<a href="chap39.html#X7AA351308787544C"><span class="RefLink">39.13-1</span></a>), <code class="code">SylowSubgroupOp</code>, <code class="code">ComputedSylowSubgroups</code> together, the declaration file <code class="file">lib/grp.gd</code> contains the following line of code.</p>
69
70
71 <div class="example"><pre>
72 KeyDependentOperation( "SylowSubgroup", IsGroup, IsPosInt, "prime" );
73 </pre></div>
74
75 <p>In this example, <var class="Arg">key-test</var> has the value <code class="code">"prime"</code>, which is silently replaced by a function that tests whether its argument is a prime.</p>
76
77
78 <div class="example"><pre>
79 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">s4 := Group((1,2,3,4),(1,2));;</span>
80 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SylowSubgroup( s4, 7 );; ComputedSylowSubgroups( s4 );</span>
81 [ 7, Group(()) ]
82 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SylowSubgroup( s4, 2 );; ComputedSylowSubgroups( s4 );</span>
83 [ 2, Group([ (3,4), (1,4)(2,3), (1,3)(2,4) ]), 7, Group(()) ]
84 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">HasSylowSubgroup( s4, 5 );</span>
85 false
86 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SetSylowSubgroup( s4, 5, Group(()));; ComputedSylowSubgroups( s4 );</span>
87 [ 2, Group([ (3,4), (1,4)(2,3), (1,3)(2,4) ]), 5, Group(()), 7, Group(()) ]
88 </pre></div>
89
90
91 <div class="example"><pre>
92 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">SylowSubgroup( s4, 6 );</span>
93 Error, SylowSubgroup: &lt;p&gt; must be a prime
94 *[1] &lt;&lt;compiled GAP function&gt;&gt;
95 @ GAPROOT/lib/oper1.g:964
96 [2] &lt;&lt;compiled GAP function "SylowSubgroup default method"&gt;&gt;
97 @ GAPROOT/lib/oper1.g:1007
98 &lt;function "SylowSubgroup default method"&gt;( &lt;arguments&gt; )
99 called from read-eval loop at *stdin*:3
100 you can 'quit;' to quit to outer loop, or
101 you can 'return;' to continue
102 <span class="GAPbrkprompt">brk&gt;</span> <span class="GAPinput">quit;</span>
103 </pre></div>
104
105 <p>Thus the prime test need not be repeated in the methods for the operation <code class="code">SylowSubgroupOp</code> (which are installed to do the real work). Note that no methods need be installed for <code class="func">SylowSubgroup</code> (<a href="chap39.html#X7AA351308787544C"><span class="RefLink">39.13-1</span></a>) and <code class="code">ComputedSylowSubgroups</code>. If a method is installed with <code class="func">InstallMethod</code> (<a href="chap78.html#X837EFDAB7BEF290B"><span class="RefLink">78.3-1</span></a>) for a wrapper operation such as <code class="func">SylowSubgroup</code> (<a href="chap39.html#X7AA351308787544C"><span class="RefLink">39.13-1</span></a>) then a warning is signalled provided the <code class="func">InfoWarning</code> (<a href="chap7.html#X7A28F77C82D6A3E0"><span class="RefLink">7.4-8</span></a>) level is at least <code class="code">1</code>. (Use <code class="func">InstallMethod</code> (<a href="chap78.html#X837EFDAB7BEF290B"><span class="RefLink">78.3-1</span></a>) in order to suppress the warning.)</p>
106
107 <p><a id="X78D4D0FF780C8A85" name="X78D4D0FF780C8A85"></a></p>
108
109 <h4>85.2 <span class="Heading">In Parent Attributes</span></h4>
110
111 <p><a id="X7C0E62D8813A4EE6" name="X7C0E62D8813A4EE6"></a></p>
112
113 <h5>85.2-1 InParentFOA</h5>
114
115 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; InParentFOA</code>( <var class="Arg">name</var>, <var class="Arg">super</var>, <var class="Arg">sub</var>, <var class="Arg">AorP</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
116 <p>This section describes how you can add new <q>in parent attributes</q> (see <a href="chap31.html#X7B58FDEF80338DD6"><span class="RefLink">31.8</span></a> and <a href="chap31.html#X7CBDD36E7B7BE286"><span class="RefLink">31.7</span></a>). As an example, we describe how <code class="func">Index</code> (<a href="chap39.html#X842AD37E79CE953E"><span class="RefLink">39.3-2</span></a>) and its related functions are implemented.</p>
117
118 <p>There are two operations <code class="func">Index</code> (<a href="chap39.html#X842AD37E79CE953E"><span class="RefLink">39.3-2</span></a>) and <code class="code">IndexOp</code>, and an attribute <code class="code">IndexInParent</code>. They are created together as shown below, and after they have been created, methods need be installed only for <code class="code">IndexOp</code>. In the creation process, <code class="code">IndexInParent</code> already gets one default method installed (in addition to the usual system getter of each attribute, see <a href="chap13.html#X7C701DBF7BAE649A"><span class="RefLink">13.5</span></a>), namely <code class="code">D -&gt; IndexOp( Parent( D ), D )</code>.</p>
119
120 <p>The operation <code class="func">Index</code> (<a href="chap39.html#X842AD37E79CE953E"><span class="RefLink">39.3-2</span></a>) proceeds as follows.</p>
121
122
123 <ul>
124 <li><p>If it is called with the two arguments <var class="Arg">super</var> and <var class="Arg">sub</var>, and if <code class="code">HasParent( <var class="Arg">sub</var> )</code> and <code class="code">IsIdenticalObj( <var class="Arg">super</var>, Parent( <var class="Arg">sub</var> ) )</code> are <code class="keyw">true</code>, <code class="code">IndexInParent</code> is called with argument <var class="Arg">sub</var>, and the result is returned.</p>
125
126 </li>
127 <li><p>Otherwise, <code class="code">IndexOp</code> is called with the same arguments that <code class="func">Index</code> (<a href="chap39.html#X842AD37E79CE953E"><span class="RefLink">39.3-2</span></a>) was called with, and the result is returned.</p>
128
129 </li>
130 </ul>
131 <p>(Note that it is in principle possible to install even <code class="func">Index</code> (<a href="chap39.html#X842AD37E79CE953E"><span class="RefLink">39.3-2</span></a>) and <code class="code">IndexOp</code> methods for a number of arguments different from two, with <code class="func">InstallOtherMethod</code> (<a href="chap78.html#X7D2C12DB841CE539"><span class="RefLink">78.3-2</span></a>), see <a href="chap13.html#X7C701DBF7BAE649A"><span class="RefLink">13.5</span></a>).</p>
132
133 <p>The call of <code class="func">InParentFOA</code> declares the operations and the attribute as described above, with names <var class="Arg">name</var>, <var class="Arg">name</var><code class="code">Op</code>, and <var class="Arg">name</var><code class="code">InParent</code>. <var class="Arg">super-req</var> and <var class="Arg">sub-req</var> specify the required filters for the first and second argument of the operation <var class="Arg">name</var><code class="code">Op</code>, which are needed to create this operation with <code class="func">DeclareOperation</code> (<a href="chap78.html#X843F48137B899BC3"><span class="RefLink">78.1-5</span></a>). <var class="Arg">sub-req</var> is also the required filter for the corresponding attribute <var class="Arg">name</var><code class="code">InParent</code>; note that <code class="func">HasParent</code> (<a href="chap31.html#X7BC856CC7F116BB0"><span class="RefLink">31.7-1</span></a>) is <em>not</em> required for the argument <var class="Arg">U</var> of <var class="Arg">name</var><code class="code">InParent</code>, because even without a parent stored, <code class="code">Parent( <var class="Arg">U</var> )</code> is legal, meaning <var class="Arg">U</var> itself (see <a href="chap31.html#X7CBDD36E7B7BE286"><span class="RefLink">31.7</span></a>). The fourth argument must be <code class="func">DeclareProperty</code> (<a href="chap13.html#X7F4602F082682A04"><span class="RefLink">13.7-5</span></a>) if <var class="Arg">name</var><code class="code">InParent</code> takes only boolean values (for example in the case <code class="code">IsNormalInParent</code>), and <code class="func">DeclareAttribute</code> (<a href="chap13.html#X7A00FC8A7A677A56"><span class="RefLink">13.5-4</span></a>) otherwise.</p>
134
135 <p>For example, to set up the three objects <code class="func">Index</code> (<a href="chap39.html#X842AD37E79CE953E"><span class="RefLink">39.3-2</span></a>), <code class="code">IndexOp</code>, and <code class="code">IndexInParent</code> together, the declaration file <code class="file">lib/domain.gd</code> contains the following line of code.</p>
136
137
138 <div class="example"><pre>
139 InParentFOA( "Index", IsGroup, IsGroup, DeclareAttribute );
140 </pre></div>
141
142 <p>Note that no methods need be installed for <code class="func">Index</code> (<a href="chap39.html#X842AD37E79CE953E"><span class="RefLink">39.3-2</span></a>) and <code class="code">IndexInParent</code>.</p>
143
144 <p><a id="X7CD4A0867BD825F7" name="X7CD4A0867BD825F7"></a></p>
145
146 <h4>85.3 <span class="Heading">Operation Functions</span></h4>
147
148 <p>Chapter <a href="chap41.html#X87115591851FB7F4"><span class="RefLink">41</span></a> and, in particular, the Section <a href="chap41.html#X83661AFD7B7BD1D9"><span class="RefLink">41.1</span></a> explain that certain operations such as <a href="chap41.html#X81E0FF0587C54543"><span class="RefLink">41.4</span></a>), besides their usual usage with arguments <var class="Arg">G</var>, <var class="Arg">D</var>, and <var class="Arg">opr</var>, can also be applied to an external set (<span class="SimpleMath">G</span>-set), in which case they can be interpreted as attributes. Moreover, they can also be interpreted as attributes for permutation groups, meaning the natural action on the set of its moved points.</p>
149
150 <p>The definition of <a href="chap41.html#X81E0FF0587C54543"><span class="RefLink">41.4</span></a> says that a method should be a function with arguments <var class="Arg">G</var>, <var class="Arg">D</var>, <var class="Arg">gens</var>, <var class="Arg">oprs</var>, and <var class="Arg">opr</var>, as in the case of the operation <code class="func">ExternalSet</code> (<a href="chap41.html#X7C90F648793E47DD"><span class="RefLink">41.12-2</span></a>) when specified via <var class="Arg">gens</var> and <var class="Arg">oprs</var> (see <a href="chap41.html#X7FD3D2D2788709B7"><span class="RefLink">41.12</span></a>). All other syntax variants allowed for <a href="chap41.html#X81E0FF0587C54543"><span class="RefLink">41.4</span></a> (e.g., leaving out <var class="Arg">gens</var> and <var class="Arg">oprs</var>) are handled by default methods.</p>
151
152 <p>The default methods for <a href="chap41.html#X81E0FF0587C54543"><span class="RefLink">41.4</span></a> support the following behaviour.</p>
153
154 <ol>
155 <li><p>If the only argument is an external set <var class="Arg">xset</var> and the attribute tester <code class="code">HasOrbits( <var class="Arg">xset</var> )</code> returns <code class="keyw">true</code>, the stored value of that attribute is returned.</p>
156
157 </li>
158 <li><p>If the only argument is an external set <var class="Arg">xset</var> and the attribute value is not known, the default arguments are obtained from the data of <var class="Arg">xset</var>.</p>
159
160 </li>
161 <li><p>If <var class="Arg">gens</var> and <var class="Arg">oprs</var> are not specified, <var class="Arg">gens</var> is set to <code class="code">Pcgs( <var class="Arg">G</var> )</code> if <code class="code">CanEasilyComputePcgs( <var class="Arg">G</var> )</code> is <code class="keyw">true</code>, and to <code class="code">GeneratorsOfGroup( <var class="Arg">G</var> )</code> otherwise; <var class="Arg">oprs</var> is set to <var class="Arg">gens</var>.</p>
162
163 </li>
164 <li><p>The default value of <var class="Arg">opr</var> is <code class="func">OnPoints</code> (<a href="chap41.html#X7FE417DD837987B4"><span class="RefLink">41.2-1</span></a>).</p>
165
166 </li>
167 <li><p>In the case of an operation of a permutation group <var class="Arg">G</var> on <code class="code">MovedPoints( <var class="Arg">G</var> )</code> via <code class="func">OnPoints</code> (<a href="chap41.html#X7FE417DD837987B4"><span class="RefLink">41.2-1</span></a>), if the attribute tester <code class="code">HasOrbits( <var class="Arg">G</var> )</code> returns <code class="keyw">true</code>, the stored attribute value is returned.</p>
168
169 </li>
170 <li><p>The operation is called as <code class="code"><var class="Arg">result</var>:= Orbits( <var class="Arg">G</var>, <var class="Arg">D</var>, <var class="Arg">gens</var>, <var class="Arg">oprs</var>, <var class="Arg">opr</var> )</code>.</p>
171
172 </li>
173 <li><p>In the case of an external set <var class="Arg">xset</var> or a permutation group <var class="Arg">G</var> in its natural action, the attribute setter is called to store <var class="Arg">result</var>.</p>
174
175 </li>
176 <li><p><var class="Arg">result</var> is returned.</p>
177
178 </li>
179 </ol>
180 <p>The declaration of operations that match the above pattern is done as follows.</p>
181
182 <p><a id="X7CA3826A7EBDE208" name="X7CA3826A7EBDE208"></a></p>
183
184 <h5>85.3-1 OrbitsishOperation</h5>
185
186 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; OrbitsishOperation</code>( <var class="Arg">name</var>, <var class="Arg">reqs</var>, <var class="Arg">usetype</var>, <var class="Arg">AorP</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
187 <p>declares an attribute <code class="code">op</code>, with name <var class="Arg">name</var>. The second argument <var class="Arg">reqs</var> specifies the list of required filters for the usual (five-argument) methods that do the real work.</p>
188
189 <p>If the third argument <var class="Arg">usetype</var> is <code class="keyw">true</code>, the function call <code class="code">op( xset )</code> will –if the value of <code class="code">op</code> for <code class="code">xset</code> is not yet known– delegate to the five-argument call of <code class="code">op</code> with second argument <code class="code">xset</code> rather than with <code class="code">D</code>. This allows certain methods for <code class="code">op</code> to make use of the type of <code class="code">xset</code>, in which the types of the external subsets of <code class="code">xset</code> and of the external orbits in <code class="code">xset</code> are stored. (This is used to avoid repeated calls of <code class="func">NewType</code> (<a href="chap13.html#X7CE39E9478AEC826"><span class="RefLink">13.9-3</span></a>) in functions like <code class="code">ExternalOrbits( xset )</code>, which call <code class="code">ExternalOrbit( xset, pnt )</code> for several values of <code class="code">pnt</code>.)</p>
190
191 <p>For property testing functions such as <code class="func">IsTransitive</code> (<a href="chap41.html#X79B15750851828CB"><span class="RefLink">41.10-1</span></a>), the fourth argument <var class="Arg">AorP</var> must be <code class="func">NewProperty</code> (<a href="chap13.html#X7F2D6FD979FE23DD"><span class="RefLink">13.7-4</span></a>), otherwise it must be <code class="func">NewAttribute</code> (<a href="chap13.html#X7B9654807858A3B0"><span class="RefLink">13.5-3</span></a>); in the former case, a property is returned, in the latter case an attribute that is not a property.</p>
192
193 <p>For example, to set up the operation <code class="func">Orbits</code> (<a href="chap41.html#X86BCAE17869BBEAA"><span class="RefLink">41.4-2</span></a>), the declaration file <code class="file">lib/oprt.gd</code> contains the following line of code:</p>
194
195
196 <div class="example"><pre>
197 OrbitsishOperation( "Orbits", OrbitsishReq, false, NewAttribute );
198 </pre></div>
199
200 <p>The global variable <code class="code">OrbitsishReq</code> contains the standard requirements</p>
201
202
203 <div class="example"><pre>
204 OrbitsishReq := [ IsGroup, IsList,
205 IsList,
206 IsList,
207 IsFunction ];
208 </pre></div>
209
210 <p>which are usually entered in calls to <code class="func">OrbitsishOperation</code>.</p>
211
212 <p>The new operation, e.g., <code class="func">Orbits</code> (<a href="chap41.html#X86BCAE17869BBEAA"><span class="RefLink">41.4-2</span></a>), can be called either as <code class="code">Orbits( <var class="Arg">xset</var> )</code> for an external set <var class="Arg">xset</var>, or as <code class="code">Orbits( <var class="Arg">G</var> )</code> for a permutation group <var class="Arg">G</var>, meaning the orbits on the moved points of <var class="Arg">G</var> via <code class="func">OnPoints</code> (<a href="chap41.html#X7FE417DD837987B4"><span class="RefLink">41.2-1</span></a>), or as</p>
213
214 <p><code class="code">Orbits( <var class="Arg">G</var>, <var class="Arg">Omega</var>[, <var class="Arg">gens</var>, <var class="Arg">acts</var>][, <var class="Arg">act</var>] )</code>,</p>
215
216 <p>with a group <var class="Arg">G</var>, a domain or list <var class="Arg">Omega</var>, generators <var class="Arg">gens</var> of <var class="Arg">G</var>, and corresponding elements <var class="Arg">acts</var> that act on <var class="Arg">Omega</var> via the function <var class="Arg">act</var>; the default of <var class="Arg">gens</var> and <var class="Arg">acts</var> is a list of group generators of <var class="Arg">G</var>, the default of <var class="Arg">act</var> is <code class="func">OnPoints</code> (<a href="chap41.html#X7FE417DD837987B4"><span class="RefLink">41.2-1</span></a>).</p>
217
218 <p>Only methods for the five-argument version need to be installed for doing the real work. (And of course methods for one argument in case one wants to define a new meaning of the attribute.)</p>
219
220 <p><a id="X7B23C48482ADB237" name="X7B23C48482ADB237"></a></p>
221
222 <h5>85.3-2 OrbitishFO</h5>
223
224 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; OrbitishFO</code>( <var class="Arg">name</var>, <var class="Arg">reqs</var>, <var class="Arg">famrel</var>, <var class="Arg">usetype</var>, <var class="Arg">realenum</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
225 <p>is used to create operations like <code class="func">Orbit</code> (<a href="chap41.html#X80E0234E7BD79409"><span class="RefLink">41.4-1</span></a>). This function is analogous to <code class="func">OrbitsishOperation</code> (<a href="chap85.html#X7CA3826A7EBDE208"><span class="RefLink">85.3-1</span></a>), but for operations <var class="Arg">orbish</var> like <code class="code">Orbit( <var class="Arg">G</var>, <var class="Arg">Omega</var>, <var class="Arg">pnt</var> )</code>. Since the return values of these operations depend on the additional argument <var class="Arg">pnt</var>, there is no associated attribute.</p>
226
227 <p>The call of <code class="func">OrbitishFO</code> declares a wrapper function and its operation, with names <var class="Arg">name</var> and <var class="Arg">name</var><code class="code">Op</code>.</p>
228
229 <p>The second argument <var class="Arg">reqs</var> specifies the list of required filters for the operation <var class="Arg">name</var><code class="code">Op</code>.</p>
230
231 <p>The third argument <var class="Arg">famrel</var> is used to test the family relation between the second and third argument of <code class="code"><var class="Arg">name</var>( <var class="Arg">G</var>, <var class="Arg">D</var>, <var class="Arg">pnt</var> )</code>. For example, <var class="Arg">famrel</var> is <code class="code">IsCollsElms</code> in the case of <code class="func">Orbit</code> (<a href="chap41.html#X80E0234E7BD79409"><span class="RefLink">41.4-1</span></a>) because <var class="Arg">pnt</var> must be an element of <var class="Arg">D</var>. Similarly, in the call <code class="code">Blocks( <var class="Arg">G</var>, <var class="Arg">D</var>, <var class="Arg">seed</var> )</code>, <var class="Arg">seed</var> must be a subset of <var class="Arg">D</var>, and the family relation must be <code class="func">IsIdenticalObj</code> (<a href="chap12.html#X7961183378DFB902"><span class="RefLink">12.5-1</span></a>).</p>
232
233 <p>The fourth argument <var class="Arg">usetype</var> serves the same purpose as in the case of <code class="func">OrbitsishOperation</code> (<a href="chap85.html#X7CA3826A7EBDE208"><span class="RefLink">85.3-1</span></a>). <var class="Arg">usetype</var> can also be an attribute, such as <code class="code">BlocksAttr</code> or <code class="code">MaximalBlocksAttr</code>. In this case, if only one of the two arguments <var class="Arg">Omega</var> and <var class="Arg">pnt</var> is given, blocks with no seed are computed, they are stored as attribute values according to the rules of <code class="func">OrbitsishOperation</code> (<a href="chap85.html#X7CA3826A7EBDE208"><span class="RefLink">85.3-1</span></a>).</p>
234
235 <p>If the 5th argument is set to <code class="keyw">true</code>, the action for an external set should use the enumerator, otherwise it uses the <code class="func">HomeEnumerator</code> (<a href="chap41.html#X86A0CC1479A5932A"><span class="RefLink">41.12-5</span></a>) value. This will make a difference for external orbits as part of a larger domain.</p>
236
237 <p><a id="X834E92F07DD0BF04" name="X834E92F07DD0BF04"></a></p>
238
239 <h5>85.3-3 <span class="Heading">Example: Orbit and OrbitOp</span></h5>
240
241 <p>For example, to setup the function <code class="func">Orbit</code> (<a href="chap41.html#X80E0234E7BD79409"><span class="RefLink">41.4-1</span></a>) and its operation <code class="code">OrbitOp</code>, the declaration file <code class="file">lib/oprt.gd</code> contains the following line of code:</p>
242
243
244 <div class="example"><pre>
245 OrbitishFO( "Orbit", OrbitishReq, IsCollsElms, false, false );
246 </pre></div>
247
248 <p>The variable <code class="code">OrbitishReq</code> contains the standard requirements</p>
249
250
251 <div class="example"><pre>
252 OrbitishReq := [ IsGroup, IsList, IsObject,
253 IsList,
254 IsList,
255 IsFunction ];
256 </pre></div>
257
258 <p>which are usually entered in calls to <code class="func">OrbitishFO</code> (<a href="chap85.html#X7B23C48482ADB237"><span class="RefLink">85.3-2</span></a>).</p>
259
260 <p>The relation test via <var class="Arg">famrel</var> is used to provide a uniform construction of the wrapper functions created by <code class="func">OrbitishFO</code> (<a href="chap85.html#X7B23C48482ADB237"><span class="RefLink">85.3-2</span></a>), in spite of the different syntax of the specific functions. For example, <code class="func">Orbit</code> (<a href="chap41.html#X80E0234E7BD79409"><span class="RefLink">41.4-1</span></a>) admits the calls <code class="code">Orbit( <var class="Arg">G</var>, <var class="Arg">D</var>, <var class="Arg">pnt</var>, <var class="Arg">opr</var> )</code> and <code class="code">Orbit( <var class="Arg">G</var>, <var class="Arg">pnt</var>, <var class="Arg">opr</var> )</code>, i.e., the second argument <var class="Arg">D</var> may be omitted; <code class="func">Blocks</code> (<a href="chap41.html#X84FE699F85371643"><span class="RefLink">41.11-1</span></a>) admits the calls <code class="code">Blocks( <var class="Arg">G</var>, <var class="Arg">D</var>, <var class="Arg">seed</var>, <var class="Arg">opr</var> )</code> and <code class="code">Blocks( <var class="Arg">G</var>, <var class="Arg">D</var>, <var class="Arg">opr</var> )</code>, i.e., the third argument may be omitted. The translation to the appropriate call of <code class="code">OrbitOp</code> or <code class="code">BlocksOp</code>, for either operation with five or six arguments, is handled via <var class="Arg">famrel</var>.</p>
261
262 <p>As a consequence, there must not only be methods for <code class="code">OrbitOp</code> with the six arguments corresponding to <code class="code">OrbitishReq</code>, but also methods for only five arguments (i.e., without <var class="Arg">D</var>). Plenty of examples are contained in the implementation file <code class="file">lib/oprt.gi</code>.</p>
263
264 <p>In order to handle a few special cases (currently <code class="func">Blocks</code> (<a href="chap41.html#X84FE699F85371643"><span class="RefLink">41.11-1</span></a>) and <code class="func">MaximalBlocks</code> (<a href="chap41.html#X79936EB97AAD1144"><span class="RefLink">41.11-2</span></a>)), also the following form of <code class="func">OrbitishFO</code> (<a href="chap85.html#X7B23C48482ADB237"><span class="RefLink">85.3-2</span></a>) is supported.</p>
265
266 <p><code class="code">OrbitishFO( <var class="Arg">name</var>, <var class="Arg">reqs</var>, <var class="Arg">famrel</var>, <var class="Arg">attr</var> )</code></p>
267
268 <p>The functions in question depend upon an argument <var class="Arg">seed</var>, so they cannot be regarded as attributes. However, they are most often called without giving <var class="Arg">seed</var>, meaning <q>choose any minimal resp. maximal block system</q>. In this case, the result can be stored as the value of the attribute <var class="Arg">attr</var> that was entered as fourth argument of <code class="func">OrbitishFO</code> (<a href="chap85.html#X7B23C48482ADB237"><span class="RefLink">85.3-2</span></a>). This attribute is considered by a call <code class="code">Blocks( <var class="Arg">G</var>, <var class="Arg">D</var>, <var class="Arg">opr</var> )</code> (i.e., without <var class="Arg">seed</var>) in the same way as <code class="func">Orbits</code> (<a href="chap41.html#X86BCAE17869BBEAA"><span class="RefLink">41.4-2</span></a>) considers <code class="code">OrbitsAttr</code>.</p>
269
270 <p>To set this up, the declaration file <code class="file">lib/oprt.gd</code> contains the following lines:</p>
271
272
273 <div class="example"><pre>
274 DeclareAttribute( "BlocksAttr", IsExternalSet );
275 OrbitishFO( "Blocks",
276 [ IsGroup, IsList, IsList,
277 IsList,
278 IsList,
279 IsFunction ], IsIdenticalObj, BlocksAttr, true );
280 </pre></div>
281
282 <p>And this extraordinary FOA triple works as follows:</p>
283
284
285 <div class="example"><pre>
286 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">s4 := Group((1,2,3,4),(1,2));;</span>
287 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Blocks( s4, MovedPoints(s4), [1,2] );</span>
288 [ [ 1, 2, 3, 4 ] ]
289 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Tester( BlocksAttr )( s4 );</span>
290 false
291 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Blocks( s4, MovedPoints(s4) );</span>
292 [ [ 1, 2, 3, 4 ] ]
293 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Tester( BlocksAttr )( s4 ); BlocksAttr( s4 );</span>
294 true
295 [ [ 1, 2, 3, 4 ] ]
296 </pre></div>
297
298
299 <div class="chlinkprevnextbot">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp; <a href="chap0.html#contents">[Contents]</a>&nbsp; &nbsp;<a href="chap84.html">[Previous Chapter]</a>&nbsp; &nbsp;<a href="chap86.html">[Next Chapter]</a>&nbsp; </div>
300
301
302 <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>
303
304 <hr />
305 <p class="foot">generated by <a href="https://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
306 </body>
307 </html>