LeanMachineLearning

ProbabilityTheory.hasLaw_of_forall_hasLaw_cond🔗

Lemma

From the authors

If a random variable has law μ conditionally on each atom of positive probability of a countable measurable partition, then it has law μ.

Types
  • Ω : Type u_1mΩ : MeasurableSpace ΩA measurable space is a space equipped with a σ-algebra.
  • 𝓧 : Type u_2m𝓧 : MeasurableSpace 𝓧
  • ι : Type u_3Countable ιA type α is countable if there exists an injective map α → ℕ.mι : MeasurableSpace ιMeasurableSingletonClass ιA typeclass mixin for MeasurableSpaces such that each singleton is measurable.
Given
  • P : MeasureTheory.Measure ΩA measure is defined to be an outer measure that is countably additive on measurable sets, with the additional assumption that the outer measure is the canonical extension of the restricted measure.MeasureTheory.IsProbabilityMeasure PA measure μ is called a probability measure if μ univ = 1.
  • g : Ω → ι
  • X : Ω → 𝓧
  • μ : MeasureTheory.Measure 𝓧
Assuming
  • hg : Measurable gA function f between measurable spaces is measurable if the preimage of every measurable set is measurable.
  • hX : Measurable X
  • h : ∀ (i : ι), P (g ⁻¹' {i})0 → HasLaw X μ P[|g ⁻¹' {i}]The predicate HasLaw X μ P registers the fact that the random variable X has law μ under the measure P, in other words that P.map X = μ.
Then
HasLaw X μ P
Code
lemma hasLaw_of_forall_hasLaw_cond [IsProbabilityMeasure P] {g : Ω → ι} (hg : Measurable g)
    {X : Ω → 𝓧} (hX : Measurable X) {μ : Measure 𝓧}
    (h : ∀ i, P (g ⁻¹' {i}) ≠ 0 → HasLaw X μ P[|g ⁻¹' {i}]) :
    HasLaw X μ P where
  aemeasurable
Proof
hX.aemeasurable
  map_eq := by
    ext s hs
    rw [Measure.map_apply hX hs]
    have h_union : X ⁻¹' s = ⋃ i, X ⁻¹' s ∩ g ⁻¹' {i} := by ext; simp
    have h_disj : Pairwise (Function.onFun Disjoint fun i ↦ X ⁻¹' s ∩ g ⁻¹' {i}) := by
      intro i j hij
      rw [Function.onFun, Set.disjoint_left]
      rintro x ⟨-, hi⟩ ⟨-, hj⟩
      exact hij ((show g x = i from hi).symm.trans hj)
    have h_univ : Set.univ = ⋃ i, g ⁻¹' {i} := by ext; simp
    have h_disj_univ : Pairwise (Function.onFun Disjoint fun i ↦ g ⁻¹' {i}) := by
      intro i j hij
      rw [Function.onFun, Set.disjoint_left]
      exact fun x hi hj ↦ hij ((show g x = i from hi).symm.trans hj)
    calc P (X ⁻¹' s)
    _ = ∑' i, P (X ⁻¹' s ∩ g ⁻¹' {i}) := by
      conv_lhs => rw [h_union]
      exact measure_iUnion h_disj fun i ↦ (hs.preimage hX).inter (hg (measurableSet_singleton i))
    _ = ∑' i, μ s * P (g ⁻¹' {i}) := by
      refine tsum_congr fun i ↦ ?_
      rw [Set.inter_comm, ← cond_mul_eq_inter (hg (measurableSet_singleton i))]
      by_cases hi : P (g ⁻¹' {i}) = 0
      · simp [hi]
      · rw [← Measure.map_apply hX hs, (h i hi).map_eq]
    _ = μ s := by
      rw [ENNReal.tsum_mul_left, ← measure_iUnion h_disj_univ
        fun i ↦ hg (measurableSet_singleton i), ← h_univ, measure_univ, mul_one]

Meaning last changed in v4.34.0-rc2-76-g565f652 (2026-09-10).

Self-contained, with its dependencies inlined and proofs replaced by sorry: download the raw file · open it in the Lean web editor.

Dependency graph

Nothing to draw. Its statement rests on no other declaration in this project, and names nothing from a package left unaudited — so the graph is this declaration alone. That is the answer, not a missing picture.

Audit surface: 0 project declarations, 19 external constants

✓ Proved: no sorry anywhere in its closure

This is the tool's own reading of one build's recorded axioms, and it is not robust against an author who wants it to pass. Checking meant to be relied on should go through Comparator, which replays the proof through the kernel from an export against an explicit list of permitted axioms.