# Thron-type continued fractions (T-fractions) for some classes of increasing trees

Veronica Bitonti, Bishal Deb, Alan D Sokal

<figure><img src="image_1.png" /></figure>

## To cite this version:

Veronica Bitonti, Bishal Deb, Alan D Sokal. Thron-type continued fractions (T-fractions) for some classes of increasing trees. 2025. hal-04920405

HAL Id: hal-04920405

https://hal.science/hal-04920405v1

Preprint submitted on 30 Jan 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
# Thron-type continued fractions (T-fractions) for some classes of increasing trees

Veronica Bitonti¹,², Bishal Deb³, and Alan D. Sokal¹,⁴

¹Department of Mathematics, University College London, London WC1E 6BT, UK

²Trinity College, University of Cambridge, Cambridge CB2 1TQ, UK

³Sorbonne Université and Université Paris Cité, CNRS, Laboratoire de Probabilités, Statistique et Modélisation, Paris 75005, FRANCE

⁴Department of Physics, New York University, New York, NY 10003, USA

vb435@cam.ac.uk, bishal@gonitsora.com, sokal@nyu.edu

12 December 2024

## Abstract

We introduce some classes of increasing labeled and multilabeled trees, and we show that these trees provide combinatorial interpretations for certain Thron-type continued fractions with coefficients that are quasi-affine of period 2. Our proofs are based on bijections from trees to labeled Motzkin or Schröder paths; these bijections extend the well-known bijection of Françon-Viennot (1979) interpreted in terms of increasing binary trees. This work can also be viewed as a sequel to the recent work of Elvey Price and Sokal (2020), where they provide combinatorial interpretations for Thron-type continued fractions with coefficients that are affine. Towards the end of the paper, we conjecture an equidistribution of vincular patterns on permutations.

**Key Words:** Continued fraction, S-fraction, J-fraction, T-fraction, increasing tree, multilabeled tree, Motzkin path, Schröder path, exponential Riordan array, permutation, vincular pattern.

**Mathematics Subject Classification (MSC 2020) codes:** 05A19 (Primary); 05A05, 05A15, 05A30, 05C05, 05C30, 30B70 (Secondary).
# Contents

<table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td>1 Introduction</td><td>3</td></tr><tr><td>1.1 Combinatorial models for T-fractions</td><td>4</td></tr><tr><td>1.2 Outline of this paper</td><td>8</td></tr><tr><td>2 Preliminaries</td><td>9</td></tr><tr><td>2.1 Contraction and transformation formulae</td><td>9</td></tr><tr><td>2.2 Types of labeled trees.</td><td>10</td></tr><tr><td>2.3 Tree statistics: Node types and label surplus</td><td>11</td></tr><tr><td>2.4 Tree statistics: Crossings and nestings</td><td>12</td></tr><tr><td>3 Statement of results</td><td>14</td></tr><tr><td>3.1 Increasing binary trees</td><td>14</td></tr><tr><td>3.1.1 Simple J-fraction and T-fraction</td><td>14</td></tr><tr><td>3.1.2 Master J-fraction and T-fraction</td><td>16</td></tr><tr><td>3.2 Increasing restricted ternary trees</td><td>18</td></tr><tr><td>3.2.1 Simple J-fraction and T-fraction</td><td>18</td></tr><tr><td>3.2.2 Master J-fraction and T-fraction</td><td>20</td></tr><tr><td>3.2.3 A more general master T-fraction</td><td>22</td></tr><tr><td>3.3 Increasing interval-labeled restricted ternary trees</td><td>24</td></tr><tr><td>3.3.1 Simple T-fraction</td><td>24</td></tr><tr><td>3.3.2 Master T-fraction</td><td>26</td></tr><tr><td>4 Preliminaries for the proofs</td><td>28</td></tr><tr><td>4.1 Combinatorial interpretation of continued fractions</td><td>28</td></tr><tr><td>4.2 Labeled Dyck, Motzkin and Schröder paths.</td><td>30</td></tr><tr><td>5 Bijective proofs of Theorems 3.11 and 3.18</td><td>32</td></tr><tr><td>5.1 Bijection for increasing restricted ternary trees: Proof of Theorem 3.11</td><td>32</td></tr><tr><td>5.2 Bijection for increasing interval-labeled restricted ternary trees: Proof of Theorem 3.18</td><td>36</td></tr><tr><td>6 Algebraic proofs of Theorems 3.7, 3.15 and 3.17</td><td>45</td></tr><tr><td>6.1 Exponential Riordan arrays, production matrices, and the enumeration of rooted trees</td><td>45</td></tr><tr><td>6.2 Application to increasing restricted ternary trees: Proof of Theorem 3.7</td><td>47</td></tr><tr><td>6.3 Application to increasing interval-labeled restricted ternary trees: Proof of Theorems 3.15 and 3.17</td><td>48</td></tr><tr><td>7 Other interpretations</td><td>48</td></tr><tr><td>7.1 Increasing binary trees ≃ Permutations</td><td>49</td></tr><tr><td>7.2 Increasing restricted ternary trees ≃ Binary free multilabeled increasing trees</td><td>55</td></tr><tr><td>A Table of OEIS matches for some T-fractions with quasi-affine coefficients</td><td>56</td></tr><tr><td>B Context-free grammars (= derivative operators) for our generating polynomials</td><td>58</td></tr><tr><td>B.1 Increasing binary trees</td><td>59</td></tr><tr><td>B.2 Increasing restricted ternary trees</td><td>59</td></tr></tbody></table>
# 1 Introduction

Let $(a_n)_{n \ge 0}$ be a sequence of combinatorial numbers or polynomials with $a_0 = 1$. In this paper we are interested in expressing the ordinary generating function $\sum_{n=0}^{\infty} a_n t^n$ as a continued fraction of Thron-type (T-fraction for short):

$$ \sum_{n=0}^{\infty} a_n t^n = \frac{1}{1 - \delta_1 t - \frac{\alpha_1 t}{1 - \delta_2 t - \frac{\alpha_2 t}{1 - \delta_3 t - \frac{\alpha_3 t}{1 - \dots}}}} \quad (1.1) $$

(Both sides of this expression are to be interpreted as formal power series in the indeterminate $t$.)

The study of T-fractions, especially those in which all the coefficients $\delta_i$ and $\alpha_i$ are nonzero, is comparatively rare in the combinatorial literature. The most commonly studied continued fractions are those of Stieltjes-type (S-fraction),

$$ \sum_{n=0}^{\infty} a_n t^n = \frac{1}{1 - \frac{\alpha_1 t}{1 - \frac{\alpha_2 t}{1 - \frac{\alpha_3 t}{1 - \dots}}}}} \quad (1.2) $$

and Jacobi-type (J-fraction),

$$ \sum_{n=0}^{\infty} a_n t^n = \frac{1}{1 - \gamma_0 t - \frac{\beta_1 t^2}{1 - \gamma_2 t - \frac{1 - \beta_2 t^2}{1 - \gamma_3 t - \frac{\beta_3 t^2}{1 - \dots}}}}} \quad (1.3) $$

Clearly, T-fractions are a generalization of the S-fractions, and reduce to them when $\delta_i = 0$ for all $i$. A nontrivial example of a T-fraction along with combinatorial interpretations was obtained recently by Elvey Price and one of us [16]: we considered the T-fraction with coefficients that are affine in $n$,

$$ \alpha_n = x + (n-1)u \quad (1.4a) $$

$$ \delta_n = z + (n-1)(w' + w'') \quad (1.4b) $$

and we showed [16, Theorem 1.2] that the Taylor coefficients $a_n$ are multivariate generalizations of the Ward polynomials that enumerate *super-augmented perfect matchings* or *phylogenetic trees* with respect to suitable statistics. Note that specializing to $z = w' = w'' = 0$ gives the S-fraction for perfect matchings with a weight $x$ for each record and a weight $u$ for each cycle-peak non-record [38, Theorem 4.1]. The most general result in [16] — the so-called “master T-fraction” [16, Theorem 2.1] — enumerates super-augmented perfect matchings with respect to an infinite number of statistics.
Our initial goal in this project was to generalize (1.4) to the case in which the coefficients $\alpha_n$ and $\delta_n$, rather than being affine in $n$, are instead “quasi-affine of period 2”:

$$ \alpha_{2k-1} = x + (k-1)u \qquad (1.5a) $$

$$ \alpha_{2k} = y + (k-1)v \qquad (1.5b) $$

$$ \delta_{2k-1} = a + (k-1)c \qquad (1.5c) $$

$$ \delta_{2k} = b + (k-1)d \qquad (1.5d) $$

Note that specializing to $a = b = c = d = 0$ in this T-fraction gives the S-fraction enumerating permutations with respect to exclusive records, antirecords and excedances [38, Theorem 2.1]. And this is, in turn, a special case of an S-fraction or J-fraction enumerating permutations with respect to an infinite number of statistics [38, Theorems 2.9 and 2.11].

When all eight parameters in (1.5) equal 1, the sequence $(a_n)_{n \ge 0}$ is

$$ (a_n)_{n \ge 0} = 1, 2, 6, 24, 124, 800, 6208, 56240, 582272, 6781888, 87769632, \dots, \qquad (1.6) $$

which is not in the OEIS [28] and for which we do not have any natural combinatorial interpretation.<fnref n="1" /> However, for certain special cases we are able to find a natural combinatorial interpretation. For instance, when $c = 0$ and the other seven variables equal 1, we have

$$ (a_n)_{n \ge 0} = 1, 2, 6, 23, 109, 632, 4390, 35621, 330545, 3451774, 40059838, \dots; \qquad (1.7) $$

and although this sequence is not currently in the OEIS, we will show that it enumerates increasing interval-labeled restricted ternary trees — a class that will be defined later in this introduction. More generally, with the constraints $c = 0, x = u, y = v, b = d$ we are able to find a combinatorial interpretation of the polynomials in four variables generated by

$$ \alpha_{2k-1} = kx, \quad \alpha_{2k} = ky, \quad \delta_{2k-1} = a, \quad \delta_{2k} = kb \qquad (1.8) $$

as enumerating increasing interval-labeled restricted ternary trees with respect to some statistics counting *node types* and *label surplus*.

Our combinatorial interpretations will thus involve several classes of increasing trees, i.e. labeled rooted trees in which the labels increase from parent to child. We will prove each J-fraction or T-fraction by constructing a bijection from the given class of increasing trees to a suitable class of labeled Motzkin or Schröder paths. These bijections will generalize the classical Françon–Viennot [21] bijection from permutations to labeled Motzkin paths, reformulated [19, 23] as a bijection from increasing binary trees to labeled Motzkin paths. Some of our tree constructions have been studied previously by Kuba and Panholzer [26], albeit not in the context of continued fractions.

In the remainder of this introduction we introduce our families of increasing trees in increasing levels of generality (Section 1.1) and then provide an outline of the rest of the paper (Section 1.2).

## 1.1 Combinatorial models for T-fractions

Our main combinatorial objects, as the title suggests, are several families of increasing trees. We list them here:

<footnote n="1">¹We have an “unnatural” combinatorial interpretation by taking $\mathbf{a} = \mathbf{b} = \mathbf{c} = \mathbf{d} = \mathbf{f} = \mathbf{1}$ and $\mathbf{e}_k = k+1$ in Theorem 3.18. This corresponds to increasing interval-labeled restricted ternary trees with the non-minimal labels in vertices being “multicolored”.</footnote>
<figure><img src="image_3.png" /><figcaption>Figure 1: An example of an increasing binary tree on the vertex set [8]. To the left of each vertex, its order as per the inorder traversal is recorded.</figcaption></figure>

**Increasing binary trees.** Our first family is the well-known set of all increasing binary trees on the vertex set $[n] \stackrel{\text{def}}{=} \{1, \dots, n\}$. That is, there is a binary rooted tree with $n$ vertices, in which the vertices carry distinct labels from the label set $[n]$; furthermore, the label of a child is always greater than the label of its parent. (In particular, the root must have label 1, and the vertex with label $n$ is necessarily a leaf.) It is well known [39, p. 45] that the cardinality of such trees is $n!$. The sequence $(n!)_{n \ge 0}$ has the well-known S-fraction with $\alpha$'s given by $1, 1, 2, 2, 3, 3, 4, 4, 5, 5, \dots$, due to Euler [18, section 21].<fnref n="2" /> This is (1.5) with $x = y = u = v = 1$ and $a = b = c = d = 0$. We denote by $B_n$ the set of all increasing binary trees on the vertex set $[n]$.

Figure 1 is an example of an increasing binary tree on the vertex set [8].

**Increasing restricted ternary trees.** Our second family consists of increasing ternary trees on the vertex set $[n]$ such that middle children do not have any siblings. We call these increasing restricted ternary trees (RTs for short). We will show (Corollary 3.10) that the sequence of cardinalities of these trees is generated by the T-fraction with $\alpha$'s given by $1, 1, 2, 2, 3, 3, 4, 4, 5, 5, \dots$ and $\delta$'s given by $0, 1, 0, 2, 0, 3, 0, 4, 0, 5, \dots$: that is, (1.5) with $x = y = u = v = b = d = 1$ and $a = c = 0$. This sequence begins as

$$ (a_n)_{n \ge 0} = 1, 1, 3, 11, 51, 295, 2055, 16715, 155355, 1624255, 18868575, \dots \quad (1.9) $$

and is [28, A230008].

The shifted sequence $(a_n)_{n \ge 1}$ was previously studied by Kuba and Panholzer in [26, Section 5.2, Example 5 and Remark 8]. However, they considered a different combinatorial interpretation: namely, binary free multilabeled increasing trees. They showed that the exponential generating function $F(t) = \sum_{n=1}^{\infty} a_n t^n/n!$ satisfies the ordinary differential equation

$$ F'(t) = F(t)^2 + 3F(t) + 1. \quad (1.10) $$

It is not difficult to see, using the general theory of increasing trees [5], that the exponential generating function for increasing restricted ternary trees satisfies this same differential equation. Indeed, one can also show directly that, for $n \ge 1$, binary free multilabeled increasing trees of size $n$ are in bijection with increasing restricted ternary trees of size $n$;

<footnote n="2">²The paper [18], which is E247 in Eneström's [17] catalogue, was probably written circa 1746; it was presented to the St. Petersburg Academy in 1753, and published in 1760.</footnote>
<figure><img src="image_4.png" /><figcaption>Figure 2: An example of an increasing restricted ternary tree on the vertex set [6].</figcaption></figure>

we do this by using the bijection in [26, Theorem 10] and then redrawing the black vertices
in their bijection to have middle children (see Section 7.2). We denote by $RT_n$ the set of
all increasing restricted ternary trees on the vertex set $[n]$.

Figure 2 is an example of an increasing restricted ternary tree on the vertex set [6].

**Increasing interval-labeled restricted ternary trees.** Our third family is defined as follows: An *increasing interval-labeled restricted ternary tree* (IRT for short) on the label set $[0, n]$ is a vertex-labeled tree satisfying the following rules:

* The underlying tree is a ternary rooted tree in which middle children do not have any siblings.

* Each vertex $v$ in the tree is assigned an interval of integer labels $L_v = [i_1, i_2] \subseteq [0, n]$ such that for every $i \in [0, n]$ there exists exactly one vertex $v$ with $i \in L_v$. Thus, the collection of vertex labels forms an interval-partition of $[0, n]$.

* If a vertex $v$ has a middle child, then $|L_v| = 1$, i.e., the vertex $v$ gets a single label.

* The labels are increasingly assigned, i.e., for every pair of vertices $v, w$ such that $v$ is the parent of $w$, we impose that $\max L_v < \min L_w$.

* The root (which is the vertex containing 0 in its label set) can only have a left child, not a middle or right child.

We stress that $n + 1$ is the total number of integer *labels*; the number of *vertices* can be anything from 1 to $n+1$. We denote by $\mathcal{IRT}_n$ the set of all IRTs on the label set $[0, n]$. In Figure 3 we show all IRTs on the label set $[0, n]$ with $n = 0, 1, 2$, and in Figure 4 we show an example of an IRT on the label set $[0, n]$ with $n = 16$.

Clearly, if we impose the further condition that all label sets have cardinality 1, and we
then remove the root (which in this case necessarily has label set {0}), then what remains
is an increasing restricted ternary tree on the vertex set [n] (and conversely). These trees
therefore generalize RTs by allowing the vertex labels (including that of the root) to be
intervals of cardinality > 1.

We will show (Corollary 3.16) that the sequence of cardinalities of these trees is gen-
erated by the T-fraction with $\alpha$'s given by 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, ... and $\delta$'s given by
1, 1, 1, 2, 1, 3, 1, 4, 1, 5, ...: that is, (1.5) with $x = y = u = v = a = b = d = 1$ and
$c = 0$. As already mentioned, this sequence is (1.7) and is not at present in the OEIS.
$n = 0:$

<figure><img src="image_5.png" /></figure>

1 in (3.40)

1 in (3.47)-(3.50)

$n = 1:$

<figure><img src="image_6.png" /></figure>

$z$ in (3.40)

<figure><img src="image_7.png" /></figure>

$y_1$ in (3.40)

$\mathbf{e}_0$ in (3.47)-(3.50)

$\mu_0 \cdot \hat{\mathbf{b}}_{00}$ in (3.47)-(3.50)

$n = 2$

<figure><img src="image_8.png" /></figure>

$z^2$ in (3.40)

<figure><img src="image_9.png" /></figure>

$y_1z$ in (3.40)

<figure><img src="image_10.png" /></figure>

$y_1z$ in (3.40)

$\mathbf{e}_0^2$ in (3.47)-(3.50)

$\mu_0 \mathbf{e}_0 \cdot \hat{\mathbf{b}}_{00}$ in (3.47)-(3.50)

$\mu_0 \cdot \hat{\mathbf{b}}_{00} \mathbf{e}_0$ in (3.47)-(3.50)

<figure><img src="image_11.png" /></figure>

$x_2y_1$ in (3.40)

<figure><img src="image_12.png" /></figure>

$wy_1$ in (3.40)

<figure><img src="image_13.png" /></figure>

$y_1y_2$ in (3.40)

$\mu_0 \cdot \hat{\mathbf{a}}_{0,0} \nu_0 \cdot \hat{\mathbf{b}}_{00}$ in (3.47)-(3.50)

$\mu_0 \cdot \mathbf{f}_{0,0} \cdot \hat{\mathbf{b}}_{00}$ in (3.47)-(3.50)

$\mu_0 \cdot \hat{\mathbf{b}}_{0,0} \mu_0 \cdot \hat{\mathbf{b}}_{00}$ in (3.47)-(3.50)

<caption>Figure 3: All IRTs on label set $[0, n]$ with $n = 0, 1, 2$, along with their respective weights as per equations (3.40) and (3.47)-(3.50).</caption>
<figure><img src="image_14.png" /><figcaption>Figure 4: An example of an increasing interval-labeled restricted ternary tree on the label set [0, 16]. To the left of each vertex are two numbers a:b, where a is the order of the vertex as per the preorder traversal, and b is the order of the vertex as per traversal order A' defined as follows: the left child if any, then the root, then the middle child if any, and then the right child if any, all implemented recursively.</figcaption></figure>

Our motivation behind defining this class of trees is a simple identity on T-fractions (Proposition 2.2). With this identity in mind, one can view our definition of interval-labeled restricted ternary trees as a deformation of the definition of restricted ternary trees; and we can in fact use Proposition 2.2 to *prove* some of our results on IRTs as corollaries of those for RTs (Section 6.3).

Finally, we pose an open problem:

**Open Problem 1.1** Find a “nice” combinatorial interpretation for the T-fraction with $\alpha$'s given by 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, ... and $\delta$'s given by 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, ...: that is, (1.5) with $x = y = u = v = a = b = c = d = 1$.

**1.2 Outline of this paper**

The remainder of this paper is structured as follows. We begin, in Section 2, by introducing some necessary preliminaries. Then, in Section 3, we state our main results. After that we proceed to the proofs: the preliminaries for the bijective proofs are given in Section 4, and the bijective proofs are presented in Section 5. Also, for some of our less powerful results we have very simple algebraic proofs: these are presented in Section 6. Finally, in Section 7, we will provide some other combinatorial interpretations of
our T-fractions; this section includes a conjecture on the equidistribution of some vincular patterns on permutations (Conjecture 7.7).

This work would not have been possible without the existence of the On-Line Encyclopedia of Integer Sequences [28]. Indeed, we began this project by doing an exhaustive search of the OEIS for sequences with quasi-affine T-fraction coefficients of period 2, as in (1.5); we will explain our procedure and results in Appendix A. In Appendix B we show how the sequences enumerating our families of trees can be obtained in a very simple way using context-free (Chen) grammars. We used these formulae to help guess our families of trees, and also to help check that the sequences obtained from the derivative operators and the T-fractions match.

# 2 Preliminaries

## 2.1 Contraction and transformation formulae

The formulae for even and odd contraction of an S-fraction to an equivalent J-fraction are well known: see e.g. [15, Lemmas 1 and 2] [13, Lemma 1] for very simple algebraic proofs, and see [42, pp. V-31–V-32] for enlightening combinatorial proofs based on grouping pairs of steps in a Dyck path. These formulae have also been extended to suitable subclasses of T-fractions [36] [9, Propositions 2.1 and 2.2]. In this paper we will need only odd contraction [9, Proposition 2.2]:

**Proposition 2.1 (Odd contraction for T-fractions with $\delta_1 = \delta_3 = \delta_5 = \dots = 0$)**

We have

$$ \frac{1}{1 - \frac{\alpha_1 t}{1 - \delta_2 t - \frac{\alpha_2 t}{1 - \frac{\alpha_3 t}{1 - \delta_4 t - \frac{\alpha_4 t}{1 - \dots}}}}} = $$

$$ 1 + \frac{\alpha_1 t}{1 - (\alpha_1 + \alpha_2 + \delta_2)t - \frac{\alpha_2 \alpha_3 t^2}{1 - (\alpha_3 + \alpha_4 + \delta_4)t - \frac{\alpha_4 \alpha_5 t^2}{1 - \dots}}} \quad (2.1) $$

That is, the T-fraction on the left-hand side of (2.1) equals 1 plus $\alpha_1 t$ times the J-fraction with coefficients

$$ \gamma_n = \alpha_{2n+1} + \alpha_{2n+2} + \delta_{2n+2} \quad (2.2a) $$

$$ \beta_n = \alpha_{2n}\alpha_{2n+1} \quad (2.2b) $$

Here (2.1)/(2.2) holds as an identity in $\mathbb{Z}[\alpha, \delta_{\text{even}}][[t]]$, where $\delta_{\text{even}} = (0, \delta_2, 0, \delta_4, \dots)$.

Both the algebraic and the combinatorial proofs of the contraction formulae for S-fractions can be easily generalized [36] to prove the contraction formulae for T-fractions.
Please note that Proposition 2.1 allows the J-fraction on the right-hand side of (2.1) to be converted to a T-fraction on the left-hand side in numerous ways: $\alpha_1$ can be chosen arbitrarily; then each $\beta_n$ can be factored arbitrarily into $\alpha_{2n}$ and $\alpha_{2n+1}$; and then $\delta_{2n+2}$ is defined by (2.2a). Of course, some of the resulting T-fractions may have coefficients $\delta$ that are “nice” in one sense or another, while others will not.

We now prove a useful transformation formula for T-fractions:

**Proposition 2.2 (T-fraction with no odd delta to generic T-fraction)**

$$ \frac{1/(1 - \delta_1 t)}{1 - \frac{\alpha_1 t/(1 - \delta_1 t)}{1 - \delta_2 t - \frac{\alpha_2 t/(1 - \delta_3 t)}{1 - \frac{\alpha_3 t/(1 - \delta_4 t - \dots}{1 - \delta_4 t - \dots}}} } = \frac{1}{1 - \delta_1 t - \frac{\alpha_1 t}{1 - \delta_2 t - \frac{\alpha_2 t}{1 - \delta_3 t - \frac{\alpha_3 t}{1 - \dots}}} } \quad (2.3) $$

**PROOF.** This is obtained by repeated use of the identity

$$ \frac{1/f(t)}{1 - g(t)/f(t)} = \frac{1}{f(t) - g(t)} \quad (2.4) $$

at alternate levels of the left-hand side of (2.3), with $f(t) = 1 - \delta_1 t, 1 - \delta_3 t, \dots$ $\square$

Let $T(t; \alpha, \delta)$ denote the T-fraction (1.1). Also, let $\delta_{\text{even}} = \delta|_{\delta_{2k-1}=0}$, i.e., $\delta_{\text{even}}$ denotes the sequence $\delta$ with all odd-order $\delta_i$ set to 0. Then, Proposition 2.2 is equivalent to the following:

$$ \frac{1}{1 - \delta_1 t} T \left( t; \alpha |_{\alpha_{2k-1} \mapsto \frac{\alpha_{2k-1}}{1 - \delta_{2k-1} t}, \alpha_{2k} \mapsto \frac{\alpha_{2k}}{1 - \delta_{2k+1} t}}, \delta_{\text{even}} \right) = T(t; \alpha, \delta) . \quad (2.5) $$

This identity gives us a recipe to start from a T-fraction with $\delta_i$ only at even orders and then insert $\delta_i$ at odd orders as well. This is what motivated our construction of increasing interval-labeled restricted ternary trees. At the end of Section 4.1 we will also give a combinatorial interpretation/proof of Proposition 2.2.

## 2.2 Types of labeled trees

In this paper, all trees are rooted and finite; we henceforth omit these two adjectives. A *labeled tree* with vertex set $V$ is a tree in which each vertex is assigned a *distinct* label from $V$, such that each element of $V$ is the label for some vertex of the tree (hence for exactly one vertex). A *multilabeled tree* with label set $\mathcal{L}$ is a tree in which each vertex $v$ is assigned a nonempty label set $L_v \subseteq \mathcal{L}$, such that each label $i \in \mathcal{L}$ belongs to exactly one of the sets $L_v$. Specific types of multilabeled trees arise by restricting the subsets of $\mathcal{L}$ that are allowed to be vertex label sets $L_v$. For instance, in *k-labeled trees* [27, Section 2.6], all vertex label sets $L_v$ must have cardinality $k$; in *interval-labeled trees*, the label set $\mathcal{L}$ is some set of integers (usually an interval), and all vertex label sets $L_v$ must be intervals.

A labeled tree on a partially ordered vertex set $V$ is called *increasing* if the label of a child is always greater than the label of its parent. In most applications the vertex set is totally ordered: this is the case for ordinary (unilabeled) increasing trees, in which
the vertex set is some set of integers (ordinarily either $[n]$ or $[0, n]$) and each vertex has a single integer label. However, for multilabeled trees the vertex set $V$ is some collection of nonempty subsets of the label set $\mathcal{L}$, equipped with the partial order $A < B \Leftrightarrow \max A < \min B$. We remark that although the set of all intervals in $[0, n]$ fails to be totally ordered when $n \ge 2$, the set of intervals occurring as vertex labels for a given interval-labeled restricted ternary tree (which is, by definition, the vertex set of that tree) forms an interval-partition of $[0, n]$ and hence is totally ordered.

## 2.3 Tree statistics: Node types and label surplus

We will use the notion of node types for $k$-ary trees, as introduced by Kuba and Varvak [27]. Let $T$ be a $k$-ary rooted tree, and let $V(T)$ be its vertex set. For $v \in V(T)$, we define the **node type** of $v$ to be the string $N(v, T) \stackrel{\text{def}}{=} n_{v,1} \cdots n_{v,k} \in \{0, 1\}^k$ where $n_{v,j} = 1$ if the $j$-th child of the vertex $v$ exists, and 0 if it does not. Let us mention the possible node types in some families of trees:

* The possible node types in binary trees are 00, 01, 10, 11.

* The possible node types in ternary trees are 000, 001, 010, 100, 011, 101, 110, 111.

* The possible node types in restricted ternary trees are 000, 100, 010, 001, 101.

For a string $s \in \{0, 1\}^k$ with $k \ge 1$, we define $I_T(s)$ to be

$$I_T(s) \stackrel{\text{def}}{=} \#\{v: v \in V(T) \text{ and } N(v, T) = s\}. \qquad (2.6)$$

Thus, $I_T(s)$ counts the number of vertices in the tree $T$ with node type $s$.

In some cases we will want to give weights only to non-root vertices. We therefore define also

$$I'_T(s) \stackrel{\text{def}}{=} \#\{v: v \in V(T) \setminus \text{root and } N(v, T) = s\}, \qquad (2.7)$$

so that $I'_T(s)$ counts the number of non-root vertices in the tree $T$ with node type $s$.

In this paper we also study some $k$-ary trees in which the vertices are allowed to have multiple labels. For this reason, given a multilabeled $k$-ary tree, we also introduce $I_T(\varepsilon)$ (here $\varepsilon$ is the empty string) to denote

$$I_T(\varepsilon) \stackrel{\text{def}}{=} \#\{i: i \text{ is a label in } T\} - \#\{v: v \text{ is a vertex in } T\}. \qquad (2.8)$$

We call the quantity $I_T(\varepsilon)$ the **label surplus of the tree $T$**. Using $L_v$ to denote the label set of the vertex $v$, we have equivalently

$$I_{\varepsilon}(T) = \sum_{v \in V(T)} (|L_v| - 1) \qquad (2.9)$$

(since the label sets $L_v$ are disjoint). We therefore call the quantity $|L_v| - 1$ the **label surplus of the vertex $v$**.
## 2.4 Tree statistics: Crossings and nestings

We now introduce some new statistics on trees. Similar statistics were used implicitly in [27, 31, 32] and will be used explicitly in [37].

Let $T$ be an increasing tree on a totally ordered vertex set $V$. (This includes the case of increasing interval-labeled trees, for which the vertex set is a totally ordered set of intervals in $[0, n]$.) Let $v_0, v_1, \dots, v_m$ be the vertices of $T$ in this total order (here $v_0$ must be the root, $v_1$ must be a child of the root, and $v_m$ must be a leaf). For any non-root vertex $v$, we denote by $p(v)$ the parent of $v$ in $T$; if $v$ is the root, then $p(v)$ is undefined. We then define the **level** of a vertex $v$ as

$$ \mathrm{lev}(v, T) \stackrel{\mathrm{def}}{=} \#\{w: p(w) < v < w\}. \qquad (2.10) $$

It is clear that $\mathrm{lev}(v_0, T) = \mathrm{lev}(v_m, T) = 0$. Note also that when $v = v_1$, which is a child of the root, any $w$ contributing in (2.10) must be another child of the root; so if the root has only one child — as is the case for our increasing interval-labeled restricted ternary trees — then $\mathrm{lev}(v_1, T) = 0$.

Now suppose further that the children of each vertex are linearly ordered. (This is certainly the case for $k$-ary trees, which include binary, ternary and restricted ternary trees as special cases.) We use this linear order to introduce two new statistics: *croix* and *nid* (the French words for crossings and nestings, respectively). However, to introduce these, we need to choose first a **tree-traversal algorithm A**: by this we mean a mapping from triplets $(T, V, <)$ of increasing ordered trees $T$ on a totally ordered vertex set $(V, <)$ to new total orders $<_{\mathbf{A}}$ on $V$, that satisfies the following **consistency property**:

For any $j \in V$, define $V|_j = \{k \in V: k \le j\}$. Then for every tree $T$ on $V$ and every $j \in V$, the total order $<_{\mathbf{A}}$ on $T$ restricted to $V|_j$ is the same as the total order $<_{\mathbf{A}}$ on the tree $T \upharpoonright V|_j$.

In other words, the vertices of $T \upharpoonright V|_j$ are traversed in the same relative order as they are traversed in $T$. Some examples of consistent tree-traversal algorithms are:

* **Preorder traversal.** First the root, then the children in order, all implemented recursively.

* **Postorder traversal.** The children in order, then the root, all implemented recursively.

* **Inorder (= symmetric) traversal for binary trees** [39, pp. 44–45]. The left child if any, then the root, then the right child if any, all implemented recursively.<fnref n="3" />

Now choose a consistent tree-traversal algorithm $\mathbf{A}$. We refine the definition (2.10) of level as follows. Consider a pair of vertices $v, w$ in the tree $T$ that satisfy $p(w) < v < w$. We say that they form a

* croix if $v <_{\mathbf{A}} w$,

<footnote n="3">³Inorder traversal can be generalized in a variety of ways to non-binary ordered trees. For instance, fix your favorite integer $c \ge 0$; traverse the first $c$ children (or all of the children if there are fewer than $c$ of them), then the root, then the remaining children, implemented recursively. Or alternatively: traverse all but the last $c$ children (if there are more than $c$ of them), then the root, then the last $c$ children (or all of the children if there are fewer than $c$ of them), implemented recursively.</footnote>
• nid if $w <_A v$.

We then define the **index-refined crossing and nestings statistics**

$$ \text{croix}_{\mathbf{A}}(v, T) = \{w: p(w) < v < w \text{ and } v <_{\mathbf{A}} w\} \quad (2.11a) $$

$$ \text{nid}_{\mathbf{A}}(v, T) = \{w: p(w) < v < w \text{ and } w <_{\mathbf{A}} v\} \quad (2.11b) $$

It is clear from definitions (2.10)/(2.11) that

$$ \text{lev}(v, T) = \text{croix}_{\mathbf{A}}(v, T) + \text{nid}_{\mathbf{A}}(v, T). \quad (2.12) $$

In the remainder of this paper we will lighten the notation by deleting the subscript **A** from croix and nid, but we stress that meaning of croix and nid *depends on the choice of tree-traversal algorithm*. Nevertheless, the resulting “master” continued fractions will be identical for all consistent tree-traversal algorithms. Therefore, we will have proven that the families $(\text{croix}_{\mathbf{A}}, \text{nid}_{\mathbf{A}})$ and $(\text{croix}_{\mathbf{A}'}, \text{nid}_{\mathbf{A}'})$ are *equidistributed*, for any pair of consistent tree-traversal algorithms **A** and **A'**.

**Example 2.3** Let $T$ be the increasing binary tree shown in Figure 1. It has three vertices of node type 00, two vertices of node type 11, two vertices of node type 10, and one vertex of node type 01.

Let **A** be the inorder traversal. The vertices are traversed as follows: $5 <_{\mathbf{A}} 7 <_{\mathbf{A}} 3 <_{\mathbf{A}} 1 <_{\mathbf{A}} 6 <_{\mathbf{A}} 2 <_{\mathbf{A}} 8 <_{\mathbf{A}} 4$.

We now note down the node type $N(v, T)$ and the statistics $\text{lev}(v, T)$, $\text{nid}_{\mathbf{A}}(v, T)$ and $\text{croix}_{\mathbf{A}}(v, T)$:

$$ \begin{array}{c|c|c|c|c} v & N(v, T) & \text{lev}(v, T) & \text{nid}(v, T) & \text{croix}(v, T) \\ \hline 1 & 11 & 0 & 0 & 0 \\ 2 & 11 & 1 & 1 & 0 \\ 3 & 10 & 2 & 0 & 2 \\ 4 & 10 & 2 & 2 & 0 \\ 5 & 01 & 2 & 0 & 2 \\ 6 & 00 & 2 & 1 & 1 \\ 7 & 00 & 1 & 0 & 1 \\ 8 & 00 & 0 & 0 & 0 \end{array} \quad (2.13) $$

<figure><img src="image_15.png" /></figure>

**Example 2.4** Let $T$ be the IRT shown in Figure 4. The total order on the vertices is $\{0, 1\} <_{\mathbf{A}} \{2, 3\} <_{\mathbf{A}} \{4\} <_{\mathbf{A}} \{5\} <_{\mathbf{A}} \{6\} <_{\mathbf{A}} \{7\} <_{\mathbf{A}} \{8\} <_{\mathbf{A}} \{9\} <_{\mathbf{A}} \{10\} <_{\mathbf{A}} \{11\} <_{\mathbf{A}} \{12, 13\} <_{\mathbf{A}} \{14, 15\} <_{\mathbf{A}} \{16\}$. There are three vertices of node type 000, two vertices each of node types 101, 100, 001, and four vertices of node type 010.

Let **A** be the preorder traversal. The vertices as traversed as follows: $\{0, 1\} <_{\mathbf{A}} \{2, 3\} <_{\mathbf{A}} \{4\} <_{\mathbf{A}} \{8\} <_{\mathbf{A}} \{9\} <_{\mathbf{A}} \{14, 15\} <_{\mathbf{A}} \{5\} <_{\mathbf{A}} \{7\} <_{\mathbf{A}} \{10\} <_{\mathbf{A}} \{6\} <_{\mathbf{A}} \{11\} <_{\mathbf{A}} \{12, 13\} <_{\mathbf{A}} \{16\}$.

Next let $\mathbf{A}'$ be the following traversal order: the left child if any, then the root, then the middle child if any, and then the right child if any, all implemented recursively. As per this order, the vertices are traversed as follows: $\{8\} <_{\mathbf{A}'} \{9\} <_{\mathbf{A}'} \{14, 15\} <_{\mathbf{A}'} \{4\} <_{\mathbf{A}'} \{2, 3\} <_{\mathbf{A}'} \{7\} <_{\mathbf{A}'} \{10\} <_{\mathbf{A}'} \{5\} <_{\mathbf{A}'} \{6\} <_{\mathbf{A}'} \{11\} <_{\mathbf{A}'} \{12, 13\} <_{\mathbf{A}'} \{16\} <_{\mathbf{A}'} \{0, 1\}$.
We now note down the node type $N(v, T)$ and the statistics $\text{lev}(v, T)$, $\text{nid}_A(v, T)$ and $\text{croix}_A(v, T)$, $\text{nid}_{A'}(v, T)$ and $\text{croix}_{A'}(v, T)$:

<table><thead><tr><th>v</th><th>N(v, T)</th><th>lev(v, T)</th><th>nid<sub>A</sub>(v, T)</th><th>croix<sub>A</sub>(v, T)</th><th>nid<sub>A'</sub>(v, T)</th><th>croix<sub>A'</sub>(v, T)</th></tr></thead><tbody><tr><td>{0,1}</td><td>100</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr><tr><td>{2,3}</td><td>101</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr><tr><td>{4}</td><td>100</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td></tr><tr><td>{5}</td><td>101</td><td>1</td><td>1</td><td>0</td><td>1</td><td>0</td></tr><tr><td>{6}</td><td>010</td><td>2</td><td>2</td><td>0</td><td>2</td><td>0</td></tr><tr><td>{7}</td><td>010</td><td>2</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>{8}</td><td>001</td><td>2</td><td>0</td><td>2</td><td>0</td><td>2</td></tr><tr><td>{9}</td><td>010</td><td>2</td><td>0</td><td>2</td><td>0</td><td>2</td></tr><tr><td>{10}</td><td>000</td><td>2</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>{11}</td><td>010</td><td>1</td><td>1</td><td>0</td><td>1</td><td>0</td></tr><tr><td>{12,13}</td><td>001</td><td>1</td><td>1</td><td>0</td><td>1</td><td>0</td></tr><tr><td>{14,15}</td><td>000</td><td>1</td><td>0</td><td>1</td><td>0</td><td>1</td></tr><tr><td>{16}</td><td>000</td><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr></tbody></table>

<figure><img src="image_16.png" /></figure>

# 3 Statement of results

All our continued fractions will come in two levels of generality: “simple” continued fractions, with finitely many indeterminates that count node types and label surplus [cf. (2.6)/(2.8)]; and then “master” continued fractions, with infinitely many indeterminates that count the pair (croix, nid) at each vertex [cf. (2.11)].

For pedagogical clarity, we begin by presenting these continued fractions for increasing binary trees; some (but not all) of these formulae are well known and go back to Flajolet [19]. After this, we present our new results in increasing order of generality: first increasing restricted ternary trees, and then increasing interval-labeled restricted ternary trees.

## 3.1 Increasing binary trees

Let $B_n$ denote the set of increasing binary trees on the vertex set $[n]$. It is well known that this set has cardinality $|B_n| = n!$: see e.g. [39, pp. 44–45] for a bijective proof. Here we define some polynomials that refine this counting, and provide continued fractions for their ordinary generating functions.

### 3.1.1 Simple J-fraction and T-fraction

Consider first the polynomial in four variables that enumerates increasing binary trees according to the node types: for $n \ge 0$, we define

$$P_n(x_1, x_2, y_1, y_2) \stackrel{\text{def}}{=} \sum_{T \in \mathcal{B}_n} x_1^{I_T(11)} y_1^{I_T(00)} x_2^{I_T(10)} y_2^{I_T(01)}, \quad (3.1)$$

where we recall that $I_T(s)$ for a string $s$ was defined in (2.6) as the number of vertices with node type $s$. Thus, the variables $x_1, y_1, x_2, y_2$ are associated to the node types 11,
00, 10, 01, respectively. In particular, we have $x_1$ or $x_2$ when a vertex has a left child, and $y_1$ or $y_2$ when it does not; we have a subscript 1 (resp. 2) when the vertex has even (resp. odd) out-degree. By convention $P_0 = 1$ (corresponding to the empty tree); for $n \ge 1$, the polynomial $P_n$ always has a factor $y_1$ since the vertex $n$ is always a leaf.

The polynomials (3.1) have the following beautiful J-fraction, which is essentially [19, Theorem 3A] restated in terms of increasing binary trees using the correspondence in [39, pp. 44–45]:

**Theorem 3.1 ([19, Theorem 3A]+[39, pp. 44–45])** *The ordinary generating function of the polynomials $P_{n+1}(x_1, x_2, y_1, y_2)$ has the J-fraction*

$$ \sum_{n=0}^{\infty} P_{n+1}(x_1, x_2, y_1, y_2) t^n = \frac{y_1}{1 - (x_2 + y_2)t - \frac{2x_1y_1t^2}{1 - 2(x_2 + y_2)t - \frac{6x_1y_1t^2}{1 - \dots}}} \quad (3.2) $$

with coefficients

$$ \gamma_n = (n+1)(x_2+y_2), \quad \beta_n = n(n+1)x_1y_1. \quad (3.3) $$

When $x_1 = x_2 = y_1 = y_2 = 1$, this is a J-fraction for the sequence $((n+1)!)_{n \ge 0}$. It arises by even contraction of the S-fraction with $\alpha_{2k-1} = k+1$, $\alpha_{2k} = k$.

We now obtain a T-fraction from Theorem 3.1 by using odd contraction (Proposition 2.1):

**Theorem 3.2** *The ordinary generating function of the polynomials $P_n(x_1, x_2, y_1, y_2)$ has the T-fraction*

$$ \sum_{n=0}^{\infty} P_n(x_1, x_2, y_1, y_2) t^n = \frac{1}{1 - \frac{y_1 t}{1 - (x_2 + y_2 - x_1 - y_1)t - \frac{x_1 t}{1 - \frac{2y_1 t}{1 - 2(x_2 + y_2 - x_1 - y_1)t - \frac{2x_1 t}{1 - \dots}}}}} \quad (3.4) $$

with coefficients

$$ \alpha_{2k-1} = k y_1 \quad (3.5a) $$

$$ \alpha_{2k} = k x_1 \quad (3.5b) $$

$$ \delta_{2k-1} = 0 \quad (3.5c) $$

$$ \delta_{2k} = k(x_2 + y_2 - x_1 - y_1) \quad (3.5d) $$

If we now choose some specialization of $x_1, x_2, y_1, y_2$ that satisfies $x_1 + y_1 = x_2 + y_2$, then from (3.5d) we get $\delta_{2k} = 0$, so that the T-fraction (3.4) becomes an S-fraction. In particular this happens if we take $x_1 = x_2$ and $y_1 = y_2$, or alternatively if we take $x_1 = y_2$ and $y_1 = x_2$ (among many other possibilities). Let us show the first of these:
**Corollary 3.3** The ordinary generating function of the polynomials (3.16) under the substitutions $x_1 = x_2 = x$ and $y_1 = y_2 = y$ has the S-fraction

$$ \sum_{n=0}^{\infty} P_n(x, x, y, y) t^n = \frac{1}{1 - \frac{yt}{1 - \frac{xt}{1 - \frac{2yt}{1 - \frac{2xt}{1 - \frac{3yt}{1 - \dots}}}}} \quad (3.6) $$

with coefficients

$$ \alpha_{2k-1} = ky, \quad \alpha_{2k} = kx. \quad (3.7) $$

This is the S-fraction for the homogenized Eulerian polynomials [34, section 79] [38, Section 2.2]. When $x = y = 1$, it gives Euler's [18, section 21] S-fraction for the sequence $(n!)_{n \ge 0}$.

### 3.1.2 Master J-fraction and T-fraction

Fix a consistent tree-traversal algorithm **A**. Now let $\mathbf{a} = (\mathbf{a}_{\ell, \ell'})_{\ell, \ell' \ge 0}$, $\mathbf{b} = (\mathbf{b}_{\ell, \ell'})_{\ell, \ell' \ge 0}$, $\mathbf{c} = (\mathbf{c}_{\ell, \ell'})_{\ell, \ell' \ge 0}$, $\mathbf{d} = (\mathbf{d}_{\ell, \ell'})_{\ell, \ell' \ge 0}$ be infinite sets of indeterminates, and define polynomials $Q_n(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d})$ by

$$ Q_n(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d}) \stackrel{\text{def}}{=} \sum_{T \in \mathcal{B}_n} \prod_{N(v,T)=11} \mathbf{a}_{\text{croix}(v,T), \text{nid}(v,T)} \prod_{N(v,T)=00} \mathbf{b}_{\text{croix}(v,T), \text{nid}(v,T)} \times \prod_{N(v,T)=10} \mathbf{c}_{\text{croix}(v,T), \text{nid}(v,T)} \prod_{N(v,T)=01} \mathbf{d}_{\text{croix}(v,T), \text{nid}(v,T)}. \quad (3.8) $$

Since the vertex $n$ is always a leaf, the polynomials (3.8) have a common factor $\mathbf{b}_{00}$ when $n \ge 1$.

We have the following master J-fraction, which is implicit in [19] when the tree-traversal algorithm is taken to be inorder (= symmetric) traversal; but we write it out explicitly and allow *any* consistent tree-traversal algorithm.

**Theorem 3.4** The ordinary generating function of the polynomials $Q_{n+1}(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d})$ has the J-fraction

$$ \sum_{n=0}^{\infty} Q_{n+1}(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d}) t^n = \frac{\mathbf{b}_{00}}{1 - (\mathbf{c}_{00} + \mathbf{d}_{00}) t - \frac{\mathbf{a}_{00}(\mathbf{b}_{01} + \mathbf{b}_{10}) t^2}{1 - (\mathbf{c}_{01} + \mathbf{c}_{10} + \mathbf{d}_{01} + \mathbf{d}_{10}) t - \frac{(\mathbf{a}_{01} + \mathbf{a}_{10})(\mathbf{b}_{02} + \mathbf{b}_{11} + \mathbf{b}_{20}) t^2}{1 - \dots}} \quad (3.9) $$
with coefficients

$$ \beta_n = \left( \sum_{\xi=0}^{n-1} \mathbf{a}_{\xi, n-1-\xi} \right) \left( \sum_{\xi=0}^{n} \mathbf{b}_{\xi, n-\xi} \right) \qquad (3.10a) $$

$$ \gamma_n = \sum_{\xi=0}^{n} \mathbf{c}_{\xi, n-\xi} + \sum_{\xi=0}^{n} \mathbf{d}_{\xi, n-\xi} \qquad (3.10b) $$

Here we will derive Theorem 3.4 as a special case of Theorem 3.11.

We can now obtain a T-fraction from Theorem 3.4 by using odd contraction (Proposition 2.1):

**Theorem 3.5** The ordinary generating function of the polynomials $Q_n(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d})$ has the T-fraction

$$ \sum_{n=0}^{\infty} Q_n(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d}) t^n = \frac{1}{1 - (c_{00} + d_{00} - a_{00} - b_{00}) t - \frac{a_{00} t}{1 - \frac{(b_{01} + b_{10}) t}{1 - (c_{01} + c_{10} + d_{01} + d_{10} - a_{01} - a_{10} - b_{01} - b_{10}) t - \frac{(a_{01} + a_{10}) t}{1 - \dots}}} \qquad (3.11) $$

with coefficients

$$ \alpha_{2k-1} = \sum_{\xi=0}^{k-1} \mathbf{b}_{\xi, k-1-\xi} \qquad (3.12a) $$

$$ \alpha_{2k} = \sum_{\xi=0}^{k-1} \mathbf{a}_{\xi, k-1-\xi} \qquad (3.12b) $$

$$ \delta_{2k-1} = 0 \qquad (3.12c) $$

$$ \delta_{2k} = \sum_{\xi=0}^{k-1} \mathbf{c}_{\xi, k-1-\xi} + \sum_{\xi=0}^{k-1} \mathbf{d}_{\xi, k-1-\xi} - \sum_{\xi=0}^{k-1} \mathbf{a}_{\xi, k-1-\xi} - \sum_{\xi=0}^{k-1} \mathbf{b}_{\xi, k-1-\xi} \qquad (3.12d) $$

If we now choose some specialization of the variables $\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d}$ that satisfies

$$ \sum_{\xi=0}^{k-1} \mathbf{a}_{\xi, k-1-\xi} + \sum_{\xi=0}^{k-1} \mathbf{b}_{\xi, k-1-\xi} = \sum_{\xi=0}^{k-1} \mathbf{c}_{\xi, k-1-\xi} + \sum_{\xi=0}^{k-1} \mathbf{d}_{\xi, k-1-\xi}, \qquad (3.13) $$

then obviously the weights (3.12c,d) become $\delta = 0$, so that we have an S-fraction. There are many ways that this can be done, but the simplest is to take $\mathbf{c} = \mathbf{a}$ and $\mathbf{d} = \mathbf{b}$: that is, we just consider the status of the left child and ignore the status of the right child. We then have:
**Corollary 3.6** The ordinary generating function of the polynomials $Q_n(\mathbf{a}, \mathbf{b}, \mathbf{a}, \mathbf{b})$ has the S-fraction

$$ \sum_{n=0}^{\infty} Q_n(\mathbf{a}, \mathbf{b}, \mathbf{a}, \mathbf{b}) t^n = \frac{1}{1 - \frac{\mathbf{b}_{00} t}{1 - \frac{\mathbf{a}_{00} t}{1 - \frac{(\mathbf{b}_{01} + \mathbf{b}_{10}) t}{1 - \frac{(\mathbf{a}_{01} + \mathbf{a}_{10}) t}{1 - \dots}}}}} \quad (3.14) $$

with coefficients

$$ \alpha_{2k-1} = \sum_{\xi=0}^{k-1} \mathbf{b}_{\xi,k-1-\xi} \quad (3.15a) $$

$$ \alpha_{2k} = \sum_{\xi=0}^{k-1} \mathbf{a}_{\xi,k-1-\xi} \quad (3.15b) $$

## 3.2 Increasing restricted ternary trees

We now generalize the results of the preceding subsection from increasing binary trees to increasing restricted ternary trees. We write $RT_n$ for the set of increasing restricted ternary trees on the vertex set $[n]$.

### 3.2.1 Simple J-fraction and T-fraction

We first introduce a polynomial in five variables that enumerates increasing restricted ternary trees according to the node types: for $n \ge 0$, we define

$$ P_n(x_1, x_2, y_1, y_2, w) \stackrel{\text{def}}{=} \sum_{T \in \mathcal{RT}_n} x_1^{I_T(101)} y_1^{I_T(000)} x_2^{I_T(100)} y_2^{I_T(001)} w^{I_T(010)}. \quad (3.16) $$

Thus, the variables $x_1, y_1, x_2, y_2, w$ are associated to the node types 101, 000, 100, 001, 010, respectively. In particular, for vertices without a middle child we have $x_1$ or $x_2$ when a vertex has a left child, and $y_1$ or $y_2$ when it does not; we have a subscript 1 (resp. 2) when the vertex has even (resp. odd) out-degree; and finally, we have $w$ for a vertex with a middle child. By convention $P_0 = 1$ (corresponding to the empty tree); for $n \ge 1$, the polynomial $P_n$ always has a factor $y_1$ since the vertex $n$ is always a leaf. When $w = 0$, (3.16) reduces to (3.1).

The polynomials (3.16) have a beautiful J-fraction:

**Theorem 3.7** The ordinary generating function of the polynomials $P_{n+1}(x_1, x_2, y_1, y_2, w)$ has the J-fraction

$$ \sum_{n=0}^{\infty} P_{n+1}(x_1, x_2, y_1, y_2, w) t^n = \frac{y_1}{1 - (x_2 + y_2 + w)t - \frac{2x_1y_1t^2}{1 - 2(x_2 + y_2 + w)t - \frac{6x_1y_1t^2}{1 - \dots}}} \quad (3.17) $$

with coefficients

$$ \gamma_n = (n+1)(x_2+y_2+w), \quad \beta_n = n(n+1)x_1y_1. \quad (3.18) $$
We will prove Theorem 3.7 in Section 5.1, as a special case of the more general “master” J-fraction; we will also give a very simple alternate proof in Section 6. Specializing Theorem 3.7 to $w = 0$ yields Theorem 3.1.

Specializing Theorem 3.7 to $x_1 = x_2 = y_1 = y_2 = w = 1$, we deduce that the sequence of cardinalities $(|RT_{n+1}|)_{n \ge 0}$ has a nice J-fraction:

**Corollary 3.8** The ordinary generating function of the sequence $(|RT_{n+1}|)_{n \ge 0}$ has the J-fraction

$$ \sum_{n=0}^{\infty} |RT_{n+1}| t^n = \frac{1}{1 - 3t - \frac{2t^2}{1 - 6t - \frac{6t}{1 - 9t - \frac{12t^2}{1 - \dots}}}} \quad (3.19) $$

with coefficients

$$ \gamma_n = 3(n+1), \quad \beta_n = n(n+1). \quad (3.20) $$

We now obtain a T-fraction from Theorem 3.7 by using odd contraction (Proposition 2.1):

**Theorem 3.9** The ordinary generating function of the polynomials $P_n(x_1, x_2, y_1, y_2, w)$ has the T-fraction

$$ \sum_{n=0}^{\infty} P_n(x_1, x_2, y_1, y_2, w) t^n = \frac{1}{1 - \frac{y_1 t}{1 - (x_2 + y_2 + w - x_1 - y_1)t - \frac{x_1 t}{1 - \frac{2y_1 t}{1 - 2(x_2 + y_2 + w - x_1 - y_1)t - \frac{2x_1 t}{1 - \dots}}}}} \quad (3.21) $$

with coefficients

$$ \alpha_{2k-1} = ky_1 \quad (3.22a) $$

$$ \alpha_{2k} = kx_1 \quad (3.22b) $$

$$ \delta_{2k-1} = 0 \quad (3.22c) $$

$$ \delta_{2k} = k(x_2 + y_2 + w - x_1 - y_1) \quad (3.22d) $$

Indeed, it is straightforward to check that the weights (3.18) and (3.22) satisfy (2.2). Specializing Theorem 3.9 to $w = 0$ yields Theorem 3.2.

If we now choose some specialization of $x_1, x_2, y_1, y_2$ that satisfies $x_1+y_1 = x_2+y_2$, then the weight (3.22d) simplifies to $\delta_{2k} = kw$. In particular, when $x_1 = x_2 = y_1 = y_2 = w = 1$, we obtain:
**Corollary 3.10** The ordinary generating function of the sequence ($|RT_n|$)$_{n \ge 0}$ has the T-fraction

$$ \sum_{n=0}^{\infty} |RT_n| t^n = \frac{1}{1 - \frac{t}{1 - t - \frac{2t}{1 - 2t - \frac{3t}{1 - 3t - \frac{3t}{1 - \dots}}}}} \quad (3.23) $$

with coefficients

$$ \alpha_{2k-1} = \alpha_{2k} = k, \quad \delta_{2k-1} = 0, \quad \delta_{2k} = k. \quad (3.24) $$

This is the sequence (1.9) [28, A230008].

### 3.2.2 Master J-fraction and T-fraction

Fix a consistent tree-traversal algorithm **A**. Now let $\mathbf{a} = (\mathbf{a}_{\ell, \ell'})_{\ell, \ell' \ge 0}$, $\mathbf{b} = (\mathbf{b}_{\ell, \ell'})_{\ell, \ell' \ge 0}$, $\mathbf{c} = (\mathbf{c}_{\ell, \ell'})_{\ell, \ell' \ge 0}$, $\mathbf{d} = (\mathbf{d}_{\ell, \ell'})_{\ell, \ell' \ge 0}$, $\mathbf{f} = (\mathbf{f}_{\ell, \ell'})_{\ell, \ell' \ge 0}$ be infinite sets of indeterminates, and define polynomials $Q_n(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d}, \mathbf{f})$ by

$$ Q_n(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d}, \mathbf{f}) = \sum_{T \in \mathcal{RT}_n} \prod_{N(v,T)=101} \mathbf{a}_{\text{croix}(v,T), \text{nid}(v,T)} \prod_{N(v,T)=000} \mathbf{b}_{\text{croix}(v,T), \text{nid}(v,T)} \times \\ \prod_{N(v,T)=100} \mathbf{c}_{\text{croix}(v,T), \text{nid}(v,T)} \prod_{N(v,T)=001} \mathbf{d}_{\text{croix}(v,T), \text{nid}(v,T)} \times \\ \prod_{N(v,T)=010} \mathbf{f}_{\text{croix}(v,T), \text{nid}(v,T)}. \quad (3.25) $$

Of course $P_0 = 1$; for $n \ge 1$, the polynomial $Q_n$ always has a factor $\mathbf{b}_{00}$ since the vertex $n$ is always a leaf.

We have the following master J-fraction:

**Theorem 3.11** The ordinary generating function of the polynomials $Q_{n+1}(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d}, \mathbf{f})$ has the J-fraction

$$ \sum_{n=0}^{\infty} Q_{n+1}(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d}, \mathbf{f}) t^n = \frac{\mathbf{b}_{00}}{1 - (\mathbf{c}_{00} + \mathbf{d}_{00} + \mathbf{f}_{00}) t - \frac{\mathbf{a}_{00}(\mathbf{b}_{01} + \mathbf{b}_{10}) t^2}{1 - (\mathbf{c}_{01} + \mathbf{c}_{10} + \mathbf{d}_{01} + \mathbf{d}_{10} + \mathbf{f}_{01} + \mathbf{f}_{10}) t - \frac{(\mathbf{a}_{01} + \mathbf{a}_{10})(\mathbf{b}_{02} + \mathbf{b}_{11} + \mathbf{b}_{20}) t^2}{1 - \dots}}} \quad (3.26) $$

where the coefficients are defined as follows:

$$ \beta_n = \left( \sum_{\xi=0}^{n-1} \mathbf{a}_{\xi, n-1-\xi} \right) \left( \sum_{\xi=0}^{n} \mathbf{b}_{\xi, n-\xi} \right) \quad (3.27a) $$

$$ \gamma_n = \sum_{\xi=0}^{n} \mathbf{c}_{\xi, n-\xi} + \sum_{\xi=0}^{n} \mathbf{d}_{\xi, n-\xi} + \sum_{\xi=0}^{n} \mathbf{f}_{\xi, n-\xi} \quad (3.27b) $$
We will prove Theorem 3.11 in Section 5.1, by bijection onto a suitable class of labeled Motzkin paths. When $f_{\ell, \ell'} = 0$ for all $\ell, \ell' \ge 0$, this yields Theorem 3.4.

Once again we can obtain a T-fraction by using odd contraction (Proposition 2.1):

**Theorem 3.12** *The ordinary generating function of the polynomials $Q_n(a, b, c, d, f)$ has the T-fraction*

$$ \sum_{n=0}^{\infty} Q_n(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d}, \mathbf{f}) t^n = \\ \begin{array}{r@{\;}c@{\;}l@{\quad}l@{\quad}l} & \multicolumn{1}{@{}c@{}}{1} & \multicolumn{1}{@{}c@{}}{b_{00} t} & & \\ & 1 - (c_{00}+d_{00}+f_{00}-a_{00}-b_{00}) t - & \multicolumn{1}{@{}c@{}}{a_{00} t} & & \\ & 1 - (c_{01}+c_{10}+d_{01}+d_{10}+f_{01}+f_{10}-a_{01}-a_{10}-b_{01}-b_{10}) t - & \multicolumn{1}{@{}c@{}}{(b_{01}+b_{10}) t} & & \\ & & 1 - \frac{1 - (c_{01}+c_{10}+d_{01}+d_{10}+f_{01}+f_{10}-a_{01}-a_{10}-b_{01}-b_{10}) t - \frac{(a_{01}+a_{10}) t}{1-\dots}}{1-\dots} & & \end{array} \tag{3.28} $$

*with coefficients*

$$ \alpha_{2k-1} = \sum_{\xi=0}^{k-1} b_{\xi,k-1-\xi} \tag{3.29a} $$

$$ \alpha_{2k} = \sum_{\xi=0}^{k-1} a_{\xi,k-1-\xi} \tag{3.29b} $$

$$ \delta_{2k-1} = 0 \tag{3.29c} $$

$$ \delta_{2k} = \sum_{\xi=0}^{k-1} c_{\xi,k-1-\xi} + \sum_{\xi=0}^{k-1} d_{\xi,k-1-\xi} + \sum_{\xi=0}^{k-1} f_{\xi,k-1-\xi} - \sum_{\xi=0}^{k-1} a_{\xi,k-1-\xi} - \sum_{\xi=0}^{k-1} b_{\xi,k-1-\xi} \tag{3.29d} $$

If we now choose some specialization of the variables **a**, **b**, **c**, **d** that satisfies

$$ \sum_{\xi=0}^{k-1} a_{\xi,k-1-\xi} + \sum_{\xi=0}^{k-1} b_{\xi,k-1-\xi} = \sum_{\xi=0}^{k-1} c_{\xi,k-1-\xi} + \sum_{\xi=0}^{k-1} d_{\xi,k-1-\xi}, \tag{3.30} $$

then obviously the weight (3.29d) simplifies to

$$ \delta_{2k} = \sum_{\xi=0}^{k-1} f_{\xi,k-1-\xi}. \tag{3.31} $$

There are many ways that this can be done, but the simplest is to take **c** = **a** and **d** = **b**: that is, if the vertex does not have a middle child, we just consider the status of the left child and ignore the status of the right child. We then have:
**Corollary 3.13** The ordinary generating function of the polynomials $Q_n(\mathbf{a}, \mathbf{b}, \mathbf{a}, \mathbf{b}, \mathbf{f})$ has the T-fraction

$$ \sum_{n=0}^{\infty} Q_n(\mathbf{a}, \mathbf{b}, \mathbf{a}, \mathbf{b}, \mathbf{f}) t^n = \frac{1}{1 - \frac{\mathbf{b}_{00} t}{1 - \mathbf{f}_{00} t - \frac{\mathbf{a}_{00} t}{1 - \frac{(\mathbf{b}_{01} + \mathbf{b}_{10}) t}{1 - (\mathbf{f}_{01} + \mathbf{f}_{10}) t - \frac{(\mathbf{a}_{01} + \mathbf{a}_{10}) t}{1 - \dots}}}}} \quad (3.32) $$

with coefficients

$$ \alpha_{2k-1} = \sum_{\xi=0}^{k-1} \mathbf{b}_{\xi,k-1-\xi} \quad (3.33a) $$

$$ \alpha_{2k} = \sum_{\xi=0}^{k-1} \mathbf{a}_{\xi,k-1-\xi} \quad (3.33b) $$

$$ \delta_{2k-1} = 0 \quad (3.33c) $$

$$ \delta_{2k} = \sum_{\xi=0}^{k-1} \mathbf{f}_{\xi,k-1-\xi} \quad (3.33d) $$

### 3.2.3 A more general master T-fraction

But there is a more general way than Corollary 3.13 to obtain a T-fraction from the J-fraction of Theorem 3.11, which we introduce now because it foreshadows in simpler form what we will do in Section 3.3.2 for interval-labeled trees. Rather than take $\mathbf{c} = \mathbf{a}$ and $\mathbf{d} = \mathbf{b}$, we introduce indeterminates $\hat{\mathbf{a}} = (\hat{\mathbf{a}}_{\ell,\ell'})_{\ell,\ell' \ge 0}$ and $\hat{\mathbf{b}} = (\hat{\mathbf{b}}_{\ell,\ell'})_{\ell,\ell' \ge 0}$ with two subscripts, and indeterminates $\mu = (\mu_\ell)_{\ell \ge 0}$ and $\nu = (\nu_\ell)_{\ell \ge 0}$ with one subscript, and then specialize the formulae of the preceding subsection to

$$ \mathbf{a}_{\ell, \ell'} = \hat{\mathbf{a}}_{\ell, \ell'} \mu_{\ell+\ell'+1} \quad (3.34a) $$

$$ \mathbf{b}_{\ell, \ell'} = \hat{\mathbf{b}}_{\ell, \ell'} \nu_{\ell+\ell'-1} \quad (3.34b) $$

$$ \mathbf{c}_{\ell, \ell'} = \hat{\mathbf{a}}_{\ell, \ell'} \nu_{\ell+\ell'} \quad (3.34c) $$

$$ \mathbf{d}_{\ell, \ell'} = \hat{\mathbf{b}}_{\ell, \ell'} \mu_{\ell+\ell'} \quad (3.34d) $$

That is, the weights $\hat{\mathbf{a}}$ and $\hat{\mathbf{b}}$ concern the status of the left child, taking full account of both croix and nid; while the weights $\mu$ and $\nu$ concern the status of the right child, but taking account only of lev = croix + nid. Another way of saying this is that we have assigned
vertex weights

$$ \mathrm{wt}(v) = \begin{cases} \hat{\mathbf{a}}_{\mathrm{croix}(v,T),\mathrm{nid}(v,T)} \mu_{\mathrm{lev}(v,T)+1} & \text{if } N(v,T) = 101 \\ \hat{\mathbf{b}}_{\mathrm{croix}(v,T),\mathrm{nid}(v,T)} \nu_{\mathrm{lev}(v,T)-1} & \text{if } N(v,T) = 000 \\ \hat{\mathbf{a}}_{\mathrm{croix}(v,T),\mathrm{nid}(v,T)} \nu_{\mathrm{lev}(v,T)} & \text{if } N(v,T) = 100 \\ \hat{\mathbf{b}}_{\mathrm{croix}(v,T),\mathrm{nid}(v,T)} \mu_{\mathrm{lev}(v,T)} & \text{if } N(v,T) = 001 \\ \hat{\mathbf{f}}_{\mathrm{croix}(v,T),\mathrm{nid}(v,T)} & \text{if } N(v,T) = 010 \end{cases} \qquad (3.35) $$

When $\mu = \nu = 1$, this reduces to the previously considered case $c = a$ and $d = b$. Using the weights (3.35), we then define polynomials $Q_n^*(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{f})$ by

$$ Q_0^*(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{f}) = 1 \qquad (3.36a) $$

$$ Q_n^*(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{f}) = \mu_0 \hat{\mathbf{b}}_{00} \sum_{T \in \mathcal{R}^T} \prod_{v=1}^{n-1} \mathrm{wt}(v) \quad \text{for } n \ge 1 \qquad (3.36b) $$

Note that vertex $n$ is not given a weight; instead we have the prefactor $\mu_0 \hat{\mathbf{b}}_{00}$. Note also that any leaf $v \le n-1$ must have $\mathrm{lev}(v,T) \ge 1$, since the parent of vertex $v+1$ must be $< v$; this means that the subscript on $\nu$ is always $\ge 0$, as it should be.

We then have the following theorem:

**Theorem 3.14** The ordinary generating function of the polynomials $Q_n^*(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{f})$ has the T-fraction

$$ \sum_{n=0}^{\infty} Q_n^*(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{f}) t^n = \frac{1}{1 - \frac{\mu_0 \hat{\mathbf{b}}_{00} t}{1 - \mathbf{f}_{00} t - \frac{\nu_0 \hat{\mathbf{a}}_{00} t}{1 - \frac{\mu_1 (\hat{\mathbf{b}}_{01} + \hat{\mathbf{b}}_{10}) t}{1 - (\mathbf{f}_{01} + \mathbf{f}_{10}) t - \frac{\nu_1 (\hat{\mathbf{a}}_{01} + \hat{\mathbf{a}}_{10}) t}{1 - \dots}}}}} \qquad (3.37) $$

with coefficients

$$ \alpha_{2k-1} = \mu_{k-1} \left( \sum_{\xi=0}^{k-1} \hat{\mathbf{b}}_{\xi,k-1-\xi} \right) \qquad (3.38a) $$

$$ \alpha_{2k} = \nu_{k-1} \left( \sum_{\xi=0}^{k-1} \hat{\mathbf{a}}_{\xi,k-1-\xi} \right) \qquad (3.38b) $$

$$ \delta_{2k-1} = 0 \qquad (3.38c) $$

$$ \delta_{2k} = \sum_{\xi=0}^{k-1} \mathbf{f}_{\xi,k-1-\xi} \qquad (3.38d) $$

When $\mu = \nu = 1$, this reduces to Corollary 3.13.
PROOF OF THEOREM 3.14, ASSUMING THEOREM 3.11. We first define polynomials $\hat{Q}_n(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{f})$ by making the substitutions (3.34) in the polynomials (3.25). Since for $n \ge 1$ this gives the vertex $n$ a weight $\mathbf{b}_{00} = \hat{\mathbf{b}}_{00}\nu_{-1}$, we have

$$Q_n^*(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{f}) = \mu_0 (\nu_{-1})^{-1} \hat{Q}_n(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{f}) \quad \text{for } n \ge 1. \quad (3.39)$$

Now, making the substitutions (3.34) in Theorem 3.11 shows that $\sum_{n=0}^{\infty} \hat{Q}_{n+1}(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{f})$ is given by the J-fraction (3.26) with $\mathbf{b}_{00} = \hat{\mathbf{b}}_{00}\nu_{-1}$. Therefore, $\sum_{n=0}^{\infty} Q_{n+1}^*(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{f})$ is given by the same J-fraction but with the top coefficient $\mathbf{b}_{00}$ replaced by $\mu_0 \hat{\mathbf{b}}_{00}$. Applying odd contraction (Proposition 2.1) to this latter J-fraction, with $\alpha$ and $\delta$ defined by (3.38), proves Theorem 3.14: the key point is that (3.38a) gives $\alpha_1 = \mu_0 \hat{\mathbf{b}}_{00}$. $\square$

We will see in Section 3.3.2 that Theorem 3.14 is a special case of a more general result (Theorem 3.18) for increasing interval-labeled restricted ternary trees (for which we will provide a bijective proof in Section 5.2).

## 3.3 Increasing interval-labeled restricted ternary trees

Finally, we state our results for increasing interval-labeled restricted ternary trees, which are counted by the sequence (1.7). We write $\mathcal{IRT}_n$ for the set of increasing interval-labeled restricted ternary trees on the label set $[0, n]$.

### 3.3.1 Simple T-fraction

We first introduce a polynomial in six variables that enumerates increasing interval-labeled restricted ternary trees on the label set $[0, n]$ according to the node types and the label surplus:

$$P_n(x_1, x_2, y_1, y_2, w, z) \stackrel{\text{def}}{=} \sum_{T \in \mathcal{IRT}_n} x_1^{I'_T(101)} y_1^{I'_T(000)} x_2^{I'_T(100)} y_2^{I'_T(001)} w^{I'_T(010)} z^{I'_T(\varepsilon)}. \quad (3.40)$$

Please note that we are here using the weights $I'_T(s)$ defined in (2.7): that is, we are giving node-type weights only to non-root vertices. (Of course, using $I'_T(s)$ instead of $I_T(s)$ matters only for the node types 000 and 100, since these are the only possible node types for the root in an increasing interval-labeled restricted ternary tree.) As before, $I_T(\varepsilon)$ is the label surplus of the tree $T$, as defined in (2.8)/(2.9). Thus, the variables $x_1, y_1, x_2, y_2, w$ are associated to the node types 101, 000, 100, 001, 010, respectively, while $z$ is associated to the label surplus. Note that $P_n$ is homogeneous of degree $n$ in the six variables $x_1, x_2, y_1, y_2, w, z$.

The polynomials (3.40) do not have a nice J-fraction; and as far as we know they do not have a nice T-fraction either. However, under the two specializations $x_1 = x_2$ and $y_1 = y_2$, they have a beautiful T-fraction:

**Theorem 3.15** The ordinary generating function of the polynomial (3.40) specialized to
$x_1 = x_2 = x$ and $y_1 = y_2 = y$ has the T-fraction

$$
\begin{align}
& \sum_{n=0}^{\infty} P_n(x, x, y, y, w, z) t^n \nonumber \\
& = \frac{1}{1 - zt - \frac{yt}{1 - wt - \frac{xt}{1 - zt - \frac{2yt}{1 - 2wt - \frac{2xt}{1 - zt - \frac{3yt}{1 - 3wt - \frac{3xt}{1 - \dots}}}}}} \tag{3.41}
\end{align}
$$

with coefficients:

$$
\alpha_{2k-1} = ky \tag{3.42a}
$$

$$
\alpha_{2k} = kx \tag{3.42b}
$$

$$
\delta_{2k-1} = z \tag{3.42c}
$$

$$
\delta_{2k} = kw \tag{3.42d}
$$

We will prove Theorem 3.15 in Section 5.2, as a special case of the more general “master”
T-fraction; we will also give a very simple alternate proof in Section 6.3.

Setting $x = y = w = z = 1$, we obtain the following simple corollary:

**Corollary 3.16** The ordinary generating function of the sequence $(a_n)_{n \ge 0}$ where $a_n =$ $|IRT_n|$ has the T-fraction

$$
\sum_{n=0}^{\infty} a_n t^n = \frac{1}{1 - t - \frac{t}{1 - t - \frac{1t}{1 - t - \frac{2t}{1 - 2t - \frac{2t}{1 - t - \frac{3t}{1 - 3t - \frac{3t}{1 - \dots}}}}}} \quad (3.43)
$$

with coefficients

$$
\alpha_{2k-1} = \alpha_{2k} = \delta_{2k} = k, \quad \delta_{2k-1} = 1. \tag{3.44}
$$

This is the sequence shown in (1.7).

In fact, we can further generalize Theorem 3.15 to have only one specialization instead
of two; we state this now:
**Theorem 3.17** The ordinary generating function of the polynomial (3.40) specialized to $y_2 = x_1 + y_1 - x_2$ has the T-fraction

$$ \sum_{n=0}^{\infty} P_n(x_1, x_2, y_1, y_2, w, z) t^n = \frac{1}{1 - zt - \frac{y_1 t}{1 - wt - \frac{x_1 t}{1 - zt - \frac{2y_1 t}{1 - 2wt - \frac{2x_1 t}{1 - zt - \frac{3y_1 t}{1 - 3wt - \frac{3x_1 t}{1 - \dots}}}}}} \quad (3.45) $$

with coefficients:

$$ \alpha_{2k-1} = ky_1 \quad (3.46a) $$

$$ \alpha_{2k} = kx_1 \quad (3.46b) $$

$$ \delta_{2k-1} = z \quad (3.46c) $$

$$ \delta_{2k} = kw \quad (3.46d) $$

Note that the result does not depend on the variable $x_2$. In Section 6.3 we will give an algebraic proof of Theorem 3.17, based on Proposition 2.2.

### 3.3.2 Master T-fraction

We now go farther, and introduce a polynomial in six infinite families of indeterminates: $\hat{\mathbf{a}} = (\hat{\mathbf{a}}_{\ell, \ell'})_{\ell, \ell' \ge 0}$, $\hat{\mathbf{b}} = (\hat{\mathbf{b}}_{\ell, \ell'})_{\ell, \ell' \ge 0}$ and $\mathbf{f} = (\mathbf{f}_{\ell, \ell'})_{\ell, \ell' \ge 0}$ with two subscripts, and $\mu = (\mu_{\ell})_{\ell \ge 0}$, $\nu = (\nu_{\ell})_{\ell \ge 0}$ and $\mathbf{e} = (\mathbf{e}_{\ell})_{\ell \ge 0}$ with one subscript. The notation is thus the same as in Section 3.2.3, together with the new indeterminates $\mathbf{e}$.

Let $T \in \mathcal{ITRT}_n$ be an increasing interval-labeled restricted ternary tree on the label set $[0, n]$, and let $v$ be a vertex of $T$ with label set $L_v = \{l, l+1, \dots, l+j\}$; here $j = |L_v| - 1$ is the label surplus of the vertex $v$. To each vertex $v$ we assign a weight $\mathrm{wt}(v)$ as follows:

$$ \bullet \text{ If } l=0 \text{ and } l+j=n, \text{ we assign weight } \mathrm{wt}(v) = \mathbf{e}_0^n. \quad (3.47) $$

$$ \bullet \text{ If } l=0 \text{ and } l+j < n, \text{ we assign weight } \mathrm{wt}(v) = \mu_0 \mathbf{e}_0^j. \quad (3.48) $$

$$ \bullet \text{ If } l > 0 \text{ and } l + j = n, \text{ we assign weight } \mathrm{wt}(v) = \hat{\mathbf{b}}_{00} \mathbf{e}_0^j. \quad (3.49) $$

$$ \bullet \text{ If } l > 0 \text{ and } l + j < n, \text{ we assign weight } \mathrm{wt}(v) = \mathbf{e}_0^j. \quad (3.50) $$

$$ \mathrm{wt}(v) = \begin{cases} \hat{\mathbf{a}}_{\mathrm{croix}(v,T), \mathrm{nid}(v,T)} \mu_{\mathrm{lev}(v,T)+1} (\mathbf{e}_{\mathrm{lev}(v,T)+1})^j & \text{if } N(v,T) = 101 \\ \hat{\mathbf{b}}_{\mathrm{croix}(v,T), \mathrm{nid}(v,T)} \nu_{\mathrm{lev}(v,T)-1} (\mathbf{e}_{\mathrm{lev}(v,T)})^j & \text{if } N(v,T) = 000 \\ \hat{\mathbf{a}}_{\mathrm{croix}(v,T), \mathrm{nid}(v,T)} \nu_{\mathrm{lev}(v,T)} (\mathbf{e}_{\mathrm{lev}(v,T)+1})^j & \text{if } N(v,T) = 100 \\ \hat{\mathbf{b}}_{\mathrm{croix}(v,T), \mathrm{nid}(v,T)} \mu_{\mathrm{lev}(v,T)} (\mathbf{e}_{\mathrm{lev}(v,T)})^j & \text{if } N(v,T) = 001 \\ \mathbf{f}_{\mathrm{croix}(v,T), \mathrm{nid}(v,T)} & \text{if } N(v,T) = 010 \end{cases} \quad (3.50) $$
(The reasons for these weights will be seen in Section 5.2 in the context of the bijective proof.)

Thus, the case (3.47) corresponds to a *trivial tree* (i.e., a tree consisting only of the root), in which the root $v$ has label surplus $n$. The case (3.48) corresponds to $v$ being the root of a nontrivial tree. The case (3.49) corresponds to $v$ being the *final vertex* (i.e., the vertex having $n$ in its label set) of a nontrivial tree. And finally, the case (3.50) corresponds to $v$ being neither the root nor the final vertex.

Notice that a vertex $v$ with no middle child gets a letter $\hat{a}$ if it has a left child, and $\hat{b}$ if not, with subscripts indicating croix and nid; it also gets a letter $\mu$ if it has a right child, and $\nu$ if not, with a single subscript indicating lev = croix + nid. A vertex $v$ with a middle child gets a letter $f$. And finally, a vertex with $|L_v| > 1$ gets a letter $e$ raised to the power $|L_v| - 1$ (which is the label surplus of $v$).

Note also that if $l + j < n$ and $N(v, T) = 000$ (i.e., $v$ is a leaf), then we necessarily have $\text{lev}(v, T) \ge 1$, since some vertex higher-numbered than $v$ must have a parent that is lower-numbered than $v$; then the subscript on $\nu$ is $\ge 0$.

Now define polynomials $Q_n(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{e}, \mathbf{f})$ as

$$Q_n(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{e}, \mathbf{f}) = \sum_{T \in \mathcal{IT}_n} \prod_{v \in V(T)} \text{wt}(v). \qquad (3.51)$$

For instance, the first few $Q_n$ (cf. Figure 3) are

$$Q_0 = 1 \qquad (3.52a)$$

$$Q_1 = \mu_0 \hat{\mathbf{b}}_{00} + \mathbf{e}_0 \qquad (3.52b)$$

$$Q_2 = (\mu_0 \hat{\mathbf{b}}_{00} + \mathbf{e}_0)^2 + \mu_0 \hat{\mathbf{b}}_{00} (\nu_0 \hat{\mathbf{a}}_{00} + \mathbf{f}_{00}) \qquad (3.52c)$$

We have the following theorem:

**Theorem 3.18** *The ordinary generating function of the polynomials $Q_n(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{e}, \mathbf{f})$ has the T-fraction*

$$\sum_{n=0}^{\infty} Q_n(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{e}, \mathbf{f}) t^n = \frac{1}{1 - \mathbf{e}_0 t - \frac{\mu_0 \hat{\mathbf{b}}_{00} t}{1 - \mathbf{f}_{00} t - \frac{\nu_0 \hat{\mathbf{a}}_{00} t}{1 - \mathbf{e}_1 t - \frac{\mu_1 (\hat{\mathbf{b}}_{01} + \hat{\mathbf{b}}_{10}) t}{1 - (\mathbf{f}_{01} + \mathbf{f}_{10}) t - \frac{\nu_1 (\hat{\mathbf{a}}_{01} + \hat{\mathbf{a}}_{10}) t}{1 - \dots}}}}} \qquad (3.53)$$
where the coefficients are defined as follows:

$$ \alpha_{2k-1} = \mu_{k-1} \left( \sum_{\xi=0}^{k-1} \hat{b}_{\xi,k-1-\xi} \right) \qquad (3.54a) $$

$$ \alpha_{2k} = \nu_{k-1} \left( \sum_{\xi=0}^{k-1} \hat{a}_{\xi,k-1-\xi} \right) \qquad (3.54b) $$

$$ \delta_{2k-1} = e_{k-1} \qquad (3.54c) $$

$$ \delta_{2k} = \sum_{\xi=0}^{k-1} f_{\xi,k-1-\xi} \qquad (3.54d) $$

We will prove Theorem 3.18 in Section 5.2, by bijection onto a suitable class of labeled Schröder paths.

Note that when $e_\ell = 0$ for all $\ell$, the tree $T$ is forced to be single-labeled, and we simply have a restricted ternary tree $T'$ on the vertex set $[n]$ together with a root vertex 0 that has (when $n \ge 1$) the vertex 1 (which is the root of $T'$) as its left child. When $n = 0$, the tree $T$ (which consists solely of the root 0) gets a weight $Q_0 = 1$, which also equals $Q_0^* = 1$ from (3.36a). When $n \ge 1$, the root of $T$ (vertex 0) gets weight $\mu_0$ from (3.48), and the vertex $n$ gets weight $\hat{b}_{00}$ from (3.49); all other vertices get the same weight (3.50) as in (3.35). This gives the same prefactor $\mu_0 \hat{b}_{00}$ as in (3.36b). It follows that

$$ Q_n(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{0}, \mathbf{f}) = Q_n^*(\hat{\mathbf{a}}, \hat{\mathbf{b}}, \mu, \nu, \mathbf{f}), \qquad (3.55) $$

so that Theorem 3.14 is the special case $\mathbf{e} = \mathbf{0}$ of Theorem 3.18.

# 4 Preliminaries for the proofs

Our proofs are based on Flajolet's [19] combinatorial interpretation of continued fractions in terms of Dyck and Motzkin paths and its generalization [22, 29, 25, 36, 16] to Schröder paths, together with some bijections mapping our tree models to labeled Motzkin or Schröder paths. In Sections 4.1 and 4.2 we review briefly these two ingredients and fix our notation. At the end of Section 4.1 we will also give a combinatorial interpretation/proof of Proposition 2.2.

## 4.1 Combinatorial interpretation of continued fractions

Recall that a **Motzkin path** of length $n \ge 0$ is a path $\omega = (\omega_0, \dots, \omega_n)$ in the right quadrant $\mathbb{N} \times \mathbb{N}$, starting at $\omega_0 = (0,0)$ and ending at $\omega_n = (n,0)$, whose steps $s_j = \omega_j - \omega_{j-1}$ are $(1,1)$ [“rise” or “up step”], $(1,-1)$ [“fall” or “down step”] or $(1,0)$ [“level step”]. We write $h_j$ for the **height** of the Motzkin path at abscissa $j$, i.e. $\omega_j = (j, h_j)$; note in particular that $h_0 = h_n = 0$. We write $M_n$ for the set of Motzkin paths of length $n$, and $M = \bigcup_{n=0}^\infty M_n$. A Motzkin path is called a **Dyck path** if it has no level steps. A Dyck path always has even length; we write $D_{2n}$ for the set of Dyck paths of length $2n$, and $\mathcal{D} = \bigcup_{n=0}^\infty \mathcal{D}_{2n}$.

Let $\mathbf{a} = (a_i)_{i \ge 0}$, $\mathbf{b} = (b_i)_{i \ge 1}$ and $\mathbf{c} = (c_i)_{i \ge 0}$ be indeterminates; we will work in the ring $\mathbb{Z}[[\mathbf{a}, \mathbf{b}, \mathbf{c}]]$ of formal power series in these indeterminates. To each Motzkin path $\omega$ we
assign a weight $W(\omega) \in \mathbb{Z}[\mathbf{a}, \mathbf{b}, \mathbf{c}]$ that is the product of the weights for the individual steps, where a rise starting at height $i$ gets weight $a_i$, a fall starting at height $i$ gets weight $b_i$, and a level step at height $i$ gets weight $c_i$. Flajolet [19] showed that the generating function of Motzkin paths can be expressed as a continued fraction:

**Theorem 4.1 (Flajolet's master theorem) We have**

$$ \sum_{\omega \in \mathcal{M}} W(\omega) = \frac{1}{1 - c_0 - \frac{a_0 b_1}{1 - c_1 - \frac{a_1 b_2}{1 - c_2 - \frac{a_2 b_3}{1 - \dots}}} \quad (4.1) $$

as an identity in $\mathbb{Z}[[\mathbf{a}, \mathbf{b}, \mathbf{c}]]$.

In particular, if $a_{i-1}b_i = \beta_i t^2$ and $c_i = \gamma_i t$ (note that the parameter $t$ is conjugate to the length of the Motzkin path), we have

$$ \sum_{n=0}^{\infty} t^n \sum_{\omega \in \mathcal{M}_n} W(\omega) = \frac{1}{1 - \gamma_0 t - \frac{\beta_1 t^2}{1 - \gamma_1 t - \frac{\beta_2 t^2}{1 - \dots}}} \quad (4.2) $$

so that the generating function of Motzkin paths with height-dependent weights is given by the J-fraction (1.3). Similarly, if $a_{i-1}b_i = \alpha_i t$ and $c_i = 0$ (note that $t$ is now conjugate to the semi-length of the Dyck path), we have

$$ \sum_{n=0}^{\infty} t^n \sum_{\omega \in \mathcal{D}_{2n}} W(\omega) = \frac{1}{1 - \frac{\alpha_1 t}{1 - \frac{\alpha_2 t}{1 - \dots}}} \quad (4.3) $$

so that the generating function of Dyck paths with height-dependent weights is given by the S-fraction (1.2).

Let us now show how to handle Schröder paths within this framework. A **Schröder path** of length $2n$ ($n \ge 0$) is a path $\omega = (\omega_0, \dots, \omega_{2n})$ in the right quadrant $\mathbb{N} \times \mathbb{N}$, starting at $\omega_0 = (0,0)$ and ending at $\omega_{2n} = (2n,0)$, whose steps are $(1,1)$ [“rise” or “up step”], $(1,-1)$ [“fall” or “down step”] or $(2,0)$ [“long level step”]. We write $s_j$ for the step starting at abscissa $j-1$. If the step $s_j$ is a rise or a fall, we set $s_j = \omega_j - \omega_{j-1}$ as before. If the step $s_j$ is a long level step, we set $s_j = \omega_{j+1} - \omega_{j-1}$ and leave $\omega_j$ undefined; furthermore, in this case there is no step $s_{j+1}$. We write $h_j$ for the height of the Schröder path at abscissa $j$ whenever this is defined, i.e. $\omega_j = (j, h_j)$. Please note that $\omega_{2n} = (2n,0)$ and $h_{2n} = 0$ are always well-defined, because there cannot be a long level step starting at abscissa $2n-1$. Note also that a long level step at even (resp. odd) height can occur only at an odd-numbered (resp. even-numbered) step. We write $S_{2n}$ for the set of Schröder paths of length $2n$, and $S = \bigcup_{n=0}^{\infty} S_{2n}$.

There is an obvious bijection between Schröder paths and Motzkin paths: namely, every long level step is mapped onto a level step. If we apply Flajolet's master theorem with
$a_{i-1}b_i = \alpha_i t$ and $c_i = \delta_{i+1}t$ to the resulting Motzkin path (note that $t$ is now conjugate to the semi-length of the underlying Schröder path), we obtain

$$ \sum_{n=0}^{\infty} t^n \sum_{\omega \in S_{2n}} W(\omega) = \frac{1}{1 - \delta_1 t - \frac{\alpha_1 t}{1 - \delta_2 t - \frac{\alpha_2 t}{1 - \dots}}} \quad (4.4) $$

so that the generating function of Schröder paths with height-dependent weights is given by the T-fraction (1.1). More precisely, every rise gets a weight 1, every fall starting at height $i$ gets a weight $\alpha_i$, and every long level step at height $i$ gets a weight $\delta_{i+1}$. This combinatorial interpretation of T-fractions in terms of Schröder paths was found recently by several authors [22, 29, 25, 36].

Since the up steps $i \to i+1$ and the down steps $i+1 \to i$ in a Schröder path can be paired, we may alternatively distribute the weights on rises and falls by assigning a weight 1 to all rises and falls starting at even heights, a weight $\alpha_{2k}$ to a rise starting at odd height $2k-1$, and a weight $\alpha_{2k-1}$ to a fall starting at odd height $2k-1$; a long level step at height $i$ gets a weight $\delta_{i+1}$ as before.

**Remark.** With these preliminaries in place, we can now give a combinatorial interpretation/proof of Proposition 2.2:

**COMBINATORIAL PROOF OF PROPOSITION 2.2.** We will provide a bijective interpretation of the identity (2.5), which is equivalent to Proposition 2.2. We use our alternative assignment of weights on Schröder paths.

By the *initial long level steps* of a Schröder path $\omega$, we shall refer to the long level steps occurring before the first rise, if any. We will add the adjective *non-initial* to refer to all other long level steps. Also, by a *restricted Schröder path*, we mean a Schröder path with no long level steps at even heights. Given a Schröder path $\omega$, we define a restricted Schröder path $\omega^b$ by simply removing all the long level steps at even heights in $\omega$. The map $\omega \mapsto \omega^b$ is clearly a surjection.

Notice that a non-initial long level step at an even height is preceded either by another non-initial long level step at the same height or by a rise or fall starting at an odd height. With this observation, we can immediately describe the preimage of a restricted Schröder path $\omega^b$ and hence prove equation (2.5): Firstly, we may choose to insert any number of initial long level steps to $\omega^b$; this contributes the prefactor $\frac{1}{1 - \delta_1 t}$ on the left-hand side. For a rise from height $2k-1$ to height $2k$ (which has weight $\alpha_{2k}$), we may choose to insert any number of non-initial long level steps at height $2k$ after this rise; this justifies the substitution $\alpha_{2k} \mapsto \frac{\alpha_{2k}}{1 - \delta_{2k+1}t}$. Likewise, for a fall from height $2k-1$ to height $2k-2$ (which has weight $\alpha_{2k-1}$), we may choose to insert any number of non-initial long level steps at height $2k-2$ after this fall; this justifies the substitution $\alpha_{2k-1} \mapsto \frac{\alpha_{2k-1}}{1 - \delta_{2k-1}t}$. $\square$

## 4.2 Labeled Dyck, Motzkin and Schröder paths

Let $\mathcal{A} = (A_h)_{h \ge 0}$, $\mathcal{B} = (B_h)_{h \ge 1}$ and $\mathcal{C} = (C_h)_{h \ge 0}$ be sequences of finite sets. An $(\mathcal{A}, \mathcal{B}, \mathcal{C})$-labeled Motzkin path of length $n$ is a pair $(\omega, \xi)$ where $\omega = (\omega_0, \dots, \omega_n)$ is
a Motzkin path of length $n$, and $\xi = (\xi_1, \dots, \xi_n)$ is a sequence satisfying

$$ \xi_i \in \begin{cases} \mathcal{A}(h_{i-1}) & \text{if step } i \text{ is a rise (i.e. } h_i = h_{i-1} + 1 \text{)} \\ \mathcal{B}(h_{i-1}) & \text{if step } i \text{ is a fall (i.e. } h_i = h_{i-1} - 1 \text{)} \\ \mathcal{C}(h_{i-1}) & \text{if step } i \text{ is a level step (i.e. } h_i = h_{i-1} \text{)} \end{cases} \quad (4.5) $$

where $h_{i-1}$ (resp. $h_i$) is the height of the Motzkin path before (resp. after) step $i$. [For typographical clarity we have here written $\mathcal{A}(h)$ as a synonym for $\mathcal{A}_h$, etc.] We call $\xi_i$ the **label** associated to step $i$. We call the pair $(\omega, \xi)$ an $(\mathcal{A}, \mathcal{B})$-labeled Dyck path if $\omega$ is a Dyck path (in this case $\mathcal{C}$ plays no role). We denote by $M_n(\mathcal{A}, \mathcal{B}, \mathcal{C})$ the set of $(\mathcal{A}, \mathcal{B}, \mathcal{C})$-labeled Motzkin paths of length $n$, and by $D_{2n}(\mathcal{A}, \mathcal{B})$ the set of $(\mathcal{A}, \mathcal{B})$-labeled Dyck paths of length $2n$.

We define a $(\mathcal{A}, \mathcal{B}, \mathcal{C})$-labeled Schröder path in an analogous way; now the sets $C_h$ refer to long level steps. We denote by $S_{2n}(\mathcal{A}, \mathcal{B}, \mathcal{C})$ the set of $(\mathcal{A}, \mathcal{B}, \mathcal{C})$-labeled Schröder paths of length $2n$.

Let us stress that the sets $\mathcal{A}_h$, $\mathcal{B}_h$ and $C_h$ are allowed to be empty. Whenever this happens, the path $\omega$ is forbidden to take a step of the specified kind starting at the specified height.

**Remark.** What we have called an $(\mathcal{A}, \mathcal{B}, \mathcal{C})$-labeled Motzkin path is (up to small changes in notation) called a *path diagramme* by Flajolet [19, p. 136] and a *history* by Viennot [42, p. II-9]. Often the label sets $\mathcal{A}_h$, $\mathcal{B}_h$, $C_h$ are intervals of integers, e.g. $\mathcal{A}_h = \{1, \dots, A_h\}$ or $\{0, \dots, A_h\}$; in this case the triplet $(\mathbf{A}, \mathbf{B}, \mathbf{C})$ of sequences of maximum values is called a *possibility function*. On the other hand, it is sometimes useful to employ labels that are *pairs* of integers (e.g. [38, Section 6.2] and [9, Section 7]). It therefore seems preferable to state the general theory without any specific assumption about the nature of the label sets. ■

Following Flajolet [19, Proposition 7A], we can state a “master J-fraction” for $(\mathcal{A}, \mathcal{B}, \mathcal{C})$-labeled Motzkin paths. Let $\mathbf{a} = (a_{h,\xi})_{h \ge 0}, \xi \in \mathcal{A}(h)$, $\mathbf{b} = (b_{h,\xi})_{h \ge 1}, \xi \in \mathcal{B}(h)$ and $\mathbf{c} = (c_{h,\xi})_{h \ge 0}, \xi \in \mathcal{C}(h)$ be indeterminates; we give an $(\mathcal{A}, \mathcal{B}, \mathcal{C})$-labeled Motzkin path $(\omega, \xi)$ a weight $W(\omega, \xi)$ that is the product of the weights for the individual steps, where a rise starting at height $h$ with label $\xi$ gets weight $a_{h,\xi}$, a fall starting at height $h$ with label $\xi$ gets weight $b_{h,\xi}$, and a level step at height $h$ with label $\xi$ gets weight $c_{h,\xi}$. Then:

**Theorem 4.2 (Flajolet’s master theorem for labeled Motzkin paths) We have**

$$ \sum_{n=0}^{\infty} t^n \sum_{(\omega, \xi) \in \mathcal{M}_n(\mathcal{A}, \mathcal{B}, \mathcal{C})} W(\omega, \xi) = \frac{1}{1 - c_0 t - \frac{a_0 b_1 t^2}{1 - c_1 t - \frac{a_1 b_2 t^2}{1 - c_2 t - \frac{a_2 b_3 t^2}{1 - \dots}}} \quad (4.6) $$

as an identity in $\mathbb{Z}[\mathbf{a}, \mathbf{b}, \mathbf{c}][[t]]$, where

$$ a_h = \sum_{\xi \in \mathcal{A}(h)} a_{h,\xi}, \quad b_h = \sum_{\xi \in \mathcal{B}(h)} b_{h,\xi}, \quad c_h = \sum_{\xi \in \mathcal{C}(h)} c_{h,\xi}. \quad (4.7) $$
This is an immediate consequence of Theorem 4.1 together with the definitions.

By specializing to $\mathbf{c} = \mathbf{0}$ and replacing $t^2$ by $t$, we obtain the corresponding theorem for $(\mathcal{A}, \mathcal{B})$-labeled Dyck paths:

**Corollary 4.3 (Flajolet's master theorem for labeled Dyck paths) We have**

$$ \sum_{n=0}^{\infty} t^n \sum_{(\omega, \xi) \in \mathcal{D}_{2n}(\mathcal{A}, \mathcal{B})} W(\omega, \xi) = \frac{1}{1 - \frac{a_0 b_1 t}{1 - \frac{a_1 b_2 t}{1 - \frac{a_2 b_3 t}{1 - \dots}}}} \quad (4.8) $$

as an identity in $\mathbb{Z}[\mathbf{a}, \mathbf{b}][[t]]$, where $a_h$ and $b_h$ are defined by (4.7).

Similarly, for labeled Schröder paths we have:

**Theorem 4.4 (Flajolet's master theorem for labeled Schröder paths) We have**

$$ \sum_{n=0}^{\infty} t^n \sum_{(\omega, \xi) \in S_{2n}(\mathcal{A}, \mathcal{B}, \mathcal{C})} W(\omega, \xi) = \frac{1}{1 - c_0 t - \frac{a_0 b_1 t}{1 - c_1 t - \frac{a_1 b_2 t}{1 - c_2 t - \frac{a_2 b_3 t}{1 - \dots}}}} \quad (4.9) $$

as an identity in $\mathbb{Z}[\mathbf{a}, \mathbf{b}, \mathbf{c}][[t]]$, where $a_h, b_h, c_h$ are defined by (4.7), with $c_{h,\xi}$ now referring to long level steps.

# 5 Bijective proofs of Theorems 3.11 and 3.18

Continued fractions for increasing binary trees go back to the celebrated bijection of Françon and Viennot [21, 20]: though ordinarily understood as a bijection from permutations to labeled Motzkin paths, the Françon-Viennot bijection can also be understood, by virtue of the standard bijection from increasing binary trees to permutations [39, pp. 44–45], as a bijection from increasing binary trees to labeled Motzkin paths; in this form it was first written down by Flajolet [19] (see also [43, Ch. 4b]). This bijection was rediscovered by Albert, Linton and Ruškuc [1], and in the permutation-patterns community it is often referred to as *insertion encoding*.

This bijection has recently been generalized by Kuba and Varvak [27] and Pétréolle, Sokal and Zhu [32] to the setting of increasing trees with higher parity, and equivalently to generalized Stirling permutations. We will provide here yet another generalization.

## 5.1 Bijection for increasing restricted ternary trees: Proof of Theorem 3.11

In this section we will construct a bijection from increasing restricted ternary trees on the vertex set $[n+1]$ to labeled Motzkin paths of length $n$, as follows: Given a tree
$T \in \mathcal{RT}_{n+1}$, we first define the path $\omega$ and then define the labels $\xi_i$, which will lie in the sets

$$ \mathcal{A}_h = \{0, \dots, h\} \qquad (5.1a) $$

$$ \mathcal{B}_h = \{0, \dots, h\} \quad \text{for } h \ge 1 \qquad (5.1b) $$

$$ \mathcal{C}_h = \{1, 2, 3\} \times \{0, \dots, h\} \qquad (5.1c) $$

A level step that has label $\xi_h \in \{i\} \times \{0, \dots, h\}$ will be called a level step of type $i$ ($i = 1, 2, 3$).

### Step 1: Definition of the Motzkin path.

Given a restricted ternary tree $T \in \mathcal{RT}_{n+1}$, we classify the indices $i \in [n]$ according to their node type. We then define a Motzkin path $\omega = (\omega_0, \dots, \omega_n)$ starting at $\omega_0 = (0, 0)$ and ending at $\omega_n = (n, 0)$, with steps $s_1, \dots, s_n$ as follows:

* If $N(i, T) = 101$, $s_i$ is a rise.

* If $N(i, T) = 000$, $s_i$ is a fall.

* If $N(i, T) = 100, 010$ or $001$, $s_i$ is a level step of type 1, 2 or 3, respectively.

These definitions can equivalently be written as

$$ h_i - h_{i-1} = \deg(i) - 1. \qquad (5.2) $$

Please note also that no step is assigned to vertex $n+1$, which is anyway always a leaf.

It is clear that $\omega$ consists of $n$ steps which are rises, falls and level steps. Thus, it remains to show that $\omega$ always stays on or above the x-axis and that it ends at $(n, 0)$. We will do this by obtaining a precise interpretation of the heights:

**Lemma 5.1 (Interpretation of the heights)** *The height of $\omega$ at position $i$ is given by*

$$ h_i = \text{lev}(i+1, T). \qquad (5.3) $$

In particular, $h_i \ge 0$ and $h_n = \text{lev}(n+1, T) = 0$.

**PROOF.** We proceed by induction. By definition, the path $\omega$ starts at height $h_0 = 0$. On the other hand, the root is here vertex 1; and was observed following (2.10), we have $\text{lev}(\text{root}, T) = 0$. This proves the base case $i = 0$ of (5.3).

Consider now $i \ge 1$, and assume that $h_{i-1} = \text{lev}(i, T)$. We will compare $\text{lev}(i+1, T)$ with $\text{lev}(i, T)$, and we will show that

$$ \text{lev}(i+1, T) - \text{lev}(i, T) = \deg(i) - 1. \qquad (5.4) $$

By (5.2), this will complete the proof of the inductive step.

Let us start from the definitions

$$ \text{lev}(i, T) = \#\{j \in [n+1]: p(j) < i < j\} \qquad (5.5a) $$

$$ \text{lev}(i+1, T) = \#\{j \in [n+1]: p(j) < i+1 < j\} \qquad (5.5b) $$

We see that:
• A vertex $j$ contributes to both $\text{lev}(i, T)$ and $\text{lev}(i+1, T)$ in case $p(j) < i < i+1 < j$.

• A vertex $j$ contributes to $\text{lev}(i, T)$ but not to $\text{lev}(i+1, T)$ in case $p(j) < i$ and $j = i+1$ — or in other words, $j = i+1$ is not a child of $i$. [Note that we must always have $p(i+1) \le i$.]

• A vertex $j$ contributes to $\text{lev}(i+1, T)$ but not to $\text{lev}(i, T)$ in case $p(j) = i$ and $j > i+1$ — or in other words, $j$ is a child of $i$ other than $i+1$.

It follows that

$$ \text{lev}(i+1, T) - \text{lev}(i, T) = (\text{deg}(i) - \text{I}[i+1 \text{ is a child of } i]) - \text{I}[i+1 \text{ is not a child of } i] \quad (5.6a) $$

$$ = \text{deg}(i) - 1. \quad (5.6b) $$

(Here $\text{I}[\text{proposition}] = 1$ if proposition is true, and 0 if it is false.) $\square$

**Remark.** For a general increasing tree (not necessarily restricted ternary), the steps (5.2) define in general an upper-Lukasiewicz path, i.e. $h_i - h_{i-1} \in \{-1, 0, 1, 2, \dots\}$. The key identity (5.4) continues to hold in this generality: see [31, Lemma 3.3] and [37]. $\blacksquare$

**Step 2: Definition of the labels $\xi_i$.** Fix a consistent tree-traversal algorithm $\mathbf{A}$. We will now describe the labels. We assign labels to the steps according to the status of the corresponding vertices as follows:

$$ \xi_i \stackrel{\text{def}}{=} \#\{j: p(j) < i < j \text{ and } j <_{\mathbf{A}} i\} \quad (5.7) $$

where $<_{\mathbf{A}}$ is the total order on vertices given by the tree-traversal algorithm $\mathbf{A}$. In other words,

$$ \xi_i = \text{nid}(i, T) \quad (5.8) $$

as defined in (2.11). To verify that the inequalities (5.1) are satisfied, we need to check that $0 \le \xi_i \le h_{i-1}$, where $h_{i-1}$ is the starting height of step $s_i$. The lower bound is immediate from the definition of $\xi_i$. For the upper bound, notice that from Lemma 5.1 it follows $h_{i-1} = \text{lev}(i, T)$. Thus, we need to show that $\xi_i \le \text{lev}(i, T)$, which is clear from the definitions (5.7)/(2.10). In fact, we also have an interpretation of the difference in terms of the statistic croix:

$$ h_{i-1} - \xi_i = \text{lev}(i, T) - \xi_i = \text{croix}(i, T) \quad (5.9) $$

by (2.12).

**Step 3: Proof of bijection.** We prove that the mapping $T \mapsto (\omega, \xi)$ is a bijection, by constructing the inverse bijection. To do this, we first use the path $\omega$ to identify the node types of the vertices. We will then use the labels $\xi$ to glue the vertices together and construct our restricted ternary tree $T \in \mathcal{RT}_n$; the details are as follows.

We first define a class of intermediate objects in our bijection: a *slotted restricted ternary tree* is an increasing restricted ternary tree whose set of vertex labels is $[i] \cup \{\infty\}$ but we now allow the label $\infty$ to be assigned to multiple vertices (all of which must be leaves).
(We think of the vertices labeled $\infty$ as placeholders where new vertices may be inserted into the tree in the future.)

Given a tree $T \in \mathcal{RT}_{n+1}$, we define the tree $T|_i$ to be the subtree of $T$ consisting of vertices $\{1, 2, \dots, i\}$ along with their children, in which the vertices with labels $> i$ are relabeled to $\infty$. Clearly, $T|_i$ is a slotted restricted ternary tree, and $T|_{n+1} = T$. By the history of tree $T$, we will mean the sequence of slotted restricted ternary trees $T|_1 \to T|_2 \to \dots \to T|_{n+1}$. Notice that for $i < n+1$, the number of vertices labeled $\infty$ in the tree $T|_i$ is the number of vertices $\ge i+1$ in $T$ whose parents are $\le i$: by (5.5b) this is $\text{lev}(i+1, T) + 1$.

We are now ready to build the tree $T$ from the pair $(\omega, \xi)$ by successively reading the steps $s_i$ and the labels $\xi_i$, using which we construct $T|_i$ from $T|_{i-1}$. We select the $(\xi_i+1)$-th vertex labeled $\infty$ in the traversal algorithm $\mathbf{A}$ applied to $T|_{i-1}$, and rename this vertex to $i$. And then we choose to add children (labeled $\infty$) to vertex $i$, depending on the status of the step $s_i$, as follows:

* If step $s_i$ is a rise, we add a left child and a right child to $i$, and both children get the label $\infty$.

* If step $s_i$ is a fall, we do not add any children.

* If step $s_i$ is a level step of type 1, we add a left child with label $\infty$.

* If step $s_i$ is a level step of type 2, we add a middle child with label $\infty$.

* If step $s_i$ is a level step of type 3, we add a right child with label $\infty$.

Finally, at the end of this process, the tree $T|_n$ will only contain a single vertex labeled $\infty$; we rename this vertex to $n+1$, thereby constructing $T = T|_{n+1}$.

**Step 4: Computation of the weights.** We can now compute the weights associated to the Motzkin path $\omega$ in Theorem 4.2, which we recall are $a_{h,\xi}$ for a rise starting at height $h$ with label $\xi$, $b_{h,\xi}$ for a fall starting at height $h$ with label $\xi$, and $c_{h,\xi}$ for a level step starting at height $h$ with label $\xi$. We do this by putting together the information collected in the description of the bijection. We write out the contribution of step $i$ of the path $\omega$ as per the different node types:

(a) Rise from height $h$ to height $h+1$:

- This step corresponds to a vertex $i$ having node type $N(i, T) = 101$, so from (3.25) it contributes the letter $\mathbf{a}$.

- From (5.7)/(5.8) we know that $\xi_i = \text{nid}(i, T)$, and from (5.9) we get $h - \xi_i = \text{croix}(i, T)$.

From (3.25), we get that the weight for this step is

$$a_{h,\xi} = a_{h-\xi,\xi} \qquad (5.10)$$

(b) Fall from height $h$ to height $h-1$:

- This step corresponds to a vertex $i$ having node type $N(i, T) = 000$, so from (3.25) it contributes the letter $\mathbf{b}$.
- Once again we have $\xi_i = \text{nid}(i, T)$ and $h - \xi_i = \text{croix}(i, T)$.

From (3.25), we get that the weight for this step is

$$b_{h,\xi} = b_{h-\xi,\xi} \qquad (5.11)$$

(c) Level step at height $h$:

- This step corresponds to a vertex $i$ having node type $N(i, T) = 100, 010$ or $001$, so from (3.25) it contributes the letter c, f or d, respectively.

- Once again we have $\xi_i = \text{nid}(i, T)$ and $h - \xi_i = \text{croix}(i, T)$.

From (3.25), we get that the weight for this step is

$$c_{h,\xi} = c_{h-\xi,\xi} + d_{h-\xi,\xi} + f_{h-\xi,\xi} \qquad (5.12)$$

Putting this all together in Theorem 4.2, we obtain a J-fraction with

$$\begin{aligned} \beta_h &= (\text{rise from } h-1 \text{ to } h) \times (\text{fall from } h \text{ to } h-1) \\ &= \left(\sum_{\xi=0}^{h-1} a_{h-1-\xi,\xi}\right) \left(\sum_{\xi=0}^{h} b_{h-\xi,\xi}\right) \qquad (5.13) \end{aligned}$$

$$\begin{aligned} \gamma_h &= \text{level step at height } h \\ &= \sum_{\xi=0}^{h} c_{h-\xi,\xi} + \sum_{\xi=0}^{h} d_{h-\xi,\xi} + \sum_{\xi=0}^{h} f_{h-\xi,\xi} \qquad (5.14) \end{aligned}$$

This completes the proof of Theorem 3.11. $\square$

We can now deduce Theorem 3.7 as a corollary:

PROOF OF THEOREM 3.7. It suffices to make the substitutions

$$a_{\ell, \ell'} = x_1, \quad b_{\ell, \ell'} = y_1, \quad c_{\ell, \ell'} = x_2, \quad d_{\ell, \ell'} = y_2, \quad f_{\ell, \ell'} = w \qquad (5.15)$$

in Theorem 3.11. $\square$

## 5.2 Bijection for increasing interval-labeled restricted ternary trees: Proof of Theorem 3.18

In this section we will construct a bijection from increasing interval-labeled restricted ternary trees on the label set $[0, n]$ to labeled Schröder paths of length $2n$, as follows: Given a tree $T \in \mathcal{IRT}_n$, we first define the path $\omega$ and then define the labels $\xi_i$, which will lie in the sets

$$A_h = \{0\} \quad \text{for } h \text{ even} \qquad (5.16a)$$

$$A_h = \{0, \dots, \lfloor h/2 \rfloor\} \quad \text{for } h \text{ odd} \qquad (5.16b)$$

$$B_h = \{0\} \quad \text{for } h \text{ even} \qquad (5.16c)$$

$$B_h = \{0, \dots, \lfloor h/2 \rfloor\} \quad \text{for } h \text{ odd} \qquad (5.16d)$$

$$C_h = \{0\} \quad \text{for } h \text{ even} \qquad (5.16e)$$

$$C_h = \{0, \dots, \lfloor h/2 \rfloor\} \quad \text{for } h \text{ odd} \qquad (5.16f)$$
Notice that only steps starting at an odd height may have a non-unique choice of label. We will then interpret the heights and labels, which will show that our path and labels are well-defined. Finally, we will prove that the map $T \mapsto (\omega, \xi)$ is indeed a bijection, by describing the inverse bijection.

**Step 1: Definition of the Schröder path.** Recall that in an increasing interval-labeled restricted ternary tree $T \in \mathcal{IRT}_n$, the vertex labels are disjoint intervals in $[0, n]$. The vertices therefore have a natural total order, obtained by comparing their label sets. Let the vertices of $T$ be $v_0 < v_1 < \dots < v_m$ in this total order; note that $v_0$ is the root, $v_m$ is a leaf, $0 \in L_{v_0}$ and $n \in L_{v_m}$. Let us call the tree **trivial** if it consists only of a root (then $m=0$ and the root has label set $[0, n]$), and **nontrivial** otherwise (then $m > 0$ and the root has a label set $[0, j]$ with $j < n$).

We will now describe a Schröder path $\omega$ of length $2n$; to do this we will assign a segment $\omega(v_i)$ to every vertex $v_i$ in the tree, and the path $\omega$ will be obtained by concatenating the segments: $\omega = \omega(v_0)\omega(v_1)\cdots\omega(v_m)$.

Let $v$ be a vertex of $T$ with $L_v = \{l, l+1, \dots, l+j\}$, so that the label surplus of this vertex is $j = |L_v| - 1$. We now describe the segment $\omega(v)$ as a word in the letters $\{\uparrow, \downarrow, \to\}$, which represent rise, fall and long level step, respectively:

$$ \bullet \text{ If } l=0 \text{ and } j=n \text{ then } \omega(v) = (\to)^n. \qquad (5.17) \\ \text{(Here } v \text{ is the root of a trivial tree.)} $$

$$ \bullet \text{ If } l=0 \text{ and } j < n \text{ then } \omega(v) = (\to)^j \uparrow. \qquad (5.18) \\ \text{(Here } v \text{ is the root of a nontrivial tree.)} $$

$$ \bullet \text{ If } l > 0 \text{ and } l + j = n, \text{ then } \omega(v) = \downarrow (\to)^j. \qquad (5.19) \\ \text{(Here } v \text{ is the last vertex } v_m \text{ of a nontrivial tree.)} $$

* If $l > 0$ and $l + j < n$ then

$$ \omega(v) = \begin{cases} \uparrow (\to)^j \uparrow & \text{if } N(v, T) = 101 \\ \downarrow (\to)^j \downarrow & \text{if } N(v, T) = 000 \\ \uparrow (\to)^j \downarrow & \text{if } N(v, T) = 100 \\ \downarrow (\to)^j \uparrow & \text{if } N(v, T) = 001 \\ \to & \text{if } N(v, T) = 010 \end{cases} \qquad (5.20) $$

(Here $v$ is neither $v_0$ nor $v_m$, and of course the tree is nontrivial.)

Notice that:

1) The cases $l=0$ correspond to the possibilities when $v$ is the root vertex $v_0$, while the cases $l > 0$ correspond to the possibilities when $v$ is a non-root vertex $v_i$ with $i \ge 1$.

2) Similarly, the cases $l+j=n$ correspond to the possibilities when $v$ is the final vertex $v_m$, while the cases $l+j < n$ correspond to the possibilities when $v$ is a non-final vertex $v_i$ with $i \le m-1$.

3) When $N(v, T) = 010$, we must have $j=0$, by virtue of our condition that vertices with a middle child are always single-labeled.

4) In (5.20) with $N(v, T) \neq 010$, we see that the first step is a rise if $v$ has a left child, and a fall if not; likewise, the last step is a rise if $v$ has a right child, and a fall if not.
5) The length of $\omega(v)$ is

$$|\omega(v)| = \begin{cases} 2j = 2|L_v| - 2 & \text{if } l = 0 \text{ and } j = n \\ 2j + 1 = 2|L_v| - 1 & \text{if } l = 0 \text{ and } j < n \\ 2j + 1 = 2|L_v| - 1 & \text{if } l > 0 \text{ and } l + j = n \\ 2j + 2 = 2|L_v| & \text{if } l > 0 \text{ and } l + j < n \end{cases} \quad (5.21)$$

Since $l = 0$ must occur exactly once, and $l + j = n$ must also occur exactly once, we have

$$\sum_{i=0}^{n} |\omega(v_i)| = \sum_{i=0}^{n} 2|L_{v_i}| - 2 = 2n. \quad (5.22)$$

So the path $\omega$ is indeed of length $2n$.

It is clear that $\omega$ consists of rises, falls and long level steps and that it starts at (0,0) and ends at $(2n, k)$ for some $k \in \mathbb{Z}$. To show that $\omega$ is a Schröder path, we need to show that it always stays on or above the x-axis and that it ends at $(2n, 0)$. We will do this by obtaining a precise interpretation of the heights. In particular, we interpret the starting and ending heights of the segments $\omega(v)$, as follows:

**Lemma 5.2 (Interpretation of the heights)** Let $v$ be a vertex of $T$ with label set $L_v$. If $L_v = [0, n]$ (which corresponds to $v$ being the root of a trivial tree), then the path consists of $n$ long level steps at height 0. Otherwise the tree is nontrivial, and:

(a) The segment $\omega(v_0)$ starts at height 0 and ends at height 1.

(b) For $v = v_i$ with $1 \le i \le m$, the segment $\omega(v)$ starts at height $2\text{lev}(v, T) + 1$; when $1 \le i < m$, it ends at height $h$ where $h$ is given by

$$h = \begin{cases} 2 \text{lev}(v, T) + 3 & \text{if } N_v(T) = 101 \\ 2 \text{lev}(v, T) + 1 & \text{if } N_v(T) = 100, 001 \text{ or } 010 \\ 2 \text{lev}(v, T) - 1 & \text{if } N_v(T) = 000 \end{cases} \quad (5.23)$$

(c) The segment $\omega(v_m)$ starts at height 1 and ends at height 0.

In particular, all the segments $\omega(v_i)$ for $i \ne 0$ start at an odd height, and all the segments $\omega(v_i)$ for $i \ne m$ end at an odd height.

**PROOF.** (a) is clear from the definition.

(b) Let us now look at the segments $\omega(v_i)$ for $1 \le i \le m$. It suffices to prove the statement about the starting height, because the statement (5.23) about the ending height when $i < m$ then follows immediately from this, using the definition (5.20) of the step (note that for $1 \le i \le m - 1$ we are always in the case $l > 0$ and $l + j < n$). We proceed by induction on $i$.

From (a) it follows that the segment $\omega(v_1)$ starts at height 1. On the other hand, $\text{lev}(v_1, T) = 0$ because the root has only one child (this was observed already following (2.10)). This proves the base case $i = 1$ of the induction.

Consider now $i \in [2, m]$, and assume the inductive hypothesis that the segment $\omega(v_{i-1})$ starts at height $2\text{lev}(v_{i-1}, T) + 1$. We now compare $\text{lev}(v_i, T)$ with $\text{lev}(v_{i-1}, T)$, and claim that the following equality holds:

$$\text{lev}(v_i, T) - \text{lev}(v_{i-1}, T) = \text{deg}(v_{i-1}) - 1. \quad (5.24)$$
<figure><img src="image_17.png" /><figcaption>Figure 5: Schröder path corresponding to the IRT shown in Figure 4. The red dots indicate the endpoints of the segments $\omega(v)$ corresponding to the vertices $v$ of the tree.</figcaption></figure>

The proof of (5.24) is identical to the proof of (5.4) in the preceding subsection: indeed, the proof holds without alteration for any increasing tree on a totally ordered vertex set. On the other hand,

$$ \deg(v_{i-1}) - 1 = \begin{cases} +1 & \text{when } N_{v_{i-1}}(T) = 101 \\ 0 & \text{when } N_{v_{i-1}}(T) = 100, 001 \text{ or } 010 \\ -1 & \text{when } N_{v_{i-1}}(T) = 000 \end{cases} \qquad (5.25) $$

It then follows from (5.23) that the ending height of the segment $\omega(v_{i-1})$, which is also the starting height of the segment $\omega(v_i)$, is $2\text{lev}(v_i, T) + 1$.

(c) Since $\text{lev}(v_m, T) = 0$, it follows from (b) that $\omega(v_m)$ starts at height 1. From the case $l > 0$ and $l + j = n$ of the definition, it therefore ends at height 0. $\square$

**Corollary 5.3** $\omega$ is a Schröder path.

**PROOF.** All that remains to prove is that the path stays always at height $\ge 0$, even in-between the starting and ending points of steps. The only potential danger is a step $\searrow (\rightarrow)^j \nearrow$ starting at height 0. But this cannot happen, because Lemma 5.2 guarantees that for $1 \le i \le m - 1$ the step $\omega(v_i)$ starts at a height $\ge 1$. $\square$

**Example 5.4** The Schröder path $\omega$ corresponding to the IRT shown in Figure 4 has been drawn in Figure 5. $\blacksquare$

**Remark.** When $m \ge 1$ (i.e. the tree consists of more than just a root), the quantities $\text{lev}(v_1, T), \dots, \text{lev}(v_m, T)$ describe the heights of a Motzkin path of length $m - 1$. $\blacksquare$

**Step 2: Definition of the labels $\xi_i$.** Fix a consistent tree-traversal algorithm $\mathbf{A}$. We will now describe the labels. However, notice first that for every vertex $v \ne v_0$, only the first step in the segment $\omega(v)$ starts at an odd height, and hence by (5.16) it will be the only step of the segment $\omega(v)$ that gets a choice of labels; all the other steps have only one choice (namely, $\xi = 0$). Thus, it suffices to assign a label $\xi_v$ to each vertex $v$, which we define as follows:

$$ \xi_v \stackrel{\text{def}}{=} \#\{w: p(w) < v < w \text{ and } w <_{\mathbf{A}} v\}, \qquad (5.26) $$
or in other words

$$ \xi_v = \mathrm{nid}(v, T) \qquad (5.27) $$

[exactly as in (5.7)/(5.8)]. To verify that the inequalities (5.16) are satisfied, we need to check that $0 \le \xi_v \le \lfloor h/2 \rfloor$, where $h$ is the starting height of the segment $\omega(v)$. The lower bound is immediate from the definition of $\xi_v$. For the upper bound, notice that from Lemma 5.2 it follows $\lfloor h/2 \rfloor = \mathrm{lev}(v, T)$; and $\xi_v \le \mathrm{lev}(v, T)$ is immediate from the definitions (5.26)/(2.10).

In fact, we also have an interpretation of the difference in terms of the statistic croix:

$$ \lfloor \frac{h}{2} \rfloor - \xi_v = \mathrm{croix}(v, T) \qquad (5.28) $$

by (2.12).

**Step 3: Proof of bijection.** We now prove that the mapping $T \mapsto (\omega, \xi)$ is a bijection, by describing the inverse bijection.

To construct the inverse bijection, we first use the path $\omega$ to determine the label sets $L_{v_0}, \dots, L_{v_m}$ and the node types $N(v_0, T), \dots, N(v_m, T)$. This is not entirely trivial (in contrast to the corresponding step in Section 5.1); we present it in Step 3a. Next we use the labels $\xi$ to glue the vertices together and construct our increasing interval-labeled restricted ternary tree $T \in \mathcal{IRT}_n$; we present this in Step 3b. In what follows, we find it convenient to think of the Schröder path as a word in the alphabet $\{\uparrow, \downarrow, \to\}$.

If the path $\omega$ consists of $n$ long level steps at height 0 [i.e., the word $(\to)^n$], then $T$ is the trivial tree ($m=0$) consisting of a root $v_0$ with label set $L_{v_0} = [0, n]$. In what follows we assume that $\omega$ has at least one rise and one fall.

**Step 3a: Description of vertices.** We begin by partitioning the label set $[0, n]$ into some intervals, which will give us our set of vertex labels. We do this by splitting our path $\omega$ into segments $\omega_0, \omega_1, \dots, \omega_m$ such that the word $\omega$ can be factorized as

$$ \omega = \omega_0\omega_1\cdots\omega_{m-1}\omega_m; \qquad (5.29) $$

then each segment $\omega_i$ will correspond to a vertex $v_i$. The segments are determined as follows:

* $\omega_0$ is the segment of $\omega$ that consists of all steps before and including the first rise from height 0. Thus, it corresponds to a word $(\to)^j \uparrow$ for some $j \ge 0$.

* The last segment $\omega_m$ is the segment of $\omega$ that consists of all steps of $\omega$ starting at the last fall to height 0 and including all steps after it. Thus, it corresponds to a word $\downarrow(\to)^j$ for some $j \ge 0$.

* Now consider the path $\omega^b$ obtained from $\omega$ by removing the prefix $\omega_0$ and the suffix $\omega_m$: it starts and ends at height 1 and never goes below the x-axis. We then split $\omega^b$ into minimal collections of steps starting and ending at odd heights. This gives us the factorization $\omega^b = \omega_1 \cdots \omega_{m-1}$.

We will now obtain the label sets for the vertices $v_0, \dots, v_m$, as follows: Consider the unique set-partition $[0, n] = l_0 \cup l_1 \cup \dots \cup l_m$ where the set $l_i$ is an interval such that $\max l_i < \min l_{i+1}$ and has cardinality given by

* If $\omega_0 = (\to)^j \uparrow$, then $|l_0| = j + 1$.
• If $\omega_m = \searrow (\longrightarrow)^j$, then $|l_m| = j + 1$.

• For $1 \le i \le m-1$:

(a) If $\omega_i$ contains $j$ long level steps at even height, then $|l_i| = j + 1$.

(b) If $\omega_i$ contains of a single long level step at odd height, then $|l_i| = 1$.

Equivalently, let $\text{leven}(\omega_i)$ count the number of long level steps of $\omega_i$ at an even height. The cardinality $|l_i|$ is simply given by $|l_i| = \text{leven}(\omega_i) + 1$. Then, to the vertex $v_i$ we assign the label set $L_{v_i} = l_i$.

We are now ready to assign node types to our vertices. The vertex $v_0$ gets node type $N(v_0, T) = 100$, and the vertex $v_m$ gets node type $N(v_m, T) = 000$. For a vertex $v_i$ with $1 \le i \le m-1$, its node type is determined by the segment $\omega_i$ as follows:

• If $\omega_i = \nearrow (\longrightarrow)^j \searrow$, then $N(v_i, T) = 101$.

• If $\omega_i = \searrow (\longrightarrow)^j \searrow$, then $N(v_i, T) = 000$.

• If $\omega_i = \nearrow (\longrightarrow)^j \searrow$, then $N(v_i, T) = 100$.

• If $\omega_i = \searrow (\longrightarrow)^j \nearrow$, then $N(v_i, T) = 001$.

• If $\omega_i = \longrightarrow$, then $N(v_i, T) = 010$.

**Step 3b: Constructing the tree using the vertices.** We now use our labels $\xi$ to glue together the vertices obtained in Step 3a. Before doing this, notice that each segment $\omega_i$ with $1 \le i \le m-1$ has exactly one step starting at an odd height, namely, its first step. From (5.16), we know that only this step may get a non-unique choice of labels. We refer to its label as $\xi_{\omega_i}$.

To describe the construction, we first define a class of intermediate objects in our bijection: a *slotted interval-labeled restricted ternary tree* is an increasing interval-labeled restricted ternary tree whose vertices may also have a label set $\{\infty\}$ and we now allow the label set $\{\infty\}$ to be assigned to multiple vertices (all of which must be leaves). (We think of the vertices labeled $\{\infty\}$ as slots where new vertices may be inserted into the tree in the future.)

Given a tree $T \in \mathcal{IRT}_n$ with vertices $v_0, v_1, \dots, v_m$, and $i \in [0, m]$, we define the tree $T|_i$ to be the subtree of $T$ consisting of vertices $v_0, v_1, \dots, v_i$ along with their children, in which the vertices with labels $> \max L_{v_i}$ are relabeled to $\{\infty\}$. Clearly, $T|_i$ is a slotted interval-labeled restricted ternary tree, and $T|_m = T$. By the *history* of tree $T$, we will mean the sequence of slotted interval-labeled restricted ternary trees $T|_0 \to T|_1 \to \dots \to T|_m$. Notice that for $i < m$ the number of vertices labeled $\{\infty\}$ in the tree $T|_i$ is $\text{lev}(v_{i+1}, T) + 1$.

We begin with the tree $T|_0$, which consists of a root $v_0$ labeled $[0, j]$ with $j = (|\omega(v_0)| - 1)/2$ and a left child labeled $\{\infty\}$. For $i > 0$, we will now construct the tree $T|_i$ from $T|_{i-1}$ by using the label $\xi_{\omega_i}$. We select the $(\xi_{\omega_i} + 1)$-th vertex in the tree-traversal order chosen in Step 2, and we replace this vertex with $v_i$. And then we choose to add children (labeled $\{\infty\}$) to $v_i$ according to the node type $N(v_i, T)$. The resulting tree is $T|_i$.

Finally, at the end of this process, the tree $T|_{m-1}$ will contain only a single vertex labeled $\{\infty\}$; we rename this vertex to $v_m$, thereby constructing $T = T|_m$.

**Step 4: Computation of the weights.** We can now compute the weights associated to the Schröder path $\omega$ in Theorem 4.4, which we recall are $a_{h,\xi}$ for a rise starting at height
h with label $\xi$, $b_{h,\xi}$ for a fall starting at height $h$ with label $\xi$, and $c_{h,\xi}$ for a long level step starting at height $h$ with label $\xi$. The weight $wt(v)$ defined in (3.47)-(3.50) is in general a product of factors; we will distribute this weight among the steps of the segment $\omega(v)$, as follows:

$$a_{2k-1,\xi} = \hat{a}_{k-1-\xi,\xi} \qquad (5.30a)$$

$$a_{2k,\xi} = \mu_k \qquad (5.30b)$$

$$b_{2k-1,\xi} = \hat{b}_{k-1-\xi,\xi} \qquad (5.30c)$$

$$b_{2k,\xi} = \nu_{k-1} \qquad (5.30d)$$

$$c_{2k-1,\xi} = f_{k-1-\xi,\xi} \qquad (5.30e)$$

$$c_{2k,\xi} = e_k \qquad (5.30f)$$

Let us now verify that these step weights give to each vertex $v$ the correct weights (3.47)-(3.50) when taking the product over all the steps in the segment $\omega(v)$.

We examine individually each type of step, starting with the steps starting at odd heights:

(a) Rise from height $2k-1$ to height $2k$:

- By definition of the Schröder path, we know that this step must correspond to the first step of a segment $\omega(v)$ for some vertex $v \neq v_0, v_m$ in the tree.

- Since the first step of $\omega(v)$ is a rise, $v$ can have node type $N(v, T) = 100$ or $101$. In either case we see from (3.50) that it will need one factor $\hat{a}$.

- From (5.26)/(5.27), we know that $\xi_v = \text{nid}(v, T)$; and from (5.28), we get $k-1-\xi_v = \text{croix}(v, T)$.

We therefore assign to this step a weight

$$a_{2k-1,\xi} = \hat{a}_{k-1-\xi,\xi} \qquad (5.31)$$

(b) Fall from height $2k-1$ to height $2k-2$:

- By definition of the Schröder path, we know that this step must correspond to the first step of a segment $\omega(v)$ for some vertex $v \neq v_0$ in the tree.

- Since the first step of $\omega(v)$ is a fall, $v$ can have node type $N(v, T) = 000$ or $N(v, T) = 001$. In either case it contributes a letter $\hat{b}$.

- Once again we have $\xi_v = \text{nid}(v, T)$ and $k-1-\xi_v = \text{croix}(v, T)$.

We therefore assign to this step a weight

$$b_{2k-1,\xi} = \hat{b}_{k-1-\xi,\xi} \qquad (5.32)$$

(c) Long level step at height $2k-1$:

- By definition of the Schröder path, we know that this step must correspond to $\omega(v)$ for some vertex $v$ with node type $N(v, T) = 010$. Thus, it contributes the letter $f$.
- Once again we have $\xi_v = \text{nid}(v, T)$ and $k - 1 - \xi_v = \text{croix}(v, T)$.

We therefore assign to this step a weight

$$c_{2k-1, \xi} = f_{k-1-\xi, \xi} \qquad (5.33)$$

The remaining steps begin at an even height and hence have $\xi = 0$ [cf. (5.16)].

(d) Rise from height $2k$ to height $2k + 1$:

- By definition of the Schröder path, we know that this step must correspond to the last step of a segment $\omega(v)$ for some vertex $v$ in the tree. (Here $v = v_0$ is a possibility.)

- As the last step of $\omega(v)$ is a rise, $v$ can have node type $N(v, T) = 101$ or $N(v, T) = 001$. In either case, we see from (3.50) that we will need one factor $\mu$.

- If $N(v, T) = 101$, the segment $\omega(v)$ started at height $2k - 1$, so from Lemma 5.2 we have $\text{lev}(v, T) = k - 1$; if $N(v, T) = 001$, the segment $\omega(v)$ started at height $2k + 1$, so from Lemma 5.2 we have $\text{lev}(v, T) = k$. In either case, (3.50) tells us to assign a weight

$$a_{2k, \xi} = \mu_k \qquad (5.34)$$

(e) Fall from height $2k$ to height $2k - 1$:

- By definition of the Schröder path, we know that this step must correspond to the last step of a segment $\omega(v)$ for some vertex $v \neq v_0, v_m$ in the tree.

- As the last step of $\omega(v)$ is a fall, $v$ can have node type $N(v, T) = 000$ or $100$. In either case, we see from (3.50) that it contributes the letter $\nu$.

- If $N(v, T) = 000$, the segment $\omega(v)$ started at height $2k + 1$, so from Lemma 5.2 we have $\text{lev}(v, T) = k$; if $N(v, T) = 100$, the segment $\omega(v)$ started at height $2k - 1$, so from Lemma 5.2 we have $\text{lev}(v, T) = k - 1$. In either case, (3.50) tells us to assign a weight

$$b_{2k, \xi} = \nu_{k-1} \qquad (5.35)$$

(f) Long level step at height $2k$:

- By definition of the Schröder path, we know that this step must correspond to one of the long level steps in a segment $\omega(v)$ for some vertex $v$ with $|L_v| > 1$.

- The vertex $v$ can have any node type except 010. Thus, we know from (3.47)-(3.50) that it contributes a letter $e$.

- If $v$ is the root, it must have node type 000 (if the tree is trivial) or 100 (if it is nontrivial), by definition of IRT. In either case we have $k = 0$ and $\text{lev}(v, T) = 0$.

- If $v$ is not the root: If $N(v, T) = 000$ or $001$, the segment $\omega(v)$ started at height $2k + 1$, so from Lemma 5.2 we have $\text{lev}(v, T) = k$; if $N(v, T) = 100$ or $101$, the segment $\omega(v)$ started at height $2k - 1$, so from Lemma 5.2 we have $\text{lev}(v, T) = k - 1$.
In all cases, (3.47)–(3.50) tell us to assign a weight

$$c_{2k, \xi} = e_k \qquad (5.36)$$

The number of such long level steps in the segment $\omega(v)$ is $j = |L_v| - 1$, which agrees with (3.47)–(3.50).

We can now check, for each of the eight types of segments $\omega(v)$ shown in (5.17)–(5.20), that the weight of the segment, taken as the product of the step weights (5.30), indeed coincides in all cases with $\mathrm{wt}(v)$ as defined in (3.47)–(3.50).

Putting this all together in Theorem 4.4, we obtain a T-fraction with

$$\begin{aligned} \alpha_{2k-1} &= (\text{rise from } 2k-2 \text{ to } 2k-1) \times (\text{fall from } 2k-1 \text{ to } 2k-2) \\ &= \mu_{k-1} \left( \sum_{\xi=0}^{k-1} \hat{b}_{k-1-\xi, \xi} \right) \end{aligned} \qquad (5.37)$$

$$\begin{aligned} \alpha_{2k} &= (\text{rise from } 2k-1 \text{ to } 2k) \times (\text{fall from } 2k \text{ to } 2k-1) \\ &= \left( \sum_{\xi=0}^{k-1} \hat{a}_{k-1-\xi, \xi} \right) \nu_{k-1} \end{aligned} \qquad (5.38)$$

$$\begin{aligned} \delta_{2k-1} &= \text{long level step at height } 2k-2 \\ &= e_{k-1} \end{aligned} \qquad (5.39)$$

$$\begin{aligned} \delta_{2k} &= \text{long level step at height } 2k-1 \\ &= \sum_{\xi=0}^{k-1} f_{k-1-\xi, \xi} \end{aligned} \qquad (5.40)$$

This completes the proof of Theorem 3.18. □

We can now deduce Theorem 3.15 as a corollary:

PROOF OF THEOREM 3.15. Consider the following substitutions:

$$\hat{a}_{\ell, \ell'} = x \qquad (5.41a)$$

$$\hat{b}_{\ell, \ell'} = y \qquad (5.41b)$$

$$f_{\ell, \ell'} = w \qquad (5.41c)$$

$$\mu_{\ell} = 1 \qquad (5.41d)$$

$$\nu_{\ell} = 1 \qquad (5.41e)$$

$$e_{\ell} = z \qquad (5.41f)$$

It is clear that inserting these into (3.54) yields the continued fraction coefficients (3.42).

To finish the proof we will need to argue that substituting (5.41) into the polynomials $Q_n(\hat{a}, \hat{b}, \mu, \nu, e, f)$ defined in (3.51) yields the polynomials $P_n(x, y, y, w, z)$ defined in (3.40). To do this, we show that the summands corresponding to the tree $T \in \mathcal{RT}_n$ are the same in both polynomials.

Let us first examine the weights of the vertices of $T$ in the polynomials $Q_n(\hat{a}, \hat{b}, \mu, \nu, e, f)$ — which are given by (3.47)–(3.50) — under the substitutions (5.41).
Consider a vertex $v$ with $L_v = \{l, l+1, \dots, l+j\}$. If $l=0$ or $l+j=n$ or both, by substituting (5.41) into (3.47)-(3.49) we obtain

$$ \mathrm{wt}(v) = \begin{cases} z^n & \text{if } l=0 \text{ and } l+j=n \\ z^j & \text{if } l=0 \text{ and } l+j<n \\ yz^j & \text{if } l>0 \text{ and } l+j=n \end{cases} \qquad (5.42) $$

Note that these three cases correspond, respectively, to the root of a trivial tree, the root of a nontrivial tree, and the final vertex of a nontrivial tree (note that this is a non-root vertex and a leaf). In the other cases (i.e. $l>0$ and $l+j<n$), by substituting (5.41) into (3.50) we obtain

$$ \mathrm{wt}(v) = \begin{cases} xz^j & \text{if } N(v, T) = 101 \\ yz^j & \text{if } N(v, T) = 000 \\ xz^j & \text{if } N(v, T) = 100 \\ yz^j & \text{if } N(v, T) = 001 \\ w & \text{if } N(v, T) = 010 \end{cases} \qquad (5.43) $$

These vertices are all non-root and non-final.

In all cases, the power of $z$ contributed by a vertex $v$ is $j = |L_v| - 1$ (the label surplus of $v$), so by (2.9) the total power of $z$ contributed by the tree $T$ is $I_T(\varepsilon)$. We then get a factor $x$ for each non-root vertex with node type 101 or 100, a factor $y$ for each non-root vertex with node type 000 or 001, and a factor $w$ for each non-root vertex with node type 010. Therefore,

$$ \prod_{v \in V(T)} \mathrm{wt}(v) = x^{I'_T(100)+I'_T(101)} y^{I'_T(000)+I'_T(001)} w^{I'_T(010)} z^{I_T(\varepsilon)}. \qquad (5.44) $$

This matches the contribution of tree $T$ in the polynomial $P_n(x, y, y, w, z)$ defined in (3.40).

<figure><img src="image_18.png" /></figure>

# 6 Algebraic proofs of Theorems 3.7, 3.15 and 3.17

In the preceding section we deduced the “simple” continued fractions (Theorems 3.7 and 3.15) as special cases of the “master” continued fractions (Theorems 3.11 and 3.18), which were proved bijectively. Here we would like to show how these “simple” continued fractions can be given an alternate, and extremely simple, algebraic proof using the theory of exponential Riordan arrays and their production matrices. We begin (Section 6.1) by recalling these two concepts and their application to the enumeration of rooted trees. Then we apply this theory to prove Theorem 3.7 (Section 6.2) and Theorems 3.15 and 3.17 (Section 6.3). In the latter proof, a crucial role is played by Proposition 2.2.

## 6.1 Exponential Riordan arrays, production matrices, and the enumeration of rooted trees

Let $R$ be a commutative ring containing the rationals, and let $F(t) = \sum_{n=0}^{\infty} f_n t^n / n!$ and $G(t) = \sum_{n=1}^{\infty} g_n t^n / n!$ be formal power series with coefficients in $R$; we set $g_0 = 0$. Then the
**exponential Riordan array** [12, 11, 4, 33] associated to the pair (F, G) is the infinite lower-triangular matrix $\mathcal{R}[F, G] = (\mathcal{R}[F, G]_{nk})_{n,k \ge 0}$ defined by

$$ \mathcal{R}[F, G]_{nk} = \frac{n!}{k!} [t^n] F(t)G(t)^k. \qquad (6.1) $$

That is, the kth column of $\mathcal{R}[F, G]$ has exponential generating function $F(t)G(t)^k/k!$.

Let us now explain briefly about production matrices [10, 11] [35, sections 2.2 and 2.3]. Let $P = (p_{ij})_{i,j \ge 0}$ be an infinite matrix with entries in a commutative ring $R$, and assume that $P$ is either row-finite or column-finite (so that powers of $P$ are well-defined). Now define a matrix $A = (a_{nk})_{n,k \ge 0}$ by

$$ a_{nk} = (P^n)_{0k} \qquad (6.2) $$

(note in particular that $a_{0k} = \delta_{k0}$). We call $P$ the **production matrix** and $A$ the **output matrix**, and we write $A = \mathcal{O}(P)$. It is not difficult to see that $AP = \Delta A$, where $\Delta$ is the matrix with 1 on the superdiagonal and 0 elsewhere. Note that if $P$ is lower-Hessenberg (i.e. vanishes above the first superdiagonal), then $\mathcal{O}(P)$ is lower-triangular; this is the most common case, and will be the case here. Conversely, when $A$ is lower-triangular with invertible diagonal entries and $a_{00} = 1$, then there exists a unique production matrix generating $A$, and it is the lower-Hessenberg matrix $P = A^{-1}\Delta A$.

The production matrix of an exponential Riordan array $\mathcal{R}[F, G]$ is given as follows (see e.g. [35, Theorem 2.19] [33, Theorem 6.1] for a proof):

**Theorem 6.1 (Production matrices of exponential Riordan arrays)** Let $L$ be a lower-triangular matrix (with entries in a commutative ring $R$ containing the rationals) with invertible diagonal entries and $L_{00} = 1$, and let $P = L^{-1}\Delta L$ be its production matrix. Then $L$ is an exponential Riordan array if and only if $P = (p_{nk})_{n,k \ge 0}$ has the form

$$ p_{nk} = \frac{n!}{k!} (z_{n-k} + k a_{n-k+1}) \qquad (6.3) $$

for some sequences $a = (a_n)_{n \ge 0}$ and $z = (z_n)_{n \ge 0}$ in $R$. (We set $a_n = z_n = 0$ for $n < 0$.)

More precisely, $L = \mathcal{R}[F, G]$ if and only if $P$ is of the form (6.3) where the ordinary generating functions $A(s) = \sum_{n=0}^{\infty} a_n s^n$ and $Z(s) = \sum_{n=0}^{\infty} z_n s^n$ are connected to $F(t)$ and $G(t)$ by

$$ G'(t) = A(G(t)), \qquad \frac{F'(t)}{F(t)} = Z(G(t)). \qquad (6.4) $$

We refer to $A(s)$ and $Z(s)$ as the **A-series** and **Z-series** of the exponential Riordan array $\mathcal{R}[F, G]$.

We now apply this theory to the enumeration of rooted trees, following [31]. Recall first [39, p. 573] that an **ordered tree** (also called *plane tree*) is a rooted tree in which the children of each vertex are linearly ordered. An **unordered forest of ordered trees** is an unordered collection of ordered trees. An **increasing ordered tree** is an ordered tree in which the vertices carry distinct labels from a linearly ordered set (usually some set of integers) in such a way that the label of each child is greater than the label of its parent; otherwise put, the labels increase along every path downwards from the root. An **unordered forest of increasing ordered trees** is an unordered forest of ordered trees with the same type of labeling.
Now let $\phi = (\phi_i)_{i \ge 0}$ be indeterminates, and let $L_{n,k}(\phi)$ be the generating polynomial for unordered forests of increasing ordered trees on the vertex set $[n]$, having $k$ components (i.e. $k$ trees), in which each vertex with $i$ children gets a weight $\phi_i$. Clearly $L_{n,k}(\phi)$ is a homogeneous polynomial of degree $n$ with nonnegative integer coefficients; it is also quasi-homogeneous of degree $n-k$ when $\phi_i$ is assigned weight $i$. The polynomials $L_{n,k}(\phi)$ are called the **generic Lah polynomials**; the lower-triangular matrix $L = (L_{n,k}(\phi))_{n,k \ge 0}$ is called the **generic Lah triangle**.

We now follow [31, sections 7 and 8]. Define the exponential generating function for trees:

$$G(t) = \sum_{n=1}^{\infty} L_{n,1}(\phi) \frac{t^n}{n!}. \qquad (6.5)$$

It is easy to see that the exponential generating function for $k$-component unordered forests is then

$$\frac{G(t)^k}{k!} = \sum_{n=0}^{\infty} L_{n,k}(\phi) \frac{t^n}{n!}. \qquad (6.6)$$

Therefore, the generic Lah triangle $L$ is the exponential Riordan array $\mathcal{R}[1, G]$. Furthermore, standard enumerative arguments [5, Theorem 1] show that $G(t)$ satisfies the ordinary differential equation

$$G'(t) = \Phi(G(t)), \qquad (6.7)$$

where $\Phi(s) \stackrel{\text{def}}{=} \sum_{k=0}^{\infty} \phi_k s^k$ is the ordinary generating function for $\phi$. Therefore, from (6.4) we see that $A(s) = \Phi(s)$.

Here we would like to get the trees into column 0 rather than column 1 of the output matrix, and shifted down to start at $n=0$ rather than $n=1$. This is easy: it suffices to consider the exponential Riordan array $\mathcal{R}[F, G]$ with

$$F(t) \stackrel{\text{def}}{=} G'(t) = \sum_{n=0}^{\infty} L_{n+1,1}(\phi) \frac{t^n}{n!}. \qquad (6.8)$$

Differentiating (6.7), we deduce that

$$G''(t) = \Phi'(G(t)) G'(t) \qquad (6.9)$$

and hence that

$$\frac{F'(t)}{F(t)} = \Phi'(G(t)). \qquad (6.10)$$

Therefore, from (6.4) we see that $Z(s) = \Phi'(s)$.

Inserting these formulae for $A(s)$ and $Z(s)$ into (6.3), we obtain the extraordinarily simple formula

$$p_{nk} = \frac{(n+1)!}{k!} \phi_{n-k+1} \qquad (6.11)$$

for the production matrix of $\mathcal{R}[G', G]$.

## 6.2 Application to increasing restricted ternary trees: Proof of Theorem 3.7

It is now easy to apply the foregoing theory to restricted ternary trees with the weights (3.16), in which the variables $x_1, y_1, x_2, y_2, w$ are associated to the node types 101, 000, 100,
001, 010, respectively. It suffices to take

$$ \phi_0 = y_1, \quad \phi_1 = x_2 + y_2 + w, \quad \phi_2 = x_1, \quad \phi_i = 0 \text{ for } i \ge 3. \qquad (6.12) $$

The production matrix (6.11) is then tridiagonal with

$$ p_{n,n+1} = y_1 \qquad (6.13a) $$

$$ p_{n,n} = (n+1)(x_2 + y_2 + w) \qquad (6.13b) $$

$$ p_{n,n-1} = n(n+1)x_1 \qquad (6.13c) $$

This generates Motzkin paths with these weights for rises, level steps and falls, respectively. On the other hand, for walks that end at height 0 we can transfer all the weights from rises to falls; we thus obtain a J-fraction with coefficients

$$ \gamma_n = (n+1)(x_2 + y_2 + w), \quad \beta_n = n(n+1)x_1y_1. \qquad (6.14) $$

These are precisely the coefficients (3.18); we have therefore proven Theorem 3.7.

## 6.3 Application to increasing interval-labeled restricted ternary trees: Proof of Theorems 3.15 and 3.17

An increasing interval-labeled restricted ternary tree $T'$ on the label set $[0, n']$ can be obtained from an increasing restricted ternary tree $T$ on the vertex set $[n]$, as follows:

* If $n = 0$, then $T$ is the empty tree; it gets a weight 1 in (3.16). The tree $T'$ is a trivial tree consisting of only a root with label set $[0, n']$; it gets a weight $z^{n'} = z^{I_{T'}(\epsilon)}$ in (3.40).

* If $n \ge 1$, the tree $T$ is nonempty. The tree $T'$ is obtained from $T$ by creating a root with label set $[0, j]$ for some $j \ge 0$, and making the root of $T$ be the left child of the root of $T'$; also, every vertex of $T$ other than one with a middle child can become interval-labeled. The weight of $T'$ in (3.40) is the same as the weight of $T$ in (3.16), multiplied by $z^{I_{T'}(\epsilon)}$.

It follows that the ordinary generating functions of the polynomials (3.16) and (3.40) are related as follows:

$$ \sum_{n=0}^{\infty} P_n(x_1, x_2, y_1, y_2, z, w) t^n = \frac{1}{1-zt} \sum_{n=0}^{\infty} P_n\left(\frac{x_1}{1-zt}, \frac{x_2}{1-zt}, \frac{y_1}{1-zt}, \frac{y_2}{1-zt}, w\right) t^n. \qquad (6.15) $$

Theorem 3.17 is then an immediate consequence of Theorem 3.9 together with Proposition 2.2: the key fact is that $x_1 + y_1 = x_2 + y_2$, so that $\delta_{2k}$ does not receive any factor $1/(1-zt)$. In particular, specializing $x_1 = x_2 = x$ and $y_1 = y_2 = y$ gives us Theorem 3.15.

## 7 Other interpretations

In this section we use bijections to reinterpret our results in terms of other combinatorial objects: increasing binary trees are in bijection with permutations (Section 7.1), and increasing restricted ternary trees are in bijection with binary free multilabeled increasing trees (Section 7.2).
## 7.1 Increasing binary trees ≃ Permutations

It is well known [39, pp. 44–45] that the set $\mathcal{B}_n$ of increasing binary trees on the vertex set $[n]$ is in bijection with the set $\mathcal{S}_n$ of permutations of $[n]$. In this section, we will translate our statistics for increasing binary trees to permutation statistics via this bijection. This will allow us to translate our continued fractions for increasing binary trees (Section 3.1) to continued fractions counting various statistics on permutations: namely, linear statistics and vincular patterns.

Let $\sigma = (\sigma_1 \cdots \sigma_n) \in \mathcal{S}_n$ be a permutation of $[n]$, which we shall consider principally as a word. We declare $\sigma_0 = \sigma_{n+1} = 0$. An index $i \in [n]$ (or a letter $\sigma_i \in [n]$) is called a

* peak (pk) if $\sigma_{i-1} < \sigma_i > \sigma_{i+1}$,

* valley (val) if $\sigma_{i-1} > \sigma_i < \sigma_{i+1}$,

* double ascent (dasc) if $\sigma_{i-1} < \sigma_i < \sigma_{i+1}$,

* double descent (ddes) if $\sigma_{i-1} > \sigma_i > \sigma_{i+1}$.

Clearly every index $i$ belongs to one of these four types; we refer to this classification as the **linear classification**.

**Remark.** The boundary condition $\sigma_0 = \sigma_{n+1} = 0$ plays a key role in our definition of the linear classification. Other boundary conditions can also be used: for instance, Han, Mao and Zeng [24] use $\sigma_0 = 0$, $\sigma_{n+1} = n + 1$. Different boundary conditions give rise to different linear classifications. ■

Next we introduce certain permutation statistics given by the occurrence of some vincular patterns [2] (see also the survey article [40]). We recall that a vincular pattern is similar in meaning to an ordinary permutation pattern, except that the absence of a dash indicates that the two letters are required to be consecutive in the word. For instance, the pattern 31–2 means that we have three letters $\ell_1 < \ell_2 < \ell_3$ such that $\ell_3$ occurs immediately before $\ell_1$ in the word, while $\ell_2$ occurs after $\ell_1$ (possibly but not necessarily immediately after it).$^4$

For a letter $\ell \in [n]$, we define $(31-2)(\ell, \sigma)$ and $(2-13)(\ell, \sigma)$ as follows:

$$ (31-2)(\ell, \sigma) \stackrel{\text{def}}{=} \#\{j: 1 < j < \sigma_{\ell}^{-1} \text{ and } \sigma_j < \ell < \sigma_{j-1}\} \quad (7.1) $$

$$ (2-13)(\ell, \sigma) \stackrel{\text{def}}{=} \#\{j: \sigma_{\ell}^{-1} < j < n \text{ and } \sigma_j < \ell < \sigma_{j+1}\} \quad (7.2) $$

Thus, $(31-2)(\ell, \sigma)$ counts the number of occurrences of the vincular pattern 31–2 in which the letter $\ell$ is the 2 in the pattern, while $\sigma_j$ and $\sigma_{j-1}$ are the 1 and the 3. Similarly, $(2-13)(\ell, \sigma)$ counts the number of occurrences of the vincular pattern 2–13 in which the letter $\ell$ is the 2 in the pattern, while $\sigma_j$ and $\sigma_{j+1}$ are the 1 and the 3. Note that these definitions do not require any boundary condition.

Let $\Phi_n: \mathcal{B}_n \to \mathcal{S}_n$ denote the reverse bijection in [39, pp. 44–45] from increasing binary trees to permutations. The permutation $\Phi_n(T)$ in word form is obtained by writing out

<footnote>$^4$There is an alternative (and perhaps preferable) notation for vincular patterns in which terms that must be adjacent are underlined. For instance, the pattern 31–2 would be written in this notation as 312. This notation has the advantage of reducing to the ordinary notation for permutation patterns when there are no underlinings.</footnote>
the vertices of tree $T$ as per the inorder (= symmetric) traversal: that is, (left, root, right), implemented recursively. The letters of the word $\Phi_n(T)$ thus correspond to the vertex labels of the tree $T$, and the order of those letters in the word $\Phi_n(T)$ corresponds to the inorder traversal $\mathbf{A}$ on those vertex labels: $\ell <_{\mathbf{A}} \ell' \iff \sigma_{\ell}^{-1} < \sigma_{\ell'}^{-1}$. Furthermore, the table in [39, p. 45] records the correspondence between the node types of a tree $T \in \mathcal{B}_n$ and the linear classification in the permutation $\Phi_n(T)$, using the boundary condition $\sigma_0 = \sigma_{n+1} = 0$:

<table><thead><tr><th>Node type $N(\sigma_i, T)$ in tree $T$</th><th>Linear classification of index $i$ in $\sigma = \Phi_n(T)$</th></tr></thead><tbody><tr><td>00</td><td>Peak</td></tr><tr><td>11</td><td>Valley</td></tr><tr><td>10</td><td>Double descent</td></tr><tr><td>01</td><td>Double ascent</td></tr></tbody></table>

Next, we translate the crossing and nesting statistics; we stress that they are defined with respect to the inorder traversal.

**Proposition 7.1** Let $T \in \mathcal{B}_n$ be an increasing binary tree and let $\sigma = \Phi_n(T)$. Then the following identities hold:

$$ \mathrm{nid}(\ell, T) = (31-2)(\ell, \sigma) \qquad (7.4a) $$

$$ \mathrm{croix}(\ell, T) = (2-13)(\ell, \sigma) \qquad (7.4b) $$

where nid and croix are defined with respect to the inorder traversal.

**PROOF.** We recall that

$$ \mathrm{croix}(\ell, T) = \#\{w: p(w) < \ell < w \text{ and } \ell <_{\mathbf{A}} w\} \qquad (7.5) $$

where $p(w)$ denotes the parent of $w$ in $T$, and $\mathbf{A}$ is the inorder traversal. Let $w$ be a vertex in $T$ that contributes to the right-hand side above. We first claim that either $w$ is a right child of its parent or it has an ancestor that is the right child of its parent. For if not, then $w$ lies on the leftmost branch of $T$, and the only possibility of having $\ell <_{\mathbf{A}} w$ is if $\ell$ occurs in the left subtree of $w$ (recall that we are using inorder traversal); but this contradicts $\ell < w$ since the tree $T$ is increasing.

Let $\hat{w}$ be the largest ancestor of $w$ (that is, the ancestor closest to $w$) that contains $w$ in its right subtree. In other words, $\hat{w}$ is the parent vertex of the first right edge that occurs on the path from $w$ to the root. In particular, $\hat{w} = p(w)$ if $w$ is the right child of its parent $p(w)$.

Let $\tilde{w}$ denote the leftmost descendant of $w$ in $T$ (that is, $\tilde{w}$ is a descendant of $w$ that does not have a left child, and the path downward from $w$ to $\tilde{w}$ consists only of left edges). In particular, $\tilde{w} = w$ if $w$ does not have a left child.

See Figure 6 for an illustration of $\hat{w}$ and $\tilde{w}$ for a given $w$.

It is immediate that $\hat{w} \le p(w) < \ell < w \le \tilde{w}$. Let $j = \sigma_{\tilde{w}}^{-1}$. It is clear, from the definition of inorder traversal, that the letter $\hat{w}$ is immediately followed by $\tilde{w}$ in $\sigma$; therefore $\sigma_{j+1} = \tilde{w}$. Thus, the triple $(\ell_1, \ell_2, \ell_3) = (\hat{w}, \ell, \tilde{w})$ forms a vincular pattern 2-13 in $\sigma$.

Also, notice that if we have two distinct vertices $w_1 \ne w_2$ contributing to $\mathrm{croix}(\ell, T)$, then necessarily $\hat{w}_1 \ne \hat{w}_2$ (since for a given vertex $\hat{w}$ there is at most vertex $w$ in the relevant chain that satisfies $p(w) < \ell < w$). Therefore, for every $w$ that contributes to $\mathrm{croix}(\ell, T)$, we have obtained a distinct $j$ that contributes to $(2-13)(\ell, \sigma)$; this shows that

$$ \mathrm{croix}(\ell, T) \le (2-13)(\ell, \sigma) \qquad (7.6) $$
<figure><img src="image_19.png" /><figcaption>Figure 6: An illustration of $\hat{w}$ and $\tilde{w}$ for a given $w$ contributing in the definition of $\text{croix}(\ell, T)$.</figcaption></figure>

On the other hand, given $j$ such that $\sigma_{\ell}^{-1} < j < n$ and $\sigma_j < \ell < \sigma_{j+1}$, we observe that $\sigma_j$ must be an ancestor of $\sigma_{j+1}$ in tree $T$. For if not, let $v$ be the closest common ancestor of $\sigma_j$ and $\sigma_{j+1}$; then the vertices $\sigma_j$ and $\sigma_{j+1}$ are in different subtrees of $v$. As $\sigma$ is obtained from $T$ by inorder traversal, the letter $v$ must occur between $\sigma_j$ and $\sigma_{j+1}$ in $\sigma$, which is a contradiction.

As $\sigma_j$ is an ancestor of $\sigma_{j+1}$, it is clear that $\sigma_{j+1}$ is in the right subtree of $\sigma_j$ and is the leftmost vertex on the right subtree of $\sigma_j$. Also notice that the vertex $\ell$ is not in the right subtree of $\sigma_j$, as that would contradict $\sigma_{\ell}^{-1} < j$. In particular, $\ell$ does not occur in the path from $\sigma_j$ to $\sigma_{j+1}$. Since $\sigma_j < \ell < \sigma_{j+1}$, on the path from $\sigma_j$ to $\sigma_{j+1}$ there is a unique vertex $w$ such that $p(w) < \ell < w$. This vertex $w$ is in the right subtree of $\sigma_j$ and hence $\sigma_j <_A w$. As we also have $\ell <_A \sigma_j$ (since this is equivalent to $\sigma_{\ell}^{-1} < j$), we get $\ell <_A w$. Furthermore, since $w$ lies in the left branch of the right child of $\sigma_j$, we have $\sigma_j = \hat{w}$; therefore $j = \sigma_{\hat{w}}^{-1}$ is uniquely determined by $w$. Thus, for every $j$ that contributes to $(2-13)(\ell, \sigma)$, we have obtained a distinct $w$ that contributes to $\text{croix}(\ell, T)$. This shows that

$$ (2-13)(\ell, \sigma) \le \text{croix}(\ell, T). \qquad (7.7) $$

This finishes the proof of (7.4b).

The proof for (7.4a) is obtained by simply switching left and right in the above proof; we leave it as an exercise for the reader. $\square$

**Remark.** The fact that $\text{nid}(\ell, T)$ translates to $(31-2)(\ell, \sigma)$ is implicitly mentioned by Viennot [43, Chapter 4b] using “$x$-decomposition” on permutations.<fnref n="5" /> ■

Now define the polynomials $P_n^*(a, b, c, d)$ as

$$ P_n^*(a, b, c, d) = \sum_{\sigma \in \mathfrak{S}_n} \prod_{\ell \in \text{Val}(\sigma)} a_{(2-13)(\ell, \sigma), (31-2)(\ell, \sigma)} \prod_{\ell \in \text{Pk}(\sigma)} b_{(2-13)(\ell, \sigma), (31-2)(\ell, \sigma)} \times \\ \prod_{\ell \in \text{Ddes}(\sigma)} c_{(2-13)(\ell, \sigma), (31-2)(\ell, \sigma)} \prod_{\ell \in \text{Dasc}(\sigma)} d_{(2-13)(\ell, \sigma), (31-2)(\ell, \sigma)} \qquad (7.8) $$

where $\text{Val}(\sigma)$ denotes the set of all valley letters of $\sigma$, and likewise for the others. From (7.3) and Proposition 7.1 we immediately obtain the following theorem:

<footnote n="5">⁵Video link address: https://www.youtube.com/watch?v=Cp8adiOL_6Q&t=865</footnote>
**Theorem 7.2 (Master J- and T-fractions for permutations with linear statistics)**

The polynomials $P_n^*(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d})$ defined in (7.8) and the polynomials $Q_n(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d})$ defined in (3.8) are equal:

$$P_n^*(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d}) = Q_n(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d}). \qquad (7.9)$$

Therefore, the ordinary generating function of the polynomials $P_n^*(\mathbf{a}, \mathbf{b}, \mathbf{c}, \mathbf{d})$ has the same J-fraction of Theorem 3.4 and the same T-fraction of Theorem 3.5.

**Example 7.3** For $\sigma = 57316284$, the quantities $(31-2)(\ell, \sigma)$ and $(2-13)(\ell, \sigma)$ are as follows:

$$ \begin{array}{c|c|c} \ell & (31-2)(\ell, \sigma) & (2-13)(\ell, \sigma) \\ \hline 1 & 0 & 0 \\ 2 & 1 & 0 \\ 3 & 0 & 2 \\ 4 & 2 & 0 \\ 5 & 0 & 2 \\ 6 & 1 & 1 \\ 7 & 0 & 1 \\ 8 & 0 & 0 \end{array} \qquad (7.10) $$

Notice that when $T$ is increasing binary tree shown in Figure 1, we have $\Phi_8(T) = \sigma = 57316284$. Comparing (2.13) and (7.10), we can verify that (7.4) holds for this example.

<figure><img src="image_20.png" /></figure>

**Remark.** Substituting $\mathbf{a}_{\ell, \ell'} = 1$, $\mathbf{b}_{\ell, \ell'} = u$, $\mathbf{c}_{\ell, \ell'} = w$ and $\mathbf{d}_{\ell, \ell'} = v$ gives us [19, Theorem 3A]. ■

<figure><img src="image_21.png" /></figure>

Here is an important special case: by setting

$$\mathbf{a}_{\ell, \ell'} = \mathbf{b}_{\ell, \ell'} = \mathbf{c}_{\ell, \ell'} = \mathbf{d}_{\ell, \ell'} = p^{\ell} q^{\ell'} \qquad (7.11)$$

in Corollary 3.6 (which is a special case of Theorem 3.5) and using Theorem 7.2, we obtain an S-fraction for the joint generating function of the statistics 2–13 and 31–2:

**Corollary 7.4** *We have the S-fraction*

$$ \sum_{n=0}^{\infty} \sum_{\sigma \in \mathfrak{S}_n} p^{(2-13)(\sigma)} q^{(31-2)(\sigma)} t^n = \frac{1}{1 - \frac{[1]_{p,q} t}{1 - \frac{[1]_{p,q} t}{1 - \frac{[2]_{p,q} t}{1 - \frac{[2]_{p,q} t}{1 - \dots}}}}} \qquad (7.12) $$

with coefficients

$$\alpha_{2k-1} = \alpha_{2k} = [k]_{p,q}. \qquad (7.13)$$
Furthermore, by combining this continued fraction with previous work of Claesson and Mansour [8], we can learn more about the joint distributions of various vincular patterns. For starters, Claesson [7, Proposition 1] showed that the four vincular patterns 2–13, 2–31, 13–2, 31–2 are equidistributed. Now consider the eight possible ordered pairs formed by taking one pattern of the form 2–ab and one of the form ab–2:

1. (2–13, 31–2)

2. (31–2, 2–13)

3. (2–31, 13–2)

4. (13–2, 2–31)

5. (2–13, 13–2)

6. (31–2, 2–31)

7. (2–31, 31–2)

8. (13–2, 2–13)

It is easy to see that the first four of these are equidistributed, and also the last four:

• The equivalences $1 \leftrightarrow 3$, $2 \leftrightarrow 4$, $5 \leftrightarrow 7$ and $6 \leftrightarrow 8$ are obtained by using complementation $\sigma \mapsto \sigma^c$ (that is, mapping letters $\ell \mapsto n + 1 - \ell$).

• The equivalences $1 \leftrightarrow 2$, $3 \leftrightarrow 4$, $5 \leftrightarrow 6$ and $7 \leftrightarrow 8$ are obtained by using reversal $\sigma \mapsto \sigma^r$ (that is, mapping indices $i \mapsto n + 1 - i$).

But here is the surprise: it turns out that all eight ordered pairs are equidistributed! This follows from the fact that Claesson and Mansour’s continued fraction for the generating function $\sum_{n=0}^{\infty} \sum_{\sigma \in \mathfrak{S}_n} p^{(2-31)(\sigma)} q^{(31-2)(\sigma)} t^n$ [8, Theorem 22 with $x = y = 1$] coincides with ours in Corollary 7.4 for $\sum_{n=0}^{\infty} \sum_{\sigma \in \mathfrak{S}_n} p^{(2-13)(\sigma)} q^{(31-2)(\sigma)} t^n$. The combination of these two continued fractions therefore proves:<fnref n="6" />

**Proposition 7.5** *In permutations of $[n]$, the pairs of statistics (2–13, 31–2) and (2–31, 31–2) are equidistributed.*

But we do not know any direct bijective proof of this equidistribution; we therefore pose it as an open problem:

**Open Problem 7.6** Find a bijective proof of Proposition 7.5.

Indeed, we can go farther, by considering the joint distribution of all four vincular patterns. Define the polynomials in four variables

$$P_n(p, q, r, s) = \sum_{\sigma \in \mathfrak{S}_n} p^{(13-2)(\sigma)} q^{(31-2)(\sigma)} r^{(2-13)(\sigma)} s^{(2-31)(\sigma)}. \quad (7.14)$$

<footnote n="6">⁶Let us remark that Vajnovszki [41] proved a special case of the equivalence $3 \leftrightarrow 5$, and thus of Proposition 7.5: namely, he proved that 2–13 and 2–31 are equidistributed among permutations avoiding 132 (or equivalently, avoiding 13–2) — that is, for the subclass for which $(13–2)(\sigma) = 0$. We thank Anders Claesson for drawing our attention to Vajnovszki’s work.</footnote>
Then the identity $P_n(p, q, r, s) = P_n(q, p, s, r)$ is a consequence of complementation symmetry, while the identity $P_n(p, q, r, s) = P_n(s, r, q, p)$ is a consequence of reversal symmetry. By combining these we obtain the $\mathbb{Z}_2 \times \mathbb{Z}_2$ symmetry

$$P_n(p, q, r, s) = P_n(q, p, s, r) = P_n(s, r, q, p) = P_n(r, s, p, q). \qquad (7.15)$$

Furthermore, it can be checked that for $n \ge 5$ these are the only permutations of the four variables that leave the polynomial $P_n$ invariant.

But by setting one of the variables equal to 1, we obtain empirically some interesting identities, which we state as a conjecture:

**Conjecture 7.7 (Trivariate symmetries on vincular patterns)**

*We have the relations*

$$P_n(1, q, r, s) = P_n(1, q, s, r) \qquad (7.16a)$$

$$P_n(p, 1, r, s) = P_n(p, 1, s, r) \qquad (7.16b)$$

$$P_n(p, q, 1, s) = P_n(q, p, 1, s) \qquad (7.16c)$$

$$P_n(p, q, r, 1) = P_n(q, p, r, 1) \qquad (7.16d)$$

We have verified Conjecture 7.7 for $n \le 11$. Please note that the four conjectured relations are equivalent by virtue of the symmetries (7.15), so it suffices to prove one of them. Please note also that Proposition 7.5 is the identity $P_n(1, q, r, 1) = P_n(1, q, 1, r)$, which is the $s = 1$ special case of (7.16a). So Conjecture 7.7 generalizes Proposition 7.5.

Finally, it is worth comparing our master polynomials (7.8) with the polynomials [24, eqs. (3.1) and (3.2)] of Han, Mao and Zeng, for which they demonstrate a master J-fraction [24, eq. (1.19)]. There are three differences between their polynomials and ours:

* Their polynomials involve the joint distribution of the patterns (2–31, 31–2) — as in Claesson and Mansour [8, Theorem 22] — whereas ours involve the joint distribution of (2–13, 31–2).

* They took the boundary conditions $\sigma_0 = 0$, $\sigma_{n+1} = n+1$, while we took the boundary conditions $\sigma_0 = \sigma_{n+1} = 0$. This difference in the boundary conditions does not affect the meanings of the vincular patterns, but it does affect the meanings of the linear classification and hence of the master polynomials.

* Their linear classification was more refined than ours: they refined double ascents into *foremaxima* (double ascents that are also records) and the rest.

Finally, their master J-fraction is different from ours, because it concerns the ogf of $Q_n$ and coincides with that of [38, Theorem 2.9], which generalizes the J-fraction for the sequence $(n!)_{n \ge 0}$, while our master J-fraction in Theorem 3.4 concerns the ogf of $Q_{n+1}$ and hence generalizes the J-fraction for the sequence $((n+1)!)_{n \ge 0}$.

If we call [24, Theorems 3.1 and 3.2 with Theorem 1.10] the *first and second master J-fractions for permutations with linear statistics*, then we can call the result obtained by combining Theorem 3.4 with Theorem 7.2 the *third master J-fraction for permutations with linear statistics*. Also, the result obtained by combining Theorem 3.5 with Theorem 7.2 can be called the *master T-fraction for permutations with linear statistics*.
<figure><img src="image_22.png" /><figcaption>Figure 7: An example of a binary free multilabeled increasing tree on the label set [6].</figcaption></figure>

## 7.2 Increasing restricted ternary trees ≃ Binary free multilabeled increasing trees

In [26, Section 5.2, Example 5], Kuba and Panholzer consider binary free multilabeled increasing trees. A *binary free multilabeled increasing tree* with label set $[n]$ is a binary tree $T$ in which each vertex $v$ is assigned a nonempty set of labels $L_v$ such that (a) $\{L_v\}_{v \in V(T)}$ is a set-partition of $[n]$, and (b) every label of a child is larger than every label of its parent.

There is a simple bijection between binary free multilabeled increasing trees on the label set $[n]$ and increasing restricted ternary trees on the vertex set $[n]$. In fact, this bijection is a slight modification of the bijection in [26, Theorem 10] that is illustrated in [26, Fig. 7]. Namely, consider a binary free multilabeled increasing tree $T$ on the label set $[n]$. We define an increasing restricted ternary tree $T'$ on the vertex set $[n]$ as follows: Replace each vertex $u$ in $T$, having label set $L_u = \{u_1 < \dots < u_i\}$, by a chain of vertices $u_1 - u_2 - \dots - u_i$ in $T'$, where the node $u_j$ has $u_{j+1}$ as its middle child for $1 \le j \le i-1$. If $u$ has a left (resp. right) child $v$ in $T$, then in $T'$ the final vertex $u_i$ has the initial vertex $v_1$ as its left (resp. right) child. The reverse bijection can be obtained by simply contracting the middle edges in a restricted ternary tree to a single multilabeled vertex.

**Example 7.8** Figure 7 is an example of a binary free multilabeled increasing tree on the label set [6]. This tree is in bijective correspondence with the increasing restricted ternary tree shown in Figure 2.

<figure><img src="image_23.png" /></figure>

## Acknowledgments

A crucial role was played in this work by the On-Line Encyclopedia of Integer Sequences [28]. We warmly thank Neil Sloane for founding this indispensable resource, and the hundreds of volunteers for helping to maintain and expand it.

The first author (V.B.) was an undergraduate at University College London when this work was performed; she thanks the Department of Mathematics for two undergraduate research bursaries.
The second author (B.D.) was supported in 2023-24 by DIMERS project ANR-18-CE40-0033 funded by Agence Nationale de la Recherche (ANR, France).

We also thank Anders Claesson for drawing our attention to the work of Vajnovszki [41] on vincular patterns.

# A Table of OEIS matches for some T-fractions with quasi-affine coefficients

In order to come up with our conjectures, we used a reverse-engineering approach. That is, rather than starting from a combinatorial family and attempting to find a T-fraction enumerating it, we started instead from a “nice” T-fraction and attempted to find a combinatorial interpretation for it. More precisely, we considered a generic quasi-affine T-fraction of the form (1.5) in which we let each of the variables $x, y, u, v, a, b, c, d$ be either 0 or 1. For each of the $2^8 = 256$ cases we generated the first 10 terms $a_n$ using a MATHEMATICA code, and we then searched the OEIS [28] for the given sequence, deleting the initial term $a_0 = 1$. Of course, the lack of an OEIS entry does not necessarily mean that the sequence is combinatorially uninteresting; indeed, the sequence (1.7) is a counterexample. And conversely, an OEIS entry sometimes lacks a combinatorial interpretation. But we figured that the OEIS would be a good place to start. Our idea was that if the OEIS entry for an integer sequence arising from $x, y, u, v, a, b, c, d \in \{0, 1\}$ mentions some combinatorial interpretation, then by refining that combinatorial interpretation we might conjecture (and then prove) a T-fraction in which one or more of the coefficients are variables conjugate to some statistic in the combinatorial model. This strategy turned out to pay off.

In reality we imposed some restrictions. To begin with, we imposed $x = y = 1$, because taking either $x = 0$ or $y = 0$ would make $\alpha_1 = 0$ or $\alpha_2 = 0$, leading to a finite (and quite trivial) continued fraction; this restriction reduces the number of cases to $2^6 = 64$. Likewise, we disallowed $a = b = c = d = 0$, since that would give an S-fraction. We excluded those because the main goal of this project was to discover new T-fractions that cannot be represented as an S-fraction or J-fraction. This further brought down the number of cases to 60.

We performed an automated search for these 60 sequences on the OEIS. Among the resulting searches, we further omitted the sequences with $c = d = 0$, since they correspond to simple linear transforms of S-fractions$^7$; this reduced the number of sequences to 48. Our MATHEMATICA code returned the following OEIS matches:

* A187251 — On setting $x = y = v = c = 1$ and $u = a = b = d = 0$ in (1.5) we obtain a sequence that starts as

$$1, 1, 2, 6, 22, 94, 460, 2532, 15420, 102620, 739512, \dots \qquad (A.1)$$

This sequence matches the OEIS entry A187251, which has the description “Number of permutations of $[n]$ having no cycle with 3 or more alternating runs (it is assumed that the smallest element of a cycle is in the first position).”

* A105072 — On setting $x = y = v = a = c = 1$ and $u = b = d = 0$ in (1.5) we obtain a sequence that starts as

$$1, 2, 5, 16, 63, 290, 1511, 8756, 55761, 386394, 2889181, \dots \qquad (A.2)$$

<footnote>$^7$See [3, Propositions 3 and 15] for some special cases, and [36] for the general case.</footnote>
This sequence matches the OEIS entry A105072, which has the description "Number of permutations on $[n]$ whose local maxima are in ascending order."

* A230008 — On setting $x = y = u = v = b = d = 1$ and $a = c = 0$ in (1.5) we obtain a sequence that starts as

$$1, 1, 3, 11, 51, 295, 2055, 16715, 155355, 1624255, 18868575, \dots \quad (A.3)$$

This sequence [which is (1.9)] matches the OEIS entry A230008, which has as a comment (by Markus Kuba) "Counts binary free multilabeled increasing trees with $m$ labels." This comment was the starting point for the present research. In this paper we have shown in Theorem 3.7, and independently in Section 7.2, that this sequence also counts increasing restricted ternary trees: $a_n = |RT_n|$.

After finishing the bulk of this research, we performed yet another automated search, this time including also the value 2 in addition to 0 and 1. This gives $3^8 = 6561$ cases. We imposed $x, y \in \{1, 2\}$ to avoid a finite continued fraction; this reduced the number of cases to $4 \times 3^6 = 2946$. Then we disallowed $a = c = 0$ and $b = d = 0$, as either would give us a J-fraction by using the odd and even contraction formulae, respectively. The resulting number of cases is further reduced to 2304. Our MATHEMATICA code returned 13 OEIS matches; we list these in Table 1.

As an aid to researchers who may wish to implement similar reverse-engineering searches — possibly with a very large number of test sequences — we share our MATHEMATICA code for automated searches of the OEIS:

```
llToString[ll_] := TextString[ll, ListFormat -> {"", ",", ""}]

OEISQuerystring[ll_] :=
  "http://oeis.org/search?q=" <> llToString[ll] <> "&fmt=json"

getOEISJSON[ll_] := Import[OEISQuerystring[ll], "JSON"]

ToAForm(num_] :=
  Module[{str1 = ToString(num]},
    If[StringLength(str1) >= 6,
      Return["A" <> str1],
      Return["A" <> StringRepeat["0", 6 - StringLength(str1)]
        <> str1]
    ]
  ]

SequenceInOEIS[ll_, delete_:1, verbose_: False] :=
  Module[{res = getOEISJSON[Drop[ll, delete]]},
    If[verbose, Print[Length res, " results"]];
    If res === Null,
      Return[{}],
      Return[{Map[ToAForm, ("number" / res)], ll}]
    ]
  ]
```
<table><caption>Table 1: OEIS entries having various T-fractions.</caption><thead><tr><th>OEIS A number</th><th>First few terms</th><th>(x, y, u, v, a, b, c, d)</th><th>Description</th></tr></thead><tbody><tr><td>A258173</td><td>1, 1, 3, 12, 58, 321, 1975, 13265</td><td>(1,1,0,0,0,1,2,2)</td><td>Sum over all Dyck paths of semilength n of products over all peaks p of y<sub>p</sub>, where y<sub>p</sub> is the y-coordinate of peak p.</td></tr><tr><td>A006318</td><td>1, 2, 6, 22, 90, 394, 1806, 8558</td><td>(1,1,0,0,1,1,0,0)</td><td>Large Schröder numbers</td></tr><tr><td>A302285</td><td>1, 2, 7, 33, 185, 1170, 8121</td><td>(1,1,0,0,1,2,2,2)</td><td>No combinatorial description</td></tr><tr><td>A047891</td><td>1, 3, 12, 57, 300, 1686, 9912</td><td>(1,1,0,0,2,2,0,0)</td><td>Number of planar rooted trees with n nodes and tricolored end nodes.</td></tr><tr><td>A155866</td><td>1, 2, 6, 22, 91, 413, 2032</td><td>(1,1,0,1,1,1,0,0)</td><td>A 'Morgan-Voyce' transform of the Bell numbers</td></tr><tr><td>A155857</td><td>1, 2, 6, 23, 107, 590, 3786</td><td>(1,1,1,1,1,1,0,0)</td><td>Row sums of triangle A155856 ((2<sup>n-k</sup>)<sub>k</sub>)(n-k)!</td></tr><tr><td>A000311</td><td>1, 1, 4, 26, 236, 2752, 39208</td><td>(1,2,2,2,0,1,2,2)</td><td>Schröder's fourth problem; also series-reduced rooted trees with n labeled leaves; also number of total partitions of n.</td></tr><tr><td>A001515</td><td>1, 2, 7, 37, 266, 2431, 27007</td><td>(1,2,2,2,1,1,0,0)</td><td>Bessel polynomial y<sub>n</sub>(x) evaluated at x = 1.</td></tr><tr><td>A006351</td><td>1, 2, 8, 52, 472, 5504, 78416</td><td>(1,2,2,2,1,2,2,2)</td><td>Number of series-parallel networks with n labeled edges. Also called yoke-chains by Cayley and MacMahon.</td></tr><tr><td>A043301</td><td>1, 3, 13, 77, 591, 5627, 64261</td><td>(1,2,2,2,2,2,0,0)</td><td>a(n) = 2<sup>n</sup> &sum;<sub>k=0</sub><sup>n</sup>(n+k)!/((n-k)!k!4<sup>k</sup>).</td></tr><tr><td>A155867</td><td>1, 3, 13, 65, 355, 2061, 12501</td><td>(2,1,0,0,1,1,0,0)</td><td>A 'Morgan-Voyce' transform of the large Schröder numbers A006318.</td></tr><tr><td>A103210</td><td>1, 3, 15, 93, 645, 4791, 37275</td><td>(2,2,0,0,1,1,0,0)</td><td>a(0) = 1<br>a(n) = (1/n) &sum;<sub>i=0</sub><sup>n-1</sup> (nchoosei) (nchoosei+1) 2<sup>i</sup> 3<sup>n-i</sup></td></tr><tr><td>A156017</td><td>1, 4, 24, 176, 1440, 12608</td><td>(2,2,0,0,2,2,0,0)</td><td>Schröder paths with two rise colors and two level colors.</td></tr></tbody></table>

## B Context-free grammars (= derivative operators) for our generating polynomials

In this appendix, we show how the sequences enumerating our families of trees can be obtained in a very simple way using context-free (Chen) grammars [6] (see also [14]), also known as derivative operators. This approach was very helpful to us in guessing our families of trees, and also in helping us to check the correctness of our T-fractions. Indeed, whenever we conjectured a family of trees to match a given sequence arising from a T-fraction, we checked our conjecture by first writing out a derivative operator to generate that family of trees; this was a quick way of obtaining a weighted count of the trees in our family without having to construct them explicitly. We then checked whether the weighted count of the trees matched the sequence generated by our T-fraction.

We applied this approach to increasing binary trees and increasing restricted ternary trees. However, for increasing interval-labeled restricted ternary trees, our approach was different: instead, we generated the first few terms of the ordinary generating function for increasing restricted ternary trees using a derivative operator, and then checked our construction by using the identity (6.15).
In the rest of this section, we write out our grammar rules and derivative operators for binary trees and restricted ternary trees.

## B.1 Increasing binary trees

We shall construct a differential operator that generates the polynomials $P_n(x_1, x_2, y_1, y_2)$ defined in (3.1), which enumerate increasing binary trees with weights $x_1, y_1, x_2, y_2$ for the node types 11, 00, 10, 01, respectively.

To do this, we start with an increasing binary tree $T$ on the vertex set $[n-1]$, and we consider the various ways in which a new vertex with label $n$ can be attached to this tree as a child of some vertex $j \in [n-1]$:

* If $j$ is a leaf in $T$, with weight $y_1$, then $n$ can be attached as either a left child or a right child of $j$. In either case $n$ has node type 00, and $j$ gets node type 10 or 01, respectively. This gives the grammar rule $y_1 \mapsto y_1x_2 + y_1y_2$.

* If $j$ has node type 10 (resp. 01) in $T$, with weight $x_2$ (resp. $y_2$), then $n$ can be attached as a right (resp. left) child of $j$. After $n$ is attached, $j$ has node type 11 and $n$ has node type 00. This gives us the grammar rules $\{x_2 \mapsto x_1y_1, y_2 \mapsto x_1y_1\}$.

* If $j$ has node type 11 in $T$, then $n$ cannot be attached there.

Combining this information, we define the differential operator

$$ \mathcal{D} \stackrel{\text{def}}{=} y_1(x_2 + y_2) \frac{\partial}{\partial y_1} + x_1 y_1 \left( \frac{\partial}{\partial x_2} + \frac{\partial}{\partial y_2} \right). \qquad (\text{B.1}) $$

Since $P_1 = y_1$, we have proven the following proposition:

**Proposition B.1** The polynomials $P_n(x_1, x_2, y_1, y_2)$ defined in (3.1) satisfy

$$ P_n(x_1, x_2, y_1, y_2) = \mathcal{D}^{n-1} y_1 \quad \text{for } n \ge 1 \qquad (\text{B.2}) $$

where $\mathcal{D}$ is defined by (B.1).

**Remark.** Specializing our grammar rule $\{y_1 \mapsto y_1x_2 + y_1y_2, x_2 \mapsto x_1y_1, y_2 \mapsto x_1y_1\}$ to $x_1 = 1, y_1 = x, x_2 = y_2 = y$ gives the grammar rule $\{x \mapsto 2xy, y \mapsto x\}$ studied in [14, section 2.4]. ■

## B.2 Increasing restricted ternary trees

We shall construct a differential operator that generates the polynomials $P_n(x_1, x_2, y_1, y_2, w)$ defined in (3.16), which enumerate increasing restricted ternary trees with weights $x_1, y_1, x_2, y_2, w$ for the node types 101, 000, 100, 001, 010, respectively.

To do this, we start with an increasing restricted ternary tree $T$ on the vertex set $[n-1]$, and we consider the various ways in which a new vertex with label $n$ can be attached to this tree. The reasoning is the same as for increasing binary trees, except that:

* If $j$ is a leaf in $T$, then $n$ can also be attached as a middle child of $j$. This gives the grammar rule $y_1 \mapsto y_1(x_2 + y_2 + w)$.
• If j has node type 010 in T, then n cannot be attached there.

We therefore define the differential operator

$$ \mathcal{D} \stackrel{\text{def}}{=} y_1(x_2 + y_2 + w) \frac{\partial}{\partial y_1} + x_1 y_1 \left( \frac{\partial}{\partial x_2} + \frac{\partial}{\partial y_2} \right). \qquad (\text{B.3}) $$

Since $P_1 = y_1$, we have proven the following proposition:

**Proposition B.2** The polynomials $P_n(x_1, x_2, y_1, y_2, w)$ defined in (3.16) satisfy

$$ P_n(x_1, x_2, y_1, y_2, w) = \mathcal{D}^{n-1} y_1 \quad \text{for } n \ge 1 \qquad (\text{B.4}) $$

where $\mathcal{D}$ is defined by (B.3).

## References

[1] M.H. Albert, S. Linton and N. Ruškuc, The insertion encoding of permutations, Electron. J. Combin. **12**, no. 1, #R47 (2005).

[2] E. Babson and E. Steingrímsson, Generalized permutation patterns and a classification of the Mahonian statistics, Séminaire Lotharingien de Combinatoire **44**, article B44b (2000), 18 pp.

[3] P. Barry, Continued fractions and transformations of integer sequences, J. Integer Seq. **12**, article 09.7.6 (2009).

[4] P. Barry, *Riordan Arrays: A Primer* (Logic Press, County Kildare, Ireland, 2016).

[5] F. Bergeron, P. Flajolet and B. Salvy, Varieties of increasing trees, in *CAAP '92*, edited by J.-C. Raoult, Lecture Notes in Computer Science #581 (Springer-Verlag, Berlin, 1992), pp. 24–48.

[6] W.Y.C. Chen, Context-free grammars, differential operators and formal power series, Theoret. Comput. Sci. **117**, 113–129 (1993).

[7] A. Claesson, Generalized pattern avoidance, European J. Combin. **22**, 961–971 (2001).

[8] A. Claesson and T. Mansour, Counting occurrences of a pattern of type (1, 2) or (2, 1) in permutations, Adv. Appl. Math. **29**, 293–310 (2002).

[9] B. Deb and A.D. Sokal, Classical continued fractions for some multivariate polynomials generalizing the Genocchi and median Genocchi numbers, Adv. Appl. Math. **161**, 102756 (2024).

[10] E. Deutsch, L. Ferrari and S. Rinaldi, Production matrices, Adv. Appl. Math. **34**, 101–122 (2005).

[11] E. Deutsch, L. Ferrari and S. Rinaldi, Production matrices and Riordan arrays, Ann. Comb. **13**, 65–85 (2009).
[12] E. Deutsch and L. Shapiro, Exponential Riordan arrays, handwritten lecture notes, Nankai University, 26 February 2004, available on-line at http://www.combinatorics.net/ppt2004/Louis%20W.%20Shapiro/shapiro.pdf

[13] D. Dumont, Further triangles of Seidel-Arnold type and continued fractions related to Euler and Springer numbers, Adv. Appl. Math. **16**, 275-296 (1995).

[14] D. Dumont, Grammaires de William Chen et dérivacons dans les arbres et arbores-cences, Séminaire Lotharingien de Combinatoire **37**, article B37a (1996).

[15] D. Dumont and J. Zeng, Further results on the Euler and Genocchi numbers, Aequationes Math. **47**, 31-42 (1994).

[16] A. Elvey Price and A.D. Sokal, Phylogenetic trees, augmented perfect matchings, and a Thron-type continued fraction (T-fraction) for the Ward polynomials, Electron. J. Combin. **27**(4), #P4.6 (2020).

[17] G. Eneström, *Die Schriften Eulers chronologisch nach den Jahren geordnet, in denen sie verfaßt worden sind*, Jahresbericht der Deutschen Mathematiker-Vereinigung (Teubner, Leipzig, 1913).

[18] L. Euler, De seriebus divergentibus, Novi Commentarii Academiae Scientiarum Petropolitanae **5**, 205-237 (1760). [Latin original and English and German translations available at http://eulerarchive.maa.org/pages/E247.html]

[19] P. Flajolet, Combinatorial aspects of continued fractions, Discrete Math. **32**, 125-161 (1980).

[20] J. Françon, Histoires de fichiers, RAIRO Informat. Théor. **12**, 49-62 (1978).

[21] J. Françon and G. Viennot, Permutations selon leurs pics, creux, doubles montées et double descentes, nombres d'Euler et nombres de Genocchi, Discrete Math. **28**, 21-35 (1979).

[22] E. Fusy and E. Guitter, Comparing two statistical ensembles of quadrangulations: A continued fraction approach, Ann. Inst. Henri Poincaré D **4**, 125-176 (2017).

[23] I.P. Goulden and D.M. Jackson, *Combinatorial Enumeration* (Wiley, New York, 1983). Reprinted by Dover, Mineola NY, 2004.

[24] B. Han, J. Mao and J. Zeng, Equidistributions around special kinds of descents and excedances, SIAM J. Discrete Math. **35**, 2858-2879 (2021).

[25] M. Josuat-Vergès, A *q*-analog of Schläfli and Gould identities on Stirling numbers, Ramanujan J. **46**, 483-507 (2018).

[26] M. Kuba and A. Panholzer, Combinatorial families of multilabelled increasing trees and hook-length formulas, Discrete Math. **339**, 227-254 (2016).

[27] M. Kuba and A.L. Varvak, On path diagrams and Stirling permutations, Séminaire Lotharingien de Combinatoire **82**, article B82c (2021).

[28] The On-Line Encyclopedia of Integer Sequences, published electronically at http://oeis.org
[29] R. Oste and J. Van der Jeugt, Motzkin paths, Motzkin polynomials and recurrence relations, Electron. J. Combin. **22**, no. 2, #P2.8 (2015).

[30] R. Parviainen, Lattice path enumeration of permutations with $k$ occurrences of the pattern 2–13, J. Integer Seq. **9**, article 06.3.2 (2006).

[31] M. Pétréolle and A.D. Sokal, Lattice paths and branched continued fractions, II: Multivariate Lah polynomials and Lah symmetric functions, European J. Combin. **92**, 103235 (2021).

[32] M. Pétréolle, A.D. Sokal and B.-X. Zhu, Lattice paths and branched continued fractions: An infinite sequence of generalizations of the Stieltjes-Rogers and Thron-Rogers polynomials, with coefficientwise Hankel-total positivity, Mem. Amer. Math. Soc., **291**, no. 1450 (2023).

[33] L. Shapiro, R. Sprugnoli, P. Barry, G.-S. Cheon, T.-X. He, D. Merlini and W. Wang, *The Riordan Group and Applications* (Springer, Cham, 2022).

[34] T.J. Stieltjes, Recherches sur les fractions continues, Ann. Fac. Sci. Toulouse **8**, J1-J122 (1894) and **9**, A1-A47 (1895). [Reprinted, together with an English translation, in T.J. Stieltjes, *Euvres Complètes/Collected Papers* (Springer-Verlag, Berlin, 1993), vol. II, pp. 401-566 and 609-745.]

[35] A.D. Sokal, Total positivity of some polynomial matrices that enumerate labeled trees and forests, I: Forests of rooted labeled trees, Monatsh. Math. **200**, 389-452 (2023).

[36] A.D. Sokal, Coefficientwise total positivity (via continued fractions) for some Hankel matrices of combinatorial polynomials, in preparation.

[37] A.D. Sokal and J. Walrad, in preparation.

[38] A.D. Sokal and J. Zeng, Some multivariate master polynomials for permutations, set partitions, and perfect matchings, and their continued fractions, Adv. Appl. Math. **138**, 102341 (2022).

[39] R.P. Stanley, *Enumerative Combinatorics*, vol. 1, 2nd ed. (Cambridge University Press, Cambridge-New York, 2012).

[40] E. Steingrímsson, Generalized permutation patterns — a short survey. In S. Linton, N. Ruškuc, and V. Vatter, eds., *Permutation Patterns*, London Mathematical Society Lecture Note Series #376 (Cambridge University Press, Cambridge-New York, 2010).

[41] V. Vajnovszki, The equidistribution of some length-three vincular patterns on $S_n(132)$, Inform. Process. Lett. **130**, 40-45 (2018).

[42] G. Viennot, Une théorie combinatoire des polynômes orthogonaux généraux, Notes de conférences données à l'Université du Québec à Montréal, septembre-octobre 1983. Available on-line at http://www.xavierviennot.org/xavier/polynomes_orthogonaux.html

[43] X. Viennot, *The Art of Bijective Combinatorics, Part I*: An introduction to enumerative, algebraic and bijective combinatorics. Institute of Mathematical Sciences, Chennai (2016). Available on-line at https://www.viennot.org/abjc1.html