A parametric representation of totally mixed Nash equilibria

We compute a parametric description of the totally mixed Nash equilibria of a generic game in normal form with pre-fixed structure. Using this representation, we show conditions under which a game has the maximum possible number of this kind of equilibria. Then, we present a symbolic procedure that allows us to describe and estimate the number of isolated totally mixed Nash equilibria of an arbitrary game. Under certain assumptions, the algorithm computes the exact number of these equilibria.


Introduction
Noncooperative game theory is used to model and analyze strategic interaction situations. Among its most outstanding applications, we can mention the fundamental role this theory has played in economics (see, for example, the classical reference book [1]). Moreover, game theory has also been applied to politics, sociology and psychology, and to biology and evolution as well.
One of the main concepts in this theory is that of Nash equilibrium, which consists in a situation in which no player can increase his payoff by unilaterally changing his strategy. Since within this theory the players cannot communicate in order to decide a simultaneous change of strategies, in a Nash equilibrium the game stabilizes. In [2], it is proved that any noncooperative game in normal form has at least one Nash equilibrium. However, the proof is not constructive and does not give any information about the existence of more than one Nash equilibrium. The question posed is how to compute algorithmically Nash equilibria and to determine the number of them in a given game.
Nash equilibria of noncooperative games in normal form can be regarded as real solutions to systems of polynomial equations and inequalities (see, for instance, [3,Chapter 6]). In the case of two players, each equilibrium is the solution of a linear system of equations, and therefore, equilibria may be found exactly by using simplex type algorithms (see, for instance, [4]); however, there is no polynomial time algorithm solving the problem (see [5]). In the general case of a game with more than two players, the polynomials appearing are multilinear. To solve the problem of finding one equilibrium, some numerical methods have been applied successfully (for example, some methods derived from Scarf's algorithm, [6]). Nevertheless, sometimes it is not sufficient to compute only one equilibrium because, depending on the problem to be solved, not all the equilibria of a game are equally interesting and the methods developed to compute only one equilibrium do not allow us to decide beforehand whether it fulfills some additional properties or to compare different equilibria.
A comparative study of different known methods for the computation of all the Nash equilibria of a game may be found in [7]. In [8], a new algorithm solving this problem for generic games by means of homotopy methods is presented, but no complexity bounds are shown (for a recent treatment of numerical methods for solving polynomial systems see the book [9]). Regarding implementation, the Gambit software (see [10]) provides some tools for finding Nash equilibria and studying games. In addition, the application of symbolic algorithms solving systems of equations and inequalities over the real numbers (see, for instance [11]) is being studied in this context, motivated by the characterization of the set of all the Nash equilibria of a game as a semi-algebraic set (an example of this fact is the application of quantifier elimination algorithms over the real numbers to compute approximated equilibria in [12]; see also the survey [13]). However, up until now, no significative result had been obtained concerning the adaptation of these algorithms in order to profit from the particular properties of the algebraic systems arising in game theory.
In this paper, we study totally mixed Nash equilibria, that is to say, Nash equilibria in which every player allocates a positive probability to each of his available strategies. Note that a procedure to compute these equilibria can be used as a subroutine to compute all Nash equilibria of the game by recursing over all possible subsets of used strategies.
The aim of this paper is to design symbolic algorithms to describe the set of totally mixed Nash equilibria of a game, either in the generic parametric case or in particular cases, taking into account the multihomogeneity of the polynomials involved in its definition. Our goal is to do so within a complexity polynomial in certain natural invariants associated to the problem, lower than the one that could be obtained by directly applying the known general polynomial equation solving algorithms (see, for instance, [14][15][16][17][18][19][20][21][22]; also [23] and the references therein).
A key ingredient to achieve the desired complexities in all the algorithms in this paper is the use of straight-line programs (see Section 2.1) to encode the polynomials we work with. This alternative data structure, which comes from numerical analysis, has already been applied in the polynomial equation solving framework yielding a significant reduction in the previously known complexities (see, for instance, [16] and [20] among many other works).
Our first result presents a symbolic method to find a parametric description (a so-called geometric resolution, see Section 2.4 for a definition) of the set of totally mixed Nash equilibria of a generic game with a pre-fixed structure. This method is based on the symbolic procedure for the computation of multihomogeneous resultants with complexity polynomial in the degree and the number of variables of the resultant described in [24] (see also this paper for previous works on resultant computation). We summarize it as follows: Theorem I. There is an algorithm which computes a geometric resolution of the set of totally mixed Nash equilibria of a generic game with r players having n 1 + 1, . . . , n r + 1 pure strategies respectively, within complexity O(δ 3 n 8 (log(n) + log(δ))r 2 n 1 . . . n r (n 3 + r 2 1≤i≤r (n i + 1))), where δ is the number of totally mixed Nash equilibria of a generic game with the given structure and n = 1≤i≤r n i .
A more precise statement of our result will be given in Theorem 1. Note that the complexity of the algorithm is polynomial in the number of players, the number of each player's pure strategies and the number of totally mixed Nash equilibria of a generic game with the given structure. These are the invariants we mentioned above, in terms of which we will express the complexity of all the algorithms in this paper.
There are already known probabilistic algorithms using straight-line programs that could be adapted in order to compute a geometric resolution of the set of totally mixed Nash equilibria of a generic game: for instance, the algorithm solving parametric polynomial equation systems by means of deformation techniques given in [25], or the one developed in [26] in the bihomogeneous setting, which takes into account the structure of the polynomial equations within a similar approach. However, the more ad hoc procedure we present in Theorem I, based on multihomogeneous resultant computations, is deterministic and works within the same or even better complexities.
Our following result is concerned with the characterization of games with the maximum possible finite number of totally mixed Nash equilibria for the considered structure. The existence of such games was proved in [27]; however, no characterization has been provided. Using the description obtained by the algorithm in Theorem 1, we give an algorithm to compute a finite set of polynomial inequalities in the payoff values under which a game with the given pre-fixed structure will have the maximum number of such equilibria (for a more precise statement, see Theorem 2): Theorem II. Under the same notation as in Theorem I, there is a family of nδ + 1 polynomials with rational coefficients S 0 , S (h) ij , 1 ≤ i ≤ r, 1 ≤ j ≤ n i and 1 ≤ h ≤ δ, in the payoff values of a game with r players with n 1 + 1, . . . , n r + 1 pure strategies such that for every payoff vector c satisfying the conditions the associated game has δ totally mixed Nash equilibria. The polynomials S 0 and S (h) ij have degrees bounded by 4δ 2 n 2 and can be computed within complexity O(δ 2 (nδ 2 + L)) from a straight-line program of length L encoding a geometric resolution of the set of totally mixed Nash equilibria of the generic game.
A further parametrical classification of games according to their set of Nash equilibria could be achieved using the algorithms in [28], but they rely on the more expensive Gröbner bases approach. In the same spirit, the work in [29] might be adapted to handle this problem.
After analyzing the generic situation, we deal with particular games. In this case, we give algorithms to compute a geometric resolution of a finite set of points including all the isolated (in the complex space) totally mixed Nash equilibria of the game. First, in Theorem 4, we obtain a procedure to achieve this task under some genericity assumptions implying, in particular, that the number of totally mixed Nash equilibria of the game is finite, and then we show how to compute this number (see Proposition 5). Finally, in Theorem 7, we consider the same problem in the general case, for which we design a probabilistic algorithm. The output of this algorithm enables us to bound the number of isolated equilibria of the game. This paper is organized as follows: In Section 2, we introduce some basic notions on game theory and polynomial system solving. In Section 3, we present algorithms for computing a geometric resolution of the totally mixed Nash equilibria of a generic game and for obtaining conditions under which a game has the maximum number of these equilibria. Section 4 deals with the isolated totally mixed Nash equilibria of particular games. In Sections 5 and 6 we make some concluding remarks on complexity and future implementation issues. Finally, two appendices are devoted to proving some complementary results about the algorithmic computation of multihomogeneous resultants and upper bounds for their degrees which are used throughout the paper, implying that the complexities of all the algorithms in this work are polynomial in the number of players, the number of each player's pure strategies and the number of totally mixed Nash equilibria of a generic game with the considered structure.

Basic definitions and notation
Throughout this paper Q denotes the field of rational numbers, N denotes the set of positive integers and N 0 := N ∪ {0}. If K is a field, we denote an algebraic closure of K by K . As usual, the ring of polynomials in the variables x 1 , . . . , x n with coefficients in K is denoted by K [x 1 , . . . , x n ]. For a polynomial f ∈ K [x 1 , . . . , x n ] we write deg f to refer to the total degree of f and deg x i f to refer to the degree of f in the variable x i . For n ∈ N and an algebraically closed field k, we denote by A n (k) and P n (k) (or simply by A n or P n if the base field is clear from the context) the n-dimensional affine space and projective space over k respectively, equipped with their Zariski topologies. We adopt the usual notion of dimension of an algebraic variety V (see for instance [30,31]).
The algorithms we consider in this paper are described by arithmetic networks over the base field Q (see [32]). The notion of complexity of an algorithm we consider is the number of operations and comparisons over Q.
The objects we deal with are polynomials with coefficients in Q. Throughout our algorithms we represent each polynomial either as the array of all its coefficients in a pre-fixed order of its monomials (dense form) or by a straight-line program. Roughly speaking, a straight-line program (or slp, for short) over Q encoding a polynomial f ∈ Q[x 1 , . . . , x n ] is a program (an arithmetic circuit) which enables us to evaluate the polynomial f at any given point in Q n . The number of instructions in the program is called the length of the slp (for a precise definition we refer to [33,Definition 4.2]; see also [34]).

Game theory
In this section we present some basic game theory concepts. For a more detailed account on the subject we refer the reader to any standard game theory text such as [35].
We consider noncooperative games in normal form; that is to say, games in which there is only one time step at which all the players move simultaneously without communicating among themselves. We will assume that there are r players in the game having n 1 + 1, . . . , n r + 1 different available pure strategies respectively (n 1 , . . . , n r ∈ N).
For i = 1, . . . , r, c (i) := (c (i) j 1 ...j r ) 0≤j k ≤n k is the given payoff matrix of player i, where c (i) j 1 ...j r is the payoff to player i if, for every 1 ≤ k ≤ r, player k chooses the strategy j k and X i := (x i0 , x i1 , . . . , x in i ) is a vector representing a mixed strategy of the ith player, which is a probability distribution on his set of pure strategies (that is to say, x ij is the probability that the ith player allocates to his jth pure strategy). With these notations, for every 1 ≤ i ≤ r, the payoff to player i if the mixed strategies X 1 , . . . , X r are played is A Nash equilibrium is a vector of mixed strategies such that no player can increase his payoff by changing unilaterally to another strategy while the other players keep their strategies fixed; that is, a vector of mixed strategies X 1 , . . . , X r satisfying π i (X 1 , . . . , . . , X r ) for every 1 ≤ i ≤ r and every mixed strategy X i . A totally mixed Nash equilibrium is a Nash equilibrium in which each pure strategy is assigned a positive probability, that is, The totally mixed Nash equilibria of an r-person game in normal form can be regarded as real solutions to a polynomial equation system (see, for example, [3, Sec. 6.3]). They are the real vectors (X 1 , . . . , X r ) with X i := (x i0 , . . . , x in i ) for every 1 ≤ i ≤ r satisfying: (a) x ij > 0 for i = 1, . . . , r and j = 0, . . . , n i , . . x rj r = 0 for i = 1, . . . , r, k = 1, . . . , n i , where the sum runs over all J −i := j 1 . . . j i−1 j i+1 . . . j r with 0 ≤ j t ≤ n t for every t = i.
Observe that (c) is a system of n := n 1 + · · · + n r multihomogeneous polynomial equations in the r groups of variables X 1 , . . . , X r with n 1 + 1, . . . , n r + 1 variables respectively (with degrees 1 or 0 with respect to each group) and, therefore, it defines a (possibly empty) projective variety in P n 1 (C) × · · · × P n r (C). The projective complex solutions to the polynomial equation system (c) will be called quasi-equilibria of the game (see [7]), and those solutions not lying in any of the infinite hyperplanes {x i0 = 0} (1 ≤ i ≤ r) will be called affine quasi-equilibria of the game.
Every quasi-equilibrium ξ := (ξ 1 , . . . , ξ r ) determines at most one totally mixed Nash equilibrium of the game: for every 1 ≤ i ≤ r, let s ξ i := 0≤j≤n i ξ ij be the sum of the coordinates of ξ i . If s ξ i = 0 for every 1 ≤ i ≤ r, the unique associated representation of ξ whose coordinates satisfy condition (b) is (ξ 1 /s ξ 1 , . . . , ξ r /s ξ r ), and it will be a totally mixed Nash equilibrium if and only if all its coordinates are positive real numbers.

On the number of solutions to a multihomogeneous system
Let r ∈ N. Fix positive integers n 1 , . . . , n r and consider r groups of variables X j := (x j0 , . . . , x j n j ), j = 1, . . . , r. We say Set n := r j=1 n j . The classical Multihomogeneous Bézout Theorem, which follows from the intersection theory for divisors (see for instance [30,Chapter 4]), states that the set of common zeroes (over an algebraically closed field) in the projective variety P n 1 × · · · × P n r of n generic multihomogeneous polynomials F 1 , . . . , F n with multidegrees ν i := (ν i1 , . . . , ν ir ) for i = 1, . . . , n is a zero-dimensional variety with Bez n 1 ...,n r (ν 1 ; . . . ; ν n ) := For alternative proofs of this result using deformation techniques, we refer the reader to [36,37] and [26]. Note that this can also be seen as a particular case of Bernstein's theorem on the number of common roots of sparse systems [38].
The quantity Bez n 1 ...,n r (ν 1 ; . . . ; ν n ) is called the Bézout number of the generic multihomogeneous polynomial system. If k 1 , . . . , k t are positive integers with t i=1 k i = n, Bez n 1 ,...,n r (ν 1 , k 1 ; . . . ; ν t , k t ) will denote the Bézout number of a multihomogeneous system with k i polynomials of multidegree ν i for every 1 The equations arising in the computation of totally mixed Nash equilibria of a game are multilinear (see the previous section): for a game with r players with n 1 + 1, . . . , n r + 1 pure strategies respectively, we have a system of n = r j=1 n j polynomial equations consisting of exactly n i polynomials of multidegrees equal to d i := (1, . . . , 1, 0, 1, . . . , 1) The multihomogeneous Bézout number associated to this system will be denoted by δ. In fact, for a ''generic'' game, this is the number of totally mixed Nash equilibria (see [27]).
Taking into account that d ii = 0 for every 1 ≤ i ≤ r, it is straightforward to see that δ equals the cardinality of the set We are going to deal with the case in which δ > 0. This inequality can be determined by considering the set of exponents appearing with nonzero coefficients in each of the polynomials in the system (see [39, Chapter IV, Proposition 2.3]) and in our particular case, it is equivalent to the fact that n j ≤ 1≤k≤r, k =j n k = n − n j for every 1 ≤ j ≤ r. From now on, we will assume that these inequalities hold.

Geometric resolutions
A way of representing zero-dimensional affine varieties which is widely used in computer algebra nowadays is a geometric resolution. This notion was first introduced in the works of Kronecker and König in the last years of the XIXth century ( [40] and [41]) and appears in the literature under different names (rational univariate representation, shape lemma, etc.). For a detailed historical account on its application in the algorithmic framework, we refer the reader to [21]. An efficient polynomial algorithm using geometric resolutions and straight-line program encoding of polynomials can be found in [22] (see also [42] for a simplified approach to this solver). Roughly speaking, a geometric resolution consists in a rational parametrization of the variety in which the parameter values range over the set of roots of a univariate polynomial. Now, we give the precise definition we are going to use.
following polynomials completely characterize the variety V : The family of univariate polynomials p, w 1 , . . . , w n ∈ K [T ] is called the geometric resolution of V (associated with the linear form ). In our particular setting of totally mixed Nash equilibria computation, we will not only deal with zero-dimensional varieties in an affine space, but we will also consider zero-dimensional subvarieties of P n 1 × · · · × P n r .

On the totally mixed Nash equilibria of a generic game
This section is devoted to the study of totally mixed Nash equilibria of generic games. In order to do this, we will treat the payoff values as parameters and compute a geometric resolution of the set of quasi-equilibria of the associated generic game.

The set of quasi-equilibria of a generic game
Here we present an algorithm that computes a geometric resolution of the set of quasi-equilibria of a generic game with r players with n 1 + 1, . . . , n r + 1 pure strategies respectively, where n i ∈ N for every 1 ≤ i ≤ r.
where the sum runs over all , and we consider the multilinear polynomial which is obtained by homogenizing the generic affine linear form with respect to each group of variables X 1 , . . . , X r .

Algorithm GenericGame
Input: The number of players r and the number of pure strategies n 1 + 1, . . . , n r + 1 to each player.
of the set of quasi-equilibria of a generic game with the input structure.
Procedure: The algorithm obtains polynomials P(T ), giving the geometric resolution with deg T P = δ, deg T W ij < δ and degrees bounded by D in the parameters C (i) j 1 ...j r , which are encoded by a straight-line program of length O(D 2 (D + n 1 . . . n r δ log(D)r 2 n 4 (n 3 + rN))).
Proof. The first step of the algorithm consists in the computation of the polynomial R which is the specialization of the resultant of a system of multihomogeneous polynomials of respective multidegrees in which all the coefficients of the polynomial of multidegree d 0 corresponding to monomials not appearing in F 0 are substituted for 0 (see [43,Theorem 1]). This polynomial is obtained by applying an adapted version of the algorithm in [24, Theorem 5] (see Appendix A). The complexity of this algorithm is of order O(D 2 (D + n 1 . . . n r δ log(D)r 2 n 4 (n 3 + rN))) and it computes an slp for R whose length is of the same order.
The algorithm to compute a geometric resolution of the zero-dimensional variety defined by the system F is standard: the parametrizations of the points in the variety are obtained from the partial An slp which encodes these derivatives can be computed from the slp representing R within the same complexity order and length of the same order as the slp which encodes R (see [33]). Note that deg ] of the minimal polynomial of L. On the other hand, . We conclude that making the substitution (4) in R 0 and R ij (1 ≤ i ≤ r, 1 ≤ j ≤ n i ), polynomials which complete the geometric resolution of the variety defined by F (i) k = 0 with respect to the generic linear form L := 1≤i≤r 1≤j≤n i L ij x ij can be obtained. Now, we choose a separating linear form and we substitute its coefficients for the parameters L ij . As the multihomogeneous system F (i) k = 0 is generic, it has no zeroes in the hyperplanes x i0 = 0 (1 ≤ i ≤ r) and we can consider its zeroes as affine points by setting x i0 = 1 (1 ≤ i ≤ r). The linear form := 1≤i≤r x i1 separates these affine points. To see this, choose coefficient vectors for the polynomials F (i) k so as to obtain a specific system f (i) k with the maximum number of affine solutions, and take a linear form l ∈ Q[x ij ; 1 ≤ i ≤ r, 1 ≤ j ≤ n i ] separating these solutions. Now, making a linear change of variables in each group X i (1 ≤ i ≤ r), the linear form l maps to and the specific system considered leads to a system of the same structure in the new variables having the maximum number of affine roots and that are separated by . As is a separating linear form for a specific system, it is also separating for the generic one.
Hence, specializing , new polynomials giving a geometric resolution of the set of common zeros of the polynomials F (i) k in P n 1 × · · · × P n r are obtained. Finally, substituting for every 1 ≤ i ≤ r, 1 ≤ k ≤ n i and each J −i = j 1 . . . j i−1 j i+1 . . . j r with 0 ≤ j t ≤ n t for every t = i, the algorithm obtains polynomials P(T ), ∂P/∂T (T ) and [T ] such that the set of quasi-equilibria of the generic game in P n 1 × · · · × P n r is represented as follows: where K := Q(C (i) j 1 ...j r ) (note that the linear form still separates the quasi-equilibria of the generic game). The polynomials P, ∂P/∂T and W ij are encoded by an slp of length O(D 2 (D + n 1 . . . n r δ log(D)r 2 n 4 (n 3 + rN))) over Q, which is also the order of complexity of the whole computation. The upper bounds deg T P ≤ δ and deg T W ij < δ follow from the stated upper bounds for the degrees of R and R ij in the variable A (0)

Games with the maximum number of totally mixed Nash equilibria
The existence of games with the maximum possible number of totally mixed Nash equilibria, namely the multihomogeneous Bézout number δ of the associated polynomial equation system, was proved in [27]. In this subsection, we will give an algorithm to obtain a finite family of polynomial conditions (inequalities over the reals) ensuring that a given game satisfying those conditions has δ totally mixed Nash equilibria. To this end, we will use signed subresultant sequences as in [44]. We do not use the most sophisticated algorithmic version of this approach (see, for instance, [45]) because the polynomials we are working with depend on some parameters and are encoded by slp's. So, we will use the classical determinant-based construction of subresultants suitably adapted to our situation.
We will first recall some definitions and notation we will use (see, for example, [11, Sections 2.2.2 and 4.2.2]). For arbitrary polynomials P, Q ∈ R[T ] with P = 0, the Tarski query (also known as Sturm query) of Q for P is the number TaQ(Q , P) = #{t ∈ R : P(t) = 0, Q (t) > 0} − #{t ∈ R : P(t) = 0, Q (t) < 0} and the Cauchy index, I(Q /P) of the rational function Q /P is, informally, the number of ''jumps'' from −∞ to +∞ minus the number of ''jumps'' from +∞ to −∞ of the rational function Q /P. For polynomials P and Q over any field, if p > q are the degrees of P and Q respectively, then for 0 ≤ h ≤ q, the hth Sylvester-Habitch matrix of P and Q , SyHa The main result of this section is the following: Theorem 2. With our previous notation, there is a family of nδ  Proof. Consider a specific choice of payoff values c := (c (i) j 1 ...j r ) 1≤i≤r, 0≤j t ≤n t over R and assume that the polynomials P(c)(T ) and W ij (c)(T ) obtained from P(T ) and W ij (T ) by specializing the parameters at c provide a geometric resolution of the set of quasi-equilibria of the game with the given payoffs. Then, the totally mixed Nash equilibria of the game are those points (ξ 1 , . . . , ξ r ) ∈ R n 1 +1 × . . . × R n r +1 of the form where P := ∂P/∂T and S i := P + 1≤j≤n i W ij , having all their coordinates real and positive; that is, with t belonging to For (3)) by means of the substitution stated in (5). Let us consider the resultant of P(T ) and P (T ) regarded as polynomials in the variable T with coefficients in Q[C (i) j 1 ...j r ], where the subindices indicate the degrees in T of P and P respectively. Observe that, for every real vector c = (c (i) j 1 ...j r ) 1≤i≤r, 0≤j t ≤n t with S 0 (c) = 0, P(c)(T ) is a nonzero square-free polynomial of degree δ. Furthermore, the solution set of the system G (i) k (c) = 0, 1 ≤ i ≤ r, 1 ≤ k ≤ n i , is a zero-dimensional sub-variety of P n 1 × · · · × P n r with δ distinct points and P(c)(T ), W ij (c)(T ) (1 ≤ i ≤ r, 1 ≤ j ≤ n i ) give a geometric resolution of this variety. Therefore, if the condition S 0 (c) = 0 holds, the game with payoff vector c will have δ different totally mixed Nash equilibria if and only if, for every 1 ≤ i ≤ r, 1 ≤ j ≤ n i , #{t ∈ R : P(c)(t) = 0, (P W ij (c))(t) > 0} = δ.
Let us fix i and j, 1 ≤ i ≤ r, 1 ≤ j ≤ n i . Since the condition S 0 (c) = 0 implies that the degree of P(c) is δ, we have that (7) is equivalent to TaQ(P (c)W ij (c), P(c)) = δ. By [11, Proposition 2.57], this equality is the same as I((P (c)) 2 W ij (c)/ P(c)) = δ, which is equivalent to I(W ij (c)/P(c)) = δ, since P(c) is a square-free polynomial. By [11,Remark 2.55], the last identity implies that deg T (W ij (c)) = δ − 1. Moreover, provided that this degree condition is met, by [11,Theorem 9.12], identity (7) is equivalent to the fact that there are no sign changes in the sequence sRes δ (P(c), W ij (c)), sRes δ−1 (P(c), W ij (c)), . . . , sRes 0 (P(c), W ij (c)). Thus, we define where P, W ij are regarded as polynomials in the variable T with coefficients in Q[C (i) j 1 ...j r ] and p δ is the leading coefficient of P. Then, for every payoff vector c with S 0 (c) = 0, we have that (7) is equivalent to S (h) ij (c) > 0 for 1 ≤ h ≤ δ (since sRes δ−1 (P(c), W ij (c)) equals the coefficient of degree δ − 1 of W ij (c), the condition on the degree of W ij (c) is ensured by Note that each of the polynomials S 0 and sRes h (P, W ij ) for 0 ≤ h ≤ δ − 1 is the determinant of a matrix of size at most 2δ − 1 whose entries are polynomials in Q[C (i) j 1 ...j r ] of total degrees bounded by D and so, their degrees are bounded by 2δD.
Therefore, the degree of S Finally, we detail the successive steps of the algorithm and we estimate its complexity and the length of an slp encoding the output polynomials. First, from an slp of length L encoding P and W ij (1 ≤ i ≤ r, 1 ≤ j ≤ n i ), we obtain an slp of length O(δ 2 L) within the same complexity for the coefficients of P, P and W ij (1 ≤ i ≤ r, 1 ≤ j ≤ n i ) in the variable T (see [33,Lemma 21.25]). Then, we apply the division-free algorithm described in [46] in order to compute the determinants giving the resultant S 0 and the signed subresultants required. This algorithm computes, in fact, all the coefficients of the characteristic polynomial of a matrix and it proceeds recursively, computing at each step the characteristic polynomial of a matrix obtained by deleting a row and a column from the matrix considered in the previous step. In our case, for every  [46]. Therefore, for each 1 ≤ i ≤ r, 1 ≤ j ≤ n i , the algorithm obtains slp's of length O(δ 2 (δ 2 + L)) encoding the polynomials S (h) ij within complexity O(δ 4 ). The computation of an slp of length O(δ 2 (δ 2 + L)) encoding S 0 is achieved within the same complexity order. The overall complexity of the algorithm is then O(δ 2 (nδ 2 +L)).
Note that, with the same notation as in the previous theorem, for a generic game with the given structure (namely, any game whose payoff vector c satisfies S 0 (c) = 0) the conditions S (h) ij (c) > 0 are equivalent to the fact that the considered game has the maximum possible number of totally mixed Nash equilibria.

The set of totally mixed Nash equilibria of an arbitrary game
When dealing with a particular game with specific payoff values, evaluating the geometric resolution of the set of quasiequilibria of a generic game with the same structure may fail to describe the quasi-equilibria of the given game. This section is aimed at adapting the procedures previously developed in order to handle this problem.
In fact, the main idea of this section is to describe by means of geometric resolutions finite sets which contain the isolated (in the complex sense) totally mixed Nash equilibria of any game. In the context of computational algebra, there are already algorithms computing the isolated solutions for any system of polynomial equations. The possible advantage of our approach is that, as we take into account the multihomogeneous structure of the systems involved, as in [26], the order of complexity of our algorithms may be lower than the known ones when the multihomogeneous bound for the number of equilibria is small.

Games with a zero-dimensional set of quasi-equilibria
As before, consider an r-person noncooperative game in normal form in which the players have n 1 + 1, . . . , n r + 1 distinct available pure strategies respectively. Let c (i) := (c (i) j 1 ...j r ) 0≤j k ≤n k denote the payoff matrix to player i for every 1 ≤ i ≤ r. The polynomial equations defining the Nash equilibria of the game (see Section 2.2) can be obtained by specializing the coefficients of F Thus, if a := (a (ik) ) 1≤i≤r, 1≤k≤n i , the set of quasi-equilibria of the game is V a := {ξ := (ξ 1 , . . . , ξ r ) ∈ P n 1 × · · · × P n r /F Lemma 3. Under the previous notation, there exists an algorithm which decides whether V a has only finitely many points within complexity O(D 2 (n 1 . . . n r ) 2 δ(D + n 1 . . . n r δ log(D)r 2 n 4 (n 3 + rN))). Proof. Consider a generic polynomial of multidegree d 0 := (1, . . . , 1) in the groups of variables X 1 , . . . , X r , . . x rj r and the resultant R := Res(F 0 , F (1) 1 , . . . , F (1) n 1 , . . . , F (r) 1 , . . . , F (r) n r ). Let R a (A (0) j 1 ...j r ) be the polynomial obtained by substituting the coordinates of a = (a (ik) ) 1≤i≤r, 1≤k≤n i for A (ik) in R. Then V a is either zero-dimensional or empty if and only if R a is not identically zero: If V a is empty, the result is straightforward. If V a is zero-dimensional, there exists a multilinear polynomial f ∈ Q[X 1 , . . . , X r ] which does not vanish at any of the (finitely many) points of V a and therefore, R a does not vanish at the coefficients of f . On the other hand, if V a has positive dimension, any multilinear polynomial f has zeros in V a and, therefore, R a is identically zero.
The first step of the algorithm computes an slp of length L := O(D 2 (D + n 1 . . . n r δ log(D)r 2 n 4 (n 3 + rN))) which encodes the multihomogeneous resultant R by using the algorithm described in [24], adapted according to Appendix A below, within complexity of the same order as L. The specialization to obtain R a does not modify this complexity order.
Let f 0 ∈ Q[t][X 1 , . . . , X r ] be the polynomial obtained by specializing the variables A (0) j 1 ...j r in F 0 into successive powers of a new variable t: For every ξ := (ξ 1 , . . . , ξ r ) ∈ P n 1 × · · · × P n r , we have which is a nonzero polynomial due to the fact that there exists at least one choice of j 1 , . . . , j r for which the product ξ 1j 1 . . . ξ rj r is not 0. Now, if V a is a finite set, let ∆(t) := ξ ∈V a f 0 (ξ )(t). Note that there exists t 0 ∈ Q with ∆(t 0 ) = 0. Then f 0 (t 0 ) ∈ Q[X 1 , . . . , X r ] does not vanish at any point of V a and therefore the polynomial R a,t ∈ Q[t] obtained by specializing R a following (8) does not vanish at t 0 . Then R a,t is not the zero polynomial.
To decide whether R a ∈ Q[A (0) j 1 ...j r ] is zero or not, it suffices to decide whether R a,t ∈ Q[t] is zero or not. Taking into account that deg(R a,t ) ≤ ( 1≤i≤r (n i + 1) − 1)δ, this task can be achieved by evaluating R a,t at ( 1≤i≤r (n i + 1))δ different values of t, which is done by substituting the powers of these values for A (0) j 1 ...j r as in (8) in the slp for R a . The overall complexity of this procedure is ( 1≤i≤r (n i + 1)) + L ( 1≤i≤r (n i + 1))δ.
Once we know that V a is zero-dimensional, even though the game does not have the maximum number of quasiequilibria, we can obtain a geometric resolution of its set of affine quasi-equilibria V aff a := {ξ ∈ V a : ξ i0 = 0 ∀ 1 ≤ i ≤ r} by means of a deterministic algorithm within a complexity polynomial in the same parameters as in the generic case.
We will use the following notation: will denote the polynomial obtained from F by specializing, as before, all the variables, except for A (0) 0 , into successive powers of a variable t.

Algorithm AffineQuasiEquilibria
Input: A family of payoff matrices c (i) := (c (i) j 1 ...j r ) 0≤j k ≤n k for 1 ≤ i ≤ r defining a game with a finite number of quasi-equilibria. Output: A geometric resolution of the set of affine quasi-equilibria of the game.

Compute a
..j r and set a for the vector with these entries.

Specialize A (ik)
= a (ik) in R to obtain the polynomial R a (A (0) j 1 ...j r ).

Compute the leading coefficient of R a in the variable A
(0) 0...0 and divide R a by this coefficient, obtaining a polynomial R aff a .

Specialize
ij (where the index j is in the ith place) for 1 ≤ j ≤ n i and A (0) j 1 ...j r = 0 otherwise in R aff a , obtaining a polynomial P a . 6. Compute the first nonzero subresultant of P 7. Compute P a = P a / gcd( P a , ∂ P a ∂A (0) 0 ) and its partial derivatives.

Evaluate the variables A (0)
ij for 1 ≤ i ≤ r, 1 ≤ j ≤ n i , at (−τ k ) 0≤k≤n−1 in the polynomial P a and its partial derivatives to obtain the polynomials giving the geometric resolution. Theorem 4. Algorithm AffineQuasiEquilibria computes a geometric resolution of the set of affine quasi-equilibria of the game with r players having n 1 + 1, . . . , n r + 1 pure strategies respectively and payoff matrices c (1) , . . . , c (r) within complexity O(δ 8 D 2 (D + n 1 . . . n r δ log(D)r 2 n 5 (n 3 + rN))) provided that the associated set of quasi-equilibria is zero-dimensional.
]. For a given coefficient vector a (0) , F a (a (0) ) = 0 if and only if there is ξ ∈ V a such that F 0 (a (0) , ξ ) = 0; that is, if and only if F 0 (a (0) ), F (1) 1 (a (11) ), . . . , F (r) n r (a (rn r ) ) have a common root in P n 1 × · · · × P n r . But this is equivalent to the fact that Res(F 0 , F (1) 1 , . . . , F (r) n r ) vanishes at a (0) , a (11) , . . . , a (rn r ) or, equivalently, that R a (a (0) ) = 0. Then To describe the set V aff a of affine quasi-equilibria of the game, we compute R aff Consider the generic form f 0 : After specializing R aff a as follows: Computation of R aff a : Let t 0 ∈ Q be obtained as in the proof of Lemma 3 so that R a,t (t 0 ) = 0, and let R ..0 ] be the (nonzero) polynomial obtained from R a after specializing it as in (8) for every (j 1 , . . . , j r ) = (0, . . . , 0) setting t = t 0 .
Because of (9), deg(R Computation of P a : This polynomial is obtained by applying the well-known subresultant-based procedure for the computation of the gcd of two polynomials (see, for instance, [48]).
0 ∈ Q such that G (t) (a (0) 0 , τ ) = 0. This enables us to compute the quotient P a by applying the algorithm in [47]. The complexity of this step is of order O(δ 8 L).
Computation of a geometric resolution: Observe that the linear form whose coefficients are (−τ k ) 0≤k≤n−1 is a separating linear form for V aff a . As in the proof of Theorem 1, the algorithm proceeds to compute the partial derivatives of P a and evaluate P a and its derivatives at the coefficients of . This may be done within O(δ 8 Ln) operations.
The overall complexity of the algorithm is O(δ 8 Ln + δ 4 n 2 ) = O(δ 8 D 2 (D + n 1 . . . n r δ log(D)r 2 n 5 (n 3 + rN))). Now, using standard methods (see, for instance, [49,50]), we are able to give a description and to compute the cardinality of the set of totally mixed Nash equilibria of a game with zero-dimensional set of quasi-equilibria from the geometric resolution given by Theorem 4. Proposition 5. Following the previous notation, there is an algorithm which computes the number of totally mixed Nash equilibria of a game with r players having n 1 + 1, . . . , n r + 1 pure strategies respectively within complexity O(δ 9 D 2 (D + n 1 . . . n r δ log(D)r 2 n 5 (n 3 + rN))) provided that the associated set of quasi-equilibria of the game is zero-dimensional. Proof. Using Theorem 4, let p and w ij (1 ≤ i ≤ r, 1 ≤ j ≤ n i ) be the polynomials giving the geometric resolution of V aff a . Then, the totally mixed Nash equilibria of the game are the points (ξ 1 , . . . , ξ r ) with ξ i = (p (t)/s i (t), w i1 (t)/s i (t), . . . , w ir (t)/s i (t)), where s i = p + n i j=1 w ij for i = 1, . . . , r, and t is a root of p, having all their coordinates real and positive. Therefore, the number of totally mixed Nash equilibria of the game equals the cardinality of the union of the sets Once we have p, p and w ij ({1 ≤ i ≤ r, 1 ≤ j ≤ n i }) encoded in dense form (which can be obtained by fast interpolation techniques as explained in [51]), by using the algorithm in [50,Section 3.3], it is possible to compute this cardinality within complexity O(nδ 3 ).
Remark 6. The algorithm of Proposition 5 can be adapted to compute the list of Thom encodings of the real roots of the polynomial p (see [52] for a definition) in the geometric resolution of the set of affine quasi-equilibria of the game leading to totally mixed Nash equilibria within the same complexity.

Computing the isolated affine quasi-equilibria of an arbitrary game
When we are dealing with an arbitrary game, it may happen that the set V a of its quasi-equilibria has positive dimension and, therefore, the polynomial R a introduced in the previous subsection (see the proof of Lemma 3) is identically zero. However, the following probabilistic algorithm computes the isolated affine quasi-equilibria of the game.

Algorithm IsolatedAffineQuasiEquilibria
Input: A family of payoff matrices c (i) Output: A geometric resolution of a set including the isolated affine quasi-equilibria of the game.

Compute a
..j r and set a for the vector with these entries.
8. From the polynomial P obtain the required geometric resolution.

Theorem 7. Algorithm IsolatedAffineQuasiEquilibria is a probabilistic procedure which computes a geometric resolution of a finite
set of points including the isolated affine quasi-equilibria of the game with r players having n 1 + 1, . . . , n r + 1 pure strategies respectively and payoff matrices c (1) , . . . , c (r) within complexity O(D 4 δ 3 (D + n 1 . . . n r δ log(D)r 2 n 4 (n 3 + rN))).
Proof. The deformation procedure we use was applied in [26]. For the sake of completeness, we are going to explain it briefly. We keep our previous notation.
Consider a sufficiently generic coefficient vector b := (b (ik) ) 1≤i≤r,1≤k≤n i such that R b ≡ 0 (b can be either chosen at random or effectively constructed as the coefficient vector of a system with δ many common roots). Then, if u is a new be the polynomial obtained from R a+u(b−a) by specializing it as in (10) and let L := ] with P(u, A (0) ) | u=0 ≡ 0 and set P := P | u=0,A (0) has dimension at least 1. Then, for each isolated point ξ of V aff a , (0, ξ ) ∈ A n+1 lies in an irreducible component C of V u such that u ∈ I(C ). Therefore P | A (0) 0 =−L ∈ I(C ) and P | T =L vanishes at ξ . Then P is a multiple of the minimal polynomial of L over the set of isolated points of V aff a .
are such that p (u) ≡ 0 for some 0 ≤ ≤ D, then := max{k : u k divides p ∀ 0 ≤ ≤ D}. The procedure for the computation of P from an slp encoding R runs as follows: First, a + u(b − a) is computed within 3N operations and then, the slp for R is specialized in a + u(b − a) and according to (10). If L is the length of an slp encoding R, an slp of length 3N + L for P a+u(b−a) is obtained. Then an slp encoding the coefficients p (u) (0 ≤ ≤ δ) is obtained by interpolation, which takes O(δ 2 (N +L)) operations. Afterwards, for every 0 ≤ ≤ δ, an slp which encodes the coefficients of p (u) = D k=0 p k u k is obtained, within complexity O(D 2 δ 2 (N + L)), in order to compute = min{k : p k = 0}. To decide whether each of the multivariate polynomials p k ∈ Q[A (0) ij ] encoded by an slp is zero or not, we apply the probabilistic Zippel-Schwartz zero test (see [53]). In this way, = min{ : 0 ≤ ≤ δ} is computed. The overall complexity of this step is O(D 2 δ 3 (N + L)). The last step of this procedure obtains an slp for P = δ =0 (−1) p T from the slp's encoding p (0 ≤ ≤ δ) within the same order of complexity.
Finally, from the polynomial P, the algorithm obtains a geometric resolution for a finite set of points including the isolated points of V aff a in the same way we showed in the proof of Theorem 1, except that the linear form is now taken at random, obtaining a description for the isolated affine quasi-equilibria of the game.
Proceeding as in the previous subsection, now it is possible to obtain an upper bound on the number of isolated (in the complex space) totally mixed Nash equilibria of the game and the corresponding Thom encodings within the same order of complexity as in Theorem 7.

A final comment on complexities
The upper bound stated in Proposition 9 in Appendix B below shows that all the algorithms presented in this paper are polynomial in the number of strategies n 1 , . . . , n r of the r players, and the generic number δ of totally mixed Nash equilibria of a game with the considered structure.
We point out that the polynomial dependence of our complexity estimates in the parameter δ is due to the use of the multihomogeneous structure of the polynomial systems involved. This is not the case for general algorithms, which only take into account degree bounds for the polynomials leading to complexity estimates in terms of the classical Bézout number, which in our situation equals (r − 1) n 1 +···+n r . Although it is not easy to give a precise estimate of the multihomogeneous Bézout number in terms of r and n 1 , . . . , n r , the following table borrowed from [27] illustrates its order of magnitude when n 1 = · · · = n r . In each box of the

Conclusions
In this paper, we showed a deterministic algorithm to compute a geometric resolution of the totally mixed Nash equilibria of a generic game in normal form with a fixed structure within a complexity which is cubic in the number of these equilibria. This complexity is due to the use of straight-line programs to encode multivariate polynomials and an efficient procedure to compute multihomogeneous resultants.
We also presented a deterministic algorithm to compute polynomial inequality conditions on the payoff values under which a game has the maximum possible number of this kind of equilibria.
Then, we designed symbolic deterministic procedures to describe the set of isolated totally mixed Nash equilibria of a game and to compute their exact number provided the set of quasi-equilibria of the game is finite.
The complexity of all our algorithms is polynomial in the number of players, the number of each player's strategies and the number of totally mixed Nash equilibria of a generic game with the considered structure. For generic games, the theoretical cost of our algorithms is comparable to the one that could be obtained by applying the best probabilistic algorithms dealing with parametric polynomial systems (see [25]).
We expect that the techniques in [54], where the authors explain how to implement algorithms handling straight-line programs efficiently, could be adapted to a future implementation of our algorithms. The application of these techniques might also decrease the exponents in the complexity of the algorithms proposed to deal with specific payoff values without introducing extra probabilistic aspects. These implementation issues and the design of a deterministic algorithm for arbitrary games is the matter of future research.
(I.a) If m i ≥ 2 for every 1 ≤ i ≤ r, (up to renaming variables and polynomials) each of the resultants Res(G (i) kj ) involves a family of polynomials satisfying the conditions in (III).
(I.b) Without loss of generality, assume now that m 1 = 1. Here, when computing Res((G (i) k1 ) 1≤i≤r,1≤k≤m i ) we can discard the first group of variables. Then, the resultant involves m polynomials in r − 1 groups of m 2 + 1, . . . , m r + 1 variables each with m i polynomials with multidegree (1, . . . , 0, . . . , 1), where the 0 is in the (i − 1)th coordinate for 2 ≤ i ≤ r, and one with multidegree (1, . . . , 1). If, for every 2 ≤ i ≤ r, m i < 1≤j≤r, j =i m j , since m 1 = 1 we deduce that m i ≤ 2≤j≤r, j =i m j and so, the polynomial system obtained is of the form (I) but with one group of variables less than the original one. On the other hand, if m i = 1 + 2≤j≤r, j =i m j for some 2 ≤ i ≤ r, then m j < m i for every j = i. Therefore, the unique essential subset is {(i, k) : 1 ≤ k ≤ m i } and the resultant to be computed is the resultant of the corresponding family of m i polynomials of multidegree (1, . . . , 1) in r − 2 groups of m 2 + 1, . . . , m i−1 + 1, m i+1 + 1, . . . , m r + 1 variables each, which is the situation in (II).
If the conditions in (II) are met, all the coordinates of the multidegrees are not zero and so, we can apply the algorithm in [24] for the computation of the resultant.
To analyze (III), let us consider first the case when r = 2. Here, the assumption on the numbers m i implies that m 1 = m 2 := M.
(III.a) We consider the resultant of M polynomials with multidegrees (0, 1) and M polynomials with multidegrees (1, 0) in two groups of M and M + 1 variables respectively. Now the unique essential set is the corresponding to the first M polynomials and, therefore, as they are linear forms, the resultant equals the determinant of their coefficient matrix.
Assume now that r > 2. Note that the equality m i = j =i m j may be valid for at most one value i. If, on the contrary, m i 1 = j =i 1 m j and m i 2 = j =i 2 m j hold for i 1 = i 2 , it follows that j =i 1 ,i 2 m j = 0, which implies r = 2. Let G (i) k (1 ≤ i ≤ r, 1 ≤ k ≤ m i ) be a family of polynomials satisfying the conditions in (III).
In order to finish the proof, we will show that #J 1 ≤ n 1 δ. Since δ equals the cardinality of the set J 0 introduced in (2), we will compare the cardinalities of both sets J 1 and J 0 . To this end, we define the following map from J 1 to J 0 : with a given n-tuple j := (1, j 12 , . . . , j 1n 1 , . . . , j r1 , . . . , j rn r ) ∈ J 1 we associate the n-tuple j ∈ J 0 which is obtained by exchanging the first coordinate of j (which equals 1) with the first one which is different from 1 and is located beyond the n 1 th coordinate. Note that a necessary condition for two distinct n-tuples in J 1 to lead to the same n-tuple in J 0 by means of this assignment is that they coincide in all of their coordinates except for two of them located among the n 1 coordinates n 1 + 1, . . . , 2n 1 . Moreover, the vector consisting of these n 1 coordinates must be of the form (1, . . . , 1, j hk , . . .) for both of them (possibly with no 1 at the beginning) and so, they can only differ in the length of the string of 1's in this vector, which ranges between 0 and n 1 − 1. We conclude that each element of J 0 is the image of at most n 1 elements of J 1 . It follows that #J 1 ≤ n 1 #J 0 as we wanted to prove.