A pattern theorem for random sorting networks

A sorting network is a shortest path from 12..n to n..21 in the Cayley graph of the symmetric group S(n) generated by nearest-neighbor swaps. A pattern is a sequence of swaps that forms an initial segment of some sorting network. We prove that in a uniformly random n-element sorting network, any fixed pattern occurs in at least cn^2 disjoint space-time locations, with probability tending to 1 exponentially fast as n tends to infinity. Here c is a positive constant which depends on the choice of pattern. As a consequence, the probability that the uniformly random sorting network is geometrically realizable tends to 0.


Introduction
Let S n be the group of all permutations σ = (σ(1), . . . , σ(n)) of {1, . . . , n} with composition given by (στ )(i) = σ(τ (i)). We denote by σ j the adjacent transposition or swap (j j+1) = (1, . . . , j+1, j, . . . , n). A sorting network of size n is a sequence (s 1 , s 2 , . . . , s N ) of N := n 2 integers with 0 < s k < n, such that the composition σ s1 σ s2 · · · σ s N equals the reverse permutation (n, n − 1, . . . , 1). We sometimes say that at time k a swap occurs at position s k , and we illustrate a sorting network by a set of crosses with coordinates (k, s k ) for k = 1, . . . , N . (This is natural, since the crosses may be joined by horizontal lines to give a "wiring diagram" consisting of n polygonal lines whose order is reversed as we move from left to right; see Figure 1.) Interest in sorting networks was initiated by Stanley, who proved in [11] that the number of sorting networks of size n is equal to the number of standard staircaseshape Young tableaux of size n, i.e. those with shape (n − 1, n − 2, . . . , 1). Uniformly random sorting networks were introduced and studied by Angel, Holroyd, Romik, and Virag in [1], giving rise to many striking results and conjectures. A pattern is any finite sequence of positive integers that is an initial segment of some sorting network. Thus for example, (1, 2, 1) and (4, 2) are patterns, but (1, 1) and (1, 2, 1, 2) are not. The size of a pattern is the minimum size of a sorting network that contains it as an initial segment, which is also one more than the maximal element in the pattern.
Theorem 1.1. Fix any pattern γ of size k. There exist constants c 1 , c 2 > 0 (depending on γ) such that for every n ≥ k, the pattern γ occurs at least c 1 n 2 times in a uniformly random sorting network of size n, with probability at least 1 − e −c2n .
We conjecture that the probability in Theorem 1.1 is in fact at least 1 − e −cn 2 for some c = c(γ).
We will prove Theorem 1.1 by establishing a closely related result about uniformly random standard staircase-shape Young tableaux, and using a bijection due to Edelman and Greene [4] between sorting networks and Young tableaux.
The numbers λ i are the row lengths of λ. In what follows we denote by (λ 1 , λ 2 , . . . ) the Young diagram with row lengths λ 1 ≥ λ 2 ≥ . . . . We call an element x = (i, j) ∈ λ a box, and draw it as a unit square at location (i, j) (with the traditional convention that (1, 1) is at the top left and the first coordinate is vertical). A tableau T of shape λ is a map from λ to the integers whose values are non-decreasing along rows and columns. We call T (x) the entry assigned to box x. A standard Young tableau is a tableau T of shape λ such that the set of entries of T is {1, 2 . . . , |λ|}. We are mostly interested in standard staircase-shape Young tableaux of size n, i.e. those with shape staircase Young diagram (n − 1, n − 2, . . . , 1).
For a Young diagram λ and a box (i, j) ∈ λ, we define the subdiagram λ (i,j) with top-left corner (i, j) by λ (i,j) := {(k, ) ∈ λ : (k, ) ≥ (i, j)}; clearly λ (i,j) is mapped to a Young diagram by the translation (k, ) → (k − i + 1, − j + 1). If T is a tableau of shape λ then we define the subtableau T (i,j) to be the restriction of T to λ (i,j) , and we call λ (i,j) the support of T (i,j) .
We say that two tableaux S and T of the same shape λ are identically ordered if for all x, y ∈ λ we have S(x) < S(y) if and only if T (x) < T (y). Furthermore, if S and T are tableaux or subtableaux, and there is a translation θ that maps (bijectively) the support of S to the support of T , then we say that S and T are identically ordered if for all x, y in the support of S we have S(x) < S(y) if and only if T (θ(x)) < T (θ(y)). Figure 4 illustrates the above terminology. Theorem 1.1 will be deduced from the following.  Figure 4: A standard Young tableau T of shape λ = (5, 5, 4, 3, 1), the subdiagram λ (3,2) , the subtableau T (3,2) , and a standard Young tableau identically ordered with T (3,2) . Theorem 1.2. Let T be any standard staircase-shape Young tableau of size k. For some positive constants c 1 , c 2 and c 3 (depending only on k), with probability at least 1 − e −c 3 n , a uniformly random standard staircase-shape Young tableau of size n ≥ k contains at least c 1 n subtableaux with pairwise disjoint supports such that: 1. each is identically ordered with T ; 2. all their entries are greater than N − c 2 n.
As an application of Theorem 1.1 we prove that a uniformly random sorting network is not geometrically realizable in the following sense. Consider a set X of n points in R 2 such that no two points from X lie on the same vertical line, no three points are collinear, and no two pairs of points define parallel lines. Label the points 1, . . . , n from left to right (i.e. in order of their first coordinate). Let X φ be the set obtained by rotating R 2 by angle φ about the origin, and let σ φ be the permutation found by reading the labels in X φ from left to right. As φ increases from 0 to π, the permutation σ φ changes via a sequence of swaps, which form a sorting network. Any sorting network that can be generated in this way is called geometrically realizable. (Such networks were called stretchable in [1], but this term is used with a different meaning in [7,6]).
Goodman and Pollack [6] gave an example of a sorting network of size 5 that is not geometrically realizable. On the other hand, in [1], it was conjectured (on the basis of strong experimental and heuristic evidence) that a uniformly random sorting network is with high probability approximately geometrically realizable, in the sense that its distance to some random geometrically realizable network tends to zero in probability (in a certain natural metric). The conjectures of [1] would also imply that, for fixed m, the sorting network obtained by observing only m randomly chosen particles from a uniformly random sorting network of size n ≥ m is with high probability geometrically realizable as n → ∞. (The conjectures also imply that these size-m networks have a limiting distribution as n → ∞, as well as providing a precise description of the limit. Certain aspects of the latter prediction were verified rigorously in [2].) However, we prove that with high probability a uniformly random sorting network is not itself geometrically realizable. Theorem 1.3. The probability that a uniformly random sorting network of size n is geometrically realizable tends to zero as n tends to infinity.
While our proof yields an exponential (in n) bound on the probability that a uniform sorting network of size n is geometrically realizable, we believe the probability is in fact O(e −cn 2 ).
The paper is organized as follows. In Section 2 we recall basic definitions and the Edelman-Greene bijection between sorting networks and standard Young tableaux. In Sections 3 and 4 we prove some auxiliary lemmas about Young tableaux and sequences of random variables, respectively. In Section 5 we prove Theorem 1.2 and then deduce Theorem 1.1 as a corollary. Finally, in Section 6 we prove Theorem 1.3.

Sorting networks and Young tableaux
Edelman and Greene [4] introduced a bijection between sorting networks of size n and standard staircase-shape Young tableaux of size n, i.e. of shape (n − 1, n − 2, . . . , 1).
We describe it in a slightly modified version that is more convenient for us.
Given a standard staircase-shape Young tableaux T of size n, we construct a sequence of integers s 1 , . . . , s N as follows. Set T 1 = T and repeat the following for t = 1, 2, . . . , N .
1. Let x = (n − j, j) be the location of the maximal entry in the tableau T t . Set s t = j.
2. Compute the sliding path, which is a sequence x 1 , x 2 , . . . , x , such that x 1 = x and for i = 1, 2, . . . we define x i+1 to be the box among {x i − (1, 0), x i − (0, 1)} with larger entry in T t , with the convention that T t (x) = 0 for every x outside the staircase Young diagram of size n. Let be the minimal i such that T t (x i ) = 0.
An example of this procedure is shown in Figure 5. Edelman and Greene [4] proved that the resulting sequence of numbers is indeed a sorting network, and furthermore that the algorithm provides a bijection between standard staircase-shape Young tableaux and sorting networks. Now we fix n, consider the set of all sorting networks of this size and equip it with the uniform measure. The Edelman-Greene bijection maps this measure to the uniform measure on the set of all standard staircase-shape Young tableaux of size n.
Given a standard Young tableau T of shape λ with |λ| = M we define a sequence of Young diagrams by Thus λ = λ 0 ⊃ λ 1 ⊃ · · · ⊃ λ M = ∅, and λ i \ λ i+1 consists of the single box T −1 (|λ| − i). If T is a uniformly random standard Young tableau of shape λ, then conditional on x arm co-arm co-leg leg Figure 6: Hook (clear) and co-hook (shaded) of a square x in a Young diagram. λ i , λ i−1 , . . . , λ 0 , the restriction of T to λ i is uniformly random. Thus the sequence of diagrams described above is a Markov chain.

Some properties of Young tableaux
In this section we present a fundamental result about Young diagrams (the hook formula) and deduce some of its consequences.
When drawing pictures of Young diagrams we adopt the convention that the first coordinate i (the row index) increases downwards while the second coordinate j (the column index) increases from left to right. Given a Young diagram λ, its transposed diagram λ is obtained by reflecting λ with respect to diagonal i = j. The column lengths of λ are the row lengths of λ . For any box x = (i, j) of a Young diagram λ, its arm is the collection of λ i − j boxes to its right: {(i, j ) ∈ λ : j > j}. The leg of x is the set {(i , j) ∈ λ : i > i} of λ j − i boxes below it. The union of the box x, its arm and its leg is called the hook of x. The number of boxes in the hook is called the hook length and is denoted by h(x). The co-arm is the set {(i, j ) ∈ λ : j < j}; the co-leg is the set {(i , j) ∈ λ : i < i}, and their union (which does not include x) is called the co-hook and denoted by C(x). See Figure 6. Finally, a corner of a Young diagram λ is a box x ∈ λ such that h(x) = 1, or equivalently such that λ \ {x} is also a Young diagram.
The dimension dim(λ) of a Young diagram λ is defined as the number of standard Young tableaux of shape λ (thus named because it is the dimension of the corresponding irreducible representations of the symmetric group).

Corollary 3.2.
Let T be a uniformly random standard Young tableau of shape λ, and let x be a corner of λ. The location T −1 (|λ|) of the largest entry is distributed as follows.
(Note that h(z) > 1 for any box in the co-hook C(x), so the right side is finite.) Proof. This is immediate from Lemma 3.1.

Lemma 3.3. Fix
> 0. Let a Young diagram λ be a subset of the staircase Young diagram of size n, and let x = (i, j) be a corner of λ with i, j ≥ n/4 and n − i − j ≤ . Let T be a uniformly random standard Young tableau of shape λ. We have where c is a constant depending only on .
There is nothing special about the bound n 4 on i, j -the lemma and proof hold as long as i, j ≥ εn, though the constant in the resulting bound tends to 0 as ε → 0.
It follows that (Here we used that the factors are all decreasing in h, greater than 1, and that i, j ≥ n/3.) It is now easy to estimate k<n/4 Lemma 3.4. Let T be a uniformly random standard Young tableau of shape λ, let x and y be two corners of λ and = x − y ∞ . Then For our application all we need is a bound of the form C( ) on this ratio, though we note that the bound we get is close to optimal for a tableau of shape (n + 1, n, . . . , n) with + 1 rows, for large n.
Proof of Lemma 3.4. To compare the expressions from Corollary 3.2 for x and y, let us introduce a partial matching between C(x) and C(y). We match boxes of the co-arm of x and the co-arm of y if they are in the same column. We match boxes of the co-leg of x and the co-leg of y if they are in the same row. All other boxes of C(x) and C(y) remain unmatched (see Figure 7). Writing x = (i 1 , j 1 ) and y = (i 2 , j 2 ) without loss of generality assume that i 1 < i 2 and j 1 > j 2 . Clearly, if z ∈ C(x) and z ∈ C(y) are a matched pair, then h(z ) = h(z) ± s, where s = i 2 − i 1 + j 1 − j 2 and the sign is plus if the box z belongs to the co-leg of x and minus otherwise. Let M (x), U (x) be the matched and unmatched parts of the co-hook C(x) and similarly for y. We have where the choice of the sign ± depends on whether a box z belongs to the co-arm or the co-leg of x. Let us bound the right side of (3.1). First note that all the boxes in the co-leg of x and all the boxes in the co-arm of y are matched. The product over z ∈ U (y) is at least 1. Next, there are at most unmatched boxes of the co-arm of x and their hook lengths Turning to the last product in (3.1), a matched pair of boxes from the co-arms contributes to (3.1) the factor which is easily seen to be less than 1.
Finally, every matched pair of boxes from the co-legs contributes to (3.1) the factor This is greater than 1 for any h(z). As z varies over a co-leg of x, the values of h(z) are distinct. Consequently, the contribution from the matched boxes from the co-legs is bounded from above by

Sequences of random variables
Recall that a real-valued random variable Y stochastically dominates another real-valued random variable Z if and only if there exist a probability space Ω and two random variables Y , Z defined on Ω, such that Y d = Y and Z d = Z, and Y ≥ Z almost surely.
Lemma 4.1. Let X 1 , . . . , X N be random variables taking values in {1, . . . , m, ∞} such that a.s. each a ∈ [1, m] appears exactly r times. Let A i be events, and define the filtration F i = σ (X 1 , . . . , X i , A 1 , . . . , A i−1 ). Assume P(A i | F i ) ≥ p a.s. for some p > 0 and all i. Let G a be the event To clarify the lemma, it helps to think of having m counters initialized at 0. At each step i ≤ N , a counter is selected dependent on X i (or no counter, signified by X i = ∞), and that counter is advanced (event A i ) with conditional probability at least p. The event G a is that the ath counter is advanced every time it is selected. Then after every counter has been selected r times, the number of counters with the highest possible value r stochastically dominates a Bin(m, p r ) random variable. Note that the order in which counters are selected may depend arbitrarily on the past selections and advances. While this lemma seems intuitively clear and perhaps even obvious, the precise assumptions on the dependencies among the events and variables make the proof slightly delicate.
Proof of Lemma 4.1. First, we want to extend the probability space, and define events A i ⊆ A i and a finer filtration F i in such a way that P(A i | F i ) = p for all i.
Let Ω be our original probability space and let µ be our original probability measure. For i = 1, 2, . . . , N let E i be the set of all elementary events in the finite σ-algebra F i that have non-zero probabilities (with respect to µ). The condition P(A i | F i ) ≥ p means that P(A i | E) ≥ p for every E ∈ E i . For any E ∈ E i let Ω E i denote the probability space {0, 1} with probability measure µ E i such that µ E i (1) = p/P(A i | E). Our new probability space Ω is the product of Ω and all Ω E i : In other words, an element of Ω is a pair (ω, f ), where ω ∈ Ω and f is a function from . We equip Ω with the probability measure µ which is the direct product of µ and the measures µ E i : In what follows we do not distinguish between a random variable X(ω) defined on Ω and the random variable X(ω, f ) := X(ω) defined on Ω . In the same way we identify any event A of Ω with A := {(ω, f ) ∈ Ω : ω ∈ A} ⊆ Ω . In what follows all the probabilities are understood with respect to µ . For any E ∈ i E i let f E denote the random variable on Ω given by Put it otherwise, B E i is the event that both E occurs and f E = 1. Denote . Informally, to get A i we cut A i into pieces A i ∩ E, replace every such piece by A i ∩ B E i and then glue pieces back together.
Let us introduce a filtration on Ω : where E runs over all elements of Moreover, consider any sequence of stopping times 1 ≤ τ 1 < · · · < τ ≤ N (w.r.t. the filtration F ). We claim that P i≤ A τi = p . The proof is a simple induction in . For = 1 we have where in the last equality we used that P(A i | F i ) = p and {τ 1 = i} ∈ F i . Now assume that our statement is true for = h − 1. Then for = h we have Note that for i ≥ 2 the restriction of τ i on the set A j ∩ {τ 1 = j} is again a stopping time. Indeed, by the definition, j < τ i ≤ N on {τ 1 = j}, and for k > j we have {τ i ≤ k} ∩ A j ∩ {τ 1 = j} ∈ F k , since both {τ i ≤ k} ∈ F k and A j ∈ F k and {τ 1 = j} ∈ F k . Therefore, using the induction assumption we conclude that if P( Applying the above claim to the r ordered stopping times τ i defined by {τ 1 , . . . , τ r } = {k : X k = a} we find P(G a ) = p r . Moreover, for any set S ⊆ [1, m], by taking the r|S| ordered stopping times τ S i defined by It follows that the events G a are independent, and so   . . . , X k ), and suppose moreover that for some c > 0 and all a, k, on the event S k (a) < r (which lies in F k ), we have Finally, let D k = #{a : S k (a) = r}. Then for every ε > 0 there are constants c 1 , c 2 , depending on c, r but not on m or N , such that On the event D k ≤ (1 − ε)m there are at least εm values a for which S k (a) < r, so by the condition of Lemma 4.2 we have E(T k+1 | F k ) − T k ≥ cε. Let M k be cεk − T k , and let M k be M k stopped when D k exceeds (1 − ε)m. More formally, the stopping time K is the minimum number such that D K > (1 − ε)m, and M k = M k∧K .
Observe that M k is a supermartingale with bounded increments. Therefore, by the Azuma-Hoeffding inequality for supermartingales (which follows from the martingale version by Doob decomposition; see e.g. [3] or [12, E14.2 and 12.11]), for any c 1 > 0 there is a c 2 so that P(M c1m > m) ≤ e −c2m . If M c1m ≤ m and K > c 1 m, then T c1m ≥ (cεc 1 m − 1)m. If c 1 is such that cεc 1 m − 1 > r, this cannot hold, thus M is already stopped by time c 1 m with probability at least 1 − e −c2m .

Proofs of the main results
We are now ready to prove Theorems 1.1 and 1.2. We denote by S a fixed standard staircase-shape Young tableau of size k and by T a uniformly random standard staircaseshape Young tableau of size n. In what follows k and S are fixed (and will correspond to the pattern we are looking for) while n tends to infinity. Given S, the idea is to consider cn specific disjointly supported subtableaux of T in columns n/4 , . . . , 3n/4 and show that linearly many (in n) of them are identically ordered with S. Now we proceed to the detailed proofs. and we choose the column set n/4 +1, . . . , n/4 +M . An example is shown in Figure 8. Let N := n 2 and r := k 2 . We now construct sequences X t and A t (1 ≤ t ≤ N ) to which we shall apply Lemmas 4.1 and 4.2, as random variables on the probability space of standard staircase-shape Young tableaux T of size n with uniform measure. Set X t = a if T −1 (N + 1 − t) belongs to K a and set X t = ∞ if T −1 (N + 1 − t) does not belong to a K a . Note that each a ∈ {1, . . . , m} appears exactly r times among X 1 , . . . , X N . Next, we define the events A t . Let a = X t , and suppose X t is the ith occurrence of a among X 1 , . . . , X t . The event A t occurs if and only if at least one of the following holds.
2. The box T −1 (N − t + 1) is in the same relative position within K a as S −1 (r − i + 1) is within a staircase Young diagram of size k.
3. A s does not occur for some s < t for which X s = a.
In other words, A t fails to occur precisely if for some number a the locations of entries {N − t + 1, . . . , N } imply that the subtableau supported by K a and S are not identically ordered, and A s occurs for all s < t (for that a). diagrams {λ t }. Each step of this Markov chain is a removal of a box from a Young diagram. If the box x = λ t \ λ t−1 removed at step t belongs to K a , then we choose the ath counter at this step. The counter advances if either the position of x is the correct one for K a and S to be identically ordered, or if the correct order of the entries of T inside K a was already broken at an earlier step. Clearly, if the ath counter advances r times, then the subtableau of T with support K a is identically ordered with S. We shall see that the sequences X t and A t , and the numbers r, m, N , satisfy the conditions of Lemma 4.1 and 4.2 with p = 1 2k 3 .
Theorem 1.2 then follows immediately by applying Corollary 4.3 for sequences X t and A t . As already noted, every a ∈ {1, . . . , m} appears among X 1 , . . . , X N exactly r times. Thus it remains to bound from below the conditional probabilities of A t . Let F t be as in Lemma 4.1. We must prove that P(A t | F t ) ≥ p. Let G t be the larger σ-algebra generated by λ 0 , . . . , λ t−1 together with X t .
If X t = ∞ then A t occurs, and there is nothing to prove. So suppose X t = a = ∞. Now, on X t = a, and given λ t−1 = µ, there are at most k − 1 corners of µ in K a (which correspond to possible positions of the box T −1 (N − t + 1)). Lemma 3.4 implies that the probabilities of any two of these possibilities have a ratio of at most 2k 2 (since the parameter in that lemma is at most k − 2). Thus, for any Young diagram ν obtained from µ by removing a box inside K a we have P(λ t = ν | λ t−1 = µ, X t = a) ≥ p. Now, the Markov property of the sequence λ t imply that the same bound holds conditioned on all of λ 0 , . . . , λ t−1 , i.e. we have P(λ t = ν | G t ) ≥ p on the event {X t = a, λ t−1 = µ}. Therefore, also P(λ t = ν | F t ) ≥ p.  Figure 9: "Padding" a tableau T γ to get S. Here k = 3.
Coming back to the bound on conditional probability of A t , if some previous A s with s < t and X s = X t did not occur then A t occurs and P(A t | F t ) = 1 ≥ p. Otherwise, occurance of A t depends on the position of the box T −1 (N − t + 1); specifically, A t occurs if this box is the correct one according to S of the possible boxes in the subdiagram K a . We have shown above that each of the possible positions of this box has conditional probability at least p. Since exactly one of the positions corresponds to the event A t , we conclude that Finally, let us check that the sequence X t satisfies the conditions of Lemma 4.2.
Observe that the condition S t (a) < r means that the subdiagram K a is not completely filled with entries greater than N − t. Thus, S t (a) < r if and only if λ t ∩ K a = ∅, which is equivalent to λ t having at least one corner in K a . Applying Lemma 3.3 for λ t and this corner yields that for some positive constant c, on the event S t (a) < r, Now, the Markov property of the sequence λ t imply that the same bound holds conditioned on all of λ 0 , . . . , λ t , and therefore also conditioned on the coarser σ-algebra F t .
We now deduce Theorem 1.1 using the Edelman-Greene bijection.
Proposition 5.1. Fix any pattern γ of size k. There exist constants c 3 , c 4 and c 5 (depending on γ) such that for every n ≥ k, the pattern γ occurs at least c 3 n times within the time interval [1, c 4 n] of a uniformly random sorting network of size n with probability at least 1 − e −c5n .
Note that Proposition 5.1 differs from Theorem 1.1 in that we consider only the beginning of the network and hence only find a linear number of occurrences of γ.
Proof of Proposition 5.1. Clearly, it suffices to prove Proposition 5.1 for patterns of length k(k − 1)/2, or in other words a sorting network of size k. Such a pattern γ = (γ 1 , . . . , γ k(k−1)/2 ) corresponds via the Edelman-Greene bijection to some standard staircase-shape Young tableau T γ of size k. Consider a larger standard staircase-shape Young tableau S of size k + 2, which is a padded version of T γ : entries of the hook of (1, 1) are the numbers 1, . . . , 2k + 1 (in an arbitrary admissible order) and the remaining staircase-shaped Young tableau of size k − 1 contains 2k + 2, . . . , (k + 2)(k + 1)/2 and is identically ordered with T γ . An example of this construction is shown in Figure 9. Let c 3 , c 4 and c 5 be the constants c 1 , c 2 and c 3 of Theorem 1.2, respectively. Let T be a standard staircase-shape Young tableau of size n having at least c 3 n disjointly supported subtableaux identically ordered with S, furthermore, all the entries of these subtableaux are greater than N − c 4 n. (Theorem 1.2 implies that a uniformly random standard staircase-shape Young tableau of size n ≥ k is of this kind with probability at least 1 − e −c5n .) Suppose that the support of the th such subtableau ( = 1, 2, . . . , c 3 n) is a subdiagram K with top-left corner (n − j − k, j ). Let K denote the subdiagram with top-left corner (n − j − k + 1, j + 1) and note that the subtableau with support K is identically ordered with T γ .
Let ω be the sorting network corresponding to T via the Edelman-Greene bijection. Note that in the Edelman-Greene bijection, every tableau entry moves towards the boundary of the staircase Young diagram until it becomes the maximal entry in the tableau, and then it disappears and adds to the sorting network a swap in position j, where j is the column of the entry just before it disappeared. It follows that all the entries starting in K disappear in the columns j , . . . , j + k and, thus, add to the sorting network swaps s i satisfying j ≤ s i ≤ j + k. Furthermore, observe that all the entries starting in K disappear (in columns s i satisfying j < s i < j + k) before the entries in K \ K . Finally, note that until all entries starting in K disappeared no other entry can disappear in columns j , . . . , j + k. We conclude that for every , the pattern γ occurs in ω at [1, t ] × [j + 1, j + k − 1]. Thus, pattern γ occurs in ω at least c 3 n times within the time interval [1, c 4 n]. There exist constants c 6 > 0 and n 0 such that if n > n 0 , then N/m e −c5n ≤ e −c6n . Let c 1 = min(c 3 /(4c 4 ), c 3 /n 0 ) and c 2 = min(c 5 , c 6 ). Let I denote the set of all sorting networks ω of size n such that γ occurs c 1 n 2 times in ω. If n > n 0 then we have And if k ≤ n ≤ n 0 , then I 1 ⊆ I and P(I) ≥ P(I 1 ) ≥ 1 − e −c5n ≥ 1 − e −c2n .

Uniform sorting networks are not geometrically realizable
Proof of Theorem 1.3. Goodman and Pollack proved in the paper [6] that there exists a sorting network γ of size 5 that is not geometrically realizable. This sorting network is shown in Figure 10. (This is the smallest possible size of such a network.) Let us view γ as a pattern. Suppose that γ occurs in a sorting network ω at time interval [1, t] and position [a, b]. We claim that w is not geometrically realizable. Indeed, if ω were a geometrically realizable sorting networks associated with points x 1 , . . . , x n ∈ R 2 (labeled from left to right), then γ would be a geometrically realizable sorting network associated with the points x a , . . . , x b . Proposition 5.1 yields that with tending to 1 probability γ occurs within the time interval [1, c 4 n] of a uniformly random sorting network ω of size n and thus ω is not geometrically realizable.