Rational payoff and stopping stochastic game models
Definitionfriedmann_payoffRational 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.
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
Read-back
What the Lean code literally says, in plain math · Codex independent auditor (model identifier unavailable)
For any type , 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 with decidable equality. A scalar model on a finite set with decidable equality specifies a predicate of maximizing vertices, an action relation , two predicates and on total functions , and a rational payoff for every pair of such functions and start. For every , let be a classically chosen rational attained as by some with and satisfying for every with , if such an attained minimum exists; otherwise let . The scalar model imposes no general axiom on its fields. A strategy is improvable if there are with , , and . An update is allowed if and for every with . An improvement is an allowed update and, if is improvable, has strict inequality at at least one such . A local scalar step is an improvement satisfying for every and action ; a global scalar step is an improvement satisfying for every strategy allowed from and every . A Boolean parameter chooses the global rule when true and the local rule when false. A complete scalar run consists of and with , for every , improvability and the chosen step for every , and nonimprovability at ; is allowed and no condition is put on later sequence entries. A scalar hard instance of bound asserts , existence of at least one complete run, and for every complete run. A discounted game consists of an arena with Boolean owner , natural priority , and edge relation , an arbitrary rational reward , and a rational discount . It is well formed exactly when every vertex has an outgoing edge and ; there is no injectivity condition on here. For total functions , let when at owner- vertices or at owner- vertices, and otherwise. Its scalar model has equivalent to , actions , legality of each player's function exactly at that player's vertices, and payoff , with matrix-vector multiplication over . 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 , its induced discounted game keeps the arena, sets , with empty maximum , takes reward in , and takes in . Rational division by is , so this expression gives if its denominator is ; the definition itself does not require well-formedness. The discounted exponential proposition asserts the existence of a natural such that, for every Boolean rule choice and every natural , there exist a natural , a well-formed discounted game on , and an initial total strategy , with at most ordered arena edges, whose scalar model is a hard instance of bound for the chosen local or global scalar rule. The same must work for both rule choices and every positive , while the witnesses may depend on both. The proposition named the mean-via-reduction exponential proposition asserts the existence of a natural such that, for every Boolean rule choice and every natural , there exist a natural , an arena on with every vertex having an outgoing edge and injective natural priorities, and an initial total strategy , such that the arena has at most ordered edges, its induced discounted game is well formed, and the induced game's scalar model is a hard instance of bound for the chosen scalar rule; the conclusion is expressed entirely using that induced discounted model. A stochastic game on specifies a role , an edge relation , rational numbers for every ordered pair, and distinguished vertices and . A decision vertex of role means , , and ; a legal role- strategy is a total function satisfying at every such decision vertex, with unrestricted values elsewhere. For total functions , define the rational matrix to have zero rows at both terminals, the row concentrated at at nonterminal role- vertices, the row concentrated at at nonterminal role- vertices, and row at nonterminal role- vertices. Well-formedness means , every nonterminal has an outgoing edge, neither terminal has any outgoing edge, every role- decision row has nonnegative entries with zero entry whenever the corresponding edge is absent and has sum , and, for every legal role- function , every legal role- function , and every vertex , there is a finite path, possibly of length zero, from to or to along pairs with . 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- decision vertices as , as actions, role- and role- legality as and , and rational payoff vector , where at and elsewhere; again a singular matrix is assigned zero inverse. The stochastic edge count is the cardinality of . The stochastic exponential proposition asserts the existence of a natural such that, for every Boolean rule choice and every natural , there exist a natural , a well-formed stochastic game on , and an initial total strategy , with at most ordered edges and whose scalar model is a hard instance of bound for the chosen rule. The same works for both rule choices and all positive . In all these scalar exponential propositions, is excluded, the natural witness 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.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.