Enumeration of coalescent histories for caterpillar species trees and $p$-pseudocaterpillar gene trees

For a fixed set $X$ containing $n$ taxon labels, an ordered pair consisting of a gene tree topology $G$ and a species tree $S$ bijectively labeled with the labels of $X$ possesses a set of coalescent histories -- mappings from the set of internal nodes of $G$ to the set of edges of $S$ describing possible lists of edges in $S$ on which the coalescences in $G$ take place. Enumerations of coalescent histories for gene trees and species trees have produced suggestive results regarding the pairs $(G,S)$ that, for a fixed $n$, have the largest number of coalescent histories. We define a class of 2-cherry binary tree topologies that we term $p$-pseudocaterpillars, examining coalescent histories for non-matching pairs $(G,S)$, in the case in which $S$ has a caterpillar shape and $G$ has a $p$-pseudocaterpillar shape. Using a construction that associates coalescent histories for $(G,S)$ with a class of"roadblocked"monotonic paths, we identify the $p$-pseudocaterpillar labeled gene tree topology that, for a fixed caterpillar labeled species tree topology, gives rise to the largest number of coalescent histories. The shape that maximizes the number of coalescent histories places the"second"cherry of the $p$-pseudocaterpillar equidistantly from the root of the"first"cherry and from the tree root. A symmetry in the numbers of coalescent histories for $p$-pseudocaterpillar gene trees and caterpillar species trees is seen to exist around the maximizing value of the parameter $p$. The results provide insight into the factors that influence the number of coalescent histories possible for a given gene tree and species tree.


Introduction
In mathematical phylogenetics, a coalescent history represents the paired list of coalescences in a gene tree together with their associated edges of a species tree. Consider two binary, rooted, leaf-labeled trees, G and S, with leaves labeled by the same label set X, such that each label in X is associated with exactly one leaf of G and exactly one leaf of S. We regard G as a gene tree representing the evolution of genealogical lineages in a group of species, and S as the species tree representing the evolutionary descent of the species themselves.
For a gene tree G evolving on a species tree S, a coalescent history is a mapping from the set of internal nodes of G to the set of internal edges of S, such that two rules are followed: (i) the image of an internal node v of G is ancestral in S to each leaf of S that shares a label with some leaf descended from v in G; (ii) the image of an internal node v of G is ancestral in S to the images of each of its descendant nodes. The biological interpretation of (i) is that a set of gene lineages can (A) (B) (C) Figure 1: Three tree shapes with n = 11 leaves. (A) Caterpillar tree shape. (B) p-pseudocaterpillar tree shape. For this tree, p = 8. (C) Caterpillar-like tree shape. The seed tree has size 9.
only find a common ancestor on a species tree edge that it is possible for them all to reach; the interpretation of (ii) is that the gene lineages descended from a descendant node coalesce at least as recently as do the gene lineages descended from its ancestral nodes. Note that we regard a node as trivially ancestral to and descended from itself. The coalescent histories for (G, S) can be viewed as describing a discrete class of evolutionary scenarios for the lineages of G on the edges of S.
A variety of studies have enumerated the coalescent histories for pairs (G, S), both by a recursive approach that applies in all cases of (G, S) (Rosenberg, 2007;Than et al., 2007), and by closed-form formulas and bijective constructions developed for particular families of trees (Degnan, 2005;Rosenberg, 2007Rosenberg, , 2013Rosenberg, , 2019Rosenberg & Degnan, 2010;Disanto & Rosenberg, 2015, 2016Himwich & Rosenberg, 2020). These enumeration studies, primarily considering matching gene trees and species trees with G = S and having particular emphasis on shapes such as caterpillars, 4pseudocaterpillars, and caterpillar-like families (Figure 1), have informally observed that in specified classes of trees, the largest number of coalescent histories tends to occur when the pair (G, S) possesses two features: multiple different sequences exist in which the coalescences of G can occur, and many edges of S exist on which those coalescences can take place. Rosenberg (2007) observed that for small trees with at most n = 9 leaves and G = S, the largest numbers of coalescent histories among tree pairs (G, G) with fixed n were seen for trees that had structure similar to caterpillar trees, but that unlike caterpillars, had more than one possible sequence of coalescences. Rosenberg (2013) and Disanto & Rosenberg (2016) examined tree families (G, G), with n growing arbitrarily large in specified caterpillar-like tree families. Beginning with a seed tree, these studies generated families of increasingly large trees by sequentially adding taxa so that the next tree in a family was formed by placing the current tree and a single leaf on opposite sides of a new root. They saw that across all seed trees of a fixed small size, as the number of leaves grew without bound, the largest numbers of coalescent histories occurred when the seed tree had many different sequences in which its coalescences could take place. Disanto & Rosenberg (2015) constructed a tree family, the lodgepole family, that, unlike caterpillar families, grows so that as the number of leaves increases, trees accumulate both new sequences in which coalescences can take place and new places for them to occur. This family is the family of matching tree pairs (G, G) with the largest-known number of coalescent histories as n increases without bound.
Despite many observations suggesting that coalescent histories tend to increase in number when G has many sequences in which coalescences can take place and many edges on which those coalescences can occur, existing results in support of this view have focused on small trees (Rosenberg, 2007) and on informal interpretations of specific families with large limits as n → ∞ (Rosenberg, 2013;Disanto & Rosenberg, 2016); no result has formally demonstrated the observation in a class of trees for a fixed finite n of arbitrary size. We devise a scenario to formalize this idea characterizing scenarios with the largest numbers of coalescent histories. We fix the species tree S to be a caterpillar, and we consider a family of non-matching gene trees G, the p-pseudocaterpillars. We show that among this class of non-matching pairs (G, S) with fixed n, the largest number of coalescent histories occurs precisely when G combines these two elements: many coalescence sequences, and many edges on which those coalescences can take place.
Our approach is one of relatively few to examine enumerations of coalescent histories in the case that G is not necessarily equal to S (Rosenberg, 2007(Rosenberg, , 2019Than et al., 2007;Rosenberg & Degnan, 2010;Himwich & Rosenberg, 2020). The strategy employs a construction that enumerates coalescent histories for non-matching caterpillar trees. Generalizing a result of Degnan (2005) for enumeration of coalescent histories for matching caterpillar trees, Himwich & Rosenberg (2020) produced a bijection with monotonic paths for use in enumerating coalescent histories for non-matching caterpillar pairs (G, S). We use this monotonic-path construction to enumerate coalescent histories for the class of non-matching trees that considers a caterpillar species tree S and a p-pseudocaterpillar gene tree G.
Section 2 introduces definitions and notation. Section 3 gives an example that motivates the general calculation. In Section 4, we enumerate coalescent histories in the general case. Section 5 gives special cases with specified values of p. Finally, in Section 6, for a specified caterpillar species tree S of fixed size n, considering all possible values of p, we obtain the maximal number of coalescent histories across all non-matching p-pseudocaterpillar trees G. Section 7 discusses a symmetry in p for fixed n, and we conclude with a discussion in Section 8. The computations illustrate how the monotonic path approach of Himwich & Rosenberg (2020) in the case of caterpillar species trees can be extended to enumerate coalescent histories in more cases beyond that of caterpillar gene trees.

Preliminaries
We formally define coalescent histories and p-pseudocaterpillars in Sections 2.1 and 2.2, and we introduce results concerning the Catalan numbers in Section 2.3. In Section 2.4, we describe the use of monotonic paths to enumerate coalescent histories for caterpillar tree pairs.

Coalescent histories
The definitions in this article closely follow Himwich & Rosenberg (2020). Henceforth, we treat all "trees" as binary, rooted, and leaf-labeled, except where specified. The set of vertices or nodes of a tree can be divided into leaf nodes and non-leaf internal nodes. For rooted tree G, we say that a node v 1 is descended from a node v 2 if the shortest path from v 1 to the root of G travels through v 2 ; v 2 is then ancestral to v 1 . Ancestor-descendant relationships also apply to edge-edge pairs and edge-node pairs. A node or edge is trivially descended from and ancestral to itself. Each internal node, including the root, possesses an associated internal edge immediately ancestral to it.
We consider pairs (G, S) in which G represents a gene tree, describing the descent of a set of genealogical lineages, and S represents a species tree, describing the descent of a set of species. G and S are assumed to have the same number of leaves, n. We assume that the leaf set of G and the leaf set of S are labeled by the same label set X, and that each label in X is assigned to exactly one leaf of G and to exactly one leaf of S. This assumption corresponds to an assumption that exactly one gene lineage is sampled in each of the n species.
For the pair (G, S), we can formally define the functions known as coalescent histories.
Definition 1. Consider a pair of trees (G, S) that are binary, rooted, and leaf-labeled, with the labels in bijective correspondence. A coalescent history is a function α from the set of internal nodes of G to the set of internal edges of S, satisfying two conditions: (a) For each internal node v in G, all labels for leaves descended from v in G label leaves descended from edge α(V ) in S.  Both trees have n leaves. The trees are drawn in canonical form, so that the shortest path from the left-most leaf to the root contains all other internal nodes for the caterpillar, and all other internal nodes except one for the p-pseudocaterpillar.
In this definition, nodes of G represent coalescent events for the gene lineages, and edges of S represent species tree edges along which the gene lineages evolve. A coalescent history reflects the biological process of coalescence, in which descendants cannot coalesce farther back in time than their ancestors. Ancestor-descendant relations are preserved under the mapping α.

Caterpillars and p-pseudocaterpillars
As our goal is to enumerate the coalescent histories in the case that G has a p-pseudocaterpillar topology and S has a caterpillar topology, we define caterpillar and p-pseudocaterpillar shapes for binary, rooted tree topologies.
Definition 2. A caterpillar tree is a binary, rooted tree that has an internal node that is descended from all other internal nodes.
In a caterpillar tree, each internal node has at least one leaf as an immediate descendant ( Figure 1A). Equivalently, a caterpillar tree is a tree that has only one cherry node: an internal node with exactly two descendant leaves. Rosenberg (2007) defined binary, rooted pseudocaterpillar trees with n ≥ 4 leaves as trees in which all internal nodes except one have at least one immediate leaf descendant. The node that provides the exception has two cherry nodes as its immediate descendants. We generalize the earlier definition of pseudocaterpillar trees to consider generalized pseudocaterpillar trees. To define this concept, we denote by v L and v R the left and right descendant nodes of an internal node v.
Definition 3. A generalized pseudocaterpillar tree is a binary, rooted tree that has at least four leaves and that satisfies two conditions. (i) The tree possesses exactly two cherry nodes. (ii) For each internal node v, at least one of v L , v R has no more than two descendant leaves.
In other words, a generalized pseudocaterpillar tree is formed from a caterpillar tree, replacing one of the leaves not descended from the unique cherry node by a second cherry node ( Figure 1B).
A generalized pseudocaterpillar can be described by two numbers: the total number of leaves n and the position p of the "second" cherry. To precisely identify p for a generalized pseudocaterpillar tree, we label the leaves by natural numbers starting from left to right, placing the "first" cherry-the one present in the caterpillar from which the generalized pseudocaterpillar has been generated-on the left. We define the position of the second cherry as the number corresponding to its second leaf from the left (Figure 2A). A generalized pseudocaterpillar tree with a second cherry in position p, 4 ≤ p ≤ n, is termed a p-pseudocaterpillar tree. The pseudocaterpillar trees in the sense of Rosenberg (2007) are 4-pseudocaterpillars.
Our interest is in the case in which the gene tree has p-pseudocaterpillar topology for some p, and the species tree has a caterpillar topology. A caterpillar species tree with n leaves has n − 1 edges on which gene tree coalescences can happen; we also label these edges with natural numbers, following the order from Degnan & Salter (2005) (Figure 2B).

Catalan numbers
It is useful to introduce the Catalan number sequence 1, 1, 2, 5, 14, 42, 132, 429, . . ., as it features prominently in our analysis. Letting C n be the nth Catalan number for n ≥ 0, Considering the many combinatorial interpretations of this sequence (Graham et al., 1994;Stanley, 2015), we will make use of the fact that C n is the number of monotonic paths that travel from (0, 0) to (n, n) on a square lattice of size n × n and that do not cross the diagonal connecting (0, 0) to (n, n), where a monotonic path is a path that proceeds exclusively by 1-unit steps up or to the right. A Catalan triangle is a combinatorial structure that counts monotonic paths to points on the lattice that lie on or below the diagonal (Reuveni, 2014). Entry (n, k) of the Catalan triangle gives the number of monotonic paths on the square lattice that travel from the origin to a point (n, k) and that do not cross the y = x line. The number of such paths, which have n "right-steps" and k "up-steps," is (Reuveni, 2014): For n ≥ 1 and 1 ≤ k ≤ n, this function satisfies the first-order recurrence C(n, k) = C(n − 1, k) + C(n, k − 1).
A Catalan trapezoid is obtained in a similar way, except that we allow additional m − 1 up-steps to happen starting at the origin, so that monotonic paths that do not travel above the diagonal from (0, m − 1) to (n, n + m − 1) are tabulated. The number m is called the order of the trapezoid; m = 1 corresponds to the Catalan triangle. Entry (n, k) of the Catalan trapezoid of order m is given by and it satisfies a similar recurrence C t (n, k, m) = C t (n − 1, k, m) + C t (n, k − 1, m) for n ≥ 1 and 1 ≤ k ≤ n + m − 1. With the origin in the lower left corner, the first colums of the Catalan triangle

Bijection between coalescent histories and monotonic paths for caterpillars
Building on work of Degnan (2005), the bijective construction of Himwich & Rosenberg (2020) enumerates coalescent histories for pairs consisting of a caterpillar gene tree and a caterpillar species tree by bijectively associating each coalescent history with a monotonic path that does not cross the diagonal of a square lattice. The coalescent histories are then enumerated by counting the bijectively-associated monotonic paths.
In the construction, given a caterpillar species tree S and a caterpillar gene tree G with n leaves, a square (n − 1) × (n − 1) lattice is examined. The coalescent histories for (G, S) correspond to monotonic paths from (0, 0) to (n − 1, n − 1), with each right-step corresponding to a species tree internal edge, and each up-step corresponding to a gene tree coalescence. The pair (G, S) specifies a set of roadblocks, points in the lattice through which monotonic paths are not permitted to travel. The number of coalescent histories for (G, S) then equals the number of monotonic paths that do not cross the diagonal and that do not travel through any of the roadblocks. In the case that G and S have the same caterpillar labeled topology, no roadblocks exist, and the number of monotonic paths, and hence the number of coalescent histories, is the Catalan number C n−1 (Degnan, 2005).
The construction of Himwich & Rosenberg (2020) also applies to caterpillar subtrees. Suppose G possibly has fewer leaves than S, so that the label set for G is a subset of the label set for S. If we use the term partial coalescent history to describe mappings that satisfy Definition 1 except that the label set of G is a subset of the label set of S rather than a bijectively-associated label set, then the number of partial coalescent histories for a caterpillar pair (G, S) is obtained by counting roadblocked monotonic paths to an associated point that is not necessarily the point (n − 1, n − 1).
For details, see Himwich & Rosenberg (2020). We illustrate the construction in an example. The arrow indicates that all coalescences other than those depicted in the diagram have already happened by the starting point, the first species tree internal edge ancestral to F.

Example
Our approach to extending the construction of Himwich & Rosenberg (2020) to count coalescent histories for a caterpillar species tree and a non-matching p-pseudocaterpillar gene tree-a tree with one extra cherry-can be understood with an example. Consider a gene tree G with 10 leaves, with cherry node (E,F) as shown in Figure 3A, and a species tree S as shown in Figure 3B.
The key to counting coalescent histories for (G, S) is to examine the specific gene tree coalescence circled in red in Figure 3A, indicating the most recent common ancestor of both cherries of G. We call this node the pivotal coalescence. In a coalescent history, this pivotal coalescence can take place on any internal edge ancestral to species F in the species tree. We partition all coalescent histories for (G, S) by the position of this pivotal coalescence. For each placement of the pivotal coalescence, we then count the number of coalescent histories by counting monotonic paths on particular diagrams for the subtrees generated by the pivotal coalescence.
Suppose the pivotal coalescence of G happens on edge 5 of S. Then all the coalescences in the "left" subtree descended from the pivotal coalescence must happen on or before edge 5. This left subtree is now a caterpillar (((A,B),C),D), coalescing on a caterpillar (((((A,B),C),D),E),F). We can now follow the construction of Himwich & Rosenberg (2020) to enumerate partial coalescent histories through a bijection with monotonic paths.
In particular, the number of ways that the gene tree coalescences of (((A,B),C),D) can occur on species tree (((((A,B),C),D),E),F) is equal to the number of monotonic paths on a Catalan triangle restricted to 5 right-steps and 3 up-steps ( Figure 4A). The up-steps correspond to the 3 coalescences in the subtree (((A,B),C),D), and the right-steps correspond to the 5 edges of (((((A,B),C),D),E),F) on which they can take place. Following eq. (2), the number of monotonic paths that travel from (0, 0) to (5,3) and that do not cross the diagonal is 8 3 − 8 2 = 28. Because gene tree coalescence (E,F) must occur on species tree edge 5 when the pivotal coalescence occurs on edge 5, coalescence (E,F) does not introduce additional coalescent histories. Thus, 28 possible partial coalescent histories place the pivotal coalescence on species tree edge 5.
We now need to consider the coalescences ancestral to the pivotal coalescence. Coalescences involving leaf G can happen on edge 6 or on any edge ancestral to 6, coalescences with leaf H can happen on edge 7 or any edge ancestral to 7, provided that leaf G has already participated in a coalescence, and so on. Again following the construction of Himwich & Rosenberg (2020), the possible assignments of gene tree coalescences to species tree edges in this upper part of the species tree can be described by a Catalan triangle with 4 right-steps and 4 up-steps ( Figure 4B). There are 14 possible monotonic paths.
To obtain the total number of coalescent histories with pivotal coalescence on edge 5, we now multiply the two numbers we already have: for each of the 28 partial coalescent histories for coalescences descended from the pivotal coalescence, there are 14 ways for the coalescences ancestral to it to happen. Hence, 392 coalescent histories exist with pivotal coalescence on edge 5.
To obtain the total count of coalescent histories for (G, S), we must consider all other possible locations of the pivotal coalescence, and sum their associated numbers of coalescent histories. With this idea, however, we are now ready for the general case.

General construction
The example in Section 3 illustrates that we can enumerate coalescent histories for a p-pseudocaterpillar gene tree and a caterpillar species tree by dividing the problem into three components: placement of the pivotal coalescence, and two enumerations, one for coalescences descended from the pivotal coalescence, and the other for coalescences ancestal to it. We describe these two enumerations in full generality, and complete the calculation by summing over all placements of the pivotal coalescence.
Consider a p-pseudocaterpillar gene tree G and a caterpillar species tree S, both with n leaves, and bijectively labeled with the same set of distinct labels. Suppose G and S have an identical leaf labelling, by which we mean that when G and S are drawn in canonical form (Figure 2), the gene tree and species tree labels are listed in the same order when reading them from left to right. Figure 3 illustrates an identical leaf labeling. Note that labelings in which the labels in one or both cherries of G are transposed with respect to S also qualify as identical.
Using our numerical labeling scheme for edges of gene trees and species trees (Figure 2), the pivotal coalescence can take place on any species tree edge from p − 1 to n − 1. Suppose it happens on edge k, p − 1 ≤ k ≤ n − 1.

Coalescences descended from the pivotal coalescence
Label by S k the subtree of S whose root is the node immediately descended from edge k. Label the subtree of G whose root node is the pivotal coalescence by G * . The left subtree of G * , which we label G * , is a caterpillar with p − 3 coalescences. By the assumption that the pivotal coalescence takes place on species tree edge k, all coalescences in G * must occur on edges 1, 2, . . . , k.
Following Himwich & Rosenberg (2020), the partial coalescent histories for (G * , S k ), with p − 3 gene tree coalescences and k species tree edges on which they take place, correspond to monotonic paths from (0, 0) to (k, p − 3) that do not cross the y = x line. The number of partial coalescent histories therefore corresponds to Catalan triangle entry (k, p − 3). By eq. (2), this quantity, which we denote k , equals The right subtree of G * , or G * r , has exactly one coalescence, which can happen on any of the branches p − 1, p, . . . , k. Hence, the number of coalescent histories for (G * r , S k ) is Exchanging the starting and ending points of monotonic paths, the number of monotonic paths in a trapezoidal lattice is equal to an entry in a Catalan triangle. Following the notation of Figure 3 with n = 10 and p = 6, suppose the pivotal coalescence happens on species tree edge k = 7. Up to two additional coalescences can happen on edge k = 7, producing a trapezoid. The number of monotonic paths is obtained from a Catalan trapezoid of order k − p + 2 = 3 with n − k − 1 = 2 right-steps and n − p = 4 up-steps, or by symmetry, by computing entry (n − p, n − k − 1) = (4, 2) of a Catalan triangle. (B) Monotonic path construction for each of the n − p + 1 = 5 options for placement of the pivotal coalescence. For a placement of the pivotal coalescence shown in the left-hand diagram, the number of coalescent histories for (G * , S) is obtained by counting monotonic paths in the right-hand diagram from the lower-left vertex to an associated point on the right-hand edge.
Combining the left and right subtrees of G * , from eqs. (4) and (5), the number of partial coalescent histories for (G * , S k ) is k r k .

Coalescences ancestral to the pivotal coalescence
To examine coalescences ancestral to the pivotal coalescence, the pivotal coalescence can be viewed as a "leaf" of a caterpillar gene tree G * whose coalescences occur on species tree edges numbered k or greater. In this view, G * is the (n − p + 1)-leaf caterpillar tree in which the subtree rooted at the pivotal coalescence is replaced by a leaf, so that the pivotal coalescence is a leaf in the cherry of G * . G * has n − p gene tree coalescences, which take place on species tree edges k, k + 1, . . . , n − 1, a total of n − k edges. It is possible for multiple coalescences in G * to occur on branch k; taking into account that branch k has k + 1 descendant leaves, and p − 1 coalescences have already occured including the pivotal coalescence, at most k − p + 1 coalescences of G * can occur on branch k.
The coalescences of G * therefore correspond to monotonic paths that do not cross a specified diagonal of a trapezoidal lattice. The number of right-steps is n − k − 1, one for each non-root edge on which coalescences take place, and the number of up-steps is n − p, one for each gene tree coalescence in G * . The order of the trapezoid is k − p + 2, one more than the number of coalescences of G * that can occur on the initial branch k.
We can count these monotonic paths using eq. (3), or by noting that the number of monotonic paths is symmetric with respect to interchange of the starting and ending points. By symmetry, the number of paths on a Catalan trapezoid is then equal to one of the entries in the right-most column of some Catalan triangle. We have A visual explanation appears in Figure 5. Denote by u k the number of coalescent histories for (G * , S). Using eq. (3) or the symmetry argument with eq. (2) to count monotonic paths in a triangular lattice with n − p right-steps and n − k − 1 up-steps, we have

Full formula
We have shown that the number of partial coalescent histories for (G * , S) that place the pivotal coalescence on edge k is k r k , and that for each of these partial coalescent histories, the number of partial coalescent histories for (G * , S) is u k . Because each coalescent history for (G, S) consists of a partial coalescent history for (G * , S), a placement of the pivotal coalescence, and a partial coalescent history for (G * , S), the number of coalescent histories for the case in which the pivotal coalescence happens on edge k is k r k u k . Summing over values of k, we have proven the following theorem.
Theorem 4. Consider a caterpillar species tree S with n ≥ 4 leaves and an identically-labeled p-pseudocaterpillar gene tree G with n leaves and 4 ≤ p ≤ n. With C(n, k) as in eq.
(2), the number of coalescent histories for (G, S) is Note that eq. (8) can be seen to apply for (n, p) with p = 3 and 3 ≤ p ≤ n, and hence for n = 3. In this case, G is viewed as a caterpillar gene tree whose cherry joins leaves 2 and 3. G * has no coalescences, so k = 1; this enumeration accords with the definition of the function C in eq. (2), where we have C(k, p − 3) = C(k, 0) = 1 for all k.
A convenient form of Eq. (8) for computation is as follows:

Identical and non-identical leaf labelings
The results of Himwich & Rosenberg (2020) enable a result on leaf labelings. We claim that for a fixed caterpillar species tree, an identically-labeled p-pseudocaterpillar gene tree-the focus of our analysis-has strictly more coalescent histories than any non-identically-labeled p-pseudocaterpillar.
The argument is that any non-identically-labeled gene tree introduces at least one "roadblock," decreasing its associated number of monotonic paths compared to the case of identical labels.
Proposition 5. Consider a caterpillar species tree S with n ≥ 4 leaves and a value of p, 4 ≤ p ≤ n. The number of coalescent histories for (G, S), with G a p-pseudocaterpillar gene tree bijectively labeled with the same n labels as S, is bounded above by h(n, p), with equality if and only if G and S are identically labeled.
Proof. Theorem 4 demonstrates that the number of coalescent histories is h(n, p) in the identicallylabeled case. We must show that a non-identically-labeled G produces fewer coalescent histories. Fix n and p. Consider caterpillar species tree S and p-pseudocaterpillar gene tree G, bijectively labeled with n labels {A 1 , A 2 , . . . , A n }, but not necessarily identically labeled. Suppose that from left to right, A 1 , A 2 , . . . , A n label the leaves of S when S appears in canonical form.
In eq. (8), the form of the equation h(n, p) = n−1 k=p−1 k r k u k has a sum from k = p − 1 to n − 1 of a product of three quantities. Each quantity counts the number of monotonic paths on a Catalan triangle-trivially so in the case of r k = C(k − p + 2, 1) = k − p + 2, which represents the number of monotonic paths that proceed k − p + 2 steps to the right and one step up.
If we now change G to a possibly non-identically-labeled p-pseudocaterpillar G , then the coalescent histories can be enumerated by a corresponding decomposition h (n, p) = n−1 k=p−1 k r k u k , where, with the pivotal coalescence on edge species tree edge k, k , r k , and u k count partial coalescent histories for (G * , S k ), (G * r , S k ), and (G * , S), respectively.
To demonstrate that h (n, p) < h(n, p), we argue that k ≤ k , r k ≤ r k , and u k ≤ u k , and that for G = G, at least one of these inequalities is strict. Following the argument of Corollary 11 of Himwich & Rosenberg (2020), the quantities k , r k , and u k count monotonic paths that do not cross the y = x line, that respectively proceed from (0, 0) to (k, p − 3), (0, 0) to (k − p + 2, 1), and (0, 0) to (n − p, n − k − 1), possibly with roadblocks.
When G = G, no roadblocks occur, so that k ≤ k , r k ≤ r k , and u k ≤ u k . When G = G, however, at least one of the following three statements holds: (i) G * = G * ; (ii) G * r = G * r ; (iii) G * = G * . In the first case, for at least one k, a roadblock occurs in tabulating coalescent histories for G * , so that k < k . Similarly, in the second case, for at least one k, a roadblock occurs in tabulating coalescent histories for G * r , so that r k < r k ; in the third case, for at least one k, a roadblock occurs in tabulating coalescent histories for G * , so that u k < u k .
Note that for the sum describing the number of coalescent histories of (G, S) to even proceed over the full range from k = p − 1 to n − 1, the first p labels of G from left to right when G is written in canonical form must be a permutation of A 1 , A 2 , . . . , A p . Otherwise, at least one label of G must be indexed by a value that exceeds p and therefore cannot descend from edge p − 1 of S.

Small p
The case of identically-labeled G and S produces the largest number of coalescent histories among all p-pseudocaterpillar gene trees and caterpillar species trees with fixed (n, p) and p ≥ 4. Note that for p = 3, the case of identically-labeled G and S produces more coalescent histories than any non-identically-labeled pair; both G and S are caterpillars in this case, and fixing n, the number of coalescent histories for matching caterpillars exceeds the number of coalescent histories for any non-matching pair of caterpillars (Himwich & Rosenberg, 2020, Corollary 11).
We now return to the case of identically-labeled (G, S) and evaluate eq. (8) for fixed small p.

Exact formulas for fixed p
Fixing the variable p allows us to obtain exact formulas for h(n, p) as a rational function of n. The smallest case is p = 3, so that the function h(n, 3) is defined for all n ≥ 3:   (8)). Wilf-Zeilberger proof certificates appear in Appendix A. The next three terms for lim n→∞ [h(n, p)/C n−1 ] are 179587/65536 for p = 10, 384199/131072 for p = 11, and 1631605/524288 for p = 12.
We rewrite the summand for h in the expanded form from eq. (9). We then obtain the sum using the Wilf-Zeilberger algorithm for computing sums that involve binomial coefficients.
Proposition 6. For all n ≥ 3, the following identity holds Proof. First, let m = n − 1. Let the function F (m, k) be the ratio of the summand to the right-hand side of eq. (10): This function and a proof certificate satisfy the assumptions of the Wilf-Zeilberger theorem (Petkovšek et al., 1996, Theorem 7.1.1). Hence, the sum m k=2 F (m, k) does not depend on m. We know that m k=2 F (m, k) = 1 when m = 2, from which eq. (10) follows by substituting n = m + 1.
It is convenient to write eq. (10) as a product of a rational function of n and a Catalan number, For other small values of p, we follow the proof in Proposition 6 to obtain analogous expressions ( Table 1). The corresponding proof certificates R(m, k) appear in Appendix A.

Asymptotic behavior for small p
We can extend beyond the exact formulas for h(n, p) for small p in Section 5.1 to show that for each fixed p, there exists a constant β p such that lim n→∞ h(n, p) ∼ β p C n−1 . The approach follows Disanto & Rosenberg (2016), who considered matching gene trees and species trees in caterpillar-like families, in which trees had a caterpillar shape with the caterpillar subtree of size replaced by a "seed tree" t of size . They assumed G = S = t (n) , with t (n) consisting of t augmented by n "caterpillar branches" appended to its root. The framework makes use of additional definitions. An r-extended coalescent history is a coalescent history for the case in which a species tree is assumed to have its root-branch divided into m ≥ 1 components (Rosenberg, 2007). Labeling these components from 1 to r with branch 1 closest to the species tree root, an m-rooted coalescent history is an r-extended coalescent history in which the gene tree root coalesces on species tree branch m, 1 ≤ m ≤ r. The number of m-rooted coalescent histories h n,m for G = S = t (n) then equals h n,m = e n,m − e n,m−1 , with e n,0 = 0. Disanto & Rosenberg (2016) devised an iterative procedure for obtaining the coalescent histories for t (n+1) from the coalescent histories for t (n) , n ≥ 0. For a fixed seed tree t, the generating function for the sequence h 0,m (t) counting m-rooted coalescent histories for t is written The bivariate generating function for the sequence h n,m (t), counting m-rooted histories for (G, S) = (t (n) , t (n) ), is denoted The univariate generating function f (z) for the sequence h n,1 (t) counts coalescent histories for (G, S) = (t (n) , t (n) ), satisfying f (z) = ∞ n=0 h n,1 (t) z n = ∂F (0, z) ∂y . (2016) obtained the result

Disanto & Rosenberg
By examining the expansion of f (z) around its dominant singularity, they showed that given t, there exists a positive constant β t such that h n,1 (t) ∼ β t C n−1 . The construction of Disanto & Rosenberg (2016) that enumerated coalescent histories of t (n+1) from those of t (n) does not use G = S. Thus, it applies for identically-labeled caterpillar-like families generated from nonmatching seed trees t G and t S of the same size, as does the associated procedure for obtaining the generating function f (z) for the number of coalescent histories for caterpillar-like families with p-pseudocaterpillar G and identically-labeled caterpillar S.
We first derive an expression for e (n,p),r , the number of r-extended coalescent histories for the p-pseudocaterpillar gene tree of n ≥ p leaves on an identically-labeled caterpillar species tree of n leaves. In our notation, dividing the root-branch amounts to adding right-steps on the diagram for u k (Section 4.2) and increasing the range of the index k. We have e (n,p),r = n+r−2 k=p−1 C(k, p − 3) (k − p + 2) C t (n − p, n + r − k − 2, r).
To obtain this expression, note that the extension of the species tree from 1 to r branches ancestral to the root does not affect the C(k, p − 3) and k − p + 2 terms, representing coalescences descended from the pivotal coalescence. However, the Catalan trapezoid that tabulates coalescent histories ancestral to the pivotal coalescence is affected. The number of coalescences ancestral to the pivotal coalescence continues to be n − p. The number of available branches is now n + r − k − 2 instead of n − k − 1. Traversing the paths "forward," the trapezoid has order k − p + 2, one more than the number of coalescences that can occur on the species tree branch on which the pivotal coalescence takes place, giving a count of C t (n + r − k − 2, n − p, k − p + 2) (eq. (3)). The number of vertices on the upper edge of the trapzeoid is r, so that if paths are traversed in reverse order, the number of r-extended coalescent histories is, equivalently, C t (n − p, n + r − k − 2, r).
Each function gives the values h(n, p) (eq. (8)) as n is incremented beginning with n = p. For p-pseudocaterpillar gene trees, we can compare the values for the limiting constants β p for two choices of the species tree S: the case in which the species tree has the same p-pseudocaterpillar labeled topology, and the case of an identically-labeled caterpillar species tree. The former value, from Disanto & Rosenberg (2016), exceeds the latter for p = 3 and p = 4 (Table 3). For p = 5 to p = 9, however, β p for the non-matching caterpillar S exceeds that for a matching p-pseudocaterpillar. Rosenberg & Degnan (2010) had shown that the case of a 4-pseudocaterpillar gene tree and an identically-labeled caterpillar species tree produced more coalescent histories (β p = 1.1875) than the case of matching caterpillar gene tree and species tree (C n−1 coalescent histories, and hence a limiting ratio of 1). The table demonstrates that p-pseudocaterpillar gene trees for each p from 5 to 9 also produce more coalescent histories than the matching caterpillar gene tree.
6 Maximal number of coalescent histories for fixed n Applying Theorem 4, we can calculate h(n, p) systematically for small n and all p with 3 ≤ p ≤ n. Table 4 shows the values of h(n, p) for all (n, p) with n ≤ 12. Table 2: Generating functions. Generating function g p (y) counts m-rooted histories h (p,p),m for caterpillar-like families with a seed p-pseudocaterpillar gene tree and identically-labeled caterpillar species tree (eq. (14)); generating function f p (z) counts coalescent histories h (p,p),m (eq. (15)).  The table suggests two patterns. First, we can see that a symmetry exists in which h(n, p) = h(n, n − p + 3). We will verify this symmetry in Section 7. Second, we can observe that for each n, the value of p that maximizes h(n, p) lies in the middle, repeating for two adjacent values of p when n is even. We state this result formally in the following theorem.
Theorem 7. Consider a caterpillar species tree S with n ≥ 4 leaves. Among identically-labeled p-pseudocaterpillar gene trees G with n leaves and 3 ≤ p ≤ n, the value of p that maximizes the number of of coalescent histories h(n, p) for (G, S) is if n is odd. If n is even, then two adjacent maxima exist: For n = 3 and n = 4, the result is trivial, as n = 3 requires p = 3, and for n = 4, h(n, 3) = h(n, 4) = 3. For n ≥ 5, the proof proceeds in three steps.   (8)) for small values of n and p.
1. First, in Section 6.1, for n ≥ 5 and 4 ≤ p ≤ n, we describe a difference function D(n, p) that measures the change in the function h(n, p) when we increment p by 1 for fixed n.
2. Next, in Section 6.2, we show that the difference function D(n, p) is positive for p = 4 (Lemma 8) and negative for p = n (Lemma 9), and that it monotonically decreases as the integer p is incremented from 4 to n (Lemma 10).
3. Finally, in Section 6.3, we deduce that for fixed n ≥ 5, if D(n, p) = 0 for all p, 4 ≤ p ≤ n, then a unique integer p exists at which h(n, p) is maximal; two maxima exist if D(n, p) = 0 for some p. We confirm that the maxima of h(n, p) are described by eqs. (16) and (17).

Difference function
For n ≥ 5 and 4 ≤ p ≤ n, we define the difference function of h(n, p): Because h(n, p) is defined as a sum, D(n, p) is also an expression involving a summation. We find a closed-form expression for D(n, p). We start by expanding eq. (18) using eq. (9): Notice that because the sums in expressions for h(n, p) and h(n, p − 1) have different summation limits, we obtain an additional term outside the sum. The sum in the expression for D(n, p) can be transformed into a closed form, which gives the following formula: 16 The proof appears in Appendix B.

Sign of the difference function
Using eq. (19) for D(n, p), we prove three lemmas concerning the sign of D(n, p).
Lemma 8. For p = 4, the function D(n, p) is positive for all n ≥ 5.
Proof. When we substitute p = 4 into eq. (19), we obtain Because n ≥ 5, all terms in this fraction are positive.
Lemma 9. For p = n, the function D(n, p) is negative for all n ≥ 5.
Proof. Substituting p = n into eq. (19), we obtain For n ≥ 7, D(n, n) is quickly seen to be a sum of two negative numbers. It remains to check the cases of n = 5 and n = 6: D(5, 5) = −2 and D(6, 6) = −9.
Lemma 10. D (n, p) = D(n, p) − D(n, p − 1) is negative for n ≥ 5 and 5 ≤ p ≤ n. That is, for each n ≥ 5, D(n, p) monotonically decreases as the integer p is incremented from p = 4 to p = n.
The left-hand term is bounded above by 3 for all n ≥ 5, and the right-hand term exceeds n for all n ≥ 5. Hence, because 5 ≤ p ≤ n, all possible values of (n, p) satisfy the inequality.

Location of the maximum
As a result of Lemmas 8-10, for n ≥ 5, as p is incremented from 4 to n, D(n, p) monotonically decreases (Lemma 10) from a positive value at p = 4 (Lemma 8) to a negative value at p = n (Lemma 9). Hence, h(n, p) increases from p = 3 to a maximum then decreases until p = n. Two cases are possible. Given n, a unique value p = p m1 could exist at which D(n, p) = 0, in which case h(n, p m1 ) = h(n, p m1 − 1), and both p m1 and p m2 = p m1 − 1 are maxima. Alternatively, if D(n, p) = 0 for all p, then h(n, p) is maximized at the largest value of p for which D(n, p) > 0.

Asymptotic growth of the maximal number of coalescent histories
With the value p m that maximizes h(n, p) established, we now examine the asymptotic growth of the maximum. We quickly verify that for a fixed caterpillar species tree with n leaves, across all p-pseudocaterpillar gene trees with fixed n, the maximal number of coalescent histories grows faster than the Catalan number C n−1 describing the number of coalescent histories for the matching caterpillar. In Section 5.2, we showed that for fixed small p ≥ 4, as n increases, the number of coalescent histories grows with a constant multiple of C n−1 , with the constant exceeding 1. Here we show that for each n ≥ 7, the maximal number of coalescent histories, that is, h(n, p m ) for odd n and h(n, p m1 ) = h(n, p m2 ) for even n, exceeds the corresponding Catalan number.
For short, we abbreviate p m = p m1 = p m2 for even n, so that the sequence of values of h(n, p m ) is well-defined for n ≥ 4. We introduce the definition of the exponential order of the sequence: a sequence {a n } has exponential order k if lim sup n→∞ n √ a n = k (Flajolet & Sedgewick, 2009). In other words, a n = k n s(n) where s(n) is a subexponential factor with lim sup n→∞ n s(n) = 1. If sequences a n and b n have the same exponential order, we write a n b n .
The Catalan numbers C n have exponential order 4, as Stirling's approximation to C n = (2n)! /[(n+ 1)(n! ) 2 ] gives C n ≈ 4 n /(n 3/2 √ π). Plotting log h(n, p m ) and log C n−1 as functions of n, we see that they grow approximately linearly with similar slopes (Figure 6). We therefore claim that the sequence h(n, p m ) also has exponential order 4.
Proposition 13. For caterpillar species trees with n leaves, the sequence h(n, p m ) describing the maximal number of coalescent histories across all p-pseudocaterpillar gene trees of size n has exponential order 4, so that h(n, p m ) C n . Quantity log h(n, p m ) log  n − 1 Figure 6: For caterpillar species trees of size n, the natural logarithms of the maximal number of coalescent histories across p-pseudocaterpillar gene trees (h(n, p m )) and the number of coalescent histories of the matching caterpillar gene tree topology (C n−1 ). The quantity h(n, p m ) is computed according to Theorem 7, and C n−1 follows eq. (1).
Proof. By Lemmas 17 and 19 in Appendix C, C n−2 ≤ h(n, p m ) ≤ n C n+2 for n ≥ 3, from which lim n→∞ n C n−2 ≤ lim n→∞ n h(n, p m ) ≤ lim n→∞ n n C n+2 .
As the left-hand and right-hand limits both equal 4, we conclude lim n→∞ n h(n, p m ) = 4, h(n, p m ) = 4 n s(n) for some subexponential s(n), and h(n, p m ) C n .

Symmetry
We now verify the symmetry h(n, p) = h(n, n − p + 3) observed in Table 4 for all (n, p) with 3 ≤ p ≤ n. For convenience, given a pseudocaterpillar tree with second cherry at position p, we define its dual as the pseudocaterpillar tree with second cherry at position n − p + 3 (Figure 7).
We show that for a fixed caterpillar species tree, the number of coalescent histories of an identically-labeled pseudocaterpillar is equal to the number of coalescent histories of its dual. The formula for the number of coalescent histories has a symmetry in the position of the second cherry on the p-pseudocaterpillar gene tree.
1. First, in Section 7.1, we introduce a dual difference function D * (n, p) that measures the change in h(n, n − p + 3) as p is incremented for fixed n.
2. Next, in Section 7.2, we show that the dual difference function D * (n, p) is equal to the regular difference function D(n, p) for all allowed values of (n, p). 3. Finally, in Section 7.3, we use this equality of difference functions to complete the proof of the symmetry of h(n, p).

Dual difference function
We define a function D * "dual" to the difference function D (eq. (18)): The function is well defined for n ≥ 5 and 4 ≤ p ≤ n, where n − p + 3 and n − p + 4 lie in [3, n].
Using the definition of h(n, p) from eq. (9), we obtain This sum can be simplified to get a closed form for D * : The proof appears in Appendix D.

Dual difference function is equal to the difference function
This section verifies the equality of the difference function and its dual.
Lemma 15. For all n ≥ 5 and 4 ≤ p ≤ n, the dual difference function equals the difference function D * (n, p) = D(n, p).
In particular, for each p from 3 to n, h(n, p) − h(n, n − p + 3) = −[h(n, p) − h(n, n − p + 3)]. Both sides of this equation must then equal zero, from which we conclude h(n, p) = h(n − p + 3) for each p, 3 ≤ p ≤ n. The proof of Theorem 14 is complete.

Discussion
We have developed a method for counting coalescent histories in cases in which the gene tree and species tree topologies do not match, considering p-pseudocaterpillar gene trees together with an identically-labeled caterpillar species tree. Using a combinatorial construction, we find that the recursive formula from Rosenberg (2007) can be evaluated non-recursively as a sum (eq. (9))-which can in turn be simplified to a closed form for fixed small p (Section 5). The number of coalescent histories h(n, p) (eq. (8)) has a symmetry in p (Theorem 14), and the maximum over values of p for each n is attained when the "second cherry" lies in the "middle" of the gene tree (Theorem 7).
Results on the value of p that maximizes h(n, p) verify an informal observation from previous studies. It has been noted that for fixed n, large numbers of coalescent histories tend to occur when two conditions are met: the number of distinct sequences in which coalescences can take place is large, as is the number of species tree branches describing potential placements of those coalescences (Rosenberg, 2007(Rosenberg, , 2013Rosenberg & Degnan, 2010;Disanto & Rosenberg, 2015, 2016. For a fixed caterpillar species tree, identically-labeled p-pseudocaterpillar gene trees represent a tradeoff of these two features. As p increases, more sequences exist for coalescences descended from the pivotal coalescence. However, the number of species tree branches on which the pivotal coalescence can occur decreases, so that fewer species tree branches exist on which the larger number of coalescence sequences can occur. That h(n, p) is maximized when p lies in the "middle" aligns with the informal observation that both conditions-many coalescence sequences, and many species tree branches on which coalescences take place-are important for generating large numbers of coalescent histories. Table 5 compares coalescent histories in three cases: matching caterpillars, matching ppseudocaterpillars, and caterpillar species trees with identically-labeled non-matching p-pseudocaterpillar gene trees. For a caterpillar species tree, as the number of species n grows to 9 or greater, the number of coalescent histories for identically-labeled p-pseudocaterpillar gene trees with 4 ≤ p ≤ n − 1 exceeds the Catalan number of coalescent histories for the matching gene tree (Proposition 12). For fixed p, more coalescent histories can occur for the non-matching p-pseudocaterpillar gene tree and identically-labeled caterpillar species tree than for matching p-pseudocaterpillars (Tables 3 and 5).
In related work, Disanto & Munarini (2019) considered matching caterpillar gene trees and species trees, identifying the leaf whose replacement by a cherry in both trees would give rise to the greatest increase in the number of coalescent histories (measured as a ratio). This speciation-the splitting of a leaf node of G and S into two child nodes-can be interpreted as extending the trees by adding the "second cherry" that converts a caterpillar into a p-pseudocaterpillar. Disanto & Munarini (2019) determined the value of p with which the p-pseudocaterpillar tree pair with n leaves would have the largest number of coalescent histories. Asymptotically, this value of p is equal to n 2 (Disanto & Munarini, 2019, i * (n) for D n in Table 1)-"in the middle," as in our result in Section 6. Theorem 7 can then be seen to prove an analogous result in a nonmatching case, as the gene tree gains a cherry node whereas the species tree gains only a caterpillar leaf.
Our p = 3 case has a direct geometric interpretation in the framework of Himwich & Rosenberg (2020), as it describes a non-matching pair of caterpillar trees ( Figure 8). Its coalescent histories are described by monotonic paths on a lattice with a single roadblock. The p = n case, for which the number of coalescent histories is equal to the p = 3 case, can also be represented in a diagram with one roadblock, obtained by reflecting monotonic paths of the p = 3 case across y = n−1−x. Because monotonic paths not crossing the y = x diagonal of a square lattice correspond to Dyck paths, and the coalescent histories for p = 3 correspond to Dyck paths beginning with two up-steps, the sequence a n = h(n, 3) = h(n, n) for n ≥ 3 gives the number of Dyck paths of length n − 1 beginning with two up-steps (OEIS A000245). We can also write h(n, 3) = h(n, n) = a(n) = C n−1 − C n−2 .
Our work provides an extension of an earlier study of coalescent histories for non-matching caterpillars (Himwich & Rosenberg, 2020). We expect that the method we have used has potential for extension to cases with more than two cherries, with the species tree remaining a caterpillar. In such an extension, each additional cherry would generate an additional "pivotal" coalescence and an additional summation based on the placement of that coalescence. The p = n case can also be seen to correspond to roadblocked monotonic paths. The second-to-last coalescence EF can occur only on the branch ancestral to the species tree root.
A Wilf-Zeilberger certificates for formulas in Table 1 This appendix gives the proof certificates for the identities in Table 1, all of which have similar proofs to Proposition 6. Only the Wilf-Zeilberger proof certificate R(m, k) differs across the cases. We list the proof certificates for the remaining identities in Table 6. Table 6: Wilf-Zeilberger proof certificates R(m, k) for expressions in Table 1 p R(m, k) B Proof of the closed form for D(n, p) from eq. (19) In this appendix, we prove the closed-form expression for the difference function D(n, p). In particular, we focus on the term that contains a summation over k.
We obtain the statement of the lemma by algebraic simplification of the right-hand side of eq. (25).

C Proofs of inequalities required for the proof of Proposition 13
In the proof of Proposition 13, we make use of lower and upper bounds for h(n, p m ). First, we prove the lower bound.
To prove the upper bound, we first need an identity concerning Catalan numbers.
Lemma 18. For n ≥ 3, the Catalan number C n can be decomposed as a sum.
We are now ready to prove the upper bound.
Proof. We split the proof into two cases, according to the expressions for p m from Theorem 7.
As is true in the even case, the summand is termwise nonnegative, as is the remaining term. We conclude that for odd n, h(n, p m ) ≤ n C n+2 , completing the proof.
D Proof of the closed form for D * (n, p) from eq. (21) Here we prove the closed-form expression for the dual difference function in eq. (21) from Section 7.1.
Proof. As in Appendix B, let ∆ k denote the forward difference operator in k, meaning that ∆ k (f ) = f (k + 1) − f (k). Let f (n, p, k) be the summand in the expression for F (n, p).
With h as in eq. (27), eq. (26) is verified algebraically. After summation of eq. (26), the left-hand side becomes F (n, p), and the right-hand side telescopes. All terms except the first and the last cancel, leaving F (n, p) = h n,p (n) − h n,p (n − p + 3).
The lemma then follows by algebraic simplification of the right-hand side of eq. (28).