A Bijection on Classes Enumerated by the Schr\"oder Numbers

We consider a sorting machine consisting of two stacks in series where the first stack has the added restriction that entries in the stack must be in decreasing order from top to bottom. The class of permutations sortable by this machine are known to be enumerated by the Schr\"oder numbers. In this paper, we give a bijection between these sortable permutations of length $n$ and Schr\"oder paths -- the lattice paths from $(0,0)$ to $(n-1,n-1)$ composed of East steps $(1,0)$, North steps $(0,1)$, and Diagonal steps $(1,1)$ that travel weakly below the line $y=x$.


Introduction
A stack is a sorting device that works by a sequence of push and pop operations. This last-in, first-out machine was shown by Knuth [8] to sort a permutation if and only if that permutation avoids the pattern 231. That is, if there are not three indices i < j < k with π k < π i < π j , then it is possible to run π through a stack and output the identity permutation. The class of stack-sortable permutations is enumerated by the Catalan numbers.
In the language of permutation patterns, any downset of permutations in the permutation containment ordering is a class, and every class has a basis, which consists of the minimal permutations not in the class. Given that the basis for the class of permutations sortable by one stack contains only a single pattern of length three, considering two stacks in series is quite natural. However, the problem becomes rather unwieldy. In the case of two stacks in series, Murphy [11] showed that the class of sortable permutations has an infinite basis. The enumeration of this class also appears to be difficult. The best known bounds are given by Albert, Atkinson, and Linton [2].
We note that to sort a permutation by two stacks in series, the push and pop operations are such that when an entry is popped out of the first stack, it is immediately pushed into the second stack.
To get a better handle on this problem, many have considered different types of weaker sorting machines. One such weaker machine is a stack in which the entries must increase when read from top to bottom. Atkinson, Murphy, and Ruškuc [3] found an optimal algorithm for sorting permutations which are sortable * partially supported by the NSA Young Investigator Grant H98230-08-1-0100 ISSN 1365-8050 c 2017 by the author(s) Distributed under a Creative Commons Attribution 4.0 International License using two increasing stacks in series. Note that to obtain the identity permutation, the last stack will be an increasing stack even without declaring this restriction. Their left-greedy algorithm sorts all permutations sortable by this machine. Interestingly enough, the basis for these sortable permutations is still infinite, but the permutation class was found to be in bijection with the permutations that avoid 1342 as enumerated by Bóna [5]. Both enumerations were found by using a bijection with β(0, 1) trees. One can analogously define a decreasing stack as a stack in which the entries must decrease when read from top to bottom. Smith [14] considered sorting with a decreasing stack followed by an increasing stack, a machine called DI (we refer to the decreasing stack as D and the increasing stack as I). We illustrate how a permutation can be sorted with the DI sorting machine in Figure 1. Notice that this permutation contains the pattern 2341, and as such cannot be sorted by two increasing stacks in series. The class of DI-sortable permutations was shown to have a finite basis, {3142, 3241}. Kremer [9,10] has shown previously that this class is enumerated by the large Schröder numbers. The Schröder numbers were introduced in somewhat modern times by Schröder [13] as legal bracketing of variables, though at least the initial terms of this sequence were known to Hipparchus [15]. Rogers and Shapiro [12] found bijections showing certain classes of lattice paths are enumerated by the Schröder numbers. While there are several such classes of lattice paths, we use the one given in the definition below. Definition 1.1. Let n ≥ 1. A lattice path from (0, 0) to (n, n) taking only East (1, 0), North (0, 1), and Diagonal (1, 1) steps while staying weakly below the main diagonal will be referred to as a Schröder path. We illustrate all of the Schröder paths from (0, 0) to (2,2) in Figure 2.
In Section 2, we state the algorithm from [14] for producing a word from a DI-sortable permutation, then classify when a sorting word is the result of the algorithm. In Section 3, we give an algorithm which produces a Schröder path from a word produced by the algorithm in Section 2, then show there is a bijective correspondence between algorithmic DI words and Schröder paths. In Section 4, we discuss some properties of DI-sortable permutations which can be ascertained from aspects of their corresponding Schröder paths, and we conclude with some open questions.
On a related note, Ferrari [7] gave bijections between permutations sorted by restricted deques and a different class of lattice paths also enumerated by the Schröder numbers. Also, Bandlow, Egge, and Killpatrick [4] gave a bijection between a different permutation class and Schröder paths. Additionally, more background on stacks in general was consolidated by Bona [6].

The Sorting Algorithm
Let W be a word, i be a positive integer, and L be a letter. In what follows, we denote the letter in the i th position of W as W (i), # L (W ) as the number of occurrences of L in W , and W i as the first i characters in W . We often refer to W i as a prefix of W . We use L i to denote i repetitions of L.
In [14], Smith showed the following algorithm was an optimal way to sort permutations using the DI machine in the sense that this algorithm would sort any DI-sortable permutation.
1. If the top entry of the second (increasing) stack is the next entry of the output, then pop the entry to the output.
2. If all of the m entries in the first (decreasing) stack make up the next m entries of the output, then push those entries to the second stack.
3. Otherwise, if the next entry of the input is smaller than the top entry of the second stack and larger than the top entry of the first stack, then push it onto the first stack. We will apply the convention that the next entry of the input satisfies each of the aforementioned properties if there is no entry in the corresponding stack with which to compare it. Thus, this step can be thought of as pushing the next entry from the input to the top of the first stack if that entry can legally sit atop each of the two stacks at this stage.
4. Finally if neither of those moves are available, push the top entry from the first stack to the second.
It was noted in [14] that Step 2 of this algorithm is not needed to produce an optimal algorithm. However, we continue to utilize it as outputting entries earlier in the process is useful in constructing a bijection between the DI-sortable permutations and Schröder paths. Definition 2.2. Let E represent a push step from the input to the first stack, let N represent pop/push from the first stack to the second stack, and let C represent the pop from the second stack to the output. See Figure 3. A sorting word of a permutation is a word representing steps that can be taken to sort that permutation using two stacks in series (without restriction). We use L i to denote the occurrence of the letter L in W which corresponds to the movement of symbol i. 1. The length of W is 3n and W contains exactly n of each of the letters E, N, and C.

For all
. That is, in any prefix of W , the number of Cs does not exceed the number of Ns, which does not exceed the number of Es.
Note that for every sorting word, there exists a permutation π which it sorts. To find π, apply W to the identity permutation, and let σ be the output (which is not necessarily sorted). Then W sorts π = σ −1 .

Definition 2.4.
A DI word of a permutation π is a sorting word representing steps that can be taken to sort π using the DI machine.
Definition 2.6. The algorithmic DI word (ADI word for short) of a permutation π is the unique word representing steps that will be taken when applying Algorithm 2.1 to sort π by the DI machine.
Example 2.7. Algorithm 2.1 was used in the process illustrated by Figure 1. So the ADI word of 23514 is EEENNNENCCCENCC. To use the indices outlined in Definition 2.2, the ADI word of 23514 can also be given as For the duration of the paper, we say that X < W Y in a word W if X appears before Y in W . Similarly we say X ≺ W Y if X appears immediately before Y in W .
We begin with some observations about the relative locations of symbols in a DI-word, then follow with a classification of when a sorting word is a DI-word and an ADI-word.
Observation 2.8. Let π be a DI-sortable permutation and let W be a DI word. Let i, j ∈ [n].
(i) E πi < W E πj if and only if i < j; symbols appearing in π earlier enter the first stack earlier.
(ii) C πi < W C πj if and only if π i < π j ; symbols must exit the second stack in increasing order.
(iii) If π i < π j and N πi < W N πj , then C πi < W N πj ; if a smaller number enters the second stack before a larger number, it must be output before the larger number can enter the second stack -otherwise the increasing condition for the second stack is not satisfied. Hence if π i < π j and N πi < W E πj , then C πi < W N πj . We highlight this specifically as it will be used in later proofs.
(iv) If N πi < W N πj < W C πi , then C πj < W C πi ; if π j enters the second stack after π i and before π i exits, then π j < π i by the increasing condition of the second stack. So π j must exit before π i .
(v) If E πj < W C πi < W N πj (which implies π i < π j ), then N πi < W E πj ; if a smaller number is pushed to the output while a larger number is in the first stack, the smaller number was popped from the first stack before the larger number entered the first stack -otherwise the larger number must be pushed to the second stack before the smaller number is pushed to the second stack.
(vi) If π i < π j and E πj < W E πi , then E πj < W N πj < W E πi ; if a larger number enters the first stack before a smaller number does, the larger number must move to the second stack before the smaller number enters the first stack -otherwise the decreasing condition for the first stack is violated.
We now give a classification of when a sorting word is a DI word.
Lemma 2.9. A sorting word W of a permutation π of length n is a DI word if and only if for all i ∈ [n], if no Ns appear in W between N πi and C πi , then that is at step x, the first stack is empty. Alternatively, we can say a sorting word W is a DI word of some permutation π of length n if and only if every entry in π that preceded the entries output by a sequence of Cs must have moved to the second stack (and possibly the output) prior to this exodus.
Proof: Suppose that W is a DI word of a permutation π and for some i ∈ [n], no Ns appear in W between N πi and C πi , and W (x) = N πi . Assume that the first stack is nonempty after stage x, and let π j be a symbol in the first stack. Then E πj < W N πi < W N πj , and since no Ns appear between N πi and C πi , it follows that N πi < W C πi < W N πj . By Observation 2.8 (v), we have that N πi < W E πj , which gives a contradiction. So at stage x, the first stack must be empty.
Conversely, suppose W is a sorting word of a permutation π of length n which is not a DI word. Recall that since W represents the sorting of π through two stacks in series, any entries in the second stack will obey the increasing condition at all times. Consequently, the movements corresponding to W when applied to π must cause a violation of the decreasing condition on the first stack. In such a case, we have two entries π i and π j where π i > π j and at some point π i is below π j in the first stack. That is, Since the end result of the sorting is the identity permutation, we must have C πj < W C πi . Therefore E πi < W E πj < W N πj < W C πj < W N πi < W C πi . Let N π k be the last N in W to appear before C πj . Since the second stack is increasing and W is a sorting word, π k ≤ π j and so N π k < W C π k ≤ W C πj . By the selection of k, no Ns appear in W between N π k and C π k . Observe that π i is in the first stack (and hence the first stack is nonempty) at the step corresponding to N π k .
To similarly characterize our ADI words, we first introduce a lemma showing how "output-greedy" Algorithm 2.1 is.
That is, if two consecutive values do not exit in two consecutive stages, then the larger value does not enter the machine until after the smaller value exits.
Proof: Assume by way of contradiction that C πi ≺ W C πi+1 and E πi+1 < W C πi .
First suppose that N πi+1 < W C πi and let x satisfy W (x) = C πi . Then necessarily π i + 1 must be immediately below π i in the second stack after stage x − 1. So Step 1 of Algorithm 2.1 applies at stage Alternatively, suppose E πi+1 < W C πi < W N πi+1 , and let x satisfy W (x) = E πi+1 . Then N πi < W E πi+1 by Observation 2. 8 (v). Therefore N πi < W E πi+1 < W C πi , meaning that at stage x, π i + 1 is pushed into the first stack while some symbol in the second stack is smaller than π i + 1 (namely π i ). Therefore Step 3 of Algorithm 2.1 should not be applied at stage x, which is a contradiction.
Example 2.11. See Figure 1 and notice when entries 1, 2, 3 are output, 4 is still in the input. This can also be seen in Example 2.7, where We now conclude this section with a classification of when a DI word is the ADI word produced by Algorithm 2.1 for some DI-sortable permutation.
Theorem 2.12. A DI word W of a DI-sortable permutation π of length n is its ADI word if and only if That is, a DI word W of a DI-sortable permutation π is its ADI word if and only if any maximal sequence of consecutive copies of Cs in W is immediately preceded by EN.
Proof: Suppose W is the ADI word of π and i ∈ [n]. It follows by Algorithm 2.1 that E 1 ≺ W N 1 ≺ W C 1 , so we may assume going forward that π i = 1. Additionally any references to Steps in the following argument refer to Algorithm 2.1.
Assume that C πi−1 ≺ W C πi . By Lemma 2.10, C πi−1 < W E πi . Define x so that W (x) = E πi . Therefore after stage x − 1, π i is smaller than all symbols in the second stack and larger than all symbols in the first stack -otherwise Step 3 would not be applied at stage x. In fact, all symbols smaller than π i have been output by stage x − 1 since C πi−1 < W E πi . Therefore after stage x, π i is the only symbol in the first stack. Hence Step 2 applies at stage x + 1, giving W (x + 1) = N πi . Then Step 1 applies at stage x + 2 giving that W (x + 2) = C πi and therefore Conversely, suppose the DI word W is not the ADI word of π, and let A denote the ADI word of π. Let t ∈ [3n] be the largest integer such that A t−1 = W t−1 , that is t is the smallest integer so that A(t) = W (t). We consider the state of the DI machine after stage t−1. Define i ∈ [n] so that C πi−1 ≤ W W (t−1) < W C πi (and also C πi−1 ≤ A W (t − 1) < A C πi ). By convention, we say that C 0 occurs at position 0, and since W (t) < C n , the index i is well-defined. Therefore all symbols smaller than π i have been output by stage t − 1 and no Cs appear between W (t − 1) and C πi in W and A. Hence by stage t − 1, π i is either at • at the bottom of the first stack (E πi ≤ W (t − 1) < N πi < C πi in W and A), or • part of the input yet to enter the stacks (W (t − 1) < E πi < N πi < C πi in W and A).
Suppose first that π i is located at the top of the second stack by stage t − 1. See Figure 4(a). Observe that Step 1 of Algorithm 2.1 outputs π i at stage t, so A(t) = C πi . Since π i is smaller than all symbols in the first stack (possibly vacuously), W (t) = N. Thus W (t) = E. Since π i is smaller than any symbol in the first stack and in the remaining input, no N can appear in W between W (t) and C πi ; otherwise the second stack is no longer increasing. Therefore E ≺ W C πi , and hence neither C πi−1 ≺ W C πi nor N πi ≺ W C πi .
Next suppose that π i is at the bottom of the first stack by stage t − 1.
Step 3 applies at stage x, meaning that π i is larger than all symbols in the first  stack by stage x − 1, but since C πi−1 < A E πi all symbols smaller than π i have been output. So π i is alone in the first stack after stage x. Since π i is smaller than any symbol (if any) in the second stack, it follows that

output input
Observe that π i is alone in the first stack by stage t − 1 and Figures 4 (b) and (c) show the states of the DI-machine using W on π after stages t − 1 and t, respectively. Since C πi−1 ≤ W W (t − 1) = E πi , no Cs appear between E πi and C πi in W . Hence C ≺ W N πi and there are no Cs between N πi and C πi . Furthermore E ≺ W N πi since E πi ≺ W N πi and otherwise W is not a sorting word. Therefore N ≺ W N πi . Furthermore, there are no Ns between N πi and C πi , otherwise Last, we show that π i must be in one of the stacks by stage t − 1, which will conclude the proof. Assume to the contrary that π i is not in either stack by stage t−1. Clearly both A(t) and W (t) are not C (necessarily C πi ), so either A(t) = N and W (t) = E or A(t) = E and W (t) = N. Suppose at stage t − 1, π k is the next symbol to enter the stacks, and if the stacks are nonempty, π q sits atop the first stack and π m sits atop the second stack. See Figure 5(a). First assume that A(t) = N πq and W (t) = E π k (and therefore the first stack is nonempty by stage t − 1). Then either Step 2 or Step 4 of Algorithm 2.1 applies at stage t. However Step 2 cannot be satisfied because π i is the next symbol to be output, so Step 4 is applied, meaning the conditions of Step 3 are not satisfied. Hence either the second stack is nonempty and π k > π m , or π k < π q . Since W is a DI word and W (t) = E π k , it follows that π k > π q (and thus π k = π i ), which implies that the second stack must be nonempty and π k > π m ; hence N πm < W E π k . Since E π k < W E πi we have that W (t) = E π k < W N π k < W E πi by Observation 2.8 (vi).
Therefore A(t) = E π k and W (t) = N πq . This implies that π k > π q (and thus π k = π i ) and the first stack is nonempty at stage t − 1, respectively. This also gives that W (t) = N πq < W E π k . Furthermore π q > π i since all other symbols smaller than π i have been output by stage t − 1.
So C πq < W N π k because from N πq < W E π k , π q < π k , and Observation 2.8 (iii). Furthermore N π k < W E πi since π i < π k , E π k < W E πi , and Observation 2.8 (vi). Since π i < π q , it follows that C πi < W C πq . So C πq < W N π k < W E πi < W C πi < W C πq , which is a contradiction.
We can now strengthen Theorem 2.12. This result will be used in an argument in Section 4, specifically the proof of Theorem 4.11.
Corollary 2.13. Consider the ADI word W of a DI-sortable permutation π. Let x ∈ [3n − 1] and That is, Algorithm 2.1 will output all available entries in the stacks before another push from the input is allowed.

The Bijection
In this section we give a bijection that takes DI-sortable permutations to their corresponding Schröder paths via their ADI words. Let π be a DI-sortable permutation of length n with corresponding ADI word W . To produce a Schröder path, we use the following constructions. Suppose that W contains k maximal, consecutive substrings consisting only of Cs. Let τ = (τ 1 , τ 2 , . . . , τ k ) be the partition of n such that τ i is the length of the ith such substring. Define a k-tuple so that 1 = τ 1 and i = τ i + i−1 , when 2 ≤ i ≤ k. Note that k = n since it counts all the Cs of W . Finally, define an increasing k-tuple ρ so that for x ∈ [3n] we have E ≺ W W (x) ≺ W C if and only if W (x) = N and # N (W x ) = ρ i . Note that ρ is well-defined by Theorem 2.12. In other words, we have: • i is the number of Cs in the first i maximal subsequences of Cs in W .
• ρ i is the number of Ns in W before the i th maximal subsequence of Cs. By Theorem 2.12, the ρ i th N in W is preceded by an E and succeeded by a C.
Using this, we give an algorithm for producing a Schröder path from a DI-sortable permutation.
Algorithm 3.2. Let π be a DI-sortable permutation of length n.
1. Use Algorithm 2.1 to find the ADI word W of π. From W , obtain τ and .
2. Construct a word T by replacing each maximal consecutive substring in W of the form ENC a with an N. Observe that N is the last letter of T , and # N (T ) = n.
3. Construct a word S D from T by replacing the i th N in T with a D for each i ∈ [k]. Observe that since k = n, the final character in this word is D. Remove this D to produce S. Example 3.3. Let π = 81736245 as given in Example 3.1, in which we give W , τ , and . We now apply Algorithm 3.2 to π. We first produce T = ENNENEENNNNN by replacing the maximal consecutive substrings ENC τi (1 ≤ i ≤ 4) with an N.
Next, we replace the i th Ns in T with D (in blue) to produce S D = EDNEDEEDNNND, then remove the final D to produce S = EDNEDEEDNNN. See Figure 6. We now give an observation, then prove two lemmas which collectively show that Algorithm 3.2 provides a one-to-one correspondence between ADI words and Schröder paths.
Observation 3.4. Let W be an ADI word for a permutation π of length n with k substrings of the form ENC τi and k-tuples ρ and as defined earlier, and let 0 = 0. Observe that C m is the mth occurrence of C in W . Let i ∈ [k] andx, x ∈ [3n] such that W (x) ≺ W C i−1 +1 and W (x) = C i ; in other words W (x) is the N which immediately precedes the ith maximal subsequence of Cs and W (x) is the last C in the ith maximal substring of Cs. See Figure 7.
Observe that in Example 3.1, i ≤ ρ i for each i ∈ [4].

· · ·
Location number: Proof: Let W be the ADI word for a DI-sortable permutation π of length n. Suppose that W contains k disjoint maximal consecutive substrings of Cs. Let T , S D , and S be the words produced in Algorithm 3.2.
Then the length of T is 2n − k with # N (T ) = n and # E (T ) = n − k. Therefore the length of S is 2n − k − 1 with # N (S) = # E (S) = n − k and # D (S) = k − 1. It follows that S corresponds to a path from (0, 0) to (n − 1, n − 1) .
Lemma 3.6. For every Schröder path S from (0, 0) to (n − 1, n − 1), there is an ADI word W of a DI-sortable permutation of length n such that Algorithm 3.2 applied to W gives S.
Proof: We begin with a Schröder path from (0, 0) to (n − 1, n − 1) and consider it as a word S. Let k = # D (S) + 1. Then # E (S) = # N (S) = n − k. Furthermore, we have # E (S ) ≥ # N (S ) for any prefix S of S, since the Schröder path stays weakly below the main diagonal. Following Algorithm 3.2 backwards, append a D to the end of S to create the "extended" Schröder path S D .
For each i ∈ [k], let t i be the location of the i th D in S D , and let i be the location of the i th D in the substring of S D consisting of all of the Ns and Ds of S D . Since the substring of S D consisting of all of the Ns and Ds of S D has exactly n letters, observe that k = n and for convention, we set 0 = 0.
Next create T by replacing each D with an N in S D . Then # N (T ) = n = k + # E (T ), and observe that if . In other words, r i is the minimal length for a prefix of T which has exactly i more Ns than Es. By convention, let r 0 = 0.
Observe that T (r i ) = N and # N (T ri−1 ) = # E (T ri−1 ) + i − 1 for each i ∈ [k] and that r k ≤ 2n − k since # N (T 2n−k ) = # E (T 2n−k ) + k. Furthermore, note that r i ≥ t i for each i ∈ [k]. Indeed, since S D is a Schröder path from (0, 0) to (n, n). In particular, r k ≥ t k = 2n − k hence r k = 2n − k. Now createT by inserting an E before the k Ns at locations r 1 , r 2 , . . . , r k of T . Letr i be the new location of these Ns inT , that isr i = r i + i, meaning the inserted Es are at locationsr i − 1 inT . Again by convention, letr 0 = 0. We have # E (T ) = n = # N (T ) andr k = 2n.
We now establish that .
Observe that sinceT (r i ) = N, we have # E (Tr i ) = # N (Tr i ). This will be used later.
Now, create the partition τ = (τ 1 , τ 2 , . . . , τ k ) of n where τ i = i − i−1 for each i ∈ [k]. Next, create W by inserting τ i copies of C after the Ns inT located atr i for each i ∈ [k]. Letr i be the new location of these Ns in W , that isr i =r i + i−1 , meaning the inserted Cs are at locationsr i + 1, . . . ,r i + τ i .
By its creation, it follows from the properties ofT that # E (W ) = # N (W ) = # C (W ) = n and , we need only to show the inequality holds when x =r i + τ i for each i ∈ [k]. So let x =r i + τ i for some i ∈ [k]. Recall t i was defined to be the location of the i th D in S D , and it was established that t i ≤ r i for all i ∈ [k]. Then . So by Observation 2.3, W is a sorting word for a permutation π of length n. Moreover, Finally, one can see by the construction of W that Hence from Theorem 2.12, W is an ADI word for some DI-sortable permutation π. Moreover, applying Algorithm 3.2 to W gives S. By Lemmas 3.5 and 3.6, our main result follows: Theorem 3.7. For any n > 0, Algorithm 3.2 produces a bijection between the set of ADI words from DI-sortable permutations of length n and Schröder paths from (0, 0) to (n − 1, n − 1).
Example 3.8. Suppose we start with the Schröder path S = EDNEDEEDNNN illustrated in Figure 6. We demonstrate the inverse of Algorithm 3.2 described in Lemma 3.6.  Figure 6 becomes an ADI-word. Circled numbers indicate consecutive copies of C.
We begin by producing S D = EDNEDEEDNNND by appending a diagonal (Figure 8(a)). We identify = (1,3,4,8) and τ = (1, 2, 1, 4) based on the relative locations of the diagonal edges with respect to the north edges. We construct T = ENNENEENNNNN by converting each diagonal edge to a north edge (Figure 8(b)). Next we find r = (3,10,11,12) and constructT = ENENENEENNENENEN by inserting E before the N at each of the locations in T specified by r. Note thatr = (4,12,14,16), and with this we construct W = ENENCENEENNENCCENCENCCCC. Observe that W is the ADI word of 81736245, and Algorithm 3.2 applied to W gives S (see Example 3.3).

Permutation properties observable from their Schröder paths
While the bijection obtained from Algorithm 3.2 can be used to show exactly which Schröder path corresponds to a given DI-sortable permutation, there are several properties that translate prominently between permutation and path.   If W is the ADI word of a DI-sortable permutation π, then E πi ≺ W N πi ≺ W C πi if and only if π i is a right-to-left minimum. Furthermore, the number of right-to-left minima of a DI-sortable permutation π is one more than the number of diagonal steps in its corresponding Schröder path.
Proof: Suppose π i is a right-to-left minimum of π with ADI word W . There must be some k ∈ [n] that satisfies E π k ≺ W N π k ≺ W C π k ≺ W · · · ≺ W C πi by Theorem 2.12. Assume by way of contradiction that k = i. Then E πi < W E π k and C π k < W C πi . Hence i < k and π k < π i , which is a contradiction to π i being a right-to-left minimum. So E πi ≺ W N πi ≺ W C πi . Now suppose that E πi ≺ W N πi ≺ W C πi for some i ∈ [n] and let j ∈ [n] such that i < j. Then E πi < W E πj . Therefore C πi < W E πj , so C πi < W C πj . Hence π i < π j . So π i is a right-to-left minimum.
Hence there is a one-to-one correspondence between consecutive sequences ENC in W and right-to-left minima in π. And as seen in Algorithm 3.2, these sequences give rise to one fewer diagonal in the corresponding Schröder path of π. Corollary 4.4. The DI-sortable permutations with one right-to-left minimum, that is the DI-sortable permutations that end in 1, are enumerated by the Catalan numbers. In particular, the number of DIsortable permutations of length n + 1 ending in 1 is C n = 1 n + 1 2n n .
Proof: The Schröder paths from (0, 0) to (n, n) without diagonal steps are Dyck paths, known to be enumerated by the Catalan numbers. Alternatively, recall that the basis for our DI-sortable permutations is {3142, 3241}. Thus, the DIsortable permutations of length n + 1 ending in 1 are exactly the permutations whose first n entries must avoid 213, which are known to be enumerated by Catalan numbers, C n [8].
For a given diagonal in a Schröder path S and prefix S of S terminating after the given diagonal, the we say the height of the diagonal is # N (S ) + # D (S ). In other words, its height is the y-coordinate of the point in the path where the diagonal terminates.
Example 4.5. Let π = 81736245 with corresponding Schröder path S given in Figure 6. Then the height of its diagonals are 1, 3, and 4.
Theorem 4.6. The heights of the diagonals determine the values of the right-to-left minima. In particular, if the heights of the diagonals in the Schröder path corresponding to the permutation π are h 1 , h 2 , . . . , h k , the right-to-left minima of π are 1, h 1 + 1, h 2 + 1, . . . , h k + 1.
Proof: Suppose that S has k diagonals (and hence π has k + 1 right-to-left minima), and let W be the ADI word of π. Notice since i counts the Cs in the first i maximal substrings of Cs, we have i counts . So the heights of the diagonals of S are one less than the right-to-left minima of π (excluding 1).
Definition 4.7. An interval of a permutation π is a consecutive subsequence of π that contains consecutive values.
Example 4.8. The permutation σ = 685712943 contains intervals 6857, 12, 9, 43. Definition 4.9. A permutation π is said to be plus-decomposable if π is the concatenation of two non-empty intervals ω and τ where the values of ω are less than those of τ . Further, if we rescale the entries of τ by subtracting the length of ω from each entry of τ to get a permutation τ , we denote π = ω ⊕ τ . If a permutation is not plus-decomposable, we say the permutation is plus-indecomposable.
Theorem 4.11. The Schröder path corresponding to a plus-decomposable DI-sortable permutation π = ω ⊕ τ is the Schröder path for ω followed by a diagonal step (on the main diagonal) followed by the Schröder path for τ . Furthermore, this means the Schröder paths with diagonal steps on the main diagonal correspond exactly to the plus-decomposable DI-sortable permutations.
Proof: Consider the plus-decomposable permutation π = ω ⊕ τ and let W be the ADI word of π. Let x ∈ [3n − 1] satisfy W (x) = E π k with k = |ω| + 1 and π i = min{π | W (x) < W C π }. Then by Corollary 2.13, we have E π k = W (x) ≤ W E πi , so k ≤ i. Since π = ω ⊕ τ and i ≥ k = |ω| + 1, we have π i > |ω|. Hence by the definition of π i , we have C |ω| < W W (x) = E π k . Thus we know Algorithm 2.1 will force the exit of all the entries of ω before any entry of τ (entries of π corresponding to τ ) enters the stacks. Therefore the ADI word for π will be the ADI word for ω followed by the ADI word for τ .
When Algorithm 3.2 acts on the ADI word for π, it will convert the first portion of the ADI word to the Schröder path for ω, but followed by D as this D is no longer the last D of the word. At the same time, it converts the remaining portion of the ADI word to the Schröder path for τ . Example 4.12. In Figure 9, we see that this Schröder path for π = 43126758 = 4312 ⊕ 231 ⊕ 1 is the concatenation of the Schröder paths for 4312, 231, and 1 (a degenerate path), connected by diagonal edges. Aguiar and Moreira [1] showed that the number of Schröder paths from (0, 0) to (n, n) that do not have diagonal steps on the main diagonal equals the number of Schröder paths from (0, 0) to (n, n) that do have diagonal steps on the main diagonal as a particular case of a larger result. That is, they showed the number of Schröder paths that do not have diagonal steps on the main diagonal are enumerated by the small Schröder numbers, which gives us the following corollary.
Corollary 4.13. The plus-decomposable DI-sortable permutations are in bijection with the plus-indecomposable DI-sortable permutations. In particular, both classes are enumerated by the small Schröder numbers.
We conclude with a few open questions: 1. Are there any other properties of the DI-sortable permutations that are easily seen by looking at the corresponding Schröder paths?
2. Is there another bijection between the DI-sortable permutations and the Schröder paths that conserves more or different properties of the DI-sortable permutations in the Schröder paths?