Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Theorem 4.4 — w.p. ≥1−δ\ge 1-\delta≥1−δ, CPI improves ημ\eta_\muημ​ at every update, stops within 72R2/ε272R^2/\varepsilon^272R2/ε2 updates, returns π\piπ with OPT(Aπ,μ)<2ε\mathrm{OPT}(\mathbb A_{\pi,\mu})<2\varepsilonOPT(Aπ,μ​)<2ε

Proved
ApproxOptRL.CPI.cpi_guarantee

by mikedeng1 · Sep 28, 2026 · Mathlib 0df444a (Lean v4.33.1)

conservative-policy-iterationmdpp2o-batch-p200bp2o-gran-per-chapterp2o-plan-paperp2o-v1reinforcement-learning

Consider a finite MDP with nonempty state set SSS, nonempty action set AAA, transition probabilities P(s′;s,a)P(s';s,a)P(s′;s,a), rewards R(s,a)∈[0,R]\mathcal R(s,a)\in[0,R]R(s,a)∈[0,R] with R>0R>0R>0, discount factor 0≤γ<10\le\gamma<10≤γ<1, and restart distribution μ\muμ. Fix ε>0\varepsilon>0ε>0, δ>0\delta>0δ>0, an ε\varepsilonε-greedy policy chooser GεG_\varepsilonGε​ (Definition 4.3) and an initial policy π0\pi_0π0​.

Run conservative policy iteration (§5): in loop j=0,1,…j = 0,1,\dotsj=0,1,… with current policy πj\pi_jπj​, the chooser returns πj′=Gε(πj)\pi'_j = G_\varepsilon(\pi_j)πj′​=Gε​(πj​), a random estimate A^j\hat{\mathbb A}_jA^j​ of Aπj,μ(πj′)\mathbb A_{\pi_j,\mu}(\pi'_j)Aπj​,μ​(πj′​) is formed; if A^j<2ε3\hat{\mathbb A}_j<\frac{2\varepsilon}3A^j​<32ε​ the run stops and returns πj\pi_jπj​, and otherwise πj+1=(1−αj)πj+αjπj′\pi_{j+1} = (1-\alpha_j)\pi_j + \alpha_j\pi'_jπj+1​=(1−αj​)πj​+αj​πj′​ with αj=(1−γ)(A^j−ε/3)4R\alpha_j = \frac{(1-\gamma)(\hat{\mathbb A}_j-\varepsilon/3)}{4R}αj​=4R(1−γ)(A^j​−ε/3)​.

Step (2) of the algorithm uses enough μ\muμ-restarts that each estimate is ε3\frac\varepsilon33ε​-accurate except with small probability. This is assumed in the form: with N=⌊72R2/ε2⌋N=\lfloor 72R^2/\varepsilon^2\rfloorN=⌊72R2/ε2⌋, for every jjj,

Pr⁡(loop j is reached and ∣A^j−Aπj,μ(πj′)∣≥ε3)≤δN+1.\Pr\Big(\text{loop } j \text{ is reached and } \big|\hat{\mathbb A}_j - \mathbb A_{\pi_j,\mu}(\pi'_j)\big| \ge \tfrac\varepsilon3\Big) \le \frac{\delta}{N+1}.Pr(loop j is reached and ​A^j​−Aπj​,μ​(πj′​)​≥3ε​)≤N+1δ​.

Theorem 4.4. With probability at least 1−δ1-\delta1−δ, conservative policy iteration

  1. improves ημ\eta_\muημ​ with every policy update: ημ(πj+1)>ημ(πj)\eta_\mu(\pi_{j+1}) > \eta_\mu(\pi_j)ημ​(πj+1​)>ημ​(πj​) for every update jjj;
  2. ceases after at most 72R2ε272\frac{R^2}{\varepsilon^2}72ε2R2​ policy updates, that is, it stops in a loop τ\tauτ with τ≤72R2/ε2\tau\le 72R^2/\varepsilon^2τ≤72R2/ε2; and
  3. returns a policy π=πτ\pi=\pi_\tauπ=πτ​ such that
OPT(Aπ,μ)<2ε.\mathrm{OPT}(\mathbb A_{\pi,\mu}) < 2\varepsilon.OPT(Aπ,μ​)<2ε.

This is the main guarantee of the paper: with a greedy chooser of accuracy ε\varepsilonε, a number of iterations polynomial in R/εR/\varepsilonR/ε and independent of the size of the state space yields a policy close to the "break point" of the chooser.

Formalization Note The run is pathwise: the estimates are arbitrary real random variables A^j(ω)\hat{\mathbb A}_j(\omega)A^j​(ω) on a probability space, and Pr⁡\PrPr of a non-measurable set is its outer measure, so no measurability of the estimates is assumed. The conclusion is stated as "the failure event has probability at most δ\deltaδ". Two disclosed deviations from the printed statement: (a) the paper's (ii) says "at most 72R2/ε272R^2/\varepsilon^272R2/ε2 calls to GεG_\varepsilonGε​", but its proof bounds the number of policy updates, and the run calls GεG_\varepsilonGε​ once more than it updates (the final call precedes the STOP); (ii) is therefore stated for updates, equivalently at most 72R2/ε2+172R^2/\varepsilon^2+172R2/ε2+1 calls. (b) The per-loop failure budget is δ/(N+1)\delta/(N+1)δ/(N+1) for the N+1N+1N+1 loops that may be reached, instead of the proof's union bound over 72R2/ε272R^2/\varepsilon^272R2/ε2 loops, for the same off-by-one reason. The estimation procedure itself (Hoeffding's inequality (5.1)) is not formalized; its role is taken by the accuracy hypothesis. The step size is clipped at 111, which never binds on the accuracy event.

Preamble
import Mathlib
import Definitions.Def_FoundationsML_ReinforcementLearning_IsTransitionKernel
import Definitions.Def_FoundationsML_ReinforcementLearning_IsPolicy
import Definitions.Def_ApproxOptRL_Shared_Model
import Definitions.Def_ApproxOptRL_CPI_PolicyAdvantage
import Definitions.Def_ApproxOptRL_CPI_Algorithm
open ApproxOptRL.Shared
open FoundationsML.ReinforcementLearning MeasureTheory
Formal statement
namespace ApproxOptRL.CPI

/-- **Theorem 4.4** (Kakade–Langford, ICML 2002, p. 5; proof p. 8). With probability at least
`1 - δ`, conservative policy iteration (§5, p. 6), started from any policy `π₀` and run with an
`ε`-greedy policy chooser `G` (Definition 4.3):
(i) improves `η_μ` (strictly) with every policy update,
(ii) stops after at most `72 R²/ε²` policy updates, and
(iii) returns a policy `π` with `OPT(𝔸_{π,μ}) < 2ε`.

The run is driven by random estimates `est j ω` (the `Â` of step (2) in loop `j`, on the
probability space `(Ω, Pr)`). Step (2) is encoded by its guarantee: for each loop `j`, the
event "loop `j` is reached and `|Â - 𝔸_{π,μ}(π')| ≥ ε/3`" has probability at most
`δ/(N + 1)`, `N = ⌊72R²/ε²⌋`. The failure event is the complement of: there is a `τ`, the loop
in which the run stops, with `τ ≤ 72R²/ε²`, strict improvement of `η_μ` at each of the `τ`
updates, and `OPT(𝔸_{π_τ,μ}) < 2ε` for the returned policy `π_τ`.

Printed slip (disclosed): the paper's (ii) counts "calls to `G_ε`"; the proof (p. 8) bounds
the number of policy **updates**, and the run makes one more call to `G_ε` than updates, so
(ii) is stated for updates (equivalently: at most `72R²/ε² + 1` calls). -/
theorem cpi_guarantee {S A : Type} [Fintype S] [Fintype A] [DecidableEq S]
    [Nonempty S] [Nonempty A]
    (P : S → A → S → ℝ) (hP : IsTransitionKernel P)
    (r : S → A → ℝ) (R : ℝ) (hR : 0 < R) (hr : ∀ s a, 0 ≤ r s a ∧ r s a ≤ R)
    (γ : ℝ) (hγ0 : 0 ≤ γ) (hγ1 : γ < 1)
    (μ : S → ℝ) (hμ : IsStateDist μ)
    (ε δ : ℝ) (hε : 0 < ε) (hδ : 0 < δ)
    (G : (S → A → ℝ) → (S → A → ℝ)) (hG : IsGreedyChooser P r γ μ ε G)
    (π₀ : S → A → ℝ) (hπ₀ : IsPolicy π₀)
    {Ω : Type} [MeasurableSpace Ω] (Pr : Measure Ω) [IsProbabilityMeasure Pr]
    (est : ℕ → Ω → ℝ)
    (hest : ∀ j : ℕ,
      Pr {ω | (∀ i < j, 2 * ε / 3 ≤ est i ω) ∧
        ε / 3 ≤ |est j ω - policyAdvantage P r γ (cpiPolicy γ R ε G π₀ (fun i => est i ω) j) μ
          (G (cpiPolicy γ R ε G π₀ (fun i => est i ω) j))|}
        ≤ ENNReal.ofReal (δ / ((⌊72 * R ^ 2 / ε ^ 2⌋₊ : ℝ) + 1))) :
    Pr {ω | ¬ ∃ τ : ℕ, (τ : ℝ) ≤ 72 * R ^ 2 / ε ^ 2 ∧
        (∀ j < τ, 2 * ε / 3 ≤ est j ω) ∧ est τ ω < 2 * ε / 3 ∧
        (∀ j < τ, eta P r γ (cpiPolicy γ R ε G π₀ (fun i => est i ω) j) μ <
          eta P r γ (cpiPolicy γ R ε G π₀ (fun i => est i ω) (j + 1)) μ) ∧
        optPolicyAdvantage P r γ (cpiPolicy γ R ε G π₀ (fun i => est i ω) τ) μ < 2 * ε}
      ≤ ENNReal.ofReal δ := by sorry

end ApproxOptRL.CPI
Source
Kakade, Langford, Approximately Optimal Approximate Reinforcement Learning, ICML 2002, p. 5, Theorem 4.4 (algorithm p. 6, §5; proof p. 8, appendix §8)
Human review
  • Endorsed by Shuze Chen · Oct 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 1, 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