Documentation

ConvexAnalysis.Nash

Nash equilibria of finite games #

Finite games in mixed strategies: expected payoffs, best responses, and Nash's theorem that every finite game has a Nash equilibrium, by Kakutani's fixed point theorem for the best-response correspondence.

Main definitions #

Main statements #

Implementation notes #

Mixed strategies are a set of vectors, mixedStrategies S ⊆ S → ℝ, so that the mixed profiles form a compact convex subset of the finite-dimensional space ∀ i, S i → ℝ. The set is the probability simplex of ConvexAnalysis.Simplex under the name of game theory (an abbrev), and has the same points as Mathlib's Convexity.StdSimplex (ConvexAnalysis.probabilitySimplex_eq_range_weights). A pure strategy a is the vector Pi.single a 1.

Mathlib has Sion's minimax theorem (Mathlib/Topology/Sion.lean), and the open Mathlib PR #39393 proposes von Neumann's minimax theorem for matrix games (Matrix.exists_mixedNash in Mathlib/GameTheory/MatrixGame.lean), the case of two players with zero-sum payoffs; this file does not depend on either.

References #

Tags #

Nash equilibrium, finite game, mixed strategy, best response, Kakutani fixed point theorem, indifference principle

@[reducible, inline]
abbrev ConvexAnalysis.mixedStrategies (S : Type u_1) [Fintype S] :
Set (S → ℝ)

The mixed strategies on a finite set S of pure strategies: the probability vectors p : S → ℝ, with p s ≥ 0 and ∑ s, p s = 1, that is, the probability simplex. The lemmas on it are those of ConvexAnalysis.probabilitySimplex.

Equations
Instances For

    Finite games and Nash equilibria #

    def ConvexAnalysis.expectedPayoff {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) (σ : (i : ι) → S i → ℝ) (i : ι) :

    The expected payoff of player i in the finite game with payoffs u i : (∀ j, S j) → ℝ, when every player j plays the mixed strategy σ j, independently of the others.

    Equations
    Instances For
      def ConvexAnalysis.bestResponses {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) (σ : (i : ι) → S i → ℝ) (i : ι) :
      Set (S i → ℝ)

      The best responses of player i to the mixed profile σ: the mixed strategies of i that maximize the expected payoff of i when the other players keep their strategies.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def ConvexAnalysis.IsNashEquilibrium {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) (σ : (i : ι) → S i → ℝ) :

        A mixed profile σ is a Nash equilibrium of the finite game with payoffs u if every σ i is a mixed strategy and no player i can raise their expected payoff by changing their own strategy alone.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          theorem ConvexAnalysis.IsNashEquilibrium.mem_mixedStrategies {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] {u : ι → ((i : ι) → S i) → ℝ} {σ : (i : ι) → S i → ℝ} (h : IsNashEquilibrium u σ) (i : ι) :
          σ i ∈ mixedStrategies (S i)

          The strategies of a Nash equilibrium are mixed strategies.

          theorem ConvexAnalysis.IsNashEquilibrium.expectedPayoff_update_le {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] {u : ι → ((i : ι) → S i) → ℝ} {σ : (i : ι) → S i → ℝ} (h : IsNashEquilibrium u σ) (i : ι) {τ : S i → ℝ} (hτ : τ ∈ mixedStrategies (S i)) :

          At a Nash equilibrium no player gains by deviating unilaterally to another mixed strategy.

          theorem ConvexAnalysis.continuous_expectedPayoff {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) (i : ι) :
          Continuous fun (σ : (i : ι) → S i → ℝ) => expectedPayoff u σ i

          The expected payoff is continuous in the mixed profile.

          theorem ConvexAnalysis.expectedPayoff_update {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) (σ : (i : ι) → S i → ℝ) (i k : ι) (ρ : S k → ℝ) :
          expectedPayoff u (Function.update σ k ρ) i = ∑ s : (j : ι) → S j, ρ (s k) * ((∏ j ∈ Finset.univ.erase k, σ j (s j)) * u i s)

          The expected payoff is linear in the strategy of each single player k.

          theorem ConvexAnalysis.expectedPayoff_update_eq_sum_single {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) [(i : ι) → DecidableEq (S i)] (σ : (i : ι) → S i → ℝ) (i k : ι) (ρ : S k → ℝ) :
          expectedPayoff u (Function.update σ k ρ) i = ∑ a : S k, ρ a * expectedPayoff u (Function.update σ k (Pi.single a 1)) i

          The expected payoff is linear in the strategy ρ of each single player k: a combination of the payoffs of the pure strategies Pi.single a 1 with the weights ρ a.

          theorem ConvexAnalysis.expectedPayoff_single {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) [(i : ι) → DecidableEq (S i)] (s : (j : ι) → S j) (i : ι) :
          expectedPayoff u (fun (j : ι) => Pi.single (s j) 1) i = u i s

          The mixed extension agrees with the game on pure profiles.

          theorem ConvexAnalysis.convex_bestResponses {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) (σ : (i : ι) → S i → ℝ) (i : ι) :

          The best responses form a convex set, since the expected payoff is linear in the strategy of the player.

          theorem ConvexAnalysis.bestResponses_nonempty {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) (σ : (i : ι) → S i → ℝ) (i : ι) [Nonempty (S i)] :

          Every player has a best response, by compactness of the mixed strategies.

          theorem ConvexAnalysis.isClosed_setOf_mem_bestResponses {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) (i : ι) :
          IsClosed {p : ((i : ι) → S i → ℝ) × (S i → ℝ) | p.2 ∈ bestResponses u p.1 i}

          The graph of the best-response correspondence of player i is closed.

          theorem ConvexAnalysis.isNashEquilibrium_iff_forall_mem_bestResponses {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) {σ : (i : ι) → S i → ℝ} :
          IsNashEquilibrium u σ ↔ ∀ (i : ι), σ i ∈ bestResponses u σ i

          σ is a Nash equilibrium iff every player plays a best response to σ.

          theorem ConvexAnalysis.isNashEquilibrium_iff_forall_single {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) [(i : ι) → DecidableEq (S i)] {σ : (i : ι) → S i → ℝ} :
          IsNashEquilibrium u σ ↔ (∀ (i : ι), σ i ∈ mixedStrategies (S i)) ∧ ∀ (i : ι) (a : S i), expectedPayoff u (Function.update σ i (Pi.single a 1)) i ≤ expectedPayoff u σ i

          σ is a Nash equilibrium iff no player gains by deviating to a pure strategy.

          theorem ConvexAnalysis.exists_isNashEquilibrium {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) [∀ (i : ι), Nonempty (S i)] :
          ∃ (σ : (i : ι) → S i → ℝ), IsNashEquilibrium u σ

          Nash's theorem Nash: every finite game has a Nash equilibrium in mixed strategies.

          theorem ConvexAnalysis.exists_isNashEquilibrium_iff {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) :
          (∃ (σ : (i : ι) → S i → ℝ), IsNashEquilibrium u σ) ↔ ∀ (i : ι), Nonempty (S i)

          The hypothesis of exists_isNashEquilibrium is necessary: a player without pure strategies has no mixed strategy.

          theorem ConvexAnalysis.exists_isNashEquilibrium_stdSimplex {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) [∀ (i : ι), Nonempty (S i)] :
          ∃ (σ : (i : ι) → Convexity.StdSimplex ℝ (S i)), IsNashEquilibrium u fun (i : ι) => ⇑(σ i).weights

          Nash's theorem with profiles in Mathlib's Convexity.StdSimplex.

          theorem ConvexAnalysis.isNashEquilibrium_single_iff {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) [(i : ι) → DecidableEq (S i)] (s : (j : ι) → S j) :
          (IsNashEquilibrium u fun (j : ι) => Pi.single (s j) 1) ↔ ∀ (i : ι) (a : S i), u i (Function.update s i a) ≤ u i s

          A pure profile is a Nash equilibrium iff no player gains by a pure deviation.

          theorem ConvexAnalysis.IsNashEquilibrium.expectedPayoff_update_single_eq {ι : Type u_1} [Fintype ι] [DecidableEq ι] {S : ι → Type u_2} [(i : ι) → Fintype (S i)] (u : ι → ((i : ι) → S i) → ℝ) [(i : ι) → DecidableEq (S i)] {σ : (i : ι) → S i → ℝ} (h : IsNashEquilibrium u σ) {i : ι} {a : S i} (ha : 0 < σ i a) :

          Indifference principle: at a Nash equilibrium, every pure strategy played with positive probability is a best response.