Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Policy improvement theorem for stochastic policies

Proved
SuttonBartoRL.DP.policy_improvement_theorem_stochastic

by mikedeng1 · Oct 4, 2026 · Mathlib 0df444a (Lean v4.33.1)

dynamic-programmingp2o-batch-b23bp2o-gran-per-chapterp2o-plan-bookp2o-v1reinforcement-learning

Let π\piπ and π′\pi'π′ be stochastic policies of a finite MDP with discount 0≤γ<10 \le \gamma < 10≤γ<1, and write

qπ(s,π′(s))  =  ∑aπ′(a∣s) qπ(s,a).q_\pi(s, \pi'(s)) \;=\; \sum_a \pi'(a\mid s)\, q_\pi(s,a).qπ​(s,π′(s))=a∑​π′(a∣s)qπ​(s,a).

If qπ(s,π′(s))≥vπ(s)q_\pi(s, \pi'(s)) \ge v_\pi(s)qπ​(s,π′(s))≥vπ​(s) for all s∈Ss \in \mathcal Ss∈S, then

vπ′(s)  ≥  vπ(s)for all s∈S,v_{\pi'}(s) \;\ge\; v_\pi(s) \qquad \text{for all } s \in \mathcal S,vπ′​(s)≥vπ​(s)for all s∈S,

and at every state sss where qπ(s,π′(s))>vπ(s)q_\pi(s, \pi'(s)) > v_\pi(s)qπ​(s,π′(s))>vπ​(s), also vπ′(s)>vπ(s)v_{\pi'}(s) > v_\pi(s)vπ′​(s)>vπ​(s).

This is the form of the theorem used for ε\varepsilonε-greedy improvement in Chapter 5 and for stochastic greedy policies that split probability among tied actions.

Formalization Note The book asserts only that the theorem "carries through as stated for the stochastic case" (p. 79). The reading of qπ(s,π′(s))q_\pi(s,\pi'(s))qπ​(s,π′(s)) as the π′\pi'π′-average of qπ(s,⋅)q_\pi(s,\cdot)qπ​(s,⋅) is the one the book itself uses in (5.2), p. 101.

Preamble
import Mathlib
import Definitions.Def_SuttonBartoRL_DP_MDP
import Definitions.Def_SuttonBartoRL_DP_ValueFunctions
Formal statement
namespace SuttonBartoRL.DP

/-- Policy improvement theorem for stochastic policies, Sutton & Barto (2018), p. 79 ("carries
through as stated for the stochastic case"), with `q_π(s, π'(s)) = Σ_a π'(a | s) q_π(s, a)` as in
(5.2), p. 101: if `Σ_a π'(a | s) q_π(s, a) ≥ v_π(s)` for all `s`, then `v_{π'}(s) ≥ v_π(s)` for all
`s`, strictly at every state where the hypothesis is strict. -/
theorem policy_improvement_theorem_stochastic {S A : Type} [Fintype S] [DecidableEq S]
    [Fintype A] (M : MDP S A) (γ : ℝ) (hγ0 : 0 ≤ γ) (hγ1 : γ < 1) (π π' : Policy S A)
    (h47 : ∀ s, stateValue M γ π s ≤ ∑ a, π'.prob s a * actionValue M γ π s a) :
    (∀ s, stateValue M γ π s ≤ stateValue M γ π' s) ∧
    (∀ s, stateValue M γ π s < ∑ a, π'.prob s a * actionValue M γ π s a →
      stateValue M γ π s < stateValue M γ π' s) := by sorry

end SuttonBartoRL.DP
Source
Sutton & Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press (2018), ISBN 9780262039246, §4.2, p. 79 ("carries through as stated for the stochastic case"); reading of q_π(s, π′(s)) from (5.2), p. 101
Human review
  • Endorsed by Shuze Chen · Oct 5, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 5, 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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me