LeanMachineLearning

ProbabilityTheory.hasLaw_of_forall_eventually_eq🔗

Lemma

From the authors

Let Y n : Ω → Π i, 𝓧 i be random variables with law μ, indexed by a countably generated filter L. If for every ω and i, Y n ω i is eventually equal to Y' ω i along L, then Y' also has law μ.

Types
  • Ω : Type u_1mΩ : MeasurableSpace ΩA measurable space is a space equipped with a σ-algebra.
  • ι : Type u_3
  • κ : Type u_5
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.IsFiniteMeasure PA measure μ is called finite if μ univ < ∞.
  • 𝓧 : ι → Type u_4(i : ι) → MeasurableSpace (𝓧 i)
  • L : Filter κA filter F on a type α is a collection of sets of α which contains the whole α, is upwards-closed, and is stable under intersection.L.NeBotA filter is NeBot if it is not equal to , or equivalently the empty set does not belong to the filter.L.IsCountablyGeneratedIsCountablyGenerated f means f = generate s for some countable s.
  • μ : MeasureTheory.Measure ((i : ι) → 𝓧 i)
  • Y : κ → Ω → (i : ι) → 𝓧 i
  • Y' : Ω → (i : ι) → 𝓧 i
Assuming
  • hY : ∀ (n : κ), Measurable (Y n)A function f between measurable spaces is measurable if the preimage of every measurable set is measurable.
  • hY' : AEMeasurable Y' PA function is almost everywhere measurable if it coincides almost everywhere with a measurable function.
  • h_law : ∀ (n : κ), HasLaw (Y n) μ PThe 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 = μ.
  • h_lim : ∀ (ω : Ω) (i : ι), ∀ᶠ (n : κ) in L, Y n ω i = Y' ω if.Eventually p or ∀ᶠ x in f, p x mean that {x | p x} ∈ f.
Then
HasLaw Y' μ P
Code
lemma hasLaw_of_forall_eventually_eq [IsFiniteMeasure P] {κ : Type*} {L : Filter κ} [L.NeBot]
    [L.IsCountablyGenerated] {μ : Measure (Π i, 𝓧 i)} {Y : κ → Ω → Π i, 𝓧 i} {Y' : Ω → Π i, 𝓧 i}
    (hY : ∀ n, Measurable (Y n)) (hY' : AEMeasurable Y' P)
    (h_law : ∀ n, HasLaw (Y n) μ P) (h_lim : ∀ ω i, ∀ᶠ n in L, Y n ω i = Y' ω i) :
    HasLaw Y' μ P where
  aemeasurable
Proof
hY'
  map_eq := by
    refine ext_of_generate_finite (measurableCylinders _) generateFrom_measurableCylinders.symm
      isPiSystem_measurableCylinders (fun s hs ↦ ?_) ?_
    · obtain ⟨I, S, hS, rfl⟩ := (mem_measurableCylinders s).1 hs
      rw [Measure.map_apply_of_aemeasurable hY' (hS.cylinder _)]
      have h_tendsto : Tendsto (fun n ↦ P (Y n ⁻¹' cylinder I S)) L
          (𝓝 (P (Y' ⁻¹' cylinder I S))) := by
        refine tendsto_measure_of_tendsto_indicator_of_isFiniteMeasure L P
          (fun n ↦ (hS.cylinder _).preimage (hY n)) fun ω ↦ ?_
        have h_ev : ∀ᶠ n in L, ∀ i ∈ I, Y n ω i = Y' ω i :=
          (eventually_all_finset I).2 fun i _ ↦ h_lim ω i
        filter_upwards [h_ev] with n hn
        simp only [Set.mem_preimage, mem_cylinder]
        have : I.restrict (Y n ω) = I.restrict (Y' ω) := funext fun i ↦ hn i i.2
        rw [this]
      have h_const : Tendsto (fun n ↦ P (Y n ⁻¹' cylinder I S)) L (𝓝 (μ (cylinder I S))) := by
        have : (fun n ↦ P (Y n ⁻¹' cylinder I S)) = fun _ ↦ μ (cylinder I S) := by
          funext n
          rw [← Measure.map_apply (hY n) (hS.cylinder _), (h_law n).map_eq]
        rw [this]
        exact tendsto_const_nhds
      exact tendsto_nhds_unique h_tendsto h_const
    · obtain ⟨n⟩ := L.nonempty_of_neBot
      rw [Measure.map_apply_of_aemeasurable hY' MeasurableSet.univ, Set.preimage_univ,
        ← (h_law n).map_eq,
        Measure.map_apply (hY n) MeasurableSet.univ, Set.preimage_univ]

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, 12 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.