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
2
9 Regular Languages of Sets of Permutations
3
4
This chapter is dedicated to the different sets of permutations with the
5
same properties.
6
7
8
9.1 Inversions in Permutations
9
10
An inversion in a permutation τ=τ_1...τ_n is a pair (i,j) such that 1≤ i<j≤
11
n and τ_i>τ_j [5].
12
13
9.1-1 InversionAut
14
15
InversionAut( k )  function
16
Returns: An automaton that accepts all permutations with exactly k
17
inversions.
18
19
The rational language of all permutations with a given number , k, of
20
inversions is computed by InversionAut.
21
22
 Example 
23
gap> a:=InversionAut(1);
24
< deterministic automaton on 2 letters with 4 states >
25
gap> AutToRatExp(a);
26
a*baa*
27
gap> Spectrum(a); 
28
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 ]
29
gap> b:=InversionAut(5);
30
< deterministic automaton on 6 letters with 14 states >
31
gap> AutToRatExp(b);
32
((a*ba*bUa*c)a*bUa*ba*cUa*d)a*(ba*baa*Ucaaa*)U(a*ba*bUa*c)a*(ca*baa*Udaaaa*)U(\
33
a*ba*daUa*eaa)a*baa*Ua*ba*(dbUeaa)aaa*U(a*eabUa*(ebUfaa)a)aaa*
34
gap> Spectrum(b); 
35
[ 0, 0, 0, 3, 22, 71, 169, 343, 628, 1068, 1717, 2640, 3914, 5629, 7889 ]
36
gap> 
37

38
39
9.1-2 InversionAutOfClass
40
41
InversionAutOfClass( aut, inv )  function
42
Returns: An automaton accepting all permutations of a class with inv
43
inversions.
44
45
InversionAutOfClass intersects the rational pattern class with the rational
46
language containing all permutations under the rank encoding that have
47
exactly inv inversions.
48
49
 Example 
50
gap> a:=MinimalAutomaton(GraphToAut(Seqstacks(2,2),1,6));
51
< deterministic automaton on 3 letters with 3 states >
52
gap> Spectrum(a); 
53
[ 1, 2, 6, 18, 54, 162, 486, 1458, 4374, 13122, 39366, 118098, 354294, 
54
 1062882, 3188646 ]
55
gap> b:=InversionAutOfClass(a,4); 
56
< deterministic automaton on 5 letters with 23 states >
57
gap> Spectrum(b); 
58
[ 0, 0, 0, 3, 13, 35, 75, 140, 238, 378, 570, 825, 1155, 1573, 2093 ]
59
gap> 
60

61
62
63
9.2 Plus- and Minus-(In)Decomposablilty
64
65
9.2-1 PlusDecomposableAut
66
67
PlusDecomposableAut( aut )  function
68
Returns: An automaton that accepts the subset of the class aut containing
69
the plus-decomposable permutations of aut.
70
71
The PlusDecomposableAut automaton accepts the language of all
72
plus-decomposable permutations of the encoded class accepted by aut.
73
74
 Example 
75
gap> xa:=MinimalAutomaton(GraphToAut(Parstacks(2,2),1,6));
76
< deterministic automaton on 4 letters with 9 states >
77
gap> Spectrum(xa);
78
[ 1, 2, 6, 23, 89, 345, 1338, 5189, 20122, 78024, 302529, 1172993, 4547973, 
79
 17633432, 68368135 ]
80
gap> a:=PlusDecomposableAut(xa);
81
< deterministic automaton on 4 letters with 16 states >
82
gap> Spectrum(a);
83
[ 0, 1, 3, 11, 47, 196, 808, 3306, 13433, 54265, 218145, 873303, 3483654, 
84
 13853682, 54945158 ]
85
gap> 
86

87
88
9.2-2 PlusIndecomposableAut
89
90
PlusIndecomposableAut( aut )  function
91
Returns: An automaton that accepts all permutations of aut that are not
92
plus-decomposable.
93
94
The PlusIndecomposableAutomaton automaton accepts the language of all
95
plus-indecomposable permutations of the encoded class accepted by aut, by
96
rejecting every rank encoding that in the original automaton would have
97
entered and left the accept state before the last letter in the rank
98
encodedpermutation.
99
100
 Example 
101
gap> xa:=MinimalAutomaton(GraphToAut(Parstacks(2,2),1,6));
102
< deterministic automaton on 4 letters with 9 states >
103
gap> Spectrum(xa);
104
[ 1, 2, 6, 23, 89, 345, 1338, 5189, 20122, 78024, 302529, 1172993, 4547973, 
105
 17633432, 68368135 ]
106
gap> a:=PlusIndecomposableAut(xa);
107
< deterministic automaton on 4 letters with 11 states >
108
gap> Spectrum(a);
109
[ 1, 1, 3, 12, 42, 149, 530, 1883, 6689, 23759, 84384, 299690, 1064319, 
110
 3779750, 13422977 ]
111
gap> 
112

113
114
9.2-3 MinusDecomposableAut
115
116
MinusDecomposableAut( aut )  function
117
Returns: An automaton that accepts the subset of the class aut containing
118
the minus-decomposable permutations of aut.
119
120
The MinusDecomposableAut automaton accepts the language of all
121
minus-decomposable permutations of the rank encoded class accepted by aut.
122
123
 Example 
124
gap> xa:=MinimalAutomaton(GraphToAut(Parstacks(2,2),1,6));
125
< deterministic automaton on 4 letters with 9 states >
126
gap> Spectrum(xa);
127
[ 1, 2, 6, 23, 89, 345, 1338, 5189, 20122, 78024, 302529, 1172993, 4547973, 
128
 17633432, 68368135 ]
129
gap> a:=MinusDecomposableAut(xa); 
130
< deterministic automaton on 4 letters with 12 states >
131
gap> Spectrum(a); 
132
[ 0, 1, 3, 10, 24, 64, 180, 520, 1524, 4504, 13380, 39880, 119124, 356344, 
133
 1066980 ]
134
gap> 
135

136
137
9.2-4 MinusIndecomposableAut
138
139
MinusIndecomposableAut( aut )  function
140
Returns: An automaton that accepts all permutations of aut that are not
141
minus-decomposable.
142
143
The MinusIndecomposableAut automaton accepts the language of all
144
minus-indecomposable permutations of the encoded class accepted by aut,
145
which is the complement set of the set of minus-decomposable permutations
146
within the class.
147
148
 Example 
149
gap> xa:=MinimalAutomaton(GraphToAut(Parstacks(2,2),1,6));
150
< deterministic automaton on 4 letters with 9 states >
151
gap> Spectrum(xa);
152
[ 1, 2, 6, 23, 89, 345, 1338, 5189, 20122, 78024, 302529, 1172993, 4547973, 
153
 17633432, 68368135 ]
154
gap> a:=MinusIndecomposableAut(xa);
155
< deterministic automaton on 4 letters with 17 states >
156
gap> Spectrum(a);
157
[ 1, 1, 3, 13, 65, 281, 1158, 4669, 18598, 73520, 289149, 1133113, 4428849, 
158
 17277088, 67301155 ]
159
gap> 
160

161
162
163
9.3 Language of all non-simple permutations
164
165
The regular language of all non-simple rank encoded permutations with
166
highest rank k is described by the following equation,
167
168
169
E(NS_k) = E(Ω_k) ∩ ( ⋃_l=1^k-1 P_l ⋃_m=l^k-1 E(hatΩ_k-m)^+m ∪ ⋃_j=1^k-1 E(hatΩ_k-j)^+j ∪
170
171
172
∪ ⋃_a=2^k-1 ⋃_b=0^k-1-a Q_a,b ⋃_i=0^a-2 (E(hatΩ_k-(b+i))^+b+i)^(a-i) ) Σ^* ∪ E(mathcalD_P(Ω_k))
173
174
where Σ is the alphabet {1,...,k}, k∈N, k ≥ 3.
175
176
P_l is the language of prefixes of rank encoded permutations, where the
177
prefix ends with the total sum of gap sizes to be equal to l.
178
179
Q_i,j is the language of prefixes of rank encoded permutations, where the
180
prefix ends with a gap of size i and the sum of the sizes of gaps below
181
equals to j.
182
183
E(Ω_k-i)^+i is the language of E(Ω_k-i) i ∈ N, with the alphabet shifted
184
upwards by i.
185
186
E(Ω_k)^(i) is the sublanguage of E(Ω_k) containing the words of length ≤ i,
187
i ∈ N.
188
189
E(hatΩ_k) is the sublanguage of E(Ω_k) excluding the words of length ≤ 1.
190
191
E(mathcalD_P(Ω_k)) is the language of all plus-decomposable permutations as
192
described in [6].
193
194
9.3-1 LengthBoundAut
195
196
LengthBoundAut( aut, min, i, k )  function
197
Returns: The subautomaton of aut that accepts words between (and including)
198
the lengths min and i.
199
200
We are taking the automaton aut and it's alphabet k, and find the automaton
201
that accepts all words of aut of length between (and including) min and i.
202
203
 Example 
204
gap> a:=BoundedClassAutomaton(4); 
205
< deterministic automaton on 4 letters with 4 states >
206
gap> Spectrum(a);
207
[ 1, 2, 6, 24, 96, 384, 1536, 6144, 24576, 98304, 393216, 1572864, 6291456, 
208
 25165824, 100663296 ]
209
gap> LengthBoundAut(a,4,8,4);
210
< deterministic automaton on 4 letters with 22 states >
211
gap> Spectrum(last);
212
[ 0, 0, 0, 24, 96, 384, 1536, 6144, 0, 0, 0, 0, 0, 0, 0 ]
213
gap> 
214

215
216
9.3-2 ShiftAut
217
218
ShiftAut( i, k )  function
219
Returns: The automaton Ω_k-i^+i.
220
221
We are shifting the alphabet of Ω_k-i in their values by i to expand to the
222
alphabet {1,...,k}, but keeping the automaton structure of Ω_k-i.
223
224
 Example 
225
gap> ShiftAut(2,4);
226
< non deterministic automaton on 4 letters with 4 states >
227
gap> Display(last);
228
 | 1 2 3 4
229
-----------------------------------
230
 a | 
231
 b | 
232
 c | [ 2 ] [ 4 ] [ 4 ] [ 4 ] 
233
 d | [ 3 ] [ 3 ] [ 3 ] [ 3 ] 
234
Initial state: [ 1 ]
235
Accepting state: [ 4 ]
236
gap> ShiftAut(1,4);
237
< non deterministic automaton on 4 letters with 5 states >
238
gap> Display(last);
239
 | 1 2 3 4 5
240
-------------------------------------------
241
 a | 
242
 b | [ 2 ] [ 5 ] [ 5 ] [ 3 ] [ 5 ] 
243
 c | [ 3 ] [ 3 ] [ 3 ] [ 3 ] [ 3 ] 
244
 d | [ 4 ] [ 4 ] [ 4 ] [ 4 ] [ 4 ] 
245
Initial state: [ 1 ]
246
Accepting state: [ 5 ]
247
gap> 
248

249
250
9.3-3 NextGap
251
252
NextGap( gap, rank )  function
253
Returns: A list of gap sizes.
254
255
Knowing the current available gap sizes gap, which are the number of
256
available spaces in a permutation plot. These gaps are separated by blocks
257
where there are already points inserted. We determine where the next point
258
(known to us as its rank) is being placed and what the next gap sizes are.
259
260
 Example 
261
gap> NextGap([1,1],2);
262
[ 1 ]
263
gap> NextGap([1],3);
264
[ 1, 1 ]
265
gap> NextGap([2,1],4);
266
[ 2, 1 ]
267
gap> 
268

269
270
9.3-4 GapAut
271
272
GapAut( k )  function
273
Returns: The non-deterministic automaton accepting the rank encoded
274
language of Ω_k and the list of all possible gap sizes.
275
276
The automaton accepts the rank encoded permutations of Ω_k, but the
277
automaton is slightly extended through having each state corresponding to a
278
gap size and the start state being the emptyset of gap sizes. The
279
transitions of the automaton are determined through the knowledge of the
280
available spaces and the rank. This is calculated in NextGap. Please note
281
that the index of the gap sizes in the list corresponds to the state of the
282
automaton.
283
284
 Example 
285
gap> GapAut(3);
286
[ < non deterministic automaton on 3 letters with 5 states >, 
287
 [ [ ], [ 0 ], [ 1 ], [ 2 ], [ 1, 1 ] ] ]
288
gap> Display(last[1]);
289
 | 1 2 3 4 5
290
-------------------------------------------
291
 a | [ 2 ] [ 2 ] [ 2 ] [ 3 ] [ 3 ] 
292
 b | [ 3 ] [ 3 ] [ 3 ] [ 3 ] [ 3 ] 
293
 c | [ 4 ] [ 4 ] [ 5 ] [ 4 ] [ 5 ] 
294
Initial state: [ 1 ]
295
Accepting states: [ 1, 2 ]
296
gap>  
297

298
299
9.3-5 SumAut
300
301
SumAut( sum, k )  function
302
Returns: The automaton accepting the language P_sum.
303
304
This automaton is based on the GapAut where the accept states are chosen by
305
their gap sizes, namely if the total sum of gap sizes equal to sum.
306
307
 Example 
308
gap> SumAut(2,3);
309
< non deterministic automaton on 3 letters with 5 states >
310
gap> Display(last);
311
 | 1 2 3 4 5
312
-------------------------------------------
313
 a | [ 2 ] [ 2 ] [ 2 ] [ 3 ] [ 3 ] 
314
 b | [ 3 ] [ 3 ] [ 3 ] [ 3 ] [ 3 ] 
315
 c | [ 4 ] [ 4 ] [ 5 ] [ 4 ] [ 5 ] 
316
Initial state: [ 1 ]
317
Accepting states: [ 4, 5 ]
318
gap>  
319

320
321
9.3-6 GapSumAut
322
323
GapSumAut( gap, sum, k )  function
324
Returns: The automaton accepting the language Q_gap,sum.
325
326
This automaton is based on the GapAut where the accept states are chosen by
327
their gap sizes, namely if there is a gap size gap and the gap sizes before
328
have a total sum of sum.
329
330
 Example 
331
gap> GapSumAut(1,0,3);
332
< non deterministic automaton on 3 letters with 5 states >
333
gap> Display(last); 
334
 | 1 2 3 4 5
335
-------------------------------------------
336
 a | [ 2 ] [ 2 ] [ 2 ] [ 3 ] [ 3 ] 
337
 b | [ 3 ] [ 3 ] [ 3 ] [ 3 ] [ 3 ] 
338
 c | [ 4 ] [ 4 ] [ 5 ] [ 4 ] [ 5 ] 
339
Initial state: [ 1 ]
340
Accepting states: [ 3, 5 ]
341
gap>  
342

343
344
9.3-7 NonSimpleAut
345
346
NonSimpleAut( k )  function
347
Returns: The automaton accepting all rank encoded non-simple permutations
348
with rank encoding k.
349
350
We find the language of all non-simple permutations of the set of all k rank
351
encoded permutations Ω_k using the above equation.
352
353
 Example 
354
gap> a:=NonSimpleAut(3);
355
< deterministic automaton on 3 letters with 9 states >
356
gap> Display(a);
357
 | 1 2 3 4 5 6 7 8 9 
358
--------------------------------
359
 a | 1 3 1 5 3 1 6 3 3 
360
 b | 3 3 3 3 9 9 3 9 3 
361
 c | 2 2 2 2 4 4 2 7 4 
362
Initial state: [ 8 ]
363
Accepting state: [ 1 ]
364
gap> 
365

366
367
368
9.4 Simplicity
369
370
The set of simple permutations of a class is the complement set of the class
371
with the non-simple permutations. We are working in the rank encoding and so
372
in language terms our set of simple permutations S_k will be the subset of
373
Ω_k
374
375
376
E(S_k) = E(Ω_k∖ NS_k) = E(Ω_k) ∖ E(NS_k) = E(Ω_k) ∩ E(NS_k)^C
377
378
9.4-1 SimplePermAut
379
380
SimplePermAut( k )  function
381
Returns: The automaton accepting all rank encoded simple permutations with
382
highest rank encoding k.
383
384
We find the language of all simple permutations of the set of all k rank
385
encoded permutations Ω_k using the above equation.
386
387
 Example 
388
gap> SimplePermAut(3);
389
< deterministic automaton on 3 letters with 8 states >
390
gap> Display(last);
391
 | 1 2 3 4 5 6 7 8 
392
-----------------------------
393
 a | 2 2 1 1 7 2 1 6 
394
 b | 2 2 4 2 2 4 4 2 
395
 c | 2 2 8 5 2 5 5 2 
396
Initial state: [ 3 ]
397
Accepting states: [ 1, 3 ]
398
gap> 
399

400
401
402
9.5 Exceptionality
403
404
A permutation is said to be exceptional if it is of one of the following
405
forms,
406
407
408
2 4 6 ... (2m) 1 3 5 ... (2m-1)
409
410
411
(2m-1) (2m-3) ... 1 (2m) (2m-2) ... 2
412
413
414
(m+1) 1 (m+2) 2 (m+3) 3 ... (2m) m
415
416
417
m (2m) (m-1) (2m-1) ... 1 (m+1)
418
419
where m ≥ 2 [7].
420
421
9.5-1 IsExceptionalPerm
422
423
IsExceptionalPerm( perm )  function
424
Returns: True if perm is exceptional, False otherwise.
425
426
The functions checks whether perm is one of the 4 types of exceptional
427
permutations, that are described above.
428
429
 Example 
430
gap> IsExceptionalPerm([1,2,5,3,4]);
431
false
432
gap> IsExceptionalPerm([1,1,3,1,1]);
433
false
434
gap> IsExceptionalPerm([2,4,6,1,3,5]);
435
true
436
gap> IsExceptionalPerm([2,3,4,1,1,1]);
437
true
438
gap> 
439

440
441
9.5-2 ExceptionalBoundedAutomaton
442
443
ExceptionalBoundedAutomaton( k )  function
444
Returns: The automaton which accepts all exceptional permutations with
445
highest rank encoding k.
446
447
The language of k rank encoded exceptional permutations will be finite, and
448
so it regular.
449
450
 Example 
451
gap> ExceptionalBoundedAutomaton(8); 
452
< deterministic automaton on 8 letters with 41 states >
453
gap> Spectrum(last,20); 
454
[ 0, 2, 0, 2, 0, 4, 0, 4, 0, 2, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0 ]
455
gap> ExceptionalBoundedAutomaton(5);
456
< deterministic automaton on 5 letters with 21 states >
457
gap> Spectrum(last);
458
[ 0, 2, 0, 2, 0, 4, 0, 2, 0, 0, 0, 0, 0, 0, 0 ]
459
gap> 
460

461
462
463