The gradient of in terms of and (proof box, p. 325)
ProvedSuttonBartoRL.PolicyGradient.grad_stateValue_recursionp2o-batch-b23bp2o-gran-per-chapterp2o-plan-bookp2o-v1policy-gradientreinforcement-learning
Let a finite episodic MDP and a differentiable policy parameterization be given, and let episodes terminate under . Then for every nonterminal state the map is differentiable at , and, with , and all gradients taken at ,
This is the recursion that the proof of the policy gradient theorem unrolls.
Formalization Note The existence of , used silently in the book, is part of the conclusion. Termination is assumed at only; because the policy is continuous in , it then holds in a neighbourhood of .
Preamble
import Mathlib import Definitions.Def_SuttonBartoRL_PolicyGradient_Model import Definitions.Def_SuttonBartoRL_PolicyGradient_EpisodicValues
Formal statement
namespace SuttonBartoRL.PolicyGradient
/-- Box "Proof of the Policy Gradient Theorem (episodic case)", p. 325, first four lines: if episodes
terminate under `π_{θ₀}`, then every state value `θ ↦ v_{π_θ}(s)` is differentiable at `θ₀` and
`∇v_π(s) = Σ_a [∇π(a|s) q_π(s, a) + π(a|s) Σ_{s'} p(s'|s, a) ∇v_π(s')]`. -/
theorem grad_stateValue_recursion {S A : Type} [Fintype S] [DecidableEq S] [Fintype A] {d : ℕ}
(M : EpisodicMDP S A) (π : ParamPolicy S A d) (θ₀ : EuclideanSpace ℝ (Fin d))
(hT : M.Terminates π θ₀) (s : S) :
HasGradientAt (fun θ => M.stateValue π θ s)
(∑ a, (M.actionValue π θ₀ s a • gradient (fun θ => π.prob θ s a) θ₀ +
π.prob θ₀ s a • ∑ s', M.trans s a s' • gradient (fun θ => M.stateValue π θ s') θ₀))
θ₀ := by sorry
end SuttonBartoRL.PolicyGradient
Source
Sutton & Barto, Reinforcement Learning: An Introduction, 2nd ed., MIT Press (2018), ISBN 9780262039246, box "Proof of the Policy Gradient Theorem (episodic case)", first four lines, p. 325
Human review
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.