Permutations avoiding a simsun pattern

A permutation π avoids the simsun pattern τ if π avoids the consecutive pattern τ and the same condition applies to the restriction of π to any interval [k]. Permutations avoiding the simsun pattern 321 are the usual simsun permutation introduced by Simion and Sundaram. Deutsch and Elizalde enumerated the set of simsun permutations that avoid in addition any set of patterns of length 3 in the classical sense. In this paper we enumerate the set of permutations avoiding any other simsun pattern of length 3 together with any set of classical patterns of length 3. The main tool in the proofs is a massive use of a bijection between permutations and increasing binary trees. Mathematics Subject Classifications: 05A05, 05A15, 05C05


Introduction
A permutation σ ∈ S n avoids the (classical) pattern τ ∈ S k if there are no indices i 1 , i 2 , . . . , i k such that the subsequence σ i 1 σ i 2 . . . σ i k is order isomorphic to τ.
A permutation σ is called simsun (after Rodica Simion and Sheila Sundaram) if it does not contain double descents and the same applies to the restriction of σ to any interval [k]. For example, 41325 is simsun, while 32415 is not. The theory of simsun permutation goes back to the work by Sundaram [13] where the author proved that the cardinality of the set of simsun permutations of length n is the (n + 1)−th Euler number (see sequence A000111 in [11]). These permutations have been intensively studied in recent years (see e.g. [3,4,5,7,8,9]).
In this paper, we deal with a generalization of simsun permutations defined by Lin, Ma, and Yeh ( [7]): we say that a permutation σ avoids the simsun pattern τ if the restriction of σ to the interval [k] does not contain the consecutive pattern τ for any k = 1, . . . , n.
We denote by S n (τ S ) the set of all permutations in S n that avoid the simsun pattern τ . In particular, the set S n (321 S ) is the set of Simsun permutations of length n. If Σ ⊆ ∪ i 0 S i is any set of permutations, we denote by S n (τ S , Σ) the set of permutation of length n that avoid the simsun pattern τ and avoid every classical pattern in Σ. If Σ contains the patterns σ 1 , σ 2 , . . . , σ k we will write S n (τ S , σ 1 , σ 2 , . . . , σ k ) instead of S n (τ S , {σ 1 , σ 2 , . . . , σ k }).
Observe that, if the permutation τ is the image of ρ under the usual reverse map and Σ is the set of permutations obtained by reversing all the permutations in Σ, we have |S n (τ S , Σ)| = |S n (ρ S , Σ )|. Hence, for all Σ, we can partition the set of simsun patterns of length 3 into three classes with respect to the avoidance of the classical patterns in Σ: In [4] the authors enumerated S n (321 S , Σ) for all Σ ⊆ S 3 . Moreover, it is well known (see [2] or [7]) that |S n (132 S )| is the n-th Bell number (sequence A000110 in [11]).
In the present paper we study the sets S n (132 S , Σ) and S n (213 S , Σ) for every Σ ⊆ S 3 . We find a recursive formula for the enumerating sequence of each of these sets, some of them appear on [11] with different interpretations, while the others are not present on that database. Our analysis is based on a systematic use of well-known bijection between permutations and binary increasing trees.
Notice that the avoidance of the simsun patterns 132 S and 213 S can be recast in terms of barred generalized patterns. In the last Section we describe this relationship.
2 Permutations avoiding the simsun pattern 132 and Σ ⊆ S 3 We observe that a permutation π avoids the simsun pattern 132 if and only if each occurrence of 132 in π is part of an occurrence of 2413 or, equivalently, π avoids the barred pattern 2413. It has been shown in [2] that these permutations are enumerated by the Bell numbers. We will use the bijection ψ between S n (132 S ) and the set of partitions of {1, 2, . . . , n} presented in [7]. Write π ∈ S n (132 S ) as π = w 1 w 2 . . . w k where w i = x i,1 x i,2 . . . x i,s i are the ascending runs of π. Then ψ(π) is the partition of n whose blocks are {x 1,1 , . . . , x 1,s 1 }, . . . , {x k,1 , . . . , x k,s k }. Notice that the sequence x 1,1 , x 2,1 , . . . , x k,1 is decreasing, since π avoids the simsun pattern 132. This ensures that the map φ is a bijection.
Hence, these cases can be traced back to classical pattern avoidance. See [10] for the complete classification and enumeration of the sets S n (Σ) with Σ ⊆ S 3 .
Hence, the set P n corresponding to S n (132 S , 123) under the map ψ consists of the partitions of {1, 2, . . . , n} such that • every block has at most two elements and • if the blocks are arranged in descending order of their smallest element, also the greatest elements of the blocks are in descending order.
There is a simple bijection between the set P and the set of Motzkin paths of length n. We recall that a Motzkin path of length n is a lattice path starting at (0, 0), ending at (n, 0), and never going below the x-axis, consisting of up steps (1, 1), horizontal steps (1, 0), and down steps (1, −1).
More precisely, given a partition in P, we can construct the Motzkin path whose i-th step is • a horizontal step, if the block containing i has cardinality one, • an up step, if the block containing i has cardinality two and i is the least element of its block, • a down step, otherwise.
As a consequence, denoting by M n the n-th Motzkin number (sequence A001006 in [11]) we have |S n (132 S , 123)| = M n .

S n (132 S , 321)
If π ∈ S n (132 S , 321), then π has at most two ascending runs, namely the partition ψ(π) has at most two blocks. It is immediate to see that the number of such partitions is 2 n−1 , therefore |S n (132 S , 123)| = 2 n−1 .

Permutations avoiding the simsun pattern 213
First of all we describe a well-known and widely used bijection φ (see e.g. [6, p. 143] or [12, p. 44]) between the set W n of words without repetitions of length n in Z + and the set of binary increasing trees with n nodes. By definition, a binary increasing tree (b.i.t) is a plane, rooted, binary tree in which each of the n nodes bears a different positive integer label and labels increase along any descending path. In the sequel we will often identify each node with its label. A non-empty maximal sequence of adjacent left edges of a b.i.t. will be called left branch. The definition of right branch is analogous. The definition of the map φ is as follows. The empty word is mapped to the empty tree. Consider now a word u in W n , n 1. Denote by a the minimal integer appearing in u and write u as u = vaw where v and w are (possibly empty) words. Consider the trees t 1 = φ(v) and t 2 = φ(w). Define φ(u) to be the tree • whose root is labelled by a, • whose left subtree of the root is t 1 and • whose right subtree of the root is t 2 .
Needless to say, the image of S n under tha map φ is the set T n of binary increasing trees with labels from {1, 2, . . . , n}.

3 6
We now characterize the subset of T n corresponding to S n (213 S ) under the map φ. We say that a b.i.t. is a -tree if it is a tree of the following form Proof. Suppose that the tree t contains a -subtree and let π = φ −1 (t). Then π = ubvawcr where u, v, w, r are (possibly empty) words such that the symbols of w are greater than the symbol c and the symbols of v are greater than the symbol a. If each symbol of v is greater than c, then π contains the simsun pattern bac. Otherwise, there exists a symbol of b of v such that b < c. In this case we can replace b by b , and b ac is an occurrence of the simsun pattern 213. Conversely, suppose that π contains the simsun pattern 213 and let bac an occurence of such pattern. Let x be minimum of the symbols y appearing in π weakly to the right of c such that a < y c. Then in the tree φ(π) the nodes labelled by a, b, c and x (with c and x possibly coincident) form an occurrence of a -subtree.
We say that a b.i.t. is -avoiding if it does not contain -subtrees, and we denote by T n ( ) the subset of -avoiding trees of T n . Let t n, be the number of elements of T n ( ) whose leftmost node in the symmetric order (namely, the initial symbol in the corresponding permutation) is labelled by . We have the following result.
Theorem 2. The numbers t n, satisfy the following recurrence Proof. Every tree in T n ( ) can be obtained by • choosing an integer k, 1 k n − 1, • choosing a tree T L in T k ( ), • choosing a tree T R in T n−1−k ( ), • appending to a root T L as the left subtree and T R as the right subtree, • modifying the labels of T L and T R so that the resulting tree does not contain substrees, and its leftmost node has a fixed label .
If = 1, then the left subtree is empty. We only need to choose the right subtree in T n−1 ( ) and increase each label by 1. Suppose now > 1. Choose a left and a right subtree T L and T R , respectively, of the appropriate size. Denote by i (j respectively) the label of the leftmost node of T L (resp. T R ). We may have several ways to modify the labels of T L before branching it to the root. The chosen set of labels must satisfy the following conditions: • they must be grater than or equal to j + 2 the electronic journal of combinatorics 27(3) (2020), #P3.45 • the i-th smaller label must be equal to l.
Then we must choose i − 1 labels in the interval {j + 2, j + 3, . . . , − 1} ( −j−2 i−1 choices) and k − i labels in the interval { + 1, + 2, . . . , n} ( n− k−i choices). We attach the chosen labels to the nodes of T L according to the initial labelling and assign the remaining labels to T R with the same criterion. Now we consider permutations that avoid the simsun pattern 213 and a set of patterns Σ of length three in the classical sense.
A permutation that avoids the simsun pattern 213 can contain the pattern 213, namely, it can contain the subsequence bac with a < b < c, only if one of the following two cases occurs.
• Between b and a there is a symbol x < a. In this case xac is an occurrence of the pattern 123 and bxa is an occurence of 312.
• Between a and c there is a symbol x such that a < x < b. In this case axc is an occurrence of the pattern 123 and bax is an occurence of 312.
From the previous observations it follows that a permutation π avoids the simsun pattern 213 if and only if each occurence of 213 in π is part of an occurrence of 3124. Note that the condition of avoiding the simsun pattern 213 cannot be rephrased as the avoidance of a barred pattern.
Since We will say that a -avoiding tree that avoids also the subtrees α and β is a right-comb. It is easily seen that the set RCT n is precisely the set of right-combs with n nodes.
The following figure represents the shape of a right-comb. Now we will establish a recurrence for the numbers of right-combs. Denote by a n the cardinality of RCT n . Theorem 4. The sequence {a n } n 0 satisfies a n = 2a n−1 + n−2 i=1 a i · (a n−i−1 − a n−i−2 ) ∀n 2 with a 0 = a 1 = 1.
Proof. Given a tree t in RCT n−1 , we can always add a son with label n either to the left of the leftmost vertex or to the right of the last vertex of the first right branch. Fix now an integer i between 1 and n − 2 and consider a tree t 1 in RCT i . Consider also a tree t 2 in RCT n−i−1 whose maximal label is not attached to its leftmost vertex. Notice that we have a n−i−1 − a n−i−2 such trees. We can associate to the pair (t 1 , t 2 ) a tree t 1 ⊕ t 2 in RCT n by adding to the rightmost vertex of t 1 a right son labelled i + 1, increasing by i + 1 each label in t 2 and pasting the root of t 2 to the left of the leftmost vertex of t 1 .
Every tree t in RCT n whose vertex with label n is neither the leftmost one nor at the end of the first right branch can be obtained in this way. In fact, given such a tree • let i + 1 be the maximal label on the first right branch, • consider the subtree t 1 (t 2 , respectively) of nodes labelled by 1, 2, . . . , i, (i + 2, . . . , n, respectively).
Example 5. The sequence {a n } n 0 is (up to a shift) sequence A105633 in [11].

S n (213 S , 231)
Similarly to the previous case, the set S n (213 S , 231) corresponds under the map φ to the subset of T n ( ) of trees avoiding the subtree Proof. To prove recurrence 1 we will partition the set LCT n into three non-intersecting subsets.
In fact, given a tree t in LCT n we have three possible cases. removing t 1 from the right subtree of the root of t. Denote by t 2 the tree whose root is the vertex of t with label h, whose right subtree is t * , and whose left subtree is the left branch stemming from h. Let t 1 and t 2 be the trees obtained from t 1 and t 2 by renormalization of the labels, respectively. The tree t is uniquely determined by the pair (t 1 , t 2 ). We will write t = t 1 ⊗ t 2 . Note that t 1 is a tree in LCT h−2 , while t 2 is a tree which satisfies all the conditions of the trees in LCT n−h+1 , except for the fact that the left son of the root can also be labelled by 2.
Example 7. Let The edges of t corresponding to t 2 are denoted by thick lines. In this example t 1 ∈ LCT 3 , t 2 ∈ LCT 5 and t ∈ LCT 9 . Note that t 1 ∈ LCT 3 , t ∈ LCT 10 , but t 2 / ∈ LCT 6 , since it contains a -subtree given by the nodes 1, 2, 4.
There are three possible situations. Subcase 3.1: t 2 is an arbitrary tree in LCT n−h+1 and, since t = t 1 ⊗ t 2 must belong to LCT n , t 1 is a tree in LCT h−2 such that its rightmost vertex does not have a left son. In order to compute the number of such trees we proceed as follows. If s is an element of LCT i such that its rightmost vertex has a left son, the labels of these last two vertices are consecutive, since s must avoid β . As a consequence, the number of such trees is b i−1 . Hence we have trees in LCT n obtained as product of smaller trees of these types. We observe that the term b n−2 refers to the case when t 2 is an arbitrary tree in LCT n−2 and t 1 is the tree with one node. Subcase 3.2: t 2 is a tree in LCT n−h+1 given by a non-empty sequence of left edges or the tree with one node, and t 1 is a tree in LCT h−2 such that its rightmost vertex has a left son. The number of trees in LCT n obtained in this way is b n−3 + b n−4 + · · · + b 1 .
Subcase 3.3: t 2 is a tree which satisfies all the conditions of the trees in LCT n−h+1 except for the fact that the left son of the root is labelled by 2 (and the root has a right son). Once again, since t = t 1 ⊗ t 2 ∈ LCT n , then t 1 belongs to LCT h−2 and its rightmost vertex does not have a left son (notice that t 1 can also be the tree with a single node). We denote byLCT n−h+1 the set of trees which satisfy all the conditions of the trees in LCT n−h+1 except for the fact that the left son of the root is labelled by 2 (and the root has a right son).
In order to enumerate the elements of the setLCT j , j 3, we observe that a tree w ∈LCT j in which the right son of the root is labelled by k must have a left branch stemming from the root whose first labels are 1, 2, . . . , k − 1. Removing the nodes labelled from 2 to k − 1 and scaling the remaining labels we get an arbitrary tree in LCT j−k+2 different from the tree given by a single left branch (hence there are b j−k−2 − 1 possible choices for such tree). This implies The number of trees t 1 ∈ LCT i whose rightmost vertex does not have a left son is b i − b i−1 , hence the total number of trees obtained as a product of the type explained above is where the sum in the second line equals the number of the trees t 1 ⊗ t 2 , with t 1 being a single node. It is easy to see that the expression above reduces to We now proceed by induction on n. The base case with n = 2 is trivial. Suppose by induction that This implies that and, iterating, we obtain Now we add all the contributes from Cases 1,2 and 3. We get the electronic journal of combinatorics 27(3) (2020), #P3.45 Exploiting identity (2), the last row of the previous equation can be rewritten as b n−1 − b n−2 − 1, hence we get as desired.

S n (213 S , 321)
In order to enumerate the set S n (213 S , 321) it is more convenient to focus on permutations themselves rather than studying the properties of the associated trees. Starting from a permutation π ∈ S n−1 (213 S , 321), with n 3, we can obtain a permutationπ ∈ S n (213 S , 321) by inserting the symbol n in one of the following positions. Write π = σx 1 x 2 . . . x k , k 1, where x 1 x 2 . . . x k is the last ascending run of π. Then we can either insert n • immediately before x 1 , or • immediately after x i , for all i 2, if any, or • between x 1 and x 2 whenever σ is the empty permutation (otherwise we would create an occurence of the consecutive pattern 213).
Denote by A n,h the number of elements of S n (213 S , 321) such that the last ascending run has length h. The above considerations imply that A n,k = A n−1,k + A n−1,k−1 · δ k 3 + A n−1,k+1 · δ n−1=k+1 + n−k−1 i=2 A n−1,k+i for all n 3 and k 1, where δ P = 1 if the proposition P is true 0 otherwise.

S n (213 S , 132, 231)
The results of Subsections 4.1 and 4.2 imply that the map φ restricted to S n (213 S , 132, 231) is a bijection between such set and the set LCT n ∩ RCT n . The trees of this last set consist of a root, a (possibly empty) left branch stemming from the root and a (possibly empty) right branch stemming from the root, as shown in the following figure Note that if such a tree has a right branch, the right son of the root has label 2 (otherwise the tree would contain a -subtree). As a consequence, we can choose the labels of the nodes on the left branch in the set {3, . . . , n}, without constraints.
The only other possible case is the case of a tree with only a left branch. Hence As proved in Subsection 4.1, the set S n (213 S , 132) corresponds, under the map φ, to the set RCT n . If π ∈ S n (213 S , 132, 321), the left branch of the right-comb φ(π) has length at most one (otherwise the elements of π corresponding to the nodes of such left branch would give rise to a decreasing subsequence). Conversely, it is immediately seen that a right-comb with a left branch of length at most one, i.e. of the form corresponds, under the map φ −1 , to a permutation in S n (213 S , 132, 321). Now, denote by k the length of the leftmost right branch of such a tree. For every n 2, there is exactly one tree with k = 0 and exactly one tree with k = n − 1. If 1 k n − 2, note that the labels of the nodes of the leftmost right branch are consecutive, otherwise the tree would contain the subtree β. Hence these labels can be chosen in n − k − 1 ways. As a consequence, This is (up to a shift) sequence A152948 in [11].
4.6 S n (213 S , 231, 321) The set S n (213 S , 231) corresponds, under the map φ, to the set of left-combs LCT n , as seen in Subsection 4.2. For every π ∈ S n (213 S , 231, 321) the right branches of the tree φ(π) have length at most one, since the labels of any right branch correspond to a descending sequence in the permutation. Moreover, φ(π) must avoid also the subtrees of the form because every labelling of such subtree yields a permutation containing either the pattern 321 or the simsun pattern 213. Hence two nodes of φ(π) with a left son cannot be consecutive. The following figure represents such a tree Let t be a tree in φ(S n (213 S , 231, 321)) with n 3. If the root of t does not have a left son, removing the root from t we get an arbitrary tree in φ(S n−1 (213 S , 231, 321)). Otherwise, let k > 2 be the label of the left son of the root. Since the tree t avoids the subtree β , the nodes with labels {2, . . . , k − 1} have no left son. If we remove from t such nodes and the root we get an arbitrary tree in φ(S n−k (213 S , 231, 321)). Hence the sequence {c n } n 0 with c n = |S n (213 S , 231, 321)| satisfies c n = c n−1 + c n−3 + c n−4 + · · · + c 0 . This is (up to the first term) sequence A005314 in [11]. The previous considerations imply that φ(S n (213 S , 132, 231, 321)) is the set of trees consisting of a root, a right branch and, possibly, a left edge stemming from the root, as in the figure below There is only one tree consisting of a single right branch. On the other hand, if the root has a left son and n 3, we can choose the label of the left son of the root from the set {3, . . . , n}. Hence if n = 0.

Connection with barred generalized patterns
A generalized pattern (or vincular pattern) is a classical pattern τ some of whose consecutive letters may be underlined. A permutation π contains the generalized pattern τ if it contains τ in the classical sense and the elements corresponding to τ i and τ i+1 are consecutive in π if τ i τ i+1 is underlined in τ.
A barred generalized pattern τ is a generalized pattern τ some of whose consecutive letters may be overlined. If τ is a barred generalized pattern, denote byτ the generalized pattern obtained from τ removing the overbars and byτ the generalized pattern obtained from τ removing the overbarred symbols.
A permutation π avoids the barred generalized pattern τ if every occurence ofτ in π is part of an occurence ofτ .
As an example, consider the barred generalized pattern 3124. In the permutations π = 4513762 the subsequence 437 forms an occurence of the generalized pattern 213 which is part of an occurence of 3124 and the same holds for the other occurrences of 213, hence π avoids the barred generalized pattern 3124.
It is possible to recast the avoidance of the simsun patterns 132 S and 213 S in terms of barred generalized patterns. In fact, as noted above, S n (132 S ) = S n (2413) and by [1, Theorem 2.3] we have also S n (132 S ) = S n (2413) = S n (2413) = S n (231).
Likewise, it is possible to prove that S n (213 S ) = S n (3124).