Documentation

CslibFrontier.GameTheory.Bimatrix.BestResponsePolytope

Best response polytopes and the odd number of Nash equilibria #

For a bimatrix game G with payoff matrices A B : Matrix M N ℝ, the best response polytopes of [vS07], equation (3.6), are P = {x ∈ ℝ^M | x ≥ 0, Bᵀ x ≤ 1} and Q = {y ∈ ℝ^N | A y ≤ 1, y ≥ 0}. Both are written as systems of inequalities with rows indexed by the labels M ⊕ N (BimatrixGame.matP, BimatrixGame.rhsP, BimatrixGame.matQ, BimatrixGame.rhsQ): the label i : M of x ∈ P means x i = 0 and the label j : N means (xᵀ B) j = 1, while the label i : M of y ∈ Q means (A y) i = 1 and j : N means y j = 0.

When all payoffs are positive, a nonzero completely labelled pair (x, y) ∈ P × Q rescales to a Nash equilibrium (x / ∑ x, y / ∑ y) (BimatrixGame.isNash_of_completelyLabeled), and every Nash equilibrium arises this way (BimatrixGame.IsNash.completelyLabeled). For a nondegenerate game the systems are nondegenerate (BimatrixGame.IsNondegenerate.isNondegenerateSystem_matP), so the completely labelled vertex pairs are exactly the artificial equilibrium (0, 0) and the images of the Nash equilibria (BimatrixGame.setOf_completelyLabeled_eq). Combined with the parity of completely labelled vertex pairs in the Lemke–Howson graph (Cslib.GameTheory.LemkeHowson.even_ncard_completelyLabeled) this gives [vS07], Corollary 3.7: a nondegenerate bimatrix game has an odd number of Nash equilibria (BimatrixGame.IsNondegenerate.odd_ncard_isNash); in particular it has one (BimatrixGame.IsNondegenerate.exists_isNash).

The argument is the undirected parity argument behind the Lemke–Howson algorithm [LH64]; it does not formalize the algorithm's running time, the orientation of its paths, or the membership of two-player Nash in PPAD.

Main definitions #

Main results #

References #

The best response polytopes #

def Cslib.GameTheory.BimatrixGame.matP {M : Type u_1} {N : Type u_2} (G : BimatrixGame M N) [DecidableEq M] :
Matrix (M ⊕ N) M ℝ

The constraint matrix of the best response polytope P = {x | x ≥ 0, Bᵀ x ≤ 1} of player 1, with rows labelled by M ⊕ N ([vS07], equation (3.6)).

def Cslib.GameTheory.BimatrixGame.rhsP (M : Type u_1) (N : Type u_2) :
M ⊕ N → ℝ

The right-hand side of the best response polytope P: 0 on M, 1 on N.

def Cslib.GameTheory.BimatrixGame.matQ {M : Type u_1} {N : Type u_2} (G : BimatrixGame M N) [DecidableEq N] :
Matrix (M ⊕ N) N ℝ

The constraint matrix of the best response polytope Q = {y | A y ≤ 1, y ≥ 0} of player 2, with rows labelled by M ⊕ N ([vS07], equation (3.6)).

def Cslib.GameTheory.BimatrixGame.rhsQ (M : Type u_1) (N : Type u_2) :
M ⊕ N → ℝ

The right-hand side of the best response polytope Q: 1 on M, 0 on N.

Player 2's polytope matrix matQ is player 1's polytope matrix for G.swap with M ⊕ N reindexed by Equiv.sumComm M N.

Player 2's right-hand side rhsQ is rhsP N M composed with Equiv.sumComm M N.

@[simp]
theorem Cslib.GameTheory.BimatrixGame.rhsP_inl {M : Type u_1} {N : Type u_2} (i : M) :
rhsP M N (Sum.inl i) = 0
@[simp]
theorem Cslib.GameTheory.BimatrixGame.rhsP_inr {M : Type u_1} {N : Type u_2} (j : N) :
rhsP M N (Sum.inr j) = 1
@[simp]
theorem Cslib.GameTheory.BimatrixGame.rhsQ_inl {M : Type u_1} {N : Type u_2} (i : M) :
rhsQ M N (Sum.inl i) = 1
@[simp]
theorem Cslib.GameTheory.BimatrixGame.rhsQ_inr {M : Type u_1} {N : Type u_2} (j : N) :
rhsQ M N (Sum.inr j) = 0
theorem Cslib.GameTheory.BimatrixGame.matP_mulVec {M : Type u_1} {N : Type u_2} [Fintype M] {G : BimatrixGame M N} [DecidableEq M] (x : M → ℝ) :
theorem Cslib.GameTheory.BimatrixGame.matQ_mulVec {M : Type u_1} {N : Type u_2} [Fintype N] {G : BimatrixGame M N} [DecidableEq N] (y : N → ℝ) :
G.matQ.mulVec y = Sum.elim (G.A.mulVec y) (-y)
@[simp]
theorem Cslib.GameTheory.BimatrixGame.matP_mulVec_inl {M : Type u_1} {N : Type u_2} [Fintype M] {G : BimatrixGame M N} [DecidableEq M] (x : M → ℝ) (i : M) :
G.matP.mulVec x (Sum.inl i) = -x i
@[simp]
theorem Cslib.GameTheory.BimatrixGame.matP_mulVec_inr {M : Type u_1} {N : Type u_2} [Fintype M] {G : BimatrixGame M N} [DecidableEq M] (x : M → ℝ) (j : N) :
@[simp]
theorem Cslib.GameTheory.BimatrixGame.matQ_mulVec_inl {M : Type u_1} {N : Type u_2} [Fintype N] {G : BimatrixGame M N} [DecidableEq N] (y : N → ℝ) (i : M) :
G.matQ.mulVec y (Sum.inl i) = G.A.mulVec y i
@[simp]
theorem Cslib.GameTheory.BimatrixGame.matQ_mulVec_inr {M : Type u_1} {N : Type u_2} [Fintype N] {G : BimatrixGame M N} [DecidableEq N] (y : N → ℝ) (j : N) :
G.matQ.mulVec y (Sum.inr j) = -y j
theorem Cslib.GameTheory.BimatrixGame.inl_mem_tightRows_matP {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} [DecidableEq M] {x : M → ℝ} {i : M} :
Sum.inl i ∈ G.matP.tightRows (rhsP M N) x ↔ x i = 0
theorem Cslib.GameTheory.BimatrixGame.inr_mem_tightRows_matP {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} [DecidableEq M] {x : M → ℝ} {j : N} :
theorem Cslib.GameTheory.BimatrixGame.inl_mem_tightRows_matQ {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} [DecidableEq N] {y : N → ℝ} {i : M} :
Sum.inl i ∈ G.matQ.tightRows (rhsQ M N) y ↔ G.A.mulVec y i = 1
theorem Cslib.GameTheory.BimatrixGame.inr_mem_tightRows_matQ {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} [DecidableEq N] {y : N → ℝ} {j : N} :
Sum.inr j ∈ G.matQ.tightRows (rhsQ M N) y ↔ y j = 0
theorem Cslib.GameTheory.BimatrixGame.matP_mulVec_le_iff {M : Type u_1} {N : Type u_2} [Fintype M] {G : BimatrixGame M N} [DecidableEq M] {x : M → ℝ} :
G.matP.mulVec x ≤ rhsP M N ↔ (∀ (i : M), 0 ≤ x i) ∧ ∀ (j : N), Matrix.vecMul x G.B j ≤ 1

x ∈ P iff x ≥ 0 and Bᵀ x ≤ 1.

theorem Cslib.GameTheory.BimatrixGame.matQ_mulVec_le_iff {M : Type u_1} {N : Type u_2} [Fintype N] {G : BimatrixGame M N} [DecidableEq N] {y : N → ℝ} :
G.matQ.mulVec y ≤ rhsQ M N ↔ (∀ (i : M), G.A.mulVec y i ≤ 1) ∧ ∀ (j : N), 0 ≤ y j

y ∈ Q iff A y ≤ 1 and y ≥ 0.

Nondegeneracy and boundedness #

The best response polytope P of a nondegenerate game is a nondegenerate system: a point of P has at most card M labels.

The best response polytope Q of a nondegenerate game is a nondegenerate system: a point of Q has at most card N labels.

theorem Cslib.GameTheory.BimatrixGame.eq_zero_of_matP_mulVec_nonpos {M : Type u_1} {N : Type u_2} [Fintype M] {G : BimatrixGame M N} [DecidableEq M] [Nonempty N] (hB : ∀ (i : M) (j : N), 0 < G.B i j) {v : M → ℝ} (hv : G.matP.mulVec v ≤ 0) :
v = 0

With positive payoffs to player 2, the best response polytope P is bounded: its recession cone is {0}.

theorem Cslib.GameTheory.BimatrixGame.eq_zero_of_matQ_mulVec_nonpos {M : Type u_1} {N : Type u_2} [Fintype N] {G : BimatrixGame M N} [DecidableEq N] [Nonempty M] (hA : ∀ (i : M) (j : N), 0 < G.A i j) {v : N → ℝ} (hv : G.matQ.mulVec v ≤ 0) :
v = 0

With positive payoffs to player 1, the best response polytope Q is bounded: its recession cone is {0}.

The origin is a vertex of P.

The origin is a vertex of Q.

Completely labelled pairs and Nash equilibria #

theorem Cslib.GameTheory.BimatrixGame.completelyLabeled_iff_forall {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} [DecidableEq M] [DecidableEq N] {x : M → ℝ} {y : N → ℝ} :
LemkeHowson.CompletelyLabeled G.matP (rhsP M N) G.matQ (rhsQ M N) x y ↔ (∀ (i : M), x i = 0 ∨ G.A.mulVec y i = 1) ∧ ∀ (j : N), Matrix.vecMul x G.B j = 1 ∨ y j = 0

A pair (x, y) is completely labelled for P and Q iff every row i is unplayed in x or a best response with payoff 1 against y, and every column j is unplayed in y or a best response with payoff 1 against x.

theorem Cslib.GameTheory.BimatrixGame.eq_zero_iff_eq_zero_of_completelyLabeled {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} [DecidableEq M] [DecidableEq N] {x : M → ℝ} {y : N → ℝ} (hx : G.matP.mulVec x ≤ rhsP M N) (hy : G.matQ.mulVec y ≤ rhsQ M N) (hcl : LemkeHowson.CompletelyLabeled G.matP (rhsP M N) G.matQ (rhsQ M N) x y) :
x = 0 ↔ y = 0

In a feasible completely labelled pair, x = 0 iff y = 0.

theorem Cslib.GameTheory.BimatrixGame.isNash_of_completelyLabeled {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} [DecidableEq M] [DecidableEq N] {x : M → ℝ} {y : N → ℝ} (hx : G.matP.mulVec x ≤ rhsP M N) (hy : G.matQ.mulVec y ≤ rhsQ M N) (hcl : LemkeHowson.CompletelyLabeled G.matP (rhsP M N) G.matQ (rhsQ M N) x y) (hx0 : x ≠ 0) :
G.IsNash ((∑ i : M, x i)⁻¹ • x) ((∑ j : N, y j)⁻¹ • y)

A nonzero feasible completely labelled pair (x, y) of P × Q rescales to the Nash equilibrium (x / ∑ x, y / ∑ y) ([vS07], Section 3.3).

theorem Cslib.GameTheory.BimatrixGame.IsNash.completelyLabeled {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} [DecidableEq M] [DecidableEq N] {x : M → ℝ} {y : N → ℝ} (hA : ∀ (i : M) (j : N), 0 < G.A i j) (hB : ∀ (i : M) (j : N), 0 < G.B i j) (h : G.IsNash x y) :

A Nash equilibrium (x, y) of a game with positive payoffs, rescaled by the inverse equilibrium payoffs, is a feasible completely labelled pair of P × Q ([vS07], Section 3.3).

The completely labelled vertex pairs #

noncomputable def Cslib.GameTheory.BimatrixGame.toPolytopes {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] (G : BimatrixGame M N) (p : (M → ℝ) × (N → ℝ)) :
(M → ℝ) × (N → ℝ)

The completely labelled pair of a Nash equilibrium (x, y): both strategies rescaled by the inverse of the other player's equilibrium payoff.

theorem Cslib.GameTheory.BimatrixGame.toPolytopes_apply {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} (p : (M → ℝ) × (N → ℝ)) :
G.toPolytopes p = ((G.payoff₂ p.1 p.2)⁻¹ • p.1, (G.payoff₁ p.1 p.2)⁻¹ • p.2)
theorem Cslib.GameTheory.BimatrixGame.injOn_toPolytopes {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} (hA : ∀ (i : M) (j : N), 0 < G.A i j) (hB : ∀ (i : M) (j : N), 0 < G.B i j) :
Set.InjOn G.toPolytopes {p : (M → ℝ) × (N → ℝ) | G.IsNash p.1 p.2}

With positive payoffs, distinct Nash equilibria give distinct completely labelled pairs.

theorem Cslib.GameTheory.BimatrixGame.zero_notMem_image_toPolytopes {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} (hB : ∀ (i : M) (j : N), 0 < G.B i j) :
0 ∉ G.toPolytopes '' {p : (M → ℝ) × (N → ℝ) | G.IsNash p.1 p.2}

With positive payoffs to player 2, no Nash equilibrium gives the artificial pair (0, 0).

theorem Cslib.GameTheory.BimatrixGame.setOf_completelyLabeled_eq {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} [DecidableEq M] [DecidableEq N] (hG : G.IsNondegenerate) (hA : ∀ (i : M) (j : N), 0 < G.A i j) (hB : ∀ (i : M) (j : N), 0 < G.B i j) :
{p : (M → ℝ) × (N → ℝ) | G.matP.IsVertex (rhsP M N) p.1 ∧ G.matQ.IsVertex (rhsQ M N) p.2 ∧ LemkeHowson.CompletelyLabeled G.matP (rhsP M N) G.matQ (rhsQ M N) p.1 p.2} = insert 0 (G.toPolytopes '' {p : (M → ℝ) × (N → ℝ) | G.IsNash p.1 p.2})

Completely labelled vertex pairs ([vS07], Section 3.4). For a nondegenerate game with positive payoffs, the completely labelled vertex pairs of P × Q are the artificial equilibrium (0, 0) and the rescaled Nash equilibria.

theorem Cslib.GameTheory.BimatrixGame.IsNondegenerate.odd_ncard_isNash_of_pos {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} [Nonempty M] [Nonempty N] (hG : G.IsNondegenerate) (hA : ∀ (i : M) (j : N), 0 < G.A i j) (hB : ∀ (i : M) (j : N), 0 < G.B i j) :
Odd {p : (M → ℝ) × (N → ℝ) | G.IsNash p.1 p.2}.ncard

A nondegenerate bimatrix game with positive payoffs has an odd number of Nash equilibria.

theorem Cslib.GameTheory.BimatrixGame.IsNondegenerate.odd_ncard_isNash {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} [Nonempty M] [Nonempty N] (hG : G.IsNondegenerate) :
Odd {p : (M → ℝ) × (N → ℝ) | G.IsNash p.1 p.2}.ncard

A nondegenerate bimatrix game has an odd number of Nash equilibria ([vS07], Corollary 3.7). The proof is the parity argument behind the Lemke–Howson algorithm [LH64]: after making all payoffs positive, the Nash equilibria correspond to the completely labelled vertex pairs of the best response polytopes other than (0, 0), and there is an even number of those (Cslib.GameTheory.LemkeHowson.even_ncard_completelyLabeled).

theorem Cslib.GameTheory.BimatrixGame.IsNondegenerate.exists_isNash {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} [Nonempty M] [Nonempty N] (hG : G.IsNondegenerate) :
∃ (x : M → ℝ) (y : N → ℝ), G.IsNash x y

A nondegenerate bimatrix game has a Nash equilibrium. This is the special case of Nash's theorem for nondegenerate bimatrix games, obtained here from BimatrixGame.IsNondegenerate.odd_ncard_isNash.

theorem Cslib.GameTheory.BimatrixGame.IsNondegenerate.finite_setOf_isNash {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} [Nonempty M] [Nonempty N] (hG : G.IsNondegenerate) :
{p : (M → ℝ) × (N → ℝ) | G.IsNash p.1 p.2}.Finite

A nondegenerate bimatrix game has finitely many Nash equilibria.