{'fraction_non_alphanumeric': 0.04858042494641865, 'fraction_numerical': 0.011827587119307809, 'mean_word_length': 3.691410129096326, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
On the computational complexity of the maximum parsimony reconciliation problem in the duplication-loss-coalescence model

Background Phylogenetic tree reconciliation is a widely-used method for inferring the evolutionary histories of genes and species. In the duplication-loss-coalescence (DLC) model, we seek a reconciliation that explains the incongruence between a gene and species tree using gene duplication, loss, and deep coalescence events. In the maximum parsimony framework, costs are associated with these event types and a reconciliation is sought that minimizes the total cost of the events required to map the gene tree onto the species tree. Results We show that this problem is NP-hard even for the special case of minimizing the number of duplications. We then show that the problem is APX-hard when both duplications and losses are considered, implying that no polynomial-time approximation scheme can exist for the problem unless P = NP. Conclusions These intractability results are likely to guide future research on algorithmic aspects of the DLC-reconciliation problem.


Background
Phylogenetic tree reconciliation is a fundamental technique in the study of the evolutionary relationships of genes and species. Given a gene tree, a species tree, and the association between their leaves, we seek to explain the incongruence between the two trees using a set of evolutionary events. In the widely-used DL model, duplication and loss events are considered, while the DTL model considers horizontal transfers as well. Although these models can explain paralogous gene families, they do not address population effects. In contrast, coalescent models [1] can explain population effects but implicitly assume that all genes are orthologs. Recently, a new duplication-loss-coalescence (DLC) model has been proposed that combines the duplication-loss tree reconciliation model with a coalescent model. This DLC model has been shown to have higher accuracy of reconstructing evolutionary events than the DL model alone [2,3].
Reconciliation is often performed using a maximum parsimony formulation in which each type of event in the model has an associated non-negative cost and the objective is to find a reconciliation of minimum total cost. Wu et al. [3] gave the first maximum parsimony algorithm for the DLC reconciliation problem. That algorithm has worst-case exponential time, leaving open the question of whether the problem can be solved in polynomial time.
In this paper, we show that the DLC parsimony problem is NP-hard and, further, has no polynomial-time approximation scheme (PTAS) unless P = NP. Specifically, we show that:

Problem statement and preliminaries
This section provides notation, definitions, and basic results that will be used throughout the paper.

Graph definitions
We begin with notation and definitions adapted from Wu et al. [3]. A tree is a rooted binary tree T = (V (T ), E(T )) where V(T) denotes the set of nodes and E(T) denotes the set of directed edges, also called branches. An edge terminating at a leaf node is called a terminal edge. Denote by L(T ) ⊂ V (T ) the set of leaves of T, I(T ) = V (T ) \ L(T ) the set of internal nodes, and r(T ) ∈ I(T ) the root node. In a binary tree, leaves correspond to extant taxa whereas internal nodes correspond to ancestral taxa.
Denote by c(v) the set of children of v, p(v) the parent of v, and e(v) the directed edge (p(v), v). The partial orders ≤ T and ≥ T on V(T) are defined by u ≤ T v if u is on the path from r(T) to v and u ≥ T v if v is on the path from r(T) to u. Note that as required by a partial ordering, ≤ T and ≥ T are reflexive (u ≤ T u and u ≥ T u). If u ≤ T v and u � = v then u is said to be an ancestor of v and v is a descendant of u. The distance from a node u to v, where u ≤ T v, is the length of the shortest path from u to v. The least common ancestor of nodes u, v, denoted lca(u, v), is the node w of maximum distance from r(T) such that w ≤ T u and w ≤ T v. For two nodes u, v ∈ T, we say that an edge e separates u and v if e is either on the path from lca(u, v) to u or on the path from lca (u, v) to v. For convenience, we also use lca as shorthand for the term "least common ancestor" when the context is clear.

Reconciliations
A leaf map is a function Le : L(G) → L(S) that associates each leaf in the gene tree with the leaf in the species tree in which that gene is found. This function need not be one-to-one nor onto; gene tree leaves that map onto the same species tree leaf correspond to paralogous genes. The labeled coalescent tree, defined below, formalizes the notion of a reconciliation in the DLC model. Definition 1 (Labeled Coalescent Tree) Given gene tree G, species tree S, and leaf map Le : L(G) → L(S) , a labeled coalescent tree (LCT) for (G, S, Le) is a tuple (M, L, L) where: is a species map which maps each node of G to a node of S; • L is a finite set, called the locus set of loci that have evolved within the gene family; • L : V (G) → L is a locus map that maps each node of G to a locus in L subject to the following constraints: where equality holds everywhere except for ℓ = L(r(g)).
Constraint 1 asserts that the species map M extends the leaf map Le; constraint 2 asserts that a gene node is mapped to either the same node or an ancestor of each of its children; constraint 3 asserts that since extant gene nodes (leaves) mapped to the same extant species (leaves) are paralogs, they must be mapped to different loci; constraint 4 asserts that the locus set only includes a locus if at least one gene uses that locus; and constraint 5 asserts that each locus is created only once. 1 A gene node g is said to be a speciation node with respect to map M if for each child g ′ ∈ c(g), M(g) � = M(g ′ ). Since a branch of the gene tree may span multiple branches of the species tree for a given map M, implied speciation nodes are added as follows: For each non-root internal node g ∈ I(G) \ {r(G)} such that either (1) p(M(g)) � = M(p(g)) or (2) p(g) is not a speciation node and M(g) � = M(p(g)), introduce a new node h and replace edge (p(g), g) with the pair of edges (p(g), h) and (h, g) and define M(h) = p(M(g)). This process 1 Wu et al. include one other relation in the LCT, a partial ordering relation O on V(G). This relation is used solely to define and count the number of so-called coalescence events. In this paper, we show that the reconciliation problem is intractable even when the cost of coalescence events is ignored. Therefore, while coalescence events are induced by the LCT, there is no need to explicitly identify these events here and we thus omit the partial ordering relation O from the above definition. Bork et al. Algorithms Mol Biol (2017) 12:6 is repeated until there exists no node g that satisfies the conditions above. Wu et al. stipulate that the species map M is defined first, then implicit speciation nodes are added as required, and finally the locus map is defined on the vertices of the gene tree, which now includes any implied speciation nodes.
The set of gene nodes mapped to a given species node s is denoted nodes(s) = {g|g ∈ V (G); M(g) = s}; bottoms(s) = {g|g ∈ nodes(s); g ∈ L(G) ∨ ∀g ′ ∈ c(g), g ′ / ∈ nodes(s)} is the subset of nodes(s) whose children are mapped to descendants of s; and tops(s) = bottoms(p(s)). 2 For any set A ⊂ V (G), let loci(A) = {ℓ|∃g ∈ A s.t. ℓ = L(g)} denote the set of loci present on all genes in set A.
Next, Wu et al. define duplication and loss events. A duplication event corresponds to the creation of a new locus while a loss event corresponds to a locus that is present at either the top of a species branch, or created via a duplication within the species branch, but no longer present at the bottom of the species branch. More precisely, these events are defined as follows: Definition 2 (Duplication and Loss Events) Let G, S, and Le denote a gene tree, species tree, and leaf map Le : L(G) → L(S), respectively, and let (M, L, L) be a LCT for (G, S, Le).
• Duplication events: Let g ∈ V (G), g � = r(G). If L(g) � = L(p(g)) then g induces a duplication event on the edge e(g) = (p(g), g).   Figure 2 shows a subtree of a gene tree and a subtree of a species tree with the species and locus maps inducing multiple loss events.

Definition 3 (Reconciliation Cost)
Given gene tree G, species tree S, leaf map Le : L(G) → L(S), and non-negative real number costs C d and C ℓ for duplication and loss events, respectively, the cost of a LCT for (G, S, Le) with d duplications events and ℓ loss events is dC d + ℓC ℓ .

Definition 4 (DCL Optimization Problem (DCLOP))
Given gene tree G, species tree S, leaf map Le : L(G) → L(S), and non-negative costs C d and C ℓ for duplication and loss events, find a LCT for (G, S, Le) of minimum cost. There is a single duplication on edge (g ′ , g 5 ) indicated by a star. This edge separates paralogs g 6 and g 7 as well as paralogs g 8 and g 9

Duplication placement
Duplication events are determined entirely by the locus map L whereas loss events depend on both the species map and the locus map. For convenience in our subsequent analyses, we give an alternate characterization of the locus map and prove its equivalence with the original definition.
Definition 6 (Duplication Placement) Given gene tree G, species tree S, and leaf map Le : L(G) → L(S), a duplication placement is a subset D of the edges of G such that for every pair of leaves g, g ′ ∈ L(G) where g � = g ′ , if Le(g) = Le(g ′ ) then D contains an edge that separates g and g ′ . Proof Let L be a locus map for (G, S, Le) and define D to be the set of all edges e(g) = (p(g), g), g ∈ V (G), such that there is a duplication on edge e(g). By definition, |D| is the number of duplication events induced by L. To show that D is a duplication placement, consider any pair of leaves g, g ′ ∈ L(G) where g � = g ′ and Le(g) = Le(g ′ ). By Definition 1 (3), L(g) � = L(g ′ ). Let P denote the path from lca(g, g ′ ) to g and let P ′ denote the path from lca(g, g ′ ) to g ′ . There must exist some edge (p(u), u) in P ∪ P ′ such that L(u) � = L(p(u)) since otherwise every node in P and P ′ is mapped to the same locus, contradicting the assumption that L(g) � = L(g ′ ). Therefore, there is necessarily a duplication event on an edge in P ∪ P ′ ; this edges separates g and g ′ and thus D is a duplication placement.
Conversely, let D be a duplication placement and consider the set S(D) = {G 1 , . . . , G |D|+1 } comprising the |D| + 1 subgraphs of G induced by the removal of the edges of D from G. Note that S(D) partitions the nodes V(G). Let L = {1, . . . , |D| + 1} and let L map all nodes in G i to i ∈ L. It follows directly that this satisfies the requirements of a locus map in Definition 1 (3), (4), (5).
Henceforth, we use locus maps and duplication placements interchangeably. When defining a duplication placement D, we say that a duplication is placed on an edge (u, v) to mean that edge (u, v) is included in the set D. We say that a duplication is placed between two leaves g and g ′ to mean that there is a duplication placed on some edge that separates g and g ′ .

3SAT
Our reductions will be from 3SAT [8]: Given m Boolean variables x 1 , . . . , x m and n clauses C 1 , . . . , C n where each clause is the disjunction of exactly three literals over the given set of variables, we wish to determine whether there exists a valuation of the variables such that all clauses are satisfied. Without loss of generality, each literal occurs at most once per clause. In addition, the literals in the clauses are assumed to be ordered so that we may uniquely refer to the hth literal of each clause, 1 ≤ h ≤ 3. Since the clauses are ordered, we may also uniquely refer to the qth occurrence of a literal x i (or x i ) in the 3SAT instance. Finally, without loss of generality, we assume that no clause contains both a literal and its negation (since such clauses are trivially satisfied by every valuation and can thus be removed).

NP-hardness
We show that DLCDP is NP-hard, even when loss events have cost zero, by a reduction from 3SAT. To provide intuition, we begin with a small example of the reduction and sketch the proof of correctness. Afterwards, we formalize the reduction and prove its correctness. Figure 3 shows the construction for the 3SAT instance comprising a single clause, (x 1 ∨ x 2 ∨ x 3 ). We construct a gene tree with a single clause gadget on the left and one variable gadget for each of x 1 , x 2 , and x 3 on the right. The variable gadget for variable x i is a subtree rooted at node x i . That node has a true branch and a false branch, Fig. 2 A part of a gene tree mapped onto a species tree. Circular nodes correspond to gene nodes in the gene tree and rectangular nodes g ′ and g ′′ correspond to implied speciation nodes. The two loci are indicated in solid red and dashed blue. There is a loss on the edges (g 1 , g 2 ) and (g ′ , g 3 ) because the red locus is present at the tops of each of those edges but not at the bottoms of those edges. There is also a loss on edge (g ′′ , g 5 ) because the blue locus is present at the top of that edge but not the bottom corresponding to setting that variable true or false, respectively. The nodes at the end of the true and false branches each have two children, resulting in four leaves for each variable gadget. (In general, variable gadgets can be larger than this, with size dependent on the number of clauses in which x i appears). One leaf on the true side and one leaf on the false side of the variable gadget get mapped to the same species tree leaf, as represented by the dashed rectangles at the bottom right of Fig. 3 and labeled 1, 2, and 3 for x 1 , x 2 , and x 3 , respectively. Since each of these pairs of leaves are paralogs mapped to the same species leaf, there must be a duplication placed between them. As we shall see, our construction will force there to be a duplication on exactly one of the true or false branches incident on each x i , corresponding to setting each variable to true or false, respectively.
Next, the gadget for clause 1 has five internal nodes (this is true in general, not just in this small example). The three important internal nodes are 1,1 , 2,1 , 3,1 corresponding to the first, second, and third literals in clause 1. Each of these internal nodes has one leaf child that is mapped to a shared species leaf, as indicated in the dashed rectangle at the bottom left labeled A. Since the first literal in clause 1 is x 1 , clause node 1,1 and the true node in the variable gadget for x 1 each have a leaf child that is mapped to the same species node labeled B in the figure. Similarly, since the second literal of clause 1 is x 2 , clause node 2,1 and the false node in the variable gadget for x 2 each have a leaf child that is mapped to the same species node labeled C in the figure. Finally, 3,1 and the true node in the x 3 gadget have leaves on a shared species node D. All remaining leaves in the variable gadgets are mapped to their own individual unshared species leaves, placing no constraints on their locus mappings.
We set the cost of duplication events, C d , to 1 and the cost of loss events, C ℓ , to 0. We set the decision parameter in this example to 5 which will force two duplications to be used in the clause gadget and one to be used in each of the three variable gadgets in a way that corresponds to choosing a valuation for the three variables (in general, the decision parameter for the number of duplications will be equal to the number of variables plus twice the number of clauses).
As noted earlier, the variable gadget leaves mapped to species 1, 2, and 3 require that there be at least one duplication placed within each variable gadget. Similarly, the three clause gadget leaves mapped to species A are paralogs and imply that there must be two duplications placed in the clause gadget rooted at δ 1 . Thus, in order to use no more than the five given duplications, there must be exactly one duplication placed in each variable gadget and exactly two duplications placed in the clause gadget. Moreover, without loss of generality, we can assume that duplications do not occur on edges terminating at leaves, since such duplications can be pushed up one level in the tree without violating any of the species map constraints.
We now sketch how the proof of correctness will proceed. First, assume that there is a satisfying assignment for the 3SAT instance (for example, x 1 = true, x 2 = true, x 3 = false). We place duplications on the corresponding edges in the variable gadgets. This satisfies the requirement that there exists a duplication placed between each pair of leaves associated with species 1, 2, and 3. Since, in our valuation, x 1 = true satisfies the clause, we choose not to place a duplication on the edge terminating at 1,1 in the clause gadget, instead placing duplications on the two edges terminating at 2,1 and 3,1 . This satisfies the requirement that a duplication is placed between each pair of the three clause leaves associated with species A. Moreover, the two leaves associated with species B have a duplication between them due to the duplication on x 1 's true edge and the leaves associated with groups C and D have duplications between them due to the duplications placed on the edges terminating at 2,1 and 3,1 .
To prove the converse direction, we assume a solution to the constructed DLCDP instance; as noted above, this implies that there exists one duplication placed in each variable gadget and two in the clause gadget. At least one duplication must be placed in the subtree rooted at δ ′ 1 , as it is the lca of two leaves in group A. Therefore, only one of the three remaining internal edges in the subtree rooted at δ 1 can contain a duplication. Thus, at least one of the pairs of leaves mapped to species B, C, or D cannot be separated by a duplication placed inside the clause gadget and thus must be separated by a duplication placed inside a variable gadget. Consider, for example, the case that the pair of leaves in group B is separated by an edge in a variable gadget. By construction, that duplication must then occur on the true side of the x 1 gadget, which corresponds to setting x 1 to be true in the valuation which, in turn, satisfies this 3SAT instance.

Formal reduction
Given a 3SAT instance with m variables x 1 , x 2 , . . . , x m and n clauses C 1 , C 2 , . . . , C n , we construct an instance of DLCDP comprising m variable gadgets and n clause gadgets.

Variable gadgets
A variable gadget for variable x i , shown in Fig. 4, is a binary tree with root node α i which, in turn, has two children β i and β i which are roots of two subtrees. Node β i has two children: a leaf y i and an internal node β i,1 . Each node β i,k has two children: a leaf y i,k and an internal node β i,k+1 , 1 ≤ k < n − 1. Node β i,n−1 has two children: leaves y i,n−1 and y i,n . Similarly, node β i has a child labeled y i and another child β i,1 . Each node β i,k has a child y i,k and a child β i,k+1 , 1 ≤ k < n − 1. Node β i,n−1 has children y i,n−1 and y i,n .

Clause gadgets
A clause gadget for clause C j , shown in Fig. 5, is a binary tree rooted at node δ j which in turn has children δ ′ j and 3,j . Node δ ′ j has children 1,j and 2,j . Finally, each node h,j has two leaf children, k h,j and k ′ h,j , 1 ≤ h ≤ 3.

Gene tree
The gene tree is constructed by assembling m variable gadgets and n clause gadgets into a single binary tree. Specifically, the gene tree is constructed from an arbitrary binary tree with m + n leaves. The first m leaves become the roots of m variable gadgets corresponding to

Species tree
The species tree is an arbitrary binary tree with 2mn + m + n leaves labeled 1, . . . , 2mn + m + n.

Leaf map
We define Le : L(G) → L(S) as follows: For each x i appearing as the h-th literal in clause C j , Le(k ′ h,j ) = Le(y i,j ) = m + n + 3(j − 1) + h, 4. For each x i appearing as the h-th literal in clause C j , Le(k ′ h,j ) = Le(y i,j ) = m + n + 3(j − 1) + h, 5. Every leaf g ∈ L(G) whose mapping is not specified above is mapped to a unique species leaf s ∈ L(S) such no other gene leaf is mapped to s.
Note that steps 1 through 4 of this leaf map define the mapping of gene tree leaves onto species leaves 1, . . . , m + 4n. By construction, after these first four steps in the leaf map, there remain 2mn − 3n gene tree leaves that are not yet mapped and (2mn + m + n) − (m + 4n) = 2mn − 3n species tree leaves that are not yet mapped onto. Thus, in step 5 of the leaf map, every gene tree leaf whose mapping was not established in parts 1 through 4 can be mapped to a unique species tree leaf.

Event costs and decision parameter
We set the cost of a duplication event to be 1 and all other event costs to be 0. The decision parameter is 2n + m, meaning in this case that we seek a reconciliation with at most 2n + m duplications. It is easily seen that this reduction can be performed in time polynomial in the size of the given 3SAT instance.

Proof of correctness 3SAT → DLCDP
We first show that the existence of a satisfying valuation to a given 3SAT instance implies that the corresponding DLCDP instance is true. We prove this by constructing a duplication placement D of size 2n + m as follows: For each literal x i , place a duplication on edge e(β i ) = (α i , β i ) if x i is true in the valuation and place a duplication on edge e(β i ) = (α i , β i ) if x i is false. This ensures that all pairs of leaves y i and y i , 1 ≤ i ≤ m, are separated by an edge in D as required by part 1 of the leaf map above. Next, consider an arbitrary clause C j and one of the literals x i whose true valuation satisfies C j (the case that the literal is x i is analogous). Without loss of generality, assume that x i is the first literal in clause C j (the case that the literal is the second or third literal in the clause is analogous). The placement of a duplication on edge e(β i ) ensures that leaves k ′ 1,j and y i,j are separated by an edge in D as required by part 3 (analogously, part 4) of the leaf map. Next, we place duplications on the edges e( 2,j ) and e( 3,j ) in the clause gadget for C j . This separates all leaves in part 2 of the leaf map and separates the remaining leaves in parts 3 and 4. Part 5 of the leaf map has no leaves requiring separation by D.
Since all of the duplication requirements implied by the leaf map are satisfied by this duplication placement and it uses exactly k = 2n + m duplications, this is a solution to the constructed DLCDP instance.

DLCDP → 3SAT
Given a solution to the DLCDP instance, we construct a satisfying valuation for the corresponding 3SAT instance. Because part 1 of the leaf map associates each pair y i and y i , 1 ≤ i ≤ m, with the same species node, each such pair must be separated by an edge in D. By construction, each such pair must be separated by a distinct edge in the variable gadget for x i which is either an edge on the path from α i to y i or on the path from α i to y i . Separating all such pairs therefore requires m edges in D.
For each clause C j , 1 ≤ j ≤ n, the leaves k 1,j , k 2,j , and k 3,j are mapped to the same species leaf by part 2 of the leaf map. Therefore, each pair of those leaves must be separated by an edge in D and, by the construction of the clause gadget, this requires two edges in each clause gadget and thus a total of 2n additional edges in D.
Thus, all k = 2n + m are required to satisfy parts 1 and 2 of the leaf map, with exactly m edges selected from the variable gadgets and exactly 2n edges from the clause gadgets. We construct a valuation of the boolean variables in the 3SAT instance as follows: for 1 ≤ i ≤ m, set x i to true if there is a duplication placed on some edge on the path from α i to y i , and set x i to false if there is a duplication along the path from α i to y i .
Consider an arbitrary clause C j and its corresponding gadget in the gene tree. Part 2 of the leaf map requires that there be an edge in D separating each pair of of k 1,j , k 2,j , and k 3,j , but, as noted above, only two edges of D are placed within that clause gadget. Since δ ′ j is the lca of k 1,j and k 2,j , at least one duplication must be placed in the subtree rooted at δ ′ j . Therefore, at least one of the three paths from δ j to k ′ 1,j , k ′ 2,j , and k ′ 3,j does not contain an edge in D. Without loss of generality, assume that the path from δ j to k ′ 1,j does not contain an edge in D and let x i be the first literal in clause C j (the argument is analogous if x i is the second or third literal of the clause). Then, by part 3 (analogously, part 4) of the leaf map, k ′ 1,j and y i,j must be separated by an edge in D. Since this edge occurs in the variable gadget for x i , by the observations above it must occur on the path from α i to y i , resulting in setting x i = true and thereby satisfying clause C j .
Thus, all clauses are satisfied and the 3SAT instance is satisfiable.

APX-hardness of the DLC parsimony problem
When only the duplication cost is considered, the DLC optimization problem, DLCOP, can be approximated arbitrarily well using the polynomial-time approximation scheme (PTAS) for Multicut in binary trees [4] since duplications correspond exactly to removed edges in the Multicut problem. However, we now show that DLCOP has no PTAS in general, unless P = NP. Specifically, we show that DLCOP is APX-hard when duplications and losses are considered. We establish this result by a polynomial-time reduction from max3sat(b) which comprises a Boolean formula in 3-CNF form in which each variable appears at most B times in the clauses. Arora [9] showed that, for some ǫ, 0 < ǫ < 1, there exists a constant value of B (B = 13) and a polynomial-time reduction from any NP-complete problem to max3sat(b) that maps yes instances of to satisfiable instances of max3sat(b) and no instances of to instances of max3sat(b) in which less than 1 − ǫ of the total number of clauses are satisfiable.
Our reduction maps an instance of max3sat(b) with n clauses (for sufficiently large values of n) to an instance of DLCOP and a parameter b such that the optimal solution to the DLCOP instance is less than b if the max3sat(b) instance is satisfiable and more than (1 + α)b if at most (1 − ǫ)n clauses can be satisfied, for some constant α > 0. If a polynomial-time (1 + α)-approximation algorithm exists for DLCOP, we can apply our gap-preserving reduction to generate a DLCOP instance from the max3sat(b) instance and then run the putative approximation algorithm to distinguish between satisfiable and (1 − ǫ)-satisfiable instances of max3sat(b). Thus, the existence of a (1 + α)-approximation algorithm for DLC implies that P = NP, and the approximation-hardness of DLCOP follows.

Reduction
Given an instance of max3sat(b) comprising m variables and n clauses, we construct an instance of DLCOP comprising a gene tree, a species tree, a leaf map, and event costs. The reduction is based on the NP-hardness reduction in the previous section but introduces more complex gadgetry and uses nonzero cost for loss events.

Thorn gadget
An ℓ-thorn gadget, depicted in Fig. 6, is a binary tree with ℓ leaves constructed as follows: let the root node be u 1 . Each node u i has two children: internal node u i+1 and leaf t i , 1 ≤ i ≤ ℓ − 2. Node u ℓ−1 has two leaf children t ℓ−1 and t ℓ . Leaf t ℓ is denoted the end tip of the thorn gadget.

Variable gadgets
Let B(i) and B(i) denote the number of occurrences of literals x i and x i , respectively. The variable gadget for variable x i , illustrated in Fig. 7, consists of a root node, α i , and two subtrees, one for each of the two literals of this variable. The left subtree has root β i , with two children: Internal node β ′ i and leaf y i . In turn, β ′ i has two children: Internal node β i,1 and leaf y ′ i . Each node β i,q , 1 ≤ q ≤ B(i) − 2, has a child β i,q+1 and a second child which is the root of a (n 2 − 1)-thorn gadget with end tip y i,q . Node β i,B(i)−1 has two children, each of which is the root of a (n 2 − 1)-thorn gadget. The end tips of these thorn gadgets are labeled y i,B(i)−1 and y i,B(i) . This construction introduces a distinct (n 2 − 1)-thorn gadget for each occurrence of x i in the 3SAT instance. We refer to the thorn gadget terminating at end tip y i,q as the thorn gadget for the qth occurrence of x i . The right subtree of α i , representing literal x i , is symmetric to the left subtree, but with β i and β ′ i replaced with β i and β ′ i , respectively, each β i,j replaced by β ′ i,j , and each y i,j replaced by y i,j . This construction introduces a distinct (n 2 − 1)-thorn gadget for each clause containing x i . We refer to the thorn gadget terminating at end tip y i,q as the thorn gadget for the qth occurrence of x i .

Clause gadgets
A clause gadget corresponding to clause C j , shown in Fig. 8, consists of root node δ j with children δ ′ j and 3,j . Node δ ′ j has two children 1,j and 2,j . Each node h,j , 1 ≤ h ≤ 3, is the root of a tree with two children, a leaf k h,j and a node ′ h,j , which in turn has two leaf children k ′ h,j and k ′′ h,j .

Gene tree
The gene tree G is constructed as follows: the root of the gene tree is a node g 0 with children g 1 and g 2 . Node g 1 is the root of a (3n − m + 1)-thorn gadget. Node g 2 is the root of an arbitrary binary subtree with n + m leaves. Each of the first n of those leaves becomes the root of a clause gadget for clauses C 1 , . . . , C n and the remaining m leaves become the roots of m variable gadgets for variables x 1 , . . . , x m .

Species tree
The species tree, shown in Fig. 9, is rooted at node ρ 0 and is constructed from a path ρ 0 , . . . , ρ 2m followed by σ 1 , σ ′ 1 , . . . , σ n , σ ′ n , and finally τ 1,1 , τ 2,1 , τ 3,1 , . . . , τ 1,n , τ 2,n , τ 3,n . This path is henceforth referred to as the trunk of the tree. Each node ρ i has a leaf child r i , 1 ≤ i ≤ 2m, and each node σ j and σ ′ j has a leaf child s j and s ′ j , respectively, 1 ≤ j ≤ n. Finally, each node τ h,j , which corresponds the hth literal in clause C j , has a child that is the root of a n 2 -thorn with end tip t h,j (henceforth referred to as the n 2 -thorn for τ h,j ), 1 ≤ h ≤ 3 , 1 ≤ j ≤ n. Node τ 3,n has an additional leaf child so that the tree is binary.

Leaf map and event costs
The leaf map Le is defined as follows: Each leaf in the (3n − m + 1)-thorn gadget rooted at node g 1 is mapped to r 0 ; 4. If the hth literal of C j is x i and this is the qth occurrence of x i in the 3SAT instance, then each leaf of the (n 2 − 1)-thorn gadget for the qth occurrence of x i is mapped to the leaf with the same index in the n 2thorn gadget for τ h,j and k ′′ h,j is mapped to the end tip, t h,j , of that n 2 -thorn gadget. 5. If the hth literal of C j is x i and this is the qth occurrence of x i in the 3SAT instance, then each leaf of the (n 2 − 1)-thorn gadget for the qth occurrence of x i is mapped to the leaf with the same index in the n 2thorn gadget for τ h,j and k ′′ h,j is mapped to the end tip, t h,j , of that n 2 -thorn gadget.
Let the event costs be as follows: D = 2Bn 2 , L = 1, C = 0. Finally, note that this reduction can be performed in polynomial time.

Proof of correctness
To prove the correctness of our reduction, we show that: • If the max3sat(b) instance is satisfiable, the optimal cost of the constructed DLC instance is less than • For sufficiently large n, if at most (1 − ǫ)n clauses of the max3sat(b) instance can be satisfied, the optimal cost is more than

Satisfiable MAX3SAT(B) instances
We first consider a satisfiable instance of max3sat(b). We show how a satisfying valuation can be used to construct a solution to the DLC instance whose cost is less than b. The species map M maps all internal nodes of G to ρ 0 except for g 1 and its descendant (3n − m + 1)-thorn gadget which are mapped to r 0 ; each leaf g ∈ L(G) is mapped to Le(g).
For each variable x i , we place one duplication in the corresponding variable gadget, on the edge e(β i ) if x i is assigned true and on the edge e(β i ) if x i is assigned false. 3 This ensures that y i and y i are separated and that y ′ i and y ′ i are separated, as required by part 1 of the leaf map. For each clause C j , identify any one literal that satisfies that clause. If the first literal in C j satisfies the clause, place duplications on edges e( 2,j ) and e( 3,j ). Alternatively, if the second literal in C j satisfies the clause, place 3 Note that this is opposite of what was done in the preceeding NP-hardness proof. This switch is necessary as becomes evident in the subsequent proof of correctness. duplications on edges e( 1,j ) and e( 3,j ); alternatively, if the third literal in C j satisfies the clause, place duplications on edges e( 1,j ) and e( 2,j ). This placement of two duplications per clause gadget satisfies the constraints implied by part 2 of the leaf map, which requires that each pair of k 1,j , k 2,j , k 3,j be separated and that each pair of k ′ 1,j , k ′ 2,j , k ′ 3,j be separated. Thus far, m + 2n duplications have been placed. Finally, we place 3n − m duplications on the terminal edges of the (3n − m + 1)-thorn gadget, since all 3n − m + 1 of its leaves are mapped to r 0 by part 3 of the leaf map and thus each pair of leaves must be separated. Note that parts 4 and 5 of the leaf mapping do not map multiple species leaves to the same trees leaves and thus require no additional duplication placements. The total number of duplications is thus m + 2n + (3n − m) = 5n. Next, we count the number of losses. We do this by first counting losses on the n 2 -thorns of the species tree and then on the trunk of the species tree.
Each clause C j has three n 2 -thorns in the species tree, one branching from each of τ 1,j , τ 2,j , and τ 3,j . Without loss of generality, assume that clause C j is satisfied by its first literal and thus duplications were placed on e( 2,j ) and e( 3,j ). Also, without loss of generality, assume that the first literal in C j is x i (the case for x i is analogous) and that this is the qth occurrence of x i in the 3SAT instance. The duplication on e( 2,j ) implies that leaf k ′′ 2,j is mapped to a different locus than all of the leaves of the (n 2 − 1) -thorn for the qth occurrence of x i in the variable gadget for x i . Since Le(k ′′ 2,j ) = t 2,j by part 4 of the leaf map, there is a loss event on each of the n 2 edges terminating at the leaves of the n 2 -thorn gadget for τ 2,j . Similarly, the duplication on edge e( 3,j ) incurs n 2 losses in the n 2 -thorn gadget for τ 3,j for a total of 2n 2 losses for clause C j . Since C j is satisfied by x i , we know that x i = true and thus a duplication was placed on edge e(β i ) in the variable gadget for x i . Therefore, there is no duplication placed between k ′′ 1,j and the leaves of the (n 2 − 1)-thorn for the q th occurrence of x i and thus there are no losses incurred on the n 2 -thorn for τ 1,j . Since there are n clauses and each contributes 2n 2 losses in the corresponding n 2 -thorns, 2n 3 losses are incurred thus far.
We next consider the number of losses incurred on the trunk of the species tree. Since M(g 1 ) = r 0 , none of the loci created by the 3n − m duplications in the 3n − m + 1 -thorn required by part 3 of the leaf map induce loss events. There are 1 + 2m + 2n + 3n nodes on the trunk and at most m + 2n loci can be lost on each of the two edges emanating from each such node since there only m + 2n other duplications.

At most (1-ǫ)-satisfiable MAX3SAT(B) instances
To complete the proof, we show that given an instance of max3sat(b) in which the fraction of satisfiable clauses is at most (1-ǫ), the optimal cost of the corresponding DLC instance, for sufficiently large n, is greater than: Part 1 of the leaf map requires at least one duplication placement per variable gadget, part 2 of the leaf map requires at least two duplications per clause gadget, and part 3 of the leaf map requires 3n − m duplications to be placed in the (3n − m + 1)-thorn gadget. Therefore, all valid duplication placements for this instance use at least m + 2n + (3n − m) = 5n duplications. We call a solution that uses exactly 5n duplications well-behaved.
A well-behaved solution must use exactly one duplication in each variable gadget. For each variable gadget for variable x i , this duplication must be placed on either the edge e(β i ) or the edge e(β i ) in order to separate both y i and y i and y ′ i and y ′ i . We interpret a duplication on edge e(β i ) as setting variable x i to false and a duplication on edge e(β i ) as setting x i to true. Thus, a well-behaved solution to the DLC Optimization Problem has a corresponding valuation of the variables in the 3SAT instance.
We now show that all optimal solutions to the DLC Optimization Problem are necessarily well-behaved. Consider a solution for our constructed DLC instance that is not well-behaved and thus comprises more than 5n duplications. A duplication placed outside of a variable, clause, or (3n − m + 1)-thorn gadget cannot satisfy any of the duplication requirements imposed by the leaf map and thus can be removed, reducing the number of duplications and not increasing the number of losses.
If a variable gadget for x i contains more than one duplication, we may replace all duplications in that variable gadget with a single duplication on edge e(β i ) = (α i , β i ) , which satisfies the duplication requirements of the leaf map and reduces the number of duplications by at least one. Introducing a new duplication may increase the number of losses. However, since each variable x i appears 5n · 2Bn 2 + (2n 3 + 121n 2 ) · 1 = (10B + 2)n 3 + 121n 2 = b.