Finite Nash Equilibria and Dependent Mixed Strategies in Lean
Abstract
We present two complementary Lean 4 developments of finite Nash equilibrium. The pure-game layer uses player-specific legal action sets, distinguishes one-way generalized ordinal potentials from bidirectional ordinal potentials, and proves potential-maximizer certificates, a local-maximum characterization, absence of strict-improvement cycles, and weak acyclicity. The mixed-game layers use either a common finite action type or a dependent finite action type for each player. They prove payoff equalization on equilibrium supports, Dirac payoff identities, continuity of the normalized payoff-excess map, and mixed equilibrium existence. We explain the finite-sum and sum-of-squares arguments and the reindexing bridge to an attributed, proved product-of-simplices Brouwer theorem. An additional legal-subtype interface is separated from the declarations selected by the registry comparator. The account is tied to two immutable source snapshots and dated verification records. It documents established mathematics and its formal interfaces, without claiming a new equilibrium theorem or formalization priority.
The mathematical result and the two artifacts
Nash’s finite-game existence theorem states that every game with finitely many players, finitely many nonempty action sets, and real payoffs admits a mixed equilibrium [7, 6]. A different, more elementary existence argument applies to finite potential games: maximize a scalar potential and rule out profitable unilateral deviations. The two arguments share the equilibrium concept but use different hypotheses and proof tools.
This article gives a consolidated account of two Lean-native artifacts. The native artifact, nash-equilibrium-lean, is inspected at commit 6dd83f3b004c0318e52f4c3cb272d909efca321d [10]. It contains the pure potential-game interface and a common-action mixed layer. The dependent artifact, dependent-nash-equilibrium-lean, is inspected at commit 2f65710af26a24a26660dd1e92d09adf1697a527 [8]. It gives each player its own action type. All source links in this paper refer to these commits.
The formalization contribution is an explicit game API, a careful separation of potential predicates, a finite improvement-path interface, and native mixed-game adapters to fixed-point infrastructure. The mathematics is classical [5]. Earlier formalizations include the Isabelle/HOL AFP development by the present manuscript’s authors [12], and a Ssreflect/Coq library for potential games and best-response dynamics [1]. The reused Lean development of Lyu and Li already addresses Scarf, Brouwer, and Nash [3]; its fixed-point proofs are attributed dependencies here. We do not claim the first formalization of Nash’s theorem, a cross-prover translation, or a machine-checked equivalence with AFP.
The artifacts use Lean 4 and Mathlib [2, 13]. Finite spaces are supplied through Fintype instances, with DecidableEq on players and on each relevant action type. The mathematical
2020 Mathematics Subject Classification. 91A10, 91A11, 68V20.
Author ORCID identifiers: Arthur Freitas Ramos, 0009-0003-3568-0325; David Barros Hulak, 0009-0002-8056-1774; Ruy J. G. B. de Queiroz, 0000-0003-1482-0977.
Copyright 2026 the authors. Licensed under Creative Commons Attribution 4.0 International (CC BY 4.0). statements below are readable independently of Lean. Source names identify where the encoded definitions and proofs can be found; the distinction between selected registry declarations and additional repository results is maintained throughout.
Pure games and the order on utilities
Let and be finite types. For each , let be a nonempty finite legal action set. A profile is a function ; it is legal if for every . Write for the profile changing only player to . Payoffs are functions , where is an ordered utility type.
These data form NashEquilibrium.Game in Basic.lean. The structure stores payoffs even on illegal profiles, but all equilibrium comparisons below start from a legal profile and use legal deviations. The field nonempty_strategies supplies a legal action for each player. No nonemptiness assumption on is made. If is empty, its unique profile is legal and all playerwise comparisons are vacuous.
Definition 2.1. For a utility preorder, a pure Nash equilibrium is a legal profile such that
This is exactly IsNash. For a general preorder, an incomparable utility is not a strict improvement. Consequently (1) must not be silently replaced by . The repository defines a best response using these weak comparisons and proves isNash_iff_bestResponse under a linear order on . It also defines dominant actions and proves that a profile of dominant actions is Nash under a preorder. The selected potential theorems impose linear orders on both utilities and potential values, as required by their formal statements.
Potential certificates and finite improvement paths
Assume and are linearly ordered, and let . The repository keeps the following predicates separate.
Definition 3.1. A generalized ordinal potential satisfies, for every legal and ,
An ordinal potential satisfies the same statement with in place of .
These are IsGeneralizedOrdinalPotential and IsOrdinalPotential. The bidirectional condition is the usual strict sign agreement. In particular, applying it to a deviation and its reverse rules out a strict potential change along a payoff-neutral deviation. The one-way condition permits such a change.
Theorem 3.2. Assume that utilities and potential values are linearly ordered.
If is a generalized ordinal potential, there is a legal profile maximizing over all legal profiles, and this is Nash.
If is an ordinal potential, a profile is Nash if and only if it is legal and for all and .
For a generalized ordinal potential, there is no nonempty finite cycle of strict better responses. From every legal starting profile there is a finite better-response path to a Nash equilibrium, allowing a zero-step path if the starting profile is already Nash.
For the first assertion, the finite set of legal profiles is nonempty: choose one legal action for each player. A maximum of exists in any linear order because the set is finite. A legal strict improvement would produce a legal profile with larger potential by (2), contradicting maximality. No real-valued potential is needed. The proof uses Finset.exists_max_image.
The implementation proves this generalized maximizer certificate as exists_nash_maximizing_generalized_ordinal_potential. The selected registry theorem is its standard-ordinal specialization, NashEquilibrium.Palomar.exists_nash_maximizing_ordinal_potential, which returns both equilibrium and global potential maximality. The selected local-maximum equivalence is isNash_iff_potential_local_maximum in the same namespace. Its forward implication uses the reverse direction of the ordinal condition; its backward implication uses (2).
The stronger hypothesis for the equivalence is necessary. Consider one player with two actions, constant payoff, and potentials 0 and 1. Every profile is Nash and every potential is generalized, but the action with potential 0 is not a local potential maximum. The repository’s Examples.lean contains checked counterexamples illustrating the potential distinction, alongside Prisoner’s Dilemma, coordination, matching-pennies, and rock-paper-scissors examples.
A better-response edge consists of legal profiles and a legal unilateral deviation strictly improving the deviator’s utility. BetterResponsePath is inductively generated by one edge and prefixing an edge to a nonempty path. Each edge strictly increases ; induction and transitivity give along every such path. A cycle would imply .
For reachability, IsWeaklyAcyclic explicitly permits either or a nonempty path from to a Nash profile . The proof makes the reversed path relation well founded using finiteness, transitivity, and irreflexivity. Well-founded induction then chooses a strictly profitable deviation whenever the current legal profile is not Nash and concatenates it with the induction hypothesis. The selected no_betterResponse_cycle_of_generalized_ordinal_potential and weaklyAcyclic_of_generalized_ordinal_potential certify these properties. They specify no scheduling rule, numerical convergence rate, or equilibrium-computation complexity.
Finite mixed profiles and expected payoffs
We now use real payoffs. Let be a finite nonempty action type for each player , and put . The payoff table is now . A mixed profile is an independent distribution for each player:
Write for the feasible set.
The native mixed layer takes a common type and represents profiles as functions . Unlike the native pure Game, its MixedGame has no legal-set field: every player may choose every . The dependent layer represents a profile as , using a family of action types indexed by players. The definitions that follow have the same finite-sum form in both layers.
For a pure profile , define the opponents’ weight
The source enumerates full pure profiles while fixing the deviator’s coordinate:
These are opponentWeight, pureDeviationPayoff, and mixedPayoff in the native Mixed.lean and dependent Basic.lean modules. The indicator in (4) ensures each opponents’ profile is counted once, rather than once per action of player .
Definition 4.1. A mixed Nash equilibrium is such that
The predicate IsMixedNash includes feasibility as well as these inequalities. This finite pure-deviation formulation excludes an improving mixed deviation as well: for any distribution , . This is an elementary explanation of the definition; it is not a separate selected arbitrary-mixed-deviation equivalence theorem.
Theorem 4.2. If is a mixed Nash equilibrium and , then . In particular, if , then .
Proof. Each summand is nonnegative by (3) and (6), and
Every summand is therefore zero. For , the positive factor can be cancelled. The second assertion follows by contradiction from the first and nonnegativity of probabilities. □
Both selected mixedNash_support_payoff_eq theorems implement this argument. They need no additional global nonemptiness assumption on action types: the equilibrium hypothesis already supplies the relevant normalization. Equalization applies only to positive-probability actions; an unused action may tie the equilibrium payoff or have a lower payoff.
For a pure profile , its Dirac embedding assigns probability one to and zero to every other action. The source proves
Products of Dirac weights eliminate all opponents’ profiles except the one agreeing with , and the finite sum reduces to a single term. Thus the condition of no profitable pure deviation yields a mixed Dirac equilibrium. These identities are additional library lemmas, not separately selected registry declarations. For the common-action mixed game they compare against every common action; a restricted pure-game equilibrium is not automatically an equilibrium of that game.
The normalized payoff-excess map
For an arbitrary real coordinate profile , define
and
The source names are excess, excessSum, and nashMap. Because for every , the denominator is strictly positive on the entire ambient space, not just on .
If , the numerator is nonnegative and
Hence , as proved by nashMap_isMixedProfile. The decisive algebraic step is the following.
Lemma 5.1. If and , then all excesses are zero, and is a mixed Nash equilibrium.
Proof. Fix a player and abbreviate . Multiplying a fixed-point coordinate identity by yields
If , every excess is zero. Suppose instead . Whenever , equation (9) makes the excess positive, so the maximum in (7) is its second argument and
For zero-probability actions, multiplying by makes the corresponding identity hold as well. Summing therefore gives
so . Normalization ensures some ; thus , contradicting . It follows that and each . Applying this to every player gives (6).
This sum-of-squares proof follows fixedPoint_excess_zero, followed by mixedNash_of_nashMap_fixedPoint, in both mixed modules. It does not infer equilibrium merely from nonnegativity of total excess, nor cancel a probability that might be zero. Conversely, an equilibrium has zero excess by definition and hence is fixed by (8); the existence proof uses the forward implication of Lemma 5.1.
Geometry and the proved fixed-point dependency
Finite-dimensional topology
The feasible set is closed: it is the intersection of coordinate half-spaces and normalization hyperplanes . Every feasible coordinate is at most one, since it is a nonnegative summand of a sum equal to one. Hence
The finite product box is compact, and the closed subset is compact. Convexity follows directly from (3): a convex combination preserves nonnegativity and normalization. Nonemptiness is witnessed by the uniform distributions when each is nonempty.
These facts are proved as mixedProfiles_closed, mixedProfiles_compact, mixedProfiles_convex, and mixedProfiles_nonempty in the native MixedTopology.lean and dependent Topology.lean. Their proofs use finite sums, coordinate evaluations, compact interval products, and closedness. Payoffs are arbitrary lookup values on a finite pure-profile space; no continuity assumption on the payoff table is necessary.
Each is a finite sum of finite products of coordinates with fixed real coefficients. The functions , , , and are therefore continuous. Division in (8) is continuous because the denominator never vanishes. The two modules prove continuous_nashMap on the full ambient real coordinate space. Their conditional fixed-point reduction accepts a supplied fixed point; it does not postulate that such a point exists.
The Brouwer bridge
Theorem 6.1. Every finite real-payoff game with a nonempty action type for each player has a mixed Nash equilibrium. The common-action version assumes one finite nonempty type available to every player. Neither version requires the player type to be nonempty.
The existence modules use the theorem Brouwer_Product from Gametheory/Brouwer_product.lean. Its interface concerns a continuous self-map of
For this interface the finite player index type is inhabited, so . It returns a fixed point. The imported Scarf-to-Brouwer development is proved source, not a new fixed-point axiom introduced by either Nash library. The four included Gametheory files are attributed to the MIT-licensed math-xmum/Brouwer development at commit 09941e849a81e520cc0cc53220f10f8e5f4768e0 [4, 3]. The native copies are unchanged from that pin; the dependent copy of Scarf.lean narrows its opening imports while retaining the proof body. This paper does not rederive or claim those upstream fixed-point proofs.
For nonempty , choose a finite equivalence . In the common-action bridge, choose and set for every . In the dependent bridge, set
Nonempty action types ensure . Reindexing the probability coordinates identifies feasible game profiles with this product of standard simplices. The normalized map transports to a continuous self-map of the product using the feasibility and continuity lemmas. The theorem Brouwer_Product supplies a fixed point, which is transported back and converted into equilibrium by Lemma 5.1.
The dependent implementation must also transport actions along . These casts appear in its playerwise equivalence eMPlayer; the fixed-point calculation uses heterogeneous equality to reconcile coordinates whose action types have propositionally equal indices. This is a type-correct reindexing issue, not an additional mathematical assumption or the addition of dummy actions.
If is empty, the existence modules construct the unique empty profile directly; feasibility and fixed-point equality are vacuous. They do not invoke a product theorem requiring an inhabited finite index type in that branch. The native theorem nevertheless retains its stated NonemptyMove hypothesis. The dependent assumption is vacuous for empty .
The direct existence proofs in MixedBrouwer.lean and Existence.lean use the simplex-product bridge, continuity, and preservation. The separate compactness and convexity lemmas document the expected geometry; the final proof does not apply an abstract compact-convex fixed-point axiom to them.
An additional restricted-action interface
The dependent repository also contains Restricted.lean. Given an ambient finite type , legal finite sets , and an ambient payoff table, it defines
and restricts payoffs by forgetting each subtype membership proof. Nonempty legal sets make these dependent types nonempty, so exists_mixedNash_restricted applies Theorem 6.1 to the restricted game. No padding with unavailable or dummy actions is used.
For a dependent pure profile , let be its ambient image. The file proves that forgetting subtype proofs commutes with unilateral deviation, then establishes
This is restricted_dirac_mixed_nash_iff. Its proof uses the Dirac payoff identities from the mixed layer of Section 4.
The exact scope matters: equation (10) is a Dirac-profile and pure-deviation correspondence. The file does not construct an equivalence between arbitrary ambient mixed profiles and dependent mixed profiles. These restricted-action results are additional repository results, are not imported by the selected Solution.lean, and are not selected by the dependent entry’s comparator. Their exposition here must not be read as expanding that entry’s verified comparison surface.
Selected declarations and historical verification
The native registration is PALOMAR-2026-09-07-000009, version 1 [11]. In the namespace NashEquilibrium.Palomar, its six selected theorems are:
exists_nash_maximizing_ordinal_potential;
isNash_iff_potential_local_maximum;no_betterResponse_cycle_of_generalized_ordinal_potential;weaklyAcyclic_of_generalized_ordinal_potential;mixedNash_support_payoff_eq;exists_mixedNash.
The dependent registration is PALOMAR-2026-09-07-000014, version 1 [9]. Its selected namespace is DependentNash.Palomar, and its two theorems are exists_mixedNash and mixedNash_support_payoff_eq. The wrappers in each Solution.lean delegate to implementation theorems; comparator.json identifies the statement-side and solution-side declarations and the selected definitions.
The two records report the same Lean toolchain, leanprover/lean4:v4.33.0, and Mathlib revision db584cd6d46c92f209a44c0f1c829460d327499d. For the native entry, the recorded verification time is September 7, 2026, at 13:45:01 UTC, with workflow run 34128531761. For the dependent entry, it is September 7, 2026, at 20:52:40 UTC, with workflow run 34160743338. Both permit only propext, Quot.sound, and Classical.choice in the selected theorem axiom audit. The records include an external nanoda checker revision. These dated records are evidence about the configured declarations; registration is not a claim of journal peer review.
The native Challenge.lean contains two deliberate statement-side sorry holes, for weak acyclicity and mixed existence; the other selected targets, including support equalization, are proved there directly. The dependent challenge has two deliberate holes. The corresponding proofs are in the implementation and Solution.lean; the challenge files are not being presented as complete proof implementations. The inspected implementation modules and solution files contain no sorry or admit placeholders. Textual inspection alone is not a fresh kernel verification of the complete import closure.
Preparation of this manuscript included inspecting the pinned definitions, proof bodies, comparator configurations, and dependency metadata. The retrieved source files match their pinned Git blob identifiers, and the Challenge.lean and Solution.lean SHA-256 hashes match both immutable registry records. No new Lean build or rerun of the external checker was performed for this manuscript. Its mechanical verification claims refer to the dated records; its explanatory claims are grounded in source inspection. The dependent record’s warning about restricted-action scope is addressed by the explicit separation in Section 7.
Authorship disclosure and limitations
This manuscript was primarily drafted with GPT 6.1 under the authors’ direction. The submitting author reports understanding some parts of the work. This disclosure does not claim a complete independent human reconstruction or line-by-line human validation of every formal proof. Both pinned formalization.yaml files separately record GPT-5 Codex assistance with historical proof engineering. The manuscript model is not inferred to be the historical proof model, and model identity is not verification evidence.
The manuscript and its source are licensed CC BY 4.0. Both Lean projects declare BSD-3-Clause; the included fixed-point source retains its MIT notice. The manuscript license does not relicense those artifacts. The two registry entries list Arthur Freitas Ramos as formalization author and responsible maintainer. The present three-author manuscript byline does not alter that attribution or assert undocumented individual contributions.
The results concern finite strategic-form games, pure potential games, and independently mixed real-payoff games under the stated action hypotheses. They do not establish an equilibrium-selection procedure, uniqueness, computable approximation bounds, infinite-game existence, correlated-equilibrium results, or an economic interpretation beyond the encoded payoff model. The artifact’s value is its explicit separation of hypotheses, source-traceable proof interfaces, and reusable bridge between native game definitions and proved fixed-point infrastructure.
References
- [1]Alexander Bagnall, Samuel Merten, and Gordon Stewart. A library for algorithmic game theory in Ssreflect/Coq. Journal of Formalized Reasoning, 10(1):67–95, 2017. DOI: 10.6092/issn.1972-5787/7235.DOI
- [2]Leonardo de Moura and Sebastian Ullrich. The Lean 4 theorem prover and programming language. In André Platzer and Geoff Sutcliffe, editors, Automated Deduction – CADE 28, volume 12699 of Lecture Notes in Computer Science, pages 625–635, Cham, 2021. Springer. DOI: 10.1007/978-3-030-79876-5_37.DOI
- [3]Yuwei Lyu and Kai Li. Formalizing Scarf, Brouwer, and Nash in Lean, July 2026. Version 1; arXiv: 2607.05987v1; DOI: 10.48550/arXiv.2607.05987.DOI
- [4]Math_XMUM. Game theory formalization in Lean. GitHub repository, 2026. Commit 09941e849a81e520cc0cc53220f10f8e5f4768e0; MIT License; https://github.com/math-xmum/Brouwer/tree/09941e849a81e520cc0cc53220f10f8e5f4768e0.
- [5]Dov Monderer and Lloyd S. Shapley. Potential games. Games and Economic Behavior, 14(1):124–143, May 1996. DOI: 10.1006/game.1996.0044.DOI
- [6]John Nash. Non-cooperative games. Annals of Mathematics, 54(2):286–295, September 1951. DOI: 10.2307/1969529.DOI
- [7]John F. Nash, Jr. Equilibrium points in n-person games. Proceedings of the National Academy of Sciences of the United States of America, 36(1):48–49, January 1950. DOI: 10.1073/pnas.36.1.48.DOI
- [8]Arthur Freitas Ramos. Dependent finite mixed Nash equilibria in Lean. GitHub repository, 2026. Commit 2f65710af26a24a26660dd1e92d09adf1697a527; native sources BSD-3-Clause, vendored fixed-point sources MIT; https://github.com/Arthur742Ramos/dependent-nash-equilibrium-lean/tree/2f65710af26a24a26660dd1e92d09adf1697a527.
- [9]Arthur Freitas Ramos. Dependent finite mixed Nash equilibria in Lean. Palomar Registry, September 2026. PALOMAR-2026-09-07-000014, version 1; https://palomar-registry.org/entry?id=PALOMAR-2026-09-07-000014&version=1.
- [10]Arthur Freitas Ramos. Native Lean finite Nash equilibria. GitHub repository, 2026. Commit 6dd83f3b004c0318e52f4c3cb272d909efca321d; native sources BSD-3-Clause, vendored fixed-point sources MIT; https://github.com/Arthur742Ramos/nash-equilibrium-lean/tree/6dd83f3b004c0318e52f4c3cb272d909efca321d.
- [11]Arthur Freitas Ramos. Native Lean finite Nash equilibria. Palomar Registry, September 2026. PALOMAR-2026-09-07-000009, version 1; https://palomar-registry.org/entry?id=PALOMAR-2026-09-07-000009&version=1.
- [12]Arthur Freitas Ramos, David Barros Hulak, and Ruy Jose Guerra Barretto de Queiroz. Nash equilibria for finite games in Isabelle/HOL. Archive of Formal Proofs, May 2026. Formal proof development; https://isa-afp.org/entries/Nash_Equilibrium.html.
- [13]The mathlib Community. The Lean mathematical library. In Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2020, pages 367–381, New York, NY, USA, 2020. Association for Computing Machinery. DOI: 10.1145/3372885.3373824.DOI