GameTheory Package for Equilibrium Analysis
- GameTheory is a Macaulay2 package that uses algebraic, combinatorial, polyhedral, and algebraic-statistical methods to compute various equilibrium notions in finite normal-form games.
- It encodes finite games as lists of payoff tensors, enabling precise analysis of Nash, correlated, dependency, and conditional independence equilibria.
- The package supports symbolic perturbation, mixed-volume bounds, and CI model saturation, offering deep geometrical insights into equilibrium structures.
GameTheory is a package for Macaulay2 for computing equilibria in finite normal-form games. In version 1.0, available since Macaulay2 version 1.25.05, it organizes four equilibrium notions—Nash, correlated, dependency, and conditional independence equilibria—within a single framework that uses algebraic, combinatorial, polyhedral, and algebraic-statistical methods rather than a single numerical paradigm (Connelly et al., 22 Jul 2025). A finite game is encoded as a list of payoff tensors, and the package exposes different computational objects according to the equilibrium notion under study: polynomial rings and ideals for Nash equilibria, polyhedra for correlated equilibria, determinantal ideals and Konstanz matrices for dependency equilibria, and graphical-model conditional-independence ideals together with saturated intersections for conditional independence equilibria.
1. Scope, representation, and package entry points
The package works with finite normal-form games. An -player game is encoded by a list
of payoff tensors, each of format , where is the number of pure strategies for player . The entry is the payoff to player when player chooses strategy . In this representation, a game is an ordered list of tensors; games can be constructed manually with zeroTensor {d_0,...,d_(n-1)} and explicit entry assignment, or generated with randomTensor and randomGame. The default coefficient ring is , and it can be changed with CoefficientRing => R (Connelly et al., 22 Jul 2025).
The package is loaded by the standard Macaulay2 command:
1 2 3 4 |
needsPackage "GameTheory" <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>i</mi></mrow><annotation encoding="application/x-tex">i</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6595em;"></span><span class="mord mathnormal">i</span></span></span></span>4m2 R = nashEquilibriumRing Y; J = nashEquilibriumIdeal(R, Y); |
and the resulting ideal satisfies
0
Its decomposition reveals a unique totally mixed Nash equilibrium at
1
but as a double point of the equilibrium ideal (Connelly et al., 22 Jul 2025).
The package also supports symbolic perturbation. In the same example, after perturbing one payoff tensor over 2, the last generator of the decomposition is
3
From this, the paper infers two totally mixed Nash equilibria for 4, one double equilibrium at 5, and none otherwise (Connelly et al., 22 Jul 2025).
For generic games, the package also addresses upper bounds for the number of isolated totally mixed Nash equilibria. By Bernstein’s theorem, the count is bounded by the mixed volume of Newton polytopes. The command deltaList constructs the relevant polytope list, numberTMNE {d_0,...,d_(n-1)} computes the mixed-volume count via a vector bundle/Chern class formula, and blockDerangements computes the corresponding combinatorial count. For a generic 6-game,
7
The paper notes that for 8, numberTMNE and blockDerangements remain fast whereas direct mixedVolume(deltaList {3,3,3}) is impractically slow (Connelly et al., 22 Jul 2025).
3. Correlated equilibria as convex polyhedra
For correlated equilibria, the package replaces independent mixed strategies by a joint probability distribution. If the game has format 9, then the variable
0
represents the probability of the pure strategy profile 1. These variables lie in the simplex
2
with nonnegativity and normalization constraints (Connelly et al., 22 Jul 2025).
The correlated equilibrium inequalities are linear: 3 for all players 4 and pure strategies 5. Together with simplex constraints, these define the correlated equilibrium polytope 6 (Connelly et al., 22 Jul 2025).
The package uses probabilityRing Di to construct the ring of joint-probability variables and correlatedEquilibria X to return a Polyhedron object through Polyhedra.m2. In the Bach or Stravinsky example, the paper identifies three Nash equilibria inside the correlated equilibrium set: two pure equilibria,
7
and one totally mixed equilibrium,
8
A mediator that recommends 9 on heads and 0 on tails yields a Pareto-optimal correlated equilibrium. The computed polytope 1 is 3-dimensional with five vertices, and the paper interprets it geometrically as a double pyramid over a triangle associated with the Nash equilibria (Connelly et al., 22 Jul 2025).
4. Dependency equilibria and the Spohn variety
Dependency equilibria are defined on joint distributions but impose a different optimality condition from correlated equilibria. For player 2, conditioned on choosing pure strategy 3,
4
For 5 in the interior of the simplex, 6 is a dependency equilibrium if
7
Because all pairwise inequalities hold, one obtains
8
This condition is encoded algebraically by the Spohn variety 9, defined by the vanishing of the 0 minors of the Spohn matrices 1 (Connelly et al., 22 Jul 2025).
The corresponding commands are spohnMatrices(PR,X) and spohnIdeal(PR,X). For generic payoff tensors, the paper recalls a theorem stating that the Spohn variety is irreducible of codimension
2
and degree
3
and that its intersection with the Segre variety inside the open simplex is exactly the set of totally mixed Nash equilibria. For a random 4-game, the package verifies
5
as predicted by the generic theory (Connelly et al., 22 Jul 2025).
An alternative representation uses the Konstanz matrix 6, characterized by
7
The package provides konstanzMatrix(PR,X) for this representation. In Bach or Stravinsky, the Spohn variety is reducible, and the paper verifies computationally that if 8 is the vectorization of the probability tensor 9, then
0
matching the theoretical definition (Connelly et al., 22 Jul 2025).
5. Conditional independence equilibria and graphical-model structure
The final equilibrium notion combines dependency equilibria with conditional independence constraints from algebraic statistics. A conditional independence statement has the form
1
for disjoint sets 2 of players, and is encoded by the standard 3-minor equations
4
Given a set 5 of such statements, the corresponding CI model 6 is the variety cut out by those equations (Connelly et al., 22 Jul 2025).
The package computes these ideals through GraphicalModels.m2. The command ciIdeal(PR, Stmts) accepts CI statements encoded as {A,B,C}, while ciIdeal(PR, G) uses the global Markov property of an undirected graph. Interoperability utilities include toMarkovRing, mapToMarkovRing, and mapToProbabilityRing. In a 7-game, the line graph on three vertices yields the same CI ideal as the statement that player 1 is independent of player 3 given player 2 (Connelly et al., 22 Jul 2025).
The equilibrium object is the Spohn CI variety
8
where 9 is the union of coordinate and marginal hyperplanes removed before closure. The main command is spohnCI(PR, X, Stmts) or spohnCI(PR, X, G). Internally, the method computes spohnIdeal(PR,X), intersects it with the CI model using intersectWithCImodel, and saturates by the hyperplanes
0
The paper notes that this saturation can be expensive. The implementation uses the Bayer strategy for saturation, and Verbose => true prints progress messages such as “Completed step 1 of saturating CI ideal” (Connelly et al., 22 Jul 2025).
A practical caveat is indexing. GraphicalModels.m2 uses one-based vertex labels, whereas GameTheory uses zero-based player and strategy indices. The package therefore permits relabeling graph vertices, including symbolic names such as Alice, Bob, and Claire, or explicit relabeling to {0,1,2} (Connelly et al., 22 Jul 2025).
6. Computational style, interoperability, and limitations
GameTheory does not force a single algorithmic paradigm. Nash and dependency equilibria are treated symbolically via rings, ideals, dimensions, degrees, decompositions, and determinantal structure; correlated equilibria are treated polyhedrally through linear inequalities and convex geometry; conditional independence equilibria add graphical-model ideals and saturation procedures (Connelly et al., 22 Jul 2025). This division of labor is also reflected in dependencies: the package explicitly relies on Polyhedra.m2 for correlated equilibria and GraphicalModels.m2 for conditional independence models.
Several limitations are stated directly. Direct mixed-volume computation can be too slow for larger formats, as illustrated by mixedVolume(deltaList {3,3,3}). Saturation in spohnCI and intersectWithCImodel can be computationally expensive. The package also focuses on algebraic and combinatorial formulations rather than classical numerical equilibrium algorithms such as Lemke–Howson (Connelly et al., 22 Jul 2025). A plausible implication is that its natural use case is structural analysis of finite normal-form games inside the Macaulay2 ecosystem, rather than large-scale numerical equilibrium computation.
This specialization distinguishes GameTheory from other game-theoretic software lines. “Game Theory Explorer” is a browser-based tool for creating extensive-form and strategic-form games and computing all Nash equilibria of two-player games (Savani et al., 2014). GPGame is an R package on CRAN for finding pure Nash equilibria in expensive black-box games by Bayesian optimization (Picheny et al., 2016). ZERO is an open-source C++ library for Reciprocally Bilinear Games and related mathematical-programming games (Dragotto et al., 2021). Arena is a prototype programmable framework for tournaments of heterogeneous games played by agents across multiple rounds and game types (Lawlor et al., 2018). Against that background, GameTheory occupies a distinct niche: finite normal-form games studied through algebraic geometry, polyhedral computation, and algebraic statistics rather than browser interaction, black-box optimization, mathematical-programming equilibrium search, or agent-based simulation.
7. Mathematical profile and place within equilibrium computation
The package’s defining feature is the coexistence of four equilibrium notions under one formal representation of a finite normal-form game. Nash equilibria appear as solutions of multilinear polynomial systems; correlated equilibria as points of a convex polytope; dependency equilibria as points on the Spohn variety cut out by 1 minors; and conditional independence equilibria as saturated intersections of dependency-equilibrium structure with CI models from graphical models (Connelly et al., 22 Jul 2025). This architecture places equilibrium computation inside Macaulay2’s native strengths: ideal theory, decomposition, dimension and degree calculations, polyhedral geometry, and symbolic perturbation.
The examples in the paper show that the package is designed not only to return equilibria but to expose their geometry. In the McLennan 2-game, the unique totally mixed Nash equilibrium appears as a double point of the equilibrium ideal. In Bach or Stravinsky, the correlated equilibrium set becomes a 3-dimensional polyhedron with five vertices, while the dependency-equilibrium variety is reducible in the nongeneric case and becomes prime after perturbation. In random 3-games, generic codimension and degree predictions for the Spohn ideal are verified computationally (Connelly et al., 22 Jul 2025). These examples indicate that the package is aimed at analysis of equilibrium structure as much as at equilibrium detection itself.
In that sense, GameTheory is best understood as a Macaulay2 package for the geometry and combinatorics of equilibria in finite normal-form games. Its contribution is not to replace general-purpose numerical solvers, but to provide a unified symbolic and polyhedral environment in which Nash, correlated, dependency, and conditional independence equilibria can be represented, computed, perturbed, decomposed, and compared within a common algebraic framework (Connelly et al., 22 Jul 2025).