Documentation

CslibFrontier.GameTheory.Bimatrix.FNP

Encoded two-player rational bimatrix games and FNP verification #

This module defines the binary encoding of finite two-player rational bimatrix games, the exact rational Nash equilibrium search problem BimatrixCode.BimatrixNash, and a polynomial-time exact integer verifier showing BimatrixNash ∈ FNP encBimatrix.

Payoff matrices are encoded by the structure BimatrixCode (fields matA, matB) under encBimatrix using Turing.MultiTapeTM.encRat, and rational mixed strategy pairs by StrategyPair under encWitness. For well-formed nonempty m × n matrices, BimatrixNash c w holds when w is a polynomially bounded canonical rational strategy pair forming an exact Nash equilibrium of c.toGame; non-well-formed inputs admit only the empty witness [].

Verification clears payoff and strategy denominators without rational division, checking canonical lowest-terms nonnegativity, unit strategy sums, and all pure-deviation inequalities in signed binary integer arithmetic.

Main definitions #

Main results #

References #

Section 1: Encodings, games, and the rational Nash search problem #

A pair of rational mixed strategy lists (x, y) for players 1 and 2.

  • x : List ℚ

    Player 1's rational mixed strategy list.

  • y : List ℚ

    Player 2's rational mixed strategy list.

Instances For
    theorem Cslib.GameTheory.StrategyPair.ext {x y : StrategyPair} :
    x.x = y.x → x.y = y.y → x = y
    @[reducible, inline]

    The tuple of the fields of encWitness.

    theorem Cslib.GameTheory.encWitness_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List ℚ} {T0 S0 : γ → ℕ} {x1 : γ → List ℚ} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encRat) T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encRat) T1 S1) :
    Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { x := x0 x, y := x1 x }) encIn encWitness (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
    theorem Cslib.GameTheory.encWitness_x_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → StrategyPair} :
    theorem Cslib.GameTheory.encWitness_y_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → StrategyPair} :

    Canonical encoding of a rational strategy pair (x, y) via Turing.MultiTapeTM.encRat.

    An explicitly presented two-player game given by two lists of rational payoff rows.

    • matA : List (List ℚ)

      Player 1's rational payoff matrix as a list of rows.

    • matB : List (List ℚ)

      Player 2's rational payoff matrix as a list of rows.

    Instances For
      theorem Cslib.GameTheory.BimatrixCode.ext {x y : BimatrixCode} (matA : x.matA = y.matA) (matB : x.matB = y.matB) :
      x = y
      @[reducible, inline]

      The tuple of the fields of encBimatrix.

      theorem Cslib.GameTheory.encBimatrix_matB_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → BimatrixCode} :
      theorem Cslib.GameTheory.encBimatrix_mk_inO {γ : Type} {encIn : γ ↪ List Bool} {x0 : γ → List (List ℚ)} {T0 S0 : γ → ℕ} {x1 : γ → List (List ℚ)} {T1 S1 : γ → ℕ} (h0 : Turing.MultiTapeTM.ComputableInO x0 encIn (Turing.MultiTapeTM.encList (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encRat)) T0 S0) (h1 : Turing.MultiTapeTM.ComputableInO x1 encIn (Turing.MultiTapeTM.encList (Turing.MultiTapeTM.encList Turing.MultiTapeTM.encRat)) T1 S1) :
      Turing.MultiTapeTM.ComputableInO (fun (x : γ) => { matA := x0 x, matB := x1 x }) encIn encBimatrix (fun (x : γ) => T0 x + T1 x) fun (x : γ) => S0 x + S1 x
      theorem Cslib.GameTheory.encBimatrix_matA_budget {γ✝ : Type} {encIn✝ : γ✝ ↪ List Bool} {S✝ : γ✝ → ℕ} {g✝ : γ✝ → BimatrixCode} :

      Binary encoding of rational bimatrix games as (matA, matB) via encRat.

      Number of pure strategies of player 1.

      Number of pure strategies of player 2.

      Decidable rectangularity and nonemptiness check for BimatrixCode.

      Predicate asserting c encodes nonempty rectangular rows × cols payoff matrices.

      Player 1's rational payoff matrix extracted from c.

      Player 2's rational payoff matrix extracted from c.

      The BimatrixGame induced by a BimatrixCode.

      Predicate asserting that c : BimatrixCode encodes a finite symmetric two-player game: nonempty, square (rows = cols), and with player 2's payoff matrix equal to the transpose of player 1's (B = Aᵀ).

      The symmetric two-player game ⟨A, Aᵀ⟩ on Fin c.rows extracted from player 1's payoff matrix c.matA. When c.IsSymmetric, this coincides with c.toGame up to casting Fin c.rows to Fin c.cols.

      The real strategy vector Fin n → ℝ of a rational strategy list, padded with zeros.

      @[simp]
      theorem Cslib.GameTheory.BimatrixCode.strategyVec_apply {n : ℕ} (x : List ℚ) (i : Fin n) :
      strategyVec x i = ↑(x.getD (↑i) 0)

      Pure rational Nash condition on strategy lists x (length c.rows) and y (length c.cols).

      theorem Cslib.GameTheory.BimatrixCode.isMixedStrategy_strategyVec {n : ℕ} {x : List ℚ} (hlen : x.length = n) (hnn : ∀ q ∈ x, 0 ≤ q) (hsum : x.sum = 1) :

      A nonnegative rational list of length n summing to 1 is a mixed strategy on Fin n.

      Polynomial witness length bound 120 * L^3 + 400 * L + 100 in L = (encBimatrix c).length.

      The rational bimatrix Nash search problem: given c, find a polynomially bounded canonical rational strategy pair s forming an exact Nash equilibrium of c.toGame (or [] on malformed c).

      Section 2: Executable denominator clearing #

      Product of all rational denominators appearing in c.

      Scale a single rational q by D via exact truncated division q.num * (D.tdiv q.den).

      Section 3: Exact FNP verifier #

      theorem Cslib.GameTheory.BimatrixCode.den_dvd_clearScale {c : BimatrixCode} {M : List (List ℚ)} (hM : M = c.matA ∨ M = c.matB) {r : List ℚ} (hr : r ∈ M) {q : ℚ} (hq : q ∈ r) :
      theorem Cslib.GameTheory.BimatrixCode.scaledEntry_cast {D : ℤ} {q : ℚ} (hdvd : ↑q.den ∣ D) :
      ↑(scaledEntry D q) = ↑D * q