Theorem 4.4 — w.p. , CPI improves at every update, stops within updates, returns with
ProvedApproxOptRL.CPI.cpi_guaranteeConsider a finite MDP with nonempty state set , nonempty action set , transition probabilities , rewards with , discount factor , and restart distribution . Fix , , an -greedy policy chooser (Definition 4.3) and an initial policy .
Run conservative policy iteration (§5): in loop with current policy , the chooser returns , a random estimate of is formed; if the run stops and returns , and otherwise with .
Step (2) of the algorithm uses enough -restarts that each estimate is -accurate except with small probability. This is assumed in the form: with , for every ,
Theorem 4.4. With probability at least , conservative policy iteration
- improves with every policy update: for every update ;
- ceases after at most policy updates, that is, it stops in a loop with ; and
- returns a policy such that
This is the main guarantee of the paper: with a greedy chooser of accuracy , a number of iterations polynomial in 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 on a probability space, and 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 ". Two disclosed deviations from the printed statement: (a) the paper's (ii) says "at most calls to ", but its proof bounds the number of policy updates, and the run calls once more than it updates (the final call precedes the STOP); (ii) is therefore stated for updates, equivalently at most calls. (b) The per-loop failure budget is for the loops that may be reached, instead of the proof's union bound over 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 , which never binds on the accuracy event.
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
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
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.