Documentation

CslibFrontier.GameTheory.Bimatrix.Basic

Bimatrix games #

A bimatrix game (Cslib.GameTheory.BimatrixGame) is a finite two-player game in strategic form, given by two payoff matrices A B : Matrix M N ℝ: if player 1 plays the row i and player 2 the column j, they receive A i j and B i j, which they maximize. A mixed strategy is a probability vector (Cslib.GameTheory.IsMixedStrategy, in CslibFrontier.GameTheory.MixedStrategy), and the expected payoffs of mixed strategies x and y are xᵀ A y and xᵀ B y. A pair (x, y) is a (mixed) Nash equilibrium (BimatrixGame.IsNash) if each strategy is a best response to the other. We follow the conventions of [vS07], Section 3.2.

Main definitions #

Main results #

References #

structure Cslib.GameTheory.BimatrixGame (M : Type u_1) (N : Type u_2) :
Type (max u_1 u_2)

A bimatrix game: a finite two-player game in strategic form. Player 1 chooses a row i : M, player 2 a column j : N, and they receive the payoffs A i j and B i j, which they maximize.

  • A : Matrix M N ℝ

    The payoff matrix of player 1, the row player.

  • B : Matrix M N ℝ

    The payoff matrix of player 2, the column player.

The game with the roles of the two players exchanged: player 1's payoff matrix becomes Bᵀ and player 2's becomes Aᵀ.

@[simp]
theorem Cslib.GameTheory.BimatrixGame.swap_mk {M : Type u_1} {N : Type u_2} (A B : Matrix M N ℝ) :
{ A := A, B := B }.swap = { A := B.transpose, B := A.transpose }
@[simp]
theorem Cslib.GameTheory.BimatrixGame.swap_A {M : Type u_1} {N : Type u_2} (G : BimatrixGame M N) :
@[simp]
theorem Cslib.GameTheory.BimatrixGame.swap_B {M : Type u_1} {N : Type u_2} (G : BimatrixGame M N) :
@[simp]
theorem Cslib.GameTheory.BimatrixGame.swap_swap {M : Type u_1} {N : Type u_2} (G : BimatrixGame M N) :
G.swap.swap = G
def Cslib.GameTheory.BimatrixGame.payoff₁ {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] (G : BimatrixGame M N) (x : M → ℝ) (y : N → ℝ) :

The expected payoff xᵀ A y of player 1.

def Cslib.GameTheory.BimatrixGame.payoff₂ {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] (G : BimatrixGame M N) (x : M → ℝ) (y : N → ℝ) :

The expected payoff xᵀ B y of player 2.

def Cslib.GameTheory.BimatrixGame.IsBestResponse₁ {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] (G : BimatrixGame M N) (x : M → ℝ) (y : N → ℝ) :

x is a best response of player 1 to y: a mixed strategy maximizing payoff₁ · y over all mixed strategies.

def Cslib.GameTheory.BimatrixGame.IsBestResponse₂ {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] (G : BimatrixGame M N) (y : N → ℝ) (x : M → ℝ) :

y is a best response of player 2 to x: a mixed strategy maximizing payoff₂ x · over all mixed strategies.

def Cslib.GameTheory.BimatrixGame.IsNash {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] (G : BimatrixGame M N) (x : M → ℝ) (y : N → ℝ) :

(x, y) is a (mixed) Nash equilibrium: each strategy is a best response to the other.

def Cslib.GameTheory.BimatrixGame.IsPureBestResponse₁ {M : Type u_1} {N : Type u_2} [Fintype N] (G : BimatrixGame M N) (y : N → ℝ) (i : M) :

The row i is a pure best response of player 1 to y: it maximizes the expected payoff (A *ᵥ y) i.

def Cslib.GameTheory.BimatrixGame.IsPureBestResponse₂ {M : Type u_1} {N : Type u_2} [Fintype M] (G : BimatrixGame M N) (x : M → ℝ) (j : N) :

The column j is a pure best response of player 2 to x: it maximizes the expected payoff (x ᵥ* B) j.

A bimatrix game is nondegenerate if no mixed strategy with support of size k has more than k pure best responses ([vS07], Definition 3.2).

theorem Cslib.GameTheory.BimatrixGame.payoff₁_eq_dotProduct {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} (x : M → ℝ) (y : N → ℝ) :
G.payoff₁ x y = x ⬝ᵥ G.A.mulVec y

Express player 1's expected payoff as the dot product x ⬝ᵥ (G.A *ᵥ y).

theorem Cslib.GameTheory.BimatrixGame.payoff₂_eq_dotProduct {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} (x : M → ℝ) (y : N → ℝ) :

Express player 2's expected payoff as the dot product y ⬝ᵥ (x ᵥ* G.B).

@[simp]
theorem Cslib.GameTheory.BimatrixGame.payoff₁_swap {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] (G : BimatrixGame M N) (y : N → ℝ) (x : M → ℝ) :
@[simp]
theorem Cslib.GameTheory.BimatrixGame.payoff₂_swap {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] (G : BimatrixGame M N) (y : N → ℝ) (x : M → ℝ) :
theorem Cslib.GameTheory.BimatrixGame.isNash_iff {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} :

Unfolding characterization of IsNash: each player plays a best response to the other.

theorem Cslib.GameTheory.BimatrixGame.isPureBestResponse₁_iff {M : Type u_1} {N : Type u_2} [Fintype N] {G : BimatrixGame M N} {y : N → ℝ} {i : M} :
G.IsPureBestResponse₁ y i ↔ ∀ (i' : M), G.A.mulVec y i' ≤ G.A.mulVec y i

Unfolding characterization of a pure best response for player 1.

theorem Cslib.GameTheory.BimatrixGame.isPureBestResponse₂_iff {M : Type u_1} {N : Type u_2} [Fintype M] {G : BimatrixGame M N} {x : M → ℝ} {j : N} :
G.IsPureBestResponse₂ x j ↔ ∀ (j' : N), Matrix.vecMul x G.B j' ≤ Matrix.vecMul x G.B j

Unfolding characterization of a pure best response for player 2.

@[simp]
theorem Cslib.GameTheory.BimatrixGame.isBestResponse₁_swap {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} :
@[simp]
theorem Cslib.GameTheory.BimatrixGame.isBestResponse₂_swap {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} :
@[simp]
theorem Cslib.GameTheory.BimatrixGame.isNash_swap {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} :
G.swap.IsNash y x ↔ G.IsNash x y

Swapping the players swaps the coordinates of a Nash equilibrium.

Unfolding characterization of nondegeneracy in terms of support and pure best-response cardinalities.

@[simp]

Swapping the players preserves nondegeneracy.

theorem Cslib.GameTheory.BimatrixGame.IsBestResponse₁.isMixedStrategy {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} (h : G.IsBestResponse₁ x y) :

A best response of player 1 is a mixed strategy.

theorem Cslib.GameTheory.BimatrixGame.IsBestResponse₂.isMixedStrategy {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} (h : G.IsBestResponse₂ y x) :

A best response of player 2 is a mixed strategy.

theorem Cslib.GameTheory.BimatrixGame.isBestResponse₁_iff {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} :
G.IsBestResponse₁ x y ↔ IsMixedStrategy x ∧ ∀ (i : M), 0 < x i → G.IsPureBestResponse₁ y i

Best response condition for player 1 ([vS07], Proposition 3.1): a mixed strategy is a best response iff every row it plays with positive probability is a pure best response.

theorem Cslib.GameTheory.BimatrixGame.isBestResponse₂_iff {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} :
G.IsBestResponse₂ y x ↔ IsMixedStrategy y ∧ ∀ (j : N), 0 < y j → G.IsPureBestResponse₂ x j

Best response condition for player 2 ([vS07], Proposition 3.1).

theorem Cslib.GameTheory.BimatrixGame.IsBestResponse₁.payoff₁_eq_of_pos {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} (h : G.IsBestResponse₁ x y) {i : M} (hi : 0 < x i) :
G.payoff₁ x y = G.A.mulVec y i

Against y, a best response earns the payoff of each row in its support.

theorem Cslib.GameTheory.BimatrixGame.IsBestResponse₁.le_payoff₁ {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} (h : G.IsBestResponse₁ x y) (i : M) :
G.A.mulVec y i ≤ G.payoff₁ x y

Against y, a best response earns at least the payoff of every row.

theorem Cslib.GameTheory.BimatrixGame.IsBestResponse₂.payoff₂_eq_of_pos {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} (h : G.IsBestResponse₂ y x) {j : N} (hj : 0 < y j) :

Against x, a best response earns the payoff of each column in its support.

theorem Cslib.GameTheory.BimatrixGame.IsBestResponse₂.le_payoff₂ {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} (h : G.IsBestResponse₂ y x) (j : N) :

Against x, a best response earns at least the payoff of every column.

theorem Cslib.GameTheory.BimatrixGame.isBestResponse₁_iff_le_payoff₁ {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} :
G.IsBestResponse₁ x y ↔ IsMixedStrategy x ∧ ∀ (i : M), G.A.mulVec y i ≤ G.payoff₁ x y

A mixed strategy is a best response to y iff no row earns more against y than it does.

theorem Cslib.GameTheory.BimatrixGame.isBestResponse₂_iff_le_payoff₂ {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} :

A mixed strategy is a best response to x iff no column earns more against x than it does.

theorem Cslib.GameTheory.BimatrixGame.payoff₁_pos {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} (hA : ∀ (i : M) (j : N), 0 < G.A i j) (hx : IsMixedStrategy x) (hy : IsMixedStrategy y) :
0 < G.payoff₁ x y

With positive payoffs, player 1 earns a positive expected payoff.

theorem Cslib.GameTheory.BimatrixGame.payoff₂_pos {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} (hB : ∀ (i : M) (j : N), 0 < G.B i j) (hx : IsMixedStrategy x) (hy : IsMixedStrategy y) :
0 < G.payoff₂ x y

With positive payoffs, player 2 earns a positive expected payoff.

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

In a Nash equilibrium of a nondegenerate bimatrix game, both strategies have supports of the same size ([vS07], Proposition 3.3).

Adding a constant to all payoffs #

def Cslib.GameTheory.BimatrixGame.addConst {M : Type u_1} {N : Type u_2} (G : BimatrixGame M N) (c : ℝ) :

The game with the constant c added to every payoff of both players.

@[simp]
theorem Cslib.GameTheory.BimatrixGame.swap_addConst {M : Type u_1} {N : Type u_2} (G : BimatrixGame M N) (c : ℝ) :
@[simp]
theorem Cslib.GameTheory.BimatrixGame.addConst_A_apply {M : Type u_1} {N : Type u_2} {G : BimatrixGame M N} (c : ℝ) (i : M) (j : N) :
(G.addConst c).A i j = G.A i j + c
@[simp]
theorem Cslib.GameTheory.BimatrixGame.addConst_B_apply {M : Type u_1} {N : Type u_2} {G : BimatrixGame M N} (c : ℝ) (i : M) (j : N) :
(G.addConst c).B i j = G.B i j + c
theorem Cslib.GameTheory.BimatrixGame.addConst_A_mulVec {M : Type u_1} {N : Type u_2} [Fintype N] {G : BimatrixGame M N} (c : ℝ) (y : N → ℝ) :
(G.addConst c).A.mulVec y = G.A.mulVec y + fun (x : M) => c * ∑ j : N, y j

Adding c to every payoff shifts player 1's pure-row payoff vector by the constant c * ∑ j, y j.

theorem Cslib.GameTheory.BimatrixGame.vecMul_addConst_B {M : Type u_1} {N : Type u_2} [Fintype M] {G : BimatrixGame M N} (c : ℝ) (x : M → ℝ) :
Matrix.vecMul x (G.addConst c).B = Matrix.vecMul x G.B + fun (x_1 : N) => c * ∑ i : M, x i

Adding c to every payoff shifts player 2's pure-column payoff vector by the constant c * ∑ i, x i.

@[simp]

Adding a constant to all payoffs does not change player 1's pure best responses.

@[simp]

Adding a constant to all payoffs does not change player 2's pure best responses.

@[simp]
theorem Cslib.GameTheory.BimatrixGame.isNash_addConst {M : Type u_1} {N : Type u_2} [Fintype M] [Fintype N] {G : BimatrixGame M N} {x : M → ℝ} {y : N → ℝ} {c : ℝ} :
(G.addConst c).IsNash x y ↔ G.IsNash x y

Adding a constant to all payoffs does not change the Nash equilibria.

@[simp]

Adding a constant to all payoffs does not change nondegeneracy.

theorem Cslib.GameTheory.BimatrixGame.exists_addConst_pos {M : Type u_1} {N : Type u_2} (G : BimatrixGame M N) [Finite M] [Finite N] :
∃ (c : ℝ), (∀ (i : M) (j : N), 0 < (G.addConst c).A i j) ∧ ∀ (i : M) (j : N), 0 < (G.addConst c).B i j

A large enough constant makes all payoffs positive.