Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

(7), §4, p. 13 — gradient of the direct parameterization: ∂V^π(μ)/∂π(a|s) = (1/(1−γ)) d^π_μ(s) Q^π(s,a)

Proved
PolicyGradTheory.ProjGA.direct_gradient

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

direct-parameterizationgradient-formulap2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1policy-gradient

Let (S,A,P,r,γ)(\mathcal S,\mathcal A,P,r,\gamma)(S,A,P,r,γ) be a finite discounted MDP with rewards in [0,1][0,1][0,1] and γ∈[0,1)\gamma\in[0,1)γ∈[0,1), and let μ\muμ be a weighting of the start states. Under the direct parameterization π(a∣s)=πs,a\pi(a\mid s)=\pi_{s,a}π(a∣s)=πs,a​, regard Vπ(μ)V^\pi(\mu)Vπ(μ) as a function of the vector π∈RS×A\pi\in\mathbb R^{\mathcal S\times\mathcal A}π∈RS×A.

At every policy π∈Δ(A)∣S∣\pi\in\Delta(\mathcal A)^{|\mathcal S|}π∈Δ(A)∣S∣ and for all s∈Ss\in\mathcal Ss∈S, a∈Aa\in\mathcal Aa∈A,

∂Vπ(μ)∂π(a∣s)=11−γ dμπ(s) Qπ(s,a).\frac{\partial V^\pi(\mu)}{\partial\pi(a\mid s)}=\frac1{1-\gamma}\,d^\pi_\mu(s)\,Q^\pi(s,a).∂π(a∣s)∂Vπ(μ)​=1−γ1​dμπ​(s)Qπ(s,a).

This is the policy gradient for the direct parameterization. It is what the projected gradient ascent update (9) uses, and it is the link between the gradient and the advantage in the proof of the gradient domination lemma.

Formalization Note The claim is about the Euclidean gradient (Mathlib's gradient, which presupposes differentiability) of the map π↦Vπ(μ)\pi\mapsto V^\pi(\mu)π↦Vπ(μ) on EuclideanSpace ℝ (S × A), evaluated at a policy; its (s,a)(s,a)(s,a) coordinate is the stated value. The value function is the series ∑tγt⋯\sum_t\gamma^t\cdots∑t​γt⋯, which converges on a neighbourhood of the simplex, so the gradient there is the genuine one. The page states (7) for a start distribution μ\muμ; the identity is linear in μ\muμ and holds for every weighting, so no distribution hypothesis is assumed.

Preamble
import Mathlib
import Definitions.Def_FoundationsML_ReinforcementLearning_QFunction
import Definitions.Def_PolicyGradTheory_ProjGA_MDP
import Definitions.Def_PolicyGradTheory_ProjGA_Algorithm

open FoundationsML.ReinforcementLearning
Formal statement
namespace PolicyGradTheory.ProjGA

/-- (7), §4, arXiv:1908.00261v5, p. 13: for the direct parameterization, at every policy `π`,
`∂V^π(μ)/∂π(a|s) = (1/(1−γ)) d^π_μ(s) Q^π(s,a)`; the Euclidean gradient of `π ↦ V^π(μ)` has
these coordinates. -/
theorem direct_gradient {S A : Type*} [Fintype S] [DecidableEq S] [Fintype A] [DecidableEq A]
    (P : S → A → S → ℝ) (r : S → A → ℝ) (γ : ℝ) (hM : IsFiniteMDP P r γ) (μ : S → ℝ) :
    ∀ π ∈ simplexSet S A, ∀ (s : S) (a : A),
      gradient (directValue P r γ μ) π (s, a) =
        1 / (1 - γ) * visitation (asPolicy π) P γ μ s * QFunction (asPolicy π) P r γ s a := by sorry

end PolicyGradTheory.ProjGA
Source
arXiv:1908.00261v5, §4, (7), p. 13
Human review
  • Endorsed by Shuze Chen · Oct 5, 2026

    Confirmed by the moderator at approval.

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