H Ülya

Arg Üz

Pierrick Bousseau

THE FLOW TREE FORMULA FOR DONALDSON-THOMAS INVARIANTS OF QUIVERS WITH POTENTIALS

We prove the flow tree formula conjectured by Alexandrov and Pioline which computes Donaldson-Thomas invariants of quivers with potentials in terms of a smaller set of attractor invariants. This result is obtained as a particular case of a more general flow tree formula reconstructing a consistent scattering diagram from its initial walls. Contents 1. Introduction 1 2. Trees and flows 9 3. Scattering diagrams 18 4. The flow tree formula for scattering diagrams 24 5. The flow tree formula for DT invariants 42 References 48

Introduction

Donaldson-Thomas (DT) theory is a topic at the intersection of algebraic geometry, symplectic geometry, representation theory and theoretical physics. Given a triangulated category C which is Calabi-Yau of dimension 3 (CY3) together with a choice of Bridgeland stability condition θ [START_REF] Bridgeland | Stability conditions on triangulated categories[END_REF], DT invariants are defined by virtually counting θ-semistable objects in C [START_REF] Simon | Gauge theory in higher dimensions[END_REF][START_REF] Joyce | A theory of generalized Donaldson-Thomas invariants[END_REF][START_REF] Kontsevich | Stability structures, motivic Donaldson-Thomas invariants and cluster transformations[END_REF][START_REF] Thomas | A holomorphic Casson invariant for Calabi-Yau 3-folds, and bundles on K3 fibrations[END_REF]. In quantum field theory and string theory, they play an important role as counts of BPS states and D-branes [START_REF] Aspinwall | Dirichlet branes and mirror symmetry[END_REF].

Quivers with potentials [START_REF] Harm Derksen | Quivers with potentials and their representations[END_REF] provide a natural source of examples of CY3 categories coming from representation theory [START_REF] Ginzburg | Calabi-Yau algebras[END_REF][START_REF] Keller | Calabi-Yau triangulated categories[END_REF]. Due to its more algebraic nature, DT theory of quivers with potentials is an ideal setting to study and explore many questions which are also of interest in the geometric incarnations of DT theory given by counts of semistable objects in the derived category of coherent sheaves on Calabi-Yau 3-folds [START_REF] Thomas | A holomorphic Casson invariant for Calabi-Yau 3-folds, and bundles on K3 fibrations[END_REF] and by counts of special Lagrangian submanifolds in Calabi-Yau 3-folds [START_REF] Joyce | On counting special Lagrangian homology 3-spheres[END_REF][START_REF] Thomas | Special Lagrangians, stable bundles and mean curvature flow[END_REF].

A key phenomenon in DT theory is wall-crossing in the space of stability conditions: DT invariants are constant in the complement of countably many real codimension one loci in the space of stability conditions called walls, but they jump discontinuously in general when the stability condition crosses a wall. The precise description of this jumping behaviour of DT invariants across walls in the space of stability conditions is given by the wall-crossing formula of Joyce-Song and Kontsevich-Soibelman [START_REF] Joyce | A theory of generalized Donaldson-Thomas invariants[END_REF][START_REF] Kontsevich | Stability structures, motivic Donaldson-Thomas invariants and cluster transformations[END_REF], which is a universal algebraic expression that contains some amount of combinatorial complexity.

By successive applications of the wall-crossing formula, one can show that the DT invariants of a quiver with potential are determined by a much smaller subset of attractor DT invariants defined by picking particular stability conditions [START_REF] Alexandrov | Attractor flow trees, BPS indices and quivers[END_REF][START_REF] Kontsevich | Wall-crossing structures in Donaldson-Thomas invariants, integrable systems and mirror symmetry[END_REF]. In [START_REF] Alexandrov | Attractor flow trees, BPS indices and quivers[END_REF], Alexandrov-Pioline conjectured, based on string-theoretic predictions, a new formula that expresses DT invariants in terms of the attractor DT invariants as a sum over trees, called the flow tree formula. Their conjecture reduces the general wall-crossing formula to an iterative application of the much simpler primitive wall-crossing formula. The main result of the present paper is a proof of the flow tree formula. In fact, we prove a version of the flow tree formula in the more general context of consistent scattering diagrams.

The flow tree formula is a new tool to unravel some of the deep and hidden structures in DT theory. For example, versions of the flow tree formula are a major tool in the recent formulation of the conjectural proposal of [START_REF] Alexandrov | Black holes and higher depth mock modular forms[END_REF] (see also [START_REF] Alexandrov | S-duality and refined BPS indices[END_REF]) for the construction of modular completions for generating series of DT invariants counting coherent sheaves supported on surfaces inside Calabi-Yau 3-folds.

1.1. Background. A quiver with potential (Q, W ) is given by a finite oriented graph Q, and a finite formal linear combination W of oriented cycles in Q. We assume that Q does not contain oriented 2-cycles, and we denote by Q 0 the set of vertices of Q. For every dimension vector γ ∈ N ∶= Z Q 0 and stability parameter (1.1) θ ∈ γ ⊥ ⊂ M R ∶= Hom(N, R) ,

where γ ⊥ ∶= {θ ∈ M R θ(γ) = 0}, the theory of King's stability for quiver representations [START_REF] King | Moduli of representations of finite-dimensional algebras[END_REF] defines a quasiprojective variety M θ γ , parametrizing S-equivalence classes of θ-semistable representations of Q of dimension γ, and a regular function

(1.2) Tr(W ) θ γ ∶ M θ γ → C .
Assuming that θ is γ-generic in the sense that θ(γ ′ ) = 0 implies γ ′ collinear with γ, the Donaldson-Thomas (DT) invariant Ω θ γ is an integer which is a virtual count of the critical points of Tr(W ) θ γ . Applying Hodge theory to the sheaf of vanishing cycles of Tr(W ) θ γ , the integer Ω θ γ can be refined into a Laurent polynomial Ω θ γ (y, t) in two variables y and t and with integer coefficients, referred to as refined DT invariants [START_REF] Davison | Donaldson-Thomas theory for categories of homological dimension one with potential[END_REF][START_REF] Davison | Cohomological Donaldson-Thomas theory of a quiver with potential and quantum enveloping algebras[END_REF][START_REF] Joyce | A theory of generalized Donaldson-Thomas invariants[END_REF][START_REF] Kontsevich | Stability structures, motivic Donaldson-Thomas invariants and cluster transformations[END_REF][START_REF] Meinhardt | Donaldson-Thomas invariants versus intersection cohomology of quiver moduli[END_REF][START_REF] Reineke | Poisson automorphisms and quiver moduli[END_REF][START_REF] Reineke | Cohomology of quiver moduli, functional equations, and integrality of Donaldson-Thomas type invariants[END_REF]. It is often convenient to use the rational functions Ω θ γ (y, t) ∈ Q(y, t) defined as in [START_REF] Joyce | A theory of generalized Donaldson-Thomas invariants[END_REF][START_REF] Kontsevich | Stability structures, motivic Donaldson-Thomas invariants and cluster transformations[END_REF][START_REF] Manschot | Wall crossing from Boltzmann black hole halos[END_REF] by (1.3)

Ω θ γ (y, t) ∶= γ ′ ∈N γ=kγ ′ , k∈Z ≥1 1 k y -y -1 y k -y -k Ω θ γ ′ (y k , t k ) ,
and referred to as rational DT invariants.

The DT invariants Ω θ γ (y, t) are locally constant functions of the γ-generic stability parameter θ ∈ γ ⊥ and their jumps across the loci of non-γ-generic stability parameters are given by the wall-crossing formula of Joyce-Song and Kontsevich-Soibelman [START_REF] Joyce | A theory of generalized Donaldson-Thomas invariants[END_REF][START_REF] Kontsevich | Stability structures, motivic Donaldson-Thomas invariants and cluster transformations[END_REF]. Using the wall-crossing formula, the DT invariants can be computed in terms of the simpler attractor DT invariants, which are DT invariants at specific values of the stability parameter.

Let ⟨-, -⟩∶ N × N → Z be the skew-symmetric form given by

(1.4) ⟨γ, γ ′ ⟩ = i,j∈Q 0 (a ij -a ji )γ i γ ′ j ,
where a ij is the number of arrows in Q from the vertex i to the vertex j. The specific point ⟨γ, -⟩ ∈ γ ⊥ ⊂ M R is called the attractor point for γ [START_REF] Alexandrov | Attractor flow trees, BPS indices and quivers[END_REF][START_REF] Mozgovoy | Attractor invariants, brane tilings and crystals[END_REF]. In general, the attractor point ⟨γ, -⟩ is not γ-generic and we define the attractor DT invariants Ω * γ (y, t) by (1.5) Ω * γ (y, t) ∶= Ω θγ γ (y, t) ,

where θ γ is a small γ-generic perturbation of ⟨γ, -⟩ in γ ⊥ [START_REF] Alexandrov | Attractor flow trees, BPS indices and quivers[END_REF][START_REF] Mozgovoy | Attractor invariants, brane tilings and crystals[END_REF]. One can check that Ω * γ (y, t) is independent of the choice of the small perturbation [START_REF] Alexandrov | Attractor flow trees, BPS indices and quivers[END_REF][START_REF] Mozgovoy | Attractor invariants, brane tilings and crystals[END_REF].

For Q acyclic (and so W = 0), or more generally (Q, W ) admitting a green-to-red sequence [START_REF] Mou | Scattering diagrams of quivers with potentials and mutations[END_REF], the attractor DT invariants are as simple as possible:

(1.6) Ω * γ (y, t) = ⎧ ⎪ ⎪ ⎨ ⎪ ⎪ ⎩ 1 ifγ = (δ ij ) i∈Q 0 for some j ∈ Q 0 0 elsewise,
where δ ij is the Kronecker delta. Similarly, for a quiver with potential (Q, W ) describing the derived category of coherent sheaves on a local del Pezzo surface, it is recently conjectured [START_REF] Beaujard | Vafa-Witten invariants from exceptional collections[END_REF][START_REF] Mozgovoy | Attractor invariants, brane tilings and crystals[END_REF] that Ω * γ (y, t) = 0 unless γ = (δ ij ) i∈Q 0 for some j ∈ Q 0 or unless γ is the class of the skyscraper sheaf of a point. However, for quivers with potential (Q, W ) describing interesting parts of the derived category of coherent sheaves on a compact Calabi-Yau 3fold, the attractor DT invariants are expected to be non-vanishing and to typically exhibit an exponential growth. We refer to [START_REF] Bena | Scaling BPS solutions and pure-Higgs states[END_REF][START_REF] Denef | Split states, entropy enigmas, holes and halos[END_REF][START_REF] Lee | BPS states, refined indices, and quiver invariants[END_REF][START_REF] Lee | Quiver invariants from intrinsic Higgs states[END_REF][START_REF] Manschot | From black holes to quivers[END_REF] for some explicit examples involving n-gon quivers.

The rational DT invariants Ω θ γ (y, t) for general γ-generic stability parameters θ ∈ γ ⊥ are expressed in terms of the rational attractor DT invariants Ω * γ (y, t) by a formula of the form (1.7) Ω θ γ (y, t) =

r≥1 {γ i } 1≤i≤r ∑ r i=1 γ i =γ 1 Aut({γ i } i ) F θ r (γ 1 , . . . , γ r ) r i=1 Ω * γ i (y, t) ,
where the second sum is over the multisets {γ i } 1≤i≤r with γ i ∈ N and ∑ r i=1 γ i = γ. Here, the denominator Aut({γ i } i ) is the order of the symmetry group of {γ i }: if m γ ′ is the number of times that γ ′ ∈ N appears in {γ i } i , then Aut({γ i } i ) = ∏ γ ′ ∈N m γ ′ !. The coefficients F θ r (γ 1 , . . . , γ r ) are element of Q(y) and are universal in the sense that they depend on (Q, W ) only through the skew-symmetric form ⟨-, -⟩ on N . Our main result is the proof of an explicit formula, called the flow tree formula and conjectured by Alexandrov-Pioline [START_REF] Alexandrov | Attractor flow trees, BPS indices and quivers[END_REF], which computes the coefficients F θ r (γ 1 , . . . , γ r ) in (1.7) combinatorially in terms of a sum over binary rooted trees, and where the contribution of each tree is computed following the flow on the tree starting at the root and ending at the leaves.

1.2. Main result: the flow tree formula. We introduce some notations which are necessary to state precisely the flow tree formula in Theorem 1.1 below. We fix γ ∈ N , a γ-generic stability parameter θ ∈ γ ⊥ , and γ 1 , . . . , γ r ∈ N such that ∑ r i=1 γ i = γ. An essential ingredient in the formulation of the flow tree formula for F θ r (γ 1 , . . . , γ r ) is the choice of a generic skew-symmetric perturbation (ω ij ) 1≤i,j≤r of the skew-symmetric matrix (⟨γ i , γ j ⟩) 1≤i,j≤r . The matrix (ω ij ) 1≤i,j≤r cannot be viewed in general as a skewsymmetric bilinear form on the sublattice of N generated by γ 1 , . . . , γ r because γ 1 , . . . , γ r are not necessarily linearly independent in N . Nevertheless, the matrix (ω ij ) 1≤i,j≤r can always be interpreted as a skew-symmetric bilinear form ω on a rank r free abelian group N ∶= ⊕ r i=1 Ze i with a basis {e i } 1≤i≤r and such that ω ij = ω(e i , e j ). From this point of view, there is a natural additive map p∶ N → N (1.8) e i → γ i , which enables us to define a skew-symmetric bilinear form η on N as being the pullback of ⟨-, -⟩ on N , that is, η(e i , e j ) ∶= ⟨γ i , γ j ⟩, and we consider a real-valued skew-symmetric form ω on N obtained as a small enough generic perturbation of η. Let M R ∶= Hom(N , R) and q∶ M R → M R be the map induced from p∶ N → N by duality. We denote by (1.9) α ∶= q(θ)

the image in M R of the stability parameter θ ∈ M R by the map q.

The flow tree formula in Theorem 1.1 below takes the form of a sum over trees. More precisely, we consider rooted trees which apart from the root vertex have r univalent vertices, or leaves, decorated by the basis elements e 1 , . . . , e r of N . For such a tree T , we

v ′ v ′′

Children of v

Parent of v

The root vertex denote by V ○ T the set of interior, that is, non-univalent, vertices. We endow each such tree with the flow from the root to the leaves. Given a vertex v in a tree, the vertex adjacent to v coming before v along the flow is referred to as the parent of v and denoted by p(v), and the vertices adjacent to v and coming after v along the flow are referred to as the children of v, as illustrated in Figure 1.1. Any vertex that comes after v along the flow is a descendent of v. Let T r be the set of such trees which are binary, that is such that each interior vertex v of a tree T ∈ T r has exactly two children. For every tree T ∈ T r and v a vertex of T , we define e v ∈ N as the sum of all elements that appear as decorations on the leaves which are descendent of a vertex v. We denote by T η r the set of trees T ∈ T r such that η(e v ′ , e v ′′ ) ≠ 0 where v is the child of the root and v ′ , v ′′ are the children of v.

For every tree T ∈ T η r and v a vertex of T distinct from the leaves, we define θ α,ω T,v ∈ M R recursively as follows: If v is the root vertex, then set θ α,ω T,v ∶= α. If v is not the root, let p(v) be the parent of v, and for any of the children, say v ′ of v, and

ι ev ω ∶= ω(e v , -) ∈ M R , define (1.10) θ α,ω T,v ∶= θ α,ω T,p(v) - θ α,ω T,p(v) (e v ′ ) ω(e v , e v ′ ) ι ev ω .
We show in Lemma 2.12 that this definition is independent of the choice of the child v ′ of v. Following [START_REF] Alexandrov | Attractor flow trees, BPS indices and quivers[END_REF], we call v ↦ θ α,ω T,v the discrete attractor flow. For every tree T ∈ T η r and interior vertex v ∈ V ○ T , we fix a labeling v ′ and v ′′ of the two children of v, and we define

(1.11) α,ω T,v ∶= - sgn(θ α,ω T,p(v) (e v ′ )) + sgn(ω(e v ′ , e v ′′ )) 2 ∈ {0, 1, -1} ,
where sgn(x) ∈ {±1} is the sign of x ∈ R -{0}. We show in §2 that for generic ω ∈ ⋀ 2 M R , we have θ α,ω T,p(v) (e v ′ ) ≠ 0 and ω(e v ′ , e v ′′ ) ≠ 0 and so the definition of α,ω T,v indeed makes sense. Our main result is the following flow tree formula, conjectured in [START_REF] Alexandrov | Attractor flow trees, BPS indices and quivers[END_REF], which enables us to determine the coefficients F θ r (γ 1 , . . . , γ r ) in (1.7) expressing the DT invariants Ω θ γ (y, t) in terms of the attractor DT invariants Ω * γ i (y, t). Theorem 1.1 . For every choice a small enough generic perturbation ω ∈ ⋀ 2 M R of the skew-symmetric bilinear form η, the universal coefficient F θ r (γ 1 , . . . , γ r ) in (1.7) is given by the flow tree formula:

(1.12)

F θ r (γ 1 , . . . , γ r ) = T ∈T η r v∈V ○ T α,ω T,v κ(η(e v ′ , e v ′′ )) ,
where α,ω T,v is as in (1.11) and

(1.13) κ(x) ∶= (-1) x ⋅ y x -y -x y -y -1
for every x ∈ Z.

Theorem 5.5 presents a version of Theorem 1.1 in which we phrase more explicitly the condition that ω should be a small enough generic perturbation of η.

We also prove a variant of the flow tree formula recently conjectured by Mozgovoy [START_REF] Mozgovoy | Operadic approach to wall-crossing[END_REF], which relies on a perturbation of points in M R rather than the skew-symmetric form. We first remark that θ ∈ γ ⊥ implies that α ∈ M R defined in (1.9) satisfies α ∈ (∑ r i=1 e i ) ⊥ . For β a small perturbation of α in the hyperplane (∑ r i=1 e i ) ⊥ , we define θ β,η T,v ∈ M R and β,η T,v ∈ {0, 1, -1} by replacing α by β and ω by η in (1.10) and (1.11). Theorem 1.2 . For every choice β ∈ (∑ r i=1 e i ) ⊥ of small enough generic perturbation of α ∶= q(θ) in the hyperplane (∑ r i=1 e i ) ⊥ , the universal coefficient F θ r (γ 1 , . . . , γ r ) is given by:

(1.14) F θ r (γ 1 , . . . , γ r ) = T ∈T η r v∈V ○ T β,η T,v κ(η(e v ′ , e v ′′ )) ,
where α,ω T,v is as in (1.11) and κ is as in (1.13). In Theorem 5.6, we present a version of Theorem 1.2 in which we state more precisely the condition that β should be a small enough generic perturbation of α.

1.3.

Structure of the proof. The proof of Theorems 1.1 and 1.2 relies on the notion of a scattering diagram, introduced in [START_REF] Gross | From real affine geometry to complex geometry[END_REF], based on the insights of [START_REF] Kontsevich | Affine structures and non-Archimedean analytic spaces[END_REF], to provide an algebro-geometric understanding of the mirror symmetry phenomenon in physics. To give the rough idea of a scattering diagram, which we elaborate further in §3.1, fix a nilpotent N + -graded Lie algebra g = ⊕ n∈N + g n . There is an associated unipotent algebraic group G with a bijective exponential map exp ∶ g → G defined using the Baker-Campbell-Hausdorff formula. Given this data, a (N + , g)-scattering diagram is defined as the collection of real codimension 1 cones in M R , called walls, which are decorated by wall-crossing automorphisms, that are elements of G. We focus attention on scattering diagrams relevant to DT and cluster theory, which have wall-crossing automorphism preserving a holomorphic symplectic form as in [START_REF] Bridgeland | Scattering diagrams, Hall algebras and stability conditions[END_REF][START_REF] Cheung | Donaldson-Thomas invariants from tropical disks[END_REF][START_REF] Davison | Strong positivity for quantum theta bases of quantum cluster algebras[END_REF][START_REF] Gross | Canonical bases for cluster algebras[END_REF][START_REF] Gross | Quivers, curves, and the tropical vertex[END_REF][START_REF] Gross | The tropical vertex[END_REF][START_REF] Kontsevich | Wall-crossing structures in Donaldson-Thomas invariants, integrable systems and mirror symmetry[END_REF][START_REF] Mandel | Scattering diagrams, theta functions, and refined tropical curve counts[END_REF][START_REF] Mou | Scattering diagrams of quivers with potentials and mutations[END_REF], and not on the more general scattering diagrams that have wall-crossing automorphisms preserving a holomorphic volume form, and which appear frequently in the context of mirror symmetry [START_REF] Argüz | The higher dimensional tropical vertex[END_REF][START_REF] Gross | Theta functions on varieties with effective anticanonical class[END_REF][START_REF] Gross | From real affine geometry to complex geometry[END_REF][START_REF] Keel | The Frobenius structure theorem for affine log Calabi-Yau varieties containing a torus[END_REF].

A codimension 2 locus in M R along which distinct walls intersect is called a joint. A scattering diagram is said to be consistent if for any joint, the path-ordered product of all wall-crossing automorphisms of walls that are adjacent to the joint is identity. It is shown in [START_REF] Gross | From real affine geometry to complex geometry[END_REF][START_REF] Kontsevich | Affine structures and non-Archimedean analytic spaces[END_REF] that there is an algorithmic prescription for constructing a consistent scattering diagram from the data of an initial set of walls. This prescription is based on inserting new walls, along with wall-crossing automorphisms, which order-by-order decrease the divergence of the path-ordered products of wall-crossing automorphisms around joints from being identity.

Given a quiver with potential (Q, W ), Bridgeland [START_REF] Bridgeland | Scattering diagrams, Hall algebras and stability conditions[END_REF] constructed from the DT invariants of (Q, W ) a consistent scattering diagram in M R , called the stability scattering diagram, whose initial walls are determined by the attractor DT invariants. The stability scattering diagram is a very useful tool to study DT invariants of quivers. For example, the transformation properties of DT invariants under mutations of a quiver with potential, conjectured in [START_REF] Manschot | Generalized quiver mutations and single-centered indices[END_REF] [57, Conjecture 3.14], are proved in [START_REF] Mou | Scattering diagrams of quivers with potentials and mutations[END_REF]Theorem 4.22] by a study of the corresponding transformation of the stability scattering diagram.

The main technical goal of the paper is to prove Theorems 4.22 and 4.24: they are flow tree formulas for consistent scattering diagrams which express as a sum over binary trees the wall-crossing automorphism attached to a general wall in terms of the wall-crossing automorphisms attached to the initial walls. In §5, we then derive Theorems 1.1 and 1.2 from the flow tree formulas for scattering diagram applied to the stability scattering diagram.

The proof of Theorems 4.22 and 4.24 is given in §4 and consists of two parts. In the first part of the proof, described in §4.2, we relate the (N + , g)-scattering diagrams, which live in M R , to auxiliary (N + , h)-scattering diagrams which live in M R , where h is a N +graded Lie algebra constructed from g. In the second part of the proof in §4.3, we show that the discrete attractor flow naturally defines a embedding of the binary rooted trees inside the walls of the auxiliary scattering diagrams in M R . The images of the trees in M R are embedded graphs in M R with a balancing condition satisfied at each vertex distinct from the root, that is, essentially tropical disks in M R [START_REF] Carl | A tropical view of Landau-Ginzburg models[END_REF][START_REF] Gross | Mirror symmetry for P 2 and tropical geometry[END_REF][START_REF] Nishinou | Toric degenerations of toric varieties and tropical curves[END_REF]. The generic perturbation of either the skew-symmetric form or the position in M R of the root of the embedded trees guarantees that the vertices of the embedded trees are always contained in double intersections of walls, but never in triple intersections. The iteration of the local consistency condition around double intersection of walls determines the contribution of each tree. In the language of DT invariants, this reduces the general wall-crossing formula to an iteration of the much simpler primitive wall-crossing formula.

We note in Remark 4.25 that the perturbation of the position in M R of the root of the trees used in the formulation of Theorems 1.2 and 4.24 is related to a way of perturbing scattering diagrams going back to the work of Gross-Pandharipande-Siebert [START_REF] Gross | The tropical vertex[END_REF]. However the perturbation of the skew-symmetric form used in the formulation of Theorems 1.1 and 4.22 seems to be a completely new way to study scattering diagrams. Thus, most of the paper is focused on the study of this perturbation of the skew-symmetric form and on the proof of Theorems 1.1 and 4.22.

1.4. Related work.

1.4.1. Operads and wall-crossing. Very recently, while this paper was being completed, Mozgovoy [START_REF] Mozgovoy | Operadic approach to wall-crossing[END_REF] proved using an operadic approach to the wall-crossing formula, a different formula for the coefficients F θ r (γ 1 , . . . , γ r ), called the attractor tree formula and originally conjectured in [START_REF] Mozgovoy | Attractor invariants, brane tilings and crystals[END_REF], following [START_REF] Alexandrov | S-duality and refined BPS indices[END_REF][START_REF] Alexandrov | Black holes and higher depth mock modular forms[END_REF]. The key differences between the flow tree formula that we prove in this paper and the attractor tree formula proved in [START_REF] Mozgovoy | Operadic approach to wall-crossing[END_REF] are the following: the flow tree formula involves binary trees, requires a choice of generic perturbation, and is naturally phrased in terms of Lie algebras, whereas the attractor tree formula involves general (not necessarily binary) trees, does not require the choice of generic perturbation, and is naturally phrased in terms of associative algebras. It is currently not known if one of these two formulas implies the other in a simple way.

Both the flow tree formula and the attractor tree formula, formulated precisely and proved for DT invariants of quivers with potentials, are expected to have versions holding more generally in DT theory as long as a global understanding of the space of stability conditions is available. For example, the flow tree formula and the attractor tree formula play an important role in the conjectural proposal of Alexandrov and Pioline [START_REF] Alexandrov | Black holes and higher depth mock modular forms[END_REF] (see also [START_REF] Alexandrov | S-duality and refined BPS indices[END_REF]) for the construction of modular completions for generating series of DT invariants counting coherent sheaves supported on surfaces inside Calabi-Yau 3-folds. 1.4.2. BPS states. From a physics perspective, a quiver with potential (Q, W ) defines a supersymmetric quantum mechanical system with 4 supercharges [START_REF] Denef | Quantum quivers and Hall/hole halos[END_REF] and the (refined) DT invariants are counts of supersymmetric ground states, which often can be identified with supersymmetric indices counting BPS particles in 4-dimensional N = 2 supersymmetric quantum field theories [START_REF] Alim | BPS quivers and spectra of complete N = 2 quantum field theories[END_REF][START_REF] Alim | N = 2 quantum field theories and their BPS quivers[END_REF][START_REF] Cecotti | R-twisting and 4d/2d correspondences[END_REF][START_REF] Cecotti | Classification of complete N = 2 supersymmetric theories in 4 dimensions[END_REF][START_REF] Fiol | The BPS spectrum of N = 2 SU (N ) SYM[END_REF] and BPS configurations of black holes in 4-dimensional N = 2 string compactifications [START_REF] Bena | Scaling BPS solutions and pure-Higgs states[END_REF][START_REF] De Boer | Quantizing N = 2 multicenter solutions[END_REF][START_REF] Denef | Quantum quivers and Hall/hole halos[END_REF][START_REF] Denef | Split states, entropy enigmas, holes and halos[END_REF][START_REF] Lee | BPS states, refined indices, and quiver invariants[END_REF][START_REF] Lee | Quiver invariants from intrinsic Higgs states[END_REF][START_REF] Manschot | Wall crossing from Boltzmann black hole halos[END_REF][START_REF] Manschot | From black holes to quivers[END_REF][START_REF] Manschot | On the Coulomb and Higgs branch formulae for multicentered black holes and quiver invariants[END_REF]. In particular, the definition of the attractor point, as well as the attractor invariants, is motivated by the attractor mechanism for BPS black holes in N = 2 supergravity [START_REF] Ferrara | N = 2 extremal black holes[END_REF][START_REF] Strominger | Macroscopic entropy of N = 2 extremal black holes[END_REF]. The attractor invariants are closely related but not equal in general to the single-centered invariants [START_REF] Manschot | From black holes to quivers[END_REF], which are expected to count micro-states of a single, spherically symmetric black hole, but whose conceptual definition is still mysterious mathematically. The flow tree formula conjectured by Alexandrov-Pioline [START_REF] Alexandrov | Attractor flow trees, BPS indices and quivers[END_REF], that we prove in this paper, is motivated by the split attractor flow picture in N = 2 supergravity [START_REF] Denef | Supergravity flows and D-brane stability[END_REF][START_REF] Denef | Split attractor flows and the spectrum of BPS D-branes on the quintic[END_REF][START_REF] Denef | Split states, entropy enigmas, holes and halos[END_REF]. 1.4.3. Tropical curves and mirror symmetry. In [START_REF] Carl | A tropical view of Landau-Ginzburg models[END_REF][START_REF] Filippini | Block-Göttsche invariants from wall-crossing[END_REF][START_REF] Gross | The tropical vertex[END_REF][START_REF] Mandel | Scattering diagrams, theta functions, and refined tropical curve counts[END_REF], the perturbation of scattering diagrams originally introduced by Gross-Pandharipande-Siebert [START_REF] Gross | The tropical vertex[END_REF] is used to express general walls of a consistent scattering diagram in terms of the initial walls using sums over tropical curves. The connection between scattering diagrams and tropical geometry is particularly interesting from the point of view of mirror symmetry and connection with Gromov-Witten theory, as shown in dimension 2 by Gross-Pandharipande-Siebert [START_REF] Gross | The tropical vertex[END_REF] in genus 0 and the second author [START_REF] Bousseau | The quantum tropical vertex[END_REF] in higher genus, and generalized to higher dimensions in the work of the first author with Gross [START_REF] Argüz | The higher dimensional tropical vertex[END_REF].

However, the point of view adopted in the present paper is different: the main interest of the flow tree formula is that it is not written as a sum over tropical curves but as a sum over abstract trees. The resulting formula is therefore entirely combinatorial, and more amenable to formal manipulations, as exemplified in [START_REF] Alexandrov | S-duality and refined BPS indices[END_REF][START_REF] Alexandrov | Attractor flow trees, BPS indices and quivers[END_REF][START_REF] Alexandrov | Black holes and higher depth mock modular forms[END_REF]. In particular, the flow tree formula can be easily implemented efficiently on a computer, as done in [START_REF] Pioline | Mathematica Package CoulombHiggs[END_REF].

1.5. Plan of the paper. In §2, we introduce our notation for trees and the discrete attractor flow, and we prove the existence of suitably generic perturbations of the skewsymmetric form. In §3, we first review the reconstruction of consistent scattering diagrams from initial data, and then we state the flow tree formula for scattering diagrams. The technical heart of the paper is §4 in which we prove the flow tree formula for scattering diagrams. Finally, we prove in §5 the flow tree formula for DT invariants of quivers with potentials by applying the flow tree formula for scattering diagrams to the stability scattering diagram. 1.6. Acknowledgments. We thank Boris Pioline and Sergey Mozgovoy for exchanges on their works [START_REF] Mozgovoy | Attractor invariants, brane tilings and crystals[END_REF] and [START_REF] Mozgovoy | Operadic approach to wall-crossing[END_REF].

Trees and flows

In §2.1 and §2.2, we introduce elementary notions on trees and skew-symmetric forms that we are used throughout the paper. In §2.3, we review the discrete attractor flow following [START_REF] Alexandrov | Attractor flow trees, BPS indices and quivers[END_REF]. In §2.4, we prove the existence of sufficiently generic skew-symmetric bilinear forms to allow the definition of the flow tree map in §2.5.

Throughout this section we fix a free abelian group N of finite rank r, and let M ∶= Hom Z (N , Z) and M R ∶= M ⊗ Z R. We introduce the notation I ∶= {1, . . . , r}, we fix a basis {e i } i∈I of N , and we denote (2.1) We also fix a skew-symmetric bilinear form η ∈ ⋀ 2 M on N , a subset J ⊂ I of cardinality J , and let

N + ∶= i∈I a i e i a i ≥ 0, i∈I a i > 0 .
(2.2) e J ∶= i∈J e i .
Finally, for every n ∈ N , we denote

n ⊥ ∶= {θ ∈ M R θ(n) = 0}.
2.1. Trees.

Definition 2.1. A rooted tree T is a connected tree with a finite number of vertices and edges, with no divalent vertices, together with the additional data of a distinguished univalent vertex referred to as the root. We denote by V T the set of vertices of T , by R T the set with the root for unique element, V ○ T the set of interior vertices, which are vertices of valency bigger than one, and by V L T the set of univalent vertices that are not the root, or leaves of T . An isomorphism between two rooted trees T and T ′ is a bijection ϕ∶ V T → V T ′ , which maps adjacent vertices of T to adjacent vertices of T ′ and the root of T to the root of T ′ . Definition 2.2. A J-decorated rooted tree is a rooted tree T endowed with a decoration of the leaves of T by {e i } i∈J , that is, a bijection ψ∶ V L T → {e i } i∈J . An isomorphism between two J-decorated rooted trees (T, ψ) and (T ′ , ψ ′ ) is an isomorphism of tree ϕ∶ V T → V T ′ compatible with the decorations, in the sense that ψ = ψ ′ ○ ϕ. Definition 2.3. Let T be a rooted tree. The parent of a vertex v ∈ V T ∖ R T is the unique vertex denoted by p(v) which is adjacent to v and lies on the shortest path between v and the root. A child of a vertex v ∈ V T is a vertex for which v is a parent, and a descendant of v is any vertex which is either the child of v or is (recursively) the descendant of any of the children of v.

Definition 2.4. A rooted tree T is binary if the root has exactly one child and each interior vertex has two children.

Remark 2.5. We illustrate in Figure 2.1 some decorated binary rooted trees. Our binary rooted trees are unordered in the sense that we do not fix an order on the set of children of a vertex. In a binary rooted tree T , for every vertex v ∈ V ○ T , we denote by {v ′ , v ′′ } the set of the children of v, without specifying an ordering. Nonetheless, for some constructions in what follows it will be sometimes useful to choose an ordering for the children. At any occasion where such a choice is made we will show that the result of the construction is in fact independent of this choice.

Lemma 2.6 . Let T be a J-decorated binary rooted tree. Then, T has 2 J vertices and 2 J -1 edges.

Proof. The proof is by induction on the cardinality J of J. The result is immediate for J = 1. For J > 1, write J = {i 0 } ⊔ {i} i∈ J ′ with J ′ = J -1. Removing from T the leg decorated by e i 0 , and erasing the resulting divalent vertex, we obtain a J ′ -decorated binary rooted tree T ′ . The result follows since T ′ has two less edges and two less vertices than T .

Lemma 2.7 . The set T J of isomorphism classes of J-decorated binary rooted trees is of cardinality

(2 J -3)!! = ∏ J -1 k=1 (2k -1). Proof.
The proof is by induction on the cardinality J of J. The result is immediate for J = 1. For J > 1, write J = {i 0 } ⊔ {i} i∈ J ′ with J ′ = J -1. Removing from T the leg decorated by e i 0 , we obtain a J ′ -decorated binary rooted tree T ′ with an added divalent vertex on one of its edges E. Conversely, given a J ′ -decorated binary rooted tree T ′ and an edge E of T ′ , then adding a divalent vertex v in the middle of E and gluing a leg decorated by e i 0 to v, we obtain a J-decorated binary rooted tree. Therefore, we have a bijection between T J and the set of pairs (T ′ , E), where T ′ ∈ T J ′ and E is an edge of T ′ . By Lemma 2.6, a J ′ -decorated binary rooted tree has 2 J ′ -1 edges, and so

T J = (2 J ′ -1) T J ′ = (2 J -3) T J ′ .
2.2. Skew-symmetric bilinear forms. We view elements ω ∈ ⋀ 2 M R as R-valued skewsymmetric bilinear forms on N , given by

ω∶ N × N → R (2.3) (v 1 , v 2 ) → ω(v 1 , v 2 ) .
Definition 2.8. For every tree T ∈ T J , and a vertex v ∈ V T , we define an associated element e v ∈ N + , referred to as the charge of v as follows: Let J T,v ⊂ J be the subset of indices with which the leaves that are descendant to v are labeled, that is, j ∈ J T,v if and only if the leaf decorated by e j is a descendant of v. Then, we set

(2.4) e v ∶= e J T,v = i∈J T,v e i .
Note that if v is the leaf decorated by e i , then the associated charge e v = e i . For v ∈ V ○ T , the sets J T,v ′ and J T,v ′′ are disjoint, and we have e v = e v ′ + e v ′′ . If v is the root of T or the child of the root of T , then J T,v = J and e v = e J . Lemma 2.9 . For every tree T ∈ T J and interior vertex v ∈ V ○ T , the linear form

∧ 2 M R → R (2.5) ω → ω(e v ′ , e v ′′ )
is not identically zero.

Proof. As {e i } i∈I is a basis of N , the linear forms ω ↦ ω(e i , e j ) for i, j ∈ I and i < j form a basis of the space of linear forms on ⋀ 2 M R . We have

(2.6) ω(e v ′ , e v ′′ ) = j ′ ∈J T,v ′ j ′′ ∈J T,v ′′
ω(e j ′ , e j ′′ ) .

As the sets J T,v ′ and J T,v ′′ are disjoint, each basis element ω ↦ ω(e j ′ , e j ′′ ) with j ′ < j ′′ appears up to sign at most once in the sum (2.6). In particular, there are no cancellations and ω ↦ ω(e v ′ , e v ′′ ) is not the zero linear form.

Proposition 2.10 . Let U J ⊂ ⋀ 2 M R be the subset of ω ∈ ⋀ 2 M R such that for every tree T ∈ T J and interior vertex v ∈ V ○ T , we have ω(e v ′ , e v ′′ ) ≠ 0. Then, the following holds:

(i) U J is open and dense in ⋀ 2 M R . (ii) For every ω ∈ U J , T ∈ T J and v ∈ V ○ T , we have ω(e v , e v ′ ) ≠ 0 and ω(e v , e v ′′ ) ≠ 0. (iii) For every J 2 ⊂ J 1 ⊂ I, we have U J 1 ⊂ U J 2 .
Proof. By Lemma 2.9, U J is the complement of finitely many hyperplanes in ⋀ 2 M R . Thus, the statement in (i) follows. To show (ii), observe that as e v = e v ′ + e v ′′ , we have ω(e v , e v ′ ) = ω(e v ′′ , e v ′ ) and ω(e v , e v ′′ ) = ω(e v ′ , e v ′′ ). Finally, (iii) follows from the fact that every J 2decorated binary rooted tree can be realized as a subtree of a J 1 -decorated binary rooted tree.

The discrete attractor flow. We review the description of the discrete attractor

flow introduced in [2, § 2.6]. Definition 2.11. Fix a tree T ∈ T J , a skew-symmetric bilinear form ω ∈ U J ⊂ ⋀ 2 M R and α ∈ e ⊥ J ⊂ M R . We also fix a labeling v ′ , v ′′ of children of vertices v ∈ V ○ T . The discrete attractor flow for (T, ω, α) is the map θ α,ω T ∶ R T ∪ V ○ T → M R (2.7) v → θ α,ω T,v
defined inductively, following the flow on T starting at the root and ending at the leaves, as follows:

(1) For the root vertex v ∈ R T , we set

(2.8) θ α,ω T,v ∶= α (2) For v ∈ V ○ T , and a child v ′ of v, we set (2.9) θ α,ω T,v = θ α,ω T,p(v) - θ α,ω T,p(v) (e v ′ ) ω(e v , e v ′ ) ι ev ω .
where p(v) is the parent of v, and for every n ∈ N ,

ι n ω = ω(n, -) ∈ M R .
Note that since ω ∈ U J , we have ω(e v , e v ′ ) ≠ 0 for every v ∈ V ○ T by Proposition 2.10, and so (2.9) makes sense.

Lemma 2.12 . Using the notations of Defn. 2.11, we have for every v ∈ V ○ T :

(2.10)

θ α,ω T,v ∈ e ⊥ v ′ ∩ e ⊥ v ′′ ⊂ e ⊥ v , and
(2.11) θ α,ω T,v = θ α,ω T,p(v) - θ α,ω T,p(v) (e v ′′ ) ω(e v , e v ′′ ) ι ev ω .
In particular, the discrete flow

θ α,ω T defined as in (2.11) is independent of the choice of labeling v ′ and v ′′ of children of vertices v ∈ V ○ T .
Proof. We prove the result inductively following the flow on T starting at the root and ending at the leaves. If v ∈ V ○ T is the child of the root of T , then θ α,ω T,v is given by (2.9). By (2.8), we have θ α,ω T,p(v) = α and so (2.12)

θ α,ω T,v (e v ′ ) = α(e v ′ ) - α(e v ′ ) ω(e v , e v ′ )
ω(e v , e v ′ ) = 0 .

On the other hand, as α ∈ e ⊥ J , we have α(e v ) = α(e J ) = 0, and so, using e v = e v ′ + e v ′′ , we have α(e v ′′ ) = -α(e v ′ ). As we also have ω(e v , e v ′ ) = -ω(e v , e v ′′ ), we finally obtain

(2.13) θ α,ω T,v (e v ′′ ) = α(e v ′′ ) + α(e v ′′ ) ω(e v , e v ′ ) ω(e v , e v ′′ ) = 0 . Similarly, if v ∈ V ○ T is not the root of T , then θ α,ω
T,v is given by (2.9) and so

(2.14) θ α,ω T,v (e v ′ ) = θ α,ω T,p(v) (e v ′ ) - θ α,ω T,p(v) (e v ′ ) ω(e v , e v ′ ) ω(e v , e v ′ ) = 0 .
By the induction hypothesis, we have θ α,ω T,p(v) (e v ) = 0 and so, using

e v = e v ′ + e v ′′ , we have θ α,ω T,p(v) (e v ′′ ) = -θ α,ω T,p(v) (e v ′
). As we also have ω(e v , e v ′ ) = -ω(e v , e v ′′ ), we finally obtain (2.11) and

(2.15) θ α,ω T,v (e v ′′ ) = θ α,ω T,p(v) (e v ′′ ) + θ α,ω T,p(v) (e v ′′ ) ω(e v , e v ′ ) ω(e v , e v ′′ ) = 0 .
2.4. Generic skew-symmetric bilinear forms. Recall that we are fixing a skew-symmetric bilinear form η ∈ ⋀ 2 M.

Definition 2.13. We denote by T η J the set of trees T ∈ T J such that η(e v ′ , e v ′′ ) ≠ 0 where v is the child of the root of T .

Definition 2.14. A point α ∈ M R is (J, η)-generic if α ∈ e ⊥
J and for every tree T ∈ T η J , we have α(e v ′ ) ≠ 0, where v is the child of the root of T .

Note that for T ∈ T η J and v the child of the root of T , we have

e v ′ + e v ′′ = e v = e J , and so, if α ∈ e ⊥ J , then α(e v ′ ) ≠ 0 is equivalent to α(e v ′′ ) ≠ 0. Equivalently, a point α ∈ e ⊥ J is (J, η)-generic if α ∉ e ⊥ J ′ for every strict subset J ′ of J such that η(e J , e J ′ ) ≠ 0. Definition 2.15. Let α ∈ e ⊥ J be a (J, η)-generic point. A skew-symmetric bilinear form ω ∈ U J ⊂ ⋀ 2 M R is called (J, α)-generic if for every T ∈ T η J and v ∈ V ○ T , we have (2.16) θ α,ω T,p(v) (e v ′ ) ≠ 0 and θ α,ω T,p(v) (e v ′′ ) ≠ 0 .
We denote by U J,α ⊂ U J the set of (J, α)-generic skew-symmetric bilinear forms.

Lemma 2.16 . Using the notations of Defn. 2.15, for every

T ∈ T η J and v ∈ V ○ T , we have θ α,ω T,p(v) (e v ) = 0 and θ α,ω T,p(v) (e v ′ ) = -θ α,ω T,p(v) (e v ′′ ).
Proof. As e v = e v ′ + e v ′′ , it is enough to show that θ α,ω T,p(v) (e v ) = 0. If v is the child of the root, then θ α,ω T,p(v) = α by (2.8), and so, as α ∈ e ⊥ J , we have α(e v ) = α(e J ) = 0. If v is not the child of the root, the result follows by (2.10) of Lemma 2.12 applied to the parent p(v) of v.

Lemma 2.17 . Let α ∈ e ⊥ J be a (J, η)-generic point, T ∈ T η J and v ∈ V T . Denote by v 0 , . . . , v m the unique sequence of vertices of T such that v 0 is the root of T , v m = v, and for every 0 ≤ a ≤ m -1, v a+1 is a child of v a . Then, the following holds.

(i)

The elements e v 0 , . . . , e vm are linearly independent in N . (ii) For every 0 ≤ a, b ≤ m, the map

U J → R ω → θ α,ω T,va (e v b )
is a rational function with R-coefficients, in the variables given by the linear maps

U J → R ω → ω(e v a ′ , e v b ′ ) for 0 ≤ a ′ , b ′ ≤ m and min(a ′ , b ′ ) ≤ a.
(iii) For every 0 ≤ a ≤ m -2, the map

U J → R ω → θ α,ω T,va (e v a+2 ) is not identically zero. Proof. (i) Assume that ∑ m i=0 a i e v i =
0 with some a i ≠ 0. Let i min be the smallest index i such that a i ≠ 0. There exists j ∈ J T,v i min such that j ∉ J T,v i for every i > i ′ , and so we obtain a contradiction.

(ii) We prove this by induction on a. For a = 0, v 0 is the root of T , and so by (2.8) we have θ α,ω T,v 0 (e v b ) = α(e b ) which is constant as a function of ω. Now, assume that the result holds for a ≥ 0. We have v a+1 ∈ V ○ T , and so by (2.9),

(2.17)

θ α,ω T,v a+1 (e v b ) = θ α,ω T,va (e v b ) - θ α,ω T,va (e v a+2 ) ω(e v a+1 , e v a+2 )
ω(e v a+1 , e v b ) .

By the induction hypothesis, θ α,ω T,va (e v b ) and θ α,ω T,va (e v a+2 ) are rational functions in the variables ω(e v a ′ , e v b ′ ) with min(a ′ , b ′ ) ≤ a and so in particular with min(a ′ , b ′ ) ≤ a + 1. The only extra variables appearing in θ α,ω T,v a+1 (e v b ) are ω(e v a+1 , e v a+2 ) and ω(e v a+1 , e v b ), which are both of the form ω(e v a ′ , e v b ′ ) with min(a ′ , b ′ ) ≤ a + 1. This shows the result for a + 1.

(iii) First note that by part (i), the elements e v 0 , . . . , e vm are linearly independent in N , and so the linear forms ω ↦ ω(e va , e v b ) with a < b are linearly independent.

We prove the result by induction on a. For a = 0, v 0 is the root of T and we have by (2.8) that θ α,ω T,v 0 (e v 2 ) = α(e v 2 ), which is nonzero because T ∈ T η J and α is (J, η)-generic (see Defn. 2.14).

Assume that the result holds for a and let us show that it holds for a + 1. We have v a+1 ∈ V ○ T and so by (2.9),

(2.18) θ α,ω T,v a+1 (e v a+3 ) = θ α,ω T,va (e v a+3 ) - θ α,ω T,va (e v a+2 ) ω(e v a+1 , e v a+2 )
ω(e v a+1 , e v a+3 ) .

By Lemma 2.17 (ii), ω ↦ θ α,ω T,va (e v a+2 ) and ω ↦ θ α,ω T,va (e v a+3 ) are rational functions in the linear forms ω ↦ ω(e v a ′ , e v b ′ ) with min(a ′ , b ′ ) ≤ a. In particular, they are algebraically independent of ω ↦ ω(e v a+1 , e v a+2 ) and ω ↦ ω(e v a+1 , e v a+3 ). On the other hand, by the induction hypothesis, ω ↦ θ α,ω T,va (e v a+2 ) is not identically zero. We conclude that ω ↦ θ α,ω T,v a+1 (e v a+3 ) is not identically zero. Proposition 2.18 . Let α ∈ e ⊥ J be a (J, η)-generic point. Then the set U J,α ⊂ U J ⊂ ⋀ 2 M R defined in Defn. 2.15 is the complement of finitely many algebraic hypersurfaces in U J . In particular, U J,α is open and dense in U J , and so in ⋀ 2 M R .

Proof. By Lemma 2.17 (ii) and (iii), for every

T ∈ T η J , v ∈ V ○ T and v ′ child of v, the map ω ↦ θ α,ω T,p(v) (e v ′
) is a not identically zero rational function. Therefore, the set {ω ∈

U J θ α,ω T,p(v) (e v ′ ) ≠ 0}
is the complement of an algebraic hypersurface in U J . By definition, U J,α is the intersection of the finitely many sets of this form obtained by varying T , v, and v ′ . Hence, U J,α is the complement of finitely many algebraic hypersurfaces in U J and is open and dense in U J . By Proposition 2.10, U J is open and dense in ⋀ 2 M R , and so it is also the case for U J,α .

We end this section in a different direction: instead of fixing α ∈ e ⊥ J and looking for

(J, α)-generic ω ∈ ⋀ 2 M R , we look for all α ∈ e ⊥ J such that the fixed η ∈ ⋀ 2 M R is (J, α)- generic. Lemma 2.19 . Let T ∈ T η J and v ∈ V T .
Denote by v 0 , . . . , v m the unique sequence of vertices of T such that v 0 is the root of T , v m = v, and for every 0

≤ a ≤ m -1, v a+1 is a child of v a . Then for every 0 ≤ a ≤ m -2, the map e ⊥ J → M R (2.19) α → θ α,η T,va
is linear, and the linear form

e ⊥ J → R (2.20) α → θ α,η T,va (e v a+2 )
is not identically zero.

Proof. The result is easily proved by induction on a, using Lemma 2.17(i) and the fact that the linear form α ↦ θ α,η T,va (e v a+2 ) is equal to the sum of the linear form α ↦ α(e v a+2 ) and of a linear combination of the linear forms

α ↦ α(e v b ) with b < a + 2. Proposition 2.20 . Let V J,η be the set of α ∈ e ⊥ J ⊂ M R such that α is (J, η)-generic and η is (J, α)-generic. Then V J,η is open and dense in e ⊥ J .
Proof. It follows from Defn. 2.14 and Lemma 2.19 that V J,η is the complement of finitely many hyperplanes in e ⊥ J .

2.5. The flow tree map.

Let h = ⊕ n∈N + h n be a Lie algebra over Q which is N + -graded, that is, such that [h n 1 , h n 2 ] ⊂ h n 1 +n 2 for every n 1 , n 2 ∈ N + . We say that h is finitely N + - graded if its support Supp(h) ∶= {n ∈ N + h n ≠ 0} is finite. Note that a finitely N + -graded Lie algebra is nilpotent.
In what follows, we fix h = ⊕ n∈N + h n a finitely N + -graded Lie algebra. For every x ∈ R -{0}, we denote by sgn(x) the sign of x defined as follows:

(2.21) sgn(x) = ⎧ ⎪ ⎪ ⎨ ⎪ ⎪ ⎩ 1 if x > 0,
and

-1 if x < 0. Definition 2.21. Fix a (J, η)-generic point α ∈ e ⊥ J ⊂ M R , a skew-symmetric bilinear form ω ∈ U J,α ⊂ ⋀ 2 M R
as in Defn. 2.15, a tree T ∈ T η J , and for every interior vertex v ∈ V ○ T a labeling v ′ and v ′′ of the children of v. We define a multilinear map

(2.22) A α,ω J,T,v ∶ i∈J T,v h e i → h ev for every v ∈ V L T ∪ V ○
T inductively, following the flow on T starting at the leaves and ending at the root, as follows:

(1) If v ∈ V L T , that is, if v is a leaf of T decorated by some e i , we define A α,ω J,T,v ∶ h e i → h e i as the identity map. (2) If v ∈ V ○ T , we set (2.23) α,ω T,v ∶= - sgn(θ α,ω T,p(v) (e v ′ )) + sgn(ω(e v ′ , e v ′′ )) 2 ∈ {0, 1, -1} ,

and

(2.24)

A α,ω J,T,v ∶= α,ω T,v [A α,ω J,T,v ′ , A α,ω J,T,v ′′ ] , where [A α,ω J,T,v ′ , A α,ω J,T,v ′′ ] is the composition of the maps A α,ω J,T,v ′ ∶ ∏ j∈J v ′ h e j → h e v ′ and A α,ω J,T,v ′′ ∶ ∏ j∈J v ′′ h e j → h e v ′′ with the Lie bracket [-, -]∶ h e v ′ × h e v ′′ → h e v ′ +e v ′′ = h ev .
Note that by the definition of U J , we have ω(e v ′ , e v ′′ ) ≠ 0 for every v ∈ V ○ T . Moreover, by Defn. 2.15 of U J,α , we have θ α,ω T,p(v) (e v ′ ) ≠ 0. Hence, both of the signs sgn(ω(e v ′ , e v ′′ )) and sgn(θ α,ω T,p(v) (e v ′ )) in 2.23 make sense. Lemma 2.22 . Using the notations of Defn. 2.21, for every v ∈ V ○ T , we have

(2.25) A α,ω J,T,v = - sgn(θ α,ω T,p(v) (e v ′′ )) + sgn(ω(e v ′′ , e v ′ )) 2 [A α,ω J,T,v ′′ , A α,ω J,T,v ′ ] .
In particular, the map A α,ω J,T,v is independent of the choice of the labeling of the children

v ′ and v ′′ of v ∈ V ○ T . Proof. Since the Lie bracket is skew-symmetric, we have [A α,ω J,T,v ′′ , A α,ω J,T,v ′ ] = -[A α,ω J,T,v ′ , A α,ω J,T,v ′′ ]. Moreover, since ω is skew-symmetric, we have sgn(ω(e v ′′ , e v ′ )) = -sgn(ω(e v ′ , e v ′′ )). Finally, by Lemma 2.16, we have sgn(θ α,ω T,p(v) (e v ′′ )) = -sgn(θ α,ω T,p(v) (e v ′ )). Definition 2.23. For every (J, η)-generic α ∈ e ⊥ J , ω ∈ U J,α and T ∈ T η J , let (2.26) A α,ω J,T ∶ i∈J h e i → h e J
be the linear map associated to T , defined by A α,ω J,T ∶= A α,ω J,T,v , where v is the child of the root of T . For every (J, η)-generic α ∈ e ⊥ J and ω ∈ U J,α , we define the flow tree map A α,ω J with initial point α, by summing over all the trees in T η J : (2.27)

A α,ω J ∶= T ∈T η J A α,ω J,T .

Scattering diagrams

In §3.1, we review the concept of consistent scattering diagram, mainly following [START_REF] Bridgeland | Scattering diagrams, Hall algebras and stability conditions[END_REF][START_REF] Gross | Canonical bases for cluster algebras[END_REF][START_REF] Kontsevich | Wall-crossing structures in Donaldson-Thomas invariants, integrable systems and mirror symmetry[END_REF]. In §3.2, we recall the notion of initial data for scattering diagrams. Finally, in §3.3, we make explicit the universal nature of the reconstruction of consistent scattering diagrams from their initial data.

3.1. Consistent scattering diagrams. Throughout this section, we fix a free abelian group N of finite rank , and let M ∶= Hom(N, Z) and M R ∶= M ⊗ Z R. We fix a basis {s i } 1≤i≤ of N , and we denote

(3.1) N + ∶= i=1 a i s i a i ∈ Z ≥0 , i=1 a i > 0 .
For every n ∈ N -{0}, we denote n ⊥ ∶= {θ ∈ M R θ(n) = 0}, and for every subset d ⊂ M R , we denote d ⊥ ∶= {n ∈ N + θ(n) = 0 for every θ ∈ d}. Finally, we fix a finitely N + -graded Lie algebra g = ⊕ n∈N + g n over Q, that is, a N + -graded Lie algebra whose support

(3.2) Supp(g) ∶= {n ∈ N + g n ≠ 0}
is a finite set. In particular, g is a nilpotent Lie algebra.

For us, a cone in M R is a closed, convex, rational, polyhedral cone in M R , that is, a subset of M R of the form

(3.3) σ = q i=1 λ i m i λ i ∈ R ≥0 , m 1 , . . . , m q ∈ M.
By definition, the codimension of a cone is the codimension of the subspace of M R it spans.

A wall is a cone of codimension 1 and a joint is a cone of codimension 2. If d is a wall in M R , we denote by n d the unique primitive element in N + ∩ d ⊥ , referred to as the normal vector to the wall. A face of a cone σ is a subset of the form σ ∩ n ⊥ where n ∈ N satisfies θ(n) ≥ 0 for all θ ∈ σ. Note that every face of a cone is itself a cone, and every intersection of faces of a given cone is also a face. Finally, a cone complex in M R is a finite collection S of cones in M R , such that any face of a cone in S is also a cone in S, and the intersection of any two cones in S is a face of each.

Definition 3.1. For every finite subset P ⊂ N + , we denote by S P the cone complex in M R whose cones are indexed by disjoint unions of sets P = P + ⊔ P 0 ⊔ P -with P 0 non-empty and given by σ(P + , P 0 , P -) ∶= {θ ∈ M R θ(n) = 0 for n ∈ P 0 , ±θ(n) ≥ 0 for n ∈ P ± }. We denote by Wall P the set of walls in S P .

In what follows, we take for the finite set P ⊂ N + in Defn. 3.1 the support Supp(g) ⊂ N + of the Lie algebra g defined by (3.2). Definition 3.2. A (N + , g)-scattering diagram is a map φ∶ Wall Supp(g) → g with the property that φ(d) ∈ ⊕ n∈Z ≥1 nd g n ⊂ g for every d ∈ Wall Supp(g) . For every n ∈ Z ≥1 n d , the projection of φ(d) on g n is denoted by φ(d) n .

Definition 3.3. A smooth path p∶ [0, 1] → M R is g-generic if
(1) the endpoints p(0) and p(1) do not lie in any wall d ∈ Wall Supp(g) , (2) p does not meet any cone of S Supp(g) of codimension > 1, (3) all intersections of γ with walls d ∈ Wall Supp(g) are transversal.

Note that, given a g-generic path p∶ [0, 1] → M R there is a finite set of points

(3.4) 0 < t 1 < . . . < t k < 1
for which p(t i ) lies in ⋃ d∈Wall Supp(g) d, and for each of these points t i there is a unique wall

d i ∈ Wall Supp(g) such that p(t i ) ∈ d i . Given a (N + , g)-scattering diagram φ and a g-generic path p∶ [0, 1] → M R , we define the path-ordered product along p of φ by (3.5) Ψ p,φ ∶= exp( k φ(d k )) ⋅ exp( k-1 φ(d k-1 )) . . . exp( 2 φ(d 2 )) ⋅ exp( 1 φ(d 1 )) ∈ G ,
where i ∈ {±1} is the sign of the derivative of t ↦ -p(t)(n d i ) at t = t i , G is the unipotent group associated to the nilpotent Lie algebra g, and exp∶ g → G is the exponential map.

Definition 3.4. A (N + , g)-scattering diagram φ is consistent if Ψ p 1 ,φ = Ψ p 2 ,φ
for every two g-generic paths p 1 and p 2 .

Note that Defn. 3.4 is equivalent to the definition of the consistency mentioned in the introduction, which requires the composition of all wall-crossing automorphisms on walls adjacent to a given joint to be identity. We set

M + R ∶= {θ ∈ M R θ(n) > 0 ∀n ∈ N + } and M - R ∶= {θ ∈ M R θ(n) < 0 ∀n ∈ N + } . The cone complex S Supp(g) is disjoint from M + R and M - R . Therefore, if φ is a consistent (N + , g)-scattering diagram, we can define an element Ψ φ ∈ G by Ψ φ ∶= Ψ p,φ
, where p is a g-generic path with initial point in M + R and final point in M - R . By consistency of φ, Ψ p,φ is independent of the particular choice of path or endpoints. Proposition 3.5 . The map φ ↦ Ψ φ is a bijection between consistent (N + , g)-scattering diagrams and elements of the group G.

Proof. In the setting of scattering diagrams as cone complexes, this is exactly Proposition 3.3 of [START_REF] Bridgeland | Scattering diagrams, Hall algebras and stability conditions[END_REF]. In the setting of scattering diagrams as set of walls, this result is originally Theorem 2.1.6 of [START_REF] Kontsevich | Wall-crossing structures in Donaldson-Thomas invariants, integrable systems and mirror symmetry[END_REF] (see also Theorem 1.17 of [START_REF] Gross | Canonical bases for cluster algebras[END_REF]). Note that Proposition 3.3 of [START_REF] Bridgeland | Scattering diagrams, Hall algebras and stability conditions[END_REF] in fact shows that these two possible points of view on scattering diagrams are in fact equivalent.

3.2. Initial data for scattering diagrams. From now on, we assume given a real-valued skew-symmetric bilinear form ⟨-, -⟩ on N such that the finitely N + -graded Lie algebra g = ⊕ n∈N + g n satisfies (3.6) [g n 1 , g n 2 ] = 0 as soon as ⟨n 1 , n 2 ⟩ = 0 .

In this section we review the notion of initial data for a (N + , g)-scattering diagram.

For every primitive n ∈ N + , we have a direct sum decomposition g = g n,+ ⊕ g n,0 ⊕ g n,-of g into Lie subalgebras

(3.7) g n,+ ∶= ⊕ n∈N + ⟨n,n⟩>0 g n , g n,0 ∶= ⊕ n∈N + ⟨n,n⟩=0 g n , g n,-∶= ⊕ n∈N + ⟨n,n⟩<0
g n .

It follows that, denoting by G n,+ ∶= exp(g n,+ ), G n,0 ∶= exp(g n,0 ), G n,-∶= exp(g n,-) the corresponding subgroups of G, every element g ∈ G can be written uniquely as a product g = g n,+ g n,0 g n,-with g n,+ ∈ G n,+ , g n,0 ∈ G n,0 , g n,-∈ G n,-. We have a further decomposition g n,0 = g ∥ n,0 ⊕ g ⊥ n,0 , where

(3.8) g ∥ n,0 ∶= ⊕ n∈Z ≥1 n g n , g ⊥ n,0 ∶= ⊕ n∈N + ⟨n,n⟩=0 n∉Z ≥1 n g n .
If n 1 + n 2 = kn with ⟨n, n 1 ⟩ = 0 and ⟨n, n 2 ⟩ = 0, then ⟨n 1 , n 2 ⟩ = 0 and so [g n 1 , g n 2 ] = 0 by (3.6). In particular, we have [g n,0 , g ⊥ n,0 ] ⊂ g ⊥ n,0 . Hence, g ⊥ n,0 is a Lie ideal in g n,0 and so the subgroup G ⊥ n,0 ∶= exp(g ⊥ n,0 ) is normal. We denote by

(3.9) π n,0 ∶ G n,0 → G n,0 G ⊥ n,0 = G ∥ n,0
the quotient group morphism, where G ∥ n,0 ∶= exp(g ∥ n,0 ). Given g = g n,+ g n,0 g n,-, set g ∥ n,0 ∶= π n,0 (g n,0 ). This defines a map

π n ∶ G → G ∥ n,0 (3.10) g → g ∥ n,0 .
Proposition 3.6 . The map

π∶ G → n∈N + n primitive G ∥ n,0 (3.11) g → (π n (g)) n is a bijection.
Proof. This is Proposition 3.3.2 of [START_REF] Kontsevich | Wall-crossing structures in Donaldson-Thomas invariants, integrable systems and mirror symmetry[END_REF]. See also Proposition 1.20 of [START_REF] Gross | Canonical bases for cluster algebras[END_REF]. Definition 3.7. For every n ∈ N + , the initial data I φ,n of a consistent (N + , g)-scattering diagram φ is the projection on g n of (3.12) log(π

n (Ψ φ )) ∈ g ∥ n,0 = ⊕ n ′ ∈Z ≥1 n g n ′ ,
where n is the unique primitive element of N + such that n ∈ Z ≥1 n, and Ψ φ is the element of G attached to φ as in Proposition 3.5.

Proposition 3.8 . The map φ ↦ (I φ,n ) n∈N + is a bijection between equivalence classes of consistent (N + , g)-scattering diagrams and elements of g = ⊕ n∈N + g n . In other words, for every

(I n ) n∈N + ∈ g = ⊕ n∈N + g n , there exists a unique consistent (N + , g)-scattering diagram φ with initial data (I φ,n ) n∈N + = (I n ) n∈N + .
Proof. This is an immediate consequence of Propositions 3.5 and 3.6.

The next Proposition 3.9 describes how to read the initial data I φ,n of a consistent (N + , g)-scattering diagram φ from the walls. Proposition 3.9 . Let φ be a consistent (N + , g)-scattering diagram, n ∈ N + and n the unique primitive element of N + such that n ∈ Z ≥1 n. For every wall d ∈ Wall Supp(g) with n d = n and containing the attractor point ⟨n, -⟩ ∈ M R for n, we have

(3.13) φ(d) n = I φ,n .
Proof. This follows from Theorem 1.21-(1) of [START_REF] Gross | Canonical bases for cluster algebras[END_REF].

Note that in the context of Proposition 3.9 there are in general several walls d with n d = n and containing the attractor point ⟨n, -⟩. Proposition 3.9 implies in particular that φ(d) n does not depend on the choice of d.

Universality of the reconstruction of scattering diagrams from initial data.

The next proposition shows that the elements φ(d) ∈ g assigned to walls d ∈ Wall Supp(g) by a consistent (N + , g)-scattering diagram φ are determined by the initial data (I φ,n ) n∈N + via universal formulas. Definition 3.10. A finite multiset Γ = {γ i } 1≤i≤r of elements of N + is a finite unordered collection γ 1 , . . . , γ r of elements of N + where multiple occurrences of elements are allowed. For every n ∈ N + , the multiplicity m Γ (n) ∈ Z ≥0 of n in Γ is the number of occurrences of n in Γ. Given a multiset Γ, we denote by Γ the set of n ∈ N + such that m Γ (n) ≠ 0. The set of finite multisets of elements of N + is denoted by mult(N + ). Proposition 3.11 . For every Γ ∈ mult(N + ) and d ∈ Wall Supp(g) , there exists a unique map

(3.14) F g,d Γ ∶ n∈Γ g n → g ∑ n∈Γ n
which is a homogeneous polynomial of degree m Γ (n) in restriction to the factor g n , and such that for every consistent (N + , g)-scattering diagram φ and γ ∈ Z ≥1 n d ∈ N + , the component φ(d) γ of φ(d) in g γ is given by

(3.15) φ(d) γ = Γ∈mult(N + ) ∑ n∈Γ n=γ F g,d Γ ((I φ,n ) n∈Γ ) ,
where the sum is over all finite multisets Γ of N + whose elements sum up to γ.

Proof. We first prove the uniqueness part. Assume that we have two collections (F g,d Γ ) 1 and (F g,d Γ ) 2 of maps satisfying the conditions of Proposition 3.11. By Proposition 3.8, there exists a consistent (N + , g)-scattering diagram for every initial data. Therefore (3.15) implies the equality of maps (3.16)

Γ∈mult(N + ) ∑ n∈Γ =γ (F g,d Γ ) 1 = Γ∈mult(N + ) ∑ n∈Γ n=γ (F g,d Γ ) 2 .
For every Γ ∈ mult(N + ) with ∑ n∈Γ n = γ, isolating on both sides of (3.16) the part homogeneous of degree m Γ (n) in restriction to each factor g n , we obtain (F g,d Γ ) 1 = (F g,d Γ ) 2 . We now prove the existence claim. Let δ∶ N → Z be an additive map such that δ(N + ) ⊂ Z ≥1 . For every k ∈ Z ≥0 , we define the Lie subalgebra g >k ∶= ⊕ n∈N + δ(n)>k g n ⊂ g. We prove by induction on k that for every k ∈ Z ≥0 , Γ ∈ mult(N + ) and d ∈ Wall Supp(g) , there exists a map (3.17)

F g,d k,Γ ∶ n∈Γ g n → g ∑ n∈Γ n ,
such that for every consistent (N + , g)-scattering diagram φ and γ ∈ Z ≥1 n d , we have

(3.18) φ(d) γ = Γ∈mult(N + ) ∑ n∈Γ n=γ F g,d k,Γ ((I φ,n ) n∈Γ ) mod g >k .
As g is nilpotent, we have g >k = 0 for k large enough, and so it will be enough to take F g,d Γ ∶= F g,d k,Γ for k large enough. For the base step of the induction, we have g >0 = g, so φ(d) γ = 0 mod g >0 for every φ, d, γ, and so we can take F g,d 0,Γ = 0 for every Γ and d. For the induction step, fix k ≥ 0, and assume that the existence of the maps F g,d k,Γ is know. We have to show the existence of the maps F g,d k+1,Γ . For every wall d ∈ Wall Supp(g) and for every consistent

(N + , g)-scattering diagram φ, define (3.19) φ(d) ∶= Γ∈mult(N + ) ∑ n∈Γ n∈Z ≥1 nd F g,d k,Γ ((I φ,n ) n∈Γ ) .
By the induction hypothesis, we have

(3.20) φ(d) = φ(d) mod g >k .
By [34, Definition-Lemma C.2], a joint j ∈ S Supp(g) , that is a codimension 2 cone, is perpendicular if for every wall d ∈ Wall Supp(g) containing j, the contraction ι nd ⟨-, -⟩ = ⟨n d , -⟩ of ⟨-, -⟩ with the normal vector n d to d is not contained in the R-linear span of j. For every perpendicular joint j ∈ S Supp(g) , let Wall(j) be the set of walls d ∈ Wall Supp(g) containing j, and let p j ∶ [0, 1] → M R be a g-generic loop around j, intersecting only once each wall d ∈ Wall(j) and no other wall. For every wall d ∈ Wall(j), denote by t j d ∈ [0, 1] the point such that p j (t j d ) ∈ d, and denote by j d ∈ {±1} the sign of the derivative of t ↦ -p j (t)(n d ) at t = t j d . We label d 1 , . . . , d m the elements of Wall(j) so that 0 < t j d 1 < ⋅ ⋅ ⋅ < t j dm < 1. By Defn. 3.4 the relation

(3.21) exp( j dm φ(d m )) ⋅ exp( j d m-1 φ(d m-1 )) . . . exp( j d 2 φ(d 2 )) ⋅ exp( j d 1 φ(d 1 )) = 1
holds for every consistent (N + , g)-scattering diagram φ. Therefore, it follows from (3.20) that

(3.22) log exp( j dm φ(d m )) . . . exp( j d 1 φ(d 1 )) = γ∈N + δ(γ)≥k+1 g j φ,γ
for some g j φ,γ ∈ g n . Using the Baker-Campbell-Hausdorff formula to compute the lefthand side of (3.22), together with (3.19), we deduce that for every Γ ∈ mult(N + ), there exists a map G j Γ ∶ ∏ n∈Γ g n → g ∑ n∈Γ n , which is a homogeneous polynomial of degree m Γ (n) in restriction to the factor g n , such that for every consistent (N + , g)-scattering diagram φ and γ ∈ N + with δ(γ) ≥ k + 1, we have

(3.23) g j φ,γ = Γ∈mult(N + ) ∑ r i=1 γ i =γ G j Γ ((I φ,n ) n∈Γ ) .
where the sum is over multisets Γ = {γ i } i∈I for some index set I, whose elements sum up to γ inN + . According to Appendix C.1 of [START_REF] Gross | Canonical bases for cluster algebras[END_REF] (see the Equations defining Dk+1 and D[j] before Lemma C.6), for every wall d ∈ Wall Supp(g) we have

(3.24) φ(d) = φ(d) + γ∈Z ≥1 nd δ(γ)=k+1 I φ,γ - γ∈Z ≥1 nd j j d j g j φ,γ mod g >k+1 ,
where the sum over j is over the perpendicular joints j such that d ⊂ j -R ≥0 ⟨n d , -⟩, and where d j ∈ Wall(j) is the wall containing j and contained in j -R ≥0 ⟨n d , -⟩. Therefore, for every Γ ∈ mult(N + ) with ∑ n∈Γ n ∈ Z ≥1 n d , we can take

(3.25) F g,d k+1,Γ = F g,d k,Γ + I d k+1,Γ - j j d j G j Γ .
where I d k+1,Γ is the identity map g γ → g γ if Γ = {γ} with γ ∈ Z ≥1 n d such that δ(γ) = k + 1, and I d k+1,Γ = 0 else.

The flow tree formula for scattering diagrams

In this section we prove our main result, Theorem 4.22, which provides an explicit description of the maps F g,d Γ in (3.14) in terms of the (specialization of the) flow tree maps.

F h,d Γ ∶ n∈Γ g n → g γ .
Our goal is to state a formula for the map F d,d Γ . As a first step to achieve this goal, we define in this section another class of scattering diagrams, referred to as (N + , h)-scattering diagrams.

We introduce a rank r free abelian group N ∶= ⊕ i∈I Ze i with a basis {e i } i∈I , and the additive map

p∶ N → N (4.2) e i → γ i .
For every J ⊂ I, let e J ∶= i∈J e i . (4.3)

In particular, we have p(e I ) = γ. Following the notations set-up in §2, we denote M ∶= Hom(N , Z), M R ∶= M ⊗ R and N + ∶= ∑ i∈I a i e i a i ≥ 0, ∑ i∈I a i > 0 . The map p∶ N → N defines by duality a linear map

q∶ M R → M R (4.4) θ → θ ○ p .
We define a skew-symmetric bilinear form η ∈ ⋀ 2 M by η(e i , e j ) ∶= ⟨γ i , γ j ⟩ (4.5) for every i, j ∈ I. In other words, η is the pullback of ⟨-, -⟩ by p. Definition 4.1. We define a N + -graded Lie algebra h = ⊕ n∈N + h n as follows. First, we introduce the finite set (4.6)

N + e ∶= { i∈I a i e i ∈ N + a i ∈ {0, 1} ∀i ∈ I} = {e J J ⊂ I, J ≠ ∅} ⊂ N + .
Then, as vector spaces, we set h n ∶= g p(n) if n ∈ N + e , and h n ∶= 0 else. For x ∈ h n 1 and y ∈ h n 2 , we define the bracket [x, y] as being the bracket

[x, y] in h n 1 +n 2 = g p(n 1 )+p(n 2 ) if n 1 , n 2 , n 1 + n 2 ∈ N +
e , and as being 0 else.

One checks easily that this defines a Lie bracket on h and that the resulting Lie algebra is finitely N + -graded: by construction, the support Supp(h

) = {n ∈ N + h n ≠ 0} of h is contained in N + e . It follows from (3.6) that [h n 1 , h n 2 ] = 0 if η(n 1 , n 2 ) = 0.
Thus, we can consider (N + , h)-scattering diagrams as in Defn. 3.2 and their initial data as in Defn. 3.7, where N + , g and ⟨-, -⟩ ∈ ⋀ 2 M are replaced by N + , h and η ∈ ⋀ 2 M.

Let e ∈ Wall Supp(h) be a wall in M R with normal vector n e = e I and which contains the image q(d) of the wall d ∈ Wall Supp(g) by the map q∶ M R → M R as in (4.4)

= g n 1 +n 2 if n 1 , n 2 , n 1 + n 2 ∈ p(N + e )
, and as being 0 else.

One checks easily that this defines a Lie bracket on g and that the resulting Lie algebra is finitely N + -graded. It follows from (3.6) that [g n 1 , gn 2 ] = 0 if ⟨n 1 , n 2 ⟩ = 0. As γ = p(e) ∈ Supp(g), there exists a unique wall d ∈ Wall Supp(g) such that d ⊂ d. Applying Proposition 3.11 for (N + , g)-scattering diagram to the multiset Γ ∈ mult(N + ) and the wall d, we obtain a map (4.9) F g, Proof. Note that by definition of g, we have gn = g n for every n ∈ Γ ∪ {γ}, and so the maps F g,d Γ and F g, d Γ have the same domain and codomain. The result follows from the fact that the algorithmic construction of F g,d Γ reviewed in the proof of Proposition 3.11 involves only brackets

[x, y] with x ∈ g n 1 , y ∈ g n 2 , [x, y] ∈ g n 1 +n 2 and n 1 , n 2 , n 1 + n 2 ∈ p(N + e ).
In what remains, we compare the Lie algebras g and h.

Proposition 4.4 . Let q∶ M R → M R be the linear map defined in (4.4). Then,

(i) For every n ∈ N , the preimage q -1 (n ⊥ ) of the hyperplane n ⊥ ⊂ M R under q∶ M R → M R is the hyperplane (p(n)) ⊥ ⊂ M R . (ii) For every cone σ ∈ S Supp(g) , the image q(σ) of σ by q∶ M R → M R is a cone q(σ) ∈ S Supp(h) .
Proof. The first part (i) of the Lemma follows immediately since we have θ ∈ q -1 (n ⊥ ) if and only if (q(θ))(n) = 0 if and only if θ(p(n)) = 0.

To show (ii), first note that by Defn. 3.1, the assumption σ ∈ S Supp(g) implies that there exists a partition of the set Supp(g) ⊂ N + into subsets Supp(g) = P + ⊔ P 0 ⊔ P -such that (4.10)

σ ∶= {θ ∈ M R θ(n) = 0 for n ∈ P 0 , ±θ(n) ≥ 0 for n ∈ P ± } . Define Q ± ∶= {n ∈ Supp(h) p(n) ∈ P ± } and Q 0 ∶= {n ∈ Supp(h) p(n) ∈ P 0 }. As Supp(g) = p(Supp(h)), we have Supp(h) = Q + ⊔ Q 0 ⊔ Q -. Using that θ(p(n)) = (q(θ))(n) for every n ∈ N , we obtain q(σ) = {θ ∈ M R θ(n) = 0 for n ∈ Q 0 , ±θ(n) ≥ 0 for n ∈ Q ± }.
Hence, q(σ) ∈ S Supp(h) by Defn. 3.1.

Proposition 4.5 . For every n ∈ N , the attractor points ⟨p(n), -⟩ for p(n) and ι n η = η(n, -) for n as in Proposition 3.9 are related by:

(4.11) q(⟨p(n), -⟩) = ι n η ,
where η ∈ ⋀ 2 M is defined by (4.5).

Proof. For every m ∈ N , we have

(4.12) (q(⟨p(n), -⟩))(m) = ⟨p(n), p(m)⟩ = η(n, m) = (ι n η)(m) ,
where the first equality uses (4.4) and the second equality uses (4.5).

4.2.2.

The (N + , g)-scattering diagram and consistency. In this section, we construct a consistent (N + , g)-scattering diagram φ ρ starting from a consistent (N + , h)-scattering diagram ρ.

Let ρ∶ Wall Supp(h) → h be a consistent (N + , h)-scattering diagram. Following [55, §2], we start by defining an extension ρ∶ S Supp(h) → h of ρ where the set of walls Wall Supp(h) is replaced by the set S Supp(h) of all cones. For a cone σ ∈ S Supp(h) , there exists by Defn. 3.1 a decomposition Supp(h) = P + ⊔ P 0 ⊔ P -such that (4. [START_REF] Bridgeland | Scattering diagrams, Hall algebras and stability conditions[END_REF] σ ∶= {θ ∈ M R θ(n) = 0 for n ∈ P 0 , ±θ(n) ≥ 0 for n ∈ P ± } .

We denote σ + ∶= {θ ∈ M R θ(m) > 0, ∀m ∈ P + ∪ P 0 } and σ -∶= {θ ∈ M R θ(m) < 0, ∀m ∈ P + ∪ P 0 }. Let p∶ [0, 1] → M R be a h-generic path with p(0) ∈ σ + and p(1) ∈ σ -(see Figure 4.1). By (3.5), we have the corresponding path-ordered product Ψ p,ρ ∈ H ∶= exp(h), and we define

(4.14) ρ(σ) ∶= log Ψ p,ρ ∈ h .
By consistency of ρ, this definition of ρ(σ) is independent of the choice of the path p. By Defn. 4.1 and Defn. 4.2, we have g = ⊕ n∈p(N + e ) g n and h = ⊕ n∈N + e g p(n) . We denote by ν∶ h → g the natural projection map sending h n = g p(n) onto g p(n) = gp(n) . We now define a (N + , g)-scattering diagram φ ρ ∶ Wall Supp(g) → g. For every wall σ ∈ Wall Supp(g) , the image q(σ) of σ by q is a cone in S Supp(h) by Proposition 4.4 (ii). Therefore, one can applied ρ to σ to obtain ρ(σ) ∈ h, and finally ν∶ h → g:

φ ρ (σ) ∶= ν(ρ(q(σ))) ∈ g . (4.15)
Lemma 4.6 . For every consistent (N + , h)-scattering diagram ρ∶ Wall Supp(h) → h, the (N + , g)-scattering diagram φ ρ ∶ Wall Supp(g) → g defined by (4.15) is consistent.

Proof. Let p∶ [0, 1] → M R be a g-generic loop. Let q be a small generic perturbation of t ↦ q(p(t)) such that, for every σ ∈ Wall Supp(g) and t ′ ∈ [0, 1] with p(t ′ ) ∈ d ′ , the perturbed path t ↦ q(t) goes from (q(σ)) -to (q(σ)) + , or from (q(σ)) + to (q(σ)) -, in a small neighborhood of t ′ . By the definition of φ ρ in (4.15), the group element Ψ p,φρ is the image in G = exp(g) of the group element Ψ q,ρ by exp(ν)∶ H → G. By consistency of ρ we have Ψ q,ρ = id, and hence Ψ p,φρ = id. Lemma 4.7 . For every consistent (N + , h)-scattering diagram ρ∶ Wall Supp(h) → h, the initial data of ρ and of the (N + , g)-scattering diagram φ ρ ∶ Wall Supp(g) → g defined by (4.15) are related as follows: for every n ∈ Supp(g) = p(Supp(h)), we have Proof. Let σ ∈ Wall Supp(g) be a wall containing the attractor point ⟨n, -⟩ for n and such that n ∈ Z ≥1 n σ . By Proposition 3.9 applied to φ, we have (4.17)

I φ,n = (φ(σ)) n .
Let ∆ ⊂ Supp(h) be the subset of primitive m ∈ Supp(h) such that p(m) ∈ Z ≥1 n σ . By Proposition 4.4, for every primitive m ∈ Supp(h), the hyperplane m ⊥ contains the cone q(σ) if and only if m ∈ ∆.

Let p∶ [0, 1] → M R be a h-generic path with p(0) ∈ (q(σ)) + and p(1) ∈ (q(σ)) -. For every m ∈ ∆, we have θ(m) > 0 for every θ ∈ (q(σ)) + and θ(m) < 0 for every θ ∈ (q(σ)) -. Therefore, up to straightening p, one can assume that for every m ∈ ∆, the path p intersects the hyperplane m ⊥ exactly once. We can also assume that for every m ∈ ∆, the intersection of p with m ⊥ lies in a wall d m ⊂ m ⊥ containing the cone q(σ). For every m, m ′ ∈ ∆, we have η(m, m ′ ) = ⟨p(m), p(m ′ )⟩ = 0, and so [ρ(d m ), ρ(d m ′ )] = 0. Thus it follows from the definition (4.15) of φ ρ that (4.18)

φ ρ (σ) n = m∈∆, k∈Z ≥1 p(km)=n ν(ρ(d m ) km ) .
By Proposition 4.5, for every m ∈ ∆ and k ∈ Z ≥1 such that p(km) = n, we have ι km η = q(⟨n, -⟩) ∈ q(σ) ⊂ d m . We deduce from Proposition 3.9 applied to ρ that (4.

F g, d Γ = 1 ∏ n∈N + m Γ (n)! F h,e
Γe .

Let ∆ ⊂ Supp(h) be the subset of primitive m ∈ Supp(h) such that p(m) ∈ Z ≥1 n d. As p(e) = γ, we have e ∈ ∆. By Proposition 4.4, for primitive m ∈ Supp(h), the hyperplane m ⊥ contains the cone q( d) if and only if m ∈ ∆. Arguing as in the proof of Lemma 4.7, one can find a h-generic path p∶ [0, 1] → M R with p(0) ∈ (q( d)) + , p(1) ∈ (q( d)) -, and such that for every m ∈ ∆, the path p intersects the hyperplane m ⊥ at a single point, lying in a wall d m ⊂ m ⊥ which contains the cone q( d). We can also assume that d e = e. Let ρ∶ Wall Supp(h) → h be a consistent (N + , h)-scattering diagram and φ ρ ∶ Wall Supp(g) → g the consistent (N + , g)-scattering diagram φ ρ ∶ Wall Supp(g) → g defined by (4.15). As in the proof of Lemma 4. We show below that the equality (4.22) follows from identifying on both sides of (4.23) the terms homogeneous of degree m Γ (n) in the initial data I φρ,n . By Proposition 3.11 applied to φ ρ , we have

(4.24) φ ρ ( d) γ = Γ ′ ={γ ′ }∈mult(N + ) γ ′ ∈Supp(g), ∑ γ ′ ∈Γ ′ γ ′ =γ F g, d Γ ′ (I φρ,γ ′ ) γ ′ ∈Γ ′ .
The only term homogeneous of degree m Γ (n) in the initial data I φρ,n in (4.24) is obtained for Γ ′ = Γ and is equal to

F g, d Γ (I φρ,n ) n∈Γ .
On the other hand, by Proposition 3.11 applied to ρ, the right-hand side of (4.23) is equal to (4.25) m∈∆, k∈Z ≥1 p(km)=γ

Γ ′ ={n ′ }∈mult(N + ) n ′ ∈Supp(h) ,∑ n ′ ∈Γ ′ n ′ =km ν F h,dm Γ ′ ((I ρ,n ′ ) n ′ ∈Γ ′ ) .
The only term homogeneous of degree 1 in the initial data I ρ,e i in (4.25) is obtained for Γ ′ = Γ e and is equal to ν(F h,e Γe ((I ρ,e i ) 1≤i≤r )). Note that the sum in (4.26) contains m Γ (n) terms. Therefore, (4.22) follows from the following algebraic claim applied to

(x i ) i = (I φρ,n ) n , (y ij ) ij = (ν(I ρ,e i )) i , f = F g, d Γ and g = ν(F h,e
Γe ): Claim: Let f ((x i ) 1≤i≤s ) be a polynomial function of s variables which is homogeneous of degree a i in the variable x i . Write each variable x i as a sum of a i variables y ij : x i = ∑ a i j=1 y ij , and let g((y ij ) 1≤i≤r,1≤j≤a i ) be the component of f ((∑ a i j=1 y ij ) 1≤i≤s ) which is homogeneous of degree 1 in each variable y ij . Finally, let ĝ((x i ) 1≤i≤s ) be the function obtained from g((y ij ) 1≤i≤s,1≤j≤a i ) by the specialization of variables y ij ↦ x i , for every 1 ≤ i ≤ s and 1 ≤ j ≤ a i . Then, we have

(4.27) ĝ((x i ) 1≤i≤s ) = s i=1 a i ! f ((x i ) 1≤i≤s ) .
Proof of the claim: It is enough to prove the result for

f = ∏ s i=1 x a i i . For f = ∏ i x a i i , g is the term proportional to ∏ i,j y ij in ∏ i (∑ j y ij ) a i . So, g = (∏ i a i !) ∏ i,j y ij and so ĝ = (∏ i a i !) ∏ i x a i i = (∏ i a i !)f .
Hence, the result follows.

(N +

, h)-scattering diagrams and flow tree maps. This section includes the technical heart of the paper, Theorem 4.14. The key result of the paper, the flow tree formula in Theorem 4.22, will follow from Theorem 4.14 and Theorem 4.9.

4.3.1.

Small enough generic perturbations of the skew-symmetric bilinear form. In this section, we define small enough generic perturbations of the skew-symmetric bilinear form η ∈ ⋀ 2 M defined by (4.5).

Definition 4.10. We denote by U η the set of ω ∈ ⋀ 2 M R such that for every n 1 , n 2 ∈ N + e with η(n 1 , n 2 ) nonzero, ω(n 1 , n 2 ) is nonzero and has the same sign as η(n 1 , n 2 ). We have

η ∈ U η and U η is an open neighborhood of η in ⋀ 2 M R .
For a fixed (I, η)-generic point α ∈ e ⊥ I ⊂ M R as in Defn. 2.14, we call a perturbation ω of η generic if it belongs to the open dense subset U I,α ⊂ ⋀ 2 M R , as in Defn. 2.15, and we say that the perturbation is small enough if ω belongs to the open neighborhood U η ⊂ ⋀ 2 M R , as in Defn. 4.10. Hence, ω is a small enough generic perturbation

of η ∈ ⋀ 2 M if (4.28) ω ∈ U I,α ∩ U η .

4.3.2.

Embedding treees in M R via the discrete attractor flow. We fix a (I, η)-generic point α ∈ e ⊥ I ⊂ M R as in Defn. 2.14 and ω ∈ U I,α as in Defn. 2.15. In this section we use the discrete attractor flow defined in §2.3 to define an embedding of binary trees in M R as follows. For every tree T ∈ T I , where T I is defined as in Lemma 2.7, we denote by T ○ the graph obtained from T by removing all the leaves v ∈ V L T , and extending the resulting open intervals to unbounded edges. For every tree T ∈ T I , we fix a continuous map (4.29)

j α,ω T ∶ T ○ → M R
such that:

(1) for every vertex v ∈ R T ∪ V ○ T , we have

(4.30) j α,ω T (v) = θ α,ω T,v .
(2) for every bounded edge E of T ○ , connecting vertices v and v ′ , the image of the map j α,ω T restricted to E is the line segment in M R with endpoints θ α,ω T,v and θ α,ω T,v ′ . (3) for every unbounded edge E of T ○ obtained by removing the leaf decorated by e i , the image of the map j α,ω

T restricted to E is the half-line θ α,ω T,v + R ≥0 ι e i ω in M R , where v is the vertex in V ○ T incident to E.
Remark 4.11. For every tree T ∈ T I , the embedded graph j α,ω T (T ○ ) ⊂ M R in (4.29) defined using the discrete flow has a natural structure of tropical disks in M R [START_REF] Carl | A tropical view of Landau-Ginzburg models[END_REF][START_REF] Gross | The tropical vertex[END_REF][START_REF] Nishinou | Toric degenerations of toric varieties and tropical curves[END_REF]

if ω ∈ ⋀ 2 M ⊗ Z Q ⊂ ⋀ 2 M R :
edges have then rational weighted directions of the form ι ev ω and the tropical balancing condition at vertices distinct from the root follows from the relation e v = e v ′ + e v ′′ in Defn. 2.8. Proposition 4.12 . For every tree T ∈ T η I and interior vertex v ∈ V ○ T , we have j α,ω T (v) ∉ j α,ω T (p(v)), that is, the edge connecting v and p(v) is not contracted to a point by j α,ω T .

Proof. From the assumption ω ∈ U I,α and Defn. 2.15 of U I,α , we have θ α,ω T,p(v) (e v ′ ) ≠ 0, and so θ α,ω T,p(v) ≠ θ α,ω T,v by (2.9). Definition 4.13. We consider the union of all the images of the trees T ○ by the maps j α,ω T for T ∈ T η I :

(4.31) F α,ω ∶= ⋃ T ∈T η I j α,ω T (T ○ ) ⊂ M R .
We view F α,ω as a graph embedded in M R . Note that we have α ∈ F , as α is the common image by the maps j α,ω T of the roots of the trees T ∈ T η I .

4.3.3.

Scattering diagrams via flow tree maps. Now we are ready to state our main theorem of this section, that allows us to describe scattering diagrams in terms of flow tree maps. This is the technical heart of this paper.

Theorem 4.14 . Fix a (I, η)-generic point α ∈ e ⊥ I ⊂ M R as in Defn. 2.14 and a small enough generic perturbation ω ∈ U I,α ∩ U η of η as in §4.3.1. Let J ⊂ I be a nonempty index set, and x ∈ e ⊥ J a (J, η)-generic point such that x ∈ F α,ω and the line segment (x + Rι e J ω) ∩ F α,ω is not a point. Let σ ∈ Wall Supp(h) be a wall containing x and with normal vector n σ = e J . Then for every consistent (N + , h)-scattering diagram φ constructed from initial data I φ,n that satisfies I φ,n = 0 if n ∉ {e i } i∈I , we have (4.32) φ(σ) e J = A x,ω J ((I φ,e i ) i∈J ) where φ(σ) e J ∈ h e J is the component of φ(σ) ∈ h in h e J , and A x,ω J is the flow tree map with initial point x as in Defn. 2.23.

Proof. The proof is done by induction on the cardinality of the subset J ⊂ I. For the initial step of the induction, let J be a singleton, that is, J = {i} for some i ∈ J. Then by Lemma 2.7, T J consists of a single tree T , with one root and one leg connected by a single edge. Therefore by item (1) of Defn. 2.21, the map A x,ω J,T ∶ g e i → g e i is the identity map. Hence, A x,ω J (I φ,e i ) = I φ,e i . On the other hand, let σ be a wall with n σ = e i . As e i does not admit any non-trivial decomposition as a sum of elements of Supp(h) ⊂ N + e , it follows from the algorithmic construction of scattering diagrams from initial data reviewed in the proof of Proposition 3.11 that φ(σ) e i = I φ,e i for every consistent (N + , h)-scattering diagram φ. Therefore, we conclude φ(σ) e i = A x,ω J (I φ,e i ), and hence the initial step of the induction. For the induction step, let J ⊂ I of cardinality J > 1. We assume that Theorem 4.14 holds for every J ′ ⊂ I with J ′ < J . Let σ ∈ Wall Supp(h) be a wall such that n σ = e J and let x ∈ F α,ω ∩ σ be a (J, η)-generic point such that (x + Rι e J ω) ∩ F α,ω is a non-trivial line segment.

In the remaining part of the section, we show that the statement of the theorem holds for J, x, σ in the following four steps:

Step I: We define a set of relevant joints J , and show in Lemma 4.15 that if two walls contained in e ⊥ J intersect along any joint that is not relevant, then the elements of the Lie algebra h associated to these walls are the same. This enables us to partition the hyperplane e ⊥ J into regions where any wall in a given region has the same associated element of the Lie algebra, which we denote by φ i-1,i ∈ h e J in (4.34), for i ∈ {1, . . . , k}, and φ k,∞ ∈ h e J in (4.35).

Step II: Using the genericity of ω, we prove Lemma 4.16 and we obtain (4.36), expressing the difference φ i-1,i -φ i,i+1 in terms of some Lie brackets. On the other hand, using that ω is close enough to η, we prove that φ k,∞ = 0.

Step III: Using the consistency condition around the relevant joints and the induction hypothesis, we determine explicitly the Lie brackets appearing in (4.36).

Step IV: Using the explicit expression obtained in Step III for the difference in (4.36), we obtain the expression (4.35) for φ(σ) e J . This, together with the fact that φ k,∞ = 0, as shown in Step II concludes the proof.

We expand each of these steps in the remaining part of this section.

Step I: We define the set J of relevant joints: a joint j ∈ S Supp(h) , that is, a codimension 2 cone of the cone complex S Supp(h) is relevant if there exists a subindex set J ′ ⊂ J with

σ x + R ≥0 ι eJ ω σ ∞ x i σ i-1,i σ i,i+1 ι eJ ω ι eJ η e ⊥ J x j i 0 Figure 4.2.
Joints in red on the wall e ⊥ J , the perturbation ι e J ω of ι e J η, and the half line x + R ≥0 ι e J ω in blue. j ⊂ e ⊥ J ′ ∩ e ⊥ J and η(e J ′ , e J ) ≠ 0. Note that the point x is not contained in a relevant joint because of the assumption that x is (J, η)-generic. Let 0 = t 0 < t 1 < ⋅ ⋅ ⋅ < t k be an increasing sequence of positive real numbers, such that the intersection points of the half-line x + R ≥0 ι e J ω with relevant joints j ∈ J correspond to points (4.33)

x x x i x i e ⊥ J1 e ⊥ J j i e ⊥ J e ⊥ J2 j i σ i-1,i
x i = x + t i ι e J ω ⊂ e ⊥ J ⊂ M R , for i ∈ {1, . . . , k}, as illustrated in Figures 4.2
I φ,n = 0 if n ∉ {e i } i∈J . Let σ 1 , σ 2 ∈ Wall Supp(h) such that n σ 1 = n σ 2 = e J .
Assume that the joint σ 1 ∩ σ 2 does not belong to J . Then we have φ(σ 1 ) e J = φ(σ 2 ) e J .

Proof. By consistency of φ applied around the joint σ 1 ∩ σ 2 , the difference φ(σ ′ ) e J -φ(σ) e J is an element of h e J equal to a sum of iterated Lie brackets in the elements φ(d k ), where d k ∈ Wall Supp(h) are the walls containing σ 1 ∩ σ 2 . As by assumption σ 1 ∩ σ 2 ∉ J , for every such wall d k , we have either n d k = e J ′ for J ′ ⊂ I not contained in J, or n d k = e J ′ with J ′ ⊂ J and η(e J , e J ′ ) = 0. If J ′ ⊂ I is not contained in J, then [h e J ′ , h] ∩ h e J = {0} and so in this case the wall d k does not contribute non-trivially to the sum of iterated Lie brackets. If J ′ ⊂ J and η(e J ′ , e J ) = 0, then η(e J ′ , n) = 0 and [e J ′ , h n ] = 0 for every n ∈ N such that e J = e J ′ + n, and so also in this case the wall d k does not contribute to the sum of iterated Lie brackets. We conclude that φ(σ 1 ) e J -φ(σ 2 ) e J = 0. By Lemma 4.15, for any i ∈ {1, . . . , k}, if σ 1 , σ 2 are two walls with n σ 1 = n σ 2 = e J such that σ 1 ∩ (x + R ≥0 ι e J ω) and σ 2 ∩ (x + R ≥0 ι e J ω) are non-trivial line segments contained in x + [t i-1 , t i ]ι e J ω, then φ(σ 1 ) e J = φ(σ 2 ) e J . We denote by (4.34)

φ i-1,i ∈ h e J
this common value. Note that φ(σ) e J = φ 0,1 . Similarly, for every walls

σ 1 , σ 2 with n σ 1 = n σ 2 = e J such that σ 1 ∩ (x + R ≥0 ι e J ω) and σ 2 ∩ (x + R ≥0 ι e J ω) are non-trivial line segments contained in x + [t k , ∞
)ι e J ω, we have φ(σ 1 ) e J = φ(σ 2 ) e J , and we denote by

φ k,∞ ∈ h e J (4.35)
this common value.

Step II: In this step, we show that the differences between φ i-1,i and φ i,i+1 have the form given by (4.36), and we prove that φ k,∞ = 0. Lemma 4.16 . Let ω ∈ U I,α as in Defn. 2.15. Let J = J 1 ⊔ ⋅ ⋅ ⋅ ⊔ J s be a partition of J in s subsets such that

x i ∈ e ⊥ J 1 ∩ ⋅ ⋅ ⋅ ∩ e ⊥ Js . Then, we have s ≤ 2. Proof. If s ≥ 3, then writing J ′ 1 = J 1 , J ′ 2 = J 2 and J ′ 3 = ⋃ s k=3 J k , we have J = J ′ 1 ⊔ J ′ 2 ⊔ J ′ 3 and x i ∈ e ⊥ J ′ 1 ∩ e ⊥ J ′ 2 ∩ e ⊥ J ′

3

. Thus, it is enough to prove that the case s = 3 cannot happen. So we assume by contradiction that there exists a partition

J = J 1 ⊔ J 2 ⊔ J 3 such that x i ∈ e ⊥ J 1 ∩ e ⊥ J 2 ∩ e ⊥ J 3 .
As we are assuming that (x + Rι e J ω) ∩ F α,ω is a non-trivial line segment, there exists a tree T ∈ T η I and an edge E of T such that, denoting by v the vertex of T incident to E on the path from E to the leaves, x is in the interior of j α,ω T (E) and the charge e v as in Defn. 2.8 is given by e v = e J .

We choose a tree T 12 ∈ T J 1 ⊔J 2 such that, denoting by v 12 the child of the root of T 12 , we have e v ′ 12 = e J 1 and e v ′′ 12 = e J 2 . We also choose a tree T 3 ∈ T J 3 . We construct a new tree T ∈ T η I from T , T 12 and T 3 as follows (see Figure 4.4). First, let T be the tree obtained by removing from T all the edges and vertices descendant from v, so that v becomes a leaf of T . Then, we obtain T by gluing the three trees T , T 12 , and T 3 : we identify the leaf v of T with the roots of T 12 and T 3 . We still denote by v the vertex of T where T , T 12 and T 3 are glued together, and by E the edge of T incident to v on the path from v to the root. We

T E v v ′ v ′′ (v ′ ) ′′ T 12 e J2 e J1 e J3
T 3 have e v = e J , and we label v ′ and v ′′ the children of v so that e v ′ = e J 1 + e J 2 , e v ′′ = e J 3 , and

(v ′ ) ′
(v ′ ) ′ and (v ′ ) ′′ the children of v ′ so that e (v ′ ) ′ = e J 1 and e (v ′ ) ′′ = e J 2 .
By (4.30), we have j T (v) = θ α,ω T ,v and it follows from Lemma 2.12 that j T (v) ∈ (e J 1 + e J 2 ) ⊥ ∩ e ⊥ J 3 . As we also have j T (E) ⊂ x + Rι e J ω, we deduce that j T (v) is the intersection point of the line x + Rι e J with (e J 1 + e J 2 ) ⊥ ∩ e ⊥ J 3 and so j T (v) = x i . As we are assuming

x i ∈ e ⊥ J 1 ∩ e ⊥ J 2 ∩ e ⊥ J 3 , we have in particular θ α,ω T ,v (e J 1 ) = 0, so θ α,ω T ,v (e (v ′ ) ′ ) = 0,
in contradiction with our assumption that ω ∈ U I,α and Defn. 2.15 of U I,α .

For every i ∈ {1, . . . , k}, we pick a relevant joint j i ∈ J containing the point x i . By consistency of φ around the joint j i , the difference φ i-1,i -φ i,i+1 can be written in terms of the walls containing j i as a sum of iterated Lie brackets. By Lemma 4.16, φ i-1,i -φ i,i+1 only receives contributions from two-terms decompositions e J = e J 1 + e J 2 . Denote by

P j i the set of {J 1 , J 2 } with J 1 , J 2 ⊂ J, J = J 1 ⊔ J 2 , j i ⊂ e ⊥ J 1 ∩ e ⊥ J 2
, and η(e J 1 , e J 2 ) ≠ 0. Then, we have

(4.36) φ i-1,i -φ i,i+1 = {J 1 ,J 2 }∈P j i g j i J 1 ,J 2
where g j i J 1 ,J 2 is a scalar multiple of a Lie bracket produced by the walls contained in the hyperplanes e ⊥ J 1 and e ⊥ J 2 and intersecting along the joint j i . It follows from Lemma 4.16 that one can compute each term g j i J,J ′ as if the only walls intersecting along the joint j i were contained in the hyperplanes e ⊥ J 1 , e ⊥ J 2 and e ⊥ J . The precise form of g j i J 1 ,J 2 is given in Lemma 4.18 below. Proposition 4.17 . For ω ∈ U η , we have φ k,∞ = 0.

Proof. As the set of walls Wall Supp(h) is finite, there exists a wall σ ∞ ∈ Wall Supp(h) such that n σ∞ = e J and x+tι e J ω ⊂ σ ∞ for t large enough, as illustrated in Figures 4.2. As σ ∞ is a cone in M R , this last condition is only possible if ι e J ω ∈ σ ∞ . As Supp(h) ⊂ N + e , it follows from the assumption ω ∈ U η and from the Defn. 4.10 of U η that ι e J η ∈ σ ∞ : indeed the condition that ω(e J , n) has the same sign as η(e J , n) for all n ∈ N + e exactly means that there are no hyperplane n ⊥ with n ∈ N + e and separating the points ι e J ω and ι e J ω. Therefore, we have by Proposition 3.9 that φ(σ ∞ ) e J = I φ,e J . But we are assuming that I φ,n = 0 if n ∉ {e i } i∈I and J > 1, so I φ,e J = 0. We conclude that φ k,∞ = φ(σ ∞ ) e J = 0.

σ i,i+1 σ i-1,i j i p(0) ι eJ ω ι eJ 2 ω 2 -2 -1 - d in 1 d out 1 d out 2 d in 2 1 ι eJ 1 ω
Step III: In this step, we apply the consistency condition for φ around the joint j i through the point x i = x + t i ι e J ω to compute the quantities g j i J 1 ,J 2 appearing in (4.36). We denote by σ i-1,i (resp. σ i,i+1 ) the wall containing j i such that n σ i-1,i = e J and σ i-1,i ⊂ j i -R ≥0 ι e J ω (resp. σ i,i+1 ⊂ j i + R ≥0 ι e J ω), as illustrated in Figures 4.2 and 4.3. We have φ(σ i-1,i ) = φ i-1,i and φ(σ i,i+1 ) = φ i,i+1 .

Let {J 1 , J the walls containing j i such that 2 )e J 2 e 1 φ(d in 1 )e J 1 e φ i,i+1 e 2 φ(d in 2 )e J 2 .

n d in 1 = n d out 1 = e J 1 , n d in 2 = n d out 2 = e J 2 , (4.37) d in 1 ⊂ j i + R ≥0 ι e J 1 ω , d in 2 ⊂ j i + R ≥0 ι e J 2 ω (4.38) d out 1 ⊂ j i -R ≥0 ι e J 1 ω , d out 2 ⊂ j i -R ≥0 ι e J 2 ω
Therefore, the consistency of φ around j i implies (4.41)

(φ i,i+1 -φ i-1,i ) + 1 2 [φ(d in 1 ) e J 1 , φ(d in 2 ) e J 2 ] = 0
and so (4.42)

g j i J 1 ,J 2 = 1 2 [φ(d in 1 ) e J 1 , φ(d in 2 ) e J 2 ]
.

We show -sgn(ω(n 1 , n 2 )) = 1 2 in the remaining part of the proof. We work in the plane transverse to j i spanned by ι e J 1 ω, ι e J 2 ω, and we view (e J 1 , e J 2 ) as coordinates on this plane. Up to smoothly deforming p, one can assume that p intersects p in 2 (resp. σ i,i+1 and d in 1 ) at the point j i + ι e J 2 ω (resp. j i + ι e J ω and j i + ι e J 1 ω), which has coordinates (-ω(e J 1 , e J 2 ), 0) (resp. (-ω(e J 1 , e J 2 ), ω(e J 1 , e J 2 )) and (0, ω(e J 1 , e J 2 ))).

By definition, 2 is minus the sign of variation of the coordinate e J 2 when p crosses d in 2 . When p goes from j i + ι e J 2 ω to j i + ι e J ω, the variation of the coordinate e J 2 is ω(e J 1 , e J 2 ), and so 2 = -sgn(ω(e J 1 , e J 2 )). Similarly, one checks that = -sgn(ω(e J 1 , e J 2 )) and 1 = -sgn(ω(e J 1 , e J 2 )). Proof. To show we can apply the induction hypothesis to J 1 , d in 1 , x i and J 2 , d in 2 , x i , we need to show that: (i) the point x i is (J 1 , η)-generic and (J 2 , η)-generic, (ii) the intersections (x i + Rι e J 1 ω) ∩ F α,ω and (x i + Rι e J 1 ω) ∩ F α,ω are non-trivial line segments.

To prove (i), first note that

x i ∈ j i ⊂ e ⊥ J 1 ∩ e ⊥ J 2 . If there were J ′ 1 ⊊ J 1 such that x i ∈ e ⊥ J ′ 1 , then, writing J 1 = J ′ 1 ⊔ J ′′ 1 , one would have e J = e J ′ 1 + e J ′′ 1 + e J 2 and x i ∈ e ⊥ J ′ 1 ∩ e ⊥ J ′′ 1 ∩ e ⊥ J 2
, in contradiction with Lemma 4.16. Therefore, x i is (J 1 , η)-generic. Exchanging the roles of J 1 and J 2 , this also proves that x i is (J 2 , η)-generic.

To prove (ii), we follow the same logic as in the proof of Lemma 4.16. As we are assuming that x + Rι e J ω ⊂ F is a non-trivial line segment, there exists a tree T ∈ T η I and an edge E of T such that, denoting by v the vertex of T incident to E on the path from E to the leaves, x is in the interior of j α,ω T (E) and e v = e J . We choose trees T 1 ∈ T J 1 and T 2 ∈ T J 2 . We construct a new tree T ∈ T η I from T , T 1 and T 2 as follows (see Figure 4.6). First, let T be the tree obtained by removing from T all the edges and vertices descendant from v, so that v becomes a leaf of T . Then, we obtain T by gluing the three trees T , T 1 , and T 2 : we identify the leaf v of T with the roots of T 1 and T 2 . We still denote by v the vertex of T where T , T 1 and T 2 are glued together and by E the edge of T incident to v on the path from v to the root. We have e v = e J and we label v ′ and v ′′ the children of v so that e v ′ = e J 1 and e v ′′ = e J 2 . Let E ′ (resp. E ′′ ) be the edge of T connecting v to v ′ (resp. v ′′ ). We have j T (e v ) = θ α,ω T ,v , and so by Lemma 2.12, j T (e v ) ∈ e ⊥ J 1 ∩ e ⊥ J 2 . As we also have j T (E) ⊂ x + Rι e J ω, we deduce that j T (v) = x i . We conclude that j T (E ′ ) ⊂ (x i + Rι e J 1 ω) ∩ F α,ω and j T (E ′′ ) ⊂ (x i + Rι e J 2 ω) ∩ F α,ω . By Proposition 4.12, j T (E ′ ) and j T (E ′′ ) are non-trivial line segments and and hence the proof of (ii) follows.

E T E ′′ v ′′ v E ′ T 2 v ′ e J 2 e J 1
Thus, we can rewrite Lemma 4.18 as (4.45) g j i J 1 ,J 2 = -sgn(ω(e J 1 , e J 2 ))[A x i ,ω J 1 , A x i ,ω J 2 ]((I φ,e j ) j∈J ) . By Defn. 2.23 of the flow tree maps as sum over trees, this can be rewritten as (4.46)

g j i J 1 ,J 2 = - T 1 ∈T η J 1 T 2 ∈T η J 2 sgn(ω(e J 1 , e J 2 ))[A x i ,ω J 1 ,T 1 , A x i ,ω J 2 ,T 2 ]((I φ,e j ) j∈J ) .
Step IV: As a final step, we show that (4.47) φ(σ) e J = φ k,∞ + A x,ω J ((I φ,e j ) j∈J ) . To prove (4.47), first observe that summing the equations (4.36) side by side for all values i ∈ {1, . . . , k} we obtain φ(σ) e J = φ k,∞ + ∑ k i=1 ∑ {J 1 ,J 2 }∈P j i g j i J 1 ,J 2 . Then, using (4.46), we get

(4.48) φ(σ) e J = φ k,∞ - k i=1 {J 1 ,J 2 }∈P j i T 1 ∈T η J 1 T 2 ∈T η J 2 sgn(ω(e J 1 , e J 2 ))[A x i ,ω J 1 ,T 1 , A x i ,ω J 2 ,T 2 ]((I φ,e j ) j∈J ) .
On the other hand, we have A x,ω J = ∑ T ∈T η J A x,ω J,T by Defn. 2.23, and so, using Defn. 2.21:

(4.49)

T ∈T η J A x,ω J,T = - T ∈T η J sgn(x(e v ′ T )) + sgn(ω(e v ′ T , e v ′′ T )) 2 [A x,ω J,T,v ′ T , A x,ω J,T,v ′′ T ] , T T 1 T 2 e J1 e J2
k i=1 {J 1 ,J 2 }∈P j i T 1 ∈T η J 1 T 2 ∈T η J 2 sgn(ω(e J 1 , e J 2 ))[A x i ,ω J 1 ,T 1 , A x i ,ω J 2 ,T 2 ] (4.50) = T ∈T η J sgn(x(e v ′ T )) + sgn(ω(e v ′ T , e v ′′ T )) 2 [A x,ω J,T,v ′ T , A x,ω J,T,v ′′ T ] . (4.51)
Given T ∈ T η J and writing J 1 = J T,v ′ T and J 2 = J T,v ′′ T , we obtain a tree T 1 ∈ T J 1 (resp. T 2 ∈ T J 2 ) by considering the subtree of T made of v T and its descendant through the child v ′ T (resp. v ′′ T ) (see Figure 4.7). If the contribution of T in (4.51) is nonzero, we have in fact T 1 ∈ T η J 1 and T 2 ∈ T η J 2 . We claim that x(e J 1 ) and ω(e J 1 , e J 2 ) are of the same sign if and only if the intersection point of the line x + Rι e J ω with e ⊥ J 1 ∩ e ⊥ J 2 is contained in the half-line x + R ≥0 ι e J ω. Indeed, the intersection point of the line x + Rι e J ω with e ⊥ J 1 ∩ e ⊥ J 2 is the point (4.52)

x -

x(e J 1 ) ω(e J , e J 1 ) ι e J ω .

Thus, if sgn(x(e J 1 )) + sgn(ω(e J 1 , e J 2 )) ≠ 0, the intersection point of the line x + Rι e J ω with e ⊥ J 1 ∩ e ⊥ J 2 is equal x i for some 1 ≤ i ≤ k such that {J 1 , J 2 } ∈ j i , and we have (4.53)

x i = x - x(e J 1 ) ω(e J , e J 1 ) ι e J ω = θ x,ω T,v .
Then, it follows from Defn. 2.21 and 2.23 that

A x i ,ω J 1 ,T 1 = A x,ω J,T,v ′ T and A x i ,ω J 2 ,T 2 = A x,ω J,T,v ′′ T .
Conversely, for every 1 ≤ i ≤ k and {J 1 , J 2 } ∈ P j i , every T 1 ∈ T η J 1 and T 2 ∈ T η J 2 are obtained in this way. Hence, (4.47) follows.

From (4.47) together with Proposition 4.17, we obtain φ(σ) e J = A x,ω J ((I φ,e j ) j∈J ) and so Theorem 4.14 holds for J, σ and x. Hence, this concludes our proof of Theorem 4.14. Proof. Assume by contradiction that α is not (I, η)-generic, which means by Defn. 2.14 that there exists a tree T ∈ T η I such that α(e v ′ ) = 0, where v is the child of the root of T . Thus, we have τ (p(e v ′ )) = 0, that is, τ ∈ p(e v ′ ) ⊥ , and so the condition that τ is γ-generic implies by Defn. 4.20 that p(e v ′ ) is collinear with γ = p(e I ). Recalling that e v = e I , this implies that η(e v ′ , e v ) = η(e v ′ , e I ) = ⟨p(e v ′ ), p(e I )⟩ = 0, in contradiction with the assumption that T ∈ T η I and the Defn. 2.13 of T η I .

4.20. A point τ ∈ γ ⊥ ⊂ M R is γ-generic if for every γ ′ ∈ N , θ(γ ′ ) = 0 implies that γ ′ is collinear with γ.
Let τ ∈ γ ⊥ be a γ-generic point as in Defn. 4.20. By Lemma 4.21, the point α ∶= q(τ ) ∈ e ⊥ I is (I, η)-generic. Therefore, by Proposition 2.18 the set U I,α of (I, α)-generic skew-symmetric bilinear form is open and dense in ⋀ 2 M R , and for every ω ∈ U I,α the flow tree map A α,ω I ∶ ∏ i∈I h e i → h e is defined by Defn. 2.23. Finally, we arrive at our main theorem of this section, the flow tree formula for scattering diagrams I: Theorem 4.22 . Let d ∈ Wall Supp(g) be a wall in M R and Γ = {γ i } i∈I ∈ mult(N + ) a multiset of elements of N + such that d ⊂ γ ⊥ , where γ = ∑ i∈I γ i . Let τ ∈ d be a γ-generic point and α ∶= q(τ ) ∈ M R the image of τ by the map q ∶ M R → M R as in (4.4). For every small enough generic perturbation ω ∈ U I,α ∩ U η of η as in 4.3.1, the map F g,d Γ in (3.14) is given by the "flow tree formula for scattering diagrams I":

(4.54) F g,d Γ = 1 ∏ n∈N + m Γ (n)! Âα,ω I .
where Âα,ω I is as in Defn. 4.8 the specialization of the flow tree map A α,ω I defined in Defn. 2.23.

Proof. Let e ∈ Wall Supp(h) be a wall in M R containing q(d) such that e ⊂ e ⊥ I . In particular, we have α ∈ e. By Theorem 4.9, we have

(4.55) F g,d Γ = 1 ∏ n∈N + m Γ (n)! F h,e
Γe .

On the other hand, as α is (I, η)-generic by Lemma 4.21, we can apply Theorem 4.14 for J = I, σ = e, x = α, and we obtain (4.56) F h,e Γe = A α,ω I .

The result follows from (4.55) and (4.56).

We provide also a variant of the flow tree formula for scattering diagrams, the flow tree formula for scattering diagrams II, which involves perturbing the points in M R rather than the skew-symmetric bilinear form, as in Theorem 4.22.

Note that from Proposition 2.20 that the set V I,η of β ∈ e ⊥ I ⊂ M R such that β is (I, η)generic and η is β-generic is open and dense in e ⊥ I . For every β ∈ V I,η , we define the flow tree maps A β,η I ∶ ∏ i∈I h e i → h e as in Defn. 2.23 and its specialization Âβ,η I ∶ ∏ n∈Γ g n → g γ as in Defn. 4.8. For every β ∈ V I,η , we define F β,η as F α,ω in 4.31 and replacing α with β, and ω with η. We also define V α ⊂ e ⊥ I as the set of β ∈ e ⊥ I such that there exists a wall e ∈ Wall Supp(h) with e ⊂ e ⊥ I which contains both α and β. We have α ∈ V α and V α is an open neighborhood of α in e ⊥ I . We say that β is a small enough generic perturbation of α in e ⊥ I if

(4.57) β ∈ V I,α ∩ V α .
Theorem 4.23 . Fix a (I, η)-generic point α ∈ e ⊥ I ⊂ M R as in Defn. 2.14 and a small enough generic perturbation β ∈ V I,α ∩ V α of α in e ⊥ I . Let J ⊂ I be a nonempty index set, and x ∈ e ⊥ J a (J, η)-generic point such that x ∈ F β,η and the line segment (x + Rι e J ω) ∩ F β,η is not a point. Let σ ∈ Wall Supp(h) be a wall containing x and with normal vector n σ = e J . Then for every consistent (N + , h)-scattering diagram φ such that I φ,n = 0 if n ∉ {e i } i∈I , we have (4. [START_REF] Nishinou | Toric degenerations of toric varieties and tropical curves[END_REF] φ(σ) e J = A x,η J ((I φ,e i ) i∈J )

Proof. The proof is analogous to the proof of Theorem 4.14, with α, ω replaced respectively by β, η, and with an extra simplification in Proposition 4.17: for t positive large enough, x + tι e J η is contained in a wall σ ∞ , which thus necessarily contains ι e J η and so φ k,∞ = 0 follows from Proposition 3.9.

Theorem 4.24 . Let d ∈ Wall Supp(g) be a wall in M R and Γ = {γ i } i∈I ∈ mult(N + ) a multiset of elements of N + such that d ⊂ γ ⊥ , where γ = ∑ i∈I γ i . Let τ ∈ d be a γ-generic point and α ∶= q(τ ) ∈ M R the image of τ by the map q ∶ M R → M R as in (4.4). For every small enough generic perturbation β ∈ V I,α ∩ V α of α in e ⊥ I , the universal map F g,d Γ in (3.14) is given by by the "flow tree formula for scattering diagrams II":

(4.59) F g,d Γ = 1 ∏ n∈N + m Γ (n)! Âβ,η I .
Proof. Let e ∈ Wall Supp(h) be a wall in M R such that e ⊂ e ⊥ I and containing both q(d) and β. By Theorem 4.9, we have

(4.60) F g,d Γ = 1 ∏ n∈N + m Γ (n)! F h,e
Γe .

On the other hand, as α is (I, η)-generic by Lemma 4.21, we can apply Theorem 4.23 for J = I, σ = e, x = β, and we obtain (4.61) F h,e Γe = A β,η I . The result follows from (4.60) and (4.61).

Remark 4.25. We compare briefly the passage from scattering diagrams in N to scattering diagrams in N and the perturbation of scattering diagrams introduced in [START_REF] Gross | The tropical vertex[END_REF]. Using our notations, the perturbation of [START_REF] Gross | The tropical vertex[END_REF] consists in replacing the hyperplanes γ ⊥ i = {θ ∈ M R θ(γ i ) = 0} by the affine hyperplanes {θ ∈ M R θ(γ i ) = i } where i ∈ R are generic perturbation parameters. On the other hand, denoting by K the kernel of p∶ N → N , we obtain by duality a surjective map π∶ M R → K ∨ R , where K ∨ R ∶= Hom(K, R). We claim that our scattering diagram in M R is a universal family of perturbed scattering diagrams in the sense of [START_REF] Gross | The tropical vertex[END_REF]. Indeed, fixing ∈ K ∨ R is equivalent to fixing the perturbation parameters i of [START_REF] Gross | The tropical vertex[END_REF], and the intersections of our scattering diagram in M R with the fibers π -1 ( ) are essentially the perturbed scattering diagrams of [START_REF] Gross | The tropical vertex[END_REF].

The embedded trees j β,η T (T ○ ) used in the proof of Theorem 4.24 are all contained in the fiber π -1 (π(β)) of π. Indeed, all edges have directions of the form ι ev η, and so for every k ∈ K, we have ι ev η(k) = η(e v , k) = 0 because η is the pullback of ⟨-, -⟩ by p. Therefore, these embedded trees viewed inside π -1 (π(β)) essentially coincide with the tropical curves contained in the perturbed scattering diagrams considered in [START_REF] Gross | The tropical vertex[END_REF] (see also [START_REF] Cheung | Donaldson-Thomas invariants from tropical disks[END_REF][START_REF] Mandel | Scattering diagrams, theta functions, and refined tropical curve counts[END_REF]).

By contrast, the embedded trees j α,ω T (T ○ ) used in the proof of Theorem 4.22 are not contained in a given fiber of π in general: one cannot use the perturbed scattering diagrams in the sense of [START_REF] Gross | The tropical vertex[END_REF] and it is essential to work with scattering diagrams in M R .

The flow tree formula for DT invariants

In §5.1- §5.2, we review the definition of DT invariants of quivers with potentials. In §5.3, we state the flow tree formula, which computes DT invariants in terms of a smaller set of attractor DT invariants. We prove the flow tree formula for DT invariants in §5.4 by applying the flow tree formula for scattering diagrams to the stability scattering diagram introduced by Bridgeland in [START_REF] Bridgeland | Scattering diagrams, Hall algebras and stability conditions[END_REF].

5.1. Quivers with potentials. A quiver Q is a finite oriented graph. A potential W ∈ CQ for Q is a finite linear combination of oriented cycles of Q in the path algebra CQ of Q. We assume that Q does not contain oriented 2-cycles and we denote by Q 0 the set of vertices of Q, and set N ∶= Z Q 0 , with dual M R ∶= Hom(N, R), and (5.1)

N + ∶= N Q 0 {0} ⊂ N .
Definition 5.1. A representation E of Q is a finite-dimensional left-module over the path algebra CQ, that is, the data of a finite-dimensional C-vector space E i for each vertex i ∈ Q 0 and of a linear map f α ∶ E i → E j for every arrow α∶ i → j in Q. Every nonzero representation of Q has a dimension vector (dim E i ) i∈Q 0 ∈ N + .

Definition 5.2. Given γ ∈ N + and a stability parameter

θ ∈ γ ⊥ = {θ ′ ∈ M R θ ′ (γ) = 0}, a representation E of Q of dimension vector γ is θ-semistable (resp. θ-stable) if for every strict subrepresentation F ⊊ E, we have θ(F ) ≤ 0 (resp. θ(F ) < 0).
It is shown in [START_REF] King | Moduli of representations of finite-dimensional algebras[END_REF] that there exists a smooth quasiprojective variety M θ-st γ parametrizing isomorphism classes of θ-stable representations of Q of dimension vector γ, and a generally singular quasiprojective variety M θ γ parametrizing S-equivalence classes of θ-semistable representations of Q of dimension vector γ. A potential W ∈ CQ defines regular functions Tr(W ) θ γ on the moduli spaces M θ γ as follows: Given a representation E = (E i , f α ) i,α ∈ M θ γ and an a oriented cycle c = α r . . . α 0 in Q starting and ending at the vertex i 0 ∈ Q 0 , the composition

(5.2) f c ∶= f αr ○ ⋅ ⋅ ⋅ ○ f α 0
of the linear maps f α i along the arrows of the cycle is an endomorphism of E i 0 , and we define the evaluation of the function Tr(c) θ γ on E as being the trace of this endomorphism. More generally, W is a linear combination ∑ k a k c k of oriented cycles c k and we define Tr(W ) θ γ by linearity, that is, Tr(W ) θ γ ∶= ∑ k a k Tr(c k ) θ γ .

5.2. DT invariants of quivers with potentials and flow trees. Let (Q, W ) be a quiver with potential, γ ∈ N + a dimension vector and θ ∈ γ ⊥ ⊂ M R a stability parameter. We assume that θ is γ-generic in the sense that θ(γ ′ ) = 0 implies γ ′ collinear with γ. Then, the (refined) Donaldson-Thomas invariant of (Q, W ) for the dimension vector γ and the stability parameter θ is a Laurent polynomial

(5.3) Ω θ γ (y, t) ∈ Z[y ± , t ± ]
in two variables y and t, and with integer coefficients. In the ideal case where M θ γ is smooth and the critical locus of Tr(W ) θ γ is non-degenerate, Ω θ γ (y, t) coincides with the (signed symmetrized) Hodge polynomial of the critical locus of Tr(W ) θ γ . In general, the singularities of M θ γ and the degeneracy of the critical locus require respectively the use of the theory of perverse sheaves [START_REF] Beȋlinson | Faisceaux pervers[END_REF] and of the theory of vanishing cycles [START_REF] Deligne | Groupes de monodromie en géométrie algébrique[END_REF]. We will in a moment review the definition of Ω θ γ (y, t) following the approach of [START_REF] Davison | Cohomological Donaldson-Thomas theory of a quiver with potential and quantum enveloping algebras[END_REF][START_REF] Meinhardt | Donaldson-Thomas invariants versus intersection cohomology of quiver moduli[END_REF] and referring to [START_REF] Davison | Cohomological Donaldson-Thomas theory of a quiver with potential and quantum enveloping algebras[END_REF] for technical details.

We define the DT sheaf DT θ γ on M θ γ by The cohomological DT invariant DT θ γ is then defined as the cohomology of the DT sheaf:

(5.6) DT θ γ ∶= H * (M θ γ , DT θ γ ) .

By Saito's theory of mixed Hodge modules [START_REF] Saito | Mixed Hodge modules[END_REF], the graded vector space DT θ γ is naturally endowed with a (monodromic) mixed Hodge structure, and so in particular with an increasing weight filtration W and a decreasing Hodge filtration F. The Hodge-Deligne numbers of DT θ γ are

(5.7) h p,q ∶= i∈Z (-1) i dim Gr p F Gr W p+q H i (M θ γ , DT θ γ ) ,

where Gr * F and Gr W * are the graded pieces of the filtrations F and W. The (refined) DT invariant Ω θ γ (y, t) is by definition a Laurent polynomial with coefficients the Hodge-Deligne numbers of DT θ γ :

(5.8) Ω θ γ (y, t) ∶= p,q h p,q y p+q t p-q ∈ Z[y ± , t ± ] .

The flow tree formula is more naturally formulated in terms of the rational DT invariants Ω θ γ (y, t) ∈ Q(y, t) defined by (5.9) Ω θ γ (y, t) ∶=

γ ′ ∈N + γ=kγ ′ , k∈Z ≥1 1 k y -y -1 y k -y -k Ω θ γ ′ (y k , t k ) .
It is proved in [START_REF] Davison | Cohomological Donaldson-Thomas theory of a quiver with potential and quantum enveloping algebras[END_REF] that the dependence on θ of the invariants Ω θ γ (y, t) is given by the wall-crossing formula of Joyce-Song and Kontsevich-Soibelman, and that the invariants Ω θ γ (y, t) coincide with those previously defined in [START_REF] Joyce | A theory of generalized Donaldson-Thomas invariants[END_REF][START_REF] Kontsevich | Stability structures, motivic Donaldson-Thomas invariants and cluster transformations[END_REF] using the motivic Hall algebra.

5.3.

Attractor invariants and the flow tree formula. In this section we state our main result, the flow tree formula in Theorem 5.5, which expresses the DT invariants in terms of a smaller subset of invariants, referred to as attractor invariants and defined as follows.

Let ⟨-, -⟩∶ N × N → Z be the skew-symmetric bilinear form defined by (5.10) ⟨γ, γ ′ ⟩ ∶= i,j∈Q 0

(a ij -a ji )γ i γ ′ j ,
where a ij is the number of arrows in Q from the vertex i to the vertex j. where Ω θγ γ (y, t) is as in (5.9), and θ γ is a small γ-generic perturbation of the attractor point ⟨γ, -⟩ ∈ M R .

Remark 5.4. The definition 5.3 of rational attractor invariants is independent of the choice of the small γ-generic perturbation (see [START_REF] Mozgovoy | Attractor invariants, brane tilings and crystals[END_REF]Theorem 3.1]): indeed, if there is a wall of marginal stability associated to a decomposition γ = γ ′ + γ ′ passing through the attractor point ⟨γ, -⟩, then ⟨γ, γ ′ ⟩ = 0 and so Ω θ γ (y, t) does not jump through this wall according to the wall-crossing formula. Replacing Ω θγ γ (y, t) in Defn. 5.3 by Ω θγ γ (y, t) in (5.8), we obatin the definition of an attractor invariants, which are related to rational attractor invariants via the formula (5.9). In what follows, we often make use of the rational attractor invariants, which suit better to wall-crossing computations.

By iteration of the wall-crossing formula, the DT invariants Ω θ γ (y, t) for any γ-generic stability parameter θ ∈ γ ⊥ can be expressed in terms of the attractor invariants Ω * γ by a formula of the form (5.12) Ω θ γ (y, t) =

r≥1 {γ i } 1≤i≤r ∑ r i=1 γ i =γ 1 Aut({γ i } i ) F θ r (γ 1 , . . . , γ r ) r i=1 Ω * γ i (y, t) ,
where the second sum is over the multisets {γ i } 1≤i≤r with γ i ∈ N and ∑ r i=1 γ i = γ. Here, the denominator Aut({γ i } i ) is the order of the symmetry group of {γ i }: if m γ ′ is the number of times that γ ′ ∈ N appears in {γ i } i , then Aut({γ i } i ) = ∏ γ ′ ∈N m γ ′ !. The coefficients F θ r (γ 1 , . . . , γ r ) are universal in the sense that they depend on (Q, W ) only through the skew-symmetric form ⟨-, -⟩ on N . The flow tree formula gives an explicit formula for coefficients F θ r (γ 1 , . . . , γ r ) as a sum over binary trees. We state the flow tree formula in Theorem 5.5 after introducing some notation.

Let γ 1 , . . . , γ r ∈ N such that ∑ r i=1 γ i = γ. As in (4.2)-(4.4), we set I ∶= {1, . . . , r} and we introduce a rank r free abelian group N = ⊕ i∈I Ze i , along with the map p ∶ N → N as in (4.2) and the map q∶ M R → M R = Hom(N , R) defined as in (4.4). We also define a skew-symmetric bilinear form η ∈ ⋀ 2 M on N by η(e i , e j ) ∶= ⟨γ i , γ j ⟩, and consider the image α of the stability parameter θ by q:

(5. [START_REF] Bridgeland | Scattering diagrams, Hall algebras and stability conditions[END_REF] α ∶= q(θ) ∈ M R .

By Lemma 4.21 the assumption that θ is γ-generic implies that α is (I, η)-generic and so we can consider a small enough generic perturbation ω ∈ U I,α ∩ U η of η as in Defn. 2.15 and Defn. 4.10.

In the following theorem we state our main result, the flow tree formula, which provides an explicit description for the universal coefficient F θ r (γ 1 , . . . , γ r ) that appears in the formula (1.7) expressing the DT invariants Ω θ γ (y, t) in terms of the attractor invariants Ω * γ i (y, t). Theorem 5.5 . For every small enough generic perturbation ω ∈ U I,α ∩ U η ⊂ ⋀ 2 M R of η ∈ ⋀ 2 M R , the universal coefficients F θ r (γ 1 , . . . , γ r ) in (1.7) are given by the flow tree formula:

(5. where the sum is over binary trees as in §2.1, α,ω T,v ∈ {0, 1, -1} is as in (2.23) and

(5.15) κ(x) ∶= (-1) x ⋅ y x -y -x y -y -1

for every x ∈ Z.

The flow tree formula stated in Theorem 5.5 was conjectured by Alexandrov and Pioline in [START_REF] Alexandrov | Attractor flow trees, BPS indices and quivers[END_REF]. The assumption ω ∈ U I,α ∩ U η in Theorem 5.5 makes precise and explicit the conditions "small enough" and "generic" which were left slightly vague in the original formulation of the conjecture in [START_REF] Alexandrov | Attractor flow trees, BPS indices and quivers[END_REF]: ω ∈ U η is the condition "small enough", and ω ∈ U I,α is the condition "generic".

We also prove a variant of the flow tree formula recently conjectured by Mozgovoy [START_REF] Mozgovoy | Operadic approach to wall-crossing[END_REF] in which one perturbs points in M R rather than the skew-symmetric form. Recall that we denote e I ∶= ∑ i∈I e i . By Proposition 2.20, the set V I,η of β ∈ e ⊥ I ⊂ M R such that β is (I, η)-generic and η is β-generic is open and dense in e ⊥ I . Finally, we denote by V α the open neighborhood of α in e ⊥ I defined by: β ∈ V α if and only if for every n ∈ N + e such that α(n) is nonzero, β(n) is nonzero and of the same sign as α(n).

Theorem 5.6 . For every small enough generic perturbation β ∈ V I,η ∩ V α of α in e ⊥ I , the universal coefficient F θ r (γ 1 , . . . , γ r ) which appears in the formula (1.7) expressing the DT invariants Ω θ γ (y, t) in terms of the attractor invariants Ω * γ i (y, t) is given by: where the sum is over binary trees as in §2.1, α,ω T,v is as in (1.11) and κ is as in (5.15). In Theorem 5.6, the assumption β ∈ V I,η ∩ V α makes precise and explicit the expression "small enough generic perturbation" used in the statement of Theorem 1.2 given in the introduction: β ∈ V α is the condition "small enough", and β ∈ V I,η is the condition "generic". 5.4. Proofs of Theorems 5.5 and 5.6. We derive the proof of the flow tree formula in Theorem 5.5 (and of its variant in Theorem 5.6), from the flow tree formula for scattering diagrams in Theorem 4.22 (and from its variant in Theorem 4.24 respectively). We do this by applying the latter formulas to the stability scattering diagram, which is a (N + , g)scattering diagram as in Defn. 3.2, introduced by Bridgeland. We roughly review its description here, and for details refer to [START_REF] Bridgeland | Scattering diagrams, Hall algebras and stability conditions[END_REF].

e 1 e 2 e 5 e 4 e 3 e 5 pFigure 1 . 1 .

 3511 Figure 1.1. A binary tree T with five leaves for N = Ze 1 ⊕ Ze 2 ⊕ Ze 3 ⊕ Ze 4 ⊕ Ze 5 .

2 Figure 2 . 1 .

 221 Figure 2.1. Decorated binary rooted trees with ≤ 3 leaves.

4. 1 .

 1 (N + , h)-scattering diagrams. As in §3, we work with (N + , g)-scattering diagrams. We fix a wall d ∈ Wall Supp(g) , γ ∈ Z ≥1 n d ⊂ N + proportional to the normal vector n d to d, and a multiset Γ = {γ i } i∈I ∈ mult(N + ) of elements of N + such that ∑ i∈I γ i = γ, where I = {1, . . . r} is some index set. Applying Proposition 3.11 to the multiset Γ = {γ i } i∈I and to the wall d, we obtain a map(4.1)

Figure 4 . 1 .

 41 Figure 4.1. Paths around a codimension two cone σ.

  ρ,m ) , where I φρ,n and I ρ,m are the initial data of φ ρ and ρ as in Defn. 3.7.

  7, for every m, m ′ ∈ ∆, we have [ρ(d m ), ρ(d m ′ )] = 0 and so it follows from the definition (4.15) of φ ρ that (4.23) φ ρ ( d) γ = m∈∆, k∈Z ≥1 p(km)=γ ν(ρ(d m ) km ) .

Finally, by Lemma 4 . 7 ,

 47 we have for every n ∈ Γ, (4.26) I φρ,n = e i ,p(e i )=n ν(I ρ,e i ) .

Figure 4 . 3 .

 43 Figure 4.3. Walls intersecting along joints in red on the left and the wall σ i-1,i ⊂ e ⊥ J on the right.

and 4. 3 .

 3 Lemma 4.15 . Let φ be a consistent (N + , h)-scattering diagram, such that

Figure 4 . 4 .

 44 Figure 4.4. A tree T as in the proof of Lemma 4.16.

Figure 4 . 5 .

 45 Figure 4.5. Consistency around the joint j i .

Lemma 4 . 19 .

 419 We can apply the induction hypothesis to J 1 , d in 1 , x i and J 2 , d in 2 , x i . Hence, φ(d in 1 ) = A x i ,ω J 1 ((I φ,e j ) j∈J 1 ) , (4.43) φ(d in 2 ) = A x i ,ω J 2 ((I φ,e j ) j∈J 2 ) . (4.44)

T 1 Figure 4 . 6 .

 146 Figure 4.6. A tree T as in the proof of Lemma 4.19.

Figure 4 . 7 .

 47 Figure 4.7. Trees T 1 , T 2 and T .

4. 4 .

 4 The flow tree formula for scattering diagrams.

Definition

Lemma 4 . 21 .

 421 Let τ ∈ γ ⊥ ⊂ M R be a γ-generic point as in Defn. 4.20. Then, the image α ∶= q(τ ) ∈ e ⊥ I ⊂ M R of τ by the map q∶ M R → M R given by (4.4) is (I, η)-generic as in Defn. 2.14.

( 5 φ

 5 Tr(W ) θ γ (IC M θ γ ) if M θ-st γ ≠ ∅ 0 elsewise,where IC M θ d denotes the intersection cohomology sheaf on M θ γ and φ Tr(W ) θ γ is the vanishing cycle functor defined by the function(5.5) Tr(W ) θ γ ∶ M θ γ → C .

Definition 5 . 3 .

 53 For every γ ∈ N + , the rational attractor invariant Ω * γ (y, t) is defined by(5.11) Ω * γ (y, t) ∶= Ω θγ γ (y, t) ,

  [START_REF] Carl | A tropical view of Landau-Ginzburg models[END_REF])F θ r (γ 1 , . . . , γ r ) = T ∈T η r v∈V ○ T α,ω T,v κ(η(e v ′ , e v ′′ )) ,

( 5

 5 .[START_REF] Cecotti | Classification of complete N = 2 supersymmetric theories in 4 dimensions[END_REF])F θ r (γ 1 , . . . , γ r ) = T ∈T η r v∈V ○ T β,η T,v κ(η(e v ′ , e v ′′ )) ,

  . Applying Proposition 3.11 to the multiset Γ e ∶= {e i } i∈I ∈ mult(N + ) of elements of N + and to the wall e ∈ Wall Supp(h) , we obtain a map Γe in (4.7). To prove it, we first need to compare the Lie algebras g and h. We do this by going through an intermediate N + -graded Lie algebra

	(4.7)	F h,e Γe ∶
	(4.8)	n∈N + g = ⊕	gn
	defined using the map p∶ N → N in (4.2) and the finite subset N +

i∈I

h e i → h e I ,

where we used the fact that, as {e i } i∈I is a basis of N , Γ e = Γ e = {e i } i∈I . 4.2. From (N + , g) to (N + , h)-scattering diagrams. The main result of this section, Theorem 4.9 provides a comparison of the map F g,d Γ in (4.1) and the map F h,e e ⊂ N + in (4.6). 4.2.1. The Lie algebra g. Definition 4.2. Define the Lie algebra g as follows: As vector spaces, we set gn ∶= g n if n ∈ p(N + e ), and gn ∶= 0 else. For x ∈ gn 1 and y ∈ gn 2 , we define the bracket [x, y] as being the bracket [x, y] in gn 1 +n 2

  [START_REF] Davison | Donaldson-Thomas theory for categories of homological dimension one with potential[END_REF] ρ(d m ) km = I ρ,km . Theorem 4.9 . Let d ∈ Wall Supp(g) be a wall in M R and Γ = {γ i } i∈I ∈ mult(N + ) a multiset of elements in N + such that d ⊂ γ ⊥ , where γ = ∑ i∈I γ i . Let Γ e = {e i } i∈I ∈ mult(N + ), and e ∈ Wall Supp(h) a wall in M R such that e ⊂ e ⊥ I and containing the image q(d) of d by the map q∶ M R → M R as in (4.4). Then, the maps F g,d Γ in (4.1) and F h,e

				Γe in (4.7) satisfy
	(4.21)	F g,d Γ =	1 ∏ n∈N + m Γ (n)!	F h,e Γe ,
	where F h,e Γe is the specialization of F h,e Γe as in Defn. 4.8.
	Proof. By Proposition 4.3, it is enough to show that
	(4.22)
	Equation (4.16) follows from (4.17)-(4.18)-(4.19).

Definition 4.8. Given a map ϕ∶ ∏ i∈I h e i → h e I , the specialization of ϕ is the map φ∶ ∏ n∈Γ g n → g γ defined as follows. For (x n ) n∈Γ ∈ ∏ n∈Γ g n , define (y i ) i∈I ∈ ∏ i∈I h e i by y i ∶= x p(e i ) , where p∶ N → N is as in (4.2), and set

(4.20)

φ ((x n ) n∈Γ ) ∶= ϕ ((y i ) i∈I ) .

  2 } ∈ P j i . We denote by d in 1 , d in 2 , d out

	1	and d out 2

  . By Lemma 4.[START_REF] Cecotti | Classification of complete N = 2 supersymmetric theories in 4 dimensions[END_REF], there are no non-trivial decomposition e J 1 = ∑ , and so it follows from the consistency of φ around j i that φ(d out 1 )e J 1 = φ(d in 1 ) e J 1 . Similarly, we have φ(d out 2 ) e J 2 = φ(d in 2 ) e J 2 . Lemma 4.18 . Let p∶ [0, 1] → M R be a h-generic oriented loop around j i intersecting successively d in 2 , σ i,i+1 , d in 1 , d out 2 , σ i-1,i , d out ,J 2 = -sgn(ω(n 1 , n 2 ))[φ(d in 1 ) e J 1 , φ(d in 2 ) e J 2 ]. Proof. Denote by 1 (resp. 2 and ) the sign of the derivative of t ↦ -p(t)(e J 1 ) (resp.-p(t)(e J 2 ) and -p(t)(e J )) at the intersection point of p with d in 1 (resp. d in 2 and σ i,i+1 ).

	s j=1 n j with n j ∈ N + e and (see Figure 4.5). Then, we have -2 φ(d in j 1 j=1 n ⊥ j i ⊂ ∩ s (4.39) g j i J 1 According to (3.5), we have (4.40) Ψ p,φ = e -1 φ(d in 1 )e J 1 e -φ i-1,i e

h Γ ∶ n∈Γ gn → gγ . Proposition 4.3 . The maps F g,d Γ in (4.1) and F g, d Γ in (4.9) are equal: F g,d Γ = F g, d Γ .

Let (Q, W ) be a quiver with potential, and γ ∈ N + be a dimension vector. Define a N + -graded Lie algebra over Q(y, t) by (5.17) g ∶= ⊕

where the Lie bracket [-, -] is given by

where κ is as in (5.15). Let δ∶ N → Z be an additive map such that δ(N + ) ⊂ Z ≥1 . Then

is a Lie ideal of g and we consider the quotient Lie algebra (5.20) g ∶= g g>δ(γ) , for every wall d ∈ Wall Supp(g) , where Ω xd knd (y, t) are rational DT invariants defined as in (5.9). The definition of φ is in fact independent of the choices of the points x d : by the wall-crossing formula, the DT invariants Ω θ n (y, t) with δ(n) ≤ δ(γ) do not jump as long as θ stays in the interior of a wall d ∈ Wall Supp(g) . The following key theorem is due to Bridgeland [13, Thm 1.1]: Theorem 5.7 (Bridgeland, 2016). The stability scattering diagram is consistent.

Hence, by Theorem 5.7, we can apply Theorems 4.22 and 4.24 to the stability scattering diagram φ. By Proposition 3.9, the initial data of φ are given by the attractor DT invariants:

(5.23)

for every n ∈ N + with δ(n) ≤ γ, and so Theorems 5.5 and 5.6 follow.