Parsimony and the rank of a flattening matrix

The standard models of sequence evolution on a tree determine probabilities for every character or site pattern. A flattening is an arrangement of these probabilities into a matrix, with rows corresponding to all possible site patterns for one set A of taxa and columns corresponding to all site patterns for another set B of taxa. Flattenings have been used to prove difficult results relating to phylogenetic invariants and consistency and also form the basis of several methods of phylogenetic inference. We prove that the rank of the flattening equals \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$r^{\nu _T(A|B)}$$\end{document}rνT(A|B), where r is the number of states and \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\nu _T(A|B)$$\end{document}νT(A|B) is the minimum size of a vertex cut separating A from B. When T is binary the rank of the flattening equals \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$r^{\ell _T(A|B)}$$\end{document}rℓT(A|B) where \documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\ell _T(A|B)$$\end{document}ℓT(A|B) equals the parsimony length of the binary character separating A and B. We provide a direct proof that requires little more than undergraduate algebra, but note that the formula could also be derived from work by Casanellas and Fernández-Sánchez (2011) on phylogenetic invariants.


Introduction
Behind any statistical inference in phylogenetics is a model of describing the evolution of the states (alleles/nucleotides/amino acids) observed at each site in the alignment.Under the standard model, this evolution is determined by three types of parameters: the phylogeny itself, the distribution of the state at the root and the transition probabilities along each edge.Together these generate the joint distribution for the state at each leaf, which in turn corresponds to a column of the alignment (reviewed in [10,15]).An example of patterns or sites on a four taxa tree.The 16 possible patterns are listed in the table on the right -any one of these could be the pattern for a particular site.
An assignment of states to the taxa is often called a pattern.If there are r states (say r " 2 for binary, r " 4 for nucleotide, r " 20 for amino acids) and n taxa then there are r n possible patterns.In 1 arXiv:2111.14961v3[q-bio.PE] 9 Dec 2021 the example in Figure 1 we have r " 2 and n " 4, so r n " 16 possible pattern for the joint distribution.
Let p i1i2i3i4 denote the joint probability of pattern i 1 i 2 i 3 i 4 , that is the probability under the model of observing state i 1 at leaf 1, i 2 at leaf 2 and so on.We can think of these as elements of an r n dimensional vector In this matrix, the rows correspond to the r 2 possible ways of assigning states to the first two taxa while the columns correspond to the r 2 possible ways of assigning states to the third and fourth taxa.A matrix of this form is called a flattening.In tensor terminology, the flattening is an example of an unfolding of the tensor of pattern probabilities.The idea was introduced into phylogenetics by Pachter and Sturmfels [17] and developed extensively by Allman and Rhodes to solve a wide range of mathematical problems in phylogenetics [1,3,4,5,6,7,8,9,18].
We can construct a flattening for any partition A|B of the set of taxa into two non-empty parts.ff .
An important property of flattenings from phylogenies is their rank.Suppose that e is an edge in a phylogeny.Removing e partitions the tree, and hence the set of leaves, into two parts, inducing a partition A|B of the set of taxa.We say that A|B is a split of the tree corresponding to edge e. Allman and Rhodes [6] (Proposition 11) proved that, under minor assumptions, if A|B is a split in the tree then the rank of flat A|B is at most r, while if A|B is not a split of the tree then the rank of flat A|B is at least Because of this property, flattenings and their ranks have played a prominent role in the mathematics of phylogenetics, particularly with respect to the development and construction of phylogenetic invariants [3,7,17].Roughly speaking, a phylogenetic invariant for a tree is a function on vectors of pattern probabilities such as (1) which is zero when the probability distribution comes from that tree and non-zero otherwise.
Flattenings have also led to methods for inferring phylogenies directly.In an original and influential chapter, Eriksson [14] outlines an efficient method for inferring phylogenies with few assumptions about the evolutionary process.The SVD quartets method [13] uses flattenings to infer trees for subsets of four taxa, subsequently assembling these four-taxa trees into one for the complete set of taxa.The method is statistically consistent even in the presence of incomplete lineage sorting.Quartet-based approaches based on flattening have also been developed by [12,16].Allman, Kubako and Rhodes propose the ranks of flattenings as a measure of support for different edges in a phylogeny [2].
In this paper we extend and complete the theorem of Allman and Rhodes and derive an exact formula for the rank of arbitrary flattenings of a tree.Our result corrects a formula appearing in [14].We show that the rank of flat A|B is given by r T pA|Bq , where T pA|Bq is the parsimony length of the binary character which assigns one state to all leaves in A and another state to all leaves in B. A slightly modified result holds for non-binary (multifurcating) trees.
In the next section we present the notation and basic results needed to establish this result.We note that we generalise from characters to maps on arbitrary subsets of vertices, and define our concepts in this more general context.The main result is proved in a series of lemmas and propositions in the final section.
Since completing this work, we have learnt that an equivalent result has been proved much earlier by Casanellas and Fernández-Sánchez [11], using a completely different proof strategy.

Trees and characters
An unrooted phylogeny is an acyclic, connected graph T " pV, Eq with leaf set (taxon set) LpT q.We say that T is binary (full resolved) if every non-leaf vertex has degree three.In a rooted phylogeny T " pV, E ρ q one vertex is selected as the root ρ and edges are directed away from ρ.The rooted phylogeny T is binary if every non-leaf vertex has out-degree 2.
A character is a function f from LpT q to a set of states rrs " t1, 2, . . ., ru.Hence r " 4 for nucleotides and r " 20 for amino acids.We will consider a more general situation where f is a map from any subset of V to rrs, not just the set LpT q.
The length of a function F : V Ñ rrs is defined as and the (parsimony) length a function f with domain A Ď V is the length of a minimum extension The length of a function or character can be expressed equivalently using vertex and edge cuts.For 1 and T zV 1 denote the graphs resulting from deleting E 1 or V 1 respectively.
The length T pf q equals the minimum cardinality of an edge cut E 1 Ď E such that f puq " f pvq whenever u and v are in the same component of T zE 1 .In a similar way, we let ν T pf q denote the minimum cardinality of a vertex cut V 1 Ď V such that f puq " f pvq whenever u and v are in the same component of T zV 1 .
For all f we have ν T pf q ď T pf q.
If A and B are disjoint subsets of V then we let T pA|Bq and ν T pA|Bq denote T pf q and ν T pf q, where f is the function given by Steel [19,21] observed that the parsimony length of a character with two states can be expressed in terms of the size of disjoint path sets .This applies for both T pA|Bq and ν T pA|Bq.
Proposition 1.Let T " pV, Eq be an unrooted phylogeny and let A and B be disjoint subsets of V .
Then T pA|Bq equals the maximum cardinality of a set of edge-disjoint paths connecting vertices in A with vertices in B, while ν T pA|Bq equals the maximum cardinality of a set of vertex-disjoint paths connecting vertices in A with vertices in B.
Corollary 1.Let T " pV, Eq be a binary phylogeny and suppose A and B are disjoint subsets of LpT q.
Proof.If p 1 and p 2 are any two paths in a binary phylogeny which begin and end at leaves then p 1 and p 2 are vertex disjoint if and only if they are edge disjoint.

Stochastic models on trees
The standard stochastic models on phylogenies determine the joint probabilities for the states at every vertex of the tree.Let T " pV, E ρ q be a rooted tree with root ρ.Let π ρ denote the root distribution and for each directed edge pu, vq we associate an r ˆr transition probability matrix P uv .Let X v denote the random state associated with vertex v and, for A Ď V , let X A denote the joint random variable X a : a P A.
The joint probability that X v " F pvq for all v P V is πpX V " F q " π ρ pF pρqq ź pu,vqPEρ P uv pF puq, F pvqq.
The marginal probabilities for maps f : A Ñ rrs on some subset A Ď V are then given by With this notation, the standard probability for a character f : LpT q Ñ rrs is πpX LpT q " f q.
We will make three assumptions about the parameters of the stochastic model.
(C1) The transition matrices P uv are non-singular.
(C3) P uv pi, jq ą 0 for all edges pu, vq and i, j P rrs.
We note that all three are satisfied in standard evolutionary models, where mutations along a branch are modelled using continuous time Markov chains.
These conditions have three immediate consequences.
Proposition 2. Suppose that conditions (C1) and (C2) are satisfied.Then 1. πpX v " iq ą 0 for all v P V and i P rrs.
2. For all u, v P V (not necessarily adjacent) the r ˆr matrix with entries P uv " πpX v " j|X u " iq is non-singular.
3. For all u, v P V the r ˆr matrix with entries M ij " πpX u " i, X v " jq is non-singular. Proof.
2. Let v 1 , v 2 , . . ., v k be the path from v 1 " u to v k " v. Then which is non-singular by (C1).
3. Let Π u be the diagonal matrix with entries πpX u " iq on the diagonal.Then M " ΠP uv so is non-singular by parts 1 and 2.
For any edge pu, vq in the rooted tree T " pV, E ρ q we can define a transition matrix P vu for the reverse edge pv, uq using Bayes' rule: " P uv pj, iq πpX u " jq πpX v " iq .
This formula allows us to move the root to any vertex in the tree with no change to the distribution of joint random variables X V [4,20].To move from the root from ρ to ρ we make the new root distribution π ρ " πpX ρq and use (3) to determine transition matrices for all edges which are flipped when directing away from ρ instead of from ρ (under the assumption that (C1) and (C2) both hold).
Conditional independence for the variables X v are, as with any graphical model, determined by cuts in the graph.More specifically, if A 1 , A 2 , . . ., A k are the components of T ztvu then X A1 , X A2 , . . ., X A k are conditionally independent, given X v , see [22,Lemma 7.1].The following Proposition is a direct consequence of this result Proof.Apply Lemma 7.1 of [22] with respect to some v P V 1 and then apply the result recursively on the components.

The main theorem
Let T " pV, Eq be a phylogeny and suppose that A and B are disjoint subsets of V .We let flat A|B denote the matrix with rows indexed by maps f A : A Ñ rrs, columns indexed by maps f B : B Ñ rrs and pf A , f B q entry given by flat Hence flat A|B is an r |A| ˆr|B| non-negative matrix with entries which sum to 1.
Theorem 1.Let T " pV, Eq be a phylogeny and let A and B be disjoint subsets of V .Suppose that the root distribution and transition matrices satisfy (C1)-(C3).Then rankpflat A|B q " r ν T pA|Bq .
If T is binary and A and B subsets of LpT q then rankpflat A|B q " r T pA|Bq .

Proof of Theorem 1
We prove the main theorem in two steps.First, we show that r ν T pA|Bq provides an upper bound for the rank of flat A|B ; second we show that this upper bound is actually achieved.
Lemma 1.Let T " pV, Eq be a phylogeny and suppose that A and B are disjoint subsets of V .Then rankpflat A|B q ď r ν T pA|Bq .
Proof.Let C be a minimum cardinality vertex cut of T such that each component of T zC contains vertices from at most one of A or B. By Proposition 3 X AzC and X BzC are conditionally independent given X C .Hence for all maps f A : A Ñ rrs and f B : B Ñ rrs we can factor πpX A " f A , X B " f B q as and the r |C| ˆr|B| matrix S by Then flat A|B " RS and rankpflat A|B q ď rankpRq ď r |C| " r ν T pA|Bq .
To illustrate, consider the tree in figure 2. The sets A and B are indicated by filled and unfilled leaves respectively.Removing the three marked vertices separates all leaves in A from leaves in B.
Hence ν T pA|Bq ď 3 and rankpflat A|B q ď r ν T pA|Bq .We note that the formula in [14] gives a generic rank of r 4 for this flattening.
The second part of the proof of the main theorem is proving a matching lower bound for Lemma 1.
We start by demonstrating that the rank of flat A|B increases monotonically as a function of A and B.
Lemma 2. Let A and B be disjoint subsets of V and suppose A 1 Ď A and B 1 Ď B. Then rankpflat A 1 |B 1 q ď rankpflat A|B q.
Figure 2: A counter-example for the rank formula in [14].Let A and B be given by the filled and unfilled leaf nodes, respectively.The three squares mark out a vertex cut of size 3 separating A from B.
Hence the rank of flat A|B is at most r 3 , for r states.Theorem 19.5 of [14] states that the generic rank is r 4 .

Proof. For any f A
Hence there is an r |A 1 | ˆr|A| 0´1 (binary) matrix U A and a r |B 1 | ˆr|B| 0´1 matrix U B such that and rankpflat A 1 |B 1 q ď rankpflat A|B q.
The next Lemma establishes Theorem 1 in the extremal case that ν T pA|Bq " |A| " |B|.This is where the bulk of the work proving the main theorem is carried out.
Lemma 3. Suppose that T " pV, Eq, A and B satisfy the conditions of Theorem 1.If |A| " |B| " m and there are m disjoint paths connecting elements of A to elements of B then rankpflat A|B q " r m .
Proof.We prove the result by induction on m.
For the base case suppose that m " 1, A " tau and B " tbu.Then flat A|B pi, jq " πpX a " i, X B " jq which is full rank r " r ν T pA|Bq by Proposition 2.
Next, assume that the result holds when |A| " |B| " m.Suppose that there is a collection of m `1 vertex disjoint paths connecting elements of A 1 and B 1 , where |A 1 | " |B 1 | " m `1.Fix a vertex ρ P V and let p be the path furthest away from ρ. Suppose that this path goes from a P A 1 to b P B 1 .Let v P p be the vertex on p closest to ρ and let e " tv, wu be the first edge on the path from v to ρ.If there is a path p 1 in the same component of T zteu then v is on the path from p 1 to ρ, contradicting the choice of p.
Let A " A 1 ztau and B " B 1 ztbu.Define the matrices F, G by F pi, kq " πpX a " i|X v " kq Gpk, jq " πpX v " k, X b " jq

Figure 1 :
Figure 1: An example of patterns or sites on a four taxa tree.The 16 possible patterns are listed in the table on the right -any one of these could be the pattern for a particular site.

RRRY p RYRR p RYRY p RRYR p RRYY p RYYR p RYYY p YRRR p YRRY p YYRR p YYRY p YRYR p YRYY p YYYR p YYYY
|B| ways of assigning a state to the taxa in B. Each entry equals a term p i1i2¨¨¨in with each state i k determined by the row if k P A and by the column if k P B. We denote this matrix RRRY p RRYR p RRYY p RYRR p RYRY p RYYR p RYYY p YRRR p YRRY p YRYR p YRYY p YYRR p YYRY p YYYR p YYYY The rows of the flattening are indexed by all r |A| ways of assigning a state to the taxa in A and the columns are indexed by all r