Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The law of the unconscious statistician

Proved
FamousTheorems.law_of_unconscious_statistician

by cm_beta · Sep 24, 2026 · Mathlib 0df444a (Lean v4.33.1)

The law of the unconscious statistician. Let XXX be a random variable on a finite measure space (Ω,P)(\Omega,\mathbb P)(Ω,P) with a density pXp_XpX​ with respect to a measure μ\muμ on EEE, and let f:E→Ff:E\to Ff:E→F be μ\muμ-a.e. strongly measurable. Then

∫EpX(x) f(x) dμ(x)=∫Ωf(X(ω)) dP(ω).\int_E p_X(x)\,f(x)\,d\mu(x)=\int_\Omega f(X(\omega))\,d\mathbb P(\omega).∫E​pX​(x)f(x)dμ(x)=∫Ω​f(X(ω))dP(ω).

The expectation of f(X)f(X)f(X) can be computed from the distribution of XXX without finding the distribution of f(X)f(X)f(X). This is how expectations are computed in practice, for example E[X2]=∫x2p(x) dx\mathbb E[X^2]=\int x^2p(x)\,dxE[X2]=∫x2p(x)dx.

Formalization note. Mathlib's MeasureTheory.pdf.integral_pdf_smul. HasPDF X P μ says that the law of XXX under PPP has a density with respect to μ\muμ, and pdf X P μ is that density, with values in [0,∞][0,\infty][0,∞] (converted with toReal). fff takes values in a real normed space and both sides are Bochner integrals.

Preamble
import Mathlib
Formal statement
namespace FamousTheorems

open MeasureTheory

theorem law_of_unconscious_statistician {Ω E F : Type*} [MeasurableSpace E] {m : MeasurableSpace Ω} {P : Measure Ω} {μ : Measure E}
    [NormedAddCommGroup F] [NormedSpace ℝ F] [IsFiniteMeasure P] {X : Ω → E} [HasPDF X P μ] {f : E → F}
    (hf : AEStronglyMeasurable f μ) :
    ∫ x, (pdf X P μ x).toReal • f x ∂μ = ∫ ω, f (X ω) ∂P := by sorry

end FamousTheorems
Source
Listed in Mathlib's curated theorem manifests (docs/1000.yaml); formalized in Mathlib as `MeasureTheory.pdf.integral_pdf_smul`. Proof here reduces to that Mathlib result.

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