Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Rational payoff and stopping stochastic game models

Definition
friedmann_payoff

by kmehltretter82 · Nov 7, 2026 · Mathlib 0df444a (Lean v4.33.1)

algorithm-analysisoliver-friedmanntheoretical-computer-science

Rational discounted Bellman values, the specified parity-to-payoff reduction, stopping stochastic absorption equations, and the corresponding local and global update rules. Validity predicates require total arenas, a discount in (0,1), or almost-sure absorption as appropriate.

Definition code
import Definitions.Def_friedmann_parity
import Mathlib.LinearAlgebra.Matrix.NonsingularInverse

set_option autoImplicit false

open Matrix

namespace FriedmannScalar

open scoped BigOperators

variable {V : Type} [Fintype V] [DecidableEq V]

/- A common interface for the actual payoff models below. Every instance in a
mission target is constructed from a concrete game, not supplied as a hypothesis.
-/
structure Model (V : Type) where
  maxNode : V → Prop
  action : V → V → Prop
  maxLegal : (V → V) → Prop
  minLegal : (V → V) → Prop
  payoff : (V → V) → (V → V) → V → ℚ

noncomputable def value (M : Model V) (σ : V → V) (v : V) : ℚ := by
  classical
  exact if h : ∃ a : ℚ,
      (∃ τ, M.minLegal τ ∧ M.payoff σ τ v = a) ∧
        ∀ τ, M.minLegal τ → a ≤ M.payoff σ τ v
    then Classical.choose h else 0

def Improving (M : Model V) (σ : V → V) (v w : V) : Prop :=
  M.maxNode v ∧ M.action v w ∧ value M σ (σ v) < value M σ w

def Improvable (M : Model V) (σ : V → V) : Prop := ∃ v w, Improving M σ v w

def Allowed (M : Model V) (σ σ' : V → V) : Prop :=
  M.maxLegal σ' ∧ ∀ v, M.maxNode v → value M σ (σ v) ≤ value M σ (σ' v)

def Improvement (M : Model V) (σ σ' : V → V) : Prop :=
  Allowed M σ σ' ∧ (Improvable M σ →
    ∃ v, M.maxNode v ∧ value M σ (σ v) < value M σ (σ' v))

def LocalStep (M : Model V) (σ σ' : V → V) : Prop :=
  Improvement M σ σ' ∧ ∀ v w, M.maxNode v → M.action v w →
    value M σ w ≤ value M σ (σ' v)

def GlobalStep (M : Model V) (σ σ' : V → V) : Prop :=
  Improvement M σ σ' ∧ ∀ ρ, Allowed M σ ρ → ∀ v, value M ρ v ≤ value M σ' v

def CompleteRun (M : Model V) (step : (V → V) → (V → V) → Prop)
    (ι : V → V) (T : ℕ) (run : ℕ → (V → V)) : Prop :=
  run 0 = ι ∧ (∀ t, t ≤ T → M.maxLegal (run t)) ∧
    (∀ t, t < T → Improvable M (run t) ∧ step (run t) (run (t + 1))) ∧
    ¬ Improvable M (run T)

def HardInstance (M : Model V) (ι : V → V)
    (step : (V → V) → (V → V) → Prop) (iterations : ℕ) : Prop :=
  M.maxLegal ι ∧ (∃ T run, CompleteRun M step ι T run) ∧
    ∀ T run, CompleteRun M step ι T run → iterations ≤ T

def rule (M : Model V) (global : Bool) : (V → V) → (V → V) → Prop :=
  if global then GlobalStep M else LocalStep M

end FriedmannScalar

namespace FriedmannDiscounted

open scoped BigOperators

structure Game (V : Type) where
  arena : FriedmannParity.Game V
  reward : V → ℚ
  discount : ℚ

variable {V : Type} [Fintype V] [DecidableEq V]

def WellFormed (G : Game V) : Prop :=
  (∀ v, ∃ w, G.arena.edge v w) ∧ 0 < G.discount ∧ G.discount < 1

noncomputable def transition (G : Game V) (σ τ : V → V) : Matrix V V ℚ := by
  classical
  exact fun v w => if (if G.arena.owner v = false then σ v else τ v) = w then 1 else 0

/- Exact rational solution of x = r + βPx. For 0 < β < 1 the matrix is
nonsingular, and this is the infinite discounted sum of the actual play. -/
noncomputable def playValue (G : Game V) (σ τ : V → V) : V → ℚ :=
  (1 - G.discount • transition G σ τ)⁻¹ *ᵥ G.reward

noncomputable def model (G : Game V) : FriedmannScalar.Model V where
  maxNode v := G.arena.owner v = false
  action := G.arena.edge
  maxLegal := FriedmannParity.Legal G.arena false
  minLegal := FriedmannParity.Legal G.arena true
  payoff := playValue G

noncomputable def induced (G : FriedmannParity.Game V) : Game V := by
  classical
  let r : V → ℚ := fun v => (-(Fintype.card V : ℚ)) ^ G.priority v
  let maxReward : ℕ := Finset.univ.sup (fun v => (Fintype.card V) ^ G.priority v)
  exact ⟨G, r, 1 - 1 / (4 * (Fintype.card V : ℚ) ^ 3 * (maxReward : ℚ))⟩

def Exponential : Prop :=
  ∃ C : ℕ, 0 < C ∧ ∀ global : Bool, ∀ n : ℕ, 0 < n →
    ∃ N : ℕ, ∃ G : Game (Fin N), ∃ ι : Fin N → Fin N,
      WellFormed G ∧ FriedmannParity.edgeCount G.arena ≤ C * n ∧
      FriedmannScalar.HardInstance (model G) ι
        (FriedmannScalar.rule (model G) global) (2 ^ n)

/- Mean-payoff policy iteration in this paper is run through its specified
discounted reduction. A direct mean-reward-only strict-switch algorithm is not
silently substituted, since it can stall at a nonoptimal strategy. -/
def ExponentialMeanViaReduction : Prop :=
  ∃ C : ℕ, 0 < C ∧ ∀ global : Bool, ∀ n : ℕ, 0 < n →
    ∃ N : ℕ, ∃ G : FriedmannParity.Game (Fin N), ∃ ι : Fin N → Fin N,
      FriedmannParity.WellFormed G ∧ FriedmannParity.edgeCount G ≤ C * n ∧
      WellFormed (induced G) ∧
      FriedmannScalar.HardInstance (model (induced G)) ι
        (FriedmannScalar.rule (model (induced G)) global) (2 ^ n)

end FriedmannDiscounted

namespace FriedmannStochastic

open scoped BigOperators

/- Roles 0 and 1 are Max and Min; role 2 is a random vertex. The two terminals
are excluded from these decision sets by explicit tests in every definition. -/
structure Game (V : Type) where
  role : V → Fin 3
  edge : V → V → Prop
  probability : V → V → ℚ
  win : V
  lose : V

variable {V : Type} [Fintype V] [DecidableEq V]

def Decision (G : Game V) (p : Fin 3) (v : V) : Prop :=
  v ≠ G.win ∧ v ≠ G.lose ∧ G.role v = p

def Legal (G : Game V) (p : Fin 3) (σ : V → V) : Prop :=
  ∀ v, Decision G p v → G.edge v (σ v)

noncomputable def transition (G : Game V) (σ τ : V → V) : Matrix V V ℚ := by
  classical
  exact fun v w => if v = G.win ∨ v = G.lose then 0
    else if G.role v = 0 then (if σ v = w then 1 else 0)
    else if G.role v = 1 then (if τ v = w then 1 else 0)
    else G.probability v w

def WellFormed (G : Game V) : Prop :=
  G.win ≠ G.lose ∧
  (∀ v, v ≠ G.win → v ≠ G.lose → ∃ w, G.edge v w) ∧
  (∀ w, ¬ G.edge G.win w ∧ ¬ G.edge G.lose w) ∧
  (∀ v w, Decision G 2 v → 0 ≤ G.probability v w ∧
    (¬ G.edge v w → G.probability v w = 0)) ∧
  (∀ v, Decision G 2 v → ∑ w, G.probability v w = 1) ∧
  ∀ σ τ, Legal G 0 σ → Legal G 1 τ → ∀ v,
    Relation.ReflTransGen (fun a b => 0 < transition G σ τ a b) v G.win ∨
    Relation.ReflTransGen (fun a b => 0 < transition G σ τ a b) v G.lose

/- Absorption probabilities, obtained from the finite transient transition
matrix. Almost-sure halting in WellFormed makes I-P nonsingular. -/
noncomputable def playValue (G : Game V) (σ τ : V → V) : V → ℚ := by
  classical
  exact (1 - transition G σ τ)⁻¹ *ᵥ (fun v => if v = G.win then 1 else 0)

noncomputable def model (G : Game V) : FriedmannScalar.Model V where
  maxNode := Decision G 0
  action := G.edge
  maxLegal := Legal G 0
  minLegal := Legal G 1
  payoff := playValue G

noncomputable def edgeCount (G : Game V) : ℕ := by
  classical
  exact (Finset.univ.filter (fun e : V × V => G.edge e.1 e.2)).card

def Exponential : Prop :=
  ∃ C : ℕ, 0 < C ∧ ∀ global : Bool, ∀ n : ℕ, 0 < n →
    ∃ N : ℕ, ∃ G : Game (Fin N), ∃ ι : Fin N → Fin N,
      WellFormed G ∧ edgeCount G ≤ C * n ∧
      FriedmannScalar.HardInstance (model G) ι
        (FriedmannScalar.rule (model G) global) (2 ^ n)

end FriedmannStochastic
Source
Friedmann, LMCS2011, §9; https://arxiv.org/abs/1106.0778
Read-back

What the Lean code literally says, in plain math · Codex independent auditor (model identifier unavailable)

For any type VVV, the scalar-model record has a predicate of maximizing vertices, an action relation, predicates of legal maximizing and minimizing total functions, and a rational payoff for every pair of functions and start; the following constructions use finite VVV with decidable equality. A scalar model on a finite set VVV with decidable equality specifies a predicate X(v)X(v)X(v) of maximizing vertices, an action relation E(v,w)E(v,w)E(v,w), two predicates Lmax⁡\mathcal L_{\max}Lmax​ and Lmin⁡\mathcal L_{\min}Lmin​ on total functions V→VV\to VV→V, and a rational payoff F(σ,τ,v)F(\sigma,\tau,v)F(σ,τ,v) for every pair of such functions and start. For every σ,v\sigma,vσ,v, let qσ(v)q_\sigma(v)qσ​(v) be a classically chosen rational aaa attained as F(σ,τ,v)F(\sigma,\tau,v)F(σ,τ,v) by some τ\tauτ with Lmin⁡(τ)\mathcal L_{\min}(\tau)Lmin​(τ) and satisfying a≤F(σ,τ′,v)a\le F(\sigma,\tau',v)a≤F(σ,τ′,v) for every τ′\tau'τ′ with Lmin⁡(τ′)\mathcal L_{\min}(\tau')Lmin​(τ′), if such an attained minimum exists; otherwise let qσ(v)=0q_\sigma(v)=0qσ​(v)=0. The scalar model imposes no general axiom on its fields. A strategy σ\sigmaσ is improvable if there are v,wv,wv,w with X(v)X(v)X(v), E(v,w)E(v,w)E(v,w), and qσ(σ(v))<qσ(w)q_\sigma(\sigma(v))<q_\sigma(w)qσ​(σ(v))<qσ​(w). An update σ↦σ′\sigma\mapsto\sigma'σ↦σ′ is allowed if Lmax⁡(σ′)\mathcal L_{\max}(\sigma')Lmax​(σ′) and qσ(σ(v))≤qσ(σ′(v))q_\sigma(\sigma(v))\le q_\sigma(\sigma'(v))qσ​(σ(v))≤qσ​(σ′(v)) for every vvv with X(v)X(v)X(v). An improvement is an allowed update and, if σ\sigmaσ is improvable, has strict inequality at at least one such vvv. A local scalar step is an improvement satisfying qσ(w)≤qσ(σ′(v))q_\sigma(w)\le q_\sigma(\sigma'(v))qσ​(w)≤qσ​(σ′(v)) for every X(v)X(v)X(v) and action E(v,w)E(v,w)E(v,w); a global scalar step is an improvement satisfying qρ(v)≤qσ′(v)q_\rho(v)\le q_{\sigma'}(v)qρ​(v)≤qσ′​(v) for every strategy ρ\rhoρ allowed from σ\sigmaσ and every vvv. A Boolean parameter chooses the global rule when true and the local rule when false. A complete scalar run consists of T∈NT\in\mathbb NT∈N and (σt)t∈N(\sigma_t)_{t\in\mathbb N}(σt​)t∈N​ with σ0=ι\sigma_0=\iotaσ0​=ι, Lmax⁡(σt)\mathcal L_{\max}(\sigma_t)Lmax​(σt​) for every t≤Tt\le Tt≤T, improvability and the chosen step for every t<Tt<Tt<T, and nonimprovability at TTT; T=0T=0T=0 is allowed and no condition is put on later sequence entries. A scalar hard instance of bound LLL asserts Lmax⁡(ι)\mathcal L_{\max}(\iota)Lmax​(ι), existence of at least one complete run, and L≤TL\le TL≤T for every complete run. A discounted game consists of an arena with Boolean owner ooo, natural priority ddd, and edge relation EEE, an arbitrary rational reward r:V→Qr:V\to\mathbb Qr:V→Q, and a rational discount β\betaβ. It is well formed exactly when every vertex has an outgoing edge and 0<β<10<\beta<10<β<1; there is no injectivity condition on ddd here. For total functions σ,τ\sigma,\tauσ,τ, let Pσ,τ(v,w)=1P_{\sigma,\tau}(v,w)=1Pσ,τ​(v,w)=1 when w=σ(v)w=\sigma(v)w=σ(v) at owner-000 vertices or w=τ(v)w=\tau(v)w=τ(v) at owner-111 vertices, and 000 otherwise. Its scalar model has X(v)X(v)X(v) equivalent to o(v)=0o(v)=0o(v)=0, actions EEE, legality of each player's function exactly at that player's vertices, and payoff F(σ,τ,⋅)=(I−βPσ,τ)−1rF(\sigma,\tau,\cdot)=(I-\beta P_{\sigma,\tau})^{-1}rF(σ,τ,⋅)=(I−βPσ,τ​)−1r, with matrix-vector multiplication over Q\mathbb QQ. All matrix inverses here mean the ordinary inverse when nonsingular and the zero matrix when singular; thus the payoff remains total for arbitrary supplied games and functions. For a parity arena on VVV, its induced discounted game keeps the arena, sets m=∣V∣m=|V|m=∣V∣, R=max⁡v∈Vmd(v)R=\max_{v\in V}m^{d(v)}R=maxv∈V​md(v) with empty maximum 000, takes reward r(v)=(−m)d(v)r(v)=(-m)^{d(v)}r(v)=(−m)d(v) in Q\mathbb QQ, and takes β=1−1/(4m3R)\beta=1-1/(4m^3R)β=1−1/(4m3R) in Q\mathbb QQ. Rational division by 000 is 000, so this expression gives β=1\beta=1β=1 if its denominator is 000; the definition itself does not require well-formedness. The discounted exponential proposition asserts the existence of a natural C>0C>0C>0 such that, for every Boolean rule choice and every natural n>0n>0n>0, there exist a natural NNN, a well-formed discounted game on {0,…,N−1}\{0,\ldots,N-1\}{0,…,N−1}, and an initial total strategy ι\iotaι, with at most CnCnCn ordered arena edges, whose scalar model is a hard instance of bound 2n2^n2n for the chosen local or global scalar rule. The same CCC must work for both rule choices and every positive nnn, while the witnesses may depend on both. The proposition named the mean-via-reduction exponential proposition asserts the existence of a natural C>0C>0C>0 such that, for every Boolean rule choice and every natural n>0n>0n>0, there exist a natural NNN, an arena on {0,…,N−1}\{0,\ldots,N-1\}{0,…,N−1} with every vertex having an outgoing edge and injective natural priorities, and an initial total strategy ι\iotaι, such that the arena has at most CnCnCn ordered edges, its induced discounted game is well formed, and the induced game's scalar model is a hard instance of bound 2n2^n2n for the chosen scalar rule; the conclusion is expressed entirely using that induced discounted model. A stochastic game on VVV specifies a role a:V→{0,1,2}a:V\to\{0,1,2\}a:V→{0,1,2}, an edge relation EEE, rational numbers p(v,w)p(v,w)p(v,w) for every ordered pair, and distinguished vertices w+w_+w+​ and w−w_-w−​. A decision vertex of role iii means v≠w+v\ne w_+v=w+​, v≠w−v\ne w_-v=w−​, and a(v)=ia(v)=ia(v)=i; a legal role-iii strategy is a total function σ:V→V\sigma:V\to Vσ:V→V satisfying E(v,σ(v))E(v,\sigma(v))E(v,σ(v)) at every such decision vertex, with unrestricted values elsewhere. For total functions σ,τ\sigma,\tauσ,τ, define the rational matrix Pσ,τP_{\sigma,\tau}Pσ,τ​ to have zero rows at both terminals, the row concentrated at σ(v)\sigma(v)σ(v) at nonterminal role-000 vertices, the row concentrated at τ(v)\tau(v)τ(v) at nonterminal role-111 vertices, and row p(v,⋅)p(v,\cdot)p(v,⋅) at nonterminal role-222 vertices. Well-formedness means w+≠w−w_+\ne w_-w+​=w−​, every nonterminal has an outgoing edge, neither terminal has any outgoing edge, every role-222 decision row has nonnegative entries with zero entry whenever the corresponding edge is absent and has sum 111, and, for every legal role-000 function σ\sigmaσ, every legal role-111 function τ\tauτ, and every vertex vvv, there is a finite path, possibly of length zero, from vvv to w+w_+w+​ or to w−w_-w−​ along pairs with Pσ,τ(x,y)>0P_{\sigma,\tau}(x,y)>0Pσ,τ​(x,y)>0. This last requirement is finite positive-transition reachability for every legal pair. Probabilities at other rows and terminal roles are unrestricted by these conditions. Its scalar model takes role-000 decision vertices as XXX, EEE as actions, role-000 and role-111 legality as Lmax⁡\mathcal L_{\max}Lmax​ and Lmin⁡\mathcal L_{\min}Lmin​, and rational payoff vector (I−Pσ,τ)−1b(I-P_{\sigma,\tau})^{-1}b(I−Pσ,τ​)−1b, where b(v)=1b(v)=1b(v)=1 at w+w_+w+​ and 000 elsewhere; again a singular matrix is assigned zero inverse. The stochastic edge count is the cardinality of {(v,w):E(v,w)}\{(v,w):E(v,w)\}{(v,w):E(v,w)}. The stochastic exponential proposition asserts the existence of a natural C>0C>0C>0 such that, for every Boolean rule choice and every natural n>0n>0n>0, there exist a natural NNN, a well-formed stochastic game on {0,…,N−1}\{0,\ldots,N-1\}{0,…,N−1}, and an initial total strategy ι\iotaι, with at most CnCnCn ordered edges and whose scalar model is a hard instance of bound 2n2^n2n for the chosen rule. The same CCC works for both rule choices and all positive nnn. In all these scalar exponential propositions, n=0n=0n=0 is excluded, the natural witness NNN is not separately required to be positive, edge counts count ordered pairs satisfying the edge relation, and there are no stated bounds on reward magnitudes, rational denominators, or encoding lengths.

Human review
  • Endorsed by Shuze Chen · Nov 7, 2026

    Confirmed by the moderator at approval.

  • Endorsed by kmehltretter82 · Nov 7, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me