Later ratio factors drop out: (5.14)
ProvedSuttonBartoRL.ImportanceSampling.per_decision_reward_termLet cover , start episodes at and generate them with , and assume that under every episode from terminates within steps with probability one. Then for every ,
where is taken to be if the episode has terminated before time . For this is (5.14): only the first factor of the ratio matters for the first reward.
The identity is the key step towards per-decision importance sampling: the factors of the ratio for decisions made after a reward are irrelevant in expectation.
Formalization Note The book writes the identity for a general time with over trajectories under ; here and the expectation is conditional on (the Markov property makes the two equivalent). The book does not state a termination assumption; the bounded-horizon hypothesis () makes every expectation a finite sum and is a restriction relative to the book's episodic setting.
import Mathlib import Definitions.Def_SuttonBartoRL_ImportanceSampling_Episodes
namespace SuttonBartoRL.ImportanceSampling
/-- Sutton & Barto (2018), §5.9, p. 114, Eq. (5.14) (`k = 1`) and its `k`-th form:
`E_b[ρ_{t:T-1} R_{t+k}] = E_b[ρ_{t:t+k-1} R_{t+k}]`, with `t = 0` and `S_0 = s`, where the reward
`R_k` is `0` if the episode has terminated before time `k`. Hypotheses: coverage, and termination of
every episode from `s` under `b` within `H` steps with probability one. -/
theorem per_decision_reward_term {S A : Type} [Fintype S] [DecidableEq S] [Fintype A]
(M : MDP S A) (term : Finset S) (π b : SuttonBartoRL.FiniteMDP.Policy S A) (hcov : Coverage π b) (s : S) (H : ℕ)
(hH : ∑ n ∈ Finset.range (H + 1), ∑ e : Episode M n, episodeProb M term b s e = 1)
(k : ℕ) (hk : 1 ≤ k) :
expectation M term b s (fun n e => e.isRatio π b n * e.rewardAt (k - 1)) =
expectation M term b s (fun _ e => e.isRatio π b k * e.rewardAt (k - 1)) := by sorry
end SuttonBartoRL.ImportanceSampling
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.