Appendix A: Proof of results
A.1 Lemma 3 and Proof of Lemma 1
Before we can prove Lemma 1, we provide a results that deals with possible selfloops in \(A({T},{S})\). Although it may be possible to show in general (with a tedious casebycase analysis) that a leaf l of S would never create a selfloop (l, l) in \(A({T},{S})\) we use a conceptionally simpler idea and treat selfloops as a special case. In particular, we show that selfloops in \(A({T},{S})\) cannot occur as long as there is a (not necessarily timeconsistent) reconciliation map from \((T;t,\sigma )\) to S. In this case, the nonoccurrence of selfloops is preserved by any graph \(A({T},{S^*})\) for which \(S^*\) is a refinement of S.
Lemma 3
Let \((T;t,\sigma )\)be an eventlabeled gene tree, S be a species tree and \(S^*\)be a refinement of S. Moreover, let l be a leaf of S (and thus, of \(S^*\)). Then (l, l) is an edge of \(A({T},{S})\)if and only if (l, l) is an edge of \(A({T},{S^*})\).
Furthermore, if there is a reconciliation map from \((T;t,\sigma )\)to S then, the graph \(A({T},{S})\)will never contain selfloops and every edge \((u',v')\)in \(A({T},{S})\)with \({u',v'\in V(S)}\), is either an A1 or A2edge and satisfies \(v'\prec _S u'\).
Proof
Let \((T;t,\sigma )\) be an eventlabeled gene tree, S be a species tree and \(S^*\) be a refinement of S. Note that if (l, l) is a selfloop of \(A({T},{S})\) (respectively \(A({T},{S^*})\)), then (l, l) must be an A1edge, and so there is \((u, v) \in E(T)\) such that \(\widehat{\mu }_S(u) = \widehat{\mu }_S(v) = l\) (respectively \(\widehat{\mu }_{S^*}(u) = \widehat{\mu }_{S^*}(v) = l\)). Since l is a leaf, \(\widehat{\mu }_S(u) = \widehat{\mu }_S(v) = l\) if and only if \(\widehat{\mu }_{S^*}(u) = \widehat{\mu }_{S^*}(v) = l\), and the statement follows.
For the second statement, assume that there is a reconciliation map from \((T;t,\sigma )\) to S. To see that \(A({T},{S})\) does not contain selfloops, observe once again that selfloops can only be provided by A1edges. So assume, for contradiction, that there is an edge \((u, v) \in E(T)\) such that \(t(u),t(v)\in \{\odot , \mathfrak {s}\}\) and \(\widehat{\mu }(u)=\widehat{\mu }(v)\). Since \(t(u),t(v)\in \{\odot , \mathfrak {s}\}\), Property (M1) and (M2.i) imply that \(\widehat{\mu }(u)=\mu (u)\) and \(\widehat{\mu }(v)=\mu (v)\) for every reconciliation map \(\mu\) from \((T;t,\sigma )\) to S. Since \(v\prec _T u\), Condition (M3.ii) implies that \(\widehat{\mu }(v) = \mu (v)\prec _S\mu (u)=\widehat{\mu }(u)\); a contradiction.
Now let \((u',v')\) be an edge in \(A({T},{S})\) with \(u',v'\in V(S)\). Since all A3 or A4edges involve vertices of T, we can conclude that \((u',v')\) must either be an A1edge or an A2edge. Clearly, if \((u',v')\) is an A2edge, we trivially have \(v'\prec _S u'\). Assume that \((u',v')\) is an A1edge. Hence there is an edge \((u,v)\in E(T)\) such that \(u' = \widehat{\mu }(u)\) and \(v' = \widehat{\mu }(v)\). This implies that \(t(u),t(v)\in \{\mathfrak {s},\odot \}\). Condition (M1) and (M2.i) imply \(\widehat{\mu }(u) = \mu (u)\) and \(\widehat{\mu }(v) = \mu (v)\). Moreover, since \((u,v)\in E(T)\), we have \(t(u)=\mathfrak {s}\). Now, we can apply Condition (M3.ii) to conclude that \(v' = \widehat{\mu }(v)=\mu (v) \prec _S \mu (u) = \widehat{\mu }(u) = u'\). \(\square\)
We are now in the position to prove Lemma 1.
Proof of Lemma 1
We may assume that \(\widehat{S}\) is nonbinary as otherwise we are done. Let \(S^*\) be any refinement of \(\widehat{S}\). First observe that we have \(\mathcal {R}(T;t,\sigma )\subseteq rt(\widehat{S}) \subseteq rt(S^*)\), and thus \(S^*\) displays \(\mathcal {R}(T;t,\sigma )\).
It remains to show that \(A({T},{S^*})\) is acyclic. We first prove that any single \((x,X')\) extension applied to \(\widehat{S}\) preserves acyclicity. Let \(S'{:}\,{=}\,\widehat{S}_{x,X'}\) be any tree obtained from \(\widehat{S}\) after applying some \((x,X')\) extension. As specified in Definition 5, if \(X' \le 1\), then \(S'=\widehat{S}\). In this case, \(A({T},{S'}) = A({T},{\widehat{S}})\) is acyclic and we are done. Hence, suppose that \(X>1\). Thus, a new node y was created, added as a child of x and became the new parent of \(X' \subset X\). We claim that \(A({T},{S'})\) is acyclic. For the remainder, we will write \(\widehat{\mu }_{\widehat{S}}\) and \(\widehat{\mu }_{S'}\) instead of \(\widehat{\mu }_{T,\widehat{S}}\) and \(\widehat{\mu }_{T, S'}\) since T will remain fixed. We will make use of the following properties.

(P1)
For every subset \(Z \subseteq L(S)\), it holds that \({\text {lca}}_{\widehat{S}}(Z) = {\left\{ \begin{array}{ll} {\text {lca}}_{S'}(Z) &{}\hbox { if}\ {\text {lca}}_{S'}(Z)\ne y \\ x &{}\text{ otherwise } \end{array}\right. }\)

(P2)
For every \(u\in V(T)\), it holds that \(\widehat{\mu }_{\widehat{S}}(u) = {\left\{ \begin{array}{ll} \widehat{\mu }_{S'}(u) &{}\text{ if } \widehat{\mu }_{S'}(u) \ne y \textit{(Case P2.a)} \\ x &{}\text{ otherwise } \textit{(Case P2.b)} \end{array}\right. }\)
Property (P1) follows from the fact that \(L(S'(v)) = L(\widehat{S}(v))\) for any \(v \in V(S') \setminus \{y\}\) and \(L(S'(y)) \subset L(\widehat{S}(x))\). Therefore if \({\text {lca}}_{S'}(Z) = z\ne y\), then z is also a common ancestor of Z in \(\widehat{S}\) and there cannot be lower common ancestor below z. If \(z=y\), then x is a common ancestor of Z in \(\widehat{S}\) and there cannot be a lower common ancestor below x. Property (P2) is a direct consequence of (P1) and the definition of \(\widehat{\mu }_{S'}\) and \(\widehat{\mu }_{\widehat{S}}.\)
Now, suppose for contradiction that \(A({T},{S'})\) contains a cycle \(C = (w_1, \ldots , w_k, w_1)\). Note that \(\mathcal {R}(T;t,\sigma )\subseteq rt(\widehat{S}) \subseteq rt(S')\). Thus, Theorem 1 implies that there is a reconciliation map from from \((T;t,\sigma )\) to \(S'\). By Lemma 3, \(A({T},{S'})\) does not contain selfloops and thus \(k>1\) for \(C = (w_1,\ldots , w_k, w_1)\)
Consider the sequence of vertices \({\widetilde{C}} = ({\widetilde{w}}_1, \ldots , {\widetilde{w}}_k, {\widetilde{w}}_1)\) of vertices of \(A({T},{\widehat{S}})\) where we take C, but replace y by x if it occurs. That is, we define, for each \(1 \le i \le k\):
$$\begin{aligned} {\widetilde{w}}_i = {\left\{ \begin{array}{ll} w_i &{}\hbox { if}\ w_i \ne y\\ x &{}\hbox { if}\ w_i = y \end{array}\right. } \end{aligned}$$
We claim that every element in \(\{({\widetilde{w}}_1, {\widetilde{w}}_2), \ldots , ({\widetilde{w}}_{k1}, {\widetilde{w}}_k),({\widetilde{w}}_k, {\widetilde{w}}_1)\} \setminus \{(x, x)\}\) is an edge in \(A({T},{\widehat{S}})\) (the pair (x, x) can occur in \({\widetilde{C}}\) if (x, y) is in C, but we may ignore it since this still results in a cycle). This will imply the existence of a cycle in \(A({T},{\widehat{S}})\), yielding a contradiction.
We show that \(({\widetilde{w}}_1, {\widetilde{w}}_2) \in E(A({T},{\widehat{S}}))\), assuming that \(({\widetilde{w}}_1, {\widetilde{w}}_2) \ne (x, x)\). This is sufficient to prove our claim, since we can choose \(w_1\) as any vertex of C and relabel the other vertices accordingly.

Case: \((w_1, w_2)\)is an A1edge.
Since \((w_1, w_2)\) is an A1edge, it is defined by some edge \((u, v) \in E(T)\) and must coincide with one of the edges in \({\mathcal {A}} = \{(u, v), (u, \widehat{\mu }_{S'}(v)), (\widehat{\mu }_{S'}(u), v), (\widehat{\mu }_{S'}(u), \widehat{\mu }_{S'}(v))\}\).
Suppose that \(w_1,w_2\ne y\). Then, by construction of \({{\widetilde{w}}}_1\) and \({{\widetilde{w}}}_2\), we have \({{\widetilde{w}}}_1=w_1\) and \({{\widetilde{w}}}_2=w_2\). Hence, \(({\widetilde{w}}_1, {\widetilde{w}}_2) = (w_1, w_2)\) is an edge in \({\mathcal {A}}\). By (P2), \(\widehat{\mu }_{{\widehat{S}}}(u)=\widehat{\mu }_{S'}(u)\) and \(\widehat{\mu }_{{\widehat{S}}}(v)=\widehat{\mu }_{S'}(v)\). Hence, \(({\widetilde{w}}_1, {\widetilde{w}}_2)\) is of one of the form \((u, v), (u, \widehat{\mu }_{{\widehat{S}}}(v)), (\widehat{\mu }_{{\widehat{S}}}(u), v), (\widehat{\mu }_{{\widehat{S}}}(u), \widehat{\mu }_{{\widehat{S}}}(v))\). This implies that \(({\widetilde{w}}_1, {\widetilde{w}}_2)\) is an A1edge that is contained in \(A({T},{\widehat{S}})\).
If \(w_1 =y\), then \(y\in V(S')\) implies that \(y=\widehat{\mu }_{S'}(u)\). By construction and (P2.b), \({\widetilde{w}}_1 = x = \widehat{\mu }_{{\widehat{S}}}(u)\). This, in particular, implies that \(w_2 \notin \{x, y\}\) as otherwise, \({\widetilde{w}}_2 = x\); contradicting \(({\widetilde{w}}_1, {\widetilde{w}}_2) \ne (x, x)\). By construction of \({{\widetilde{w}}}_2\), we have \({\widetilde{w}}_2=w_2\). Thus, \(({\widetilde{w}}_1,{\widetilde{w}}_2)\) is either of the form \((\widehat{\mu }_{{\widehat{S}}}(u), v)\) or \((\widehat{\mu }_{{\widehat{S}}}(u), \widehat{\mu }_{{\widehat{S}}}(v))\) depending on the label t(v). In either case, \(({\widetilde{w}}_1,{\widetilde{w}}_2)\) is an A1edge that is contained in \(A({T},{\widehat{S}})\) (invoking (P2.b) for the latter case).
If \(w_2 = y\) then, by analogous arguments as in the case \(w_1=y\), we have \({\widetilde{w}}_2 = x = \widehat{\mu }_{{\widehat{S}}}(v)\) and \({\widetilde{w}}_1=w_1\). Again, \(({\widetilde{w}}_1,{\widetilde{w}}_2)\) is an A1edge that is contained in \(A({T},{\widehat{S}})\).
In summary, \(({\widetilde{w}}_1,{\widetilde{w}}_2)\) is an A1edge in \(A({T},{\widehat{S}})\) whenever \((w_1, w_2)\) is an A1edge in \(A({T},{S'})\)

Case: \((w_1, w_2)\)is an A3edge.
Since \((w_1, w_2)\) is an A3edge, we have \((w_1, w_2) = (u, \widehat{\mu }_{S'}(u))\). Since \(u \in V(T)\), it holds that \(w_1=u \ne y\) and thus, \({\widetilde{w}}_1=w_1=u\). Now we can apply similar arguments as in the first case: either \(\widehat{\mu }_{S'}(u) \ne y\) and thus, \({\widetilde{w}}_2 = w_2 = \widehat{\mu }_{S'}(u) = \widehat{\mu }_{\widehat{S}}(u)\) or \(\widehat{\mu }_{S'}(u) =y\) and thus, \({\widetilde{w}}_2 = x = \widehat{\mu }_{\widehat{S}}(u)\). In both cases, \(({\widetilde{w}}_1, {\widetilde{w}}_2) = (u,\widehat{\mu }_{\widehat{S}}(u))\) which implies that \(({\widetilde{w}}_1, {\widetilde{w}}_2)\) is an A3edge in \(A({T},{S'})\).

Case: \((w_1, w_2)\)is an A2edge.
Since \((w_1, w_2)\) is an A2edge, we have \((w_1, w_2)\in E(S')\) and hence, \(w_1\) is the parent of \(w_2\) in \(S'\). This implies that \(w_2 \ne y\) as, otherwise, \(w_1=x\) and thus, \(({\widetilde{w}}_1, {\widetilde{w}}_2) = (x, x)\); a contradiction. Thus, by construction, \({\widetilde{w}}_2 = w_2\). If \(w_1 = y\), then \({{\widetilde{w}}}_1 = x\) and, by construction of \(S'\), we have \((x, w_2) = ({\widetilde{w}}_1, {\widetilde{w}}_2) \in E(\widehat{S})\). In this case, \(({\widetilde{w}}_1, {\widetilde{w}}_2)\) is an A2edge in \(E(A({T},{\widehat{S}}))\). Otherwise, if \(w_1\ne y\), then \({{\widetilde{w}}}_1=w_1\). Hence, \((w_1, w_2) = ({\widetilde{w}}_1, {\widetilde{w}}_2) \in E(\widehat{S})\) which implies that \(({\widetilde{w}}_1, {\widetilde{w}}_2)\) is an A2edge in \(E(A({T},{\widehat{S}}))\).

Case: \((w_1, w_2)\)is an A4edge.
Since \((w_1, w_2)\) is an A4edge, there is an edge \((u,v)\in \mathcal {E}_T\) such that \(w_1 = {\text {lca}}_{S'}(\widehat{\mu }_{S'}(u),\widehat{\mu }_{S'}(v))\) and \(w_2=u\). Clearly, \(w_2=y\) is not possible, since \(w_2 = u\) corresponds to a vertex in T. By construction, \({{\widetilde{w}}}_2=w_2=u\). Note that in \(A({T},{\widehat{S}})\), (u, v) defines the A4 edge \(({\text {lca}}_{\widehat{S}}(\widehat{\mu }_{\widehat{S}}(u),\widehat{\mu }_{\widehat{S}}(v)), u)\). Therefore, it remains to show that \({{\widetilde{w}}}_1 = {\text {lca}}_{\widehat{S}}(\widehat{\mu }_{\widehat{S}}(u),\widehat{\mu }_{\widehat{S}}(v))\). Notice that
$$\begin{aligned} w_1&= {\text {lca}}_{S'}(\widehat{\mu }_{S'}(u),\widehat{\mu }_{S'}(v)) \\&= {\text {lca}}_{S'}(lca_{S'}(\sigma _{T_{\mathcal {\overline{E}}}}(u)), lca_{S'}(\sigma _{T_{\mathcal {\overline{E}}}}(v))) \\&= {\text {lca}}_{S'}(\sigma _{T_{\mathcal {\overline{E}}}}(u) \cup \sigma _{T_{\mathcal {\overline{E}}}}(v)) \end{aligned}$$
In a similar manner, we obtain
$$\begin{aligned} {\text {lca}}_{\widehat{S}}(\widehat{\mu }_{\widehat{S}}(u), \widehat{\mu }_{\widehat{S}}(v)) = {\text {lca}}_{\widehat{S}}(\sigma _{T_{\mathcal {\overline{E}}}}(u) \cup \sigma _{T_{\mathcal {\overline{E}}}}(v)) \end{aligned}$$
Let \(Z = \sigma _{T_{\mathcal {\overline{E}}}}(u) \cup \sigma _{T_{\mathcal {\overline{E}}}}(v)\). Property (P1) implies that if \(w_1 \ne y\), then \({\text {lca}}_{\widehat{S}}(\widehat{\mu }_{\widehat{S}}(u),\widehat{\mu }_{\widehat{S}}(v)) = {\text {lca}}_{\widehat{S}}(Z) = {\text {lca}}_{S'}(Z) = w_1 = {\widetilde{w}}_1\), as desired. If \(w_1 = y\), then \({\text {lca}}_{\widehat{S}}(\widehat{\mu }_{\widehat{S}}(u),\widehat{\mu }_{\widehat{S}}(v)) = {\text {lca}}_{\widehat{S}}(Z) = x\) and \({\widetilde{w}}_1 = x\), as desired.
We have therefore shown that a cycle in \(A({T},{S'})\) implies a cycle in \(A({T},{\widehat{S}})\). Since \(\widehat{S}\) is a solution, we deduce that \(A({T},{S'})\) cannot have a cycle, and it is therefore also a solution to \(((T;t,\sigma ), S)\).
To finish the proof, we need to show that \(A({T},{S^*})\) is acyclic. This is now easy to see since \(\widehat{S}\) can be transformed into \(S^*\) by a sequence of extensions. As we showed, each extension maintains the acyclicity property, and we deduce that \(A({T},{S^*})\) is acyclic. \(\square\)
A.2 Properties of maximal topological sort and Lemma 4
Lemma 4
Let \(G = (V,E)\)be a graph and Q and \(Q'\)be maximal topological sorts of G. Then, \(\mathcal {M}(Q) = \mathcal {M}(Q')\). In particular, \(\mathcal {M}(Q) = V(G)\)if and only if G is a directed acyclic graph.
Furthermore, if \(x\in V\setminus \mathcal {M}(Q)\), then none of the vertices y in V for which there is a directed path from x to y are contained in \(\mathcal {M}(Q)\).
If \(x\in \mathcal {M}(Q)\), then x is not contained in any cycle of G.
Proof
Let \(Q, Q'\) be maximal topological sorts of G, with \(Q = (v_1, \ldots , v_k)\) and assume, for contradiction that \(\mathcal {M}(Q) \ne \mathcal {M}(Q')\). Let \(v_i\) be the first vertex in the sequence Q such that \(v_i \notin \mathcal {M}(Q')\). Then all the inneighbors of \(v_i\) are in the set \(\{v_1, \ldots , v_{i1}\}\). Moreover, by assumption \(\{v_1, \ldots , v_{i1}\} \subseteq \mathcal {M}(Q')\), implying that \(v_i\) has indegree 0 in \(G  \mathcal {M}(Q')\). Hence, we could append \(v_i\) to \(Q'\), contradicting its maximality. The fact that \(\mathcal {M}(Q) = V(G)\) if and only if G a directed acyclic graph is wellknown and follows from the results of [52].
Let \(x\in V\setminus \mathcal {M}(Q)\). Moreover, let \(P=(x=v_1,\dots v_k=y)\), \(k\ge 2\), be a directed path from x to y. Since \(x\notin \mathcal {M}(Q)\), \(v_2\) has indegree greater than 0 in \(G\mathcal {M}(Q)\). Therefore, \(v_2\notin \mathcal {M}(Q)\) and, by induction, \(v_k=y\notin \mathcal {M}(Q).\)
We now show that no vertex \(x\in \mathcal {M}(Q)\) can be contained in a cycle of G. Assume, for contradiction, that there is a cycle C such that some of its vertices are part of a maximal topological sort \(Q = (v_1,\dots ,v_k)\) of G. Let \(v_i\) be the first vertex of C that appears in Q. Hence, \(v_i\) must have indegree 0 in \(G  \{v_1, \ldots , v_{i1}\}\). But this implies, that the inneighbor of \(v_i\) in C must already be contained in Q; a contradiction. \(\square\)
A maximal topological sort of G can be found by applying the following procedure: start with Q empty, and while there is a vertex of indegree 0 in \(G  \mathcal {M}(Q)\), append v to Q and repeat. Then, G is acyclic if an only if any maximal topological sort Q of V(G) satisfies \(\mathcal {M}(Q) = V(G)\). The latter argument is correct as it directly mirrors the wellknown algorithm by Kahn to find a topological sort of graph [52].
A.3 Proof of proposition 2
We prove some generalpurpose statements first. Let \(I_G(v)\) denote the set of inneighbors of vertex v in a graph G.
Lemma 5
Let \(((T;t,\sigma ), S)\)be a GTC instance. Moreover, let \(S'\)be a split refinement of S at a cherry x. Then, for every vertex y of S such that \(y \not \preceq _S x\), it holds that \(I_{A({T},{S'})}(y) = I_{A({T},{S})}(y)\).
Proof
Let \(y\in V(S)\) be a vertex of S satisfying \(y \not \preceq _S x\). Since \(y\notin V(T)\), for every \(z\in I_{A({T},{S'})}(y)\) or \(z\in I_{A({T},{S})}(y)\) the edge (z, y) cannot be an A4edge.
If (z, y) is an A2edge in \(A({T},{S})\) then, \((z,y)\in E(S)\), which is if and only if \((z,y)\in E(S')\), since \(y\not \preceq _S x\). In this case, \(z\in I_{A({T},{S})}(y)\) if and only if \(z\in I_{A({T},{S'})}(y),\)
It remains to consider A1 and A3edges. We translate here Property (P2.a) as in the proof of Lemma 1. It states as a particular case that for \(u \in V(T)\), \(\widehat{\mu }_{S}(u)=\widehat{\mu }_{S'}(u)\) whenever \(\widehat{\mu }_{S}(u) \not \preceq x\). This holds for every \(y \not \preceq _S x\), which immediately implies that \(z\in I_{A({T},{S})}(y)\) and the edge (z, y) is an A1edge, resp., A3edge in \(A({T},{S})\) if and only if \(z\in I_{A({T},{S'})}(y)\) and (z, y) is an A1edge, resp., A3edge in \(A({T},{S'})\). \(\square\)
We are now in the position to prove Prop. 2.
Proof of Prop. 2
We show that if S does not admit a good split refinement, then none of the binary refinements \(S^*\) of S is a solution to the GTC instance \(((T;t,\sigma ), S)\). Contraposition of Lemma 1 together with Prop. 1 then implies that there is no solution at all for \(((T;t,\sigma ), S).\)
Thus, assume that S is not binary (but almost binary, due to the definition of GTC instances) such that S does not admit a good split refinement. Let \(S^*\) be any binary refinement of S. We may assume that \(S^*\) agrees with and thus, displays \(\mathcal {R}(T,t,\sigma )\), as otherwise it is not a solution. We show that \(A({T},{S^*})\) contains a cycle.
Let Q be a maximal topological sort of \(A({T},{S})\). By Lemma 4, \(\mathcal {M}(Q)\) is independent of the choice of the particular sequence Q. Note that \(V(S) \subseteq V(S^*)\) and therefore that \(V(A({T},{S})) \subseteq V(A({T},{S^*})).\) In particular, \(\mathcal {M}(Q) \subseteq V(A({T},{S^*}))\). Also notice that because of the A2 edges in \(A({T},{S})\) and Lemma 4, if a vertex \(x \in V(S)\) is not in \(\mathcal {M}(Q)\), then no descendant of x in S is in \(\mathcal {M}(Q).\) We separate the proof into three claims.
Claim 1 Let \(y \in V(S^*) \setminus V(S)\). Then y has indegree at least 1 in \(A({T},{S^*}) \mathcal {M}(Q)\).
Observe that since \(y \notin V(S)\), y must have been created by one of the extensions that transforms S into \(S^*\), and so in \(S^*\), y must be a descendant of a vertex x such that x is a nonbinary cherry in S. We first argue that \(x \notin \mathcal {M}(Q)\), and then proceed to prove the claim.
Note that since x is nonbinary and \(S^*\) is a binary refinement of S, there is a split refinement \(S'\) of S at x such that \(S^*\) refines \(S'\). Since \(S^*\) agrees with \(\mathcal {R}(T;t,\sigma )\), also \(S'\) agrees with \(\mathcal {R}(T;t,\sigma )\). If all inneighbors of x in \(A({T},{S'})\) are in Q, then \(S'\) is a good split refinement; a contradiction. So we may assume that x has an inneighbor y in \(A({T},{S'})\) such that \(y \notin \mathcal {M}(Q)\). Since \(x\in V(S)\), the edge (y, x) cannot be an A4edge in \(A({T},{S'})\). If (y, x) is an A1edge in \(A({T},{S'})\), then \(x = \widehat{\mu }_{S'}(v)\) for some \(v \in V(T)\). By construction, \(L(S(x)) = L(S'(x))\) and thus, \(\widehat{\mu }_{S}(v) = \widehat{\mu }_{S'}(v) = x\). Therefore, \((y, \widehat{\mu }_S(v)) = (y, x) \in E(A({T},{S}))\). Similarly, if (y, x) is an A3edge in \(A({T},{S'})\), then \(x = \widehat{\mu }_{S'}(y)\) and again, \((y, \widehat{\mu }_S(y)) = (y, x) \in E(A({T},{S}))\). If (y, x) is an A2edge in \(A({T},{S'})\), then \((y, x) \in E(A({T},{S}))\) since the parent of x is the same in S and \(S'\). In all cases, y is an inneighbor of x in \(A({T},{S})\). However, since \(y \notin \mathcal {M}(Q)\), vertex y remains an inneighbor of x in the graph \(A({T},{S})  \mathcal {M}(Q)\). It follows that \(x \notin \mathcal {M}(Q)\).
Now, since \(x \notin \mathcal {M}(Q)\), and because of the A2edges, y must have indegree at least 1 in \(A({T},{S^*})  \mathcal {M}(Q)\).
Claim 2 Let \(v \in V(T) \setminus \mathcal {M}(Q)\). Then v has indegree at least 1 in \(A({T},{S^*})  \mathcal {M}(Q)\).
Let \(v \in V(T) \setminus \mathcal {M}(Q)\). Since \(v \notin \mathcal {M}(Q)\), v has indegree at least 1 in \(A({T},{S})  \mathcal {M}(Q)\), or else it could be added to the maximal topological sort. Let (x, v) be an incoming edge of v in \(A({T},{S})  \mathcal {M}(Q)\), which is either an A1 or an A4 edge.
If (x, v) is an A1 edge, we either have \(x \in V(T)\) or \(x \in V(S)\). Suppose first that \(x \in V(T)\). In this case, the (x, v) edge exists because x is the parent of v in T with t(x), t(v) both in \(\{\mathfrak {d}, \mathfrak {t}\}\). This is independent of S, and so (x, v) is also an A1edge of \(A({T},{S^*})  \mathcal {M}(Q)\). Suppose now that \(x \in V(S)\). In this case, observe that \(x\notin \mathcal {M}(Q)\), since (x, v) is an edge in \(A({T},{S})  \mathcal {M}(Q)\). Therefore, \(x \in V(S) \setminus \mathcal {M}(Q)\). This, in particular, implies that the parent \(v_p\) of v in T satisfies \(t(v_p) = \mathfrak {s}\) and \(\widehat{\mu }_{S}(v_p) = x\). Since \(S^*\) refines S, we must have \(\widehat{\mu }_{S^*}(v_p) \preceq _{S^*} x\). There are two cases, either \(\widehat{\mu }_{S^*}(v_p)\notin V(S)\), in which case trivially \(\widehat{\mu }_{S^*}(v_p) \notin \mathcal {M}(Q)\), or \(\widehat{\mu }_{S^*}(v_p)\in V(S)\). In the latter case, there is a directed (possibly edgeless) path from x to \(\widehat{\mu }_{S^*}(v_p)\) in \(A({T},{S})\) due to the A2edges. Thus, we can apply Lemma 4 to conclude that \(\widehat{\mu }_{S^*}(v_p) \notin \mathcal {M}(Q)\).
In either case, \((\widehat{\mu }_{S^*}(v_p), v)\) is an A1edge of \(A({T},{S^*})  \mathcal {M}(Q)\). Therefore, v has an inneighbor in \(A({T},{S^*})\) that does not belong to Q.
Assume now that (x, v) is an A4edge. Thus, there is an edge \((v,v') \in \mathcal {E}_T\) such that \(x= lca_{S}(\widehat{\mu }_S(v), \widehat{\mu }_S(v'))\). Again since \(S^*\) refines S, it is not hard to see that \({\text {lca}}_{S^*}(\widehat{\mu }_S^*(v), \widehat{\mu }_S^*(v')) \preceq _{S^*} x\). By similar arguments as before, \({\text {lca}}_{S^*}(\widehat{\mu }_S^*(v), \widehat{\mu }_S^*(v')) \notin \mathcal {M}(Q)\). Thus, \(({\text {lca}}_{S^*}(\widehat{\mu }_S^*(v), \widehat{\mu }_S^*(v')),v)\) is an A4edge of \(A({T},{S^*})\). Hence, v also has indegree at least 1 in \(A({T},{S^*})  \mathcal {M}(Q)\), which proves Claim 2.
We prove the analogous statement for the species tree vertices.
Claim 3 Let \(x \in V(S) \setminus \mathcal {M}(Q)\). Then x has indegree at least 1 in \(A({T},{S^*})  \mathcal {M}(Q)\).
Let \(x \in V(S) \setminus \mathcal {M}(Q)\). We may assume that x has indegree at least 1 in \(A({T},{S})  \mathcal {M}(Q)\), by the maximality of Q. Notice that since \(S^*\) is a binary refinement of S, there exists a sequence of split refinements that transforms S into \(S^*\). That is, there is a sequence of trees \(S = S_1, S_2, \ldots , S_k = S^*\) such that for \(2 \le i \le k\), \(S_i\) is a split refinement of \(S_{i1}\).
Let (w, x) be an incoming edge of x in \(A({T},{S})  \mathcal {M}(Q)\). We consider the following three exclusive cases: either x is a binary or a nonbinary interior vertex, or a leaf.
Suppose first that x is a binary vertex of S. Because S is almost binary, x is not a descendant of any nonbinary vertex of S. By applying Lemma 5 successively on each split refinement of the sequence transforming S into \(S^*\), we obtain \(I_{A({T},{S_1})}(x) = I_{A({T},{S_2})}(x) = \ldots = I_{A({T},{S_k})}(x) = I_{A({T},{S^*})}(x)\). In particular, \(w \in I_{A({T},{S^*})}(x)\), which proves the claim for this case since \(w \notin \mathcal {M}(Q)\).
Suppose now that x is a leaf of S. If the parent \(x_p\) of x is binary, then again, successive application of Lemma 5 on \(S_1, \ldots , S_k\) implies that \(I_{A({T},{S})}(x) = I_{A({T},{S^*})}(x)\), and therefore that \(w \in I_{A({T},{S^*})}(x)\). If \(x_p\) is a nonbinary cherry, then \(x_p \notin \mathcal {M}(Q)\) by Claim 1. There are two cases, either the parent p(x) of x in \(S^*\) is identical to \(x_p\) or not. In the first case, \(p(x)=x_p\) is not part of Q. In the latter case, p(x) refers to some newly added vertex during the construction of \(S^*\). In this case, p(x) is not contained in S and so neither in Q. In summary, the parent of x in \(S^*\) is not in Q. Due to the A2edges, x has indegree at least 1 in \(A({T},{S^*})  \mathcal {M}(Q)\).
Finally, suppose that x is a nonbinary interior vertex of S, i.e. x is a cherry. Let \(S'\) be a split refinement of S at x such that \(S^*\) refines \(S'\). Recall that as in Claim 1, \(S'\) agrees with \(\mathcal {R}(T;t,\sigma )\). This and the fact that S does not admit a good split refinement implies that x has indegree at least 1 in \(A({T},{S'})  \mathcal {M}(Q)\). Now, x is binary in \(S'\). As before, there is a sequence of binary refinements transforming \(S'\) into \(S^*\). Since x is not a descendant of any nonbinary vertex in \(S'\), by applying Lemma 5 on each successive refinement, \(I_{A({T},{S'})}(x) = I_{A({T},{S^*})}(x)\). It follows that x has indegree at least 1 in \(A({T},{S^*})  \mathcal {M}(Q)\) as well. This proves Claim 3.
To finish the argument, note that \(V(A({T},{S^*})  \mathcal {M}(Q)) = (V(T) \setminus \mathcal {M}(Q)) \cup (V(S) \setminus \mathcal {M}(Q)) \cup (V(S^*) \setminus V(S))\). By Claim 1, each vertex in \(V(S^*) \setminus V(S)\) has indegree at least 1 in \(A({T},{S^*})  \mathcal {M}(Q)\), and by Claim 2 and Claim 3, it follows that every vertex of \(A({T},{S^*})  \mathcal {M}(Q)\) has indegree at least 1. This implies that \(A({T},{S^*})  \mathcal {M}(Q)\) contains a cycle, and hence that \(A({T},{S^*})\) also contains a cycle. We have reached a contradiction, proving the lemma. \(\square\)
A.4 Proof of Theorem 3
First, we provide the following lemma for later reference.
Lemma 6
Let \(((T;t,\sigma ), S)\)be a GTC instance and let Q be a maximal topological sort of \(A({T},{S})\). Moreover, let \(S'\)be a split refinement of S at a cherry x. Then, for any maximal topological sort \(Q'\)of \(A({T},{S'})\), it holds that \(\mathcal {M}(Q) \subseteq \mathcal {M}(Q')\).
Proof
Assume without loss of generality that the cherry x is nonbinary in S, as otherwise \(S=S'\) and we are done. Let \(x_1, x_2\) be the children of x in \(S'\), and assume furthermore w.l.o.g. that \(L(S'(x_1)) \ge L(S'(x_2))\). Note that \(x_2\) could be a leaf, but that \(x_1\) must be an internal vertex since x is a nonbinary cherry. Now, if \(\mathcal {M}(Q)=\emptyset\), then the lemma statement is trivially satisfied. Hence, assume that \(Q = (w_1, \ldots , w_l)\), \(l\ge 1\). We construct partial topological sorts \(Q_0, Q_1, \ldots , Q_l\) of \(A({T},{S'})\) as follows. Define \(Q_0 = ()\) as an empty sequence and, for each \(1 \le i \le l\), \(Q_i\) is obtained from \(Q_{i1}\) by appending \(w_i\) to \(Q_{i1}\) if \(w_i \ne x\), and if \(w_i = x\), by appending x and \(x_1\) (in this order) to \(Q_{i1}\), and then appending \(x_2\) to \(Q_{i1}\) if it is not a leaf in \(S'\). We show, by induction, that each \(Q_i\) is a partial topological sort of \(A({T},{S'})\). The base case \(i = 0\) is clearly satisfied. So let us assume that for \(i > 0\) the sequence \(Q_{i  1}\) is a partial topological of of \(A({T},{S'})\). Consider now the vertex \(w_i\).

Case: \(w_i \in V(S)\)and \(w_i \not \preceq _S x\)
By Lemma 5, \(I_{A({T},{S})}(w_i) = I_{A({T},{S'})}(w_i)\). Since each member of \(I_{A({T},{S})}(w_i)\) precedes \(w_i\) in Q, \(\mathcal {M}(Q_{i1})\) contains \(I_{A({T},{S})}(w_i)\). It follows that appending \(w_i\) to \(Q_{i1}\) yields a partial topological sort \(Q_i\) of \(A({T},{S'})\).
In the remaining cases, we will make frequent use of the fact that if \(Q'\) is a partial topological sort of \(A({T},{S'})\) and v is a vertex with \(I_{A({T},{S'})}(v)\setminus M = \emptyset\) for some (possibly empty) subset \(M\subseteq \mathcal {M}(Q')\), then appending v to \(Q'\) yields a partial topological sort of \(A({T},{S'})\). In other words, we can w.l.o.g. assume \(I_{A({T},{S'})}(v)\setminus M\ne \emptyset\) for all such considered sets.

Case: \(w_i \in V(S)\)and \(w_i = x\)
We start by showing that the sequence \(Q^x_{i1}\) obtained by appending x to \(Q_{i1}\) is a partial topological sort of \(A({T},{S'})\). Let \(z \in I_{A({T},{S'})}(x)\). Suppose first that \(z \in V(S')\). Then (z, x) is either an A1 or A2edge of \(A({T},{S'})\). If (z, x) is an A2edge, then z is the parent of x in both S and \(S'\). Thus \((z, x) \in E(A({T},{S}))\) and since \(x \in \mathcal {M}(Q)\), we must have \(z \in \mathcal {M}(Q)\). Moreover, z must precede x in Q, and it follows that \(z \in \mathcal {M}(Q_{i1})\). If (z, x) is an A1edge, then \(x \preceq _{S'} z\). If \(x \prec _{S'} z\), then \(x \prec _{S} z\) as well. Thus in \(A({T},{S})\), there is a path of A2edges from z to x, implying that z precedes x in Q. Finally if \(x = z\), then \(A({T},{S'})\) contains the selfloop (x, x). In this case, there is an edge \((u, v) \in E(T)\) such that \((x, x) = (\widehat{\mu }_{S'}(u), \widehat{\mu }_{S'}(v))\). By construction, \(L(S'(x)) = L(S(x))\) and therefore, \((\widehat{\mu }_S(u), \widehat{\mu }_S(v)) = (x, x)\) is an edge of \(A({T},{S})\). This case cannot occur, since it is impossible that \(x \in \mathcal {M}(Q)\) if x is part of a selfloop. Therefore, z precedes x in Q whenever \(z \in V(S')\).
If instead \(z \in V(T)\), then (z, x) is either an A1 or A3edge of \(A({T},{S'})\), in which case there is \(z'\in V(T)\) such that \((z, x) = (z, \widehat{\mu }_{S'}(z'))\). By construction \(L(S'(x)) =L(S(x))\) and therefore, \((z, \widehat{\mu }_{S}(z')) = (z, x)\) is an edge of \(A({T},{S})\). Again, z must precede x in Q. We have thus shown that z precedes x in Q for every \(z \in I_{A({T},{S'})}(x) \subseteq \mathcal {M}(Q_{i1})\). Hence, appending x to \(Q_{i1}\) yields a partial topological sort \(Q^x_{i1}\) of \(A({T},{S'})\).
We continue with showing that \(Q_{i}\) is a partial topological sort of \(A({T},{S'})\). Note, \(Q_{i}\) is obtained by appending \(x_1\) and, in case \(x_2\) is not a leaf in \(S'\), also \(x_2\) to the partial topological sort \(Q^x_{i1}\) of \(A({T},{S'})\). Let \(z \in I_{A({T},{S'})}(x_j)\setminus \{x\}\), where \(x_j \in \{x_1, x_2\}\) is is chosen to be an interior vertex of \(S'\). Note, \(x_j=x_1\) is always possible as argued at the beginning of this proof. Suppose that \(z \in V(S')\). In this case, \((z, x_j)\) cannot be an A2edge since it would imply \(x=z\); a contradiction. Hence, \((z, x_j)\) is an A1edge of \(A({T},{S'})\) and \(x_j \preceq _{S'} z\). Similarly as before, if \(x_j \prec _{S'} z\), then \(x \prec _{S} z\) since \(z \ne x\). Thus, z precedes x in Q, since \(A({T},{S})\) contains a path of A2edges from z to x. If \(x_j = z\), then there is an edge \((u, v) \in E(T)\) such that \((\widehat{\mu }_{S'}(u), \widehat{\mu }_{S'}(v)) = (x_j, x_j)\). Since \(x_j\) is supposed not to be a leaf in \(S'\) and by construction of \(S'\) from S, we must have in S that \((\widehat{\mu }_S(u), \widehat{\mu }_S(v)) = (x, x)\), contradicting \(x \in \mathcal {M}(Q)\). Now, assume that \(z \in V(T)\) in which case \((z, x_j)\) is either an A1 or A3edge in \(A({T},{S'})\). Again, there must be a vertex \(z'\in V(T)\) such that \((z, x_j) = (z, \widehat{\mu }_{S'}(z'))\). By construction \(L(S'(x_i)) \subset L(S(x))\). This and \(x_j = \widehat{\mu }_{S'}(z')\) immediately implies that \(x = \widehat{\mu }_{S}(z')\). Thus, \((z, \widehat{\mu }_{S}(z')) = (z, x)\) is an edge of \(A({T},{S})\) and z must precede x in Q. Again, this holds for every z which implies implies that \(I_{A({T},{S'})}(x_j) \setminus \{x\} \subseteq \mathcal {M}(Q^x_{i1})\). Thus, appending \(x_1\) and \(x_2\) to \(Q^x_{i1}\) after x yields the partial topological sort \(Q_i\) of \(A({T},{S'})\).

Case: \(w_i \in V(S)\)and \(w_i \prec _S x\)
Since x is a cherry, \(w_i\) must be a leaf in S. Thus x precedes \(w_i\) in Q and therefore, we may assume that \(x, x_1\) and, in case \(x_2\) is not a leaf in \(S'\), also \(x_2\) are contained in the partial topological sort \(Q_{i1}\) of \(A({T},{S'})\) Note, \(x_2\) could be absent from \(Q_{i1}\) if it is a leaf and \(w_i = x_2\). That is, we may assume that \(w_i\) is a child of either \(x, x_1\) or \(x_2\) in \(S'\), and that the parent of \(w_i\) in \(S'\) is in \(Q_{i1}\). Consider \(z \in I_{A({T},{S'})}(w_i) \setminus \{x, x_1, x_2\}\). If \(z \in V(S')\), then \(w_i \preceq _{S'} z\). As before, if \(w_i \prec _{S'} z\), then \(w_i \prec _{S} z\) and because of the A2edges of \(A({T},{S})\), z precedes \(w_i\) in Q. If \(z = w_i\), then \((w_i, w_i)\) is a selfloop in \(A({T},{S'})\). By Lemma 3, \((w_i, w_i)\) is also a selfloop of \(A({T},{S})\); a contradiction since, by Remark 5, \(A({T},{S})\) has no selfloops on its leaves. So assume that \(z \in V(T)\). Then \((z, w_i)\) is an A1 or A3edge. Since \(w_i\) is a leaf, we have that for any \(v \in V(T)\), \(\widehat{\mu }_{S'}(v) = w_i\) if and only if \(\widehat{\mu }_S(v) = w_i\). It follows that \((z, w_i) \in E(A({T},{S}))\). Therefore, z precedes \(w_i\) in Q and z belongs to \(Q_{i1}\). Thus we may append \(w_i\) to \(Q_{i1}\) to obtain a partial topological sort \(Q_i\) of \(A({T},{S'})\).

Case: \(w_i \in V(T)\)
Let \(z \in I_{A({T},{S'})}(w_i)\). Thus, \((z,w_i)\) is either an A1 or A4edge in \(A({T},{S'})\). If \(z \in V(T)\), then \((z,w_i)\) is an A1edge in \(A({T},{S'})\). Since the eventlabels in T are fixed, \((z,w_i)\) is an A1edge in \(A({T},{S})\) and thus, \(z \in I_{A({T},{S})}(w_i)\). Therefore, z precedes \(w_i\) in Q.
Now, suppose \(z \in V(S')\). If \((z, w_i)\) is an A1edge, then the parent u of \(w_i\) in T satisfies \(\widehat{\mu }_{S'}(u) = z\). If \(z \notin \{x, x_1, x_2\}\), then we immediately obtain \(\widehat{\mu }_{S}(u) = z\). Hence, \((z, w_i) \in E(A({T},{S}))\) and thus, z precedes \(w_i\) in Q. If \(z \in \{x, x_1, x_2\}\), then it is easy to verify that \(\widehat{\mu }_S(u) = x\). Thus \((x, w_i) \in E(A({T},{S}))\), x precedes \(w_i\) in Q. By construction, we have added \(x,x_1,x_2\) in one of the previous steps to obtain \(Q_j\), \(1\le j\le i1\). Hence, \(z \in \{x, x_1, x_2\}\) precedes \(w_i\) in Q. If instead \((z, w_i)\) is an A4edge, then \(w_i\) has a child v such that \({\text {lca}}_{S'}(\widehat{\mu }_{S'}(w_i), \widehat{\mu }_{S'}(v)) = z\). Clearly, it holds that \(z = {\text {lca}}_{S'}(Z)\) for \(Z = \sigma _{T_{\mathcal {\overline{E}}}}(w_i) \cup \sigma _{T_{\mathcal {\overline{E}}}}(v)\). If \(z \in \{x, x_1, x_2\}\), then \(({\text {lca}}_S(Z), w_i) = (x, v) \in E(A({T},{S}))\), and if \(z \notin \{x, x_1, x_2\}\), then \(({\text {lca}}_S(Z), w_i) = ({\text {lca}}_{S'}(Z), w_i) = (z, w_i) \in E(A({T},{S}))\). In both cases, z precedes \(w_i\) in Q. In every case, each z is already contained in \(Q_{i1}\), and we may append \(w_i\) to \(Q_{i1}\) to obtain a partial topological sort \(Q_i\) of \(A({T},{S'})\).
We have shown that \(Q_l\) is a partial topological sort of \(A({T},{S'})\) satisfying \(\mathcal {M}(Q) \subseteq \mathcal {M}(Q_l)\). If we add indegree 0 vertices in \(Q_l\) until we obtain a maximal topological sort \(Q'\) of \(A({T},{S'})\), then have \(\mathcal {M}(Q) \subseteq \mathcal {M}(Q_l) \subseteq \mathcal {M}(Q')\), as desired. \(\square\)
We are now in the position to prove Theorem 3.
Proof of Theorem 3
It is easy to see that any solution \(S^*\) of \(((T; t, \sigma ), S')\) would be a solution for \(((T; t, \sigma ), S)\). Hence, if \(((T; t, \sigma ), S)\) does not admit a solution, then \(((T; t, \sigma ), S')\) cannot admit a solution.
For the converse, suppose now that \(((T; t, \sigma ), S)\) admits a solution. Thus, there is a binary refinement \(S^*\) of S that displays \(\mathcal {R}(T;t,\sigma )\) and such that \(A({T},{S^*})\) is acyclic. Let \(S'\) be any good split refinement of S at some cherry x of S. Furthermore, let \(x_1, x_2\) be the children of x in \(S'\), and let \(X = L(S'(x_1))\) and \(Y = L(S'(x_2))\). Note that \(\{X,Y\}\) is a partition of the children of x in S. Consider the trees \(S^*_X\) and \(S^*_Y\). We define another tree \(\widehat{S}\) obtained by replacing the children of x in \(S^*\) by \(S^*_X\) and \(S^*_Y\). More precisely, first observe that, by construction \(L(S^*_X)= X\) and \(L(S^*_Y)= Y\). Moreover, for any binary refinement \(S^*\) of S it must hold that \(L(S^*(x))\) is the set of children \(\mathrm {ch}(x)\) in S. In particular, x is an ancestor in \(S^*\) of every vertex in \(S^*_X\) as well as in \(S^*_Y\). Hence, we can safely replace the two subtrees \(S^*(v_1)\) and \(S^*(v_2)\) rooted at the two children \(v_1,v_2\) of x in \(S^*\) by \(S^*_X\) and \(S^*_Y\) (by defining the root of \(S^*_X\) and the root of \(S^*_Y\) as the two new children of x) to obtain another tree \(\widehat{S}\) with \(L(\widehat{S}) = L(S^*)\). By construction, \(\widehat{S}\) is identical to \(S^*\), except that the two subtrees below x are replaced by \(S^*_X\) and \(S^*_Y\). An example of the trees \(S, S', S^*\) and \(\widehat{S}\) is shown in Figure 4.
Let \(\widehat{x}_1\) and \(\widehat{x}_2\) be the children of x in \(\widehat{S}\), with \(L(\widehat{S}(\widehat{x}_1)) = X\) and \(L(\widehat{S}(\widehat{x}_2)) = Y\). Clearly, \(\widehat{S}(\widehat{x}_1)= S^*_X\), resp., \(\widehat{S}(\widehat{x}_2) =S^*_Y\) is a binary refinement of \(S'(x_1)\), resp., \(S'(x_2)\). Moreover, \(S^*_{L(S^*)\setminus (X\cup Y)}\) is a binary refinement of \(S'_{L(S')\setminus (X\cup Y)}\). Taking the latter two arguments together, \(\widehat{S}\) is a binary refinement of \(S'\).
We proceed with showing that \(\widehat{S}\) is a solution to \(((T; t, \sigma ), S')\). To this end, we apply Prop. 1 and show that \(\widehat{S}\) agrees with \(\mathcal {R}(T; t,\sigma )\) and that \(A({T},{\widehat{S}})\) is acyclic.
Let us first argue that \(\widehat{S}\) agrees with \(\mathcal {R}(T; t,\sigma )\). Observe first that since \(\widehat{S}\) contains \(S^*_X\) and \(S^*_Y\) as subtrees, \(\widehat{S}\) displays all triplets in \(abc \in rt(S^*)\) with \(a,b,c\in X\), or with \(a,b,c\in Y\). Moreover, \(\widehat{S}\) displays all triplets \(abc \in rt(S^*)\) for which at least one of a, b and c is not contained in \(X\cup Y\). The latter two arguments and \({\text {lca}}_{\widehat{S}}(X\cup Y)=x\) imply that \(\widehat{S}\) displays all triplets \(abc \in rt(S^*)\) except possibly those for which \(lca_{\widehat{S}}(a,b,c) = x\). Let \(R_x = \{abc \in rt(\widehat{S}) : lca_{\widehat{S}}(a,b,c) = x\}\). By the latter arguments, the only triplets in \(rt(\widehat{S})\) that are not in \(rt(S^*)\) are in \(R_x\), i.e. \(rt(\widehat{S}) \subseteq rt(S^*) \cup R_x\). By the definition of a good split refinement, \(S'\) agrees with \(\mathcal {R}(T; t,\sigma )\). Note that \(R_x\) contains precisely those triplets abc for which either \(a,b\in X\) and \(c\in Y\) or \(c\in X\) and \(a,b\in Y\). This observation immediately implies that \(R_x \subseteq rt(S')\). We thus have \(rt(\widehat{S}) \subseteq rt(S^*) \cup rt(S')\) and since both \(S^*\) and \(S'\) agree with \(\mathcal {R}(T; t,\sigma )\), it follows that \(\widehat{S}\) agrees with \(\mathcal {R}(T; t,\sigma )\).
We must now argue that \(A({T},{\widehat{S}})\) is acyclic. Assume for contradiction that \(A({T},{\widehat{S}})\) contains a cycle \(C = (w_1, w_2, \ldots , w_k, w_1)\). Since \(\widehat{S}\) is binary and agrees with \(\mathcal {R}(T; t, \sigma )\), \(\widehat{S}\) displays \(\mathcal {R}(T; t, \sigma )\) and Theorem 1 implies that there is a reconciliation map from from \((T;t,\sigma )\) to \(\widehat{S}\). By Lemma 3, \(A({T},{\widehat{S}})\) does not contain selfloops and thus \(k>1\) for \(C = (w_1,\ldots , w_k, w_1)\). We will derive a contradiction by showing that \(A({T},{S^*})\) contains a cycle. The proof is divided in a series of claims.

Claim 1If \((u, v) \in E(A({T},{\widehat{S}}))\)and \(u, v \notin V(\widehat{S}(x))\), then \((u, v) \in E(A({T},{S^*}))\).
Note that \(\widehat{S}\) and \(S^*\) are identical except for the subtree rooted at x. Thus, (u, v) is an A2edge in \(E(A({T},{\widehat{S}})\) if and only if it is an A2edge in \(A({T},{S^*})\) (assuming \(u, v \notin V(\widehat{S}(x))\)). Moreover, for all other edge types, notice that for every \(w \in V(T)\) such that \(\widehat{\mu }_{\widehat{S}}(w) \in V(\widehat{S}) \setminus V(\widehat{S}(x))\), we have \(\widehat{\mu }_{\widehat{S}}(w) = \widehat{\mu }_{S^*}(w)\). Thus if (u, v) is an edge of \(A({T},{\widehat{S}})\) with \(u, v \notin V(\widehat{S}(x))\), then it is of one of the forms \((w, z), (\widehat{\mu }_{\widehat{S}}(w), z), (w, \widehat{\mu }_{\widehat{S}}(z))\) or \((\widehat{\mu }_{\widehat{S}}(w), \widehat{\mu }_{\widehat{S}}(z))\), where \((w, z) \in E(T)\). Since T does not change and by the previous argument, all four cases lead to \((u, v) \in E(A({T},{S^*}))\). This proves Claim 1.
To stress once again, since \(\widehat{S}\) is binary and agrees with \(\mathcal {R}(T; t,\sigma )\), it must display \(\mathcal {R}(T; t,\sigma )\). Thus, we can apply Theorem 1 to conclude that there is a reconciliation map from \(\widehat{S}\) to \((T; t,\sigma )\).
Now, let \(Z = (V(T) \cup V(\widehat{S})) \setminus V(\widehat{S}(x))\). Observe that \(Z = (V(T) \cup V(S^*)) \setminus V(S^*(x))\). If C does not contain a vertex of \(V(\widehat{S}(x))\), then by Claim 1, every edge of C is also in \(A({T},{S^*})\). Thus C is also a cycle in \(A({T},{S^*})\), contradicting that it is acyclic. Therefore, we may assume that C contains at least one vertex from \(V(\widehat{S}(x))\). On the other hand, assume that C does not contain a vertex of Z. Then all the vertices of C belong to \(V(\widehat{S}(x))\). Since, as we argued before, \(A({T},{\widehat{S}})\) does not contain selfloops, we conclude that every edge (u, v) of C is either an A1 or an A2edge of \(A({T},{\widehat{S}})\) that satisfies \(v \prec _{\widehat{S}} u\). However, this implies that the edges of C cannot form a cycle; a contradiction. Therefore, C must contain vertices from both \(V(\widehat{S}(x))\) and Z. Assume, without loss of generality, that \(w_1 \in V(\widehat{S}(x))\) and \(w_k \in Z\).
Now, C can be decomposed into a set of subpaths that alternate between vertices of \(V(\widehat{S}(x))\) and of Z. More precisely, we say that a subpath \(P = (w_i, w_{i+1}, \ldots , w_l)\) of C, where \(1 \le i \le l \le k\), is a \(V(\widehat{S}(x))\)subpath if \(w_i, \ldots , w_l \in V(\widehat{S}(x))\). Similarly, we say that P is a Zsubpath if \(w_i, \ldots , w_l \in Z\). Now, \(C = (w_1, \ldots , w_k)\) is a concatenation of subpaths \(P_1, P'_1, P_2, P'_2, \ldots , P_h, P'_h\) such that for \(1 \le i \le h\), \(P_i\) is a nonempty \(V(\widehat{S}(x))\)subpath and \(P'_i\) is a nonempty Zsubpath.
We want to show that \(A({T},{S^*})\) contains a cycle. To this end, we will construct a cycle \(C^*\) in \(A({T},{S^*})\) such that \(C^*\) is the concatenation of subpaths \(P_1^*, P_1', \ldots , P_h^*, P_h'\), where each \(P^*_i\) is a subpath of \(A({T},{S^*})\) that replaces \(P_i\). First notice that for each \(1 \le i \le h\), all the edges of \(P'_i\) are in \(A({T},{S^*})\) by Claim 1. Therefore, every \(P'_i\) is a path in \(A({T},{S^*})\).
In what follows, we consider the \(V(\widehat{S}(x))\)subpath \(P_i = (w_p, w_{p+1}, \ldots , w_q)\), where \(1 \le i \le h\) (\(w_p = w_q\) may be possible if \(P_i\) consists of a single vertex only). Notice that \(w_{p  1}\) and \(w_{q+1}\) are in Z (where we define \(w_{p1} = w_k\) if \(p = 1\) and \(w_{q+1} = w_1\) if \(p = k\)). We construct a path \(P^*_i = (w^*_1, \ldots , w^*_r)\) of \(A({T},{S^*})\) such that \((w_{p1}, w^*_1) \in E(A({T},{S^*}))\) and \((w^*_r, w_{q+1}) \in E(A({T},{S^*}))\).
To this end, we provide the following

Claim 2 The vertex x does not belong to C.
Let Q be a maximal topological sort of \(A({T},{S})\) and let \(Q'\) be a maximal topological sort of \(A({T},{S'})\). By Lemma 6, \(\mathcal {M}(Q) \subseteq \mathcal {M}(Q')\). Moreover, since \(S'\) is a good split refinement, all the inneighbors of x in \(A({T},{S'})\) belong to Q. Since \(\mathcal {M}(Q) \subseteq \mathcal {M}(Q')\), all the inneighbors of x in \(A({T},{S'})\) are also in \(Q'\). This and maximality of \(Q'\) implies that x is itself also in \(Q'\). Let \(\widehat{Q}\) be a maximal topological sort of \(A({T},{\widehat{S}})\). Since \(\widehat{S}\) can be obtained from a sequence of split refinements starting from \(S'\), Lemma 6 implies that \(\mathcal {M}(Q') \subseteq \mathcal {M}(\widehat{Q})\). In particular, \(x \in \mathcal {M}(\widehat{Q})\). Lemma 4 implies that x cannot be contained in any cycle of \(A({T},{\widehat{S}})\), which proves Claim 2.
Recalling (again) that \(A({T},{\widehat{S}})\) does not contain selfloops, every edge (u, v) of \(P_i\) is an A1 or A2edge of \(A({T},{\widehat{S}})\) and satisfies \(v \prec _{\widehat{S}} u\). This implies that either \(w_q \prec _{\widehat{S}} w_{q1} \prec _{\widehat{S}} \ldots \prec _{\widehat{S}} w_p\), or that \(w_p=w_q\). In either case, we have \(w_q \preceq _{\widehat{S}} w_p\). By Claim 2, \(w_p \ne x\). This and \(w_p\in V(\widehat{S}(x))\) implies that \(w_p \prec _{\widehat{S}} x\). By construction of \(\widehat{S}\) we therefore have \(L(\widehat{S}(w_p)) \subseteq X\) or \(L(\widehat{S}(w_p)) \subseteq Y\). We will assume, without loss of generality, that \(L(\widehat{S}(w_p)) \subseteq X\). Since \(w_q \preceq _{\widehat{S}} w_p\), we have \(L(\widehat{S}(w_q)) \subseteq L(\widehat{S}(w_p)) \subseteq X\). We now construct two important sets \(X_p \subseteq X\) and \(X_q \subseteq X\) that are quite helpful for our construction of a cycle \(C^*\) in \(A({T},{S^*})\).

Claim 3There exists a subset \(X_p \subseteq X\)such that \(w_p ={\text {lca}}_{\widehat{S}}(X_p)\)and \((w_{p1}, {\text {lca}}_{S^*}(X_p)) \in E(A({T},{S^*}))\).
Since \(w_p \in V(\widehat{S})\), the edge \((w_{p1}, w_p)\) is either an A1, A2 or A3edge in \(A({T},{\widehat{S}})\). Suppose first that \((w_{p1}, w_p)\) is an A2edge. Then \(w_{p1}\) is the parent of \(w_p\) in \(\widehat{S}\). Since \(w_p \prec _{\widehat{S}} x\), this implies that \(w_{p1} \in V(\widehat{S}(x))\), contradicting \(w_{p1} \in Z\). Therefore, this case is not possible.
Suppose that \((w_{p1}, w_p)\) is an A1edge defined by some \((u, v) \in E(T)\). Then \(w_p\in V(\widehat{S})\) implies \(w_p = \widehat{\mu }_{\widehat{S}}(v) = {\text {lca}}_{\widehat{S}}(\sigma _{T_{\mathcal {\overline{E}}}}(v))\) and we define \(X_p = \sigma _{T_{\mathcal {\overline{E}}}}(v)\). We must prove that \((w_{p1}, {\text {lca}}_{S^*}(X_p)) \in E(A({T},{S^*}))\). Since \((u, v) \in E(T)\) yields the A1edge \((w_{p1}, w_p)\) in \(A({T},{\widehat{S}})\), we have \(t(v)\in \{\odot , \mathfrak {s}\}\). Hence, (u, v) yields some A1edge \((z, {\text {lca}}_{S^*}(X_p))\) in \(A({T},{S^*})\) for some vertex z. In what follows, we show that \(z=w_{p1}\).
If \(w_{p1} \in V(T)\), then \(w_{p1} = u\) and (u, v) defines the A1edge \((u, \widehat{\mu }_{S^*}(v)) = (w_{p1}, {\text {lca}}_{S^*}(X_p))\) in \(A({T},{S^*})\). If \(w_{p1} \in V(\widehat{S})\), then \(w_{p1} = \widehat{\mu }_{S^*}(u)\). Since \(w_{p1} \in Z\), vertex \(w_{p1}\) must be a strict ancestor of x in \(\widehat{S}\). This and the fact that \(S^*\) and \(\widehat{S}\) coincide except possibly in \(S^*(x)\) and \(\widehat{S}(x)\) implies that \(\widehat{\mu }_{\widehat{S}}(u) = \widehat{\mu }_{S^*}(u) = w_{p1}\). Hence, \((w_{p1}, {\text {lca}}_{S^*}(X_p)) \in E(A({T},{S^*}))\).
Finally, suppose that \((w_{p1}, w_p)\) is an A3edge defined by some \(u \in V(T)\). Then \(w_{p1} = u\) and \(w_p = \widehat{\mu }_{\widehat{S}}(u) = {\text {lca}}_{\widehat{S}}(\sigma _{T_{\mathcal {\overline{E}}}}(u))\), where \(\sigma _{T_{\mathcal {\overline{E}}}}(u) \subseteq X\). Define \(X_p = \sigma _{T_{\mathcal {\overline{E}}}}(u)\). Then \((w_{p1}, w_p) = (u, {\text {lca}}_{\widehat{S}}(X_p))\) and \((u, \widehat{\mu }_{S^*}(u)) = (w_{p1}, {\text {lca}}_{S^*}(X_p)) \in E(A({T},{S^*}))\). This proves Claim 3.

Claim 4: There exists a subset \(X_q \subseteq X\)such that \(w_{q} = {\text {lca}}_{\widehat{S}}(X_q)\)and \(({\text {lca}}_{S^*}(X_q), w_{q+1}) \in E(A({T},{S^*}))\).
We show first that \(w_{q+1} \in V(T)\). Assume, for contradiction, that \(w_{q+1} \in V(\widehat{S})\). Since \((w_q,w_{q+1})\) is an edge of \(A({T},{\widehat{S}})\) and since \(w_{q} \in V(\widehat{S})\), the edge \((w_q,w_{q+1})\) is an A1 or A2edge in \(A({T},{\widehat{S}})\). However in both cases, because there are no selfloops, \(w_{q+1} \prec _{\widehat{S}} w_q\) and thus, \(w_{q+1}\in V(\widehat{S}(x))\) ; a contradiction to \(w_{q+1} \in Z\). Hence, \(w_{q+1} \in V(T)\). Therefore, \((w_q, w_{q+1})\) is either an A1 or A4edge in \(A({T},{\widehat{S}})\).
Suppose first that \((w_q, w_{q+1})\) is an A1edge of \(A({T},{\widehat{S}})\) defined by some \((u, v) \in E(T)\). Then \((w_q, w_{q+1}) = (\widehat{\mu }_{\widehat{S}}(u), v)\), where \(\widehat{\mu }_{\widehat{S}}(u) = {\text {lca}}_{\widehat{S}}(\sigma _{T_{\mathcal {\overline{E}}}}(u))\) and where \(\sigma _{T_{\mathcal {\overline{E}}}}(u) \subseteq X\). Define \(X_q = \sigma _{T_{\mathcal {\overline{E}}}}(u)\). Then \((w_q, w_{q+1}) = ({\text {lca}}_{\widehat{S}}(X_q), w_{q+1})\), and \((\widehat{\mu }_{S^*}(u), v) = ({\text {lca}}_{S^*}(X_q), w_{q+1})\) is an A1edge of \(A({T},{S^*})\).
Suppose instead that \((w_q, w_{q+1})\) is an A4edge of \(A({T},{\widehat{S}})\) defined by some \((u, v) \in \mathcal {E}_T\) with \(u=w_{q+1}\). Then \((w_q, w_{q+1}) = ({\text {lca}}_{\widehat{S}}(\widehat{\mu }_{\widehat{S}}(u), \widehat{\mu }_{\widehat{S}}(v)), u) = ({\text {lca}}_{\widehat{S}}(\sigma _{T_{\mathcal {\overline{E}}}}(u) \cup \sigma _{T_{\mathcal {\overline{E}}}}(v)), u)\). Define \(X_q = \sigma _{T_{\mathcal {\overline{E}}}}(u) \cup \sigma _{T_{\mathcal {\overline{E}}}}(v)\). Hence, \(w_q = {\text {lca}}_{\widehat{S}}(X_q)\), and since \(w_q \in V(\widehat{S}(x))\), we must have \(\sigma _{T_{\mathcal {\overline{E}}}}(u) \cup \sigma _{T_{\mathcal {\overline{E}}}}(v) \subseteq X\). Moreover, \(({\text {lca}}_{S^*}(\widehat{\mu }_{S^*}(u), \widehat{\mu }_{S^*}(v)), u) = ({\text {lca}}_{S^*}(X_q), w_{q+1})\) is an A4edge of \(A({T},{S^*})\). This completes the proof of Claim 4.

Claim 5: Let \(X_p\)and \(X_q\)be subsets of X as defined in Claim 3 and 4. Then in \(A({T},{S^*})\), there exists a path from \({\text {lca}}_{S^*}(X_p)\) to \({\text {lca}}_{S^*}(X_q)\).
By Claim 3 and 4 we have \(w_p = {\text {lca}}_{\widehat{S}}(X_p)\) and \({\text {lca}}_{\widehat{S}}(X_q) = w_q\), respectively. As argued after the proof of Claim 2, we have \({\text {lca}}_{\widehat{S}}(X_q) = w_q \preceq _{\widehat{S}} w_p = {\text {lca}}_{\widehat{S}}(X_p)\). Because \(\widehat{S}\) contains \(S^*_X\) as a rooted subtree, it follows that \({\text {lca}}_{S^*}(X_q) \preceq _{S^*} {\text {lca}}_{S^*}(X_p)\). Because of the A2edges, there must be a path from \({\text {lca}}_{S^*}(X_p)\) to \({\text {lca}}_{S^*}(X_q)\) in \(A({T},{S^*})\). This completes the proof of Claim 5.
We may now finish the argument. For each \(1 \le i \le h\), we let \(P^*_i\) be the path obtained from Claim 5. We claim that by concatenating the paths \(P^*_1, P'_1, P^*_2, P'_2, \ldots , P^*_h, P'_h\) in \(A({T},{S^*})\), we obtain a cycle. We have already argued that each \(P^*_i\) and each \(P'_i\) is a path in \(A({T},{S^*})\). The rest follows from Claim 4, since it implies that for each \(1 \le i \le h\), the last vertex of \(P^*_i\) has the first vertex of \(P'_i\) as an outneighbor, and the last vertex of \(P'_i\) has the first vertex of \(P^*_{i+1}\) as an outneighbor (where \(P^*_{h+1}\) is defined to be \(P^*_1\)). We have thus found a cycle in \(A({T},{S^*})\), a contradiction to the acyclicity of \(A({T},{S^*})\).
Hence, \(A({T},{\widehat{S}})\) is acyclic. This and the fact that \(\widehat{S}\) displays \(\mathcal {R}(T;t,\sigma )\) implies that \(\widehat{S}\) is a solution to \(((T; t, \sigma ), S')\). Therefore, \(((T; t, \sigma ), S')\) admits a solution. \(\square\)
A.5 Proof of Theorem 5
Before proving Theorem 5, we provide a result that shows how maximal topological sorts and strict ancestors of vertices in S are related w.r.t. split refinements of S.
Lemma 7
Let Q be a maximal topological sort of \(A({T},{S})\). If there exists a good split refinement \(S'\)of S at a cherry x, then every strict ancestor of x in S and \(S'\)is in \(\mathcal {M}(Q)\).
Proof
Let \(S'\) be a good split refinement of S at x. By construction, the sets of ancestors of x in S and \(S'\) are equal.
Assume that there is a strict ancestor y of x that is not in Q. Due to the A2edges in \(A({T},{S})\) there is a directed path P from y to x in \(A({T},{S})\). Lemma 4 implies that none of the vertices along this path P are contained in \(\mathcal {M}(Q)\). Since y is a strict ancestor of x in S, we can conclude that the parent p(x) of x in S is not contained in \(\mathcal {M}(Q)\). Again, due to the A2edges of \(A({T},{S'})\), the pair (p(x), x) is an edge in \(A({T},{S'})\) and hence, p(x) is an inneighbor of x in \(A({T},{S'})\). However, since \(S'\) is a good split refinement of S, all the inneighbors of x in \(A({T},{S'})\) must, by definition, belong to \(\mathcal {M}(Q)\); a contradiction. Thus, every strict ancestor y of x in S and \(S'\) is in \(\mathcal {M}(Q)\). \(\square\)
In what follows, when we ask whether a fixed x admits a good split refinement, we can first check whether all of its ancestors are in Q, where Q is a maximal topological sort of \(A({T},{S})\). If this is not the case, then, by contraposition of Lemma 7, we may immediately conclude that there is no good split refinement at x.
Otherwise, we investigate x further.
We are now in a position to prove Theorem 5.
Proof of Theorem 5
In what follows, put \(G {:}{=}G((T; t, \sigma ), S, x)\). Suppose that there exists a good split refinement \(S'\) of S. Let x be the cherry of S that was refined from S to \(S'\), and let \(x_1, x_2\) be the children of x in \(S'\). Let Q be a maximal topological sort of \(A({T},{S})\). By Lemma 7, every strict ancestor of x in S is in Q. Let \(A = L(S(x_1))\) and \(B = L(S(x_2))\). We claim that for any pair \(a \in A, b \in B\), \(ab \notin E(G)\).
Assume for contradiction that there is an edge ab with \(a \in A, b \in B\). We treat each possible edge type separately.
(C1): Suppose that \(ab \in E(G)\) because there exists \(c \in L(S(x))\) such that \(abc \in \mathcal {R}(T; t,\sigma )\). Because \(a \in A\) and \(b \in B\) and by construction of \(S'\), we either have \(acb \in rt(S')\) if \(c \in A\), or \(bca \in rt(S')\) if \(c \in B\). In either case, \(S'\) does not agree with \(\mathcal {R}(T; t,\sigma )\), contradicting that \(S'\) is a good split refinement.
(C2): Suppose instead that \(ab \in E(G)\) because there exists an edge \((u, v) \in E(T)\) with \(t(u) \in \{\mathfrak {d}, \mathfrak {t}\}\), \(u \notin \mathcal {M}(Q)\), \(t(v) = \mathfrak {s}\) and \(a,b \in \sigma _{T_{\mathcal {\overline{E}}}}(v)\). By construction of \(S'\) and due to the choice of \(A = L(S(x_1))\) and \(B = L(S(x_2))\), we have \(\widehat{\mu }_{S'}(v) = lca_{S'}(\sigma _{T_{\mathcal {\overline{E}}}}(v)) \succeq _{S'} lca_{S'}(a,b) = x\). If \(\widehat{\mu }_{S'}(v) = x\), then \((u, \widehat{\mu }_{S'}(v)) = (u, x)\) is an A1edge of \(A({T},{S'})\). Thus, x has inneighbor u in \(A({T},{S'})\) such that \(u \notin \mathcal {M}(Q)\), which contradicts that \(S'\) is a good split refinement. So assume that \(\widehat{\mu }_{S'}(v) \succ _{S'} x\). In this case, \((u, \widehat{\mu }_{S'}(v))\) is an A1edge of \(S'\), and by Lemma 5, \((u, \widehat{\mu }_{S'}(v)) \in E(A({T},{S}))\). Since \(u \notin \mathcal {M}(Q)\), we must have \(\widehat{\mu }_{S'}(v) \notin \mathcal {M}(Q)\). Since \(\widehat{\mu }_{S'}(v) \succ _S x\), we obtain a contradiction to Lemma 7.
(C3): Suppose that \(ab \in E(G)\) because there exists an edge \((u, v) \in E(T)\) with \(t(u) = t(v) = \mathfrak {s}\), \(\widehat{\mu }_{S}(u) = x\) and \(a,b \in \sigma _{T_{\mathcal {\overline{E}}}}(v)\). Note, since \({\text {lca}}_S(a,b)=x\) and \(a,b \in \sigma _{T_{\mathcal {\overline{E}}}}(v)\), it must hold that \(x\preceq _S\widehat{\mu }_S(v)\). Moreover, \(t(u) = t(v) = \mathfrak {s}\) implies that u and v are contained in the same connected component of \(T_{\mathcal {\overline{E}}}\). This and \(v\prec _{T_{\mathcal {\overline{E}}}} u\) implies \(\sigma _{T_{\mathcal {\overline{E}}}}(v)\subseteq \sigma _{T_{\mathcal {\overline{E}}}}(u)\). Hence, \(\widehat{\mu }_S(v) \preceq _S \widehat{\mu }_S(u)\). Now, \(x\preceq _S\widehat{\mu }_S(v) \preceq _S \widehat{\mu }_S(u) = x\) implies \(\widehat{\mu }_S(v) =\widehat{\mu }_S(u) = x\). Therefore, \((\widehat{\mu }_S(u), \widehat{\mu }_S(v)) = (x, x)\) is an A1edge of \(A({T},{S})\), and it follows that \(x \notin \mathcal {M}(Q)\) (a vertex with a selfloop cannot never be added to a maximal topological sort). Moreover, because \(a, b \in \sigma _{T_{\mathcal {\overline{E}}}}(v)\) and \(a \in A = L(S(x_1))\) and \(b\in B = L(S(x_2))\), it holds that \(\widehat{\mu }_{S'}(u) = \widehat{\mu }_{S'}(v) = x\). Hence (x, x) is an A1edge of \(A({T},{S'})\) as well, and x has an inneighbor not in Q (namely x itself). This contradicts the assumption that \(S'\) is a good split refinement.
(C4): Suppose that \(ab \in E(G)\) because there is a vertex \(u \in V(T) \setminus \mathcal {M}(Q)\) such that \(t(u) \in \{\mathfrak {d}, \mathfrak {t}\}\) and \(a,b \in \sigma _{T_{\mathcal {\overline{E}}}}(u)\). The reasoning is similar to Case (C2). That is, we must have \(p {:}{=}\widehat{\mu }_{S'}(u) = lca_{S'}(\sigma _{T_{\mathcal {\overline{E}}}}(u)) \succeq _{S'} lca_{S'}(a, b) = x\). Now, \(A({T},{S'})\) contains the A3edge (u, p). We cannot have \(p = x\) because \(u \notin \mathcal {M}(Q)\) and \(S'\) is a good split refinement of S. Thus \(p \succ _{S'} x\). In this case, \((u, p) \in E(A({T},{S}))\) by Lemma 5. Thus p cannot be in \(\mathcal {M}(Q)\), which contradicts Lemma 7.
We have thus shown that ab cannot exist for any pair \(a\in A\) and \(b\in B\). Since A and B form a partition of V(G), the graph G must be disconnected.
Conversely, suppose that there exists a cherry x of S such that G is disconnected and such that every strict ancestor of x in S is in Q. Let (A, B) be any disconnected bipartition of G. Furthermore, let \(S'\) be the split refinement of S obtained by splitting the children of x into A and B and let \(x_1, x_2\) be the two children of x in \(S'\). W.l.o.g. assume that \(x_1\) and \(x_2\) is the ancestor of the leaves in A and B, respectively. We claim that \(S'\) is a good split refinement.
Let us first argue that \(S'\) agrees with \(\mathcal {R}(T; t, \sigma )\). Assume for contradiction that \(S'\) displays a triplet acb, but that \(abc \in \mathcal {R}(T; t, \sigma )\). By assumption, S agrees with \(\mathcal {R}(T; t, \sigma )\), so \(acb \in rt(S') \setminus rt(S)\). This implies that \({\text {lca}}_{S'}(a, b) = {\text {lca}}_{S'}(c, b) = x\). W.l.o.g we may assume that \(a, c \in A\) and \(b \in B\). However, Condition (C1) implies that we have the edge \(ab \in E(G)\), contradicting that (A, B) forms a disconnected bipartition. Therefore, \(S'\) agrees with \(\mathcal {R}(T; t, \sigma )\).
It remains to show that all inneighbors of x in \(A({T},{S'})\) are contained in \(\mathcal {M}(Q)\). Assume, for contradiction, that there is an edge \((p, x) \in E(A({T},{S'}))\) such that \(p \notin \mathcal {M}(Q)\). Since \(x\in V(S')\), the edge (p, x) it either an A1, A2 or A3edge in \(A({T},{S'})\). As it is now our routine, we check several cases separately.

Case: (p, x) is an A1edge and \(p \ne x\).
In this case (p, x) is defined by some edge \((u, v) \in E(T)\). Suppose that \((p, x) = (\widehat{\mu }_{S'}(u), \widehat{\mu }_{S'}(v))\). Since \(p \ne x\), p is a strict ancestor of x in \(S'\), and hence also in S. This is not possible, since we assume that every strict ancestor of x in S belongs to Q (whereas here we suppose \(p \notin \mathcal {M}(Q)\)). We deduce that \((p, x) = (u, \widehat{\mu }_{S'}(v))\). Therefore, \(u \notin \mathcal {M}(Q)\), \(t(u) \in \{\mathfrak {d}, \mathfrak {t}\}\) and \(t(v) = \mathfrak {s}\). Moreover, since \(\widehat{\mu }_{S'}(v) = x\) and x has only the two children \(x_1\) and \(x_2\) in \(S'\), we can conclude there are \(a,b \in \sigma _{T_{\mathcal {\overline{E}}}}(v)\) such that \(a \preceq _{S'} x_1\) and \(b \preceq _{S'} x_2\), i.e. \(a \in A, b \in B\). The latter two arguments imply that Condition (C2) is satisfied for a and b and, therefore, \(ab\in E(G)\); a contradiction to (A, B) are forming a disconnected bipartition.

Case: (p, x) is an A1edge and \(p = x\).
In this case, \((p, x) = (x, x) = (\widehat{\mu }_{S'}(u), \widehat{\mu }_{S'}(v))\) is defined by some edge (u, v) of T. Since x is an internal vertex of \(S'\), we must have \(t(u) = t(v) = \mathfrak {s}\). Since \(L(S(x)) = L(S'(x))\) and x is a cherry in S, we also have \((\widehat{\mu }_S(u), \widehat{\mu }_S(v)) = (x, x)\). Moreover because \(\widehat{\mu }_{S'}(v) = x = {\text {lca}}_{S'}(x_1,x_2)\), there must exist distinct a, b with \(a\prec _{S'}x_1\) and \(b\prec _{S'}x_2\) such that \(a,b \in \sigma _{T_{\mathcal {\overline{E}}}}(v)\). Thus, \(a \in A, b \in B\). Moreover ab satisfies the Condition (C3). Thus, \(ab\in E(G)\); a contradiction to our assumption that (A, B) forms a disconnected bipartition.

Case: (p, x) is an A2edge.
This case is not possible, since the parent of x is the same in S and \(S'\), and we assume that all strict ancestors of x in S are in Q.

Case: (p, x) is an A3edge.
In this case, \((p, x) = (u, \widehat{\mu }_{S'}(u))\) is defined by a vertex \(u \in V(T)\) such that \(t(u) \in \{\mathfrak {d}, \mathfrak {t}\}\) and \(\widehat{\mu }_{S'}(u) = x\). Since \(u = p\) and, by assumption \(p \notin \mathcal {M}(Q)\), we have \(u \in V(T) \setminus \mathcal {M}(Q)\).
As in the A1case, there must be \(a, b \in \sigma _{T_{\mathcal {\overline{E}}}}(u)\) such that \(a \in A, b \in B\). Then ab should be an edge of G because of Condition (C4), a contradiction.
We have shown that the (p, x) edge cannot exist. Therefore in \(A({T},{S'})\), all the inneighbors of x are in Q. Since \(S'\) also agrees with R, it follows that splitting the children of x into (A, B) forms a good split refinement at x. \(\square\)
A.6 Proof of Lemma 2
Proof of Lemma 2
To compute \(\mathcal {R}(T; t, \sigma )\) as in Def. 1 we can proceed as follows: We first compute the \({\text {lca}}_{T_{\mathcal {\overline{E}}}}\)’s for every pair of vertices within the connected components of \(T_{\mathcal {\overline{E}}}.\) This task can be done in constant time for each pair of vertices after linear preprocessing of the trees in \(T_{\mathcal {\overline{E}}}\) [53, 54]. Thus, we end in an overall time complexity of \(O(n^2)\) to compute all \({\text {lca}}_{T_{\mathcal {\overline{E}}}}\)’s between the leaves of T. We now compute the distance from the root \(\rho _{{{\widetilde{T}}}}\) to all other vertices in \(V({{\widetilde{T}}})\) for every connected component \({{\widetilde{T}}}\) of \(T_{\mathcal {\overline{E}}}\). The latter can be done for each individual connected component \({{\widetilde{T}}}\) via Dijkstra’s algorithm in \(O(V({{\widetilde{T}}})^2)\) time. As this must be done for all connected components of \(T_{\mathcal {\overline{E}}}\) and since \(\sum _{{{\widetilde{T}}}} V({{\widetilde{T}}})^2 \le (\sum _{{{\widetilde{T}}}} V({{\widetilde{T}}}))^2 = V(T)^2\) we end in time \(O(V(T)^2) = O(n^2)\) to compute the individual distances. Now, for all three distinct leaves a, b, c within the connected components of \(T_{\mathcal {\overline{E}}}\), we compare the relative order of \(x={\text {lca}}_{T_{\mathcal {\overline{E}}}}(a,b)\), \(y={\text {lca}}_{T_{\mathcal {\overline{E}}}}(a,c)\), and \(z={\text {lca}}_{T_{\mathcal {\overline{E}}}}(b,c)\) which can be done directly by comparing the distances \(d_{{{\widetilde{T}}}}(\rho _{{{\widetilde{T}}}},x)\), \(d_{{{\widetilde{T}}}}(\rho _{{{\widetilde{T}}}},y)\) and \(d_{{{\widetilde{T}}}}(\rho _{{{\widetilde{T}}}},z)\). It is easy to see that at least two of the latter three distances must be equal. Hence, as soon as we have found that two distances are equal but distinct from the third, say \(d_T(\rho _T,x)\ne d_T(\rho _T,y)=d_T(\rho _T,z)\), we found the triplet abc that is displayed by \({{\widetilde{T}}}\). If, in addition, \(t(z)=\mathfrak {s}\) and \(\sigma (a), \sigma (b), \sigma (c)\) are pairwise distinct, then we add \(\sigma (a)\sigma (b)\sigma (c)\) to \(\mathcal {R}(T; t, \sigma )\). The latter tasks can be done in constant for every triplet a, b, c. Since there are at most \(\left( {\begin{array}{c}n\\ 3\end{array}}\right) =O(n^3)\) triplets in T, we end in an overall timecomplexity \(O(n^3)\) to compute all triplets displayed by T that satisfy Def. 1(1).
Now we proceed to construct for all transfer edges \((u,v)\in \mathcal {E}_T\) the triplets \(\sigma (a)\sigma (b)\sigma (c)\) for all \(a,b\in L(T_{\mathcal {\overline{E}}}(u))\) and \(c\in L(T_{\mathcal {\overline{E}}}(v))\) as well as for all \(c\in L(T_{\mathcal {\overline{E}}}(u))\) and \(a,b\in L(T_{\mathcal {\overline{E}}}(v))\) with \(\sigma (a), \sigma (b), \sigma (c)\) being pairwise distinct. To this end, we need to compute \(L(T_{\mathcal {\overline{E}}}(w))\) for all \(w\in V(T)\). We may traverse every connected component \({{\widetilde{T}}}\) of \(T_{\mathcal {\overline{E}}}\) from the root \(\rho _{T_{\mathcal {\overline{E}}}}\) to each individual leaf and and for each vertex w along the path from \(\rho _{T_{\mathcal {\overline{E}}}}\) to a leaf l, we add the leaf l to \(L(T_{\mathcal {\overline{E}}}(w))\). As there are precisely \(L({{\widetilde{T}}})\) such paths, each having at most \(V({{\widetilde{T}}})\in O(L({{\widetilde{T}}}))\) vertices, we end in \(O(L({{\widetilde{T}}})^2)\) time to compute \(L(T_{\mathcal {\overline{E}}}(w))\) for all \(w\in V({{\widetilde{T}}})\). As this step must be repeated for all connected components \({{\widetilde{T}}}\) of \(T_{\mathcal {\overline{E}}}\) we end, by the analogous arguments as in the latter paragraph, in \(\sum _{{{\widetilde{T}}}} O(L({{\widetilde{T}}})^2) = O(n^2)\) time to compute \(L(T_{\mathcal {\overline{E}}}(w))\) for all \(w\in V(T)\). Now, for every transfer edge \((u,v)\in \mathcal {E}_T\) the triplets \(\sigma (a)\sigma (b)\sigma (c)\) (with \(\sigma (a), \sigma (b), \sigma (c)\) being pairwise distinct) are added to \(\mathcal {R}(T; t, \sigma )\) for all \(a,b\in L(T_{\mathcal {\overline{E}}}(u))\) and \(c\in L(T_{\mathcal {\overline{E}}}(v))\) as well as for all \(c\in L(T_{\mathcal {\overline{E}}}(u))\) and \(a,b\in L(T_{\mathcal {\overline{E}}}(v))\). Note, none of the trees \(T_{\mathcal {\overline{E}}}\) contains transfer edges. Moreover, for each transfer edge (u, v) we have, by Axiom (O3), \(\sigma _{T_{\mathcal {\overline{E}}}}(v)\cap \sigma _{T_{\mathcal {\overline{E}}}}(u) = \emptyset\). The latter two arguments imply that, for each transfer edge (u, v), precisely \(\left( {\begin{array}{c}\sigma (L(T_{\mathcal {\overline{E}}}(v)))\\ 2\end{array}}\right) \sigma (L(T_{\mathcal {\overline{E}}}(u)))+ \left( {\begin{array}{c}\sigma (L(T_{\mathcal {\overline{E}}}(u)))\\ 2\end{array}}\right) \sigma (L(T_{\mathcal {\overline{E}}}(v)))\) triplets are added.
Now, let \(\mathcal {T} = \{T_1, T_2, \ldots , T_k\}\) be the set of trees in the forest \(T_{\mathcal {\overline{E}}}\). For each \(i \in \{1, \ldots , k\}\), define \(n_i = L(T_i)\). Let us write \(T_i \rightarrow T_j\) if there exists a transfer edge \((u, v) \in \mathcal {E}_T\) satisfying \(u \in V(T_i), v \in V(T_j)\). It is easy to verify that there is exactly one transfer edge connecting two distinct connected components of \(T_{\mathcal {\overline{E}}}\), as otherwise, some root vertex of some \(T_j\) would have indegree 2 or more in T (since all transfer edges go from a vertex to a root of another subtree of \(T_{\mathcal {\overline{E}}}\)). For each transfer edge \((u, v) \in \mathcal {E}_T\), where \(u \in V(T_i)\) and \(v \in V(T_j)\), we can bound the number of added triplets by \(\left( {\begin{array}{c}\sigma _{T_{\mathcal {\overline{E}}}}(u)\\ 2\end{array}}\right) \sigma _{T_{\mathcal {\overline{E}}}}(v)+ \left( {\begin{array}{c}\sigma _{T_{\mathcal {\overline{E}}}}(v)\\ 2\end{array}}\right) \sigma _{T_{\mathcal {\overline{E}}}}(u) \le n_i^2 n_j + n_i n_j^2\). The total number of triplets considered is then at most
$$\begin{aligned}&\sum _{T_i \in \mathcal {T}} \sum _{T_j : T_i \rightarrow T_j} \left( n_i^2n_j + n_j^2n_i \right) \\&\quad = \sum _{T_i \in \mathcal {T}} n_i^2 \sum _{T_j : T_i \rightarrow T_j} n_j + \sum _{T_i \in \mathcal {T}} n_i \sum _{T_j : T_i \rightarrow T_j} n_j^2 \\&\quad \le \sum _{T_i \in \mathcal {T}} n_i^2 \cdot n + \sum _{T_i \in \mathcal {T}} n_i \cdot n^2 \\&\quad = n \sum _{T_i \in \mathcal {T}} n_i^2 + n^2 \sum _{T_i \in \mathcal {T}} n_i \le 2n^3 \in O(n^3) . \end{aligned}$$
In the latter approximation, we have used the fact that distinct trees \(T_i\) and \(T_j\) have disjoint sets of leaf sets (cf. [4, Lemma 1]). Thus, \(\sum _{T_i \in \mathcal {T}} n_i \le n\) and \(\sum _{T_j : T_i \rightarrow T_j} n_i \le n\). In summary, \(\mathcal {R}(T; t, \sigma )\) can be computed in \(O(n^3)\) time.
Finally, note that if \((T; t, \sigma )\) is binary such that all inner vertices are labeled as speciation \(\mathfrak {s}\) and for all two distinct leaves \(x,y\in L(T)\) we have \(\sigma (x)\ne \sigma (y)\), then \(\mathcal {R}(T; t, \sigma )=\left( {\begin{array}{c}n\\ 3\end{array}}\right) \in O(n^3)\). Hence, the boundary \(O(n^3)\) can indeed be achieved and thus, the worstcase runtime is \(\Theta (n^3)\). \(\square\)
A.7 Proof of Theorem 6
Proof of Theorem 6
We first prove the correctness of the algorithm. Algorithm 2 takes as input a labeled gene tree \((T;t,\sigma )\). First \(\mathcal {R}(T;t,\sigma )\) is computed and the star tree S (which clearly agrees with \(\mathcal {R}(T;t,\sigma )\)) will be furthermore refined. Moreover, S contains at this point of computation only one cherry, namely the root r of S, and \(G((T;t,\sigma ),S,r)\) is computed. Now, in each step of the whileloop it is first checked if S is nonbinary and if in one of the previous steps a good split refinement has been found. In this case, it is first checked (forloop) if there are nonbinary cherries of the current tree S for which all strict ancestors are contained in \(\mathcal {M}(Q)\) with Q being the maximal topological sort of \(A({T},{S})\). If this is not the case for all nonbinary cherries, the whileloop terminates according to Lemma 7 and the algorithm correctly outputs “No timeconsistent species tree exists”. Contrary, if there is a nonbinary cherry x for which all strict ancestors are contained in \(\mathcal {M}(Q)\), then it is checked whether we have not found already a good split for S and if \(G((T;t,\sigma ),S,x)\) is disconnected. In this case, we can apply Theorem 5 to conclude that there is a good split refinement for S at x which is computed in the subsequent step. If, however, for all nonbinary cherries \(G((T;t,\sigma ),S,x)\) is connected, the algorithm correctly outputs “No timeconsistent species tree exists” according to Theorem 5. Finally, if in each step of the whileloop we have found a good split refinement and S does not contain a nonbinary cherry, then S must, by construction, be binary. In this case, repeated application of Theorem 3 shows that the final binary tree S is a solution to the underlying GTC instance and the algorithm correctly returns S. Thus, Algorithm 2 correctly computes a timeconsistent binary species tree for \((T;t,\sigma )\), if one exists.
We next analyze the running time of the algorithm. Let \(\Sigma = \sigma (L(T))\) be the set of species. We will frequently use the fact that \(\Sigma  \le n\). The main challenge in optimizing this algorithm is to be able to efficiently construct and update the \(G((T;t,\sigma ), S, x)\) graphs. We will save this analysis for the end of the proof, and will ignore the time spent on graph updates for now.
We will assume that \(\sigma _{T_{\mathcal {\overline{E}}}}(u)\) is computed and stored for each \(u \in V(T)\). As argued in the proof of Lemma 2, this can be done in time \(O(n^2)\). Also by Lemma 2, the triplet set \(\mathcal {R}(T; t, \sigma )\) can be computed in \(O(n^3)\) time. Since every iteration of the main while loop adds a new binary vertex in S, the loop will be executed O(n) times (since a binary tree on \(\Sigma  \le n\) leaves has O(n) internal vertices). By [4, Lemma 3], computing \(\widehat{\mu }_{T,S}\) can be done in time O(\(n\log (\Sigma ))=O(n\log (n))\). By [4, Thm. 6], the auxiliary graph \(A({T},{S})\) can be computed in \(O(V(T)\log (V(S)))\) time. Since \(O(V(T)) = O(n)\) and \(O(V(S)) = O(n)\), the latter task can be done in \(O(n\log (n))\) time. Construction of Q can be done in time \(O(V(A({T},{S})) + E(A({T},{S}))) = O(n)\) using the techniques of [52] and by observing that the edges in \(E(A({T},{S}))\) cannot exceed \(E(T)+E(S)=O(n)\).
In each pass of the main while loop, we iterate through O(n) nonbinary cherries. Let \(c_1, \ldots , c_k\) be the nonbinary cherries of S, assuming that each auxiliary \(G((T;t,\sigma ), S, c_i)\) graph is already precomputed. Since \(c_1, \ldots , c_k\) are cherries of S, the sets in \(\{L(S(c_1)), L(S(c_2)), \ldots L(S(c_k))\}\) must be pairwise disjoint. Denoting \(n_i = L(S(c_i))\), \(1 \le i \le k\), we thus observe that \(\sum _{i = 1}^{k}n_i \le n\). In the worst case, we go through every cherry and check connectedness in time \(O(n_i^2)\) on each graph \(G((T;t,\sigma ), S, c_i)\) via “classical” breadthfirst search. Thus in one iteration of the main while loop, the total time spent on connectedness verification is \(O(\sum _{i = 1}^{k}n_i^2) = O(n^2)\). When we apply a split refinement, we compute \(\widehat{\mu }_{T,S}(u)\) for all \(u\in V(T)\), \(A({T},{S})\) and Q at most once per while iteration, each operation being feasible in time \(O(n \log n)\). To be more precise, as soon as we have found a good split refinement we put Has_GoodSplit=TRUE. Hence, the ifcondition (Line 11) will then not be satisfied, and we will not recompute the values \(\widehat{\mu }_{T,S}(u)\), \(A({T},{S})\) and Q again for the remaining nonbinary cherries x of S within the forloop (Line 10). As there are O(n) iterations, the time spent on operations other than graph construction and updates is \(O(n^3)\).
Let us now argue that the total time spent on the auxiliary \(G((T;t,\sigma ), S, x)\) graph updates can be implemented to take time \(O(n^3)\). To this end, we maintain a special data structure that, for each 2element subset \(\{a,b\} \subseteq \Sigma\), remembers the members of \(\Sigma \cup V(T)\) that may cause ab to be an edge in the auxiliary graphs. We describe this in more detail. For a certain species tree S, we say that \(a,b \in L(S)\) are siblings if a and b have the same parent in S. For any two siblings a, b of S, define
$$\begin{aligned} l_1(a,b)&= \{c \in \Sigma :c \text{ is } \text{ a } \text{ sibling } \text{ of } a \text{ and } b, \text{ and } \\&\quad abc \in \mathcal {R}(T;t,\sigma )\} \\ l_2(a,b)&= \{u \in V(T) :\exists v \in V(T) \hbox { such that}\ (u,v) \\&\quad \text{ satisfies } \text{(C2) }\} \\ l_3(a,b)&= \{u \in V(T) :\exists v \in V(T) \hbox { such that}\ (u,v) \\&\quad \text{ satisfies } \text{(C3) } \text{ and } ab\in \mathrm {ch}(x)\}\\ l_4(a,b)&= \{u \in V(T) :u \text{ satisfies } \text{(C4) } \} \end{aligned}$$
Note that if we have access to each of the four \(l_i\) sets for any siblings a, b, then we may construct a graph \(G {:}{=}G((T;t,\sigma ), S, x)\) in time \(O(n^2)\). Indeed, to decide whether there is an edge ab in \(G((T;t,\sigma ), S, x)\), it suffices to check whether one \(l_i(a,b)\), \(1\le i \le 4\), is nonempty, a task that can done in constant time for each two vertices \(a,b\in \Sigma\). Since there are \(O(n^2)\) pairs to check, the graph construction takes time \(O(n^2)\). After each binary refinement, there are two new graphs to construct (one for each child of the new binary vertex), and since there are \(O(n^2)\) iterations, the total time spent for constructing graphs will be \(O(n^3)\). The main challenge is to update the \(l_i\) sets after a binary refinement, which we now analyze.
We thus show how to maintain these four sets for each pair of siblings as S undergoes split refinements, starting with the initial star tree S. With S being a star tree, the set \(l_1(a,b)\) can be constructed in time \(O(n^3)\) for all a, b by iterating through \(\mathcal {R}(T;t,\sigma )\) once, and each \(l_i(a,b)\), \(i \in \{2,3,4\}\) can be constructed in time \(O(n^3)\) by first constructing \(A({T},{S})\) with its maximal topological sort Q and, for each a, b pair, checking every vertex and edge of T for conditions (C2), (C3) and (C4). It is easy to see that each condition can be checked in constant time per edge or vertex.
Now assume inductively that \(l_1,l_2,l_3\) and \(l_4\) are known for each pair of siblings of S. Assume that we perform a split refinement at some cherry x of S, yielding a tree \(S'\) in which \(x_1, x_2\) are the new children of x. We then need to compute \(G((T;t,\sigma ), S, x_1)\) and \(G((T;t,\sigma ), S, x_2)\). Denote \(X_1 = L(S'(x_1))\) and \(X_2 = L(S'(x_2))\), let Q (resp. \(Q'\)) be a maximal topological sort of \(A({T},{S})\) (resp. \(A({T},{S'})\)). We describe how each \(l_i\) update is done, and argue on the total time spent on each update type (by total time, we mean summing the time over every iteration of the for loop).

(The \(l_1\) set). For \(a,b \in X_1\), we may need to remove c from \(l_1(a,b)\) if \(c \in X_2\) since it is not a sibling of a and b anymore. Thus, for each \(a,b \in X_1\) and each \(c \in X_2\), we remove c from \(l_1(a,b)\) if present (and we do the same for each \(a'b' \in X_2, c' \in X_1\)). Therefore, each time that a pair \(a,b \in \Sigma\) gets separated from some \(c \in \Sigma\) during the species tree construction, we need O(1) time to remove c from \(l_1(a, b)\). Importantly, this separation occurs at most once for each triplet \(\{a,b,c\}\) during the whole algorithm execution. Therefore, in total we spend time O(1) on \(l_1\) for each distinct \(a,b,c \in \Sigma\), and so the total time spent on updating \(l_1\) is \(O(n^3)\).

(The \(l_2\) set). Let \(a,b \in X_i\), \(i \in \{1,2\}\). Recall that we must have \(u \in l_2(a,b)\) if there is \((u, v) \in E(T)\) such that \(t(u) \in \{\mathfrak {d}, \mathfrak {t}\}, u \notin \mathcal {M}(Q')\), \(t(v) = \mathfrak {s}\) and \(\{a, b\} \subseteq \sigma _{T_{\mathcal {\overline{E}}}}(v)\). Since \(\mathcal {M}(Q) \subseteq \mathcal {M}(Q')\) and t does not change when refining, after one binary refinement we can only remove elements from \(l_2(a, b)\), and never insert new elements. That is, we only need to remove some u from \(l_2(a, b)\) if \(u \notin \mathcal {M}(Q)\) but \(u \in \mathcal {M}(Q')\). Therefore, when computing \(Q'\) and adding a new element \(u \in \mathcal {M}(Q') \setminus \mathcal {M}(Q)\), we remove u from each \(l_2(a, b)\) that contains u. This takes time \(O(n^2)\) every time we add a new element in the maximal topological sort, and this is enough to keep \(l_2\) uptodate. Importantly, each vertex of T gets added at most once in Q during the execution of the whole algorithm. Therefore, maintaining \(l_2\) consumes total time \(O(n^3)\) in total.

(The \(l_4\) set). Let \(a,b \in X_i\), \(i \in \{1,2\}\). Recall that we must have \(u \in l_4(a,b)\) if \(u \in V(T)\), \(t(u) \in \{\mathfrak {d}, \mathfrak {t}\}, u \notin \mathcal {M}(Q')\), and \(\{a, b\} \subseteq \sigma _{T_{\mathcal {\overline{E}}}}(u)\). This can be handled exactly as in the \(l_2\) set. That is, since t never changes, u can only be removed from \(l_4\) when adding u to \(Q'\). Thus when adding a vertex u to the maximal topological sort, we remove u from every \(l_4(a, b)\) containing u, which takes time \(O(n^2)\). Since each u gets added at most once in Q, maintaining \(l_4\) takes \(O(n^3)\) times in total.

(The \(l_3\) set). Let \(a,b \in X_i\), \(i \in \{1,2\}\). Recall that we must have \(u \in l_3(a, b)\) if there is \((u, v) \in E(T)\) such that \(t(u) = t(v) = \mathfrak {s}\), \(\widehat{\mu }_{S'}(u) = x_i\) and \(a,b \in \sigma _{T_{\mathcal {\overline{E}}}}(v)\). Note that if \(\widehat{\mu }_{S'}(u) = x_i\), then \(\widehat{\mu }_{S}(u) = x\), and x was the parent of a and b in S. Since t does not change after refining, this means that if u must be in \(l_3(a, b)\) after the binary refinement, then u was also in \(l_3(a, b)\) before the refinement. It follows that we never add new vertices into \(l_3(a, b)\). It therefore suffices to detect when some u needs to be removed from \(l_3(a, b)\). Recall that when refining S into \(S'\), \(\widehat{\mu }_{S'}(u) \ne \widehat{\mu }_S(u)\) is only possible if \(\widehat{\mu }_S(u) =x\) and \(\widehat{\mu }_{S'}(u) \in \{x, x_1, x_2\}\). There are thus three cases to consider. If \(\widehat{\mu }_{S'}(u) = x\), then we remove u from all \(l_3(a, b)\) such that \(a,b \in X_1\) or \(a, b \in X_2\). We note that we will never consider again the \(\{a, b, u\}\) triplet because u will never be refined again. If \(\widehat{\mu }_{S'}(u) = x_1\), then u stays present in all \(l_3(a, b)\) such that \(a,b \in X_1\), but we must remove u from every \(l_3(a, b)\) such that \(a, b \in X_2\). Symmetrically, if \(\widehat{\mu }_{S'}(u)\), we remove u from every \(l_3(a, b)\) such that \(a, b \in X_1\). In either case, the triplets \(\{a, b, u\}\) evaluated in the last two cases will never be considered again because u will never be mapped to an ancestor of a and b in future refinements of \(S'\). Globally, we therefore notice that for any triplet \(\{a, b, u\}\) such that \(a, b \in L(S)\) and \(u \in V(T)\), we only need to consider once the removal of u from \(l_3(a, b)\), and this removal takes O(1) time. We deduce that maintaining \(l_3\) requires total time \(O(n^3)\).
To summarize, the \(l_i\) sets can be kept uptodate after each split refinement in total time \(O(n^3)\). Since the other operations also take time \(O(n^3)\), the complete algorithm also takes \(O(n^3)\) time.
Finally, among all algorithms that compute \(\mathcal {R}(T; t, \sigma )\), Lemma 2 implies that the boundary \(O(n^3)\) is tight, that is the worstcase runtime is \(\Theta (n^3)\)\(\square.\)