CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it

Views: 418346
1
<Chapter><Heading>Pattern Classes</Heading>
2
3
Permutation pattern classes can be determined using their corresponding basis.
4
The basis of a pattern class is the anti-chain of the class,
5
under the order of containment. A permutation <M>\pi</M> contains another
6
permutation <M>\sigma</M> (of shorter length) if there is a subsequence
7
in <M>\pi</M>, which is isomorphic to <M>\sigma</M>. <P/>
8
With the rational language of the rank encoded class, it is also possible
9
to find the rational language of the basis and vice versa.
10
Several specific kinds of transducers are used in this process.
11
<Cite Key="RegCloSetPerms"/>
12
13
<Section><Heading>Transducers</Heading>
14
15
<ManSection>
16
<Func Name="Transducer" Arg="states,init,transitions,accepting"/>
17
<Returns>A record that represents a transducer.</Returns>
18
<Description>
19
A transducer is essentially an automaton, where running through the process does not
20
determine whether the input is accepted, but the input is translated to another language,
21
over a different alphabet. <P/>
22
Formally a transducer is a six-tuple with:
23
<M>Q</M> being the set of states, <M>S</M> the input alphabet, <M>G</M> the output alphabet,
24
<M>I \in Q</M> the start state, <M>A \subseteq Q</M> the set of accept states, and with the transition function
25
<M>f: Q \times (S \cup \{e\}) \rightarrow Q \times (G \cup \{e\})</M>, where <M>e</M> is the empty word. <P/>
26
In this function the transducer is stored by defining how many states there are, which one (by index) is the start
27
or initial state, the transitions are of the form <C>[inputletter,outputletter,fromstate,tostate]</C> and
28
a list of accept states. The input and output alphabet are determined by the input and output letters on
29
the transitions.
30
<Example><![CDATA[
31
gap> trans:=Transducer(3,1,[[1,2,1,2],[1,2,2,2],[2,2,1,3],[2,2,2,3],
32
> [1,1,3,3],[2,2,3,3]],[2]);
33
rec( accepting := [ 2 ], initial := 1, states := 3,
34
transitions := [ [ 1, 2, 1, 2 ], [ 1, 2, 2, 2 ], [ 2, 2, 1, 3 ],
35
[ 2, 2, 2, 3 ], [ 1, 1, 3, 3 ], [ 2, 2, 3, 3 ] ] )
36
gap> ]]></Example>
37
<Alt Only="LaTeX">
38
This transducer can be visualised as the following graph:
39
\begin{figure}[H] \begin{center} \leavevmode \includegraphics[scale=0.75]{img/trans.jpg} \end{center} \end{figure}
40
</Alt>
41
<Alt Only="HTML">
42
This transducer can be visualised as the following graph:
43
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;img/trans.jpg&#34; WIDTH=241 HEIGHT=296 &#62;&#60;/center&#62;&#60;br&#62;
44
</Alt>
45
</Description>
46
</ManSection>
47
48
49
50
51
<ManSection>
52
<Func Name="DeletionTransducer" Arg="k"/>
53
<Returns>A transducer over <C>k</C>+1 states.</Returns>
54
<Description>
55
A deletion transducer is a transducer that deletes one letter of a rank encoded permutation
56
and returns the correct rank encoding of the new permutation. The deletion transducer over <C>k</C>
57
deletes letters over the set of all rank encoded permutations with highest rank <C>k</C>.
58
Specifically, running through a deletion transducer with a rank encoded permutation, of highest rank <C>k</C>,
59
will lead to the set of all rank encoded permutations that have one letter of the initial permutation removed.
60
It is important to note that computing these shorter permutations with the transducer, is done by reading the
61
input permutation from right to left.
62
For example the deletion transducer with <C>k</C>=3, looks as follows:
63
<Example><![CDATA[
64
gap> DeletionTransducer(3);
65
rec( accepting := [ 1 .. 3 ], initial := 4, states := 4,
66
transitions := [ [ 1, 1, 4, 4 ], [ 1, 0, 4, 1 ], [ 2, 1, 1, 1 ],
67
[ 1, 1, 1, 2 ], [ 3, 2, 1, 1 ], [ 1, 1, 2, 3 ], [ 1, 1, 3, 3 ],
68
[ 2, 2, 4, 4 ], [ 2, 0, 4, 2 ], [ 3, 2, 2, 2 ], [ 2, 2, 2, 3 ],
69
[ 2, 2, 3, 3 ], [ 3, 3, 4, 4 ], [ 3, 0, 4, 3 ], [ 3, 3, 3, 3 ] ] )
70
gap> ]]></Example>
71
<Alt Only="LaTeX">
72
\begin{figure}[H] \begin{center} \leavevmode \includegraphics[scale=0.75]{img/dt3.jpg} \end{center} \end{figure}
73
</Alt>
74
<Alt Only="HTML">
75
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;img/dt3.jpg&#34; WIDTH=288 HEIGHT=317 &#62;&#60;/center&#62;&#60;br&#62;
76
</Alt>
77
</Description>
78
</ManSection>
79
80
81
82
83
<ManSection>
84
<Func Name="TransposedTransducer" Arg="t"/>
85
<Returns>A new transducer with interchanged input and output letters on each transition.</Returns>
86
<Description>
87
A transducer is transposed when all origins and destinations of transitions are left the same as before
88
but the input and output letters on each transition are interchanged.
89
Taking the deletion transducer from above, its transpose looks as follows:
90
<Example><![CDATA[
91
gap> TransposedTransducer(DeletionTransducer(3));
92
rec( accepting := [ 1 .. 3 ], initial := 4, states := 4,
93
transitions := [ [ 1, 1, 4, 4 ], [ 0, 1, 4, 1 ], [ 1, 2, 1, 1 ],
94
[ 1, 1, 1, 2 ], [ 2, 3, 1, 1 ], [ 1, 1, 2, 3 ], [ 1, 1, 3, 3 ],
95
[ 2, 2, 4, 4 ], [ 0, 2, 4, 2 ], [ 2, 3, 2, 2 ], [ 2, 2, 2, 3 ],
96
[ 2, 2, 3, 3 ], [ 3, 3, 4, 4 ], [ 0, 3, 4, 3 ], [ 3, 3, 3, 3 ] ] )
97
gap> ]]></Example>
98
<Alt Only="LaTeX">
99
\begin{figure}[H] \begin{center} \leavevmode \includegraphics[scale=0.75]{img/dtt3.jpg} \end{center} \end{figure}
100
</Alt>
101
<Alt Only="HTML">
102
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;img/dtt3.jpg&#34; WIDTH=293 HEIGHT=319 &#62;&#60;/center&#62;&#60;br&#62;
103
</Alt>
104
</Description>
105
</ManSection>
106
107
108
109
110
<ManSection>
111
<Func Name="InvolvementTransducer" Arg="k"/>
112
<Returns>A transducer over <C>k</C>+1 states, with a <C>k</C> sized alphabet.</Returns>
113
<Description>
114
An involvement transducer is a transducer over <C>k</C>+1 states, and deletes
115
any number of letters in a rank encoded permutation, of rank at most <C>k</C>.
116
<Example><![CDATA[
117
gap> InvolvementTransducer(3);
118
rec( accepting := [ 1 .. 4 ], initial := 4, states := 4,
119
transitions := [ [ 1, 1, 1, 2 ], [ 1, 0, 1, 3 ], [ 2, 1, 1, 1 ],
120
[ 2, 0, 1, 3 ], [ 3, 2, 1, 1 ], [ 3, 0, 1, 1 ], [ 1, 1, 2, 4 ],
121
[ 1, 0, 2, 1 ], [ 2, 2, 2, 4 ], [ 2, 0, 2, 2 ], [ 3, 2, 2, 2 ],
122
[ 3, 0, 2, 2 ], [ 1, 1, 3, 2 ], [ 1, 0, 3, 3 ], [ 2, 1, 3, 1 ],
123
[ 2, 0, 3, 3 ], [ 3, 1, 3, 3 ], [ 3, 0, 3, 3 ], [ 1, 1, 4, 4 ],
124
[ 1, 0, 4, 1 ], [ 2, 2, 4, 4 ], [ 2, 0, 4, 2 ], [ 3, 3, 4, 4 ],
125
[ 3, 0, 4, 4 ] ] )
126
gap> ]]></Example>
127
<Alt Only="LaTeX">
128
\begin{figure}[H] \begin{center} \leavevmode \includegraphics[scale=0.75]{img/it3.jpg} \end{center} \end{figure}
129
</Alt>
130
<Alt Only="HTML">
131
&#60;br&#62;&#60;center&#62;&#60;img src=&#34;img/it3.jpg&#34; WIDTH=318 HEIGHT=331 &#62;&#60;/center&#62;&#60;br&#62;
132
</Alt>
133
</Description>
134
</ManSection>
135
136
137
138
139
140
<ManSection>
141
<Func Name="CombineAutTransducer" Arg="aut,trans"/>
142
<Returns>An automaton consisting of a combination of <C>aut</C> and <C>trans</C>.</Returns>
143
<Description>
144
Combining automata and transducers is done over the natural "translation" of the by the automaton accepted language
145
through the transducer and then building a new automaton that accepts the new language. The function
146
<C>CombineAutTransducer</C> does this process and returns the new non-deterministic automaton.
147
<Example><![CDATA[
148
gap> a:=Automaton("det",1,1,[[1]],[1],[1]);
149
< deterministic automaton on 1 letters with 1 states >
150
gap> AutToRatExp(a);
151
a*
152
gap> t:=Transducer(2,1,[[1,2,1,2],[2,1,1,2],
153
> [1,1,2,1],[2,2,2,1]],[1]);
154
rec( accepting := [ 1 ], initial := 1, states := 2,
155
transitions := [ [ 1, 2, 1, 2 ], [ 2, 1, 1, 2 ], [ 1, 1, 2, 1 ],
156
[ 2, 2, 2, 1 ] ] )
157
gap> res:=CombineAutTransducer(a,t);
158
< non deterministic automaton on 2 letters with 2 states >
159
gap> AutToRatExp(res);
160
(ba)*
161
gap> Display(res);
162
| 1 2
163
-------------------
164
a | [ 1 ]
165
b | [ 2 ]
166
Initial state: [ 1 ]
167
Accepting state: [ 1 ]
168
gap> ]]></Example>
169
170
</Description>
171
</ManSection>
172
173
</Section>
174
175
176
177
<Section><Heading>From Class to Basis and vice versa</Heading>
178
<ManSection>
179
<Func Name="BasisAutomaton" Arg="a"/>
180
<Returns>An automaton that accepts the rank encoded permutations of the basis
181
of the input automaton <C>a</C>.</Returns>
182
<Description>
183
Every pattern class has a basis that consists of the smallest set of permutations which do not
184
belong to the class. Using
185
<Display Mode="M">B(L)=(L^{r} D^{t})^{r} \cap L^{c}</Display>
186
it is possible using the deletion transducer <M>D</M> and the language of rank encoded permutations <M>L</M>
187
to find the language of the rank encoded permutations of the basis <M>B(L)</M>, and thus the basis.
188
<Example><![CDATA[
189
gap> x:=Parstacks(2,2);
190
[ [ 2, 4 ], [ 3, 6 ], [ 2 ], [ 5, 6 ], [ 4 ], [ ] ]
191
gap> xa:=GraphToAut(x,1,6);
192
< epsilon automaton on 5 letters with 66 states >
193
gap> ma:=MinimalAutomaton(xa);
194
< deterministic automaton on 4 letters with 9 states >
195
gap> Display(ma);
196
| 1 2 3 4 5 6 7 8 9
197
--------------------------------
198
a | 1 2 1 3 2 2 6 6 3
199
b | 3 2 3 3 4 3 6 9 3
200
c | 9 2 9 4 6 6 4 9 9
201
d | 8 2 8 7 5 5 7 8 8
202
Initial state: [ 1 ]
203
Accepting state: [ 1 ]
204
gap> ba:=BasisAutomaton(ma);
205
< deterministic automaton on 4 letters with 9 states >
206
gap> Display(ba);
207
| 1 2 3 4 5 6 7 8 9
208
--------------------------------
209
a | 2 2 1 3 4 2 2 2 2
210
b | 2 2 2 2 2 4 1 2 8
211
c | 2 2 2 2 2 2 1 2 2
212
d | 2 2 2 9 2 2 5 6 2
213
Initial state: [ 7 ]
214
Accepting states: [ 1, 5 ]
215
gap> AutToRatExp(ba);
216
d(a(dbdb)*aaU@)UbUc
217
gap> ]]></Example>
218
Ignoring the trailing <C>UbUc</C> which essentially are noise, the basis of the pattern class indicates which
219
permutations are avoided in this particular class. The shortest permutation in the basis, looking at the rational expression,
220
is <M>daaa</M>, which can be translated to 4111 and decoded to the permutation 4123.
221
</Description>
222
</ManSection>
223
224
225
226
227
<ManSection>
228
<Func Name="ClassAutomaton" Arg="a"/>
229
<Returns>The automaton that accepts permutations of the class in their rank encoding.</Returns>
230
<Description>
231
The function <C>ClassAutomaton</C> does the reverse process of <C>BasisAutomaton</C>. Namely it
232
takes the automaton that represents the language of the rank encoded basis of a permutation class,
233
and using the formula
234
<Display Mode="M">L=B_{k} \cap ((B(L)^{r} I^{t})^{c} )^{r}</Display>
235
returns the automaton that accepts the rank encoded permutations of the class.
236
In the formula, <M>B_{k}</M> is the automaton that accepts all permutations of any length with
237
highest rank <M>k</M>, <M>B(L)</M> is the automaton that represents the basis and <M>I</M> is
238
the involement transducer.
239
<Example><![CDATA[
240
gap> xa:=Automaton("det",9,4,[[2,2,1,3,4,2,2,2,2],[2,2,2,2,2,4,1,2,8],
241
> [2,2,2,2,2,2,1,2,2],[2,2,2,9,2,2,5,6,2]],[7],[1,5]);
242
< deterministic automaton on 4 letters with 9 states >
243
gap> ca:=ClassAutomaton(xa);
244
< deterministic automaton on 4 letters with 9 states >
245
gap> Display(ca);
246
| 1 2 3 4 5 6 7 8 9
247
--------------------------------
248
a | 1 2 1 3 2 2 6 6 3
249
b | 3 2 3 3 4 3 6 9 3
250
c | 9 2 9 4 6 6 4 9 9
251
d | 8 2 8 7 5 5 7 8 8
252
Initial state: [ 1 ]
253
Accepting state: [ 1 ]
254
gap> IsPossibleGraphAut(ca);
255
true
256
gap> ]]></Example>
257
</Description>
258
</ManSection>
259
260
261
262
263
<ManSection>
264
<Func Name="BoundedClassAutomaton" Arg="k"/>
265
<Returns>An automaton that accepts all rank encoded permutations, with highest rank being <C>k</C>.</Returns>
266
<Description>
267
The bounded class automaton, is an automaton that accepts all rank encoded permutations, of any length, with
268
highest rank <C>k</C>.
269
<Example><![CDATA[
270
gap> BoundedClassAutomaton(3);
271
< deterministic automaton on 3 letters with 3 states >
272
gap> Display(last);
273
| 1 2 3
274
--------------
275
a | 1 1 2
276
b | 2 2 2
277
c | 3 3 3
278
Initial state: [ 1 ]
279
Accepting state: [ 1 ]
280
gap> ]]></Example>
281
</Description>
282
</ManSection>
283
284
285
286
287
288
<ManSection>
289
<Func Name="ClassAutFromBaseEncoding" Arg="base,k"/>
290
<Returns>The class automaton from a list of rank encoded basis permutations.</Returns>
291
<Description>
292
Given the permutations in the basis, in their rank encoded form, and the bound of the rank
293
of the permutations of the class, <C>ClassAutFromBaseEncoding</C> builds the automaton that
294
accepts rank encoded permutations of the class.
295
<Example><![CDATA[
296
gap> ClassAutFromBaseEncoding([[4,1,1,1]],4);
297
< deterministic automaton on 4 letters with 7 states >
298
gap> Display(last);
299
| 1 2 3 4 5 6 7
300
--------------------------
301
a | 1 2 1 3 2 2 6
302
b | 3 2 3 3 4 3 4
303
c | 4 2 4 4 6 6 4
304
d | 7 2 7 7 5 5 7
305
Initial state: [ 1 ]
306
Accepting state: [ 1 ]
307
gap> ]]></Example>
308
</Description>
309
</ManSection>
310
311
<ManSection>
312
<Func Name="ClassAutFromBase" Arg="perms,k"/>
313
<Returns>The class automaton from a list of permutations of the basis.</Returns>
314
<Description>
315
Taking <C>perms</C> which is the list of permutations in the basis and <C>k</C> an
316
integer which indicates the highest rank in the encoded permutations of the class,
317
<C>ClassAutFromBase</C> constructs the automaton that accepts the language
318
of rank encoded permutations of the class.
319
320
<!-- Given the permutations of the basis and the highest rank of the encoded permutations
321
of the class, <C>ClassAutFromBase</C> constructs the automaton that accepts the language
322
of rank encoded permutations of the class. -->
323
<Example><![CDATA[
324
gap> ClassAutFromBase([[4,1,2,3]],4);
325
< deterministic automaton on 4 letters with 7 states >
326
gap> Display(last);
327
| 1 2 3 4 5 6 7
328
--------------------------
329
a | 1 2 1 3 2 2 6
330
b | 3 2 3 3 4 3 4
331
c | 4 2 4 4 6 6 4
332
d | 7 2 7 7 5 5 7
333
Initial state: [ 1 ]
334
Accepting state: [ 1 ]
335
gap> ]]></Example>
336
</Description>
337
</ManSection>
338
339
340
341
342
<ManSection>
343
<Func Name="ExpandAlphabet" Arg="a,newAlphabet"/>
344
<Returns>The automaton <C>a</C>, over the alphabet of size <C>newAlphabet</C>.</Returns>
345
<Description>
346
Given an automaton and the size of the new alphabet, which has to be bigger than the size of
347
the alphabet in <C>a</C> , <C>ExpandAlphabet</C> changes the automaton <C>a</C> to contain
348
an alphabet of size <C>newAlphabet</C>. The new letters have no transitions within the
349
automaton.
350
<Example><![CDATA[
351
gap> aut:=Automaton("det",3,2,[[2,2,3],[3,3,3]],[1],[3]);
352
< deterministic automaton on 2 letters with 3 states >
353
gap> Display(aut);
354
| 1 2 3
355
--------------
356
a | 2 2 3
357
b | 3 3 3
358
Initial state: [ 1 ]
359
Accepting state: [ 3 ]
360
gap> ExpandAlphabet(aut,4);
361
< deterministic automaton on 4 letters with 3 states >
362
gap> Display(last);
363
| 1 2 3
364
--------------
365
a | 2 2 3
366
b | 3 3 3
367
c |
368
d |
369
Initial state: [ 1 ]
370
Accepting state: [ 3 ]
371
gap> ]]></Example>
372
</Description>
373
</ManSection>
374
375
376
377
</Section>
378
379
380
381
<Section><Heading>Direct Sum of Regular Classes</Heading>
382
383
It is obvious that the direct sum of two rational pattern classes is also rational. But the skew sum of two rational
384
pattern classes does not imply that the resulting pattern class is rational, because if the second class in the
385
sum has infinitely many permutations, the alphabet of the skew sum class will be infinite and thusly the resulting
386
class will not be rational.
387
388
<ManSection>
389
<Func Name="ClassDirectSum" Arg="aut1,aut2"/>
390
<Returns>An automaton that corresponds to the direct sum of <C>aut1</C> with <C>aut2</C>.</Returns>
391
<Description>
392
<C>ClassDirectSum</C> builds the concatenation automaton of <C>aut1</C> with <C>aut2</C>, which corresponds
393
to the pattern class <C>aut1</C> <M>\oplus</M> <C>aut2</C>.
394
<!-- EXAMPLE !!!!!!!! -->
395
<Example><![CDATA[
396
gap> a:=BasisAutomaton(GraphToAut(Parstacks(2,2),1,6));
397
< deterministic automaton on 4 letters with 9 states >
398
gap> AutToRatExp(a);
399
d(a(dbdb)*aaU@)UbUc
400
gap> b:=MinimalAutomaton(GraphToAut(Seqstacks(2,2),1,6));
401
< deterministic automaton on 3 letters with 3 states >
402
gap> AutToRatExp(b);
403
((cc*(aUb)Ub)(cc*(aUb)Ub)*aUa)*
404
gap> ab:=ClassDirectSum(a,b);
405
< deterministic automaton on 4 letters with 11 states >
406
gap> AutToRatExp(ab);
407
((d(acUc)c*(aUb)Ud(abUb))(cc*(aUb)Ub)*aUda(d(bdbd)*bdbaaUa)UbUc)((cc*(aUb)U\
408
b)(cc*(aUb)Ub)*aUa)*Ud(aU@)
409
gap> ]]></Example>
410
</Description>
411
</ManSection>
412
413
414
415
</Section>
416
417
418
419
420
421
<Section><Heading>Statistical Inspections</Heading>
422
It is of interest to see what permutations and how many of different length are accepted by the class,
423
respectively the basis. <P/>
424
In this section, the examples will be inspecting the basis automaton of the token passing network
425
containing 2 stacks of capacity 2, which are situated in parallel to each other.
426
<Example><![CDATA[
427
gap> x:=Parstacks(2,2);
428
[ [ 2, 4 ], [ 3, 6 ], [ 2 ], [ 5, 6 ], [ 4 ], [ ] ]
429
gap> xa:=GraphToAut(x,1,6);
430
< epsilon automaton on 5 letters with 66 states >
431
gap> ma:=MinimalAutomaton(xa);
432
< deterministic automaton on 4 letters with 9 states >
433
gap> ba:=BasisAutomaton(ma);
434
< deterministic automaton on 4 letters with 9 states >
435
gap> AutToRatExp(ba);
436
d(a(dbdb)*aaU@)UbUc
437
gap> ]]></Example>
438
439
440
441
<ManSection>
442
<Func Name="Spectrum" Arg="aut [, int]"/>
443
<Returns>A list indicating how many words of each length from 1 to
444
<C>int</C> or 15 (default) are accepted by the automaton.</Returns>
445
<Description>
446
Each entry in the returned list indicates how many words of length the index of the entry
447
are accepted by the automaton <C>aut</C>. The length of the list is
448
by default 15, but if this is too much or too little the second optional argument
449
regulates the length of the list.
450
<Example><![CDATA[
451
gap> Spectrum(ba);
452
[ 3, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 ]
453
gap> Spectrum(ba,20);
454
[ 3, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 ]
455
gap> ]]></Example>
456
</Description>
457
</ManSection>
458
459
460
461
462
<ManSection>
463
<Func Name="NumberAcceptedWords" Arg="aut,len"/>
464
<Returns>The number of words of length <C>len</C> accepted by the automaton <C>aut</C>.</Returns>
465
<Description>
466
Given the automaton <C>aut</C> and the integer <C>len</C>, <C>NumberAcceptedWords</C> determines
467
how many words of length <C>len</C> are accepted by the automaton.
468
<Example><![CDATA[
469
gap> NumberAcceptedWords(ba,1);
470
3
471
gap> NumberAcceptedWords(ba,16);
472
1
473
gap> ]]></Example>
474
</Description>
475
</ManSection>
476
477
478
479
480
<ManSection>
481
<Func Name="AutStateTransitionMatrix" Arg="aut"/>
482
<Returns>A matrix containing the number of transitions between states of the automaton <C>aut</C>.</Returns>
483
<Description>
484
In the matrix computed by <C>AutStateTransitionMatrix</C> the rows are indexed by the state the transitions
485
are originating from, the columnns are indexed by the states the transitions are ending at. Each entry
486
<M>a_{i,j}</M> of the matrix represents the number of transitions from the state <M>i</M> to the state <M>j</M>.
487
<Example><![CDATA[
488
gap> AutStateTransitionMatrix(ba);
489
[ [ 0, 4, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 4, 0, 0, 0, 0, 0, 0, 0 ],
490
[ 1, 3, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 2, 1, 0, 0, 0, 0, 0, 1 ],
491
[ 0, 3, 0, 1, 0, 0, 0, 0, 0 ], [ 0, 3, 0, 1, 0, 0, 0, 0, 0 ],
492
[ 2, 1, 0, 0, 1, 0, 0, 0, 0 ], [ 0, 3, 0, 0, 0, 1, 0, 0, 0 ],
493
[ 0, 3, 0, 0, 0, 0, 0, 1, 0 ] ]
494
gap> ]]></Example>
495
</Description>
496
</ManSection>
497
498
499
500
501
<ManSection>
502
<Func Name="AcceptedWords" Arg="aut,int"/>
503
<Returns>All words of length <C>int</C> that are accepted by the automaton <C>aut</C>.</Returns>
504
<Description>
505
<C>AcceptedWords</C> outputs all permutations accepted by the automaton <C>aut</C>, which have length
506
<C>int</C>, in a list. The permutations are output in their rank encoding.
507
<Example><![CDATA[
508
gap> AcceptedWords(ba,1);
509
[ [ 2 ], [ 3 ], [ 4 ] ]
510
gap> AcceptedWords(ba,16);
511
[ [ 4, 1, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 1, 1 ] ]
512
gap> ]]></Example>
513
</Description>
514
</ManSection>
515
516
517
518
519
<ManSection>
520
<Func Name="AcceptedWordsR" Arg="aut,int1 [,int2]"/>
521
<Func Name="AcceptedWordsReversed" Arg="aut,int1 [,int2]"/>
522
<Returns>The list of all by the automaton accepted words of length <C>int1</C>,
523
where each word is written in reverse.</Returns>
524
<Description>
525
The functions <C>AcceptedWordsR</C> and <C>AcceptedWordsReversed</C> are synonymous and take the following
526
arguments; an automaton <C>aut</C>, an integer <C>int1</C> which indicates the length of the words that are
527
accepted by the <C>aut</C> and another integer <C>int2</C> which is optional and represents the initial state
528
of <C>aut</C>. The return value of these functions is the list containing all permutations of length <C>int1</C>
529
that are accepted by <C>aut</C>. The permutations are rank encoded and written in reverse.
530
<Example><![CDATA[
531
gap> AcceptedWordsR(ba,1);
532
[ [ 2 ], [ 3 ], [ 4 ] ]
533
gap> AcceptedWordsReversed(ba,16);
534
[ [ 1, 1, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 1, 4 ] ]
535
gap> ]]></Example>
536
</Description>
537
</ManSection>
538
539
540
</Section>
541
542
</Chapter>
543