Asymptotic Behaviour of the Containment of Certain Mesh Patterns

We present some results on the proportion of permutations of length $n$ containing certain mesh patterns as $n$ grows large, and give exact enumeration results in some cases. In particular, we focus on mesh patterns where entire rows and columns are shaded. We prove some general results which apply to mesh patterns of any length, and then consider mesh patterns of length four. An important consequence of these results is to show that the proportion of permutations containing a mesh pattern can take a wide range of values between $0$ and $1$.


Introduction
Mesh patterns are a generalisation of permutations patterns, and were first introduced by Brändén and Claesson in [BC11]. A mesh pattern consists of a pair (π, P ), where π is a permutation and P is a set of coordinates in a square grid. For example, (312, {(0, 0), (1, 2)}) is a mesh pattern, which we depict by . Permutations patterns have long been a topic of much interest, primarily due to their links to sorting algorithms, see [Kit11] for an excellent overview of the field. Of particular interest in permutation patterns is the enumeration of the avoidance or containment class of particular permutations. Mesh patterns have been studied extensively since their introduction, see e.g., [AKV13,Ten13,CTU15,JKR15,BGMU19]. The first systematic study of the avoidance of mesh patterns was conducted in [HJS + 15], where enumeration results were given for the avoidance of 25 patterns of length 2. The first study of the distribution of the avoidance of mesh patterns was undertaken in [KZ19], which was further extended in [KZZ20].
In this paper we present some results on the proportion of permutations containing certain mesh patterns as n grows large, that is, the asymptotic behaviour of s + n (p)/n! where p is a mesh pattern and s + n (p) is the number of permutations of length n containing at least one occurrence of p. In particular, does the limit in Expression (1), which we call the containment limit of p, exist and can we compute it?
It is known that in traditional permutation patterns as n grows large the containment limit tends to 1, which gives us our first result for mesh patterns. For any permutation π we get the containment limit lim n→∞ s + n ((π, {})) n! = 1.
Moreover, if p is a mesh pattern where every box is shaded, then it is not possible for a larger permutation to contain p, which gives us our second result lim n→∞ s + n (p) n! = 0.
It is often the case when studying permutation patterns that the asymptotics of such proportions either tend to 0 or 1. So the motivation for this article is to find mesh patterns where the containment limit lies strictly between 0 and 1.
In Section 2 we recall some definitions and notation. In Section 3 we present some formulas for the containment limit of mesh patterns (π, R) for any permutation π, and a fixed type of shading R. In Section 4 we present some formulas for the containment limit for mesh patterns (π, R), where π is a permutation of length four and R is fixed. We finish with some conjectures and further questions in Section 5.

Definitions and Notation
First we recall some definitions concerning permutation patterns. Let [n] := {0, 1, . . . , n} and [m, n] := {m, m + 1, . . . , n}. We consider a permutation π using one line notation, so as a sequence of the numbers in [1, n] and we say the length of π, denoted |π|, is n. Let S n be the set of permutations of length n. We denote the number in the i-th position of π by π i . A permutation σ occurs in a permutation π if there is a subsequence, η, of π whose letters appear in the same relative order of size as the letters of σ. The subsequence η is called an occurrence of σ in π. If no such occurrence exists we say that π avoids σ. For example, 213 occurs as a pattern in 3124 as the subsequence 314, but 3124 avoids 321.
A mesh pattern is a pair (π, R), where π is a permutation of length n and R ⊆ [n] × [n]. We depict a mesh pattern on a grid by putting dots in positions (i, π i ), for all i ∈ [n], and for each coordinate (x, y) ∈ R shade the boxes whose south west corner is (x, y). The length of a mesh pattern is given by |p| = |π|. For example, (3124, {(0, 2), (1, 2), (3, 3)}) is depicted by . Consider a mesh pattern (σ, S) and an occurrence η of σ in π, in the classical permutation pattern sense. If (i, j) is a dot in the plot of σ, let (α η (i), β η (j)) be the corresponding dot in π given by η. Each box (i, j) of S corresponds to a rectangular area in π consisting of the boxes where α η (0) = β η (0) = 0 and α η (|σ| + 1) = β η (|σ| + 1) = |π| + 1. For example, in Figure 1 where η is the occurrence in red, the area corresponding to the box (1, 1) is , that is, not on the boundary. We say that η is an occurrence of the mesh pattern (σ, S) in the permutation π if there is no point in R η (i, j), for all shaded boxes (i, j) ∈ S.

Patterns of general length
In this section we consider results that relate to mesh patterns of any length. We begin with a useful lemma that allows us to construct bounds for the containment limit of p using other mesh patterns.
Proof. Suppose p 2 occurs in τ as the occurrence η. So η is an occurrence of π in the classical sense, and since every shaded block (i, j) of p 1 is also shaded in p 2 we know that there are no points in the areas R η (i, j), for all (i, j) ∈ R 1 . Hence, η is also an occurrence of p 1 . So every permutation that contains an occurrence of p 2 also contains an occurrence of p 1 , which implies s + n (p 1 ) ≥ s + n (p 2 ). Next we consider the case where all boxes are shaded except one row (or column) which is fully unshaded, such as the mesh pattern in Figure 2a.
, that is, we fully shade all rows except row i which is fully unshaded, then for n ≥ k we have Proof. Let 0 ≤ i ≤ k and suppose the i-th row is the one that is not shaded. Then the shading requires that the subword of σ realising the mesh pattern consists of the letters Every permutations contains these letters, so for the mesh pattern to occur, they just need to be permuted correctly. This immediately implies the claim.
, that is, we fully shade all columns except column j which is fully unshaded, then for n ≥ k we have Proof. This follows from Theorem 3.2 by rotational symmetry, that is, if τ contains p thenτ containsp, whereτ andp are obtained by rotating τ and p by 90 degrees.
Combining Lemma 3.1 and Theorem 3.2 gives us a lower bound for the containment limit of boxed patterns. Boxed patterns are mesh patterns where everything is shaded except for the first and last row and the first and last column all of which are completely unshaded, such as the mesh pattern in Figure 2b. Boxed patterns were extensively studied in [AKV13].  In Theorem 3.2 the containment limit is nonzero. We now show that shading one additional square, for example the mesh pattern in Figure 2c, reduces this limit to 0.
that is, we fully shade all rows except row i which has exactly one shaded box, then for n ≥ k we have Proof. Let a = π j when j > 0 and a = π 1 when j = 0. The position of a in any occurrence of p is uniquely determined, since if j = 0, the letter corresponding to a must occur in the first place; if j = k, the letter corresponding to a must occur in the last place; and if 1 ≤ j ≤ k − 1, the letter corresponding to a must appear immediately before π j+1 . This implies that s + n (p) = s + n (p), wherep is the mesh pattern obtained from p by deleting a and unshading (j, i). Sop is a mesh pattern of length n − 1 with all rows shaded except one which is fully unshaded, and the result follows from Theorem 3.2.

Patterns of length four
In this section we consider mesh patterns of length four, with a particular focus on the permutation 2143 and its symmetries. We begin by considering the mesh pattern in Figure 3, where the shaded boxes are exactly the boundary boxes. Proof. Assume π = 2143, the argument for the other permutations is analogous. Note that if p occurs in a permutation σ ∈ S n , the shading tells us that there can be nothing to the left of the 2, nothing to the right of the 3, nothing above 4 and nothing below 1. This means that p can be realised in σ in exactly one way, namely as the subword σ 1 1nσ n , subject to the restriction 1 < σ 1 < σ n < n. Conversely, a subword of this form is an occurrence of the pattern p. Therefore, to calculate s + n (p), it suffices to count how many permutations contain this subword. In a permutation σ of length n, there are n − 2 possible places for 1 and n. Since 1 has to occur before n, we can only choose the two places, leaving us with n−2 2 choices. Similarly, there are n − 2 possible values of σ 1 and σ n and since we must have σ 1 < σ n , this again gives us n−2 2 possibilities. Since there are (n − 4) remaining letters which we can freely permute, we conclude Considering the remaining 20 permutations in S 4 with the same shading leads to a different result: , that is, with the same shading as in Figure 3, but a different choice of permutation. Then, Proof. For each such π, we either have π 1 ∈ {1, 4} or π 4 ∈ {1, 4}. Therefore, if σ ∈ S n has an occurrence of (π, R), the shading then prescribes either an explicit value of σ 1 ∈ {1, n} or of σ n ∈ {1, n}. But fixing one letter in σ already reduces the number of such permutations to (n − 1)!, which is vanishingly small in S n as n → ∞.
The exact enumeration for the mesh patterns in Theorem 4.2 depends on the pattern chosen and we do not pursue it further here.
Next we consider mesh patterns where the shaded boxes are exactly the top and bottom rows and π is any length four permutation. The exact enumeration result depends on whether 2 and 3 are consecutive or not, so there are two cases to treat, see Figures 4 and 5. The limit, however, is the same in both cases.   1. If 2 and 3 do not appear consecutively in π, so p is any of the mesh patterns in Figure 4, then 2. If 2 and 3 do appear consecutively in π, so p is any of the mesh patterns in Figure 5, then In both cases, Proof. First we derive the two enumerative results. The proof proceeds by splitting the permutation σ ∈ S n into three segments separated by the letters that realise 1 and 4 of the pattern. The two cases then arise by considering whether or not 2 and 3 lie in the same segment.
Case 1: 2 and 3 are not adjacent. Suppose π = 2143, the argument for the other permutations is analogous. Note that if p occurs in a permutation σ ∈ S n , the shading tells us that there can be nothing above 4 and nothing below 1. This means that a realisation of p in σ is exactly a subword a1nb, subject to the restriction 1 < a < b < n.
First we fix σ k = 1 and σ = n, with k < . Next we count the permutations which fail to satisfy the condition that a letter before the letter 1 is smaller than a letter after the letter n in σ. To do so we choose the letters which lie between 1 and n, for which we have n−2 −k−1 ( − k − 1)! possibilities as there are − k − 1 letters to pick out of n − 2, and we can order them in any way. The remaining letters must then be partitioned so that the largest k − 1 are before 1 in σ, and the smallest n − are after n. We can order both these sets in any way. So the number of permutations which don't satisfy the condition is permutations that do satisfy the condition. We then sum over all k and to get the first enumerative result: Case 2: 2 and 3 are adjacent. Suppose π = 2314, the argument for the other permutations is analogous. Again, if p occurs in a permutation σ ∈ S n , the shading tells us that there can be nothing above 4 and nothing below 1. This means that a realisation of p in σ is exactly a subword ab1n, subject to the restriction 1 < a < b < n.
Fix σ k = 1 and σ = n, with k < . Next we count the permutations which fail to satisfy the condition that two of the letters appearing before 1 in σ occur in ascending order as required to realise the pattern. First we choose the letters appearing after 1 (excluding n which has already been fixed), for which we have n−2 n−k−1 (n − k − 1)! possibilities as there are n − k − 1 letters to pick out of n − 2, and we can order them in any way. The remaining letters are then the ones occurring before 1 in σ and for the condition to fail, they all have to appear in decreasing order. Once the letters after 1 have been fixed, there is exactly one way to do this, so the number of permutations which don't satisfy the condition is Therefore, we have (n − 2)! − (n−2)! (k−1)! permutations that do satisfy the condition. We then sum over all k and to get the second enumerative result: This concludes the proof of the two enumerative results. Finally, we prove the asymptotic result. In both cases we have the exact same lower and upper bounds, but we obtain them in slightly different ways. In the first case, the upper bound is obtained as follows: In the second case, we instead have: In both cases, this implies: To get the lower bound in the first case, first note that 1 − n− 1 +k−1 Which gives the following inequality In the second case, note that 1 − 1 (k−1)! ≥ 1 − 1 k−1 holds for all k ≥ 2, and then change the summation index to r = k − 1. This gives Notice that we obtain the exact same lower bound in both cases. This bound can now be simplified as follows: where H n is the n-th Harmonic number. Using the formula lim n→∞ (H n − ln(n)) = γ for Euler's constant [Eul41], we get the following lower bound for the containment limit.
Combining the two bounds implies the result.
By trivial symmetries we get the following corollary.
Corollary 4.4. Let p be any of the following mesh patterns Then, Let p be any of the following mesh patterns Then, Furthermore, in both cases: The Shading Lemma is a useful result introduced in [HJS + 15, Lemma 3.11] which gives conditions allowing extra boxes to be shaded which does not change the containment set. Applying the Shading Lemma combined with Theorem 4.3, for π = 2143, gives the following corollary. Note that we can derive a similar result to Corollary 4.5 for the other mesh patterns in Theorem 4.3 and Corollary 4.4, but we omit them here for brevity.
We suspect that Theorem 4.3 will extend to general mesh patterns of length n. Heuristically, shading the top and bottom row fixes the relative position of 1 and n, with exactly half of the permutations having that relative position. Containing the remaining k − 2 points of the pattern means that the corresponding permutation pattern occurs with its points appearing on the prescribed sides of 1 and n. As a consequence of the Marcus-Tardos Theorem [MT04], we know that as n increases all permutation patterns occur with probability 1, so one would expect similar behaviour here. Which leads to the following conjecture. In Corollary 4.5 we see that shading the top and bottom rows, and all but one box on the rightmost column, gives a containment limit of 1 2 . Next we show that if we shade all boxes in the rightmost column the containment limit is still 1 2 .
Theorem 4.7. Let p = , then Proof. Note that if p occurs in a permutation σ ∈ S n , the shading tells us that there can be nothing above 4, nothing below 1, and nothing to the right of 3. This means that a realisation of p in σ is a subword of the form a1nσ n , subject to the restriction 1 < a < σ n < n. In other words, the pattern p occurs in σ if and only if the letter 1 occurs in σ before the letter n and some letter occurring before the letter 1 is smaller than the last letter in σ (which is not allowed to be n). To calculate s + n (p), we can count such permutations. Let 1 < k < < n and 1 < q < n. There are (n − 3)! permutations σ satisfying σ k = 1, σ = n and σ n = q. A permutation of this kind will contain the mesh pattern if and only if a letter smaller than q occurs in one of the first k − 1 places. As usual, it is easier to count which permutations do not satisfy this condition: namely those whose first k − 1 letters are all larger than q. Note that this cannot happen if k − 1 > n − q − 1, as there are only n − q − 1 letters between q and n. If on the other hand k − 1 ≤ n − q − 1, we have n−q−1 k−1 possible choices of letters to put in the first k − 1 places, each of which we can permute in (k − 1)! possible ways. The remaining (n − k − 2) letters can be freely permuted, giving us (n − k − 2)! choices. Therefore, among the (n − 3)! permutations satisfying the restrictions above, of them do not contain the mesh pattern. We subtract this number from (n − 3)! to obtain the number of those that do contain it: To obtain the total number of such permutations in S n we now sum over all k, and q: Since does not appear in the sum, we can replace the corresponding summation symbol by a multiplicative factor, giving the formula: Next, we calculate the containment limit. By Theorem 4.3 and Lemma 3.1 we get an The lower bound is given by: Combining the two bounds implies lim n→∞ s + n (p) n! = 1 2 .
We cannot apply the Shading Lemma to Theorem 4.7, since the shaded boxes on the right hand side cause the conditions of the Lemma to no longer be satisfied. But we do get the following corollary from trivial symmetries.
Proof. Note that if p occurs in a permutation σ ∈ S n , then a realisation of p in σ is a subword of the form aqnb, subject to the restriction q < a < b < n such that every letter in σ smaller than q appears after b. In particular, n cannot be in the first place. To calculate s + n (p) we count such permutations.
Assume n is not in the first position and let q be the smallest letter appearing before n. The permutation σ contains a unique subword ω = qnπ 1 . . . π q−1 where π i < q for all i. Fixing q < n − 2, there are (q − 1)! choices for this subword and the rest of the letters of σ can be chosen freely, in (n − q − 1)! different ways. To obtain a permutation σ from the subword ω, we have to insert n − q − 1 letters. Let ψ = (ψ 0 , . . . , ψ q+1 ) be the number of letters we insert into each of the parts of σ separated by the letters of ω.
For a fixed π and a fixed partition ψ, there are (n − q − 1)! possible permutations of letters to be inserted, and we now count how many of these do not contain p. These are exactly the permutations where all the ψ 0 letters before q are larger than all the ψ 2 letters between n and π 1 , and the remaining letters can be chosen and permuted arbitrarily. First − (n − 3)! ln(n − 2) (n − 2)(n − 1)H n−3 − (n − 3)(3n − 4) 2 = (n − 2)!(n + 1)(n − 2) − 2(n − 1)!H n−2 − ln(n − 2)(n − 1)!H n−3 where H n is the n-th Harmonic number. To get (3) we set k+ k to k+1 k , (4) is given by the identity c a=b a b = c+1 b+1 , (5) we get by using k k+1 = 1 − 1 k+1 and then sum of binomial coefficients identity again, (6) is obtained by setting the second k to 1, (7) we get from the inequality n k=1 1 k = H n ≤ ln(n) + 1, (8) is given by dividing the binomial coefficients by n−2 q−1 , (9) we get by multiplying out the polynomials and simplifying the sums, and (10) is simply expanding the brackets. Therefore, we get the following lower bound, which combined with the upper bound completes the proof: 2n(n − 1)(n − 2) = 1.
Combining Lemma 3.1 and Theorem 4.9 gives the following corollary. We can apply the Shading Lemma to get the following corollary. Moreover, if p obtained by taking a subset of the shadings of any of the above mesh patterns then the containment limit is also 1.

Questions and Conjectures
We have presented some results on the asymptotics of mesh pattern containment, but many questions remain. In this section we finish with some open questions and conjectures.
Permutations that contain p must be constructed by taking the skew-sum of a permutation that contains the mesh pattern in Theorem 4.7 along with any other permutation, this leads us to claim the following conjecture. Many of the examples we consider have entire rows or columns shaded, so could actually be considered as bivincular patterns. So we wonder if a complete analysis of length 3 or 4 bivincular patterns is possible? Also, we have only considered s + n (P ), where P is a single pattern. What can we determine for the containment limit when P is a set of mesh patterns?
One motivation for this work was the application of mesh patterns to the homology of permutation complexes, such as those studied in [CLM20]. For example, we initially believed that each occurrence in π ∈ S n of the mesh pattern contributes to the homology of the permutation complex X(12 . . . n, π), which is topologically the suspension of the simplicial complex Y (π) whose faces are the increasing subsequences of π. This was motivated by the observation that the topological realisation of the subcomplex corresponding to an occurrence of such a pattern in Y (π) is a circle which the shading prevents from being coned off by the addition of a single point. Unfortunately, it can be coned off by the addition of two points, as demonstrated by taking the permutation π = 214635 and the occurrence 2163 of the pattern. Which leads us to pose the question: Question 5.2. Can occurrences of mesh patterns be used to compute the Betti numbers of permutation complexes? Or can we define a set of mesh patterns P such that if π avoids P its permutation complex is contractible?