Game Theory Formalization in Lean

This repository proves that every finite game with at least one player and nonempty pure strategy sets has a mixed Nash equilibrium. The proof goes from Scarf's colorful-room theorem to Brouwer's fixed-point theorem on a simplex, then to the product of simplices that represents mixed strategy profiles.

Yuwei Lyu and Kai Li describe the formalization in the accompanying paper, Formalizing Scarf, Brouwer, and Nash in Lean.

Build

Install Lean through elan and run these commands from the repository root.

lake exe cache get
lake build

The project uses Lean v4.35.0 and Mathlib v4.35.0. The toolchain and Lake manifest pin the compiler and dependencies. The first command retrieves precompiled Mathlib dependencies. The default build checks the full library and the API examples.

Main results

Lean declarationResult
IndexedLOrder.ScarfExistence of a colorful room for the indexed-order coloring.
BrouwerEvery continuous self-map of a nonempty finite-dimensional standard simplex has a fixed point.
Brouwer_ProductThe fixed-point theorem for a nonempty finite product of standard simplices, via a retraction from one simplex.
ExistsNashEqExistence of a mixed Nash equilibrium for FinGame.

Mixed strategies use Gametheory.finiteSimplex, the set of nonnegative coordinate vectors whose entries sum to one.

import GameTheory

example (G : FinGame) : ∃ σ : G.mixedS, G.mixedNashEquilibrium σ :=
  ExistsNashEq G

Scarf graphs and primitive sets

ScarfPath.component_structure gives spanning paths or cycles in the fixed-color room–door graph. Primitive.Trace.nonempty gives a classical graph walk from the slack boundary to a fully colored primitive set. The proofs of Brouwer and Nash use the colorful-room existence theorem. The interface guide covers the graph, replacement steps, and coordinate models.

Axiom audit

Run lake env lean Gametheory/AxiomAudit.lean to print the axioms used by the 16 audited declarations. They depend only on propext, Classical.choice, and Quot.sound. GitHub Actions also replays these declarations and their dependencies with the Nanoda checker bundled with Lean. The build and theorem guide lists the audited declarations and their source locations.

References

  • N. V. Ivanov, Beyond Sperner's Lemma.
  • J. F. Nash, “Non-Cooperative Games,” Annals of Mathematics (1951).