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> Regular Languages of Sets of Permutations </Heading>
2
3
This chapter is dedicated to the different sets of permutations with the same properties.
4
5
<Section><Heading> Inversions in Permutations </Heading>
6
An inversion in a permutation <M>\tau=\tau_{1}\ldots\tau_{n}</M> is a pair <M>(i,j)</M> such that <M>1\leq i&lt;j\leq n</M> and
7
<M>\tau_{i}&gt;\tau_{j}</M> <Cite Key="UpBndStanWilf1324"/>.
8
<ManSection>
9
<Func Name="InversionAut" Arg="k"/>
10
<Returns>An automaton that accepts all permutations with exactly <C>k</C> inversions.</Returns>
11
<Description>
12
The rational language of all permutations with a given number , <C>k</C>, of inversions is computed by <C>InversionAut</C>.
13
<Example><![CDATA[
14
gap> a:=InversionAut(1);
15
< deterministic automaton on 2 letters with 4 states >
16
gap> AutToRatExp(a);
17
a*baa*
18
gap> Spectrum(a);
19
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ]
20
gap> b:=InversionAut(5);
21
< deterministic automaton on 6 letters with 14 states >
22
gap> AutToRatExp(b);
23
((a*ba*bUa*c)a*bUa*ba*cUa*d)a*(ba*baa*Ucaaa*)U(a*ba*bUa*c)a*(ca*baa*Udaaaa*)U(\
24
a*ba*daUa*eaa)a*baa*Ua*ba*(dbUeaa)aaa*U(a*eabUa*(ebUfaa)a)aaa*
25
gap> Spectrum(b);
26
[ 0, 0, 0, 3, 22, 71, 169, 343, 628, 1068, 1717, 2640, 3914, 5629, 7889 ]
27
gap> ]]></Example>
28
29
</Description>
30
</ManSection>
31
32
33
<ManSection>
34
<Func Name="InversionAutOfClass" Arg="aut,inv"/>
35
<Returns>An automaton accepting all permutations of a class with <C>inv</C> inversions.</Returns>
36
<Description>
37
<C>InversionAutOfClass</C> intersects the rational pattern class with the rational language containing all permutations
38
under the rank encoding that have exactly <C>inv</C> inversions.
39
<Example><![CDATA[
40
gap> a:=MinimalAutomaton(GraphToAut(Seqstacks(2,2),1,6));
41
< deterministic automaton on 3 letters with 3 states >
42
gap> Spectrum(a);
43
[ 1, 2, 6, 18, 54, 162, 486, 1458, 4374, 13122, 39366, 118098, 354294,
44
1062882, 3188646 ]
45
gap> b:=InversionAutOfClass(a,4);
46
< deterministic automaton on 5 letters with 23 states >
47
gap> Spectrum(b);
48
[ 0, 0, 0, 3, 13, 35, 75, 140, 238, 378, 570, 825, 1155, 1573, 2093 ]
49
gap> ]]></Example>
50
51
</Description>
52
</ManSection>
53
</Section>
54
55
56
57
58
<Section> <Heading> Plus- and Minus-(In)Decomposablilty </Heading>
59
60
<ManSection>
61
<Func Name="PlusDecomposableAut" Arg="aut"/>
62
<Returns>An automaton that accepts the subset of the class <C>aut</C> containing the
63
plus-decomposable permutations of <C>aut</C>.</Returns>
64
<Description>
65
The <C>PlusDecomposableAut</C> automaton accepts the language of all
66
plus-decomposable permutations of the encoded class accepted by <C>aut</C>.
67
<!-- EXAMPLE !!!!!!!! -->
68
<Example><![CDATA[
69
gap> xa:=MinimalAutomaton(GraphToAut(Parstacks(2,2),1,6));
70
< deterministic automaton on 4 letters with 9 states >
71
gap> Spectrum(xa);
72
[ 1, 2, 6, 23, 89, 345, 1338, 5189, 20122, 78024, 302529, 1172993, 4547973,
73
17633432, 68368135 ]
74
gap> a:=PlusDecomposableAut(xa);
75
< deterministic automaton on 4 letters with 16 states >
76
gap> Spectrum(a);
77
[ 0, 1, 3, 11, 47, 196, 808, 3306, 13433, 54265, 218145, 873303, 3483654,
78
13853682, 54945158 ]
79
gap> ]]></Example>
80
81
</Description>
82
</ManSection>
83
84
<ManSection>
85
<Func Name="PlusIndecomposableAut" Arg="aut"/>
86
<Returns>An automaton that accepts all permutations of <C>aut</C> that are not
87
plus-decomposable.</Returns>
88
<Description>
89
The <C>PlusIndecomposableAutomaton</C> automaton accepts the language of all
90
plus-indecomposable permutations of the encoded class accepted by aut, by rejecting
91
every rank encoding that in the original automaton would have entered and left
92
the accept state before the last letter in the rank encodedpermutation.
93
<!-- EXAMPLE !!!!!!!! -->
94
<Example><![CDATA[
95
gap> xa:=MinimalAutomaton(GraphToAut(Parstacks(2,2),1,6));
96
< deterministic automaton on 4 letters with 9 states >
97
gap> Spectrum(xa);
98
[ 1, 2, 6, 23, 89, 345, 1338, 5189, 20122, 78024, 302529, 1172993, 4547973,
99
17633432, 68368135 ]
100
gap> a:=PlusIndecomposableAut(xa);
101
< deterministic automaton on 4 letters with 11 states >
102
gap> Spectrum(a);
103
[ 1, 1, 3, 12, 42, 149, 530, 1883, 6689, 23759, 84384, 299690, 1064319,
104
3779750, 13422977 ]
105
gap> ]]></Example>
106
107
</Description>
108
</ManSection>
109
110
111
<ManSection>
112
<Func Name="MinusDecomposableAut" Arg="aut"/>
113
<Returns>An automaton that accepts the subset of the class <C>aut</C> containing the
114
minus-decomposable permutations of <C>aut</C>.</Returns>
115
<Description>
116
The <C>MinusDecomposableAut</C> automaton accepts the language of all
117
minus-decomposable permutations of the rank encoded class accepted by <C>aut</C>.
118
<!-- EXAMPLE !!!!!!!! -->
119
<Example><![CDATA[
120
gap> xa:=MinimalAutomaton(GraphToAut(Parstacks(2,2),1,6));
121
< deterministic automaton on 4 letters with 9 states >
122
gap> Spectrum(xa);
123
[ 1, 2, 6, 23, 89, 345, 1338, 5189, 20122, 78024, 302529, 1172993, 4547973,
124
17633432, 68368135 ]
125
gap> a:=MinusDecomposableAut(xa);
126
< deterministic automaton on 4 letters with 12 states >
127
gap> Spectrum(a);
128
[ 0, 1, 3, 10, 24, 64, 180, 520, 1524, 4504, 13380, 39880, 119124, 356344,
129
1066980 ]
130
gap> ]]></Example>
131
132
</Description>
133
</ManSection>
134
135
<ManSection>
136
<Func Name="MinusIndecomposableAut" Arg="aut"/>
137
<Returns>An automaton that accepts all permutations of <C>aut</C> that are not
138
minus-decomposable.</Returns>
139
<Description>
140
The <C>MinusIndecomposableAut</C> automaton accepts the language of all
141
minus-indecomposable permutations of the encoded class accepted by aut,
142
which is the complement set of the set of minus-decomposable permutations
143
within the class.
144
<!-- EXAMPLE !!!!!!!! -->
145
<Example><![CDATA[
146
gap> xa:=MinimalAutomaton(GraphToAut(Parstacks(2,2),1,6));
147
< deterministic automaton on 4 letters with 9 states >
148
gap> Spectrum(xa);
149
[ 1, 2, 6, 23, 89, 345, 1338, 5189, 20122, 78024, 302529, 1172993, 4547973,
150
17633432, 68368135 ]
151
gap> a:=MinusIndecomposableAut(xa);
152
< deterministic automaton on 4 letters with 17 states >
153
gap> Spectrum(a);
154
[ 1, 1, 3, 13, 65, 281, 1158, 4669, 18598, 73520, 289149, 1133113, 4428849,
155
17277088, 67301155 ]
156
gap> ]]></Example>
157
158
</Description>
159
</ManSection>
160
161
</Section>
162
163
164
<Section> <Heading> Language of all non-simple permutations </Heading>
165
The regular language of all non-simple rank encoded permutations with highest rank <M>k</M> is
166
described by the following equation,
167
<Display Mode="M">
168
E(NS_{k}) = E(\Omega_{k})
169
\cap ( \bigcup_{l=1}^{k-1} P_{l} \bigcup_{m=l}^{k-1} E(\hat{\Omega}_{k-m})^{+m}
170
\cup
171
\bigcup_{j=1}^{k-1} E(\hat{\Omega}_{k-j})^{+j}
172
\cup
173
</Display>
174
<Display Mode="M">
175
\cup
176
\bigcup_{a=2}^{k-1} \bigcup_{b=0}^{k-1-a} Q_{a,b} \bigcup_{i=0}^{a-2} (E(\hat{\Omega}_{k-(b+i)})^{+b+i})^{(a-i)} ) \Sigma^{*}
177
\cup
178
E(\mathcal{D}_{P}(\Omega_{k}))
179
</Display>
180
where
181
<M>\Sigma</M> is the alphabet <M>\{1,\ldots,k\}</M>, <M>k\in\mathbb{N}</M>, <M>k \geq 3</M>.<P/>
182
<M>P_{l}</M> is the language of prefixes of rank encoded permutations, where the prefix ends with the total sum of gap sizes to be equal to <M>l</M>. <P/>
183
<M>Q_{i,j}</M> is the language of prefixes of rank encoded permutations, where the prefix ends with a gap of size <M>i</M> and the sum of the sizes of gaps below equals to <M>j</M>. <P/>
184
<M>E(\Omega_{k-i})^{+i}</M> is the language of <M>E(\Omega_{k-i})</M> <M>i \in \mathbb{N}</M>, with the alphabet shifted upwards by <M>i</M>.<P/>
185
<M>E(\Omega_{k})^{(i)}</M> is the sublanguage of <M>E(\Omega_{k})</M> containing the words of length <M>\leq i</M>, <M>i \in \mathbb{N}</M>.<P/>
186
<M>E(\hat{\Omega}_{k})</M> is the sublanguage of <M>E(\Omega_{k})</M> excluding the words of length <M>\leq 1</M>.<P/>
187
<M>E(\mathcal{D}_{P}(\Omega_{k}))</M> is the language of all plus-decomposable permutations as described in <Cite Key="RegLangPlusMinPerms"/>.
188
189
190
<ManSection>
191
<Func Name="LengthBoundAut" Arg="aut,min,i,k"/>
192
<Returns>The subautomaton of <C>aut</C> that accepts words between (and including) the lengths <C>min</C> and <C>i</C>.</Returns>
193
<Description>
194
We are taking the automaton <C>aut</C> and it's alphabet <C>k</C>, and find the automaton that accepts all words of <C>aut</C> of length between (and including) <C>min</C> and <C>i</C>.
195
<Example><![CDATA[
196
gap> a:=BoundedClassAutomaton(4);
197
< deterministic automaton on 4 letters with 4 states >
198
gap> Spectrum(a);
199
[ 1, 2, 6, 24, 96, 384, 1536, 6144, 24576, 98304, 393216, 1572864, 6291456,
200
25165824, 100663296 ]
201
gap> LengthBoundAut(a,4,8,4);
202
< deterministic automaton on 4 letters with 22 states >
203
gap> Spectrum(last);
204
[ 0, 0, 0, 24, 96, 384, 1536, 6144, 0, 0, 0, 0, 0, 0, 0 ]
205
gap> ]]></Example>
206
</Description>
207
</ManSection>
208
209
210
<ManSection>
211
<Func Name="ShiftAut" Arg="i,k"/>
212
<Returns>The automaton <M>\Omega_{k-i}^{+i}</M>.</Returns>
213
<Description>
214
We are shifting the alphabet of <M>\Omega_{k-i}</M> in their values by <M>i</M> to expand to the alphabet <M>\{1,\ldots,k\}</M>, but keeping the automaton structure of <M>\Omega_{k-i}</M>.
215
<Example><![CDATA[
216
gap> ShiftAut(2,4);
217
< non deterministic automaton on 4 letters with 4 states >
218
gap> Display(last);
219
| 1 2 3 4
220
-----------------------------------
221
a |
222
b |
223
c | [ 2 ] [ 4 ] [ 4 ] [ 4 ]
224
d | [ 3 ] [ 3 ] [ 3 ] [ 3 ]
225
Initial state: [ 1 ]
226
Accepting state: [ 4 ]
227
gap> ShiftAut(1,4);
228
< non deterministic automaton on 4 letters with 5 states >
229
gap> Display(last);
230
| 1 2 3 4 5
231
-------------------------------------------
232
a |
233
b | [ 2 ] [ 5 ] [ 5 ] [ 3 ] [ 5 ]
234
c | [ 3 ] [ 3 ] [ 3 ] [ 3 ] [ 3 ]
235
d | [ 4 ] [ 4 ] [ 4 ] [ 4 ] [ 4 ]
236
Initial state: [ 1 ]
237
Accepting state: [ 5 ]
238
gap> ]]></Example>
239
</Description>
240
</ManSection>
241
242
<ManSection>
243
<Func Name="NextGap" Arg="gap,rank"/>
244
<Returns>A list of gap sizes.</Returns>
245
<Description>
246
Knowing the current available gap sizes <C>gap</C>, which are the number of available spaces in a permutation plot. These gaps are separated by blocks where there are already points inserted. We determine where the next point (known to us as its <C>rank</C>) is being placed and what the next gap sizes are.
247
<Example><![CDATA[
248
gap> NextGap([1,1],2);
249
[ 1 ]
250
gap> NextGap([1],3);
251
[ 1, 1 ]
252
gap> NextGap([2,1],4);
253
[ 2, 1 ]
254
gap> ]]></Example>
255
</Description>
256
</ManSection>
257
258
259
260
261
<ManSection>
262
<Func Name="GapAut" Arg="k"/>
263
<Returns>The non-deterministic automaton accepting the rank encoded language of <M>\Omega_{k}</M> and the list of all possible gap sizes.</Returns>
264
<Description>
265
The automaton accepts the rank encoded permutations of <M>\Omega_{k}</M>, but the automaton is slightly extended through having each state corresponding to a gap size and the start state being the emptyset of gap sizes. The transitions of the automaton are determined through the knowledge of the available spaces and the rank. This is calculated in <C>NextGap</C>.
266
Please note that the index of the gap sizes in the list corresponds to the state of the automaton.
267
<Example><![CDATA[
268
gap> GapAut(3);
269
[ < non deterministic automaton on 3 letters with 5 states >,
270
[ [ ], [ 0 ], [ 1 ], [ 2 ], [ 1, 1 ] ] ]
271
gap> Display(last[1]);
272
| 1 2 3 4 5
273
-------------------------------------------
274
a | [ 2 ] [ 2 ] [ 2 ] [ 3 ] [ 3 ]
275
b | [ 3 ] [ 3 ] [ 3 ] [ 3 ] [ 3 ]
276
c | [ 4 ] [ 4 ] [ 5 ] [ 4 ] [ 5 ]
277
Initial state: [ 1 ]
278
Accepting states: [ 1, 2 ]
279
gap> ]]></Example>
280
</Description>
281
</ManSection>
282
283
284
<ManSection>
285
<Func Name="SumAut" Arg="sum,k"/>
286
<Returns>The automaton accepting the language <M>P_{sum}</M>.</Returns>
287
<Description>
288
This automaton is based on the <C>GapAut</C> where the accept states are chosen by their gap sizes, namely if the total sum of gap sizes equal to <C>sum</C>.
289
290
<Example><![CDATA[
291
gap> SumAut(2,3);
292
< non deterministic automaton on 3 letters with 5 states >
293
gap> Display(last);
294
| 1 2 3 4 5
295
-------------------------------------------
296
a | [ 2 ] [ 2 ] [ 2 ] [ 3 ] [ 3 ]
297
b | [ 3 ] [ 3 ] [ 3 ] [ 3 ] [ 3 ]
298
c | [ 4 ] [ 4 ] [ 5 ] [ 4 ] [ 5 ]
299
Initial state: [ 1 ]
300
Accepting states: [ 4, 5 ]
301
gap> ]]></Example>
302
</Description>
303
</ManSection>
304
305
306
<ManSection>
307
<Func Name="GapSumAut" Arg="gap,sum,k"/>
308
<Returns>The automaton accepting the language <M>Q_{gap,sum}</M>.</Returns>
309
<Description>
310
This automaton is based on the <C>GapAut</C> where the accept states are chosen by their gap sizes, namely if there is a gap size <C>gap</C> and the gap sizes before have a total sum of <C>sum</C>.
311
312
<Example><![CDATA[
313
gap> GapSumAut(1,0,3);
314
< non deterministic automaton on 3 letters with 5 states >
315
gap> Display(last);
316
| 1 2 3 4 5
317
-------------------------------------------
318
a | [ 2 ] [ 2 ] [ 2 ] [ 3 ] [ 3 ]
319
b | [ 3 ] [ 3 ] [ 3 ] [ 3 ] [ 3 ]
320
c | [ 4 ] [ 4 ] [ 5 ] [ 4 ] [ 5 ]
321
Initial state: [ 1 ]
322
Accepting states: [ 3, 5 ]
323
gap> ]]></Example>
324
</Description>
325
</ManSection>
326
327
328
<ManSection>
329
<Func Name="NonSimpleAut" Arg="k"/>
330
<Returns>The automaton accepting all rank encoded non-simple permutations with rank encoding <C>k</C>.</Returns>
331
<Description>
332
We find the language of all non-simple permutations of the set of all <M>k</M> rank encoded permutations <M>\Omega_{k}</M> using the above equation.
333
334
<Example><![CDATA[
335
gap> a:=NonSimpleAut(3);
336
< deterministic automaton on 3 letters with 9 states >
337
gap> Display(a);
338
| 1 2 3 4 5 6 7 8 9
339
--------------------------------
340
a | 1 3 1 5 3 1 6 3 3
341
b | 3 3 3 3 9 9 3 9 3
342
c | 2 2 2 2 4 4 2 7 4
343
Initial state: [ 8 ]
344
Accepting state: [ 1 ]
345
gap> ]]></Example>
346
</Description>
347
</ManSection>
348
</Section>
349
350
351
<Section> <Heading> Simplicity </Heading>
352
The set of simple permutations of a class is the complement set of the class with the non-simple permutations. We are working in the rank encoding and so in language terms our set of simple permutations <M>S_{k}</M> will be the subset of <M>\Omega_{k}</M>
353
<Display Mode="M">
354
E(S_{k}) = E(\Omega_{k}\setminus NS_{k}) = E(\Omega_{k}) \setminus E(NS_{k}) = E(\Omega_{k}) \cap E(NS_{k})^{C}
355
</Display>
356
<ManSection>
357
<Func Name="SimplePermAut" Arg="k"/>
358
<Returns>The automaton accepting all rank encoded simple permutations with highest rank encoding <C>k</C>.</Returns>
359
<Description>
360
We find the language of all simple permutations of the set of all <M>k</M> rank encoded permutations <M>\Omega_{k}</M> using the above equation.
361
362
<Example><![CDATA[
363
gap> SimplePermAut(3);
364
< deterministic automaton on 3 letters with 8 states >
365
gap> Display(last);
366
| 1 2 3 4 5 6 7 8
367
-----------------------------
368
a | 2 2 1 1 7 2 1 6
369
b | 2 2 4 2 2 4 4 2
370
c | 2 2 8 5 2 5 5 2
371
Initial state: [ 3 ]
372
Accepting states: [ 1, 3 ]
373
gap> ]]></Example>
374
</Description>
375
</ManSection>
376
</Section>
377
378
379
380
<Section><Heading>Exceptionality</Heading>
381
A permutation is said to be exceptional if it is of one of the following forms,
382
<Display Mode="M">
383
2 4 6 \ldots (2m) 1 3 5 \ldots (2m-1)
384
</Display>
385
<Display Mode="M">
386
(2m-1) (2m-3) \ldots 1 (2m) (2m-2) \ldots 2
387
</Display>
388
<Display Mode="M">
389
(m+1) 1 (m+2) 2 (m+3) 3 \ldots (2m) m
390
</Display>
391
<Display Mode="M">
392
m (2m) (m-1) (2m-1) \ldots 1 (m+1)
393
</Display>
394
where <M>m \geq 2</M> <Cite Key="SimpPermsPoset"/>.
395
396
397
<ManSection>
398
<Func Name="IsExceptionalPerm" Arg="perm"/>
399
<Returns><C>True</C> if <C>perm</C> is exceptional, <C>False</C> otherwise.</Returns>
400
<Description>
401
The functions checks whether <C>perm</C> is one of the 4 types of exceptional permutations, that are described above.
402
<Example><![CDATA[
403
gap> IsExceptionalPerm([1,2,5,3,4]);
404
false
405
gap> IsExceptionalPerm([1,1,3,1,1]);
406
false
407
gap> IsExceptionalPerm([2,4,6,1,3,5]);
408
true
409
gap> IsExceptionalPerm([2,3,4,1,1,1]);
410
true
411
gap> ]]></Example>
412
</Description>
413
</ManSection>
414
415
416
417
<ManSection>
418
<Func Name="ExceptionalBoundedAutomaton" Arg="k"/>
419
<Returns>The automaton which accepts all exceptional permutations with highest rank encoding <C>k</C>.</Returns>
420
<Description>
421
The language of <C>k</C> rank encoded exceptional permutations will be finite, and so it regular.
422
<Example><![CDATA[
423
gap> ExceptionalBoundedAutomaton(8);
424
< deterministic automaton on 8 letters with 41 states >
425
gap> Spectrum(last,20);
426
[ 0, 2, 0, 2, 0, 4, 0, 4, 0, 2, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0 ]
427
gap> ExceptionalBoundedAutomaton(5);
428
< deterministic automaton on 5 letters with 21 states >
429
gap> Spectrum(last);
430
[ 0, 2, 0, 2, 0, 4, 0, 2, 0, 0, 0, 0, 0, 0, 0 ]
431
gap> ]]></Example>
432
</Description>
433
</ManSection>
434
435
</Section>
436
</Chapter>
437
438