Representing Permutations with Few Moves
Sergey Bereg, Alexander E. Holroyd, Lev Nachmanson, Sergey Pupyrev
aa r X i v : . [ m a t h . C O ] A ug REPRESENTING PERMUTATIONS WITH FEW MOVES
SERGEY BEREG, ALEXANDER E. HOLROYD,LEV NACHMANSON, AND SERGEY PUPYREVA
BSTRACT . Consider a finite sequence of permutations of the elements , . . . , n , with the property that each element changes its position by atmost from any permutation to the next. We call such a sequence a tangle , and we define a move of element i to be a maximal subsequenceof at least two consecutive permutations during which its positions forman arithmetic progression of common difference +1 or − . We provethat for any initial and final permutations, there is a tangle connectingthem in which each element makes at most moves, and another inwhich the total number of moves is at most n . On the other hand, thereexist permutations that require at least moves for some element, andat least n − moves in total. If we further require that every pair ofelements exchange positions at most once, then any two permutationscan be connected by a tangle with at most O (log n ) moves per element,but we do not know whether this can be reduced to O (1) per element,or to O ( n ) in total. A key tool is the introduction of certain restrictedclasses of tangle that perform pattern-avoiding permutations.
1. I
NTRODUCTION
Let S n be the symmetric group of permutations π = [ π (1) , . . . , π ( n )] on { , . . . , n } , with composition defined via ( π · ρ )( i ) = π ( ρ ( i )) . It is natural torepresent a permutation π as a composition of simpler permutations. Definethe swap s ( i ) to be the permutation [1 , . . . , i + 1 , i, . . . , n ] that interchanges i and i + 1 . We call two permutations π and ρ adjacent if they are related bya collection of non-overlapping swaps, i.e. if ρ = π · s ( p ) · · · s ( p k ) where | p i − p j | ≥ for i = j . Equivalently, π and ρ are adjacent if | π − ( i ) − ρ − ( i ) | ≤ for every i . A tangle is a finite sequence of permutations inwhich each consecutive pair is adjacent. If a tangle T starts with the identitypermutation id = [1 , . . . , n ] and ends with π , we say that T performs π .It is straightforward to see that for any permutation π there is some tan-gle that performs π . Our goal is to find tangles with simple and elegant Date : 11 August 2015.2010
Mathematics Subject Classification.
Key words and phrases. permutation, permutation diagram, reduced word, graph draw-ing, permutation pattern. (a) Permutations andpaths.
11 2 23 344 55 66 (b) Moves (thickenedlines) and corners (cir-cles).
11 2 23 344 55 66 (c) Shading the swaps. F IGURE
1. A tangle performing the permutation π =[1 , , , , , , with moves.structure. We may visualize a tangle as follows. Consider the sequenceof permutations written in one-line notation π = [ π (1) , . . . , π ( n )] in a col-umn from top to bottom as in Figure 1(a), with equal horizontal and verticalspacings between symbols. Then, for each i = 1 , . . . , n , draw a polygo-nal path connecting all occurrences of the number i , from top to bottom, asin the figure. The path corresponding to element i is called path i . Eachline segment of a path is either vertical or at an angle of ± ◦ to the verti-cal. We call a maximal non-vertical line segment of a path a move . Thus,a move corresponds to a maximal sequence of swaps s ( p i ) that occur be-tween the adjacent elements in some interval of permutations of the tangle,and with their locations p i forming an arithmetic progression with commondifference ± . See Figure 1(b). It is convenient to illustrate the structureby shading the area occupied by swaps, as in Figure 1(c). Our focus is onminimizing moves among tangles that perform a given permutation.Our first main result is that any permutation can be performed by a tan-gle with a bounded number of moves per path (and therefore O ( n ) movesin total as n → ∞ ). In contrast, various natural greedy algorithms for con-structing a tangle (including one proposed in [18]) require Ω( n ) moves intotal in the worst case. (See Figure 3 for examples.) Theorem 1.
For any permutation π ∈ S n , there is a tangle performing π that has at most moves in each path. Shifting our attention to total moves, we can reduce the constant from to . Theorem 2.
For any permutation π ∈ S n , there is a tangle performing π that has at most n moves in total. EPRESENTING PERMUTATIONS WITH FEW MOVES 3
On the other hand, for all sufficiently large n there are permutations thatrequire at least moves in some path, and permutations that require at least n − moves in total. (The latter is easily seen to hold for the reversepermutation [ n, n − , . . . , , while the former apparently requires a quiteinvolved argument – see Proposition 17). It is an open problem to close thegap between the bounds and for moves per path, and between n − and n for total moves.Figures 2(a) and 2(b) give examples of the constructions behind Theo-rems 1 and 2. The tangles will be constructed by combining various “gad-gets” – smaller tangles that are capable of performing permutations in cer-tain restricted classes. Specifically, we will consider gadgets that perform(and are in bijective correspondence with) Grassmannian, -avoiding, -avoiding, and -avoiding permutations.Despite the relatively small numbers of moves, the tangles illustrated inFigures 2(a) and 2(b) arguably have some undesirable features, which wediscuss next. Firstly, they have many “holes” – small internal regions con-taining no swaps, shown unshaded in the figures. Secondly, a given pair ofpaths may cross multiple times. We will show that some version of the firstissue is unavoidable if the number of moves is to be linear in n . On theother hand, we do not know whether the second issue can be avoided.Rather than holes, it will be convenient to work with a slightly differentnotion, to be defined next. First we observe that counting moves is essen-tially equivalent to counting corners (see also [4]). A corner is a vertex ofa path, at which its direction changes between any two of the three possi-ble directions. Assume that a tangle has its initial and final permutationsrepeated at least once, so that each path starts and ends with a vertical seg-ment. In addition, count “double corners” (at which a path changes fromone non-vertical direction to the other) with multiplicity . With these con-ventions, the number of corners in a path equals twice the number of moves.In our geometric interpretation of a tangle, we think of the swaps as lo-cated at the elements of the integer lattice Z . Therefore, the elements ofthe permutations, and thus also the corners, are located at elements of theshifted lattice ( Z + ) . Specifically, take the i th element π t ( i ) of the t thpermutation π t in the tangle to be located at the point ( i − , t − ) , wherethe first coordinate increases from left to right, and the second coordinateincreases from top to bottom.Given a tangle T , consider the graph whose vertices are the corners of T , and with an edge between two corners if their locations are within ℓ ∞ -distance . We call the connected components of this graph clusters . (SeeFigure 16.) The idea is that clusters generalize the notion of holes discussedabove. Our next result implies that, as n → ∞ , for some (in fact, almost all) BEREG, HOLROYD, NACHMANSON, AND PUPYREV (a) At most moves per path (Theo-rem 1). (b) At most n moves (Theorem 2). (c) Minimum crossings, and at most ⌈ log n ⌉ moves per path (Proposition 4). F IGURE
2. Examples of the tangles corresponding to themain results. Shading is added to illustrate the structure.
EPRESENTING PERMUTATIONS WITH FEW MOVES 5 permutations, if a tangle has only O ( n ) corners (equivalently, O ( n ) moves)then it must have at least Ω( n ) clusters. Indeed, o ( n ) clusters necessitates Ω( n log n ) corners. The proof will use a counting argument. Theorem 3.
Let θ ∈ (0 , ) and suppose n > θ − /θ . For at least a propor-tion − e − n of the permutations π ∈ S n , any tangle performing π has eitherat least ( − θ ) n clusters or at least θn log n corners. We now turn to the second issue raised above. We call a tangle simple ifeach pair of paths has at most one crossing. It is again easy to see that everypermutation admits a simple tangle. In a simple tangle performing a per-mutation π , paths π ( i ) and π ( j ) cross each other if and only if ( π ( i ) , π ( j )) is an inversion of π , i.e. i < j and π ( i ) > π ( j ) .The article [4] by the current authors characterizes a class of permutationsfor which there exist simple tangles that have the minimum moves among all tangles. However, there exist permutations that require strictly moremoves for a simple tangle than for a general tangle. Again, see [4] fordetails.In contrast with the case of general tangles discussed earlier, our upperand lower bounds for numbers of moves in simple tangles are rather farapart: O ( n log n ) and Ω( n ) respectively as n → ∞ . Closing this gap is ourprincipal open problem. Proposition 4.
For any permutation π ∈ S n , there is a simple tangle per-forming π that has at most ⌈ log n ⌉ moves in each path. Proposition 5.
For every n ≥ , there is a permutation π ∈ S n such thatany simple tangle that performs it has at least n − c √ n moves, where c > is an absolute constant. While our focus is on moves, one can attempt to optimize other aspects ofa tangle. For instance, we may define the depth of a tangle to be the lengthof the sequence of permutations comprising it (including the final permuta-tion but not the initial one, say). It is not difficult to check that any π ∈ S n can be performed by some tangle of depth at most n − for even n and atmost n for odd n (and these bounds are optimal; they are attained by thereverse permutation). Our constructions for Theorems 1 and 2 and Propo-sition 4 perform reasonably well in this regard, having depths at most n , n/ and n/ respectively. Background.
Further material on tangles and moves appears in a compan-ion paper [4] by the current authors. The main result of [4] is a surprisinglycomplex characterization of the set of permutations that can be performedby a simple tangle in which each path has at most one move in each di-rection, together with a polynomial-time algorithm for recognizing such a
BEREG, HOLROYD, NACHMANSON, AND PUPYREV permutation and constructing the tangle. (In particular, this set turns out toinclude every permutation in S , but no permutation containing the pattern .) Tangles and related objects have been studied in several settingsby other authors, although the problem of minimizing moves (or corners)does not appear to have been considered prior to [4].Wang in [18] considered essentially the same notion in the context ofVLSI design for integrated circuits. However, the research in [18] targets,in our terminology, the depth of a tangle, and the total length of the paths.The algorithm suggested by Wang produces tangles with O ( n ) moves forsome permutations.In algebraic combinatorics, Schubert polynomials can be encoded as sumsover diagrams called RC-graphs or pipe dreams [5, 9], which may be inter-preted as tangles of a certain type. Specifically, an RC-diagram correspondsvia a ◦ rotation to a simple tangle whose swaps are restricted to odd lo-cations in a triangular region (the same region as our “reflector gadget” inSection 2.3). Reduced words for permutations are extensively studied; seee.g. [3, 10, 14, 21]. In our terminology, a reduced word is a simple tanglewith only one swap between consecutive permutations.Decomposition of permutations into nearest-neighbour transpositionswas considered in the context of permuting machines and pattern-restrictedclasses of permutations [2]. In our terminology, Albert et. al. [2] proved thatit is possible to check in polynomial time whether for a given permutationthere exists a tangle of depth k , for a given k . Tangles and the associatedvisualizations also appear in sorting networks [1, 14], in arrangements ofpseudolines [8], and in the context of change ringing (English-style churchbell ringing) [20]. In the terminology of change ringing, a tangle with min-imum corners is a “link method with minimum changes of direction”; eachpermutation represents an order of ringing the bells, and a corner requiresa ringer to change the speed of their bell, which involves extra physical ef-fort. Also related is the problem of decomposing a permutation into theminimum number of block transpositions – see [7].Tangles appear naturally as a sub-problem in the context of graph-drawing, and this was our original motivation for the problems consideredhere. In order to simplify a visualization of a large graph, it is sometimesadvantageous to “bundle” sets of nearby edges together [15, 16]. Since theedges may be required to appear in different orders at the two ends of a bun-dle, they must be permuted along its length, and it is desirable to do this in ahelpful and visually appealing way. Paths with few moves (or few corners)tend to be easy to follow.With practical applications in mind, it is worth noting that the tanglesresulting from our constructions can often be improved slightly by localmodifications. For example, in Figure 2(a), one may eliminate the two EPRESENTING PERMUTATIONS WITH FEW MOVES 7 (a) Bubble sort variant: use one R-move to route each path to its correctposition, starting from the rightmost, π ( n ) . Path i may have Ω( i ) L-moves. (b) Odd-even sort: at alternate steps,apply swaps in all odd positions, orall even positions, wherever the twoelements form an inversion. F IGURE
3. Tangles constructed according to two naturalgreedy algorithms. Both require Ω( n ) moves in the worstcase as n → ∞ .swaps where the tail and body of the “fish” meet, reducing the depth; inFigure 2(b), the isolated swap in the middle of the leftmost column may bemoved upward to meet the swaps at the top, eliminating a move. Such mod-ifications may be iterated, but will not improve the worst case asymptoticperformance of the constructions. Further notation and conventions.
As mentioned above, it is convenientto consider a tangle in terms of its swaps, and we think of the swaps aslocated at elements of the integer lattice Z . If π t , π t +1 ∈ S n are two con-secutive permutations in a tangle, and they are related by non-overlapping BEREG, HOLROYD, NACHMANSON, AND PUPYREV swaps thus: π t · s ( p ) · · · s ( p k ) = π t +1 , then we say that the tangle has swapsat locations ( p , t ) , . . . , ( p k , t ) . The first coordinate is sometimes called po-sition, and increases from left (West) to right (East) (from to n − ); thesecond coordinate is called time, and increases from top (North) to bottom(South). If a tangle consists of permutations in S n then we sometimes call n the width of the tangle.We identify two tangles if they have the same set of swap locations; thus,we consider the tangle with permutations π , . . . , π t to be the same as thatwith permutations γ · π , . . . , γ · π t , for any permutation γ . In particular, atangle that performs a permutation π may be equivalently be considered asstarting at π − and ending at id , thus “sorting” π − . The latter conventionwas adopted in [4]. It will also be useful to allow times of swaps to take any value in Z , and to identify two tangles if one is obtained from the other byadding a constant to all swap times (thus translating it vertically).As mentioned earlier, we will construct tangles by combining smallertangles (called gadgets), and for this it will be useful to translate horizon-tally as well as vertically. Thus, let m < n and suppose that T is a tangleperforming π ∈ S m , with its swaps at locations S ⊂ [1 , m − × Z . Thenfor integers a, b , we may form a tangle T ′ of size n by placing swaps at thetranslated locations S ′ := { ( i + a, t + b ) : ( i, t ) ∈ S } ; this performs thepermutation [1 , . . . , a, π ( a + 1) , . . . , π ( a + m ) , a + m + 1 , . . . , n ] . Moreover,we may combine several tangles by taking the union of their sets of swaplocations (perhaps after applying various translations).A swap location ( x, t ) is called even or odd according to whether x + t iseven or odd. All the tangles we construct will have their swaps restricted tolocations of one parity. As indicated above, a convenient way to highlightthe structure of such a tangle is to draw a shaded ◦ -rotated square centeredat each swap, as in Figure 1(c). Recall that a move is a maximal non-verticalsegment of a path. We call it an L-move if it runs in the North-East toSouth-West direction, and an
R-move if it runs North-West to South-East.Pattern-avoiding permutations will play a key role. (See e.g. [11] forbackground.) A pattern is a permutation p ∈ S m . For n ≥ m , we saythat a permutation π ∈ S n (or, more generally, a sequence of n distinct realnumbers π ) contains the pattern p if there exist indices ≤ i < · · ·
In Section 2 below we introduce the gadgetsthat will be used in our constructions, and prove their required properties.Proposition 4 and Theorems 1 and 2 are then proved in Sections 3–5 respec-tively. We prove the bound Theorem 3 in Section 6, via a combinatorial ar-gument. In contrast, the lower bound in Proposition 5 and the fact that somepermutations require moves in some path (Proposition 17) are proved byexplicitly exhibiting suitable permutations, in Sections 7 and 8 respectively.Although the permutations in question are very easy to describe, the proofsof both results are surprisingly delicate.2. G ADGETS
In this section we introduce the gadgets that will be used to prove Theo-rems 1 and 2. They come in three main categories, with several variants ineach.2.1.
Splitter and Merger.
Our first gadget comes in two variant forms,which are reflections of each other about a horizontal axis. A splitter gadgethas swaps at locations ( i − j + a, − i − j ) , for all j ≥ and ≤ i ≤ b ( j ) , where a is an even integer, and b is anon-decreasing integer-valued function of bounded support. Thus, a split-ter consists of swaps at all even locations in a region bounded below bytwo line segments running South-East and North-East, and bounded aboveby an interface comprising any sequence of North-East and South-East seg-ments. See Figure 4(a) for an example. The idea is that it separates thepaths into two arbitrary sets, and places them on the left and right sideswhile maintaining the relative order within each set.To formalize this: a permutation π = [ π (1) , . . . , π ( n )] is called Grass-mannian if it has at most one descent, i.e. at most one index k such that π ( k ) > π ( k + 1) . F IGURE
5. A direct tangle, performing a -avoiding per-mutation.
Lemma 6.
A permutation can be performed by some splitter if and only if itis Grassmannian. Furthermore, the correspondence between splitters andGrassmannian permutations is bijective.
For the purposes of the claimed bijectivity, recall that two tangles areidentified if they have the same set of swap locations.
Proof of Lemma 6.
The identity permutation is clearly performed by thetrivial tangle containing no swaps. Any other Grassmannian permutation π has exactly one descent; say π ( k ) > π ( k + 1) . We take a = k , and b ( i ) = π ( k − i ) − ( k − i ) for ≤ i ≤ k − , and b ( i ) = 0 for i ≥ k .The function b is easily seen to be non-decreasing. The lower boundary ofthe splitter consists of k steps South-East followed by n − k steps North-East. The upper boundary also consists of k South-East steps and n − k North-East steps, with the π ( i ) th step being South-East if and only if i ≤ k .For i ≤ k , path π ( i ) makes one L-move, starting at position i and endingat position π ( i ) . For i > k , path π ( i ) similarly makes one R-move. Thepaths π ( i ) for i ≤ k maintain their order relative to each other, as do thosefor i > k . See Figure 4(a). By similar reasoning, any splitter performs aGrassmannian permutation. Since different splitters perform different per-mutations, the correspondence is bijective. (cid:3) A merger is obtained by reflecting a splitter about a horizontal axis. Thusit has swaps at all locations ( i − j + a, i + j ) , for a and b ( · ) as above. See Figure 4(b). The corresponding permutationis the inverse of that performed by the splitter. A permutation π is theinverse of a Grassmannian permutation if and only if, for some k , the values , . . . , k appear in increasing order in the sequence π = [ π (1) , . . . , π ( n )] ,and so do k + 1 , . . . , n . The proof of the following lemma is immediate. Lemma 7.
A permutation can be performed by some merger if and only ifits inverse is Grassmannian. Furthermore, this correspondence is bijective.
Both splitters and mergers are special cases of a more general class oftangles considered in [4], called direct tangles. A direct tangle is one in
EPRESENTING PERMUTATIONS WITH FEW MOVES 11 (a) Matrix gadget in-dexed by the permutation [1 , , , , , , , , , . (b) The same gadget trun-cated on the right. F IGURE and below by interfaces comprising North-East and South-East segments. SeeFigure 5. It is shown in [4] that a permutation admits a direct tangle if andonly if it is -avoiding. (Grassmannian permutations and their inversesare indeed -avoiding.) The correspondence is again bijective.2.2.
Matrix gadget.
Let n = 2 m be even, and let α ∈ S m be a permuta-tion. The matrix gadget indexed by α consists of swaps at the locations ( i + j − , i − j ) for all pairs i, j ∈ { , . . . , m } except those with α ( i ) = j . In other words,a square angled at ◦ to the axes is filled with swaps at all odd locations,except for those locations corresponding to the support of the (rotated) per-mutation matrix of α . See Figure 6(a) for an example. The idea is that amatrix gadget performs any given permutation on one half; the followingresult says that the effect on the second half is the inverse permutation. Lemma 8.
Let n = 2 m and let α ∈ S m . The matrix gadget indexed by α performs the permutation (cid:2) α (1) , α (2) , . . . , α ( m ) , α − (1)+ m, α − (2)+ m, . . . , α − ( m )+ m (cid:3) ∈ S n . Proof.
This is straightforward to check. Suppose α ( i ) = j . Then path j makes an R-move until it encounters the “omitted swap” corresponding to j j i + mi + mij i + mj + m F IGURE
7. A pair of complementary paths in a matrix gad-get. Horizontal positions are indicated along the top line.the pair ( i, j ) , and then makes a vertical segment of length followed by anL-move, finishing in position i . Similarly, path i + m finishes in position j + m after an L-move and an R-move. See Figure 7. (cid:3) The matrix gadget is fundamentally more powerful than our other gad-gets, in the sense that it can perform ( n/ different permutations in S n ,whereas each the others can only perform O ( c n ) permutations for someconstants c . The matrix gadget is the source of the “holes” (or, more gen-erally, clusters) mentioned in the introduction. Theorem 3 reflects the factthat some such construction is a requirement if we are to have only linearlymany moves.For some of our constructions, we will need the following variants of thematrix gadget for odd n . Let n = 2 m − , and let α ∈ S m . The truncatedmatrix gadget indexed by α is simply the matrix gadget of the larger size m indexed by α , but with the rightmost swap (in location (2 m − , )omitted (whether or not it is present in the original matrix gadget). SeeFigure 6(b) for an example. This gadget performs a permutation of theform (cid:2) α (1) , α (2) , . . . , α ( m ) , . . . (cid:3) ∈ S m − ; i.e. α on the m leftmost positions, and some permutation on the m − right-most positions. The precise nature of the permutation on the right will notmatter for our applications. Similarly, we may truncate a matrix gadget onthe left side to obtain any desired permutation on the rightmost m positions.Finally, note the following subtle variation. If n = 2 m and the indexpermutation satisfies α (1) = 1 , then the standard matrix gadget already hasno swap in the leftmost column. Figure 6(a) is an example. Therefore, it EPRESENTING PERMUTATIONS WITH FEW MOVES 13 (a) A left reflector. (b) A right reflector. F IGURE , . . . , m , andperforming any desired permutation on the positions , . . . , m . (And it maythen be translated one position leftward, for example).2.3. Reflectors.
Our final gadget also comes in two complementary forms,this time related by reflection in a vertical axis. A right reflector gadgetconsists of swaps at locations ( i + j + 1 , j − i ) for all j ≥ and ≤ i ≤ b ( j ) , where b is a non-decreasing integer-valuedfunction of bounded support. Thus, a right reflector consists of swaps atall odd locations in a region bounded on the left by two line segments run-ning South-West and South-East, and bounded on the right by an interfacecomprising a sequence of South-West and South-East segments. See Fig-ure 8(b). In this case, this rightmost bounding interface must stay to theleft of the horizontal coordinate n . Therefore it corresponds to a Dyck path.The idea of the right reflector is that every path starts with an R-move, thenhas a vertical segment (now possibly of length greater than ), and then is“reflected” back with an L-move. Lemma 9.
A permutation can be performed by some right-reflector if andonly if it is -avoiding. Furthermore, this correspondence between gad-gets and permutations is bijective.Proof.
We prove the “if” direction by induction on n . For n = 1 , the claimis clear. For n > , suppose that π is -avoiding. Consider the locationof element n in π , and write π = [ α, n, β ] , where α, β are the sequences of n n α β F IGURE
9. Inductive construction of a right reflector. Therectangle is chosen so as to route path n to its correct lo-cation, and the two remaining triangles are then filled withsmaller right reflectors.numbers to the left and right of n . Note that α and β are both -avoiding.Also, every element of α is greater than every element of β , otherwise wewould have a pattern including n .We construct a right reflector as shown in Figure 9. There is a ◦ rec-tangle filled with swaps, with one corner at (1 , and an opposite corner at ( n − , n − π − ( n )) ; path n has a vertical segment until it hits this rec-tangle just above its rightmost corner, and then has an L-move. (A trivialcase is when π − ( n ) = n , the rectangle is empty, and path n is vertical).Finally, we use the inductive hypothesis to insert two strictly smaller rightreflectors, which perform the permutations corresponding to relative ordersof α and β , in the triangular regions to the North-East and South-East of therectangle.We now turn to the “only if” direction. Suppose that a right reflectorgadget T performs a permutation π . We first note that T is simple. Indeed,every path consists of an R-move, then a vertical segment, then an L-move(where it is possible that one or both of these moves is empty); since twopaths can only cross during the R-move of one and the L-move of the other,they cannot cross more than once. Now suppose for a contradiction that π contains a pattern. Thus, there exist u < v < w with π ( u ) < π ( w ) < EPRESENTING PERMUTATIONS WITH FEW MOVES 15 π ( v ) . Consider the location x of the unique swap between paths π ( v ) and π ( w ) . By the definition of the right reflector, every odd location in the ◦ rectangle with corners (1 , and x contains a swap. However, path π ( u ) starts to the left of path π ( w ) , and traverses the entire rectangle during itsR-move, and crosses path π ( v ) at the South-East side of the rectangle. Thiscontradicts simplicity.To check bijectivity, since clearly every gadget performs only one per-mutation, it is enough to check that the two sets have equal cardinality. Thenumber of -avoiding permutations in S n is given by the Catalan num-ber C n . A right reflector gadget is encoded by a Dyck path describing itsright boundary. Therefore the number of them is also C n . See e.g. [17,Ex. 6.19]. (cid:3) We remark that the standard Catalan recurrence C n +1 = P ni =0 C i C n − i is implicit in our inductive construction above. Arguments similar to oursappear in the context of stack sorting (see [19, p. 14] and [13]).A left reflector gadget is simply the image of a right reflector under thereflection in the vertical line through the center of the permutation. Thus ithas swaps at locations ( n − i − j, j − i ) for i , j and b ( · ) as before. See Figure 8(a). The next result follows immedi-ately by symmetry. Lemma 10.
A permutation can be performed by some left reflector if andonly if it is -avoiding. This correspondence is bijective.
In our applications, we will prove and use two properties of -avoiding(or -avoiding) permutations that are interesting in their own right: (i)any permutation can be decomposed into a cyclic permutation and a -avoiding permutation (Section 4); (ii) a -avoiding permutation can befound that maps any given subset of { , . . . , n } to any other subset of thesame size (Section 5).3. L OGARITHMIC MOVES PER PATH
Our simplest construction uses only splitters to obtain a simple tanglewith logarithmically many moves per path.
Proof of Proposition 4.
See Figure 10 for the construction and Figure 2(c)for an example. Let π ∈ S n be any permutation and let m = ⌊ n/ ⌋ .Let L = { π (1) , . . . , π ( m ) } and R = { π ( m + 1) , . . . , π ( n ) } . Considerthe Grassmannian permutation ρ obtained by writing the elements of L inincreasing order followed by the elements of R in increasing order. ByLemma 6 there is a splitter than performs ρ . We first apply this splitter. It n · · · ρ (1) ρ ( m ) · · · ρ ( m + 1) · · · ρ ( n ) π (1) π ( m ) · · · π ( m + 1) · · · π ( n ) L R F IGURE
10. Construction for Proposition 4. After the ini-tial splitter, the two rectangles signify smaller recursively de-fined versions of the same construction.remains to perform ρ − · π , which is an ( m, n − m ) -split permutation. Thus,we can split into two subproblems. We then recursively apply the sameprocedure to each, and place the resulting tangles below the initial splitter,after appropriate translations.Each path performs at most one move within each splitter that it encoun-ters (perhaps fewer, since some may splitters involve no move for the path,and some pairs of splitters may be positioned to abut one another, so thattwo moves coalesce). A path encounters at most ⌈ log n ⌉ splitters.The tangle is simple, since if two paths cross in the first splitter, then theysubsequently remain in the two distinct halves. (cid:3) We remark that the above construction can be modified to obtain a tanglewith only one cluster, and O (log n ) moves per path, thus matching up toconstants the extremal case θ ր of Theorem 3. After the first splitter,route path π ( m ) alongside the South-West boundary of the splitter to itscorrect position m . This path then remains vertical for the rest of the tangle,keeping the two halves apart and preventing formation of holes. Iterate onthe two intervals [1 , m − and [ m + 1 , n ] , and ensure that the subsequentsplitters are translated upward until they touch some swap of a previousstage. EPRESENTING PERMUTATIONS WITH FEW MOVES 17
4. B
OUNDED MOVES PER PATH
In this section we prove Theorem 1. The construction will make essentialuse of reflector gadgets. We use the following key property of -avoidingpermutations, which we will then extend to other patterns of length . Apermutation is called cyclic if it has only one cycle (or orbit). Lemma 11.
For any permutation π ∈ S n , there exists a -avoiding per-mutation σ such that σ · π is cyclic.Proof. Assume n ≥ , otherwise the result is trivial. We use an iterativeprocedure to compute a suitable σ . We start with π , and pre-compose itby a sequence of suitably chosen disjoint cycles. The composition of thesecycles will be -avoiding. Given the current permutation τ (which isinitially equal to π ), a rainbow interval is an interval [ a, b ] such that allelements i ∈ [ a, b ] belong to distinct cycles of τ . A maximal rainbowinterval [ a, b ] is one that is not a proper subset of another; thus, either wehave a = 1 , or a − belongs to the same cycle as some element of [ a, b ] ; asimilar condition holds at the other end. If τ is not cyclic, then there existssome maximal rainbow interval [ a, b ] of length at least . We now replace τ with the permutation τ ′ := κ · τ , where κ := h , . . . , a − , a + 1 , a + 2 , . . . , b, a | {z } , b + 1 , . . . , n i , (i.e. a rotation of the interval [ a, b ] ; note that κ is -avoiding). The effectof this change is to unite all the distinct cycles of the elements of [ a, b ] intoone cycle; all other cycles are unchanged. Consequently, if we iterate thisoperation, the rainbow intervals used at successive steps will be disjoint,and eventually τ will be cyclic. Moreover, the various cycles κ used atdifferent steps commute with each other, and their composition σ is -avoiding. (cid:3) Corollary 12.
For any permutation π ∈ S n , and any pattern p ∈{ , , , } , there exists a p -avoiding permutation σ such that σ · π is cyclic.Proof. Lemma 11 is the case p = 312 . Let rev := [ n, n − , . . . , ∈ S n be the reverse permutation. For the case p = 231 , apply Lemma 11 tothe conjugate permutation rev · π · rev − to obtain a -avoiding σ with σ · rev · π · rev − cyclic. The conjugate of the last permutation by rev − is rev − · σ · rev · π · rev − · rev = (rev − · σ · rev) · π , which thus is cyclic also.The permutation rev − · σ · rev is -avoiding, as required.For p = 213 , apply Lemma 11 to rev · π , to obtain a -avoiding σ with σ · rev · π cyclic. Then σ · rev is -avoiding. Finally, for p = 132 , applythe conjugation trick to the p = 213 case. (cid:3) α α − σ σ β β − (a) The construction forLemma 13: two matrix gadgets,a left reflector and a rightreflector. (b) An example. F IGURE
Lemma 13.
For n even and any ( n/ , n/ -split permutation π ∈ S n , thereis a tangle with at most moves per path that performs π .Proof of Lemma 13. Let n = 2 m . Since π is ( m, m ) -split, there exist π , π ∈ S m such that π = ( π (1) , . . . , π ( m )) and π = ( π ( m + 1) − m, . . . , π (2 m ) − m ) . We construct the required tangle using two matrixgadgets, one above the other, together with a left reflector and a right reflec-tor (each of width m ) in the two spaces between them, as in Figure 11.Let α, β ∈ S m be the permutations indexing the upper and lower matrixgadgets respectively (see the definition of a matrix gadget). Let ρ , ρ ∈ S m be the permutations performed by the left reflector and the right reflectorrespectively. Clearly such a tangle performs an ( m, m ) -split permutation,for any choices of α, β, ρ , ρ . Our task is to choose these permutations soas to perform the required π .Recall from Lemma 8 that a matrix gadget performs its indexing permu-tation on the left and the inverse permutation on the right. Thus, our tangleperforms π if and only if(1) α · ρ · β = π and α − · ρ · β − = π . EPRESENTING PERMUTATIONS WITH FEW MOVES 19
The first equation gives π − · α · ρ = β − , and substituting into the secondgives α − · ρ · π − · α · ρ = π . Rearranging,(2) ρ · π − = α · ( π · ρ − ) · α − . There exists an α satisfying (2) if and only if the two permutations ρ · π − and π · ρ − are conjugate. By Corollary 12, for any π , we can choose a -avoiding ρ such that ρ · π − is cyclic. Similarly, for any π , we canchoose a -avoiding ρ such that ρ · π − is cyclic, whence the inverse π · ρ − is cyclic also. The permutations ρ , ρ can be performed by theappropriate reflector gadgets by Lemmas 9 and 10. Thus, the two permuta-tions mentioned above are both cyclic, and therefore conjugate, and so wecan choose α satisfying (2). Finally, we can compute β = ρ − · α − · π ,and (1) will be satisfied.The resulting tangle has at most moves per path: a path has two movesin each matrix gadget, and these moves continue into the reflectors, sincethe gadgets abut each other. (cid:3) Proof of Theorem 1.
First consider even n = 2 m . See Figure 2(a) for anexample. Using Lemma 6, we first apply a splitter gadget that performsthe permutation τ , where τ (1) , . . . , τ ( m ) are π (1) , . . . , π ( m ) in increasingorder, and τ ( m + 1) , . . . , τ (2 m ) are π ( m + 1) , . . . , π (2 m ) in increasingorder. We then use Lemma 13 to obtain a tangle that performs the ( m, m ) -split permutation τ − · π , and we place this tangle below the splitter. Thesplitter adds at most one move to each path.For odd n = 2 m + 1 , we modify the construction as shown in Figure 12.The initial splitter separates the paths into sets of sizes m and m + 1 , withpath at the extreme right being z = max { π ( m + 1) , . . . , π (2 m + 1) } . Wethen proceed as before for the first m paths. Finally, we insert path z intoits proper place in π by an L-move alongside the South-East side of thelower matrix gadget. Path z has only moves, and every other path still hasat most moves. (cid:3) We remark that the last trick for adding an additional path with only moves could be iterated, to obtain an inductive construction of larger tan-gles. However, in general this would incur a quadratic number of moves intotal, for similar reasons to the construction in Figure 3(a).5. L INEAR TOTAL MOVES
We begin with another fact about -avoiding permutations. Write [ k ] := { , . . . , k } . Lemma 14. If A, B ⊆ [ n ] have equal cardinality then there exists a -avoiding π ∈ S n with π ( A ) = B . F IGURE
12. The construction for Theorem 1 for odd n : thelargest element in the right half of the permutation is routedalong the right side. Proof.
The proof is by induction on n . If n = 1 then the claim is obvious.Suppose that the theorem holds for all n ′ < n . We will deduce it for n . Apair ( i, j ) is called conforming if either i ∈ A and j ∈ B , or i / ∈ A and j / ∈ B . (In other words, if we are allowed to assign π ( i ) = j ). We considerseveral cases. Case 1.
Pair ( n, is conforming. Without loss of generality, suppose that n / ∈ A and / ∈ B ; otherwise take complements of A and B . Consider theset B − { i − i ∈ B } . By the induction hypothesis, there existsa -avoiding σ ∈ S n − with σ ( A ) = B − . Define π ∈ S n by setting π ( n ) = 1 , and π ( i ) = σ ( i ) + 1 for i < n . Then π is 132-avoiding, and maps A to B , as required. Case 2.
Pair (1 , n ) is conforming. Without loss of generality, / ∈ A and n / ∈ B . Consider A − { i − i ∈ A } . By the induction hypothesisthere exists a -avoiding σ ∈ S n − with σ ( A −
1) = B . Define π ∈ S n by π (1) = n and π ( i ) = σ ( i − for i > . Case 3.
Pair ( n, n ) is conforming. Apply the inductive hypothesis to , . . . , n − and set π ( n ) = n . Case 4.
None of the pairs ( n, , (1 , n ) , ( n, n ) is conforming. Without lossof generality, ∈ A . Then n / ∈ B because (1 , n ) is not conforming. Then n ∈ A because ( n, n ) is not conforming. Then / ∈ B because ( n, is notconforming. In summary, we have , n ∈ A but , n / ∈ B . EPRESENTING PERMUTATIONS WITH FEW MOVES 21
We claim that there exists an integer k with ≤ k ≤ n − such that | A ∩ [ k ] | = | B ∩ ([ n ] \ [ n − k ]) | . Indeed, we have | A ∩ [1] | = 1 > | B ∩ ([ n ] \ [ n − | , whereas | A ∩ [ n − | = | A | − < | B | = | B ∩ ([ n ] \ [1]) | ;but the difference | A ∩ [ j ] | − | B ∩ ([ n ] \ [ n − j ]) | decreases by at most as j is increased by ; thus it must be for some j .Let A ′ = A ∩ [ k ] and B ′ = ( B ∩ ([ n ] \ [ n − k ])) − ( n − k ) . By theinduction hypothesis, (since k < n ) there exists a -avoiding π ∈ S k with π ( A ′ ) = B ′ . Let A ′′ = ( A ∩ ([ n ] \ [ k ])) − i and B ′′ = B ∩ [ n − k ] .By the induction hypothesis, (since n − k < n ) there exists a -avoiding π ∈ S n − k with π ( A ′′ ) = B ′′ . We define π by setting π ( j ) = π ( j ) + n − k for j ≤ k , and π ( j ) = π ( j − k ) for j > k . This π is -avoiding: if u < v < w form a pattern, then we cannot have all three in [ k ] or allthree in [ n ] \ [ k ] . On the other hand, we cannot have u ≤ k < w : indeed,for all i ≤ k < j we have π ( i ) > n − k ≥ π ( j ) . (cid:3) The following is a major ingredient of the proof of Theorem 2.
Proposition 15.
Let π ∈ S n be a ( ⌈ n/ ⌉ , ⌊ n/ ⌋ ) -split permutation. Thepermutation π can be performed by a tangle all of whose swaps are withinthe triangular region { ( x, t ) : − x < t < x } . The tangle accepts n pathsrunning in the South-East direction on its North-West edge, and outputsthem running in the South-East direction on its South-East edge, and has atmost n moves including these input and output segments.Proof. We first assume that n = 2 m is even, so π is ( m, m ) -split. Theconstruction of the required tangle C is recursive: it consists of a matrixgadget M , together with a right reflector R of width m placed to the North-East of the matrix, and a smaller, recursively-constructed version C ′ of itself(performing a suitable permutation of size m ) placed to the South-East ofthe matrix. See Figure 13(a).We now explain how to choose the gadgets. Let ρ, µ ∈ S n be the per-mutations performed by the right reflector R (when translated to the righthalf [ m + 1 , n ] ) and the matrix gadget M , respectively. Since the right-reflector does not affect positions in the left half [1 , m ] , we require that [ µ (1) , . . . , µ ( m )] = [ π (1) , . . . , π ( m )]( ∈ S m ) . Therefore we choose the ma-trix gadget to be indexed by this last permutation. Now consider the righthalf. The tangle C ′ can perform any desired ( ⌈ m/ ⌉ , ⌊ m/ ⌋ ) -split permuta-tion on positions m + 1 , . . . , m . Therefore, letting Q = [ m + ⌈ m/ ⌉ + 1 , n ] be the set of positions in the last quarter of [1 , n ] , we need to choose ρ sothat ρ · µ ( Q ) = π ( Q ) . Since | µ ( Q ) | = | π ( Q ) | , by Lemmas 9 and 14, thereis a right reflector that achieves this.In the case when n = 2 m + 1 is odd, the construction is modified asfollows. The matrix gadget is replaced with a truncated version (with the M RC ′ (a) Construction of the tangle C in Proposition 15, comprisinga right reflector, a matrix, anda recursively-constructed version C ′ of itself. (b) An example foreven n . (c) An example forodd n . F IGURE , . . . , m + 1 .Finally, we count moves. Suppose that all paths start running in theSouth-East direction. Then each path makes at most 2 moves in the re-flector together with the matrix, including the input path, but not includingthe final R-move in the case of the paths in the right half. Since these movescontinue into C ′ , writing A ( n ) for the maximum number of moves requiredby our construction for a permutation of size n , we have A ( n ) ≤ n + A (cid:0) ⌊ n/ ⌋ (cid:1) . By induction, A ( n ) ≤ n . (cid:3) Proof of Theorem 2.
The construction is illustrated in Figure 14, and Fig-ure 2(b) is an example. We first assume that n is a multiple of , and write n = 4 m . As shown in Figure 14, the tangle finishes with a merger G that(by Lemma 7) intersperses the paths in locations , . . . , m with those in m + 1 , . . . , m in an arbitrary way while maintaining the relative orderof each. Therefore, the remainder of the tangle (above the merger) needsto perform an arbitrary (2 m, m ) -split permutation. On the other hand, thetangle starts with two splitters S and S , placed in the first and secondhalves. By Lemma 6 each of these splitters can map any desired set of EPRESENTING PERMUTATIONS WITH FEW MOVES 23 M M CS S Gm m m m F IGURE
14. Construction for Theorem 2: splitters S , S ,matrix gadgets M , M , merger G , and a tangle C fromProposition 15.paths into its own first half (of width m ). Therefore, the task for the remain-ing portion of the tangle (i.e. everything apart from the merger and the twosplitters) is to perform an arbitrary ( m, m, m, m ) -split permutation.The remainder of the tangle is composed of two matrix gadgets, togetherwith a tangle constructed via Proposition 15. Both matrix gadgets havewidth m . The upper matrix gadget M occupies the middle half [ m +1 , m ] of [1 , n ] . The other matrix gadget, M , abuts M to the South-Westand occupies the first half [1 , m ] . The tangle C from Proposition 15 alsohas width m , and is located on the right, partially abutting M .We now explain how to choose these gadgets. The matrix gadget M ischosen so as to perform the required permutation in the first quarter [1 , m ] .Then M chosen so that the required permutation in the second quarter [ m +1 , m ] is performed by the left half of M composed with the right half of M . Finally, C needs to perform an arbitrary ( m, m ) -split permutation (onpositions [2 m + 1 , m ] ). This can be achieved, by Proposition 15.We now count moves. We first total the moves within each component.When two components abut each along a common boundary, the movescrossing this boundary will be double-counted. Therefore we then subtracta term corresponding to the total length of the common boundaries. The (a) n ≡ . (b) n ≡ . (c) n ≡ . (d) n ≡ . F IGURE
15. Variations of the construction for Theorem 2,according to the congruence class of n .upper splitters each contribute m moves; the two matrix gadgets each con-tribute m moves; the final merger contributes m moves; and the tangle C contributes n/
2) = 2 n moves, by Proposition 15. The total over-countingfrom common boundaries is m + m + 3 m + 3 m . Therefore, there are atmost m − m = 16 m = 4 n moves.Finally, we describe how the construction is adjusted when n is not amultiple of . Let n = 4 m + r where m is an integer and r ∈ { , , , } .Depending on the value of r , we choose a suitable splitting into quarters,and use carefully chosen truncated matrix gadgets. The splitters and mergerare adjusted to that the remaining central section of the tangle must performa permutation that is split as follows: r = 0 : ( m, m, m, m ) r = 1 : ( m, m, m + 1 , m ) r = 2 : ( m, m + 1 , m + 1 , m ) r = 3 : ( m + 1 , m + 1 , m + 1 , m ) . The case r = 0 was described above. In the case r = 1 , the matrix gadget M is not truncated, but has width m + 1) , and is chosen to have noswap in its leftmost column. In the case r = 2 , the matrix M is truncatedon its left side. In the case r = 3 , both matrices have width m + 1) , andneither is truncated. For each of r = 1 , , , the tangle C has odd width, andperforms a ( m + 1 , m ) -split permutation, as stated in Proposition 15. Thesechoices ensure that the various components can still abut each other withoutintroducing extra moves at the boundaries. See Figure 15 for examples. (cid:3) EPRESENTING PERMUTATIONS WITH FEW MOVES 25 F IGURE
16. Corners and clusters (for a tangle constructedaccording to the proof of Theorem 2). Corners are circled,and corners connected by thick lines belong to the same clus-ter. There are three clusters.We remark that, in the above construction, while the average number ofmoves per path is only , some paths may have as many as Θ(log n ) moves– this is a consequence of the recursive construction in Proposition 15.6. C LUSTER BOUND
In this section we prove Theorem 3. Recall that swaps are located atelements of the integer lattice Z , and thus corners are located at elementsof ( Z + ) . Recall that a cluster is a connected component of the graphwhose vertices are corners, and with an edge between two corners if theirlocations are within ℓ ∞ -distance . See Figure 16 for an example.We start with a standard estimate for counting clusters. Let Z ∗ be thegraph with vertex set Z and an edge between any two elements that are at ℓ ∞ -distance from each other. By a ∗ -animal we mean a finite subset of Z that induces a connected subgraph of Z ∗ . The size of a ∗ -animal is thenumber of its vertices. Two ∗ -animals are said to be equivalent if one canbe obtained from the other by a translation of Z . Lemma 16.
The number of equivalence classes of ∗ -animals of size m is atmost A m , where A = 7 / . Proof.
Apply the argument of Eden [6], adapted to the ∗ lattice. See alsoe.g. [12]. (cid:3) Proof of Theorem 3.
Fix θ ∈ (0 , ) and n > θ − /θ . Suppose for a contra-diction that there are at least e − n n ! distinct permutations π ∈ S n each ofwhich has a tangle T π with fewer than K := ( − θ ) n clusters and fewerthan C := θn log n corners.For any tangle T , suppose that there are no corners at the time t + .It is easy to check that all segments must be vertical at the point, so thethree permutations corresponding to times t − , t + , t + are all equal.Therefore we can remove one of these permutations from the sequence toobtain a new tangle. This operation preserves the number of corners, anddoes not increase the number of clusters. We can therefore assume thateach of the tangles T π defined above has depth at most equal to its numberof corners. We may further assume that the time of the first corner is .Therefore all corners are within a fixed rectangle R of area Cn . (Recall thatthere are at most C corners).If we are given the set of locations of corners of a tangle, together withthe directions of the two incident path segments at each corner, then we canrecover the tangle. At any given corner there are at most − possiblechoices for this pair of directions.We now bound from above the number of possible tangles T π . A clusterof size m corresponds to a ∗ -animal together with a location in the rectangle R . Therefore the number of possible tangles is at most X m ,...,m k k Y i =1 (cid:0) A m i m i Cn (cid:1) , where the sum is over all sequences ( m i ) i =1 ,...k with k ≤ K , and m i ≥ and P i m i ≤ C , and where A is the constant from Lemma 16. The numberof choices of such ( m i ) i =1 ,...,k is at most C , so the above expression is atmost ( Cn ) K (12 A ) C .Since each T π corresponds to a different permutation π , we have e − n n ! ≤ ( Cn ) K (12 A ) C . Taking logarithms, substituting for C and K , and using log( n !) > n log n − n , we obtain n log n − n ≤ ( − θ ) n log( Cn ) + θn log n log(12 A ) . Using log(12 A ) < and simplifying gives log n − ≤ ( − θ ) log C. EPRESENTING PERMUTATIONS WITH FEW MOVES 27
Since < − θ < and log C ≤ log n + log log n , this implies θ log n ≤ log log n. It is straightforward to check that this gives a contradiction if n > θ − /θ . (cid:3) We remark that there is nothing special about the choice of ℓ ∞ -distance in the definition of clusters, except that it is fairly natural in the contextof the tangles that we have constructed. The above argument goes through(with different constants) for other choices of norm and threshold distance.7. L OWER BOUND FOR SIMPLE TANGLES
Proof of Proposition 5.
First assume that n = r + 2 . Consider the permu-tation(3) π = h n, r + 1 , r, . . . , | {z } , r + 1 , r, . . . , r + 2 | {z } , . . . , n − , . . . , n − r | {z } , i . Thus, π consists of r blocks of length r , with each block having its elementsin reverse order, and with and n in reverse order at the two ends. Forexample, for r = 3 the permutation is π = [11 , , , , , , , , , , .Define block i to be the set B ( i ) = { ir + 2 , . . . , ir + r + 1 } for i = 0 , , . . . , r − . Let T be a simple tangle that performs π . Every pathother than and n has at least two moves, since it crosses paths n and indifferent directions. Observe that paths of B ( i ) and B ( j ) do not cross eachother for i = j . Call a path bad if it has at least moves, and call a block terrible if it contains at most one non-bad path. Next, we show that thereare at most non-terrible blocks, from which the result will follow easily.Since paths from different blocks cannot cross each other, for any i < j ,all elements of B ( i ) precede all elements of B ( j ) in any permutation of thetangle. Now consider the location ( x, t ) of the unique swap between paths and n . Recall that ( x, t ) occurs between permutations π t and π t +1 , andswaps the elements in locations x and x + 1 . Let H := (cid:8) π t ( x − r − , . . . , π t ( x + r ) (cid:9) be the set of elements that are within distance r on the left and right justbefore this swap. The set H has exactly r elements including and n .Thus, by the previous observation, H contains elements from at most blocks. We will show that any block having no elements in H is terrible.Suppose that B ( i ) ∩ H = ∅ . By the argument of the previous paragraph,either all elements of B ( i ) are before all elements of H in the permutation π t , or they are after. Without loss of generality, assume the former. This H ′ npq tus F IGURE
17. The key step in the proof of Proposition 5. Thepaths of H ′ must all cross path n before time s , therefore atleast as many paths must cross path p during the same timeinterval.implies that each path of B ( i ) crosses before it crosses n . Let p < q beany elements of B ( i ) . We will show that at least one of paths p, q is bad. Let ( y, s ) be the location of the swap of p and q , and consider the permutation π s . We consider six cases.Suppose first that π s = [ . . . , , . . . , p, q, . . . , n, . . . ] (which is to say that p and q swap in the region above paths and n ). Path p has an R-move (toswap with q ), then an L-move (to swap with ), then an R-move (to swapwith n ). Therefore p is bad. The case π s = [ . . . , n, . . . , p, q, . . . , , . . . ] (where p and q swap below paths and n ) can be treated symmetrically.Suppose now that π s = [ . . . , p, q, . . . , , . . . , n, . . . ] (which is to say that p and q swap in the region left of paths and n , and at or before time t , so s ≤ t ). The argument for this case is illustrated in Figure 17. If p is not bad,then path p has an L-move (to swap with 1), followed by an R-move duringwhich it swaps with both q and n . Let H ′ := { π t ( x − r − , . . . , π t ( x ) } .All elements of H ′ are between p and n in π t . These elements do not swapwith p after time t , because π t ( x ) = 1 has already swapped with p , whilethe others belong to different blocks and so never swap with p . Let u bethe time of the swap of p and n . Since u ≥ t , all elements of H ′ mustswap with n strictly before time u . Therefore u − t ≥ r . Therefore, path p has at least r swaps at times in the interval [ t, u ) (since s ≤ t , so itsunique R-move is in progress throughout this interval). Since path p alsoswaps with and n , it has at least r + 2 swaps in total, which contradictssimplicity, since p is involved in only r + 1 inversions. Thus, p is bad. Thecase π s = [ . . . , p, q, . . . , n, . . . , , . . . ] can be treated symmetrically. EPRESENTING PERMUTATIONS WITH FEW MOVES 29
Finally, the cases π s = [ . . . , , . . . , n, . . . , p, q, . . . ] and π s =[ . . . , n, . . . , , . . . , p, q, . . . ] are impossible, since together with our assump-tion about π t they imply contradictions to simplicity.Now we count moves. There at least r − terrible blocks, each of whichhas at least r − bad paths, which have at least moves, so the total numberof moves is at least r − r − ≥ r − r ) ≥ n − c √ n for some c > .For general n , we use the same construction with r = ⌊√ n − ⌋ , add anextra n − r − < √ n + 1 elements at the end of the permutation, andadjust the constant. (cid:3) It is tempting to try to extend the ideas of the above proof to show thatthere are permutations for which any simple tangle has ≫ n moves as n → ∞ (perhaps even Ω( n log n ) ). A candidate permutation might be con-structed recursively: a “level- k permutation” would have the same structureas π above, except with each block replaced with a smaller level- ( k − permutation; the number of levels might be chosen to be of order log n (orat least something ≫ ). We have not succeeded in completing such anargument. Indeed, we do not know whether in fact O ( n ) moves (or even O (1) moves per path) suffice for a simple tangle.8. P ER PATH LOWER BOUND
Finally, we prove a lower bound on moves per path that applies even fornon-simple tangles, as mentioned in the introduction.
Proposition 17.
For any n > there exists a permutation π ∈ S n such thatany tangle performing π has a path with at least 3 moves. Our proof of this seemingly simple statement is surprisingly intricate,and involves the two lemmas below. The permutation will be π := (cid:2) n, , , n − , n − , . . . , , , n − , n − , (cid:3) . Recall that a pair of elements i, j is said to be an inversion of a permutation π if i < j but π − ( i ) > π − ( j ) . Lemma 18.
Let T be a tangle performing any permutation of the form π = [ n, . . . , with each path making at most moves. Let < i < j < n .If i, j is an inversion then paths i and j cross each other exactly once. If i, j is not an inversion then paths i and j either do not cross or cross exactlytwice. In the latter case, the permutation at the time t just before paths and n cross is of the form π t = [ . . . , j, . . . , , n, . . . , i, . . . ] . n n a ab bW ESN F IGURE
18. Illustration of the proof of Lemma 19: the re-gion formed by paths a, b, , n , and the four types of paththat may intersect it. An RL path necessitates an LR path,but an LR path requires two further moves in order to crosspaths n and . Proof.
Paths i and j must cross an odd number of times if i, j is an inversion,and an even number of times if not. Since each path has at most moves,they cannot intersect more than twice.Suppose that paths i and j cross twice. Then i must have an R-movefollowed by an L-move, and vice-versa for j . Since any path other than and n must cross path during an L-move and cross path during an R-move,the claimed form of π t follows. (cid:3) Lemma 19.
Let T be a tangle performing a permutation of the form π =[ n, . . . , with each path making at most moves. Let z < a < b be somepaths of T that first cross n and then cross . If path z crosses neither a nor b , then a and b do not cross each other.Proof. Suppose on the contrary that paths a and b cross. By Lemma 18,they cross only once. Path b cannot cross a before n , since then b wouldhave more than moves. Similarly, path b cannot cross a after , since a would have moves.Therefore, path b crosses n , then a , then . Let N, E, S, W be the inter-section points of the pairs of paths ( n, a ) , ( a, b ) , (1 , b ) , (1 , n ) respectively,all of which are unique by Lemma 18. These points are connected in clock-wise order by four portions of the paths a, b, , n , which bound a region N ESW . See Figure 18. Note that any path other than or n has exactlyone L-move and one R-move. Therefore, the sides N E and ES (which EPRESENTING PERMUTATIONS WITH FEW MOVES 31 form part of paths a and b ) are straight line segments. On the other hand,the sides SW and W N may each contain at most one vertical segment,since paths and n may have two moves in the same direction separated bya vertical segment.Let ℓ ( SW ) denote the number of intersections of the side SW with pathsother than , n, a, b (which corresponds to the length of its non-vertical por-tions), and similarly for each of the other three sides. By the above obser-vations, ℓ ( W N ) ≤ ℓ ( ES ); ℓ ( SW ) ≤ ℓ ( N E ) . Every path other than , n, a, b than intersects N ESW must do so either ina single L-move or R-move, or with an L-move followed by an R-move, orvice-versa. Let p ( L ) , p ( R ) , p ( LR ) , p ( RL ) denote the numbers of paths ineach category. We have ℓ ( W N ) = p ( RL ) + p ( R ); ℓ ( N E ) = p ( LR ) + p ( L ); ℓ ( ES ) = p ( LR ) + p ( R ); ℓ ( SW ) = p ( RL ) + p ( L ) . Combining these equations with either of the above inequalities gives p ( RL ) ≤ p ( LR ) . We have p ( RL ) ≥ , because of path z . However, p ( LR ) ≥ gives acontradiction, because such a path has at least moves, in order to cross n , a , b and . (cid:3) Proof of Proposition 17.
Consider π := h n, , |{z} , n − , n − , . . . , , | {z } , n − , n − | {z } , i . We denote A = { , } , B = { , . . . , n − } , and C = { n − , n − } .Suppose for a contradiction that there exists a tangle T performing π in which each path has at most moves. First suppose that T is simple.In each permutation of the tangle, the elements of A precede the elementsof B , which precede the elements of C . Let t be the time of the swap , n , and suppose that some element x appears to the right of this swap, i.e. π t = [ . . . , , n, . . . , x, . . . ] . If x ∈ A ∪ B then paths x < n − < n − contradict Lemma 19. Thus x ∈ C . Similarly, if π t = [ . . . , y, . . . , , n, . . . ] then y ∈ A . Thus there is no possible location for the elements of B in π t ,a contradiction.Suppose on the other hand that T is not simple. Thus there exist paths i, j that double-cross (i.e. have two crossings). By Lemma 18, the pair i, j isnot an inversion, therefore i, j are from two different sets among A, B, C .We claim that there exist i ′ ∈ A and j ′ ∈ C whose paths double-cross.Suppose not. Without loss of generality, assume that i ∈ A and j ∈ B double-cross. Since path i and any path of C do not double-cross, they do not cross at all by Lemma 18. Since path i has an R-move then an L-move,we have π t = [ . . . , , n, . . . , i, . . . ] . So paths i < n − < n − contradictLemma 19. Thus i ′ , j ′ exist as claimed.Since n > and | B | > , there are at least two elements u, v of B that either both cross before n , or both cross n before . Without loss ofgenerality, assume the latter. Since paths i ′ and u both move right then left,they cannot double-cross, and therefore by Lemma 18, they do not cross.By the same reasoning, i ′ and v do not cross. But now the paths i ′ < u < v give a contradiction to Lemma 19. (cid:3) A CKNOWLEDGEMENTS
We thank Omer Angel, Franz Brandenburg, David Eppstein, Martin Fink,Michael Kaufmann, Peter Winkler and Alexander Wolff for valuable con-versations. O
PEN PROBLEMS
1. What is the asymptotic behavior as n → ∞ of the maximum over permu-tations π ∈ S n of the minimum number of moves among simple tanglesthat perform π ? In particularly, is it O ( n ) ? Our results show only that itis between n − o ( n ) and O ( n log n ) .2. Similarly, what is the asymptotic behavior of the number of moves inthe worst path (again, for the best simple tangle performing the worstpermutation)? Our bounds are and O (log n ) .3. For general (not necessarily simple) tangles, what is the smallest con-stant a for which there exists a tangle with at most an moves for everypermutation in S n , for every n ? And what is the smallest b for which wecan achieve at most b moves per path? We know that ≤ a ≤ and ≤ b ≤ .4. Many natural questions arise concerning permutations that can be per-formed by tangles of various restricted types. For example, suppose thatthe swaps of a tangle occupy all even locations in a simply connectedregion bounded above and below by interfaces consisting of North-Eastand South-East steps, and on the left and right by interfaces of South-West and South-East steps, as in Figure 19(a). Note in particular thatthere is one cluster, and no “holes”. It is not difficult to show that anypermutation can be performed by such a tangle of depth at most O ( n ) (see Figure 19(b) for the idea), but this seems far too large. What is theminimum depth needed? Is there a simple characterization of the set ofpermutations that can be performed if the depth is restricted to be at most n (say)? EPRESENTING PERMUTATIONS WITH FEW MOVES 33 (a) A tangle occupying a simply con-nected region bounded by monotoneinterfaces, as discussed in open prob-lem 4. (b) A greedy construction of such atangle: we apply alternate rows ofswaps in odd and even positions un-til path π ( n ) is in the rightmost po-sition, then continue in the same waywith locations , . . . , n − . F IGURE
EFERENCES [1] M. Ajtai, J. Koml´os, and E. Szemer´edi. Sorting in c log n parallelsteps. Combinatorica , 3(1):1–19, 1983.[2] M. H. Albert, R. E. L. Aldred, M. Atkinson, H. P. van Ditmarsch,C. C. Handley, D. A. Holton, and D. J. McCaughan. Compositions ofpattern restricted sets of permutations.
Australian J. Combinatorics ,37:43–56, 2007.[3] O. Angel, A. E. Holroyd, D. Romik, and B. Virag. Random sortingnetworks.
Advances in Mathematics , 215(2):839–868, 2007.[4] S. Bereg, A. E. Holroyd, L. Nachmanson, and S. Pupyrev. Drawingpermutations with few corners. In
Graph drawing , volume 8242 of
Lecture Notes in Comput. Sci. , pages 484–495. Springer, Cham, 2013.[5] N. Bergeron and S. Billey. RC-graphs and Schubert polynomials.
Ex-periment. Math. , 2(4):257–269, 1993.[6] M. Eden. A two-dimensional growth process. In
Proc. 4th Berke-ley Sympos. Math. Statist. and Prob., Vol. IV , pages 223–239. Univ.California Press, Berkeley, Calif., 1961. [7] H. Eriksson, K. Eriksson, J. Karlander, L. Svensson, and J. W¨astlund.Sorting a bridge hand.
Discrete Math. , 241(1-3):289–300, 2001. Se-lected papers in honor of Helge Tverberg.[8] S. Felsner. On the number of arrangements of pseudolines. In
Pro-ceedings of the 12th Annual Symposium on Computational Geometry ,pages 30–37, 1996.[9] S. Fomin and A. N. Kirillov. The Yang-Baxter equation, sym-metric functions, and Schubert polynomials.
Discrete Mathematics ,153(13):123 – 143, 1996. Proceedings of the 5th Conference on For-mal Power Series and Algebraic Combinatorics.[10] A. M. Garsia.
The saga of reduced factorizations of elements of thesymmetric group . Universit´e du Qu´ebec [Laboratoire de combinatoireet d’informatique math´ematique (LACIM)], 2002.[11] S. Kitaev.
Patterns in permutations and words . Monographs in The-oretical Computer Science. An EATCS Series. Springer, Heidelberg,2011. With a foreword by Jeffrey B. Remmel.[12] D. A. Klarner. Cell growth problems.
Canad. J. Math. , 19:851–863,1967.[13] D. E. Knuth.
The art of computer programming. 1, Fundamental al-gorithms . Addison-Wesley, 1973.[14] D. E. Knuth.
The art of computer programming. 3, Sorting and Search-ing . Addison-Wesley, 1997.[15] S. Pupyrev, L. Nachmanson, S. Bereg, and A. E. Holroyd. Edge rout-ing with ordered bundles. In
Graph Drawing , pages 136–147, 2011.[16] S. Pupyrev, L. Nachmanson, and M. Kaufmann. Improving layeredgraph layouts with edge bundling. In
Proc. 18th Int. Symp. on GraphDrawing , pages 465–479, 2010.[17] R. P. Stanley.
Enumerative Combinatorics , volume 2. CambridgeStudies in Advanced Mathematics 62, Cambridge University Press,1999.[18] D. C. Wang. Novel routing schemes for IC layout, part I: Two-layerchannel routing. In
Proc. 28th ACM/IEEE Design Automation Con-ference , pages 49–53, 1991.[19] J. West.
Permutations with forbidden subsequences, and, stack-sortable permutations . PhD thesis, Dept. of Mathematics, Mas-sachusetts Institute of Technology, 1990.[20] A. T. White. Ringing the cosets.
Amer. Math. Monthly , 94(8):721–746,1987.[21] B. Young. A Markov growth process for Macdonald’s distribution onreduced words, 2014. arXiv:1409.7714.
EPRESENTING PERMUTATIONS WITH FEW MOVES 35 (Sergey Bereg) U
NIVERSITY OF T EXAS AT D ALLAS , USA
E-mail address : [email protected] (Alexander E. Holroyd) M ICROSOFT R ESEARCH , USA
E-mail address : [email protected] (Lev Nachmanson) M ICROSOFT R ESEARCH , USA
E-mail address : [email protected] (Sergey Pupyrev) U NIVERSITY OF A RIZONA , USA
E-mail address ::