Cluster integrable systems and spin chains

We discuss relation between the cluster integrable systems and spin chains in the context of their correspondence with 5d supersymmetric gauge theories. It is shown that $\mathfrak{gl}_N$ XXZ-type spin chain on $M$ sites is isomorphic to a cluster integrable system with $N \times M$ rectangular Newton polygon and $N \times M$ fundamental domain of a 'fence net' bipartite graph. The Casimir functions of the Poisson bracket, labeled by the zig-zag paths on the graph, correspond to the inhomogeneities, on-site Casimirs and twists of the chain, supplemented by total spin. The symmetricity of cluster formulation implies natural spectral duality, relating $\mathfrak{gl}_N$-chain on $M$ sites with the $\mathfrak{gl}_M$-chain on $N$ sites. For these systems we construct explicitly a subgroup of the cluster mapping class group $\mathcal{G}_\mathcal{Q}$ and show that it acts by permutations of zig-zags and, as a consequence, by permutations of twists and inhomogeneities. Finally, we derive Hirota bilinear equations, describing dynamics of the tau-functions or A-cluster variables under the action of some generators of $\mathcal{G}_\mathcal{Q}$.


Introduction
In the seminal paper [SW] Seiberg and Witten found 'exact solution' to 4d N = 2 super-symmetric gauge theory in the strong coupling regime. More strictly, the IR effective couplings were constructed geometrically, from the period integrals on a complex curve, whose moduli are determined by the condensates and bare couplings of the UV gauge theory. Shortly after, it has been also realized [GKMMM] that natural language for the Seiberg-Witten theory is given by classical integrable systems. In such context the pure supersymmetric gauge theories (with only N = 2 vector supermultiplets) correspond to the Toda chains, while integrable systems for the gauge theories with fundamental matter multiplets are usually identified with classical spin chains of XXX-type.
The next important step was proposed in [S], where this picture has been lifted to 5d. Then it has been shown that transition from 4d to 5d (actually -four plus one compact dimensions) results in 'relativization' of the integrable systems [N] (in the sense of Ruijsenaars [R]). In the simplest case of SU (2) pure Yang-Mills theory, or affine Toda chain with two particles, instead of the Hamiltonian H 4d = p 2 + e q + Ze −q , (1.1) corresponding to 4d theory, one has to consider H 5d = e p + e −p + e q + Ze −q , (1.2) or the Hamiltonian of relativistic Toda chain, which describes effective theory for 5d pure SU (2) Yang-Mills 1 . It has been also shown that 5d theories with fundamental matter correspond to XXZ-type spin chains (see e.g. [MM] and references therein). Relativistic Toda chains lead to natural relation of this story with the integrable systems on the Poisson submanifolds in Lie groups, or more generally to the cluster integrable systems -recently discovered class of integrable systems of relativistic type [GK,M,FM14]. Direct relation between cluster integrable systems and 5d gauge theories has been proposed in [BGM17]. It was shown there that for the case of Newton polygons with single internal point, dynamics of discrete flow is governed by q-Painlevé equations and their bilinear form is solved by Nekrasov 5d dual partition functions (for other examples of 5d gauge theories the same phenomenon was considered in [JNS,BGT,BGM18]) 2 .
Cluster integrable systems Any convex polygon ∆ with vertices in Z 2 ⊂ R 2 can be considered as a Newton polygon of polynomial f ∆ (λ, µ), and equation (1.3) defines a plane (noncompact) spectral curve in C × × C × . The genus g of this curve is equal to the number of integral points strictly inside the polygon ∆. According to [GK], [FM14] a convex Newton polygon ∆, modulo action of SA(2, Z) = SL(2, Z) ⋉ Z 2 , defines a cluster integrable system, i.e. an integrable system on X-cluster Poisson variety X of dimension dim X = 2S, where S is area of the polygon ∆. The Poisson structure can be encoded by quiver Q with 2S vertices. Let ǫ ij be the number of arrows from i-th to j-th vertex (ǫ ji = −ǫ ij ) of Q, then logarithmically constant Poisson bracket has the form ( where g is the number of internal points (or genus of the curve (1.3)), or the number of independent integrals of motion. So the number of independent integrals of motion is half of the dimension of symplectic leaf, and the system is integrable. One of distinguished features of the cluster integrable systems is that their integrals of motion are the Laurent polynomials of (generally -fractional powers) in the cluster variables.
There are several different ways to get explicit form of the spectral curve equation (1.3): • Compute the dimer partition function (with signs) for a bipartite graph on a torus. One possible form of it is a characteristic equation det D(λ, µ) = 0 (1.8) with the classical (trigonometric) r-matrix 3 r(λ) = − λ 1/2 + λ −1/2 λ 1/2 − λ −1/2 i =j (1.10) A classical chain of trigonometric type can be defined by the monodromy operator where M is called 'rank' of the chain. Integrability is guaranteed by classical RTT-relation (1.12) for the monodromy operator that follows from (1.9), and gives rise to the integrals of motion, which can be extracted from the spectral curve equation (1.3) given explicitly by the formula f ∆ (λ, µ) = det(λQ − T (µ)) = 0. (1.13) where Q -diagonal twist matrix with the constant entities. Relativistic Toda system can be considered as certain degenerate case of generic XXZ chain of rank M = 2 (of length N for N particles).

Examples of Newton polygons
In what follows we mostly consider cluster integrable systems, corresponding to the Newton polygons of the following types: Figure 1: From left to right Newton polygons for: Toda chain on three sites, gl 2 XXZ spin chain on three sites, gl 2 spin chain on three sites with cyclic twist matrix.
• Quadrangles with four boundary points, where all internal points are located along the same straight line, as on Fig. 1, left. This is the case of relativistic Toda chains, studied in [BGM17]. The corresponding gauge theory is 5d N = 1 Yang-Mills theory with SU (N ) gauge group (for N − 1 internal points) without matter multiplets, possibly with the Chern-Simons term of level |k| ≤ N -in such case quadrangle is not a parallelogram.
• "Big" rectangles (modulo SA(2, Z) transform). For the N × M rectangle (see Fig. 1, center) this can be alternatively described as a gl N spin chain on M sites (cf. with [BPTY]), or vice versa. The corresponding 5d gauge theories are given by linear quivers theories with the SU (N ) gauge group at each of M − 1 nodes: see Fig. 2.
• "Twisted rectangles", or just the parallelograms, which are not SA(2, Z)-equivalent to the previous class (see Fig. 1, right), they can be alternatively formulated as spin chains with nontrivial twists. Gauge theory counterpart for this class of polygons is not yet known, except for the twisted gl N chain on one site, leading back to the basic class of Toda chains. For all these families the spectral curve of an integrable system, determined by equation (1.3) is endowed with a pair of meromorphic differentials dλ λ , dµ µ with the fixed 2πiZ-valued periods. One can also use this pair to introduce (the SL(2, Z)-invariant for our family) 2-form dλ λ ∧ dµ µ on C × × C × , whose 'pre-symplectic' form is the SW differential.
Structure of the paper The main aim is to extend the correspondence between 5d theories and cluster integrable systems to wider class of models. We find isomorphism between the classes of gl N XXZ-like spin chains on M sites, corresponding to 5d SU (N ) linear quiver gauge theories (see Fig. 2) [BPTY], and cluster integrable systems with N × M rectangular Newton polygons.
We start from the brief overview of classical XXZ spin chains. We illustrate with the simple example of relativistic Toda chain, how Lax operators naturally arise from the Dirac-Kasteleyn operator of cluster integrable system. Then we do this for the general case of XXZ spin chain of arbitrary length and rank. Spectral (or fiber-base) duality arises as an obvious consequence of the structure of considered bipartite graph. Spin chains with additional cyclic permutation twist matrix arise in the cluster context naturally as well.
Then we explain structure of large subgroup of cluster mapping class group G Q . We show that in case of general rank and length of chain it contains subgroup (4.1) which act in autonomous q = 1 limit by permutations of inhomogeneities and diagonal twist parameters of spin chain. We also discuss issue of deautonomization and propose a way to define action of G Q on zig-zags in q = 1 case. Then we derive bilinear equations for the action of generators of G Q on A-cluster variables.
2 Spin chains 2.1 Relativistic Toda chain Let us start with the case of relativistic Toda chain, which is known to be related to Seiberg-Witten theory in 5d without matter [N]. Relativistic Toda chains arise naturally on Lie groups [FM97], and therefore have cluster description. A typical bipartite graph of affine relativistic Toda is shown in Fig. 3. For the Toda system with N particles it has 2N vertices, 4N edges and 2N faces. Corresponding Newton polygon is shown in Fig. 1 where in the non-vanishing r.h.s. one can immediately recognize the Cartan matrix of sl N . This Poisson bracket has obviously two Casimir functions, which can be chosen, say, as 4 However, in what follows we are going to use the edge variables (see Appendix B for details), which do not have any canonical Poisson bracket, e.g. since they are not gauge invariant, when treated as elements of C × -valued gauge connection on the graph. Hence, following [M], we fix the gauge and parameterize all edges by 2N exponentiated Darboux variables ξ k , η k so that the face variables are expressed, as a products of oriented edge variables (see Fig. 3, left) by In terms of the edge variables (2.3) the monodromies over zig-zag paths (see Fig. 3, middle, right) can be expressed as follows In the autonomous limit q = 1, there is a single independent Casimir -diagonal twist of monodromy operator κ 1 /κ 2 or coupling of the affine Toda chain. Reduction from four zig-zags α, β, γ, δ to single Casimir κ 1 /κ 2 is a reminiscence of the freedom λ → aλ, µ → bµ and the fact that αβγδ = 1. The Dirac-Kasteleyn operator here can be read of the left picture at Fig. 3, and is given by N × N matrix 5 : where we have additionally defined and it almost coincides here [EFS] with the standard N × N formalism for the spectral curve of relativistic Toda chain det D(λ, µ) = 0 ⇔ ∃ D(λ, µ)ψ = 0 (2.8) with Baker-Akhiezer function ψ ∈ C N . Now, to illustrate what is going to be done for the spin chains, let us rewrite this equation in terms of the well-known 2 × 2 formalism for Toda chains, but not quite in a standard way. In order to do that, we first add an additional black (white) vertex to each top (bottom) edge in left Fig. 3, and draw it in deformed way as in Fig. 4. Such operation obviously does not change the set of dimer Figure 4: Extended and deformed bipartite graph for the Toda chain.
configurations, and new dimer partition function differs from the old one only by total nonvanishing factor. The Dirac-Kasteleyn matrix, read from the Fig. 4, can be written in the block form (2.10) The first factor in the tensor product corresponds to the number of the particle (or of the 'site'), arising naturally in the framework of 2 × 2 formalism for Toda systems and spin chains below, while the second -to position of a vertex inside the 'site'. For the 'extended' (compare to (2.6)) operator (2.9) one gets the same equation (2.8), but now with ψ ∈ C 2N , which can be written as: For the coefficients of this expansion (2.8) gives (2.12) or the system of finite-difference equations on Baker-Akhiezer functions with the quasi-periodic boundary conditions, where the 2 × 2 Lax matrix The spectral parameters or quasimomenta λ and µ appear due to intersection of the edge with the blue and purple cycles in H1(T 2 , Z), and minuses arise due to discrete spin structure. is equivalent to the standard Lax matrix for relativistic Toda chain (see e.g. [M]) up to conjugation by permutation matrix, and redefinition of the variables (2.14) This Lax operator satisfies classical RLL relation with the classical (trigonometric) r-matrix (1.10) 6 . Compatibility condition of (2.12) gives spectral curve equation in the form det(λQ − L N (µ)...L 1 (µ)) = 0 (2.16) where Q = diag (κ 1 , κ 2 ) is extra twist matrix 7 , and inhomogeneities {µ i }, which appear in the case of generic XXZ chain, are absorbed here into redefinition of dynamical variables.

Spin chains of XXZ type
Let us now apply the same arguments, which we used for the Toda chain, to the following class of chains: the rank M chains on N cites of XXZ-type, which means that the Poisson structure (2.15) is defined by trigonometric r-matrix. Such systems naturally arise in q → 1 limit of U q (gl M ), see Appendix A. We claim that such classical spin chain can be alternatively described as cluster integrable systems, constructed from 'big rectangles' of the size N × M . For a cluster integrable system with such Newton polygon (see Fig. 5, left) one gets a bipartite graph, drawn at Fig. 6. According to [GK] this graph is drawn on torus T 2 , i.e. left side is glued with the right side, and top -with the bottom, we will call such graphs as N × M 'fence nets'. The cluster coordinates x × ia , x + ia , now associated with the faces of graph at Fig. 6, satisfy the following Poisson bracket relations with two kinds of indices living 'on circles': i, j enumerating rows of bipartite graph and a, b enumerating columns. Corresponding quiver is drawn at Fig. 5, right. As in Toda case, 'fixing' a gauge, we pass now to the edge variables Extra parameters in (2.18) are the Casimir functions of the bracket (2.17), together with It is useful to re-express them via the zig-zag variables (see the zig-zag paths on Fig. 6, middle and right) These formulas relate convenient generators of the center of cluster Poisson algebra with inhomo- 1 2 of the chain. Our main statement here is that the classical spin variables (for definition see Appendix A) associated with single site of the chain could also be expressed via the edge variables ξ, η by (2.23) and the 'site index' i = 1, . . . , N is omitted here. Spin-variables cannot be directly expressed through the cluster variables in a natural way, but rather as a product of edge variables over some non-closed paths. However it is possible to express cluster variables via the spin variables on two adjacent sites by (2.24) where index outside brackets of spin variables enumerates number of site. This relation will be discussed in details elsewhere [SZ]. γ 1 δ 1 γ 2 δ 2 Figure 6: Left: bipartite graphs with labeled edges and faces: each edge, crossing purple cycle has to be multiplied by µ, each edge, crossing blue cycle -by λ. Center: horizontal zig-zag paths. Right: vertical zig-zag paths.
The spectral curve again can be given by determinant of the Dirac-Kasteleyn operator, which is the weighted adjacency matrix of the bipartite graph. For generic (N, M ) system it has the form: where the summand E ij ⊗ E ab is corresponding to the edge between black and white vertices 10 (i, a) → (j, b), and those matrices E ij which get out of fundamental domain are promoted to the elements of the 'loop algebra', with the 'loop' parameters (λ, µ): (2.28) 10 Signs '−' in D arise in a standard way [GK] due to choice of Kasteleyn marking or discrete spin structure on T 2 .
Let us now, breaking M ↔ N symmetry, collect the terms, corresponding to E ii and E i,i−1 in the first tensor factor, i.e. rewrite (2.25) as: From the spectral curve equation det D(λ, µ) = 0 one finds for (2.32) Solving these equations recursively for the vectors ψ i = M a=1 ψ ia e a , one finally gets of the form (1.13), with the Lax matrices Hence, the spectral curve det D(λ, µ) = 0 is represented in the form (1.11), common for the classical integrable chains with inhomogeneities µ k = 1/σ k ζ h k = β k and twist Q = a κ a E aa = a δ a /γ a E aa . There are also two sets of Casimirs related to spin variables: total projections of spin ζ v a = i e S 0 ia and single non-trivial on-site Casimirs ζ h i . The Lax operators (2.35) on different sites satisfy classical RLL-relations which coincide with (A.35) arising from the classical limit of U q (gl M ) with q = e − and κ = 1 2 in (A.25), see Appendix C for details. In such way one gets explicit formulas (with the sign-factors , endowed with the usual r-matrix Poisson structure [FG05,FM14]. For the family of systems we consider here, given by the SA(2, Z)-orbit of rectangular   Figure 7: Thurston diagram in the (3, 2) case, which appears from u = (s 2s2 s 1s1 Λ) 3 .
We are not going to repeat here all steps of the construction in detail, and just present the main ingredient -the Thurston diagram for (2.38), drawn for (N, M ) = (3, 2) at Fig. 7. The corresponding bipartite graph (see Fig. 7) differs from the discussed above 'fence-net' by additional horizontal twist of the cylinder by 2π, which does not affect an integrable system, since it corresponds to the SL(2, Z) transformation of the spectral parameters (λ, µ) → (λ, µλ −1 ).
Example. SU(2) theory with N f = 4 The most well-known case of the system we consider here corresponds to the five-dimensional supersymmetric gauge theory with the SU (2) gauge group and N f = 4 fundamental multiplets. The corresponding Newton polygon is a square with sides of length N = M = 2 (see Fig. 8), and as a spin chain this is just common XXZ-model on two sites with the Lax operator 11 (see e.g. [MM]) Spectral curve for the system is given by The Poisson brackets of spin operators are given by classical trigonometric r-matrix and written as: for the S-variables on the same site, and zero for the variables on the different sites. Such bracket has one natural Casimir function (2.43) As a cluster integrable system it lives on X-variety with the quiver corresponding to A (1) 3 -type system from Fig. 2 in [BGM17], and its deautonomization leads to the Painlevé VI equation, solvable by conformal blocks, or equivalently topological strings amplitudes [JNS]. We derive Lax operator for this system from Kasteleyn operator in details in the next example, which is simply generalization of this example to three sites.
(2.44) Spectral curve is given by condition which could be rewritten using monodromy operator (2.47) Lax operator (2.46) is of gl 2 type, so can be mapped to (A.43). To transform it in sl 2 form (2.40) we have to apply transformations like (A.45) Defining classical sl 2 spin variables by we see that Lax operator (2.49) coincides with the (2.40) up to replacement µ 1/2 → µ and S z → −S z . The latter is a consequence of the fact that (2.49) is coming from q = e − prescription, but (2.40) -from the usual q = e . Poisson brackets of spin variables coming from edge variables bracket which differs from (2.42) by factor 1/2, appearing from κ = 1 2 in the prescription for the classical limit of commutators (A.25). For details see Appendix A.
Spectral curve (2.41) could be obtained from (2.34) by transformation

Spectral duality
For some integrable chains special kind of duality could be observed both on the classical and on the quantum level: namely system with N -dimensional auxiliary space on M sites share Hamiltonians with some other system with M -dimensional auxiliary space on N sites. Under duality spectral parameter which monodromy operator depends on, and spectral parameter of characteristic equation exchange, so this duality is often called spectral duality (however, sometimes referred as 'level-rank' or 'fiber-base' duality, see [MMRZZ] and references therein).
In the case of our interest, system doesn't change its type: XXZ classical spin chain of gl M type on N sites is dual to the XXZ chain of the gl N type on M sites [MMRZZ], [BS]. Looking at M × N fence-net bipartite graph, it becomes obvious: graph keeps its structure under 90-degree rotation. On the level of Kasteleyn operator, this corresponds to exchange of factors in tensor product, and using different expressions for spin variables.
SU(2) theory with N f = 4 and one bi-fundamental multiplet. We start discussion of spectral duality in our context from simplest non-trivial example. Let us consider gl 3 spin chain on two sites, which is dual to gl 2 chain on three sites, considered in section 2.2. To derive dual Lax operators, we should permute some rows and columns of Kasteleyn operator (2.44), which is exchanging of factors in tensor product End( Spectral curve is given by condition which could be rewritten using monodromy operator It is indeed spectral dual to the curve (2.47). One can check by direct calculation that General case. If the order of factors in tensor product in (2.29) had been chosen in the other way, we would get M matrices A k and C k of size N × N : Again, we present spectral curve as condition which gives for the spectral curve (3.10) Using variables (2.23) we can write dual Lax operator (3.11) We can relate them to L-operators (2.37) of the same size Noting that for the classical r-matrix where transposition is taken in each tensor multiplier, we can deduce from (2.36) that (3.14) To obtain explicit relation for the dual spectral curves, we have to come back to the Kasteleyn operator of the system, and consider its determinant. In terms of M ×M blocks A k , C k defined by (3.8) spectral curve is given by and subtracting consequentially lines from first to last Acting in the same way, we get for the dual spectral curve Note that the relation of pre-factors is Casimir of the bracket

Twisted chains
A diagonal twist matrix is not the only one, commuting with r-matrices. A cyclic twist In terms of bipartite graphs it corresponds to the twist on a cycle of the torus, where the bipartite graph is drawn on, or the gluing condition for the sides of fundamental domain, see Fig. 6. Such twist also changes a Poisson quiver, even though the edge variables are not affected themselves. The twist of a bipartite graph results further in change of the zig-zag's structure. Several parallel zig-zags now join into 'longer sequences' with non-trivial winding so that rectangle Newton polygon undergoes a 'shear shift' -see examples on Fig. 9.
In the context of such transformations one can expect nontrivial consequences for spectral duality. Consider the trivial case of gl N chain on a single site, which is dual to rank 1 chain on N sites, and apply the cyclic twist along the longer side of a bipartite graph. In original picture this is just a multiplication of a single N × N Lax operator by cyclic permutation matrix. However in the dual setup, this results in passing from trivial gl 1 chain to the Toda chain on the same number of sites, which can be verified by comparing Fig. 9 and Fig. 3. After such procedure the number of Casimirs drops by 2N − 2, while number of Hamiltonians jumps from 0 to N − 1.
For supersymmetric gauge theories such transformation turns the theory of a single SU(N ) hypermultiplet with only SU(N ) × SU(N ) flavor symmetry into pure SU(N ) gauge theory.

Discrete dynamics
The cluster mapping class group G Q consists of sequences of mutations and permutations of quiver vertices, which maps quiver to itself, but acts in general non-trivially to the cluster variables (see Appendix B for details). As a simplification one can restrict the action of G Q to the set of Casimirs of the Poisson bracket. Each monomial Casimir maps to the monomial in Casimir functions. When We use different notations for zig-zags here, comparing to the pictures above. Edges crossed by red arrows belong to γ 2 zig-zag, orange arrows are for α 1 . a,b) XXZ chain of rank two and its twisted cousin. Note that the twisted twice chain is equivalent up to SL(2, Z) transformation λ → λµ to the untwisted chain, as Q 2 Λ = µ 1, like in Remark 2.2. c,d) Making Toda chain by twisting gl N chain dual to gl 1 chain.
the necessary for integrability condition i x i = 1 is relaxed to i x i = q (which is called as deautonomization), these flows act on the set of Casimirs, inducing non-trivial q−dynamics.
In [BGM17] the cluster mapping class groups for the quivers, corresponding to Newton polygons with a single internal point, were identified with the symmetry groups of q-Painlevé equations 12 . Passing from X-cluster to A-cluster variety, the q-Painlevé equations acquire bilinear form for the taufunctions, and can be solved via the dual Nekrasov partition functions for 5d supersymmetric SU(2) gauge theories [BS16,BGM17,JNS,BGT], which is a natural '5d uplift' of '4d' isomonodromic/CFT correspondence [GIL]. In [BGM18] the cluster description was further applied to discrete dynamics of relativistic Toda chains of arbitrary lengths, where the solutions of non-autonomous versions are given by SU (N ) partition functions with the |k| ≤ N Chern-Simons terms. Recently, cluster realization of generalized q-Painlevé VI system was also observed in [OS]. Note that for q = 1 case with trivial Casimirs solution of discrete dynamics for arbitrary bipartite graph can be written in terms of θfunctions [F].
Below in this section we discuss the cluster mapping class groups and non-autonomous bilinear equations, arising for generic rectangle Newton polygons. We present their explicit construction in the example, which will illustrate the following results: Structure of the group G Q . For the SA(2, Z)-class of N ×M rectangular Newton polygon, the MCG G Q always contains a subgroup of the form W A (1) N −1 is a co-extended double Weyl group (2.39). The generators of each subgroup are naturally labeled by intervals on sides of a Newton polygon, or subset of 'parallel' zig-zag paths (in the same homology class) on a bipartite graph: where subscripts α, β, γ, δ label the corresponding group of paths, see Fig. 6 middle and right. The group being extended by the additional generator ρ contains lattice of the rank 2N + 2M − 3 of q−difference flows of integrable system. Moreover, in special cases there is an obvious symmetry enhancement: for example, for N = M an additional 'external' generator appears, which rotates the whole picture by π/2. However, sometimes this enhancement is more essential: if any of the sides is of length 2, two rest Weyl groups can be 'glued' together by additional permutation, so the known subgroup of G Q becomes This enhancement is closely related to the fact that spectral curves with the N × 2 rectangular Newton polygon can be mapped to the curves with the triangular Newton polygon with the integer sides 2N × 2 × 2 (see e.g. (3.70) in [GMN]). If both N = M = 2 one finds the extra enhancement from W (A Action on spin chain Casimirs. Inhomogeneities, total spins, on-site Casimirs and twists of spin chain are permuted under the action of different components of G Q . Inhomogeneities are given by single zig-zags µ i = β i , while on-site Casimirs are given by products of zig-zags ζ h i = (α i β i ) 1 2 . So the well defined transformation of them, which 'permutes sites' of spin chain are products of primitive permutations Permutations of twists κ a = (δ a /γ a ) 1 2 and projections of spins ζ v a = (γ a δ a ) 1 2 by products can be viewed as an action of the Weyl group by permutations on the maximal torus of Lie group.

Bilinear equations.
Equations defining the action of each single generator of G Q on A-cluster variables (τ × ij , τ + ij ) could be rewritten in the form of bilinear equations. Evolution of coefficients can be encapsulated into the transformations of frozen variables {u α i , u β i , u γa , u δa }, which are evolving in the same way as Casimirs in X -variables.

Structure of G Q
Now we present generators of G Q in terms of the quiver mutations 13 {µ × ij , µ + ij } (in the vertices, initially assigned with {x × ij , x + ij }) and permutations of the vertices {s ×,+ ij,kl }. Consider for simplicity the (3, 2)example, which already illustrates how the explicit formulas look like in generic case. Here 2(N +M ) = 10 generators (4.2) can be realized as (4.9) which are sequences of mutations in the vertices along zig-zags in the forward and then backward directions. One can check that each generator here is an involution i.e. s 2 = 1. On the X-cluster variables it acts by rational transformation, e.g. for s β 2 ,β 3 = s ×, , (4.10) while all the other variables remain unchanged. Here we have used the notation Notice also that the result of zig-zag mutation sequences actually do not depends on the point of the 'zig-zag strip' one starts with the first mutation and direction of the jumps along/across given zig-zag. Note that the [ ]-function possesses nice 'inversion' property which allows to write equivalently, for example . (4.13) Each set of permutations s z i ,z i+1 with similar z constitute affine Weyl group of A (1) -type. The groups for different z are commuting, so they satisfy usual relations (4.14) There are two more 'external' automorphisms preserving bipartite graph which satisfy obvious relations and promote affine Weyl groups to extended affine Weyl groups. There is also one more generator of infinite order satisfying relations so the cluster mapping class group contains We conjecture that for general rectangular N × M Newton polygon, cluster mapping class group contains subgroup (4.1). Construction of generators for general N and M is straightforward, by 'jumps over zig-zags' as in example.
In the case N = M there is also one additional 'external' generator R π/2 of order 4, which rotates bipartite graph by π/2 R π/2 : In the case N = 2K or M = 2K there is another additional 'external' generator, which flips the rectangle.
One can find embedding of the lattice into the conjectured in [FM14] group of discrete flows G ′ ∆ . The group is defined to be a group of integral valued functions on boundary vertices of Newton polygon modulo sub-lattice A generated by the restrictions from Z 2 to the boundary of Newton polygon of affine functions f (i, j) = ai + bj + c, so G ′ ∆ = Z B /A. For the case of rectangular Newton polygon one can easily find that G ′ ∆ = Z B−3 ⊕ Z/N Z ⊕ Z/M Z. We are not going to stop here at the construction of embedding of generators of the lattice from G Q to G ′ ∆ , interested reader can find it in Section 7.3 of [FM14]. The computation comes from the consideration of the action of G Q on zig-zags presented in the next sub-section, and the result is that the image is G ∆ = Z B−3 ⊕Z/N Z⊕Z/M Z, however the embedding is of the index G ′ ∆ /G ∆ = lcm(N, M ). The non-trivial index is due to the generator (ρ) lcm(N, M ) which coincides with the generator τ from [FM14].

Monomial dynamics of Casimirs
According to [GK] the lattice of Casimir functions x γ is generated by zig-zag paths 14 (4.25) As the skew-symmetric form ε is intersection form on dual surface, this condition is equivalent to being trivial in dual surfaceŜ homologies. In order to be expressed in terms of cluster variables {x × ij , x + ij } Casimir should be also trivial in torus homologies, i.e. we are interested in subset (4.26) As zig-zags and faces are drawn on torus Z, F ⊂ H 1 (Γ, Z), they are constrained by i x z i = 1, where the product goes over all zig-zag paths and i x f i = 1, where the product goes over all faces of bipartite graph on torus. To obtain non-trivial q-dynamic these constraints have to be relaxed to where we have additionally defined q = x ω ,q = xω. Introduction of q = 1 can be considered by lifting of bipartite graph to universal cover of T 2 which is R 2 .
Any variable x γ , γ ∈ C can be expressed via face variables x f i , which are cluster variables, and can be mutated by usual rules (B.2). However, there is no generic rule for mutation of variable associated with a single zig-zag, except for mutation in four-valent vertex identified with a 'spider move' [GK]. We propose here the generic rule for transformation of zig-zags 15 under the action of generators (4.7), namely, for the N × M rectangle: where i = 1, . . . , N , a = 1, . . . , M . The group G Q acts on the elements of C, embedded in multiplicative lattice generated by zig-zags, precisely as Coxeter groups of A K−1 -type act on the root lattices embedded into Z K (c.f. [OS, IIO]). These rules basically come just from consistency with mutation transformations for the elements of C. There is a two-parametric family of transformations for zig-zag variables which do not affect C, since C consists of the combinations of zig-zags with zero class in torus homology. This ambiguity is fixed using the 'locality assumption' that zig-zags not adjacent to the transformed faces are not changed.
Let us now demonstrate, how formulas (4.28) come for (N, M ) = (3, 2) from consistency with transformations of C, where one can introduce the following over-determined set of generators (4.32) so that the number of independent Casimirs is seven. In the autonomous limit, these Casimirs reduce to Z z,z ′ = z · z ′ , where z, z ′ correspond to zig-zags {α, β, γ, δ}, expressed via the edge variables. The transformation, for example, s β 1 ,β 2 acts by (4.33) and substituting here Z z,z ′ = z · z ′ one finds that the action of s β 1 ,β 2 reduces just to permutation of β 1 and β 2 , the same is true for the other generators s z 1 ,z 2 . 15 We abuse notations, denoting xz = z for zig-zags.
For q = 1 consider the generators T β i ,β i+1 (4.23) which act trivially on C at all in the autonomous limit. One gets now Again, after expressing the Casimirs via zig-zags, the action of T β 1 ,β 2 is equivalent to β 1 → q −1 β 1 , β 2 → qβ 2 . These formulas suggest that at q = 1 one can express generators of C via zig-zags and q by 16 which are consistent with constraints (4.32) with q = 1 if one assumed 17 α 1 α 2 α 3 β 1 β 2 β 3 γ 1 γ 2 δ 1 δ 2 = q = 1. Comparison of transformation (4.33) with (4.35) and (4.36) leads to the formulas (4.28) for (N, M ) = (3, 2). The action of remaining generators is defined by (4.39) Remark 4.1. Specialities of N = 2 or M = 2 case. It is well known (see e.g. [GMN], eq.(3.70)) that spectral curves with a Newton polygon being 2 × N rectangle can be mapped to the 'triangle ones' with the catheti 2 and 2N (see Fig. 10) just by change of variables. Namely, equation For a corresponding cluster integrable system the Poisson quiver from Fig. 5 can be transformed into the form drawn in Fig. 11 -more common for 'triangular' polygons, studied in detail in [OS]. This correspondence results in the 'enhancement' of the symmetry group 18 : a pair of commuting Weyl groups A (1) The fractional powers of q in these formulas can be restored using the 'magnetic flux' interpretation for q = 1 in non-autonomous case. This interpretation is also consistent with the fact that zig-zags with the different orientations collect fluxes of different signs.
17 One can incorporateq = 1 consistently modifying formulas (4.30) and (4.31) by However, as a meaning of this extension is not clear, we will assumeq = 1 in the following. 18 We are grateful to Y.Yamada for clarification of this point. Embedding A (1) and commutativity of s α i ,α i+1 and s β i ,β i+1 just follows form the relations on 'elementary' generators The generator ρ is also absorbed. Now it is not a primitive one, but can be presented as a composition so there are no extra 'dimensions' in the lattice of the flows.

Towards bilinear equations
Let us finally turn to the issue of bilinear equations for the cluster tau-functions or A-cluster variables. We postpone rigorous discussion of this issue for a separate publication, but demonstrate here, how Hirota bilinear equations can arise in the systems, corresponding to rectangle Newton polygons. The simplest example of bilinear equations is provided by spider moves, or mutations in a fourvalent vertex of the Poisson quiver, see also Fig. 16 in Appendix for the transformation of corresponding piece of a bipartite graph. Such transformation induce the only change in τ -variables, which (for all unit coefficients) τ 0 →τ 0 = τ 1 τ 3 + τ 2 τ 4 τ 0 or τ 0τ0 = τ 1 τ 3 + τ 2 τ 4 .
(4.53) obviously leads to bilinear equation. However, there is no a priori reason to get bilinear equations from generic action by an element of G Q . For example, a single mutation in a six-valent vertex rather leads to relation, which symbolically has form ττ = τ 3 + τ 3 (4.54) instead of bilinear. Sometimes one can get nevertheless a bilinear relation for a sequence of mutations without no a priori reason for them to hold, see e.g. sect. 2.8 of [BGM18]. We are going to show in this section that the same happens for the transformations, induced by the zig-zag permutations (e.g. {s β i ,β i+1 } or {s γa,γ a+1 }), constructing their explicit action on tau-variables. For A-cluster algebras 19 the role of Casimir functions is played by 'coefficients' [FZ], taking values in some tropical semi-field P, see also discussion in [BGM18]. For the case of rectangle Newton polygons we label the generators of P by zig-zags (together with q), i.e.
(4.55) so that the coefficients are expressed by (4.56) The action of transformations s z i ,z i+1 on coefficients in this basis is equivalent to the action on generators of P like in (4.28) on zig-zags, i.e. (4.57) Coefficients could be encoded by 'frozen' vertices of quiver. This suggests principle that we assign frozen variables to faces of dual surface, corresponding to zig-zag variables, while mutable variablesto faces of original torus. Let us now present an example of the action of the generator s β 1 ,β 2 on τ -variables in (N, M ) = (3, 2) case. An explicit computation gives The main point is that the matrix in the r.h.s. is nicely invertible so that these equations can be rewritten in bilinear 19 For the definition of A-cluster algebra with coefficients and transition from X to A-cluster algebra see Appendix B.3.
(4.59) This is actually a generic phenomenon for the zig-zag generators: the same happens, for example, for the generator s δ 1 ,δ 2 from another component of G Q . One gets explicitly for the transformation of A-cluster variables t 1 = C 1 · C 2 · t 2 , (4.60) where with u α = u α 1 u α 2 u α 3 . Again, inverting matrix C 1 we end up with the set of bilinear equations It remains yet unclear, how to derive bilinear equations systematically for compositions of elements of G Q . We are going to return to this issue together with discussion of their solutions elsewhere.

Conclusion
In this paper we have presented extra evidence that cluster integrable systems provide convenient framework for the description of 5d super-symmetric Yang-Mills theory. It has been shown that cluster integrable systems with the Newton polygons SA(2, Z)-equivalent to the N × M rectangles are isomorphic to the XXZ-like spin chains of rank M on N sites (or vice versa) on the 'lowest orbit'. Due to special symmetry of the Kasteleyn operators, defining spectral curves of these systems, it turns to be possible to express the Lax operators of spin chain in terms of the X-cluster variables. Inhomogeneities and twists of the chain can be expressed via (part of) the zig-zag paths on the Goncharov-Kenyon bipartite graphs. Rectangle Newton polygons generally correspond to linear quiver gauge theories [BPTY] so that inhomogeneities, 'on-site' Casimirs and twists define the fundamental and bi-fundamental masses together with the bare couplings on the Yang-Mills side. The proposed cluster description possesses obvious symmetry between the structure in horizontal and vertical directions so that one gets a natural spectral (or fiber-base or length-rank) duality, interchanging also the rank and length of spin chains. The parameters in dual descriptions are related in the following way: Inhomogeneities (β 1 , ..., β N ) δ −1 1 , ..., δ −1 M (5.1) Shear shift of one side of a Newton polygon to the shape of N × M parallelogram results in the multiplication of the monodromy operator of the spin chain by the cyclic twist matrix.
We have found that the cluster mapping class group G Q for the 'spin-chain class' always contains a subgroup isomorphic to whose generators act on zig-zag paths by permutations. Moreover, their action on the A-cluster variables gives rise to the q−difference bilinear relations. The symmetry enhancement happens in the case N = 2 (or M = 2) and results in 'gluing' of two copies of A (1) Our first results in this direction actually produce more question than give answers. The following obvious questions (at least!) can be addressed for the further investigations: • Trivial rank-N spin chain on a single site once twisted becomes spectrally dual to relativistic Toda chain, see sect. 3.2. Can we similarly identify the spectral duals of the twisted chains of arbitrary lengths and twists, whose Newton polygons are generic parallelograms -or even extend this to generic four-gons? This question is also very interesting on the gauge-theory side, where by now only the hyperelliptic case of 'generalized Toda' (four boundary points and all internal points are lying on one line -pure SU (N ) theory with the CS term) was studied in [BGM18].
• We have derived in sect. 4.3 the bilinear relations, coming out of the action of a single 'permutation' generator of G Q on A-cluster variables, acting by transpositions on zig-zags. Is there any systematic principle to derive bilinear equations for compositions of such transformations?
• In [BS16], [BGM17], [JNS], [BGM18], [BS18] and [MN] the solutions for q-difference bilinear equations and their degenerations, arising from certain cluster integrable systems, were found in terms of Fourier-transformed Nekrasov functions for the corresponding 5d gauge theories. As partition functions for the 5d linear quiver gauge theories are well known, a natural further step is to show that they solve the bilinear equations found here (and their hypothetical generalizations!).
We would like to thank V.Fock, T.Ishibashi, A.Liashyk, A.Shchechkin, I.Vilkoviskiy, Y.Yamada and Y.Zenkevich for the stimulating discussions, and S.Kharchev for providing us with unpublished notes [K]. We are especially grateful to M.Bershtein and P.Gavrylenko for very important discussions during the whole period of work on the project and their useful remarks after reading the manuscript. The results of Section 4 were obtained under support of the RSF under the grant 19-11-00275, the work of AM was also partially supported by RFBR grant 18-01-00460. This research was carried out within the HSE University Basic Research Program and funded (jointly) by the Russian Academic Excellence Project '5-100'.

A From quantum to classical spin chains
We start with brief overview of the generalities of R-matrix formalism for the quantum XXZ-like spin chain, following [K], [OPS], and then turn to the details of their classical limit, presenting explicit formulas for the rank 2 and 3 cases.

A.1 Quantum XXZ spin chain
Quantum gl M spin chain of XXZ type can be defined using quantum monodromy matrix T (u), satisfying so-called RT T -relations: Here T (u) = M i,j=1 E ij ⊗T ij (u) (two-sided formal series in spectral parameter u, as we consider double of RT T algebra) acts in the product of 'auxiliary' space V = C M (E ij ∈ End(V ) -standard matrix units), and 'quantum' Hilbert space of the chain H, T ij (u) ∈ End(H). The trigonometric R-matrix, R ∈ End(V ⊗ V ), is given by: with the sign-factors The integrals of motion of the chain come from the coefficients of expansion of the transfer matrix T (u) = tr V T (u) = k∈Z u k H k . Their commutativity immediately follows from the RT T -relations (A.1): For the higher-rank case M > 2 this does not provide the complete set of commuting Hamiltonians, one has to add higher transfer matrices, or take the coefficients of the so-called quantum spectral curve equation with the quantum determinant is defined by The center of the RT T algebra (A.1) ([T ij (u), C k ] = 0 ∀i, j) is generated by quantum determinant of T -operator: det q T (u) = C k u k . A seminal statement, proven in [DF], claims that the algebra defined by (A.1) is isomorphic to the quantum affine algebra U q ( gl M ). More precisely, there is an isomorphism between the algebra, generated by modes of the currents satisfying the RT T -relations (A.1) and quantum affine algebra U q ( gl M ) with the central extension c. Hence, different integrable systems, constructed from trigonometric RT T -relations can be identified with different representations of U q ( gl M ). Among these are spin chains on N sites, exploiting the co-product property that if T 1 (u) and T 2 (v) both satisfy RT T -relations, and act in different quantum spaces, then so does T = T 1 (u)T 2 (v), where the product is taken over the common auxiliary space. To construct a chain of length N , one has to associate an L-operator in some representation π k of the U q ( gl M ) with each site of the chain, and construct quantum monodromy matrix, taking product in the common auxiliary space where u k ∈ C are so-called inhomogeneities, L (k) (u) = π k (L + )(u) and Q ∈ End(V ) -a 'twist' matrix, having trivial quantum space. Such approach allows to construct many non-trivial integrable systems by assigning to each site a simple representation of U q ( gl M ). Conventional way to do so in case of zero central charge, is to apply first evaluation homomorphism Ev z : Positive and negative currents could be collected to: Homomorphism Ev z is well defined only for positive or negative sub-algebra at once as geometrical progression for L + (u) converges if u/v < 1 and for L − (u) if u/v > 1. But luckily we need only positive part for our purposes. Note also that L + as a matrix is upper triangular, while L − -lower triangular.
If we substitute L ev into RT T relation we can decompose it by degrees of spectral parameters, and get for L ± R + · (L ± ⊗ 1) · (1 ⊗ L ± ) = (1 ⊗ L ± ) · (L ± ⊗ 1) · R + (A.13) where we used that R(u, v) can be represented as where P = i,j E ij ⊗ E ji -permutation matrix. The situation here is similar to the one, which was in the affine context: RT T algebra, now without spectral parameters, generated by matrix elements of L ± satisfying (A.13)-(A.14) is isomorphic to the quantum group U q (gl M ) in the Drinfeld-Jimbo definitions, if we put where e i,j -generators of U q (gl M ), corresponding to the roots, h k -to the Cartan sub-algebra [FRT, DF]. Generators, corresponding to the simple roots e i = e i,i+1 , f i = e i+1,i satisfy relations which are deformation of the usual gl M relations and q-deformed Serre relations e 2 a e a−1 − (q + q −1 )e a e a−1 e a + e a−1 e 2 a = 0, e 2 a−1 e a − (q + q −1 )e a−1 e a e a−1 + e a e 2 a−1 = 0. Algebra U q (gl M ) plays here role of deformation of the usual algebra of spin variables. So considering any representation of U q (gl M ), we construct L-operators satisfying RT T relation, and consequentlyintegrable spin chain of XXZ type.

A.2 Classical XXZ spin chain
Classical limit of the quantum spin chain appears when we replace algebra of quantum operators in the limit → 0 by some commutative Poisson algebra of classical dynamical variables. Poisson bracket is coming from the usual prescription Quantum parameter can be introduced as q = e . Additional parameter κ ∈ C × provides us with the family of non-isomorphic Poisson algebras. Classical r-matrix appears as a first order of the expansion R(u, v, e ) → 1 ⊗ 1 + r(u, v) + O( 2 ), and looks Note that we don't assume any dependence of u and v on . This gives for the RLL relation with the classical L-operator L cl+ (u) = lim →0 L ev (u, q = e ) = (A.28) For classical limit of U q (gl M ), we assume Their Poisson brackets and classical limit of Serre relations are Generators, corresponding to non-simple roots are coming from It is different from the L cl+ (u) only by the change of signs near generators Together, this results in that the only relations which change are The general recipe to turn expressions from one algebra to another is to invert sign at all the simple generators, and at all the brackets. As a product of L-operators in both cases q = e ± satisfies classical RT T equation, we can construct classical monodromy matrix Commuting Hamiltonians of the classical XXZ spin chain are coefficients of the classical spectral curve where the Casimir functions are generated by det T (µ).
Example. Classical limit of U q (gl 2 ) Algebra U q (gl 2 ) has rank 2 and has 4 generators -S 12 = S + , S 21 = S − , S 0 1 , S 0 2 . Poisson brackets in the both cases q = e ± are similar Casimirs are generated by So there are two independent Casimirs -total projection of the spin S 0 = S 0 1 + S 0 2 and 'square' of the spin (or quadratic Casimir) C 2 = cosh(S 0 1 − S 0 2 ) + 2S + S − . If their values are fixed, the resulting symplectic leaf is 2-dimensional. Coordinates S 0 1 − S 0 2 and S + /S − could be chosen on it, for example. Form usual for sl 2 chain appears if we transform Lax operator by u → u e ∓(S 0 Lax operators becomes New variables satisfy almost the same relations Note that only in 2×2 case it is possible to eliminate spectral parameter from the off-diagonal elements of matrix. Example. Classical limit of U q (gl 3 ) Algebra U q (gl 3 ) has rank 3 and 9 generators. In the classical limit, generators corresponding to the simple positive roots are S 12 = S + 1 , S 23 = S + 2 . If q = e , only non-simple positive root S 13 can be defined using relation Substituting this into Serre relations we can get two remaining brackets Finally, for non-simple roots using Jacobi identity In agreement with the general prescription, the relations, which are being changing, if we choose q = e − , are The Lax operator is which gives generating function of the Casimirs:

B Cluster integrable system
Here we remind some basics of the cluster classical integrable systems, which have two equivalent constructions: • A combinatorial way [GK] assigns to a convex Newton polygon a bipartite graph Γ on torus T 2 . The cluster variables {x i } are then just monodromies of C × -valued connection around the faces of Γ. The spectral curve of integrable system is given by dimer's partition function on Γ ⊂ T 2 .
• A group theory construction exploits the Poisson submanifolds or double Bruhat cells, parameterized by cyclically irreducible words in (W × W ) ♯ (the co-extended double affine Weyl group of P GL(N )) [FM14]. The structure of cluster Poisson variety is coming from restriction of standard trigonometric r-matrix bracket [FG05], while the integrals of motion are given by Ad-invariant functions on the Poisson submanifold.
B.1 X -cluster variety X -cluster variety is defined by the set of split toric charts (C × ) d assigned with d× d integer-valued and skew-symmetric exchange matrix ε. Such a pair is called seed or cluster seed. Coordinate functions x i ∈ C × on these charts are Poisson variables with the logarithmically constant Poisson bracket The matrix ε can be encoded by quiver Q -an oriented graph, whose vertices are labeled by cluster variables, and number of arrows from vertex i to j is equal 20 to ε ij . Generally the Poisson bracket (B.1) has Casimir functions Z(x), {Z, x i } = 0 for any x i , the number of independent Casimir functions coincides with the dimension of kernel of ε.
The cluster seeds are glued together by special coordinate birational transformations -mutations , assigned to each vertex of the quiver Q or variable x k : 3) The transformation of exchange matrix can be easily reformulated as transformation of corresponding quiver. Mutations are the Poisson maps, i.e.
Collection of seeds glued by mutations is called X -cluster variety. Denote by G Q the stabilizer of the quiver Q -the group consisting of composition of mutations and permutations of the vertices, which maps quiver Q to itself: such transformations nevertheless generate non-trivial maps of the cluster variables {x i }. This group is called the mapping class group of X -cluster variety.
B.2 From bipartite graph to cluster integrable system X -cluster variety from bipartite graph. For a bipartite graph Γ ֒→ T 2 embedded in torus (without self-intersections) the vertices are divided into black and white subsets B, W ⊂ C 0 (Γ) so that the black vertices are connected only with the white ones and visa versa. We chose orientation of edges from black to white, and assume that graph is connected and all 2-valent vertices are contracted.
The coordinates X = {x γ ∈ C × | γ ∈ H 1 (Γ, Z)} of GK integrable system are multiplicative functions on H 1 (Γ, Z), considered as an Abelian group, i.e. x γ 1 x γ 2 = x γ 1 +γ 2 . Any element γ ∈ H 1 (Γ, Z) can be decomposed as where γ A , γ B form a basis in H 1 (T 2 , Z), while F = {f i } = {∂B i } is the set of faces or boundaries of the disks T 2 \ Γ = ⊔ i B i with the orientation induced from surface, generating H 1 (Γ, Z)/H 1 (T 2 , Z) modulo single relation k f k = 0. Therefore, there is an exact sequence The set of face variables {x f |f ∈ F} are coordinates on the toric chart on X Γ , these are the Xcluster variables, transforming rationally under the cluster mutations or 'spider moves' of bipartite graph. Relation k f k = 0 can be relaxed, this results in deautonomization q = i x f i = 1 of cluster integrable system and leads to non-trivial q-dynamics. Exchange matrix of the cluster seed is given by intersection form on the dual surfaceŜ, obtained from Γ by gluing disks, which become faces ofŜ, to zig-zag paths Z 21 , and forgetting structure of the torus. Embeddingπ : Γ ֒→Ŝ allows to consider any cycle γ ∈ H 1 (Γ, Z) as an element of H 1 (Ŝ, Z), which is equipped with non-degenerate skew-symmetric intersection form · , · : H 1 (Ŝ, Z) × H 1 (Ŝ, Z) → Z, which defines the Poisson bracket on X by Intersection form computed on faces F give exchange matrix of cluster seed ε ij = f i , f j . Effective way of writing this matrix is the following: for each black vertex, draw arrows in the clockwise direction between each pair of consecutive faces, which have this vertex as a corner. Then matrix element ε ij is equal to the alternated number of arrows from f i to f j , see Fig. 14.
Classes of zig zag paths in H 1 (T 2 , Z) are in one to one correspondence with the boundary intervals of Newton polygon ∆, and this correspondence is the simple way to build ∆ by bipartite graph. They are trivial in H 1 (Ŝ, Z) so that the variables x z , corresponding to the zig-zag paths z ∈ H 1 (Γ, Z) are Casimir functions of the bracket (B.7), i.e.
Zig-zag variables x z i always present non-trivial elements from H 1 (T 2 , Z), so single zig-zag itself cannot be expressed via the cluster variables. On the central and right pictures from Fig. 14 zig-zag paths for the Toda chain on two sites are drawn. Casimir Z from the example from previous sub-section in terms of it is given by Z = x α x β .
Spectral curve. Now, we are ready to construct Hamiltonians of integrable system, which is given by dimer partition function on it.
Perfect matching on bipartite graph Γ is such configuration of edges D ⊂ C 1 (Γ) that each vertex has one adjacent edge from D. Such configurations has specific property that ∂D = W − B. Fixing any D 0 ⊂ C 1 (Γ) we can put an element D − D 0 ∈ C 1 (Γ), which is closed, into correspondence to any perfect matching. Any D − D 0 under decomposition (B.5) can be presented as Denoting variables The curve C is spectral curve of integrable system. Collecting terms corresponding to the same degrees of spectral parameters we get Hamiltonians H ij of the Goncharov-Kenyon integrable system with the Newton polygon ∆. Change of the base configuration D 0 just multiplies partition function by monomial (B.12) In [GK] authors proved for the special choose of D 0 that the model is integrable -i.e. that {H ij , H kl } = 0, and the number of independent Hamiltonians is half of the dimension of phase space. Hamiltonians which correspond to the boundary integral points of N are Casimirs of Poisson bracket, and have to be fixed, to get symplectic leaf with non-degenerate Poisson bracket. Boundary intervals of ∂N are in one to one correspondence with zig-zag paths. Vector presenting boundary interval coincides with the class of corresponding zig-zag in H 1 (T 2 , Z). Choice of D 0 proposed in [GK] are so that H ij = 1 for one corner of Newton polygon.
Important detail which remained out of the scope yet is that we have to choose concrete representative in H 1 (Γ, Z) for cycles γ A and γ B . Usually, spectral parameters are expected to commute with all dynamical variables of the system, so γ A and γ B have to be chosen as an integral combinations of zig-zag paths. However, it is not always possible -even for the simplest example of bipartite graph from Fig. 14, zig-zags are (1, 0), (1, 2), (−1, 0), (−1, −2)-cycles, and subgroup generated by them in H 1 (T 2 , Z) has index two. Generally, this order is d = |H 1 (T 2 , Z)/Z|, so by choosing spectral parameters expressed via zig-zags, we get Hamiltonians depending on fractional powers of cluster variables x 1/d i . Convenient choosing of spectral parameters normalization is so that three Hamiltonians in three corners of Newton polygon become equal to unit.
On right panel of Fig. 15 perfect matchings for bipartite graph from Fig. 14 are drawn. Selecting third matching in the first row as a D 0 , and spectral parameters by λ = x γ A , µ = x γ B with γ A = β, γ B = − 1 2 (β + δ), one gets spectral curve Coefficient at λµ is precisely Hamiltonian of closed relativistic Toda chain on two sites. Newton polygon of this curve coincides with the one obtained from zig-zags and drawn on the right panel of Fig. 14  Kasteleyn operator. Dimer partition function can be computed using the Kasteleyn operator. To define it, first, consider discrete linear bundle with connection a on bipartite graph Γ. In trivialization this means that we associate 1-d vector space C with each vertex of Γ, and discrete monodromy a e ∈ C × with each edge e oriented from black to white. For the edge with the opposite orientation set a −e = a −1 e . This definition can be extended to any γ ∈ C 1 (Γ, Z) by a γ 1 +γ 2 = a γ 1 a γ 2 . Dynamical variables x γ used above, could be naturally associated with monodromies taken over cycles, i.e. x γ = a γ if ∂γ = 0. It is problematic to introduce Poisson structure for variables a e , as they are not 'gauge invariant'. We can perform gauge transformation e iφ k at each vertex k, which results in change a e ij → a e ij e i(φ i −φ j ) of edge variables 22 . However monodromies x γ are well defined, so their bracket is given by (B.7).
Second ingredient in this construction is discrete spin structure -multiplicative map K e : C 1 (Γ) → {±1}, which assigns ±1 to each edge e in such a way that for any face B i where l(B i ) -number of edges, adjacent to B i . Finally, the third ingredient is choosing of two oriented cycles h A and h B on T 2 , which cross edges of Γ transversally, and as elements of H 1 (T 2 , Z) they present [h A ] = γ B and [h B ] = γ A (indices A and B are indeed interchanged). We denote by e, h A,B intersection index of edge e with cycle h A,B . It is +1 if edge cross cycle from the left to the right, if you look along cycle. Bringing all ingredients together, Kasteleyn operator D : C |B| → C |W | of graph Γ is a |B| by |W | (which are equal) matrix where we assume that a e ij is zero, if there are no edges between vertices i and j. Note that as an operator acting C |B| → C |W | , it acts from the right on row vectors. It could be shown that det D(λ,μ) = where summation goes over all perfect matchings, sign (−1) s will depend only on the resulting class in homology of perfect matching after normalization. Parametersλ andμ are different from λ and µ used above. They do not indicate belonging of contribution to any particular homology class, as D are not closed. To make it so, we have to subtract some 'reference configuration' D 0 , and choose pair of elements ζ A , ζ B ∈ H 1 (T 2 , Z), presenting A and B cycles on T 2 . Precise relation between determinant of Kasteleyn operator and dimer partition function is = µ −1 bh + λ bf + λ −1 µ −2 hd + µ −1 df + ae + µ −1 ce + µ −1 ag + µ −2 cg Dividing it by a D 0 = λ −1 µ −2 hd and rescaling λ → λ/x β , µ → µ/x − 1 2 (β+δ) with x β = cg hd , x δ = dh ae , one immediately gets spectral curve (B.13).
Spider moves. There is a special class of mutations for the quivers constructed from bipartite graph called spider moves [GK]. If mutation is performed at four-valent vertex corresponding to four-gonal face of bipartite graph, one can change bipartite graph as shown in Fig. 16, left, and redefine weights on the edges in such a way that dimer partition function remains unchanged. Cluster variables expressed by edges are changing as they should under corresponding mutations (see Fig. 16, right, for the change of quiver).

B.3 Cluster algebras
Dual description to X -cluster language is A-cluster language [FZ]. To define A-cluster algebra, starting from the quiver Q, we associate with each vertex i ∈ Q of quiver a pair of variables (τ i , y i ), y-variables are often called the coefficients, and τ -variables usually refereed as cluster variables 23 . The coefficients take values in tropical semi-field P = Trop(u 1 , ..., u r ) = u n 1 1 ...u nr r | n α ∈ Q -a set equipped with the pair of operations: It can be easily seen that with respect to ⊙ element 1 = u 0 1 ... u 0 r is unit, and each element y = u n 1 1 ... u nr r has inverse u −1 = u −n 1 1 ... u −nr r . Both operations are commutative, we also have distributivity a ⊙ (b ⊕ c) = a ⊙ b ⊕ a ⊙ c. It is convenient for our purposes to allow fractional powers of u, so that elements u 1 , ..., u r generate whole P. Field F of rational functions in {τ i } i∈Q with coefficients in P is called ambient field. Cluster seed is a set (Q, {τ i , y i } i∈Q ). Mutation µ k transforms seed into some other seed (Q ′ , {τ ′ i , y ′ i } i∈Q ′ ) with Q ′ related to Q by the rules (B.3), while new cluster variables τ ′ i ∈ F and coefficients y ′ i ∈ P are defined by This can be viewed as an addition of r vertices with the variables τ |Q|+1 = u 1 , ... , τ |Q|+r = u r to the quiver, and connection of each vertex containing τ |Q|+α with the vertices containing τ i , i < |Q| by n α,i arrows. We will denote extended quiver byQ so that |Q| = |Q| + r. Mutation rules for τ variables get unified form while mutation rules for coefficients are no longer needed -they transformations are taken into account by transformations of extended quiver with frozen variables. The map from A-cluster variables to Xcluster variables is given by Under this map the frozen variables (i.e. coefficients) parameterize the Casimir functions of Poisson algebra {Z, · } = 0, which are monomials Z = i x c i i in X-variables, defined by the property that i ε ij c j = 0. If one takes all unit coefficients, the Casimirs In the example of relativistic affine Toda chain with two particles (or on two sites) one gets two Casimir functions Z and q. Extended exchange matrix, chosen following [BGM17], is drawn at Fig. 17. The coefficients can be read from the matrix b (two lowest rows) y 1 = (τ 5 τ 6 ) 2 , y 2 = τ −2 6 , y 3 = (τ 5 τ 6 ) 2 , y 4 = τ −2 In addition to the sign-factors (A.3) we also introduce 24 which satisfies s k ij = −s k ji , s k ij = s i jk , s k ij = s ij + s jk + s ki . (C.5) From definitions (C.1) Computations in 1,2,7,8.a) are straightforward. In 3, 4, 5.a) relation (C.6) has to be used. 9,10.a) can be obtained by application of (C.6) and (C.5): {L ij (λ), L ja (µ)} = − 1 2 λ − 1 2 s ij µ − 1 2 s ja τ a τ i (s a ij (z 2 j + z −2 j )(z 2 a + z −2 a ) + (z 2 j − z −2 j )(z 2 a + z −2 a )) = = − 1 2 λ − 1 2 s ij µ − 1 2 s ja (z 2 a + z −2 a ) τ a τ i ((s a ij + 1)z 2 j + (s a ij − 1)z −2 j )) = = −s a ij λ − 1 2 s ij µ − 1 2 s ja (z 2 a + z −2 a ) τ a τ i z Looking at the table (C.9) we can suggest that the last two columns are equal, if we put f i = A( λ/µ), g ij = B ji ( λ/µ) (C.12) For 1-5 and 9-10 it is obvious. For 6, 7, 8 it is easier to move from the right to the left. For 6, using (C.5): which shows that 6.a) and 6.b) from (C.9) are equal. For 7.b): f i L ij (λ)L ia (µ) − g aj L ia (λ)L ij (µ) = (C.15) = 1 2 ( λ/µ + µ/λ)λ − 1 2 s ij µ − 1 2 s ia − 2λ − 1 2 s aj − 1 2 s ia µ − 1 2 s ja − 1 2 s ij λ/µ − µ/λ τ j τ i τ a τ i (z 2 j + z −2 j )(z 2 a + z −2 a ) = = 1 2 λ/µ + µ/λ − 2(λ/µ) − 1 2 s j ia λ/µ − µ/λ L ij (λ)L ia (µ) = − 1 2 s a ij L ij (λ)L ia (µ) which is equal to 7.a). Similarly for 8 a) and b). To show that (C.7) is equal to (A.26) multiplied by 1 2 , we have to note that and 1 ⊗ 1 is commuting with anything, so can be always added to the r-matrix with the arbitrary coefficient, without any change of the relations.