An open game (Ghani, Hedges, Winschel & Zahn, Definition 3) is a tuple of
- a set of strategy profiles;
- a play function (states in, moves out);
- a coplay function (utilities from the future in, utilities for the past out);
- a best-response function , giving for each context — a state and a continuation saying how outcomes will be valued — the relation ” is a best response to “.
Forgetting , the pair is a -parametrised lens : an open game is a parametric lens (strategies = parameters) plus a best-response relation. A strategy profile is a Nash equilibrium in context if .
Sources: Ghani, Hedges, Winschel & Zahn, Compositional Game Theory arXiv:1603.04641 (notes) Definitions 3–10, Theorem 1; Bolt, Hedges & Zahn, Bayesian open games arXiv:1910.03656 (notes); Capucci et al., Towards Foundations of Categorical Cybernetics arXiv:2105.06332 (notes) §4 (open games as parametrised optics with a selection functor); Capucci, Ghani, Ledent & Nordvall Forsberg arXiv:2105.06763 (notes).
Atomic games and composition
- A decision (Definition 4): strategies are functions , play is , coplay is trivial, and iff . More generally, any selection function gives a decision (Definition 5).
- Functions , lift to strategically trivial games (Definition 7), and counits close a play–coplay loop by handing a player’s own outcome back as utility (Definition 8).
- Sequential (Definition 9) and parallel (Definition 10) composition: play composes forwards, coplay backwards as for lenses, strategy sets multiply, and best responses are defined so that a profile is an equilibrium of the composite iff each part is a best response in the context the other part creates.
Theorem 1 (after quotienting strategy sets by isomorphism). Open games form a symmetric monoidal category , and string diagrams in it describe games built from their parts.
Three lens-shaped frameworks, three backward passes
| framework | forward | backward pass carries | ”equilibrium” | note |
|---|---|---|---|---|
| gradient-based learning | model | a gradient | stationary point | Gradient-Based Learning with Parametric Lenses |
| statistical games | generative model | a posterior | free-energy minimum | Statistical Game |
| open games | play | coutility + a best response | Nash equilibrium | this note |
All three are with different and different extra structure (Capucci et al.). A statistical game is a one-player degenerate case — “game” there means “a lens with an objective attached”, not a strategic interaction. Bayesian open games (Bolt, Hedges & Zahn) replace functions by Markov kernels, giving incomplete-information games with Bayesian updating in the backward pass.
Why machine learning cares
A GAN is a two-player zero-sum game: generator and discriminator are two players whose objectives have opposite signs. A single scalar objective descended by every parameter (as in variational inference) cannot express this; an open game can, and its solution concept is Nash rather than stationarity. Actor–critic reinforcement learning is a general-sum (Stackelberg) game of the same shape.
Docs: plain Julia — Catlab has no dedicated API for this; related: Catlab v0.16 docs · GATlab standard library
# A decision (Definition 4) and the Nash condition for a 2×2 simultaneous game.
# Prisoner's dilemma, payoffs (row, column); C = cooperate, D = defect.
payoff = Dict((:C, :C) => (-1, -1), (:C, :D) => (-3, 0), (:D, :C) => (0, -3), (:D, :D) => (-2, -2))
moves = (:C, :D)
best_responses(k) = (m = maximum(k, moves); [y for y in moves if k(y) == m]) # arg max k
is_nash(σ) = σ[1] in best_responses(y -> payoff[(y, σ[2])][1]) &&
σ[2] in best_responses(y -> payoff[(σ[1], y)][2])
[σ for σ in Iterators.product(moves, moves) if is_nash(σ)] # [(:D, :D)]import Mathlib
-- An open game (X, S) → (Y, R), Ghani–Hedges–Winschel–Zahn Definition 3
structure OpenGame (X S Y R : Type) where
Strat : Type
play : Strat × X → Y
coplay : Strat × X × R → S
bestResponse : X × (Y → R) → Strat → Strat → Prop
def OpenGame.isNash {X S Y R : Type} (G : OpenGame X S Y R) (x : X) (k : Y → R) (σ : G.Strat) : Prop :=
G.bestResponse (x, k) σ σ-- A single decision as an open game, and its best-response check
data Move = C | D deriving (Eq, Show, Enum, Bounded)
payoff :: (Move, Move) -> (Int, Int)
payoff (C, C) = (-1, -1); payoff (C, D) = (-3, 0)
payoff (D, C) = (0, -3); payoff (D, D) = (-2, -2)
argmaxes :: (Move -> Int) -> [Move]
argmaxes k = let m = maximum (map k [minBound ..]) in [ y | y <- [minBound ..], k y == m ]
isNash :: (Move, Move) -> Bool
isNash (a, b) = a `elem` argmaxes (\y -> fst (payoff (y, b)))
&& b `elem` argmaxes (\y -> snd (payoff (a, y)))
-- filter isNash [ (a, b) | a <- [C, D], b <- [C, D] ] == [(D, D)]