Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 8.3.5 — one algorithm acts T-step optimally at all but NAT timesteps in every deterministic MDP

Proved
SampleComplexityRL.Exploration.deterministic_sample_complexity

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

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

Fix a finite state set SSS with N=∣S∣N=|S|N=∣S∣ states, a finite nonempty action set with AAA actions, and a horizon T≥1T\ge1T≥1. There exists a single algorithm A\mathcal AA — a deterministic function of the observed path (s0,a0,r0,…,st)(s_0,a_0,r_0,\dots,s_t)(s0​,a0​,r0​,…,st​) of states, actions and rewards — with the following property. For every deterministic MDP on these states and actions (next-state map fff, rewards r(s,a)∈[0,1]r(s,a)\in[0,1]r(s,a)∈[0,1]), every start state s0s_0s0​ and every number of epochs LLL, the path ccc produced by running A\mathcal AA from s0s_0s0​ satisfies

UA(ct)=U∗(ct)U_{\mathcal A}(c_t)=U^*(c_t)UA​(ct​)=U∗(ct​)

for all but at most NATNATNAT times t<Lt<Lt<L. Here UA(ct)=1T∑τ=tt′−1r(sτ,aτ)U_{\mathcal A}(c_t)=\frac1T\sum_{\tau=t}^{t'-1}r(s_\tau,a_\tau)UA​(ct​)=T1​∑τ=tt′−1​r(sτ​,aτ​) is the normalized reward the algorithm collects from ttt to the TTT-step end time t′t't′ of ttt, and U∗(ct)U^*(c_t)U∗(ct​) is the best such reward any algorithm could collect from the same subpath.

The bound does not depend on LLL: however long the algorithm runs, it fails to act TTT-step optimally at most NATNATNAT times. It is matched by the thesis's lower bound Ω(NAT)\Omega(NAT)Ω(NAT) (Theorem 8.3.6).

Formalization Note The printed statement fixes the MDP before the algorithm ("Let MMM be … There exists an algorithm"), which an algorithm knowing MMM satisfies trivially. The thesis's algorithm (RmaxR_{max}Rmax​ with m=1m=1m=1, p. 114) does not know MMM, and Theorem 8.3.1 says the algorithm takes only N,A,TN,A,TN,A,T (and ε,δ\varepsilon,\deltaε,δ) as inputs; here the algorithm is chosen before the MDP, the start state and LLL. The algorithm observes rewards, as RmaxR_{max}Rmax​ does (p. 105). Times are 0-based and counted for t<Lt<Lt<L for every LLL, which is equivalent to the printed "t≤Lt\le Lt≤L". In a deterministic MDP the expectation in UAU_{\mathcal A}UA​ is the realised sum, and U∗(ct)U^*(c_t)U∗(ct​) is the best normalized reward over action sequences of length t′−tt'-tt′−t from sts_tst​ (Markov property, p. 102).

Preamble
import Mathlib
import Definitions.Def_SampleComplexityRL_Exploration_Online
Formal statement
namespace SampleComplexityRL.Exploration

/-- **Theorem 8.3.5 (Deterministic Sample Complexity)** (Kakade 2003, p. 104), uniform form.
Fix finite state and action sets `S`, `A` (`N = |S|`, `A = |A|`) and a horizon `T ≥ 1`. There is
one algorithm — a deterministic function of the observed state–action–reward path, chosen before
the MDP — such that for every deterministic MDP (next-state map `f`, rewards `r` in `[0,1]`), every
start state `s₀` and every number of epochs `L`, the run `c` of the algorithm satisfies
`U_A(c_t) = U*(c_t)` at all but at most `N·A·T` times `t < L`.

The printed statement reads "Let `M` be … There exists an algorithm `A`", i.e. `∀ M ∃ A`, which
is trivially satisfied by an algorithm that knows `M`; the thesis's algorithm (R_max with `m = 1`,
p. 114) does not know `M`, and Theorem 8.3.1 says the algorithm takes only `N, A, T` as inputs, so
the algorithm is quantified before the MDP. Rewards are part of the observed path (p. 105:
"Estimating the reward function is trivial"). -/
theorem deterministic_sample_complexity {S A : Type} [Fintype S] [DecidableEq S] [Fintype A]
    [DecidableEq A] [Nonempty A] (T : ℕ) (hT : 0 < T) :
    ∃ alg : OnlineAlg S A,
      ∀ (f : S → A → S) (r : S → A → ℝ), (∀ s a, 0 ≤ r s a ∧ r s a ≤ 1) →
        ∀ (s₀ : S) (L : ℕ),
          ((Finset.range L).filter
              (fun t => algValue f r T alg s₀ t ≠ optValue f r T alg s₀ t)).card
            ≤ Fintype.card S * Fintype.card A * T := by sorry

end SampleComplexityRL.Exploration
Source
Kakade, On the Sample Complexity of Reinforcement Learning, PhD thesis, University College London, 2003, p. 104, Theorem 8.3.5 (definitions pp. 100, 102; algorithm pp. 108, 114)
Human review
  • Endorsed by Shuze Chen · Oct 7, 2026

    Confirmed by the moderator at approval.

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