File: foa.xml

package info (click to toggle)
gap 4.15.1-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 110,212 kB
  • sloc: ansic: 97,261; xml: 48,343; cpp: 13,946; sh: 4,900; perl: 1,650; javascript: 255; makefile: 252; ruby: 9
file content (229 lines) | stat: -rw-r--r-- 8,938 bytes parent folder | download | duplicates (2)
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
<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<!-- %% -->
<!-- %W  foa.tex                   GAP documentation            Heiko Theißen -->
<!-- %% -->
<!-- %% -->
<!-- %Y  Copyright 1997,  Lehrstuhl D für Mathematik,  RWTH Aachen,   Germany -->
<!-- %% -->
<Chapter Label="Function-Operation-Attribute Triples">
<Heading>Function-Operation-Attribute Triples</Heading>

&GAP;  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  <E>attributes</E>; and    this   was already mentioned   in
section&nbsp;<Ref Sect="Attributes" BookName="tut"/>.
In   this  chapter  we  will
describe further mechanisms that  allow storage of  results that  are not
values of attributes.
<P/>
<Index>FOA triples</Index>
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, &GAP; knows, in
addition  to  the <E>operation</E>  and  the  <E>attributes</E>   also a
<E>function</E>, 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
<E>f</E>unction-<E>o</E>peration-<E>a</E>ttribute triple (or <E>FOA triple</E>)  is set up by
a single   &GAP; 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.


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Key Dependent Operations">
<Heading>Key Dependent Operations</Heading>

<#Include Label="KeyDependentOperation">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="In Parent Attributes">
<Heading>In Parent Attributes</Heading>

<#Include Label="InParentFOA">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Operation Functions">
<Heading>Operation Functions</Heading>

<Index Key="ExternalSet" Subkey="computing orbits"><C>ExternalSet</C></Index>
<Index Key="G-sets" Subkey="computing orbits"><M>G</M>-sets</Index>
<Index Key="Orbits" Subkey="as attributes for external sets"><C>Orbits</C></Index>
Chapter&nbsp;<Ref Chap="Group Actions"/>
and, in particular,
the Section&nbsp;<Ref Sect="About Group Actions"/>
<!-- % currently in <C>abattoir/group.tex</C>, <C>abattoir/permgrp.tex</C>, -->
<!-- % <C>abattoir/solvgrp.tex</C> ... -->
explain that certain operations such as <Ref Sect="Orbits"/>),
besides their usual usage with arguments <A>G</A>, <A>D</A>, and <A>opr</A>,
can also be applied to an external set (<M>G</M>-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/>
The definition of <Ref Sect="Orbits"/> says that a method
should be a function
with arguments <A>G</A>, <A>D</A>, <A>gens</A>, <A>oprs</A>, and <A>opr</A>,
as in the case of the operation <Ref Oper="ExternalSet"/>
when specified via <A>gens</A> and <A>oprs</A>
(see&nbsp;<Ref Sect="External Sets"/>).
All other syntax variants allowed for <Ref Sect="Orbits"/>
(e.g., leaving out <A>gens</A> and <A>oprs</A>)
are handled by default methods.
<P/>
The default methods for <Ref Sect="Orbits"/> support the
following behaviour.
<Enum>
<Item>
    If the only argument is an external set <A>xset</A> and the attribute
    tester <C>HasOrbits( <A>xset</A> )</C> returns <K>true</K>,
    the stored value of that attribute is returned.
</Item>
<Item>
    If the only argument is an external set <A>xset</A> and the attribute
    value is not known,
    the default arguments are obtained from the data of <A>xset</A>.
</Item>
<Item>
    If <A>gens</A> and <A>oprs</A> are not specified,
    <A>gens</A> is set to <C>Pcgs( <A>G</A> )</C>
    if <C>CanEasilyComputePcgs( <A>G</A> )</C>
    is <K>true</K>, and to <C>GeneratorsOfGroup( <A>G</A> )</C> otherwise;
    <A>oprs</A> is set to <A>gens</A>.
</Item>
<Item>
    The default value of <A>opr</A> is <Ref Func="OnPoints"/>.
</Item>
<Item>
    In the case of an operation of a permutation group <A>G</A>
    on <C>MovedPoints( <A>G</A> )</C> via
    <Ref Func="OnPoints"/>,
    if the attribute tester <C>HasOrbits( <A>G</A> )</C> returns <K>true</K>,
    the stored attribute value is returned.
</Item>
<Item>
    The operation is called as
    <C><A>result</A>:= Orbits( <A>G</A>, <A>D</A>, <A>gens</A>,
    <A>oprs</A>, <A>opr</A> )</C>.
</Item>
<Item>
    In the case of an external set <A>xset</A> or a permutation group
    <A>G</A> in its natural action,
    the attribute setter is called to store <A>result</A>.
</Item>
<Item>
    <A>result</A> is returned.
</Item>
</Enum>
<P/>
The declaration of operations that match the above pattern is done
as follows.

<#Include Label="OrbitsishOperation">
<#Include Label="OrbitishFO">

<Subsection Label="Example: Orbit and OrbitOp">
<Heading>Example: Orbit and OrbitOp</Heading>

For example, to setup the function <Ref Oper="Orbit"/>
and its operation <C>OrbitOp</C>,
the declaration file <F>lib/oprt.gd</F> contains the following line of code:
<Log><![CDATA[
OrbitishFO( "Orbit", OrbitishReq, IsCollsElms, false, false );
]]></Log>
The variable <C>OrbitishReq</C> contains the standard requirements
<Log><![CDATA[
OrbitishReq  := [ IsGroup, IsList, IsObject,
                  IsList,
                  IsList,
                  IsFunction ];
]]></Log>
which are usually entered in calls to <Ref Func="OrbitishFO"/>.
<P/>
The relation test via <A>famrel</A> is used to provide a uniform
construction of the wrapper functions created by
<Ref Func="OrbitishFO"/>,
in spite of the different syntax of the specific functions.
For example, <Ref Oper="Orbit"/> admits the calls
<C>Orbit( <A>G</A>, <A>D</A>, <A>pnt</A>, <A>opr</A> )</C>
and <C>Orbit( <A>G</A>, <A>pnt</A>, <A>opr</A> )</C>,
i.e., the second argument <A>D</A> may be omitted;
<Ref Oper="Blocks" Label="for a group, an action domain, etc."/>
admits the calls
<C>Blocks( <A>G</A>, <A>D</A>, <A>seed</A>, <A>opr</A> )</C> and
<C>Blocks( <A>G</A>, <A>D</A>, <A>opr</A> )</C>,
i.e., the third argument may be omitted.
The translation to the appropriate call of <C>OrbitOp</C> or
<C>BlocksOp</C>,
for either operation with five or six arguments,
is handled via <A>famrel</A>.
<P/>
As a  consequence, there must not only be methods for <C>OrbitOp</C>
with the six arguments corresponding to <C>OrbitishReq</C>,
but also methods for only five arguments (i.e., without <A>D</A>).
Plenty of examples are contained in the implementation file
<F>lib/oprt.gi</F>.
<P/>
In order to handle a few special cases
(currently <Ref Oper="Blocks" Label="for a group, an action domain, etc."/>
and
<Ref Oper="MaximalBlocks" Label="for a group, an action domain, etc."/>),
also the following form of <Ref Func="OrbitishFO"/> is supported.
<P/>
<C>OrbitishFO( <A>name</A>, <A>reqs</A>, <A>famrel</A>, <A>attr</A> )</C>
<P/>
The functions in question depend upon an argument <A>seed</A>,
so they cannot be regarded as attributes.
However, they are most often called without giving <A>seed</A>,
meaning <Q>choose any minimal resp. maximal block system</Q>.
In this case, the result can be stored as the value of the attribute
<A>attr</A> that was entered as fourth argument of
<Ref Func="OrbitishFO"/>.
This attribute is considered by a call
<C>Blocks( <A>G</A>, <A>D</A>, <A>opr</A> )</C>
(i.e., without <A>seed</A>) in the same way as
<Ref Attr="Orbits" Label="attribute"/> considers <C>OrbitsAttr</C>.
<P/>
To set this up,
the declaration file <F>lib/oprt.gd</F> contains the following lines:
<Log><![CDATA[
DeclareAttribute( "BlocksAttr", IsExternalSet );
OrbitishFO( "Blocks",
    [ IsGroup, IsList, IsList,
      IsList,
      IsList,
      IsFunction ], IsIdenticalObj, BlocksAttr, true );
]]></Log>
And this extraordinary FOA triple works as follows:
<Example><![CDATA[
gap> s4 := Group((1,2,3,4),(1,2));;
gap> Blocks( s4, MovedPoints(s4), [1,2] );
[ [ 1, 2, 3, 4 ] ]
gap> Tester( BlocksAttr )( s4 );
false
gap> Blocks( s4, MovedPoints(s4) );
[ [ 1, 2, 3, 4 ] ]
gap> Tester( BlocksAttr )( s4 );  BlocksAttr( s4 );
true
[ [ 1, 2, 3, 4 ] ]
]]></Example>

</Subsection>
</Section>
</Chapter>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<!-- %% -->
<!-- %E -->