Wilf-classification of mesh patterns of short length

This paper starts the Wilf-classification of mesh patterns of length 2. Although there are initially 1024 patterns to consider we introduce automatic methods to reduce the number of potentially different Wilf-classes to at most 65. By enumerating some of the remaining classes we bring that upper-bound further down to 56. Finally, we conjecture that the actual number of Wilf-classes of mesh patterns of length 2 is 46.


Introduction
Let n be a non-negative integer. A permutation is a bijection from the set t1, 2, . . . , nu to itself. The permutation that maps i to π i will be written as the word π " π 1 π 2¨¨¨πn . For example, π " 1324 is the permutation of the set t1, 2, 3, 4u with π 1 " 1, π 2 " 3, π 3 " 2 and π 4 " 4. Let S n be the set of all permutations of length n.
A (classical permutation) pattern is a permutation p P S k . The pattern 312 P S 3 can be drawn as follows, where the horizontal lines represent the values and the vertical lines denote the positions in the pattern.

"
We say that a pattern p occurs in a permutation π P S n if there is a subsequence of π whose letters are in the same relative order of size as the letters of p. This sequence is called an occurrence of the pattern p in the permutation π. If a pattern occurs in a permutation we say that the permutation contains the pattern. For example, the permutation 25134 contains the pattern 312 as the subsequence 534. The diagram below shows the permutation where points corresponding to the occurrence of the pattern have been circled.

"
A permutation that does not contain a pattern is said to avoid the pattern. For example, a permutation π P S n avoids the pattern 231 if there do not exist 1 ď i ă j ă k ď n with πpkq ă πpiq ă πpjq. An example of a permutation that avoids the pattern 231 is the permutation 51423.

"
One of the primary questions in the theory of permutation patterns is that of Wilf-equivalence: Given two patterns p and q, is the number of avoiding permutations in S n the same for both patterns? Patterns for which the answer is "yes" are called Wilf-equivalent. A Wilf-class is a maximal set of patterns (necessarily of the same length) that are all Wilf-equivalent.
The process of sorting patterns into classes by Wilf-equivalence is called Wilf-classification. Classical patterns of length 3 were Wilf-classified by Knuth [8], who showed that the number of permutations avoiding each classical pattern of length 3 is given by the Catalan numbers. Permutations avoiding more than one pattern have also been studied. Simion and Schmidt [10] Wilf-classified all sets of classical patterns of length 3.
The purpose of this paper is to start the Wilf-classification of mesh patterns. Mesh patterns, whose definition we review below, provide a common extension of several previous generalizations of classical patterns. We show that the 16 mesh patterns of length 1 belong to 4 different Wilf-classes. The classification of the 1024 mesh patterns of length 2 would be impossible to to by hand without resorting to the usual D 8 symmetries of patterns. This however only brings the number of patterns down to 186. In Lemma 3.11 we prove when a shading can be added to a mesh pattern. This cuts the number of patterns in half, down to 87. Two other operations allow us to bring that number down to 65. We then use conventional tools of combinatorics, like generating functions, bijective maps, etc., to achieve the upper bound of 56 on the number of Wilf-classes. We conjecture that the actual number of classes is 46.

An overview of generalized patterns
Several generalizations of classical patterns have been introduced. The first extension relevant to us are vincular patterns, defined by Babson and Steingrímsson [2]. These patterns can require letters in a permutation to be adjacent. For example the pattern requires the letters corresponding to 1 and 3 in a permutation to be adjacent. Graphically this means that no points can be in the shaded area. This pattern occurs in the permutation

"
because 53124 contains the classical pattern 213 as the subsequence 324 and because the letters in the permutation that correspond to 1 and 3 in the pattern, i.e., 2 and 4, are adjacent in the permutation.
The permutation 52314 avoids the pattern , since the only occurrence of the classical pattern 123 is the subsequence 234 and the letters 3 and 4 are not adjacent in the permutation.

"
Vincular patterns of length 3 were Wilf-classified by Claesson [6]. He showed that the number of permutations avoiding eight of the vincular patterns is given by the Bell numbers and the remaining four give the Catalan numbers. Several of his results are a consequence of Lemma 3.11 below.
Bivincular patterns are a natural extension of vincular patterns where we may also put constraints on the values in a permutation. Bivincular patterns where first introduced by Bousquet-Mélou et al. [3]. The pattern p " requires the letters corresponding to 1 and 3 in a permutation to be adjacent in position and the letters corresponding to 2 and 3 in a permutation to be adjacent in size. The permutation 14253 " contains the pattern p because it contains the classical pattern 132 as the subsequence 143 and letters 1 and 4 are adjacent in position and letters 3 and 4 are adjacent in size. On a diagram, we observe that there are no points in the shaded areas.

"
However the permutation 12543 contains one occurrence of the classical pattern 132 as the subsequence 253 but 5 and 3 are not adjacent in size, so that is not an occurrence of the bivincular pattern.

"
Bivincular patterns of length 2 and 3 were Wilf-classified by Parviainen in [9]. Some of his results are a consequence of Lemma 3.11 below.
Mesh patterns where first introduced by Brändén and Claesson [4], as a further extension of bivincular patterns, that also subsumes barred patterns 1 [14], and interval patterns [15]. A pair pτ, Rq, where τ is a permutation in S k and R is a subset of 0, k ˆ 0, k , where 0, k denotes the interval of the integers from 0 to k, is a mesh pattern of length k.
Let vi, jw denote the box whose corners have coordinates pi, jq, pi, j`1q, pi1 , j`1q and pi`1, jq. An example of a mesh pattern is the classical pattern 312 along with R " tv1, 2w, v2, 1wu. We draw this by shading the boxes in R The permutation 521643 contains this pattern, see below

"
The permutation has an occurrence of the mesh pattern as the subsequence 514, since it forms the classical pattern 312 and there are no points in the shaded areas.
Let's now look at the permutation π " 32145. This permutation avoids the pattern p123, tv0, 1w, v1, 0w, v2, 2wuq " , because for all occurrences of the classical pattern 123 there is at least one point in at least one of the shaded boxes. For example, the subsequence 245 in π is an occurrence of the classical pattern 123 but not of the mesh pattern since the point representing 1 is in one of the shaded areas. This can be seen on the following diagram.

Operations preserving Wilf-equivalence
The number of mesh patterns of length n is n!¨2 pn`1q 2 so already for n " 2 we have 1024 patterns. This makes the Wilf-classification impossible to do by hand. We therefore review known operations (or symmetries) that preserve Wilf-equivalence as well as introducing new ones. This will allow us to automatically bring the number of patterns to consider down to 65.
The first known operations are the symmetries reverse, complement and inverse. For a given mesh pattern pτ, Rq of length n, we define pτ, Rq r " pτ r , R r q, pτ, Rq c " pτ c , R c q, pτ, where τ r is the usual reverse of the permutation τ , τ c the usual complement, τ i the usual inverse, and R r " tvn´x, yw : vx, yw P Ru, R c " tvx, n´yw : vx, yw P Ru, R i " tvy, xw : vx, yw P Ru.
Hence, reverse is a reflection around the vertical center line, complement is a reflection around the horizontal center line and inverse is the reflection around the southwest to northeast diagonal. Figure 1 is an example of the use of these symmetries on the pattern p " p312, tv0, 1w, v1, 3w, v2, 2wuq. It Figure 1. Several symmetries of a mesh pattern is well-known that a permutation π avoids a mesh pattern p if and only if the permutation π r avoids p r . That is, the reverse operation preserves Wilf-equivalence. The same applies for complement and inverse or any composition of these three operations. We now define the first of the new operations.
Definition 3.1. Let π be a permutation (or a classical pattern) of length n.
Let p " pτ, Rq be a mesh pattern of length n. We define the toric-shift of p as the pattern p t " pτ t , R t q, where R t " tva`pn`1´ℓq mod pn`1q, b`1 mod pn`1qw : va, bw P Ru.
Here ℓ is the position of the letter n in the classical pattern τ . Example 3.6. This example shows the effect of toric-shift on a mesh pattern of length 6. toric´shif t ÝÑ Observation 3.7. Let p " pτ, Rq be a pattern of length n where the top line is shaded, that is tp0, nq, p1, nq, . . . , pn, nqu Ď R. Recall from Ulfarsson [13] that a permutation π avoids p if and only if π t avoids p t . That is, toric-shift preserves Wilf-equivalence for this kind of pattern.
Definition 3.8. Two mesh patterns p and q are said to be equivalent, denoted by -, if for any permutation π, π avoids p if and only if π avoids q.
Equivalent patterns are obviously Wilf-equivalent.
Observation 3.9. Let R 1 Ď R. Then any occurrence of pτ, Rq in a permutation is an occurrence of pτ, R 1 q.
The next example will be generalized below into a powerful lemma that allows adding more shaded boxes to a mesh pattern, while maintaining the equivalence with the original pattern. . Let u be the point p1, 1q and v the point p2, 2q. We claim that the mesh pattern q " p12, tv0, 0wuq " is equivalent to p. Because of Observation 3.9 it suffices to show that if a permutation contains p it also contains q. Let π be a permutation that contains p and consider a particular occurrence of it. Let k be the number of points in the box v0, 0w in π. If k " 0, it is clear that π contains q as well. If k ě 1, then we can choose the leftmost (or the lowest point), call it d, in the box v0, 0w and replace u with d. It is clear that the subsequence ud satisfies the requirements of the mesh in q. This can be interpreted as shading the box v0, 0w. Figure 2 shows an example of this equivalence. In the left image in the figure, the pattern p can be found with the points (7, 5) as u and (8,8) as v. There are points in the area at the lower left of u and the circled point, (2,2), is the leftmost point in that area, and thus we denote that point as d. In the right image, point v is still (8,8) but now u has been replaced with d.
This example generalizes to a new operation, introduced in Lemma 3.11, which preserves equivalence of mesh patterns.   Figure 3. If the condition of the lemma are satisfied the box vi, jw can be shaded.
Proof. In this proof we assume that the box vi´1, jw is not in R. According to Observation 3.9 we know that if a permutation π contains the pattern q " pτ, R Y tvi, jwuq, it also contains the pattern p " pτ, Rq. Now we show that if a permutation π contains the pattern p it also contains the pattern q. Assume we have a particular occurrence of p in π so the pattern point pi, jq corresponds to a particular point pi 1 , j 1 q in π and the box vi, jw corresponds to a certain region K in π containing k points. If k " 0 then we have an occurrence of q. If k ě 1 then let pi 2 , j 2 q be the rightmost 2 point in the region K. This amounts to shifting the line x " i 1 to the line x " i 2 and the line y " j 1 to the line y " j 2 . While we have now an empty region in the permutation corresponding to the box vi, jw in the pattern we need to make sure we have not violated any of requirements of the mesh R. The shifting of the lines has the following effect on the other neighboring boxes of the point pi, jq: ‚ The box vi´1, jw is shrunk from below, but extended to the right. It might contain extra points after the shifting, but that does not matter since it is not shaded. ‚ The box vi´1, j´1w is extended up and to the right. It now contains the point pi 1 , j 1 q (and possibly others) but this box is not a part of the shading, because of requirement (1). ‚ The box vi, j´1w is shrunk from the left and extended up, but since we choose pi 2 , j 2 q as the rightmost point in K we can be sure that this box is empty. The effect on the rest of the mesh is as follows: ‚ Every box vℓ, jw (ℓ ‰ i´1, i) is shrunk (from below) and any empty box is still empty. In particular every shaded box can remain shaded. (3) in the lemma ensures that a shaded box remains empty. ‚ Every box vi, ℓw (ℓ ‰ j, j´1) is shrunk (from the left) and any empty box is still empty. In particular every shaded box can remain shaded. ‚ Every box vi´1, ℓw pℓ ‰ j, j´1) is extended into the previous vi, ℓw box. Requirement (4) in the lemma ensures that a shaded box remains empty.
We note that a related result was independendly proved by Tenner [12, Theorem 3.5'] which determines when a mesh pattern is equivalent to the underlying classical pattern.
Example 3.12. By using Lemma 3.11 the following equivalence can be found. The point that the arrow is pointing from is the point pi, jq in the lemma.

--
First we can shade the box v1, 1w because when choosing the rightmost (or the topmost point) in that box, both of the shaded boxes, v1, 2w and v2, 1w, will not be extended. When shading the box v2, 2w we choose the leftmost (or the lowest point) and the same applies as before. Notice that the point p1, 1q and the box v1, 0w do not fulfill the condition of the lemma since the box v2, 1w is shaded but the box v2, 0w is not.

--
We can shade the box v0, 5w by choosing the leftmost (or the topmost point) in the box, because none of the shaded boxes touching the lines x " 0 or y " 5 will be extended by this. We can also shade the box v3, 3w by choosing the rightmost (not the topmost point!). This is because the shaded boxes touching the lines x " 3 and y " 3 will either not be extended, boxes v0, 3w and v3, 5w, or are extended into a shaded area, box v2, 5w. However when trying to shade box v1, 0w, box v4, 1w would have to be extended into a nonshaded area. Therefore box v1, 0w cannot be shaded.
We record one more new operation that preserves Wilf-equivalence in Appendix A since it is only useful for patterns of length three or more. In this section we look at the Wilf-classification of mesh patterns of length 1 and 2.

Wilf-classes
The number of mesh patterns of length 1 is 2¨2 3 " 16. The operations from above suffice to sort these 16 patterns into 4 Wilf-classes. Below is one representative from each class.
Occurrences of these patterns in a permutation are well-known. Each occurrence of the first pattern in a permutation π is a left-to-right maximum. An occurrence of the second pattern in a permutation π is a strong fixed point in π.
Observation 4.2 (Stanley [11]). For reference we record the generating function for the number of permutations without fixed points is Both left-to-right maxima and strong fixed points in connection to mesh patterns were introduced by Brändén and Claesson [5]. All permutations of length n that contain the third pattern begin with n. There is only one permutation that contains the last pattern, namely 1.
The number of mesh patterns of length 2 is 2 10 " 1024. We start by creating 1024 Wilf-subclasses, one for each of the patterns. By using the operations above many of these subclasses merge. More precisely, the operations reverse, complement and inverse preserve Wilf-equivalence so after merging we arrive at 168 Wilf-subclasses. When further using the shading lemma this number decreases to 87 and finally when taking into account the toric shift and the up-shift we arrive at 65 Wilf-subclasses.
Below we further reduce this number to 56 by combining some of the above classes. We conjecture that the actual number of Wilf-classes is 46.

4.1.
The Wilf-class containing classical patterns. Here we will bring the number of Wilf-subclasses down to 62 by merging four Wilf-subclasses, represented by the patterns shown in Table 1.
Nr. Repr. p |S n ppq| for n " 1, . . . , 9 # of patts. in Wilf-subclass Because of Observation 3.9 it suffices to show that a permutation containing the classical pattern 12 also contains the last pattern in Table 1. But this follows from the fact that a permutation contains the pattern 12 if and only if it contains at least two left-to-right maxima; and the last pattern in the table consists of the first and last of these maxima.
There are no other Wilf-subclasses that have the same number of avoiding permutations of length n " 1, . . . , 9 as this one so it can not be enlarged further. This result is shown in Table 2. It is worth noticing that over 1{10th of length 2 mesh patterns lie in this class.

4.2.
Wilf-classes containing vincular patterns. In this section we will deal with subclasses that contain vincular patterns and subclasses that can be merged with them. These subclasses are shown in Table 3. We will bring Repr. p |S n ppq| # of patts. in Wilf-class OEIS seq.

1
126 A000012   Proof. We only prove part (2) as the others are similar. Let π be a permutation that does not end with 1. Let a be the last element of π and let b " a´1, which is somewhere to the left of a in π. It is easy to see that the letters ab form an occurrence of the pattern. Clearly if π ends with 1 it can not contain the pattern.
Recall that rx n sf pxq denotes the coefficient of x n in the power series expansion of the function f pxq. pk`1q n x k " E n pxq p1´xq n`1 , see for example [7]. It is well-known that the Eulerian numbers, T n,k " rx k sE n , can also be defined recursively by T n,k " k¨T n´1,k`p n´k`1q¨T n´1,k´1 , T 1,1 " 1. Table 5 we find the distribution of descents and use it to find the enumeration. Proof. In order to construct all permutations of length n we can take each permutation in S n´1 and place n in every possible position. Let π 1 be a permutation obtained by adding the letter n to π, where π is a permutation in S n´1 which contains the pattern p. Then there exist i ă j where the only letter lower than πpjq in positions 1, 2, . . . j´1 is πpiq. From this it follows that we can add the letter n to any position in the permutation π for π 1 to still satisfy these conditions and therefore contain the pattern p. Now let π be a permutation in S n´1 that avoids p. Then for all i ă j with πpiq ă πpjq there are at least two letters in places 1, 2, . . . j´1 lower than πpjq. In order to get a permutation of length n that also avoids p we can add the letter n in all positions except between the letters πp1q and πp2q. By adding the letter n between the letters πp1q and πp2q we produce an ascent where the letter n has only one letter to the left of it and therefore π 1 would contain the pattern p. However by adding the letter n in all other positions does not produce an ascent or it produces an ascent that has more than one letter to the left of it and therefore π 1 avoids the pattern p. Since we are not allowed to add the letter n between the letters πp1q and πp2q, it follows that all permutations in S n p q start with a descent. We let B n pxq be the distribution for the number of descents in permutations of length n avoiding p, i.e., B n pxq " ÿ πPSnp q

Instead of just enumerating avoiders of the fourth and fifth pattern in
x despπq , and R n,k " rx k sB n pxq.
In order to construct a permutation π of length n with k descents, we have two choices. We can either take a permutation of length n´1 with k descents and add n to it without changing the number of descents or take a permutation of length n´1 with k´1 descents and increase the number of descents by one by adding n to it. By adding n between two letters making up a descent we do not change the number of descents. If we add n in any of the other position we increase the number of descents by one. Above we have shown that we can add the letter n to a permutation of length n´1 that avoids p in every position except between the first two letters of the permutation. We have also shown that every permutation avoiding p begins with a descent. From this it follows that R n,k " pk´1qR n´1,k`p n´k`1qR n´1,k´1 .
We claim that B n pxq " xE n´1 pxq, or equivalently R n,k " T n´1,k´1 . We will prove this by induction. For n " 2 we have B 2 pxq " x 1 and E 1 pxq " x 0 , so R 2,1 " 1 and T 1,0 " 1. Hence, the claim holds for the base case. Now we assume that R N,k " T N´1,k´1 holds for all N ă n and all k. By Definition 4.4, we have R n,k " pk´1qR n´1,k`p n´k`1qR n´1,k´1 " pk´1qT n´2,k´1`p n´k`1qT n´2,k´2 (by induction hypothesis) " T n´1,k´1 .
Thus, the claim holds for all n. It is well-known that ř n´1 k"0 T n´1,k " pn´1q! and therefore the number of permutations of length n avoiding p is pn1 q!.
The proof of the next proposition is analogous to the previous one, but instead of considering where n can be added to a permutation we consider where 1 can be added (and the rest of the values raised by 1).     Table 3 have the same enumeration.
pn´1q! 232 A000142 n!{2, n ě 2 80 A001710 n!, n ě 3 2 A000142 (n ě 3) Table 4. Wilf-classes containing vincular patterns 4.3. Wilf-classes containing bivincular patterns. Here we will deal with Wilf-subclasses that contain bivincular patterns and other subclasses that can be merged with them. The subclasses are shown in Table 5. We will bring the number of subclasses down to 57 by combining the last two subclasses.
Formulas for the number of permutations avoiding patterns in the first three subclasses were found by Parviainen [9]. Computer experiments show that these subclasses can not be enlarged further. He also shows that the Nr. Repr. p |S n ppq| for n " 1, . . . , 9 # of patts. in Wilf-subclass The following proposition shows the last subclass in the table can be merged with the third one.
Proposition 4.9. A permutation π avoids the pattern p " if and only if each ascent in π is the 12 of a 312 pattern or the 13 of a 213 pattern, or both. IfˇˇˇS n´¯ˇ" a n then a n " pn´1qa n´1`p n´2qa n´2 and a 0 " a 1 " 1. Furthermore a n " n ÿ k"0 p´1q k pn´k`1q n! k! .
Proof. We leave the characterization in terms of ascents to the reader, as well as the last formula for a n . Let A n be the set of all permutations that avoid p and a n be the size of A n . Now, let A n,k " tπ P Apnq|πpnq " ku. For k ‰ n we define a mapping ϕ k : A n,k Þ Ñ A n´1 such that for a permutation π, the mapping removes k from π and then subtracts 1 from all letters larger than k. Then we can also define ϕ´1 k : A n´1 Þ Ñ A n,k to be the mapping that appends k to the end of a permutation π and then adds 1 to all letters that are equal to k or larger. For k " n we also have a mapping ϕ n : A n,n Þ Ñ A n´1 zA n´1,n´1 such that for a permutation π where the last letter is n, the mapping removes n. The range of the mapping is A n´1 zA n´1,n´1 because if ϕpπqpnq " n´1 then π would end with pn´1qn which is an occurrence of the pattern p. It is easy to see that the inverse is ϕ´1 n " A n´1 zA n´1,n´1 Þ Ñ A n,n ; the mapping that appends n to the end of a permutation. As explained above, in order to construct all permutations of length n avoiding the pattern A n , we can append n at the end of all permutations of length n´1 except for those ending with the letter n´1. Hence, a n " na n´1´an´1,n´1 .
From the mappings we get a n,n " a n´1´an´1,n´1 which gives a n´1,n´1 " a n´1´an,n . We also have a n,n " pn´2qa n´2 since for producing a permutation from A n,n we take a permutation in A n´2 and append a letter from the set t1, 2, . . . , n´2u to it. Lastly we append n at the end of the permutation. Therefore, a n " na n´1´p a n´1´an,n q " na n´1´an´1`p n´2qa n´2 which is what we wanted to prove.
The results for the bivincular Wilf-classes is shown in Table 6.
In this section we provide formulas for the enumeration of the Wilf-subclasses shown in Table 7. The first seven subclasses have unique enumeration sequences for n ď 9 and can therefore not be enlarged further. The last two subclasses are shown to have the same enumeration in Propositions 4.17 and 4.18. They therefore merge into one Wilf-class. Hence, the number of Wilf-classes is decreased from 57 to 56.
Proposition 4.10. The number of permutations of length n that avoid the pattern p " is Proof. We define two sequences, a n "ˇˇS n´¯ˇa nd b n "ˇˇS n`˘ˇ,  Table 7. Wilf-subclasses not containing bivincular patterns, with a known counting sequence and let us show that (1) a n " b n`bn´1 .
We define a map, ϕ : S n`˘ď S n´1`˘Ý Ñ S n ppq.
The mapping ϕ maps π P S n p q to itself in S n ppq, we know that π avoids , and therefore it also avoids p. For π P S n´1 p q the mapping ϕ appends the letter n after the last letter in π, and we obtain a permutation of length n with the letter n in the n-th position.
The inverse map ϕ´1 : S n ppq ÝÑ S n`˘ď S n´1`c an be defined as follows: For π P S n ppq that ends with the letter n, we remove n and then ϕ´1pπq is in S n´1 p q. For π P S n ppq that does not end with the letter n, π maps to itself in S n p q. The permutation π avoids as well for the following reasons. For a letter u in π that appears to the left of the letter n there must be points in at least one of the shaded areas for π to avoid p. Also for v in π that appears to the right of n then there is at least one point, n, in the upper shaded box. Therefore, π avoids , and hence ϕ´1pπq P S n p q. This proves equation 1.
We define the generating function for a n to be Dpxq " ÿ ně1 a n x n .
The generating function for b n is given in Observation 4.2. Since a n " b n`bn´1 we obtain We now have Dpxq " xA 1 pxq where Apxq " logp1`ř ně1 pn´1q!x n q which implies that Apxq is the logarithmic generating function of a n , i.e., Apxq " ÿ ně1 a n n x n " logp1`ÿ ně1 pn´1q!x n q. Proof. To find an occurrence of the pattern p in a permutation of length n, we must use the first letter in the permutation and the letter n. Then it must also hold that all the letters to the right of n must be greater than the first letter. Thus, the number of permutations containing the pattern p depends on the position of the letter n.
Recall that i is the position of the letter n counted from the right and let k be the size of the first letter. Obviously, the letter n cannot be in the last position counted from the right, and thus, 1 ď k ď n´1 and 1 ď i ď n´1. Now, we choose i´1 letters greater than k to fill the positions to the right of n, which can be done in`n´p k`1q i´1˘w ays. Then these letters can be arranged in pi´1q! ways. The remaining n´i´1 letters will be placed between n and k, which can be done in pn´i´1q! ways. This must hold for each 1 ď k ď n´1. Therefore, the number of permutations containing the pattern p is i´1q!pn´i´1q!.
We have We note that a permutation contains the pattern in the next proposition if and only if it starts with 1 and the remaining letters form a permutation with a strong fixed point. The rest of the proof is left to the reader  is i!pn´1´iq!. ThereforěˇˇS n´¯ˇ" n!´n´2 Proposition 4.14. The number of permutations of length n that start with k and contain the pattern p " is pk´1q!pn´k´1q! and thereforěˇˇS n´¯ˇ" n!´n´1 Proposition 4.15. The number of permutations of length n containing the pattern p, with i as the height of the first point of the pattern p " , counted from above, and ℓ as the distance between the two points, is piĺ q!pn´i´ℓq!ℓ!.
Proposition 4.16. The number of permutations of length n containing the pattern p " with k as the height of the first point of the pattern, counted from above, and j the distance between the two points is j!pk´jq!pn´kq!.

Thus,ˇˇˇS
n´¯ˇ" n!´n´2 The proofs of the next two proposition follow similar arguments as the proof of Proposition 4.9 and are therefore omitted. if and only if each ascent in π is the 23 of a 123 pattern or the 12 of a 312 pattern, or both. If,ˇˇˇS n´¯ˇ" a n then a n " n¨a n´1´an´2 and a´1 " 0, a 0 " 1. if and only if each ascent in π is the 13 of a 213 pattern or the 23 of a 123 pattern, or both. IfˇˇˇS n´¯ˇ" a n then a n " n¨a n´1´an´2 and a´1 " 0, a 0 " 1.  Tables 9 and 10 show the Wilf-subclasses that we have not mentioned before and have a unique enumeration sequence up to and including S 9 . This shows that these subclasses cannot be merged with any other Wilf-subclasses and are therefore Wilf-classes.
Although we are unable to provide a formula for the enumeration of these classes, we do have a conjecture for one of them.
p " The number of permutations of length n avoiding the pattern is the same as the absolute value of the n-th line in column 0 of a triangular matrix given by the formula T pn, kq " n´k ÿ j"0 T pn´k, jq¨T pj`k´1, k´1q 3 for n ě k ą 0 with T p0, 0q " 1 and T pn, 0q "´ř n j"1 T pn, jq for n ą 0. 4.6. The remaining subclasses. In this section we will list all the remaining subclasses. As can be seen in Table 11 some of these subclasses have the same enumeration sequence for n ď 9. We believe those subclasses can be merged so that the final number of Wilf-classes will be 46. We have only been able to find formula for the enumeration of one subclass.   Table 9. Wilf-subclasses not containing bivincular patterns, without a known counting sequence -Part I.
To be able to provide that proof we have to consider invariant set and connected permutations. According to Aguiar and Sottile in [1] the number of permutations of length n with no global descents is given by 1´1 ř n n!x n , which is the same as the number of connected permutations of length n.
Proof of Proposition 4.20. We will show the contrapositive, i.e., that the pattern p occurs in a permutation π if and only if π has an invariant set.
In the pattern p " , let us call the points in the pattern v and w, respectively. If p occurs in a permutation π, then there is no letter to the left of w that is greater than v. Also, there can be no smaller letter than v to the right of w. Hence, if there exist letters a 1 , a 2 , . . . , a k to the left of w, then a 1 , a 2 , . . . , a k are all smaller than v.
On one hand, if ta 1 , a 2 , . . . , a k u " ∅, then v is both the leftmost and the smallest letter in π. Then tvu is an invariant set. On the other hand, if ta 1 , a 2 , . . . , a k u " ∅ then the points a 1 , a 2 , . . . , a k are in the first k positions in π and hence ta 1 , a 2 , . . . , a k , vu is an invariant set.
If π has an invariant set, we know that the lowest k letters in the permutation are in the first k positions. Let us choose the highest letter in the invariant set, and call it v. Then we choose w in position k`1. Now, v and w form the pattern p.

Open questions
We end with three open questions: Nr. Repr. p |S n ppq| for n " 1, . . . , 9 # of patts. in Wilf-subclass (1) What is the actual number of Wilf-classes for mesh patterns of length 2? As mentioned above it is at most 56 but based on computer experiments we conjecture it to be 46.
(2) Suppose p and q are mesh patterns such that |S n ppq| " |S n pqq| for all 1 ď n ď N ; how large does N have to be (as a function of the length of the patterns p and q) to guarantee that p and q are Wilfequivalent? (3) Is there a stronger version of the Shading Lemma (Lemma 3.11) that explains more pattern equivalences, perhaps strong enough to give all the equivalences between the patterns in Table 1.
Example A.4. Here is another example showing the effect of the switch operation S r,id,1 on a mesh pattern of length 6.

ÝÑ
According to Observation A.3 theses two patterns are Wilf-equivalent.