Lemma B.4 (as proved): returns bound, branched rollout
ProvedWhenToTrustYourModel.branched_returns_boundConsider a discounted Markov decision process with finite state and action sets, discount , a reward with and an initial distribution . Fix a branch length . For , process starts from , uses the post-branch policy and dynamics at the branch steps , and the pre-branch policy and dynamics at the steps ; is its return and is the state marginal of process 1. Suppose
- for every ;
- for every ;
- and .
Then
This is the returns bound from which Theorems 4.2 and 4.3 are assembled.
Formalization Note The paper does not define the branched rollout formally. Its proof bounds the state-action marginals at the times by the post-branch errors alone and at the times by pre-branch errors plus post-branch errors, so the branch segment is the first time steps; the Lean statement uses that ordering. If instead the pre-branch segment comes first, as the text of Section 4.2 suggests, the statement is false: with one state, rewards , , and pre-branch policies at total variation used only at times and , the returns differ by about while the bound is . The paper writes the model error as an expected KL divergence of ; as in Lemma B.3, the proof uses the total variation of the dynamics. The pre-branch and post-branch model errors are required at the pre-branch and post-branch times respectively.
import Mathlib import Definitions.Def_WhenToTrustYourModel_Basic open Finset
namespace WhenToTrustYourModel
theorem branched_returns_bound {S A : Type*} [Fintype S] [Fintype A]
(γ : ℝ) (hγ₀ : 0 < γ) (hγ₁ : γ < 1)
(r : S → A → ℝ) (rmax : ℝ) (hr : ∀ s a, |r s a| ≤ rmax)
(ρ₀ : S → ℝ) (hρ₀ : IsDist ρ₀) (k : ℕ)
(π₁pre π₂pre π₁post π₂post : S → A → ℝ)
(hπ₁pre : IsPolicy π₁pre) (hπ₂pre : IsPolicy π₂pre)
(hπ₁post : IsPolicy π₁post) (hπ₂post : IsPolicy π₂post)
(P₁pre P₂pre P₁post P₂post : S → A → S → ℝ)
(hP₁pre : IsDynamics P₁pre) (hP₂pre : IsDynamics P₂pre)
(hP₁post : IsDynamics P₁post) (hP₂post : IsDynamics P₂post)
(εmpre εmpost επpre επpost : ℝ)
(hmpre : ∀ t, k ≤ t →
expectedTV (stateDist ρ₀ (phase k π₁post π₁pre) (phase k P₁post P₁pre) t)
π₁pre P₁pre P₂pre ≤ εmpre)
(hmpost : ∀ t, t < k →
expectedTV (stateDist ρ₀ (phase k π₁post π₁pre) (phase k P₁post P₁pre) t)
π₁post P₁post P₂post ≤ εmpost)
(hπpre : ∀ s, tvDist (π₁pre s) (π₂pre s) ≤ επpre)
(hπpost : ∀ s, tvDist (π₁post s) (π₂post s) ≤ επpost) :
|branchedReturn γ r ρ₀ k π₁post P₁post π₁pre P₁pre -
branchedReturn γ r ρ₀ k π₂post P₂post π₂pre P₂pre| ≤
2 * rmax * (γ ^ (k + 1) / (1 - γ) ^ 2 * (εmpre + επpre) + k / (1 - γ) * (εmpost + επpost)
+ γ ^ k / (1 - γ) * επpre + 1 / (1 - γ) * επpost) := by sorry
end WhenToTrustYourModelRead-back
What the Lean code literally says, in plain math · claude-opus-5-5
Setting. Let (states) and (actions) be arbitrary finite sets. A distribution on a finite set is a function with for all and . A policy is a function such that is a distribution on for every . A dynamics is a function such that is a distribution on for every pair .
The total variation distance between two functions is
Two-phase schedules. For , the phase schedule selects a "post" object at the early times and a "pre" object at all times :
Processes and returns. Take a time-indexed policy sequence , a dynamics sequence , and an initial function . The state marginals are defined recursively:
The expected reward at time is
and the discounted return is the series . This series is assigned the value if it is not summable.
The branched return is the discounted return of the process that, at time :
- uses policy and dynamics for ;
- uses and for .
Both the reward at time and the transition from to use the time- policy and dynamics. Let denote the state marginals of the process built from , scheduled this way from .
Hypotheses. The theorem quantifies over the following data:
- a discount factor with ;
- a reward and a real number with for all ;
- a distribution on ;
- a natural number , which may be ;
- four policies ;
- four dynamics ;
- four real numbers , which are not explicitly required to be nonnegative.
These must satisfy the following conditions:
- Pre-phase model error. For every time :
- Post-phase model error. For every time :
This condition is vacuous when .
- Pre-phase policy divergence. For every state (a worst-case bound, not an average):
- Post-phase policy divergence. For every state :
In conditions 1 and 2, the state weights are always those of process 1, and the actions are always weighted by process 1's policies.
Conclusion. The difference between the two branched returns satisfies
Edge cases.
- Nonempty spaces. Because must have total mass , is nonempty. Because each policy must be a distribution on at every state, is nonempty. Consequently , , and .
- The case . The "post" objects never appear in either return. Condition 2 is vacuous, so is unconstrained, but its term is multiplied by . The term still appears in the bound.
- Summability. Under the hypotheses, every (and likewise process 2's marginals) is a distribution. Hence for every , and both return series converge.
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.