Positional Marked Patterns in Permutations

We define and study positional marked patterns, permutations $\tau$ where one of elements in $\tau$ is underlined. Given a permutation $\sigma$, we say that $\sigma$ has a $\tau$-match at position $i$ if $\tau$ occurs in $\sigma$ in such a way that $\sigma_i$ plays the role of the underlined element in the occurrence. We let $pmp_\tau(\sigma)$ denote the number of positions $i$ which $\sigma$ has a $\tau$-match. This defines a new class of statistics on permutations, where we study such statistics and prove a number of results. In particular, we prove that two positional marked patterns $1\underline{2}3$ and $1\underline{3}2$ give rise to two statistics that have the same distribution. The equidistibution phenomenon also occurs in other several collections of patterns like $\left \{1\underline{2}3 , 1\underline{3}2 \right \}$, and $\left \{ 1\underline234, 1\underline243, \underline2134, \underline2 1 4 3 \right \}$, as well as two positional marked patterns of any length $n$: $\left \{ 1\underline 2\tau , \underline 21\tau \right \}$.


Introduction
The notion of mesh patterns was first introduced by Brändén and Claesson Brändén and Claesson (2011). Many authors have further studied this notion. In particular, the notion of marked mesh pattern was introduced byÚlfarssoń Ulfarsson (2010), and the study of the distributions of quadrant marked mesh patterns in permutations was initiated by Kitaev and Remmel in Kitaev and Remmel (2012a).
Here, we recall the definition of a quadrant marked mesh pattern. Let N = {0, 1, 2, . . .} denote the set of natural numbers and S n denote the symmetric group of permutations of 1, . . . , n. We consider the graph of σ, G(σ), to be the set of points (i, σ i ). We are interested in the points that lie in the four quadrants I, II, III, IV of that coordinate system. For any a, b, c, d ∈ N and any σ = σ 1 . . . σ n ∈ S n , we say that σ i matches the simple marked mesh pattern M M P (a, b, c, d) if in G(σ) relative to the coordinate system which has the point (i, σ i ) as its origin, there are at least a points in quadrant I, at least b points in quadrant II, at least c points in quadrant III, and at least d points in quadrant IV. We let mmp (a,b,c,d) (σ) denote the number of i such that σ i matches the marked mesh pattern M M P (a, b, c, d) in σ.
We studied a generalization of quadrant marked mesh patterns. Here, we make a connection between quadrant marked mesh pattern and classical permutation patterns. Let σ = σ 1 σ 2 . . . σ n ∈ S n and τ = τ 1 τ 2 . . . τ k ∈ S k . We say that σ contains pattern τ if there is a subsequence σ ′ = σ i1 σ i2 . . . σ i k of σ such that σ ′ and τ have the same relative order. That is, σ ij < σ i k if and only if τ j < τ k . For example, permutation 15324 contains pattern 123 as the subsequence 134 (and 124) has the same relative order as pattern 123. We now consider the pattern M M P (1, 0, 1, 0). An element in a permutation matches M M P (1, 0, 1, 0) when there is at least one point to the top right and at least one point to the bottom left of the interested point. An equivalent way to think about M M P (1, 0, 1, 0) for any permutation σ is to count the number of elements in σ that can be the midpoint of the pattern 123 in σ. One can ask similar questions  but for different patterns and positions. For example, one may consider the number of elements in σ that can be the starting point of the pattern 2314.
Here, we briefly define the notion of positional marked patterns (PMP) which enumerates the described statistics. A positional marked pattern of length k is a permutation of [k] with one of the elements underlined. Given any positional marked pattern τ , let π(τ ) denote the element in S k obtained from τ by removing the underline, and let u(τ ) be the position of the underlined element in τ . Given σ = σ 1 σ 2 . . . σ n ∈ S n and a positional marked pattern τ , we say that σ has a τ -match at position ℓ if σ contains the pattern π(τ ) in such a way that the ℓ-th element in σ plays the role of the underlined elements in τ . Let pmp τ (σ) denote the number of positions ℓ such that σ has a τ -match at position ℓ. We will carefully define positional marked patterns in Section 2. Recall that, in classical patterns, two patterns τ 1 and τ 2 are Wilf-equivalent if the number of σ in S n avoiding τ 1 is the same as that of τ 2 for all n ∈ N. Here, we adopt the vocabulary from the classical definition to our definition. Given two positional marked patterns τ 1 and τ 2 , we say that τ 1 and τ 2 are P M P -Wilf-equivalent if pmp τ1 and pmp τ2 have the same distribution over S n for all n. Our main goal is to classify P M P -Wilf-equivalent classes for positional marked patterns.
The paper outlines as follows: In Section 2, we give a precise definition and some preliminary results on positional marked patterns. In Section 3, we study positional marked patterns of length 3. We prove that there are only two P M P -Wilf-equivalent classes for positional marked patterns of length 3. The result follows from the following theorems. In Section 4, we prove some non-trivial equivalences of pairs of positional marked patterns of length 4 as well as providing numerical results for every patterns of length 4. In Section 5, we prove the following theorem, which gives an equivalence of pairs of positional marked patterns of arbitrary length.
In Section 6, we discuss further research possibilities, as well as precise connection between positional marked patterns and quadrant marked mesh patterns.

Definition
Definition 4. Let S * k denote a set of permutations of [k] with one of the elements underlined. Given any τ ∈ S * k , let π(τ ) denote an element in S k obtained from τ by removing the underline, and let u(τ ) be the position of the underlined element in τ . We shall call an element in S * k a positional marked pattern (PMP). For example, τ = 1432 is an element in S * 4 . In this case, π(τ ) = 1432 and u(τ ) = 2. Definition 5. Given a word w where letters are taken from Z ≥0 , a reduction of w, denoted by red(w), is the word obtained from w by replacing the i-th smallest letter by i. In particular, if w is a word of length k with distinct letters, then red(w) ∈ S k .
For example, if w = 25725, then red(w) = 12312. Here, we are ready to define a statistic on S n that we mainly focus on in this paper.
Definition 6. Given σ = σ 1 σ 2 . . . σ n ∈ S n and τ ∈ S * k , we say that σ has a τ -match at position ℓ if there is a subsequence σ i1 σ i2 . . . σ i k in σ such that In other words, σ contains the pattern π(τ ) in such a way that ℓ-th element in σ plays the role of the underlined elements in τ . Let pmp τ (σ) denote the number of positions ℓ such that σ has a τ -match at position ℓ.
For example, if σ = 26481573 and τ = 1432. Then σ has a τ -match at positions 2 and 4, as we find subsequences 2653 and 2853 respectively. Thus, pmp τ (σ) = 2. We are interested in the generating function P n,τ (x) = σ∈Sn x pmpτ (σ) . We say that two positional marked patterns τ 1 and τ 2 are P M P -Wilf-equivalent if P n,τ1 (x) = P n,τ2 (x) for all n. Note that, by looking at the constant terms of generating functions, if τ 1 and τ 2 are P M P -Wilfequivalent, then π(τ 1 ) and π(τ 2 ) are Wilf-equivalent. Thus, one might think of pmp-Wilf-equivalent as a stronger version of Wilf-equivalent. In this paper, we classify equivalence classes of S * 3 and S * 4 . We associate a positional marked pattern with a permutation matrix-like diagram. Given any τ ∈ S * k , the diagram associated to τ is a k by k array with the following filling: For the cell at i-th row and j-th column (i) the cell is filled with • if τ i = j and u(τ ) = i, (ii) the cell is filled with × if τ i = j and u(τ ) = i, or (iii) the cell is empty otherwise. By convention, we count rows and columns of an array from left to right and from bottom to top. For example, if τ = 1432, then the corresponding diagram is Similarly, we associate σ ∈ S n with an n by n diagram with the cell at i-th row and j-column is (i) filled with × if σ i = j and (ii) empty otherwise. For example, the diagram corresponding to π = 26481573 is We can visualize matching of P M P using diagrams. Given a permutation σ and a P M P τ , σ has a τ -match at position i if when replacing × in the i-th column of the diagram of σ by •, then it contains a subdiagram τ . For example, σ = 26481573 has a τ -match at position 2 and 4 by looking at subdiagrams marked in red below With diagrams, we prove equivalences of P M P by symmetry. Given two P M P s τ 1 , τ 2 such that the diagram of τ 2 can be obtained from τ 1 by applying a series of rotations and reflections to the diagram of τ 1 , then we can construct a map θ : S n → S n by applying the same series of rotations and reflections to elements in S n . The map will obviously have the property that pmp τ1 (σ) = pmp τ2 (θ(σ)) for all σ ∈ S n , and so τ 1 and τ 2 are P M P -Wilf-equivalent. We proved the following lemma.
Lemma 7. Given τ 1 , τ 2 ∈ S * k , such that τ 2 can be obtained by applying a series of rotations and reflections to τ 1 . Then τ 1 and τ 2 are P M P -Wilf-equivalent.
Lemma 7 reduces the problem tremendously. There are 3! · 3 = 18 P M P s of length 3. However, with Lemma 7, there are at most 4 equivalence classes, which are represented by 123, 123, 132, 132. Their diagrams are shown in Figure 3. In this subsection, we restate and prove one of the theorems mentioned in Section 1. For our convenience, we let τ 1 = 123 and τ 2 = 132. We will first prove by showing that generating functions corresponding to those patterns satisfy the same recursive formula. We later will construct a bijection from S n to itself that maps pmp τ1 to pmp τ2 , that is, a map θ such that pmp τ1 (σ) = pmp τ2 (θ(σ)).
Given any permutation σ = σ 1 σ 2 . . . σ n ∈ S n . We say that σ has an ascent at position i if σ i < σ i+1 . We will look at the position where the last ascent occurs. In particular, either σ has no ascent or there is k such that σ k < σ k+1 > σ k+2 > . . . > σ n . In that case, we say that the last ascent of σ is at position k. Let P n,τ1,k (x) = x pmpτ 1 (σ) where the sum is over all permutations in S n with the last ascent at position k. Then, we have P n,τ1 (x) = 1 + n−1 k=1 P n,τ1,k (x).
Given any permutation σ = σ 1 σ 2 . . . σ n ∈ S n . We say that σ has an descent at position i if σ i > σ i+1 . Similar to τ 1 , we will look at the position where the last descent occurs for τ 2 . Either σ has no descent, or there is k such that σ k > σ k+1 < σ k+2 < . . . < σ n . We say that the last descent of σ is at position k. Let P n,τ2,k (x) = x pmpτ 2 (σ) where the sum is over all permutations in S n with the last descent at position k. Then, we have P n,τ2 (x) = 1 + n−1 k=1 P n,τ2,k (x).
First, we derive a recursive formula for P n,τ1,k (x).
Proof: We derive a recursive formula of P n,τ1,k (x) by looking at position of 1 in σ where the last ascent is at position k. So, σ has the following form: Let t be the position of 1. We have three cases: In this case, 1, σ k , σ k+1 form the pattern τ 1 . Thus, σ has a τ 1 -match at position t. Moreover, 1 does not influence τ 1 -match at other positions. Thus, we can remove 1 from σ and decrease other elements by 1. The last ascent will be at position k − 1. Therefore, this case contributes x(k − 1)P n−1,τ1,k−1 (x).
2. t = k. In this case, σ does not have a τ 1 -match at position k. We can remove 1 from σ and decrease other elements by 1. Either the remaining permutation will has no ascent, or the last ascent appears at some position between 1 and k − 1. Thus, this case contributes 1 + k−1 ℓ=1 P n−1,τ1,ℓ (x).
3. t = n. In this case, σ does not have a τ 1 -match at position n. We can remove 1 from σ and decrease other elements by 1. The remaining permutation will have the last ascent at position k. Thus, this case contributes P n−1,τ1,k (x).
Here, we prove a similar result for τ 2 .

Proof:
We use the same strategy as in the case for τ 1 . We derive a recursive formula for P n,τ2,k (x) by looking at the position of 1 in σ where the last descent is at position k. So, σ has the following form: Let t be the position of 1. We have 2 cases: 1. 1 ≤ t ≤ k − 1. In this case, 1, σ k , σ k+1 form the pattern τ 2 . Thus, σ has a τ 2 -match at postion t. Moreover, 1 does not influence τ 2 -match at other positions. Thus, we can remove 1 from σ and decrease other elements by 1. The last descent will be at position k − 1. Therefore, this case contributes x(k − 1)P n−1,τ2,k−1 (x).
2. t = k + 1. In this case, σ does not have a τ -match at position k + 1. We can remove 1 from σ and decrease other elements by 1. The remaining permutation will either has no descent, or the last ascent appears at some position between 1 and k. Thus, this case contributes 1 + k ℓ=1 P n−1,τ1,ℓ (x).
In total, we have Note that, the first case does not exist when k = 1, but the formula is correct since P n−1,τ2,0 (x) = 0. Also, for the second case, if k = n − 1, the last descent cannot be at position k = n − 1. However, the formula is still correct since P n−1,τ2,n (x) = 0.
2. The last ascent of σ is at the same position as the last descent of θ(σ).
By observation, θ satisfies the properties for S 1 and S 2 . For S n+1 where n ≥ 2, we define the map recursively. Given σ ∈ S n , we have σ ′ = θ(σ) ∈ S n , where the last ascent of σ is at the same position as the last descent of σ ′ . Let k be the position. We decompose σ and σ ′ at k.
If σ has no ascent, then σ ′ has no descent, we decompose σ and σ ′ by having the "first part" empty, or, equivalently, set k = 0.
Here, we obtain an elementσ ∈ S n+1 by increasing every element in σ by 1 and inserting 1 at some position, then θ(σ) will be obtained from increasing elements in σ ′ by 1 and inserting 1 at some position based on the position of 1 inσ. Suppose we insert 1 at position r from the left in σ, then the position r ′ of 1 inserted in σ ′ is The corresponding positions of 1 can be viewed in Figure 4. Fig. 4: Inserting positions of 1 of the bijection θ that sends pmp123 to pmp132 By observation, the position of the last ascent ofσ is the same as the position of the last descent ofσ. Also, pmp τ1 will increase by 1 if and only if 1 is inserted at the first k positions, which is the same condition for pmp τ2 to increase by 1. Thus, θ satisfies the conditions.
As an example, we start with θ(12) = 21. Here, the diagram for inserting 1 looks like Suppose we insert 1 to 12 at the last position, so we get 231. According to the diagram, we should insert 1 to 21 at the second position, so we get 312. Thus, θ(231) = 312. Now the diagram looks like Here, we insert 1 to 231 at the first position, so we get 1342. We should also insert 1 to 312 at the first position, so we get 1423. Thus, θ(1342) = 1423.
Below are enumerations of P n,123 (x) for the first few n: Even though we do not know a formula for P n,123 (x) in general, we can still explain some of the coefficients. For example, P n,123 (x)| x 0 = C n , the n-th Catalan number. This is obvious since a permutation is 123-avoiding if and only if it does not have a 123-match at any position. There are other coefficients that have a nice formula.
Proof: For any σ ∈ S n , it is clear that σ does not have a 123-match at position n or n − 1. Thus, pmp 123 (σ) ≤ n − 2.
For any σ ∈ S n , we claim that pmp 123 (σ) = n − 2 if and only if σ n−1 = n − 1 and σ n = n. The converse obviously true since σ would have a 123-match at position i for 1 ≤ i ≤ n − 2. Suppose that pmp 123 (σ) = n − 2. Let p i be the position of i in σ. That is σ pi = i. Note that n − 1 and n cannot be a starting point of the pattern 123, so σ does not have a 123-match at positions p n−1 and p n . However, σ has a 123-match at every position except n − 1 and n. Thus, {p n−1 , p n } = {n − 1, n}. Consider position p n−2 . σ must be 123-match at position p n−2 . That is n − 2 is a starting point of a pattern 123 in σ. However, the only way for n − 2 to be a starting point of 123 is that n − 2, n − 1, n form the pattern 123. That is n − 1 is to the left of n. So, p n−1 = n − 1 and p n = n, which means σ n−1 = n − 1 and σ n = n. Thus, we know that all σ such that pmp 123 (σ) = n − 2 are precisely all σ of the form: This theorem can generalized to any P M P .
Proof: Given k ≤ n and τ ∈ S * k . Suppose τ has the form That is u(τ ) = ℓ and π(τ ) = τ 1 τ 2 . . . τ k . Note that there are ℓ − 1 numbers to the left of the underlined number in τ and there are k − ℓ numbers to the right of the underlined number in τ . Given σ ∈ S n , suppose σ has a τ -match at position i. Then, there must be at least ℓ − 1 numbers to the left of position i in σ and there must be at least k − ℓ to the right of position i in σ.
Let's call numbers appearing at positions 1, 2, . . . , ℓ − 1 the left part of σ, while call the numbers appearing at positions n − k + ℓ + 1, n − k + ℓ + 2, . . . , n the right part of σ. Then, σ has a following structure: We shall prove that ways to rearrange 1, 2, . . . , τ ℓ − 1, n − k + τ ℓ + 1, . . . n in left and right part of σ so that Consider the number τ ℓ in σ. We know that σ has a τ -match at position p τ ℓ . Then, numbers 1, 2, . . . , τ ℓ − 1 in σ must involve in τ -match at position p τ ℓ since we need τ ℓ − 1 numbers smaller than τ ℓ . Therefore, for each number i less than τ ℓ , we can determine whether i is in the left part or the right part of σ based on the relative postion of i and τ ℓ in τ . Also, consider the number n − k + τ ℓ . σ must be a τ -match at position p n−k+τ ℓ . By the same reasoning, for each number n − k + τ ℓ + i, we determine whether n − k + τ ℓ + i is in the left part or right part of σ based on the relative position of τ ℓ + i and τ ℓ in τ . Thus, we determine both left and right part as sets. Now, consider position ℓ in σ. σ must have a τ -match at position ℓ. Thus, numbers in first ℓ − 1 positions in σ must involve in a τ -match at position ℓ, and so, the first ℓ − 1 numbers in σ must have the same relative order as first ℓ − 1 elements in τ . By the same reasoning, by considering position n − k + ℓ, the last k − ℓ numbers in σ have the same relative order as the last k − ℓ numbers in τ . Therefore, we completely determine both left and right part of σ. Thus, there is at most one way to rearrange {1, 2, . . . , τ ℓ − 1, n − k + τ ℓ + 1, . . . , n}.
Another coefficient we can describe is P n,132 (x)| x . The sequences is A029760 and A139262 on OEIS. The sequence A139262 counts the sum of all inversion of all elements in S n (132), the set of 132-avoiders in S n .
Definition 14. Let IM S n (132) be the set of 132-avoiding σ that a pair of elements causing an inversion are marked with * .
Definition 15. Given σ ∈ S n , i, j ∈ Z, 1 ≤ i ≤ n, 1 ≤ j ≤ n + 1. Let θ(σ, i, j) be an element in S n+1 obtained from σ by 1. increasing every number greater than or equal to i by 1; 2. inserting i at the j-th position from the left. (The first position is in front of the first element, and the n + 1-th position is behind the last element).
Definition 16. Given σ ∈ IM S n (132). Let σ be the underlying permutation of σ. Let j be the position of the first * in σ, and let i be the number underneath the second * in σ. Define Φ(σ) = θ(σ, i, j).
Suppose otherwise. That is,σ contains the pattern 132 where the starting element is σ ′ t for some t. We have two cases: 1. If the pattern does not involve σ ℓ , then there must be u, v such that σ ′ t , σ ′ u , σ ′ v form a pattern 132. It is easy to see that σ t , σ u , σ v also form a pattern 132 in σ, which is a contradiction since σ is a 132-avoider.
2. If the pattern involves σ ℓ , then t < k and σ ′ t < σ ℓ . In this case, it is easy to see that σ ′ t , σ ′ k , σ ′ ℓ also form the pattern 132. Thus, σ t , σ k , σ ℓ form the pattern 132 in σ, which is again a contradiction.
The map Φ is clearly an injection. Let σ = σ 1 . . . σ n be in the image of Φ, and let σ i be the starting point of the pattern 132. Then, i determines the first starred element, and σ i determines the second starred element. To prove that the map Φ is a surjective, we need another lemma: Lemma 18. Given σ = σ 1 . . . σ n ∈ S n such that pmp 132 (σ) = 1. Suppose the pattern 132 in σ starts at σ t , then the following must be true: (1) σ t+1 ≥ σ t .
(2) σ t + 1 is on the right of σ t .

That is, the graph of σ should look like
Suppose (2) is not true. There must be u, v such that σ t , σ u , σ v form a pattern 132. Then, σ t + 1, σ u , σ v also form a pattern 132. So, pmp 132 (σ) ≥ 2.

213.
Therefore Φ is a bijection, and so we prove Theorem 13.

Equivalence of 123 and 132
By observing diagrams of 132 and 132, we see that those two patterns are equivalent by Lemma 7. Thus, we will instead prove that 123 and 132 are equivalent.

Diagrams of 132 and 132
Here, we restate and prove one of the theorems mentioned in Section 1. For our convenience, we let τ 1 = 123 and τ 2 = 132. We will first prove by showing that two generating functions satisfy the same recursive formula. We later will construct a bijection from S n to itself that maps an pmp τ1 to pmp τ2 , that is, a map θ such that pmp τ1 (σ) = pmp τ2 (θ(σ)).
Given any permutation σ ∈ S n . We will look at the position of 1 in σ. Let P n,τ1,k (x) = x pmpτ 1 (σ) , where the sum is over all permutations in S n with 1 at position k. Then, we have P n,τ1 (x) = n k=1 P n,τ1,k (x).
Here, we derive a recursive formula for P n,τ1,k (x).
Lemma 20. Let τ 1 = 123 and let P n,τ1,k = x pmpτ 1 (σ) where the sum is over all σ ∈ S n with 1 at position k. Then, P n,τ1,k (x) satisfies the following recursive formula: where P n,τ1,N (x) = 0 for N > n by convention.
Proof: We derive a recursive formula for P n,τ1,k (x) by looking at the position of 2 in σ where the position of 1 is k. σ has a following form Let ℓ be the position of 2. We have 3 cases: In this case, we can remove 1 from σ and decrease other elements by 1 without effecting τ 1 -match at other position. To see this, first note that if σ does not have a τ 1 -match at a particular position, removing 1 and reducing will not change it. Also, if σ does not have a τ 1 -match at some position before 1, then removing 1 will not change τ 1 -match at the position, since 1 can only serve as 1 in 123. However, 1 appears after the position that τ 1 -match occurs. Thus, σ has a τ 1 -match at the position without considering 1. Lastly, if σ has a τ 1 -match at some position t after 1. Note that 2 appears before 1 in σ. Thus, 2 can serve as 1 in 123. Therefore, σ still has a τ 1 -match at position t when not considering 1. So, we can remove 1 and decrease other elements by 1 without effecting τ 1 -match.
2. k + 1 ≤ ℓ ≤ n − 1. In this case, σ has a τ 1 -match at position ℓ since 1 2 σ n form the pattern τ 1 . Moreover, by the same reason as in the first case, removing 2 and reducing will not effect τ 1 -match at other position.
3. ℓ = n. In this case, σ does not have a τ 1 -match at position ℓ, and removing 2 will not effect τ 1 -match at other positions. Thus, this case contributes P n−1,τ1,k (x).
In total, we have Note that, the first case vanishes when k = 1, but the formula is correct since it would contribute an empty summation. The second case vanishes when n − 1 ≤ k ≤ n, but the formula is still correct since n − k − 1 = 0 for k = n − 1 and P n−1,τ1,n (x) = 0 for k = n. The last case also vanishes when k = n, but the formula is still correct as P n−1,τ1,n (x) = 0.
Here, we prove a similar result of τ 2 = 132.
Let ℓ be the position of 2. We have 3 cases: 1. 1 ≤ ℓ ≤ k − 1. In this case, by the same reason as the first case in the proof of Lemma 20, we can remove 1 from σ and decrease other elements by 1 without effecting τ 1 -match at other positions.
2. ℓ = k + 1. In this case, σ does not have a τ 2 -match at position ℓ, and removing 2 will not effect τ 2 -match at other positions by the same reason as above. Thus, this case contributes P n−1,τ2,k (x).
3. k + 2 ≤ ℓ ≤ n. In this case, σ has a τ 2 -match at position ℓ since 1 σ k+1 2 form the pattern τ 2 . Moreover, by the same reason as above, removing 2 and reducing will not effect τ 2 -match at other position.
After removing 2 and reducing, the position of 1 is still at ℓ. Thus, this case contribute x(n−k −1)P n−1,τ2,k (x).
In total, we have Note that the first case vanishes when k = 1, but the formula is still correct as it contributes an empty summation. The second case vanishes when k = n. The formula is still correct as P n−1,τ2,n (x) = 0. The last case vanishes when k = n − 1, n. When k = n − 1, the formula is correct as n − k − 1 = 0. When k = n, the formula is correct as P n−1,τ2,n (x) = 0.
It is easy to see that P 1,τ1,1 (x) = 1 = P 1,τ2,1 (x). Since, P n,τ1,k (x) and P n,τ2,k (x) satisfy the same recursive formula and have the same initial values, we prove that P n,τ1,k (x) = P n,τ2,k (x) for all n, k such that 1 ≤ k ≤ n, and thus P n,τ1 (x) = P n,τ2 (x) for all n ≥ 1. Hence, we prove Theorem 2.
θ satisfies the properties for S 1 and S 2 . For S n+1 where n ≥ 2, we define the map recursively. Given σ ∈ S n , we have σ ′ = θ(σ). We know that the position of 1 in σ is the same as the position of 1 in σ ′ . Let k be the position.
Here, we obtain an elementσ ∈ S n+1 by applying one of the following: 1. Increase every element by 1, and insert 1 at or after position k + 1.
2. Increase every element except 1 by 1, and insert 2 at or after position k + 1.
Then, we obtain θ(σ) by applying similar action to σ ′ based on an action applied to σ: 1. If 1 was inserted to σ, then increase every element in σ ′ by 1 and insert 1 at the same position as inserted in σ.
2. If 2 was inserted to σ at position r, then increase every element in σ ′ except 1 by 1 and insert 2 at position r ′ where r ′ = r + 1 k + 1 ≤ r ≤ n k + 1 r = n + 1 .
Corresponding positions when inserting 1 or 2 can be viewed from Figure 5 and Firgure 6.  The position of 1 inσ and θ(σ) will be the same. Also, pmp τ1 (σ) would increase by 1 if and only if 2 was inserted at a non-last position, while pmp τ2 (σ ′ ) will increase by 1 if and only if 2 was inserted at any position but k + 1. Thus, pmp τ1 (σ) = pmp τ2 (θ(σ)). Also, it is not hard to see that every σ ∈ S n can be obtained by inserting 1 or 2 repeatedly in a unique way. Therefore, θ is a bijection.
As an example, we start with θ(12) = 12. Say, we would like to insert 2, then the diagram looks like 1 2 1 2 .
Suppose we insert 2 to the preimage 12 at the last position, so then get 132. According to the diagram, we should insert 2 to the image 12 at the first position, so we get 123. Thus, θ(132) = 123. Here, suppose we would like to insert 1, then the diagram looks like: Suppose we insert 1 to 132 at the first position, then we get 2143. According to the diagram, we insert 1 to 123 at the same position, so we get 2134. Thus, θ(2143) = 2134. Now, suppose we want to insert 2. The diagram looks like: Suppose we insert 2 to 2134 at the second position, so we get 31245. According to the diagram, we insert 2 to 2143 at the last position, so we get 31542. Thus, θ(31245) = 31542.
Below are enumerations of P n,123 (x) for the first few n.
In this section, we present numerical results suggesting that there are 10 equivalent classes in S * 4 . We then will show that the following patterns are equivalent: 1234, 1243, 2134, 2143.

Numerical data
Here, for each pattern τ shown in Figure 4, we enumerate polynomials P n,τ (x) for small n. We also group patterns together if they seem to provide the same polynomials.

Diagrams of 2134 and 1243
The equivalence of 1234 and 2134 as well as the equivalence of 1243 and 2143 follow a more general Theorem 3. Thus, in this section, we only prove the equivalence of 1234 and 1243.
Theorem 22. Two P M P s 1234 and 1243 are P M P -Wilf-equivalent.
Proof: First, consider the formula for P n,τ1,s,t (x) when 1 ≤ t < s ≤ n − 1. Let ℓ be the position of 2 in σ, where σ ∈ S n with the last ascent of σ at position s and 1 at position t. We have 4 cases: In this case, we can remove 1 from σ without effecting a τ 1 -match at other positions. That is because σ does not have a τ 1 -match at the position of 2, and if σ has a τ 1 -match at other positions and matching involves 1, it can still have a τ 1 -match by using 2 instead of 1.
After removing and reducing, the position of 1 is ℓ, and the position of the last ascent is s − 1. Thus, this case contributes t−1 ℓ=1 P n−1,τ1,s−1,ℓ (x).
In this case, σ has a τ 1 -match at position ℓ since 1 2 σ s σ s+1 form the pattern τ 1 . By the same reasoning as the first case, we can remove 2 without effecting τ 1 -match at any other positions.
After removing and reducing, the position of 1 stays at t and the position of the last ascent is s − 1. Thus, this case contributes x(s − 1 − t)P n−1,τ1,s−1,t (x).
3. ℓ = s. In this case, we can remove 2 without effecting a τ 1 -match at other positions.
After removing and reducing, the position of 1 stays at t and the last ascent appears at some position between t and s − 1. Thus, this case contributes s−1 j=t P n−1,τ1,j,t (x).
4. ℓ = n. In this case, we can remove 2 without effecting a τ 1 -match at other positions. After removing and reducing, the position of 1 stays at t and the position of the last ascent stays at s. Thus, this case contributes P n−1,τ1,s,t (x).
Note that, the first case vanishes if t = 1, but the formula is consistent as it contributes an empty summation. The second case vanishes when t = s − 1, but the formula is still correct as P n−1,τ1,s−1,s (x) = 0. The last case vanishes when s = n − 1, but the formula is correct as P n−1,τ1,n−1,t (x) = 0. Thus, we prove the first formula.
Here, we derive a recursive formula for P n,τ1,s,s (x) when 1 ≤ s ≤ n − 1. Given any σ ∈ S n such that the position of 1 and the position of the last ascent is s. Removing 1 does not effect a τ 1 -match at other positions. After removing and reducing, the permutation either has no ascent, or the last ascent is at some position between 1 and s − 1. Thus, we have Lastly, we derive a formula for P n,τ1,s,n (x) when 1 ≤ s < n − 1. Given any σ such that the position of the last ascent is s and 1 is at the last position. Removing 1 will not effect τ 1 -match at other positions. The position of the last ascent is still s. Thus, we have P n,τ1,s,n (x) = P n−1,τ1,s (x).
We shall prove similar result for 1243. Let τ 2 = 1243. Let P n,τ2,s (x) = σ x pmpτ 2 (σ) , where the sum is over all σ ∈ S n with the last descent of σ at position s. Let P n,τ2,s,t (x) = σ x pmpτ 2 (σ) , where the sum is over all σ ∈ S n with the last descent of σ at position s and 1 at position t. All feasible values of s are 1, 2, . . . , n − 1. All feasible values of t are t = 1, 2, . . . , s − 1 and s + 1. Note that, when s = 1, the only possible value for t is 2. Thus, we have P n,τ2 (x) = 1 + n−1 s=1 P n,τ2,s (x).
Proof: First, consider the formula for P n,τ2,s,t (x) when 1 ≤ t < s ≤ n − 1. Let ℓ be the position of 2 in σ, where σ ∈ S n with the last descent of σ at position s and 1 at position t. we have 4 cases: In this case, σ does not have a τ 2 -match at position ℓ. We can remove 1 from σ without effecting τ 2 -match at other positions. That is because if σ has a τ 2 -match at other positions and the matching involves 1, it still has a τ 2 -match by using 2 instead of 1.
After removing and reducing, the position of 1 is ℓ and the position of the last descent is s − 1. Thus, this case contributes t−1 ℓ=1 P n−1,τ2,s−1,ℓ (x).
2. t + 1 ≤ ℓ ≤ s − 1. In this case, σ has a τ 2 -match at position ℓ since 1 2 σ s σ s+1 form the pattern τ 2 . By the same reasoning as the first case, we can remove 2 without effecting τ 2 -match at any other positions.
After removing and reducing, the position of 1 stays at t and the position of the last descent is s − 1. Thus, this case contributes x(s − 1 − t)P n−1,τ1,s−1,t (x).
3. ℓ = s. In this case, we can remove 2 without effecting τ 2 -match at other positions.
After removing and reducing, the position of 1 stays at t and the last descent appears at some position between t + 1 and s, or at the position t − 1 (right before 1). Thus, this case contributes s j=t+1 P n−1,τ2,j,t (x) + P n−1,τ2,t−1,t (x).
Note that, the first case vanishes if t = 1, but the formula is consistent as it contributes an empty summation. The second case vanishes when t = s − 1, but the formula is still correct as P n−1,τ2,s−1,s (x) = 0. The last case vanishes when s = n − 1, but the formula is correct as P n−1,τ2,n−1,t (x) = 0. Thus, we prove the first formula.
Next, we derive the recursive formula for P n,τ2,s,s+1 (x) for 1 ≤ s ≤ n − 1. Given any σ ∈ S n such that the position of the last descent is s and the position of 1 is s + 1. Removing 1 will not effect τ 2 -matching at other positions. After removing and reducing, the remaining permutation either has no descent, or the last descent is at some position between 1 and s. Thus, we have P n,τ2,s,s+1 (x) = 1 + s i=1 P n−1,τ2,i (x).
Thus, we prove the second formula.

Proof:
First of all, P n,τ1,t,t (x) = P n,τ2,t−1,t (x) by Lemma 23 and 24. As a result, P n,τ1,s,t (x) and P n,τ2,s,t (x) have the same recursive formula for 1 ≤ t < s. Then, we proceed to prove the lemma as follows.
We end this section here by introducing collections of patterns that are likely to be equivalent to one another, but we do not yet have a proof. According to numerical values generated, we guess that 1234, 1432 and 1243 are all equivalent to one another. Also, 1342 and 2413 are likely to be equivalent. Diagrams of mentioned positional marked patterns are shown in Figure 8 and   In this section, we restate and prove an equivalence of a collection positional marked patterns of arbitrary length mentioned in Section 1.
We will prove that P 1 and P 2 are P M P -Wilf-equivalent. The equivalence of P 1 and P 3 follows from the fact that P 1 and P 2 are equivalent. Here, we apply the technique introduced in Babson and West (2000) to prove the equivalence of P 1 and P 2 . First, we need to give several definitions. Let τ = red(p 1 p 2 . . . p ℓ−2 ).
Definition 26. Given π ∈ S n . Consider the diagram of π. For each cell (i, j) in the diagram of π, the cell is dominant if there is an occurrence of τ in the diagram of π when only considering row i + 1, i + 2, . . . , n and columns j + 1, j + 2, . . . , n. A cell is non-dominant if it is not dominant.
It is clear that given any dominant cell, every cell to the left and below the dominant cell is also dominant. Thus, the collection of dominant cells form a Ferrers board.
Let N D(π) = {(i, j) ∈ [n] × [n] | cell (i, j) is non-dominant and contains ×}. Note that, if a cell is dominant, then one could find an occurrence of τ above and to the right of the cell such that all × involved are in non-dominant cell. If not, then every occurrence of τ above and to the right of the cell (i, j) contains × in a dominant cell. Pick a copy T 1 of τ in which a dominant cell (i ′ , j ′ ) containing × is the rightmost among all dominant cells containing × in all copies of τ above and to the right of (i, j). Since cell (i ′ , j ′ ) is also dominant, one can find a copy T 2 of τ above and to the right of (i ′ , j ′ ), which is also above and to the right of cell (i, j). Thus, this copy will also contain a dominant cell containing ×, contradicting to the fact that the T 1 contains the rightmost dominant cell.
Thus, if N D(π) is known, one can recover the set of dominant cells in the diagram of π completely. Given any Q ⊆ [n] × [n], let S Q n = {π ∈ S n |N D(π) = Q}. We shall prove that Here, we analyse the set S Q n . First, we only need to consider those Q such that S Q n = ∅. Given any such Q, we can obtain an element in S Q n by filling × in the dominant part of the diagram until every row and column contains precisely one ×. This gives all elements in S Q n since filling × in the dominant part does not alter whether a cell is dominant or non-dominant.
To fill × in dominant cells, we start with all dominant cells and eliminate all rows and columns that already contain × from the set Q. The remaining cells form a Ferrers board. Let λ(Q) denote the shape of the Ferrers board obtained from the process above.
In order for λ to have a filling, the number of rows of λ must be the same as the number of columns in λ. More specifically, if λ = (λ 1 , λ 2 , . . . , λ k ), λ has a filling if and only if (k − i + 1) ≤ λ i ≤ k for all k. Let S λ denote the set of fillings of λ.
Given any π ∈ S λ , and p ∈ S k , we say that π contains p if π contains a subdiagram of p. Note that, in order for π to contain p, the entire diagram of p has to present as a subdiagram of π including cells not containing ×. For example, the filling below contains p = 12 but does not contain q = 21.

× × × ×
Here, we define positional marked pattern on S λ similar to S n . Given any π ∈ S λ and p ∈ S * k , we say that π has a p-match at position t if when replacing × in the t-th column of π of by •, then it contains a subdiagram p. For example, the diagram above has a 12-match at position 3 as shown below.

× × × •
Let pmp p (π) denote the number of positions t such that π has a p-match at position t. Here, we state a lemma which will be our main tool to prove Theorem 3. x pmp12(π) and π∈S Q n x pmpP 2 (π) = π∈S λ (Q) x pmp21(π) .
Proof: Note that there is a natural bijection φ : S λ(Q) → S Q n which maps any filling π ∈ λ(Q) to a permutation with non-dominant part corresponding to Q and dominant part having the same filling as π. We will show that π has a 12-match at a position if and only if φ(π) has a P 1 -match at the corresponding position according to the map φ The converse is obvious. For the forward direction, suppose π ∈ S λ(Q) has a 12-match at a certain position. Thus, the corresponding position in φ(π) has a 12-match with every cells involved are dominant. Thus, we can find a copy of τ above and to the right of every cells involved in 12-match. Therefore, the 12-match together with τ makes φ(π) P 1 -match at the position corresponding to the 12-match in π.
Therefore, φ is a bijection between S λ(Q) and S Q n such that pmp 12 (π) = pmp P1 (φ(π)). Thus, it proves the first equality of the lemma. The second equation can be proved with the exact same reasoning.
As an example, let n = 9, τ = 12, (so P 1 = 1234 and P 2 = 2134), and Q is as below With Q, we recover dominant and non-dominant cells. We fill • in non-dominant cells as below Here, in order to prove theorem 3, we only need to prove that, given any Ferrers board λ, π∈S λ x pmp12(π) = π∈S λ x pmp21(π) . In fact, we find a formula for both polynomials.
To prove the equation above, we consider the topmost row in λ. The filling has a 12-match at the position of × in the topmost row if and only if × is not in the rightmost possible cell. So, there are λ k − 1 positions to fill × so that it has a 12-match, and 1 position otherwise. Once the top row is filled, we consider filling the rest of λ by remove the top row and the column containing ×. The remaining cells form a shape λ. Thus, the equation above is proved.
For the pattern 21, a similar reasoning can also be applied. The filling of λ has a 21-match at the position of × in the topmost row if and only if × is not in the leftmost possible cell. Hence, we have Therefore, we proved the lemma.
Here, we prove the main theorem: Proof: (of Theorem 3) Note that S n is a disjoint union of S Q n for all Q such that S Q n = ∅. So, we have Thus, P 1 and P 2 are P M P -Wilf-equivalent. To see that P 1 = 12p 1 . . . p n−2 and P 3 = 21p 1 . . . p n−2 , Let P inv 1 and P inv 3 be positional marked patterns obtained from P 1 and P 3 by reflecting diagram of P 1 and P 3 along the diagonal y = x respectively. By Lemma 7, P 1 and P inv 1 are P M P -Wilf-equivalent, and so are P 3 and P inv 3 . However, P inv 1 has the form 12q 1 . . . q n−2 and P inv 3 has the form of 21q 1 . . . q n−2 , thus P inv 1 and P inv 3 are P M P -Wilf-equivalent by the main argument above. Therefore, P 1 and P 3 are P M P -Wilf-equivalent.