Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 3.1.2 — the finite horizon optimality equation and the characterization of optimal policies

Proved
SennottDP.FiniteHorizon.optimality_equation

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

dynamic-programmingfinite-horizonoptimality-equationp2o-batch-b23ap2o-gran-per-chapterp2o-plan-bookp2o-v1

Let Δ\DeltaΔ be an MDC with countable state space, F≥0F \ge 0F≥0 a finite terminal cost, and 0<α≤10 < \alpha \le 10<α≤1. The finite horizon value function satisfies the finite horizon optimality equation

vα,n(i)=min⁡a∈Ai{C(i,a)+α∑jPij(a) vα,n−1(j)},i∈S, n≥1.(3.2)v_{\alpha,n}(i) = \min_{a \in A_i} \Big\{ C(i,a) + \alpha \sum_j P_{ij}(a)\, v_{\alpha,n-1}(j) \Big\}, \qquad i \in S,\ n \ge 1. \tag{3.2}vα,n​(i)=a∈Ai​min​{C(i,a)+αj∑​Pij​(a)vα,n−1​(j)},i∈S, n≥1.(3.2)

Moreover, with Bi(α,n)B_i(\alpha,n)Bi​(α,n) the set of actions attaining this minimum:

  1. A policy θ\thetaθ is optimal for the 111 horizon if and only if, for every initial state iii, the distribution θ(⋅∣i)\theta(\cdot \mid i)θ(⋅∣i) is concentrated on Bi(α,1)B_i(\alpha,1)Bi​(α,1).
  2. For n≥2n \ge 2n≥2, a policy θ\thetaθ is optimal for the nnn horizon if and only if, for every initial state iii: (1) θ(⋅∣i)\theta(\cdot \mid i)θ(⋅∣i) is concentrated on Bi(α,n)B_i(\alpha,n)Bi​(α,n); and (2) if vα,n(i)<∞v_{\alpha,n}(i) < \inftyvα,n​(i)<∞, then for every action aaa with θ(a∣i)>0\theta(a \mid i) > 0θ(a∣i)>0 and every state jjj with Pij(a)>0P_{ij}(a) > 0Pij​(a)>0, the continuation policy ψ(i,a,j)\psi(i,a,j)ψ(i,a,j) that θ\thetaθ follows from t=1t = 1t=1 is optimal for the n−1n-1n−1 horizon at the initial state jjj: vψ(i,a,j),α,n−1(j)=vα,n−1(j)v_{\psi(i,a,j),\alpha,n-1}(j) = v_{\alpha,n-1}(j)vψ(i,a,j),α,n−1​(j)=vα,n−1​(j).

Policies here are general: history dependent and randomized. The theorem gives both the recursion that computes vα,nv_{\alpha,n}vα,n​ and Bellman's principle of optimality in necessary-and-sufficient form.

Formalization Note The book states (2) without the clause "if vα,n(i)<∞v_{\alpha,n}(i) < \inftyvα,n​(i)<∞". That clause is needed for the "only if" direction: when vα,n(i)=∞v_{\alpha,n}(i) = \inftyvα,n​(i)=∞, every policy attains vα,n(i)v_{\alpha,n}(i)vα,n​(i), including one that acts suboptimally after reaching a state jjj with vα,n−1(j)<∞v_{\alpha,n-1}(j) < \inftyvα,n−1​(j)<∞. The book's proof of necessity uses a strict inequality that holds only when vα,n(i)v_{\alpha,n}(i)vα,n​(i) is finite. "Given the process moves to state jjj at t=1t = 1t=1" is read as: the pair (a,j)(a,j)(a,j) is reachable, θ(a∣i)>0\theta(a \mid i) > 0θ(a∣i)>0 and Pij(a)>0P_{ij}(a) > 0Pij​(a)>0. The continuation policy is θ.shift i a, and θ.σ [] i a is θ(a∣i)\theta(a \mid i)θ(a∣i).

Preamble
import Mathlib
import Definitions.Def_SennottDP_FiniteHorizon_MDC
import Definitions.Def_SennottDP_FiniteHorizon_Criterion

open scoped ENNReal NNReal Topology
open Filter
Formal statement
namespace SennottDP.FiniteHorizon

/-- Theorem 3.1.2 (Sennott, pp. 36–37), with a correction to the necessity of (ii)(2).
Let `0 < α ≤ 1` and a nonnegative terminal cost `F`. The finite horizon value function satisfies
the finite horizon optimality equation (3.2)
`v_{α,n}(i) = min_{a ∈ A_i} {C(i,a) + α ∑_j P_ij(a) v_{α,n−1}(j)}`, `i ∈ S`, `n ≥ 1`, and:
(i) a (general) policy `θ` is optimal for the 1 horizon iff for every initial state `i` the
distribution `θ(· | i)` is concentrated on `B_i(α, 1)`;
(ii) for `n ≥ 2`, `θ` is optimal for the `n` horizon iff for every initial state `i`:
(1) `θ(· | i)` is concentrated on `B_i(α, n)`, and (2) whenever `v_{α,n}(i) < ∞`, for every
action `a` with `θ(a | i) > 0` and every state `j` with `P_ij(a) > 0`, the continuation policy
`ψ(i, a, j)` of `θ` is optimal for the `n − 1` horizon at `j`.
The guard `v_{α,n}(i) < ∞` in (2) is not in the book; without it the "only if" fails when
`v_{α,n}(i) = ∞` (then every policy is optimal at `i`). -/
theorem optimality_equation {S Act : Type} [Countable S] (M : MDC S Act) (F : S → ℝ≥0)
    (α : ℝ≥0) (hα0 : 0 < α) (hα1 : α ≤ 1) :
    (∀ n, 1 ≤ n → ∀ i, M.value F α n i = (M.A i).inf' (M.A_nonempty i) (M.aux F α n i)) ∧
    (∀ θ : M.Policy, M.IsOptimal F α 1 θ ↔
      ∀ i a, θ.σ [] i a ≠ 0 → a ∈ M.minSet F α 1 i) ∧
    (∀ n, 2 ≤ n → ∀ θ : M.Policy, M.IsOptimal F α n θ ↔
      ∀ i, (∀ a, θ.σ [] i a ≠ 0 → a ∈ M.minSet F α n i) ∧
        (M.value F α n i < ⊤ → ∀ a j, θ.σ [] i a ≠ 0 → M.P i a j ≠ 0 →
          MDC.horizonCost F α (θ.shift i a) (n - 1) j = M.value F α (n - 1) j)) := by sorry

end SennottDP.FiniteHorizon
Source
Sennott, Stochastic Dynamic Programming and the Control of Queueing Systems (Wiley, 1999), pp. 36–37, Theorem 3.1.2 (Eq. (3.2)); proof pp. 37–39
Human review
  • Endorsed by Shuze Chen · Oct 2, 2026

    Confirmed by the moderator at approval.

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