(q, t)-KZ equations for quantum toroidal algebra and Nekrasov partition functions on ALE spaces

We describe the general strategy for lifting the Wess-Zumino-Witten model from the level of one-loop Kac-Moody $U_q(\widehat{\mathfrak{g}})_k$ to generic quantum toroidal algebras. A nearly exhaustive presentation is given for the two series $U_{q,t}(\widehat{\widehat{\mathfrak{gl}}}_1)$ and $U_{q,t}(\widehat{\widehat{\mathfrak{gl}}}_n)$, when screenings do not exist and thus all the correlators are purely algebraic, i.e. do not include additional hypergeometric type integrations/summations. Generalizing the construction of the intertwiner (refined topological vertex) of the Ding-Iohara-Miki (DIM) algebra, we obtain the intertwining operators of the Fock representations of the quantum toroidal algebra of type $A_n$. The correlation functions of these operators satisfy the $(q,t)$-Knizhnik-Zamolodchikov (KZ) equation, which features the ${\cal R}$-matrix. Matching with the Nekrasov function for the instanton counting on the ALE space is worked out explicitly. We also present an important application of the DIM formalism to the study of $6d$ gauge theories described by the double elliptic integrable systems. We show that the modular and periodicity properties of the gauge theories are neatly explained by the network matrix models providing solutions to the elliptic $(q,t)$-KZ equations.

Liouville and Toda theories, are various reductions. This model and its reductions are straightforwardly handled by various versions of the free-field methods [39]- [44]. Nowadays problem is the lifting of this model to the level of adequately extended toroidal algebras (which corresponds to lifting from 4d to 6d on the Yang-Mills side of the AGT relations) and development of an efficient generalization of the free-field formalism to describe the resulting "network matrix models" [45]- [51]. This paper is a continuation of our study of this problem in [52,53,54,55] 3 . Mathematically the problem is that of the full-fledged representation theory of the Ding-Iohara-Miki algebra [67,68] and its various generalizations [69]- [81], which we also refer to as DIM. In this paper, we focus on a small corner of this very broad area and describe two generalizations and one application of the (q, t)-KZ equations introduced in [55].
The plan of the paper is the following: in sec.2, we propose a generalization of the (q, t)-KZ for U q,t ( gl 1 ) with arbitrary central charge. In sec.3, we describe the quantum toroidal algebra and its vertical and horizontal (Fock) representations that we deal with in the paper. In sec.4, we construct the operators that intertwine these representations. In sec.5, we derive the (level one) Knizhnik-Zamolodchikov equation for the correlation functions of these intertwining operators, Eqs.(5.49)-(5.50). In sec.6, we use solutions to the elliptic KZ equations to obtain modular properties of the 6d U (N ) gauge theories with adjoint hypermultiplet of mass m compactified on torus T 2 derived in [82] basing on the description in terms of double elliptic integrable systems. Concluding remarks in sec.7 are followed by Appendices A-E that contain various technical details.
With the help of all the technical exercises, we would like to demonstrate a simple idea: that the DIM intertwiner formalism is not just an interesting toy but an important tool, which can find its use in gauge theories, as well as in other related fields.
In the remaining part of the introduction, we first describe these three objectives (sec. 1.1) and then give some general description of the methods by which we are going to achieve them (sec. 1.2).

Abelian (q, t)-KZ for general central charge
The (q, t)-KZ equation was introduced in [55] 4 . Its first generalization relaxes the condition on the central charge of the "horizontal" representation, i.e. we no longer require this space to be the Fock space, but instead assume that it has a general central charge (k, N ). The vertical representations are still assumed to be Fock spaces with central charge (0, 1). In this case, the modification of the KZ equation is not hard to guess and the solution to the equations can also be explicitly obtained. The solution is algebraic, i.e. no integrals of screening charges appear in the answer 5 .

Non-Abelian (q, t)-KZ equation for unit central charge and its algebraic solutions
The second generalization of the (q, t)-KZ equation is the much sought non-Abelian version, that for the algebra U q,t ( gl n ). In order to derive the (q, t)-KZ equation, we first construct the intertwiners for the horizontal and vertical Fock representations with unit central charges, i.e. (1, N ) and (0, 1). The intertwining relations for the intertwiners are determined by the coproduct structure of the quantum toroidal algebra U q,t ( gl n ). The same strategy as in the gl 1 case [77] can be used, and the λ-component of intertwiner Φ λ (v) can be expressed as the normal ordered product of the currents E i (z) over the boxes of the Young diagram λ, where the argument z is shifted according to the position of the boxes. One of the important differences with the gl 1 case is the appearance of the zero mode factor in the free field realization of the horizontal Fock representation. The zero modes are group algebra valued and their commutation relation is crucial for obtaining the correct intertwining relations. Another new aspect of U q,t ( gl n ) is the "color selection" rules. Some combinatorial arguments for such rules are required, especially when we establish the relation to the Nekrasov partition function for gauge theories on the ALE space ALE n of type A n , which is a resolution of the orbifold C 2 /Z n .
Once we obtain the intertwiners, we can introduce the T -operator and the R-matrix in a similar way to [53,54] and write down the (q, t)-KZ equations [55], where the R-matrix is featured as the connection matrix for q-shift of the argument of the intertwiner. The R-matrix can be identified with q-difference of the operator product expansion (OPE) factor of the intertwiners and is essentially diagonal. Since the OPE factor of the intertwiners agrees with the Nekrasov factor (the bi-fundamental contribution to the partition function), we have a fundamental relationship between the R-matrix and the Nekrasov partition function. Basing on this relation, we can find explicit solutions to our (q, t)-KZ equations, which turn out to be the Nekrasov functions for 5d gauge theories on ALE n × S 1 . Since we consider only the setup with unit central charges, all the solutions to the KZ equations are still algebraic.
Moreover, for the unrefined case with unit central charges, we actually demonstrate that the intertwiners of U q,q ( gl n ) essentially factorize into products of noninteracting U q n ,q n ( gl 1 ) intertwiners. The most complicated and interesting case of representations with general central charges in non-Abelian DIM algebra is left for the future.

Modular and periodic properties of 6d gauge theories.
To demonstrate the effectiveness of DIM formalism, we are going to describe an important application of network matrix models to 6d gauge theories with adjoint matter compactified on the torus T 2 . These theories are, in a certain sense, the highest step in the hierarchy of gauge theories with eight supercharges, for which the Seiberg-Witten and Nekrasov solutions are available. Within the Seiberg-Witten paradigm, they are described by the double elliptic integrable systems with both coordinates and momenta entering the Hamiltonians through elliptic functions [100,101,102]. Despite the recent important progress [103,104,105], these systems are still quite mysterious and require more explicit description. In particular, the behavior of the 6d gauge theories and double elliptic systems under the S-duality and the modular transformations of the compactification torus is quite peculiar. It turns out that the modular transformation rule mixes the complex structure of the compactification torus with the complexified coupling in a very specific way [82]. We will explain this behavior using the network matrix model of the Abelian DIM algebra U q,t ( gl 1 ) corresponding to the gauge theories in question. Adding the adjoint matter in the gauge theory corresponds to the compactification of the network diagram in the horizontal direction, and an extra sixth dimension also implies the compactification of the vertical direction. Thus, we get the "doubly compactified" network, which geometrically corresponds to a CY three-fold with an elliptic fibration. In the algebraic language, the double compactification corresponds to taking the trace of the product of the intertwiners over both the vertical and the horizontal representations. The network of intertwiners is modeled after the Seiberg-Witten Type IIB (p, q)-brane diagram associated with the gauge theory. The brane diagram for the case of U (2) gauge theory is shown in Fig. 1, and the network of intertwiners, in Fig. 2. The picture of DIM intertwiners corresponding to the double elliptic system is given by the intersection of one horizontal and N vertical lines. Notice that the picture of intertwiners is rotated by π 2 with respect to the Seiberg-Witten (p, q)-brane diagram ( Fig. 1) usually given in the literature. Of course, this does not change the answer since NS5 and D5 branes of Type IIB string theory are S-dual. The ends of the lines should be identified with each other so that the picture is essentially drawn on a two-dimensional torus.
The "fugacities" Q, Q ⊥ can be also understood as the twisting parameters of the fibration giving the background for the M-theory, which hints at possible duality between them and equivariant parameters q and t of the Ω-background. Notice that we set the preferred direction (determining the coproduct structure and thus the intertwiners) to be vertical. However, the final answer for the character/partition function is independent of the preferred direction. In these conventions, the trace over the horizontal representation can be taken straightforwardly giving a combination of theta-functions. Moreover, from our previous investigations we recall that precisely this trace appeared as a solution to elliptic (q, t)-KZ equations. Since the result is expressed through the theta-functions, we can use it to effectively study the modular properties of the partition function. Of course, this strategy works only for modular transformation on the compactification a m Λ Λ Figure 1: Compactified (p, q)-brane web corresponding to the 6d U (2) gauge theory with adjoint hypermultiplet compactified on T 2 . The wavy (double wavy) lines are understood to be identified with each other. The parameters of the gauge theory are encoded in the distances between the branes: a is the Coulomb modulus, m is the mass of the adjoint field, Λ is the exponentiated complexified coupling, and Λ is the exponentiated complex structure modulus of the compactification torus T 2 .
(1, 0) (1, 1) (1, 2) (1, 1) Figure 2: Compactified network of intertwiners corresponding to the same 6d U (2) gauge theory with adjoint hypermultiplet, as in Fig. 1. The grading operators Q d Q d ⊥ ⊥ and P d P d ⊥ ⊥ count the states of the Fock representations in the same way as the Boltzman factor e −βH counts the states in a quantum mechanical partition function.
torus, but not for the S-duality. The S-duality transformation corresponds to the modular transformation of the vertical compactified direction, where the trace is a lot harder to compute. However, we can use the slicing invariance of the partition function and safely change the preferred direction to the horizontal one. This would allow us to analyze the S-duality transformation as easily as the modular transformation.
Using the intertwiner picture, we can also analyze periodicity properties of the partition function. As an example consider moving the incoming vertical lines around the circle (i.e. under the trace). The lines necessarily have to pass through the grading operators Q d Q d ⊥ ⊥ . The action of grading operators gives a shift in the positions of the incoming vertical lines with respect to the outgoing vertical lines. Investigating this move in detail, we find that it is actually accompanied by a certain change in the complexified coupling of the gauge theory. k2) is a quantum toroidal algebra (hence, two hats) with two central elements fixed to levels k 1 and k 2 , and two deformation parameters q and t; we usually consider g = gl n . The physical model, associated with it in just the same way as the WZW model is associated with the Kac-Moody algebra U ( G) k is introduced in [48,49,50,51,52] and named network model. We refer the reader to these papers for terminology and basic logic. 6 The basic ingredients of construction of the KZ equation for the network models generalizing [85] and used in [55] are:

Tactics of computations
• "Horizontal" representations which is given in terms of operators acting in the infinite dimensional vector space F (k1,M ) (u) • "Vertical" representations given by combinatorial formulas in some basis in another infinite dimensional space F (0,k2) (u) • Intertwiners. The intertwiners Ψ λ , Ψ * λ carry the index λ (e.g. a set of N Young diagrams or a plain partition) which labels the element of the vertical representation space: They depend on the choice of the "vertical" coproduct ∆ vert . In the horizontal direction, they can be easily multiplied: Ψ(z 1 )Ψ(z 2 ) and Ψ(z 2 )Ψ(z 1 ) are just the compositions of operators.

(q, t)-KZ equations
In this paper, we concentrate on the case when only algebraic solutions are present. In this setup, we can supplement the items from the list above with some more concrete properties. Namely, the short list of ingredients for the derivation of the (q, t)-KZ equation for the non-Abelian DIM algebra is: 1. Shift identity. We need to build up the shift operator, whose action on the intertwiner can be rewritten as the product of two T -operators: This requirement by itself can be trivially satisfied, since we can simply write where Ψ ± denote the creation and annihilation parts of the intertwiner. However, we also need T ± to satisfy nontrivial RT T identities.

2.
Commutation of the T -operators. We need the commutation property as follows To get these identities, we need first to find the non-Abelian R-matrix.
3. Diagonal R-matrix. One way to obtain the R-matrix is to commute a pair of intertwiners: The commutation can be done using the free boson formalism.

4.
Vacuum property of T -operators. After we get the shift and commutation identities, we can act with the shift operator on a string of intertwiners and get an insertion of a pair of the T -operators. We can then move them to the ends of the string using the commutation identities. The last step in the derivation of the equation is to ensure that the T -operators annihilate the vacuum: Concretely for the non-Abelian DIM algebra, the intertwiner is built as a normal ordered product of elements E i (z) taken at certain discrete points specified by the Young diagram on the vertical leg. We can derive the shift identity for each operator E i (z) in the product separately and then account for the normal ordering constants. We have The T -operators for the intertwiners are normal ordered products of the basic T -operators (1.9), (1.10) over the boxes of the Young diagram. It is important that the T -operators in the non-Abelian case are still diagonal in the vertical Young diagram, so that no extra sums over diagrams appear.
2 (q, t)-KZ equation for U q,t ( gl 1 ) with general central charge The q-KZ equation for the conventional quantum affine algebra [85] contains an extra parameter, which is missing in the DIM case we have considered so far. This parameter is the central charge of the "horizontal" (highest weight) representation running in the conformal block. It enters the shift operator and also the shifts of the R-matrices. The conformal blocks of DIM are combinations of intertwiners acting in horizontal and vertical Fock spaces. These representations have definite central charges of the form either (0, 1) or (1, N ). The shift operator determined by the first central charge of the horizontal representation is therefore fixed and reads q In this section, we will try to extend the central charge parameter to arbitrary values and find the corresponding solutions to the Abelian (q, t)-KZ. Unfortunately, the intertwiners for general representations are not known, so the solution cannot be found as easily as that for the Fock spaces. However, the structure of the KZ equation is very rigid and seems to give the only way of introducing the central charge parameter into it. We will try to follow this route and investigate the resulting solutions for the conformal blocks.
Let us consider the combination of intertwiners similar to the Fock space case, but with an arbitrary representation living on the horizontal line. The shift operator thus becomes p z k ∂z k with an arbitrary parameter p. The vertical representations remain to be (0, 1) Fock spaces. This implies that the R-matrices featuring in the KZ equation are still the same (e.g. they are diagonal), and the new parameter p can enter only as a shift of their arguments.
Having these two arguments, we can conjecture the (q, t)-KZ equation with the parameter p encoding the central charges of the horizontal representation in the simplest case of two vertical incoming lines: 3 Quantum toroidal algebra U q,d ( gl n ) and Fock representation For the future convenience, we introduce here the basic definitions and notation for the quantum toroidal algebras.
The quantum toroidal algebra U q,d ( gl n ) has two deformation parameters 7 q, d, which are associated with the Cartan matrix A of type A (1) n−1 , a ij = 2δ i,j − (δ i−1,j + δ i+1,j ) and a skew-symmetric matrix M with m ij = δ i−1,j − δ i+1,j , where δ is the Kronecker delta modulo n. In this paper, we consider the generic case of (n > 2). Explicitly the matrices A and M are given by It seems difficult to introduce an analogue of the skew-symmetric matrix M for other affine Lie algebras g, and it is not known if the toroidal algebra for general affine algebra allows a two parameter deformation. As we will see below, if the second deformation parameter is trivial (d = 1), the structure function g ij (z, w) coincides with that for the quantum affinization of U q (g) for a Lie algebra with a symmetrizable Cartan matrix 8 . Thus U q,d=1 ( gl n ) can be regarded as the quantum affinization of the affine algebra gl n . We introduce the structure function [78,79], where we have defined with q 1 q 2 q 3 = 1. We also use The generators of U q,d ( gl n ) are where i ∈ Z/nZ (index set of simple roots or vertices of the cyclic quiver), k ∈ Z, r ∈ Z \ {0} and c is a central element. It is convenient to employ the generating currents; which satisfy [79]; with appropriate Serre relations 9 . The delta function in (3.12) is defined by δ(z) = n∈Z z n and satisfies δ(z) = δ(z −1 ). Note that there is the following change of the scaling of the Heisenberg part H i,r between [78] and [79]; . The coproduct is defined by 10 where C 1 = q c ⊗ 1 and C 2 = 1 ⊗ q c . As is well known, there are two equivalent constructions of the (untwisted) affine Lie algebra g corresponding to a simple finite dimensional Lie algebra g. One is based on the Chevalley generators with the Serre relations determined by the Cartan matrix A. In this approach, the affine Lie algebra is obtained by replacing the Cartan matrix of finite type (det A > 0) with the corresponding one of affine type (det A = 0). The other way, which is more familiar among physicists, employs the loop algebra (the current algebra) g ⊗ C[z, z −1 ] of the finite dimensional Lie algebra g. The one-dimensional central extension of the loop algebra with the additional grading operator gives the affine Lie algebra g. Analogously there are two methods to obtain the quantum enveloping algebra (or the quantum affine algebra) U q ( g). That is, Drinfeld and Jimbo originally defined U q ( g) in terms of the Chevalley generators with the q deformed Serre relations [108,109,110]. Later Drinfeld observed [111] that the same algebra is obtained by introducing the generating functions of the generators (the Drinfeld currents). This is called Drinfeld realization, or the quantum affinization U q ( g) of U q (g). Note that, in this realization of the quantum affine algebra, we use the Cartan matrix of finite type. In a sense, the quantum toroidal algebra U q ( g) is obtained by combining the above two ways of "affinization". Namely, if we use the Cartan matrix of affine type in the Drinfeld realization, we obtain the relations from (3.8) to (3.14). In fact, if we compare these relations with those of the Drinfeld's realization of the quantum affine algebra U q ( g) for a Lie algebra g with symmetrizable (generalized) Cartan matrix (see for example [107] section 1.2), we see the difference is only a change of g ij (z, w) by the second deformation parameter d (and a redefinition of the Cartan part (3.15)).
It is convenient to introduce the following rational function In this paper, we do not use the Serre relations. 10 Remember the redefinition (3.15), which implies ∆( to rewrite the commutation relations (3.10) and (3.11) in the form of OPE relations of E j (w), F j (w) with K ± i (z) or K ± i (qz). We see the relation ψ(q 2 z) −1 = ψ(z −1 ). (3.22) In fact, as we shall see below, the matrix elements of the vertical representation in the basis labelled by partitions are described by the function ψ(z). We can check that imply the exchange relation (3.10). Similarly, the OPE relations of the same form with K + i (z) being replaced by K − i (qz) or E i (z) imply (3.10) and (3.13). We can also see that (3.11) and (3.14) follow from similar relations for F j (w) with K + i (qz), K − i (z) and F i (z), where ψ is replaced by ψ −1 with the same argument. The quantum toroidal algebra U q,d ( gl n ) has two central elements, q c and κ := i K i . We will call a representation of U q,d ( gl n ) that of level (k, ), when (q c , κ) = (q k , q − ). In analogy with the case of gl 1 , we will call the level (0, 1) representation vertical and the level (1, N ) representation horizontal. It is known that U q,d ( gl n ) has two subalgebras which are isomorphic to the quantum affine algebra U q ( sl n ). The horizontal subalgebra U hor q ( sl n ) is generated by "zero modes" E i,0 , F i,0 and K ± i (i ∈ Z/nZ) and their relations take the original form by Drinfeld-Jimbo. On the other hand, the vertical subalgebra U ver q ( sl n ) is most conveniently described by restricting the Drinfeld currents to the "finite algebra" part E i (z), F i (z), K ± i (z), q ±c/2 with i = 0. As in the case of DIM algebra, there is an algebra automorphism that exchanges the horizontal and vertical algebra. It also exchanges two central elements and hence the level (k, ) representation is mapped to the level (− , k) representation. In the case of DIM, there exists the Heisenberg subalgebra labeled by rational number k/ and related by SL(2, Z) transformation. It is interesting to see that the Z 2 symmetry of vertical and horizontal subalgebra of U q,d ( gl n ) can be enhanced to SL(2, Z).
When c = 0 (corresponding to the vertical representation), the factor in (3.9) becomes trivial, and K ± i (z) are completely commuting. Hence, there exist simultaneous eigenstates of H i,±r in this case. In the geometric construction of representation of the quantum toroidal algebra, we can obtain the vertical representation, the fixed points of torus action give simultaneous eigenstates of H i,±r . Hence, in refs [112]- [116] the defining relations with c = 0 have been provided from the very beginning.

Vertical representation and color selection rule
In the vertical representation or level (0, 1) representation, the Heisenberg part is completely commuting and they are diagonalizable by simultaneous eigenstates. This representation is what we will obtain by the geometric construction based on the (Nakajima) quiver variety [106,107], [112]- [116]. The relevant geometry is the instanton moduli space of the ALE space of A n type, which is a resolution of the orbifold C 2 /Z n+1 . Originally Nakajima constructed a representation of the affine Kac-Moody algebra from the (equivariant) cohomology of the moduli space. A representation of the quantum affinization is expected to be obtained, if we replace the cohomology with the corresponding K theory. When we consider the instantons on the ALE space of A n type, the affine algebra is A (1) n−1 , and we have a representation of the quantum toroidal algebra by the K theory of the quiver variety (the instanton moduli space).
In the vertical representation, we can label simultaneous eigenstates of K ± i (z) by a partition (Young diagram) λ. We take a basis {|λ)} of the Fock space 11 , which simultaneously diagonalizes K ± (z). Since the eigenvalues are non-degenerate, the freedom is only in the normalization of each eigenvector |λ). In the following computation, we assume that {|λ)} is an orthonormal basis. Then |λ) is canonically identified with 11 We reserve the standard bra-ket notation for states in the horizontal representation to be introduced in the next subsection. the dual basis (λ| with (λ|µ) = δ λµ . The vertical representation with the spectral parameter v is introduced in [78]. For a partition λ = (λ 1 ≥ λ 2 ≥ · · · ), let λ ± 1 j = (λ 1 ≥ · · · ≥ λ j ± 1 ≥ · · · ). We assign the color i − j + k modulo n to the box (i, j) ∈ λ, so that the empty partition and the box on the diagonal have the color k. With the notation x s := q λs−1 1 q s−1 3 = q 2 q λs 1 q s 3 , the non-vanishing matrix elements of the vertical representation can be written as follows; where k is the charge (coloring) of the empty partition, and ψ(z) is defined by (3.21). The parameter v is called spectral parameter of the vertical representation. The factor δ i,j−λj +k−1 stands for the color selection rule stating that the color of the box that is added to or removed from the Young diagram is i. Note that the matrix elements of K − i (z) are related by (3.22). The matrix elements of the generators E i,k and F i,k are easily identified by expanding δ(q 1 x j v/z). We note that, except for the range of the product over 1 ≤ s ≤ j − 1 or j + 1 ≤ s < ∞, E i (z) and F i (z) have the common factors in their matrix elements. In fact, these factors emerge as a consequence of substituting v/z = (q 1 x j ) −1 imposed by the delta-function to the corresponding factors in (3.27). The difference of the ranges for E i (z) and F i (z) is due to the semi-infinite product construction of the Fock module in [78]. There are the restrictions on the product in the right hand side: The meaning of these restrictions becomes clear, if one recalls that we have assigned the color i − j + k modulo n to the box (i, j) ∈ λ. Then the first condition of (3.29) means that the last box (s, λ s ) in the s-th row has the color i. Note that the box (s, λ s ) may be removed from the diagram if λ s = λ s+1 . Similarly, the second condition means the box (s, λ s + 1), which may be added to the diagram if λ s−1 = λ s , has the color i. For a Young diagram λ, let us define the set of addable (or concave) and removable (or convex) corner of λ. The addable corner A(λ) is the set of boxes (x, y) / ∈ λ such that we can add (x, y) to λ without violating the Young diagram condition. Similarly, the removable corner R(λ) is the set of boxes (x, y) ∈ λ such that we can remove (x, y) from λ without violating the Young diagram condition. That is, if we follow the boundary of λ from x → ∞ to y → ∞ the direction changes from up to right (from right to up) at addable (removable) corner. Since the direction is up for x → ∞ and right for y → ∞, we see for any Young diagram λ When the vacuum charge is k, we introduce the set of addable and removable corners of color by With these notations, we can rewrite (3.27) as follows 12 ; In particular, we have Hence, from (3.30) the value of the center is κ = K = q −1 , and we see that the vertical representation has, in fact, level (0, 1).

Vertex operators and horizontal representation
The Heisenberg subalgebra part of U q,d ( gl n ) is and define Note that the commutation relation (3.35) is invariant under the redefinition (3.15). To introduce a vertex operator representation with c = 1, we will employ the following vertex operators: The fundamental OPE by normal ordering is Let us introduce notations for the oscillator part of the vertical operator representation: The inverse of the vertex operator V (i) ± (z) −1 is defined by flipping the sign of the exponential and satisfies, for example, V Then the vertex operator (horizontal) representation with level (1, N ) is given by 13 The vertex operator representation was originally given in [117,118], where the level was (1, 0). Here we generalize it to level (1, N ). We have also introduced the spectral parameter u for the horizontal representation. Note that the modification by the level N and the spectral parameter u appears, only when the color i of the currents is the same as the vacuum 14 . The zero mode parts e ±αi , z ±∂α i and H i,0 satisfy e αi e αj = (−1) aij e αj e αi , (3.48) and the same relation for q replacing z. Note that (3.48) defines a Z 2 twist of the group algebra of the root is fixed by the commutation relations. An additional factor of q is introduced for later convenience.
Let us check the commutation relation (3.12). First of all, when i ≡ j, we have Using the formula and the property δ(xy −1 )f (x) = δ(xy −1 )f (y), we obtain (3.54) When i ≡ j ± 1, by taking the commutation relations of zero modes (3.48) and (3.50) into account, we can check Before concluding the section, we give another example that shows the role of the commutation of the zero modes. From the OPE relation (3.39), we see and By combining with the commutation relation of the zero modes: q ±∂α k e α = q ±a k e α q ±∂α k , see (3.49), we recover the relation (3.23) between K + (z), K − (qz) and E k (w).

Construction of the intertwining operator
Let be the Fock spaces for the vertical and horizontal representations with spectral parameters v and u. We assume that the color of the vacuum (the highest weight state) in the vertical representation is 0 for simplicity of expressions. Note that the color of the vacuum can be made k by the shift of the color indices: Following [77], we define the intertwiners of the quantum toroidal algebra U q,d ( gl n ) as follows: Later we will see that the intertwiners Φ(N, u|v) and Φ * (N + 1, w|v) exist only when the spectral parameters satisfy a conservation law w = −uv. Note that, in our notation, the level and the spectral parameter of the horizontal representation refer to the source Fock space. In the following, we often suppress them for simplicity. They are indicated explicitly, whenever it is helpful. In terms of the basis |λ) of the vertical representation F where {|λ)} is the basis of F (0,1) v introduced in section 3.1. The component Φ λ is a map between horizontal representations, and our task is to express it in terms of the vertex operators. Since C 1 = 1 and C 2 = q for the vertical and the horizontal representations, the definition of the coproduct implies the following intertwining relations for Φ λ : At the left hand side, the currents E i (z), F i (z), K + i (z) and K − i (qz) are taken in the level (1, N + 1) representation, while, at the right hand side, the representations are at level (1, N ). The argument v is the spectral parameter of the vertical representation so that (λ, v) represents the data of the state on the vertical side. We have used that 1 = λ |λ)(λ| in order to derive the intertwining relations assuming (λ|µ) = δ λ,µ . If we employ a different normalization, the intertwining relation will involve the normalization factor.
The component of the dual intertwiner is defined by 15 Since C 1 = q, C 2 = 1 for Φ * λ , we find the following intertwining relations:

Structure of the intertwining operator
It turns out that the components of the intertwiner have the same structure as in the DIM case [77]. Namely, with the normalization factor C λ (q 1 , q 3 ) which is related to the normalization of the basis |λ) of the vertical representation, we have where the vacuum component is (formally) given by an infinite product: c(i, j) ≡ i − j is the content of the box (i, j) modulo n, which defines the coloring of boxes. Since the zero modes are non-commutative, we have to fix the ordering of E i (z) in (4.13). This is the reason why we used the notation ← , which means we take the product in the "reversed" order, namely ← 1≤i≤n a i = a n a n−1 · · · a 1 .
In the case of (4.13), it is more complicated, since we have double indices. We first order Ec (i,j) in each row with respect to the second index j, then we order the blocks of each row from the first (rightmost) to the last (leftmost). See (4.22) below more about the ordering of the product in (4.13). We impose C ∅ (q 1 , q 3 ) = t ∅ (q 1 , q 3 ) = 1 as the normalization condition. Then, later we will see the intertwining relation fixes the normalization factor as We define the arm-length, the leg-length and the hook length of = (i, j) ∈ λ by and where λ is the transpose of the Young diagram. Note that if we do not have the restriction that the hook length h λ ( ) is a multiple of n, the normalization factor appears in the norm of the Macdonald function P λ (x). As we will show in section 4.3, the intertwining relation with E (z) gives the following recursion relation for the prefactor t λ of Φ λ (v): With the initial condition t ∅ = 1, we obtain In formula (4.13), we employ the vertex operator Ec (i,j) (q j−1 in the representation with level (1, N + 1) and the spectral parameter −uv. Recall that the component of the intertwiner Φ λ (v) can be regarded as a map between two Fock spaces F . We will see that the relation w = −uv is required for the existence of the intertwiner. The level and the spectral parameter of the horizontal representation affect only the zero mode part of E i (z) (see (3.45)) and it turns out that it is natural to use the vertex operators referring to the target Fock space.
For the convenience of forthcoming computations, let us separate the zero mode part of the intertwiner as follows 16 and |λ| 0 denotes the number of boxes with color 0 in λ. The monomial factort λ (u, v; q 1 , q 3 ) now depends on the horizontal spectral parameter u and takes values in the group algebra of the root lattice. The group The factor in (4.21) is the generalized framing factor arising from the commutation of zero modes. If we do not impose the restrictionc(i, j) ≡ 0, f λ (q, t −1 ) is nothing but the framing factor of the refined topological vertex [119,120]. The dependence of the intertwiner Φ λ (v) on the level (1, N ) can be arranged simply in the powers of f λ (q 1 , q 3 ) and −v. As we emphasized before, since e i,j (v) are non-commutative, we have to fix the ordering of e i,j (v) in the product. Our choice of the ordering in (4.22) is for convenience of computing of the intertwining relation with E (z), F (z). For example, it means that z (3,2) = e 2,2 e 2,1 e 1,3 e 1,2 e 1,1 . The spectral parameter u of the horizontal Fock space counts the number of boxes with the same color as the vacuum and only appears in the second factor of (4.21). From now on, we write only the v-dependence explicitly. The condition on the vacuum component imposes the relation w = −uv among the spectral parameters of the horizontal and the vertical Fock spaces. Similarly, the dual intertwiner is given by replacing The normalization of the dual intertwiners is ). (4.27) As in the case of Φ λ (v), the vertex operator . That is, it has the level (1, N ) and the horizontal spectral parameter u (see (3.46)). Let us decompose the monomial factor as before, 29) and the same generalized framing factor (4.23). Then we have the recursion relation By solving the recursion relation with the initial condition t * ∅ = 1, we obtain

Vacuum component of the intertwiner
Let us first check that the vacuum component Φ ∅ (u) satisfies the following intertwining relations: The color selection rule tells us that ((1)|E (z)|∅) = 0 and (∅|K ± (z)|∅) = 1, unless the color is the same as that of the vacuum state |∅), which we chose 0. Hence, if = 0, all the currents E (z), F (z) and K ± (z) commute with the vacuum component Φ ∅ (v). This is consistent with the fact that the dependence on the level (1, N ) and the spectral parameter of the horizontal representation appear only in E 0 (z), F 0 (z) and K ± 0 (z).
Since C ∅ = t ∅ = 1, the non-trivial commutation relation comes only from the vertex operator part. A crucial point for the check of the intertwining relations is the following fact. Let The rule of ordering is the same as in the case of z λ .
Then the shift of the power of q 1 combined with (3.56) implies that non-trivial OPE factors with ϕ + (q − 1 2 z) and ϕ − (q 1 2 z) cancel: Because of this "triplet" cancellation, for each row a non-trivial OPE factor of ϕ + (q − 1 2 z) with Φ ∅ (v) arises only when the first box (i, 1) has color − 1 or . When i ≡ , we have 18 Hence, if we take the product over rows, these factors cancel in general. But a non-trivial factor q · ψ(q 2 v z ) −1 survives when 1 ≡ + 1. Recall that, according to our choice of the color of the vacuum, the box (1, 1) has color 0. From our definition of level (1, N ) representation, when the color of K + (z) is the same as the vacuum, there is a change of the power of q, since the level of the horizontal representation changes from (1, N ) to (1, N + 1). Taking this factor of q into account, we can confirm (4.34). We can also check (4.35).
By the same reasoning, we see that E (z) and F (z) commute with the vacuum component Φ ∅ (v), unless = 0. When = 0, we have On the other hand, the substitution of (4.39) to gives This means that (4.32) holds with It may be useful to mention that the intertwining relation for Φ ∅ (v) can be also reproduced by introducing the dual vertex operator with the commutation relation More explicitly, Λ i,r is a linear combination of H j,r (4.46) and b ij (q, d) are the components of the inverse of the deformed Cartan matrix (3.36); The fundamental OPE relation is where k is the color of the vacuum. We can check the intertwining relation for the vacuum component with general δ ,k . Similarly, the vacuum component of the dual intertwiners can be expressed as

Zero mode part and intertwining relations
We can use the same idea to compute the OPE relation of Φ λ (v) with K + (z) and K − (qz). When we compute the OPE relation of (i,j)∈λ , using (3.23) for the (1, N + 1) −uv representation, for each row (fixed index i) a non-trivial OPE factor arises from the first box (i, 1) and the last box (i, λ i ) when they satisfy the color selection rule. The factor from the first box (i, 1) exactly cancels the contribution from Φ ∅ (v) discussed above. Thus the remaining factor comes from the last box (i, λ i ) with the color selection rule that (i, λ i ) has the color or + 1. From (3.23), we obtain and, hence, and where we also used relation (4.34). This implies Similar computation is valid for K − (qz), since (3.23) also holds for K − (qz). Let us move to the intertwining relation with E (z). Since (3.23) still holds even after replacing K + (z) by E (z), we have where we also used relation (4.32). Note that the first term at right hand side of (4.32) vanishes due to the coefficient ψ(q 2 v/z)δ(v/z). To obtain the delta functions in the intertwining relation, we make use of the following formal series identity for a rational function γ(z) regular at z = 0, ∞ and with simple poles at most (Lemma 3.3 of [70]); where γ ± (z) denote the Taylor expansions of γ(z) in z ∓1 at z = ∞ and z = 0. The sum at the right hand side runs over all poles z (t) of γ(z) with γ (t) = Res z=z (t) γ(z) dz z being the residues. One can prove the identity by the partial fraction decomposition of rational functions. The formula (4.58) implies (4.60) , we have to compute the normal ordered product and take contributions of zero modes and spectral parameters into account. We need the following OPE relation for |z| > |w|: The "triplet" cancellation also holds in this case. Thus, a non-trivial OPE of Φ λ (v)η (z) appears when the selection rule i − λ i ≡ or i − λ i ≡ + 1 is satisfied in each row. The contribution of the i-th row is Hence, the product over the rows gives Note that the delta-function δ(q 1 x j v/z) appears when j − λ j ≡ + 1, that is, when we may add a box with color in the j-th row. Then we move e j,λj +1 to get 19 (v) by using Lemma 4 in Appendix B, a necessary technical result is worked out in Appendix B. Taking the level dependence of the zero modes part into account, we finally obtain Now we employ the following combinatorial identity for the normalization factor C λ See a related computation in the DIM case, Lemma 6.4 in [77]. In Appendix A, we prove (4.67) which also appeared in section 7.2.1 of [115]. Taking this into account, we arrive at (v). 20 To obtain trivial cancellations with this factor, we have chosen the product order of z λ .
By comparing with the intertwining relation (4.4), we obtain the recursion relation (4.18) which gives the formula (4.19).
The OPE computation of F (z) and Φ λ (u) involves the commutation relation of E i (z) and F j (w). But it can be performed similarly based on for |z| > |w|. We can deduce that This time the delta-function δ xj v qz appears when j − λ j ≡ , that is, when we may remove a box with color from the j-th row. Using we can check the intertwining relation with F (z) by (4.67) with λ j → λ j − 1.
Finally, the dual intertwining relations can be demonstrated in the same way.

Network matrix model and screening operator
Network matrix model is a matrix model of the Dotsenko-Fateev type (conformal matrix model) 21 whose measure is determined by a trivalent planar diagram (5 brane-web) representing a toric Calabi-Yau threefold [50,51]. The correlation functions of the model are computed as the (vacuum) expectation values or the traces of appropriate products of the intertwiners glued together. They reproduce refined topological string amplitudes or five dimensional lift of the Nekrasov partition function for N = 2 quiver gauge theories. Using the intertwiners constructed in this section, we can define a network matrix model with U q,d ( gl n ) symmetry. There are two fundamental ways of gluing intertwiners (see Fig.3). The gluing along the horizontal line is simply the successive action of operators on the horizontal Fock space. A particular example is the product of Φ λ (z) and the dual intertwiner Φ * µ (w), which we call T operator [53]. The T operator satisfies the RT T relation and plays an important role in deriving (q, t)-KZ equation, since it realizes the q-shift operator (see the next section). Note that such a product of the intertwiners along the horizontal line gives again an intertwining operator which satisfies, for example, aΦ( On the other hand, the gluing along the vertical line means taking the tensor product in the horizontal direction with summation over the intermediate Young diagrams on the vertical line. This gives the screening operator of the network matrix model [52]; In the DIM case, there should be the inverse of the square norm of the Macdonald function ||M λ || −2 as a weight in the summation over λ. However, we have changed the normalization of the dual intertwiner Φ * λ and consequently there appears no weight factor in (4.73). Figure 3: Gluing two intertwiners Φ and Φ * gives the T -operator (horizontal gluing) or the screening operator (vertical gluing).
An important property of the screening operator is a commutativity with ∆(X) for any element X in This relation gives constraints (Schwinger-Dyson equations) for the correlation functions of the network matrix model. Since the coproduct ∆ is a homomorphism of the algebra, it is enough to check (4.74) for generating currents E (w), F (w) and K ± (w). For X = K ± (w), the commutativity is easily checked by using the definition of ∆ and the intertwining relations for Φ λ (z) and Φ * λ (z). For X = E (w), we have The right hand side vanishes inductively in the number of boxes |λ| of the Young diagram. A similar computation is valid for F (w).

Abelianization of the DIM intertwiner
We would like to reexpress the intertwiner (4.20) so that it explicitly depends on the quotients λ (c) and shifts p c of the vertical diagram λ. We will see that the intertwiner factorizes into a product of commuting operators, each depending on its own quotient λ (c) and shift p c . Thus the intertwiner for the non-Abelian DIM algebra breaks down into a product of intertwiners for the Abelian 22 DIM algebra.
To minimize technical steps in the derivation in this section, we limit ourselves to the unrefined non-Abelian DIM algebra. The unrefined limit corresponds to setting q 1 = q −1 3 , or, equivalently, to q = 1 with arbitrary d. Let us first write down the expression (4.20) for the intertwiner Φ λ (v) using the colored characters: Now we use the formula (E.15) expressing the colored character in terms of characters of the quotients: where the matrix L cd (q) is from Eq. (E.16). We introduce modified Cartan generatorsH c,r which are given by the following linear combinations of the original ones: where a ij and m ij are the Cartan and adjacency matrices introduced in Eq. (3.1), and we have used the crucial property of L −1 : .

(4.80)
This property is easy to verify from the explicit expression (E.19). We therefore conclude thatH i,r are N independent bosonic generators. We notice a further simplification which occurs when we rewrite the vacuum part of the intertwiner in terms of the new Cartan generators: Plugging the identities (4.78) and (4.81) into the intertwiner, we obtain It is remarkable that, sinceH r,d for different d commute, the intertwiner is a product of commuting operators each depending on its own quotient diagram λ (d) and the shift p d , the latter entering only in the shift of the spectral parameter. Moreover, upon closer examination each of the commuting operators is nothing but the Abelian DIM intertwiner! Let us denote the Abelian DIM intertwiner by Ψ λ (z) as in [52]: wherec λ (z) denotes the scalar prefactor, which we omit in what follows, and we have explicitly written the q 1 -dependence of the intertwiner and also indicated that it acts in the horizontal representation with the bosonic generatorsH r . The generatorsH r satisfy the commutation relations Notice that here the normalization of the generators is nonstandard, though the expression for the Abelian intertwiner (4.83) is correct. We can introduce a more convenient set of operators a r =H r which are independent (we assume that d=0H d,0 = 0). Then the zero modes also factorize into a product of independent factors: where we have omitted the scalar prefactors. Several remarks are in order: 1. Each operator Ψ acts on its own horizontal Fock space with the bosonic operatorsH d,r , which are completely decoupled from each other. The vertical quotient diagrams λ (d) are also independent.
2. The normal ordering in the product in Eq. (4.89) has been omitted, since each factor is already normal ordered, and the bosonsH d,r commute for different d.  Overall, since we have expressed the non-Abelian intertwiner as a product of the Abelian ones, we can now draw a network matrix model picture for it, see Fig. 4. The non-Abelian intertwiner acts in the tensor product of N horizontal Fock spaces and N vertical Fock spaces. The latter have the basis labelled by the N -tuple of Young diagrams λ (d) . The spectral parameters on the vertical legs are obtained from the original one v and the shifts p c , while those on the horizontal legs are encoded in the momenta (zero modes) of the corresponding bosonic fields. The Fock spaces are intertwined pairwise by the usual triple topological vertices so that, as a result, one gets a tensor product of N horizontal Fock spaces.
From the physical point of view, the phenomenon we observe in this computation is that of symmetry enhancement. The Abelian intertwiner corresponds to a triple junction of three Type IIB (p, q)-branes, each of them being represented by a Fock space in the algebraic picture. The DIM algebra plays the role of the "worldvolume gauge symmetry" of the brane. Since there is only one brane, the symmetry is essentially Abelian, hence, represented by the Abelian DIM algebra U q,t ( gl 1 ).
One can consider a triple junction of a stack of N (p, q)-branes. If the branes in the stack are far apart then on each of them there is still an Abelian algebra acting. However, when we move the branes closer together, the symmetry will be enhanced. The natural candidate for the enhanced symmetry algebra is U q,d ( gl N ). A priori it is nontrivial that the triple junction of stacks of branes factorizes into a product of non-interacting triple junctions. Our computation shows that at least in the unrefined limit this is, indeed, the case: the branes pass through each other and form the junctions just in the way they used to when they were far apart. Perhaps one can interpret this effect as conservation of certain protected quantities.

Level one KZ equation and Nekrasov function for ALE space
Let us define the T -operator [53,54] as a bilinear composition of the intertwiners where (z, λ) and (w, µ) label the states in the incoming and the outgoing vertical Fock space, respectively. In some of the computations below, it is necessary to change the level N and the spectral parameter u of the horizontal Fock space. We also introduce a function G λµ (z) by the normal ordering of the oscillator part 23 As we will see below, in the construction of algebraic solutions to the (q, t)-KZ equation, G λµ (q −1 z/w) plays a role similar to the two point function (the propagator) in the computation of correlation functions based on the Wick theorem for the free fields. From the structure of the intertwiners Φ λ (z) ∼: with the free field realization all the OPE relations (the two point functions) of the intertwiners are expressed in terms of the single function G λµ (z); Recall that the vacuum components are given by .

(5.12)
In topological string theory, G ∅∅ (z) gives the amplitude of the conifold and is the origin of the "anomalous" factor in the RT T relation [53]. In the following, we renormalize the function G λµ by so that G ∅∅ (z) = 1. 23 We keep the ordering of the zero mode part in (5.2). The insertion of q −1 is for later convenience.

Shift operator and R-matrix
From the combinations of the q-shift in the vertex operators, we can see that when the ratio of the incoming and the outgoing spectral parameters is q ±1 , the diagonal components of the T -operator have no positive or negative modes. Namely, if we define Actually T ± λ (N, u|z) is independent of the horizontal spectral parameter u, and the dependence on the level N is simply A crucial point in deriving the KZ equation is that the q −2 -shift of the intertwining operators is realized as the action of T ± λ (z) and their inverses as follows: where we have used Due to relation (5.23) to be discussed below, the prefactor can be simplified to .

(5.22)
It is instructive to count the power of q on both sides of these relations. We can see the factor q ±(1+2N )|λ|0 (the positive sign for (5.19) and the negative sign for (5.20)). Since q = (t/q) 1/2 , the shift parameter is the same as in the gl 1 case [55]. It should be noticed that the q −2 -shift of the vertical spectral parameter is accompanied by a shift of the horizontal parameter q ±1 u, which is consistent with the fact that T ± λ and (T ∓ λ ) −1 shift the horizontal spectral parameter by q ±1 , while keeping the level N . In order to derive the KZ equation based on (5.19) and (5.20), we have to use the commutation relations between the intertwiners and T ± λ (N, u|z) which follow from those among the intertwiners. Let us begin with the commutation relations of Φ λ (z) and Φ * µ (w). We want to require them to commute up to the anomalous factor G ∅∅ (z) so that we have a simple algebra of two copies of the Zamolodchikov algebra satisfied separately by Φ λ (z) and Φ * µ (w). In the computation of the commutation relation, it is important that the exchange of Φ λ (z) and Φ * µ (w) changes the level and the spectral parameter of the horizontal representation. It also involves the exchange of the zero mode factors z λ and z * µ , which are the group algebra parts (4.22), (4.29) of the (dual) intertwiner. We find that the above requirement is satisfied if and only if 24 where f λ (q 1 , q 3 ) is the generalized framing factor (4.23), and |λ| 0 denotes the number of boxes with color 0 in λ. In Appendix D, we prove (5.23). Using the relation (5.23), we can write down the commutation relations of the intertwiners as follows 25 ; where we have introduced the R-matrix defined by where H(λ, µ) = #{s ∈ λ|h µ,λ (s) ≡ 0} + #{t ∈ µ|h λ,µ (t) ≡ 0}. (5.28) When there are no constraints on the relative hook length, H(λ, µ) = |λ| + |µ|, and (5.27) reduces to the definition for the gl 1 case [53,54]. Υ (0,±) (z) stands for the anomalous factor which satisfies Υ (0,±) (z)Υ (0,±) (z −1 ) = 1. Note that the relation (5.23) implies The definition of the R-matrix (5.27) is justified by the fact that we can derive the following RT T relation by a computation similar to the gl 1 case [53,54], (5.31) up to the anomalous factor from the vacuum contribution.

Relation to K-theoretic Nekrasov function for ALE space
Difference of the Nekrasov functions for the flat space and the ALE space is in the selection rule for the boxes of the Young diagram. The selection rule is a consequence of taking the invariant part of the character under the orbifold action of Z n+1 on C 2 . To define the selection rule, we introduce the relative hook length Then the building block (the bifundamental matter contribution) of the five-dimensional Nekrasov function for instanton counting on ALE n × S 1 is given by [135,136] ). (5.33) The following specialization of N λµ (u; q 1 , q 3 ) is related to the normalization factor of the intertwiners: In [137,138], the gl n version of the Jack polynomials (Uglov polynomials) is obtained by taking the roots of unity limit of the Macdonald polynomials. The Uglov polynomials play an important role in the fourdimensional (Yangian) version of AGT correspondence for the Nekrasov partition function on the ALE space [139]- [144]. Since our current problem should be related to a five-dimensional uplift of this story, we expect the normalization factor of the intertwiner is closely related to the norm of an uplift of the Uglov polynomials as a generalization of the uplift of the Jack polynomials to the Macdonald polynomials. Though such an uplift is not available at the moment, we can guess the normalization factor from that of the Uglov polynomials given in [138].
See also Lemma 2 in Appendix A. At the CFT side, the uplift might be related to q-deformed W-coset models. We can expect the same level-rank duality as in the undeformed case, since the character is invariant under the q-deformation. It is interesting to see how the level-rank duality is realized in the setting of quantum toroidal algebras. Now we argue that the renormalized two-point function G λµ (z) of the intertwiners is nothing but the bifundamental matter contribution (5.33) on the ALE space. By a direct computation of the OPE factors between Φ * ∅ (v) and Φ λ (u), we obtain where, in the second equality, we convert the summation over the co-arm length j −1 in each row (1 ≤ j ≤ λ i ) to that over the arm length λ i − j and use ∅ (i, j) = −i. In general, from the normal ordering for ≡ j − µ j − 1, we obtain a recursion relation for G λµ (u) with respect to the second diagram µ, In Appendix C, we prove that N λµ (u; q 1 , q 3 ) satisfies exactly the same recursion relation. Thus, we have G λµ (u) = N λµ (u; q 1 , q 3 ). (5.39)

Level one KZ equation for U q,d ( gl n )
From the commutation relations between the intertwiners, we obtain the following commutation relations of the T -operator and the intertwiners: It is convenient to introduce a universal function that is the q −2 -difference of the vacuum anomalous factor and define a renormalized R-matrix by It is amusing that a similar decomposition takes place for the R-matrix for the tensor product of evaluation representations of the quantum affine algebra [84]. Here the vertical Fock representation of the quantum toroidal algebra plays the role of the evaluation representation [145]. With the renormalized R-matrix, the commutation relations between the shift operator T ± λ (z) and the intertwiners take the following simple form: After commuting with T ± -operators, there is the q ±1 -shift of the horizontal parameter of the intertwiners, while the level of T ± itself changes. Let us derive an ((q, t)-KZ) equation for the correlation function of the intertwiners G (n,m) (v| z, λ; w, µ) = ∅|Φ * µ1 (w 1 ) · · · Φ * µm (w m )Φ λ1 (z 1 ) · · · Φ λn (z n )|∅ , (5.48) where v is the incoming (rightmost) spectral parameter of the horizontal representations. Without loss of generality, we can assume that the right vacuum belongs to the level (1, 0) representation. Then the left vacuum belongs to the level (1, n − m) representation. The other horizontal spectral parameters are determined by the conservation law for the existence of the intertwining operator. The difference operator q −2x∂x acting on each intertwiner produces an insertion of T ± λ (z) according to (5.19) and (5.20). Using the commutation relations (5.44) -(5.47), we can then move T − λ to the left and T + λ to the right. Finally acting on the (dual) vacuum, T ± λ (z) produces the prefactors c ± λ given by (5.16) which cancel G function in (5.19) and (5.20). The remaining factor comes only from the level dependent part of c ± λ and from the assumption on the level of vacua |∅ and ∅| we obtain the factor q ±(n−m)|λ k |0 . In this way we can write down the (q, t)-KZ equation; and q −2w k ∂w k −v∂v · G (n,m) (v| z, λ; w, µ) The additional operator q ±v∂v accounts for the shift of the horizontal parameter in (5.19) and (5.20). Note that since all the horizontal parameters are proportional to the initial parameter v, all of them are shifted by q ±1 . After commuting the intertwiners with the operators T ± λ k or T ± µ k , the shifted horizontal parameters get back to the original values.

Nekrasov function as algebraic solutions to KZ equation
The Nekrasov function for the U (1) gauge theory on the ALE space satisfies the (q, t)-KZ equation derived in the last subsection. This solution does not require any screening operators and, hence, there are no integrations associated with the screening operators. In this sense, the Nekrasov function for the U (1) gauge theory gives an algebraic solution to the (q, t)-KZ equation. For the U (N ) gauge theory, one could need screening operators, and we have to glue N building blocks, with each block being an appropriate Nekrasov functions for the U (1) theory.
To construct algebraic solutions to the (q, t)-KZ equation, let us introduce the "modified" two point function which satisfies a fundamental difference equation Then one can check satisfies both the (q, t)-KZ equations (5.49) and (5.50).
6 Modular and periodic properties of double elliptic systems from U q,t ( gl 1 ) network matrix model Let us use solutions to the elliptic KZ equations for U q,t ( gl 1 ) obtained in [55] to deduce the properties of the 6d U (N ) gauge theories with adjoint hypermultiplet of mass m compactified on a torus T 2 . These systems are described by the double elliptic integrable systems [100,101,102] and possess remarkable modular properties [82]. The partition function, or prepotential, of the double elliptic system depends on the bare complexified coupling constant τ of the gauge theory and on the complex structure modulus of the compactification torusτ . S-duality can be thought of as the symmetry of the theory with respect to inversion of the coupling constant, τ → − 1 τ . However, in the double elliptic case, this transformation is mixed with the transformation of the compactification torus so that its complex structure is shiftedτ →τ − N m(m+ε1+ε2) τ . We will derive this transformation from the exact solution of the elliptic KZ equations, which can be understood as the network matrix model correlator. It also gives the basic building block of the 6d version of Nekrasov functions.
From string theory considerations, one can also argue that the partition function of the 6d theory should be doubly periodic in the mass parameter, e.g. m → m + 1 or m → m +τ should leave it invariant. Upon closer look, however, there is a surprise here: when shifting the mass byτ , one also needs to shift the coupling constant τ → τ + N (τ + 2m + ε 1 + ε 2 ). This seemingly mysterious shift can be also explained from the network matrix model picture, which we redraw here (for N = 2): The algebraic expression corresponding to this picture reads In Eq. (6.1) we have introduced the grading operators Q d Q d ⊥ ⊥ counting the states of a given degree just as in the ordinary characters of affine algebra representations V µ : where d is the grading operator counting the modes in the loop algebra. An important difference between compactified DIM networks and the characters ch µ is that, in the DIM case, there are two grading directions and two grading operators d and d ⊥ . This happens because the DIM algebra is essentially a double loop algebra. However, we cannot simply write a generalization of character as at least not for the simplest representation, the Fock one F (k1,k2) u . The problem is that the general grading operator Q d Q d ⊥ ⊥ shifts the spectral parameter u of the Fock space F (k1,k2) u , i.e. it does not map the representation space into itself. A pedantic reader might notice that what we have just stated actually means that Fock representations are strictly speaking not representations of the whole DIM algebra. Indeed, the Fock representations are counterparts of the evaluation representation of the affine algebra g, which are representations of the loop algebra Lg, i.e. with zero central charge and without the action of the grading operator d. Evaluation representation ev u is a representation in which all the modes j a n of affine currents j a (z) act in the same way, up to scalar factors: j a n | v, u = u n |t a v, u , (6.5) where t a denote the generators of the finite algebra. In particular, the action of modes of the Cartan generators can be simultaneously diagonalized. The grading operator d can be introduced, but it transforms one evaluation representation into another one, shifting the spectral parameter u: Similarly, the Fock representations F (k1,k2) u of the DIM algebra are representations in which a certain linear combination of central charges vanishes. Therefore, a certain linear combination of grading operators d and d ⊥ transforms one Fock representation into another one, shifting the spectral parameter, while an orthogonal linear combination counts the level of the states in the representation. In other words, the Fock representation is an evaluation representation for a quantum affine (in the gl 1 case, simply Heisenberg) subalgebra of the DIM algebra with a particular slope (k 1 , k 2 ). The action of all the DIM generators can be expressed in terms of the action of just one Heisenberg subalgebra (with "slope" (−k 2 , k 1 )) of DIM. The action of the "orthogonal" DIM subalgebra with slope (k 1 , k 2 ), on the other hand, can be diagonalized on the whole Fock module and gives rise to the basis of Macdonald polynomials. Taking the trace of the grading operators (6.4) is forbidden for the same reason as the trace of Q d over the evaluation representation ev u : it simply makes no sense, since the operator does not act from the representation space into itself.
In general, the grading operator Q d Q d ⊥ ⊥ changes the spectral parameter u of the Fock representation F (k1,k2) u of general slope (k 1 , k 2 ) into Q −k2 Q k1 ⊥ u: or, pictorially, One can notice that, at the r.h.s. of (6.7), the slope vector (k 1 , k 2 ) and the fugacity vector (ln Q, ln Q ⊥ ) are paired using the skew symmetric SL(2, Z)-invariant bilinear form.
Instead of the trace (6.4), one thus needs to consider in addition to the grading operators a nontrivial network of the intertwiners which compensates for the shift of the spectral parameters. Eq. (6.1) provides an example of such a setup. The spectral parameters of the horizontal representations before and after the wavy lines are uQ ⊥ P −2 and u respectively. These spectral parameters have to coincide for the trace (represented by the wavy line) to be well-defined. We therefore tune Q ⊥ = P 2 or, for generic N , so that the whole network between the wavy lines does not shift the horizontal spectral parameter. We will not write Q ⊥ among the arguments of the partition function Z(Q, Q ⊥ , P, P ⊥ , z) henceforth. The relations between the spectral parameters of the network and the gauge theory parameters are as follows: where a i are the Coulomb moduli. The periodicity of the partition function with respect to shifts of a, m, τ orτ by 1 is automatic in this formalism. Notice that the picture we are considering is almost symmetric with respect to the exchange of the vertical and horizontal directions (the exchange is called Miki automorphism [68], spectral duality [146]- [153], or S-duality of Type IIB strings depending on the formalism). The asymmetry appears only in the number of lines. Thus we can predict that the necklace quiver 6d theory with the gauge group U (N ) ⊗N will be spectral self-dual, i.e. symmetric with respect to the exchange of τ (a certain combination of the N coupling constants) andτ accompanied by a suitable exchange of the vevs and masses of the bifundamental hypermultiplets. In particular, the 6d U (1) theory with adjoint matter is spectral self-dual. In the two subsequent sections, we will use the network matrix model formalism to deduce the modular and periodicity properties of the partition function (6.2). The derivation of the modular and periodicity properties from the DIM intertwiner picture gives the answer for the gauge theory in arbitrary Ω-background with all corrections in 1,2 automatically taken into account.

Adjoint mass shift
Let us understand the transformation of the partition function when the mass is shifted byτ . To this end, we carefully use the commutation relations of the DIM algebra intertwiners and automorphisms. We start with the "double" (vertical and horizontal) trace of the intertwiners shown in Fig. 2.
The procedure breaks down into two steps which can be divided further into substeps: 1. Commutation of intertwiners. Let us move the intertwiners Ψ λi (z i ) cyclically under the trace.
Here are the steps of this procedure: (a) Move Ψ λi (z i ) to the left through the intertwiners Ψ * µi (w i ): Here we use the commutation relation for Ψ with Ψ * , which involves the scalar function Υ q,t The crucial point is that the grading operators satisfy the intertwining relations with Ψ so that where we have indicated all the slopes and spectral parameters of the Fock spaces corresponding to the legs explicitly.
(c) Move Ψ λi (z i ) through the trace so that they emerge on the right: Recall that the corresponding (double) wavy lines are identified with each other. Therefore, the grading operators Q d Q d ⊥ ⊥ sitting on the upper vertical legs are effectively multiplied with the grading operators P d P d ⊥ ⊥ sitting on the lower ones. After these steps one arrives at the following picture: The expression looks almost the same as the initial one (6.2). There are two key differences 26 : (a) The fugacities on the vertical legs are different. They used to be (P, P ⊥ ), whereas after the cyclic movement of the intertwiners they became (P Q, P ⊥ Q ⊥ ).
(b) The Fock space over which the trace is taken has a different slope, which used to be (1, 0) and has become (1, −N ). To compare the parameters of the theory with that of the initial setup, we need to transform the slope of the Fock space back to (1, 0) using the T -transformation, i.e. act with the T -element from the SL(2, Z) automorphism group of DIM. (0, 1) is the framing factor. These actions are, of course, consistent with the explicit expression for the DIM intertwiners written down in [77].
(b) On the grading operators. The action of T on the grading operators is explicitly given by The slopes indicated on the picture are those appearing in between the T −N and T N operators.
Finally, we obtain the equality between the initial gauge theory partition function Z(Q, P, P ⊥ , z) and a similar one, but with shifted parameters: Notice that we have omitted an inessential overall shift of z i in the argument of the partition function. The product of Υ q,t functions arises from the classical part of the gauge theory partition function. Indeed, the prefactor is independent of P ⊥ , i.e. of the gauge theory coupling constant, thus we can safely send it to zero and still keep Eq. (6.22) intact. In this limit, the gauge theory instantons do not contribute, or, in the language of intertwiners, the vertical lines become uncompactified so that λ 1 = λ 2 = ∅. What remains is the strip of intertwiners compactified only along the horizontal direction. The prefactor can be absorbed into a simple redefinition of the partition function and we have the following difference equation 27 Ξ q,t,Q (α|Qx) Ξ q,t,Q (α|x) = Υ q,t (α|x) . (6.25) The resulting partition function Z periodic is invariant with respect to the following shift of the parameters: Z periodic (Q, QP, P ⊥ Q N P 2N , z) = Z periodic (Q, P, P ⊥ , z) (6.26) Now the shift of the gauge theory parameters can be easily extracted from the dictionary (6): In absence of the ε-deformation, this transformation law coincides with what was found in [82] for the classical integrable system. Here we provide an exact expression valid for arbitrary Ω-background. In particular, setting ε 1 = , ε 2 = 0 in Eq. (6.27) gives the transformation law for the exact prepotential of the quantum double elliptic integrable system (as usual in the Nekrasov-Shatashvili limit [154,155,156,157]). 27 Notice that Ξ q,t,Q (Q) − 1 2 α Q 1 2 x is symmetric in q, t −1 and Q.

Modular transformations
The properties of the partition function with respect to the modular transformations of the compactification torus can also be deduced from the network matrix model. We take the explicit expression for the trace of intertwiners over the horizontal Fock space from [55]. It is written as a product of theta-functions, which are modular invariant up to a simple prefactor. This prefactor gives rise to an extra shift of the gauge coupling τ . For N > 1, we will discuss only one of the two modular transformations of the 6d U (N ) partition function, the second being the τ → − 1 τ . This second transformation can also be easily analysed in our framework, but we leave this task for the future.

U (1) theory
As a warm-up, we consider the U (1) theory, where the expressions are simpler, though the modular properties are still nontrivial. In particular, there are no vacuum moduli in this case. We have: and θ Q (x) is the Jacobi theta function: Notice that in Eq. (6.31) we exclude an extra Ξ q,t,Q prefactor used to construct the periodic partition function Z periodic . The modular transformation of the theta function is given by the standard formula: τ (e we get a prefactor from each theta-function in the product in Eq. (6.32). The term in the instanton expansion labelled by the diagram λ is multiplied with the exponential of the following expression: . (6.39) 28 We slightly change the notations as compared to [55]. There was also a typo in [55].
There happen to be many cancellations between different terms in the sum (6.39). The final answer for the prefactor looks quite simple: .
The partition function is invariant (up to an overall scalar factor) under the modular transformation ofτ , if we perform a shift of the complexified coupling of the gauge theory encoded in P ⊥ = e 2πiτ : In the classical case, this matches the transformation law obtained from the Seiberg-Witten theory techniques and modular anomaly equations [82]. Notice that our derivation is valid for the general Ωbackground, in particular, it holds for the quantized double elliptic integrable system.
As we have mentioned earlier, the U (1) theory is spectral self-dual, which, in this case, means that it is invariant under the exchange of τ andτ . This implies the second modular transformation for τ . Notice that for m = 0 the theory becomes 6d N = (2, 0) theory compactified on T 2 without any punctures 29 . The partition function becomes a product of two η-functions: , where we omit an overall prefactor independent ofτ and τ . The spectral duality and modular invariance are evident in this limiting case.

U (N ) theory
The case of U (N ) gauge theory can be understood along the same lines as the U (1) one. The partition function is equal to (6.43) Now we have a nontrivial dependence on (N − 1) vacuum moduli a a , which we assume add up to zero, N a=1 a a = 0. The modular transformation of a a is the same as that of the mass m: z a = e 2πiaa →z a = e 2πiãa = e 2πi aâ τ . (6.44) After the modular transformation, the theta-functions in the instanton series give a prefactor, which is the exponential of Again there are many cancellations, in particular, the dependence on a a cancels completely. Eventually, we have a simple transformation law: The partition function is therefore invariant under the following modular transformation: The transformation is consistent with the classical case discussed in [82].

Discussion
We have presented two generalizations and one application of the (q, t)-KZ equation for the quantum toroidal algebra U q,t ( gl 1 ) derived in [55]. The first generalization is the case of an arbitrary horizontal level in U q,t ( gl 1 ), where we postulate the KZ equation using the analogy with the quantum affine case. The second generalization is the KZ equation for the "non-Abelian" quantum toroidal algebra U q,d ( gl n ), but with horizontal level one. In this setup, we find the expressions for the intertwiners of the Fock representations and show that (at least in the unrefined case) they factorize into products of the intertwiners for U q n ,q n ( gl 1 ). Thus, the networks of the "non-Abelian" intertwiners can be redrawn as more complicated networks of the Abelian ones. We call this procedure Abelianization.
In both of these cases, we still find only algebraic solutions. For U q,d ( gl n ) these solutions are related to the Nekrasov functions on the ALE spaces C 2 /Z n .
We also consider an application of network matrix models and KZ equations to 6d gauge theories. We identify the compactified network of the intertwiners corresponding to the 6d U (N ) gauge theory with massive adjoint hypermultiplet compactified on T 2 and study the properties of the partition function under shifts of the adjoint mass and modular transformations of the compactification torus. We find all ε-corrections to the known classical answer. It would be interesting to understand the origin and interplay between two SL(2, Z) modular transformations and spectral duality of the 6d gauge theory.
The most interesting and nontrivial generalization of (q, t)-KZ equations, when both central charges are arbitrary still remains to be understood. In this case, new integral solutions should arise, which generalize the Nekrasov functions in a nontrivial way. We plan to study these intriguing cases elsewhere.

Acknowledgements
We very much appreciate correspondence and discussions with M. Jimbo, S. Minabe, and S. Yanagida.

A Combinatorics of the normalization factor
We have normalized the components of the intertwiner Φ λ (u) by the following factor: Note that in the product there is a restriction on the length of the hook. Our normalization of the component of the dual intertwiner Φ * λ (u) is slightly different and given by In this subsection, we will prove technical lemmas on these normalization factors.
Lemma 1. When we add a box with color in the k-th row, the change of the normalization factors C λ and C λ is given by and Since we have to deal with the coloring and the length of the hooks in λ, let us introduce convenient notations for this purpose. We define the head (x h , y h ) and the tail (x t , y t ) of a hook by the condition (x h , y h − 1), (x t , y t ) ∈ λ and (x h , y h ), (x t + 1, y t ) / ∈ λ.

•
The hook consists of boxes with •.
Note that the tail belongs to the hook, but the head does not. The corner of the hook is (x h , y t ). The color of the boxes is increasing along a hook from the head to the tail. If a hook satisfies h λ (x h , y t ) ≡ 0, the head and the tail have the same color. In the above hook diagram, the head is the red box with × and the tail is the red box with •. In terms of these notations, the normalization factor is Thus, we can evaluate each factor of C λ (q 1 , q 3 ) by identifying the heads and the tails of the hooks. Now when we add a box (k, λ k + 1) with color in the k-th row, a newly appearing hook in λ + 1 k has the head (k, λ k + 2) or the tail (k, λ k + 1). Let us first consider the case when (k, λ k + 1) is the tail and the hook length is a multiple of n. Then the head (j, λ j + 1) for j ≤ k − 1 has the color . This hook gives a new factor to C λ+1 k , if the up-shifted hook is not a hook in the original diagram λ. This takes place if λ j−1 > λ j , that is, when we can add a box with color in the j-th row. Since the head and the tail of such a new hook are (j, λ j + 1) and (k, λ k + 1), the new factor is ). (A.6) Next, when (k, λ k + 2) is the head and the hook length is a multiple of n, we may have the tail (j, µ j ) for k ≤ j and λ j+1 < µ j ≤ λ k . This time a new factor in C λ+1 k appears, if the left-shifted hook is not a hook in the original diagram λ. This is the case only when µ j = λ j+1 + 1, the minimum of allowed µ j . Since the tail (j, λ j+1 + 1) has the same color − 1 as (k, λ k + 2), we can add a box (j + 1, λ j+1 + 1) with color in the (j + 1)-th row. The new factor is where we have made a shift j → j − 1 so that k + 1 ≤ j ≤ (λ) + 1. On the other hand, thinking in the opposite way, we see that the hooks that cease to contribute C λ (q 1 , q 3 ) have either the head (j, λ j + 1) and the tail (k − 1, λ k + 1) for 1 ≤ j ≤ k − 1, or the head (k, λ k + 1) and the tail (j, λ j ) for k + 1 ≤ j ≤ (λ). The selection rule is that we can remove a box with the color from the j-th row. The corresponding factors are for the latter one. By taking above four factors with the color selection rule, we obtain (A.3). Considering the difference between C λ (q 1 , q 3 ) and C λ (q 1 , q 3 ), we see that (A.4) follows from (A.3) by a shift q y 1 q x 3 → q −1 2 q y 1 q x 3 . In the vertical representation, we take a basis {|λ)} of the Fock space, which simultaneously diagonalizes K ± (z). Since the eigenvalues are non-degenerate, the freedom is only the change of the norm of each eigenvector |λ). The normalization factors C λ (q 1 , q 3 ) and C λ (q 1 , q 3 ) are related to the relative normalization of |λ). In fact, if we define 30 (λ|λ) q1,q3 := C λ (q 1 , q 3 ) C λ (q 1 , q 3 ) , (A.10) the recursion relation for (λ|λ) q1,q3 is given by the matrix elements of the vertical representation as follows: Lemma 2.

B Zero mode factor of the intertwiner
In this Appendix, we prove the lemmas concerning the zero mode part of the intertwiner. First of all, we recall the zero mode algebra k ± i e j (z) = q ±ai,j e j (z)k ± i , k ± i f j (z) = q ∓ai,j f j (z)k ± i , (B.1) e i (z)e j (w) = (w/z) −ai,j (−d) −mi,j e j (w)e i (z), f i (z)f j (w) = (w/z) −ai,j (−d) −mi,j f j (w)f i (z), (B.2) e i (z)f j (w) = (w/z) ai,j (−d) mi,j f j (w)e i (z), f i (z)e j (w) = (w/z) ai,j (−d) mi,j e j (w)f i (z), where i, j ∈ Z/nZ, a i,j = 2δ i,j − δ i−1,j − δ i+1,j and m i,j = δ i−1,j − δ i+1,j . These are represented by k ± i → q ±∂α i , e i (z) → e αi z Hi,0+1 , f i (z) → e −αi z −Hi,0+1 (B.5) and relations (3.48)-(3.50). Then the first lemma is stated as below i,j (v) = e i−j+k (q j−1 λ, (v/u)z Now we shall check the commutation relation between e (u) and z

C Recursion relation for Nekrasov function
In this Appendix, we give a proof of G λµ (z) = N λµ (z; q 1 , q 3 ) (C.1) for the Nekrasov function (bifundamental contribution) on ALE n × S 1 , by obtaining a recursion relation for N λµ (z; q 1 , q 3 ).
Lemma 5. The Nekrasov factor N λµ (z; q 1 , q 3 ) satisfies the following recursion relation where = j − µ j − 1 is the color of the added box (j, µ j + 1).
To obtain the recursion relation, we can proceed in the way similar to the proof of Lemmas 1 and 2 in Appendix A. However, since a pair of the Young diagrams is involved, the argument necessarily becomes more sophisticated. As the Nekrasov factor (5.33) consists of two parts, let us consider each part separately.

E.2 Decomposing characters
The (uncolored) character of the Young diagram is defined as follows: ch Y (q) = We would like to rewrite the character as a manifest function of the quotient diagrams Y (c) and of the shifts p c . This, indeed, can be done and we obtain the following expression: One can also introduce the colored character The colored characters can also be expressed in terms of the quotient Young diagrams: where x denotes the floor function of x. One observes that the colored characters ch (E. 16) The matrix L turns out to have a particularly nice inverse: (E. 18) or, in the index notation, (L(q) −1 ) cd = δ cd − qδ c,d−1 1 − q N , (E. 19) whereδ cd is the Kronecker symbol modulo N . In sec. 4.5, we used this result for the inverse matrix in order to transform the expression for the non-Abelian DIM intertwiner into a product of commuting intertwiners.