Thesis for the Degree of Doctor of Philosophy

Generalized Patterns in Words and Permutations

Sergey Kitaev

Department of Mathematics

Chalmers University of Technology and Göteborg University SE-412 96 Göteborg, Sweden

Göteborg, January 2003 Generalized patterns in words and permutations Sergey Kitaev ISBN 91-628-5521-2

\begin{matrix}c \\ ◯ \end{matrix}Sergey Kitaev, 2003

Cover: ”Counting occurrences of generalized patterns”, designed and created by Toufik Mansour.

Department of Mathematics Chalmers University of Technology and Göteborg University SE-412 96 Göteborg, Sweden

Göteborg, Sweden, January 2003

Abstract

The thesis consists of the following nine papers:

I Multi-avoidance of generalized patterns. (Discrete Mathematics, to appear) Recently, Babson and Steingrímsson introduced generalized permutation patterns that allow the requirement that two adjacent letters in a pattern must be adjacent in the permutation. We investigate simultaneous avoidance of two or more 3-patterns without internal dashes, that is, where the pattern corresponds to a contiguous subword in a permutation.

II Generalized pattern avoidance with additional restrictions. (Séminaire Lotharingien de Combinatoire, to appear) We consider n-permutations that avoid the generalized pattern 1-32 and whose k rightmost letters form an increasing subword. The number of such permutations is a linear combination of Bell numbers. We find a bijection between these permutations and all partitions of an (n − 1)-element set with one subset marked that satisfy certain additional conditions. Also we find the e.g.f. for the number of permutations that avoid a generalized 3-pattern with no dashes and whose k leftmost or k rightmost letters form either an increasing or decreasing subword. Moreover, we find a bijection between n-permutations that avoid the pattern 132 and begin with the pattern 12 and increasing rooted trimmed trees with n + 1 nodes.

III Simultaneous avoidance of generalized patterns (joint work with Toufik Mansour). In [Kit1] Kitaev considered simultaneous avoidance (multiavoidance) of two or more 3-patterns with no internal dashes, that is, where the patterns correspond to contiguous subwords in a permutation. There either an explicit or a recursive formula was given for all but one case of simultaneous avoidance of more than two patterns. In this paper we find the exponential generating function for the remaining case. Also we consider permutations that avoid a pattern of the form x-yz or xy-z and begin with one of the patterns 12 … k, k(k − 1) … 1, 23 … k1, (k − 1)(k − 2) … 1k or end with one of the patterns 12 … k, k(k − 1) … 1, 1k(k − 1) … 2, k12 … (k − 1). For each of these cases we find either the ordinary or exponential generating functions or a precise formula for the number of such permutations. Besides we generalize some of the obtained results as well as some of the results given in [Kit3]: we consider permutations avoiding certain generalized 3-patterns and beginning (ending) with an arbitrary pattern having either the greatest or the least letter as its rightmost (leftmost) letter.

IV On multi-avoidance of generalized patterns (joint work with Toufik Mansour). In [Kit1] Kitaev discussed simultaneous avoidance of two 3-patterns with no internal dashes, that is, where the patterns correspond to contiguous subwords in a permutation. In three essentially different cases, the numbers of such n-permutations are 2^{n−1}, the number of involutions in S_{n}, and 2E_{n}, where E_{n} is the n-th Euler number. In this paper we give recurrence relations for the remaining three essentially different cases.

To complete the descriptions in [Kit3] and [KitMans1], we consider avoidance of a pattern of the form x-y-z (a classical 3-pattern) and beginning or ending with an increasing or decreasing pattern. Moreover, we generalize this problem: we demand that a permutation must avoid a 3-pattern, begin with a certain pattern and end with a certain pattern simultaneously. We find the number of such permutations in case of avoiding an arbitrary generalized 3-pattern and beginning and ending with increasing or decreasing patterns.

V Partially Ordered Generalized Patterns. (Discrete Mathematics, to appear) We introduce partially ordered generalized patterns (POGPs), which further generalize the generalized permutation patterns (GPs) introduced by Babson and Steingrímsson. A POGP p is a GP some of whose letters are incomparable. Thus, in an occurrence of p in a permutation π, two letters that are incomparable in p pose no restrictions on the corresponding letters in π. We describe many relations between POGPs and GPs and give general theorems about the number of permutations avoiding certain classes of POGPs. These theorems have several known results as corollaries but also give many new results. We also give the generating function for the entire distribution of the maximum number of non-overlapping occurrences of a pattern p with no dashes, provided we know the e.g.f. for the number of permutations that avoid p.

VI Partially ordered generalized patterns and k-ary words (joint work with Toufik Mansour). We study the generating functions (g.f.) for the number of k-ary words avoiding some POGPs. We give analogues, extend and generalize several known results, as well as get some new results. In particular, we give the g.f. for the entire distribution of the maximum number of non-overlapping occurrences of a pattern p with no dashes (that allowed to have repetition of letters), provided we know the g.f. for the number of k-ary words that avoid p.

VII Counting the occurrences of generalized patterns in words generated by a morphism (joint work with Toufik Mansour). We count the number of occurrences of certain patterns in given words. We choose these words to be the set of all finite approximations of a sequence generated by a morphism with certain restrictions. The patterns in our considerations are either classical patterns 1-2, 2-1, 1-1- ⋯ -1, or arbitrary generalized patterns without internal dashes, in which repetitions of letters are allowed. In particular, we find the number of occurrences of the patterns 1-2, 2-1, 12, 21, 123 and 1-1- ⋯ -1 in the words obtained by iterations of the morphism 1 → 123, 2 → 13, 3 → 2, which is a classical example of a morphism generating a nonrepetitive sequence.

VIII The Peano curve and counting occurrences of some patterns (joint work with Toufik Mansour). We introduce Peano words, which are words corresponding to finite approximations of the Peano space filling curve. We then find the number of occurrences of certain patterns in these words.

IX The sigma-sequence and counting occurrences of some patterns, subsequences and subwords. We consider sigma-words, which are words used by Evdokimov in the construction of the sigma-sequence [Evdok1]. We then find the number of occurrences of certain patterns, subsequences and subwords in these words.

Key words and phrases. Generalized pattern avoidance, partially ordered generalized patterns, occurrence of a pattern in a word or permutation, iterated morphism, Peano curve, sigma-sequence, Dragon curve

AMS 2000 subject classification: 05A05, 05A15, 05A18, 68R15

Acknowledgements

First of all I would like to thank my advisor Einar Steingrímsson for his knowledge, enthusiasm, generosity and sense of humour. I would like to thank him for being ready to help me at a moment’s notice with professional advice, and for making me feel very welcome during my stay in Sweden. Without doubt he is one of the greatest people I have ever met. Thank you Einar very much for everything you did for me!

I would like to thank Alexander Evdokimov for suggesting interesting unsolved problems to me, his advice, his permanent interest in my work and his encouragement and support during my student life. Also, my thanks go to Toufik Mansour for being such a great collaborator, for fruitful discussions, interesting, sometimes crazy, ideas, and for being the first person who has read this thesis.

I thank all the people at the Department of Mathematics at Chalmers University of Technology and Göteborg University, all the people at the Laboratory of Discrete Analysis at the Sobolev Institute of Mathematics and everybody who plays traditional Friday football with me for creating such a friendly atmosphere.

Special thanks to all my friends for making my life full of fun.

I would like to thank my mother, father, grandmother and grandfather (even though he is not among us anymore) for their invaluable support throughout all my life. My thanks go to the Shuiskii family, especially to Sergei Ivanovich, for interesting debates and helpful advice. Also, I would like to thank my aunt Valentina Semenova for being such a nice person.

The final acknowledgement goes to my wonderful wife Daria, for her love and inspiration. It is to her that I dedicate this thesis.

Sergey Kitaev

Göteborg, December 2002

Contents

0 Introduction 1 0.1 Permutation patterns . . . . . . . . . . . . . . . . . . . . . . . . . 1 0.2 Generalized permutation patterns . . . . . . . . . . . . . . . . . . 6 0.3 Partially ordered generalized patterns . . . . . . . . . . . . . . . 11 0.4 Counting occurrences of certain patterns in certain words …. 15

Bibliography 25

1 Paper I: Multi-avoidance of generalised patterns 33 1.1 Introduction and Background . . . . . . . . . . . . . . . . . . . . 33 1.2 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 1.3 Proofs, remarks, comments . . . . . . . . . . . . . . . . . . . . . 36

2 Paper II: Generalized pattern avoidance with additional restrictions 49 2.1 Introduction and Background . . . . . . . . . . . . . . . . . . . . 49 2.2 Set partitions and pattern avoidance . . . . . . . . . . . . . . . . 50 2.3 Increasing rooted trimmed trees and pattern avoidance . . . . . . 53 2.4 Avoiding 132 and beginning with 12 … k or k(k − 1) … 1 …. 54 2.5 Avoiding 123 and beginning with k(k − 1) … 1 or 12 … k …. 57 2.6 Avoiding 213 and beginning with k(k − 1) … 1 or 12 … k …. 58 2.7 Summarizing the results from sections 2.4, 2.5 and 2.6 . . . . . . 62

3 Paper III: Simultaneous avoidance of generalized patterns 69 3.1 Introduction and Background . . . . . . . . . . . . . . . . . . . . 69 3.2 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 3.3 Simultaneous avoidance of 123, 231 and 312 . . . . . . . . . . . . 72 3.4 Avoiding a 3-pattern with no dashes and beginning with a pattern

whose rightmost letter is the greatest or smallest . . . . . . . . . 73 3.5 Avoiding a pattern x-yz and beginning with an increasing or de-

creasing pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 3.6 Avoiding a pattern xy-z and beginning with an increasing or de-

creasing pattern . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78 3.6.1 The pattern 12-3 . . . . . . . . . . . . . . . . . . . . . . . 78 3.6.2 The pattern 13-2 . . . . . . . . . . . . . . . . . . . . . . . 79 3.6.3 The pattern 23-1 . . . . . . . . . . . . . . . . . . . . . . . 81

3.7 Avoiding a pattern xy-z and beginning with the pattern (k − 1)(k − 2) … 1k or 23 … k1 . . . . . . . . . . . . . . . . . . . . . . 82 3.7.1 Avoiding 12-3 and beginning with (k − 1)(k − 2) … 1k . . 82 3.7.2 Avoiding 13-2 and beginning with (k − 1)(k − 2) … 1k . . 83 3.7.3 Avoiding 21-3 and beginning with (k − 1)(k − 2) … 1k . . 83 3.7.4 Avoiding 23-1 and beginning with (k − 1)(k − 2) … 1k . . 84 3.7.5 Avoiding 31-2 and beginning with (k − 1)(k − 2) … 1k . . 84 3.7.6 Avoiding 32-1 and beginning with (k − 1)(k − 2) … 1k . . 85

3.8 Avoiding a pattern x-yz and beginning with the pattern (k −

1)(k − 2) … 1k or 23 … k1 . . . . . . . . . . . . . . . . . . . . . . 85 3.9 Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

4 Paper IV: On multi-avoidance of generalized patterns 95 4.1 Introduction and Background . . . . . . . . . . . . . . . . . . . . 95 4.2 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 4.3 Simultaneous avoidance of two 3-patterns with no dashes …. 97

4.3.1 Avoidance of patterns 123 and 231 simultaneously …. 97 4.3.2 Avoidance of patterns 132 and 213 simultaneously …. 98 4.3.3 Avoidance of the patterns 213 and 231 simultaneously . . 99

4.4 Avoiding a pattern x-y-z and beginning or ending with certain

patterns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 4.5 Avoiding a pattern x-y-z, beginning and ending with certain pat-

terns simultaneously . . . . . . . . . . . . . . . . . . . . . . . . . 101 4.6 Avoiding a pattern xyz, beginning and ending with certain pat-

terns simultaneously . . . . . . . . . . . . . . . . . . . . . . . . . 107 4.7 Avoiding a pattern x-yz, beginning and ending with certain pat-

terns simultaneously . . . . . . . . . . . . . . . . . . . . . . . . . 114 4.8 Avoiding a pattern xy-z, beginning and ending with certain pat-

terns simultaneously . . . . . . . . . . . . . . . . . . . . . . . . . 120 4.9 Further results . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122

5 Paper V: Partially Ordered Generalized Patterns 129 5.1 Introduction and Background . . . . . . . . . . . . . . . . . . . . 129 5.2 Definitions and Preliminaries . . . . . . . . . . . . . . . . . . . . 130 5.3 GPs with no dashes . . . . . . . . . . . . . . . . . . . . . . . . . 133 5.4 The Shuffle Patterns . . . . . . . . . . . . . . . . . . . . . . . . . 134 5.5 The Multi-Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . 138 5.6 Patterns of the Form στ . . . . . . . . . . . . . . . . . . . . . . . 141 5.7 The Distribution of Non-Overlapping GPs . . . . . . . . . . . . . 144

6 Paper VI: Partially ordered generalized patterns and k-ary words 151 6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 6.2 Definitions and Preliminaries . . . . . . . . . . . . . . . . . . . . 152 6.3 The shuffle patterns . . . . . . . . . . . . . . . . . . . . . . . . . 155 6.4 The multi-patterns . . . . . . . . . . . . . . . . . . . . . . . . . . 157 6.5 The distribution of non-overlapping generalized patterns . . . . . 159

7 Paper VII: Counting the occurrences of generalized patterns in words generated by a morphism 165 7.1 Introduction and Background . . . . . . . . . . . . . . . . . . . . 165 7.2 Patterns 1-2, 2-1 and 1-1-⋯ -1 . . . . . . . . . . . . . . . . . . . 167 7.3 Patterns without internal dashes . . . . . . . . . . . . . . . . . . 169

8 Paper VIII: The Peano curve and counting occurrences of some patterns 175 8.1 Introduction and Background . . . . . . . . . . . . . . . . . . . . 175 8.2 The Peano curve and the Peano words . . . . . . . . . . . . . . . 176 8.3 The main results . . . . . . . . . . . . . . . . . . . . . . . . . . . 177

9 Paper IX: The sigma-sequence and counting occurrences of some patterns, subsequences and subwords 187 9.1 Introduction and Background . . . . . . . . . . . . . . . . . . . . 187 9.2 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 9.3 Patterns 1-1-⋯ -1, 1-2 and 2-1 . . . . . . . . . . . . . . . . . . . 190 9.4 Patterns without internal dashes . . . . . . . . . . . . . . . . . . 192 9.5 Patterns of the form τ_{1}-τ_{2} . . . . . . . . . . . . . . . . . . . . . . 193 9.6 Counting occurrences of τ_{1}-τ_{2}-⋯ -τ_{k} . . . . . . . . . . . . . . . . 195 9.7 Patterns of the form [τ_{1}-τ_{2}-⋯ -τ_{k}], [τ_{1}-τ_{2}-⋯ -τ_{k}) and (τ_{1}-τ_{2}-⋯ -τ_{k}]197

In mathematics, if a pattern occurs, we can go on to ask, Why does it occur? What does it signify? And we can find answers to these questions. In fact, for every pattern that appears, a mathematician feels he ought to know why it appears.

– W. W. Sawyer

Introduction

In the last decade a wealth of papers has been written on the subject of pattern avoidance in permutations, also known as the study of “restricted permutations” and “permutations with forbidden subsequences.” This topic is the main focus of the present thesis (the first five papers are about this). In the sixth paper, which extends and generalizes the fifth paper, we study certain patterns in k-ary words. The last three papers are dedicated to counting occurrences of certain patterns in certain words related to sequences generated by morphisms, the Peano curve and the sigma-sequence, respectively.

0.1 Permutation patterns

We write permutations as words π = a_{1}a_{2} ⋯ a_{n}, whose letters are distinct and usually consist of the integers 1, 2, …, n.

An occurrence of a pattern τ in a permutation π is “classically” defined as a subsequence in π (of the same length as τ) whose letters are in the same relative order as those in τ. Formally speaking, for r ≤ n, we say that a permutation σ in the symmetric group S_{n} has an occurrence of the pattern τ ∈ S_{r} if there exist 1 ≤ i_{1} < i_{2} < ⋯ < i_{r} ≤ n such that τ = σ(i_{1})σ(i_{2}) … σ(i_{r}) in reduced form. The reduced form of a permutation σ on a set {j_{1}, j_{2}, …, j_{r}}, where j_{1} < j_{2} < ⋯ < j_{r}, is the permutation σ_{1} obtained by renaming the letters of the permutation σ so that j_{i} is renamed i for all i ∈ {1, …, r}. For example, the reduced form of the permutation 3651 is 2431.

We denote by S_{n}(τ) the set of all permutations in S_{n} which avoid τ, that is have no occurrences of τ. If R = {τ_{1}, τ_{2}, …, τ_{k}}, we let

S_{n}(R) = ⋂_{1≤i≤k} S_{n}(τ_{i}).

The reverse R(π) of a permutation π = a_{1}a_{2} … a_{n} is the permutation a_{n}a_{n−1} … a_{1}. The complement C(π) is the permutation b_{1}b_{2} … b_{n} where b_{i} = n + 1 − a_{i}. Also, R ∘ C is the composition of R and C. For example, R(13254) = 45231, C(13254) = 53412 and R ∘ C(13254) = 21435. We call these bijections of S_{n} to itself trivial, and it is easy to see that for any pattern τ the number |S_{n}(τ)| of permutations avoiding the pattern τ is the same as for the patterns R(τ), C(τ) and R ∘ C(τ). For example, the number of permutations that avoid the pattern 132 is the same as the number of permutations that avoid the pattern 231. This property holds for sets of patterns as well. If we apply one of the trivial bijections to all patterns of a set R, then we get a set R′ for which |S_{n}(R′)| is equal to |S_{n}(R)|. For example, the number of permutations avoiding {123, 132} equals the number of those avoiding {321, 312} because the second set is obtained from the first one by complementing each pattern.

Fundamental questions are to determine |S_{n}(R)| viewed as a function of n, and if |S_{n}(R)| = |S_{n}(R′)| to find an explicit bijection between S_{n}(R) and S_{n}(R′). It is also interesting to find relations between S_{n}(R) and other combinatorial structures. By determining |S_{n}(R)| we mean finding an explicit formula, or ordinary or exponential generating functions (g.f. and e.g.f. respectively).

In cases when one does not succeed in finding |S_{n}(R)|, there appear other questions. For example, does there exist a constant c such that |S_{n}(R)| < c^{n}? (see [Bona3]). One more example is the following question: is |S_{n}(R)| P - recursive? We recall that a function f : ℕ → ℂ is called P -recursive if there exist polynomials P_{0}, P_{1}, …, P_{k} ∈ ℂ[n], so that

P_{k}(n)f(n + k) + P_{k−1}(n)f(n + k − 1) + ⋯ + P_{0}(n)f(n) = 0

for all n ∈ ℕ (see [Bona4, NooZeil]). However, in the present thesis we only deal with the fundamental questions.

The most studied case has been to forbid a single pattern of length 3. Because of obvious symmetry arguments, namely the trivial bijections, there are only two essentially distinct cases to enumerate, |S_{n}(123)| and |S_{n}(132)|. As it happens, these two functions are equal to the nth Catalan number, C_{n} = \frac{1}{n+1} \binom{2n}{n}, which was shown by Knuth [Knuth]. The first bijection between the two cases was presented by Simion and Schmidt [SimSch], a second one was given by Richards [Rich]; West described in [West1] a construction using trees; and recently, Krattenthaler [Krat] connected the 123-avoiding and 132-avoiding permutations via Dyck paths.

While there are 24 permutation patterns of length 4, for many of them the sequences |S_{n}(τ)| are identical. In fact, there are only three different classes of patterns from this point of view [West, Stank]. The patterns 1342, 1234 and 1324 are distinct representatives of these classes. Table 1 shows the present state of research on permutations avoiding given patterns of length 4, where

(⋆) = 2 ∑_{k=0}^{n} \binom{2k}{k}\binom{n}{k}^{2} \frac{3k^{2} + 2k + 1 − n − 2kn}{(k + 1)^{2}(k + 2)(n − k + 1)} and

(⋆⋆) = \frac{7n^{2} − 3n − 2}{2} · (−1)^{n−1} + 3 ∑_{i=2}^{n} 2^{i+1} · \frac{(2i − 4)!}{i!(i − 2)!}\binom{n − i + 2}{2}(−1)^{n−i}.

The second column there corresponds to the question of existence of a constant c such that |S_{n}(τ)| < c^{n}. Stanley and Wilf conjectured that such a constant exists for any pattern τ.

For the patterns of length greater than 4, the following result by Regev [Regev] is worth mention.

Theorem 1. For all n, the number N_{n}(12 … k) of permutations in S_{n} that avoid the pattern 12 … k is asymptotically equal to

λ_{k} \frac{(k − 1)^{2n}}{n^{(k^{2}−2k)/2}} .

Here

λ_{k} = γ_{k}^{2} ∫_{x_{1}≥x_{2}} ∫_{x_{2}≥x_{3}} ⋯ ∫_{x_{k−1}≥x_{k}}[D(x_{1}, x_{2}, …, x_{k})·e^{−(k/2)x^{2}}]^{2} dx_{1}dx_{2} … dx_{k},

pattern p |S_{n}(p)| < c^{n} formula for N_{n}(p) P -recursive

1234  yes  (⋆)  yes
Regev [Regev]  Gessel [Gessel]  Zeilberger [Zeil]

1342  yes  (⋆⋆)  yes
Bóna [Bona]  Bóna [Bona1]  Bóna [Bona1]

1324  yes  open  open

Bóna [Bona]

Table 1: Present state of research on avoidance of patterns of length 4

where D(x_{1}, x_{2}, …, x_{k}) = ∏_{i<j}(x_{i} − x_{j}), and γ_{k} = (1/\sqrt{2π})^{k−1} · k^{k^{2}/2}.

Another general result, involving generating functions, is due to Gessel [Gessel].

Theorem 2. Let ℓ_{k}(n) = |S_{n}(12 … k)|; then

L_{k}(x) = ∑_{n≥0} ℓ_{k}(n)\frac{x^{2n}}{n!} = det(I_{|i−j|}(x))_{1≤i,j≤k},

where I_{i}(x) is a Bessel function:

I_{i}(x) = ∑_{n≥0} \frac{x^{2n+i}}{n!(n + i)!} = ∑_{n≥0} \binom{2n + i}{n}\frac{x^{2n+i}}{(2n + i)!}.

This result was later explained in terms of lattice walks by Gessel, Weinstein and Wilf [GWW].

A natural question is the consideration of those permutations that avoid two or more patterns simultaneously. This problem was solved completely for the patterns from S_{3} (see [SimSch]). We summarize some of the results from that paper in Table 2. The trivial bijections break the set of all possibilities into 12 classes of equivalence; we pick one representative from each class.

For the case of simultaneous avoidance of two patterns τ_{1} and τ_{2}, where τ_{1} ∈ S_{3} and τ_{2} ∈ S_{4} see [West2]. We summarize the known results in Table 3.

The results in Table 4 were given by West.

For the case of simultaneous avoidance of two patterns in S_{4}, see [Bona2, Kremer] and references therein. Several recent papers [ChowWest, MV1, Krat,

patterns  enumeration
{123, 132}  2^{n−1}
\{123, 231\}  \binom{n}{2} + 1
{123, 321}  zero for n > 4
{132, 213}  2^{n−1}
{132, 231}  2^{n−1}
{132, 312}  2^{n−1}
{123, 132, 213} Fibonacci numbers
{123, 132, 231}  n
{123, 132, 312}  n
{123, 132, 321}  zero for n > 4
{123, 231, 312}  n
{132, 213, 231}  n

Table 2: Simultaneous avoidance of patterns of length 3 ([SimSch])

restrictions  formula  author
S_{n}(123, 4321)  0  West
S_{n}(123, 3421)  \binom{n}{4} + 2\binom{n}{3} + n  West
S_{n}(132, 4321)  2\binom{n}{4} + \binom{n}{3} + \binom{n}{2} + 1  West
S_{n}(123, 4231) \binom{n}{5} + 2\binom{n}{4} + \binom{n}{3} + \binom{n}{2} + 1 West
S_{n}(123, 3241)  3 · 2^{n−1} − \binom{n+1}{2} − 1  West
S_{n}(123, 3412)  2^{n+1} − \binom{n+1}{3} − 2n − 1  Stanley
S_{n}(132, 4231)  1 + (n − 1)2^{n−2}  Guibert
S_{n}(132, 3421)  1 + (n − 1)2^{n−2}  West
S_{n}(132, 3214)  g.f.: \frac{(1−x)^{3}}{1−4x+5x^{2}−3x^{3}}  West

Table 3: Simultaneous avoidance of a 3-pattern and a 4-pattern

restrictions restrictions  formula
S_{n}(123, 2143) S_{n}(312, 1342)
S_{n}(123, 2413) S_{n}(312, 3241)
S_{n}(132, 2314) S_{n}(312, 3214)
S_{n}(132, 2341) S_{n}(123, 3214)  F_{2n}
S_{n}(312, 2314) S_{n}(312, 4321)  (Fibonacci number)
S_{n}(132, 3412) S_{n}(312, 3421)
S_{n}(312, 1432) S_{n}(132, 3241)
S_{n}(3142, 2413) S_{n}(4132, 4231) the (n − 1)-st Schröder number

g.f.: \frac{1−x−\sqrt{1−6x+x^{2}}}{2x}

Table 4: Some results given by West

MV3, MV2] deal with the case τ_{1} ∈ S_{3}, τ_{2} ∈ S_{k} for various pairs τ_{1}, τ_{2}. Erdős and Szekeres [ErdSze] gave the following general result.

Theorem 3. For all n ≥ (ℓ − 1)(m − 1) + 1,

|S_{n}(12 … ℓ, m … 21)| = 0.

0.2 Generalized permutation patterns

In [BabStein] Babson and Steingrímsson introduced generalized permutation patterns that allow the requirement that two adjacent letters in a pattern must be adjacent in the permutation. In order to avoid confusion we write a ”classical” pattern, say 231, as 2-3-1, and if we write, say 2-31, then we mean that if this pattern occurs in a permutation π, then the letters in π that correspond to 3 and 1 are adjacent. For example, the permutation π = 516423 has only one occurrence of the pattern 2-31, namely the subword 564, whereas the pattern 2-3-1 occurs, in addition, in the subwords 562 and 563. If we use ”[” in a pattern, for example if we write p = [1-2), we indicate that in an occurrence of p, the letter corresponding to the 1 must be the first letter of the permutation, whereas if we write, say, p = (1-2], then the letter corresponding to 2 must be the last (rightmost) letter of the permutation. Thus, a parenthesis at either end of a pattern corresponds to a dash, and a square bracket corresponds to the absence of a dash. However, when a pattern begins and ends with a parenthesis, we omit these parentheses, writing simply 123 instead of (123).

The motivation for introducing these patterns in [BabStein] was the study of Mahonian statistics. A number of interesting results on generalized patterns were obtained in [Claes]. Relations to several well studied combinatorial structures, such as set partitions, Dyck paths, Motzkin paths and involutions, were

patterns P |S_{n}(P)|  description
1-23  B_{n}  partitions of [n]
1-32  B_{n}  partitions of [n]
2-13  C_{n}  Dyck paths of length 2n
1-23, 12-3  B_{n}^{⋆}  non-overlapping partitions of [n]
1-23, 1-32  I_{n}  involutions in S_{n}
1-23, 13-2  M_{n}  Motzkin paths of length n

Table 5: Generalized pattern avoidance ([Claes])

shown there. The main results from that paper are given in Table 5, where B_{n} is the n-th Bell number, C_{n} is the n-th Catalan number, and B_{n}^{⋆} is the n-th Bessel number.

For some other results on generalized permutation patterns see [ClaesMans1, ClaesMans2, Kit1, Kit2, Kit3, KitMans1, KitMans2]

Paper I. In Paper I ([Kit1]) we consider 3-patterns without internal dashes, that is, generalized patterns of the form xyz. Thus, such patterns correspond to contiguous subwords anywhere in a permutation. For example the permutation π = 12345 has 3 occurrences of the pattern 123 but 10 occurrences of the classical pattern 1-2-3. Patterns without internal dashes were considered by Elizalde and Noy in [ElizNoy]. In that paper, there is a number of results on the distribution of several classes of patterns without internal dashes. In particular, formulas are given for the bivariate exponential generating functions that count permutations by the number of occurrences of any given 3-pattern.

As in the paper by Simion and Schmidt [SimSch], dealing with the classical patterns, Claesson [Claes] considered a number of cases when permutations have to avoid two or more generalized patterns simultaneously (see Table 5). However, except for the simultaneous avoidance of the patterns 123 and 132, and three more pairs each of which is essentially equivalent to one of these, there were no other results for multi-avoidance of the patterns without internal dashes. In Paper I we give either an explicit formula or a recursive formula for almost all cases of simultaneous avoidance of more than two patterns. We also mention what is known about double restrictions. There are 18 classes of equivalence. As we did before, we choose a representative from each class and record all the known results in Table 6, where we define the double factorial n!! by 0!! = 1, and, for n > 0,

n!! = \{ \begin{matrix}n · (n − 2) ⋯ 3 · 1, & if n is odd, \\ n · (n − 2) ⋯ 4 · 2, & if n is even. \end{matrix}

Besides, in order to complete the description of simultaneous avoidance of two generalized patterns without internal dashes, we put in the same table some results from papers III ([KitMans1]) and IV ([KitMans2]).

Paper II. In Paper II ([Kit3]) we consider avoidance of some generalized 3patterns with additional restrictions. The restrictions consist of demanding that a permutation begin or end with the pattern 12 … k or the pattern k(k−1) … 1. We observe that avoidance of some pattern with the additional restrictions described above in fact is equivalent to simultaneous avoidance of several patterns. For example, beginning with the pattern 12 is equivalent to the avoidance of the pattern [21) in the Babson-Steingrímsson notation. Thus avoidance of the pattern 132 and beginning with the pattern 12 is equivalent to simultaneous avoidance of the patterns 132 and [21). Also, ending with the pattern 123 is equivalent to simultaneously avoiding the patterns (132], (213], (231], (312] and (321]. So, demanding that a permutation must begin or end with some pattern is equivalent to simultaneous avoidance of a set of generalized patterns. A motivation for considering additional restrictions such as beginning or ending with some patterns is their connection to some classes of trees mentioned below.

It turns out that the number of permutations that avoid the pattern 1-32 and end with the pattern 12 … k is a linear combination of the Bell numbers. We find a bijection between these permutations and all partitions of an (n − 1)- element set with one subset marked that satisfy certain additional conditions. In particular, we get that the total number of partitions of an (n−1)-element set with one part marked, is equal to the number of (1-32)-avoiding n-permutations that end with a 12-pattern. Also, we get an identity involving the Bell numbers and the Stirling numbers of the second kind, which seems to be new. Besides, we prove that the number of 132-avoiding n-permutations that begin with the pattern 12 is equal to the number of increasing rooted trimmed trees with n + 1 nodes. In an increasing rooted tree, the nodes are numbered and the numbers increase as we move away from the root. A trimmed tree is a tree where no node has a single leaf as a child (every leaf has a sibling).

In Sections 4–7 of Paper II, we give a complete description, in terms of exponential generating functions, for the number of permutations that avoid a pattern of the form xyz and begin or end with the pattern 12 … k or the pattern k(k − 1) … 1. We record all the results concerning these e.g.f. in Table 7. The case k = 1 is equivalent to the absence of the additional restriction. This case was considered in [ElizNoy] and Paper I.

Paper III. As mentioned above, Paper II dealt with the avoidance of a generalized 3-pattern p with no dashes and, at the same time, beginning or ending with an increasing or decreasing pattern. Theorem 2 in Paper III ([KitMans1]) generalizes some of these results to the case of beginning (resp. ending) with an arbitrary pattern p that has the greatest or least letter as the rightmost (resp. leftmost) letter. To write down this theorem, we need the following definitions. Let E_{q}^{p}(x) denote the exponential generating function for the number of permutations that avoid the pattern q and begin with the pattern p. Also, Γ_{k}^{min} (resp. Γ_{k}^{max}) denotes the set of all k-patterns with no dashes such that the least

class  restrictions  formula
1  123, 321, 231, 213  2
2  321, 213, 231, 312  2
3  132, 231, 213, 312  2
4  123, 321, 132, 231  2 if n = 3; 0 if n > 3
5  231, 312, 213, 123  n − 1
6  123, 321, 132, 213  2C_{k}, if n = 2k + 1

C_{k} + C_{k−1}, if n = 2k

7  231, 312, 321  \binom{n}{⌊n/2⌋}
8  123, 213, 312  n
9  132, 213, 312  1 + 2^{n−2}

recursive formula:

10 123, 213, 231 A(0) = 1; A(1) = 1;

A(n) = ∑_{i} \binom{n − i − 1}{i}A(n − 2i − 1) + ((n + 1) mod 2)

the first few numbers: 1, 1, 2, 3, 6, 13, 29, 72, 185 …

11  123, 321, 231  (n − 1)!! + (n − 2)!!
12  123, 231, 312  e.g.f.: 1 + x(sec x + tan x), Paper III
13  321, 132  recurrence relation, Paper IV
14  213, 231  recurrence relation, Paper IV
15  132, 213  recurrence relation, Paper IV
16  123, 321  2E_{n}, where E_{n} is the n-th Euler number
17  321, 231  the number of involutions in S_{n}, Claesson [Claes]
18  132, 231  2^{n−1}

Table 6: Simultaneous avoidance of generalized 3-patterns (mostly Paper I)

avoid begin  end  e.g.f.
123 12 … k  –
1 123  –  12 … k  \frac{\sqrt{3}}{2} \frac{e^{x/2}}{cos(^{\frac{\sqrt{3}}{2}} x+ \frac{π}{6} )} , if k = 1
321 k … 21  –  \frac{\sqrt{3}}{2} e^{x/2} sec( \frac{\sqrt{3}}{2} x + \frac{π}{6} ) − \frac{1}{2} − \frac{\sqrt{3}}{2} tan( \frac{\sqrt{3}}{2} x + \frac{π}{6} ), if k = 2
321  –  k … 21  0, if k ≥ 3
123 k … 21  –
2 123 – k … 21 \frac{\sqrt{3}}{2} \frac{e^{x/2}}{cos(^{\frac{\sqrt{3}}{2}} x+ \frac{π}{6} )} , if k = 1
321 12 … k  –
321 – 12 … k \frac{e^{x/2} ∫_{0}^{x} e^{−t/2}t^{k−1} sin(^{\frac{\sqrt{3}}{2}} t+ \frac{π}{6} )) dt}{(k−1)! cos(^{\frac{\sqrt{3}}{2}} x+ \frac{π}{6} )} , if k ≥ 2
132 12 … k  –
3 213  –  12 … k  (1 − ∫_{0}^{x} e^{−t^{2}/2} dt)^{−1}, if k = 1
312 k … 21  –  e^{−x^{2}/2}(1 − ∫_{0}^{x} e^{−t^{2}/2} dt)^{−1} − x − 1, if k = 2
231  –  k … 21  (1 − ∫_{0}^{x} e^{−t^{2}/2} dt)^{−1} ∫_{0}^{x} ∫_{0}^{t_{k−2}} ⋯ ∫_{0}^{t_{2}}(e^{−t_{1}^{2}/2}−

(t_{1} + 1)(1 − ∫_{0}^{t_{1}} e^{−t^{2}/2} dt))dt_{1}dt_{2} ⋯ dt_{k−2}, if k ≥ 3

132 k … 21  –
4 213  –  k … 21  (1 − ∫_{0}^{x} e^{−t^{2}/2} dt)^{−1}, if k = 1
312 12 … k  –  _{\frac{1}{(k−1)!(1−∫_{0}^{x} e^{−t^{2}/2} dt)}} ∫_{0}^{x} t^{k−1}e^{−t^{2}/2} dt, if k ≥ 2
231  –  12 … k
213 12 … k  –  (1 − ∫_{0}^{x} e^{−t^{2}/2} dt)^{−1}, if k = 1
5 132  –  12 … k
231 k … 21  –  ∫_{0}^{x} ∫_{0}^{t} \frac{s^{k−2}e^{T (t)−T (s)}}{(k−2)!(1−∫_{0}^{t} e^{−m^{2}/2}dm)} dsdt , if k ≥ 2, where
312  –  k … 21  T (x) = −x^{2}/2 + ∫_{0}^{x} \frac{e^{−t^{2}/2}}{1−∫_{0}^{t} e^{−s^{2}/2}ds} dt
213 k … 21  –  (1 − ∫_{0}^{x} e^{−t^{2}/2} dt)^{−1}, if k = 1
6 132  –  k … 21  − \frac{x^{k−1}}{(k−1)!} + ∑_{n=0}^{k−2}∫_{0}^{x} ∫_{0}^{t_{n}} ⋯ ∫_{0}^{t_{1}} \frac{C_{k−n}(t)+δ_{n,k−2}}{1−∫_{0}^{t} e^{−m^{2}/2}dm} dtdt_{1} ⋯ dt_{n},
231 12 … k  –  if k ≥ 2, where C_{k}(x) = e^{T (x)} ∫_{0}^{x} ∫_{0}^{t_{k−2}} ⋯ ∫_{0}^{t_{1}} e^{−T (t)}·
312  –  12 … k ( \frac{e^{−t^{2}/2}}{1−∫_{0}^{t} e^{−m^{2}/2}dm} − t − 1) dtdt_{1} ⋯ dt_{k−2} and T (x) as above

Table 7: Avoiding a pattern xyz with additional restrictions (Paper II)

(resp. greatest) letter of a pattern is the rightmost letter. Now, we formulate Theorem 2 from Paper III:

Theorem 4. Suppose p_{1}, p_{2} ∈ Γ_{k}^{min} and p_{1} ∈ S_{k}(132), p_{2} ∈ S_{k}(123). Thus, the complements C(p_{1}), C(p_{2}) ∈ Γ_{k}^{max} and C(p_{1}) ∈ S_{k}(312), C(p_{2}) ∈ S_{k}(321). Then, for k ≥ 2,

E_{132}^{p_{1}}(x) = E_{312}^{C(p_{1})}(x) = \frac{∫_{0}^{x} t^{k−1}e^{−t^{2}/2} dt}{(k − 1)!(1 − ∫_{0}^{x} e^{−t^{2}/2} dt)}

and

E_{123}^{p_{2}}(x) = E_{321}^{C(p_{2})}(x) = \frac{e^{x/2} ∫_{0}^{x} e^{−t/2}t^{k−1} sin(\frac{\sqrt{3}}{2}t + \frac{π}{6} )) dt}{(k − 1)! cos(\frac{\sqrt{3}}{2}x + \frac{π}{6} )}.

Propositions 4–15 (resp. 16–27) in Paper III give a complete description for the number of permutations avoiding a pattern of the form x-yz or xy-z and beginning with one of the patterns 12 … k or k(k − 1) … 1 (resp. 23 … k1 or (k − 1)(k − 2) … 1k). For each of these cases we find either the ordinary or exponential generating function or a precise formula for the number of such permutations. Theorem 28 in Paper III generalizes some of these results:

Theorem 5. Suppose p_{1}, p_{2} ∈ Γ_{k}^{min} and p_{1} ∈ S_{k}(1-23), p_{2} ∈ S_{k}(1-32). Thus, the complements C(p_{1}), C(p_{2}) ∈ Γ_{k}^{max} and C(p_{1}) ∈ S_{k}(1-23), C(p_{2}) ∈ S_{k}(3-12). Then, we have

E_{1-23}^{p_{1}}(x) = E_{3-21}^{C(p_{1})}(x) = E_{1-32}^{p_{2}}(x) = E_{3-12}^{C(p_{2})}(x) =

\{ \begin{matrix}(e^{e^{x}}/(k − 1)!) ∫_{0}^{x} t^{k−1}e^{−e^{t}+t} dt, & if k ≥ 2, \\ e^{e^{x}−1}, & if k = 1. \end{matrix}

Moreover, the results from Propositions 4–27 in Paper III give a complete description for the number of permutations that avoid a pattern of the form x-yz or xy-z and end with one of the patterns 12 … k, k(k − 1) … 1, 1k(k − 1) … 2 and k12 … (k−1). To get the last one of these we only need to apply the reverse operation defined above.

Paper IV. In Paper IV ([KitMans2]) we continue consideration of generalized pattern avoidance with additional restriction. In Section 4 of Paper IV, we consider avoidance of a pattern x-y-z, and beginning or ending with an increasing or decreasing pattern. This completes the results given in Paper III, which concerns the number of permutations that avoid a generalized 3-pattern and begin or end with an increasing or decreasing pattern.

In Sections 5–8 of Paper IV, we consider stronger restrictions, which generalize many results from Papers II, III, IV. Namely, we give enumeration for the number of permutations that avoid a generalized 3-pattern, and begin and end with increasing or decreasing patterns. We record our results in terms of either generating functions, or exponential generating functions, or formulas for the numbers in question.

In Section 9 of Paper IV, we discuss possible directions for generalization of the results from Sections 5–8. The first direction is to consider avoidance of more than one pattern, beginning with some pattern and ending with another pattern. The second direction concerns permutations in S_{n} containing a pattern τ exactly r times, beginning with some pattern and ending with another pattern.

0.3 Partially ordered generalized patterns

Suppose we are interested in finding the number of permutations that avoid all patterns from the set {12-4-3, 13-4-2, 23-4-1} simultaneously. There is a way to code these three patterns into one pattern, and instead of considering three patterns to consider one. This is done by allowing some letters of a pattern to be incomparable. Thus the set of patterns above can be replaced by the pattern p = 1′2′-3-1′′, where in an occurrence of p in a permutation π the letter corresponding to the 1′′ in p can be either larger or smaller than the letters corresponding to 1′2′, but all of them must be less than the letter corresponding to the 3 in p. Such patterns are discussed in Papers V ([Kit2]) and VI ([KitMans3]). These patterns allow us to determine the distribution of non-overlapping occurrences of patterns without internal dashes.

Paper V. In Paper V ([Kit2]) we introduce a further generalization of generalized patterns (GPs)—namely partially ordered generalized patterns (POGP). A POGP is a GP some of whose letters are incomparable. For instance, if we write p = 1-1′2′ then we mean that in an occurrence of p in a permutation π the letter corresponding to the 1 in p can be either larger or smaller than the letters corresponding to 1′2′. Thus, the permutation 31254 has three occurrences of p, namely 3-12, 3-25, and 1-25.

We consider two particular classes of POGPs—shuffle patterns and multipatterns. A multi-pattern is of the form p = σ_{1}-σ_{2}- ⋯ -σ_{k} and a shuffle pattern is of the form p = σ_{0}-a_{1}-σ_{1}-a_{2}- ⋯ -a_{k}-σ_{k}, where for any i and j, the letter a_{i} is greater than any letter of σ_{j} and for any i ≠ j each letter of σ_{i} is incomparable to any letter of σ_{j} These patterns are investigated in Sections 4 and 5. A corollary to Theorem 13 is the result of Claesson [Claes, Proposition 2] that the number of n-permutations that avoid the pattern 12-3 is the n-th Bell number.

Let p and q be two patterns. An occurrence of p overlaps an occurrence of q in a permutation π if these two occurrences share a letter in π. For example, if p = 123, q = 231 and π = 623514 then 235 and 351, being occurrences of the patterns p and q respectively, overlap.

Let p = σ_{1}-σ_{2}- ⋯ -σ_{k} be an arbitrary multi-pattern and let A_{i}(x) be the exponential generating function (e.g.f.) for the number of permutations that avoid σ_{i} for each i. In Theorem 28 we find the e.g.f., in terms of the A_{i}(x), for the number of permutations that avoid p.

Theorem 6. Let p = σ_{1}-σ_{2}- ⋯ -σ_{k} be a multi-pattern and let A_{i}(x) be the e.g.f. for the number of permutations that avoid σ_{i}. Then the e.g.f. B(x) for the number of permutations that avoid p is

B(x) = ∑_{i=1}^{k} A_{i}(x) ∏_{j=1}^{i−1}((x − 1)A_{j}(x) + 1).

In fact, this allows us to find the e.g.f. for the entire distribution of the maximum number of non-overlapping occurrences of a pattern p with no dashes, if we only know the e.g.f. for the number of permutations that avoid p:

Theorem 7. Let p be a GP with no dashes. Let A(x) be the e.g.f. for the

number of permutations that avoid p. Let D(x, y) = ∑_{π} y^{N(π)} \frac{x^{|π|}}{|π|!} where N(π)

is the maximum number of non-overlapping occurrences of p in π. Then

D(x, y) = \frac{A(x)}{1 − y((x − 1)A(x) + 1)}.

In many cases, this theorem gives nice generating functions. The following two examples are corollaries to Theorem 7. We recall that a descent in a permutation π = a_{1}a_{2} … a_{n} is an i such that a_{i} > a_{i+1}. Two descents i and j overlap if j = i + 1.

Example 1. If we consider descents then A(x) = e^{x}, hence the distribution of the maximum number of non-overlapping descents is given by the formula

D(x, y) = \frac{e^{x}}{1 − y(1 + (x − 1)e^{x})}.

The reader might want to compare this result with some known results related to descents. To this end we recall the following. The number of descents in a permutation π is denoted des π (and is equivalent to the generalized pattern 21). Any statistic with the same distribution as des is said to be Eulerian. The Eulerian numbers A(n, k) count permutations in the symmetric group S_{n} with k descents and they are the coefficients of the Eulerian polynomials A_{n}(t) defined by A_{n}(t) = ∑_{π∈S_{n}} t^{1+des π}. The e.g.f. for Eulerian polynomials is given by

∑_{n≥0} A_{n}(t)\frac{x^{n}}{n!} = \frac{t(1 − t)e^{x}}{e^{xt} − te^{x}} .

Example 2. If we consider the maximum number of non-overlapping occurrences of the pattern 132 then the distribution of these numbers is given by the formula

D(x, y) = \frac{1}{1 − yx + (y − 1) ∫_{0}^{x} e^{−t^{2}/2} dt}.

We will talk about bivariate generating functions, or b.g.f., exclusively as generating functions of the form

A(u, z) = ∑_{π} u^{p(π)} \frac{z^{|π|}}{|π|!} = ∑_{n,k≥0} A_{n,k}u^{k} \frac{x^{n}}{n!} ,

were A_{n,k} is the number of n-permutations with k occurrences of the pattern p.

In order to apply the last two theorems, as well as some other results from Paper V, we need to know how many patterns avoid a given ordinary GP with no dashes. We are also interested in different approaches to studying these patterns. There is a number of results on the distribution of several classes of patterns with no dashes. These results can be used as building blocks for some of the results in Paper V. The most important of these is the following result by Elizalde and Noy:

Theorem 8. ([ElizNoy, Theorem 3.4]) Let m and a be positive integers with a ≤ m, let σ = 12 … aτ(a + 1) ∈ S_{m+2}, where τ is any permutation of the letters {a + 2, a + 3, …, m + 2}, and let A(u, z) be the b.g.f. for permutations where u marks the number of occurrences of σ and z marks the length of the permutation. Then A(u, z) = 1/w(u, z), where w is the solution of

w^{a+1} + (1 − u)\frac{z^{m−a+1}}{(m − a + 1)!}w′ = 0

with w(0) = 1, w′(0) = −1 and w^{(k)}(0) = 0 for 2 ≤ k ≤ a. In particular, the distribution does not depend on τ.

In Paper V we give alternative proofs, using inclusion-exclusion, of some of the results of Elizalde and Noy [ElizNoy]. Our proofs result in explicit formulas for the coefficients of the e.g.f. whereas Elizalde and Noy obtained differential equations for the same e.g.f..

Paper VI. From now on we are not discussing permutations and generalized permutation patterns. Instead we consider k-ary words and occurrences of patterns in them. First of all we need some definitions, most of which are intuitively clear from the preceding discussion.

Let [k]^{n} denote the set of all the words of length n over the (totally ordered) alphabet [k] = {1, 2, …, k}. We refer to these words as n-long k-ary words. A generalized pattern τ is a word in [ℓ]^{m} (possibly with dashes between some letters) that contains each letter from [ℓ] (possibly with repetitions). We say that the word σ ∈ [k]^{n} contains a generalized pattern τ if σ contains a subsequence order-isomorphic to τ in which the entries corresponding to consecutive entries of τ that are not separated by a dash must be adjacent. Otherwise, we say that σ avoids τ and write σ ∈ [k]^{n}(τ). Thus, [k]^{n}(τ) denotes the set of all the words in [k]^{n} that avoid τ. Moreover, if P is a set of generalized patterns then |[k]^{n}(P)| denotes the set all the words in [k]^{n} that avoid all patterns from P simultaneously. For example, a word π = a_{1}a_{2} … a_{n} avoids the pattern 13-2 if π has no subsequence a_{i}a_{i+1}a_{j} with j > i+1 and a_{i} < a_{j} < a_{i+1}. Also, π avoids the pattern 121 if it has no subword a_{i}a_{i+1}a_{i+2} such that a_{i} = a_{i+2} < a_{i+1}.

Burstein [Burstein] considered patterns without repeated letters on words instead of permutations. In particular, he found the number |[k]^{n}(P)| of words of length n in a k-letter alphabet that avoid all patterns from a set P ⊆ S_{3} simultaneously. Burstein and Mansour [BurMans1] (resp. [BurMans2, BurMans3]) considered forbidden patterns (resp. generalized patterns) with repeated letters.

In Paper VI ([KitMans3]) we introduce a further generalization of the generalized patterns, namely partially ordered generalized patterns in words (POGPs), which are analogues of POGPs in permutations [Kit2]. A POGP is a generalized pattern some of whose letters are incomparable. For example, if we write τ = 1-1′2′, then we mean that in an occurrence of τ in a word σ ∈ [k]^{n} the letter corresponding to the 1 in τ can be either larger than, smaller than, or equal to the letters corresponding to 1′2′. Thus, the word 113425 ∈ [5]^{6} contains seven occurrences of τ, namely 113, 134 twice, 125 twice, 325, and 425.

Following Paper V, we consider two particular classes of POGPs — shuffle patterns and multi-patterns, which allows us to give an analogue for all the main results of [Kit2] for k-ary words.

Let τ = τ_{0}-τ_{1}- ⋯ -τ_{s} be an arbitrary multi-pattern and let A_{τ_{i}}(x; k) be the ordinary generating function (g.f.) for the number of words in a k-letter alphabet that avoid τ_{i} for each i. In Theorem 4.7 of Paper VI we find the g.f., in terms of the A_{τ_{i}}(x; k), for the number of k-ary words that avoid τ:

Theorem 9. Let τ = τ_{1}-τ_{2}- ⋯ -τ_{s} be a multi-pattern. Then

A_{τ} (x; k) = ∑_{j=1}^{s} A_{τ_{j}}(x; k) ∏_{i=1}^{j−1}((kx − 1)A_{τ_{i}}(x; k) + 1).

In particular, this allows us to find the g.f. for the entire distribution of the maximum number of non-overlapping occurrences of a pattern τ with no dashes, if we only know the g.f. for the number of k-ary words that avoid τ:

Theorem 10. Let τ be a generalized pattern with no dashes. Then, for all k ≥ 1,

∑_{n≥0} ∑_{σ∈[k]^{n}} y^{N_{τ} (σ)}x^{n} = \frac{A_{τ} (x; k)}{1 − y((kx − 1)A_{τ} (x; k) + 1)},

where N_{τ} (σ) is the maximum number of non-overlapping occurrences of τ in σ.

Thus, in order to apply our results from the last two theorems we need to know how many k-ary words avoid a given ordinary generalized pattern with no dashes. This question was examined, for instance, in [BurMans1, Sections 2 and 3], [BurMans2, Section 3] and [BurMans3, Section 3.3].

All of the following examples are corollaries to Theorem 10.

Example 3. If we consider rises (the pattern 12) then A_{12}(x; k) = \frac{1}{(1−x)^{k}} (see [BurMans2]), hence the distribution of the maximum number of non-overlapping descents is given by the formula:

∑_{n≥0} ∑_{σ∈[k]^{n}} y^{N_{12}(σ)}x^{n} = \frac{1}{(1 − x)^{k} + y(1 − kx − (1 − x)^{k})}.

Example 4. The distribution of the maximum number of non-overlapping occurrences of the pattern 122 is given by the formula:

∑_{n≥0} ∑_{σ∈[k]^{n}} y^{N_{122}(σ)}x^{n} = \frac{x}{(1 − x^{2})^{k} + x − 1 + y(1 − kx^{2} − (1 − x^{2})^{k})},

since, according to [BurMans3, Theorem 3.10], A_{122}(x; k) = \frac{x}{(1−x^{2})^{k}−(1−x)}.

Example 5. If we consider the pattern 212 then A_{212}(x; k) = (1 − x ∑_{j=0}^{k−1} \frac{1}{1 + jx^{2}} )^{−1}

(see [BurMans3, Theorem 3.12]), hence the distribution of the maximum number of non-overlapping occurrences of the pattern 212 is given by the formula:

∑_{n≥0} ∑_{σ∈[k]^{n}} y^{N_{212}(σ)}x^{n} = \frac{1}{1 − x ∑_{j=0}^{k−1} \frac{1}{1 + jx^{2}} + xy (∑_{j=0}^{k−1} \frac{1}{1 + jx^{2}} − k)}.

0.4 Counting occurrences of certain patterns in certain words

The most attention, in the papers on classical or generalized patterns, in particular in Papers I–VI, is paid to obtaining exact formulas and/or generating functions for the number of words or permutations avoiding, or having k occurrences of, certain patterns. In Papers VII–IX we suggest another problem, namely counting the occurrences of certain patterns in certain words. These words were chosen to be the set of all finite approximations of certain sequences.

In Paper VII ([KitMans4]) this is a sequence generated by a morphism (a system of substitutions, to be defined below) with certain restrictions. In Paper VIII ([KitMans5]) the sequence is obtained from the Peano curve. The Peano curve was studied by the Italian mathematician Giuseppe Peano in 1890 as an example of a continuous space filling curve. Finally, in Paper IX ([Kit4]) this sequence is the sigma-sequence, which was used by Evdokimov [Evdok1] to construct chains of maximal length in the n-dimensional unit cube.

Independent interest in the sigma-sequence appears in connection with the well-known Dragon curve, discovered by the physicist John E. Heighway and defined as follows: Fold a sheet of paper in half, then fold in half again (so that the folds are parallel), and again, etc. and then unfold in such a way that each crease created by the folding process is opened out into a 90-degree angle. The “curve” refers to the shape of the partially unfolded paper as seen edge on (see

Figure 1: Dragon curve

Figure 1). If one travels along the curve, some of the creases will represent turns to the left and others turns to the right. Now if 1 indicates a turn to the right, and 2 to the left, and we start travelling along the curve indicating the turns, we get the sigma-sequence [Evdok].

Paper VII. In Paper VII ([KitMans4]) we count the occurrences of certain patterns in certain words. We choose these words to be a set of all finite approximations (to be defined below) of a sequence generated by a morphism with certain restrictions. The motivation is to study classes of sequences and words that are defined by iterative schemes [Lothaire, Salomaa]. The pattern τ in our considerations is either a classical pattern (with repeated letters allowed) from the set {1-2, 2-1, 1-1- ⋯ -1}, or an arbitrary generalized pattern without internal dashes, in which repetitions of letters are allowed. In particular, we find that there are (3 · 4^{n−1} + 2^{n}) occurrences of the pattern 1-2 in the n-th finite approximation of the sequence w defined below, which is a classical example of a nonrepetitive sequence.

Let Σ be an alphabet and Σ^{⋆} the set of all words over Σ. A map φ : Σ^{⋆} → Σ^{⋆} is called a morphism if we have φ(uv) = φ(u)φ(v) for any u, v ∈ Σ^{⋆}. It is easy to see that a morphism φ can be defined by defining φ(i) for each i ∈ Σ. The set of all rules i ↦ φ(i) is called a substitution system. We create words by starting with a letter from the alphabet Σ and iterating the substitution system. Such a substitution system is called a D0L (Deterministic, with no context Lindenmayer) system [LindRoz]. D0L systems are classical objects of formal language theory. They are interesting from a mathematical point of view [Frid], but also have applications in theoretical biology [Lind]. Let |X| denote the length of a word X, that is the number of letters in X.

Suppose a word φ(a) begins with a for some a ∈ Σ, and that the length of φ^{k}(a) increases without bound. The symbolic sequence lim_{k→∞} φ^{k}(a) is said to

be generated by the morphism φ. In particular, lim_{k→∞} φ^{k}(a) is a fixed point of φ. However, in this paper we are only interested in the finite approximations of lim_{k→∞} φ^{k}(a), that is in the words φ^{k}(a) for k = 1, 2, . . ..

An example of a sequence generated by a morphism is the following sequence w. We create words by starting with the letter 1 and iterating the substitution system ϕ_{w}: 1 ↦ 123, 2 ↦ 13, 3 ↦ 2. Thus, the initial letters of w are 123132123213.... This sequence was constructed in connection with the problem of constructing a nonrepetitive sequence on a 3-letter alphabet, that is, a sequence that does not contain any subwords of the type XX, where X is any non-empty word over a 3-letter alphabet. The sequence w has that property. The question of the existence of such a sequence, as well as the questions of the existence of sequences avoiding other kinds of repetitions, were studied in algebra [Adian, Justin, Kol], discrete analysis [Carpi, Dekk, Evdok2, Ker, Pleas] and in dynamical systems [MorseHedl]. In Examples 2.2, 2.6 and 3.3 of Paper VII we give the number of occurrences of the patterns 1-2, 2-1, 1-1- ⋯ -1, 12, 123 and 21 in the finite approximations of w.

Suppose N_{ϕ}^{τ}(n) denotes the number of occurrences of a pattern τ in a word generated by some morphism ϕ after n iterations. Suppose W = AXBY C, where A, X, B, Y, and C are some subwords. We say that an occurrence of a pattern τ in W is external for the pair of words (X, Y), if this occurrence starts somewhere in X and ends somewhere in Y. Also, an occurrence of τ in W is internal for the word X if this occurrence is a subsequence of X. For example, if W = 12324265, A = 1, X = 23, B = 2 and Y = 426 then an occurrence of the generalized pattern 213, namely 324 is external for (X, Y). On the other hand, the word X = 231 has two internal occurrences of the pattern 2-1, namely 21 and 31.

The following theorem was proved in Paper VII.

Theorem 11. Let A = {1, 2, …, k} be an alphabet, where k ≥ 2 and a pattern τ ∈ {1-2, 2-1}. Let X_{1} begins with the letter 1 and consists of ℓ copies of each letter i ∈ A (ℓ ≥ 1). Let a morphism ϕ be such that

1 → X_{1}, 2 → X_{2}, 3 → X_{3}, …, k → X_{k},

where we allow X_{i} to be the empty word ϵ for i = 2, 3, …, k (that is, ϕ may be

an erasing morphism), ∑_{i=2}^{k} |X_{i}| = k · d, and each letter from A appears in the

word X_{2}X_{3} … X_{k} exactly d times. Besides, let e_{i,j} (resp. e_{i}) be the number of external occurrences of τ for (X_{i}, X_{j}) (resp. (X_{i}, X_{i})), where i ≠ j. We assume that e_{i,j} = e_{j,i} for all i and j. Let s_{i} be the number of internal occurrences of τ in X_{i}. In particular, s_{i} = e_{i} = e_{i,j} = e_{j,i} = 0, whenever X_{i} = ϵ; also, e_{i} = |X_{i}| · (|X_{i}| − 1)/2, whenever there are no repetitive letters in X_{i}. Then N_{ϕ}^{τ}(1) = s_{1} and for n ≥ 2, N_{ϕ}^{τ}(n) is given by

ℓ · (d + ℓ)^{n−2} ∑_{i=1}^{k} s_{i} + \binom{ℓ · (d + ℓ)^{n−2}}{2} ∑_{i=1}^{k} e_{i} + ℓ^{2} · (d + ℓ)^{2n−4} ∑_{1≤i<j≤k} e_{i,j}.

Paper VIII. Let us define the Peano curve and the Peano words. We follow [GelbOlm] and present a description of a curve that fills the unit square S = [0, 1] × [0, 1], given in 1891 by D. Hilbert.

As indicated in Figure 2, the idea is to subdivide S and the unit interval I = [0, 1] into 4^{n} closed subsquares and subintervals, respectively, and to set up a correspondence between subsquares and subintervals so that inclusion relationships are preserved (at each stage of subdivision, if a square corresponds to an interval, then its subsquares correspond to subintervals of that interval).

We now define the continuous mapping f of I onto S: If x ∈ I, then at each stage of subdivision x belongs to at least one closed subinterval. Select either one (if there are two) and associate it to the corresponding square. In this way a decreasing sequence of closed squares is obtained corresponding to a decreasing sequence of closed intervals. This sequence of closed squares has the property that there is exactly one point belonging to all of them. This point is defined to be f(x). It can be shown that the point f(x) is well-defined, that is, independent of any choice of intervals containing x; the range of f is S; and f is continuous.

Figure 2: The Peano words

The following discrete analogue of the Peano curve was given by Evdokimov [Evdok]. For subdivision stage (iteration) n we construct a word X_{n} as follows: Go through the curve inside S starting at the point 1 (see Figure 2), and coding any movement “up” by 1, “right” by 2, ”down” by 3, ”left” by 4. Thus, we start

\begin{matrix}x & y & N_{τ_{1}(x,y)}(X_{2k+1}) & N_{τ_{2}(x,y)}(X_{2k+1}) & N_{τ_{1}(x,y)}(X_{2k+2}) & N_{τ_{2}(x,y)}(X_{2k+2}) \\ 1 & 1 & \binom{4^{2k}−1}{ℓ} & \binom{4^{2k}−1}{ℓ} & \binom{4^{2k+1}+2^{2k+1}−1}{ℓ} & \binom{4^{2k+1}+2^{2k+1}−1}{ℓ} \\ 1 & 2 & S_{1} & \binom{4^{2k}}{ℓ} + \binom{4^{2k}+2^{2k}−1}{ℓ} & S_{2} & \binom{4^{2k+1}}{ℓ} \\ 2 & 1 & 0 & \binom{4^{2k}−2^{2k}}{ℓ} & \binom{4^{2k+1}}{ℓ} & S_{2} \end{matrix}

Table 8: Generalized patterns having 2 letters (Paper VIII)

with the first iteration X_{1} = 123, the second iteration is X_{2} = 214112321233432. More generally, it is easy to see that the n-th iteration is given by

X_{n} = φ_{1}(X_{n−1})1X_{n−1}2X_{n−1}3φ_{2}(X_{n−1}),

where the function φ_{1}(A) reverses the letters in the word A and makes the substitution corresponding to the permutation 4123, that is, 1 becomes 4 etc. The function φ_{2} does the same, except with 4123 replaced by 2341. In this paper, we are interested in the words X_{n}, for n = 1, 2, …, which appear as the subdivision stages of the Peano curve. We call these words the Peano words.

In Paper VIII ([KitMans5]) we consider the Peano words and find the number of occurrences of the patterns

12, 21, 1^{ℓ}, τ_{1}(x, y) = [x-y^{ℓ}), τ_{2}(x, y) = (x^{ℓ}-y] and τ_{3}(x, y, z) = [x-y^{ℓ}-z],

where x, y, z ∈ {1, 2, 3}, y^{ℓ} = y-y- ⋯ -y (ℓ times), and we recall that “[“ in p = [x − w) indicates that in an occurrence of p, the letter corresponding to the x must be the first letter of the word. For example, the number of occurrences of the pattern 12 in X_{n}, according to Theorem 4 in Paper VIII, is equal to either \frac{2}{5}(4 · 16^{k} + 1) or \frac{2}{5}(16^{k+1} − 1) depending on whether n is odd or even.

Let N_{τ} (W) denote the number of occurrences of the pattern τ in the word W. Let S_{1} and S_{2} denote the following:

S_{1} = \binom{4^{2k} − 2^{2k}}{ℓ}+\binom{4^{2k}}{ℓ}+\binom{4^{2k} + 2^{2k} − 1}{ℓ}, S_{2} = \binom{4^{2k+1}}{ℓ}+\binom{4^{2k+1} − 2^{2k+1}}{ℓ}.

Tables 8 and 9 give all the results concerning the patterns τ_{1}(x, y), τ_{2}(x, y) and τ_{3}(x, y, z) except those triples (x, y, z), for which N_{τ_{3}(x,y,z)}(X_{n}) = 0 for all n.

Paper IX. Let us define the sigma-sequence and the sigma-words. In [Evdok1, Yab], Evdokimov constructed chains of maximal length in the n-dimensional unit cube using the sigma-sequence. The sigma-sequence w_{σ} was defined there by the following recursive scheme:

\begin{matrix}x & y & z & N_{τ_{3}(x,y,z)}(X_{2k+1}) & N_{τ_{3}(x,y,z)}(X_{2k+2}) \\ 1 & 1 & 1 & 0 & \binom{4^{2k+1}−2}{ℓ} \\ 1 & 1 & 2 & \binom{4^{2k}−1}{ℓ} & 0 \\ 1 & 2 & 1 & 0 & S_{2} \\ 1 & 2 & 2 & \binom{4^{2k}−1}{ℓ} & 0 \\ 2 & 1 & 2 & 0 & \binom{4^{2k+1}}{ℓ} \\ 1 & 2 & 3 & \binom{4^{2k}+2^{2k}−1}{ℓ} & 0 \\ 1 & 3 & 2 & \binom{4^{2k}−2^{2k}}{ℓ} & 0 \end{matrix}

Table 9: Generalized patterns having 3 letters (Paper VIII)

C_{1} = 1, D_{1} = 2
C_{k+1} = C_{k}1D_{k}, D_{k+1} = C_{k}2D_{k}
k = 1, 2, …

and w_{σ} = lim_{k→∞} C_{k}. Thus, the initial letters of w_{σ} are 11211221112212 . . .. We

call the words C_{k} the sigma words. The first four values of the sequence {C_{k}}_{k≥1} are 1, 112, 1121122, 112112211122122.

In [Kit] an equivalent definition of w_{σ} was given: any natural number n ≠ 0 can be presented unambiguously as n = 2^{t}(4s + σ), where σ < 4, and t is the greatest natural number such that 2^{t} divides n. If n runs through the natural numbers then σ runs through some sequence consisting of 1s and 3s. If we substitute 2 for 3 in this sequence, we get w_{σ}.

In Paper IX ([Kit4]) we give either an explicit formula or recurrence relation for the number of occurrences for some classes of patterns, subwords and subsequences in the sigma-words. In particular, Theorem 4 allows us to find the number of occurrences of an arbitrary generalized pattern without internal dashes of length ℓ, provided we know certain four numbers that can be easily calculated for the words C_{k}, D_{k}, C_{k+1} and D_{k+1}, where k = ⌈log_{2} ℓ⌉. Theorem 9 gives a recurrence relation for counting occurrences of patterns of the form τ_{1}-τ_{2}. In Section 6 we discuss occurrences of patterns of the form τ_{1}-τ_{2}- ⋯ -τ_{k}, where the pattern τ_{i} does not overlap with the patterns τ_{i−1} and τ_{i+1} for i = 1, 2, …, k−1. Finally, Section 7 deals with patterns of the form [τ_{1}-τ_{2}- ⋯ -τ_{k}], [τ_{1}-τ_{2}- ⋯ -τ_{k}) and (τ_{1}-τ_{2}- ⋯ -τ_{k}] in the Babson-Steingrímsson notation.

To formulate some of the results from Paper IX we need the following definitions.

Suppose a word W = AaB, where A and B are some words of the same length, and a is a single letter. We define the kernel of order k for the word W to be the subword consisting of the k − 1 rightmost letters of A, the letter a, and the k − 1 leftmost letters of B. We denote it by K_{k}(W). For example, K_{3}(111211221) = 12112. If |A| < k − 1 then we set K_{k}(W) = ϵ, that is the kernel in this case is the empty word. Also, m_{k}(τ, W) denotes the number of occurrences of the pattern τ in K_{k}(W).

The following theorems are proved in Paper IX.

Theorem 12. Let τ = τ_{1}τ_{2} … τ_{ℓ} be an arbitrary generalized pattern without internal dashes that consists of 1s and 2s. Suppose k = ⌈log_{2} ℓ⌉, a = m_{ℓ}(τ, D_{k}1C_{k}), and b = m_{ℓ}(τ, D_{k}2C_{k}). Then for n > k + 1, we have

c_{n}^{τ} = (a + b + c_{k+1}^{τ} + d_{k+1}^{τ}) · 2^{n−k−2} − b,
d_{n}^{τ} = (a + b + c_{k+1}^{τ} + d_{k+1}^{τ}) · 2^{n−k−2} − a.

Theorem 13. Let p = τ_{1}-τ_{2} be a generalized pattern such that |τ_{1}| = k_{1} and |τ_{2}| = k_{2}. Suppose k = ⌈log_{2}(k_{1} + k_{2} − 1)⌉. Let the following denote the number of occurrences of the subwords τ_{1} and τ_{2} in the kernels (recall that by definitions |C_{n}| = |D_{n}|):

\begin{matrix}a_{τ_{1}} = m_{k_{1}}(τ_{1}, D_{k}1C_{k}) & a_{τ_{2}} = m_{k_{2}}(τ_{2}, D_{k}1C_{k}) \\ b_{τ_{1}} = m_{k_{1}}(τ_{1}, D_{k}2C_{k}) & b_{τ_{2}} = m_{k_{2}}(τ_{2}, D_{k}2C_{k}) \end{matrix}

Also, let r_{1}^{a} (resp. r_{2}^{a}, r_{1}^{b}, r_{2}^{b}) denote the number of occurrences of overlapping subwords τ_{1} and τ_{2} in the word D_{k}1C_{k} (resp. D_{k}1C_{k}, D_{k}2C_{k}, D_{k}2C_{k}), where τ_{1} ∈ K_{k_{1}}(D_{k}1C_{k}) and τ_{2} ∈ C_{k} (resp. τ_{1} ∈ D_{k} and τ_{2} ∈ K_{k_{2}}(D_{k}1C_{k}), τ_{1} ∈ K_{k_{1}}(D_{k}2C_{k}) and τ_{2} ∈ C_{k}, τ_{1} ∈ D_{k} and τ_{2} ∈ K_{k_{2}}(D_{k}2C_{k})).

Besides, we assume that we know c_{n}^{τ_{i}} and d_{n}^{τ_{i}} for n > n_{i}, i = 1, 2. Then for n > max(k + 1, n_{1} + 1, n_{2} + 1), c_{n}^{τ} and d_{n}^{τ} are given by the following recurrence:

( \begin{matrix}c_{n}^{τ} \\ d_{n}^{τ} \end{matrix} ) = ( \begin{matrix}1 & 1 \\ 1 & 1 \end{matrix} ) ( \begin{matrix}c_{n−1}^{τ} \\ d_{n−1}^{τ} \end{matrix} ) + ( \begin{matrix}α_{n} \\ β_{n} \end{matrix} ) ,

where

α_{n} = (c_{n−1}^{τ_{1}} + a_{τ_{1}} − r_{1}^{a})d_{n−1}^{τ_{2}} + (a_{τ_{2}} − r_{2}^{a})c_{n−1}^{τ_{1}}

and

β_{n} = (c_{n−1}^{τ_{1}} + b_{τ_{1}} − r_{1}^{b})d_{n−1}^{τ_{2}} + (b_{τ_{2}} − r_{2}^{b})c_{n−1}^{τ_{1}}.

Theorem 14. Let τ = τ_{1}-τ_{2}- ⋯ -τ_{k} be a generalized pattern such that |τ_{i}| = k_{i} for i = 1, 2, …, k. We assume that for i = 1, 2, …, k − 1, the subword τ_{i} does not overlap with the subwords τ_{i−1} and τ_{i+1} in the following sense: no suffix of τ_{i−1} is a prefix of τ_{i} and no suffix of τ_{i} is a prefix of τ_{i+1}.

Suppose ℓ_{i} = ⌈log_{2} k_{i}⌉, ℓ = max_{i} ℓ_{i}, and for the subwords τ_{i} we have a_{i} = m_{k_{i}}(τ_{i}, D_{ℓ_{i}}1C_{ℓ_{i}}) and b_{i} = m_{k_{i}}(τ_{i}, D_{ℓ_{i}}2C_{ℓ_{i}}), for i = 1, 2, …, k.

We assume that we know c_{n−1}^{τ_{1}-···-τ_{i}} and d_{n−1}^{τ_{i+1}-···-τ_{k}} for each 1 ≤ i ≤ k − 1 and for all n > n^{⋆}. Then for all n > max(ℓ + 1, n^{⋆} + 1), c_{n}^{τ} and d_{n}^{τ} are given by the following recurrence:

\begin{matrix}( \begin{matrix}c_{n}^{τ} \\ d_{n}^{τ} \end{matrix} ) = ( \begin{matrix}1 & 1 \\ 1 & 1 \end{matrix} ) ( \begin{matrix}c_{n−1}^{τ} \\ d_{n−1}^{τ} \end{matrix} ) + \\ ∑_{i=1}^{k−1} ( \begin{matrix}c_{n−1}^{e(i)} · d_{n−1}^{f(i)} \\ c_{n−1}^{e(i)} · d_{n−1}^{f(i)} \end{matrix} ) + ∑_{i=1}^{k} ( \begin{matrix}a_{i} · c_{n−1}^{e(i−1)} · d_{n−1}^{f(i)} \\ b_{i} · c_{n−1}^{e(i−1)} · d_{n−1}^{f(i)} \end{matrix} ) , \end{matrix}

where e(i) = τ_{1}-τ_{2}- ⋯ -τ_{i} and f(i) = τ_{i+1}-τ_{i+2}- ⋯ -τ_{k}.

Theorem 15. Suppose τ_{1} and τ_{2} are two patterns without internal dashes such that |τ_{1}| = k_{1} and |τ_{2}| = k_{2}. Also, suppose ℓ_{1} = log_{2}(k_{1} + 1), ℓ_{2} = log_{2}(k_{2} + 1) and ℓ = log_{2}(k_{1} + k_{2} + 1).

Let a(τ_{1}, τ_{2}) be the number of overlapping subwords τ_{1} and τ_{2} in C_{ℓ} such that τ_{1} consists of the k_{1} leftmost letters of C_{ℓ}; b(τ_{1}, τ_{2}) is the number of overlapping subwords τ_{1} and τ_{2} in C_{ℓ} such that τ_{2} consists of the k_{2} rightmost letters of C_{ℓ}.

We assume that we know c_{n}^{τ_{i}} and d_{n}^{τ_{i}} for i = 1, 2 and for all n > n^{⋆}.

i. For n ≥ max(ℓ_{1}, n^{⋆}),

c_{n}^{[τ_{1}-τ_{2})} = \{ \begin{matrix}c_{n}^{τ_{2}} − a(τ_{1}, τ_{2}), & if C_{ℓ_{1}} begins with τ_{1}, \\ 0, & otherwise. \end{matrix}

ii. For n ≥ max(ℓ_{2}, n^{⋆}),

c_{n}^{(τ_{1}-τ_{2}]} = \{ \begin{matrix}c_{n}^{τ_{1}} − b(τ_{1}, τ_{2}), & if C_{ℓ_{2}} ends with τ_{2}, \\ 0, & otherwise. \end{matrix}

iii. For n ≥ ℓ,

c_{n}^{[τ_{1}-τ_{2}]} = \{ \begin{matrix}1, & if C_{ℓ} begins with τ_{1} and ends with τ_{2}, \\ 0, & otherwise. \end{matrix}

iv. For n ≥ max(ℓ_{1}, n^{⋆}),

d_{n}^{[τ_{1}-τ_{2})} = \{ \begin{matrix}d_{n}^{τ_{2}} − a(τ_{1}, τ_{2}), & if D_{ℓ_{1}} begins with τ_{1}, \\ 0, & otherwise. \end{matrix}

v. For n ≥ max(ℓ_{2}, n^{⋆}),

d_{n}^{(τ_{1}-τ_{2}]} = \{ \begin{matrix}d_{n}^{τ_{1}} − b(τ_{1}, τ_{2}), & if D_{ℓ_{2}} ends with τ_{2}, \\ 0, & otherwise. \end{matrix}

vi. For n ≥ ℓ,

d_{n}^{[τ_{1}-τ_{2}]} = \{ \begin{matrix}1, & if D_{ℓ} begins with τ_{1} and ends with τ_{2}, \\ 0, & otherwise. \end{matrix}

So, in Paper IX we count occurrences of certain patterns, subsequences and subwords in the sigma-words, which are particular initial subwords of w_{σ}. However, the challenging question is to find the number of occurrences of patterns, subsequences and subwords in an arbitrary initial subword of w_{σ}, or more generally, in a subword of w_{σ} starting in position i and ending in position j.

Bibliography

[Adian] Adian S. I.: The Burnside problem and identities in groups. Translated from the Russian by John Lennox and James Wiegold. Ergebnisse der Mathematik und ihrer Grenzgebiete [Results in Mathematics and Related Areas], 95. Springer-Verlag, Berlin-New York, (1979).

[BabStein] Babson E., Steingrímsson E.: Generalized permutation patterns and a classification of the Mahonian statistics, Sém. Lothar. Combin. 44 (2000), Art. B44b, 18 pp.

[Bona] Bóna M.: Permutations avoiding certain patterns; The case of length 4 and generalizations. Discrete Math. 175 (1997), 55–67.

[Bona1] Bóna M.: Exact enumeration of 1342-avoiding permutations: a close link with labeled trees and planar maps. J. Combin. Theory Ser. A 80 (1997), no. 2, 257–272.

[Bona2] Bóna M.: The permutation classes equinumerous to the smooth class. Electron. J. Combin. 5 (1998), no. 1, Research Paper 31, 12 pp. (electronic).

[Bona3] Bóna M.: The Solution of a Conjecture of Wilf and Stanley for all layered patterns. J. Combin. Theory Ser. A 85 (1999), 96–104.

[Bona4] Bóna M.: The number of permutations with exactly r 132-subsequences is P -recursive in the size!. Adv. Appl. Math. 18 (1997), 510–522.

[Burstein] Burstein A., Enumeration of words with forbidden patterns, Ph.D. thesis, University of Pennsylvania, 1998.

[BurMans1] Burstein A., Mansour T.: Words restricted by patterns with at most 2 distinct letters, Electron. J. Combin. 9, no. 2, #R3 (2002).

[BurMans2] Burstein A., Mansour T.: Words restricted by 3-letter generalized multipermutation patterns, preprint CO/0112281^{1}.

[BurMans3] Burstein A., Mansour T.: Counting occurrences of some subword patterns, preprint CO/0204320.

1References of type CO/xxxxxxx refer to preprints in Archive http://arxiv.org/

[Carpi] Carpi A.: On the number of abelian square-free words on four letters, Discrete Appl. Math. 81 (1998), 155–167.

[ChowWest] Chow T., West J.: Forbidden subsequences and Chebyshev polynomials. Discrete Math. 204 (1999), no. 1–3, 119–128.

[Claes] Claesson A.: Generalised Pattern Avoidance, European J. Combin. 22 (2001), no. 7, 961–971.

[ClaesMans1] Claesson A., Mansour T.: Permutations avoiding a pair of generalized patterns of length three with exactly one dash, preprint CO/0107044.

[ClaesMans2] Claesson A., Mansour T.: Counting Occurrences of a Pattern of Type (1,2) or (2,1) in Permutations, Adv. in Appl. Math. 29 (2002), 293–310.

[Dekk] Dekking F. M.: Strongly non-repetitive sequences and progression-free sets, Journal Com. Theory, Vol. 27-A, no. 2 (1979), 181–185.

[ElizNoy] Elizalde S., Noy M.: Enumeration of Subwords in Permutations, Proceedings of FPSAC 2001.

[ErdSze] Erdös P., Szekeres G.: A combinatorial problem in geometry, Compositio Mathematica 2 (1935), 463–470.

[Evdok] Evdokimov A. A.: Private communication (2001).

[Evdok1] Evdokimov A. A.: On the Maximal Chain Length of an Unit ndimensional Cube, Maths Notes 6, no. 3 (1969), 309–319. (Russian)

[Evdok2] Evdokimov A. A.: Strongly asymmetric sequences generated by a finite number of symbols, Dokl. Akad. Nauk SSSR 179 (1968), 1268–1271. (Russian) English translation in: Soviet Math. Dokl. 9 (1968), 536–539.

[Frid] Frid A. E.: On the frequency of factors in a D0L word, J. Automata, Languages and Combinatorics, Otto-von-Guericke-Univ., Magdeburg 3, no. 1 (1998), 29–41.

[GelbOlm] Gelbaum B., Olmsted J.: Counterexamples in Analysis, Holden-Day, San Francisco, London, Amsterdam, (1964).

[Gessel] Gessel I. M.: Symmetric functions and P -recursiveness, J. Combin. Theory Ser. A 53 (1990), 257–285.

[GWW] Gessel I. M., Weinstein J., Wilf H. S.: Lattice walks in Z^{d} and permutations with no long ascending subsequences, Electron. J. Combin. 5, no. 1, #R2 (1998).

[GoulJack] Goulden I. P., Jackson D. M.: Combinatorial Enumeration, A Wiley-Interscience Series in Discrete Mathematics, John Wiley & Sons Inc., New York, (1983).

[Justin] Justin J.: Characterization of the repetitive commutative semigroups, J. Algebra 21 (1972), 87–90.

[Ker] Keränen V.: Abelian squares are avoidable on 4 letters, In W. Kuich, editor, Proc. ICALP’92, Lecture Notes in Comp. Sci. 623 (1992), 41–52.

[Kit] Kitaev S.: There are no iterated morphisms that define the Arshon sequence and the sigma-sequence, J. Automata, Languages and Combinatorics, to appear.

[Kit1] Kitaev S.: Multi-avoidance of generalised patterns, Discrete Math., to appear.

[Kit2] Kitaev S.: Partially ordered generalized patterns, Discrete Math., to appear.

[Kit3] Kitaev S.: Generalized pattern avoidance with additional restrictions, preprint math.CO/0205215.

[Kit4] Kitaev S.: The sigma-sequence and counting occurrences of some patterns, preprint CO/0211260.

[KitMans1] Kitaev S., Mansour T.: Simultaneous avoidance of generalized patterns, preprint CO/0205182.

[KitMans2] Kitaev S., Mansour T.: On multi-avoidance of generalized patterns, preprint CO/0209340.

[KitMans3] Kitaev S., Mansour T.: Partially Ordered generalized patterns and k-ary words, preprint CO/0210023

[KitMans4] Kitaev S., Mansour T.: Counting the occurrences of generalized patterns in words generated by a morphism, preprint CO/0210170.

[KitMans5] Kitaev S., Mansour T.: The Peano curve and counting occurrences of some patterns, preprint CO/0210268.

[Knuth] Knuth D. E.: The Art of Computer Programming, 2nd ed. Addison-Wesley, Reading, MA (1973).

[Kol] Kolotov A. T.: Aperiodic sequences and functions of the growth of algebras, Algebra i Logika 20 (1981), no. 2, 138–154. (Russian)

[Krat] Krattenthaler C.: Permutations with restricted patterns and Dyck paths, Adv. in Appl. Math. 27 (2001), 510–530.

[Kremer] Kremer D.: Permutations with forbidden subsequences and a generalized Schröder number, Discrete Math. 218 (2000), 121–130.

[Lind] Lindenmayer A.: Mathematical models for cellular interaction in development, Parts I and II, J. Theoretical Biology, 18 (1968), 280–315.

[LindRoz] Lindenmayer A., Rozenberg G.: Automata, languages, development, North-Holland Publishing Co., Amsterdam-New York-Oxford (1976).

[Lothaire] Lothaire M.: Combinatorics on Words, Encyclopedia of Mathematics, Vol. 17, Addison-Wesley (1986). Reprinted in the Cambridge Mathematical Library, Cambridge University Press, Cambridge UK (1997).

[MacMah] MacMahon P. A.: Combinatory Analysis. Chelsea, New York, 1960 (Originally published by Camb. Univ. Press, London, 1915/16).

[Mans1] Mansour T.: Continued fractions and generalized patterns, European J. Combin. 23, no. 3 (2002), 329–344.

[Mans2] Mansour T.: Continued fractions, statistics, and generalized patterns, Ars Combin., to appear.

[Mans3] Mansour T.: Restricted 1-3-2 permutations and generalized patterns, Ann. Comb. 6, no. 1 (2002), 65–76.

[MV1] Mansour T., Vainshtein A.: Restricted permutations, continued fractions, and Chebyshev polynomials, Electron. J. Combin. 7, no. 1 (2000), Research Paper 17, 9 pp. (electronic).

[MV2] Mansour T., Vainshtein A.: Restricted 132-avoiding permutations, Adv. in Appl. Math. 126 (2001), no. 3, 258–269.

[MV3] Mansour T., Vainshtein A.: Layered restrictions and Chebyshev polynomials, Ann. Comb. 5 (2001), 451–458.

[MV4] Mansour T., Vainshtein A.: Restricted permutations and Chebyshev polyonomials, Sém. Lothar. Combin. 47 (2002), Article B47c.

[MorseHedl] Morse M., Hedlung G.: Unending chess, symbolic dynamics and a problem in semigroups, Duke Math. Journal, Vol. 11, no. 1 (1944), 1–7.

[NooZeil] Noonan J., Zeilberger D.: The enumeration of permutations with a prescribed number of “forbidden” patterns, Adv. Appl. Math. 17 (1996), 381–407.

[Pleas] Pleasants P.: Non-repetitive sequences, Proc. Camb. Phil. Soc., Vol. 68 (1970), 267–274.

[Regev] Regev A.: Asymptotic values for degrees associated with strips of Young diagrams, Adv. in Math. 41 (1981), 115–136.

[Rich] Richards D.: Ballot sequences and restricted permutations. Ars Combin. (1988), 25:83–86.

[Rob] Robertson A.: Permutations containing and avoiding 123 and 132 patterns, Discrete Math. Theor. Comput. Sci. 3 (1999), no. 4, 151–154 (electronic).

[RWZ] Robertson A., Wilf H.: and D. Zeilberger: Permutation patterns and continued fractions, Electron. J. Combin. 6 (1999), no. 1, Research Paper 38, 6 pp. (electronic).

[Salomaa] Salomaa A.: Jewels of Formal Language Theory, Computer Science Press (1981).

[SimSch] Simion R., Schmidt F.: Restricted permutations, European J. Combin. 6, no. 4 (1985), 383–406.

[SloPlo] Sloane N, J. A. and Plouffe S.: The Encyclopedia of Integer Sequences, Academic Press, (1995). http://www.research.att.com/∼njas/sequences/.

[Stank] Stankova Z.: Forbidden Subsequences, Discrete Math. 132 (1994), 291– 316.

[Stanley] Stanley R. P.: Enumerative Combinatorics, Vol. 1, Cambridge University Press, (1997).

[West] West J.: Permutations with forbidden subsequences; and, Stack sortable permutations, PHD-thesis, Massachusetts Institute of Technology, (1990).

[West1] West J.: Generating trees and the Catalan and Schröder numbers, Discrete Math. 146 (1995), 247–262.

[West2] West J.: Generating trees and forbidden subsequences, Discrete Math. 157 (1996), 363–372.

[Zeil] Zeilberger D.: Holonomic systems for special functions, J. Computational and Applied Mathematics, 32 (1990), 321–368.

[Yab] Yablonsky S. V.: Discrete mathematics and mathematical problems of cybernetics, Nauka, Vol. 1, Moscow (1974), 112–116. (Russian)

Paper I

Multi-avoidance of generalised patterns

Multi-Avoidance of Generalised Patterns

Sergey Kitaev ^{1}

Abstract

Recently, Babson and Steingrímsson introduced generalized permutation patterns that allow the requirement that two adjacent letters in a pattern must be adjacent in the permutation. We investigate simultaneous avoidance of two or more 3-patterns without internal dashes, that is, where the pattern corresponds to a contiguous subword in a permutation.

1.1 Introduction and Background

We write permutations as words π = a_{1}a_{2} ⋯ a_{n}, whose letters are distinct and usually consist of the integers 1, 2, …, n.

An occurrence of a pattern p in a permutation π is “classically” defined as a subsequence in π (of the same length as the length of p) whose letters are in the same relative order as those in p. Formally speaking, for r ≤ n, we say that a permutation σ in the symmetric group S_{n} has an occurrence of the pattern p ∈ S_{r} if there exist 1 ≤ i_{1} < i_{2} < ⋯ < i_{r} ≤ n such that p = σ(i_{1})σ(i_{2}) … σ(i_{r}) in reduced form. The reduced form of a permutation σ on a set {j_{1}, j_{2}, …, j_{r}}, where j_{1} < j_{2} < ⋯ < j_{r}, is a permutation σ_{1} obtained by renaming the letters of the permutation σ so that j_{i} is renamed i for all i ∈ {1, …, r}. For example, the reduced form of the permutation 3651 is 2431.

In [1] Babson and Steingrímsson introduced generalised permutation patterns that allow the requirement that two adjacent letters in a pattern must be adjacent in the permutation. In order to avoid confusion we write a ”classical” pattern, say 231, as 2-3-1, and if we write, say 2-31, then we mean that if this pattern occurs in the permutation, then the letters in the permutation that correspond to 3 and 1 are adjacent. For example, the permutation π = 516423 has only one occurrence of the pattern 2-31, namely the subword 564, whereas the pattern 2-3-1 occurs, in addition, in the subwords 562 and 563.

The motivation for introducing these patterns in [1] was the study of Mahonian statistics. A number of interesting results on generalised patterns were obtained in [5]. Relations to several well studied combinatorial structures, such as set partitions, Dyck paths, Motzkin paths and involutions, were shown there.

In this paper we consider 3-patterns without internal dashes, that is, generalised patterns of the form xyz. Thus, such patterns correspond to contiguous subwords anywhere in a permutation. For example the permutation π = 12345 has 3 occurrences of the pattern 123 but 10 occurrences of the classical pattern 1-2-3. Patterns without internal dashes were considered by Elizalde and Noy in [6]. In that paper, there is a number of results on the distribution of several classes of patterns without internal dashes. In particular, formulas are given for the bivariate exponential generating functions that count permutations by the number of occurrences of any given 3-pattern. Those formulas give rise to the exponential generating functions for the number of permutations that avoid any 3-pattern.

1Matematiska Institutionen, Chalmers tekniska högskola and Göteborgs universitet, S-412 96 Göteborg, Sweden; E-mail: kitaev@math.chalmers.se

As in the paper by Simion and Schmidt [11], dealing with the classical patterns, one can consider the case when permutations have to avoid two or more generalised patterns simultaneously. A number of such cases were considered in [5]. However, except for the simultaneous avoidance of the patterns 123 and 132, and three more pairs that are essentially equivalent to this, there are no other results for multi-avoidance of the patterns without internal dashes. In this paper we give either an explicit formula or a recursive formula for almost all cases of simultaneous avoidance of more than two patterns. We also mention what is known about double restrictions.

1.2 Preliminaries

Since we only treat patterns of length 3, and permutations of length 1 or 2 avoid all such patterns, we always assume that our permutations have length n ≥ 3.

Obviously, no permutation avoids all six patterns of length three. Only the increasing permutation 12 … n avoids all 3-patterns but 123, and only the decreasing permutation avoids all but 321.

Consider now permutations that avoid all but one 3-pattern, different from 123 and 321, Obviously, there is exactly one such 3-permutation. However, for n ≥ 4 there is no such permutation. Indeed, if the permutation π = a_{1}a_{2} … a_{n} avoids the patterns 123 and 321, then the letters of π alternate in size. That means that a_{1}a_{2}a_{3} and a_{2}a_{3}a_{4} form different patterns and thus π has an occurrence of a forbidden pattern.

There are, of course, \binom{6}{k} sets consisting of k different 3-patterns, so we have 15 sets of two 3-patterns, 20 with three 3-patterns and 15 with four. So we have 50 different sets having more than one restriction. But we can simplify our work by partitioning the sets into equivalence classes in the way shown below and it will be enough to consider only 18 sets of restrictions.

The reverse R(π) of a permutation π = a_{1}a_{2} … a_{n} is the permutation a_{n}a_{n−1} … a_{1}. The complement C(π) is the permutation b_{1}b_{2} … b_{n} where b_{i} = n+1−a_{i}. Also, R ∘C is the composition of R and C. For example, R(13254) = 45231, C(13254) = 53412 and R ∘ C(13254) = 21435. We call these bijections of S_{n} to itself trivial, and it is easy to see that for any pattern p the number A_{p}(n) of permutations avoiding the pattern p is the same as for the patterns R(p), C(p) and R ∘ C(p). For example, the number of permutations that avoid the pattern 132 is the same as the number of permutations that avoid the pattern 231. This property holds for sets of patterns as well. If we apply one of the trivial bijections to all patterns of a set G, then we get a set G′ for which A_{G′}(n) is equal to A_{G}(n). For example, the number of permutations avoiding {123, 132} equals the number of those avoiding {321, 312} because the second set is obtained from the first one by complementing each pattern.

So up to equivalence modulo the trivial bijections we need to investigate 18 sets of restrictions that are represented in the table below.

We define the double factorial n!! by 0!! = 1, and, for n > 0,

n!! = \{ \begin{matrix}n · (n − 2) ⋯ 3 · 1, & if n is odd, \\ n · (n − 2) ⋯ 4 · 2, & if n is even. \end{matrix}

Recall that the n-th Catalan number is defined by

C_{n} = \frac{1}{n + 1}\binom{2n}{n}.

Instead of writing A_{G}(n) for a set G of patterns, we will write A(n) since it will be unambiguous what set of patterns is under consideration.

Class  Restrictions  Formula
1  123, 321, 132, 312
123, 321, 231, 213  2

123, 312, 132, 213

2 321, 213, 231, 312 2

123, 231, 231, 132 321, 132, 312, 231

3  132, 231, 213, 312  2
4  123, 321, 132, 231  2, if n = 3
123, 321, 312, 213  0, if n > 3

132, 213, 312, 321

5 231, 312, 213, 123 n − 1

213, 132, 231, 321 312, 231, 132, 123

6 123, 321, 132, 213 2C_{k}, if n = 2k + 1
123, 321, 231, 312  C_{k} + C_{k−1}, if n = 2k
7  123, 132, 213
231, 312, 321  \binom{n}{⌊n/2⌋}

123, 132, 231

8 123, 213, 312 n

132, 231, 321 213, 312, 321

Class Restrictions  Formula

132, 213, 231

9 132, 213, 312 1 + 2^{n−2}

132, 231, 312 213, 231, 312

123, 132, 312  Recursive Formula:
10  123, 213, 231  A(0) = 1; A(1) = 1;
132, 312, 321  A(n) = ∑_{i} \binom{n − i − 1}{i}A(n − 2i − 1) + ((n + 1) mod 2)
213, 231, 321  The first few numbers: 1, 1, 2, 3, 6, 13, 29, 72, 185 …

123, 321, 132

11 123, 321, 231 (n − 1)!! + (n − 2)!!

123, 321, 312 123, 321, 213

12 123, 231, 312 ?

132, 213, 321 123, 231

13 321, 132 ?

321, 213 123, 312

14 213, 231 ?

312, 132

15 132, 213 ?

231, 312

16 123, 321 2E_{n}, where E_{n} is the n-th Euler number

123, 132

17 321, 231 the number of involutions in S_{n}
321, 312  (Claesson, [5])

123, 213

18 132, 231 2^{n−1}

312, 213

We now give proofs and comments for the results represented in the table.

1.3 Proofs, remarks, comments

From now on, when talking about class i, we mean the first set of patterns in the equivalence class i according to the table above. Thus, for instance, 8 will be taken to refer to the set of patterns {123, 132, 231}.

Let us consider class 1. There are only two patterns, namely 231 and 213, that are allowed to occur. Suppose a permutation π = a_{1}a_{2} … a_{n} avoids the patterns from 1. If a_{1}a_{2}a_{3} forms a 231-pattern then a_{2}a_{3}a_{4} has to form a 213pattern since a_{2} > a_{3}. It is easy to see that a_{3}a_{4}a_{5} has to form the pattern 231 and so on. Moreover, if we consider the letters in even positions from left to right then we get an increasing sequence any element of which is greater then any element in an odd position; letters in odd positions form a decreasing sequence when read from left to right. From this we see that there is a unique such permutation in which the letters {1, 2, …, ⌊(n + 1)/2⌋} are in the odd positions in decreasing order, and all other letters are in the even positions in increasing order.

By the same argument there is only one permutation that avoids 1 and begins with a 213-pattern. Thus, in this case A(n) = 2.

For class 2 there are only two permutations that avoid it, namely π_{1} = n(n − 1)(n − 2) … 1 and π_{2} = (n − 1)n(n − 2)(n − 3) … 1. This is because n has to be either in the leftmost position or in the second position from the left, for otherwise we have either an occurrence of the pattern 123 or of the pattern 213 that involves n. To the right of n we have to have decreasing order because otherwise we have an occurrence of a 312- or a 213-pattern. Moreover, if n is in the second position from the left then in the leftmost position we must have the letter (n − 1) because otherwise (n − 1) must be in the third place and the first three letters form a 132-pattern.

There are obviously only two permutations that avoid class 3. They are π_{1} = 12 … n and π_{2} = n(n − 1) … 1.

For class 4, only the patterns 213 and 312 are allowed. Obviously, for n = 3 we have A(n) = 2. Suppose n > 3. If a permutation π = a_{1}a_{2} … a_{n} avoids 4, then it has to be that a_{2} < a_{3}, because a_{1}a_{2}a_{3} forms either a 213- or a 312-pattern. But this means that a_{2}a_{3}a_{4} cannot form a 213- or a 312-pattern, whence A(n) = 0.

For class 5, n has to be either in the rightmost position or in the second position from the right, for otherwise we have an occurrence of a 312- or a 321-pattern. Moreover we must have increasing order to the left of n because otherwise we have an occurrence of a 213- or a 312-pattern. Thus there is only one permutation with n in the rightmost position. If n is in the second position from the right then (n − 1) cannot be in the rightmost position, because in this case we have an occurrence of a 132-pattern that involves n and (n−1). So in this case (n−1) has to be in the third position from the right, and we can put any letter i other than n − 1 and n in the rightmost position. This means that A(n) = 1 + (n − 2) = n − 1.

Class 6 will be considered in Theorem 2 below.

Theorem 1. For class 7 we have A(n) = \binom{n}{⌊n/2⌋}.

Proof. Let us construct a permutation that avoids class 7 by inserting the numbers 1, 2, …, n into n slots and observing the following:

The number 1 can be placed either in the rightmost slot or in the second slot from the right, since otherwise, independently of what we have to the right of 1 in the permutation, we get either a 123- or a 132-pattern, which is prohibited. If 1 has already been placed then 2 must be placed in such way that:

1. The two slots immediately to the right of 2 are not both empty, for otherwise we will get an occurrence of either a 123- or a 132-pattern involving 2;

2. If 1 is not in the rightmost slot then 2 cannot be immediately to the left of 1, because in this case we will get an occurrence of a 213-pattern involving the letters 1 and 2.

In general it is easy to see that if i letters have been placed then for some j such that 0 ≤ j ≤ i the rightmost j slots are non-empty and the 2 · (i − j) slots immediately to the left of these j slots are alternatingly empty and non-empty. By an argument analogous to the above we can only place the letter (i + 1) into either

0) the rightmost empty slot or

1) the second empty slot to the left of the leftmost non-empty slot.

If we place 1 next to the rightmost slot we assume that we use option 1).

Let us call the leftmost two slots critical slots. When we fill one of the critical slots, there is only one way to place the remaining letters, using option 0), since in this case, option 1) can not be applied any more.

So any permutation with the right properties can be written as a sequence of 0s and 1s according to which option we use in placing the ith letter (i = 1, 2, …) and we stop writing a (0,1)-sequence whenever we reach one of the critical slots.

Let us call the (0,1)-sequences thus constructed legal sequences.

Example 1. Let n = 6. The (0,1)-sequence 01101 is a legal sequence that corresponds to the permutation 5736241. But 1111 is not a legal sequence, because after 3 steps, namely 111, we are already in a critical slot and must stop writing the (0,1)-sequence.

Since obviously there is a bijection between legal sequences and permutations in class 7, our problem is to count all possible legal sequences. We prove by induction on n that the number of such sequences is equal to \binom{n}{⌊n/2⌋}.

It is easy to check this for n = 3.

Assuming that for all i < n we have A(i) = \binom{i}{⌊i/2⌋}, we prove the statement for A(n). We consider separately the cases when n is even and odd.

Suppose n is even. The number of legal sequences that begin with 0 is obviously equal to

A(n − 1) = \binom{n − 1}{⌊(n − 1)/2⌋} = \binom{n − 1}{(n − 2)/2}.

Now we prove that the number of legal sequences beginning with 1 is equal to the number of legal sequences beginning with 0. We shall show that a bijection between these legal sequences is given by the correspondence 0X ↔ 1X, where 0X is any legal (0,1)-sequence of length ℓ, \frac{n}{2} ≤ ℓ ≤ n−1, that starts with 0. From this it follows that

A(n) = 2A(n − 1) = \binom{n−1}{(n−2)/2} + \binom{n−1}{(n−2)/2} =

= \binom{n−1}{(n−2)/2} + \binom{n−1}{n/2} = \binom{n}{n/2} = \binom{n}{⌊n/2⌋}.

So the problem is to prove that 0X ↔ 1X is a bijection.

We use induction on even n. If n = 2 then we only have the critical slots and thus there are only two legal sequences possible, namely 0 and 1. In this case X = ∅ and we have that 0X ↔ 1X is a bijection.

Suppose for all even m less than n the correspondence 0X ↔ 1X is a bijection. We consider the case m = n. Recall that n is even.

By n-permutation we mean a permutation of elements 1, 2, …, n.

A (0,1)-sequence p_{0} = 00X′ is a legal sequence that corresponds to some n-permutation avoiding 7 if and only if p′_{0} = X′ is a legal sequence that corresponds to some (n − 2)-permutation. To see this we observe that after the first two steps, p_{0} fills in the two rightmost slots. We can strike them and forget about the first two steps of p_{0}; by this, we are left with the (0,1)-sequence X′ that can be investigated (if it is a legal sequence) with respect to (n − 2)-permutations.

By the same reasoning, a (0,1)-sequence p_{1} = 10X′ is a legal sequence that corresponds to some n-permutation avoiding 7 if and only if p′_{1} = X′ is a legal sequence that corresponds to some (n − 2)-permutation.

From these arguments we conclude, that if X = 0X′ then the correspondence 0X ↔ 1X is a bijection.

For any natural number k, we write (k) instead of writing k consecutive letters 1. In particular (0) = ∅.

Suppose X = (k)0X′ and k ≥ 1. Reasoning as before, p_{0} = 0(k)0X′ is a legal sequence with respect to n-permutations if and only if p′_{0} = 0(k − 1)X′ is a legal sequence with respect to (n − 2)-permutations. Also, p_{1} = 1(k)0X′ is a legal sequence with respect to n-permutations if and only if p′_{1} = 1(k −1)X′ is a legal sequence with respect to (n − 2)-permutations. By induction, for (n − 2)- permutations, the correspondence 0Y ↔ 1Y between legal sequences 0Y and 1Y is a bijection, thus the correspondence 0X ↔ 1X, when X = (k)0X′, is a bijection for n-permutations as well.

The last thing we need to observe is that since n is even, p_{0} = 0(k) is a legal sequence if and only if p_{1} = 1(k) is a legal sequence.

This proves that the correspondence 0X ↔ 1X is a bijection.

Suppose n is odd. If a legal sequence begins with 0, then we obviously have that there are A(n − 1) = \binom{n−1}{(n−1)/2} such legal sequences. So to prove the statement we need to prove that the number of legal sequences that begin with 1 is equal to \binom{n−1}{(n+1)/2} because if it is so then we have

A(n) = \binom{n − 1}{(n − 1)/2} + \binom{n − 1}{(n + 1)/2} = \binom{n}{(n − 1)/2} = \binom{n}{⌊n/2⌋}.

If a legal sequence begins with 1 then either

i) the number of 1s always exceeds the number of 0s, or

ii) at some point the number of 1s is equal to the number of 0s.

Let us consider case i). Here we deal with Catalan numbers, which, among many other things, count the Dyck paths. A Dyck path of length 2n is a lattice path from (0, 0) to (2n, 0) with steps (1, 1) and (1, −1) that never goes below the x-axis. Let us explain why in case i) we have \frac{1}{(n−1)/2} \binom{n−3}{(n−3)/2} legal sequences with the right properties.

We can see that the number of ones is fixed in this case and equal to (n−1)/2. We can complete our (0,1)-sequence with 0s if necessary (in order to complete a Dyck path that corresponds to the (0,1)-sequence under consideration). Moreover, we can forget about the leftmost letter 1 because we know that it is followed by another letter 1, so we have (n−3)/2 ones. We thus substitute k = (n−3)/2 in the formula for the Catalan numbers, C_{k} = \frac{1}{k+1} \binom{2k}{k}, which completes the consideration of i).

In case ii) we apply induction. Let us consider the first time, say step i, when the number of 0s is equal to the number of 1s. Obviously it can occur at any even step (and not at any odd one). Moreover, because it is the first such time, if we consider initial subsequences of length less then i, we always have that in such subsequences the number of 1s exceeds the number of 0s. So in case ii), if we apply the induction hypothesis to the A(n − i), the number of legal sequences is equal to

∑_{i is even^{i=2}}^{n−3} \frac{1}{i/2}\binom{i − 2}{(i − 2)/2}A(n − i) = ∑_{i is even^{i=2}}^{n−3} \frac{1}{i/2}\binom{i − 2}{(i − 2)/2}\binom{n − i}{(n − i − 1)/2}.

So to complete the case when n is odd we need only check the following equality:

\binom{n − 1}{(n + 1)/2} =

∑_{i is even^{i=2}}^{n−3} \frac{1}{i/2}\binom{i − 2}{(i − 2)/2}\binom{n − i}{(n − i − 1)/2} + \frac{1}{(n − 1)/2}\binom{n − 3}{(n − 3)/2}.

The last term can be moved inside the sum. Since n is odd, we have n = 2m + 1 and the equation above can be rewritten as

\binom{2m}{m + 1} = ∑_{i=1}^{m} \frac{1}{i}\binom{2(i − 1)}{i − 1}\binom{2(m − i) + 1}{m − i}.

We give a combinatorial proof of this identity. We observe that the left hand side of it counts the number of all lattice paths from (0, 0) to (2m, −2) with steps (1, 1) and (1, −1).

The i-th term in the right hand side counts the number of such paths whose first step below the x-axis is just after step 2(i−1). Now the first 2(i−1) steps of any such path determine a Dyck path of length 2(i − 1). So there are \binom{2(i−1)}{i−1}/i possibilities for a such path to pass the point (2(i − 1), 0) and come to the point (2i − 1, −1) with the (1, −1) step. We multiply this number with \binom{2(m−i)+1}{m−i} which counts the number of all lattice paths from (2i − 1, −1) to (2m, −2) with steps (1, 1) and (1, −1). Thus, the right hand side counts the same paths as the left hand side.

This completes the case when n is odd and thereby the proof.

Example 2. For n = 4 there are indeed \binom{4}{2} = 6 permutations avoiding class 7. In the table below we show these permutations and legal sequences that correspond to them.

Permutation Corresponding legal sequence
4321  0000
3421  001
4231  01
4312  100
3412  101
2413  11

Theorem 2. For class 6 we have

A(n) = \{ \begin{matrix}2C_{k}, & if n = 2k + 1, \\ C_{k} + C_{k−1}, & if n = 2k, \end{matrix}

where C_{k} is the k-th Catalan number.

Proof. We consider n empty slots. If we fill the slots successively with the letters 1, 2, …, n then we always have one or two possibilities, namely, either

0) we place the current number in the rightmost empty slot, or

1) we place it in the second empty slot left of the leftmost non-empty slot.

Observe that we can use option 0), except in the first step, only if there is a non-empty slot to the left of the rightmost empty slot. This is a crucial difference between classes 6 and 7.

As in the proof of Theorem 1 we can consider the critical slots as well as (0,1)- sequences that appear in the obvious way (we have always one or two possibilities until we reach a critical slot and uniquely place all remaining numbers). After that we can associate the (0,1)-sequences with Dyck paths and apply the formula for the number of Dyck paths.

The number of legal sequences that correspond to the permutations avoiding class 6, whose rightmost letter is 1, is equal to

\frac{1}{⌊(n − 1)/2⌋ + 1}\binom{2 · ⌊(n − 1)/2⌋}{⌊(n − 1)/2⌋}.

The number of legal sequences that correspond to the permutations avoiding class 6, with the second letter from the right equals 1, is equal to

\frac{1}{⌊n/2⌋ + 1}\binom{2 · ⌊n/2⌋}{⌊n/2⌋}.

From these facts we have that

A(n) = \frac{1}{⌊n/2⌋ + 1}\binom{2 · ⌊n/2⌋}{⌊n/2⌋} + \frac{1}{⌊(n − 1)/2⌋ + 1}\binom{2 · ⌊(n − 1)/2⌋}{⌊(n − 1)/2⌋}.

Substituting n by 2k + 1 and 2k, respectively, completes the proof.

For class 8, 1 must be either in the rightmost position or in the second position from the right. It is easy to see that the letters to the left of 1 must be in decreasing order. So there are n ways to choose the rightmost element of a permutation and all other elements can be placed uniquely, so there are n permutations avoiding 8.

For class 9, if 1 is in the rightmost position then we must place all other letters in decreasing order, so in this case we have the permutation π = n(n − 1) … 21 that avoids class 9.

Assume that 1 is not in the rightmost position. The letters to the left of 1 must be in decreasing order. On the other hand it is easy to see that the letters to the right of 1 must be in increasing order (the set of such elements is nonempty). But 2 can not be to the left of 1 since in this case we obviously have an occurrence of a 213-pattern in the permutation that involves the letters 1 and 2. So 2 is immediately right of 1. Thus, to determine a permutation in class 9 is equivalent to partitioning the letters {3, 4, …, n} into two blocks. There are 2^{n−2} ways of doing it. One of the blocks is all elements of a permutation to the right of 12, and the other one is all elements to the left of 12. So there are 1 + 2^{n−2} permutations avoiding class 9.

Let us consider class 10. We explain how to get a recurrence relation for A(n) in this case.

It is easy to see that 1 is either in the rightmost position or in the second position from the right. In the first case there are A(n − 1) permutations that avoid 10. In the second case we can place the letter 2 either in the position immediately left of 1 or in the second position left of 1.

In the first of these cases we choose from the remaining (n − 2) letters a candidate for the rightmost position. One can do this in (n − 2) ways. Then we multiply this by A(n − 3) since three of rightmost positions do not affect to placement of all other letters in a permutation.

So we need to consider the case when 2 is in the second position left of 1. In general, we need to consider the case when the letters 1, 2, …, i have been already placed in such way that 2i rightmost positions are alternatingly empty and non-empty, the rightmost position is empty, and these i letters are in decreasing order from the left to the right. If we place (i + 1) immediately left of the leftmost non-empty position then we choose i elements from the remaining (n−i−1) elements in order to fill in i of rightmost empty positions. We observe that we must fill in the chosen elements in increasing order from the left to the right, otherwise we get an occurrence of a 312-pattern that is prohibited. Then we multiply this by A(n − 2i − 1) because in this case the (2i + 1) rightmost letters do not affect the placement of the other letters in the permutation. So we need to consider the case when (i + 1) is in the second position left of i and so on.

So we have

A(n) = ∑_{i} \binom{n − i − 1}{i}A(n − 2i − 1) + ((n + 1) mod 2).

The last term appears because if n is odd we have to consider the permutation

π = \frac{n + 1}{2} \frac{n − 1}{2} \frac{n + 3}{2} \frac{n − 3}{2} … 2(n − 1)1n,

which avoids 10 and which is not counted in the sum.

As initial conditions one can take A(0) = 1, A(1) = 1.

Theorem 3. For class 11 we have A(n) = (n − 1)!! + (n − 2)!!.

Proof. Since the patterns 123 and 321 can not occur in the permutations avoiding class 11, such permutations are alternating or reverse alternating, that is, of the form a_{1} > a_{2} < a_{3} > ⋯ or a_{1} < a_{2} > a_{3} < ⋯, with one more restriction. One can easily see that 1 is either in the rightmost position or next to this position, for otherwise we have an occurrence of a 123- or 132-pattern. If we go from the right to the left starting from 1 and jumping over one element then we get an increasing sequence of letters because otherwise we have an occurrence of the pattern 132.

Let P_{1}(n) be the number of permutations having 1 in the rightmost position and let P_{2}(n) be the number of permutations having 1 in the next to the rightmost position. Then obviously

A(n) = P_{1}(n) + P_{2}(n).

It is easy to see that

\begin{matrix}P_{1}(n) = P_{2}(n − 1), \\ P_{2}(n) = (n − 1)P_{2}(n − 2) \end{matrix}

whence P_{1}(n) = (n − 2)!! and P_{2}(n) = (n − 1)!!.

Class 16 is a classically studied object. Permutations that avoid 16 are the alternating and the reverse alternating permutations. It is well known that the exponential generating function for the number of such permutations is 2(tan x + sec x)^{2}. The initial values for A(n) are 1, 2, 4, 10, 32, 122, 544, 2770, …

For the result on class 17 we refer the reader to Porism 10 in [5].

Finally, for class 18 we can observe that to the left of 1 in such a permutation we must have a decreasing subword and to the right of 1 we must have an increasing subword, since otherwise we have either a 132- or a 231-pattern. Thus we can choose the elements to the right of 1 from the set {2, 3, …, n} in 2^{n−1} ways and then arrange uniquely the right hand side and the left hand side (elements of a permutation to the left of 1). So there are 2^{n−1} permutations that avoid class 18.

[1] E. Babson, E. Steingrímsson: Generalized permutation patterns and a classification of the Mahonian statistics, Sém. Lothar. Combin. 44 (2000), Art. B44b, 18 pp.

[2] M. Bóna: Exact enumeration of 1342-avoiding permutations: a close link with labeled trees and planar maps, J. Combin. Theory Ser. A 80 (1997), no. 2, 257–272.

[3] M. Bóna: Permutations avoiding certain patterns: the case of length 4 and some generalisations, Discrete Math. 175 (1997), no. 1–3, 55–67.

[4] M. Bóna: Permutations with one or two 132-subsequences, Discrete Math. 181 (1998), no. 1–3, 267–274.

[5] A. Claesson: Generalised Pattern Avoidance, European J. Combin. 22 (2001), no. 7, 961–971.

[6] S. Elizalde and M. Noy: Enumeration of Subwords in Permutations, Proceedings of FPSAC 2001.

[7] M. Klazar: Counting pattern-free set partitions. I. A generalisation of Stirling numbers of the second kind, European J. Combinatorics 21 (2000), no. 3, 367–378.

[8] J. Noonan, D. Zeilberger: The enumeration of permutations with a prescribed number of ”forbidden” patterns, Adv. in Appl. Math. 17 (1996), no. 4, 381–407.

[9] N. J. A. Sloane and S. Plouffe. The Encyclopedia of Integer Sequences, Academic Press, (1995) http://www.research.att.com/∼njas/sequences/.

[10] R. P. Stanley: Enumerative Combinatorics, Vol. 1, Cambridge University Press, (1997).

[11] F. W. Schmidt, R. Simion: Restricted permutations, European J. Combin. 6 (1985), no. 4, 383–406.

Paper II

Generalized pattern avoidance with additional restrictions

Generalized Pattern Avoidance with Additional Restrictions

Sergey Kitaev

E-mail: kitaev@math.chalmers.se Matematik, Chalmers tekniska högskola och Göteborgs universitet, S-412 96 Göteborg, Sweden

Abstract

Babson and Steingrímsson introduced generalized permutation patterns that allow the requirement that two adjacent letters in a pattern must be adjacent in the permutation. We consider n-permutations that avoid the generalized pattern 1 − 32 and whose k rightmost letters form an increasing subword. The number of such permutations is a linear combination of Bell numbers. We find a bijection between these permutations and all partitions of an (n−1)-element set with one subset marked that satisfy certain additional conditions. Also we find the e.g.f. for the number of permutations that avoid a generalized 3-pattern with no dashes and whose k leftmost or k rightmost letters form either an increasing or decreasing subword. Moreover, we find a bijection between n-permutations that avoid the pattern 132 and begin with the pattern 12 and increasing rooted trimmed trees with n + 1 nodes.

2.1 Introduction and Background

All permutations in this paper are written as words π = a_{1}a_{2} ⋯ a_{n}, where the a_{i} consist of all the integers 1, 2, …, n.

A pattern is a word on some alphabet of letters, where some of the letters may be separated by dashes. In our notation, the classical permutation patterns, first studied systematically by Simion and Schmidt [SchSim], are of the form p = 1 − 3 − 2, the dashes indicating that the letters in a permutation corresponding to an occurrence of p do not have to be adjacent. In the classical case, an occurrence of a pattern p in a permutation π is a subsequence in π (of the same length as the length of p) whose letters are in the same relative order as those in p. For example, the permutation 264153 has only one occurrence of the pattern 1−2−3, namely the subsequence 245. Note that a classical pattern should, in our notation, have dashes at the beginning and end. Since most of the patterns considered in this paper satisfy this, we suppress these dashes from the notation.

In [BabStein] Babson and Steingrímsson introduced generalized permutation patterns (GPs) where two adjacent letters in a pattern may be required to be adjacent in the permutation. Such an adjacency requirement is indicated by the absence of a dash between the corresponding letters in the pattern. Thus, a pattern with no dashes corresponds to a contiguous subword anywhere in a permutation. For example, the permutation π = 516423 has only one occurrence of the pattern 2-31, namely the subword 564, but the pattern 2-3-1 occurs also in the subwords 562 and 563. The motivation for introducing these patterns in [BabStein] was the study of Mahonian statistics.

A number of interesting results on GPs were obtained by Claesson [Claes]. Relations to several well studied combinatorial structures, such as set partitions, Dyck paths, Motzkin paths and involutions, were shown there. In [Kit1] the present author investigated simultaneous avoidance of two or more 3-letter GPs with no dashes. Also there is a number of works concerning GPs by Mansour (see for example [Mans1, Mans2]).

In this paper we consider avoidance some generalized 3-patterns with additional restrictions. The restrictions consist of demanding that a permutation begin or end with the pattern 12 … k or the pattern k(k − 1) … 1.

It turns out that the number of permutations that avoid the pattern 1 − 32 and end with the pattern 12 … k is a linear combination of the Bell numbers. The n-th Bell number is the number of ways a set of n elements can be partitioned into nonempty subsets. We find a bijection between these permutations and all partitions of an (n − 1)-element set with one subset marked that satisfy certain special conditions. In particular, in Theorem 1, we investigate the case k = 2. We get that the total number of partitions of an (n−1)-element set with one part marked, is equal to the number of (1 − 32)-avoiding n-permutations that end with a 12-pattern. Lemma 1 gives us an identity involving the Bell numbers and the Stirling numbers of the second kind, which seems to be new. In Theorem 3 we prove that the number of 132-avoiding n-permutations that begin with the pattern 12 is equal to the number of increasing rooted trimmed trees with n + 1 nodes.

In Sections 4 – 7, we give a complete description (in terms of exponential generating functions (e.g.f.)) for the number of permutations that avoid a pattern of the form xyz and begin or end with the pattern 12 … k or the pattern k(k − 1) … 1. We record all the results concerning these e.g.f. in the table in Section 7. The case k = 1 is equivalent to the absence of the additional restriction. This case was considered in [ElizNoy] and [Kit2].

We observe that avoidance of some pattern with the additional restrictions described above, in fact is equivalent to simultaneous avoidance of several patterns. For example, beginning with the pattern 12 is equivalent to the avoidance of the pattern [21) in the Babson-Steingrímsson notation. Thus avoidance of the pattern 132 and beginning with the pattern 12 is equivalent to simultaneous avoidance of the patterns 132 and [21). Also, ending with the pattern 123 is equivalent to simultaneously avoiding the patterns (132], (213], (231], (312] and (321].

2.2 Set partitions and pattern avoidance

We recall some basic definitions.

A partition of a set S is a family, π = {A_{1}, A_{2}, …, A_{k}}, of pairwise disjoint non-empty subsets of S such that S = ∪_{i}A_{i}. The total number of partitions of an n-element set is called a Bell number and is denoted B_{n}.

The Stirling number of the second kind S(n, k) is the number of ways a set with n elements can be partitioned into k disjoint, non-empty subsets.

Proposition 1. Let P (n, k) be the number of n-permutations that avoid the pattern 1 − 32 and end with the pattern 12 … k. Then

P (n, k) = ∑_{i=0}^{n−k} \binom{n − 1}{i}B_{i}.

Proof. Suppose a permutation π = σ1τ avoids the pattern 1 − 32 and ends with the pattern 12 … k. The letters of τ must be in increasing order, since otherwise we have an occurrence of the pattern 1 − 32 involving 1. Also, σ must avoid 1 − 32. If |σ| = i then obviously 0 ≤ i ≤ n − k and we can choose the letters of σ in \binom{n−1}{i} ways. By [Claes, Proposition 5], the number of i-permutations that avoid the pattern 1 − 32 is equal to B_{i}, hence there are B_{i} ways to form σ.

Lemma 1. We have ∑_{i=0}^{n−1} \binom{n}{i}B_{i} = ∑_{i=0}^{n} i · S(n, i).

Proof. The identity can be proved from the recurrences for S(n, k) and B_{n}, but we give a combinatorial proof.

The left-hand side of the identity is the number of ways to choose i elements from an n-element set, and then to make all possible partitions of the chosen elements.

The right-hand side is the number of ways to partition a set with n elements into i disjoint non-empty subsets (i = 1, 2, …, n) and mark one of the subsets. For example if n = 4 then \overline{1} − 24 − 3 and 1 − \overline{24} − 3 are two different partitions, where the marked subset is overlined.

A bijective correspondence between these combinatorial interpretations is given by the following: For the left-hand side, after partitioning the i chosen elements, let the remaining n − i elements form the marked subset in the partition.

The formula for P (n, k) in Proposition 1, applied to k = 2, and Lemma 1 now give the following theorem:

Theorem 1. The total number of partitions of an (n − 1)-element set with one part marked, is equal to the number of (1 − 32)-avoiding n-permutations that end with the pattern 12.

We give now a direct combinatorial proof of this theorem.

Proof. Suppose P = S_{1} − S_{2} − ⋯ − S_{k} is a partition of an (n − 1)-element set into k subsets with one marked subset and T_{i} is the word that consists of all elements of S_{i} in increasing order. We may, without loss of generality, assume that min(S_{i}) < min(S_{j}) if i > j. In particular, 1 ∈ S_{k}. There are two cases possible:

1) S_{k} = {1} (S_{k} is not marked set);

2) Either S_{k} = \overline{1} or 1 ∈ S_{k} and |S_{k}| ≥ 2.

In the first case, to a partition P = S_{1} − S_{2} − ⋯ − \overline{S_{i}} − ⋯ − S_{k−1} − 1 we associate the permutation π(P) = nT_{1}T_{2} … T_{i−1}T_{i+1} … T_{k−1}1T_{i}, which is (1 − 32)-avoiding and ends with the pattern 12 since S_{i} ≠ ∅. For example 4 − \overline{23} − 1 ↦ 54123.

In the second case we adjoin n to a marked subset, and then consider the permutation π(P) = T_{1}T_{2} … T_{k}. This permutation is obviously (1−32)-avoiding since min(S_{i}) < min(S_{j}) if i > j and the letters in T_{i} are in increasing order. Also it ends with the pattern 12. For example 5 − \overline{34} − 12 ↦ 534612, and 5 − 234 − \overline{1} ↦ 523416.

Obviously in both cases we have an injection.

Now it is easy to see that the correspondence above is a surjection as well. Indeed, for any (1 − 32)-avoiding permutation π that ends with the pattern 12, we can check if π begins with n or not and according to this we have either case 1) or 2). In the first case, we remove n, then read π from left to right and consider all maximal increasing intervals. The elements of each such interval correspond to some subset, and we let all the letters to the right of 1 constitute the marked subset. In the second case, we divide π into maximal increasing intervals, and let the letters of each interval correspond to a subset. Then we let the interval containing n be the marked subset. Thus we have a surjection. So the correspondence is a bijection and the theorem is proved.

The following theorem generalizes Theorem 1.

Theorem 2. Let P = S_{1} − S_{2} − ⋯ − S_{ℓ} be a partition of {1, 2, …, n − 1} into ℓ subsets with subset S_{i} marked. We assume also that 1 ∈ S_{ℓ}. Then P (n, k) counts all possible marked partitions of {1, 2, …, n−1} that satisfy the following conditions:

1) if i = ℓ (the last subset is marked) then |S_{ℓ}| ≥ k − 1;

2) if i ≠ ℓ and |S_{ℓ}| ≠ 1 then |S_{ℓ}| ≥ k;

3) if i ≠ ℓ and |S_{ℓ}| = 1 then |S_{i}| ≥ k − 1.

Proof. A proof of this theorem is similar to the proof of Theorem 1. We assume that min(S_{i}) < min(S_{j}) for i > j and consider three cases.

If a partition satisfies 1), that is P = S_{1} −S_{2} −⋯−\overline{S_{ℓ}} and |S_{ℓ}| ≥ k −1, then adjoining n to S_{ℓ} guarantees that the permutation π(P) = T_{1}T_{2} … T_{ℓ}, which is (1 − 32)-avoiding, ends with k letters in increasing order.

In case 2), we adjoin n to the marked subset and consider π(P) = T_{1}T_{2} … T_{ℓ}. This permutation avoids the pattern 1 − 32 and ends with the pattern 12 … k since |S_{ℓ}| ≥ k.

In case 3), to a partition P = S_{1}−S_{2}−⋯−\overline{S_{i}}−⋯−S_{k−1}−1 we associate the permutation π(P) = nT_{1}T_{2} … T_{i−1}T_{i+1} … T_{k−1}1T_{i}, which is (1 − 32)-avoiding and ends with at least k letters in increasing order since |S_{i}| ≥ k − 1.

That this correspondence is a bijection can be shown in a way similar to the proof of Theorem 1.

2.3 Increasing rooted trimmed trees and pattern avoidance

In an increasing rooted tree, nodes are numbered and the numbers increase as we move away from the root. A trimmed tree is a tree where no node has a single leaf as a child (every leaf has a sibling).

Theorem 3. Let A_{n} denote the set of all n-permutations that avoid the pattern 132 and begin with the pattern 12. The number of permutations in A_{n} is equal to the number of increasing rooted trimmed trees (IRTTs) with n + 1 nodes.

Proof. A right-to-left minimum of a permutation π is an element a_{i} such that a_{i} < a_{j} for every j > i.

We describe a bijective correspondence F between the permutations in A_{n} and IRTTs with n + 1 nodes.

Suppose π ∈ A_{n} and π = P_{0}a_{0}P_{1}a_{1} … P_{k}a_{k}, where a_{i} are the right-to-left minima of π and P_{j} are (possibly empty) subwords of π. We construct a IRTT T = F (π) with n + 1 nodes as follows. The root of T is labelled by 0 and a_{0}, a_{1}, …, a_{k} are the labels of the root’s children if we read them from left to right. Then we let the right-to-left minima of P_{i} be the labels of the children of a_{i} and so on. It is easy to see that, since π avoids 132 and begins with 12, T avoids limbs of length 2. Also, T is an increasing rooted tree and hence T is a IRTT. For instance,

F (2 9 10 5 3 1 11 13 14 8 12 7 4 6) = [figure: 0; 1; 4; 6; 2; 3; 7; 5; 8; 12; 9; 10; 11; 13; 14]

Obviously, the correspondence F is an injection.

To see, that F is a surjection, we show how to construct the permutation π ∈ A_{n} that corresponds to a given IRTT T. The main rule is the following: If a_{i} and a_{j} are siblings, and a_{i} < a_{j}, then the labels of the nodes of the subtree below a_{j}, are all the letters in π between a_{i} and a_{j}, that is, a_{i+1}, a_{i+2}, …, a_{j−1}. If a_{i} is a single child, then the labels of the nodes of the subtree below a_{i} appear immediately left of a_{i} in π. That is, if there are k nodes in the subtree below a_{i} then the k corresponding labels form the subword a_{i−k}a_{i−k+1} … a_{i−1}. We now start from the first level of T, which consists of the root’s children, and apply this rule. After that we consider the second level and so on. The fact that T is a IRTT ensures that π avoids the pattern 132 and begins with the pattern 12. Thus, F is a bijection.

2.4 Avoiding 132 and beginning with 12 … k or k(k − 1) … 1

Let E_{q}^{p}(x) denote the e.g.f. for the number of permutations that avoid the pattern q and begin with the pattern p.

If k = 1, then there is no additional restriction, that is, we are dealing with avoidance of the pattern 132 (no dashes) and thus

E_{132}^{1}(x) = \frac{1}{1 − ∫_{0}^{x} e^{−t^{2}/2} dt},  (2.1)

since this result is a special case of [ElizNoy, Theorem 4.1] and [Kit2, Theorem 12].

Theorem 4. We have

E_{132}^{12}(x) = \frac{e^{−x^{2}/2}}{1 − ∫_{0}^{x} e^{−t^{2}/2} dt} − x − 1,

and for k ≥ 3

E_{132}^{12...k}(x) = E_{132}^{1}(x) ∫_{0}^{x} ∫_{0}^{t_{k−2}} ⋯ ∫_{0}^{t_{2}} (e^{−t_{1}^{2}/2} − \frac{t_{1} + 1}{E_{132}^{1}(t_{1})}) dt_{1}dt_{2} ⋯ dt_{k−2}.

Proof. Let E_{n,k} denote the number of n-permutations that avoid the pattern 132 and begin with an increasing subword of length k > 0. Let π be such a permutation of length n + 1. Also, suppose k ≠ 2. If π = σ1τ then either σ = ϵ or σ ≠ ϵ where ϵ denotes the empty word. If σ = ϵ then τ must avoid 132 and begin with an increasing subword of length k − 1. Otherwise σ must avoid 132 and begin with an increasing subword of length k, whereas τ must begin with the pattern 12, or be a single letter (there are n ways to choose this letter), or be ϵ. This leads to the following:

E_{n+1,k} = E_{n,k−1} + ∑_{i≥0} \binom{n}{i}E_{i,k}E_{n−i,2} + nE_{n−1,k} + E_{n,k}.  (2.2)

Multiplying both sides of the equality with x^{n}/n! and summing over all n we get the following differential equation

\frac{d}{dx}E_{132}^{12...k}(x) = (E_{132}^{12}(x) + x + 1)E_{132}^{12...k}(x) + E_{132}^{12...(k−1)}(x),  (2.3)

with the initial conditions E_{132}^{12...k}(0) = 0 for k ≥ 3.

Observe that equality (2.3) is not valid for k = 2. Indeed, if k = 2, then it is incorrect to add the term E_{n,k−1} = E_{n,1} in (2.2), since this term counts the number of permutations π = 1τ with the only restriction for τ that it must avoid 132. The absence of an additional restriction for τ means that the 3 leftmost letters of π could form the pattern 132. However, we can use (2.3) to find E_{132}^{12}(x) by letting k equal 1. In this case we have

\frac{d}{dx}E_{132}^{1}(x) = (E_{132}^{12}(x) + x + 1)E_{132}^{1}(x),

which gives

E_{132}^{12}(x) = \frac{e^{−x^{2}/2}}{1 − ∫_{0}^{x} e^{−t^{2}/2} dt} − x − 1.  (2.4)

For the case k ≥ 3, it is convenient to write E_{132}^{12}(x) in the form

E_{132}^{12}(x) = B′(x) − x − 1,

where B(x) = − ln(1 − ∫_{0}^{x} e^{−t^{2}/2} dt) and thus B′(x) = exp(B(x) − \frac{x^{2}}{2} ). So (2.3) is equivalent to the differential equation

\frac{d}{dx}E_{132}^{12...k}(x) = B′(x)E_{132}^{12...k}(x) + E_{132}^{12...(k−1)}(x)

which has the solution

E_{132}^{12...k}(x) = e^{B(x)} ∫_{0}^{x} e^{−B(t)}E_{132}^{12...(k−1)}(t) dt =

E_{132}^{1}(x) ∫_{0}^{x} \frac{E_{132}^{12...(k−1)}(t)}{E_{132}^{1}(t)}dt =

E_{132}^{1}(x) ∫_{0}^{x} ∫_{0}^{t_{2}} \frac{E_{132}^{12...(k−2)}(t_{1})}{E_{132}^{1}(t_{1})}dt_{1}dt_{2} =

E_{132}^{1}(x) ∫_{0}^{x} ∫_{0}^{t_{k−2}} ⋯ ∫_{0}^{t_{2}} \frac{E_{132}^{12}(t_{1})}{E_{132}^{1}(t_{1})}dt_{1}dt_{2} ⋯ dt_{k−2}.

Using (2.1) and (2.4) we now get the desired result.

Using the formula for E_{132}^{12...k}(x) in Theorem 4 one can derive, in particular, that

E_{132}^{123}(x) = −\frac{1}{2} − x − \frac{x^{2}}{2} + \frac{(1 + \frac{x}{2}) e^{−x^{2}/2} − \frac{1}{2}}{1 − ∫_{0}^{x} e^{−t^{2}/2} dt} .

Theorem 5. For k ≥ 2

E_{132}^{k(k−1)...1}(x) = \frac{E_{132}^{1}(x)}{(k − 1)!} ∫_{0}^{x} t^{k−1}e^{−t^{2}/2} dt.

Proof. We proceed as in the proof of Theorem 4.

Let R_{n,k} denote the number of n-permutations that avoid the pattern 132 and begin with a decreasing subword of length k > 1 and let π be such a permutation of length n + 1. Suppose also that π = σ1τ. If τ = ϵ then, obviously, there are R_{n,k} ways to choose σ. If |τ| = 1, that is, 1 is in the second position from the right in π, then there are n ways to choose the rightmost letter in π and we multiply this by R_{k,n−1}, which is the number of ways to choose σ. If |τ| > 1 then τ must begin with the pattern 12, otherwise the letter 1 and the two leftmost letters of τ form the pattern 132, which is forbidden. So, in this case there are ∑_{i≥0} \binom{n}{i}R_{i,k}E_{n−i,2} such permutations with the right properties, where i indicates the length of σ and E_{n−i,2} is defined in the proof of Theorem 4. In the last formula, of course, R_{i,k} = 0 if i < k. Finally we have to consider the situation when 1 is in the k-th position. In this case we can choose the letters of σ in \binom{n}{k−1} ways, write them in decreasing order and then choose τ in E_{n−k+1,2} ways. Thus

R_{n+1,k} = R_{n,k} + nR_{n−1,k} + ∑_{i≥0} \binom{n}{i}R_{i,k}E_{n−i,2} + \binom{n}{k − 1}E_{n−k+1,2}. (2.5)

We observe that (2.5) is not valid for n = k − 1 and n = k. Indeed, if 1 is in the k-th position in these cases, the term \binom{n}{k−1}E_{n−k+1,2}, which counts the number of such permutations, is zero, whereas there is one “good” (n + 1)- permutation in the case n = k − 1 and n “good” (n + 1)-permutations in case n = k. Multiplying both sides of the equality with x^{n}/n!, summing over n and using the observation above (which gives the term x^{k−1}/(k − 1)! + kx^{k}/k! in the right-hand side of Equalion (2.6)), we get

\frac{d}{dx}E_{132}^{k(k−1)...1}(x) = (E_{132}^{12}(x) + x + 1) (E_{132}^{k(k−1)...1}(x) + \frac{x^{k−1}}{(k − 1)!}) , (2.6)

with the initial condition E_{k(k−1)...1}^{132}(0) = 0. We solve the equation in the way proposed in Theorem 4 and get

E_{132}^{k(k−1)...1}(x) = \frac{E_{132}^{1}(x)}{(k − 1)!} ∫_{0}^{x} \frac{(E_{132}^{12}(t) + t + 1)t^{k−1}}{E_{132}^{1}(t)} dt = \frac{E_{132}^{1}(x)}{(k − 1)!} ∫_{0}^{x} t^{k−1}e^{−t^{2}/2} dt.

For instance,

E_{132}^{21}(x) = \frac{1 − e^{−x^{2}/2}}{1 − ∫_{0}^{x} e^{−t^{2}/2} dt} and E_{132}^{321}(x) = \frac{1}{2} (−1 + \frac{1 − xe^{−x^{2}/2}}{1 − ∫_{0}^{x} e^{−t^{2}/2} dt}) .

Moreover, the integral ∫_{0}^{x} t^{k−1}e^{−t^{2}/2} dt from the formula for E_{132}^{k(k−1)...1}(x) can be solved to show that E_{132}^{k(k−1)...1}(x) equals

\frac{(k/2 − 1)!2^{k/2−1}}{(k − 1)!(1 − \sqrt{\frac{π}{2}} erf(x))} (1 − e^{−x^{2}/2} ∑_{i=0}^{k/2−1} \frac{x^{2i}}{2^{i}i!}) ,

if k is even, and

\frac{1}{(k − 1)!!} (−1 + \frac{1}{1 − \sqrt{\frac{π}{2}} erf(x)} (1 − e^{−x^{2}/2} ∑_{i=0}^{(k−3)/2} \frac{x^{2i+1}}{(2i + 1)!!}))

if k is odd.

In the formula above, erf(x) is the error function:

erf(x) = \frac{2}{\sqrt{π}} ∫_{0}^{x} e^{−t^{2}} dt.

2.5 Avoiding 123 and beginning with k(k−1) … 1 or 12 … k

If k = 1, we have no additional restrictions and, according to [ElizNoy, Theorem 4.1],

E_{123}^{1}(x) = \frac{\sqrt{3}}{2} \frac{e^{x/2}}{cos (\frac{\sqrt{3}}{2}x + \frac{π}{6} )}.

Theorem 6. For k ≥ 2

E_{123}^{k(k−1)...1}(x) = \frac{e^{x/2}}{(k − 1)! cos (\frac{\sqrt{3}}{2}x + \frac{π}{6} )} ∫_{0}^{x} e^{−t/2}t^{k−1} sin (\frac{\sqrt{3}}{2}t + \frac{π}{3} ) dt.

In particular,

E_{123}^{21}(x) = \frac{\sqrt{3}}{2} tan (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) − x − \frac{1}{2}.

Proof. Let P_{n,k} denote the number of n-permutations that avoid the pattern 123 and begin with a decreasing subword of length k. We observe that we can use arguments similar to the proof of Theorem 5 to get the recurrence formula for P_{n,k}. Indeed, we only need to write the letter P instead of R and E in (2.5):

P_{n+1,k} = P_{n,k} + nP_{n−1,k} + ∑_{i≥0} \binom{n}{i}P_{i,k}P_{n−i,2} + \binom{n}{k − 1}P_{n−k+1,2}. (2.7)

This formula is valid for k > 1. Multiplying both sides of the equality with x^{n}/n!, summing over n and reasoning as in the proof of Theorem 5, we get:

\frac{d}{dx}E_{123}^{k(k−1)...1}(x) = (E_{123}^{21}(x) + x + 1) (E_{123}^{k(k−1)...1}(x) + \frac{x^{k−1}}{(k − 1)!}) , (2.8)

with the initial condition E_{123}^{k(k−1)...1}(0) = 0. To solve (2.8), we need to know E_{123}^{21}(x). To find it, we consider the case k = 1. In this case we have almost the same recurrence as we have in (2.7), but we must remove the last term in the right-hand side:

P_{n+1,1} = P_{n,1} + nP_{n−1,1} + ∑_{i≥0} \binom{n}{i}P_{i,k}P_{n−i,2}.

After multiplying both sides of the last equality with x^{n}/n! and summing over n, we have

\frac{d}{dx}E_{123}^{1}(x) = (E_{123}^{21}(x) + x + 1)E_{123}^{1}(x),

and thus

E_{123}^{21}(x) = \frac{\frac{d}{dx}E_{123}^{1}(x)}{P_{1}(x)} − x − 1 = \frac{\sqrt{3}}{2} tan (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) − x − \frac{1}{2}.

Now we solve (2.8) in the way we solved Equalion (2.6) and get

E_{123}^{k(k−1)...1}(x) = \frac{e^{x/2}}{(k − 1)! cos (\frac{\sqrt{3}}{2}x + \frac{π}{6} )} ∫_{0}^{x} e^{−t/2}t^{k−1} sin (\frac{\sqrt{3}}{2}t + \frac{π}{3} ) dt.

The following theorem is straightforward to prove.

Theorem 7. We have E_{123}^{12...k}(x) = 0 for k ≥ 3 and

E_{123}^{12}(x) = E_{123}^{1}(x) − E_{123}^{21}(x) = \frac{\sqrt{3}}{2} \frac{e^{x/2}}{cos (\frac{\sqrt{3}}{2}x + \frac{π}{6} )} − \frac{1}{2} − \frac{\sqrt{3}}{2} tan (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) .

2.6 Avoiding 213 and beginning with k(k−1) … 1 or 12 … k

If k = 1, then by [ElizNoy, Theorem 4.1] or [Kit2, Theorem 12]

E_{213}^{1}(x) = \frac{1}{1 − ∫_{0}^{x} e^{−t^{2}/2} dt}.

E_{213}^{12...k}(x) = ∫_{0}^{x} ∫_{0}^{t} \frac{s^{k−2}e^{T (t)−T (s)}}{(k − 2)!(1 − ∫_{0}^{t} e^{−m^{2}/2}dm)} dsdt,

where T (x) = −x^{2}/2 + ∫_{0}^{x} \frac{e^{−t^{2}/2}}{1−∫_{0}^{t} e^{−s^{2}/2}ds} dt.

Proof. Let A_{n} denote the number of n-permutations that avoid the pattern 213 and let B_{n} denote the number of n-permutations that avoid 213 and begin with the pattern 12 … k. Let C_{n} denote the number of n-permutation that avoid 213, begin with the pattern 12 … k and end with the pattern 12 and let D_{n} denote the number of n-permutations that avoid 213 and end with the pattern 12. Also, let A(x), B(x), C(x) and D(x) denote the e.g.f. for the numbers A_{n}, B_{n}, C_{n} and D_{n} respectively.

We observe, that

D(x) = E_{132}^{12}(x) = e^{−x^{2}/2}/(1 − ∫_{0}^{x} e^{−t^{2}/2}dt) − x − 1,

since, by using the reverse and complement discussed in the next section, there are as many permutations that avoid the pattern 213 and end with the pattern 12 as those that avoid the pattern 132 and begin with the pattern 12. Also, A(x) = E_{312}^{1}(x) and B(x) = E_{213}^{12...k}(x).

Suppose now that π = σ(n + 1)τ is an (n + 1)-permutation that avoids the pattern 213 and begins with the pattern 12 … k. So σ must avoid 213, begin with 12 … k, but also end with the pattern 12 since otherwise the two rightmost letters of σ together with the letter (n + 1) form the pattern 213, which is forbidden. For τ, there is only one restriction — avoidance of 213. So if |σ| = i then we can choose the letters of σ in \binom{n}{i} ways, which gives ∑_{i≥0} \binom{n}{i}C_{i}A_{i} permutations that avoid the pattern 213 and begin with the pattern 12 … k. Moreover, it is possible for (n + 1) to be in the kth position, in which case we choose the letters of σ in \binom{n}{k−1} ways and arrange them in increasing order. Thus

B_{n+1} = ∑_{i≥0} \binom{n}{i}C_{i}A_{n−i} + \binom{n}{k − 1}A_{n−(k−1)}.

Multiplying both sides of this equality with x^{n}/n! and summing over n, we get

B′(x) = (C(x) + \frac{x^{k−1}}{(k − 1)!}) A(x),  (2.9)

with the initial condition B(0) = 0.

To solve (2.9) we need to find C(x). Let π = σ(n + 1)τ be an (n + 1)- permutation that avoids the pattern 213, begins with the pattern 12 … k and ends with the pattern 12. Reasoning as above, σ must avoid the pattern 213, begin with the pattern 12 … k and end with the pattern 12, whereas τ must avoid 213 and end with the pattern 12. This gives ∑_{i≥0} \binom{n}{i}C_{i}D_{n−i} permutations counted by C_{n+1}. Also, the letter (n + 1) can be in the kth position, which gives \binom{n}{k−1}D_{n−(k−1)} permutations, and this letter can be in the (n + 1)st position, which gives C_{n} permutations that avoid the pattern 213, begin with the pattern 12 … k and end with the pattern 12. Also, if n + 1 = k and all the letters are arranged in increasing order, then (n + 1) is in the (n + 1)st position, but this permutation is not counted by C_{n} above. So

C_{n+1} = ∑_{i≥0} \binom{n}{i}C_{i}D_{n−i} + \binom{n}{k − 1}D_{n−(k−1)} + C_{n} + δ_{n,k−1},

where δ_{n,k} is the Kronecker delta, that is,

δ_{n,k} = \{ \begin{matrix}1, & if n = k, \\ 0, & else. \end{matrix}

Multiplying both sides of the equality with x^{n}/n! and summing over n, we get

C′(x) = (D(x) + 1)C(x) + (D(x) + 1)\frac{x^{k−1}}{(k − 1)!}.  (2.10)

To solve (2.10), it is convenient to introduce the function T (x) such that T′(x) = D(x) + 1. Thus

T (x) = x + ∫_{0}^{x} D(t)dt = −x^{2}/2 + ∫_{0}^{x} \frac{e^{−t^{2}/2}}{1 − ∫_{0}^{t} e^{−s^{2}/2}ds} dt,

and we need to solve the equation

C′(x) = T′(x)C(x) + T′(x)\frac{x^{k−1}}{(k − 1)!},

with C(0) = 0.

The solution to this equation is given by

C(x) = e^{T (x)} ∫_{0}^{x} e^{−T (t)}T′(t)\frac{t^{k−1}}{(k − 1)!}dt = −\frac{x^{k−1}}{(k − 1)!}+e^{T (x)} ∫_{0}^{x} e^{−T (t)} \frac{t^{k−2}}{(k − 2)!}dt.

Now we substitute C(x) into (2.9) to get the desired result.

Theorem 9. For k ≥ 2

E_{213}^{k(k−1)...1}(x) = −\frac{x^{k−1}}{(k − 1)!} + ∑_{n=0}^{k−2} ∫_{0}^{x} ∫_{0}^{t_{n}} ⋯ ∫_{0}^{t_{1}} \frac{C_{k−n}(t) + δ_{n,k−2}}{1 − ∫_{0}^{t} e^{−m^{2}/2}dm} dtdt_{1} ⋯ dt_{n},

where

C_{k}(x) = e^{T (x)} ∫_{0}^{x} ∫_{0}^{t_{k−2}} ⋯ ∫_{0}^{t_{1}} e^{−T (t)} (\frac{e^{−t^{2}/2}}{1 − ∫_{0}^{t} e^{−m^{2}/2}dm} − t − 1) dtdt_{1} ⋯ dt_{k−2},

with T (x) = −x^{2}/2 + ∫_{0}^{x} \frac{e^{−t^{2}/2}}{1−∫_{0}^{t} e^{−s^{2}/2}ds} dt.

Proof. Let A_{n} denote the number of n-permutations that avoid the pattern 213 and let B_{n,k} denote the number of n-permutations that avoid 213 and begin with the pattern k(k − 1) … 1 for k ≥ 2. Let C_{n,k} denote the number of npermutation that avoid 213, begin with k(k − 1) … 1 for k ≥ 2 and end with the pattern 12 and let D_{n} denote the number of n-permutations that avoid 213 and end with the pattern 12. Also, let A(x), B_{k}(x), C_{k}(x) and D(x) denote the e.g.f. for the numbers A_{n}, B_{n,k}, C_{n,k} and D_{n} respectively. In the proof of Theorem 8 it was shown that D(x) = e^{−x^{2}/2}/(1 − ∫_{0}^{x} e^{−t^{2}/2}dt) − x − 1 and A(x) = E_{312}^{1}(x). Moreover, B_{k}(x) = E_{213}^{k(k−1)...1}(x).

Suppose now that π = σ(n + 1)τ is an (n + 1)-permutation that avoids 213 and begins with the pattern k(k − 1) … 1. So σ must avoid 213, begin with k(k−1) … 1, but also end with the pattern 12 if |σ| ≥ 2, since otherwise the two rightmost letters of σ together with the letter (n+1) form the pattern 213 which is forbidden. For τ, there is only one restriction - avoidance of 213. So if |σ| = i then we can choose the letters of σ in \binom{n}{i} ways, which gives ∑_{i≥0} \binom{n}{i}C_{i,k}A_{i} permutations counted by B_{n+1,k}. Also, it is possible for (n + 1) to be the leftmost letter, in which case the remaining letters must form a n-permutation that avoids 213 and begins with the pattern (k − 1)(k − 2) … 1. Thus

B_{n+1,k} = ∑_{i≥0} \binom{n}{i}C_{i,k}A_{n−i} + B_{n,k−1}.  (2.11)

However, this formula is not valid when k = 2 and n = 0. Indeed, since B_{0,1} = A_{0} = 1, it follows from the formula that B_{1,2} = 1, which is not true, since B_{1,2} must be 0. So, in the right-hand side of (2.11), we need to subtract the term

γ_{n,k} = \{ \begin{matrix}1, & if n = 0 and k = 2, \\ 0, & else. \end{matrix}

Multiplying both sides of the obtained equality by x^{n}/n! and summing over n, we get, that for k ≥ 3

\frac{d}{dx}B_{k}(x) = C_{k}(x)A(x) + B_{k−1}(x),  (2.12)

with the initial condition B_{k}(0) = 0, and

\frac{d}{dx}B_{2}(x) = C_{2}(x)A(x) + B_{1}(x) − 1,  (2.13)

with the initial condition B_{2}(0) = 0.

The solution to differential equations (2.12) and (2.13) is given by

B_{k}(x) = −\frac{x^{k−1}}{(k − 1)!} + ∑_{n=0}^{k−2} ∫_{0}^{x} ∫_{0}^{t_{n}} ⋯ ∫_{0}^{t_{1}} \frac{C_{k−n}(t) + δ_{n,k−2}}{1 − ∫_{0}^{t} e^{−m^{2}/2}dm} dtdt_{1} ⋯ dt_{n}.

So, to prove the theorem, we only need to find C_{k}(x).

Suppose π = σ(n+1)τ be an (n+1)-permutation that avoids the pattern 213, begins with the pattern k(k − 1) … 1 and ends with the pattern 12. It is clear that σ must avoid 213, begin with the pattern k(k − 1) … 1 and end with the pattern 12, whereas τ must avoid 213 and end with the pattern 12. There are ∑_{i≥0} \binom{n}{i}C_{i,k}D_{n−i} permutations with these properties. Also, the letter (n + 1) can be in the leftmost position, which gives C_{n,k−1} permutations, and (n + 1) can be in the rightmost position, which gives C_{n,k} permutations, since in this case, two letters immediately to the left of (n + 1) cannot form a descent. So,

C_{n+1,k} = ∑_{i≥0} \binom{n}{i}C_{i,k}D_{n−i} + C_{n,k−1} + C_{n,k}.

Multiplying both sides of the equality with x^{n}/n! and summing over n, we get the following differential equation

C′_{k}(x) = (D(x) + 1)C_{k}(x) + C_{k−1}(x).  (2.14)

As when solving Equation (2.10), it is convenient to introduce the function T (x) such that T′(x) = D(x) + 1. Moreover, Equation (2.14) is similar to Equation (2.3) and we can solve it in the same way. Also we observe that from the definitions, C_{1}(t) = D(t), and thus

C_{k}(x) = e^{T (x)} ∫_{0}^{x} ∫_{0}^{t_{k−2}} ⋯ ∫_{0}^{t_{1}} e^{−T (t)}C_{1}(t)dtdt_{1} ⋯ dt_{k−2} =

e^{T (x)} ∫_{0}^{x} ∫_{0}^{t_{k−2}} ⋯ ∫_{0}^{t_{1}} e^{−T (t)} (\frac{e^{−t^{2}/2}}{1 − ∫_{0}^{t} e^{−m^{2}/2}dm} − t − 1) dtdt_{1} ⋯ dt_{k−2}.

2.7 Summarizing the results from sections 2.4, 2.5 and 2.6

We recall that the reverse R(π) of a permutation π = a_{1}a_{2} … a_{n} is the permutation a_{n}a_{n−1} … a_{1} and the complement C(π) is the permutation b_{1}b_{2} … b_{n} where b_{i} = n + 1 − a_{i}. Also, R ∘ C is the composition of R and C. We call these bijections of S_{n} to itself trivial. Let ϕ be an arbitrary trivial bijection. It is easy to see that, for example, there are as many permutations avoiding the pattern 132 as those avoiding the pattern ϕ(132). Moreover if, for instance, a permutation π begins with a decreasing pattern of length k, then depending on ϕ, ϕ(π) either begins with an increasing pattern, or ends with either a decreasing or increasing pattern of length k. This allows us to apply Theorems 6 – 11 to a number of other cases. We summarize all the obtained results concerning avoidance of a generalized 3-pattern with no dashes and beginning or ending with either increasing or decreasing subword, in the table below.

avoid begin  end  e.g.f.
123 12 … k  –
1 123  –  12 … k  \frac{\sqrt{3}}{2} \frac{e^{x/2}}{cos(^{\frac{\sqrt{3}}{2}} x+ \frac{π}{6} )} , if k = 1
321 k … 21  –  \frac{\sqrt{3}}{2} \frac{e^{x/2}}{cos(^{\frac{\sqrt{3}}{2}} x+ \frac{π}{6} )} − \frac{1}{2} − \frac{\sqrt{3}}{2} tan( \frac{\sqrt{3}}{2} x + \frac{π}{6} ), if k = 2
321  –  k … 21  0, if k ≥ 3
123 k … 21  –
2 123  –  k … 21  \frac{\sqrt{3}}{2} \frac{e^{x/2}}{cos(^{\frac{\sqrt{3}}{2}} x+ \frac{π}{6} )} , if k = 1
321 12 … k  –
321  –  12 … k  \frac{e^{x/2} ∫_{0}^{x} e^{−t/2}t^{k−1} sin(^{\frac{\sqrt{3}}{2}} t+ \frac{π}{6} )) dt}{(k−1)! cos(^{\frac{\sqrt{3}}{2}} x+ \frac{π}{6} )} , if k ≥ 2
132 12 … k  –
3 213  –  12 … k  (1 − ∫_{0}^{x} e^{−t^{2}/2} dt)^{−1}, if k = 1
312 k … 21  –  e^{−x^{2}/2}(1 − ∫_{0}^{x} e^{−t^{2}/2} dt)^{−1} − x − 1, if k = 2
231  –  k … 21  (1 − ∫_{0}^{x} e^{−t^{2}/2} dt)^{−1} ∫_{0}^{x} ∫_{0}^{t_{k−2}} ⋯ ∫_{0}^{t_{2}}(e^{−t_{1}^{2}/2}−

(t_{1} + 1)(1 − ∫_{0}^{t_{1}} e^{−t^{2}/2} dt))dt_{1}dt_{2} ⋯ dt_{k−2}, if k ≥ 3

132 k … 21  –
4 213  –  k … 21  (1 − ∫_{0}^{x} e^{−t^{2}/2} dt)^{−1}, if k = 1
312 12 … k  –  _{\frac{1}{(k−1)!(1−∫_{0}^{x} e^{−t^{2}/2} dt)}} ∫_{0}^{x} t^{k−1}e^{−t^{2}/2} dt, if k ≥ 2
231  –  12 … k
213 12 … k  –  (1 − ∫_{0}^{x} e^{−t^{2}/2} dt)^{−1}, if k = 1
5 132  –  12 … k
231 k … 21  –  ∫_{0}^{x} ∫_{0}^{t} \frac{s^{k−2}e^{T (t)−T (s)}}{(k−2)!(1−∫_{0}^{t} e^{−m^{2}/2}dm)} dsdt , if k ≥ 2, where
312  –  k … 21  T (x) = −x^{2}/2 + ∫_{0}^{x} \frac{e^{−t^{2}/2}}{1−∫_{0}^{t} e^{−s^{2}/2}ds} dt
213 k … 21  –  (1 − ∫_{0}^{x} e^{−t^{2}/2} dt)^{−1}, if k = 1

6 132  –  k … 21  − \frac{x^{k−1}}{(k−1)!} + ∑_{n=0}^{k−2}∫_{0}^{x} ∫_{0}^{t_{n}} ⋯ ∫_{0}^{t_{1}} \frac{C_{k−n}(t)+δ_{n,k−2}}{1−∫_{0}^{t} e^{−m^{2}/2}dm} dtdt_{1} ⋯ dt_{n},
231 12 … k  –  if k ≥ 2, where C_{k}(x) = e^{T (x)} ∫_{0}^{x} ∫_{0}^{t_{k−2}} ⋯ ∫_{0}^{t_{1}} e^{−T (t)}·

312  –  12 … k ( \frac{e^{−t^{2}/2}}{1−∫_{0}^{t} e^{−m^{2}/2}dm} − t − 1) dtdt_{1} ⋯ dt_{k−2} and T (x) as above

[BabStein] E. Babson, E. Steingrímsson: Generalized permutation patterns and a classification of the Mahonian statistics, Séminaire Lotharingien de Combinatoire, B44b:18pp, 2000.

[Bon] M. Bóna: Exact enumeration of 1342-avoiding permutations: a close link with labeled trees and planar maps. J. Combin. Theory Ser. A 80 (1997), no. 2, 257–272.

[Claes] A. Claesson: Generalised Pattern Avoidance, European J. Combin. 22 (2001), 961-971.

[ClaesMans] A. Claesson and T. Mansour: Permutations avoiding a pair of generalized patterns of length three with exactly one dash, preprint CO/0107044.

[ElizNoy] S. Elizalde and M. Noy: Enumeration of Subwords in Permutations, Proceedings of FPSAC 2001.

[Kit1] S. Kitaev: Multi-avoidance of generalised patterns, to appear in Discrete Mathematics.

[Kit2] S. Kitaev: Partially ordered generalized patterns, to appear in Discrete Mathematics.

[Knuth] D. E. Knuth: The Art of Computer Programming, 2nd ed. Addison Wesley, Reading, MA, (1973).

[Loth] M. Lothaire: Combinatorics on Words, Encyclopedia of Mathematics and its Applications, 17, Addison-Wesley Publishing Co., Reading, Mass. (1983).

[Mans1] T. Mansour: Continued fractions and generalized patterns, European J. Combin., to appear (2002), math.CO/0110037.

[Mans2] T. Mansour: Continued fractions, statistics, and generalized patterns, to appear in Ars Combinatorica (2002), preprint CO/0110040.

[SloPlo] N. J. A. Sloane and S. Plouffe: The Encyclo-

pedia of Integer Sequences,  Academic Press,  (1995).

http://www.research.att.com/~njas/sequences/

[Stan] R. Stanley: Enumerative Combinatorics, Volume 1, Cambridge University Press, (1997).

[SchSim] R. Simion, F. Schmidt: Restricted permutations, European J. Combin. 6 (1985), no. 4, 383–406.

Paper III

Simultaneous avoidance of generalized patterns

Simultaneous avoidance of generalized patterns

Sergey Kitaev^{1} and Toufik Mansour ^{2}

Abstract

In [BabStein] Babson and Steingrímsson introduced generalized permutation patterns that allow the requirement that two adjacent letters in a pattern must be adjacent in the permutation. In [Kit1] Kitaev considered simultaneous avoidance (multi-avoidance) of two or more 3-patterns with no internal dashes, that is, where the patterns correspond to contiguous subwords in a permutation. There either an explicit or a recursive formula was given for all but one case of simultaneous avoidance of more than two patterns. In this paper we find the exponential generating function for the remaining case. Also we consider permutations that avoid a pattern of the form x − yz or xy − z and begin with one of the patterns 12 … k, k(k − 1) … 1, 23 … k1, (k − 1)(k − 2) … 1k or end with one of the patterns 12 … k, k(k − 1) … 1, 1k(k − 1) … 2, k12 … (k − 1). For each of these cases we find either the ordinary or exponential generating functions or a precise formula for the number of such permutations. Besides we generalize some of the obtained results as well as some of the results given in [Kit3]: we consider permutations avoiding certain generalized 3-patterns and beginning (ending) with an arbitrary pattern having either the greatest or the least letter as its rightmost (leftmost) letter.

3.1 Introduction and Background

Permutation patterns: All permutations in this paper are written as words π = a_{1}a_{2} … a_{n}, where the a_{i} consist of all the integers 1, 2, …, n. Let α ∈ S_{n} and τ ∈ S_{k} be two permutations. We say that α contains τ if there exists a subsequence 1 ≤ i_{1} < i_{2} < ⋯ < i_{k} ≤ n such that (α_{i_{1}}, …, α_{i_{k}}) is orderisomorphic to τ, that is, for all j and m, τ_{j} < τ_{m} if and only if a_{i_{j}} < a_{i_{m}}; in such a context τ is usually called a pattern. We say that α avoids τ, or is τ-avoiding, if α does not contain τ. The set of all τ-avoiding permutations in S_{n} is denoted by S_{n}(τ). For an arbitrary finite collection of patterns T, we say that α avoids T if α avoids each τ ∈ T; the corresponding subset of S_{n} is denoted by S_{n}(T).

While the case of permutations avoiding a single pattern has attracted much attention, the case of multiple pattern avoidance remains less investigated. In particular, it is natural, as the next step, to consider permutations avoiding pairs of patterns τ_{1}, τ_{2}. This problem was solved completely for τ_{1}, τ_{2} ∈ S_{3} (see [SchSim]), for τ_{1} ∈ S_{3} and τ_{2} ∈ S_{4} (see [W]), and for τ_{1}, τ_{2} ∈ S_{4} (see [B, K] and references therein). Several recent papers [CW, MV1, Kr, MV3, MV2] deal with the case τ_{1} ∈ S_{3}, τ_{2} ∈ S_{k} for various pairs τ_{1}, τ_{2}.

1Matematik, Chalmers tekniska högskola och Göteborgs universitet, S-412 96 Göteborg, Sweden. E-mail: kitaev@math.chalmers.se

2LaBRI, Université Bordeaux 1, 351 cours de la Libération 33405 Talence Cedex, France.

E-mail:toufik@labri.fr

Generalized permutation patterns: In [BabStein] Babson and Steingrímsson introduced generalized permutation patterns (GPs) where two adjacent letters in a pattern may be required to be adjacent in the permutation. Such an adjacency requirement is indicated by the absence of a dash between the corresponding letters in the pattern. For example, the permutation π = 516423 has only one occurrence of the pattern 2-31, namely the subword 564, but the pattern 2-3-1 occurs also in the subwords 562 and 563. Note that a classical pattern should, in our notation, have dashes at the beginning and end. Since most of the patterns considered in this paper satisfy this, we suppress these dashes from the notation. Thus, a pattern with no dashes corresponds to a contiguous subword anywhere in a permutation. The motivation for introducing these patterns was the study of Mahonian statistics. A number of results on GPs were obtained by Claesson, Kitaev and Mansour. See for example [Claes], [Kit1, Kit2, Kit3] and [Mans1, Mans2, Mans3].

As in [SchSim], dealing with the classical patterns, one can consider the case when permutations have to avoid two or more generalized patterns simultaneously. A complete solution for the number of permutations avoiding a pair of 3-patterns of type (1,2) or (2,1), that is, the patterns having one internal dash, is given in [ClaesMans]. In [Kit1] Kitaev gives either an explicit or a recursive formula for all but one case of simultaneous avoidance of more than two patterns. This is the case of avoiding the GPs 123, 231 and 312 simultaneously. In Theorem 1 we find the exponential generating function (e.g.f.) for the number of such permutations.

As it was discussed in [Kit3], if a permutation begins (resp. ends) with the pattern p = p_{1}p_{2} … p_{k}, that is, the k leftmost (resp. rightmost) letters of the permutation form the pattern p, then this is the same as avoidance of k! − 1 patterns simultaneously. For example, beginning with the pattern 123 is equivalent to the simultaneous avoidance of the patterns (132], (213], (231], (312] and (321] in the Babson-Steingrímsson notation. Thus demanding that a permutation must begin or end with some pattern, in fact, we are talking about simultaneous avoidance of generalized patterns. The motivation for considering additional restrictions such as beginning or ending with some patterns is their connection to some classes of trees. An example of such a connection can be found in [Kit3, Theorem 5]. There it was shown that there is a bijection between n-permutations avoiding the pattern 132 and beginning with the pattern 12 and increasing rooted trimmed trees with n+1 nodes. We recall that a trimmed tree is a tree where no node has a single leaf as a child (every leaf has a sibling) and in an increasing rooted tree, nodes are numbered and the numbers increase as we move away from the root. The avoidance of a generalized 3-pattern p with no dashes and, at the same time, beginning or ending with an increasing or decreasing pattern was discussed in [Kit3]. Theorem 2 generalizes some of these results to the case of beginning (resp. ending) with an arbitrary pattern avoiding p and having the greatest or least letter as the rightmost (resp. leftmost) letter.

Propositions 4 – 15 (resp. 16 – 27) give a complete description for the number of permutations avoiding a pattern of the form x − yz or xy − z and beginning with one of the patterns 12 … k or k(k − 1) … 1 (resp. 23 … k1 or (k − 1)(k − 2) … 1k). For each of these cases we find either the ordinary or exponential generating functions or a precise formula for the number of such permutations. Theorem 3 generalizes some of these results. Besides, the results from Propositions 4–27 give a complete description for the number of permutations that avoid a pattern of the form x − yz or xy − z and end with one of the patterns 12 … k, k(k − 1) … 1, 1k(k − 1) … 2 and k12 … (k − 1). To get the last one of these we only need to apply the reverse operation discussed in the next section. The results of Theorems 2 and 3 can also be used to get the case of ending with a pattern from the sets Δ_{k}^{min} or Δ_{k}^{max} introduced in the next section.

Except for the empty permutation, every permutation ends and begins with the pattern p = 1. To simplify the discussion we assume that the empty permutation also begin with the pattern 1. This does not course any harm since, to count the generating functions in question for this, we need only subtract 1 from the generating functions obtained in this paper.

3.2 Preliminaries

The reverse R(π) of a permutation π = a_{1}a_{2} … a_{n} is the permutation a_{n}a_{n−1} … a_{1}. The complement C(π) is the permutation b_{1}b_{2} … b_{n} where b_{i} = n + 1 − a_{i}. Also, R ∘ C is the composition of R and C. For example, R(13254) = 45231, C(13254) = 53412 and R ∘ C(13254) = 21435. We call these bijections of S_{n} to itself trivial, and it is easy to see that for any pattern p the number A_{p}(n) of permutations avoiding the pattern p is the same as for the patterns R(p), C(p) and R ∘ C(p). For example, the number of permutations that avoid the pattern 132 is the same as the number of permutations that avoid the pattern 231. This property holds for sets of patterns as well. If we apply one of the trivial bijections to all patterns of a set G, then we get a set G′ for which A_{G′}(n) is equal to A_{G}(n). For example, the number of permutations avoiding {123, 132} equals the number of those avoiding {321, 312} because the second set is obtained from the first one by complementing each pattern.

In this paper we denote the nth Catalan number by C_{n}; the generating function for these numbers by C(x); the nth Bell number by B_{n}.

Also, N_{q}^{p}(n) denotes the number of permutations that avoid the pattern q and begin with the pattern p; G_{q}^{p}(x) (resp. E_{q}^{p}(x)) denotes the ordinary (resp. exponential) generating function for the number of such permutations. Besides, Γ_{k}^{min} (resp. Γ_{k}^{max}) denotes the set of all k-patterns with no dashes such that the least (resp. greatest) letter of a pattern is the rightmost letter; Δ_{k}^{min} (resp. Δ_{k}^{max}) denotes the set of all k-patterns with no dashes such that the least (resp. greatest) letter of a pattern is the leftmost letter.

Recall the following properties of C(x):

C(x) = \frac{1 − \sqrt{1 − 4x}}{2x} = \frac{1}{1 − xC(x)}.  (3.1)

3.3 Simultaneous avoidance of 123, 231 and 312

The Entringer numbers E(n, k) (see [SloPlo, Sequence A000111/M1492]) are the number of permutations on 1, 2, …, n + 1, starting with k + 1, which, after initially falling, alternately fall then rise. The Entringer numbers (see [Ent]) are given by

E(0, 0) = 1, E(n, 0) = 0,

together with the recurrence relation

E(n, k) = E(n, k + 1) + E(n − 1, n − k).

The numbers E(n) = E(n, n), are the secant and tangent numbers given by the generating function

sec x + tan x.

The following theorem completes the consideration of multi-avoidance of more than two generalized 3-patterns with no dashes made in [Kit1].

Theorem 1. Let E(x) be the e.g.f. for the number of permutations that avoid 123, 231 and 312 simultaneously. Then

E(x) = 1 + x(sec(x) + tan(x)).

Proof. Let s(n; i_{1}, …, i_{m}) denote the number of permutations π ∈ S_{n}(123, 231, 312) such that π_{1}π_{2} … π_{m} = i_{1}i_{2} … i_{m} and f : S_{n} → S_{n} be a map defined by

f(π_{1}π_{2} … π_{n}) = (π_{1} + 1)(π_{2} + 1) … (π_{n} + 1),

where the addition is modulo n. Using f one can see that for all a = 1, 2, …, n− 1,

s(n; a) = s(n; a + 1).  (3.2)

Thus, |S_{n}(123, 231, 312)| = ns(n; 1) and we only need to prove that s(n; 1) = E_{n−1}, where E_{n} is the nth Euler number (see [SloPlo, Sequence A000111/M1492]).

Suppose π ∈ S_{n}(123, 231, 312) is an n-permutation such that π_{1} = 1 and π_{2} = t. Since π avoids 123, we get π_{3} ≤ t − 1 and it is easy to see that

s(n; 1, t) = ∑_{j=2}^{t−1} s(n; 1, t, j) = ∑_{j=1}^{t−2} s(n − 1; t − 1, j),

so

s(n; 1, t + 1) = s(n; 1, t) + ∑_{j=1}^{t−1} s(n − 1; t, j) − ∑_{j=1}^{t−2} s(n − 1; t − 1, j).

Using (3.2) we get

s(n; 1, t+1) = s(n; 1, t)+s(n−1; t, 1)+∑_{j=2}^{t−1} s(n−1; t−1, j−1)−∑_{j=1}^{t−2} s(n−1; t−1, j),

and by (3.2) again, we have for all t = 2, 3, …, n − 1,

s(n; 1, t + 1) = s(n; 1, t) + s(n − 1; 1, n − t + 1).

Besides, by the definition, it is easy to see that s(n; 1, 2) = 0 for all n ≥ 3, hence

using the definition of Entringer numbers [Ent] we get s(n; 1) = ∑_{t=2}^{n} s_{n;1,t} =

E_{n−1}, as required.

3.4 Avoiding a 3-pattern with no dashes and beginning with a pattern whose rightmost letter is the greatest or smallest

The following theorem generalizes Theorems 7 and 8 in [Kit3]. Recall the definition of E_{q}^{p}(x) in Section 3.2.

Theorem 2. Suppose p_{1}, p_{2} ∈ Γ_{k}^{min} and p_{1} ∈ S_{k}(132), p_{2} ∈ S_{k}(123). Thus, the complements C(p_{1}), C(p_{2}) ∈ Γ_{k}^{max} and C(p_{1}) ∈ S_{k}(312), C(p_{2}) ∈ S_{k}(321). Then, for k ≥ 2,

E_{132}^{p_{1}}(x) = E_{312}^{C(p_{1})}(x) = \frac{∫_{0}^{x} t^{k−1}e^{−t^{2}/2} dt}{(k − 1)!(1 − ∫_{0}^{x} e^{−t^{2}/2} dt)}

and

E_{123}^{p_{2}}(x) = E_{321}^{C(p_{2})}(x) = \frac{e^{x/2} ∫_{0}^{x} e^{−t/2}t^{k−1} sin(\frac{\sqrt{3}}{2}t + \frac{π}{6} )) dt}{(k − 1)! cos(\frac{\sqrt{3}}{2}x + \frac{π}{6} )}.

Proof. To prove the theorem, it is enough to copy the proofs of Theorems 7 and 8 in [Kit3], since the fact that the first k − 1 letters of p are possibly not in decreasing order is immaterial for the proofs of that theorems. Thus we can get the formula for E_{132}^{p}(x) and E_{123}^{p}(x), and automatically, using properties of the complement, the formula for E_{312}^{C(p)}(x) and E_{321}^{C(p)}(x), directly from these theorems. However we give here a proof of the formula for E_{132}^{p}(x) and refer to [Kit3, Theorem 8] for a proof of the formula for E_{123}^{p}(x).

If k = 1, we have no additional restrictions, that is, we are dealing only with the avoidance of 132 and, according to [ElizNoy, Theorem 4.1] or [Kit2, Theorem 12],

E_{132}^{1}(x) = \frac{1}{1 − ∫_{0}^{x} e^{−t^{2}/2} dt}.

Also, according to [Kit3, Theorem 6],

E_{132}^{12}(x) = \frac{e^{−x^{2}/2}}{1 − ∫_{0}^{x} e^{−t^{2}/2} dt} − x − 1.

Let R_{n,k} (resp. F_{n,k}) denote the number of n–permutations that avoid the pattern 132 and begin with a decreasing (resp. increasing) subword of length k > 1 and let π be such a permutation of length n + 1. Suppose π = σ1τ. If τ = ϵ then, obviously, there are R_{n,k} ways to choose σ. If |τ| = 1, that is, 1 is in the second position from the right, then there are n ways to choose the rightmost letter in π and we multiply this by R_{k,n−1}, which is the number of ways to choose σ. If |τ| > 1 then τ must begin with the pattern 12, otherwise the letter 1 and the two leftmost letters of τ form the pattern 132, which is

forbidden. So, in this case there are ∑_{i≥0} \binom{n}{i}R_{i,k}F_{n−i,2} such permutations with

the right properties, where i indicates the length of σ. In the last formula, of course, R_{i,k} = 0 if i < k. Finally we have to consider the situation when 1 is in the k-th position. In this case we can choose the letters of σ in \binom{n}{k−1} ways, write them in decreasing order and then choose τ in F_{n−k+1,2} ways. Thus

R_{n+1,k} = R_{n,k} + nR_{n−1,k} + ∑_{i≥0} \binom{n}{i}R_{i,k}F_{n−i,2} + \binom{n}{k − 1}F_{n−k+1,2}. (3.3)

We observe that (3.3) is not valid for n = k − 1 and n = k. Indeed, if 1 is in the k-th position in these cases, the term \binom{n}{k−1}F_{n−k+1,2}, which counts the number of such permutations, is zero, whereas there is one “good” (n + 1)– permutation in case n = k − 1 and n good (n + 1)–permutations in case n = k. Multiplying both sides of the equality with x^{n}/n!, summing over n and using the observation above (which gives the term x^{k−1}/(k−1)!+kx^{k}/k! in the right-hand side of equality (3.4)), we get

\frac{d}{dx}E_{132}^{p}(x) = (E_{132}^{12}(x) + x + 1)E_{132}^{p}(x) + (E_{132}^{12}(x) + x + 1)\frac{x^{k−1}}{(k − 1)!}, (3.4)

with the initial condition E_{132}^{p}(0) = 0. We solve this equation and get

E_{132}^{p}(x) = \frac{E_{132}^{1}(x)}{(k − 1)!} ∫_{0}^{x} \frac{(E_{132}^{12}(t) + t + 1)t^{k−1}}{E_{132}^{1}(t)} dt = \frac{E_{132}^{1}(x)}{(k − 1)!} ∫_{0}^{x} t^{k−1}e^{−t^{2}/2} dt.

Remark 1. It is obvious that if in the previous theorem p_{1} ∉ S_{k}(132) and p_{2} ∉ S_{k}(123), then E_{132}^{p_{1}}(x) = E_{123}^{p_{2}}(x) = 0.

3.5 Avoiding a pattern x-yz and beginning with an increasing or decreasing pattern

In this section we consider avoidance of one of the patterns 1 − 23, 1 − 32, 2 − 31, 2 − 13, 3 − 12 and 1 − 32 and beginning with a decreasing pattern. We get all the other cases, that is, avoidance of one of these patterns and beginning with an increasing pattern, by the complement operation. For instance, we have E_{1−23}^{k(k−1)...1}(x) = E_{3−21}^{12...k}(x).

Proposition 1. We have

E_{1−23}^{k(k−1)...1}(x) = E_{1−32}^{k(k−1)...1}(x) = \{ \begin{matrix}(e^{e^{x}}/(k − 1)!) ∫_{0}^{x} t^{k−1}e^{−e^{t}+t} dt, & if k ≥ 2, \\ e^{e^{x}−1}, & if k = 1. \end{matrix}

Proof. We prove the statement for the pattern 1 − 23. All the arguments we give for this pattern are valid for the pattern 1 − 32. The only difference is that instead of decreasing order in τ (see below), we have increasing order.

Suppose k ≥ 2. Let B_{n,k} denote the number of n–permutations that avoid the pattern 1 − 23 and begin with a decreasing subword of length k. Suppose π = σ1τ be one of such permutations of length n + 1. Obviously, the letters of τ must be in decreasing order since otherwise we have an occurrence of 1 − 23 in π starting from the letter 1. If |σ| = i then we can choose the letters of σ in \binom{n}{i} ways. Since the letters of τ are in decreasing order, they do not affect σ and thus there are B_{i,k} possibilities to choose σ. Besides, if |σ| = k − 1 and letters of σ are in decreasing order, we get \binom{n}{k−1} additional possibilities to choose π. Thus

B_{n+1,k} = ∑_{i≥0} \binom{n}{i}B_{i,k} + \binom{n}{k − 1}.

Multiplying both sides of the equality with x^{n}/n! and summing over n, we get the differential equation

\frac{d}{dx}E_{1−23}^{k(k−1)...1}(x) = (E_{1−23}^{k(k−1)...1}(x) + \frac{x^{k−1}}{(k − 1)!})e^{x}

with the initial condition E_{1−23}^{k(k−1)...1}(0) = 0. The solution to this equation is given by

E_{1−23}^{k(k−1)...1}(x) = (e^{e^{x}}/(k − 1)!) ∫_{0}^{x} t^{k−1}e^{−e^{t}+t} dt.  (3.5)

If k = 1, then there is no additional restriction. According to [Claes, Prop. 2] (resp. [Claes, Prop. 5]), the number of n-permutations that avoid the pattern 1-23 (resp. 1-32) is the nth Bell number and the e.g.f. for the Bell numbers is e^{e^{x}−1}. However, all the arguments used for k ≥ 2 remain the same for the case k = 1 except for the fact that we do not count the empty permutation, which, of course, avoids 1-23. So, if k = 1, we need to add 1 to the right-hand side of (3.5):

E_{1−23}^{1}(x) = e^{e^{x}} ∫_{0}^{x} e^{−e^{t}+t} dt + 1 = e^{e^{x}−1}.

Proposition 2. We have

E_{3−12}^{k(k−1)...1}(x) = \{ \begin{matrix}e^{e^{x}} ∫_{0}^{x} e^{−e^{t}} ∑_{n≥k−1} \frac{t^{n}}{n!} dt, & if k ≥ 2, \\ e^{e^{x}−1}, & if k = 1. \end{matrix}

Proof. Suppose k ≥ 2. Let B_{n,k} denote the number of n–permutations that avoid the pattern 3 − 12 and begin with a decreasing subword of length k. Suppose π = σ(n + 1)τ be such a permutation of length n + 1. Obviously, the letters of τ must be in decreasing order since otherwise we have an occurrence of the pattern 3 − 12 in π starting from the letter (n + 1). If |σ| = i then we can choose the letters of σ in \binom{n}{i} ways. Since the letters of τ are in decreasing order, they do not affect σ and thus there are B_{i,k} possibilities to choose σ. Besides, if n ≥ k − 1, then π can be decreasing, that is, (n + 1) can be in the leftmost position. Thus

B_{n+1,k} = ∑_{i≥0} \binom{n}{i}B_{i,k} + δ_{n,k},

where

δ_{n,k} = \{ \begin{matrix}1, & if n ≥ k − 1, \\ 0, & else. \end{matrix}

Multiplying both sides of the equality with x^{n}/n! and summing over n, we get the differential equation

\frac{d}{dx}E_{3−12}^{k(k−1)...1}(x) = e^{x}E_{3−12}^{k(k−1)...1}(x) + ∑_{n≥k−1} \frac{x^{n}}{n!}

with the initial condition E_{3−12}^{k(k−1)...1}(0) = 0. The solution to this equation is given by

E_{3−12}^{k(k−1)...1}(x) = e^{e^{x}} ∫_{0}^{x} e^{−e^{t}} ∑_{n≥k−1} \frac{t^{n}}{n!} dt.  (3.6)

If k = 1, then there is no additional restriction. In [Claes, Prop. 5] it is shown that E_{1−32}^{1}(x) = e^{e^{x}−1}. Using the complement, the number of n-permutations that avoid 1 − 32 is equal to the number of n-permutations that avoid 3 − 12. We get that E_{3−12}^{1}(x) = e^{e^{x}−1}. However, all the arguments used for the case k ≥ 2 remain the same for the case k = 1 except the fact that we do not count the empty permutation, which avoids 3-12. So, if k = 1, we need to add 1 to the right-hand side of (3.6):

E_{3−12}^{1}(x) = e^{e^{x}} ∫_{0}^{x} e^{−e^{t}}e^{t} dt + 1 = e^{e^{x}−1}.

Proposition 3. We have

E_{3−21}^{k(k−1)...1}(x) = \{ \begin{matrix}0, & if k ≥ 3, \\ e^{e^{x}} ∫_{0}^{x} e^{−e^{t}}(e^{t} − 1) dt, & if k = 2, \\ e^{e^{x}−1}, & if k = 1. \end{matrix}

Proof. For k ≥ 3, the statement is obviously true. If k = 1, then the statement follows from [Claes, Prop. 2] and the fact that there are as many n-permutations avoiding the pattern 1 − 23, as n-permutations avoiding the pattern 3 − 21. For the case k = 2, we can use exactly the same arguments as those in the proof of Proposition 2 to get the same recurrence relation and thus the same formula, which, however, is valid only for k = 2.

Recall the definition of N_{q}^{p} in Section 3.2.

Proposition 4. We have

N_{2−13}^{k(k−1)...1}(n) = \{ \begin{matrix}C_{n−k+1}, & if n ≥ k, \\ 0, & else. \end{matrix}

Proof. If k = 1, then the statement follows from [Claes, Prop. 22]. Suppose k ≥ 2 and let π = σnτ be an n-permutation avoiding 2 − 31 and beginning with the pattern k(k − 1) … 1. Suppose, without loss of generality that σ consists of the letters 1, 2, …, ℓ. Now ℓ must be the rightmost letter of σ, since otherwise ℓ, the rightmost letter of σ and n form the pattern 2−13. Also, the letter (ℓ−1) must be next to the rightmost letter of σ since otherwise the letter (ℓ − 1), next to the rightmost letter of σ and the letter ℓ form the pattern 2 − 13. And so on. Thus σ must be increasing, which contradicts the fact that π must begin with a decreasing pattern of length greater than 1. So |σ| = 0 and τ must begin with the pattern (k − 1)(k − 2) … 1. Now, we can consider the letter (n − 1) and, by the same reasoning, get that it must be in the second position of π. Then we consider (n − 2), and so on up to the letter (n − k + 2). Finally, we get that π = n(n − 1) … (n − k + 2)π′, where π′ must avoid the pattern 2 − 13 and thus, there are C_{n−k+1} ways to choose π ([Claes, Prop. 22]).

Recall that C(x) is the generating function for the Catalan numbers. Also recall the definition of G_{q}^{p} in Section 3.2.

Proposition 5. We have

G_{2−31}^{k(k−1)...1}(x) = \{ \begin{matrix}x^{k}C^{k+1}(x), & if k ≥ 2 \\ C(x), & if k = 1. \end{matrix}

Proof. If k = 1, then there is no additional restriction, and thus G_{2−31}^{1}(x) = C(x) (applying the complement operation to [Claes, Prop. 22]).

Suppose k ≥ 2. Using the reverse, we see that beginning with k(k − 1) … 1 and avoiding 2 − 31 is equivalent to ending with 12 … k and avoiding 13 − 2, which by [Claes] is equivalent to ending with 12 … k and avoiding 1 − 3 − 2.

Suppose π = π′nπ′′ ends with 12 … k and avoids 1 − 3 − 2. Each letter of π′ must be greater than any letter of π′′, since otherwise we have an occurrence of the pattern 1 − 3 − 2 involving the letter n. Also, π′ and π′′ avoid the pattern 1 − 3 − 2, and π′′ ends with the pattern 12 … k. In terms of generating functions (the generating function for the number of permutations ending with 12 … k and avoiding 1 − 3 − 2 is, of course, G_{2−31}^{k(k−1)...1}(x)) this means that

G_{2−31}^{k(k−1)...1}(x) = xC(x)G_{2−31}^{k(k−1)...1}(x) + xG_{2−31}^{(k−1)...1}(x),  (3.7)

where the rightmost term corresponds to the case when π′′ is empty. Now, (3.1) and (3.7) give

G_{2−31}^{k(k−1)...1}(x) = x^{k}C(x)/(1 − xC(x))^{k} = x^{k}C^{k+1}(x).

3.6 Avoiding a pattern xy-z and beginning with an increasing or decreasing pattern

First of all we state the following well-known binomial identity

∑_{i=1}^{n−m−k+1} \binom{n − m − i}{k − 1}\binom{m + i − 1}{m} = \binom{n}{m + k}.  (3.8)

Let s_{q}(n) denote the cardinality of the set S_{n}(q) and s_{q}(n; i_{1}, i_{2}, … i_{m}) denote the number of permutations π ∈ S_{n}(q) with π_{1}π_{2} … π_{m} = i_{1}i_{2} … i_{m}.

In this section we consider avoidance of one of the patterns 12-3, 13-2 and 23-1 and beginning with an increasing or decreasing pattern. We get all the other cases, which are avoidance of one of the patterns 32-1, 31-2 and 21-3 and beginning with an increasing or decreasing pattern, by the complement operation. For instance, we have N_{13−2}^{12...k}(n) = N_{31−2}^{k(k−1)...1}(n).

3.6.1 The pattern 12 − 3

We first consider beginning with the pattern p = k … 21. In [ClaesMans, Lemma 9] it was proved that

s_{12−3}(n; i) = ∑_{j=0}^{i−1} \binom{i − 1}{j}s_{12−3}(n − 2 − j),

together with s_{12−3}(n; n) = s_{12−3}(n; n − 1) = s_{12−3}(n − 1).

On the other hand, from the definitions, it is easy to see that

N_{12−3}^{k(k−1)...1}(n) = ∑_{i=1}^{n−k+1} \binom{n − i}{k − 1}s_{12−3}(n − k + 1; i).

Hence, using (3.8) and the fact shown in [Claes] that s_{12−3}(n) equals B_{n}, we get the following proposition.

Proposition 6. For all n ≥ k + 1, we have

\begin{matrix}N_{12−3}^{k(k−1)...1}(n) = (k + 1)B_{n−k}+ \\ + ∑_{j=0}^{n−k−2} (\binom{n}{k+j} − k\binom{n−k−1}{j} − \binom{n−k}{j}) B_{n−k−1−j}, \end{matrix}

together with N_{12−3}^{k(k−1)...1}(k) = 1 and N_{12−3}^{k(k−1)...1}(n) = 0 for all n ≤ k − 1.

Now, let us consider beginning with the pattern p = 12 … k. From the definitions, it is easy to see that N_{12−3}^{12...k}(n) = 0 for all n, where k ≥ 3, and N_{12−3}^{1}(n) = s_{12−3}(n) = B_{n} (see [ClaesMans, Prop. 10]). Thus, we only need to consider the case k = 2.

Suppose π ∈ S_{12−3}(n) is a permutation with π_{1} < π_{2}. It is easy to see that π_{2} = n. Hence N_{12−3}^{12}(n) = (n−1)s_{12−3}(n−2), for all n ≥ 2, and by [ClaesMans, Prop. 10], we get the truth of the following

Proposition 7. We have

E_{12−3}^{12...k}(x) = \{ \begin{matrix}0, & if k ≥ 3, \\ x^{2} ∑_{j=0}^{k}(1 − jx)^{−1} ∑_{d≥0} \frac{x^{d}}{(1 − x)(1 − 2x) … (1 − dx)}, & if k = 2, \\ ∑_{d≥0} \frac{x^{d}}{(1 − x)(1 − 2x) … (1 − dx)}, & if k = 1. \end{matrix}

3.6.2 The pattern 13 − 2

Let us introduce an object that plays an important role in the proof of the main result in this case. For n ≥ m + 1 ≥ 0, we define

A(n; m) = ∑_{1≤i_{m}<···<i_{2}<i_{1}<n−1} s_{1−3−2}(n; i_{1}, i_{2}, …, i_{m}).

We extend this definition to m = 0 by A(n; 0) = s_{1−3−2}(n).

Lemma 1. For all n ≥ m ≥ 0,

A(n; m) = ∑_{j≥0}(−1)^{j}\binom{m + 1 − j}{j}s_{1−3−2}(n − j).

Proof. For m = 0 the lemma holds by definitions. Let m ≥ 0; so

A(n; m) = ∑_{1≤i_{m}<···<i_{2}<i_{1}<n−1} ∑_{j=1}^{n} s_{1−3−2}(n; i_{1}, i_{2}, …, i_{m}, j),

= A(n; m + 1) + ∑_{1≤i_{m}<···<i_{2}<i_{1}<n−1} s_{1−3−2}(n; i_{1}, i_{2}, …, i_{m}, n),

= A(n; m + 1) + ∑_{1≤i_{m}<···<i_{2}<i_{1}<n−1} s_{1−3−2}(n − 1; i_{1}, i_{2}, …, i_{m}),

= A(n; m + 1) + ∑_{1≤i_{m}<···<i_{2}<n−2} s_{1−3−2}(n − 1; n − 1, i_{2}, …, i_{m})+

+ ∑_{1≤i_{m}<···<i_{2}<i_{1}<n−2} s_{1−3−2}(n − 1; i_{1}, i_{2}, …, i_{m})

\begin{matrix}= A(n; m + 1) + A(n − 1; m) + ∑_{1≤i_{m−1}<···<i_{1}<n−2} s_{1−3−2}(n − 2; i_{1}, …, i_{m−1}), \\ = ⋯ = A(n; m + 1) + A(n − 1; m) + ⋯ + A(n − m − 1; 0). \end{matrix}

Hence, using induction on m, we get

\begin{matrix}A(n; m + 1) = ∑_{j≥0}(−1)^{j}\binom{m + 1 − j}{j}s_{1−3−2}(n − j) \\ − ∑_{d=0}^{m} ∑_{j≥0}(−1)^{j}\binom{m − d + 1 − j}{j}s_{1−3−2}(n − 1 − d − j). \end{matrix}

Using the identity \binom{r}{0} − \binom{r}{1} + ⋯ + (−1)^{s}\binom{r}{s} = \binom{r−1}{s}, we get

\begin{matrix}A(n; m + 1) = ∑_{j≥0}(−1)^{j}\binom{m + 1 − j}{j}s_{1−3−2}(n − j) \\ − ∑_{d=0}^{m}(−1)^{d}\binom{m − d}{d}s_{1−3−2}(n − 1 − d). \end{matrix}

Now using the identity \binom{n}{k} + \binom{n}{k−1} = \binom{n+1}{k}, we get

A(n; m + 1) = ∑_{j≥0}(−1)^{j}\binom{m + 2 − j}{j}s_{1−3−2}(n − j),

which means that the lemma holds for m + 1.

Now we find N_{13−2}^{k(k−1)...1}(n).

Proposition 8. Let k ≥ 1. For all n ≥ 0,

N_{13−2}^{k(k−1)...1}(n) = C_{n+1−k} + ∑_{d=0}^{k−2} ∑_{j≥0}(−1)^{j}\binom{k + 1 − d − j}{j}C_{n−d−j}.

Proof. Claesson [Claes] proved that the set of permutations that avoid the pattern 13−2 is the same as the set of permutations that avoid the pattern 1−3−2, hence

N_{13−2}^{k(k−1)...1}(n) = N_{1−3−2}^{k(k−1)...1}(n).  (3.9)

If the leftmost letter of a permutation avoiding 13-2 and beginning with the pattern k(k − 1) … 1 is n, then, obviously, there are N_{1−3−2}^{(k−1)(k−2)...1}(n − 1) such permutations. Otherwise, it is easy to see that there are A(n; k) such permutations. So, by Lemma 1 and the considerations above, also using the fact that the number of (1 − 3 − 2)-avoiding n-permutations in S_{n} is C_{n}, we get

N_{13−2}^{k(k−1)...1}(n) = N_{13−2}^{(k−1)(k−2)...1}(n − 1) + ∑_{j≥0}(−1)^{j}\binom{k + 1 − j}{j}C_{n−j}.

Moreover, using the definitions and Equation (3.9), we have N_{13−2}^{1}(n) = s_{1−3−2}(n) = C_{n}, for all n ≥ 0. Hence, by induction on k, the proposition holds.

Now, let us consider the case of N_{13−2}^{12...k}(n).

Proposition 9. Let k ≥ 1. For all n ≥ k, we have

N_{13−2}^{12...k}(n) = C_{n+1−k}.

Proof. Suppose π = π′nπ′′ is a permutation in S_{n}(13 − 2) = S_{n}(1 − 3 − 2) (see (3.9)), such that π_{1} < π_{2} < ⋯ < π_{k}. It is easy to see that there exists an m such that

π = (m + 1)(m + 2) … (m + k − 1)βnπ′′,

where β is a 1−3−2-avoiding permutation on the letters m+k, m+k+1, …, n−1, and π′′ ∈ S_{m}(1 − 3 − 2). Hence, in terms of generating functions, we get

∑_{n≥0} N_{13−2}^{12...k}(n)x^{n} = x^{k}C^{2}(x).

The rest is easy to check using the identity xC^{2}(x) = C(x) − 1.

3.6.3 The pattern 23 − 1

We first consider beginning with the pattern p = k(k − 1) … 1.

Proposition 10. For all k ≥ 1,

E_{23−1}^{k(k−1)...1}(x) = x^{k−1} (∑_{d≥0} \frac{x^{d}}{(1 − x)(1 − 2x) ⋯ (1 − dx)} − 1) .

Proof. Let π ∈ S_{n}(23 − 1) be a permutation such that π_{1} < π_{2} < ⋯ < π_{k}. Since π avoids 23 − 1, we have π_{j} = j, for each j = 1, 2, …, k − 1. Hence π = 12 … (k − 1)π′, where π′ is a non-empty 23 − 1-avoiding permutation in S_{n+1−k}. The rest is easy to get by using [ClaesMans, Prop. 17].

Now let us consider beginning with the pattern p = 12 … k.

Proposition 11. Suppose k ≥ 1. For all n ≥ k + 1,

N_{23−1}^{12...k}(n) = (1 + \binom{n − 1}{k − 1}) B_{n−k}+ ∑_{j=0}^{n−k−2} [\binom{n − 1}{k + j} − \binom{n − k − 1}{j}] B_{n−k−1−j},

with N_{23−1}^{12...k}(k) = 1.

Proof. In [ClaesMans, Lemma 16] proved that for all 2 ≤ i ≤ n − 1,

s_{23−1}(n; i) = ∑_{j=0}^{i−2} \binom{i − 2}{j}s_{23−1}(n − 2 − j),

together with s_{23−1}(n; n) = s_{23−1}(n; 1) = s_{23−1}(n − 1) = B_{n−1}.

On the other hand, by the definitions, it is easy to see that

N_{23−1}^{12...k}(n) = ∑_{i=1}^{n−k+1} \binom{n − i}{k − 1}s_{23−1}(n − k + 1; i).

Hence, using (3.8) and the fact that [Claes] s_{23−1}(n) is given by B_{n}, we get the desired result.

3.7 Avoiding a pattern xy-z and beginning with the pattern (k − 1)(k − 2) … 1k or 23 … k1

In this section we consider avoidance of one of the patterns 12−3, 13−2, 23−1, 21 − 3, 31 − 2 and 13 − 2 and beginning with the pattern (k − 1)(k − 2) … 1k. The case when a permutation begins with the pattern 23 … k1 and avoids a pattern xy − z can be obtained then by the complement operation.

3.7.1 Avoiding 12−3 and beginning with (k −1)(k −2) … 1k

Proposition 12. We have

N_{12−3}^{(k−1)(k−2)...1k}(n) = \binom{n − 1}{k − 1}B_{n−k}.

Proof. Suppose π = π′nπ′′ avoids the pattern 12−3 and begins with the pattern (k − 1)(k − 2) … 1k. We have that π′ must be decreasing, since otherwise we have an occurrence of the pattern 12 − 3 involving the letter n, and π′′ must avoid 12 − 3. Also, since π begins with (k − 1) … 21k, the length of π′ is k − 1. Hence, by [Claes] (the number of permutations in S_{n}(12 − 3) is given by B_{n}), we have

N_{12−3}^{(k−1)(k−2)...1k}(n) = \binom{n − 1}{k − 1}B_{n−k}.

3.7.2 Avoiding 13−2 and beginning with (k −1)(k −2) … 1k

By [Claes], a permutation π avoids the pattern 13 − 2 if and only if π avoids 1 − 3 − 2.

Suppose π = π′nπ′′ is an n-permutation avoiding 1 − 3 − 2 and beginning with (k − 1)(k − 2) … 1k. Obviously, π′ and π′′ avoid 1 − 3 − 2 and each letter of π′ is greater than any letter of π′′, since otherwise we have an occurrence of the pattern 1 − 3 − 2 involving the letter n. Also, π′ begins with the pattern (k − 1)(k − 2) … 1k or π′ = (k − 1)(k − 2) … 1.

By [Knuth], the generating function for the number of permutations that avoid 1 − 3 − 2 is C(x), hence, using the considerations above,

G_{13−2}^{(k−1)(k−2)...1k}(x) = xG_{13−2}^{(k−1)(k−2)...1k}(x)C(x) + x^{k}C(x).

Therefore, by (3.1), we get the following.

Proposition 13. We have

G_{13−2}^{(k−1)(k−2)...1k}(x) = x^{k}C^{2}(x).

Hence

N_{13−2}^{(k−1)(k−2)...1k}(n) = \{ \begin{matrix}C_{n−(k−1)}, & if n ≥ k \\ 0, & else. \end{matrix}

3.7.3 Avoiding 21−3 and beginning with (k −1)(k −2) … 1k

If k ≥ 3 then, by the definitions, we have N_{21−3}^{(k−1)(k−2)...1k}(n) = 0.

If k = 1 then, by the definitions and [Claes], we have N_{21−3}^{1}(n) = B_{n}.

Suppose k = 2 and π = π′nπ′′ is an n-permutation avoiding the pattern 21−3 and beginning with the pattern (k −1)(k −2) … 1k = 12. It is easy to see that π′ must be increasing, and the length of π′ is at least 1. Thus, using the fact that the number of permutations in S_{n}(21 − 3) is given by B_{n} (see [Claes]), we have

N_{21−3}^{(k−1)(k−2)...1k}(n) = ∑_{j=1}^{n−1} \binom{n − 1}{j}B_{n−1−j}.  (3.10)

Since B_{n} = ∑_{j=0}^{n−1} \binom{n − 1}{j}B_{n−1−j}, equality (3.10) gives that

N_{21−3}^{(k−1)(k−2)...1k}(n) = B_{n} − B_{n−1}.

Thus we have proved the following.

Proposition 14.

N_{21−3}^{(k−1)(k−2)...1k}(n) = \{ \begin{matrix}0, & if k ≥ 3 \\ B_{n} − B_{n−1}, & if k = 2, \\ B_{n}, & if k = 1. \end{matrix}

3.7.4 Avoiding 23−1 and beginning with (k −1)(k −2) … 1k

Proposition 15. We have that N_{23−1}^{(k−1)(k−2)...1k}(n) is given by

\{ \begin{matrix}B_{n−k} + ∑_{t=2}^{n−k+2} \binom{t + k − 3}{k − 2} ∑_{j=0}^{t−2} \binom{t − 2}{j}B_{n−k−1−j}, & if k ≥ 3 \\ B_{n−1}, & if k = 2, \\ B_{n}, & if k = 1. \end{matrix}

Proof. Suppose k = 2. We are interested in the permutations π ∈ S_{n}(23−1) that begin with the pattern 12. It is easy to see that π_{1} = 1, hence B_{12}^{23−1}(n) = B_{n−1} for all n ≥ 2.

Suppose k ≥ 3. We recall that s_{23−1}(n; t) is the number of permutations in S_{n}(23 − 1) having t as the first letter. By [ClaesMans], s(n; 1) = B_{n−1} and for t ≥ 2, we have

s(n; t) = ∑_{j=0}^{t−2} \binom{t − 2}{j}B_{n−2−j}.

On the other hand, if a permutation π = π′1tπ′′ avoids 23 − 1 and begins with the pattern (k − 1)(k − 2) … 1k, then π′ is decreasing of length k − 2, and using s(n; t), we get

N_{23−1}^{(k−1)(k−2)...1k}(n) = B_{n−k} + ∑_{t=2}^{n−k+2} \binom{t + k − 3}{k − 2} ∑_{j=0}^{t−2} \binom{t − 2}{j}B_{n−k−1−j}.

3.7.5 Avoiding 31−2 and beginning with (k −1)(k −2) … 1k

By [Claes], a permutation π avoids the pattern 31 − 2 if and only if π avoids the pattern 3 − 1 − 2.

Suppose π = π′1π′′ is an n-permutation avoiding 3 − 1 − 2 and beginning with (k − 1)(k − 2) … 1k. Obviously, π′ and π′′ avoid 3 − 1 − 2 and each letter of π′ is smaller than any letter of π′′, since otherwise we have an occurrence of the pattern 3 − 1 − 2 involving the letter 1. Also, π′ begins with the pattern (k − 1)(k − 2) … 1k or π′ = (k − 1)(k − 2) … 2 and π′′ is not empty. So, using the generating function for the number of permutations avoiding the pattern 3 − 1 − 2, which is C(x) ([Knuth]), we get

G_{31−2}^{(k−1)(k−2)...1k}(x) = xG_{31−2}^{(k−1)(k−2)...1k}(x)C(x) + x^{k−1}(C(x) − 1).

Therefore, using (3.1), we get the following.

G_{31−2}^{(k−1)(k−2)...1k}(x) = \{ \begin{matrix}x^{k}C^{3}(x), & if k ≥ 2, \\ C(x), & if k = 1. \end{matrix}

Hence

N_{31−2}^{(k−1)(k−2)...1k}(n) = \{ \begin{matrix}C_{n−k+2} − C_{n−k+1}, & if k ≥ 2, \\ C_{n}, & if k = 1. \end{matrix}

3.7.6 Avoiding 32−1 and beginning with (k −1)(k −2) … 1k

Proposition 17.

N_{32−1}^{(k−1)(k−2)...1k}(n) = \{ \begin{matrix}0, & if k ≥ 4 \\ B_{n−1} − (n − 2)B_{n−3}, & if k = 3 and n ≥ 3, \\ B_{n} − (n − 1)B_{n−2}, & if k = 2 and n ≥ 2, \\ B_{n}, & if k = 1. \end{matrix}

Proof. Using the definitions and [Claes], it is easy to see that the statement is true for k = 1, 2 and k ≥ 4.

Suppose now that k = 3 and π = π′1π′′ is an n-permutation avoiding the pattern 32 − 1 and beginning with the pattern (k − 1)(k − 2) … 1k = 213. We have that π′ must be increasing, since otherwise we have an occurrence of the pattern 32 − 1 involving the letter 1, and π′′ must avoid 32 − 1. Moreover, since π begins with 213, the length of π is 1 and the rightmost letter of π′′ is greater than the letter of π′. Also, it is easy to see that the number of permutations in S_{n−1}(32 − 1) beginning with the pattern 12 is the same as the number of permutations in S_{n}(32 − 1) beginning with the pattern 213 (one can see it by placing 1 in the second position). Hence N_{32−1}^{(k−1)...21k}(n) = B_{n−1} − (n − 2)B_{n−3} for all n ≥ 3.

3.8 Avoiding a pattern x-yz and beginning with the pattern (k − 1)(k − 2) … 1k or 23 … k1

In this section we consider avoidance of one of the patterns 1−23, 1−32, 2−31, 2 − 13, 3 − 12 and 1 − 32 and beginning with the pattern (k − 1)(k − 2) … 1k. The case when a permutation begins with the pattern 23 … k1 and avoids a pattern x − yz can be obtained by the complement operation.

Proposition 18. We have

E_{1−32}^{(k−1)(k−2)...1k}(x) = \{ \begin{matrix}e^{e^{x}} ∫_{0}^{x} e^{−e^{t}} ∑_{n≥k−1} \frac{t^{n}}{n!} dt, & if k ≥ 2, \\ e^{e^{x}−1}, & if k = 1. \end{matrix}

Proof. Suppose k ≥ 2. Let B_{n,k} denote the number of n–permutations that avoid the pattern 1−32 and begin with the pattern (k−1)(k−2) … 1k. Suppose π = σ1τ is such a permutation of length n + 1. Obviously, the letters of τ must be in increasing order, since otherwise we have an occurrence of the pattern 1 − 32 in π starting from the letter 1. If |σ| = i, then we can choose the letters of σ in \binom{n}{i} ways. Since the letters of τ are in increasing order, they do not affect σ and thus there are B_{i,k} possibilities to choose σ. Also, if n ≥ k −1, then 1 can be in the (k − 1)th position, and in this case, since π begins with the pattern (k − 1)(k − 2) … 1k, it must be that π = (k − 1)(k − 2) … 21k(k + 1) … (n + 1). Thus, in the last case we have only one permutation. This leads to the recurrence relation

B_{n+1,k} = ∑_{i≥0} \binom{n}{i}B_{i,k} + δ_{n,k},

where

δ_{n,k} = \{ \begin{matrix}1, & if n ≥ k − 1, \\ 0, & else. \end{matrix}

This recurrence relation is identical to the one given in the proof of Proposition 2, so using this proof we get the desired result.

Proposition 19. We have

E_{1−23}^{(k−1)(k−2)...1k}(x) = \{ \begin{matrix}e^{e^{x}} ∫_{0}^{x} ∫_{0}^{t} \frac{r^{k−2}}{(k−2)!}e^{r−e^{t}} drdt, & if k ≥ 2, \\ e^{e^{x}−1}, & if k = 1. \end{matrix}

Proof. If k = 1, then the statement is true due to Proposition 1.

Suppose k ≥ 2. Let B_{n,k} denote the number of n-permutations that avoid the pattern 1 − 23 and begin with the pattern (k − 1)(k − 2) … 1k. Suppose π = σ1τ is such a permutation of length n + 1. Obviously, the letters of τ must be in decreasing order since otherwise we have an occurrence of the pattern 1 − 23 in π starting from the letter 1. If |σ| = i, then we can choose the letters of σ in \binom{n}{i} ways. Since the letters of τ are in the decreasing order, they do not affect σ and thus there are B_{i,k} possibilities to choose σ. Besides, if n ≥ k − 1, then 1 can be in the (k − 1)th position, and in this case, since π begins with the pattern (k −1)(k −2) … 1k and τ is decreasing, it must be that the kth letter of π is (n + 1) and there are \binom{n−1}{k−2} ways to choose the letters of σ and then write them in decreasing order. Thus,

B_{n+1,k} = ∑_{i≥0} \binom{n}{i}B_{i,k} + \binom{n − 1}{k − 2}.

Multiplying both sides of the equality with x^{n}/n! and summing over n, we get the differential equation

\frac{d}{dx}E_{1−23}^{(k−1)(k−2)...1k}(x) = E_{1−23}^{(k−1)(k−2)...1k}e^{x} + ∑_{n≥0} \binom{n − 1}{k − 2}\frac{x^{n}}{n!} ,

with the initial condition E_{1−23}^{(k−1)(k−2)...1k}(0) = 0. If F (x) denotes the last term, then it is easy to see that F′(x) = \frac{x^{k−2}}{(k−2)!}e^{x}, and thus

F (x) = ∫_{0}^{x} \frac{t^{k−2}}{(k − 2)!}e^{t} dt.

Now, the solution to the equation above is given by

E_{1−23}^{(k−1)(k−2)...1k}(x) = e^{e^{x}} ∫_{0}^{x} e^{−e^{t}}F (t) dt = e^{e^{x}} ∫_{0}^{x} ∫_{0}^{t} \frac{r^{k−2}}{(k − 2)!}e^{r−e^{t}} drdt.

(3.11)

For example, if k = 2, then (k − 1)(k − 2) … 1k = 12 and (3.11) gives

E_{1−23}^{12} = e^{e^{x}} ∫_{0}^{x} e^{−e^{t}}(e^{t} − 1) dt,

which is a particular case of Proposition 3, since the number of n-permutations that avoid the pattern 3 − 21 and begin with the pattern 21 is equal to the number of n-permutations that avoid the pattern 1 − 23 and begin with the pattern 12 by applying the complement.

Proposition 20. We have

G_{2−13}^{(k−1)(k−2)...1k}(x) = \{ \begin{matrix}0, & if k ≥ 3 \\ x^{2}C^{3}(x), & if k = 2 \\ C(x), & if k = 1. \end{matrix}

Hence

N_{2−13}^{(k−1)(k−2)...1k}(n) = \{ \begin{matrix}0, & if k ≥ 3 \\ C_{n−1} − C_{n−2}, & if k = 2 \\ C_{n}, & if k = 1. \end{matrix}

Proof. For the case k = 1, see Proposition 4. If k ≥ 3, then the statement is true, since in this case the pattern (k − 1)(k − 2) … 1k does not avoid 2 − 13.

Suppose now that k = 2. Using the reverse, we see that beginning with the pattern 12 and avoiding 2 − 13 is equivalent to ending with the pattern 21 and avoiding 31 − 2, which by [Claes] is equivalent to ending with the pattern 21 and avoiding the pattern 3 − 1 − 2.

Let π = π′1π′′ be an n-permutation avoiding 3 − 1 − 2 and ending with the pattern 21. Obviously, π′ and π′′ avoid 3−1−2 and each letter of π′ is less than any letter of π′′, since otherwise we have an occurrence of 3 − 1 − 2 involving the letter 1. Also, π′′ ends with the pattern 21 or |π′′| = 1. So, using the generating function for the number of permutations avoiding 3 − 1 − 2, which is C(x) ([Knuth]), we have

G_{2−13}^{12}(x) = xG_{2−13}^{12}(x)C(x) + x(C(x) − 1).

Therefore, using (3.1), we get the desired result.

G_{2−31}^{(k−1)(k−2)...1k}(x) = x^{k}C^{2}(x).

Hence

N_{2−31}^{(k−1)(k−2)...1k}(n) = \{ \begin{matrix}C_{n−(k−1)}, & if n ≥ k \\ 0, & else. \end{matrix}

Proof. Using the reverse, we see that beginning with the pattern (k − 1)(k − 2) … 1k and avoiding the pattern 2−31 is equivalent to ending with the pattern k12 … (k − 1) and avoiding the pattern 13 − 2, which, by [Claes], is equivalent to ending with the pattern k12 … (k − 1) and avoiding the pattern 1 − 3 − 2.

Let π = π′nπ′′ be an n-permutation avoiding the pattern 1 − 3 − 2 and ending with the pattern k12 … (k − 1). Obviously, π′ and π′′ avoid the pattern 1 − 3 − 2 and each letter of π′ is greater than any letter of π′′, since otherwise we have an occurrence of the pattern 1 − 3 − 2 involving the letter n. Also, π′′ ends with the pattern k12 … (k − 1) or π′′ = 12 … (k − 1).

Using the reverse operation, the generating function for the number of permutations ending with the pattern k12 … (k − 1) and avoiding 1 − 3 − 2 is equal to G_{2−31}^{(k−1)(k−2)...1k}(x). In terms of generating functions, the considerations above lead to

G_{2−31}^{(k−1)(k−2)...1k}(x) = xG_{2−31}^{(k−1)(k−2)...1k}(x)C(x) + x^{k}C(x).

Therefore, by (3.1), we get the desired result.

Proposition 22. We have

E_{3−12}^{(k−1)(k−2)...1k}(x) = \{ \begin{matrix}(e^{e^{x}}/(k − 1)!) ∫_{0}^{x} t^{k−1}e^{−e^{t}+t} dt, & if k ≥ 2, \\ e^{e^{x}−1}, & if k = 1. \end{matrix}

Proof. Suppose k ≥ 2. Let B_{n,k} denote the number of n-permutations that avoid the pattern 3 − 12 and begin with a decreasing subword of length k. Let π = σ(n + 1)τ be such a permutation of length n + 1. Obviously, the letters of τ must be in decreasing order since otherwise we have an occurrence of 3 − 12 in π starting from the letter (n+1). If |σ| = i then we can choose the letters of σ in \binom{n}{i} ways. Since the letters of τ are in decreasing order, they do not affect σ and thus there are B_{i,k} possibilities to choose σ. Also, if |σ| = k − 1 and the letters of σ are in decreasing order, we get \binom{n}{k−1} additional ways to choose π. Thus

B_{n+1,k} = ∑_{i≥0} \binom{n}{i}B_{i,k} + \binom{n}{k − 1}.

This recurrence relation is identical to the one given in the proof of Proposition 1, and we get the desired result using that proof.

Proposition 23.

E_{3−21}^{(k−1)(k−2)...1k}(n) = \{ \begin{matrix}0, & if k ≥ 4 \\ (e^{e^{x}}/(k − 1)!) ∫_{0}^{x} t^{k−1}e^{−e^{t}+t} dt, & if k = 2 or k = 3, \\ e^{e^{x}−1}, & if k = 1. \end{matrix}

Proof. If k ≥ 4 then the statement is true, since in this case the pattern (k − 1)(k − 2) … 1k does not avoid the pattern 3 − 21. In the other cases, we use the same arguments as we have in the proof of Proposition 22. The only difference is that instead of decreasing order in τ, we have increasing order.

3.9 Conclusions

The goal of our paper is to give a complete description for the numbers of permutations avoiding a pattern of the form x−yz or xy−z and either beginning with one of the patterns 12 … k, k(k − 1) … 1, 23 … k1, (k − 1)(k − 2) … 1k, or ending with one of the patterns 12 … k, k(k−1) … 1, 1k(k−1) … 2, k12 … (k− 1). This description is given in Sections 5–8. However, some of our results can be generalized to beginning with a pattern belonging to Γ_{k}^{min} or Γ_{k}^{max}, and thus to the ending with a pattern belonging to Δ_{k}^{min} or Δ_{k}^{max} (see Section 3.2 for definitions). An example of such a generalisation is given in Theorem 3 below. This theorem generalizes Propositions 1 and 22 and can be proved by using the same considerations as we do in the proofs of these propositions.

Theorem 3. Suppose p_{1}, p_{2} ∈ Γ_{k}^{min} and p_{1} ∈ S_{k}(1 − 23), p_{2} ∈ S_{k}(1 − 32). Thus, the complements C(p_{1}), C(p_{2}) ∈ Γ_{k}^{max} and C(p_{1}) ∈ S_{k}(1 − 23), C(p_{2}) ∈ S_{k}(3 − 12). Then, we have

E_{1−23}^{p_{1}}(x) = E_{3−21}^{C(p_{1})}(x) = E_{1−32}^{p_{2}}(x) = E_{3−12}^{C(p_{2})}(x) =
\{ \begin{matrix}(e^{e^{x}}/(k − 1)!) ∫_{0}^{x} t^{k−1}e^{−e^{t}+t} dt, & if k ≥ 2, \\ e^{e^{x}−1}, & if k = 1. \end{matrix}

[BabStein] E. Babson, E. Steingrímsson: Generalized permutation patterns and a classification of the Mahonian statistics, Séminaire Lotharingien de Combinatoire, B44b:18pp, 2000.

[Bon] M. Bóna: Exact enumeration of 1342-avoiding permutations: a close link with labeled trees and planar maps. J. Combin. Theory Ser. A 80 (1997), no. 2, 257–272.

[B] M. Bóna: The permutation classes equinumerous to the smooth class. Electron. J. Combin. 5 (1998), no. 1, Research Paper 31, 12 pp. (electronic).

[CW] T. Chow and J. West: Forbidden subsequences and Chebyshev polynomials. Discrete Math. 204 (1999), no. 1-3, 119–128.

[Claes] A. Claesson: Generalised Pattern Avoidance, European J. Combin. 22 (2001), 961-971.

[ClaesMans] A. Claesson and T. Mansour: Permutations avoiding a pair of generalized patterns of length three with exactly one dash, preprint CO/0107044.

[ElizNoy] S. Elizalde and M. Noy: Enumeration of Subwords in Permutations, Proceedings of FPSAC 2001.

[Ent] R. Entringer: A Combinatorial Interpretation of the Euler and Bernoulli Numbers, Nieuw. Arch. Wisk. 14 (1966), 241–246.

[Kit1] S. Kitaev: Multi-avoidance of generalised patterns, Discrete Math., to appear (2002).

[Kit2] S. Kitaev: Partially ordered generalized patterns, Discrete Math., to appear (2002).

[Kit3] S. Kitaev: Generalized pattern avoidance, preprint.

http://www.math.chalmers.se/~kitaev/papers.html

[Knuth] D. E. Knuth: The Art of Computer Programming, 2nd ed. Addison Wesley, Reading, MA, (1973).

[Kr] C. Krattenthaler: Permutations with restricted patterns and Dyck paths, Adv. in Appl. Math. 27 (2001), 510–530.

[K] D. Kremer: Permutations with forbidden subsequnces and a generalized Schröder number, Discrete Math. 218 (2000), 121–130.

[Loth] M. Lothaire: Combinatorics on Words, Encyclopedia of Mathematics and its Applications, 17, Addison-Wesley Publishing Co., Reading, Mass. (1983).

[Mans1] T. Mansour: Continued fractions and generalized patterns, European J. Combin., to appear (2002), math.CO/0110037.

[Mans2] T. Mansour: Continued fractions, statistics, and generalized patterns, to appear in Ars Combinatorica (2002), preprint CO/0110040.

[Mans3] T. Mansour: Restricted 1-3-2 permutations and generalized patterns, Annals of Combinatorics 6 (2002), 1–12.

[MV1] T. Mansour and A. Vainshtein: Restricted permutations, continued fractions, and Chebyshev polynomials, Electron. J. Combin. 7 (2000) no. 1, Research Paper 17, 9 pp. (electronic).

[MV2] T. Mansour and A. Vainshtein: Restricted 132-avoiding permutations, Adv. in Appl. Math. 126 (2001), no. 3, 258–269.

[MV3] T. Mansour and A. Vainshtein: Layered restrictions and Chebyshev polynomials, Annals of Combinatorics 5 (2001), 451–458.

[MV4] T. Mansour and A. Vainshtein: Restricted permutations and Chebyshev polyonomials, Séminaire Lotharingien de Combinatoire 47 (2002), Article B47c.

[R] A. Robertson: Permutations containing and avoiding 123 and 132 patterns, Discrete Math. Theor. Comput. Sci. 3 (1999), no. 4, 151–154 (electronic).

[RWZ] A. Robertson, H. Wilf, and D. Zeilberger: Permutation patterns and continued fractions, Electron. J. Combin. 6 (1999), no. 1, Research Paper 38, 6 pp. (electronic).

[SloPlo] N. J. A. Sloane and S. Plouffe: The Encyclo-

pedia of Integer Sequences,  Academic Press,  (1995).

http://www.research.att.com/~njas/sequences/

[Stan] R. Stanley: Enumerative Combinatorics, Vol. 1, Cambridge University Press, (1997).

[SchSim] R. Simion, F. Schmidt: Restricted permutations, European J. Combin. 6 (1985), no. 4, 383–406.

[W] J. West: Generating trees and forbidden subsequences, Discrete Math. 157 (1996), 363–372.

Paper IV

On multi-avoidance of generalized patterns

On multi-avoidance of generalized patterns

Sergey Kitaev and Toufik Mansour ^{1}

Matematik, Chalmers tekniska högskola och Göteborgs universitet, S-412 96 Göteborg, Sweden

         kitaev@math.chalmers.se, toufik@math.chalmers.se

Abstract

In [Kit1] Kitaev discussed simultaneous avoidance of two 3-patterns with no internal dashes, that is, where the patterns correspond to contiguous subwords in a permutation. In three essentially different cases, the numbers of such npermutations are 2^{n−1}, the number of involutions in S_{n}, and 2E_{n}, where E_{n} is the n-th Euler number. In this paper we give recurrence relations for the remaining three essentially different cases.

To complete the descriptions in [Kit3] and [KitMans], we consider avoidance of a pattern of the form x-y-z (a classical 3-pattern) and beginning or ending with an increasing or decreasing pattern. Moreover, we generalize this problem: we demand that a permutation must avoid a 3-pattern, begin with a certain pattern and end with a certain pattern simultaneously. We find the number of such permutations in case of avoiding an arbitrary generalized 3-pattern and beginning and ending with increasing or decreasing patterns.

4.1 Introduction and Background

Permutation patterns: All permutations in this paper are written as words π = a_{1}a_{2} … a_{n}, where the a_{i} consist of all the integers 1, 2, …, n. Let α ∈ S_{n} and τ ∈ S_{k} be two permutations. We say that α contains τ if there exists a subsequence 1 ≤ i_{1} < i_{2} < ⋯ < i_{k} ≤ n such that (α_{i_{1}}, …, α_{i_{k}}) is orderisomorphic to τ; in such a context τ is usually called a pattern. We say that α avoids τ, or is τ-avoiding, if such a subsequence does not exist. The set of all τ-avoiding permutations in S_{n} is denoted by S_{n}(τ). For an arbitrary finite collection of patterns T, we say that α avoids T if α avoids any τ ∈ T; the corresponding subset of S_{n} is denoted by S_{n}(T).

While the case of permutations avoiding a single pattern has attracted much attention, the case of multiple pattern avoidance remains less investigated. In particular, it is natural, as the next step, to consider permutations avoiding pairs of patterns τ_{1}, τ_{2}. This problem was solved completely for τ_{1}, τ_{2} ∈ S_{3} (see [SchSim]), for τ_{1} ∈ S_{3} and τ_{2} ∈ S_{4} (see [W]), and for τ_{1}, τ_{2} ∈ S_{4} (see [B, K] and references therein). Several recent papers [CW, MV1, Kr, MV3, MV2] deal with the case τ_{1} ∈ S_{3}, τ_{2} ∈ S_{k} for various pairs τ_{1}, τ_{2}.

1Research financed by EC’s IHRP Programme, within the Research Training Network ”Algebraic Combinatorics in Europe”, grant HPRN-CT-2001-00272

Generalized permutation patterns: In [BabStein] Babson and Steingrímsson introduced generalized permutation patterns (GPs) where two adjacent letters in a pattern may be required to be adjacent in the permutation. Such an adjacency requirement is indicated by the absence of a dash between the corresponding letters in the pattern. For example, the permutation π = 516423 has only one occurrence of the pattern 2-31, namely the subword 564, but the pattern 2-3-1 occurs also in the subwords 562 and 563. Note that a classical pattern should, in our notation, have dashes at the beginning and end. Since most of the patterns considered in this paper satisfy this, we suppress these dashes from the notation. Thus, a pattern with no dashes corresponds to a contiguous subword anywhere in a permutation. The motivation for introducing these patterns was the study of Mahonian statistics. A number of results on GPs were obtained by Claesson, Kitaev and Mansour. See for example [Claes], [Kit1, Kit2, Kit3] and [Mans1, Mans2, Mans3].

As in [SchSim], dealing with the classical patterns, one can consider the case when permutations have to avoid two or more generalized patterns simultaneously. A complete solution for the number of permutations avoiding a pair of 3-patterns of type (1,2) or (2,1), that is the patterns having one internal dash, is given in [ClaesMans1]. In [Kit1] Kitaev discussed simultaneous avoidance of two 3-patterns with no internal dashes, that is, where the patterns correspond to contiguous subwords in a permutation. In three essentially different cases, the numbers of such n-permutations are 2^{n−1}, the number of involutions in S_{n}, and 2E_{n}, where E_{n} is the n-th Euler number. The remaining cases are avoidance of 123 and 231, 213 and 231, 132 and 213. In Section 4.3 we give recurrence relations for these cases.

In Section 4, we consider avoidance of a pattern x-y-z, and beginning or ending with increasing or decreasing pattern. This completes the results made in [KitMans], which concerns the number of permutations that avoid a generalized 3-pattern and begin or end with an increasing or decreasing pattern.

In Sections 5–8, we give enumeration for the number of permutations that avoid a generalazed 3-pattern, begin and end with increasing or decreasing patterns. We record our results in terms of either generating functions, or exponential generating functions, or formulas for the numbers appeared.

In Section 4.9, we discuss possible directions of generalization of the results from Sections 5–8.

4.2 Preliminaries

The reverse R(π) of a permutation π = a_{1}a_{2} … a_{n} is the permutation a_{n} … a_{2}a_{1}. The complement C(π) is the permutation b_{1}b_{2} … b_{n} where b_{i} = n + 1 − a_{i}. Also, R ∘ C is the composition of R and C. For example, R(13254) = 45231, C(13254) = 53412 and R ∘ C(13254) = 21435. We call these bijections of S_{n} to itself trivial, and it is easy to see that for any pattern p the number A_{p}(n) of permutations avoiding the pattern p is the same as for the patterns R(p), C(p) and R ∘ C(p). For example, the number of permutations that avoid the pattern 132 is the same as the number of permutations that avoid the pattern 231. This property holds for sets of patterns as well. If we apply one of the trivial bijections to all patterns of a set G, then we get a set G′ for which A_{G′}(n) is equal to A_{G}(n). For example, the number of permutations avoiding {123, 132} equals the number of those avoiding {321, 312} because the second set is obtained from the first one by complementing each pattern.

In this paper we denote the nth Catalan number by C_{n}; the generating function for these numbers by C(x); the nth Bell number by B_{n}.

Also, N_{p}^{q}(n) denotes the number of permutations that avoid the pattern p and begin with the pattern q; G_{p}^{q}(x) (respectively, E_{p}^{q}(x)) denotes the ordinary (respectively, exponential) generating function for the number of such permutations. Besides, N_{p}^{q,r}(n) denotes the number of permutations that avoid the pattern p, begin with the pattern q and end with the pattern r; G_{p}^{q,r}(x) (respectively, E_{p}^{q,r}(x)) denotes the ordinary (respectively, exponential) generating function for the number of such permutations.

Recall the following properties of C(x):

C(x) = \frac{1 − \sqrt{1 − 4x}}{2x} = \frac{1}{1 − xC(x)}.  (4.1)

4.3 Simultaneous avoidance of two 3-patterns with no dashes

4.3.1 Avoidance of patterns 123 and 231 simultaneously

We first consider the avoidance of the patterns 123 and 231 simultaneously.

Let a(n; i_{1}, i_{2}, …, i_{m}) denote the number of permutations π ∈ S_{n}(123, 231) such that π_{1}π_{2} … π_{m} = i_{1}i_{2} … i_{m} and let a(n) = |S_{n}(123, 231)|.

By the definitions, we get that a(n) = ∑_{j=1}^{n} a(n; j) and a(n; n) = a(n − 1). Hence

a(n) = a(n − 1) + a(n; 1) + a(n; 2) + ⋯ + a(n; n − 1).  (4.2)

Also, by the definitions, for all 1 ≤ i ≤ n − 1, we get

a(n; i) = ∑_{j=1}^{i−1} a(n; i, j) + ∑_{j=i+1}^{n} a(n; i, j).  (4.3)

Suppose π ∈ S_{n}(123, 231) is such that π_{1} = i and π_{2} = j. If i > j then there is no occurrence of the pattern 123 or 231 that contains π_{1}, so a(n; i, j) = a(n − 1; j). If i < j then since π avoids 123 and 231, we get that i < π_{3} < j, and thus in this case a(n; i, j) = a(n−2; i)+a(n−2; i+1)+⋯+a(n−2; j −2).

Hence, using (4.2) and (4.3), we get the following theorem.

Proposition 1. Let s_{n} = |S_{n}(123, 231)|. For all n ≥ 3,

s_{n} = s_{n−1} + s_{n}(1) + s_{n}(2) + ⋯ + s_{n}(n − 1),

where for all 1 ≤ i ≤ n,

s_{n}(i) = ∑_{j=1}^{i−1} s_{n−1}(j) + ∑_{j=i}^{n−2}(n − 1 − j)s_{n−2}(j),

and s_{3}(1) = 1, s_{3}(2) = 1, s_{3}(3) = 2.

Using this theorem, we get quickly the first values of the sequence |S_{n}(123, 231)| for n = 0, 1, 2, …, 10:

\begin{matrix}n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\ |S_{n}(123, 231)| & 1 & 1 & 2 & 4 & 11 & 39 & 161 & 784 & 4368 & 27260 & 189540 \end{matrix}

4.3.2 Avoidance of patterns 132 and 213 simultaneously

We consider avoidance of the patterns 132 and 213 simultaneously.

Let b(n; i_{1}, i_{2}, …, i_{m}) denote the number of permutations π ∈ S_{n}(132, 213) such that π_{1}π_{2} … π_{m} = i_{1}i_{2} … i_{m} and let b(n) = |S_{n}(132, 213)|.

Suppose π ∈ S_{n}(132, 213) is such that π_{1} = i and π_{2} = j. If i > j then, since π avoids 213, we get π_{3} ≤ i − 1. Thus

b(n; i, j) = ∑_{k=1, k≠j}^{i−1} b(n − 1; j, k).  (4.4)

If i < j then, since π avoids 132, we get π_{3} ≤ i − 1 or π_{3} ≥ j + 1. Thus

b(n; i, j) = ∑_{k=1}^{i−1} b(n − 1; j − 1, k) + ∑_{k=j}^{n−1} b(n − 1; j − 1, k).  (4.5)

Using (4.4) and (4.5), we get the following theorem.

Proposition 2. Let s_{n} = |S_{n}(132, 213)|. Then s_{n} = ∑_{i,j=1}^{n} s(n; i, j) with s(n; i, i) = 0 for all n, i ≥ 1; s(n; i, j) = ∑_{k=1}^{i−1} s(n − 1; j, k) if i > j; s(n; i, j) = ∑_{k=1}^{i−1} s(n − 1; j − 1, k) + ∑_{k=j}^{n−1} s(n − 1; j − 1, k) if i < j; and s(2; 1, 2) = s(2; 2, 1) = 1, s(2; 1, 1) = s(2; 1, 1) = 0.

Using this theorem, we get

\begin{matrix}n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\ |S_{n}(132, 213)| & 1 & 1 & 2 & 4 & 11 & 37 & 149 & 705 & 3814 & 23199 & 156940 \end{matrix}

4.3.3 Avoidance of the patterns 213 and 231 simultaneously

We now consider avoidance of the patterns 213 and 231 simultaneously. This case is equivalent to avoidance of the patterns 132 and 312 by applying the reverse operation.

Let c(n; i_{1}, i_{2}, …, i_{m}) denote the number of permutations π ∈ S_{n}(132, 312) such that π_{1}π_{2} … π_{m} = i_{1}i_{2} … i_{m} and let c(n) = |S_{n}(132, 312)|. We proceed as in the previous case. For n ≥ i > j ≥ 1, we have

c(n; i, j) = ∑_{k=1}^{j−1} c(n − 1; j, k) + ∑_{k=i}^{n−1} c(n − 1; j, k).  (4.6)

For 1 ≤ i < j ≤ n, we have

c(n; i, j) = ∑_{k=1}^{i−1} c(n − 1; j − 1, k) + ∑_{k=j}^{n−1} c(n − 1; j − 1, k).  (4.7)

Using (4.6) and (4.7), we get the following theorem.

Proposition 3. Let s_{n} = |S_{n}(132, 312)|. Then s_{n} = ∑_{i,j=1}^{n} s(n; i, j) with s(n; i, i) = 0 for all n, i ≥ 1; s(n; i, j) = ∑_{k=1}^{j−1} s(n − 1; j, k) + ∑_{k=i}^{n−1} s(n − 1; j, k) if i > j; s(n; i, j) = ∑_{k=1}^{i−1} s(n − 1; j − 1, k) + ∑_{k=j}^{n−1} s(n − 1; j − 1, k) if i < j; and s(2; 1, 2) = s(2; 2, 1) = 1, s(2; 1, 1) = s(2; 1, 1) = 0.

Using this theorem, we get

\begin{matrix}n & 0 & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 \\ |S_{n}(132, 312)| & 1 & 1 & 2 & 4 & 10 & 30 & 108 & 454 & 2186 & 11840 & 71254 \end{matrix}

4.4 Avoiding a pattern x-y-z and beginning or ending with certain patterns

Recall the definitions of G_{q}^{p}(x), N_{q}^{p}(n), C(x) and C_{n} in Section 4.2.

Proposition 4. We have

G_{1-3-2}^{12...k}(x) = x^{k}C^{2}(x).

Proof. Suppose π = π′nπ′′ ∈ S_{n}(1-3-2) is such that π_{1} < π_{2} < ⋯ < π_{k} and π_{j} = n. It is easy to see that π avoids 1-3-2 if and only if π′ is a 1-3-2-avoiding permutation on the letters n − j + 1, n − j + 2, …, n, and π′′ ∈ S_{n−j}(1-3-2). If we now consider two cases, namely j = k and j ≥ k + 1, we get

G_{1-3-2}^{12...k}(x) = x^{k}C(x) + xG_{1-3-2}^{12...k}(x)C(x).

Thus, G_{1-3-2}^{12...k}(x) = x^{k}C(x)/(1 − xC(x)) and, using (4.1), we get the desired result.

G_{1-3-2}^{k(k−1)...1}(x) = x^{k}C^{k+1}(x).

Proof. Suppose π = π′nπ′′ ∈ S_{n}(1-3-2) is such that π_{1} > π_{2} > ⋯ > π_{k} and π_{j} = n. It is easy to see that π avoids 1-3-2 if and only if π′ is a 1-3-2-avoiding permutation on the letters n − j + 1, n − j + 2, …, n, and π′′ ∈ S_{n−j}(1-3-2). If we consider separately the cases j = 1 and j ≥ 2, we get

G_{1-3-2}^{k(k−1)...1}(x) = xG_{1-3-2}^{(k−1)(k−2)...1}(x) + xG_{1-3-2}^{k(k−1)...1}(x)C(x).

Hence,

G_{1-3-2}^{k(k−1)...1}(x) = xG_{1-3-2}^{(k−1)(k−2)...1}(x)/(1 − xC(x))

and, using (4.1), we get G_{1-3-2}^{k(k−1)...1}(x) = xC(x)G_{1-3-2}^{(k−1)(k−2)...1}(x). By induction on k, using the fact that G_{1-3-2}^{1}(x) = C(x) − 1 = xC^{2}(x), we get the desired result.

Proposition 6. We have

G_{2-1-3}^{12...k}(x) = x^{k}C^{k+1}(x).

Proof. One can use the same considerations as we have in the proof of Proposition 5, by considering a permutation π = π′1π′′ ∈ S_{n}(2-1-3) such that π_{1} < π_{2} < ⋯ < π_{k} and π_{j} = 1.

Proposition 7. We have

G_{2-1-3}^{k(k−1)...1}(x) = x^{k}C^{2}(x).

Proof. One can use the same considerations as we have in the proof of Proposition 4, by considering a permutation π = π′1π′′ ∈ S_{n}(2-1-3) such that π_{1} > π_{2} > ⋯ > π_{k} and π_{j} = 1.

Let s_{n}(i_{1}, …, i_{m}) denote the number of permutations π ∈ S_{n}(1-2-3) such that π_{1}π_{2} … π_{m} = i_{1}i_{2} … i_{m}. It is easy to see that

s_{n}(n) = s_{n}(n − 1) = C_{n−1},  (4.8)

and

s_{n}(t) = s_{n}(t, n) + ∑_{j=1}^{t−1} s_{n}(t, j) = s_{n−1}(t) + ∑_{j=1}^{t−1} s_{n−1}(j).  (4.9)

Now, (4.8) and (4.9) with induction on t give

s_{n}(n − t) = ∑_{j=0}^{t}(−1)^{j}\binom{t − j}{j}C_{n−j}  (4.10)

Let us prove the following proposition.

G_{1-2-3}^{12...k}(x) = \{ \begin{matrix}0, & if k ≥ 3, \\ x^{2}C^{2}(x), & if k = 2, \\ xC^{2}(x), & if k = 1 . \end{matrix}

Proof. For k ≥ 3, the statement is obviously true. If k = 1 then G_{1-2-3}^{1}(x) = C(x) − 1 = xC^{2}(x).

Suppose now that k = 2. From the definitions, for all n ≥ 2, we have

N_{1-2-3}^{12}(n) = ∑_{i=1}^{n−1} ∑_{j=i+1}^{n} s_{n}(i, j).

In this formula, j can only be equal to n, since otherwise we have an occurrence of the pattern 1-2-3. Using this fact with (4.8) and (4.9), we get for n ≥ 2,

N_{1-2-3}^{12}(n) = ∑_{i=1}^{n−1} s_{n}(i, n) = ∑_{i=1}^{n−1} s_{n−1}(i) = C_{n−1}.

Hence, G_{1-2-3}^{12}(x) = x(C(x) − 1) = x^{2}C^{2}(x).

Proposition 9. We have

N_{1-2-3}^{k(k−1)...1}(n) = ∑_{t=1}^{n+1−k} \binom{n − t}{k − 1} ∑_{j=0}^{n−t}(−1)^{j}\binom{n − t − j}{j}C_{n−t−j}.

Proof. From the definitions, we have

N_{1-2-3}^{k(k−1)...1}(n) = ∑_{i_{1}=k}^{n} ∑_{i_{2}=1}^{i_{1}−1} ⋯ ∑_{i_{k}=1}^{i_{k−1}−1} s_{n}(i_{1}, …, i_{k}) = ∑_{t=1}^{n+1−k} \binom{n − t}{k − 1}s_{n}(t).

Using (4.10), we get

N_{1-2-3}^{k(k−1)...1}(n) = ∑_{t=1}^{n+1−k} \binom{n − t}{k − 1} ∑_{j=0}^{n−t}(−1)^{j}\binom{n − t − j}{j}C_{n−t−j}.

4.5 Avoiding a pattern x-y-z, beginning and ending with certain patterns simultaneously

Recall the definitions of G_{q}^{p,r}(x) and N_{q}^{p,r}(n) in Section 4.2.

Proposition 10. We have (i) G_{1-3-2}^{12...k,12...ℓ}(x) = x^{k+ℓ−1}C^{ℓ+1}(x) + \frac{x^{m}−x^{k+ℓ−1}}{1−x}.

(ii) G_{1-3-2}^{12...k,ℓ(ℓ−1)...1}(x) = x^{k+ℓ−1}C^{2}(x).

(iii) G_{1-3-2}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) = x^{k+ℓ−1}C^{k+1}(x)+\frac{x^{m}−x^{k+ℓ−1}}{1−x}, where m = max(k, ℓ).

(iv) the generating function G_{1-3-2}(x, y, z) = ∑_{k,ℓ≥0} G_{1-3-2}^{k(k−1)...1,12...ℓ}(x)y^{k}z^{ℓ} for the sequence {G_{1-3-2}^{k(k−1)...1,12...ℓ}(x)}_{k,ℓ≥0} (where k and ℓ go through all natural numbers) is

\frac{1}{1 − x(y + z)} (x(y + z + yz) + \frac{C(x) − 1}{(1 − xyC(x))(1 − xzC(x))}) .

Proof.

Beginning with 12 … k and ending with ℓ(ℓ − 1) … 1: Suppose π = π′nπ′′ ∈ S_{n}(1-3-2) is such that π_{1} < π_{2} < ⋯ < π_{k}, π_{n} < π_{n−1} < ⋯ < π_{n−ℓ+1} and π_{j} = n. It is easy to see that π avoids 1-3-2 if and only if π′ is a 1-3-2-avoiding permutation on the letters n − j + 1, n − j + 2, …, n, and π′′ ∈ S_{n−j}(1-3-2). We now consider three cases, namely j = k, k +1 ≤ j ≤ n−ℓ and j = n − ℓ + 1. In terms of generating functions, we have

G_{1-3-2}^{12...k,ℓ(ℓ−1)...1}(x) = x^{k}G_{2-1-3}^{ℓ(ℓ−1)...1}(x)+xG_{1-3-2}^{12...k}(x)G_{2-1-3}^{ℓ(ℓ−1)...1}(x)+x^{ℓ}G_{1-3-2}^{12...k}(x)+x^{k+ℓ−1},

where we observed that to avoid 1-3-2 and end with ℓ(ℓ−1) … 1 is the same as to avoid 2-1-3 and begin with ℓ(ℓ−1) … 1 by applying the reverse and complement operations. Also, we added the term x^{k+ℓ−1}, since when j = k = n − ℓ + 1, we have one “good” (k + ℓ − 1)-permutation, which is not counted by our three cases.

From Propositions 4 and 7, we have that

G_{1-3-2}^{12...k}(x) = x^{k}C^{2}(x) and G_{2-1-3}^{ℓ(ℓ−1)...1}(x) = x^{ℓ}C^{2}(x).

Thus, using the fact that xC^{2}(x) = C(x) − 1, we get

\begin{matrix}G_{1-3-2}^{12...k,ℓ(ℓ−1)...1}(x) = x^{k+ℓ}C^{2}(x)(2 + xC^{2}(x)) + x^{k+ℓ−1} \\ = x^{k+ℓ−1}(C(x) − 1)(C(x) + 1) + x^{k+ℓ−1} = x^{k+ℓ−1}C^{2}(x). \end{matrix}

Beginning with 12 … k and ending with 12 … ℓ: Suppose π = π′nπ′′ ∈ S_{n}(1-3-2) is such that π_{1} < π_{2} < ⋯ < π_{k}, π_{n} > π_{n−1} > ⋯ > π_{n−ℓ+1} and π_{j} = n. As above, π avoids 1-3-2 if and only if π′ is a 1-3-2-avoiding permutation on the letters n − j + 1, n − j + 2, …, n, and π′′ ∈ S_{n−j}(1-3-2). We consider the cases j = k, k + 1 ≤ j ≤ n − ℓ and j = n. In terms of generating functions, the first approximation for the function G_{1-3-2}^{12...k,12...ℓ}(x) is

G_{1-3-2}^{12...k,12...ℓ}(x) ≈ x^{k}G_{2-1-3}^{12...ℓ}(x) + xG_{1-3-2}^{12...k}(x)G_{2-1-3}^{12...ℓ}(x) + xG_{1-3-2}^{12...k,12...(ℓ−1)}(x),

where we observed that to avoid 1-3-2 and end with 12 … ℓ is the same as to avoid 2-1-3 and begin with 12 … ℓ by applying the reverse and complement operations. We use the sign “≈” because there are some “good” permutations, which are not counted by our considerations. We discuss them below.

From Propositions 4 and 6, we have that G_{1-3-2}^{12...k}(x) = x^{k}C^{2}(x) and G_{2-1-3}^{12...ℓ}(x) = x^{ℓ}C^{ℓ+1}(x). Thus, using the fact that xC^{2}(x) = C(x) − 1 and G_{1-3-2}^{12...k,1}(x) = G_{1-3-2}^{12...k}(x) = x^{k}C^{2}(x) (Proposition 4), we get

G_{1-3-2}^{12...k,12...ℓ}(x)

≈ x^{k+ℓ}C^{ℓ+1}(x) + x^{k+ℓ+1}C^{ℓ+3}(x) + xG_{1-3-2}^{12...k,12...(ℓ−1)}(x)
= x^{k+ℓ}C^{ℓ+2}(x) + xG_{1-3-2}^{12...k,12...(ℓ−1)}(x)
= x^{k+ℓ}C^{ℓ+2}(x) + x^{k+ℓ}C^{ℓ+1}(x) + x^{2}G_{1-3-2}^{12...k,12...(ℓ−2)}(x)
= ⋯ = x^{k+ℓ}C^{4}(x)(C^{ℓ−2}(x) + C^{ℓ−3}(x) + ⋯ + 1) + x^{k+ℓ−1}C^{2}(x)

= x^{k+ℓ−1}(C(x) − 1)C^{2}(x)\frac{1−C^{ℓ−1}(x)}{1−C(x)} + x^{k+ℓ−1}C^{2}(x) = x^{k+ℓ−1}C^{ℓ+1}(x).

To complete the proof of this case, we observe that in our considerations above, we do not count increasing permutations of length m = max(k, ℓ), m+1, …, k+ ℓ − 2, which satisfy all our restrictions. We did not count them because the kbeginning and ℓ-ending in these permutations overlap in more than one letter. So, to get the desired result, we need to add the term

x^{m} + x^{m+1} + … + x^{k+ℓ−2} = (x^{m} − x^{k+ℓ−1})/(1 − x)

to the approximate value of G_{1-3-2}^{12...k,12...ℓ}(x). For example, expanding G_{1-3-2}^{12,123}(x), we have, in particular, that there are 2002 10-permutations that avoid 1-3-2, begin with the pattern 12 and end with the pattern 123.

Beginning with k(k − 1) … 1 and ending with ℓ(ℓ − 1) … 1: If ℓ = 1 then, by Proposition 5, G_{1-3-2}^{k(k−1)...1,1}(x) = x^{k}C^{k+1}(x). Suppose ℓ ≥ 2, and π = π′1π′′ ∈ S_{n}(1-3-2) is such that π_{1} > π_{2} > ⋯ > π_{k}, π_{n} < π_{n−1} < ⋯ < π_{n−ℓ+1} and π_{j} = 1. Obviously, π′′ is the empty word, since otherwise we have an occurrence of the pattern 1-3-2 starting from the letter 1. Thus, the first approximation for the function G_{1-3-2}^{k(k−1)...1,ℓ(ℓ−1)...1} is

G_{1-3-2}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) ≈ xG_{1-3-2}^{k(k−1)...1,(ℓ−1)(ℓ−2)...1}(x) = ⋯ = x^{k+ℓ−1}C^{k+1}(x).

Like in the previous case, we did not count decreasing permutations of length m = max(k, ℓ), m + 1, …, k + ℓ − 2, which satisfy all our restrictions. Thus, to get the desired result, we add the term (x^{m}−x^{k+ℓ−1})/(1−x) to the approximate value of G_{1-3-2}^{k(k−1)...1,ℓ(ℓ−1)...1}(x).

Beginning with k(k − 1) … 1 and ending with 12 … ℓ: Suppose π = π′nπ′′ ∈ S_{n}(1-3-2). Any letter of π′ is greater than any letter of π′′, since otherwise we have an occurrence of the pattern 1-3-2 in π containing the letter n which is forbidden. Also, π′ and π′′ avoid 1-3-2. If π begins with k(k−1) … 1, ends with 12 … ℓ and π′ and π′′ are not empty, then π′ must begin with k(k − 1) … 1 and π′′ must end with 12 … ℓ. If π′ is empty then π′′ must begin with (k − 1)(k − 2) … 1 and end with 12 … ℓ. If π′′ is empty then π′ must begin with k(k − 1) … 1 and end with 12 … (ℓ − 1). In terms of generating functions, the discussion above leads to the following:

G_{1-3-2}^{k(k−1)...1,12...ℓ}(x) ≈

xG_{1-3-2}^{k(k−1)...1}(x)G_{2-1-3}^{12...ℓ}(x) + xG_{1-3-2}^{(k−1)...1,12...ℓ}(x) + xG_{1-3-2}^{k(k−1)...1,12...(ℓ−1)}(x),

where we observed that to avoid 1-3-2 and end with 12 … ℓ is the same as to avoid 2-1-3 and begin with 12 … ℓ. However, to put the sign “=” instead of “≈”, we have to correct the right-hand side of the recurrence relation by observing that when either k = 1 and ℓ = 0, or k = 0 and ℓ = 1, or k = 1 and ℓ = 1, the formula do not count the permutation π = 1 which satisfies all the conditions needed. Thus, if we make correction of the right-hand side, then multiply both parts of the obtained equality by x^{k}y^{ℓ} and sum over all natural k and ℓ we get (recall the definition of G_{1-3-2}(x, y, z) in the statement of the theorem):

G_{1-3-2}(x, y, z) = x ∑_{k,ℓ≥0} G_{1-3-2}^{k(k−1)...1}(x)G_{2-1-3}^{12...ℓ}(x)y^{k}z^{ℓ}+x(y+z)G_{1-3-2}(x, y, z)+x(y+z+yz).

From Propositions 5 and 6, G_{1-3-2}^{k(k−1)...1}(x)G_{2-1-3}^{12...ℓ}(x) = x^{k+ℓ}C^{k+ℓ+2}(x), and thus

G_{1-3-2}(x, y, z) = \frac{1}{1−x(y+z)} (x(y + z + yz) + ∑_{k,ℓ≥0} x^{k+ℓ}C^{k+ℓ+2}(x)y^{k}z^{ℓ})

= \frac{1}{1−x(y+z)} (x(y + z + yz) + zC^{2}(z) ∑_{k≥0}(xyC(x))^{k} ∑_{ℓ≥0}(xzC(x))^{ℓ})

= \frac{1}{1−x(y+z)} (x(y + z + yz) + \frac{C(x)−1}{(1−xyC(x))(1−xzC(x))}) ,

where we used that xC^{2}(x) = C(x) − 1.

Proposition 11. We have

(i) G_{2-1-3}^{12...k,12...ℓ}(x) = x^{k+ℓ−1}C^{k+1}(x) + \frac{x^{m}−x^{k+ℓ−1}}{1−x}.

(ii) G_{2−1−3}^{k(k−1)...1,12...ℓ}(x) = x^{k+ℓ−1}C^{2}(x).

(iii) G_{2-1-3}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) = x^{k+ℓ−1}C^{ℓ+1}(x)+\frac{x^{m}−x^{k+ℓ−1}}{1−x}, where m = max(k, ℓ).

(iv) the generating function G_{2-1-3}(x, y, z) = ∑_{k,ℓ≥0} G_{2-1-3}^{12...k,ℓ(ℓ−1)...1}(x)y^{k}z^{ℓ} for the sequence {G_{2-1-3}^{12...k,ℓ(ℓ−1)...1}(x)}_{k,ℓ≥0} (where k and ℓ go through all natural numbers) is

\frac{1}{1 − x(y + z)} (x(y + z + yz) + \frac{C(x) − 1}{(1 − xyC(x))(1 − xzC(x))}) .

Proof. We apply the reverse and complement operations and then use the results of Proposition 10. For example, to avoid 2-1-3, begin with 12 … k and end with 12 … ℓ is the same as to avoid 1-3-2, begin with 12 … ℓ and end with 12 … k.

Let h_{n}^{k,ℓ}(t; s) denote the number of 1-2-3-avoiding n-permutations such that π_{k} = t, π_{n−ℓ+1} = s, π_{1} > π_{2} > ⋯ > π_{k}, and π_{n−ℓ+1} > π_{n−ℓ+2} > ⋯ > π_{n}. Also, we define g_{n}(i_{1}, i_{2}, …, i_{m}; b) to be the number of 1-2-3-avoiding npermutations such that π_{1}π_{2} ⋯ π_{m} = i_{1}i_{2} … i_{m} and π_{n} = b. We need the following two lemmas to prove Proposition 12.

Lemma 1. For all n ≥ 2,

g_{n}(a; b) = \{ \begin{matrix}0, & 2 ≤ a + 1 < b ≤ n, \\ \binom{n−2}{a−1}, & 1 ≤ a ≤ n − 1, \\ ∑_{j=0}^{n−a}(−1)^{j}\binom{n−a−j}{j} ( ∑_{i=0}^{b−1}(−1)^{i}\binom{b−1−i}{i}C_{n−2−j−i}) , & 1 ≤ b < a ≤ n. \end{matrix}

Proof. By definitions we have (1) g_{n}(a; b) = 0 for all 2 ≤ a + 1 < b ≤ n;

(2) g_{n}(a; a + 1) = g_{n}(a, 1; a + 1) + … + g_{n}(a, a − 1; a + 1) + g_{n}(a, a + 2; a + 1) + … + g_{n}(a, n − 1; a + 1) + g_{n}(a, n; a + 1). Using the fact that no there exists a permutation π ∈ S_{n}(1-2-3) such that π_{1} = a, π_{2} ≤ a − 2, and π_{n} = a + 1 we get

g_{n}(a; a + 1) = g_{n}(a, a − 1; a + 1) + g_{n}(a, a + 2; a + 1) + … + g_{n}(a, n; a + 1).

Using the fact that no there exists a permutation π ∈ S_{n}(1-2-3) such that π_{1} = a and a ≤ π_{2} ≤ n − 1 we get g_{n}(a; a + 1) = g_{n}(a, a − 1; a + 1) + g_{n}(a, n; a + 1). On the other hand, it is easy to see that g_{n}(a, a − 1; a + 1) = g_{n−1}(a − 1; a) and g_{n}(a, n; a + 1) = g_{n−1}(a; a + 1). Hence,

g_{n}(a; a + 1) = g_{n−1}(a − 1; a) + g_{n−1}(a; a + 1).

Using induction we get that g_{n}(a; a+1) = \binom{n−2}{a−1} for all n ≥ 2 and 1 ≤ a ≤ n−1. (3) Similarly as (2) we have for all a > b,

g_{n}(a; b) = g_{n−1}(b − 1; b) + g_{n−1}(b + 1; b) + g_{n−1}(b + 2; b) + ⋯ + g_{n−1}(a; b).

Using Equation (4.10) we get

g_{n}(a; 1) = g_{n}(a; 2) = s_{n−1}(a − 1) = ∑_{j=0}^{n−a}(−1)^{j}\binom{n − a − j}{j}C_{n−2−j}.

Using induction on b, we get

g_{n}(a; b) = ∑_{j=0}^{n−a}(−1)^{j}\binom{n − a − j}{j} (∑_{i=0}^{b−1}(−1)^{i}\binom{b − 1 − i}{i}C_{n−2−j−i}) .

Lemma 2. We have

h_{n}^{k,ℓ}(t; s) = \{ \begin{matrix}\binom{n−t}{k−1}\binom{s−1}{ℓ−1}g_{t−(ℓ−1);s−(ℓ−1)}(n + 2 − k − ℓ), & if 1 ≤ s < t ≤ n; \\ h_{n}^{k,ℓ}(t + 1; t), & if s = t + 1; \\ h_{n−1}^{k,ℓ−1}(t; s − 1) + h_{n−1}^{k−1;ℓ}(t; s − 1), & if 2 ≤ t + 1 < s ≤ n. \end{matrix}

Proof. (1) Let n ≥ t > s ≥ 1; so by definitions we get

h_{n}^{k,ℓ}(t; s) = \binom{n − t}{k − 1}\binom{s − 1}{ℓ − 1}g_{t−(ℓ−1);s−(ℓ−1)}(n − (k − 1) − (ℓ − 1)).

(2) Let s = t + 1; so it is easy to see h_{n}^{k,ℓ}(t; t + 1) = h_{n}^{k,ℓ}(t + 1; t);

(3) Let 2 ≤ t + 1 < s ≤ n. Let π any permutations in S_{n}(1-2-3) such that π_{k} = t and π_{n+1−ℓ} = s where π_{1} > ⋯ > π_{k} and π_{n+1−ℓ} > ⋯ > π_{n}; so there two possibilities either π_{n+2−ℓ} = s−1 or π_{j} = s−1 where j ≤ k −1. In this first case we get that there exist h_{n−1}^{k,ℓ−1}(t; s−1) permutations, and in the second case we have that there exist h_{n−1}^{k−1;ℓ}(t; s − 1) permutations. (we extend the number h_{n}^{k,l}(a; b) as 0 for any ℓ ≤ 0 or k ≤ 0.

We recall that the Kronecker delta δ_{n,k} is defined to be

δ_{n,k} = \{ \begin{matrix}1, & if n = k, \\ 0, & else. \end{matrix}

Proposition 12. We have

(i) G_{1-2-3}^{12...k,12...ℓ}(x) = \{ \begin{matrix}0, & if k ≥ 3 or ℓ ≥ 3 \\ xC^{2}(x), & if k = 1 and ℓ = 1 \end{matrix} ,

N_{1-2-3}^{12,12}(n) = \{ \begin{matrix}0, & if n = 3 \\ C_{n−2}, & else \end{matrix} , and

N_{1-2-3}^{12,1}(n) = N_{1−2−3}^{1,12}(n) = C_{n−1}.

(ii) N_{1-2-3}^{k(k−1)...1,12...ℓ}(n) =

\{ \begin{matrix}0, & if ℓ ≥ 3, \\ ∑_{t=1}^{n−k} \binom{n−t−1}{k−1} ∑_{j=0}^{n−t−1}(−1)^{j}\binom{n−t−j−1}{j}C_{n−t−j−1} + (k − 1)δ_{n,k+1}, & if ℓ = 2, \\ ∑_{t=1}^{n+1−k} \binom{n−t}{k−1} ∑_{j=0}^{n−t}(−1)^{j}\binom{n−t−j}{j}C_{n−t−j}, & if ℓ = 1. \end{matrix}

(iii) N_{1-2-3}^{12...k,ℓ(ℓ−1)...1}(n) =

\{ \begin{matrix}0, & if k ≥ 3, \\ ∑_{t=1}^{n−ℓ} \binom{n−t−1}{ℓ−1} ∑_{j=0}^{n−t−1}(−1)^{j}\binom{n−t−j−1}{j}C_{n−t−j−1} + (ℓ − 1)δ_{n,ℓ+1}, & if k = 2, \\ ∑_{t=1}^{n+1−ℓ} \binom{n−t}{ℓ−1} ∑_{j=0}^{n−t}(−1)^{j}\binom{n−t−j}{j}C_{n−t−j}, & if k = 1. \end{matrix}

(iv) N_{1−2−3}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) = ∑_{t=1}^{n−k+1} ∑_{s=ℓ}^{n} h_{n}^{k,ℓ}(t; s), where h_{n}^{k,ℓ}(t; s) is given in Lemma 2.

Proof. Beginning with 12 … k and ending with 12 … ℓ: If k ≥ 3 or ℓ ≥ 3, the statement is obvious, since in this case 12 … k or 12 … ℓ does not avoid the pattern 1-2-3. If k = 1 or ℓ = 1, we get the statement from Proposition 8 (in the first of these cases we apply the reverse and complement operations). Suppose now that k = 2, ℓ = 2, and an n-permutation π avoids 1-2-3, begins with the pattern 12 and ends with the pattern 12. The letter n must be next to the leftmost letter, since otherwise two leftmost letters and n form the pattern 1-2-3. Also, the letter 1 must be next to the rightmost letter, since otherwise 1 and two rightmost letters form the pattern 1-2-3. It is easy to see now that there are C_{n−2} possibilities to choose π, since we can take any 1-2-3-avoiding permutation on the letters {2, 3, …, n−1} (there are C_{n−2} such permutations), then let the letters n and 1 be in the second and (n−1)-st positions respectively. These considerations are fail only when n = 3, since in this case the second and (n − 1)-st positions coincide. However, in this case we obviously have no permutations with the good properties.

Beginning with k(k −1) … 1 and ending with 12 … ℓ: The statement is true for ℓ ≥ 3, since in this case 12 … ℓ does not avoid 1-2-3. For the case ℓ = 1 we use Proposition 9. Suppose now that ℓ = 2, and an n-permutation π avoids 1-2-3, begins with the pattern k(k − 1) … 1 and ends with the pattern 12. The letter 1 must be next to the rightmost letter, since otherwise 1 and two rightmost letters form the pattern 1-2-3. So, to form π we can take any (n−1)-permutation on the letters {2, 3, …, n} that avoid 1-2-3 and begin with the pattern k(k − 1) … 1 (the number of such permutations is given by Proposition 9), and then let the letter 1 be in the (n − 1)-st position. Also, we observe that in the case n = k + 1 we have k − 1 extra permutations, which are obtained from the (n − 1)-permutations having the k − 1 leftmost letters in decreasing order and two rightmost letters in increasing order.

Beginning with 12 … k and ending with ℓ(ℓ − 1) … 1: By the reverse and complement operations, to avoid 1-2-3, begin with the pattern 12 … k and end with the pattern ℓ(ℓ − 1) … 1 is the same as to avoid 1-2-3, begin with the pattern ℓ(ℓ − 1) … 1 and end with the pattern 12 … k, so we can apply the results of the previous case.

Beginning with k(k − 1) … 1 and ending with ℓ(ℓ − 1) … 1: The statement is straitforward to prove.

4.6 Avoiding a pattern xyz, beginning and ending with certain patterns simultaneously

Recall the definitions of E_{q}^{p,r}(x) in Section 4.2.

Proposition 13. We have

(i) E_{213}^{12...k,12...ℓ}(x) = \{ \begin{matrix}E_{132}^{12...ℓ}(x), & if k = 1 \\ E_{213}^{12...k}(x), & if ℓ = 1 \end{matrix} , where E_{132}^{12...ℓ}(x) and E_{213}^{12...k}(x)

are given in [Kit3, Theorem 6] and [Kit3, Theorem 10] respectively. For k, ℓ ≥ 2, E_{213}^{12...k,12...ℓ}(x) satisfies

\frac{∂}{∂x}E_{213}^{12...k,12...ℓ}(x) = E_{213}^{12...k,12...(ℓ−1)}(x)+(E_{213}^{12...k,12}(x) + \frac{x^{k−1}}{(k − 1)!}) E_{132}^{12...ℓ}(x).

(ii) E_{213}^{12...k,ℓ(ℓ−1)...1}(x) = \{ \begin{matrix}E_{132}^{ℓ(ℓ−1)...1}(x), & if k = 1 \\ E_{213}^{12...k}(x), & if ℓ = 1 \end{matrix} , where E_{132}^{ℓ(ℓ−1)...1}(x) and

E_{213}^{12...k}(x) are given in [Kit3, Theorem 7] and [Kit3, Theorem 10] respectively. For k, ℓ ≥ 2, E_{213}^{12...k,ℓ(ℓ−1)...1}(x) satisfies

\frac{∂}{∂x}E_{213}^{12...k,ℓ(ℓ−1)...1}(x) = \frac{x^{ℓ−1}}{(ℓ − 1)!}E_{213}^{12...k}(x)+

(E_{213}^{12...k,12}(x) + \frac{x^{k−1}}{(k − 1)!}) E_{132}^{ℓ(ℓ−1)...1}(x) + \binom{k + ℓ − 2}{k − 1}\frac{x^{k+ℓ−2}}{(k + ℓ − 2)!}.

(iii) E_{213}^{k(k−1)...1,12...ℓ}(x) = \{ \begin{matrix}E_{132}^{12...ℓ}(x), & if k = 1 \\ E_{213}^{k(k−1)...1}(x), & if ℓ = 1 \end{matrix} , where E_{132}^{12...ℓ}(x) and

E_{213}^{k(k−1)...1}(x) are given in [Kit3, Theorem 6] and [Kit3, Theorem 11] respectively. For k, ℓ ≥ 2, E_{213}^{k(k−1)...1,12...ℓ}(x) satisfies

\frac{∂}{∂x}E_{213}^{k(k−1)...1,12...ℓ}(x) = E_{213}^{(k−1)...1,12...ℓ}(x)+

E_{213}^{k(k−1)...1,12}(x)E_{132}^{12...ℓ}(x) + E_{213}^{k(k−1)...1,12...(ℓ−1)}(x).

(iv) E_{213}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) = \{ \begin{matrix}E_{132}^{ℓ(ℓ−1)...1}(x), & if k = 1 \\ E_{213}^{k(k−1)...1}(x), & if ℓ = 1 \end{matrix} , where E_{132}^{ℓ(ℓ−1)...1}(x)

and E_{213}^{k(k−1)...1}(x) are given in [Kit3, Theorem 7] and [Kit3, Theorem 11] respectively. For k, ℓ ≥ 2, E_{213}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) satisfies

\frac{∂}{∂x}E_{213}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) = E_{213}^{(k−1)...1,ℓ(ℓ−1)...1}(x)+

(E_{132}^{ℓ(ℓ−1)...1}(x) + \frac{x^{ℓ−1}}{(ℓ − 1)!}) E_{213}^{k(k−1)...1,12}(x).

Proof.

Beginning with 12 … k and ending with ℓ(ℓ − 1) … 1: The statement is obviously true when k = 1 and ℓ = 1. Suppose now that k ≥ 2, ℓ ≥ 2 and an (n + 1)-permutation π avoids 213, begins with the pattern 12 … k and ends with the pattern 12 … ℓ. The letter (n + 1) can only be in the position k, or in the position i, where (k + 1) ≤ i ≤ n − ℓ + 1, or in the position n − ℓ + 2.

In the first case, we choose the (k − 1) leftmost letters in \binom{n}{k−1} ways, rearrange them into the increasing order, and observe, that the letters of π to the right of (n+1) must form an (n−k +1)-permutation, that avoids 213 and ends with the pattern ℓ(ℓ − 1) … 1 (the number of such permutations, using the reverse and complement operation, is equal to the number of (n − k + 1)-permutations that avoid 132 and begin with the pattern ℓ(ℓ−1) … 1). In the third case, we choose the (ℓ − 1) rightmost letters in \binom{n}{ℓ−1} ways, rearrange them into the decreasing order, and observe, that the letters of π to the right of (n + 1) must form an (n − ℓ + 1)-permutation, that avoids 213, begins with the pattern 12 … k, and ends with the pattern 12 (if it ends with the pattern 21, the letter (n + 1) and two letters immediately to the left of it form the pattern 213). In the second case, we choose the letters of π to the left of (n + 1) in \binom{n}{i−1} ways and observe, that these letters must form a (i − 1)-permutation that avoids 213, begins with the pattern 12 … k and ends with the pattern 12. In the same time, the letters to the right of (n + 1) must form an (n − i + 2)-permutation that avoids 213 and ends with the pattern ℓ(ℓ − 1) … 1. Besides, we observe that if n = k + ℓ − 2, that is |π| = k + ℓ − 1, and first k-letters of π are rearranged into the increasing order, whereas the last ℓ letters are rearranged in the decreasing order, we have a number of extra “good” permutations. The number of such permutations is the number of ways of choosing the first (k − 1) letters, that is \binom{k+ℓ−2}{k−1}. This discussion leads to the following:

\begin{matrix}N_{213}^{12...k,ℓ(ℓ−1)...1}(n + 1) = \binom{n}{k−1}N_{132}^{ℓ(ℓ−1)...1}(n − k + 1) + \binom{n}{ℓ−1}N_{213}^{12...k}(n − ℓ + 1) \\ + ∑_{i=0}^{n} \binom{n}{i}N_{213}^{12...k,12}(i)N_{132}^{ℓ(ℓ−1)...1}(n − i) + \binom{k + ℓ − 2}{k − 1}δ_{n,k+ℓ−2}, \end{matrix}

where δ_{n,k+ℓ−2} is the Kronecker delta. We get the desirable result by multiplying both sides of the last equality by x^{n}/n! and summing over n.

Beginning with 12 … k and ending with 12 … ℓ: The statement is obviously true when k = 1 and ℓ = 1. Suppose now that k ≥ 2, ℓ ≥ 2 and an (n+1)-permutation π avoids 213, begins with the pattern 12 … k and ends with the pattern 12 … ℓ. The letter (n + 1) can only be in the position k, or in the position i, where (k + 1) ≤ i ≤ n − ℓ, or in the (n + 1)-th position. In the last case, the number of such permutations is obviously N_{213}^{12...k,12...ℓ−1}(n). In the first case, we choose the (k − 1) leftmost letters in \binom{n}{k−1} ways, rearrange them into increasing order, and observe, that the letters of π to the right of (n + 1) must form an (n−k+1)-permutation, that avoids 213 and ends with the pattern 12 … ℓ (the number of such permutations, using the reverse and complement operation, is equal to the number of (n − k + 1)-permutations that avoid 132 and begin with the pattern 12 … ℓ). In the second case, we choose the letters of π to the left of (n + 1) in \binom{n}{i−1} ways and observe, that these letters must form a (i − 1)-permutation that avoids 213, begins with the pattern 12 … k and ends with the pattern 12 (if it ends with the pattern 21, the letter (n + 1) and two letters immediately to the left of it form the pattern 213). In the same time, the letters to the right of (n + 1) must form an (n − i + 2)-permutation that avoids 213 and ends with the pattern 12 … ℓ. This discussion leads to the following:

\begin{matrix}N_{213}^{12...k,12...ℓ}(n + 1) = N_{213}^{12...k,12...ℓ−1}(n) \\ + ∑_{i=0}^{n} \binom{n}{i}N_{213}^{12...k,12}(i)N_{132}^{12...ℓ}(n − i) + \binom{n}{k − 1}N_{132}^{12...ℓ}(n − k + 1). \end{matrix}

We get the desirable result by multiplying both sides of the last equality by x^{n}/n! and summing over n.

Beginning with k(k − 1) … 1 and ending with 12 … ℓ or with ℓ(ℓ − 1) … 1: We proceed in the same way as we do under considering the previous case.

Proposition 14. We have

(i) E_{132}^{12...k,12...ℓ}(x) = \{ \begin{matrix}E_{213}^{12...ℓ}(x), & if k = 1 \\ E_{132}^{12...k}(x), & if ℓ = 1 \end{matrix} , where E_{213}^{12...ℓ}(x) and E_{132}^{12...k}(x)

are given in [Kit3, Theorem 10] and [Kit3, Theorem 6] respectively. For k, ℓ ≥ 2, E_{132}^{12...k,12...ℓ}(x) satisfies

\frac{∂}{∂x}E_{132}^{12...k,12...ℓ}(x) = E_{132}^{12...k−1,12...ℓ}(x)+(E_{132}^{12,12...ℓ}(x) + \frac{x^{ℓ−1}}{(ℓ − 1)!}) E_{132}^{12...k}(x).

(ii) E_{132}^{12...k,ℓ(ℓ−1)...1}(x) = \{ \begin{matrix}E_{132}^{12...k}(x), & if ℓ = 1 \\ E_{213}^{ℓ(ℓ−1)...1}(x), & if k = 1 \end{matrix} , where E_{132}^{12...k}(x) and

E_{213}^{ℓ(ℓ−1)...1}(x) are given in [Kit3, Theorem 6] and [Kit3, Theorem 11] respectively. For k, ℓ ≥ 2, E_{132}^{12...k,ℓ(ℓ−1)...1}(x) satisfies

\frac{∂}{∂x}E_{132}^{12...k,ℓ(ℓ−1)...1}(x) = E_{132}^{12...k,(ℓ−1)...1}(x)+

E_{132}^{12,ℓ(ℓ−1)...1}(x)E_{132}^{12...k}(x) + E_{132}^{12...(k−1),ℓ(ℓ−1)...1}(x).

(iii) E_{132}^{k(k−1)...1,12...ℓ}(x) = \{ \begin{matrix}E_{213}^{12...ℓ}(x), & if k = 1 \\ E_{132}^{k(k−1)...1}(x), & if ℓ = 1 \end{matrix} , where E_{213}^{12...ℓ}(x) and

E_{132}^{k(k−1)...1}(x) are given in [Kit3, Theorem 10] and [Kit3, Theorem 7] respectively. For k, ℓ ≥ 2, E_{132}^{k(k−1)...1,12...ℓ}(x) satisfies

\begin{matrix}\frac{∂}{∂x}E_{213}^{k(k−1)...1,12...ℓ}(x) = \frac{x^{k−1}}{(k−1)!}E_{213}^{12...ℓ}(x) \\ + (E_{132}^{12,12...ℓ}(x) + \frac{x^{ℓ−1}}{(ℓ−1)!}) E_{132}^{k(k−1)...1}(x) + \binom{k+ℓ−2}{ℓ−1} \frac{x^{k+ℓ−2}}{(k+ℓ−2)!}. \end{matrix}

(iv) E_{132}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) = \{ \begin{matrix}E_{213}^{ℓ(ℓ−1)...1}(x), & if k = 1 \\ E_{132}^{k(k−1)...1}(x), & if ℓ = 1 \end{matrix} , where E_{132}^{k(k−1)...1}(x)

and E_{213}^{ℓ(ℓ−1)...1}(x) are given in [Kit3, Theorem 7] and [Kit3, Theorem 11] respectively. For k, ℓ ≥ 2, E_{132}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) satisfies

\frac{∂}{∂x}E_{132}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) = E_{132}^{(ℓ−1)...1,k(k−1)...1}(x)+

(E_{132}^{k(k−1)...1}(x) + \frac{x^{k−1}}{(k − 1)!}) E_{132}^{12,ℓ(ℓ−1)...1}(x).

Proof. We apply the reverse and complement operations and then use the results of Proposition 14. For example, to avoid 213, begin with 12 … k and end with 12 … ℓ is the same as to avoid 132, begin with 12 … ℓ and end with 12 … k.

Proposition 15. We have (i) E_{123}^{12...k,12...ℓ}(x) =

0,  if k ≥ 3 or ℓ ≥ 3,

x − \frac{1}{2} − \frac{\sqrt{3}}{2} tan (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) +

sec (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) (\frac{\sqrt{3}}{2} (e^{x/2} + e^{−x/2}) − sin (\frac{\sqrt{3}}{2}x + \frac{π}{3} )) , if k = 2 and ℓ = 2,
\frac{\sqrt{3}}{2}e^{x/2} sec (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) − 1,  if k = 1 and ℓ = 1,
\frac{\sqrt{3}}{2}e^{x/2} sec (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) − \frac{1}{2} − \frac{\sqrt{3}}{2} tan (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) ,  else;

(ii) E_{123}^{12...k,ℓ(ℓ−1)...1}(x) =

0,  if k ≥ 3,
Φ_{ℓ}(x) = \frac{e^{x/2}}{(ℓ−1)!} sec (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) ∫_{0}^{x} e^{−t/2}t^{ℓ−1} sin (\frac{\sqrt{3}}{2}t + \frac{π}{3} ) dt,  if k = 1,
∫_{0}^{x} sec (\frac{\sqrt{3}}{2}t + \frac{π}{6} ) (sin (\frac{\sqrt{3}}{2}t + \frac{π}{3} ) − \frac{\sqrt{3}}{2}e^{−t/2}) (Φ_{ℓ}(t) + \frac{t^{ℓ−1}}{(ℓ−1)!}) dt, if k = 2;

(iii) E_{123}^{k(k−1)...1,12...ℓ}(x) =

0,  if ℓ ≥ 3,
Φ_{k}(x) = \frac{e^{x/2}}{(k−1)!} sec (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) ∫_{0}^{x} e^{−t/2}t^{k−1} sin (\frac{\sqrt{3}}{2}t + \frac{π}{3} ) dt,  if ℓ = 1,
∫_{0}^{x} sec (\frac{\sqrt{3}}{2}t + \frac{π}{6} ) (sin (\frac{\sqrt{3}}{2}t + \frac{π}{3} ) − \frac{\sqrt{3}}{2}e^{−t/2}) (Φ_{k}(t) + \frac{t^{k−1}}{(k−1)!}) dt, if ℓ = 2;

(iv) E_{123}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) = \{ \begin{matrix}E_{123}^{ℓ(ℓ−1)...1}(x), & if k = 1, \\ E_{123}^{k(k−1)...1}(x), & if ℓ = 1, \\ E_{123}^{k(k−1)...1}(x) − E_{123}^{k(k−1)...1,12}(x), & if ℓ = 2; \end{matrix}

For k ≥ 2 and ℓ ≥ 3, E_{123}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) satisfies

\frac{∂}{∂x} E_{123}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) = (E_{123}^{ℓ(ℓ−1)...1}(x) + \frac{x^{ℓ−1}}{(ℓ − 1)!} ) E_{123}^{k(k−1)...1,21}(x)+E_{123}^{(k−1)...1,ℓ(ℓ−1)...1}(x),

where E_{123}^{k(k−1)...1}(x) is given in [KitMans, Theorem 2]:

E_{123}^{k(k−1)...1}(x) = \frac{e^{x/2} ∫_{0}^{x} e^{−t/2}t^{k−1} sin(\frac{\sqrt{3}}{2}t + \frac{π}{6} )) dt}{(k − 1)! cos(\frac{\sqrt{3}}{2}x + \frac{π}{6} )},

and E_{123}^{k(k−1)...1,12} is given in this theorem above.

Proof.

Beginning with k(k − 1) … 1 and ending with 12 … ℓ: If ℓ ≥ 3 then the pattern 12 … ℓ does not avoid 123, thus the statement is true. If ℓ = 1, the statement is true according to [Kit3, Theorem 8] and the observation that if k = 1 then this formula gives the expression

\frac{\sqrt{3}}{2}e^{x/2} sec (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) − 1,

which is true according to [ElizNoy, Theorem 4.1] and the assumption that the empty permutation does not begin or end with the pattern p = 1. So, we need only to consider the case ℓ = 2. Recall the definitions of E_{q}^{p}(x) in Section 4.2.

Let P_{k}(n) denote the number of n-permutations that avoid the pattern 123, begin with a decreasing subword of length k and end with the pattern 12. Also, let R_{k}(n) denote the number of n-permutations that avoid the pattern 123 and begin with a decreasing subword of length k. Let π = π_{1}1π_{2} be an (n + 1)- permutation that avoids the pattern 123, begins with the pattern k(k − 1) … 1 and ends with the pattern 12. We observe that π_{1} avoids 123 and begins with k(k − 1) … 1; π_{2} ends with the pattern 12 and |π_{2}| > 0 since otherwise π cannot end with the pattern 12; if |π_{2}| > 1 then π_{2} must begin with the pattern 21 since otherwise we have an occurrence of the pattern 123 beginning from the letter 1. If |π_{1}| = i then the letters of π_{1} can be chosen in \binom{n}{i} ways. So, there are at least

∑_{i≥0} \binom{n}{i}R_{k}(i)P_{2}(n − i) + nR_{k}(n − 1)

(n+1)-permutations with the good properties, where the first term corresponds to the case |π_{2}| > 1 and the second term to the case |π_{2}| = 1. By this formula, we do not count the permutations having |π_{1}| = k − 1, although in this case π begins with the pattern k(k − 1) … 1. So, we can choose the letters of π_{1} in \binom{n}{k−1} ways, and according to whether |π| ≥ 1 or |π| = 1, we have two terms:

\binom{n}{k − 1}P_{2}(n − k + 1) + kδ_{n,k},

where δ_{n,k} is the Kronecker delta. Thus,

P_{k}(n+1) = ∑_{i≥0} \binom{n}{i}R_{k}(i)P_{2}(n−i)+nR_{k}(n−1)+\binom{n}{k − 1}P_{2}(n−k+1)+kδ_{n,k}.

After multiplying both sides of the last equality with x^{n}/n! and summing over n, we have

\frac{d}{dx}E_{123}^{k(k−1)...1,12}(x) = (E_{123}^{21,12}(x) + x) (E_{123}^{k(k−1)...1}(x) + \frac{x^{k−1}}{(k − 1)!}) , (4.11)

with the initial condition E_{123}^{k(k−1)...1,12}(0) = 0. Since

E_{123}^{k(k−1)...1}(x) = E_{123}^{k(k−1)...1,1}(x) =

\frac{e^{x/2}}{(k − 1)!} sec (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) ∫_{0}^{x} e^{−t/2}t^{k−1} sin (\frac{\sqrt{3}}{2}t + \frac{π}{3} ) dt,

to solve (4.11), we only need to know E_{123}^{21,12}(x). To find it, we set k = 2 into (4.11) and solve this equation. For an example how to solve such an equation, we refer to [Kit3, Theorem 6]. We get

E_{123}^{21,12}(x) = −x + sec (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) e^{−x/2} ∫_{0}^{x} e^{t/2} cos (\frac{\sqrt{3}}{2}t + \frac{π}{6} ) dt.

Now, we put the formula for E_{123}^{21,12}(x) into (4.11) and solve this differential equation to get the desired result.

Beginning with 12 … k and ending with ℓ(ℓ − 1) … 1: By the reverse and complement operations, to avoid 123, begin with the pattern 12 … k and end with the pattern ℓ(ℓ − 1) … 1 is the same as to avoid 123, begin with the pattern ℓ(ℓ − 1) … 1 and end with the pattern 12 … k, so we can apply the results of the previous case.

Beginning with 12 … k and ending with 12 … ℓ: The statement is obvious if k ≥ 3 or ℓ ≥ 3. If k = 1 and ℓ = 1 then the statement is true according to [ElizNoy, Theorem 4.1] (but we need to subtract 1, since by our assumption the empty permutation does not begin or end with the pattern p = 1). If ℓ = 1 and k = 2, the statement is true according [Kit3, Theorem 9]. If k = 1 and ℓ = 2, we apply the reverse and complement operations, and use again [Kit3, Theorem 9]. So, we only need to consider the case k = 2 and ℓ = 2. It is easy to see that

E_{123}^{12,12}(x) = E_{123}^{1,12}(x) − E_{123}^{21,12}(x),

and from the previous cases

E_{123}^{1,12}(x) = \frac{\sqrt{3}}{2}e^{x/2} sec (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) − \frac{1}{2} − \frac{\sqrt{3}}{2} tan (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) ,

and

E_{123}^{21,12}(x) = −x + sec (\frac{\sqrt{3}}{2}x + \frac{π}{6} ) (sin (\frac{\sqrt{3}}{2}x + \frac{π}{3} ) − \frac{\sqrt{3}}{2}e^{−x/2}) .

Beginning with k(k − 1) … 1 and ending with ℓ(ℓ − 1) … 1: If ℓ = 1, the statement is trivial. If k = 1, we get the statement by using the reverse and complement operations. For the case ℓ = 2, we observe that the number of n-permutations that avoid the pattern 123, begin with the pattern k(k − 1) … 1 and end with the pattern 21 is equal to the number of n-permutation that avoid 123 and begin with the pattern k(k − 1) … 1 minus the number of npermutations that avoid the pattern 123, begin with the pattern k(k − 1) … 1 and end with the pattern 12. Suppose now that k ≥ 2 and ℓ ≥ 3 and an (n+1)- permutation π avoids 123, begins with k(k − 1) … 1 and ends with ℓ(ℓ − 1) … 1.

It is easy to see that the letter (n + 1) can be either in the first position, or in the position i, where (k + 1) ≤ i ≤ (n − ℓ), or in the position (n − ℓ + 1). In the first of these cases, obviously we have N_{123}^{(k−1)...1,ℓ(ℓ−1)...1}(n) permutations. In the second case, we choose the letters of π to the left of (n + 1) in \binom{n}{i−1} ways. These letters must form a permutation that avoids 123, begins with the pattern k(k − 1) … 1, and ends with the pattern 21 (if the last condition does not hold, the letter (n + 1) and two letters to the left of it form a 123-pattern. In the same time, the letters to the right of (n+1) form a permutation that avoids 123 and ends with the pattern ℓ(ℓ − 1) … 1. In the third case, we can choose the letters to the right of (n + 1) in \binom{n}{ℓ−1} ways, rearrange them into the decreasing order, and form from the letters to the left of (n + 1) a permutation that avoids 123, begins with the pattern k(k − 1) … 1 and ends with the pattern 21 (by the same reasons as above) in N_{123}^{k(k−1)...1,21}(n − ℓ + 1) ways. Thus,

\begin{matrix}N_{123}^{k(k−1)...1,ℓ(ℓ−1)...1}(n + 1) = N_{123}^{(k−1)...1,ℓ(ℓ−1)...1}(n) \\ + ∑_{i=0}^{n} \binom{n}{i}N_{123}^{k(k−1)...1,21}(i)N_{123}^{ℓ(ℓ−1)...1}(n − i) + \binom{n}{ℓ − 1}N_{123}^{k(k−1)...1,21}(n − ℓ + 1), \end{matrix}

where we observed, that to avoid 123 and end with ℓ(ℓ − 1) … 1 is the same as to avoid 123 and begin with ℓ(ℓ − 1) … 1 using the reverse and complement. Now, we multiply both sides of the equality by x^{n}/n! and sum over n to get the desirable result.

4.7 Avoiding a pattern x-yz, beginning and ending with certain patterns simultaneously

Proposition 16. We have

(i) E_{1-32}^{12...k,1}(x) = E_{1-32}^{12...k}(x) = \{ \begin{matrix}e^{e^{x}} ∫_{0}^{x} e^{−e^{t}} ∑_{n≥k−1} \frac{t^{n}}{n!} dt, & if k ≥ 2 \\ e^{e^{x}−1}, & if k = 1 \end{matrix} .

For ℓ ≥ 2, E_{1-32}^{12...k,12...ℓ}(x) satisfies

\frac{∂}{∂x}E_{1-32}^{12...k,12...ℓ}(x) = (e^{x} − ∑_{i=0}^{ℓ−2} \frac{x^{i}}{i!} ) E_{1-32}^{12...k}(x) + e^{x}x^{max(ℓ,k)−1}.

(ii) E_{1-32}^{12...k,ℓ(ℓ−1)...1}(x) satisfies

\frac{∂^{ℓ−1}}{∂x^{ℓ−1}} E_{1-32}^{12...k,ℓ(ℓ−1)...1}(x) = \{ \begin{matrix}e^{e^{x}} ∫_{0}^{x} e^{−e^{t}} ∑_{n≥k−1} \frac{t^{n}}{n!} dt, & if k ≥ 2, \\ e^{e^{x}−1}, & if k = 1. \end{matrix}

(iii)

E_{1-32}^{k(k−1)...1,1}(x) = E_{1-32}^{k(k−1)...1}(x) =

\{ \begin{matrix}(e^{e^{x}}/(k − 1)!) ∫_{0}^{x} t^{k−1}e^{−e^{t}+t} dt, & if k ≥ 2 \\ e^{e^{x}−1}, & if k = 1 \end{matrix}

For ℓ ≥ 2, E_{1-32}^{k(k−1)...1,12...ℓ}(x) satisfies

\frac{∂}{∂x}E_{1-32}^{k(k−1)...1,12...ℓ}(x) = (e^{x} − ∑_{i=0}^{ℓ−2} \frac{x^{i}}{i!} ) E_{1-32}^{k(k−1)...1}(x)+(e^{x} − ∑_{i=0}^{ℓ−2} \frac{x^{i}}{i!} ) \frac{x^{k−1}}{(k − 1)!}.

(iv) E_{1-32}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) satisfies

\frac{∂^{ℓ−1}}{∂x^{ℓ−1}} (E_{1-32}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) − \frac{x^{max(k,ℓ)} − x^{k+ℓ−1}}{1 − x} ) =

\{ \begin{matrix}\frac{e^{e^{x}}}{(k−1)!} ∫_{0}^{x} t^{k−1}e^{−e^{t}+t} dt, & if k ≥ 2, \\ e^{e^{x}−1}, & if k = 1. \end{matrix}

Proof.

Beginning with 12 … k and ending with ℓ(ℓ − 1) … 1: If ℓ = 1 then the result follows from [KitMans, Proposition 5], since to avoid 1-32 and begin with 12 … k is the same as to avoid 3-12 and begin with k(k − 1) … 1. Suppose now that ℓ ≥ 2 and a permutation π avoids the pattern 1-32, begins with the pattern 12 … k and ends with the pattern ℓ(ℓ − 1) … 1. Since ℓ ≥ 2, we have that the letter 1 must be in the rightmost position since otherwise, this letter and two rightmost letters of π form the pattern 1-32, which is forbidden. Thus,

N_{1-32}^{12...k,ℓ(ℓ−1)...1}(n) = N_{1-32}^{12...k,(ℓ−1)(ℓ−2)...1}(n − 1) = ⋯ = N_{1-32}^{12...k,1}(n − ℓ + 1).

Multiplying both sides of the equality N_{1-32}^{12...k,ℓ(ℓ−1)...1}(n) = N_{1-32}^{12...k,1}(n − ℓ + 1) by x^{n−ℓ+1}/(n − ℓ + 1)! and summing over n, we get

\frac{∂^{ℓ−1}}{∂x^{ℓ−1}} E_{1-32}^{12...k,ℓ(ℓ−1)...1}(x) = E_{1-32}^{12...k}(x),

where E_{1-32}^{12...k}(x) is given in [KitMans, Proposition 5], since to avoid 1-32 and begin with 12 … k is the same as to avoid 3-12 and begin with k(k − 1) … 1.

Beginning with k(k − 1) … 1 and ending with ℓ(ℓ − 1) … 1: We use the same arguments as those given under consideration of the previous case, but instead of [KitMans, Proposition 5] we use [KitMans, Proposition 4]. However, we observe, that when we use the argument

N_{1-32}^{k(k−1)...1,ℓ(ℓ−1)...1}(n) = N_{1-32}^{k(k−1)...1,(ℓ−1)(ℓ−2)...1}(n−1) = ⋯ = N_{1-32}^{k(k−1)...1,1}(n−ℓ+1)

for k, ℓ ≥ 2, we do not count the decreasing permutations of length max(k, ℓ), max(k, ℓ) + 1, …, k + ℓ − 2, since in this case, the patterns k(k − 1) … 1 and ℓ(ℓ − 1) … 1 overlap in more than one letter, which causes the observation. So, we need to consider additionally the term

x^{max(k,ℓ)} + x^{max(k,ℓ)+1} + ⋯ + x^{k+ℓ−2} = \frac{x^{max(k,ℓ)} − x^{k+ℓ−1}}{1 − x} ,

which vanishes if k = 1 or ℓ = 1.

Beginning with 12 … k and ending with 12 … ℓ: The only interesting case here is the case k ≥ 2 and ℓ ≥ 2. Using the reverse and complement, instead of considering avoiding 1-32, beginning with 12 … k and ending with 12 … ℓ, we consider avoiding 1-32, beginning with 12 … ℓ and ending with 12 … k. Suppose an n-permutation π satisfies all the conditions. We observe, that the letter n can be in the position i, where ℓ ≤ i ≤ n − k. Also, n can be in the rightmost position if n ≥ max(ℓ, k). In any case, the letters of π to the left of n must be in the increasing order, since otherwise we have an occurrence of the pattern 21-3. This means that in the second case we have the only one permutation. In the first case, the letters of π to the right of n must avoid 21-3 and end with the pattern 12 … k. The number of such permutations, using the reverse and complement, is given by N_{1-32}^{12...k}(n − i). Thus, for n ≥ max(ℓ, k),

N_{21-3}^{12...ℓ,12...k}(n) = ∑_{i=ℓ}^{n−k} \binom{n − 1}{i − 1}N_{1-32}^{12...k}(n − i) + 1.

This gives

N_{21-3}^{12...ℓ,12...k}(n) = ∑_{i=1}^{n} \binom{n − 1}{i − 1}N_{1-32}^{12...k}(n − i) − ∑_{i=1}^{ℓ−1} \binom{n − 1}{i − 1}N_{1-32}^{12...k}(n − i) + 1,

which leads to the desirable result after multiplying both sides of the last equality by x^{n}/n! and summing over n.

Beginning with k(k − 1) … 1 and ending with 12 … ℓ: The only interesting case here is the case k ≥ 2 and ℓ ≥ 2. Using the reverse and complement, instead of considering avoiding 1-32, beginning with k(k − 1) … 1 and ending with 12 … ℓ, we consider avoiding 1-32, beginning with 12 … ℓ and ending with k(k − 1) … 1. Suppose an n-permutation π satisfies all the conditions. We observe, that the letter n can only be in the position i, where ℓ ≤ i ≤ n − k, or in position (n − k + 1) (in the case n ≥ k + ℓ − 1). In the first case, it is easy to see that the letters of π to the left of n must be in the increasing order, and the letters of π to the right of n must avoid 21-3 and end with the pattern k(k − 1) … 1. Using the reverse and complement, the total number of permu-

tations counted in the first case is ∑_{i=ℓ}^{n−k} \binom{n − 1}{i − 1}N_{1-32}^{k(k−1)...1}(n − i). In the second

case, the letters to the left of n are in the increasing order, whereas the letters to the right of n are in decreasing order. The number of such permutations is \binom{n−1}{k−1}, which is the number of ways to choose the last k − 1 letters. Thus,

N_{21-3}^{12...ℓ,k(k−1)...1}(n) = ∑_{i=ℓ}^{n−k} \binom{n − 1}{i − 1}N_{1-32}^{k(k−1)...1}(n − i) + \binom{n − 1}{k − 1}.

Multiplying both parts of the equality by x^{n−1}/(n − 1)! and summing over n, we get

\begin{matrix}\frac{∂}{∂x}E_{21-3}^{12...ℓ,k(k−1)...1}(x) = ∑_{n≥k+ℓ} \binom{n − 1}{k − 1}\frac{x^{n−1}}{(n − 1)!} \\ + ∑_{n≥0} (∑_{i=1}^{n−1} \binom{n − 1}{i − 1}N_{1-32}^{k(k−1)...1}(n − i) − ∑_{i=1}^{ℓ−1} \binom{n − 1}{i − 1}N_{1-32}^{k(k−1)...1}(n − i)) \frac{x^{n−1}}{(n − 1)!}, \end{matrix}

which leads to the desirable result.

Proposition 17. We have (i) G_{2-13}^{12...k,12...ℓ}(x) = x^{k+ℓ−1}C^{k+1}(x) + \frac{x^{m}−x^{k+ℓ−1}}{1−x}.

(ii) G_{2-13}^{k(k−1)...1,12...ℓ}(x) = x^{k+ℓ−1}C^{2}(x).

(iii) G_{2-13}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) = x^{k+ℓ−1}C^{ℓ+1}(x)+\frac{x^{m}−x^{k+ℓ−1}}{1−x}, where m = max(k, ℓ).

(iv) the generating function G_{2-13}(x, y, z) = ∑_{k,ℓ≥0} G_{2-13}^{12...k,ℓ(ℓ−1)...1}(x)y^{k}z^{ℓ} for the sequence {G_{2-13}^{12...k,ℓ(ℓ−1)...1}(x)}_{k,ℓ≥0} (where k and ℓ go through all natural numbers) is

\frac{1}{1 − x(y + z)} (x(y + z + yz) + \frac{C(x) − 1}{(1 − xyC(x))(1 − xzC(x))}) .

Proof. By [Claes], to avoid the pattern 2-13 is the same as to avoid the pattern 2-1-3. Thus we can apply the results of Proposition 11.

Proposition 18. We have

(i) E_{1-23}^{12...k,12...ℓ}(x) = \{ \begin{matrix}0, & if k ≥ 3 or ℓ ≥ 3, \\ E_{1-23}^{12...k}(x), & if ℓ = 1, \\ E_{12-3}^{12...ℓ}(x), & if k = 1, \\ ∫_{0}^{x} tE_{12-3}^{12}(t) dt + \frac{x^{2}}{2!} , & if k = 2 and ℓ = 2, \end{matrix}

where E_{12-3}^{12...k}(x) and E_{1-23}^{12...k}(x) are given by [KitMans, Proposition 10] and [KitMans, Proposition 6] respectively:

E_{12-3}^{12...k}(x) = \{ \begin{matrix}0, & if k ≥ 3, \\ x^{2} ∑_{j=0}^{k}(1 − jx)^{−1} ∑_{d≥0} \frac{x^{d}}{(1 − x)(1 − 2x) … (1 − dx)}, & if k = 2, \\ ∑_{d≥0} \frac{x^{d}}{(1 − x)(1 − 2x) … (1 − dx)}, & if k = 1; \end{matrix}

E_{1-23}^{12...k}(x) = E_{3−21}^{k(k−1)...1}(x) = \{ \begin{matrix}0, & if k ≥ 3, \\ e^{e^{x}} ∫_{0}^{x} e^{−e^{t}}(e^{t} − 1) dt, & if k = 2, \\ e^{e^{x}−1}, & if k = 1. \end{matrix}

(ii) N_{1-23}^{12...k,ℓ(ℓ−1)...1}(n) =

0,  if k ≥ 3,
0,  if k = 2 and
n ≤ ℓ,
1 + N_{1-23}^{12,(ℓ−1)(ℓ−2)...1}(n − 1) + ∑_{j=ℓ+1}^{n−2} \binom{n − 1}{j − 1}N_{1-23}^{12}(n − j), if k = 2 and
n ≥ ℓ + 1,
N_{12-3}^{ℓ(ℓ−1)...1}(n),  if k = 1,

where the numbers N_{12-3}^{ℓ(ℓ−1)...1}(n) are given in [KitMans, Proposition 9], and the numbers N_{1-23}^{12}(n) are given by expending the exponential generating functions in [KitMans, Proposition 6].

(iii)

E_{1-23}^{k(k−1)...1,12...ℓ}(x) =

\{ \begin{matrix}0, & if ℓ ≥ 3 \\ \frac{1}{(k−1)!} ∫_{0}^{x} ∫_{0}^{t} tm^{k−1}e^{e^{t}−e^{m}+m} dmdt + \frac{kx^{k+1}}{(k+1)!}, & if ℓ = 2 \\ (e^{e^{x}}/(k − 1)!) ∫_{0}^{x} t^{k−1}e^{−e^{t}+t} dt, & if ℓ = 1 \end{matrix} ,

where E_{1-23}^{k(k−1)...1,1}(n) = E_{1-23}^{k(k−1)...1}(n) is given by [KitMans, Proposition 4], and N_{1-23}^{1,ℓ(ℓ−1)...1}(n) = N_{12-3}^{ℓ(ℓ−1)...1}(n) is given by [KitMans, Proposition 9];

(iv) For k ≥ 2 and ℓ ≥ 2, E_{1-23}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) satisfies

\frac{∂}{∂x}E_{1-23}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) = E_{1-23}^{k(k−1)...1,(ℓ−1)...1}(x)+

(e^{x} − ∑_{i=0}^{ℓ−1} \frac{x^{i}}{i!} ) (E_{1-23}^{k(k−1)...1}(x) + \frac{x^{k}}{(k − 1)!}) .

Proof.

Beginning with k(k − 1) … 1 and ending with 12 … ℓ: If ℓ ≥ 3 then E_{1-23}^{k(k−1)...1,12...ℓ}(x) = 0, since in this case the pattern 12 … ℓ does not avoid 1-23. If ℓ = 1 then we use [KitMans, Proposition 4], since in this case the only restrictions to the permutations are avoiding 1-23 and beginning with the pattern k(k − 1) … 1. Suppose now that ℓ = 2 and an (n + 1)-permutation π avoids 1-23, begins with k(k − 1) … 1 and ends with the pattern 12. The letter 1 must be in next to the rightmost position, since otherwise this letter and two rightmost letters form the pattern 1-23. We can choose the rightmost letter of π in n ways, and the letters to the left of 1 must form a 1-23-avoiding permutation that begins with k(k − 1) … 1. Besides, if n = k, and the k − 1 letters to the right of 1 are in the decreasing order, we get n extra permutations that satisfy our restrictions. Thus,

N_{1-23}^{k(k−1)...1,12}(n + 1) = nN_{1-23}^{k(k−1)...1}(n) + nδ_{n,k},

where δ_{n,k} is the Kronecker delta. Multiplying both sides of the equality by x^{n}/n! and summing over n we get

E_{1-23}^{k(k−1)...1,12}(x) = ∫_{0}^{x} tE_{1-23}^{k(k−1)...1}(t) dt + \frac{kx^{k+1}}{(k + 1)!}.

Using the formula for E_{1-23}^{k(k−1)...1}(t) in [KitMans, Proposition 4], we get the desirable result.

Beginning with 12 … k and ending with 12 … ℓ: The first three cases are easy to prove in the same manner as we do in the proves of previous propositions. The only interesting case is when k = 2 and ℓ = 2. Using the reverse and complement operations, instead of considering avoiding 1-23, beginning with 12 and ending with 12, we consider avoiding 12-3, beginning with 12 and ending with 12, which we find to be more easy. Suppose an (n + 1)-permutation π satisfies all the restrictions. It is easy to see that |π| ≠ 1 and |π| ≠ 3, as well as if |π| = 2 (that is n = 1) then π must be 12. Suppose |π| ≥ 4. Since π begins with the pattern 12, it is impossible for the letter (n + 1) to be somewhere to the right of the second letter of π or to be the leftmost letter. Thus, (n + 1) must be in the second position. We can choose the leftmost letter of π in n ways, since any choice of this letter will not lead to an occurrence of the pattern 12 − 3 beginning with two leftmost letters. If π = a(n + 1)π′ then π′ must avoid 12-3 and end with the pattern 12. The number of such permutations, using the reverse and complement, is given by N_{1-23}^{12}(n − 1). Thus,

N_{12-3}^{12,12}(n + 1) = nN_{1-23}^{12}(n − 1).

Multiplying both sides of the equality by x^{n}/n! and summing over all n, we get

(E_{12-3}^{12,12}(x))′ = xE_{1-23}^{12}(x) + x,

where the term x corresponds to the permutation 12. We have the desirable result by integrating both sides of the last equality.

Beginning with 12 … k and ending with ℓ(ℓ − 1) … 1: All the cases but k = 2 and n ≥ ℓ + 1 are easy to prove. Let us consider this case. Using the reverse and complement operations, instead of considering avoiding 1-23, beginning with 12 and ending with ℓ(ℓ − 1) … 1, we consider avoiding 12-3, beginning with ℓ(ℓ − 1) … 1 and ending with 12, which we find to be more easy. Let an n-permutation π satisfies all the conditions. We observe, that the letter n is either in the first position, or in position j, where k + 1 ≤ j ≤ n − 2, or in the last position. Obviously, in the first of these cases the number of “good” permutations is given by N_{12-3}^{(ℓ−1)(ℓ−2)...1,12}(n − 1), which is equivalent to N_{1-23}^{12,(ℓ−1)(ℓ−2)...1}(n − 1) by using the reverse and complement. In the second case, we choose the letters to the left of n in \binom{n−1}{j−1} ways, rearrange them to the decreasing order (we do it since otherwise we have an occurrence of the pattern 12-3 having the letter n). After that, the letters to the right of n must form a permutation that avoid 12-3 and end with the pattern 12. Using the reverse and complement, there are N_{1-23}^{12}(n − j) such permutations. So, totally, in the second case there are ∑_{j=ℓ+1}^{n−2} \binom{n−1}{j−1}N_{1-23}^{12}(n−j) permutations. Finally, if n is at the last position, we have the only one such permutation, since the other letters must be in the decreasing order.

Beginning with k(k − 1) … 1 and ending with ℓ(ℓ − 1) … 1: The only interesting case here is the case k ≥ 2 and ℓ ≥ 2. Using the reverse and complement operations, instead of considering avoiding 1-23, beginning with k(k −1) … 1 and ending with ℓ(ℓ−1) … 1, we consider avoiding 12-3, beginning with ℓ(ℓ − 1) … 1 and ending with k(k − 1) … 1, which we find to be more easy. Let an n-permutation π satisfies all the conditions. We observe, that the letter n is either in the first position, or in position j, where ℓ + 1 ≤ j ≤ n − k, or in the last position n − k + 1. We proceed as in the previous case to get the following

N_{12-3}^{ℓ(ℓ−1)...1,k(k−1)...1} = N_{12-3}^{(ℓ−1)...1,k(k−1)...1}+ ∑_{i=ℓ+1}^{n−k} \binom{n − 1}{i − 1}N_{1-23}^{k(k−1)...1}(n−i)+\binom{n − 1}{k − 1},

where three terms in the right-hand side correspond to the three cases described above. We now multiply both sides of the equality by x^{n}/n!, sum over n and observe the following detail. We cannot write instead of i = ℓ + 1 (in the sum above) i = 1 as we did in most of the cases above, since, for instance, the case i = 1 do not necessarily make the term of summation equal 0 as it was before.

Thus, instead of the factor e^{x}, we have the factor (e^{x} − ∑_{i=0}^{ℓ−1} \frac{x^{i}}{i!} )

4.8 Avoiding a pattern xy-z, beginning and ending with certain patterns simultaneously

Proposition 19. We have (i) G_{13-2}^{12...k,12...ℓ}(x) = x^{k+ℓ−1}C^{ℓ+1}(x) + \frac{x^{m}−x^{k+ℓ−1}}{1−x}.

(ii) G_{13-2}^{12...k,ℓ(ℓ−1)...1}(x) = x^{k+ℓ−1}C^{2}(x).

(iii) G_{13-2}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) = x^{k+ℓ−1}C^{k+1}(x)+\frac{x^{m}−x^{k+ℓ−1}}{1−x}, where m = max(k, ℓ).

(iv) the generating function G_{13−2}(x, y, z) = ∑_{k,ℓ≥0} G_{13-2}^{k(k−1)...1,12...ℓ}(z)y^{k}z^{ℓ} for the sequence {G_{13-2}^{k(k−1)...1,12...ℓ}(x)}_{k,ℓ≥0} (where k and ℓ go through all natural numbers) is

\frac{1}{1 − x(y + z)} (x(y + z + yz) + \frac{C(x) − 1}{(1 − xyC(x))(1 − xzC(x))}) .

Proof. We apply the reverse and complement operations and then use the results of Proposition 17. For example, to avoid 2-13, begin with 12 … k and end with 12 … ℓ is the same as to avoid 13-2, begin with 12 … ℓ and end with 12 … k.

Proposition 20. We have (i) E_{21-3}^{12...k,1}(x) = E_{21-3}^{12...k}(x) is given by [KitMans, Proposition 14]. For ℓ ≥ 2,

E_{21-3}^{12...k,12...ℓ}(x) satisfies

\frac{∂}{∂x}E_{21-3}^{12...k,12...ℓ}(x) = (e^{x} − ∑_{i=0}^{k−2} \frac{x^{i}}{i!} ) E_{1-32}^{12...ℓ}(x) + e^{x}x^{max(ℓ,k)−1}.

where E_{1-32}^{12...ℓ}(x) = E_{3-12}^{ℓ(ℓ−1)...1}(x) is given by [KitMans, Proposition 5].

(ii) For ℓ ≥ 2, E_{21-3}^{12...k,ℓ(ℓ−1)...1}(x) satisfies

\frac{∂}{∂x}E_{21-3}^{12...k,ℓ(ℓ−1)...1}(x) = (e^{x} − ∑_{i=0}^{k−2} \frac{x^{i}}{i!} ) E_{1-32}^{ℓ(ℓ−1)...1}(x)+(e^{x} − ∑_{i=0}^{k−2} \frac{x^{i}}{i!} ) \frac{x^{ℓ−1}}{(ℓ − 1)!},

where E_{1-32}^{ℓ(ℓ−1)...1}(x) is given by [KitMans, Proposition 4].

(iii) E_{21-3}^{k(k−1)...1,12...ℓ}(x) satisfies

\frac{∂^{k−1}}{∂x^{k−1}} E_{21-3}^{k(k−1)...1,12...ℓ}(x) = \{ \begin{matrix}e^{e^{x}} ∫_{0}^{x} e^{−e^{t}} ∑_{n≥ℓ−1} \frac{t^{n}}{n!} dt, & if ℓ ≥ 2, \\ e^{e^{x}−1}, & if ℓ = 1. \end{matrix}

(iv) E_{21-3}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) satisfies

\frac{∂^{k−1}}{∂x^{k−1}} (E_{2-13}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) − \frac{x^{max(k,ℓ)} − x^{k+ℓ−1}}{1 − x} ) =

\{ \begin{matrix}\frac{e^{e^{x}}}{(ℓ−1)!} ∫_{0}^{x} t^{ℓ−1}e^{−e^{t}+t} dt, & if ℓ ≥ 2, \\ e^{e^{x}−1}, & if ℓ = 1. \end{matrix}

Proof. We apply the reverse and complement operations and then use the results of Proposition 16. For example, to avoid 1-32, begin with 12 … k and end with 12 … ℓ is the same as to avoid 21-3, begin with 12 … ℓ and end with 12 … k.

Proposition 21. We have

(i) E_{12-3}^{12...k,12...ℓ}(x) = \{ \begin{matrix}0, & if k ≥ 3 or ℓ ≥ 3, \\ E_{12-3}^{12...k}(x), & if ℓ = 1, \\ E_{1-23}^{12...ℓ}(x), & if k = 1, \\ ∫_{0}^{x} tE_{1-23}^{12}(t) dt + \frac{x^{2}}{2!} , & if k = 2 and ℓ = 2, \end{matrix}

where E_{12-3}^{12...k}(x) and E_{1-23}^{12...k}(x) are given in Proposition 18.

(ii) E_{1-23}^{12...k,ℓ(ℓ−1)...1}(x) = \{ \begin{matrix}0, & if k ≥ 3, \\ \frac{1}{(ℓ−1)!} ∫_{0}^{x} ∫_{0}^{t} tm^{ℓ−1}e^{e^{t}−e^{m}+m} dmdt + \frac{ℓx^{ℓ+1}}{(ℓ+1)!}, & if k = 2, \\ (e^{e^{x}}/(ℓ − 1)!) ∫_{0}^{x} t^{ℓ−1}e^{−e^{t}+t} dt, & if k = 1; \end{matrix}

(iv) N_{12-3}^{k(k−1)...1,12...ℓ}(n) =

0,  if ℓ ≥ 3,
0,  if ℓ = 2 and
n ≤ k,
1 + N_{12-3}^{(k−1)(k−2)...1,12}(n − 1) + ∑_{j=k+1}^{n−2} \binom{n − 1}{j − 1}N_{3-21}^{21}(n − j), if ℓ = 2 and
n ≥ k + 1,
N_{12-3}^{k(k−1)...1}(n),  if ℓ = 1,

where the numbers N_{12-3}^{k(k−1)...1}(n) are given in [KitMans, Proposition 9], and the numbers N_{3-21}^{21}(n) are given by expending the exponential generating functions in [KitMans, Proposition 6].

(iv) N_{12-3}^{k(k−1)...1,1}(n) = N_{12-3}^{k(k−1)...1}(n) is given by [KitMans, Proposition 9], and N_{12-3}^{1,ℓ(ℓ−1)...1}(n) = N_{1-23}^{ℓ(ℓ−1)...1}(n) is given by [KitMans, Proposition 4]. For k ≥ 2 and ℓ ≥ 2, E_{12-3}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) satisfies

\frac{∂}{∂x}E_{12-3}^{k(k−1)...1,ℓ(ℓ−1)...1}(x) =

E_{12-3}^{(k−1)...1,ℓ(ℓ−1)...1}(x) + (e^{x} − ∑_{i=0}^{k−1} \frac{x^{i}}{i!} ) (E_{1−23}^{ℓ(ℓ−1)...1}(x) + \frac{x^{ℓ}}{(ℓ − 1)!}) .

Proof. We apply the reverse and complement operations and then use the results of Proposition 18. For example, to avoid 1-23, begin with 12 … k and end with 12 … ℓ is the same as to avoid 12-3, begin with 12 … ℓ and end with 12 … k.

4.9 Further results

In this section, we propose two directions of generalization of the results from the previous sections. The first one is a consideration of avoiding more than one pattern, beginning with some pattern and ending with another pattern. For example, suppose that v = 12-3, w = 21-3, p = 12 … k, q = 12 … ℓ, and E_{v,w}^{p,q}(x) denotes the exponential generating function for the number of permutations that avoid the patterns v and w simultaneously, begin with the pattern p and end with the pattern q. It is easy to see that if k ≥ 3 or ℓ ≥ 3 then E_{12-3,21-3}^{12...k,12...ℓ}(x) = 0. For the other k and ℓ, one can prove the following theorem:

Theorem 1. We have (i) E_{12-3,21-3}^{1,1}(x) = e^{x+x^{2}/2} − 1.

(ii) E_{12-3,21-3}^{1,12}(x) = e^{x+x^{2}/2} (1 − ∫_{0}^{x} e^{−t−t^{2}/2}dt) − 1.

(iii) E_{12-3,21-3}^{12,1}(x) = ∫_{0}^{x} te^{t+t^{2}/2}dt.

(iv) E_{12-3,21-3}^{12,12}(x) = \frac{1}{2}x^{2} + ∫_{0}^{x} [e^{t+t^{2}/2} (1 − ∫_{0}^{t} e^{−r−r^{2}/2}dr) − 1] dt.

The second direction is a consideration of permutations in S_{n} containing a pattern v exactly r times, beginning with some pattern and ending with another pattern. For example, suppose that v = 12-3, r = 1, p = 1 … k, q = 1, and N_{v;r}^{p,q}(n) denotes the number of n-permutations that contain the pattern v exactly r times, begin with the pattern p, and end with the pattern q. It is easy to see that the only interesting case is 1 ≤ k ≤ 3, since otherwise N_{12-3;1}^{12...k,1}(n) = 0. Moreover, one can prove the following theorem:

Theorem 2. Let F_{n} denote the number of n-permutations containing 12-3 exactly once. Then, for all n ≥ 3,

\begin{matrix}N_{12-3;1}^{1,1}(n) = F_{n}N_{12-3;1}^{12,1}(n) = (n − 1)F_{n−1} + (n − 2)B_{n−2}, \\ N_{12-3;1}^{123,1}(n) = (n − 2)B_{n−3}, \end{matrix}

where B_{n} is the nth Bell number, and F_{n} is given by [ClaesMans2, Corollarly 13].

[BabStein] E. Babson, E. Steingrímsson: Generalized permutation patterns and a classification of the Mahonian statistics, Séminaire Lotharingien de Combinatoire, B44b:18pp, 2000.

[Bon] M. Bóna: Exact enumeration of 1342-avoiding permutations: a close link with labeled trees and planar maps. J. Combin. Theory Ser. A 80 (1997), no. 2, 257–272.

[B] M. Bóna: The permutation classes equinumerous to the smooth class. Electron. J. Combin. 5 (1998), no. 1, Research Paper 31, 12 pp. (electronic).

[CW] T. Chow and J. West: Forbidden subsequences and Chebyshev polynomials. Discrete Math. 204 (1999), no. 1-3, 119–128.

[Claes] A. Claesson: Generalised Pattern Avoidance, European J. Combin. 22 (2001), 961-971.

[ClaesMans1] A. Claesson and T. Mansour: Permutations avoiding a pair of generalized patterns of length three with exactly one dash, preprint CO/0107044.

[ClaesMans2] A. Claesson and T. Mansour, Counting Occurrences of a Pattern of Type (1,2) or (2,1) in Permutations, Advances in Applied Mathematics, to appear (2002).

[ElizNoy] S. Elizalde and M. Noy: Enumeration of Subwords in Permutations, Proceedings of FPSAC 2001.

[Ent] R. Entringer: A Combinatorial Interpretation of the Euler and Bernoulli Numbers, Nieuw. Arch. Wisk. 14 (1966), 241–246.

[Kit1] S. Kitaev: Multi-avoidance of generalised patterns, Discrete Math., to appear (2002).

[Kit2] S. Kitaev: Partially ordered generalized patterns, Discrete Math., to appear (2002).

[Kit3] S. Kitaev: Generalized pattern avoidance with additional restrictions, preprint math.CO/0205215.

[KitMans] S. Kitaev and T. Mansour: Simultaneous avoidance of generalized patterns, preprint math.CO/0205182.

[Knuth] D. E. Knuth: The Art of Computer Programming, 2nd ed. Addison Wesley, Reading, MA, (1973).

[Kr] C. Krattenthaler: Permutations with restricted patterns and Dyck paths, Adv. in Appl. Math. 27 (2001), 510–530.

[K] D. Kremer: Permutations with forbidden subsequnces and a generalized Schröder number, Discrete Math. 218 (2000), 121–130.

[Loth] M. Lothaire: Combinatorics on Words, Encyclopedia of Mathematics and its Applications, 17, Addison-Wesley Publishing Co., Reading, Mass. (1983).

[Mans1] T. Mansour: Continued fractions and generalized patterns, European Journal of Combinatorics,23:3 (2002), 329–344.

[Mans2] T. Mansour: Continued fractions, statistics, and generalized patterns, to appear in Ars Combinatorica (2002), preprint CO/0110040.

[Mans3] T. Mansour: Restricted 1-3-2 permutations and generalized patterns, Annals of Combinatorics 6 (2002), 65–76.

[MV1] T. Mansour and A. Vainshtein: Restricted permutations, continued fractions, and Chebyshev polynomials, Electron. J. Combin. 7 (2000) no. 1, Research Paper 17, 9 pp. (electronic).

[MV2] T. Mansour and A. Vainshtein: Restricted 132-avoiding permutations, Adv. in Appl. Math. 126 (2001), no. 3, 258–269.

[MV3] T. Mansour and A. Vainshtein: Layered restrictions and Chebyshev polynomials, Annals of Combinatorics 5 (2001), 451–458.

[MV4] T. Mansour and A. Vainshtein: Restricted permutations and Chebyshev polyonomials, Séminaire Lotharingien de Combinatoire 47 (2002), Article B47c.

[R] A. Robertson: Permutations containing and avoiding 123 and 132 patterns, Discrete Math. Theor. Comput. Sci. 3 (1999), no. 4, 151–154 (electronic).

[RWZ] A. Robertson, H. Wilf, and D. Zeilberger: Permutation patterns and continued fractions, Electron. J. Combin. 6 (1999), no. 1, Research Paper 38, 6 pp. (electronic).

[SloPlo] N. J. A. Sloane and S. Plouffe: The Encyclopedia of Integer Sequences, Academic Press, (1995).

[Stan] R. Stanley: Enumerative Combinatorics, Vol. 1, Cambridge University Press, (1997).

[SchSim] R. Simion, F. Schmidt: Restricted permutations, European J. Combin. 6 (1985), no. 4, 383–406.

[W] J. West: Generating trees and forbidden subsequences, Discrete Math. 157 (1996), 363–372.

Paper V

Partially Ordered Generalized Patterns

Partially Ordered Generalized Patterns

Sergey Kitaev

E-mail: kitaev@math.chalmers.se Matematik, Chalmers tekniska högskola och Göteborgs universitet, S-412 96 Göteborg, Sweden

Abstract

We introduce partially ordered generalized patterns (POGPs), which further generalize the generalized permutation patterns (GPs) introduced by Babson and Steingrímsson [BabStein]. A POGP p is a GP some of whose letters are incomparable. Thus, in an occurrence of p in a permutation π, two letters that are incomparable in p pose no restrictions on the corresponding letters in π. We describe many relations between POGPs and GPs and give general theorems about the number of permutations avoiding certain classes of POGPs. These theorems have several known results as corollaries but also give many new results. We also give the generating function for the entire distribution of the maximum number of non-overlapping occurrences of a pattern p with no dashes, provided we know the e.g.f. for the number of permutations that avoid p.

5.1 Introduction and Background

All permutations in this paper are written as words π = a_{1}a_{2} ⋯ a_{n}, where the a_{i} consist of all the integers 1, 2, …, n.

We will be concerned with patterns in permutations. A pattern is a word on some alphabet of letters, where some of the letters may be separated by dashes. In our notation, the classical permutation patterns, first studied systematically by Simion and Schmidt [SchSim], are of the form p = 1 − 3 − 2, the dashes indicating that the letters in a permutation corresponding to an occurrence of p don’t have to be adjacent. In the classical case, an occurrence of a pattern p in a permutation π is a subsequence in π (of the same length as the length of p) whose letters are in the same relative order as those in p. For example, the permutation 41352 has only one occurrence of the pattern 1 − 2 − 3, namely the subword 135.

Note that a classical pattern should, in our notation, have dashes at the beginning and end. Since all patterns considered in this paper satisfy this, we suppress these dashes from the notation. Thus, a pattern with no dashes corresponds to a contiguous subword anywhere in a permutation.

In [BabStein] Babson and Steingrímsson introduced generalized permutation patterns (GPs) where two adjacent letters in a pattern may be required to be adjacent in the permutation. Such an adjacency requirement is indicated by the absence of a dash between the corresponding letters in the pattern. For example, the permutation π = 516423 has only one occurrence of the pattern 2-31, namely the subword 564, but the pattern 2-3-1 occurs also in the subwords 562 and 563. The motivation for introducing these patterns in [BabStein] was the study of Mahonian statistics.

A number of interesting results on GPs were obtained by Claesson in [Claes]. Relations to several well studied combinatorial structures, such as set partitions, Dyck paths, Motzkin paths and involutions, were shown there. In [Kit] the present author investigated simultaneous avoidance of two or more 3-letter GPs with no dashes. This work is of particular interest here since avoidance of the patterns considered in this paper has a close connection to simultaneous avoidance of two or more GPs with no dashes. Also important here is the work of Elizalde and Noy [ElizNoy] where they find the distribution of several patterns with no dashes.

In this paper we introduce a further generalization of GPs — namely partially ordered generalized patterns (POGP). A POGP is a GP some of whose letters are incomparable. For instance, if we write p = 1 − 1′2′ then we mean that in an occurrence of p in a permutation π the letter corresponding to the 1 in p can be either larger or smaller than the letters corresponding to 1′2′. Thus, the permutation 13425 has four occurrences of p, namely 134, 125, 325 and 425.

We consider two particular classes of POGPs — shuffle patterns and multipatterns. A multi-pattern is of the form p = σ_{1} − σ_{2} − ⋯ − σ_{k} and a shuffle pattern is of the form p = σ_{0} − a_{1} − σ_{1} − a_{2} − ⋯ − a_{k} − σ_{k}, where for any i and j, the letter a_{i} is greater than any letter of σ_{j} and for any i ≠ j each letter of σ_{i} is incomparable with any letter of σ_{j} These patterns are investigated in Sections 5.4 and 5.5. A corollary to one of our theorems (Theorem 5) about the shuffle patterns is the result of Claesson [Claes, Proposition 2] that the number of n-permutations that avoid the pattern 12 − 3 is the n-th Bell number.

Let p = σ_{1} − σ_{2} − ⋯ − σ_{k} be an arbitrary multi-pattern and let A_{i}(x) be the exponential generating function (e.g.f.) for the number of permutations that avoid σ_{i} for each i. In Theorem 11 we find the e.g.f., in terms of the A_{i}(x), for the number of permutations that avoid p. In particular, this allows us to find the e.g.f. for the entire distribution of the maximum number of non-overlapping occurrences of a pattern p with no dashes, if we only know the e.g.f. for the number of permutations that avoid p. In many cases, this gives nice generating functions.

We also give alternative proofs, using inclusion-exclusion, of some of the results of Elizalde and Noy [ElizNoy]. Our proofs result in explicit formulas for the e.g.f. in terms of infinite series whereas Elizalde and Noy obtained differential equations for the same e.g.f..

5.2 Definitions and Preliminaries

A partially ordered generalized pattern (POGP) is a GP where some of the letters can be incomparable.

Example 1. The simplest non-trivial example of a POGP that differs from the ordinary GPs is p = 1′ − 2 − 1′′, where the second letter is the greatest one and the first and the last letters are incomparable to each other. The permutation 3142 has two occurrences of p, namely, the subwords 342 and 142.

It is easy to see that the number of permutations that avoid p in Example 1 is equal to 2^{n−1}. Indeed, if π = a_{1} … a_{n} and a_{i} is the leftmost letter in π that is smaller than its successor, then all letters to the right of a_{i} must be in increasing order. So any permutation π avoiding p can be written as π_{1}1π_{2} , where π_{1} is decreasing and π_{2} is increasing and there are 2^{n−1} ways to pick the permutation π_{1}, which determines π.

Definition 1. If the number of permutations in S_{n}, for each n, that avoid a POGP p is equal to the number of permutations that avoid a POGP q, then p and q are said to be equivalent and we write p ≡ q in this case.

If A_{n} is the number of n-permutations that avoid a pattern p, then the exponential generating function, or e.g.f., of the class of such permutations is

A(x) = ∑_{n≥0} A_{n} \frac{x^{n}}{n!} .

We will talk about bivariate generating functions, or b.g.f., exclusively as generating functions of the form

A(u, x) = ∑_{π} u^{p(π)} \frac{x^{|π|}}{|π|!} = ∑_{n,k≥0} A_{n,k}u^{k} \frac{x^{n}}{n!} ,

were A_{n,k} is the number of n-permutations with k occurrences of the pattern p.

The reverse R(π) of a permutation π = a_{1}a_{2} … a_{n} is the permutation a_{n}a_{n−1} … a_{1}. The complement C(π) is the permutation b_{1}b_{2} … b_{n} where b_{i} = n+1−a_{i}. Also, R ∘C is the composition of R and C. For example, R(13254) = 45231, C(13254) = 53412 and R ∘ C(13254) = 21435. We call these bijections of S_{n} to itself trivial, and it is easy to see that any pattern p is equivalent to the patterns R(p), C(p) and R ∘ C(p). For example, the number of permutations that avoid the pattern 132 is the same as the number of permutations that avoid the patterns 231, 312 and 213, respectively.

It is convenient to introduce the following definition.

Definition 2. Let p be a GP without internal dashes. A permutation π quasiavoids p if π has exactly one occurrence of p and this occurrence consists of the |p| rightmost letters of π.

For example, the permutation 51342 quasi-avoids the pattern p = 231, whereas the permutations 54312 and 45231 do not. Indeed, 54312 ends with 312, which is not an occurrence of the pattern p, and 45231 has an occurrence of p, namely 452, in a forbidden place.

Proposition 1. Let p be a non-empty GP with no dashes. Let A(x) (resp. A^{⋆}(x)) be the e.g.f. for the number of permutations that avoid (resp. quasiavoid) p. Then

A^{⋆}(x) = (x − 1)A(x) + 1.

Proof. We first show that

A_{n}^{⋆} = nA_{n−1} − A_{n}.  (5.1)

If we consider all (n−1)-permutations that avoid p and all possible extending of these permutations to the n-permutations by writing one more letter to the right, then the number of obtained permutations will be nA_{n−1}. Obviously, the set of these permutations is a disjoint union of the set of all n-permutations that avoid p and the set of all n-permutations that quasi-avoid p. Thus we get (5.1). Multiplying both sides of (5.1) with x^{n}/n! and summing over all natural numbers n, observing that A_{0}^{⋆} = 0, we get the desired result.

Definition 3. Suppose {σ_{0}, σ_{1}, …, σ_{k}} is a set of GPs with no dashes and p = σ_{1} − σ_{2} − ⋯ − σ_{k} where each letter of σ_{i} is incomparable with any letter of σ_{j} whenever i ≠ j. We call such POGPs multi-patterns.

Definition 4. Suppose {σ_{0}, σ_{1}, …, σ_{k}} is a set of GPs with no dashes and a_{1}a_{2} … a_{k} is a permutation of k letters. We define a shuffle pattern to be a pattern of the form

σ_{0} − a_{1} − σ_{1} − a_{2} − ⋯ − σ_{k−1} − a_{k} − σ_{k},

where for any i and j, the letter a_{i} is greater than any letter of σ_{j} and for any i ≠ j each letter of σ_{i} is incomparable with any letter of σ_{j}. We also allow σ_{0} and σ_{k}, but not the other σ_{i}, to be empty patterns.

The pattern from Example 1 is an example of a shuffle pattern. It follows from the definitions that we can get a multi-pattern from a shuffle pattern by removing all the a_{i}.

Let S_{∞} denote the disjoint union of the S_{n} for all n ∈ ℕ. The POGPs (which include the GPs, as well as the classical patterns), can be considered as functions from S_{∞} to ℕ that count the number of occurrences of the pattern in a permutation in S_{∞}. This allows us to write a POGP (as a function) as a linear combination of GPs. For example,

1′ − 2 − 1′′ = (1 − 3 − 2) + (2 − 3 − 1),

from which, in particular, we see that to avoid 1′ − 2 − 1′′ is the same as to avoid simultaneously the patterns 1 − 3 − 2 and 2 − 3 − 1. A straightforward argument leads to the following proposition.

Proposition 2. For any POGP p there exists a set S of GPs such that a permutation π avoids p if and only if π avoids all the patterns in S.

The following theorem can be easily proved by induction on k:

Theorem 1. Let p_{1} = σ_{0} − a_{1} − σ_{1} − a_{2} − ⋯ − σ_{k−1} − a_{k} − σ_{k} (resp. p_{2} = σ_{0} − σ_{1} − ⋯ − σ_{k}) be an arbitrary shuffle pattern (resp. multi-pattern) with |σ_{i}| = ℓ_{i} for all i = 0, …, k. Then to avoid the pattern p_{1} (resp. p_{2}) is the same as to avoid

∏_{i=1}^{k} \binom{ℓ_{0} + ℓ_{1} + ⋯ + ℓ_{i}}{ℓ_{i}} = \binom{ℓ_{0} + ℓ_{1}}{ℓ_{1}}\binom{ℓ_{0} + ℓ_{1} + ℓ_{2}}{ℓ_{2}} ⋯ \binom{ℓ_{0} + ℓ_{1} + ⋯ + ℓ_{k}}{ℓ_{k}}

ordinary GPs.

Example 2. Let p = 1′2′ −3−1′′. That is σ = 12 and τ = 1. By Theorem 1, to avoid p is the same as to avoid \binom{3}{2} = 3 GPs simultaneously, namely 12 − 4 − 3, 13 − 4 − 2 and 23 − 4 − 1.

There is a number of results on the distribution of several classes of patterns with no dashes. These results can be used as building blocks for some of the results in the present paper. The most important of these is the following result by Elizalde and Noy [ElizNoy]:

Theorem 2. [ElizNoy, Theorem 3.4] Let m and a be positive integers with a ≤ m, let σ = 12 … aτ(a + 1) ∈ S_{m+2}, where τ is any permutation of {a + 2, a+3, …, m+2}, and let P (u, z) be the b.g.f. for permutations where u marks the number of occurrences of σ. Then P (u, z) = 1/w(u, z), where w is the solution of

w^{a+1} + (1 − u)\frac{z^{m−a+1}}{(m − a + 1)!}w′ = 0

with w(0) = 1, w′(0) = −1 and w^{(k)}(0) = 0 for 2 ≤ k ≤ a. In particular, the distribution does not depend on τ.

5.3 GPs with no dashes

In order to apply our results in what follows we need to know how many patterns avoid a given ordinary GP with no dashes. We are also interested in different approaches to studying these patterns. The theorems in this section can be proved using an inclusion-exclusion argument similar to the one given in the proof of Theorem 12 and we omit these proofs. This allows us to get explicit formulas for the e.g.f. in terms of infinite series instead of having to solve differential equations as done by Elizalde and Noy [ElizNoy] for the same e.g.f.. However, in particular cases, we use certain differential equations to simplify our series.

Theorem 3. [GoulJack] Let A_{k}(x) be the e.g.f. for the number of permutations avoiding the pattern p = 123 … k. Then

A_{k}(x) = 1/F_{k}(x),

where F_{k}(x) = ∑_{i≥0} \frac{x^{ki}}{(ki)!} − ∑_{i≥0} \frac{x^{ki+1}}{(ki + 1)!}.

For some k it is possible to simplify the function F_{k}(x) in the theorems above. Indeed, F_{k}(x) satisfies the differential equation F_{k}^{(k)}(x) = F_{k}(x) with the k initial conditions F_{k}(0) = 1, F′_{k}(0) = −1 and F_{k}^{(i)}(0) = 0 for all i = 2, 3, …, k − 1. For instance, if k = 4 then

F_{4}(x) = \frac{1}{2}(cos x − sin x + e^{−x}).

Theorem 4. Let k and a be positive integers with a < k, let p = 12 … aτ(a + 1) ∈ S_{k+1}, where τ is any permutation of the elements {a + 2, a + 3, …, k + 1}, and let A_{k,a}(x) be the e.g.f. for the number of permutations that avoid p. Let

F_{k,a}(x) = ∑_{i≥1} \frac{(−1)^{i+1}x^{ki+1}}{(ki + 1)!} ∏_{j=2}^{i} \binom{jk − a}{k − a}.

Then

A_{k,a}(x) = 1/(1 − x + F_{k,a}(x)).

If k = 2 and a = 1 in the previous theorem, corresponding to the pattern p = 132, then from Theorem 4 the function F_{2,1}(x), which is the same for the patterns p, 231, 312 and 213 because of the trivial bijections, can be written as:

F_{2,1}(x) = ∑_{i≥1} \frac{(−1)^{i+1}x^{ki+1}}{i!(k!)^{i}(ki + 1)} = x − ∫_{0}^{x} e^{−t^{2}/2} dt.

That is

A_{2,1} = \frac{1}{1 − ∫_{0}^{x} e^{−t^{2}/2} dt},

which is a special case of Theorem 4.1 in [ElizNoy].

5.4 The Shuffle Patterns

We recall that according to Definition 4, a shuffle pattern is a pattern of the form σ_{0} − a_{1} − σ_{1} − a_{2} − ⋯ − σ_{k−1} − a_{k} − σ_{k}, where {σ_{0}, σ_{1}, …, σ_{k}} is a set of GPs with no dashes, a_{1}a_{2} … a_{k} is a permutation of k letters, for any i and j the letter a_{i} is greater than any letter of σ_{j} and for any i ≠ j each letter of σ_{i} is incomparable with any letter of σ_{j}.

Let us consider a shuffle pattern that in fact is an ordinary generalized pattern. This pattern is p = σ − k, where σ is an arbitrary pattern with no dashes that is built on elements 1, 2, …, k−1. So the last element of p is greater than any other element.

Theorem 5. Let p = σ − k and let A(x) (resp. B(x)) be the e.g.f. for the number of permutations that avoid σ (resp. p). Then B(x) = e^{F (x,A(y))}, where

F (x, A(y)) = ∫_{0}^{x} A(y) dy.

Proof. Suppose that π ∈ S_{n+1} and that π avoids p. Suppose the letter (n + 1) is in the i-th position and π = π_{1}(n + 1)π_{2}, where π_{1} and π_{2} might be empty.

Since π is p-avoiding, π_{1} must be σ-avoiding, because otherwise an occurrence of σ in π_{1} together with the letter (n + 1) gives an occurrence of p in π. But if π_{1} is σ-avoiding then there is no interaction between π_{1} and π_{2}, that is, if π_{2} is p-avoiding and π_{1} is σ-avoiding then π is p-avoiding. To see this it is enough to see that if an occurrence of σ in π contains the letter (n + 1), then this occurrence of σ can not lead to an occurrence of p = σ − k containing the letter (n + 1).

From the above, considering all possible positions of (n + 1), we get the recurrence relation

B_{n+1} = ∑_{i} \binom{n}{i}A_{i}B_{n−i},

where B_{j} (resp. A_{j}) is the number of j-permutations that avoid p (resp. σ), because we can choose the elements of π_{1} in \binom{n}{i} ways.

Multiplying both sides of the equality by x^{n}/n! we get

\frac{B_{n+1}}{n!} x^{n} = ∑_{i} \frac{A_{i}}{i!} x^{i} \frac{B_{n−i}}{(n − i)!}x^{n−i}.

Taking the sum over all natural numbers n leads us to

B′(x) = A(x)B(x)

where the derivative of B is with respect to x. Since B(0) = 1, the solution of the differential equation is B(x) = e^{F (x,A(y))}.

Example 3. Let p = 1−2. Here σ = 1, so A(x) = 1 since A_{n} = 0 for all n ≥ 1 and A_{0} = 1. So

B(x) = e^{F (x,1)} = e^{x}.

This corresponds to the fact that for each n ≥ 1 there is exactly one permutation that avoids the pattern p, namely π = n(n − 1) … 1.

Example 4. Suppose p = 12 − 3. Here σ = 12, so A(x) = e^{x}, since there is exactly one permutation that avoids the pattern σ. So

B(x) = ∑_{n≥0} \frac{B_{n}}{n!} x^{n} = e^{F (x,e^{y})} = e^{e^{x}−1}.

According to [Claes, Proposition 2], for all n ≥ 1, B_{n} is the n-th Bell number and the e.g.f. for the Bell numbers is e^{e^{x}−1}.

The table below gives the initial values of B_{n} for several patterns p = σ − k. These numbers were obtained by expanding the corresponding B(x). The functions A(x) are taken from the previous section.

pattern  initial values for B_{n}
132-4 1, 2, 6, 23, 107, 585, 3671, 25986, 204738
123-4 1, 2, 6, 23, 108, 598, 3815, 27532, 221708
1234-5 1, 2, 6, 24, 119, 705, 4853, 38142, 336291
12345-6 1, 2, 6, 24, 120, 719, 5022, 40064, 359400

Theorem 6. Let p be the shuffle pattern σ − k − τ. So k is the greatest letter of the pattern, and each letter of σ is incomparable with any letter of τ. Let A(x), B(x) and C(x) be the e.g.f. for the number of permutations that avoid σ, τ and p respectively. Then C(x) is the solution of the differential equation

C′(x) = (A(x) + B(x))C(x) − A(x)B(x),

with C(0) = 1.

Proof. As before, we consider the symmetric group S_{n+1} and a permutation π ∈ S_{n+1} that avoids p. Suppose the letter (n + 1) is in the i-th position and π = π_{1}(n + 1)π_{2}, where π_{1} and π_{2} might be empty.

There are exactly four mutually exclusive possibilities:

1) π_{1} does not avoid σ, π_{2} does not avoid τ.

2) π_{1} avoids σ, π_{2} does not avoid τ;

3) π_{1} does not avoid σ, π_{2} avoids τ;

4) π_{1} avoids σ, π_{2} avoids τ;

Obviously, the situation 1) is impossible, since an occurrence of σ in π_{1} with (n+1) and with an occurrence of τ in π_{2} gives us an occurrence of p in π. On the other hand, if p occurs in π then it is easy to see that the letter (n + 1) cannot be one of the letters in the occurrences of σ or τ, so all p-avoiding permutations are described by the possibilities 2)–4). We count these permutations in the following way.

In \binom{n}{i} ways we choose first i elements from the letters 1, 2 … n, that is, the elements of π_{1}. Let A_{i}, B_{i} and C_{i} be the number of i-permutations that avoid σ, τ and p respectively.

If π_{1} is σ-avoiding, we let π_{2} be any p-avoiding permutation of the remaining (n − i + 1) letters. This accounts for all ”good” permutations from the possibilities 2) and 4). There are \binom{n}{i}A_{i}C_{n−i} such permutations.

If π_{2} is τ-avoiding, we let π_{1} be any p-avoiding permutation of chosen i letters. This covers all “good” permutations from 3) and 4). There are \binom{n}{i}B_{i}C_{n−i} such permutations.

But we have counted p-avoiding permutations that correspond to 4) twice, so we must subtract \binom{n}{i}A_{i}B_{n−i}, which is the number of such permutations.

So we have

C_{n+1} = ∑_{i} \binom{n}{i}(A_{i}C_{n−i} + B_{i}C_{n−i} − A_{i}B_{n−i}).

Multiplying both sides of the equality by x^{n}/n! we get

\frac{C_{n+1}}{n!} x^{n} = ∑_{i} (\frac{A_{i} + B_{i}}{i!} x^{i} \frac{C_{n−i}}{(n − i)!}x^{n−i} − \frac{A_{i}}{i!} x^{i} \frac{B_{n−i}}{(n − i)!}x^{n−i}) ,

so

C′(x) = (A(x) + B(x))C(x) − A(x)B(x).

Example 5. Let p = 1′−2−1′′. That is, σ = 1 and τ = 1. So A(x) = B(x) = 1 and we need to solve the equation

C′(x) = 2C(x) − 1

with C(0) = 1. The solution of this equation is C(x) = \frac{1}{2}(e^{2x} + 1), so for all n ≥ 1 we have C_{n} = 2^{n−1}, as in Example 1.

In the table below we record the initial values of C_{n} for several patterns p = σ − k − τ.

σ  τ  initial values for C_{n}
1  12  1, 2, 6, 21, 82, 354, 1671, 8536, 46814
1 132 1, 2, 6, 24, 116, 652, 4178, 30070, 240164
1 123 1, 2, 6, 24, 116, 657, 4260, 31144, 253400
1 1234 1, 2, 6, 24, 120, 715, 4946, 38963, 344350
12 12 1, 2, 6, 24, 114, 608, 3554, 22480, 152546
12 132 1, 2, 6, 24, 120, 710, 4800, 36298, 302780
12 123 1, 2, 6, 24, 120, 710, 4815, 36650, 308778
12 1234 1, 2, 6, 24, 120, 720, 5025, 39926, 355538
123 123 1, 2, 6, 24, 120, 720, 5020, 39790, 352470
123 132 1, 2, 6, 24, 120, 720, 5020, 39755, 351518
132 132 1, 2, 6, 24, 120, 720, 5020, 39720, 350496

Remark 2. The pattern p = σ − k from Theorem 5 is a particular case of the pattern p = σ − k − τ from Theorem 6 when τ is the empty word. The e.g.f. for the number of permutations that avoid the empty word is zero, because no permutation avoids the empty word. So if τ is empty, we can use Theorem 6 to get Theorem 5. Indeed, B(x) = 0, and after renaming C with B we get in Theorem 6 exactly the same differential equation as we have in Theorem 5.

We now give two corollaries to Theorem 6.

Corollary 1. Suppose we have the shuffle pattern p = σ − k − τ. We consider the pattern φ(p) = φ_{1}(σ)−k−φ_{2}(τ), where φ_{1} and φ_{2} are any trivial bijections. Then p ≡ φ(p).

Proof. We just observe that if A(x) (resp. B(x)) is the e.g.f. for the number of permutations that avoid σ (resp. τ) then A(x) (resp. B(x)) is the e.g.f. for the number of permutations that avoid φ_{1}(σ) (resp. φ_{2}(τ)).

Corollary 2. We have σ − k − τ ≡ τ − k − σ.

Proof. This follows directly from the differential equation of Theorem 6 (A(x) and B(x) are symmetric in that equation), but we can also obtain this as a corollary to Corollary 1. By Corollary 1, the pattern σ − k − τ is equivalent to the pattern σ − k − R(τ). Reversing the pattern σ − k − R(τ), we obtain the pattern

R(σ − k − R(τ)) = R(R(τ)) − k − R(σ) = τ − k − R(σ),

which thus is equivalent to σ − k − τ. Finally, we use Corollary 1 one more time to get

τ − k − R(σ) ≡ τ − k − R(R(σ)) = τ − k − σ.

5.5 The Multi-Patterns

We recall that according to Definition 3, a multi-pattern is a pattern p = σ_{1} − σ_{2} − ⋯ − σ_{k}, where {σ_{0}, σ_{1}, …, σ_{k}} is a set of GPs with no dashes and each letter of σ_{i} is incomparable with any letter of σ_{j} whenever i ≠ j.

We first discuss patterns of the type p = σ − τ which are a particular case of the multi-patterns to be treated in this section.

If σ or τ is the empty word then we are dealing with ordinary GPs with no dashes, some of which were investigated in [ElizNoy] and Section 3. The analysis of the case when σ or τ is equal to 1 can also be reduced to the analysis of ordinary GPs. For example, suppose that σ = 1, that is, p = 1 − τ, and we want to count the number of permutations in S_{n} that avoid p. We can choose the leftmost letter of a permutation avoiding p in n ways, then the remainder of the permutation must avoid τ, so we multiply n by the number of permutations in S_{n−1} that avoid τ. For instance, if p = 1−1′2′ then the number of permutations in S_{n} avoiding p is exactly n.

Theorem 7. Let p = σ − τ and q = φ_{1}(σ) − φ_{2}(τ), where φ_{1} and φ_{2} are any of the trivial bijections. Then p and q are equivalent.

Proof. The theorem is equivalent to the following statement:

Let p = σ − τ and q = σ − φ(τ), where φ is a trivial bijection. Then p and q are equivalent.

It is obvious that the statement follows from Theorem 7. Conversely, suppose we have p = σ − τ. We observe that any two trivial bijections commute, that is for any trivial bijection ψ, we have ψ(R(x)) = R(ψ(x)). This observation, the statement and the fact that x ≡ R(x) give

p = σ − τ ≡ σ − φ_{2}(τ) ≡ R(φ_{2}(τ)) − R(σ) ≡ R(φ_{2}(τ)) − φ_{1}(R(σ)) ≡

R(φ_{2}(τ)) − R(φ_{1}(σ)) ≡ φ_{1}(σ) − φ_{2}(τ).

So to prove the theorem we now prove the statement.

Let p = σ − τ and q = σ − φ(τ), where φ is a trivial bijection. Let A_{n} (resp. B_{n}) be the number of n-permutations that avoid p (resp. q). We are going to prove that A_{n} = B_{n}.

Suppose π avoids p and π = π_{1}σ′π_{2}, where π_{1}σ′ has exactly one occurrence of the pattern σ, namely σ′. Then π_{2} must avoid τ, φ(π_{2}) must avoid φ(τ) and π_{φ} = π_{1}σ′φ(π_{2}) avoids q. The converse is also true, that is, if π_{φ} has no occurrences of q then π has no occurrences of p. If π has no occurrences of σ then π has no occurrences of p as well as no occurrences of q. Since any permutation either avoids σ or can be factored as above, we have a bijection between the class of permutations that avoid p and the class of permutations that avoid q. Thus A_{n} = B_{n}.

We get the following corollary to Theorem 7:

Corollary 3. The pattern σ − τ is equivalent to the pattern τ − σ.

Proof. We proceed as in the proof of Corollary 2. From Theorem 7 we have:

σ − τ ≡ σ − R(τ) ≡ R(R(τ)) − R(σ) ≡ τ − R(R(σ)) ≡ τ − σ.

We observe that the presence of the dash in the patterns in Theorem 7 is essential. That is, generally speaking, the pattern στ is not equivalent to the pattern φ_{1}(σ)φ_{2}(τ) for any trivial bijections φ_{1} and φ_{2}. For example, there are 66 permutations in S_{5} that avoid the pattern 122′1′ but only 61 that avoid 121′2′. In Section 6 we investigate the pattern 122′1′.

Theorem 8 and Corollary 4 generalise Theorem 7 and Corollary 3:

Theorem 8. Suppose we have multi-patterns p = σ_{1} − σ_{2} − ⋯ − σ_{k} and q = τ_{1} − τ_{2} − ⋯ − τ_{k}, where τ_{1}τ_{2} … τ_{k} is a permutation of σ_{1}σ_{2} … σ_{k}. Then p and q are equivalent.

Proof. We proceed by induction on k. If k = 2 then the statement is true by Corollary 3. Suppose the statement is true for all k′ < k. Suppose p has exactly k blocks. If a permutation π avoiding p has no occurrences of σ_{1} then it obviously avoids both p and q. Otherwise we factor π as π = π_{1}σ′_{1}π_{2} where π_{1}σ_{1}′ has exactly one occurrence of the pattern σ_{1}, namely σ_{1}′. Then π_{2} must avoid σ_{2} −⋯−σ_{k}. Moreover it is irrelevant from which letters π_{1}σ_{1}′ is built and therefore we can apply the inductive hypothesis. We can rearrange σ′_{2} … σ′_{k} of σ_{2} … σ_{k} in such a way that the blocks in τ_{1}τ_{2} … τ_{k} corresponding to σ_{2}, …, σ_{k} are arranged in the same order as the τ’s. Now we consider separately two cases: τ_{k} ≠ σ_{1} and τ_{k} = σ_{1}. In the first case we use the following equivalences:

p = σ_{1} − σ_{2} − ⋯ − σ_{k} ≡ σ_{1} − σ_{2}′ − ⋯ − σ′_{k} ≡ R(σ′_{k}) − ⋯ − R(σ′_{2}) − R(σ_{1}).

For the pattern R(σ′_{k}) − ⋯ − R(σ′_{2}) − R(σ_{1}) we use the factorisation of a permutation π avoiding this pattern, where the role of σ_{1} is played by R(σ′_{k}). So by the inductive hypothesis we put the pattern R(σ_{1}) in the right place somewhere to the left of R(σ′_{2}) and apply R to get that p ≡ q.

In the second case we have:

p ≡ R(σ′_{k}) − ⋯ − R(σ′_{2}) − R(σ_{1}) ≡ R(σ′_{k}) − ⋯ − R(σ_{1}) − R(σ′_{2}) ≡

σ′_{2} − σ_{1} − ⋯ − σ′_{k} ≡ σ′_{2} − ⋯ − σ′_{k} − σ_{1} = q

The first equivalence here is taken from the considerations above; the second one uses the inductive hypothesis; then we use the fact that R(R(x)) = x and apply the inductive hypothesis again.

Corollary 4. Suppose we have multi-patterns p = σ_{1} − σ_{2} − ⋯ − σ_{k} and q = φ_{1}(σ_{1})−φ_{2}(σ_{2})−⋯−φ_{k}(σ_{k}), where each φ_{i} is an arbitrary trivial bijection. Then p and q are equivalent.

Proof. We use induction on k, Theorem 8 and the factorisation of permutations, which is discussed in the proof of Theorem 8. If k = 2 then the statement is true by Theorem 7. Suppose the statement is true for all k′ < k. Then

p = σ_{1} − σ_{2} − ⋯ − σ_{k} ≡ σ_{1} − φ_{2}(σ_{2}) − ⋯ − φ_{k}(σ_{k}) ≡
φ_{2}(σ_{2}) − σ_{1} − ⋯ − φ_{k}(σ_{k}) ≡ φ_{2}(σ_{2}) − φ_{1}(σ_{1}) − ⋯ − φ_{k}(σ_{k}) ≡
φ_{1}(σ_{1}) − φ_{2}(σ_{2}) − ⋯ − φ_{k}(σ_{k}) = q,

where first we apply the inductive hypothesis then Theorem 8 then the inductive hypothesis and finally Theorem 8 again.

Theorem 9. Suppose p = σ−p′, where p′ is an arbitrary POGP, and the letters of σ are incomparable to the letters of p′. Let C(x) (resp. A(x), B(x)) be the e.g.f. for the number of permutations that avoid p (resp. σ, p′). Moreover let A^{⋆}(x) be the e.g.f. for the number of permutations that quasi-avoid σ. Then

C(x) = A(x) + B(x)A^{⋆}(x).

Proof. Let A_{n}, B_{n}, C_{n} be the number of n-permutations that avoid the patterns σ, p′ and p respectively. Also A_{n}^{⋆} is the number of n-permutations that quasiavoid σ. If a permutation π avoids σ then it avoids p. Otherwise we find the leftmost occurrence of σ in π. We assume that this occurrence consists of the |σ| rightmost letters among the i leftmost letters of π. So the subword of π beginning at the (i + 1)st letter must avoid p′. From this we conclude

C_{n} = A_{n} + ∑_{i=|σ|}^{n} \binom{n}{i}A_{i}^{⋆}B_{n−i}.

We observe that we can change the lower bound in the sum above to 0, because A_{i}^{⋆} = 0 for i = 0, 1, …, |σ| − 1. Multiplying both sides by x^{n}/n! and taking the sum over all n we get the desired result.

Corollary 5. Suppose p = σ_{1} − σ_{2} − ⋯ − σ_{k} is a multi-pattern where |σ_{i}| = 2 for all i, so each σ_{i} is equal to either 12 or 21. If B(x) is the e.g.f. for the number of permutations that avoid p then

B(x) = \frac{1 − (1 + (x − 1)e^{x})^{k}}{1 − x} .

Proof. We use Theorem 9, induction on k and the fact that A(x) = e^{x} and A^{⋆}(x) = 1 + (x − 1)e^{x}.

The following corollary to Corollary 5 can be proved combinatorially.

Theorem 10. There are (n − 2)2^{n−1} + 2 permutations in S_{n} that avoid the pattern p = 12 − 1′2′ or, according to Theorem 7, the pattern p = 12 − 2′1′.

One more corollary to Theorem 9 is the following theorem that is the basis for calculating the number of permutations that avoid a multi-pattern, and therefore is the main result for multi-patterns in this paper.

Theorem 11. Let p = σ_{1} − σ_{2} − ⋯ − σ_{k} be a multi-pattern and let A_{i}(x) be the e.g.f. for the number of permutations that avoid σ_{i}. Then the e.g.f. B(x) for the number of permutations that avoid p is

B(x) = ∑_{i=1}^{k} A_{i}(x) ∏_{j=1}^{i−1}((x − 1)A_{j}(x) + 1).

Proof. We use Theorem 9 and prove by induction on k that

B(x) = ∑_{i=1}^{k} A_{i}(x) ∏_{j=1}^{i−1} A_{j}^{⋆}(x).

Then we use Proposition 1 to get the desired result.

Remark 3. One can consider the function B(x) from Theorem 11 as a function in k variables B(x) = B(A_{1}(x), A_{2}(x), …, A_{k}(x)). Then, by Theorem 8, this function is symmetric in the variables A_{1}(x), A_{2}(x), …, A_{k}(x). That means that we can rename the variables, which may simplify the calculation of B(x).

5.6 Patterns of the Form στ

Theorem 12. Let B(x) be the e.g.f. for the number of permutations that avoid the pattern p = 122′1′. Then

B(x) = \frac{1}{2} + \frac{1}{4} tan x(1 + e^{2x} + 2e^{x} sin x) + \frac{1}{2}e^{x} cos x.

Proof. Let B_{n} be the number of n-permutations that avoid p and A_{n} be the number of n-permutations that avoid p and begin with the pattern 12. Let also A(x) be the e.g.f. for the numbers A_{n}. We set B_{0} = A_{0} = A_{1} = 1. Suppose π is a (n + 1)-permutation that avoids p. There are three mutually exclusive possibilities:

1) π = (n + 1)π_{2};

2) π = π_{1}(n + 1);

3) π = π_{1}(n + 1)π_{2} and π_{1}, π_{2} ≠ ε.

Obviously, in 1) and 2) the letter (n + 1) does not affect the rest of the permutation π, and therefore in each of these cases we have B_{n} permutations that avoid p. In 3), it is easy to see that if π_{1} has more than one letter then π_{1} must end with a 21 pattern whereas if π_{2} has more than one letter then π_{2} must begin with a 12 pattern. The key observation is that the number of npermutations that avoid p and end with a 21 pattern is the same as the number of n-permutations that avoid p and begin with a 12 pattern. To see this it is enough to apply the reverse function to any n-permutation π that begins with 12-pattern and avoids p and observe that R(p) = p, that is, R(π) avoids p and ends with a 21 pattern. Obviously this is a bijection. So if |π_{1}| = i then we can choose the letters of π_{1} in \binom{n}{i} ways and then choose a permutation π_{1} in A_{i} ways and a permutation π_{2} in A_{n−i} ways, since the letters of π_{1} and π_{2} do not affect each other. From all this we get

B_{n+1} = 2B_{n} + ∑_{i=1}^{n−1} \binom{n}{i}A_{i}A_{n−i} = 2B_{n} + ∑_{i=0}^{n} \binom{n}{i}A_{i}A_{n−i} − 2A_{n}.

We multiply both sides of the last equality by x^{n}/n! to get

B_{n+1} \frac{x^{n}}{n!} = 2B_{n} \frac{x^{n}}{n!} + ∑_{i=0}^{n} \frac{A_{i}}{i!} x^{i} \frac{A_{n−i}}{(n − i)!}x^{n−i} − 2A_{n} \frac{x^{n}}{n!} .

Summing both sides over all natural numbers n we get:

B′(x) = 2B(x) + A^{2}(x) − 2A(x).  (5.2)

To solve this differential equation with the initial condition B(0) = 1, we need to determine A(x). One can observe that if a permutation π avoids p and begins with the pattern 12 then π has the structure π = a_{1}b_{1}a_{2}b_{2}a_{3}b_{3} ⋯, where a_{i} < b_{i} for all i. Moreover, if b_{1} < a_{2} then we must have a_{1} < b_{1} < a_{2} < b_{2} < a_{3} < ⋯ since otherwise we obviously have an occurrence of the pattern p. A first approximation is that A_{n} = \binom{n}{2}A_{n−2}, because we can choose a_{1}b_{1} in π in \binom{n}{2} ways and then pick an arbitrary (n−2)-permutation that avoids p and begins with the pattern 12, to be a_{2}b_{2}a_{3}b_{3} …, in A_{n−2} ways. But it is possible that b_{1} < a_{2} in which case b_{1}a_{2}b_{2}a_{3} can be an occurrence of p in π, and it is an occurrence of p unless a_{2} < b_{2} < a_{3} < · · ·. So in order to avoid this we must subtract the number of permutations of the form abcdπ′, where a < b < c < d and π′ is any (n − 4)-permutation that avoids p, from the first approximation of A_{n}. Thus the second approximation is that A_{n} = \binom{n}{2}A_{n−2} − \binom{n}{4}A_{n−4}. We observe that in the second approximation we do not count the increasing permutation 123 … n. Moreover, among the permutations counted by \binom{n}{4}A_{n−4}, there are the permutations that begin with 6 increasing letters. Except for the increasing permutation, such permutations are not counted by \binom{n}{2}A_{n−2}. We must therefore add the number of such permutations. So the third approximation is that A_{n} = \binom{n}{2}A_{n−2} − \binom{n}{4}A_{n−4} + \binom{n}{6}A_{n−6} and so on. That is,

A_{n} = \binom{n}{2}A_{n−2}−\binom{n}{4}A_{n−4}+\binom{n}{6}A_{n−6}−\binom{n}{8}A_{n−8}+⋯ = ∑_{i≥1}(−1)^{i+1}\binom{n}{2i}A_{n−2i}.

(5.3)

We observe that if n = 4k or n = 4k + 1 then we do not count the increasing permutation in our sum. This, together with Equation 5.3, gives us

∑_{i≥0}(−1)^{i}\binom{n}{2i}A_{n−2i} = \{ \begin{matrix}1, & if n = 4k or n = 4k + 1, \\ 0, & if n = 4k + 2 or n = 4k + 3. \end{matrix}

Multiplying both sides of the equality with x^{n}/n! and summing over all natural numbers n we get

(A_{0} + A_{1}x + \frac{A_{2}}{2!} x^{2} + ⋯)(1 − \frac{x^{2}}{2!} + \frac{x^{4}}{4!} − \frac{x^{6}}{6!} + ⋯) = ∑_{k=0}^{∞} (\frac{x^{4k}}{(4k)!} + \frac{x^{4k+1}}{(4k + 1)!}) .

The left hand side of this equality is equal to A(x) cos x. Let F (x) be the function in the right hand side of the equality. Then it is easy to see that F (x) is the solution to the differential equation F^{(4)}(x) = F (x) with the initial conditions F (0) = F′(0) = 1, F^{(2)}(0) = F^{(3)}(0) = 0. So F (x) = \frac{1}{2}(cos x + sin x + e^{x}) and

A(x) = \frac{1}{2} (1 + tan x + \frac{e^{x}}{cos x}) .

Now we solve the differential equation (5.2) and get

B(x) = \frac{1}{2} + \frac{1}{4} tan x(1 + e^{2x} + 2e^{x} sin x) + \frac{1}{2}e^{x} cos x.

Remark 4. The series expansion of B(x) in Theorem 12 begins with

B(x) = 1 + x + x^{2} + x^{3} + \frac{3}{4}x^{4} + \frac{11}{20}x^{5} + \frac{7}{20}x^{6} + \frac{7}{30}x^{7} + \frac{103}{720}x^{8} + · · · .

That is, the initial values for B_{n} are 1, 2, 6, 18, 66, 252, 1176, 5768.

5.7 The Distribution of Non-Overlapping GPs

A descent in a permutation π = a_{1}a_{2} … a_{n} is an i such that a_{i} > a_{i+1}. The number of descents in a permutation π is denoted des π (and is equivalent to the generalized pattern 21). Any statistic with the same distribution as des is said to be Eulerian. The Eulerian numbers A(n, k) count permutations in the symmetric group S_{n} with k descents and they are the coefficients of the Eulerian polynomials A_{n}(t) defined by A_{n}(t) = ∑_{π∈S_{n}} t^{1+des π}. The Eulerian polynomials satisfy the identity

∑_{k≥0} k^{n}t^{k} = \frac{A_{n}(t)}{(1 − t)^{n+1}} .

Two descents i and j overlap if j = i + 1. We define a new statistic, namely the maximum number of non-overlapping descents, or MND, in a permutation. For instance, MND(321) = 1 whereas MND(41532) = 2. One can find the distribution of this new statistic by using Corollary 5. This distribution is given in Example 6. However, we prove a more general theorem:

Theorem 13. Let p be a GP with no dashes. Let A(x) be the e.g.f. for the

number of permutations that avoid p. Let D(x, y) = ∑_{π} y^{N(π)} \frac{x^{|π|}}{|π|!} where N(π)

is the maximum number of non-overlapping occurrences of p in π. Then

D(x, y) = \frac{A(x)}{1 − y((x − 1)A(x) + 1)}.

Proof. We fix the natural number k and consider an auxiliary multi-pattern P_{k} = p − p − ⋯ − p with k copies of p. If a permutation avoids P_{k} then it has at most k − 1 non-overlapping occurrences of p. From Theorem 11, the e.g.f.

B_{k}(x) for the number of permutations avoiding P_{k} is equal to ∑_{i=1}^{k} A(x) ∏_{j=1}^{i−1}((x −

1)A(x) + 1). If we subtract B_{k}(x) from the e.g.f. B_{k+1}(x) = ∑_{i=1}^{k+1} A(x) ∏_{j=1}^{i−1}((x −

1)A(x) + 1) for the number of permutations avoiding P_{k+1}, which is obtained by applying Theorem 11 to the pattern P_{k+1}, then we get the e.g.f. D_{k}(x) for the number of permutations that have exactly k non-overlapping occurrences of the pattern p. So

D_{k}(x) = ∑_{n} D_{n,k} \frac{x^{n}}{n!} = B_{k+1}(x) − B_{k}(x) = A(x)((x − 1)A(x) + 1)^{k}.

Now

D(x, y) = ∑_{n,k≥0} D_{n,k}y^{k} \frac{x^{n}}{n!} = ∑_{k} D_{k}(x)y^{k} = \frac{A(x)}{1 − y((x − 1)A(x) + 1)}.

All of the following examples are corollaries to Theorem 13.

Example 6. If we consider descents then A(x) = e^{x}, hence the distribution of MND is given by the formula:

D(x, y) = \frac{e^{x}}{1 − y(1 + (x − 1)e^{x})}.

Example 7. Theorems 3 and 13 give the distribution of the maximum number of non-overlapping occurrences of the increasing subword of length k (the pattern 123 … k), which is equal to

D(x, y) = \frac{1}{(1 − x)y + (1 − y)F_{k}(x)},

were F_{k}(x) = ∑_{i≥0} \frac{x^{ki}}{(ki)!} − ∑_{i≥0} \frac{x^{ki+1}}{(ki + 1)!}.

Example 8. If we consider the maximum number of non-overlapping occurrences of the pattern 132 then the distribution of these numbers is given by the formula

D(x, y) = \frac{1}{1 − yx + (y − 1) ∫_{0}^{x} e^{−t^{2}/2} dt}.

Example 9. The distribution of the maximum number of non-overlapping occurrences of the pattern from Theorem 4 is given by the formula:

D(x, y) = \frac{1}{1 − x + (1 − y)F_{k,a}(x)},

where F_{k,a}(x) = ∑_{i≥1} \frac{(−1)^{i+1}x^{ki+1}}{(ki + 1)!} ∏_{j=2}^{i} \binom{jk − a}{k − a}.

[BabStein] E. Babson, E. Steingrímsson: Generalized permutation patterns and a classification of the Mahonian statistics, Séminaire Lotharingien de Combinatoire, B44b:18pp, 2000.

[Bon1] M. Bóna: Exact enumeration of 1342-avoiding permutations; A close link with labeled trees and planar maps, Journal of Combinatorial Theory, Series A, 80 (1997) 257-272.

[Bon2] M. Bóna: Permutations avoiding certain patterns; The case of length 4 and generalisations, Discrete Mathematics 175 (1997), 55-67.

[Bon3] M. Bóna: Permutations with one or two 132-subsequences, Discrete Mathematics 181 (1998), 267-274.

[Claes] A. Claesson: Generalised Pattern Avoidance, European Journal of Combinatorics 22 (2001), 961-971.

[ClaesMans] A. Claesson and T. Mansour: Permutations avoiding a pair of generalized patterns of length three with exactly one dash, preprint CO/0107044.

[ElizNoy] S. Elizalde and M. Noy: Enumeration of Subwords in Permutations, Proceedings of FPSAC 2001.

[GoulJack] I. P. Goulden and D. M. Jackson, Combinatorial Enumeration, A Wiley-Interscience Series in Discrete Mathematics, John Wiley & Sons Inc., New York, (1983).

[Kit] S. Kitaev: Multi-avoidance of generalised patterns, preprint.

http://www.math.chalmers.se/~kitaev/papers.html

[Knuth] D. E. Knuth: The Art of Computer Programming, 2nd ed. Addison Wesley, Reading, MA, (1973).

[Mans] T. Mansour: Restricted 1-3-2 permutations and generalized patterns, preprint CO/0110039.

[SloPlo] N. J. A. Sloane and S. Plouffe: The Encyclopedia of Integer Sequences, Academic Press, (1995). http://www.research.att.com/∼njas/sequences/.

[Stan] R. Stanley: Enumerative Combinatorics, Volume 1, Cambridge University Press, (1997).

[SchSim] R. Simion, F. Schmidt: Restricted permutations, European J. Combin. 6 (1985), no. 4, 383–406.

Paper VI

Partially ordered generalized patterns and k-ary words

Partially Ordered generalized patterns and k-ary words

Sergey Kitaev and Toufik Mansour ^{1}

Matematik, Chalmers tekniska högskola och Göteborgs universitet, S-412 96 Göteborg, Sweden

         kitaev@math.chalmers.se, toufik@math.chalmers.se

Abstract

Recently, Kitaev [Ki2] introduced partially ordered generalized patterns (POGPs) in the symmetric group, which further generalize the generalized permutation patterns introduced by Babson and Steingrímsson [BS]. A POGP p is a GP some of whose letters are incomparable. In this paper, we study the generating functions (g.f.) for the number of k-ary words avoiding some POGPs. We give analogues, extend and generalize several known results, as well as get some new results. In particular, we give the g.f. for the entire distribution of the maximum number of non-overlapping occurrences of a pattern p with no hyphens (that allowed to have repetition of letters), provided we know the g.f. for the number of k-ary words that avoid p.

6.1 Introduction

Let [k]^{n} denote the set of all the words of length n over the (totally ordered) alphabet [k] = {1, 2, …, k}. We call these words by n-long k-ary words. A generalized pattern τ is a word in [ℓ]^{m} (possibly with hyphens between some letters) that contains each letter from [ℓ] (possibly with repetitions). We say that the word σ ∈ [k]^{n} contains a generalized pattern τ, if σ contains a subsequence isomorphic to τ in which the entries corresponding to consecutive entries of τ, which are not separated by a hyphen, must be adjacent. Otherwise, we say that σ avoids τ and write σ ∈ [k]^{n}(τ). Thus, [k]^{n}(τ) denotes the set of all the words in [k]^{n} that avoid τ. Moreover, if P is a set of generalized patterns then |[k]^{n}(P)| denotes the set all the words in [k]^{n} that avoid each pattern from P simultaneously.

Example 1. A word π = a_{1}a_{2} … a_{n} avoids the pattern 13-2 if π has no subsequence a_{i}a_{i+1}a_{j} with j > i + 1 and a_{i} < a_{j} < a_{i+1}. Also, π avoids the pattern 121 if it has no subword a_{i}a_{i+1}a_{i+2} such that a_{i} = a_{i+2} < a_{i+1}.

Classical patterns are generalized patterns with all possible hyphens (say, 2-1-3-4), in other words, those that place no adjacency requirements on σ. The first case of classical patterns studied was that of permutations avoiding a pattern of length 3 in S_{3}. Knuth [Knuth] found that, for any τ ∈ S_{3}, |S_{n}(τ)| = C_{n}, the nth Catalan number. Later, Simion and Schmidt [SS] determined the number |S_{n}(P)| of permutations in S_{n} simultaneously avoiding any given set of patterns P ⊆ S_{3}. Burstein [Bu] extended this to |[k]^{n}(P)| with P ⊆ S_{3}. Burstein and Mansour [BM1] considered forbidden patterns with repeated letters. Also, Burstein and Mansour [BM2, BM3] considered forbidden generalized patterns with repeated letters.

1Research financed by EC’s IHRP Programme, within the Research Training Network ”Algebraic Combinatorics in Europe”, grant HPRN-CT-2001-00272

Generalized permutation patterns were introduced by Babson and Steingrímsson [BS] with the purpose of the study of Mahonian statistics. Claesson [C] and Claesson and Mansour [CM] considered the number of permutations avoiding one or two generalized patterns with one hyphen. Kitaev [Ki1] examined the number of |S_{n}(P)| of permutations in S_{n} simultaneously avoiding any set of generalized patterns with no hyphens. Besides, Kitaev [Ki2] introduced a further generalization of the generalized permutation patterns namely partially ordered generalized patterns.

In this paper we introduce a further generalization of the generalized patterns namely partially ordered generalized patterns in words (POGPs), which is an analogue of POGPs in permutations [Ki2]. A POGP is a generalized pattern some of whose letters are incomparable. For example, if we write τ = 1-1′2′, then we mean that in occurrence of τ in a word σ ∈ [k]^{n} the letter corresponding to the 1 in τ can be either larger, smaller, or equal to the letters corresponding to 1′2′. Thus, the word 113425 ∈ [5]^{6} contains seven occurrence of τ, namely 113, 134 twice, 125 twice, 325, and 425.

Following [Ki2], we consider two particular classes of POGPs – shuffle patterns and multi-patterns, which allows us to give an analogue for all the main results of [Ki2] for k-ary words. A multi-pattern is of the form τ = τ^{0}-τ^{1}- ⋯ -τ^{s} and a shuffle pattern of the form τ = τ^{0}-a_{1}-τ^{1}-a_{2}- ⋯ -τ^{s−1}-a_{s}-τ^{s}, where for any i and j, the letter a_{i} is greater than any letter of τ^{j} and for any i ≠ j each letter of τ^{i} is incomparable with any letter of τ^{j}. These patterns are investigated in Sections 6.3 and 6.4.

Let τ = τ^{0}-τ^{1}- ⋯ -τ^{s} be an arbitrary multi-pattern and let A_{τ^{i}}(x; k) be the generating function (g.f.) for the number of words in k-letter alphabet that avoid τ^{i} for each i. In Theorem 6 we find the g.f., in terms of the A_{τ^{i}}(x; k), for the number of k-ary words that avoid τ. In particular, this allows us to find the g.f. for the entire distribution of the maximum number of non-overlapping occurrences of a pattern τ with no hyphens, if we only know the g.f. for the number of k-ary words that avoid τ. Thus, in order to apply our results in what follows we need to know how many k-ary words avoid a given ordinary generalized pattern with no hyphens. This question was examined, for instance, in [BM1, Sections 2 and 3], [BM2, Section 3] and [BM3, Section 3.3].

6.2 Definitions and Preliminaries

A partially ordered generalized pattern (POGP) is a generalized pattern where some of the letters can be incomparable.

Example 2. The simplest non-trivial example of a POGP that differs from the ordinary generalized patterns is τ = 1′-2-1′′, where the second letters is the greatest one and the first and the last letters are incomparable to each other. The word σ = 31421 has five occurrences of τ, namely 342, 341, 142, 141, and 121.

Let A_{τ} (x; k) = ∑_{n≥0} a_{τ} (n; k)x^{n} denote the generating function (g.f.) for the numbers a_{τ} (n; k) of words in [k]^{n} avoiding the pattern τ. For τ = 1′-2-1′′, we have

A_{1′-2-1′′}(x; k) = \frac{1}{(1 − x)^{2k−1}} − ∑_{j=1}^{k−1} \frac{x}{(1 − x)^{2j}} .  (6.1)

Indeed, if σ ∈ [k]^{n} avoids τ, and σ contains s > 0 copies of the letter k, then the letters k appear as leftmost or rightmost letters of σ. If σ contains no k then σ ∈ [k − 1]^{n}. So, for all n ≥ 0, we have

a_{τ} (n; k) = a_{τ} (n; k−1)+2a_{τ} (n−1; k−1)+3a_{τ} (n−2; k−1)+⋯+(n+1)a_{τ} (0; k−1),

since there are (i + 1)a_{τ} (n − i; k − 1) possibilities to place i letters k into σ, for 0 ≤ i ≤ n. Hence, for all n ≥ 2,

a_{τ} (n; k) − 2a_{τ} (n − 1; k) + a_{τ} (n − 2; k) = a_{τ} (n; k − 1),

together with a_{τ} (0, k) = 1 and a_{τ} (1, k) = k. Multiplying both sides of the recurrence above with x^{n} and summing over all n ≥ 2, we get Equation 6.1.

Definition 5. If the number of words in [k]^{n}, for each n, that avoid a POGP τ is equal to the number of words that avoid a POGP ϕ, then τ and ϕ are said to be equivalent and we write τ ≡ ϕ.

The reverse R(σ) of a word σ = σ_{1}σ_{2} … σ_{n} is the word σ_{n} … σ_{2}σ_{1}. The complement C(σ) is the word θ = θ_{1}θ_{2} … θ_{n} where θ_{i} = k + 1 − σ_{i} for all i = 1, 2, …, n. For example, if σ = 123331 ∈ [3]^{6}, then R(σ) = 133321, C(σ) = 321113, and R(C(σ)) = 311123. We call these bijections of [k]^{n} to itself trivial. For example, the number of words that avoid the pattern 12-2 is the same as the number of words that avoid the patterns 2-21, 1-12, and 21-1, respectively.

Following [Ki2], it is convenient to introduce the following definition.

Definition 6. Let τ be a generalized pattern without hyphens. A word σ quasiavoids τ if σ has exactly one occurrence of τ and this occurrence consists of the |τ| rightmost letters of σ, where |τ| denotes the number of letters in τ.

For example, the word 5112234 quasi-avoids the pattern 1123, whereas the words 5223411 and 1123345 do not.

Proposition 1. Let τ be a non-empty generalized pattern with no hyphens. Let A_{τ}^{∗}(x; k) denote the g.f. for the number of words in [k]^{n} that quasi-avoid τ. Then

A_{τ}^{∗}(x; k) = (kx − 1)A_{τ} (x; k) + 1.  (6.2)

Proof. Using the similar arguments as those in the proof of [Ki2, Proposition 4], we get that, for n ≥ 1,

a_{τ}^{∗}(n; k) = ka_{τ} (n − 1; k) − a_{τ} (n; k),

where a_{τ}^{∗}(n; k) denotes the number of words in [k]^{n} that quasi-avoid τ. Multiplying both sides of the last equality by x^{n} and summing over all natural numbers n, we get the desired result.

Definition 7. Suppose {τ^{0}, τ^{1}, …, τ^{s}} is a set of generalized patterns with no hyphens and

τ = τ^{0}-τ^{1}- ⋯ -τ^{s},

where each letter of τ^{i} is incomparable with any letter of τ^{j} whenever i ≠ j. We call such POGPs multi-patterns.

Definition 8. Suppose {τ^{0}, τ^{1}, …, τ^{s}} is a set of generalized patterns with no hyphens and a_{1}a_{2} … a_{s} is a word of s letters. We define a shuffle pattern to be a pattern of the form

τ = τ^{0}-a_{1}-τ^{1}-a_{2}- ⋯ -τ^{s−1}-a_{s}-τ^{s},

where each letter of τ^{i} is incomparable with any letter of τ^{j} whenever i ≠ j, and the letter a_{i} is greater than any letter of τ^{j} for any i and j.

For example, 1′-2-1′′ is a shuffle pattern, and 1′-1′′ is a multi-patterns. From definitions, we obtain that we can get a multi-pattern from a shuffle pattern by removing all the letters a_{i}.

There is a connection between multi-avoidance of the generalized patterns and the POGPs. In particular, to avoid 1′-2-1′′ is the same as to avoid simultaneously the patterns 1-2-1, 1-3-2, and 2-3-1. A straightforward argument leads to the following proposition.

Proposition 2. For any POGP τ there exists a set T of generalized patterns such that a word σ avoids τ if and only if σ avoids all the patterns in T.

For example, if τ = 1′2′-3-1′′, then to avoid τ is the same to avoid 5 patterns, 12-3-1, 12-3-2, 12-4-3, 13-4-2, and 23-4-1. Moreover, the following proposition holds:

Proposition 3. Suppose τ = τ_{1}-a-τ_{2} (resp. ϕ = ϕ_{1}-ϕ_{2}) is a shuffle pattern (resp. a multi-pattern) such that τ_{1}, ϕ_{1} ∈ [r_{1}]^{ℓ_{1}}, τ_{2}, ϕ_{2} ∈ [r_{2}]^{ℓ_{2}} and each letter of [r_{1}] is incomparable with any letter of [r_{2}]. Also, without lose the generality, suppose r_{1} ≥ r_{2}. Then to avoid τ (resp. ϕ) is the same as to avoid

∑_{i=0}^{r_{2}} \binom{r_{1}}{i}\binom{r_{2}}{i}\binom{r_{1} + r_{2} − i}{r_{1}} generalazed patterns. In particular, the number of

generalized patterns does not depend on the lengths ℓ_{1} and ℓ_{2}.

Proof. Obviously, to prove the statement, we need to find the number of ways to make a total order on [r_{1}] ∪ [r_{2}] (the letter a does not play any roll, since it is always the greatest letter). Any total order on [r_{1}] ∪ [r_{2}] is an alphabet that can consist of r_{1} + r_{2} − i letters, where i is the number of letters in [r_{2}] that supposed to coincide with some letters in [r_{1}]. Clearly, 0 ≤ i ≤ r_{2} and we can choose coinciding letters in \binom{r_{1}}{i}\binom{r_{2}}{i} ways. Now, after choosing the coinciding letters, we can make a total order in \binom{r_{1}+r_{2}−i}{r_{1}} ways, which is given by [Ki2, Theorem 8].

6.3 The shuffle patterns

We recall that according to Definition 8, a shuffle pattern is a pattern of the form

τ = τ^{0}-a_{1}-τ^{1}-a_{2}- ⋯ -τ^{s−1}-a_{s}-τ^{s},

where {τ^{0}, τ^{1}, …, τ^{s}} is a set of generalized patterns with no hyphens, a_{1}a_{2} … a_{s} is a word of s letters, for any i and j the letter a_{i} is greater than any letter of τ^{j} and for any i ≠ j each letter of τ^{i} is incomparable with any letter of τ^{j}.

Let us consider the shuffle pattern ϕ = τ-ℓ-τ, where ℓ is the greatest letter in ϕ and letters each letter in the left τ is incomparable with any letter in the right τ.

Theorem 1. Let ϕ be the shuffle pattern τ-ℓ-τ described above. Then for all k ≥ ℓ,

A_{ϕ}(x; k) = \frac{1}{(1 − xA_{τ} (x; k − 1))^{2}} (A_{ϕ}(x; k − 1) − xA_{τ}^{2}(x; k − 1)).

Proof. We show how to get a recurrence relation on k for A_{ϕ}(x; k), which is the g.f. for the number of words in [k]^{n}(ϕ). Suppose σ ∈ [k]^{n}(ϕ) is such that it contains exactly d copies of the letter k. If d = 0 then the g.f. for the number of such words is A_{ϕ}(x; k − 1). Assume that d ≥ 1. Clearly, σ can be written in the following form:

σ = σ^{0}kσ^{1}k ⋯ kσ^{d},

where σ^{j} is a ϕ-avoiding word on k − 1 letters, for j = 0, 1, …, d. There are two possibilities: either σ^{j} avoids τ for all j, or there exists j_{0} such that σ^{j_{0}} contains τ and for any j ≠ j_{0}, the word σ^{j} avoids τ. In the first case, the number of such words is given by the g.f. x^{d}A_{τ}^{d+1}(x; k − 1), whereas in the second case, by (d + 1)x^{d}A_{τ}^{d}(x; k − 1)(A_{ϕ}(x; k − 1) − A_{τ} (x; k − 1)). In the last expression, the multiple (d + 1) is the number of ways to choose j, such that σ^{j} has an occurrence of τ, and A_{ϕ}(x; k − 1) − A_{τ} (x; k − 1) is the g.f. for the number of words avoiding ϕ and containing τ.

Therefore,

A_{ϕ}(x; k) = A_{ϕ}(x; k − 1)+

∑_{d≥1}(d + 1)x^{d}A_{τ}^{d}(x; k − 1)A_{ϕ}(x; k − 1) − ∑_{d≥1} dx^{d}A_{τ}^{d+1}(x; k − 1),

equivalently,

A_{ϕ}(x; k) = A_{ϕ}(x; k − 1)+

A_{ϕ}(x; k − 1)\frac{2xA_{τ} (x; k − 1) − x^{2}A_{τ}^{2}(x; k − 1)}{(1 − xA_{τ} (x; k − 1))^{2}} − \frac{xA_{τ}^{2}(x; k − 1)}{(1 − xA_{τ} (x; k − 1))^{2}} .

The rest is easy to check.

Example 3. Let ϕ = 1′-2-1′′. Here τ = 1, so A_{τ} (x; k) = 1 for all k ≥ 1, since only the empty word avoids τ. Hence, according to Theorem 1, we have

A_{ϕ}(x; k) = \frac{A_{ϕ}(x; k − 1) − x}{(1 − x)^{2}},

which together with A_{ϕ}(x; 1) = \frac{1}{1−x} (for any n only the word \underbrace{11 … 1}_{n times} avoids ϕ)

gives Equation 6.1.

More generally, we consider a shuffle pattern of the form τ^{0}-ℓ-τ^{1}, where ℓ is the greatest element of the pattern.

Theorem 2. Let ϕ be the shuffle pattern τ-ℓ-ν. Then for all k ≥ ℓ, A_{ϕ}(x; k) =

\frac{1}{(1 − xA_{τ} (x; k − 1))(1 − xA_{ν}(x; k − 1))}(A_{ϕ}(x; k−1)−xA_{τ} (x; k−1)A_{ν}(x; k−1)).

Proof. We proceed as in the proof of Theorem 1. Suppose σ ∈ [k]^{n}(ϕ) is such that it contains exactly d copies of the letter k. If d = 0 then the g.f. for the number of such words is A_{ϕ}(x; k − 1). Assume that d ≥ 1. Clearly, σ can be written in the following form:

σ = σ^{0}kσ^{1}k ⋯ kσ^{d},

where σ^{j} is a ϕ-avoiding word on k − 1 letters, for j = 0, 1, …, d. There are two possibilities: either σ^{j} avoids τ for all j, or there exists j_{0} such that σ^{j_{0}} contains τ, σ^{j} avoids τ for all j = 0, 1, …, j_{0} −1 and σ^{j} avoids ν for any j = j_{0} +1, …, d. In the first case, the number of such words is given by the g.f. x^{d}A_{τ}^{d+1}(x; k − 1). In the second case, we have

x^{d} ∑_{j=0}^{d} A_{τ}^{j} (x; k − 1)A_{ν}^{d−j}(x; k − 1)(A_{ϕ}(x; k − 1) − A_{τ} (x; k − 1)).

Therefore, we get

\begin{matrix}A_{ϕ}(x; k) = A_{ϕ}(x; k − 1) + A_{ϕ}(x; k − 1) ∑_{d≥1} x^{d} ∑_{j=0}^{d} A_{τ}^{j} (x; k − 1)A_{ν}^{d−j}(x; k − 1) \\ − ∑_{d≥1} x^{d} ∑_{j=1}^{d} A_{τ}^{j} (x; k − 1)A_{ν}^{d+1−j}(x; k − 1), \end{matrix}

equivalently,

A_{ϕ}(x; k) = (A_{ϕ}(x; k−1)−xA_{τ} (x; k−1)A_{ν}(x; k−1)) ∑_{d≥0} x^{d} ∑_{j=0}^{d} A_{τ}^{j} (x; k−1)A_{ν}^{d−j}(x; k−1).

Hence, using the identity ∑_{n≥0} x^{n} ∑_{j=0}^{n} p^{j}q^{n−j} = \frac{1}{(1 − xp)(1 − xq)} we get the de-

sired result.

We now give two corollaries to Theorem 2.

Corollary 6. Let ϕ = τ^{0}-ℓ-τ^{1} be a shuffle pattern, and let f(ϕ) = f_{1}(τ^{0})-ℓ-f_{2}(τ^{1}), where f_{1} and f_{2} are any trivial bijections. Then ϕ ≡ f(ϕ).

Proof. Using Theorem 2, and the fact that the number of words in [k]^{n} avoiding τ (resp. ν) and f_{1}(τ) (resp. f_{2}(ν)) have the same generating functions, we get the desired result.

Corollary 7. For any shuffle pattern τ-ℓ-ν, we have

τ-ℓ-ν ≡ ν-ℓ-τ.

Proof. Corollary 6 yields that the shuffle pattern τ-ℓ-ν is equivalent to the pattern τ-ℓ-R(ν), which is equivalent to the pattern R(τ-ℓ-R(ν)) = ν-ℓ-R(τ). Finally, we use Corollary 6 one more time to get the desired result.

6.4 The multi-patterns

We recall that according to Definition 7, a multi-pattern is a pattern of the form τ = τ^{0}-τ^{1}- ⋯ -τ^{s}, where {τ^{0}, τ^{1}, …, τ^{s}} is a set of generalized patterns with no hyphens and each letter of τ^{i} is incomparable with any letter of τ^{j} whenever i ≠ j.

The simplest non-trivial example of a multi-pattern is the multi-pattern ϕ = 1-1′2′. To avoid ϕ is the same as to avoid the patterns 1-12, 1-23, 2-12, 2-13, and 3-12 simultaneously. To count the number of words in [k]^{n}(1-1′2′), we choose the leftmost letter of σ ∈ [k]^{n}(1-1′2′) in k ways, and observe that all the other letters of σ must be in a non-increasing order. Using [BM1], for all n ≥ 1, we have

|[k]^{n}(1-1′2′)| = k · \binom{n + k − 2}{n − 1}.

The following theorem is an analogue to [Ki2, Theorem 21].

Theorem 3. Let τ = τ^{0}-τ^{1} and ϕ = f_{1}(τ^{0})-f_{2}(τ^{1}), where f_{1} and f_{2} are any of the trivial bijections. Then τ ≡ ϕ.

Proof. First, let us prove that the pattern τ = τ^{0}-τ^{1} is equivalent to the pattern ϕ = τ^{0}-f(τ^{1}), where f is a trivial bijection. Suppose that σ = σ^{1}σ^{2}σ^{3} ∈ [k]^{n} avoids τ and σ^{1}σ^{2} has exactly one occurrence of τ^{0}, namely σ^{2}. Then σ^{3} must avoid τ^{1}, so f(σ^{3}) avoids f(τ^{3}) and σ_{f} = σ^{1}σ^{2}f(σ^{3}) avoids ϕ. The converse is also true, if σ_{f} avoids ϕ then σ avoids τ. Since any word either avoids τ^{0} or can be factored as above, we have a bijection between the class of words avoiding τ and the class of words avoiding ϕ. Thus τ ≡ ϕ.

Now, we use the considerations above as well as the properties of trivial bijections to get

\begin{matrix}τ ≡ τ^{0}-f_{2}(τ^{1}) ≡ R(τ^{0}-f_{2}(τ^{1})) ≡ R(f_{2}(τ^{1}))-R(τ^{0}) ≡ \\ R(f_{2}(τ^{1}))-f_{1}(R(τ^{0})) ≡ R(f_{2}(τ^{1}))-R(f_{1}(τ^{0})) ≡ f_{1}(τ^{0})-f_{2}(τ^{1}). \end{matrix}

Using Theorem 3, we get the following corollary, which is an analogue to [Ki2, Corollary 22].

Corollary 8. The multi-pattern τ^{0}-τ^{1} is equivalent to the multi-pattern τ^{1}-τ^{0}.

Proof. From Theorem 3, using the properties of the trivial bijection R, we get

τ^{0}-τ^{1} ≡ τ^{0}-R(τ^{1}) ≡ R(R(τ^{1}))-R(τ^{0}) ≡ τ^{1}-R(R(τ^{0})) ≡ τ^{1}-τ^{0}.

Using induction on s, Corollary 8, and proceeding in the way proposed in [Ki2, Theorem 23], we get

Theorem 4. Suppose we have multi-patterns τ = τ^{0}-τ^{1}- ⋯ -τ^{s} and ϕ = ϕ^{0}-ϕ^{1}- ⋯ -ϕ^{s}, where τ^{1}τ^{2} ⋯ τ^{s} is a permutation of ϕ^{1}ϕ^{2} ⋯ ϕ^{s}. Then τ ≡ ϕ.

The last theorem is an analogue to [Ki2, Theorem 23]. As a corollary to Theorem 4, using Theorem 3 and the idea of the proof of [Ki2, Corollary 24], we get the following corollary which is an analogue to [Ki2, Corollary 24].

Corollary 9. Suppose we have multi-patterns τ = τ^{0}-τ^{1}- ⋯ -τ^{s} and ϕ = f_{0}(τ^{0})-f_{1}(τ^{1})- ⋯ -f_{s}(τ^{s}), where f_{i} is an arbitrary trivial bijection. Then τ ≡ ϕ.

The following theorem is a good auxiliary tool for calculating the g.f. for the number of words that avoid a given POGP. For particular POGPs, it allows to reduce the problem to calculating the g.f. for the number of words that avoid another POGP which is shorter. We recall that A_{τ}^{∗}(x; k) is the generating function for the number of words in [k]^{n} that quasi-avoid the pattern τ.

Theorem 5. Suppose τ = τ^{0}-ϕ, where ϕ is an arbitrary POGP, and the letters of τ^{0} are incomparable to the letters of ϕ. Then for all k ≥ 1, we have

A_{τ} (x; k) = A_{τ^{0}}(x; k) + A_{ϕ}(x; k)A_{τ^{0}}^{∗}(x; k).

Proof. Suppose σ = σ^{1}σ^{2}σ^{3} ∈ [k]^{n} avoids the pattern τ, where σ^{1}σ^{2} quasiavoids the pattern τ^{0}, and σ^{2} is the occurrence of τ^{0}. Clearly, σ^{3} must avoid ϕ. To find A_{τ} (x; k), we observe that there are two possibilities: either σ avoids τ^{0}, or σ does not avoid τ^{0}. In these cases, the g.f. for the number of such words is equal to A_{τ^{0}}(x; k) and A_{ϕ}(x; k)A_{τ^{0}}^{∗}(x; k) respectively (the second term came from the factorization above). Thus, the statement is true.

Corollary 10. Let τ = τ^{1}-τ^{2}- ⋯ -τ^{s} be a multi-pattern such that τ^{j} is equal to either 12 or 21, for j = 1, 2, …, s. Then

A_{τ} (x; k) = \frac{1 − (1 + \frac{kx−1}{(1−x)^{k}} )^{s}}{1 − kx} .

Proof. According to [BM2], A_{12}(x; k) = A_{21}(x; k) = \frac{1}{(1−x)^{k}}. Using Theorem 5, Proposition 1 and induction on s, we get the desired result.

More generally, using Theorem 5 and Proposition 1, we get the following theorem that is the basis for calculating the number of words that avoid a multi-pattern, and therefore is the main result for multi-patterns in this paper.

Theorem 6. Let τ = τ^{1}-τ^{2}- ⋯ -τ^{s} be a multi-pattern. Then

A_{τ} (x; k) = ∑_{j=1}^{s} A_{τ^{j}}(x; k) ∏_{i=1}^{j−1}((kx − 1)A_{τ^{i}}(x; k) + 1).

6.5 The distribution of non-overlapping generalized patterns

A descent in a word σ ∈ [k]^{n} is an i such that σ_{i} > σ_{i+1}. Two descents i and j overlap if j = i + 1. We define a new statistics, namely the maximum number of non-overlapping descents, or MND, in a word. For example, MND(33211) = 1 whereas MND(13211143211) = 3. One can find the distribution of this new statistic by using Corollary 10. This distribution is given in Example 4. However, we prove a more general theorem:

Theorem 7. Let τ be a generalized pattern with no hyphens. Then for all k ≥ 1,

∑_{n≥0} ∑_{σ∈[k]^{n}} y^{N_{τ} (σ)}x^{n} = \frac{A_{τ} (x; k)}{1 − y((kx − 1)A_{τ} (x; k) + 1)},

where N_{τ} (σ) is the maximum number of non-overlapping occurrences of τ in σ.

Proof. We fix the natural number s and consider the multi-pattern Φ_{s} = τ-τ- ⋯ -τ with s copies of τ. If a word avoids Φ_{s} then it has at most s−1 non-overlapping occurrences of τ. Theorem 6 yields

A_{Φ_{s}}(x; k) = ∑_{j=1}^{s} A_{τ} (x; k) ∏_{i=1}^{j−1}((kx − 1)A_{τ} (x; k) + 1).

So, the g.f. for the number of words that has exactly s non-overlapping occurrences of the pattern τ is given by

A_{Φ_{s+1}}(x; k) − A_{Φ_{s}}(x; k) = A_{τ} (x; k)((kx − 1)A_{τ} (x; k) + 1)^{s}.

Hence,

∑_{n≥0} ∑_{σ∈[k]^{n}} y^{N_{τ} (σ)}x^{n} = ∑_{s≥0} A_{τ} (x; k)((kx − 1)A_{τ} (x; k) + 1)^{s} =

\frac{A_{τ} (x; k)}{1 − y((kx − 1)A_{τ} (x; k) + 1)}.

All of the following examples are corollaries to Theorem 7.

Example 4. If we consider descents (the pattern 12) then A_{12}(x; k) = \frac{1}{(1−x)^{k}} (see [BM2]), hence the distribution of MND is given by the formula:

∑_{n≥0} ∑_{σ∈[k]^{n}} y^{N_{12}(σ)}x^{n} = \frac{1}{(1 − x)^{k} + y(1 − kx − (1 − x)^{k})}.

Example 5. The distribution of the maximum number of non-overlapping occurrences of the pattern 122 is given by the formula:

∑_{n≥0} ∑_{σ∈[k]^{n}} y^{N_{122}(σ)}x^{n} = \frac{x}{(1 − x^{2})^{k} + x − 1 + y(1 − kx^{2} − (1 − x^{2})^{k})},

since according to [BM3, Theorem 3.10], A_{122}(x; k) = \frac{x}{(1−x^{2})^{k}−(1−x)}.

Example 6. If we consider the pattern 212 then A_{212}(x; k) = (1 − x ∑_{j=0}^{k−1} \frac{1}{1 + jx^{2}} )^{−1}

(see [BM3, Theorem 3.12]), hence the distribution of the maximum number of non-overlapping occurrences of the pattern 212 is given by the formula:

∑_{n≥0} ∑_{σ∈[k]^{n}} y^{N_{212}(σ)}x^{n} = \frac{1}{1 − x ∑_{j=0}^{k−1} \frac{1}{1 + jx^{2}} + xy (∑_{j=0}^{k−1} \frac{1}{1 + jx^{2}} − k)}.

Example 7. Using [BM3, Theorem 3.13], the distribution of the maximum number of non-overlapping occurrences of the pattern 123 is given by the formula:

∑_{n≥0} ∑_{σ∈[k]^{n}} y^{N_{123}(σ)}x^{n} = \frac{1}{∑_{j=0}^{k} a_{j}\binom{k}{j}x^{j} + y (1 − kx − ∑_{j=0}^{k} a_{j}\binom{k}{j}x^{j})},

where a_{3m} = 1, a_{3m+1} = −1, and a_{3m+2} = 0, for all m ≥ 0.

[BS] E. Babson, E. Steingrímsson: Generalized permutation patterns and a classification of the Mahonian statistics, Séminaire Lotharingien de Combinatoire, B44b:18pp, (2000).

[Bu] A. Burstein, Enumeration of words with forbidden patterns, Ph.D. thesis, University of Pennsylvania, 1998.

[BM1] A. Burstein and T. Mansour, Words restricted by patterns with at most 2 distinct letters, Electronic J. of Combinatorics, to appear (2002).

[BM2] A. Burstein and T. Mansour, Words restricted by 3-letter generalized multipermutation patterns, preprint CO/0112281.

[BM3] A. Burstein and T. Mansour, Counting occurrences of some subword patterns, preprint CO/0204320.

[C] A. Claesson: Generalised Pattern Avoidance, European Journal of Combinatorics 22 (2001), 961-971.

[CM] A. Claesson and T. Mansour, Enumerating Permutations Avoiding a Pair of Babson-Steingrímsson Patterns, preprint CO/0107044.

[Ki1] S. Kitaev, Multi-avoidance of generalised patterns, Discr. Math., to appear (2002).

[Ki2] S. Kitaev, Partially ordered generalized patterns, Discr. Math., to appear (2002).

[Knuth] D. E. Knuth: The Art of Computer Programming, 2nd ed. Addison Wesley, Reading, MA, (1973).

[SS] R. Simion, F. Schmidt: Restricted permutations, European J. Combin. 6, no. 4 (1985), 383–406.

Paper VII

Counting the occurrences of generalized patterns in words generated by a morphism

Counting the occurrences of generalized patterns in words generated by a morphism

Sergey Kitaev and Toufik Mansour ^{1}

Matematik, Chalmers tekniska högskola och Göteborgs universitet, S-412 96 Göteborg, Sweden

         kitaev@math.chalmers.se, toufik@math.chalmers.se

Abstract

We count the number of occurrences of certain patterns in given words. We choose these words to be the set of all finite approximations of a sequence generated by a morphism with certain restrictions. The patterns in our considerations are either classical patterns 1-2, 2-1, 1-1- ⋯ -1, or arbitrary generalized patterns without internal dashes, in which repetitions of letters are allowed. In particular, we find the number of occurrences of the patterns 1-2, 2-1, 12, 21, 123 and 1-1- ⋯ -1 in the words obtained by iterations of the morphism 1 → 123, 2 → 13, 3 → 2, which is a classical example of a morphism generating a nonrepetitive sequence.

7.1 Introduction and Background

We write permutations as words π = a_{1}a_{2} ⋯ a_{n}, whose letters are distinct and usually consist of the integers 1, 2, …, n.

An occurrence of a pattern p in a permutation π is “classically” defined as a subsequence in π (of the same length as the length of p) whose letters are in the same relative order as those in p. Formally speaking, for r ≤ n, we say that a permutation σ in the symmetric group S_{n} has an occurrence of the pattern p ∈ S_{r} if there exist 1 ≤ i_{1} < i_{2} < ⋯ < i_{r} ≤ n such that p = σ(i_{1})σ(i_{2}) … σ(i_{r}) in reduced form. The reduced form of a permutation σ on a set {j_{1}, j_{2}, …, j_{r}}, where j_{1} < j_{2} < ⋯ < j_{r}, is a permutation σ_{1} obtained by renaming the letters of the permutation σ so that j_{i} is renamed i for all i ∈ {1, …, r}. For example, the reduced form of the permutation 3651 is 2431. The first case of classical patterns studied was that of permutations avoiding a pattern of length 3 in S_{3}. Knuth [Knuth] found that, for any τ ∈ S_{3}, the number |S_{n}(τ)| of n-permutations avoiding τ is C_{n}, the nth Catalan number. Later, Simion and Schmidt [SimSch] determined the number |S_{n}(P)| of permutations in S_{n} simultaneously avoiding any given set of patterns P ⊆ S_{3}.

In [BabStein] Babson and Steingrímsson introduced generalised permutation patterns that allow the requirement that two adjacent letters in a pattern must be adjacent in the permutation. In order to avoid confusion we write a ”classical” pattern, say 231, as 2-3-1, and if we write, say 2-31, then we mean that if this pattern occurs in the permutation, then the letters in the permutation that correspond to 3 and 1 are adjacent. For example, the permutation π = 516423 has only one occurrence of the pattern 2-31, namely the subword 564, whereas the pattern 2-3-1 occurs, in addition, in the subwords 562 and 563. A motivation for introducing these patterns in [BabStein] was the study of Mahonian statistics. A number of interesting results on generalised patterns were obtained in [Claes]. Relations to several well studied combinatorial structures, such as set partitions, Dyck paths, Motzkin paths and involutions, were shown there.

1Research financed by EC’s IHRP Programme, within the Research Training Network ”Algebraic Combinatorics in Europe”, grant HPRN-CT-2001-00272

Burstein [Burstein] considered words instead of permutations. In particular, he found the number |[k]^{n}(P)| of words of length n in k-letter alphabet that avoid each pattern from a set P ⊆ S_{3} simultaneously. Burstein and Mansour [BurMans1] (resp. [BurMans2, BurMans3]) considered forbidden patterns (resp. generalized patterns) with repeated letters.

The most attention, in the papers on classical or generalized patterns, is paid to counting exact formulas and/or generating functions for the number of words or permutations avoiding, or having k occurrences of, certain pattern. In this paper we suggest another problem, namely counting the number of occurrences of a particular pattern τ in given words. We choose these words to be a set of all finite approximations (to be defined below) of a sequence generated by a morphism with certain restrictions. A motivation for such a choice is big interest in studying classes of sequences and words that are defined by iterative schemes [Lothaire, Salomaa]. The pattern τ in our considerations is either a classical pattern from the set {1-2, 2-1, 1-1- ⋯ -1}, or an arbitrary generalized pattern without internal dashes, in which repetitions of letters are allowed. In particular, we find that there are (3 · 4^{n−1} + 2^{n}) occurrences of the pattern 1-2 in the n-th finite approximation of the sequence w defined below, which is a classical example of a nonrepetitive sequence.

Let Σ be an alphabet and Σ^{⋆} be the set of all words of Σ. A map φ : Σ^{⋆} → Σ^{⋆} is called a morphism, if we have φ(uv) = φ(u)φ(v) for any u, v ∈ Σ^{⋆}. It is easy to see that a morphism φ can be defined by defining φ(i) for each i ∈ Σ. The set of all rules i → φ(i) is called a substitution system. We create words by starting with a letter from the alphabet Σ and iterating the substitution system. Such a substitution system is called a D0L (Deterministic, with no context Lindenmayer) system [LindRoz]. D0L systems are classical objects of formal language theory. They are interesting from mathematical point of view [Frid], but also have applications in theoretical biology [Lind]. Let |X| denote the length of a word X, that is the number of letters in X.

Suppose a word φ(a) begins with a for some a ∈ Σ, and that the length of φ^{k}(a) increases without bound. The symbolic sequence lim_{k→∞} φ^{k}(a) is said to be

generated by the morphism φ. In particular, lim_{k→∞} φ^{k}(a) is a fixed point of φ. However, in this paper we are only interesting in the finite approximations of lim_{k→∞} φ^{k}(a), that is in the words φ^{k}(a) for k = 1, 2, . . ..

An example of a sequence generated by a morphism can be the following sequence w. We create words by starting with the letter 1 and iterating the substitution system ϕ_{w}: 1 → 123, 2 → 13, 3 → 2. Thus, the initial letters of w are 123132123213.... This sequence was constructed in connection with the problem of constructing a nonrepetitive sequence on a 3-letter alphabet, that is, a sequence that does not contain any subwords of the type XX = X^{2}, where X is any non-empty word over a 3-letter alphabet. The sequence w has that property. The question of the existence of such a sequence, as well as the questions of the existence of sequences avoiding other kinds of repetitions, were studied in algebra [Adian, Justin, Kol], discrete analysis [Carpi, Dekk, Evdok, Ker, Pleas] and in dynamical systems [MorseHedl]. In Examples 1, 4 and 5 we give the number of occurrences of the patterns 1-2, 2-1, 1-1- ⋯ -1, 12, 123 and 21 in the finite approximations of w.

To proceed further, we need the following definitions. Let N_{ϕ}^{τ}(n) denote the number of occurrences of the pattern τ in a word generated by some morphism ϕ after n iterations. We say that an occurrence of τ is external for a pair of words (X, Y), if this occurrence starts in X and ends in Y. Also, an occurrence of τ for a word X is internal, if this occurrence starts and ends in this X.

7.2 Patterns 1-2, 2-1 and 1-1- ⋯ -1

Theorem 1. Let A = {1, 2, …, k} be an alphabet, where k ≥ 2 and a pattern τ ∈ {1-2, 2-1}. Let X_{1} begins with the letter 1 and consists of ℓ copies of each letter i ∈ A (ℓ ≥ 1). Let a morphism ϕ be such that

1 → X_{1}, 2 → X_{2}, 3 → X_{3}, …, k → X_{k},

where we allow X_{i} to be the empty word ϵ for i = 2, 3, …, k (that is, ϕ may be

an erasing morphism), ∑_{i=2}^{k} |X_{i}| = k · d, and each letter from A appears in the

word X_{2}X_{3} … X_{k} exactly d times. Besides, let e_{i,j} (resp. e_{i}) be the number of external occurrences of τ for (X_{i}, X_{j}) (resp. (X_{i}, X_{i})), where i ≠ j. We assume that e_{i,j} = e_{j,i} for all i and j. Let s_{i} be the number of internal occurrences of τ in X_{i}. In particular, s_{i} = e_{i} = e_{i,j} = e_{j,i} = 0, whenever X_{i} = ϵ; also, e_{i} = |X_{i}| · (|X_{i}| − 1)/2, whenever there are no repetitive letters in X_{i}. Then N_{ϕ}^{τ}(1) = s_{1} and for n ≥ 2, N_{ϕ}^{τ}(n) is given by

ℓ · (d + ℓ)^{n−2} ∑_{i=1}^{k} s_{i} + \binom{ℓ · (d + ℓ)^{n−2}}{2} ∑_{i=1}^{k} e_{i} + ℓ^{2} · (d + ℓ)^{2n−4} ∑_{1≤i<j≤k} e_{i,j}.

Proof. We assume that τ = 1-2. All the considerations for this τ remain the same for the case τ = 2-1.

If n = 1 then the statement is trivial.

Suppose n ≥ 2. Using the fact that X_{1}X_{2}X_{3} … X_{k}, has exactly d + ℓ occurrences of each letter i, i = 1, 2, …, k, one can prove by induction on n, that the word ϕ^{n}(1) is a permutation of ℓ · (d + ℓ)^{n−2} copies of each word X_{i}, where i = 1, 2, …, k. This implies, in particular, that |ϕ^{n}(1)| = k · ℓ · (d + ℓ)^{n−1}.

An occurrence of τ in ϕ^{n}(1) can be either internal, that is when τ occurs inside a word X_{i}, or external, which means that τ begins in a word X_{i} and ends in another word X_{j}. In the first of these cases, since there are ℓ·(d+ℓ)^{n−2} copies of each X_{i}, we have ℓ · (d + ℓ)^{n−2} ∑_{i=1}^{k} s_{i} possibilities. In the second case, either i = j, which gives \binom{ℓ·(d+ℓ)^{n−2}}{2} ∑_{i=1}^{k} e_{i} possibilities, or i ≠ j, in which case there are ℓ · (d + ℓ)^{n−2} possibilities to choose X_{i} (resp. X_{j}) among ℓ · (d + ℓ)^{n−2} copies of X_{i} (resp. X_{j}), and using the fact that e_{i,j} = e_{j,i} (the order in which the words X_{i} and X_{j} occur in ϕ^{n}(1) is unimportant), we have ℓ^{2} ·(d+ℓ)^{2n−4} ∑_{1≤i<j≤k} e_{i,j} possibilities. Summing all the possibilities, we finish the proof.

Let s (resp. e) denote the vector (s_{1}, s_{2}, …, s_{k}) (resp. (e_{1}, e_{2}, …, e_{k})), where s_{i} and e_{j} are defined in Theorem 1. All of the following examples are corollaries to Theorem 1.

Example 1. If we consider the morphism ϕ_{w} defined in Section 7.1 and the pattern τ = 1-2 then d = ℓ = 1, s = (3, 1, 0), e = (3, 1, 0) and e_{1,2} = e_{2,1} = 2, e_{1,3} = e_{3,1} = 1, e_{2,3} = e_{3,2} = 1. Hence, the number of occurrences of τ is given by N_{ϕ_{w}}^{1-2}(1) = 3 and, for n ≥ 2, N_{ϕ_{w}}^{1-2}(n) = (3 · 4^{n−1} + 2^{n})/2. If τ = 2-1 then s = (0, 0, 0), e = (3, 1, 0) and e_{1,2} = e_{2,1} = 2, e_{1,3} = e_{3,1} = 1, e_{2,3} = e_{3,2} = 1. Hence, N_{ϕ_{w}}^{2-1}(1) = 0 and, for n ≥ 2, N_{ϕ_{w}}^{2-1}(n) = (3 · 4^{n−1} − 2^{n})/2.

Example 2. If we consider the morphism ϕ: 1 → 1324, 2 → ϵ, 3 → 14, and 4 → 23 then for the pattern τ = 1-2, we have d = ℓ = 1, s = (5, 0, 1, 1), e = (6, 0, 1, 1), and e_{i,j}, for i ≠ j, are elements of the matrix

( \begin{matrix}− & 0 & 3 & 3 \\ 0 & − & 0 & 0 \\ 3 & 0 & − & 2 \\ 3 & 0 & 2 & − \end{matrix} ) .

Hence, N_{ϕ}^{1-2}(1) = 5 and, for n ≥ 2, N_{ϕ}^{1-2}(n) = 3 · 4^{n−1} + 11 · 2^{n−2}.

Example 3. If we consider the morphism ϕ: 1 → 13542, 2 → 423, 3 → ϵ, 4 → 5115, and 5 → 234 then for the pattern τ = 1-2, we have ℓ = 1, d = 2, s = (6, 1, 0, 2, 3), e = (10, 3, 0, 4, 3), and e_{i,j}, for i ≠ j, are elements of the matrix

( \begin{matrix}− & 6 & 0 & 8 & 6 \\ 6 & − & 0 & 6 & 3 \\ 0 & 0 & − & 0 & 0 \\ 8 & 6 & 0 & − & 6 \\ 6 & 3 & 0 & 6 & − \end{matrix} ) .

Hence, N_{ϕ}^{1-2}(1) = 6 and, for n ≥ 2, N_{ϕ}^{1-2}(n) = 5 · 9^{n−1} + 2 · 3^{n−2}.

Using the proof of Theorem 1, we have the following.

Theorem 2. Let a morphism ϕ satisfy all the conditions in the statement of Theorem 1 and the pattern τ = \underbrace{1-1- ⋯ -1}_{r times}. Then, for n ≥ 2, the number of occurrences of τ in ϕ^{n}(1) is given by k · \binom{ℓ·(d+ℓ)^{n−1}}{r}, whereas for n = 1, by k · \binom{ℓ}{r}.

Proof. From the proof of Theorem 1, we have that if n ≥ 2 (resp. n = 1) then ϕ^{n}(1) has exactly ℓ · (d + ℓ)^{n−1} (resp. ℓ) copies of each letter from A. We can choose r of them in \binom{ℓ·(d+ℓ)^{n−1}}{r} (resp. \binom{ℓ}{r}) ways to form the pattern τ. The rest is clear.

The following example is a corollary to Theorem 2.

Example 4. If we consider the morphism ϕ_{w} defined in Section 7.1 and the pattern τ = 1-1-1-1 then d = ℓ = 1, r = 4, hence the number of occurrences of τ in ϕ^{n}(1) is 0, whenever n = 1 or n = 2, and 3 · \binom{2^{n−1}}{4} otherwise.

7.3 Patterns without internal dashes

In what follows we need to extend the notion of an external occurrence of a pattern. Suppose W = AXBY C, where A, X, B, Y and C are some subwords. We say that an occurrence of τ in W is external for a pair of words (X, Y), if this occurrence starts in X, ends in Y and is allowed to have some of its letters in B. For instance, if W = 12324245, where A = 1, X = 23, B = 2 and Y = 424 then an occurrence of the generalized pattern 213, namely the subword 324 is an external occurrence for (X, Y).

Theorem 3. Let A = {1, 2, …, k} be an alphabet and a generalized pattern τ has no internal dashes. Let X_{1} begins with the letter 1 and consists of ℓ copies of each letter i ∈ A (ℓ ≥ 1). Let a morphism ϕ be such that

1 → X_{1}, 2 → X_{2}, 3 → X_{3}, …, k → X_{k},

where we allow X_{i} to be the empty word ϵ for i = 2, 3, …, k (that is, ϕ may

be an erasing morphism), ∑_{i=2}^{k} |X_{i}| = k · d, and each letter from A appears in

the word X_{2}X_{3} … X_{k} exactly d times. Besides, we assume that there are no external occurrences of τ in ϕ^{n}(1) for the pair (X_{i}, X_{j}) for each i and j. Let s_{i} be the number of internal occurrences of τ in X_{i}. In particular, s_{i} = 0, whenever X_{i} = ϵ. Then N_{ϕ}^{τ}(1) = s_{1} and for n ≥ 2,

N_{ϕ}^{τ}(n) = ℓ · (d + ℓ)^{n−2} ∑_{i=1}^{k} s_{i}.

Proof. The theorem is straightforward to prove by observing that for n ≥ 2, ϕ^{n}(1) has ℓ·(d+ℓ)^{n−2} occurrences of each word X_{i} (see the proof of Theorem 1).

Remark 5. In order to use Theorem 3, we need to control the absence of external occurrences of a pattern τ for given τ (without internal dashes) and a morphism ϕ. To do this, we need, for any pair (X_{i}, X_{j}), to consider all the words X_{i}W X_{j}, where |W | < |τ| − 1, and W is a permutation of a number of words from the set {X_{1}, X_{2}, …, X_{k}}.

The following examples are corollaries to Theorem 3.

Example 5. If we consider the morphism ϕ_{w} defined in Section 7.1 and the pattern τ = 12 then all the conditions of Theorems 3 hold. In this case d = ℓ = 1 and s = (2, 1, 0). Hence, the number of occurrences of the patterns 12, that is the number of rises, is given by N_{ϕ_{w}}^{12}(1) = 2 and, for n ≥ 2, N_{ϕ_{w}}^{12}(n) = 3 · 2^{n−2}. If τ = 123 then we can apply the theorem to get that for n ≥ 2, N_{ϕ_{w}}^{123}(n) = 2^{n−2}.

If we want to count the number of occurrences of the pattern τ = 21, that is the number of descents, then we cannot apply Theorem 1, since for instance, the pair (X_{1}, X_{2}) = (123, 13) has an external occurrence of τ. However, it is obvious that the number of descents in ϕ^{n}(1) is equal to |ϕ^{n}(1)|−N_{ϕ_{w}}^{12}(1)−1 = 3·2^{n−2}−1.

Example 6. If we consider the morphism ϕ: 1 → 1243, 2 → 3, 3 → ϵ, and 4 → 124 then for the pattern τ = 123, all the conditions of Theorems 3 hold. In this case d = ℓ = 1, s = (1, 0, 0, 1). Hence, for n ≥ 1, N_{ϕ}^{123}(n) = 2^{n−1}. For τ = 321 we cannot apply Theorem 3, since the pair (X_{4}, X_{1}) has an external occurrence of τ (look at X_{4}X_{2}X_{1} = 12431243). Consideration of the words X_{4}X_{2} and X_{4}X_{1} implies that the theorem cannot be apply for the patterns 132 and 231 respectively. However, we can apply the theorem to the pattern 213 to prove that it does not occur in ϕ^{n}(1) for any n.

Acknowledgement: The final version of this paper was written during the second author’s (T.M.) stay at Haifa University, Haifa 31905, Israel. T.M. wants to express his gratitude to Haifa University for the support.

[Adian] Adian S. I.: The Burnside problem and identities in groups. Translated from the Russian by John Lennox and James Wiegold. Ergebnisse der Mathematik und ihrer Grenzgebiete [Results in Mathematics and Related Areas], 95. Springer-Verlag, Berlin-New York, (1979). xi+311 pp.

[BabStein] Babson E., Steingrímsson E.: Generalized permutation patterns and a classification of the Mahonian statistics, Sém. Lothar. Combin. 44 (2000), Art. B44b, 18 pp.

[Burstein] Burstein A., Enumeration of words with forbidden patterns, Ph.D. thesis, University of Pennsylvania, 1998.

[BurMans1] Burstein A. and Mansour T., Words restricted by patterns with at most 2 distinct letters, Electronic J. of Combinatorics, to appear (2002).

[BurMans2] Burstein A. and Mansour T., Words restricted by 3-letter generalized multipermutation patterns, preprint CO/0112281.

[BurMans3] Burstein A. and Mansour T., Counting occurrences of some subword patterns, preprint CO/0204320.

[Carpi] Carpi A.: On the number of abelian square-free words on four letters, Discrete Appl. Mathematics, Elsevier, 81 (1998), 155–167.

[Claes] A. Claesson: Generalised Pattern Avoidance, European J. Combin. 22 (2001), no. 7, 961–971.

[Dekk] Dekking F. M.: Strongly non-repetitive sequences and progression-free sets, Journal Com. Theory, Vol. 27-A, No. 2 (1979), 181–185.

[Evdok] Evdokimov A. A.: Strongly asymmetric sequences generated by a finite number of symbols, Dokl. Akad. Nauk SSSR, 179 (1968), 1268–1271. (Russian) English translation in: Soviet Math. Dokl., 9 (1968), 536–539.

[Frid] Frid A. E.: On the frequency of factors in a DOL word, J. Automata, Languages and Combinatorics, Otto-von-Guericke-Univ., Magdeburg 3(1) (1998), 29–41.

[Justin] Justin J.: Characterization of the repetitive commutative semigroups, Journal of Algebra (1972), no. 21, 87–90.

[Ker] Keränen V.: Abelian squares are avoidable on 4 letters, In W. Kuich, editor, Proc. ICALP’92, Lecture Notes in Comp. Sci., 623, Springer-Verlag, Berlin (1992), 41–52.

[Knuth] Knuth D. E.: The Art of Computer Programming, 2nd ed. Addison Wesley, Reading, MA, (1973).

[Kol] Kolotov A. T.: Aperiodic sequences and functions of the growth of algebras, Algebra i Logika 20 (1981), no. 2, 138–154. (Russian)

[Lind] Lindenmayer A.: Mathematical models for cellular interaction in development, Parts I and II, Journal of Theoretical Biology, 18 (1968), 280–315.

[LindRoz] Lindenmayer A., Rozenberg G.: Automata, languages, development, North-Holland Publishing Co., Amsterdam-New York-Oxford (1976), viii+529 pp.

[Lothaire] Lothaire M.: Combinatorics on Words, Encyclopedia of Mathematics, Vol. 17, Addison-Wesley (1986). Reprinted in the Cambridge Mathematical Library, Cambridge University Press, Cambridge UK, (1997).

[MorseHedl] Morse M., Hedlung G.: Unending chess, symbolic dynamics and a problem in semigroups, Duke Math. Journal, Vol. 11, No. 1 (1944), 1–7.

[Pleas] Pleasants P.: Non-repetitive sequences, Proc. Camb. Phil. Soc., Vol. 68 (1970), 267–274.

[Salomaa] Salomaa A.: Jewels of Formal Language Theory, Computer Science Press, (1981).

[SimSch] R. Simion, F. Schmidt: Restricted permutations, European J. Combin. 6, no. 4 (1985), 383–406.

Paper VIII

The Peano curve and counting occurrences of some patterns

The Peano curve and counting occurrences of some patterns

Sergey Kitaev and Toufik Mansour ^{1}

Matematik, Chalmers tekniska högskola och Göteborgs universitet, S-412 96 Göteborg, Sweden

         kitaev@math.chalmers.se, toufik@math.chalmers.se

Abstract

We introduce Peano words, which are words corresponding to finite approximations of the Peano space filling curve. We then find the number of occurrences of certain patterns in these words.

8.1 Introduction and Background

We write permutations as words π = a_{1}a_{2} ⋯ a_{n}, whose letters are distinct and usually consist of the integers 1, 2, …, n.

An occurrence of a pattern p in a permutation π is “classically” defined as a subsequence in π (of the same length as the length of p) whose letters are in the same relative order as those in p. Formally speaking, for r ≤ n, we say that a permutation σ in the symmetric group S_{n} has an occurrence of the pattern p ∈ S_{r} if there exist 1 ≤ i_{1} < i_{2} < ⋯ < i_{r} ≤ n such that p = σ(i_{1})σ(i_{2}) … σ(i_{r}) in reduced form. The reduced form of a permutation σ on a set {j_{1}, j_{2}, …, j_{r}}, where j_{1} < j_{2} < ⋯ < j_{r}, is a permutation σ_{1} obtained by renaming the letters of the permutation σ so that j_{i} is renamed i for all i ∈ {1, …, r}. For example, the reduced form of the permutation 3651 is 2431. The first case of classical patterns studied was that of permutations avoiding a pattern of length 3 in S_{3}. Knuth [Knuth] found that, for any τ ∈ S_{3}, the number |S_{n}(τ)| of n-permutations avoiding τ is C_{n}, the nth Catalan number. Later, Simion and Schmidt [SimSch] determined the number |S_{n}(P)| of permutations in S_{n} simultaneously avoiding any given set of patterns P ⊆ S_{3}.

In [BabStein] Babson and Steingrímsson introduced generalised permutation patterns that allow the requirement that two adjacent letters in a pattern must be adjacent in the permutation. In order to avoid confusion we write a ”classical” pattern, say 231, as 2-3-1, and if we write, say 2-31, then we mean that if this pattern occurs in the permutation, then the letters in the permutation that correspond to 3 and 1 are adjacent. For example, the permutation π = 516423 has only one occurrence of the pattern 2-31, namely the subword 564, whereas the pattern 2-3-1 occurs, in addition, in the subwords 562 and 563. A motivation for introducing these patterns in [BabStein] was the study of Mahonian statistics. A number of interesting results on generalised patterns were obtained in [Claes]. Relations to several well studied combinatorial structures, such as set partitions, Dyck paths, Motzkin paths and involutions, were shown there.

1Research financed by EC’s IHRP Programme, within the Research Training Network ”Algebraic Combinatorics in Europe”, grant HPRN-CT-2001-00272

Burstein [Burstein] considered words instead of permutations. In particular, he found the number |[k]^{n}(P)| of words of length n in a k-letter alphabet that avoid all patterns from a set P ⊆ S_{3} simultaneously. Burstein and Mansour [BurMans1] (resp. [BurMans2, BurMans3]) considered forbidden patterns (resp. generalized patterns) with repeated letters.

The most attention, in the papers on classical or generalized patterns, is paid to finding exact formulas and/or generating functions for the number of words or permutations avoiding, or having k occurrences of, certain patterns. In [KitMans] the present authors suggested another problem, namely counting the number of occurrences of certain patterns in certain words. These words were chosen to be the set of all finite approximations of a sequence generated by a morphism with certain restrictions. A motivation for this choice was the interest in studying classes of sequences and words that are defined by iterative schemes [Lothaire, Salomaa].

In the present paper we also study the number of occurrences of certain patterns in certain words. But here we choose these words to be the discrete analogue given by Evdokimov, of subdivision stages from which the Peano curve is obtained. We call these words the Peano words. The Peano curve was studied by the Italian mathematician Giuseppe Peano in 1890 as an example of a continuous space filling curve. We consider the Peano words and find the number of occurrences of the patterns 12, 21, 1^{ℓ}, [x-y^{ℓ}), (x^{ℓ}-y] and [x-y^{ℓ}-z], where x, y, z ∈ {1, 2, 3}, y^{ℓ} = y-y- ⋯ -y (ℓ times), and “[“ in p = [x − w) indicates that in an occurrence of p, the letter corresponding to the x must be the first letter of the word.

8.2 The Peano curve and the Peano words

We follow [GelbOlm] and present a description (of a curve that fills the unit square S = [0, 1]×[0, 1]) given in 1891 by the German mathematician D. Hilbert.

As indicated in Figure 8.3, the idea is to subdivide S and the unit interval I = [0, 1] into 4^{n} closed subsquares and subintervals, respectively, and to set up a correspondence between subsquares and subintervals so that inclusion relationships are preserved (at each stage of subdivision, if a square corresponds to an interval, then its subsquares correspond to subintervals of that interval).

We now define the continuous mapping f of I onto S: If x ∈ I, then at each stage of subdivision x belongs to at least one closed subinterval. Select either one (if there are two) and associate the corresponding square. In this way a decreasing sequence of closed squares is obtained corresponding to a decreasing sequence of closed intervals. This sequence of closed squares has the property that there is exactly one point belonging to all of them. This point is by definition f(x). It can be shown that the point f(x) is well-defined, that is, independent of any choice of intervals containing x; the range of f is S; and f is continuous.

Figure 8.3: the Peano words

The following discrete analogue of the Peano curve was given by Evdokimov [Evdok]. We consider a subdivision stage (an iteration), go through the curve inside S starting in the point 1 (see Figure 8.3), and coding any movement “up” by 1, “right” by 2, ”down” by 3, ”left” by 4. Thus, we start with the first iteration X_{1} = 123, the second iteration is X_{2} = 214112321233432. More generally, it is easy to see that the n-th iteration is given by

X_{n} = φ_{1}(X_{n−1})1X_{n−1}2X_{n−1}3φ_{2}(X_{n−1}),

where the function φ_{1}(A) reverses the letters in the word A and makes the substitution corresponding to the permutation 4123, that is, 1 becomes 4 etc. The function φ_{2} does the same, except with 4123 replaced by 2341. In this paper, we are interested in the words X_{n}, for n = 1, 2, …, which appear as the subdivision stages of the Peano curve. We call these words the Peano words.

8.3 The main results

It is easy to see that the length of the curve after the n-th iteration is |X_{n}| = 4^{n} − 1. Moreover, the following lemma holds.

Lemma 1. The number of occurrences of the letters 1, 2, 3 and 4 in X_{n} is given by 4^{n−1}, 4^{n−1} + 2^{n−1} − 1, 4^{n−1} and 4^{n−1} − 2^{n−1} respectively.

Proof. Suppose d_{1}^{n} (resp. d_{2}^{n}, d_{3}^{n}, d_{4}^{n}) denote the number of occurrences of the letter 1 (resp. 2,3,4) in the word X_{n}. It is easy to see, using the way we construct X_{n}, that

( \begin{matrix}d_{1}^{n} \\ d_{2}^{n} \\ d_{3}^{n} \\ d_{4}^{n} \end{matrix} ) = ( \begin{matrix}2 & 1 & 0 & 1 \\ 1 & 2 & 1 & 0 \\ 0 & 1 & 2 & 1 \\ 1 & 0 & 1 & 2 \end{matrix} ) ( \begin{matrix}d_{1}^{n−1} \\ d_{2}^{n−1} \\ d_{3}^{n−1} \\ d_{4}^{n−1} \end{matrix} ) + ( \begin{matrix}1 \\ 1 \\ 1 \\ 0 \end{matrix} ) .

Using the diagonalization of the matrix in the identity above, namely the fact that

\begin{matrix}( \begin{matrix}2 & 1 & 0 & 1 \\ 1 & 2 & 1 & 0 \\ 0 & 1 & 2 & 1 \\ 1 & 0 & 1 & 2 \end{matrix} ) = \\ ( \begin{matrix}−1 & −1 & 0 & 1 \\ 1 & 0 & −1 & 1 \\ −1 & 1 & 0 & 1 \\ 1 & 0 & 1 & 1 \end{matrix} ) ( \begin{matrix}0 & 0 & 0 & 0 \\ 0 & 2 & 0 & 0 \\ 0 & 0 & 2 & 0 \\ 0 & 0 & 0 & 4 \end{matrix} ) ( \begin{matrix}−1/4 & 1/4 & −1/4 & 1/4 \\ −1/2 & 0 & 1/2 & 0 \\ 0 & −1/2 & 0 & 1/2 \\ 1/4 & 1/4 & 1/4 & 1/4 \end{matrix} ) , \end{matrix}

we get that the vector (d_{1}^{n}, d_{2}^{n}, d_{3}^{n}, d_{4}^{n})′ is equal to the vector

(4^{n−1}, 4^{n−1} + 2^{n−1} − 1, 4^{n−1}, 4^{n−1} − 2^{n−1})′.

As a corollary to Lemma 1 we have the following.

Corollary 11. The number of occurrences of the pattern τ = \underbrace{1-1- ⋯ -1}_{ℓ} = 1^{ℓ}

in X_{n} is equal to

\binom{4^{n−1} − 2^{n−1}}{ℓ} + 2\binom{4^{n−1}}{ℓ} + \binom{4^{n−1} + 2^{n−1} − 1}{ℓ}.

Proof. The number of occurrences of a subsequence \underbrace{i-i- ⋯ -i}_{ℓ} in X_{n}, for i =

1, 2, 3, 4, is obviously given by \binom{d_{i}^{n}}{ℓ}, where d_{i}^{n} is defined and determined in the proof of Lemma 1. The rest is easy to see.

Definition 9. Let r(A) (resp. d(A)) denote the number of occurrences of the pattern 12 (resp. 21), that is the number of rises (resp. descents), in a word A.

Lemma 2. Suppose A = 1X3 and B = 2Y 2 for some words X and Y. Then r(φ_{1}(A)) = d(A) + 1, d(φ_{1}(A)) = r(A) − 1, r(φ_{2}(B)) = d(B) and d(φ_{2}(B)) = r(B).

Proof. If Ā and B̄ denote the reverses of A and B then r(Ā) = d(A), d(Ā) = r(A), r(B̄) = d(B), and d(B̄) = r(B).

We consider two factorizations of each word Ā and B̄. We can write Ā as

Ā = 3A_{1} \underbrace{1 … 1}_{i_{1}} A_{2} \underbrace{1 … 1}_{i_{2}} A_{3} … A_{k} \underbrace{1 … 1}_{i_{k}},

where A_{i}, for i = 1, 2, …, k is a word over the alphabet {2, 3, 4}, only A_{1} can be the empty word ϵ, and i_{j} ≥ 1 for j = 1, 2 …, k. Also, we can write Ā as

Ā = 3A0^{′} \underbrace{4 … 4}_{i′_{1}} A1^{′} \underbrace{4 … 4}_{i′_{2}} A2^{′} … Ak−1^{′} \underbrace{4 … 4}_{i′_{k}} Ak^{′}1,

where Ai^{′}, for i = 0, 1, …, k is a word over the alphabet {1, 2, 3}, only A0^{′} and Ak^{′} can be ϵ, and ij^{′} ≥ 1 for j = 1, 2 …, k.

The word B̄ can be written as

B̄ = 2B_{0} \underbrace{1 … 1}_{j_{1}} B_{1} \underbrace{1 … 1}_{j_{2}} B_{2} … B_{ℓ−1} \underbrace{1 … 1}_{j_{ℓ}} B_{ℓ}2,

where B_{i}, for i = 0, 1, …, ℓ, is a word over the alphabet {2, 3, 4}, only B_{0} and B_{ℓ} can be ϵ, and j_{i} ≥ 1 for i = 1, 2 …, ℓ. Also, B̄ can be written as

B̄ = 2B0^{′} \underbrace{4 … 4}_{j′_{1}} B1^{′} \underbrace{4 … 4}_{j′_{2}} B2^{′} … Bℓ−1^{′} \underbrace{4 … 4}_{j′_{ℓ}} Bℓ^{′}2,

where Bi^{′}, for i = 0, 1, …, ℓ, is a word over the alphabet {1, 2, 3}, only B0^{′} and Bℓ^{′} can be ϵ, and ji^{′} ≥ 1 for i = 1, 2 …, ℓ.

It follows from the definitions that φ_{1}(A) and φ_{1}(B) (resp. φ_{2}(A) and φ_{2}(B)) are obtained from Ā and B̄ by permuting the letters with the function π_{1} (resp. π_{2}) that acts as the permutation 4123 (resp. 2341).

We now consider the first factorizations of Ā and B̄, and the function π_{1}. It is easy to see that if W is equal to A_{i}, or B_{i}, or 3A_{1}, or 2B_{0}, or B_{ℓ}2, then r(W) = r(π_{1}(W)) and d(W) = d(π_{1}(W)), since π_{1} is an order-preserving function when it acts from the set {2, 3, 4} to the set {1, 2, 3}. From the other hand, occurrences of the rises 12, 13 and 14 (resp. the descents 41, 31 and 21) in Ā and B̄, give occurrences of the descents 41, 42 and 43 (resp. the rises 34, 24 and 14) in π_{1}(Ā) and π_{1}(B̄) respectively. If we now read the first factorizations of Ā and B̄ from the left to the right, then the occurrences of the subwords a1 alternate with the occurrences of the subwords 1b, where a, b ∈ {2, 3, 4}. Moreover, in the factorization of Ā, we begin and end with the subword a1 for some a ∈ {2, 3, 4}, which gives that d(A) + 1 = r(Ā) + 1 = r(π_{1}(Ā)) = r(φ_{1}(A)) and r(A) − 1 = d(Ā) − 1 = d(π_{1}(Ā)) = d(φ_{1}(A)); in the factorization of B̄, we begin with the subword a1 and end with the subword 1b for some a, b ∈ {2, 3, 4}, which gives that d(B) = r(B̄) = r(π_{1}(B̄)) = r(φ_{1}(B)) and r(B) = d(B̄) = d(π_{1}(B̄)) = d(φ_{1}(B)).

If we consider the second factorizations of Ā and B̄, and the function π_{2}, one can see that if W is equal to Ai^{′}, or Bi^{′}, or 3A0^{′}, or Ak^{′}1, or 2B0^{′}, or Bℓ^{′}2, then r(W) = r(π_{2}(W)) and d(W) = d(π_{2}(W)), since π_{2} is an order-preserving function when it acts from the set {1, 2, 3} to the set {2, 3, 4}. From the other hand, occurrences of the rises 14, 24 and 34 (resp. the descents 41, 42 and 43) in Ā and B̄, give occurrences of the descents 21, 31 and 41 (resp. the rise 12, 13 and 14) in π_{2}(Ā) and π_{2}(B̄) respectively. If we now read the second factorizations of Ā and B̄ from the left to the right, then the occurrences of the subwords a4 alternate with the occurrences of the subwords 4b, where a, b ∈ {1, 2, 3}. Moreover, in both cases, we begin with the subword a4 and end with the subword 4b for some a, b ∈ {1, 2, 3}, which gives that d(A) = r(Ā) = r(π_{2}(Ā)) = r(φ_{2}(A)), r(A) = d(Ā) = d(π_{2}(Ā)) = d(φ_{2}(A)), d(B) = r(B̄) = r(π_{2}(B̄)) = r(φ_{2}(B)) and r(B) = d(B̄) = d(π_{2}(B̄)) = d(φ_{2}(B)).

Theorem 1. Let r_{n} (resp. d_{n}) be the number of occurrences of the pattern 12 (resp. 21) in X_{n}. Then for all k ≥ 0,

r_{2k+1} = \frac{2}{5}(4 · 16^{k} + 1),
r_{2k+2} = \frac{2}{5}(16^{k+1} − 1),
d_{2k+1} = \frac{8}{5}(16^{k} − 1),
d_{2k+2} = \frac{2}{5}(16^{k+1} − 1).

Proof. Using the properties of φ_{1} and φ_{2}, as well as the way we construct X_{n}, it is easy to check by induction, that X_{2k+1} and X_{2k+2} can be factorized as follow:

X_{2k+1} = \underbrace{1X^{(1)}1}_{φ_{1}(X_{4k})} 1 \underbrace{2Y^{(1)}2}_{X_{4k}} 2 \underbrace{2Y^{(1)}2}_{X_{4k}} 3 \underbrace{3Z^{(1)}3}_{φ_{2}(X_{4k})},

X_{2k+2} = \underbrace{2X^{(2)}4}_{φ_{1}(X_{4k+1})} 1 \underbrace{1Y^{(2)}3}_{X_{4k+1}} 2 \underbrace{1Y^{(2)}3}_{X_{4k+1}} 3 \underbrace{4Z^{(2)}2}_{φ_{2}(X_{4k+1})},

where X^{(i)}, Y^{(i)} and Z^{(i)} are some words for i = 1, 2.

Suppose we know r_{2k+1} and d_{2k+1} for some k. Since X_{2k+1} = 1W 3 for some word W, using Lemma 2 and the factorization of the word X_{2k+2}, we can find r_{2k+2} and d_{2k+2}. Indeed, φ_{1}(X_{4k+1}) has d_{2k+1} + 1 rises and r_{2k+1} − 1 descents; φ_{2}(X_{4k+1}) has d_{2k+1} rises and r_{2k+1} descents; two subwords X_{2k+1} give 2r_{2k+1} rises and 2d_{2k+1} descents. Besides, we have some extra rises and descents appeared between different blocks of the decomposition. They are one extra rise between the letter 3 and the subword φ_{2}(X_{4k+1}), and 3 extra descents between the subword φ_{1}(X_{4k+1}) and the letter 1, the subword X_{4k+1} and the letter 2, the letter 2 and the subword X_{4k+1}. Thus, r_{2k+2} = 2r_{2k+1} +2d_{2k+1} +2 and d_{2k+2} = 2r_{2k+1} + 2d_{2k+1} + 2, which shows, in particular, that for even n, in X_{n}, the number of rises is equal to the number of descents.

We now analyze the factorization of X_{2k+3}, which is similar to that of X_{2k+1}. Using the fact that X_{2k+2} = 2W′2 for some word W′ and Lemma 2, we can find r_{2k+3} and d_{2k+3}. Indeed, we can use the similar considerations as above to get r_{2k+3} = 2r_{2k+2} + 2d_{2k+2} + 2 = 8r_{2k+1} + 8d_{2k+1} + 10 and d_{2k+3} = 2r_{2k+2} + 2d_{2k+2} = 8r_{2k+1} +8d_{2k+1} +8. Thus, if x_{k} denote the vector (r_{2k+1}, d_{2k+1})′ then

x_{k+1} = ( \begin{matrix}8 & 8 \\ 8 & 8 \end{matrix} ) x_{k} + ( \begin{matrix}10 \\ 8 \end{matrix} ) ,

with x_{0} = (2, 0), since in X_{1} = 123, there are two rises and no descents. This recurrence relation, using diagonalization of the matrix in it, leads us to

x_{k} = (\frac{2}{5}(4 · 16^{k} + 1), \frac{8}{5}(16^{k} − 1))′.

Finally, r_{2k+2} = d_{2k+2} = 2r_{2k+1} + 2d_{2k+1} + 2 = \frac{2}{5}(16^{k+1} − 1).

Let N_{τ} (W) denote the number of occurrences of the pattern τ in the word W. Using Lemma 1 and the proof of Theorem 1, we can count, for X_{n}, the

number of occurrences of the patterns τ_{1}(x, y) = [x-y^{ℓ}), τ_{2}(x, y) = x^{ℓ}-y] and τ_{3}(x, y, z) = [x-y^{ℓ}-z], where x, y, z ∈ {1, 2, 3}, y^{ℓ} = y-y- ⋯ -y (ℓ times), and “[“ in p = [x − w) indicates that in an occurrence of p, the letter corresponding to the x must be the first letter of the word, whereas “]” in τ_{3}(x, y, z) indicates that in an occurrence of τ_{3}(x, y, z), the letter corresponding to the z must be the last (rightmost) letter of the word.

If we consider, for instance, the pattern τ_{1}(1, 2) = [1-2^{ℓ}) then the letter 1 in this pattern must correspond to the leftmost letter of the word X_{n}. Now if n = 2k+1 then from the proof of Theorem 1 X_{n} = 1W for some word W, which means that to the sequence 2^{ℓ} there can correspond any subsequence i^{ℓ} in X_{n}, where i = 2, 3, 4. Thus, using Lemma 1 and the way we prove Corollary 11, there are \binom{4^{2k}−2^{2k}}{ℓ} + \binom{4^{2k}}{ℓ} + \binom{4^{2k}+2^{2k}−1}{ℓ} occurrences of the pattern τ_{1}(1, 2) in X_{2k+1}. If n = 2k + 2 then X_{n} = 2W for some word W and for the sequence 2^{ℓ} there correspond any subsequence i^{ℓ} in X_{n}, where i = 3, 4. Thus, N_{τ_{1}(1,2)}(X_{2k+2}) = \binom{4^{2k}−2^{2k}}{ℓ} + \binom{4^{2k}}{ℓ}.

In the example above, as well as in the following considerations, we assume ℓ to be greater then 0. If ℓ = 0 then obviously N_{τ_{1}(x,y)}(X_{n}) = N_{τ_{2}(x,y)}(X_{n}) = 1, whereas N_{τ_{3}(x,y,z)}(X_{n}) is equal to 1 if x < z and n = 2k + 1, or x = z and n = 2k + 2, and it is equal to 0 otherwise.

When we consider τ_{3}(x, y, z)(X_{n}), we observe that since X_{2k+2} = 2W 2 for some W, N_{τ_{3}(x,y,z)}(X_{2k+2}) = 0, whenever x ≠ z. Also, since X_{2k+1} = 1W 3 for some W, N_{τ_{3}(x,y,z)}(X_{2k+1}) = 0, whenever x ≥ z.

Let us consider the pattern τ_{3}(2, 1, 3) = [2-1^{ℓ}-3]. As it was mentioned before, N_{τ_{3}(2,1,3)}(X_{2k+2}) = 0. But, if we consider X_{2k+1} = 1W 3, then it is easy to see that N_{τ_{3}(2,1,3)}(X_{2k+1}) = 0, since the leftmost letter of X_{2k+1} is the least letter, which means that it cannot correspond to the letter 2 in the pattern. As one more example, we can consider the pattern τ_{3}(1, 1, 2) = [1-1^{ℓ}-2]. We are only interested in case X_{n} = X_{2k+1}, since N_{τ_{3}(1,1,2)}(X_{2k+2}) = 0. The number of occurrences of the pattern is obviously given by the number of ways to choose ℓ letters among 4^{2k} − 1 letters 1 (totally, there are 4^{2k} letters 1 according to Lemma 1, but we cannot consider the leftmost 1 since it corresponds to the leftmost 1 in the pattern). Thus, N_{τ_{3}(1,1,2)}(X_{2k+1}) = \binom{4^{2k}−1}{ℓ}.

All the other cases of x, y, z in the patterns τ_{1}(x, y), τ_{2}(x, y) and τ_{3}(x, y, z) can be considered in the same way. Let S_{1} and S_{2} denote the following:

S_{1} = \binom{4^{2k} − 2^{2k}}{ℓ}+\binom{4^{2k}}{ℓ}+\binom{4^{2k} + 2^{2k} − 1}{ℓ}, S_{2} = \binom{4^{2k+1}}{ℓ}+\binom{4^{2k+1} − 2^{2k+1}}{ℓ}.

The tables below give all the results concerning the patterns under consideration, except those triples (x, y, z), for which N_{τ_{3}(x,y,z)}(X_{n}) = 0 for all n.

\begin{matrix}x & y & N_{τ_{1}(x,y)}(X_{2k+1}) & N_{τ_{2}(x,y)}(X_{2k+1}) & N_{τ_{1}(x,y)}(X_{2k+2}) & N_{τ_{2}(x,y)}(X_{2k+2}) \\ 1 & 1 & \binom{4^{2k}−1}{ℓ} & \binom{4^{2k}−1}{ℓ} & \binom{4^{2k+1}+2^{2k+1}−1}{ℓ} & \binom{4^{2k+1}+2^{2k+1}−1}{ℓ} \\ 1 & 2 & S_{1} & \binom{4^{2k}}{ℓ} + \binom{4^{2k}+2^{2k}−1}{ℓ} & S_{2} & \binom{4^{2k+1}}{ℓ} \\ 2 & 1 & 0 & \binom{4^{2k}−2^{2k}}{ℓ} & \binom{4^{2k+1}}{ℓ} & S_{2} \end{matrix} \begin{matrix}x & y & z & N_{τ_{3}(x,y,z)}(X_{2k+1}) & N_{τ_{3}(x,y,z)}(X_{2k+2}) \\ 1 & 1 & 1 & 0 & \binom{4^{2k+1}−2}{ℓ} \\ 1 & 1 & 2 & \binom{4^{2k}−1}{ℓ} & 0 \\ 1 & 2 & 1 & 0 & S_{2} \\ 1 & 2 & 2 & \binom{4^{2k}−1}{ℓ} & 0 \\ 2 & 1 & 2 & 0 & \binom{4^{2k+1}}{ℓ} \\ 1 & 2 & 3 & \binom{4^{2k}+2^{2k}−1}{ℓ} & 0 \\ 1 & 3 & 2 & \binom{4^{2k}−2^{2k}}{ℓ} & 0 \end{matrix}

182 [BabStein] Babson E., Steingrímsson E.: Generalized permutation patterns and

a classification of the Mahonian statistics, Sém. Lothar. Combin. 44 (2000), Art. B44b, 18 pp.

[Burstein] Burstein A., Enumeration of words with forbidden patterns, Ph.D. thesis, University of Pennsylvania, 1998.

[BurMans1] Burstein A., Mansour T.: Words restricted by patterns with at most 2 distinct letters, Electronic J. of Combinatorics, to appear (2002).

[BurMans2] Burstein A., Mansour T.: Words restricted by 3-letter generalized multipermutation patterns, preprint CO/0112281.

[BurMans3] Burstein A., Mansour T.: Counting occurrences of some subword patterns, preprint CO/0204320.

[Claes] A. Claesson: Generalised Pattern Avoidance, European J. Combin. 22 (2001), no. 7, 961–971.

[GelbOlm] Gelbaum B., Olmsted J.: Counterexamples in Analysis, Holden-day, San Francisco, London, Amsterdam, (1964).

[KitMans] Kitaev S., Mansour T.: Counting the occurrences of generalized patterns in words generated by a morphism, preprint CO/0210170.

[Knuth] Knuth D. E.: The Art of Computer Programming, 2nd ed. Addison Wesley, Reading, MA, (1973).

[Lothaire] Lothaire M.: Combinatorics on Words, Encyclopedia of Mathematics, Vol. 17, Addison-Wesley (1986). Reprinted in the Cambridge Mathematical Library, Cambridge University Press, Cambridge UK (1997).

[Salomaa] Salomaa A.: Jewels of Formal Language Theory, Computer Science Press (1981).

[SimSch] Simion R., Schmidt F.: Restricted permutations, European J. Combin. 6, no. 4 (1985), 383–406.

Paper IX

The sigma-sequence and counting occurrences of some patterns, subsequences and subwords

The sigma-sequence and counting occurrences of some patterns, subsequences and subwords

Sergey Kitaev ^{1}

Abstract

We consider sigma-words, which are words used by Evdokimov in the construction of the sigma-sequence [Evdok]. We then find the number of occurrences of certain patterns, subsequences and subwords in these words.

9.1 Introduction and Background

We write permutations as words π = a_{1}a_{2} ⋯ a_{n}, whose letters are distinct and usually consist of the integers 1, 2, …, n.

An occurrence of a pattern p in a permutation π is “classically” defined as a subsequence in π (of the same length as the length of p) whose letters are in the same relative order as those in p. Formally speaking, for r ≤ n, we say that a permutation σ in the symmetric group S_{n} has an occurrence of the pattern p ∈ S_{r} if there exist 1 ≤ i_{1} < i_{2} < ⋯ < i_{r} ≤ n such that p = σ(i_{1})σ(i_{2}) … σ(i_{r}) in reduced form. The reduced form of a permutation σ on a set {j_{1}, j_{2}, …, j_{r}}, where j_{1} < j_{2} < ⋯ < j_{r}, is a permutation σ_{1} obtained by renaming the letters of the permutation σ so that j_{i} is renamed i for all i ∈ {1, …, r}. For example, the reduced form of the permutation 3651 is 2431. The first case of classical patterns studied was that of permutations avoiding a pattern of length 3 in S_{3}. Knuth [Knuth] found that, for any τ ∈ S_{3}, the number |S_{n}(τ)| of n-permutations avoiding τ is C_{n}, the nth Catalan number. Later, Simion and Schmidt [SimSch] determined the number |S_{n}(P)| of permutations in S_{n} simultaneously avoiding any given set of patterns P ⊆ S_{3}.

In [BabStein] Babson and Steingrímsson introduced generalised permutation patterns that allow the requirement that two adjacent letters in a pattern must be adjacent in the permutation. In order to avoid confusion we write a ”classical” pattern, say 231, as 2-3-1, and if we write, say 2-31, then we mean that if this pattern occurs in the permutation, then the letters in the permutation that correspond to 3 and 1 are adjacent. For example, the permutation π = 516423 has only one occurrence of the pattern 2-31, namely the subword 564, whereas the pattern 2-3-1 occurs, in addition, in the subwords 562 and 563. A motivation for introducing these patterns in [BabStein] was the study of Mahonian statistics. A number of interesting results on generalised patterns were obtained in [Claes]. Relations to several well studied combinatorial structures, such as set partitions, Dyck paths, Motzkin paths and involutions, were shown there.

1Matematiska Institutionen, Chalmers tekniska högskola and Göteborgs universitet, S-412 96 Göteborg, Sweden; E-mail: kitaev@math.chalmers.se

Burstein [Burstein] considered words instead of permutations. In particular, he found the number |[k]^{n}(P)| of words of length n in a k-letter alphabet that avoid all patterns from a set P ⊆ S_{3} simultaneously. Burstein and Mansour [BurMans1] (resp. [BurMans2, BurMans3]) considered forbidden patterns (resp. generalized patterns) with repeated letters.

The most attention, in the papers on classical or generalized patterns, is paid to finding exact formulas and/or generating functions for the number of words or permutations avoiding, or having k occurrences of, certain patterns. In [KitMans1] the authors suggested another problem, namely counting the number of occurrences of certain patterns in certain words. These words were chosen to be the set of all finite approximations of a sequence generated by a morphism with certain restrictions. A motivation for this choice was the interest in studying classes of sequences and words that are defined by iterative schemes [Lothaire, Salomaa]. In [KitMans2] the authors also studied the number of occurrences of certain patterns in certain words. But there they choose these words to be the subdivision stages from which the Peano curve is obtained. The authors called these words the Peano words. The Peano curve was studied by the Italian mathematician Giuseppe Peano in 1890 as an example of a continuous space filling curve.

In the present paper we consider the sigma-words, which are words used by Evdokimov in construction of the sigma-sequence [Evdok]. Evdokimov used this sequence to construct chains of maximal length in the n-dimensional unit cube. Independent interest to the sigma-sequence appears in connection with the well-known Dragon curve, discovered by physicist John E. Heighway and defined as follows: we fold a sheet of paper in half, then fold in half again, and again, etc. and then unfold in such way that each crease created by the folding process is opened out into a 90-degree angle. The “curve” refers to the shape of the partially unfolded paper as seen edge on. If one travels along the curve, some of the creases will represent turns to the left and others turns to the right. Now if 1 indicates a turn to the right, and 2 to the left, and we start travelling along the curve indicating the turns, we get the sigma-sequence [Evdokimov]. In [Kitaev] the sigma-sequence was studied from another point of view. It was proved there that this sequence cannot be defined by iterated morphism.

Since the sigma-sequence w_{σ} is a sequence in a 2-letter alphabet, we consider patterns in 2-letter alphabets. Moreover, the patterns in a 1-letter alphabet (for example 1-1-1) correspond to two subsequences (for this example, these subsequences are 1-1-1 and 2-2-2), whereas the patterns in a 2-letter alphabet (with at least one letter 2) uniquely determine the subsequences in w_{σ} that correspond to them, and conversely. For example, an occurrence of the pattern 1-2-1 is an occurrence of the subsequence 1-2-1, whereas an occurrence of the subsequence (subword) 211 is an occurrence of the pattern 211. Thus, any our result for a pattern, can be interpreted in term of subsequences or subwords, depending on the context, and conversely.

In our paper we give either an explicit formula or recurrence relation for the number of occurrences for some classes of patterns, subwords and subsequences in the sigma-words. In particular, Theorem 1, allows to find the number of occurrences of an arbitrary generalized pattern without internal dashes of length ℓ, provided we know four certain numbers that can be easily calculated for the sigma-words C_{k}, D_{k}, C_{k+1} and D_{k+1} (to be defined below), where k = ⌈log_{2} ℓ⌉. Theorem 2 gives a recurrence relation for counting occurrences of patterns of the form τ_{1}-τ_{2}. In Section 9.6 we discuss occurrences of patterns of the form τ_{1}-τ_{2}- ⋯ -τ_{k}, where the pattern τ_{i} does not overlap with the patterns τ_{i−1} and τ_{i+1} for i = 1, 2, …, k − 1. Finally, Section 9.7 deals with patterns of the form [τ_{1}-τ_{2}- ⋯ -τ_{k}], [τ_{1}-τ_{2}- ⋯ -τ_{k}) and (τ_{1}-τ_{2}- ⋯ -τ_{k}] in Babson and Steingrímsson notation, which means that we use ”[x” in a pattern p to indicate that in an occurrence of p, the letter corresponding to the x must be the first letter of a word under consideration, whereas if we use “y]”, we mean that the letter corresponding to y must be the last (rightmost) letter in the word.

9.2 Preliminaries

In [Evdok, Yab], Evdokimov constructed chains of maximal length in the ndimensional unit cube using the sigma-sequence. The sigma-sequence w_{σ} was defined there by the following inductive scheme:

C_{1} = 1, D_{1} = 2

C_{k+1} = C_{k}1D_{k}, D_{k+1} = C_{k}2D_{k}
k = 1, 2, …

and w_{σ} = lim_{k→∞} C_{k}. Thus, the initial letters of w_{σ} are 11211221112212 . . .. We call the words C_{k} the sigma words. The first four values of the sequence {C_{k}}_{k≥1} are 1, 112, 1121122, 112112211122122.

In [Kitaev] an equivalent definition of w_{σ} was given: any natural number n ≠ 0 can be presented unambiguously as n = 2^{t}(4s + σ), where σ < 4, and t is the greatest natural number such that 2^{t} divides n. If n runs through the natural numbers then σ runs through some sequence consisting of 1 and 3. If we substitute 3 by 2 in this sequence, we get w_{σ}.

In this paper we count occurrences of patterns in the sigma-words, which are particular initial subwords of w_{σ}. However, the challenging question is to find the number of occurrences of patterns or subwords in an arbitrary initial subword of w_{σ}, or more generally, in a subword of w_{σ} starting in the position i and ending in the position j.

It turns out that for counting occurrences of certain patterns or subwords in C_{n}, one needs to know the number of occurrences of certain patterns in D_{n}. So, in the most cases, we give results for both C_{n} and D_{n}. However, our main purpose is the words C_{n} for n ≥ 1, and in some propositions and examples we do not consider D_{n}.

In what follows, we give initial values for the words C_{i} and D_{i}:

\begin{matrix}C_{1} = 1 & D_{1} = 2 \\ C_{2} = 112 & D_{2} = 122 \\ C_{3} = 1121122 & D_{3} = 1122122 \\ C_{4} = 112112211122122 & D_{4} = 112112221122122 \end{matrix}

\begin{matrix}C_{5} = 1121122111221221112112221122122 \\ D_{5} = 1121122111221222112112221122122 \end{matrix}

We now give some other definitions.

A descent (resp. rise) in a word w = a_{1}a_{2} … a_{n} is an i such that a_{i} > a_{i+1} (resp. a_{i} < a_{i+1}). It follows from the definitions that an occurrence of a descent (resp. rise) is an occurrence of the pattern 21 (resp. 12).

Let c_{n}^{τ} (resp. d_{n}^{τ}) denote the number of occurrences of the pattern τ in C_{n} (resp. D_{n}).

Suppose a word W = AaB, where A and B are some words of the same length, and a is a letter. We define the kernel of order k for the word W to be the subword consisting of the k − 1 rightmost letters of A, the letter a, and the k − 1 leftmost letters of B. We denote it by K_{k}(W). For example, K_{3}(111211221) = 12112. If |A| < k − 1 then we assume K_{k}(W) = ϵ, that is, the kernel in this case is the empty word. Also, m_{k}(τ, W) denotes the number of occurrences of the pattern (or the word, or the subsequence depending on the context) τ in K_{k}(W).

We denote x-x- ⋯ -x (ℓ times) by x^{ℓ}. Also, ⌈a⌉ denotes the least natural number b such that a ≤ b.

9.3 Patterns 1-1- ⋯ -1, 1-2 and 2-1

It is easy to see that |C_{n}| = |D_{n}| = 2^{n} − 1. The following lemma gives the number of the letters 1 and 2 in C_{n} and D_{n}.

Lemma 1. The number of 1s (resp. 2s) in C_{n} is 2^{n−1} (resp. 2^{n−1} − 1). The number of 1s (resp. 2s) in D_{n} is 2^{n−1} − 1 (resp. 2^{n−1}).

Proof. It is enough to find the number of 1s c_{n} and d_{n} in C_{n} and D_{n} respectively, since the number of 2s in C_{n} and D_{n} are obviously equal to |C_{n}|−c_{n} and |D_{n}|−d_{n} respectively.

It is easy to see from the structure of C_{n} and D_{n} that

\{ \begin{matrix}c_{n} = c_{n−1} + d_{n−1} + 1, \\ d_{n} = c_{n−1} + d_{n−1}, \end{matrix}

together with c_{1} = 1 and d_{1} = 0. The solution to this recurrence is c_{n} = 2^{n−1} and d_{n} = 2^{n−1} − 1.

Proposition 1. The number occurrences of the subsequence 1^{k} (resp. 2^{k}) in C_{n} is \binom{2^{n−1}}{k} (resp. \binom{2^{n−1}−1}{k}). Thus, the number of occurrences of the pattern 1^{k} in C_{n} is equal to

c_{n}^{1^{k}} = \binom{2^{n−1}}{k} + \binom{2^{n−1} − 1}{k} = \frac{2^{n} − k}{2^{n−1} − k} \binom{2^{n−1} − 1}{k}.

Proof. From Lemma 1, there are 2^{n−1} (resp. 2^{n−1} − 1) occurrences of the letter 1 (resp. 2) in C_{n}, and thus there are \binom{2^{n−1}}{k} (resp. \binom{2^{n−1}−1}{k}) occurrences of the subsequence 1^{k} (resp. 2^{k}) there.

Proposition 2. We have that for all n ≥ 2, c_{n}^{1-2} = d_{n}^{1-2} = 2·4^{n−2}+(n−2)·2^{n−2}, and c_{n}^{2-1} = d_{n}^{2-1} = 2 · 4^{n−2} − n · 2^{n−2}.

Proof. Let us first consider the pattern 1-2. An occurrence of this pattern in C_{n} = C_{n−1}1D_{n−1} is either inside C_{n−1}, or inside D_{n−1}, or the letter 1 is from the word C_{n−1}1, whereas the letter 2 is from the word D_{n−1}. Thus

c_{n}^{1-2} = c_{n−1}^{1-2}+d_{n−1}^{1-2}+{ (the number of 1s in C_{n−1}) + 1}·{ the number of 2s in D_{n−1}}.

Using the same considerations for D_{n} = C_{n−1}2D_{n−1}, one can get

d_{n}^{1-2} = c_{n−1}^{1-2}+d_{n−1}^{1-2}+{ the number of 1s in C_{n−1}}·{ (the number of 2s in D_{n−1}) + 1}.

The number of 1s and 2s in C_{n−1} and D_{n−1} is given in Lemma 1. So,

\{ \begin{matrix}c_{n}^{1-2} = c_{n−1}^{1-2} + d_{n−1}^{1-2} + 2^{n−2} · (2^{n−2} + 1) \\ d_{n}^{1-2} = c_{n−1}^{1-2} + d_{n−1}^{1-2} + 2^{n−2} · (2^{n−2} + 1) \end{matrix} ⇔

( \begin{matrix}c_{n}^{1-2} \\ d_{n}^{1-2} \end{matrix} ) = ( \begin{matrix}1 & 1 \\ 1 & 1 \end{matrix} ) ( \begin{matrix}c_{n−1}^{1-2} \\ d_{n−1}^{1-2} \end{matrix} ) + ( \begin{matrix}2^{n−2} · (2^{n−2} + 1) \\ 2^{n−2} · (2^{n−2} + 1) \end{matrix} )  (9.1)

together with c_{2}^{1-2} = 2 and d_{2}^{1-2} = 2. Here, and several times in what follows, we need to solve recurrence relations of the form

x_{n} = Ax_{n−1} + b,

where A is a matrix, and x_{n}, x_{n−1} and b are some vectors, where b sometimes depends on n. We recall from linear algebra that such relations can be solved by diagonalization of the matrix A, that is, by writing A = V DV^{−1}, where D is a diagonal matrix consisting of eigenvalues of A, and the columns of V are eigenvectors of A. For example, if A is a 2 × 2 matrix that consists of 1s, then we use

( \begin{matrix}1 & 1 \\ 1 & 1 \end{matrix} ) = ( \begin{matrix}1 & 1 \\ −1 & 1 \end{matrix} ) ( \begin{matrix}0 & 0 \\ 0 & 2 \end{matrix} ) ( \begin{matrix}1/2 & −1/2 \\ 1/2 & 1/2 \end{matrix} )

for computing powers of A, and thus for solving the recurrence relations. For the recurrence 9.1, we get that for all n ≥ 2, c_{n}^{1-2} = d_{n}^{1-2} = 2·4^{n−2}+(n−2)·2^{n−2}.

In the same manner, we can get that for the pattern 2-1,

\{ \begin{matrix}c_{n}^{2-1} = c_{n−1}^{2-1} + d_{n−1}^{2-1} + 2^{n−2} · (2^{n−2} − 1), \\ d_{n}^{2-1} = c_{n−1}^{2-1} + d_{n−1}^{2-1} + 2^{n−2} · (2^{n−2} − 1), \end{matrix}

together with c_{3}^{2-1} = 2 and d_{3}^{2-1} = 2. This gives, that for all n ≥ 2, c_{n}^{2-1} = d_{n}^{2-1} = 2 · 4^{n−2} − n · 2^{n−2}.

Proposition 2 shows that asymptotically, the numbers of occurrences of the patterns, or the subsequences, 1-2 and 2-1 in C_{n} or D_{n} are equal.

9.4 Patterns without internal dashes

Recall the definitions in Section 9.2.

Theorem 1. Let τ = τ_{1}τ_{2} … τ_{ℓ} be an arbitrary generalized pattern without internal dashes that consists of 1s and 2s. Suppose k = ⌈log_{2} ℓ⌉, a = m_{ℓ}(τ, D_{k}1C_{k}), and b = m_{ℓ}(τ, D_{k}2C_{k}). Then for n > k + 1, we have

c_{n}^{τ} = (a + b + c_{k+1}^{τ} + d_{k+1}^{τ}) · 2^{n−k−2} − b,
d_{n}^{τ} = (a + b + c_{k+1}^{τ} + d_{k+1}^{τ}) · 2^{n−k−2} − a.

Proof. Suppose n > k + 1. In this case, C_{n} = C_{n−1}1D_{n−1} = W_{1}K_{ℓ}(D_{k}1C_{k})W_{2}, for some words W_{1} and W_{2} such that |W_{1}| = |W_{2}|. Because of the definition of the kernel K_{ℓ}(D_{k}1C_{k}), an occurrence of the pattern τ in C_{n} is in either C_{n−1}, or D_{n−1}, or K_{k}(D_{k}1C_{k}) (from the definitions |C_{n−1} ∩ K_{k}(D_{k}1C_{k})| = |D_{n−1}∩K_{k}(D_{k}1C_{k})| = ℓ−1 and thus these intersections cannot be an occurrence of τ). So,

c_{n}^{τ} = c_{n−1}^{τ} + d_{n−1}^{τ} + a,

whereas in the same way, we can obtain that

d_{n}^{τ} = c_{n−1}^{τ} + d_{n−1}^{τ} + b.

By solving these recurrence relations, we get the desirable.

In particular, Theorem 1 is valid for ℓ = 1, in which case the number of occurrences of τ in C_{n} (or D_{n}) is the number of letters in C_{n} (or D_{n}). Indeed, in this case, k = 0, a = b = c_{1}^{1} = d_{1}^{1} = 1, hence c_{n}^{1} = d_{n}^{1} = 2^{n} − 1 = |C_{n}| = |D_{n}|. Also, as a corollary to Theorem 1 we have, that if a = b = c_{k+1}^{τ} = d_{k+1}^{τ} = 0 for some pattern τ, then this pattern never appears in sigma-sequence.

All of the following examples are corollaries to Theorem 1.

Example 1. Suppose τ = 12. We have that k = 1, a = m_{2}(12, D_{1}1C_{1}) = 0 and b = m_{2}(12, D_{1}2C_{1}) = 0. Besides, c_{2}^{12} = 1 and d_{2}^{12} = 1. Thus using Theorem 1, for all n > 2, c_{n}^{12} = 2^{n−2}. So, the number of rises in C_{n} is equal to 2^{n−2}, for n ≥ 2.

If τ = 21, again k = 1, but now a = m_{2}(21, D_{1}1C_{1}) = 1, b = m_{2}(21, D_{1}2C_{1} ) = 1. Besides, c_{3}^{21} = 1 and d_{3}^{21} = 1. From Theorem 1, for all n > 3, c_{n}^{21} = 2^{n−2} − 1, which shows that the number of descents in C_{n} is one less than the number of rises.

Since in both cases a = b, using the recurrences in Theorem 1, we have that c_{n}^{12} = d_{n}^{12} = 2^{n−2}, whereas c_{n}^{21} = d_{n}^{21} = 2^{n−2} − 1.

Example 2. Suppose τ = 112. We have that k = 2, a = m_{3}(112, D_{2}1C_{2}) = 0, and b = m_{3}(112, D_{2}2C_{2}) = 0. Besides, c_{3}^{112} = 2 and d_{3}^{112} = 1. Now, from Theorem 1, we have that for all n > 3, c_{n}^{112} = d_{n}^{112} = 3 · 2^{n−4}.

Example 3. Suppose τ = 221. We have that k = 2, a = m_{3}(221, D_{2}1C_{2}) = 1, and b = m_{3}(221, D_{2}2C_{2}) = 1. Besides, c_{3}^{221} = 0 and d_{3}^{221} = 1. Now, from Theorem 1, we have that for all n > 3, c_{n}^{221} = d_{n}^{221} = 3 · 2^{n−4} − 1.

Example 4. If τ = 2212221 then k = 3, a = m_{7}(221, D_{3}1C_{3}) = 0, b = m_{7}(221, D_{3}2C_{3}) = 1, c_{4}^{2212221} = 0, and d_{4}^{2212221} = 0. Thus for n ≥ 4, c_{n}^{2212221} = 2^{n−4} − 1.

9.5 Patterns of the form τ_{1}-τ_{2}

Theorem 2. Let p = τ_{1}-τ_{2} be a generalized pattern such that |τ_{1}| = k_{1} and |τ_{2}| = k_{2}. Suppose k = ⌈log_{2}(k_{1} + k_{2} − 1)⌉. The following denote the number of occurrences of the subwords τ_{1} and τ_{2} in the kernels:

\begin{matrix}a_{τ_{1}} = m_{k_{1}}(τ_{1}, D_{k}1C_{k}) & a_{τ_{2}} = m_{k_{2}}(τ_{2}, D_{k}1C_{k}) \\ b_{τ_{1}} = m_{k_{1}}(τ_{1}, D_{k}2C_{k}) & b_{τ_{2}} = m_{k_{2}}(τ_{2}, D_{k}2C_{k}) \end{matrix}

Also, let r_{1}^{a} (resp. r_{2}^{a}, r_{1}^{b}, r_{2}^{b}) denote the number of occurrences of overlapping subwords τ_{1} and τ_{2} in the word D_{k}1C_{k} (resp. D_{k}1C_{k}, D_{k}2C_{k}, D_{k}2C_{k}), where τ_{1} ∈ K_{k_{1}}(D_{k}1C_{k}) and τ_{2} ∈ C_{k} (resp. τ_{1} ∈ D_{k} and τ_{2} ∈ K_{k_{2}}(D_{k}1C_{k}), τ_{1} ∈ K_{k_{1}}(D_{k}2C_{k}) and τ_{2} ∈ C_{k}, τ_{1} ∈ D_{k} and τ_{2} ∈ K_{k_{2}}(D_{k}2C_{k})).

Besides, we assume that we know c_{n}^{τ_{i}} and d_{n}^{τ_{i}} for n > n_{i}, i = 1, 2. Then for n > max(k + 1, n_{1} + 1, n_{2} + 1), c_{n}^{τ} and d_{n}^{τ} are given by the following recurrence:

( \begin{matrix}c_{n}^{τ} \\ d_{n}^{τ} \end{matrix} ) = ( \begin{matrix}1 & 1 \\ 1 & 1 \end{matrix} ) ( \begin{matrix}c_{n−1}^{τ} \\ d_{n−1}^{τ} \end{matrix} ) + ( \begin{matrix}α_{n} \\ β_{n} \end{matrix} ) ,

where

α_{n} = (c_{n−1}^{τ_{1}} + a_{τ_{1}} − r_{1}^{a})d_{n−1}^{τ_{2}} + (a_{τ_{2}} − r_{2}^{a})c_{n−1}^{τ_{1}}

and

β_{n} = (c_{n−1}^{τ_{1}} + b_{τ_{1}} − r_{1}^{b})d_{n−1}^{τ_{2}} + (b_{τ_{2}} − r_{2}^{b})c_{n−1}^{τ_{1}}.

Proof. Suppose n > max(k + 1, n_{1} + 1, n_{2} + 1). Let us find a recurrence for the number c_{n}^{τ} (one can use the same considerations for d_{n}^{τ}).

An occurrence of the pattern τ in C_{n} = C_{n−1}1D_{n−1} is either inside C_{n−1}, or inside D_{n−1}, or begins in C_{n−1} or the letter 1 between C_{n−1} and D_{n−1} and ends in D_{n−1} or the letter 1. The first two cases obviously give c_{n−1} and d_{n−1} occurrences of τ. To count the contribution of the last to cases, we work with words instead of patterns. We do it to take in account the situations when τ_{1} or τ_{2} consists of copies of only one letter. In this case, we cannot count occurrence of these patterns separately, and then use this information, since, for instance, occurrences of the pattern τ_{1} = 111 are subwords 111 and 222 (the last one of these subwords we do not need), whereas occurrences of the pattern τ_{1} = 222 are not defined at all (222 is not a pattern).

If an occurrence of τ_{1}-τ_{2} does not entirely belong to C_{n−1} or D_{n−1} then we only have one of the following possibilities:

(a) the subword τ_{1} entirely belongs to C_{n−1} and the subword τ_{2} entirely belongs to D_{n−1};

(b) the subword τ_{1} belongs entirely to C_{n−1} and the subword τ_{2} belongs to the kernel K_{k_{2}}(D_{k}1C_{k}), where k = ⌈log_{2}(k_{1} + k_{2} − 1)⌉ is the least number that allow to control, in C_{n} (n > k), overlapping occurrences of subwords τ_{1} and τ_{2} where τ_{1} is entirely from C_{n−1} and τ_{2} ∈ K_{k_{2}}(D_{k}1C_{k});

(c) the subword τ_{2} belongs entirely to D_{n−1} and the subword τ_{1} belongs to the kernel K_{k_{1}}(D_{k}1C_{k}).

In (a) we obviously have c_{n−1}^{τ_{1}} · d_{n−1}^{τ_{2}} possibilities.

In (b) we have c_{n−1}^{τ_{1}} · a_{τ_{2}} − c_{n−1}^{τ_{1}} · r_{2}^{a} possibilities, since we need to subtract those occurrences of τ_{1} and τ_{2} that overlap.

Analogically to (b), in (c) we have d_{n−1}^{τ_{2}} · a_{τ_{1}} − d_{n−1}^{τ_{2}} · r_{1}^{a} possibilities, which completes the proof.

Remark 6. For using Theorem 2, one needs to know c_{n}^{τ} and d_{n}^{τ} for patterns τ without internal dashes. These numbers could be obtained by using Theorem 1.

The following corollary to Theorem 2 is straitforward to prove, using the fact that for non-overlapping patterns τ_{1} and τ_{2}, r_{1}^{a} = r_{2}^{a} = r_{1}^{b} = r_{2}^{b} = 0.

Corollary 12. We make the same assumptions as those in Theorem 2. Suppose additionally that the words τ_{1} and τ_{2} are not overlapping in the following sense: no one suffix of τ_{1} is a prefix of τ_{2}. Then for n > max(k + 1, n_{1} + 1, n_{2} + 1), c_{n}^{τ} and d_{n}^{τ} are given by the same recurrence as that in Theorem 2 with

α_{n} = (c_{n−1}^{τ_{1}} + a_{τ_{1}})d_{n−1}^{τ_{2}} + a_{τ_{2}}c_{n−1}^{τ_{1}}

and

β_{n} = (c_{n−1}^{τ_{1}} + b_{τ_{1}})d_{n−1}^{τ_{2}} + b_{τ_{2}}c_{n−1}^{τ_{1}}.

Remark 7. Corollary 12 is valid under more weak assumptions, namely we only need the property of non-overlapping of the patterns τ_{1} and τ_{2} when one of them is in its kernel and the other one is not in its kernel. Example 7 deals with the pattern τ that has overlapping blocks τ_{1} and τ_{2}, but Corollary 12 can be applied. However, from practical point of view, checking the fact if two subwords are non-overlapping is more easy than considering the kernels and checking the non-overlapping of the subwords there.

Example 5. Suppose τ = 12-21. We have that |τ_{1}| = |τ_{2}| = 2. Now, in the statement of Theorem 2 we have that k = 2, a_{τ_{1}} = 0, a_{τ_{2}} = 1, b_{τ_{1}} = 0 and b_{τ_{2}} = 1. Also, since there are no overlapping occurrences of the subwords 12 and 21 in K_{3}(1221112) and K_{3}(1222112), we have r_{1}^{a} = 0, r_{2}^{a} = 0, r_{1}^{b} = 0 and r_{2}^{b} = 0. Besides, from example 1, c_{n}^{12} = d_{n}^{12} = 2^{n−2} and c_{n}^{21} = d_{n}^{21} = 2^{n−2} − 1. Thus, α_{n} = β_{n} = 4^{n−3}. Using the fact that c_{3}^{12-21} = 0 and d_{3}^{12-21} = 1, this allows us to get an explicit formula for c_{n}^{12-21} and d_{n}^{12-21} for n > 3:

c_{n}^{12-21} = d_{n}^{12-21} = \frac{1}{2}4^{n−2} − 3 · 2^{n−4}.

In particular c_{4}^{12-21} = 5.

Example 6. Suppose τ = 1-221. We have that |τ_{1}| = 1 and |τ_{2}| = 3. Moreover, the words τ_{1} and τ_{2} are not overlapping, hence we can use Corollary 12. We have that k = 2, a_{τ_{1}} = 1, a_{τ_{2}} = 1, b_{τ_{1}} = 0 and b_{τ_{2}} = 1. From example 3, d_{n}^{221} = 3 · 2^{n−4} − 1. Also, the number of occurrences of the letter 1 (the subword τ_{1} = 1) is given by Lemma 1: c_{n}^{1} = 2^{n−1}. So, α_{n} = 6 · 4^{n−4} + 3 · 2^{n−5} − 1 and β_{n} = 6 · 4^{n−4}. One can get now an explicit formula for c_{n}^{1-221} and d_{n}^{1-221} for n > 4:

\begin{matrix}c_{n}^{1-221} = \frac{1}{2}4^{n−2} + 27 · 2^{n−5} − n − 7, \\ d_{n}^{1-221} = \frac{1}{2}4^{n−2} + 21 · 2^{n−5} − 8. \end{matrix}

In particular, c_{5}^{1-221} = 47.

Example 7. Suppose τ = 112-21. We have that |τ_{1}| = k_{1} = 3 and |τ_{2}| = k_{2} = 2. The other parameters in Theorem 2 are k = 3, a_{τ_{1}} = 0, a_{τ_{2}} = 1, b_{τ_{1}} = 0, b_{τ_{2}} = 1, r_{1}^{a} = r_{2}^{a} = r_{1}^{b} = r_{2}^{b} = 0. From Example 2, for n ≥ 4, c_{n}^{112} = 3 · 2^{n−4}, and from Example 1, d_{n}^{21} = 2^{n−2} − 1. Thus, in Theorem 2, α_{n} = β_{n} = c_{n−1}^{112}(d_{n−1}^{21} + 1) = 3 · 4^{n−4}. Now, we solve the recurrence relation from the theorem to get, that for n > 3

c_{n}^{112-21} = d_{n}^{112-21} = \frac{3}{2} · 4^{n−3} − 2^{n−4}.

9.6 Counting occurrences of τ_{1}-τ_{2}- ⋯ -τ_{k}

In this section we study the number of occurrences of a pattern τ = τ_{1}-τ_{2}- ⋯ -τ_{k}, where τ_{i} are patterns without internal dashes. We say that τ consists of k blocks. We assume that for i = 1, 2, …, k − 1, the pattern τ_{i} does not overlap with the patterns τ_{i−1} and τ_{i+1}. In this case we give a recurrence relation for the number of occurrences of τ, provided we know the number of occurrences of certain patterns consisting of less than, or equal to, k − 1 blocks, as well as 2k certain numbers which can be calculated by considering the words D_{ℓ}1C_{ℓ} and C_{ℓ}2D_{ℓ}, where ℓ is the maximum number such that ℓ ≤ max_{i}⌈log_{2} |τ_{i}|⌉. The cases of k = 1 and k = 2 are studied in the previous sections; they give the bases for our calculations. However, the case of overlapping patterns τ_{i} is not solved, and it remains as a challenging problem, since an answer to this problem gives the way to count occurrences of an arbitrary generalized pattern, or an arbitrary subsequence, in σ-words.

Theorem 3. Let τ = τ_{1}-τ_{2}- ⋯ -τ_{k} be a generalized pattern such that |τ_{i}| = k_{i} for i = 1, 2, …, k. We assume that for i = 1, 2, …, k − 1, the subword τ_{i} does not overlap with the subwords τ_{i−1} and τ_{i+1} in the following sense: no one suffix of τ_{i−1} is a prefix of τ_{i} and no one suffix of τ_{i} is a prefix of τ_{i+1}.

Suppose ℓ_{i} = ⌈log_{2} k_{i}⌉, ℓ = max_{i} ℓ_{i}, and for the subwords τ_{i} we have a_{i} = m_{k_{i}}(τ_{i}, D_{ℓ_{i}}1C_{ℓ_{i}}) and b_{i} = m_{k_{i}}(τ_{i}, D_{ℓ_{i}}2C_{ℓ_{i}}), for i = 1, 2, …, k.

We assume that we know c_{n−1}^{τ_{1}-···-τ_{i}} and d_{n−1}^{τ_{i+1}-···-τ_{k}} for each 1 ≤ i ≤ k − 1 and for all n > n^{⋆}. Then for all n > max(ℓ + 1, n^{⋆} + 1), c_{n}^{τ} and d_{n}^{τ} are given by the following recurrence:

\begin{matrix}( \begin{matrix}c_{n}^{τ} \\ d_{n}^{τ} \end{matrix} ) = ( \begin{matrix}1 & 1 \\ 1 & 1 \end{matrix} ) ( \begin{matrix}c_{n−1}^{τ} \\ d_{n−1}^{τ} \end{matrix} ) + \\ ∑_{i=1}^{k−1} ( \begin{matrix}c_{n−1}^{τ_{1}-···-τ_{i}} · d_{n−1}^{τ_{i+1}-···-τ_{k}} \\ c_{n−1}^{τ_{1}-···-τ_{i}} · d_{n−1}^{τ_{i+1}-···-τ_{k}} \end{matrix} ) + ∑_{i=1}^{k} ( \begin{matrix}a_{i} · c_{n−1}^{τ_{1}-···-τ_{i−1}} · d_{n−1}^{τ_{i+1}-···-τ_{k}} \\ b_{i} · c_{n−1}^{τ_{1}-···-τ_{i−1}} · d_{n−1}^{τ_{i+1}-···-τ_{k}} \end{matrix} ) . \end{matrix}

Proof. We consider only c_{n}^{τ}, since the same arguments can be applied to d_{n}^{τ}. We use the considerations similar to those in Theorem 2.

An occurrence of the pattern τ in C_{n} = C_{n−1}1D_{n−1} can be entirely in C_{n} or D_{n}. The first term counts such occurrences. Otherwise, we have two possibilities: either the letter 1 between the words C_{n−1} and D_{n−1} does not belong to an occurrence of τ, or it does do it, in which case there exist i (exactly one) such that the subword τ_{i} occurs in its kernel. The first sum in the statement is obviously responsible for the first of this cases, whereas the second sum is responsible for the second case (in the last case we use the fact that subwords τ_{i} are not overlapping).

As a corollary to Theorem 3, we have Corollary 12.

The following example is another corollary to Theorem 3.

Example 8. Suppose τ = 2 − 1 − 221, that is, τ_{1} = 2, τ_{2} = 1 and τ_{3} = 221. So, parameters in Theorem 3 are the following: k_{1} = k_{2} = 1, k_{3} = 3, ℓ_{1} = ℓ_{2} = 1, ℓ_{3} = 2, ℓ = 2. From D_{1}1C_{1} = 211 we obtain a_{1} = 0, a_{2} = 1. From D_{2}1C_{2} = 1221112 we obtain a_{3} = 1. From D_{1}2C_{1} = 221 we get b_{1} = 1, b_{2} = 0. From D_{2}2C_{2} = 1222112 we get b_{3} = 1. Besides, from Proposition 2, Examples 3 and 6, we have

c_{n}^{τ_{1}-τ_{2}} = c_{n}^{2−1} = 2 · 4^{n−2} − n · 2^{n−2}, for n > 1;
d_{n}^{τ_{3}} = d_{n}^{221} = 3 · 2^{n−4} − 1, for n > 3;
d_{n}^{τ_{2}-τ_{3}} = d_{n}^{1-221} = \frac{1}{2} · 4^{n−2} + 21 · 2^{n−5} − 8, for n > 4.

Also, the number of occurrences of the subword τ_{1} = 2 in C_{n} is given by Proposition 1: c_{n}^{τ_{1}} = c_{n}^{2} = 2^{n−1} − 1. So, the number of occurrences of the pattern τ in C_{n} and D_{n}, for n > 5, satisfies the following recurrence relation:

( \begin{matrix}c_{n}^{τ} \\ d_{n}^{τ} \end{matrix} ) = ( \begin{matrix}1 & 1 \\ 1 & 1 \end{matrix} ) ( \begin{matrix}c_{n−1}^{τ} \\ d_{n−1}^{τ} \end{matrix} ) + ( \begin{matrix}\frac{5}{1024}8^{n} + \frac{25−3n}{256}4^{n} − \frac{171}{64}2^{n} + 9 \\ \frac{5}{1024}8^{n} + \frac{21−3n}{256}4^{n} − 2^{n+1} \end{matrix} ) ,

with initial conditions c_{5}^{τ} = 70 and d_{5}^{τ} = 74.

9.7 Patterns of the form [τ_{1}-τ_{2}- ⋯ -τ_{k}], [τ_{1}-τ_{2}- ⋯ -τ_{k}) and (τ_{1}-τ_{2}- ⋯ -τ_{k}]

We recall that according to Babson and Steingrímsson notation for generalized patterns, if we use ”[” in a pattern, for example if we write p = [1-2), we indicate that in an occurrence of p, the letter corresponding to the 1 must be the first letter of a word under consideration, whereas if we write, say, p = (1-2], then the letter corresponding to 2 must be the last (rightmost) letter of the word.

In the theorems of this section, we assume that we can find the numbers c_{n}^{τ_{1}-τ_{2}-···-τ_{k}} and d_{n}^{τ_{1}-τ_{2}-···-τ_{k}} for any patterns τ_{i}, i = 1, 2, …, k, without internal dashes. For certain special cases, these numbers can be obtained using the theorems of Sections 9.5 and 9.6.

Theorem 4. Suppose τ_{1} and τ_{2} are two patterns without internal dashes such that |τ_{1}| = k_{1} and |τ_{2}| = k_{2}. Also, suppose ℓ_{1} = log_{2}(k_{1} + 1), ℓ_{2} = log_{2}(k_{2} + 1) and ℓ = log_{2}(k_{1} + k_{2} + 1).

Let a(τ_{1}, τ_{2}) be the number of overlapping subwords τ_{1} and τ_{2} in C_{ℓ} such that τ_{1} consists of the k_{1} leftmost letters of C_{ℓ}; b(τ_{1}, τ_{2}) is the number of overlapping subwords τ_{1} and τ_{2} in C_{ℓ} such that τ_{2} consists of the k_{2} rightmost letters of C_{ℓ}.

We assume that we know c_{n}^{τ_{i}} and d_{n}^{τ_{i}} for i = 1, 2 and for all n > n^{⋆}.

i. For n ≥ max(ℓ_{1}, n^{⋆}),

c_{n}^{[τ_{1}-τ_{2})} = \{ \begin{matrix}c_{n}^{τ_{2}} − a(τ_{1}, τ_{2}), & if C_{ℓ_{1}} begins with τ_{1}, \\ 0, & otherwise. \end{matrix}

ii. For n ≥ max(ℓ_{2}, n^{⋆}),

c_{n}^{(τ_{1}-τ_{2}]} = \{ \begin{matrix}c_{n}^{τ_{1}} − b(τ_{1}, τ_{2}), & if C_{ℓ_{2}} ends with τ_{2}, \\ 0, & otherwise. \end{matrix}

iii. For n ≥ ℓ,

c_{n}^{[τ_{1}-τ_{2}]} = \{ \begin{matrix}1, & if C_{ℓ} begins with τ_{1} and ends with τ_{2}, \\ 0, & otherwise. \end{matrix}

iv. For n ≥ max(ℓ_{1}, n^{⋆}),

d_{n}^{[τ_{1}-τ_{2})} = \{ \begin{matrix}d_{n}^{τ_{2}} − a(τ_{1}, τ_{2}), & if D_{ℓ_{1}} begins with τ_{1}, \\ 0, & otherwise. \end{matrix}

v. For n ≥ max(ℓ_{2}, n^{⋆}),

d_{n}^{(τ_{1}-τ_{2}]} = \{ \begin{matrix}d_{n}^{τ_{1}} − b(τ_{1}, τ_{2}), & if D_{ℓ_{2}} ends with τ_{2}, \\ 0, & otherwise. \end{matrix}

vi. For n ≥ ℓ,

d_{n}^{[τ_{1}-τ_{2}]} = \{ \begin{matrix}1, & if D_{ℓ} begins with τ_{1} and ends with τ_{2}, \\ 0, & otherwise. \end{matrix}

Proof. We prove case i, all the other cases are then easy to see.

Clearly, if C_{ℓ_{1}} does not begin with τ_{1} then C_{n} does not begin with τ_{1} for all n ≥ ℓ_{1}, which means that c_{n}^{[τ_{1}-τ_{2})} = 0 in this case. Otherwise, to count occurrences of the pattern [τ_{1}-τ_{2}) is the same as to find the number of occurrences of the pattern τ_{2} in C_{n} and then subtract the number of such occurrences of τ_{2} that begin from the i-th letter of C_{n}, where 1 ≤ i ≤ k_{1}.

The following two examples are corollaries to Theorem 4.

Example 9. Suppose we have the patterns σ_{1} = [1122 − 21211) and σ_{2} = (21221 − 12]. From Theorem 4, c_{n}^{σ_{1}} = d_{n}^{σ_{1}} = 0, since C_{3} does not begin with 1122 (ℓ_{1} = 3). Also, c_{n}^{σ_{2}} = d_{n}^{σ_{2}} = 0, since C_{3} does not end with 12 (ℓ_{2} = 3).

Example 10. Suppose τ = [112-21). We have that k_{1} = 3, ℓ_{1} = 2 and C_{2} begins with the subword 112. Besides, a(112, 21) = 1 and, from Example 1, c_{n}^{21} = d_{n}^{21} = 2^{n−2} − 1. Theorem 4 now gives, that for n > 3, we have c_{n}^{[112-21)} = c_{n}^{τ_{2}} − a(τ_{1}, τ_{2}) = 2^{n−2} − 2.

The following theorem is straitforward to prove using the assumptions concerning non-overlapping of certain subwords.

Theorem 5. Let {τ_{1}, τ_{2}, …, τ_{k}} be a set of generalized patterns without internal dashes. Suppose |τ_{1}| = s_{1}, |τ_{k}| = s_{k}, ℓ_{1} = log_{2}(s_{1} + 1) and ℓ_{k} = log_{2}(s_{k} + 1). Also, ℓ = max(ℓ_{1}, ℓ_{k}).

i. With the assumption that the subword τ_{1} does not overlap with the subword τ_{2}, that is, no one suffix of τ_{1} is a prefix of τ_{2}, we have

(a)

c_{n}^{[τ_{1}-τ_{2}-···-τ_{k})} = \{ \begin{matrix}c_{n}^{τ_{2}-τ_{3}-···-τ_{k}}, & if C_{ℓ_{1}} begins with τ_{1}, \\ 0, & otherwise. \end{matrix}

(b)

d_{n}^{[τ_{1}-τ_{2}-···-τ_{k})} = \{ \begin{matrix}d_{n}^{τ_{2}-τ_{3}-···-τ_{k}}, & if D_{ℓ_{1}} begins with τ_{1}, \\ 0, & otherwise. \end{matrix}

ii. With assumption that the subword τ_{k−1} does not overlap with the subword τ_{k}, that is, no one suffix of τ_{k−1} is a prefix of τ_{k}, we have

(a)

c_{n}^{(τ_{1}-τ_{2}-···-τ_{k}]} = \{ \begin{matrix}c_{n}^{τ_{1}-τ_{2}-···-τ_{k−1}}, & if C_{ℓ_{k}} ends with τ_{k}, \\ 0, & otherwise. \end{matrix}

(b)

d_{n}^{(τ_{1}-τ_{2}-···-τ_{k}]} = \{ \begin{matrix}d_{n}^{τ_{1}-τ_{2}-···-τ_{k−1}}, & if D_{ℓ_{k}} ends with τ_{k}, \\ 0, & otherwise. \end{matrix}

iii. With the assumption that the subword τ_{1} does not overlap with the subword τ_{2}, and the subword τ_{k−1} does not overlap with the subword τ_{k}, we have

(a)

c_{n}^{[τ_{1}-τ_{2}-···-τ_{k}]} = \{ \begin{matrix}c_{n}^{τ_{2}-τ_{3}-···-τ_{k−1}}, & if C_{ℓ} begins with τ_{1} and ends with τ_{k}, \\ 0, & otherwise. \end{matrix}

(b)

d_{n}^{[τ_{1}-τ_{2}-···-τ_{k}]} = \{ \begin{matrix}d_{n}^{τ_{2}-τ_{3}-···-τ_{k−1}}, & if D_{ℓ} begins with τ_{1} and ends with τ_{k}, \\ 0, & otherwise. \end{matrix}

The following example is a corollary to Theorem 5.

Example 11. Suppose τ = [112-1-221-22]. The parameters of Theorem 5 are k_{1} = 3, k_{2} = 2, ℓ_{1} = 2, ℓ_{2} = 2, ℓ = 2. C_{3} begins with the subword 112 and ends with the subword 22. Thus by Theorem 5 and Example 6, c_{n}^{[112-1-221-22]} = c_{n}^{1-221} = \frac{1}{2}4^{n−2} + 27 · 2^{n−5} − n − 7.

[BabStein] Babson E., Steingrímsson E.: Generalized permutation patterns and a classification of the Mahonian statistics, Sém. Lothar. Combin. 44 (2000), Art. B44b, 18 pp.

[Burstein] Burstein A., Enumeration of words with forbidden patterns, Ph.D. thesis, University of Pennsylvania, (1998).

[BurMans1] Burstein A., Mansour T.: Words restricted by patterns with at most 2 distinct letters, Electronic J. of Combinatorics, to appear (2002).

[BurMans2] Burstein A., Mansour T.: Words restricted by 3-letter generalized multipermutation patterns, preprint CO/0112281.

[BurMans3] Burstein A., Mansour T.: Counting occurrences of some subword patterns, preprint CO/0204320.

[Claes] A. Claesson: Generalised Pattern Avoidance, European J. Combin. 22 (2001), no. 7, 961–971.

[Evdok] Evdokimov A. A.: On the Maximal Chain Length of an Unit ndimensional Cube, Maths Notes 6, No. 3 (1969), 309–319. (Russian)

[Evdokimov] Private communication (2001).

[GelbOlm] Gelbaum B., Olmsted J.: Counterexamples in Analysis, Holden-day, San Francisco, London, Amsterdam, (1964).

[Kitaev] Kitaev S., There are no iterated morphisms that define the Arshon sequence and the sigma-sequence, to appear J. Automata, Languages and Combinatorics (2002).

[KitMans1] Kitaev S., Mansour T.: Counting the occurrences of generalized patterns in words generated by a morphism, preprint CO/0210170.

[KitMans2] Kitaev S., Mansour T.: The Peano curve and counting occurrences of some patterns, preprint CO/0210268.

[Knuth] Knuth D. E.: The Art of Computer Programming, 2nd ed. Addison Wesley, Reading, MA, (1973).

[Lothaire] Lothaire M.: Combinatorics on Words, Encyclopedia of Mathematics, Vol. 17, Addison-Wesley (1986). Reprinted in the Cambridge Mathematical Library, Cambridge University Press, Cambridge UK (1997).

[Salomaa] Salomaa A.: Jewels of Formal Language Theory, Computer Science Press (1981).

[SimSch] Simion R., Schmidt F.: Restricted permutations, European J. Combin. 6, no. 4 (1985), 383–406.

[Yab] Yablonsky S. V.: Discrete mathematics and mathematical problems of cybernetics, Nauka, Vol. 1, Moscow (1974), 112–116. (Russian)