Spectral duality in elliptic systems, six-dimensional gauge theories and topological strings

We consider Dotsenko-Fateev matrix models associated with compactified Calabi-Yau threefolds. They can be constructed with the help of explicit expressions for refined topological vertex, i.e. are directly related to the corresponding topological string amplitudes. We describe a correspondence between these amplitudes, elliptic and affine type Selberg integrals and gauge theories in five and six dimensions with various matter content. We show that the theories of this type are connected by spectral dualities, which can be also seen at the level of elliptic Seiberg-Witten integrable systems. The most interesting are the spectral duality between the XYZ spin chain and the Ruijsenaars system, which is further lifted to self-duality of the double elliptic system.


Introduction
Gauge theories with eight supercharges in 4d, 5d and 6d can be effectively analyzed from the string theory perspective. This view is natural if one wants to study deformations of these theories and understand their structure in geometric terms. Also this family of gauge theories turns out to be a focus point of several dualities, some of which are still in need of a full explanation.
One of these dualities is the AGT correspondence, relating partition functions of gauge theories to 2d CFT conformal blocks. It was first observed for 4d theories [1], then generalized to 5d [2] and very recently to 6d [3]. The AGT relation was motivated by the study of the worldvolume theory on the stack of M5 branes wrapping a Riemann surface, the bare spectral curve [4]. This geometric point of view naturally incorporated various properties of 4d N = 2 gauge theories: S-duality, Seiberg-Witten curve, BPS states counting and relation with integrable systems. Any geometric meaning of the AGT duality for 5d gauge theories, which features q-deformed 2d CFT, is not so manifest.
Gauge theories in five dimensions can be obtained using a different approach, the geometric engineering technique, which relates them to type IIB strings on the (p, q)-brane web [5,6] or topological strings on toric Calabi-Yau three-folds. This approach allows for direct computation using the refined topological vertex technique [7,8], and explicitly reproduces the Nekrasov partition function of gauge theories.
(p, q)-webs and toric CY backgrounds have a natural symmetry, the spectral [9,10], or fiber-base, duality, which is also the S-duality of IIB strings. This duality connects gauge theories with different gauge groups and matter content, which, however, have the same partition functions and the same set of BPS particles: the instantons and W -bosons get exchanged. The spectral duality has been studied for linear quiver gauge theories [11] and for SU (2) gauge theories with N f ≤ 8 fundamental matter multiplets [12].
It has also been understood that the spectral duality is closely related to the AGT duality. In [13] (see also [14]) the Dotsenko-Fateev (DF) integrals for conformal blocks of the q-deformed CFT [15,16,17] have been rewritten as sums over residues, each corresponding to a fixed point in the instanton moduli space of a 5d gauge theory. However, this gauge theory turned out to be not the theory related to the conformal block by the AGT duality, but rather its spectral dual. Thus, the AGT relation is obtained as action of the spectral duality on the DF integrals of the q-deformed CFT.
In [18], [19], [20] we initiated a program to better understand the relationship between 5d gauge theories, q-deformed conformal blocks and structure of refined topological string amplitudes on toric CY. Here we would like to extend our analysis to the compactified toric CY, which correspond to 6d gauge theories and to the elliptic deformation of the conformal algebra.
In the spirit of [19], we show how to combine the elementary building blocks, amplitudes of the refined topological string in order to obtain the measures of the DF-type integral representations of conformal blocks in various theories. In this way, we obtain the integrals for W N algebras (also known as A N q-Selberg integrals), toric q-deformed conformal blocks (featuring in the "elliptic AGT relations" [3]), conformal blocks corresponding to affine root systems (related to the 6d gauge theories), and the setup corresponding to the 6d theory with adjoint matter.
It is well-known that gauge theories we are considering correspond to the Seiberg-Witten integrable systems [21]- [33], [6]. In the case of compactified brane diagram, these integrable systems are of elliptic type. They include the elliptic Ruijsenaars, the XYZ spin chain and the still mysterious double elliptic integrable system [31]. We propose the spectral duality for these systems and make a few qualitative tests of it.
One motivation for going to 6d is to probe the (2, 0) 6d superconformal theory, which is thought to originate from coincident M5 branes. However, what we actually obtain is the T -dual theory, the (1, 1) 6d gauge theory. This is the dimensional reduction of the 10d minimal supersymmetric gauge theory, which upon further reduction gives the N = 2 theory in 5d and N = 4 theory in 4d. The (1,1) gauge theory can also be thought of as a Kähler gravity theory, which is the target space description of the microscopic "quantum foam" geometry of topological strings [34]. The theory can be put in the 6d Ω-background with three equivariant parameters q 1,2,3 corresponding to three elements of the Cartan subalgebra of SO (6). The "instantons" of the 6d theory, fixed under these isometries are identified with the atoms of the melting crystal model, and the partition function of the gauge theory is identified with the index version of the topological vertex.
We start our discussion by reminding the brane descriptions of gauge theories in 4d, 5d, 6d and their relation to (refined) topological strings. We then provide an exhaustive list of possible topological string amplitudes (including compactified toric diagrams), which are suitable as building blocks for quiver gauge theories in 5d and 6d. We also generalize the dictionary obtained in [19] to these amplitudes and describe the corresponding Dotsenko-Fateev type integrals. Our approach to the DF integrals exploits also the "triality" between 5d gauge theories, 3d theories and q-deformed conformal blocks proposed in [13]. We interpret the sums over Young diagrams as the sums over residues and then investigate structure of the corresponding integral.
In the second part, we focus on one particular amplitude for the compactified CY, which corresponds to the 5d gauge theory with adjoint matter, or, employing the spectral duality, to the 6d linear quiver of U (1) groups. We find here a close counterpart of the triality, which gives the affine version of the q-Selberg integrals. Investigating the pole structure of these integrals we encounter a new interesting phenomenon: the contour of integration does not encircle all the poles of the integrand. The meaning of the missing poles turns out to be quite remarkable: they correspond to instantons of the six-dimensional gauge theory enumerated by the plane partitions (3d Young diagrams). Even more remarkable is the fact that each residue exactly reproduces the equivariant K-theory index of the corresponding fixed point in the instanton moduli space of the N = (1, 1) 6d theory [35,36]. We also point out that the affine Selberg integrals and their generalizations, which we introduce, have a very nice cohomology limit, in which they turn into the 6d counterparts of the LMNS integrals [37]. Taking a further limit reduces the integrals to the standard 4d LMNS ones. Thus, our extended integral provides a simple explanation for the AGT relation between the two very different integral representations of the same quantity: the DF integrals (representing the conformal blocks) and the LMNS integrals (computing the Nekrasov partition function).
In the last part of the paper, we discuss the Seiberg-Witten integrable systems, corresponding to the gauge theories we have considered. We first recall the general idea of the integrable system construction, and then proceed to study action of the spectral duality on integrable systems a la [9]. We generalize the results known for the rational and trigonometric systems to the elliptic ones: the elliptic Ruijsenaars model, the XYZ spin chain, the double elliptic systems and their generalizations. We show that the spectral duality originating from the (p, q)-brane rotation indeed gives a nontrivial identification between different elliptic systems.

Brane pictures
For 4d theories the relevant brane construction is provided by Type IIA theory [38] (see also related subjects in [39]). To obtain a linear U (N ) M −1 gauge theory one considers a set of M "vertical" NS5 branes extending in the (x 0 , x 1 , x 2 , x 3 , x 4 , x 5 ) directions and N "horizontal" D4 branes suspended between them in the directions (x 0 , x 1 , x 2 , x 3 , x 6 ). The (x 5 , x 6 ) projection of this setting is shown in Fig. 1. On the segments of D4 branes suspended between each pair of adjacent NS5 branes lives a gauge theory with U (N ) gauge group, which is spontaneously broken down to U (1) N by the adjoint scalar vacuum averages a (α) i . These averages are represented by the vertical distances between the D4 branes. The (asymptotic) distance between the two NS5 branes represent the complexified coupling constant Λ α = −iτ α = 4π 2π of the gauge group. The neighbouring gauge groups in the linear quiver are coupled through a bifundamental hypermultiplet. Its mass m bif is given by the relative positions of the centers of masses of D4 branes to the left and to the right of the corresponding NS5 brane. There are N semi-infinite D4 branes coming from the left -they correspond to N fundamental matter fields with masses m f,i coupled to the first U (N ) gauge factor of the quiver. These branes can also be understood as arising from an additional gauge theory with vanishing coupling constant. Similarly N branes extending to the right of the diagram correspond to N antifundamental hypermultiplets with masses m f,i coupled to the last gauge factor. One can make the hypermultiplets infinitely massive while simultaneously sending the gauge coupling to zero. This corresponds to the picture, where all the semi-infinite D4 branes are moved infinitely high or low. The D4 branes have tension, which bends the NS5 branes, so they are no longer asymptotically parallel to each other. This simply means that there is no well-defined coupling at high energies, and the theory is asymptotically free. Indeed, bending of NS5 branes can be found by solving for a minimal surface in 3d space spanned by (x 4 , x 5 , x 6 ). Thus, the brane diagram in Fig. 1 is only schematic -NS5 branes should be viewed as curved surfaces pulled by D4 branes. Away from D4 branes one gets x 6 (x 4 , x 5 ) ∼ ln |x 4 + ix 5 | -characteristic behavior of an asymptotically free theory. If there are the same numbers of D4 branes pulling an NS5 brane to the left and to the right, then the tension is balanced and asymptotically one has x 6 (x 4 , x 5 ) ∼ const, so that the resulting gauge theory is conformal in the UV. Figure 1: Type IIA brane diagram corresponding to U (2) 2 linear quiver.
To analyze the non-perturbative effects, such as instantons, in the gauge theory the picture has to be lifted to M-theory. The extra coordinate forms a circle S 1 R11 , which radius is proportional to Type IIA string coupling constant. Then, the NS5 and D4 branes are described by a single M5-brane, wrapping the complex Seiberg-Witten curve Σ, which should be holomorphic due to supersymmetry. The matter content, prepotential, BPS spectrum and global symmetries can be read off from the curve and the corresponding brane diagram. In particular, M2 branes suspended between the sheets of Σ and wrapping special contours on it correspond to BPS particles in the gauge theory. Partition function of the gauge theory can be found by evaluating the periods of the Seiberg-Witten differential λ over the Seiberg-Witten curve Σ.
Let us describe one more system associated with the brane picture: the Seiberg-Witten integrable system. The phase space of this system can be understood as follows. The family of Seiberg-Witten curves is parameterized by the Coulomb moduli of the gauge theory, which correspond to positions of the D4 branes in the Type IIA picture. These are the integrals of motion, or Hamiltonians of the integrable system. Thus, the Seiberg-Witten curve is identified with the spectral curve of the integrable system, which is the generating function of the Hamiltonians. For fixed values of the Hamiltonians, the system moves on a torus. This torus is given by the Jacobian of the Seiberg-Witten curve, so that the whole phase space is a torus fibration over the Coulomb branch of the gauge theory moduli space. The surprising fact is that Seiberg-Witten integrable systems can in fact be described very concretely and coincide with some classic integrable systems: e.g. for 4d U (N ) M −1 linear quiver it is given by the periodic gl M XXX spin chain with N spins [26]. The masses of the hypermultiplets correspond to Casimir operators of the spins and the couplings enter the twist matrix of the chain.
In a similar way one can consider gauge theories with adjoint matter. In this case the x 6 direction (horizontal in Fig. 1) should be compactified on a circle S 1 R6 , so that the D4 branes no longer extend to infinity on the left and right margins of the page, but wrap the S 1 R6 circle with both ends attached to a single NS5 brane. The resulting arrangement is shown in Fig. 2. By compactifying diagrams with more NS5 branes, one gets a "necklace" quiver of gauge groups coupled by bifundamentals. For the resulting gauge theory to be well defined in the UV one has to make all the gaps between NS5 branes expanding asymptotically, or staying constant. The only way to actually obey this constraint is to make the number of D4 branes suspended between each two NS5 branes the same, which gives the U (N ) M quiver. The integrable system corresponding to the 4d U (N ) theory with adjoint matter is N -particle elliptic Calogero model [23], and for necklace quivers it is a certain multipoint generalization of Calogero system [10]. The mass of the adjoint multiplet corresponds to the Calogero coupling constant and the gauge theory coupling constant is encoded in the elliptic parameter of the system. One can also compactify the x 4 direction (which is perpendicular to the plane of Figs. 1,2). To get the gauge theory interpretation of this setup we perform T -duality along the resulting circle S 1 1/R4 . Under Tduality Type IIA theory turns into Type IIB, which has odd instead of even D-branes. Thus, after T -duality, D4 branes, which were suspended between the NS5 branes and spanned (x 0 , x 1 , x 2 , x 3 , x 6 ), being transverse to S 1 1/R4 , become D5-branes, wrapped over S 1 R4 and spanning (x 0 , x 1 , x 2 , x 3 , x 4 , x 6 ). The worldvolume theory on D5 branes is generally a six-dimensional gauge theory. However, in the x 6 direction the brane has a finite span Λ, so the resulting low energy theory is five-dimensional gauge theory on ( R4 . However, as in the NS5-D4 system discussed above, we have to include brane tension in our picture. The difference with the D4 case is that now we have to solve the minimal surface condition in two-dimensional space (x 5 , x 6 ), so the resulting surface is always a straight line (this answer also follows from supersymmetry constraints). D5 branes are represented by horizontal lines and called (0, 1) branes, and NS5 branes are vertical lines, or (1,0) in this setting. When (0, 1) and (1, 0) branes merge one has to balance the tension, so the resulting brane is can be neither vertical, nor horizontal. In fact the tensions of (0, 1) and (1, 0) branes can be made the same by a suitable choice of x 5 and x 6 scales, and we will assume this choice throughout our discussion. The bound state of (0, 1) and (1, 0) branes has unit slope, and is called the (1, 1) brane. All other bound states can be obtained in a similar fashion and the whole web of branes in the (x 5 , x 6 ) plane is called the Type IIB (p, q)-brane web [5]. The example of a brane web is depicted in Fig. 3. Notice that the angles of the branes are related to their charges -which are conserved in any brane merger. The moduli of the gauge theory correspond to the lengths of the edges, which we denote by Q i . More concretely, in the example shown in Fig. 3 Q m,i correspond to the gauge theory masses, Q F,i encode the vacuum moduli and Q B,i are related to the couplings Λ i . Notice that in this picture the vacuum averages, masses and coupling constants all appear on the same footing. Moreover the S-duality of the type IIB theory turns (1, 0) brane into a (0, 1) brane, thus eliminating the asymmetry between the vertical and horizontal directions.
Rotation of the brane web, or S-duality in Type IIB language, which is obviously a symmetry of the theory, corresponds to a nontrivial duality between 5d gauge theories, corresponding to the web. Indeed, for M vertical branes intersecting with N horizontal branes one has the U (N ) M −1 linear quiver, while for a rotated web it should be U (M ) N −1 . The relation between two gauge theories is given by the spectral duality. One can understand this duality as the map on the space of BPS states of the theories, taking the W -bosons of one theory into the instantons of the other and vice versa. The masses of the BPS states are given by M BP S = |Z| ∼ a i n i + Λ i k i + . . ., where n i are U (1) N charges and k i are instanton numbers with respect to U (N ) M . From this expression we see that the spectral duality maps Coulomb moduli of one theory to couplings of the dual theory. This is also evident from the brane web, since vertical and horizontal distances correspond to Coulomb moduli and couplings respectively.
The integrable system corresponding to the 5d U (N ) M −1 linear quiver gauge theory is the periodic U q (gl M ) XXZ spin chain with N spins [26]. As in the XXX case, masses and couplings of the gauge theory are written in terms of Casimir operators and twist matrix of the spin chain. Notice that spectral duality is also a nontrivial duality of the two spin chains: the U q (gl M ) chain with N spins is mapped onto the U q (gl N ) chain with M spins [9]. The spectral curves of the two systems coincide, while the Hamiltonians are expressed through each other and the parameters of the systems.
Again, as in the Type IIA case, considered above, to obtain the non-perturbative description of the 5d gauge theory, one has to lift the (p, q)-web to M-theory. We start from Type IIB theory on R 9 × S 1 R4 , which is equivalent to M-theory on R 9 × T 2 with Vol(T 2 ) = R 4 . A (p, q)-brane of Type IIB is M5 brane wrapping the (p, q)-cycle on T 2 . By a chain of dualities one can transform this brane picture into a purely geometric background without any branes, namely the toric Calabi-Yau threefold [40], so that the whole setup looks like R 4 × CY 3 × S 1 . CY 3 is a T 3 -fibration degenerating over the edges and vertices of the toric diagram T ∈ R 3 , which completely determines the geometry and is identified with the brane web from Type IIB. Finite edges of the diagram represent the two-spheres inside the CY, and, instead of the lengths of brane segments, the relevant parameters are Kähler moduli of these spheres, which we also denote by Q i . Notice that not all the edge lengths are independent: one needs to impose constraints, so that all the cycles on the diagram are indeed closed. In particular, each cycle imposes two constraints, corresponding to horizontal and vertical projections. On Fig. 3 we label only the independent lengths.
Toric or web diagrams can be compactified in the same way as the type IIA brane diagram. Again, the edges of the picture become identified and some of the branes wrap the resulting cycle, as shown on Fig. 4, resulting in a 5d gauge theory with adjoint (or more generally necklace quiver of bifundamental) matter. Moreover, since there is no difference between the horizontal and vertical directions in this picture, one can consider the vertical compactification as well (see Fig. 4). The vertical compactification corresponds to the 6d gauge theory with fundamental matter. The important point here is that since the vertical direction is compact, one cannot send the semi-infinite D5 branes up or down indefinitely, and only U (N ) gauge theories with exactly 2N fundamental multiplets are allowed. Also, there is a constraint that the sum of all the masses is equal to the sum of all the vacuum moduli. In the language of the gauge theory this constraint can be understood as the anomaly cancellation condition for large gauge transformations. Notice that spectral duality still acts on the compactified diagram. However, the dual gauge theories are now of different space-time dimension: one is the 5d U (N ) M necklace quiver theory and the other is the 6d U (M ) N −1 linear quiver. The BPS states of the two theories are identified in the same way, as for the 5d linear quivers discussed above.
In the language of integrable systems spectral duality gives a new nontrivial identification between different elliptic systems. More concretely, 5d U (N ) M necklace quiver theory corresponds to multipoint generalization of elliptic Ruijsenaars system, while 6d U (M ) N −1 linear quiver is described by the XYZ spin chain. The two gauge theories are dual, and thus the integrable systems are also dual, in the same way as the XXZ spin chains in the example discussed above. We conclude that the XYZ spin chain is spectral dual to the multipoint elliptic Ruijsenaars model.
Naturally one can also compactify both horizontal and vertical directions of the toric diagram, and obtain the 6d necklace quiver theory. This theory seems in many ways special. In particular, the corresponding Seiberg-Witten integrable system is of double elliptic type, i.e. the Hamiltonians depend elliptically both on the coordinates and momenta. This system is currently a subject of intense investigation [31]. We only mention here that, since the doubly compactified toric diagram can be rotated to get another doubly compactified diagram, different double elliptic systems should be connected by the spectral duality.

From pictures to formulas
For concrete computations, we use the relation between M-theory on CY 3 × R 4 × S 1 and (refined) topological strings on CY 3 , where the (refined) topological vertex technique can be used. Let us describe the recipe to obtain the partition function from the toric diagram.
To each 3-valent vertex of the toric diagram one assigns a 3-index object C ABC (q, t), where A, B and C are Young diagrams, residing on the three edges adjacent to the vertex, and the two parameters of the vertex, q = e − 2 R5 , t = q β = e 1R5 , are related to Ω-deformation parameters ( 1 , 2 ) of the corresponding 5d gauge theory on R 4 × S 1 R5 . In topological strings q is also the exponentiated string coupling q = e −gs , so that R 5 can also be understood as the radius of the M-theory circle. The ordering of indices in the refined topological vertex C ABC (q, t) depends on the extra labels of the adjacent edges. For toric manifolds, which we consider, each vertex has one edge with preferred direction (marked with double stroke) and two other labelled by t and q, see [8]: To each internal edge of the toric diagram one assigns the (complexified) Kähler parameter Q of the corresponding two-cycle in the CY. If the two vertices are joined by an edge, then the corresponding indices are contracted with the "propagator" G AB (Q, q, t): where n is the framing factor, depending on the relative orientation of the adjacent edges. Notice that the t and q marks should be different on the two sides of the propagator. The total closed string partition function corresponding to a diagram is given by the appropriate contraction of the propagators with the vertices. One can also leave some of the sums over the diagrams unevaluated, to obtain the open string amplitude. In this case, some of the external edges will contain the Young diagram labels, corresponding to the open string boundary conditions on the Lagrangian brane intersecting the corresponding leg of the diagram. Compactification of the toric diagram introduces a new parameter -which can be though as either the coupling constant τ of the theory with adjoint hypermultiplet (similarly to Fig. 2, where it was given by Λ), or as the compactification radius R 6 of the 6d theory. This parameter is encoded in the Kähler parameter of the corresponding edge. For example, in Fig. 4 the (exponentiated) coupling constant is given by Q τ = Q B Q m . Notice that in the CY construction of gauge theories there is essentially no difference between the 5d theory with adjoint matter (e.g. in Fig. 4) or a 6d theory with fundamental matter (as e.g. in Fig. 5) -which is just another manifestation of the spectral duality.
Figure 5: Type IIB (p, q)-brane web corresponding to 6d U (3) gauge theory with 6 fundamental multiplets. The compactification radius is given by We also observe a new curios feature of the compactified diagrams [20]. If we consider the diagram corresponding to U (1) gauge theory with adjoint matter, we get extra poles in the corresponding DF integral. Encircling these poles we arrive at the 6d (1, 1) gauge theory on R 6 q1,q2,q3 with three equivariant parameters. Two of these parameters are the equivariant parameters of the original gauge theory, while the third one is given by the mass of the adjoint multiplet. The partition function of this theory on C 3 = R 6 computes the index topological vertex [36] with external diagrams all empty. One can hope that one more compactification of the brane diagram will give index vertex with nonzero external legs.
The Kähler parameters of the diagram are related to gauge theory parameters as follows 1 : Here a is the Coulomb modulus of the gauge theory m ± 1,2 are the masses of the four fundamental hypermultiplets and Λ is the exponentiated complexified coupling constant. Figure 6: Toric diagram corresponding to the four-point q-deformed conformal block and 5d U (2) gauge theory with four fundamentals.
The DF representation reads On the other hand the block should be given by a sum over a quadruple of partitions -each corresponding to internal edge of the diagram.
The hidden quadruple symmetry is revealed if Yang-Mills theory is lifted to 5 dimensions [28,29] and ordinary Dotsenko-Fateev integrals are substituted [17] by Jackson sums with discretization parameter q = e − 2 R5 . The Vandermonde determinants in the measure are replaced by their (q, t)-deformation: with t = q β . All the quantities in matrix model are analytically continued from integer values of N and β, what is made unambiguously due to Selberg nature of the integrals [44]. This quadruple decomposition is recently presented in some detail in [19] based on the number of previous developments [44,45,46,16,47,17,18], see sec. 2.1.1 below. The group theory symmetry behind the whole picture [21] is encoded in the 2-site U q (gl 2 ) XXZ spin chain integrable system [6,27] (reduced to XXX in 4d, when q = 1 [24]). As evident from Fig. 6, the diagram is very symmetric. Some symmetry is simple consequence of the symmetries in the matter content of the corresponding gauge theory, e.g. reflections along the horizontal and vertical lines correspond to renaming of the fundamental hypermultiplets m ± 1 ↔ m ± 2 and charge conjugation respectively. Also, in the CFT language these symmetries are related to the z → z −1 symmetry and renumbering of the primary fields in the conformal block.
However, reflection along the diagonal (or, equivalently rotation by π 2 ) is not evident neither in the gauge theory, nor in the CFT. In fact, it corresponds to the spectral duality between two U (2) gauge theories, such that Coulomb modulus q 2a is interchanged with the coupling constant Λ 2 . For the conformal blocks it is the duality between two four-point conformal blocks of the q-Virasoro algebra, in which the cross-ratio of positions is interchanged with the momentum of the intermediate field.
Let us describe this peculiar duality in more detail. Conformal block can be decomposed into a sum over intermediate states, and for certain very specific choice of basis -the basis of generalized Macdonald polynomials -labelled by pairs of Young diagrams, the resulting decomposition reproduces the "vertical cut" sum over A and B diagrams in Fig. 6. Moreover, the decomposition is also equal to the Nekrasov partition function and thus we get the following equality between the topological string partition function, conformal block and Nekrasov partition function: Expressing the q-deformed conformal block B 4 in the DF form we get a discrete sum 3 , which also turns out to be just the "horizontal cut" sum over R ± in Fig. 6. Naturally, since the diagram is symmetric, this sum is also a Nekrasov decomposition of a certain gauge theory, though it is different from the one featuring in Eq. (8)it is its spectral dual. We have: (9) In the last line the parameters of the Nekrasov function are dual, in particular the Coulomb moduli and coupling constant are exchanged. Spectral duality acts on the topological vertices trivially only for t = q. In the refined case, t = q, and the vertices transform nontrivially under the rotation of the diagram, since the preferred direction also changes (see (1)). However, in this case one can understand the algebraic meaning of the duality.
Instead of considering rotation of the brane diagram, one can consider the rotation of the preferred direction. Different choices of the preferred direction correspond to different choices of basis in the tensor product of Fock modules corresponding to the legs of the diagram. For preferred direction along the legs the basis |A, B, ∆ is the one appearing in the decomposition (8). For an orthogonal choice of the preferred direction, the basis is factorized |A ⊗ |B . The change of basis from |A, B, ∆ to the factorized basis |A ⊗ |B is performed using the generalized Kostka functions, described in [19]. We will return to this point when we describe the action of spectral duality for the compactified diagram.

DF measures from toric diagram
How do the DF measures for different conformal blocks arise from the toric diagrams? We show how to glue them from the elementary building block where Z ∅ (Q) = Z ∅ ∅ ∅ ∅ Q, q, t and N collects both the factors independent of the external diagrams A, B, R and P and framing factors which cancel when several amplitudes are glued together. When gluing two four-point amplitudes we use the identity (77).
It is possible to contract the amplitudes (10) in many different ways, and in the next several sections we will investigate all these possibilities. First of all, there are planar rectangular webs. They correspond to 5d linear quiver gauge theories with gauge groups U (N ) M . One can compactify the rectangle by identifying the opposite edges. Then, one gets either 6d linear quiver gauge theory or 5d necklace quiver, depending on the orientation of the identified edges. The two descriptions are spectral dual to each other, since they turn into one another by π 2 rotation of the brane diagram. Identifying both vertical and horizontal edges of the rectangle give the 6d necklace quiver gauge theory. These theories are spectral self-dual in a sense that the 6d theory with gauge group U (N ) M is dual to the theory with gauge group U (M ) N . This generalizes the familiar result for 5d theories [11].
The classification of different compactifications/deformations and the respective measures is summarized in the table:

Sphere
Torus algebra Selberg Elliptic Selberg q-deformed algebra q-Selberg Elliptic q-Selberg doubly-deformed algebra Affine Selberg Elliptic affine Selberg In each case there can be either Virasoro or W M -algebra conformal block, corresponding to A 1 or A M −1 Selberg measure. There can also be multiple vertex operator insertions in the integral. The number of these insertions and the rank of the W M algebra are related by the spectral duality.

q-deformed spherical block
The block is given by multiple contour integrals, each corresponding to a primary field insertion. These integrals can be evaluated by residues [13] and the poles are enumerated by Young diagrams, so that the resulting expressions coincide with the combinations of four-point topological string amplitudes. The alternative approach is to write down the sum instead of an integral from the very beginning. This sum is then called the Jackson q−integral and is defined as

Virasoro conformal block
In this case the elementary building block of the DF integral is the q-Selberg average: where the essential part of the measure is the (q, t)-Vandermonde It corresponds to the following combination of four-point amplitudes: where x R,i = q Ri+1 t N −i and N is a normalization constant independent of the diagrams A, B, C, D. To get the correct q-Selberg measure we have to set q t Q m,1 = q −v t −N , q t Q m,2 = t N , and Q F = q u+v+ 1 2 t − 1 2 . Let us understand the structure of the topological string amplitude. The (q, t)-Vandermonde appears in the second line. The product over i and j is in fact finite for the discrete choice of the Kähler parameters we have made, since most terms in the numerator and the denominator cancel with each other. After the dust settles we get the residues of the q-Selberg measure: This exactly reproduces the original q-Selberg measure (12). The last two lines in Eq. (14) contain Schur functions, which are being averaged with the q-Selberg measure. They play the role of the function f (x) in Eq. (12).

W M -algebra conformal block
The next logical step is to consider the W M conformal block. In our formalism only special primary fields with weight proportional to a single fundamental weight are allowed. This reproduces the case of AGT correspondence, where these fields correspond to bifundamental field insertions in the SU (M ) gauge theory partition function. The relevant toric diagram for this block is the vertical strip geometry obtained by gluing together M copies of the four-point amplitude (10)  The Kähler parameters should be identified as follows: We skip the tedious technical details and give the final answer for the A M −1 q-Selberg measure: where essential part of the measure is the A M −1 q-Vandermonde determinant, which is given by where x Ra,i = q Ra,i+1 t Na−i , ∆ (q,t) (x) is given by Eq. (13) and Here M − 2 denominators appear from M four-point amplitudes like (10) and M − 1 numerators arise from the identity (77) used to glue them together. Notice also that the vertex operator contribution (1 − q k x 1,i ) contains only the variables x 1,i from the first integration contour. This is the general effect, seen in the SU (N ) versions of the AGT conjecture -the vertex operators, corresponding to Lagrangian quiver gauge theories are not general W N primary fields, but have dimension vector proportional to a single fundamental weight. We conclude that our gluing procedure correctly reproduces both the gauge theory results and the corresponding W N conformal blocks. One can clearly sees the structure of the root system A N −1 in the measure (19). Other classic root systems Φ can be obtained from orbifolding the toric CY, so that in general the q-Vandermonde is given by where A ab is the Cartan matrix. The ADE case of this measure was derived in [48] and in [49].

q-deformed torus block
We next consider the four point amplitude with horizontal ends identified.

R
where Q τ = Q m Q B and the factor N is independent of the diagrams R, P . It is possible to express some infinite products in the r.h.s. of Eq. (22) in the form of theta-functions (see e.g. [50]), however we will not be concerned with modular properties and thus will not need this representation. Let us describe the action of spectral duality for the compactified toric diagram. It is again the π 2 rotation of the diagram, and for the case of t = q this is an explicit symmetry of the topological string formalism. Using this formalism one can again see that the poles in DF integral representation of the conformal block correspond to AGT-like decomposition of the spectral dual conformal block.
However, for t = q, refined vertex should be used. This vertex (1) is not rotation symmetric, and thus spectral duality requires a nontrivial change of basis of states of the topological string, which we briefly explained in the Introduction. This basis change from generalized Macdonald polynomials to a factorized basis (of Schur functions) is given by the nontrivial generalized Kostka functions. These matrix functions act in the tensor product of several Fock spaces and, therefore, depend on several Young diagrams. The number of diagrams is given by the number of parallel edges in the toric diagram. The case of compactified toric diagram corresponds to effectively infinite number of legs -one can understand the leg on a circle as an infinite array of "mirror images" in the uncompactified space.
Unfortunately, in this case the generalized Macdonald polynomials are in fact not yet known. Let us only notice that, unlike the uncompactified case, here the problem is nontrivial even for a single leg, i.e. a single Fock module, where the basis is labelled by a single Young diagram (though, of course depends on an extra parameter -the compactification radius).

Virasoro conformal block
Gluing two blocks (22) together we get the q-deformed Virasoro DF integral on torus, which is also known as the elliptic version of the A 1 Selberg integral: where Q τ = Q m Q B . The sum over partitions in Eq. (23) can be recast into the contour integral of the elliptic Selberg form: where Here t N = q t Q m and q u = Q F t q . Notice the symmetry between q and Q τ in the measure -this follows from the equivalence between the two compactified circles S R5 and S R6 . This form of elliptic Selberg integral was used in [3] to formulate the elliptic version of the AGT correspondence. Notice that the dimension of the vertex operator V N (1, x) is not an independent variable, but is related to the number of integrations, and thus to the intermediate dimension in the toric conformal block.

W M -algebra conformal block
The same procedure as in sec. 2.2.1 applies to the W -algebra case. We glue several compactified pieces like (22) together to obtain the toric diagram corresponding to the 5d U (M ) gauge theory with adjoint multiplet.
The corresponding A elliptic Selberg measure is given by where ∆ q,t,Qτ (x a ) is given by Eq. (25) and Of course, the measure for any root system Φ can be obtained in a similar way: where A ab is the Cartan matrix of the root system Φ.

Affine spherical block
This case provides the vertex operator corresponding to the 6d gauge theory. It is very much analogous to the W M case considered above, however the root system is now not finite, but affine. The resulting algebra is doubly deformed -by q and by an extra parametert related to the compactified sixth dimension. We start from the simplest example of U (1) gauge theory and then generalize to higher rank groups. We also present an interesting generalization of the affine integrals in sec. 3.

u(1) measure
The simplest example of 6d theory is the U (1) linear quiver. It is built from the elementary block corresponding to the bifundamental field. In the topological string language this corresponds to a four point amplitude with vertical edges joined with each other. The new feature appearing in this setting is that the width of the diagram featuring in the sum is not bounded, so that the number of x i variables in the corresponding integral becomes infinite: wheret = q t Q m . Notice the symmetry between t andt, which is made explicit in the last expression. This should be compared to the analogous symmetry between q and Q τ in the toric measure (25). Of course, the two cases are related by the spectral duality, which partly explains the similarity. However, the exact relation between the two measures is nontrivial, since the sum over R in Fig. 8 is over a different edge, than in Eq. (23). We will look more closely at the measure (30) in sec. 3.

A M measure
The story is similar for several four-point amplitudes glued in a cyclic fashion in the vertical direction. The corresponding Vandermonde factor is where differences between N a are encoded by the Kähler parameters of the diagram: t Na+1−Na = q t Q m,a , a = 1, . . . , M − 1, and t N1−N Mt = q t Q m,M . Notice that the product corresponding to the additional affine root is distinguished, and contains an extra parametert. Of course, one can rescale the variables x Ra so that the extra parameter appears in any other product. The other curious fact about the affine case is that the number of contours (and, thus, the number of Young diagrams in the sum over poles) in the A M measure is M , and not M − 1 as in the A M case. This special point is closely related to the fact that the bosonization of the elliptic Virasoro algebra necessarily involves free fields of two sorts, whereas only one free field is needed in the rational and q-deformed cases.

Affine torus block
We proceed to describe the most advanced generalization, i.e. the double compactification of the diagram. It corresponds to the torus conformal block for the W -algebra of the affine algebra (also denoted by W ( g)).
This measure is symmetric with respect to the exchange of q and Q τ , however the symmetry between t andt is lost.

Torus A M measure
We now have M four-point amplitudes with edges totally contracted. The measure is a straightforward generalization of the u 1 measure: where ∆ (q,t,Qτ ) (x) = lim t q t q Figure 11: Three four-point amplitude with both vertical and horizontal ends identified to obtain the A 2 elliptic q-Selberg measure. Notice that Q m,i are now all the same, because of the constraints imposed by the closed hexagons formed by the identified edges. and

6d theory, affine Selberg integral and index vertex
In this section we investigate in more detail the affine Selberg integrals first described in sec. 2.3 and point out an interesting natural generalization of them. We start with the simplest example and evaluate the partition function of the trivial 6d theory with "zero" gauge group and only one free multiplet using refined topological string. The corresponding toric diagram is compactified along the preferred direction, as shown on Fig. 12. Figure 12: Compactified resolved conifold corresponding to free hypermultiplet in 6d or (in the spectral dual frame) to 5d U (1) theory with adjoint hypermultiplet.
It is straightforward to obtain the (spectral dual) partition function, which is given by the Nekrasov formula, i.e. the sum over Young diagrams: Using the standard identities we can rewrite this sum over diagrams as a contour integral of q-Selberg type: wheret = q t Q m , q u = t q Q F and N is the normalization constant. The poles are enumerated by Young diagrams R and are located at points The integral (37) differs from the ordinary q-Selberg integral from sec. 2.1.1 in several respects: 1. The measure is of affine Selberg type, more precisely of type u 1 . This is in close analogy with the A n Selberg measure (see sec. 2.1.2), though the factor corresponding to the imaginary root contains extrat.
2. The integration measure in Eq. (37) is explicitly symmetric between t andt. This symmetry is completely unexpected from the point of view of the topological strings:t in this framework represents the Kähler parameter of the resolved conifold while t is the refinement parameter. Neither is this symmetry obvious from the corresponding 5d gauge theory: heret is the mass of the adjoint multiplet and t is one of the equivariant parameters.
3. The curious feature of the integral (37) is the appearance of the special contour γ, which encircles only pole of the form x i = z 1 q k t l with k, l ≥ 0 and excludes the poles x i = z 1 q k t ltm with nonzero m. This choice of contour explicitly breaks the symmetry between t andt in the measure, so that the whole partition function is no longer symmetric. This can also be seen from the explicit infinite product formula for the partition function (36), which has no symmetry between q t Q m and t. 4. The adjoint Nekrasov factors (36) are non-vanishing for Young diagrams of arbitrary width. Thus, the number of integrations in (37) is also infinite.

We insert an additional vertex operator
at z 1 to produce the poles of the necessary form (38). We then take the limit Q → 1 so that the extra factors cancel. One can naively think that the integral vanishes in this limit, since the poles in the denominator cancel with the zeroes of the numerator. However, we are in fact interested in the ratio of the residues at the points (38). More concretely, one sets N = Res x∅,i µ(x), where µ(x) is the integrand, so that the sum over residues starts from the identity and is finite for Q → 1. The value of the integral in this limit of course does not depend on the position z 1 of the vertex operator. We, therefore, view the additional factors in (37) as a regularization.
In the next section we modify the integral (37) to include all the poles and find that this is exactly the equivariant instanton partition function of the 6d (1, 1) gauge theory on R 6 .

Extending the contour
Let us consider the following integral [20] Z U (1) where we assume |q| < 1, |t| > 1, |t| > 1 and N = Res Enumerating the poles. Consider first the terms with k = 0 in the integrand of Eq. (39). Then for finite N the situation is completely analogous to the LMNS integrals for U (1) gauge theory [43] (we will elaborate on this analogy in sec. 3.4). One can see that one of the variables x i should pick up a pole coming from the vertex operator. The whole integrand is symmetric in x i , so we can think that this is the first variable, i.e.
x 1 = z 1 . Suppose then, that we have already performed the first l < N integrals and have picked the poles, at x i = z 1 t 1−nt1−m , where (n, m) ∈ Y ⊂ Y . Then the next integration produces the following poles: There are also zeroes: Some poles are canceled by zeroes, and only small portion of them survives. In particular, if a point lies inside of Y and not on the boundary of Y , then there are exactly 4 poles and 4 zeroes which cancel them. So, there is no pole to pick strictly inside Y . On the boundary the situation is a bit more subtle, and there are corner contributions, recursion relations, etc. -for details see [51]. However, when the dust settles one gets the simple recipe, i.e. that each successive integration adds a box so that the whole set of poles remains a Young diagram. All the poles thus organize themselves into a Young diagram Y with N boxes: The terms with k > 0 have a simple effect -each pole x i,j is now shifted by q k with respect to the poles at x i+1,j or x i,j+1 . Thus, the poles are now labelled by a plane partition (3d Young diagram) π with floor area N , so that For infinite N a slightly different picture is more convenient. Let us demolish the "stylobate" of π -i.e. reduce the height of each column by one. The resulting plane partition has floor area less or equal to N and will be denoted byπ, so thatπ i,j = π i,j − 1.
Computing the residues. Let us now compute the residues at the poles. More concretely, since the normalization constant is the contribution of the pole corresponding to the empty diagram, we are actually computing the ratio of the residues (the same trick was used in [13]): We find that the residues have the following plethystic form: where p n (x) are power sum symmetric functions. We can take the limit N → ∞ in each term, and the power sums become where the chπ(q 1 , q 2 , . Finally, the value of the residues is given by where Eπ(q 1 , q 2 , . In s. 3 we have found an unexpected symmetry between t andt in the integration measure. However, the choice of the special contour γ did not respect this symmetry. Choosing the contour |x| = |z 1 |+ we not only restore the symmetry t ↔t, but also get a free bonus. The partition function (46) is actually completely symmetric in t −1 ,t −1 and q. This is part of our motivation for extending the integration contour. Topological string theory does not give a clue about the origin of this extra symmetry. In the next section we will argue that it can be understood from the six-dimensional point of view. More concretely, we will show that Eq. (46) exactly reproduces the sum over fixed points in the instanton moduli space of the 6d N = (1, 1) U (1) gauge theory.
3.2 6d N = (1, 1) U (1) theory and the index vertex The N = (1, 1) gauge theory has the maximal possible supersymmetry in six dimensions. It can be straightforwardly obtained from dimensional reduction of 10d N = 1 gauge theory. In flat Euclidean space the supersymmetry can be equivariantly twisted using the maximal torus of isometries of R 6 , i.e. U (1) 3 . The equivariant partition function, therefore, depends on three equivariant parameters q 1,2,3 = e 1,2,3 . The equivariant integrals over the Q-closed field configurations localize on the fixed points, which are labelled by plane partitions, so that the instanton partition function is given by the sum over fixed points each taken with its equivariant index 4 [34], [52] where Λ is the coupling constant. The index of each fixed point is given by the product of U (1) 3 weights: It is convenient to write the weights in the plethystic form: where the character of the tangent space to the fixed point is given by These characters have been found in [35] and are given by One immediately sees that this sum over fixed points is exactly the same as the sum over poles in Eq. (46) provided one makes the following identifications: At this point several remarks are in order.
1. Partition function, similar to (47) was used in [34] to find the partition function of topological strings on the C 3 patch of a toric CY manifold. The main difference from (47) was that the plane partitions were allowed to have infinite "legs" along the three coordinate axes, so that the resulting vertex depended on the three Young diagrams in the asymptotics.
2. Using the map (52) one can understand the remarkable symmetry between t,t and q in the enlarged integral as the symmetry between three equivariant parameters in R 6 , and eventually relate it to the action of the Weyl group of SO(6).

Generalizing to U (N )/quiver of U (1) groups
Generalization to linear quiver of U (1) groups in 6d or equivalently to 5d U (N ) gauge theory is straightforward. We consider a stack of N compactified resolved conifolds as shown on Fig. 13.
t q t q t q Figure 13: Stack of compactified resolved conifolds corresponding to 5d U (3) theory with adjoint hypermultiplet.
The partition function is just 5d U (N ) Nekrasov function with adjoint multiplet. It has an integral representation quite similar to (37), the only difference is that there are N vertex operator insertions at points z 1 ,. . . , z N : The poles of the integral are now enumerated not by one partition, but by an N -tuple of partitions R = (R 1 , . . . , R N ), so that x R =z a q Ra,i t 1−i , wherez a = z a t Na−1 .
Just as in the U (1) case, the contour γ can be extended to encircle the additional poles, so that the whole partition function is the sum over N -tuples of plane partitions, π = (π 1 , . . . , π N ), and x π =z a q πa,i,j t 1−it1−j . Moreover, the sum over residues exactly reproduces the localization formula for the 6d N = (1, 1) U (N ) theory. For the (scaled) sum over residues we have: Whereas the localization in the gauge theory looks similar to (47): except the index now depends on N -tuple of plane partitions and N Coulomb moduli of the theory: where W ( a, q) = N p=1 a p , E( a, q) = N p=1 (i,j,k)∈πa Notice, that for N = 1 the dependence of the index on a p drops out, as it should (there are no Coulomb moduli in the abelian theory). Partition functions (54) and (55) manifestly coincide if we make the following identification of the gauge theory and topological string parameters: Notice that the extended integral in the U (N ) case is still symmetric in q, t −1 andt −1 .

AGT: LMNS integral from the extended DF integral
The LMNS integrals and DF integrals describe respectively the instanton partition functions and conformal blocks. Their equivalence is known as AGT duality and it is usually seen as a non-trivial integral transform of the Habbard-Stratonovich type [45]. In [20], we suggested that it can actually be raised to an explicit symmetry. Namely, our extended "six-dimensional" integral is a certain generalization of both integrals, which can be turned into either the q-deformed version of the DF integral or the 5d LMNS integral in suitable limits. These two limits are given byt → 0 and q → 0 respectively, and the resulting expressions are related by transformations t −1 ↔t −1 ↔ q. This is an exact and explicit symmetry of the integral. This limiting procedure straightforwardly generalizes to U (N ) theory. Since the initial extended integral is still symmetric in the three equivariant parameters, DF and LMNS representations are exactly equivalent.
One can go further and study the 4d limit of the gauge theory. In this case q-deformed DF integral turns into the ordinary DF or beta-ensemble integral, and 5d LMNS integral reduces to the ordinary LMNS one. However, at this level the symmetry is no longer explicit and looks almost like a miracle, if one does not know that the integrals came from an explicitly symmetric 6d expression.

Generalities
According to [21], the hierarchy of physical theories associated with brane configurations in string and lowenergy Yang-Mills models actually begins with much simpler integrable systems, and Seiberg-Witten theory is exactly the one, which captures the information available at this level of description. Moreover, the Nekrasov deformation of Seiberg-Witten theory corresponds to a quantization of these systems [32], or, more precisely, a lifting from quasiclassical to full-fledged τ -function theory, what, within the integrable theory context, is a general straightforward procedure, which does not require any additional information.
This circle of ideas was further developed and exploited in numerous works. It is now well known that, within this context, the 5d gauge theory with adjoint hypermultiplet corresponds to the elliptic Ruijsenaars system [29], the 6d linear quiver theory gives the XYZ spin chain [27] and the 6d gauge theory with adjoint matter is described by the double elliptic integrable system [31]. In other words, for generic toric diagrams, which we consider in this paper, we have the following All these systems should be related by various dualities, of which the most non-trivial are spectral dualities, interchanging vertical and horizontal directions in toric diagrams. They make XYZ spin chain equivalent to the Ruijsenaars system and different double elliptic systems are also equivalent. In the integrable system context, this equivalence was first realized by K.Hasegawa [53] (in fact, in some part by E.Sklyanin [54]). We describe it briefly in this section, postponing the details until a separate paper [10]. Let us start simply by counting the parameters of the spectral dual gauge theories. SU (N ) theory with fundamental matter in 6d has the following parameters: Coulomb moduli a i , i = 1, . . . , N − 1, masses of the fundamental hypermultiplets m ± i , i = 1, . . . , N , the coupling constant Λ and the two radii of the compactified dimensions R 5 and R 6 . There is also one feature unique to 6d theories: the masses cannot all be set independently, but there is one condition on them. This makes the total number of parameters 3N + 1. SU (2) N necklace quiver theory in 5d has the following parameters parameters: Coulomb moduli a i , i = 1, . . . , N , masses of the bifundamentals m i , i = 1, . . . , N , coupling constants Λ i = 1, . . . , N , and the radius of the fifth dimension R 5 . In total one gets 3N + 1 parameters.
This counting can also be seen on the toric diagram. We consider the example of SU (2) 4 : The amplitude depends on 5 × 4 = 20 Kähler parameters written explicitly on the diagram and also on the radius R 5 of the M-theory circle. Each hexagon on the diagram enforces a pair of constraints on the Kähler parameters of its edges: where we set Q F,i+4 = Q F,i , etc. In total we get 5 × 4 − 2 × 4 = 3 × 4 = 12 independent Kähler parameters and R 5 , which agrees with the gauge theory counting, which also gives 3N + 1 = 3 × 4 + 1 = 13.

XYZ chain
SU (N ) gauge theory with 2N fundamental hypermultiplets 5 in 6d corresponds [27] to the Sklyanin N -site U q,t (gl 2 ) XYZ spin chain [54]. The transfer matrix of the spin chain is written in terms of Lax matrices, residing on each site of the chain with the corresponding inhomogeneity ξ i : where σ a are the Pauli matrices, and where θ a (x) is the standard Jacobi θ-function and e i are values of the Weierstrass function ℘(ξ) at the halfperiods. The dynamical variables S 0 , S a form the (classical) Sklyanin algebra [54]: with the obvious notation: abc is the triple 123 or its cyclic permutations. For this U q,t (gl 2 ) chain there are two Casimir operators, i.e. one degree of freedom remaining per site, which means that there are totally N action variables, which correspond to N Coulomb moduli a i . However, one can consider vanishing the full momentum of the system (which corresponds to removing the U (1)-factor in the gauge theory), in this way, we are left with N − 1 Coulomb moduli. The Casimirs and inhomogeneities are combined into 2N parameters of the fundamental hypermultiplet masses [27, (4.14)-(4.15)]. In fact, there is a restriction imposed on the sum of all masses [27], thus, there are 2N − 1 parameters. This matches the counting of degrees of freedom above.
The 5d and 4d reductions of this theory is described by the XXZ and XXX chain respectively.

Elliptic spin Ruijsenaars system
The SU (N ) gauge theory with the adjoint hypermultiplet in 5d corresponds [29] to the elliptic Ruijsenaars system [55] given by the Lax operator where c(ξ| ) is a normalization factor which has to be chosen in a convenient way. In order to extend this theory to the product of gauge groups, one first has to consider the spin elliptic Ruijsenaars system [56]. Then, the corresponding Lax operator is just with more dynamical variables: spins S ij . The next step is to extend it further to multi-point system. The Lax operator in this case becomes much more involved and so does the Poisson bracket of the spin variables S a ij [10]. For the sake of simplicity, we write down here only the 4d case, when the system is multi-point Calogero system, and the formulas are much more compact, while the 5d formulas can be found in [10]. In the 4d case, the gauge theory has the gauge group U (1) × SU (N ) k and contains k matter bifundamentals [38]. On the integrable side, the multi-point spin Calogero system is described by the Lax operator given on a torus with k marked points w a , [57]: where the spin variables satisfy the Poisson bracket {S a ij , S b kl } = δ ab S a il δ jk − S a jk δ il and there is an additional constraint a S a ii = 0 The Poisson bracket is non-degenerate upon reducing the spin matrices to the orbits of gl N . Thus, the system is characterized by the three integers: the number of particles N , the number of marked points k and the parameter of the orbit l.

Spectral duality
The spectral duality, which we mentioned in ss.1.1 and 4.1, connects the Seiberg-Witten theories in 6d and 5d gauge theories. At the level of integrable systems, it was established by K.Hasegawa [53] (see also a trigonometric version of the correspondence in [58]) and claims an equivalence of the elliptic multi-point spin Ruijsenaars system given by (N, k, l) and the elliptic spin chain on k sites, given by the l-orbit of the Sklyanin-Odesskii-Feigin gl N [59]. In the particular case of l = 1 (the orbit of minimal dimension), one obtains the duality between SU (N ) k theory with fundamental matter in 6d and SU (k + 1) N necklace quiver theory in 5d. Since this is a subject of its own value, we discuss implications of this Hasegawa correspondence between integrable systems in some more detail in a separate paper [10].
This duality can be lifted to the 6d theories with adjoint matter, which are described by the double elliptic integrable systems [31]. These systems have not been studied in full yet, because of a very involved structure (see [60] for some new advances). As usual, they appear from explicit expressions for partition function in section 3 in quasiclassical limit 1 ∼ 2 −→ 0, while in Nekrasov-Shatashvili limit [32] (when only 2 −→ ∞) we get their straightforward quantization, when the spectral curve is substituted by a Baxter equation (quantum spectral curve). Analysis of these limits could help to describe the full integrable double elliptic system.

Conclusion
In this paper, we attempted to describe the Seiberg-Witten/Nekrasov theory for the most general model associated with an arbitrary (p, q)-web toric diagram (the tropical limit of the spectral curve). In the gauge theory language, this corresponds to 6d theory, in the integrable system language to the double elliptic system. We explained that the recent advances in the theories of Dotsenko-Fateev integrals and topological integrals provide a straightforward dictionary for conversion between the pictorial language of toric diagrams (spectral curves) and the Young-diagram expansions for the Nekrasov functions, and this dictionary gets remarkably simple at this most general level. Numerous string dualities have non-trivial realizations in all the languages, and they turn into precise equivalences between the Nekrasov functions, reflecting precise equivalences between the integrable systems. The most interesting of the latter are spectral dualities between the integrable systems of spin chain (XYZ) and Calogero-Ruijsenaars types.
An enormous amount of work is still necessary to polish this description. Most important is to find an adequate extension of the matrix model formalism, which would make the dualities transparent. In its usual form, from [15] to [61,49], it treats differently the horizontal and vertical directions in toric diagrams. At the same time, it is the only approach which straightforwardly provides the entire set of Ward identities (Virasoro/W Nconstraints, loop equations) for the Nekrasov expansions and the AGT related conformal blocks. Desired is an efficient formalism, where explicit are both the perturbative Ward identities and non-perturbative dualities. We hope that this paper clearly demonstrates that such a description is fully consistent, but an adequate formalism still needs to be found.