The score function has zero mean:
ProvedScoreFunction.score_zero_meanThe score function has mean zero: the measure-theoretic analogue of score_zero_mean, which is already on the platform in the finite-sum setting.
Let be a measure space and let be a family of probability densities with respect to , so that
The score at is . Then, under the standard conditions for differentiating under the integral sign,
The identity is what makes the Fisher information the variance of the score rather than a second moment about an unknown mean, and it is the reason an arbitrary -independent baseline may be subtracted from the reward in a policy-gradient estimator without introducing bias.
Note that normalization is required on a whole neighbourhood of , not merely at itself: the proof differentiates the constant function , and a family normalized only at the single point carries no information about that derivative. The remaining hypotheses are the dominated-derivative conditions: almost-everywhere positivity of , measurability of near and integrability at , differentiability of on a neighbourhood of with derivative , and an integrable bound on uniform over .
Formalization Note As in the general identity, the parameter derivative is supplied explicitly as p' through HasDerivAt, while the conclusion is stated with deriv (fun t => Real.log (p t x)) θ so that the score appears as a logarithmic derivative. This statement is the specialization of the measure-theoretic log-derivative trick combined with the normalization hypothesis.
import Mathlib.Analysis.Calculus.ParametricIntegral import Mathlib.Analysis.SpecialFunctions.Log.Deriv open MeasureTheory Filter open scoped Topology
namespace ScoreFunction
theorem score_zero_mean
{X : Type*} [MeasurableSpace X] {μ : Measure X}
{p p' : ℝ → X → ℝ} {bound : X → ℝ} {θ : ℝ} {s : Set ℝ}
(hs : s ∈ 𝓝 θ)
(hp_pos : ∀ᵐ x ∂μ, 0 < p θ x)
(hp_meas : ∀ᶠ t in 𝓝 θ, AEStronglyMeasurable (p t) μ)
(hp_int : Integrable (p θ) μ)
(hp'_meas : AEStronglyMeasurable (p' θ) μ)
(h_bound : ∀ᵐ x ∂μ, ∀ t ∈ s, |p' t x| ≤ bound x)
(h_bound_int : Integrable bound μ)
(h_diff : ∀ᵐ x ∂μ, ∀ t ∈ s, HasDerivAt (fun u => p u x) (p' t x) t)
(h_norm : ∀ t ∈ s, ∫ x, p t x ∂μ = 1) :
∫ x, p θ x * deriv (fun t => Real.log (p t x)) θ ∂μ = 0 := by sorry
end ScoreFunction