Bijections Between {\L}ukasiewicz Walks and Generalized Tandem Walks

In this article, we study the enumeration by length of several walk models on the square lattice. We obtain bijections between walks in the upper half-plane returning to the $x$-axis and walks in the quarter plane. A recent work by Bostan, Chyzak, and Mahboubi has given a bijection for models using small north, west, and south-east steps. We adapt and generalize it to a bijection between half-plane walks using those three steps in two colours and a quarter-plane model over the symmetrized step set consisting of north, north-west, west, south, south-east, and east. We then generalize our bijections to certain models with large steps: for given $p\geq1$, a bijection is given between the half-plane and quarter-plane models obtained by keeping the small south-east step and replacing the two steps north and west of length 1 by the $p+1$ steps of length $p$ in directions between north and west. This model is close to, but distinct from, the model of generalized tandem walks studied by Bousquet-M\'elou, Fusy, and Raschel.


Introduction
Tandem walks are walks on the square lattice Z 2 that start at the origin and are confined to the quarter plane, with all steps taken in the set S 1 = {(−1, 0), (0, 1), (1, −1)}, that is, the set consisting of the small steps west, north, and south-east. The name originates from queuing theory: tandem walks indeed represent the behaviour of two M/M/1 queues in tandem. See for example [10,Section 4.7]. Tandem walks are one simple model in a larger family of models of walks on the quarter plane with a prescribed step set. In 2010, Bousquet-Mélou and Mishna [5] identified 79 essentially different models of walks with step sets consisting of nontrivial steps in {−1, 0+1} 2 . These models have since then received a vast amount of attention in the combinatorial litterature. From the 79, another class of interest to the present work is obtained by symmetrizing the step set with respect to the line x = y, leading to a generalization of tandem walks to walks over the step set S 1,sym = S 1 ∪ {(0, −1), (1, 0), (−1, 1)}, that is, the six small steps west, north, south-east, south, east, and north-west. Both classes are known to have algebraic generating series when enumerated by length (the number of steps). For the former, Gouyou-Beauchamps gave in 1989 an implicit bijection in terms of Motzkin walks and standard Young tableaux [11].
For the latter, Bousquet-Mélou and Mishna gave in 2010 an explicit algebraic calculation of the generating series, by an averaging of a functional equation satisfied by the series [5]. In addition, the last two authors remarked that the symmetric duplication of the step set used to define the second class is likely to be mirrored, in a manner not yet explained at the time, by the factor 2 n that they observed in their enumeration. They asked for a bijective explanation of the phenomenon.
While the bijection suggested by Gouyou-Beauchamps [11] proceeds by composing several known bijections, more recent works by Eu and collaborators [8,9] introduced a more direct transformation that operates by searching for patterns on the walk viewed as a word and successively rewriting their occurrences until none is found. The patterns used are arbitrarily distant pairs of matching parentheses. Very recently, Bostan, Chyzak, and Mahboubi revisited the problem to get bijections described by single-pass algorithms [3]. 1 They developed an approach inspired by the theory of automata: the algorithm for each of the two converse bijections consists of a single unidirectional traversal of the input walk, read step by step by a transducer that additionally maintains two nonnegative integer counters 2 . The evolution of the counters follows very local rules. This more explicit presentation of the bijection also allows for following information about the final position.
The present work adapts the use of automata in [3] to study two models that generalize tandem walks. On the one hand (Section 4), a suitable interlacing of two copies of the bijection between Motzkin walks and tandem walks provides a bijection between bicoloured Motzkin walks and 6-step walks in the quarter plane. This leads to a combinatorial explanation to the 2 n factor for the symmetric step-set model. On the other hand (Section 3), proceeding beyond Motzkin walks and tandem walks, we introduce walks with large nonnegative steps. Given a nonnegative integer p, we consider the class of walks of the upper half plane that use the steps (1, i) for −1 ≤ i ≤ p and return to the x-axis, which we call p-Łukasiewicz walks. We also introduce the class of walks of the quarter plane that use the small step (1, −1) and the large steps (−i, p − i) for 0 ≤ i ≤ p, which we call p-tandem walks. Our principal result is to obtain a bijection between these two classes (Theorem 6).
Łukasiewicz walks have been studied for a long time in several forms. They were initially introduced in logic by Łukasiewicz, see, e.g., the book by Rosenbloom [15], and introduced to combinatorics seemingly for the first time by Raney [14]. Traditionally, they are defined as words that correspond to walks confined to the upper half plane, with the exception of their very last step, which has to be (1, −1) and passes below the axis. Keeping the last SE step implicit makes a bijection to our class more direct, and our p-Łukasiewicz walks have been studied for instance by Brak, Iliev, and Prellberg under the name of "(0, p)-restricted Łukasiewicz paths" [6], as models of polymer adsorption. The traditional form is better suited to studying their recursive, tree-like structure, and applications to random sampling and random generation of trees are to be found for instance in [2].
Although we claim a proximity of our work to automata theory, we will not use more than its vocabulary in most of the present article. We will indeed describe the procedure implementing our bijections in a more relaxed way, hiding their automatic content in a presentation by "boxes" (see . The interested reader will wait until Section 5 to see a formal comparison of our presentation to classical automata theory. A combinatorial explanation of the factor 2 n in the symmetric step-set model was already given by Yeats [17]. Her approach shares similarities with the work by Eu, Fu, Hou, and Hsu for the simpler tandem model. For comparison's sake, we provide it here as well, together with a generalization to p-tandem walks (Section 6).
Remarkably enough, similar bijective results appeared recently in an ongoing work by Bousquet-Mélou, Fusy, and Raschel [4]. There, the authors use a recent bijection between the class of all tandem walks for all p and the class of so-called marked bipolar-oriented planar maps, by Kenyon, Miller, Sheffield, and Wilson [12]. Our bijections are different from those based on maps, with no clearly studied potential connection so far. This is discussed further in Section 7.1.
We see three main benefits to our bijections. First of all, they are described algorithmically with only a single pass through the input word. This makes it clear they have short, fast implementations. The single pass algorithmic description leads to nicer, clearer proofs than the approach of [17], and also made the generalization to larger step sets possible. Then, after the fact, the bijections for larger step sets could also be given an alternate explanation in the spirit of [17]. This gives us two ways, each with different benefits, to understand all of our bijections.
1.1. General setup. Notation. All of our bijections are described algorithmically and proceed in a similar fashion: to compute the image of a given word w = w 1 . . . w n , a counter c is introduced with values associated to the prefixes of w, and an output wordw =w 1 . . .w n is computed as the image of w by computing (w i , c i ) from (w i−1 , c i−1 ) for successive values of i. The value of (w i , c i ) depends on (w i−1 , c i−1 ) in a deterministic way, according to a piecewise definition given by possible transitions. We describe such transitions by boxes in what follows.
Steps in 2-dimensional step sets may be depicted by arrows, which then represent vectors with integer coordinates.
Step sets made of such steps are named using the letter S.
Step sets for 1-dimensional walks are subsets of Z. They are named using the letter Σ. We will freely identify such a step set Σ with the set of vectors {1}×Σ. For future reference, we summarize the use of these alphabets in the following list, together with the specific classes of words that we will build on them. For this description, given an alphabet A, A * denotes as usual the set of finite words on A, including the empty word , and we write w ≤ w when w is a prefix of w, and |w| a for the number of occurrences of the letter a in w.
-Tandem words are classically those words on S 1 giving rise to a walk in the quarter plane. We will also call them quarter-plane 1-tandem words: Q = {w ∈ S * 1 : ∀w , w ≤ w ⇒ |w | ≥ |w | ≥ |w | }.
-By relaxing the quarter-plane constraint, but forcing the final height to be 0, we obtain what we will call half-plane 1-tandem words: H = {w ∈ S * 1 : |w| = |w| and ∀w , w ≤ w ⇒ |w | ≥ |w | }. The bijection M H is obvious.
• {1, 2, 3}. We restrict the classical class of Yamanouchi words (using any letters from N * ) to those words using only the first three integers: The bijection Y 3 Q is obvious.
• S p = { , . . . , , . . . , , }. Our quarter-plane p-tandem words generalize classical tandem words by allowing longer steps into the north-west quadrant: We will use the class A * p of unrestricted finite words on A p to represent generalized counters (stack contents).

1.2.
Outline of the paper. Contributions. Section 2 discusses the case p = 1. It is bibliographical, along the lines of [3,7]. (But we prefer the present description in terms of counters over the equivalent description in terms of infinite automata developed in [3].) There, we provide a bijection H Q between half-plane and quarter-plane words in the 1-tandem case. The bijection is essentially the bijection M Y 3 between Motzkin words and (restricted) Yamanouchi words, owing to the trivial relations M H and Y 3 Q. This description is given without proofs, as it can be viewed as a special case of the case of general p. This new result is a bijection L p T p for 1 ≤ p ∈ N. It is developed in full in Section 3. For the proofs, we introduce parameters attached to the constructions, and we study their variations and invariants. We then develop the 6-step model and the corresponding bijection M bicol Q sym in a more sketchy way in Section 4, providing just what has to be adapted to obtain complete proofs. Alternate interpretations follow, via explicit automata in Section 5 and via raisings of steps in Section 6.
Although we have developped the automata approach of the present article as a more intuitive explanation of the phenomenon for some of us, other readers may prefer the approach by raising followed in [17]. To save those readers from waiting until Section 6, we work out in Section 1.3 an example of execution of the automata and raising algorithms to transform an explicit quarter-plane walk to the corresponding Motzkin walk. We provide this comparison without any formalism and any proof of the bijections. We thus propose two reads of the article. Most readers will consider a linear read of it, possibly skipping Section 1.3 and postponing its read until after reading Section 6. On the other hand, readers already aware of the raising approach will probably prefer reading the worked example in Section 1.3 before jumping directly to Section 6 and returning to Section 2 when enclined to do so.
The interested reader will find a Julia implementation of the algorithms described in this article, both on Chyzak's web page and as ancillary files to the arXiv preprint of this work.
1.3. Worked example. The difference between the traditional approach by raising and our new approach by transducers is most striking in the divergence of their intermediate calculations when converting an input walk in the quarter plane with steps from { , , } into a walk in the upper half plane using the same steps and returning to the x-axis, or, equivalently, into a Motzkin walk using steps from { , , }. Both approaches realize the map ψ that we will define and describe using transducers in Section 3, and that we will describe using raising in Section 6.1.
In order to transform a quarter-plane walk, like the one at the bottom of column (b), the traditional approach is to read its steps from beginning to end, inducing the prefixes that can be seen from top to bottom in that column, and to progressively generate the corresponding Motzkin walks in column (a). To maintain the Motzkin property, this induces the so-called raising of an earlier step when the added step would otherwise go below the x-axis. Such raising instances are marked by round arrows and shift the rest of the walk vertically by one. The global transformation returns the final Motzkin walk, given at the bottom of column (a).
The approach introduced in the present work is to read the quarter-plane walk backwards, thus considering the suffixes that appear from bottom to top in column (c). This family of walks has no obvious property with regard to a quarter plane or even a half plane, and so we have not bothered to translate them in any way, so as to have the origin as final vertex for example. The new transformation is depicted in column (d), which shows suffixes of the final Motzkin walk. Observe that those suffixes are not altered after they have been produced in any other way than prepending another step. In the end, the completed Motzkin walks obtained by both algorithms and drawn at the bottom of column (a) and top of column (d) are the same. If we insist on writing upper-half-plane walks in terms of the same allowed steps as for the quarter-plane walks, we obtain in column (e) the suffixes of an upper-half-plane walk returning to the x-axis. The fact that the complete walk, at the top of column (e), returns to the origin is specific to the example, in relation to the quarter-plane walk ending on the main diagonal.
Raising approach (execution from top to bottom) Transducer approach (execution from bottom to top) Alternative encoding Figure 1. Computing the Motzkin walk associated with a given quarter-plane plane: comparison of the traditional raising approach and the new transducer approach. Raising algorithm: input on the right (b), output on the left (a). These columns (a) and (b) display the same data as Figure 16. This exemplifies the algorithm provided formally as Figure 15 in Section 6.1, with the exception that the raisability marks are not shown here. Transducer approach: input on the left (c), output on the right (d). This algorithm is provided formally in Section 2 (map ψ) and generalized to long up steps in Section 3 (map Ψ p ). Column (e) provides the walks homologous to those of column (d) under the trivial bijection that exchanges and , and and . Figure 2. Transitions used to define the forward map φ: the letter m is read from the input Motzkin word w; the letter χ is written to the output Yamanouchi wordw. At the top, the rows a and µ present alternate encodings of m under obvious bijections. At the bottom, the rowā presents an alternate encodings of χ. A transition named (Xχ) reads a letter m indicated by X: respectively , , , if X stands for U(p), L(evel), D(own). With the exception of (DE), all transitions (Xχ) output the letter χ.

Three-step model
We start with the three-step model, to obtain a bijection H Q, which we realize as two converse bijective maps φ : H → Q and Q → H. This implicitly contains the bijection M Y 3 , which is the foundation of the case p = 1 in the literature.
Following the strategy announced in the introduction, we introduce the transitions that we use to define the forward map φ and the backward map ψ. This is done by the 6 boxes on the right of Figure 2 and the 5 boxes on the right of Figure 3. We describe the meaning of the boxes using the notation introduced by the box (TR) on their left. There: • a andā stand for letters from the alphabet S 1 := { , , }; • µ is the y-coordinate of the letter a, that is, the vertical displacement caused by a, with value µ in {−1, 0, +1}; • m stands for a letter from the alphabet Σ 1 := { , , }; • (h L , v L ) and (h R , v R ) are pairs of counters, from N 2 (henceforth, we will simply say "counter" for short, instead of "pair of counters"); • χ stands for an integer from {1, 2, 3}. The forward map φ converts a walk of the 3-step model H in the upper half plane to a walk of the 3-step model Q in the quarter plane. To ease its definition, the map is defined as a partial function of any word from S * 1 . This is convenient because the construction potentially leads to an error. The map is defined in terms of the 6 forward transitions (U1) to (DE) listed in Figure 2. Any application of (U1) to (D2) consumes a letter a of the 3-step model as well as a counter (h L , v L ) ∈ N 2 , and produces a new counter (h R , v R ) together with a letterā of the 3-step model. The values of the counters (h L , v L ) and (h R , v R ) in the boxes are given as patterns, where α and β have to be viewed as matching nonnegative integers. So, for example, if the input step is and the counters are (h L , v L ), then we use transition (L2) if Given a word w = w 1 . . . w n ∈ S * 1 of length n, the forward transform φ(w) is now defined as follows. Set (h LR 0 , v LR 0 ) = (0, 0). For i from 1 to n, find the only forward transition that can be applied to the letter w i and the counter (h LR i−1 , v LR i−1 ). If this is (DE), then φ is not defined at w. Otherwise, apply the transition to set (h LR i , v LR i ) to the returned counter andw i to the returned letter. If the loop terminates without using the transition (DE), then φ(w) is defined asw 1 . . .w n .
The backward map ψ is defined similarly using the backward transitions (1L) to (3E) listed in Figure 3, with the added simplicity that no error can occur. Applications of backward transitions consume a letterā and a counter (h R , v R ), and produce a counter (h, v) together with a letter a . Again, the triples (ā , h R , v R ) cover all possible input cases from S 1 × N 2 . (For other models in future sections, we will not list the backward transitions separately since they are the same boxes interpreted in reverse.) Given a wordw =w 1 . . .w n ∈ S * 1 of length n, the backward transform ψ(w) is now defined as follows. Set (h RL n , v RL n ) = (0, 0). For i from n down to 1, find the only backward transition that can be applied to the letterw i and the counter (h RL i , v RL i ), so as to define a letter w i and a counter ( One can prove that, after calculating some φ(w), the last counter (h LR n , v LR n ) is (0, 0) if and only if w is a Motzkin word. Likewise, after calculating some ψ(w), the last counter (h RL 0 , v RL 0 ) is (0, 0) if and only ifw is a quarter-plane word. Also, one can prove that if some (h LR i , v LR i ,w i ) is the result of applying the forward transition (U1), then the only backward transition that can be applied to this result, in a right to left process having this specific letterw i at position i, is (1U). Like properties hold for all other natural pairs of forward and backward transitions. The proof that φ and ψ are inverse bijections between Motzkin words of M and quarter-plane words of Q follows from this local reversibility property. We do not   exhibit those proofs here as they will be seen as special cases of the case of a general p in Section 3.
Because of an interpretation specific to the case p = 1 and in view of the generalization to larger p in Section 3, the input and output letters are also given in the boxes in different alphabets. Three-step walks in the upper half plane are in bijection with Motzkin words, by replacing each with a , each with a , and leaving all 's unchanged. The letter m corresponding to a is given in the boxes, together with its vertical displacement µ. Here, the letters are those for Motzkin walks, implying −1 ≤ µ ≤ 1, but the bijection in Section 3 will use −1 ≤ µ ≤ p, so this notation will be preferred. On the other hand, the constraint on a 3-step walk to remain in the quarter plane leads to each prefix of such a 3-step walk having more 's than 's and more 's than 's. Replacing , , and respectively with 1, 2, and 3 puts walks in the quarter plane in bijection with Yamanouchi words. The bijection for p = 1 is thus essentially a bijection between Motzkin words and Yamanouchi words using only 1s, 2s, and 3s.  or v RL i , in our previous description. Pay attention to how a value χ =w i appears between times i − 1 and i.
Interpreted as a bijection between walks in the 3-step models, the bijection maps the upper-half-plane walk on the left of Figure 5 to the quarter-plane walk on the right. To help the reader understand the order of these tangled walks, we have put the time of first reach close to each position. This corresponds to the value of i in An interesting property is made apparent by this example. Focus on those positions between times i and i+1 for which m = in the Motzkin walk and for which χ = 1 in the Yamanouchi word. In other words, consider i ∈ {6, 7, 16, 20, 23, 24}, but not i ∈ {10, 12, 14}. Then, we observe that the suffix of the quarter-plane walk for the position at that time i never goes back to a lower abscissa than that of its vertex marked i. (On the other hand, this is not true for 10, 12, 14.) See the first point of Proposition 7.
The reader in need of an early intuition about our bijections between models with long steps can compare Figure 4 (three-step model, p = 1) and Figure 11 (p = 5).

p-Tandem Walks
In this section, we generalize the bijections of Section 2 to general p ≥ 1.

Construction of maps between Σ *
p and S * p . For the description of the bijection for general p, we proceed to introduce transitions akin to those for the case p = 1, but with two kinds of generalizations needed.
• The letters , , and , used to encode Motzkin words for p = 1 and also represented by their y-coordinates (that is, their vertical displacements), respectively as +1, 0, −1, need to be generalized to a set of p + 2 letters µ, named by numbers from −1 to p. • The letters , , and , used for the 3-step quarter-plane model, need to be generalized to another set of p+2 lettersā: the p+1 vectors (− , p− ) for 0 ≤ ≤ p, together with the vector (1, −1). In the boxes of Figure 6, the parameterμ is the y-coordinate ofā. It also varies from −1 to p and could be used as another encoding.
• The parameter h ∈ N of the case p = 1 needs to be generalized to a word H over the alphabet A p consisting of the p(p − 1)/2 letters a ,m for 0 ≤ + m ≤ p − 1. For p = 1, this alphabet reduces to a single letter a 0,0 , so that the values of H for p = 1 are in natural bijection with the possible values of h ∈ N. This explains why a mere integer was sufficient in Section 2. We could find no better way to name the transitions in Figure 6 than simply naming them from (T1) to (T8). We describe their meaning using the notation introduced by the box (TG). There: • µ is the y-coordinate of a letter (1, µ) of a Łukasiewicz word, that is, the vertical displacement caused by it, with value in Σ p := {−1, 0, 1, . . . , p}; (T8) •ā stands for a letter from the alphabet S p := { , . . . , , . . . , , }; •μ also stands for a letter from the alphabet Σ p .
As in the definition of the forward map φ in Section 2, those transitions are used in a forward manner to produce a counter (H LR i , v LR i ) and a letterw i from a given letter w i and a counter ( . The procedure, given in Figure 7, explains how transitions are selected unambiguously. We prove that, given an input

Figure 7.
One step of the LR process (ith step).
• v LR i is the sum of one or two nonnegative integers, except at steps (2)(b), (4)(a), and (4) As in the case p = 1 of Section 2, we next define a (partial) map Φ p from Σ * p to S * p . Given an input word w = w 1 . . . w n from Σ * p , iterating the process above from the initial counter (H LR 0 , v LR 0 ) = ( , 0) results either in an error, or in a wordw = w 1 . . .w n . In the former case, Φ p remains undefined at w, while in the latter case, Φ p (w) is defined asw.
Likewise, as in the definition of the backward map ψ in Section 2, the transitions (T1) to (T8) in Figure 6 are used in a backward manner to produce a counter (H RL i−1 , v RL i−1 ) and a letter w i from a given letterw i and a counter (H RL i , v RL i ). We provide the procedure in Figure 8 to explain how transitions, meant to be applied backwards, are selected unambiguously. We prove that, given an input ( • w i is either p or −1, or, at steps (1)(a) and (4)(a), an integer between 0 and p − 1. In all cases, As in the case p = 1 of Section 2, we next define a map Ψ p from S * p to Σ * p as follows. Given an input wordw =w 1 . . .w n from S * p , iterating the process above from the initial counter (H RL n , v RL n ) = ( , 0) results in a word w = w 1 . . . w n , and Ψ p (w) is defined as w.
In Figure 9, we provide again, this time in usual set notation, the input and output sets of the forward transitions (T1) to (T8) and of the corresponding backward transitions. The careful reader will realize that the eight sets in the middle column form a partition of Σ p × A * p × N, while the seven sets in the right-hand column form a partition of A * p × N × S p . Thus, the forward and backward procedures described above induce inverse bijections between (Σ p ×A * p ×N) {(−1, , 0)} and A * p ×N×S p . This local reversibility property and the constructions of Φ p and Ψ p immediately make it possible to identify simple sets of words on which the restriction of Φ p has a left inverse given by Ψ p , and on which the restriction of Ψ p has a left inverse given by Φ p . This is made precise in the following proposition.
is never used in the forward construction applied to w, and if additionally this con- Symmetrically, givenw ∈ S * p , if the backward construction applied tow termi- Figure 10 provides an example for p = 5: on the left side, the 5-Łukasiewicz walk

Example 3.
where each letter µ represents the step (1, µ); on the right side, the corresponding 5-tandem walk, obtained by applying Φ 5 , where each letterμ represents the step (μ − 5,μ) ifμ ≥ 0, and (1, −1) ifμ = −1. Figure 11 provides the transitions used and the evolution of the counters H and v along the construction of the 5-tandem walk from the 5-Łukasiewicz walk.  tr  T1 T7 T7 T7 T5 T6 T3 T5 T6 T3 T5 T3 T2 T7 T7 T7 T5 T3 T7 T7 T7   H  a2,0 Figure 11. Transduction corresponding to Figure 10 (top rows), augmented with the stack to be used in Section 6.4 (bottom row). The letters µ in row w are the input to the LR process as well as the output from the RL process. They give the Łukasiewicz walk w as the succession of steps (1, µ), with D standing for −1. The lettersμ in roww are the output from the LR process, the input to the RL process. They give the p-tandem wordw as the succession of steps (μ − 5,μ), or (1, −1) ifμ = D. The transitions used are indicated by row tr. How they transform the generalized counters H and v is provided by two more rows. Along this run, H remains either the empty word or is a word consisting of a single letter a ,m . The last row provides the evolution of the stack V of the augmented RL transducer process of Section 6.4, with pushes to the top of the depicted columns ( denoting the empty stack). Observe that the length of V constantly matches v.

Parameters depending on the constructions, and their variations.
The counters (H, v) of Section 3.1 (whether it be in LR or in RL form) are needed explicitly for the constructions of Φ p and Ψ p . In Section 3.3, we will introduce further parameters that could be computed, along with H and v, over the course of the constructions. Yet, these parameters are only needed for proving properties of the constructions, which is why they are not made part of the definition of the construction in the way that H and v are. A notational difficulty in proofs is that we need to compare the counters, outputs, and parameters as computed by the left-to-right process Φ p with those computed by the right-to-left process Ψ p , and in fact several sorts of variations in the parameters. We introduce such variations in abstract in the present section, before defining specific parameters in Section 3.3. (We will freely use the abbreviations LR and RL to refer to the two processes.) We start with notation to distinguish the counters (H, v) and the words produced by the two processes. Given a p-Łukasiewicz word w ∈ Σ n p , for any integer i satisfying 1 ≤ i ≤ n we denote by H (w) LR,i and v (w) LR,i the values of H and v obtained by the LR process after its ith step, that is, after using the letter w i from the input word w, and byw (w) LR,i the letter output at this step. Similarly, given a quarter-plane wordw ∈ S n p , for any integer i satisfying 0 ≤ i ≤ n−1 we denote by H (w) RL,i and v (w) the values of H and v obtained by the RL process after its (n − i)th step, that is, after using the letterw i+1 from the input wordw, and by w (w) RL,i+1 the letter output at this step. To get total maps over 0 ≤ i ≤ n, we also set H (w) The parameters we are interested in depend on the words input to the constructing processes, in Σ * p for LR and in S * p for RL, on the words output by the same processes, in S * p for LR and in Σ * p for RL, as well as on the counter (H, v) at each step in the process. So, we formally introduce a parameter q as a tuple (α,ᾱ, σ 1 , σ 2 ) of monoid morphisms with integer values. That is, we assume that the four maps satisfy formulas and v ∈ N. After fixing a length n for words, we associate two sequences to the parameter q, which we name the values of q along the LR and RL processes, respectively: • For a p-Łukasiewicz word w ∈ Σ n p and 0 ≤ i ≤ n, the value q (w) LR,i of q obtained after i steps in the construction Φ p is given, assuming no error occurs, as • Similarly, for a quarter-plane wordw ∈ S n p and 0 ≤ i ≤ n, the value q (w) RL,i of q obtained after n − i steps in the construction Ψ p is given as RL,i ). (Negative signs may look counter-intuitive. They relate to RL's operating transitions backwards.) Observe that q (w) LR,i may be undefined, as Φ p may lead to error. It will be our goal to relate q (w) LR,i and q (w) RL,i when w andw are properly related by Φ p and Ψ p (and for suitable parameters q).
Our plan is next to describe how parameters vary along the processes LR and RL, and how (LR and RL) variations in parameters decompose into variations across transitions. We first define two kinds of variation operators on parameters: • Similarly, for a quarter-plane wordw ∈ S n p and 0 ≤ i ≤ j ≤ n, the RLvariation in q is defined as An extreme case is obtained when i and j differ by 1, in which case Given two (independent) words w andw of same length n, it can happen that the ith step of the LR process at w and the (n + 1 − i)th step of the RL process atw use the same transition (in reverse forms). That is, a possible situation is the existence of a tuple τ = (µ, In such a situation, we call τ a transition instance (or more specifically an instance of a named transition). We can then define the variation in q across τ as the common value Obviously, ∆ τ q depends on the 6-tuple τ , but neither on the location i of its use, nor on the context of the entire p-Łukasiewicz walk or p-tandem quarter-plane walk being processed. Furthermore, both ∆ (w) i→j q and ∆ (w) i←j q decompose as sums of ∆ τ q's, for the successive τ 's set up by LR or RL.
3.3. Specific parameters and some of their invariants. The specific parameters we are about to define are of two types: first, parameters on counters; second, parameters on input and output words. Our proofs will require parameters that are linear combinations of the two types.
For the parameters on counters, we introduce three monoid morphisms from A * p to N. Namely, we define | · |, wt , and wt m , by, respectively, |a ,m | = 1, wt (a ,m ) = + 1, and wt m (a ,m ) = m + 1 for each a ,m ∈ A p . We obtain three parameters, named respectively λ, ζ, and ξ, by setting α,ᾱ, and σ 2 to the zero map, and defining σ 1 by, respectively, A fourth parameter depending on the counters, named v, is obtained by setting σ 2 to the identity and α,ᾱ, and σ 1 to the zero map. We state the following proposition with no reference to parameters, but it clearly expresses constraints for the first three parameters above to cancel. The simplest parameters depending on input and output words we use are given as coordinates of the vertices of the walks. A first parameter, z, is obtained by settingᾱ = σ 1 = σ 2 = 0 and by defining α(µ) = µ for any letter µ ∈ Σ p . Two parameters,x andȳ, respectively, are obtained by setting α = σ 1 = σ 2 = 0 and by definingᾱ(ā) to be the first coordinateā 1 , respectively the second coordinateā 2 of any letterā = (ā 1 ,ā 2 ) ∈ S p . In particular, for any p-Łukasiewicz word w ∈ S n p we have the formulas so that the (i, z (w) LR,i ) form a walk that remains in the upper half plane, and the (x (w) LR,i ,ȳ (w) LR,i ) form a (free) p-tandem walk associated tow (w) LR,1 . . .w (w) LR,n ∈ Σ n p . Another parameter, namedk, measures how far the p-tandem walk is from the main diagonal, and is obtained by setting α = σ 1 = σ 2 = 0 and by definingᾱ(ā) to be the differenceā 2 −ā 1 , for any letterā = (ā 1 ,ā 2 ) ∈ S p . Specifically, Note that, across one step in the LR process, the parameterk either increases by p, if the letterw (w) LR,j is one of the (−j, p − j) for 0 ≤ j ≤ p, or decreases by 2, if it is (1, −1). We mimic this definition on the walk associated to w, by setting now α = σ 1 = σ 2 = 0 and by defining the monoid morphism α from Σ * p to N defined by α(µ) = p if 0 ≤ µ ≤ p and α(−1) = −2. This defines a parameter, named k. Two additional parameters, which we will need specifically for the analysis of the RL process, keep track of the cumulative amount by which the inequalities given below in (2) are strict. They can be understood visually by noting that under most transitions,ȳ and v move in parallel, as dox and ξ. The parameters we want, namedr ands below, are the shifts separating the two parallel functions in each case. More precisely, define a parameterr by setting Similarly, define a parameters by setting Thus, the following formulas hold forw ∈ S * p : It will prove convenient in what follows to write identities like the last one in a more compact, while more general, form. To this end, remember that our parameters are defined through morphisms to Z. Thus, the operations in Z of addition, subtract, and multiplication by an integer, transpose in an obvious manner into operations on morphisms, then into operations on parameters. For instance, we could have definedr ands as differences of parameters, via the formulasr =x − ξ ands =ȳ − v. These conveniently suggest the identities (1), as well as similar identities for the RL process and for variations.
The variations along the walks in the parameters introduced so far depend only on the transition instance τ = (µ, H L , v L , H R , v R ,μ), so we can define and calculate ∆ τ for each of them. As it turns out, the variations actually do not depend on the specific transition instance τ , but simply on the transition, one of (T1) to (T8). The results are given in the table in Figure 12. Figure 12. Variations in the parameters across the transitions defined in Figure 6 for the bijections between p-Łukasiewicz and p-tandem walks.
Additionally, the inequalities (2) are strict in precisely the following circumstances: Proof. By inspection of the table. (The equalities of (4) are really just restatements of the definitions ofr ands.) Since these quantities depend only on the transitions, we also have that for given w ∈ Σ * p ,w ∈ S * p , and 0 ≤ i ≤ j ≤ n, the variations ∆ (w) i→j and ∆ (w) i←j are sums of ∆ τ 's operating on the letters of w andw. It follows by induction that the two equalities and two inequalities in (2) and (3) still hold for ∆ = ∆ (w) i→j and ∆ = ∆ (w) i←j . Observe that ∆r and ∆s are both nonnegative for all choices of ∆ as a ∆ τ , a ∆ (w) i→j , or a ∆ (w) i←j , provided i < j. 3.4. Properties of the constructed walks. Theorem 6. The map Φ p is a bijection between p-Łukasiewicz walks and p-tandem walks that preserves the total number of steps, maps k tok, and maps the number of −1 steps to the number of steps. The map Ψ p is the inverse bijection.
Proof. We first prove that Φ p maps prefixes of p-Łukasiewicz walks to quarterplane walks and that applying Φ p to a p-Łukasiewicz walk in its entirety results in (v, H) = (0, ) at the end of the algorithm.
To this end, again take w ∈ Σ n p andw = Φ p (w), both of length n. Note that we have the initial conditionsx (w) Summing this with the initial conditions we get that for all ī Arguing likewise from (2) and (3) we havē LR,i andx (w) LR,i are nonnegative for all i, as they are both bounded below by lengths, and so the p-tandem walk associated tow remains in the quarter plane. Second, z (w) LR,i is the sum of two nonnegative integers, and more precisely z (w) . As a consequence, by Proposition 4, w is a p-Łukasiewicz word if and only if the construction ofw = Φ p (w) ends with H = and v = 0. Additionally, if w is a p-Łukasiewicz word, then w = Ψ p (Φ p (w)) by the remark at the end of Section 3.1. Finally, also λ (w) LR,n = 0, because H (w) LR,n = , and so k Next we will prove that Ψ p maps quarter-plane walks in S * p to suffixes of p-Łukasiewicz walks and that we have (H, v) = ( , 0) at the end of the algorithm. To this end, now takew ∈ S * p and w = Ψ p (w), both of length n. By (3) we have for all i that Next, summing we get that z (w) RL,i is a sum of nonnegative terms and so is nonnegative for all i. Thus every suffix of w remains in the upper half plane.
Next considerr (w) RL,i ands (w) RL,i . All the entries forr ands in the table are nonnegative and sor (w) RL,i ≥r (w) RL,j for i ≤ j, and likewise fors (w) RL,i . In other words,r (w) RL,i and s (w) RL,i are weakly decreasing as functions of i. Consequentlyr (w) RL,0 is the maximum value of {r (w) RL,i : 0 ≤ i ≤ n}. Let j be maximal such thatr (w) RL,j =r (w) RL,0 . As observed in the previous section,r (w) RL,i can only change under transition (T7) and the stack must be empty for this transition. Thus the choice of j implies by Proposition 4 that ξ (w) RL,j = 0. By definition ofr, for the remainder of the algorithm, from index j down to index 0,x (w) RL,j and ξ (w) RL,j move in parallel with a fixed shift ofr (w) RL,0 . At the end of the algorithm, Ψ p has consumed all ofw from its end to its beginning, and so we havex (w) RL,0 = 0. Sincew is a quarter-plane walk,x (w) RL,j ≥ 0, and by the previous paragraphx (w) However m-weight is always nonnegative and hence ξ (w) RL,0 = 0 and so, by Proposition 4, H is empty at the end of the process.
We can make an analogous argument withȳ in place ofx and v in place of wt m (H). Specifically, now let j be maximal such thats (w) RL,j =s (w) RL,0 . Sincē s can only change under transitions (T2) and (T3), v (w) RL,j = 0. For the remainder of the algorithm, from index j down to index 0,ȳ (w) RL,j and v (w) RL,j move in parallel with a fixed shift ofs (w) RL,0 . We haveȳ (w) RL,0 = 0, and, sincew is a quarter-plane walk, y (w) RL,j ≥ 0. Additionally, by the definition of j,ȳ (w) From all this we conclude that (H, v) = ( , 0) after applying Ψ p tow and that z (w) RL,0 = 0. Thus w is a p-Łukasiewicz word andw = Φ p (Ψ p (w)). Therefore for each n, Φ p and Ψ p are mutually inverse bijections between p-Łukasiewicz walks of length n and quarter-plane walks in S n p . Finally, by (4), k (w) RL,i −k (w) RL,i = (p + 2)λ (w) RL,i , and λ (w) RL,0 = 0 and so k (w) RL,0 = k (w) RL,0 . Remembering (5), this tells us that Φ p and Ψ p , convert k tok and vice versa. Additionally, since −1 (respectively ) is the only step that decreases k (respectivelyk) and all the other steps increase k (respectivelyk) by the same amount p + 2, we also obtain that Φ p and Ψ p take the number of −1 steps to the number steps in the walks and vice versa.
Many interesting consequences can be read off of the observations we have made so far. We collect a few in the following proposition.

for (T3)). • A lower bound on the minimum x-value of the suffixes of the quarter-plane walk is obtained as follows: each time transition (T7) is used, the lower bound on the minimum for the suffix from after this step to the end is increased at least by 1. • If a p-Łukasiewicz walk w returns to the x-axis after i letters, thus factoring
into two p-Łukasiewicz walks, write w = w 1 w 2 for a left factor of length i. Then Φ p (w) is the concatenation of Φ p (w 1 ) and Φ p (w 2 ).
Note that in the case p = 1, transition (T3) does not exist and transition (T2) becomes (L1). Consequenly, the first item of the proposition explains the observation at the end of Example 1.
Yeats [17,Proposition 2.4] has given the result analogous to the second point in the six-step model. The converse to the third point is also true, but this is easier to see from the raising description and so the proof will be postponed to Section 6.
Proof. From Proposition 5, we have ∆ȳ = ∆s + ∆v. Intuitively, this means thatȳ and v move in paralell except whens is nonzero. From the table in Figure 12 we see thats is nonzero precisely for transition (T2) and transition (T3) with p−m−1 > , and whens is nonzero it is positive. Finally, by the Łukasiewicz property, v ≥ 0, therefores gives a lower bound as described in the first item of the statement.
Similarly, from Proposition 5, we have ∆x = ∆r + ∆ξ, so intuitivelyx and ξ move in parallel except withr is nonzero. From the table in Figure 12 we see that r is nonzero precisely for transition (T7) where it has value 1. Finally, ξ is a weight on H and so is always nonnegative, thereforer gives a lower bound as described in the second item of the statement.
For the third point, since w 1 is a p-Łukasiewicz walk, then as in the proof of Theorem 6, we have (v, H) = (0, ) after i steps of the LR process for Φ p . Consequently, when the process moves beyond length i it cannot remember anything from the prefix, as the only internal state is v and H, both of which have been (DE ) Figure 13. Transitions used for the 6-step model. The first row is a copy of Figure 2 with "solid" input letters. The second row is a copy of Figure 2 with "striped" input letters, output letters flipped around the main diagonal, and roles of counters exchanged.
returned to their initial situation. Therefore the same steps are outputted when Φ p acts on the steps of w 2 as part of w as when Φ p acts on w 2 as a p-Łukasiewicz walk in its own right. The second point follows.

Six-step model
Let us consider now the 6-step model, that is we return to the case p = 1 and consider augmenting the step set with the steps' flips through the line y = x. }. We will call the steps , , solid and the steps , , striped, and the walks made of these steps we will call bicoloured.
Define Φ 1,sym and Ψ 1,sym by the following transitions as in Section 2 or Section 3.1.
Inspecting the transitions we see that the forwards and backwards input sets of the transitions partition the forwards and backwards input spaces and the outputs and parameters lie in the correct sets. We can define the same parameters as in Section 3.3 and capture how these parameters change in the table in Figure 14. Figure 14. Variations in the parameters across the transitions defined in Figure 13 for the 6-step model. Then, using these equalities and inequalities, the proof that the maps give a bijection between bicoloured Motzkin paths and quarter-plane walks in S 1,sym proceeds as in the unsymmetrized case.
This bijection answers a question of Bousquet-Mélou and Mishna (see [5, Section 7.1, item 2]); this is encapsulated in the following theorem. The question was first answered in a more complicated way in [17]. We will use the notation M(n) and M bicol (n) for the classes of Motzkin and bicoloured Motzkin paths with n steps, Q(n) for 1-tandem walks with n steps, Q sym (n) for quarter-plane walks with n steps each in S 1,sym and 2 [n] for the powerset of {1, 2, . . . , n}.

Theorem 8. The map Φ 1,sym is a length-preserving bijection between bicoloured
Motzkin paths and quarter-plane walks with steps in S 1,sym . The map Ψ 1,sym is the inverse bijection.
With the notation as described above, the chain of bijections explains combinatorially why |Q sym (n)| = 2 n |Q(n)|.
To say the same thing in a slightly different way, if f is the map forgetting the colouring then Φ 1 • f • Ψ 1,sym gives a combinatorially defined 2 n -to-1 map from quarter-plane walks with steps in S 1,sym to quarter-plane walks with steps in S 1 explaining |Q sym (n)| = 2 n |Q(n)|.
Our answer to the question of Bousquet-Mélou and Mishna, while now fully combinatorial, still goes through Motzkin paths as intermediate objects. We can nevertheless understand some things about the composition directly without this intermediary. Following the definition of Ψ 1,sym we see that steps , , and map to solid letters and , , and map to striped letters. Carrying solid and striped as "colours" though Φ 1 to obtain coloured quarter plane walks in S 1 , we see that output steps which came from input steps in S 1 have the solid colour while output steps which came from the reflection of S 1 have the striped colour. So the colours in the output remember which half of the step set the input steps came from.
From the definition of the maps one can immediately observe that Ψ 1,sym restricted to those 6-step walks which happen to only use steps of S 1 agrees with Ψ 1 after colouring the output of Ψ 1 solid. Additionally, Ψ 1,sym restricted to those 6-step walks which only use steps not in S 1 agrees with Ψ 1 applied to the reflection of the walk after colouring the output of Ψ 1 striped. This was part of the initial motivation: we were looking for a generalization that extended Ψ 1 and that also extended Ψ 1 applied to the reflection for walks purely not using S 1 steps. Returning to the context of the question of question of Bousquet-Mélou and Mishna this implies that Φ 1 • f • Ψ 1,sym is the identity on those walks with only steps in S 1 and is reflection through y = x on those walks with no steps in S 1 .

Alternate interpretation via automata
It was said in the introduction that the bijections we introduce in the present work take their origin in automata theory. Yet, no explicit automaton is provided in Sections 2-4, where we used a notation by "boxes". In this section, we show that boxes are just a rephrasing of the transitions in an automaton, the only essential difference being that a single one of our boxes will usually pack a number of transitions of an automaton. We refer the reader to [1,13,16] for a detailed introduction to automata theory, and we follow the first of these references for the terminology. More accurately, our maps φ, ψ, Φ p , Ψ p , Φ 1,sym , Ψ 1,sym turn out to be the transductions realized by pushdown transducers (see [1,Section 5.4]), with the slight extension that our automata/transducers use two stacks (not just one).
We now give an explicit description of the transducer to transform Motzkin walks to tandem walks (case p = 1). We fix an input alphabet A = Σ 1 = { , , }, an output alphabet B = S 1 = { , , }, a finite set of states Q = {q} (in fact a singleton), a set of accepting states F = Q (that is, we want all states to be accepting), a stack alphabet common to both stacks Z 1 = Z 2 = {o, ι}, an internal starting configuration i = (q, o, o) ∈ Q × Z * 1 × Z * 2 (of the associated pushdown machine), and a set of internal accepting configurations We will also shortly fix a finite set of transition after which collecting those sets into the tuple T = (A, Q, Z 1 , Z 2 , B, i, K, γ) will describe a pushdown transducer over A. As is traditional, an automaton is pictorially described as an oriented graph whose vertices are the elements of Q (states), with transition rules given by a labeling of edges. This labeling takes the form "s; t 1 /T 1 , t 2 /T 2 ; s ", which really denotes a 6-tuple (s, In our transducers, all possible transitions are from state q to itself. A computation by the underlying pushdown machine thus consists of a succession of transitions. Each transition operates in a well-defined manner. If the machine inputs a letter s ∈ A when the internal configuration has t 1 as top letter of the first stack and t 2 as top letter of the second stack, then it replaces the top letter t 1 by the word T 1 and the top letter t 2 by the word T 2 , before outputting the letter s ∈ B. We will make sure that no stack will ever become empty and that their contents encode natural integers in unary: some m ∈ N will correspond to a stack consisting of an o (at the bottom), followed by m copies of ι (towards the top). More precisely, the first, respectively second, stack will represent the counter h, respectively the counter v. So the variations of counters will be be encoded in one of three forms: ι/ for a decrement by 1; o/o and ι/ι for no variation; o/oι and ι/ιι for an increment by 1. This leads to a set γ containing the following 11 transition rules: Observe the absence of a transition rule of the form ; o/T 1 , o/T 2 ; s , which would correspond to the box with an error in Section 2: not listing any such transition rule makes a computation on input and internal configuration (q, o, o) impossible by the underlying pushdown machine. The reader will easily identify the transduction realized by the machine just introduced as the map φ of Section 2.
For general p as well as for the reflected p = 1 case, we change some of the ingredients defining the previous transducer T. In the first situation, the input alphabet, output alphabet, and the alphabet for the first stack are In the second situation, the input and output alphabets are and the alphabet for the first stack is unchanged. We will not go here into the details of the corresponding redefinitions for the sets γ of transition rules. We only provide one example, the encoding of the rule (T6): this single box gets expanded into the (p−1)p/2 transition rules −1; a ,m /a ,m+1 , ι/ ; −1, one for each pair ( , m) satisfying + m ≤ p − 2.

Alternate interpretation via raising
So far, we have provided descriptions of algorithms by transducers that map several classes of quarter-plane walks starting at the origin to related classes of walks in the upper half plane returning to the x-axis. Those maps are described in terms of the alphabet and notation given in Section 1.1, which we repeat here for convenience and to make the present section more independent from the rest. Specifically: • In Section 2, the map ψ (also denoted Ψ 1 ) converts an input (classical) tandem walk with steps from S 1 = { , , } into a Motzkin walk using steps from Σ 1 = {−1, 0, +1} { , , }. • In Section 3, the map Ψ p converts an input p-tandem walk with steps from S p = { , . . . , , . . . , , } into a p-Łukasiewicz walk using steps from Σ p = {−1, 0, 1, . . . , p}.
There is another interpretation of our maps, ψ, Ψ p , Ψ 1,sym , from quarter-plane walks to Motzkin, Łukasiewicz, and bicoloured Motzkin walks. This other interpretation builds the output half-plane walk by, at each stage of the construction, adding a new step at the end and sometimes raising a past step. In this interpretation, stopping the process after dealing with a prefix of a quarter-plane walk results in exactly the action of the full process on that shorter-length walk. Thus the smaller words constructed along the way will not be prefixes of the ultimately constructed half-plane walk, and the approach can no longer be implemented in a single pass. However, it allows us to define the map ψ by reading the quarter-plane walk from left to right instead of from right to left. Additionally it has a prefix property that is reminiscent of the work by Bousquet-Mélou, Fusy, and Raschel [4]: the process really constructs a sequence of half-plane walks that all return to the x-axis, one for each length up to the total length of the input quarter-plane walk. In the p = 1 case and the reflected p = 1 case, the same maps as those we constructed in Sections 2 and 4 have been defined (albeit in a difficult-to-read way) using this raising perspective in [17]. The extension of this raising idea to the p > 1 case is new and will be presented in Section 6.4.
The decision of which past step to raise requires knowing whether past steps can be raised. This cannot be determined simply by looking at past steps, as for instance for p = 1 a past step 0 could have been raised from −1 in which case it is no longer available to be raised or it may have been originally added to the word as a 0 in which case it has not yet been raised and is available for raising. To keep track of this information, over the course of the construction each Motzkin, Łukasiewicz, or bicoloured Motzkin step carries the additional information of whether it can still be raised, and then this additional data is discarded at the end of the construction. For the p = 1 and the flipped p = 1 cases, it is not necessary to carry this extra information provided the algorithm is allowed to look back at previous steps in the quarter-plane walk. This is discussed further below.
In the p > 1 case we additionally need to keep track of a pairing between certain steps. Again this information is discarded at the end of the algorithm. 6.1. Raising in the 3-step model. To make the idea clear first in the simplest case, consider the 3-step model one more time. It is clearer and easier to generalize to p > 1 if, for the duration of the algorithm, we augment the output alphabet so as to include the raisability of the steps. Thus for the duration of the algorithm we will have 5 possible letters in the output word. These will be for a in the Motzkin path that is not raisable and for one that is raisable. Similarly there will be for a in the Motzkin path that is not raisable and for one that is raisable. The fifth letter in the alphabet will be since such steps are never raisable. At the end of the algorithm we forget the extra information and so project onto the smaller alphabet { , , } in order to get a Motzkin path. Given a quarter-plane walk in S * 1 written as a sequence of stepsā 1ā2 . . .ā n , the procedure in Figure 15 (2)c cannot be raised and no step can be raised more than once.
In the language of [17] a step that is raisable is marked and a step that is not raisable is unmarked. Alternately, we can determine whether a step can be raised Input: a quarter-plane walk written as a wordā 1ā2 . . .ā n in S *  j has been raised and so can no longer be raised. It turns out that this procedure is an alternate realization of the map ψ from Section 2. See Figure 16 and the related Figure 1 for an example.
It is useful to sketch a proof that the map defined above is ψ because this explains how the idea of raising relates to the transitions that define ψ. To know what step will be in location i in the final output, it suffices to know what stepā i is and to Input: a quarter-plane walk written as a word in S *  know whether or not the letter first output to this location i will have to be raised at some later stage. Whether or not it will be raised is determined by which steps come later in the input, when read forward. In particular everyā j = must raise a step that came from someā i = with i < j and everyā j = must raise a step that came from someā i = with i < j. In both cases they raise the most recent such steps. If we read the quarter-plane walk in the reverse direction, that is, backwards, we already have the information about whether m i will need to be raised or not when we get to it. Specifically, we only need to count steps and steps (these cause raisings) and subtract these amounts from the counts for and steps, respectively (these get raised). This is exactly what h and v are doing in the original definition of ψ. The cases based on h and v give the raised and unraised options for the different input steps.
The proof in [17] that the map is bijective is both more complicated and more unpleasant than the proofs of this paper, illustrating one of the benefits of our transition-based single pass construction. None-the-less the raisings can be a helpful reformulation for visualizing the map, and explains how to implement ψ while stepping forward through the quarter-plane walk, rather than backward as with the RL transducer algorithm. 6.2. Freedom of pairing and comparison with Eu, Fu, Hou, and Hsu. Observe that knowing whether or not a step will be raised is sufficient to determine the output word, but it is less information than what is given by the raising algorithm. The raising algorithm additionally pairs each raised step with the step that raised it. The left-hand side of Figure 18 shows the pairing obtained on the example worked out in Figure 16. This leaves open the possibility that other algorithms could be described, which give the same output but a different pairing. In fact, in [9], Eu, Fu, Hou, and Hsu give a description of the bijection by an algorithm giving a different pairing. See also [8].
Their algorithm (Algorithm B of [9, Section 2.2]) from the quarter-plane walk takes three passes each running right to left. This algorithm views the quarter-plane walk as a word in S * 1 and modifies it in place to obtain a Motzkin path. Because of the in-place modification, we need disjoint input and output alphabets, so we will write the Motzkin paths as words in {−1, 0, 1} * for the purposes of describing this algorithm. This yields the algorithm in Figure 17.  Figure 16 showing the different pairings from the raising algorithm (left) and Eu, Fu, Hou, and Hsu's algorithm (right). Pairings indicated with solid lines come from (2)b in the raising algorithm or the second pass of Eu, Fu, Hou, and Hsu's algorithm while pairings indicated with dashed lines come from (2)c or the third pass.
As in the raising description, steps become 0, which may or may not then be raised to 1 by a later step, steps themselves become −1, which may or may not be raised to 0 by a later step, and steps themselves always become −1. By making the three separate passes Eu, Fu, Hou, and Hsu's algorithm does not need to distinguish between those 0 steps that have been raised and those that have not, as first all the unraised 0s are generated, then in the second pass some are raised, and finally in the last pass the raised 0s are generated.
Their algorithm also builds the same map ψ because, similarly to the situation in the raising algorithm, to know what step will be in position i in the output it suffices to know what the input step in position i is and whether or not this step will get converted in the second or third pass. To know whether or not a step will be converted, as we read from right to left through the word, we only need to count steps and steps (these cause conversions in the second and third passes) and subtract from the counts for each and steps, respectively, that we meet (these get converted). This is again exactly what h and v are doing in the original definition of ψ. However, the particular pairing given by the three passes is different from the one given in the raising description.
To see the different pairing, consider the example of Figure 16. As a word the quarter-plane walk is where the right-hand side of Figure 18 shows the pairings. Observe that the pairings are different though the Motzkin path is the same.
The raising algorithm gives the pairing that is noncrossing when restricted to those pairings from step (2)b and when restricted to those from (2)c. Eu, Fu, Hou, and Hsu's algorithm gives the pairing that takes the closest step from right to left and so is in some sense maximally crossing in each pass.
In [17] the bicolouring is given by red and black where solid here is red there and striped here is black there. The proof that this defines the same map as in Section 4 is analogous to that of the 3-step model. 6.4. Raising for p > 1. For p > 1 we can move beyond [17] and still give a raising interpretation for Ψ p . There are additional complications compared to the p = 1 cases as steps may be raised more than once, may be frozen from further raising by later steps, and may pass back their raising to a previous step (that is, at a position to its left). A first, rough description of the process follows, before we devote the rest of the section to formal details, culminating with the result that a raising algorithm (given in Figure 20) and the RL transducer algorithm compute the same object (Theorem 13). Reading forwards through the quarter-plane walk, take a letterā in the latter to the smallest Łukasiewicz letter µ that is possible under some transition for that quarter-plane letterā. Most of the time this will break the Łukasiewicz property. Then raise enough previous steps to re-obtain the property. The steps to raise are recent ones that came from quarter-plane steps that went away from whichever axisā goes towards and that have not already been maximally raised.
6.4.1. Raisability and modality of raising. As for the case p = 1, we will keep track of raisability by augmenting the alphabet used during the run of our algorithm, and discarding the raisability information at the end of it. Raisability is now an integer parameter j ≥ 0, indicating how many times the step can be raised (each time by 1, as we will see). However, we need to keep track of more than just the raisability of a step, namely we need to keep track of which kind of future steps it can be raised by and whether it can be raised itself or has to pass its raising on to a previous "proxy" step. We will encode this modality of raising with a second integer parameter t ≥ −1. Depending on modality, steps separate into three sorts. Steps with modality t = −1 can be raised themselves, but only by one of the p steps of the form (−m, p − m) for m ≥ 1 (those having some strict west component). Steps with modality t = 0 can be raised themselves, but only by a step (1, −1). Steps with modality t ≥ 1 can only be raised by proxy, by a step (1, −1), and the value of t then indicates the distance to the proxy step. (Observe that, conversely, a step (0, p) never causes a raising.) We arrive at an alphabet of letters that we denote j,t (µ). For example, 4,−1 (0) represents a 0 letter from the Łukasiewicz alphabet that can be raised 4 times, by a step with strict west component and so has no proxy, while 1,3 (−1) is a letter −1 that can be raised once, by a south-east step and has the letter three positions before it as its proxy. (Beware that what we will soon define as a step getting raised is marked by the decrease of its raisability j, and not necessarily by the increase of its nominal value µ.) Given a quarter-plane walk in S * p written as a sequence of stepsā 1ā2 . . .ā n , the procedure in Figure 20 computes a sequence of words, L 0 to L n , by successively obtaining each L i (of length i) fromā i and L i−1 . Observe that the factorization in the second point of (2)b is always possible because the only case yielding t > 0, case (2)c, also places some (µ)w where j > 0 and t ≥ 0 and where w has no letters with raisability > 0 and modality ≥ 0.
where, for each > 0, j is > 0 and w is free of steps with raisability > 0 and modality −1. Then  recent raisable letters with modality −1, raise the mth oldest one, and remove the raisability of the m letters for the rest of the process. Furthermore, the m − 1 more recent ones are permanently frozen as their raisability is 0 and they cannot be the proxy steps for any future step. The mth most recent of the letters that were found is different. Its raisability has also been set to 0 but it is a proxy. To avoid ambiguities we will use the following language with respect to raising: • In cases (2)c and (2)b we say that the step at position i causes a raising.
• In case (2)b, in both the t = 0 and t > 0 cases we say that the letter j,t (µ) gets raised, becoming j−1,t (µ + 1) and j−1,t (µ) respectively, and that the obtained letter was raised by the step at position i. The t > 0 case is a raising that is passed on to a proxy step, precisely 0,−1 (µ ), but it still counts as a raising for µ not for µ .
• In case (2)c we say that the letter j1,−1 (µ 1 ) gets raised, becoming 0,−1 (µ 1 + 1), and that the obtained letter was raised by the step at position i. We say D  D  D  3  D  D  3  D  4  5  D  D  D  D  4  D  D  D   a b1  b1  b1  b1  b1  c  b2  b2  c  b2  c  a b1  b1  b1  b1  c  b2  b2  b2 1 5,0 (µ ) for 1 ≤ ≤ m get frozen by the step at position i, and this also does not count as a raising. Note that the raisability of a letter is never increased and only letters with positive raisability can get raised. Example 9. We continue Example 3 by providing in Figures 21 and 22 an example of execution of the raising algorithm on the same 5-tandem walkw. The forward process exemplified in Figure 21, with inputw (at the top) and output w (at the bottom), should be compared to the RL transducer process in Figure 11 constructed are first shown in there precise form with raisability and modality in Figure 21, and next as plain walks in Figure 22.
To make the connection between the raising algorithm and the transducer algorithm more precise in Theorem 13 we need a few lemmas. We gather simple properties in Figures 23 and 24, then give the more elaborate Lemmas 11 and 12. For the rest of the section, letw be a quarter-plane walk in S * p with lettersā j . Immediate properties of the RL process and of the raising algorithm can be derived from the two algorithm descriptions. They are expressed in terms of the nature of steps in the input wordw, by trichotomies according to their x-coordinate and y-coordinate, respectively. These properties are gathered as tables in Figures  23 and 24 (only their last rows are less immediate and will be proved in lemmas). The trichotomy with respect to y matches exactly the case distinction in the raising algorithm (into (2)a, (2)b, (2)c); it also matches a partitioning of the transitions. In contrast, the trichotomy with respect to x does not directly match the computational case distinctions in our algorithms, but further refinements of case (2)c and of (T3) and (T4) provide a suitable partitioning. (We could have gathered the two tables by a partitioning into four columns, at the cost of some repetition.) 6.4.2. Augmented RL transducer process: a more elaborate stack V . For the purposes of the first lemma, we will reinterpret the parameter v from the RL transducer algorithm as the length of a new stack V added to the algorithm. The letters allowed on V will be integers representing positions in the input wordw. Thus it will make sense to speak of which letter or transition instance put a particular element onto V and which took it off, and the stack elements will keep track of these indices. Specifically, for the rest of this section, we augment the RL process with the stack V and we modify the reverses of the transitions (T1) to (T7). In the augmented RL process, the reverses of (T5), (T6), and (T7) push i onto the stack V whenever those transitions are used at stage n + 1 − i, that is, when dealing with the input letterā i . Moreover, the reverses of (T1), (T2), (T3), and (T4) pop respectively p, q, , and elements from the stack V . the row for V , the augmented RL transducer process successively pushes 21, 20, and 19 to the stack V by three instances of (T7), before an instance of (T3) pops all three integers, emptying the stack. Four similar cycles of successive pushes before emptying the stack occur in the rest of the run. Other examples involving (T2) would similarly empty the stack; on the other hand, examples with longer runs of successive pushes could lead to the use of (T4) or (T1), causing pops of several integers without fully emptying the stack. 6.4.3. Relation between steps with positive y-coordinates, the stack V , and raisings.
Lemma 11. Consider an index j inw for whichā j has positive y-coordinate. When processingā j , the RL transducer algorithm either • leaves the stack V unchanged, in which case the letter in position j is never raised in the raising algorithm, or • takes off at least one element from it, in which case the steps (with indices > j) that put on those elements taken off byā j are precisely the steps that raise the letter in position j in the raising algorithm.
Proof. Consider the trichotomy of input steps given by the (1, −1) steps, the (−p, 0) steps, and the steps with positive y-coordinate. We will now to describe, in relation to this trichotomy, which transitions in the RL transducer algorithm and which cases in the raising algorithm deal with the steps. We will also describe how the steps affect V in the RL process and are involved in raisings of steps of modality ≥ 0 in the raising algorithm. The table in Figure 23 captures facts, all of which can be immediately derived from the two algorithm descriptions, with the exception of the final row, which requires additional explanation. This row is addressing how the input steps are involved in raisings of steps with modality ≥ 0, which can occur only in case (2)b (as a raising requires raisability > 0). All (1, −1) steps are dealt with by case (2)b and vice versa; each time exactly one raising of a step of modality ≥ 0 is caused (this raising may or may not involve a proxy, but that is of no concern for this lemma). The step (−p, 0) has no involvement with raisings of steps of modality ≥ 0 as the raisings it causes are on steps of modality −1 and its output step is unraisable from its creation. The steps with positive y-coordinate have output steps of modality ≥ 0 with nonzero raisability: each such output step starts with raisability equal to the y value of the input step and may get raised any number of times between 0 and this value. Steps with positive y do cause raisings but only on steps of modality −1 which are not of present concern. Therefore the input steps that raise steps of nonnegative modality (that is, those dealt with by case (2)b) and the steps that put an element on V (that is, those that increase v) are the same, namely the (1, −1) steps. Furthermore the steps with positive y-coordinate are the only ones which may take elements off V and are also the only ones whose corresponding outputs may get raised by step (2)b.
It remains to show that the these classes of steps are associated to each other as described in the statement of the lemma. This is a parenthesis matching problem. Let each step with positive y-coordinate correspond to as many open parentheses as its y-coordinate and each (1, −1) correspond to a close parenthesis. In this way the input word is associated to a string of parentheses. Note that there may be more open parentheses in this string than close parentheses. The final thing we need to prove is that the RL process and the raising process both induce a natural matching of these parentheses, both being in fact the same matching. By remembering what input letter has introduced each parenthesis, this matching induces an association between input letters, each step with positive y-coordinate being potentially linked to several (1, −1) more rightwards. Specifically, this association will be the one described in the statement of the lemma.
Consider first the RL transducer process. Reading the string of parentheses from right to left in parallel to the RL process, a close parenthesis corresponds to adding an element to V , open parentheses to removing elements of V provided V is not empty yet. By inspecting the transition rules, we see that in the RL process, when v decreases it always decreases by as much as it can (namely by the minimum of its current value and the y-coordinate of the input step). Consequently the parentheses are matched naturally from right to left in a last in first out manner, with the additional rule that unmatchable opens are skipped when they are met. The result of this is the parenthesis matching obtained by forcing all extra opens to be as leftwards as possible while retaining the possibility to match all closes. Furthermore, the links between input letters naturally induced from the parenthesis matching are such that any stepā j with positive y-coordinate is linked to exactly those input steps in the RL process that added elements of V thatā j later removes. The stack V remains unchanged precisely when the linking induced from the parenthesis matching does not linkā j to any other steps. Now consider the raising process. The reader can check that the raisability of the output letter at position j after dealing with the input letterā i is equal to the number of unmatched open parentheses in the group originating fromā j when we consider the left-to-right last in first out parentheses-matching algorithm after all groups originating fromā 1 , . . . ,ā i have been dealt with. This can be verified by a step-by-step comparison or a straightforward induction. This gives the same parenthesis matching as the RL transducer process. Furthermore, the links between input letters naturally induced from the parenthesis matching are such that any step a j with positive y-coordinate is linked to exactly those input steps which raised the step at position j. The step at position j is never raised precisely when the linking induced from the parenthesis matching does not linkā j to any other steps.
The concluding sentences of the previous two paragraphs together prove the lemma. 6.4.4. Relation between steps with negative x-coordinates, the stack H, and freezings of raisings. Letters with negative x-coordinates cause a push onto H in the RL transducer algorithm and no other letters cause a push onto H. Let a ,m−1 be a letter that is pushed onto H. Observe that the only way for a ,m−1 to be taken off the stack is by m − 1 (T6) transition instances and then a (T5) transition instance (not necessarily consecutively). Note also that in the raising algorithm the case that deals with letters with negative x-coordinate is case (2)c. These simple observations are refined in the next lemma.

Lemma 12.
Let j be an index inw for whichā j has negative x-coordinate, so that some letter a ,m−1 is pushed on H at step j in the RL process. Then, the indices where the m − 1 (T6) transition instances occur are precisely the indices of the letters that are permanently frozen by case (2)c forā j , and the index where the (T5) instance occurs is the index of the letter raised byā j .
Additionally, indices where (T7) transition instances occur correspond to indices where the output step in the raising algorithm has modality −1 but is never raised or frozen.
Proof. The relevant trichotomy of input letters for this lemma is based on xcoordinate rather than y-coordinate. A table again helps to collect the key information that can be read off the definitions of the two algorithms, and is given in Figure 24. The final row addresses how the input steps and their outputs are involved in raisings and freezings of steps of modality −1. These raisings and freezings occur only in case (2)c. As we will prove in what follows, the three possibilities in the bottom left entry of the table correspond respectively with the three possibilities in each of the first and second left entries of the table.
Again we have a parenthesization problem. Associate every (1, −1) step in the input to an open parenthesis. Associate every input step with x-coordinate x < 0 with |x| close parentheses. The input word is again associated to a string of parentheses and again there may be more open parentheses in this string than close parentheses. The RL process and the raising process give natural matchings of these parentheses, and the final claim is that they both give the same matching, and that specifically, the matching is as described in the statement of the lemma.
Consider first the RL transducer process. Reading the string of parentheses from right to left in parallel to the RL process, every time an element a ,|x|−1 is added to the stack H, |x| close parentheses appear in the parenthesis string, and close parentheses can appear in no other way. Every time the second coordinate of the top of H is decreased by 1 as well as every time the top of H is popped, there is an open parenthesis that matches the most recent unmatched close parenthesis; additionally, each instance of transition (T7), which can only occur when H is empty, introduces one open parenthesis, which remains unmatched.
We proceed to justify that such a matching is always possible. Recall that the mweight of a ,m −1 is m (see Section 3.3). Thus, because the RL transducer process makes no other kind of alteration to H, at any given point in the RL process, wt m (H) is the number of unmatched close parentheses at the corresponding point in the parenthesis string. In particular the matching is always possible. Also, the open parentheses from (T7) steps only occur when H is empty, that is, when there are no unmatched close parentheses.
Therefore, the RL transducer algorithm matches the parentheses from right to left in a last in first out manner with the additional rule that unmatchable opens are skipped when they are met. Furthermore, the links between input letters naturally induced from the parenthesis matching are such that any stepā j with negative x-coordinate is linked to exactly those steps that modify (via (T6)) or pop (via (T5)) the element of H thatā j pushed. Now consider the raising process. The reader can verify by a straightforward induction that for a (1, −1) input step at some position j, the output letter from this step, after dealing with the input letterā i for i ≥ j, is raisable if and only if the open parenthesis from the (1, −1) step is unmatched when we consider the left-to-right last in first out parentheses-matching algorithm after all parentheses originating fromā 1 , . . . ,ā i have been dealt with. Thus the raising algorithm matches the parentheses in a left to right, last in first out manner. This gives the same parenthesis matching as the RL transducer process. Observe that the unmatched open parentheses correspond to output letters from (1, −1) input steps which are still raisable at the end of the algorithm. Since such output steps are raisable at most once and freezing also sets the raisability to 0, these are steps which were never frozen or raised. Furthermore, the links between input letters naturally induced from the parenthesis matching are such that any stepā j with negative x-coordinate is linked to exactly those steps that were either frozen or raised byā j by step (2)c. 6.4.5. Equivalence between the raising and transducer processes. The concluding sentences of the previous two paragraphs prove the first statement of the lemma. The characterization of the unmatched open parentheses in the two algorithms implies the second statement of the lemma. Figure 20 and the RL transducer algorithm produce the same output.

Theorem 13. The raising algorithm in
Proof. We prove the result for the augmented RL transducer algorithm, which has the same output as the unmodified RL transducer algorithm. The proof considers each position j independently and goes by a case analysis on the input letterā j : • Supposeā j is (0, p). Case (2)a stipulates that the first letter output by the raising algorithm at posititon j is 0 and the second point of case (2)b stipulates that when this step is raised its output letter increases by 1 for each raising. Thus the final output by the raising algorithm at position j is the number of times the step in position j is raised. On the other hand, in the RL transducer algorithm, transitions (T1) and (T2) together make the output at j be the number of elements of V that are removed at step j. Therefore Lemma 11 implies that the final output of both algorithms at position j is the same. • Supposeā j is (1, −1). We refine the case analysis according the the transition used at that position j by the RL process: -Ifā j triggers a (T6) instance, then the output letter in this position by the RL process is −1 , and by Lemma 12 the output letter in this position in the raising process was frozen and so is also −1 (by steps (2)b and step (2)c, along with the fact that Lemma 12 accounts for all transitions that affect H). -Ifā j triggers a (T5) then Lemma 12 also implies that the output by the raising algorithm at that position j is turned into a proxy step after dealing with some position i ≥ j. The step at position i is the step that originally put on the stack letter that the (T5) instance removed. The output of this (T5) instance is the value of the first index of this stack letter, but this is the number of elements taken off of V byā i . Lemma 11 implies that this number is the same as the number of steps that raised the output letter at position i. Hence by the nature of proxy raising, this number is the final output value at position j. Therefore both algorithms also agree in this case. -Ifā j triggers a (T7) then the RL transducer algorithm outputs a −1; in the raising algorithm, the output step at position j first appears as a −1 by case (2)b, while by Lemma 12 it is never raised, and so it is −1 in the final output. • Supposeā j has a negative x-coordinate. All these cases yield −1 as output steps in both algorithms.
Therefore, the description of Ψ p by raisings agrees with the transducer description.
Overall, the raising description is more complicated than the transition-based description of Ψ p . This is a good moment to return to Proposition 7. The (T2) and (T3) steps with p − m − 1 > described in the first point of the proposition are the steps that could be raised but do not get raised by the end of the raising algorithm. This gives an intuitive explanation for why they correspond to an increased bound on the abscissa for the quarter-plane walk: if the quarter-plane walk were extended to return to lower x-values, then sufficiently many steps must be present in the p-Łukasiewicz walk that can still be raised to correspond to these extension steps.
walks or half-plane walks ending on the x-axis in S * p,sym . The latter suggestion is in view of the bijection between Łukasiewicz walks and half-plane walks ending on the x-axis in S * p . However, direct counting of small walks in these sets show that neither of these are equinumerous with quarter-plane walks in S * p,sym . Leaving this problem aside for the moment, we could try to generalize the transitions in the hopes that the image itself will become clear in due time. Analogously to the relationship between the p = 1 transitions and the symmetrized p = 1 transitions, we would expect that restricting to only the flipped steps as input should give us something equivalent to the original map but with differently coloured output steps and with the parameters swapped. Thus we expect that transitions for a Ψ p,sym map would have two stacks as parameters and would specialize to Ψ p in two ways. Unfortunately, neither considering the symmetries of the transitions nor working through many small examples have shown how this could be done.
Consequently, we are left without a clear idea of how to generalize our maps to a symmetrized p > 1 situation. 7.3. Standard Young tableaux of bounded height. In their work [9], Eu, Fu, Hou, and Hsu gave an algorithm for the bijection when p = 1 that is similar in spirit to the algorithm by raising. See our comments in Section 6.2. This bijection, between (usual) Motzkin walks and Yamanouchi words as we described it in Section 2, really is a bijection between Motzkin walks and standard Young tableaux of height at most 3. But the true contribution of [9] was to generalize it to a bijection between standard Young tableaux of height at most d and a class of coloured Motzkin walks that they introduced. Their "d-Motzkin walks" are Motzkin walks whose up and down steps may appear in d-colours, with an additional constraint between the occurrences of the colours that they describe by inequalities. The bijection works by treating and removing the colours one after the other. This makes it very tempting to try and apply the transducer approach to d-Motzkin walks. Our attempts have failed so far. If one conceives the transducer approach applied to (usual) Motzkin walks as a means to reschedule the raising transformations so that they can be applied as soon as a raised step is considered, instead of postponing to when the process needs it to restore a Motzkin property, then a transducer algorithm for bounded height would develop such a rescheduling for each colour, and the d transducers thus obtained would then have to be merged into a single one, leading to further rescheduling. It would be great to see such an algorithm.