Documentation

ToCslib.MeasureTheory.Measure.Option

Discarding the none part of an option-valued measure #

Measure.dropNone turns a measure on Option α into the submeasure of successful values on α. It is the effect-preserving boundary needed by OptionT and by finite observations of a possibly nonterminating computation: the none mass is discarded instead of being confused with an ordinary result.

The definition uses the Giry bind. The coproduct measurable structure makes the success/failure case split measurable without requiring α itself to be discrete. dropNone μ is μ.comap some (dropNone_eq_comap_some), the form an upstream version would use directly; VCVio's proofs unfold the bind.

noncomputable def MeasureTheory.Measure.dropNone {α : Type u_1} [MeasurableSpace α] (μ : Measure (Option α)) :

Keep the mass at some x as mass at x, and discard the mass at none.

Equations
Instances For
    theorem MeasureTheory.Measure.measurable_dropNoneKernel {α : Type u_1} [MeasurableSpace α] :
    Measurable fun (value : Option α) => match value with | none => 0 | some x => dirac x

    The measure family used by dropNone is measurable for every measurable result space.

    The optional measure kernel is measurable in its eliminator form.

    Discarding the none branch varies measurably with the input measure.

    theorem MeasureTheory.Measure.dropNone_apply {α : Type u_1} [MeasurableSpace α] (μ : Measure (Option α)) {s : Set α} (hs : MeasurableSet s) :
    μ.dropNone s = μ (some '' s)

    The mass retained by dropNone on a measurable set is the mass of its image under some.

    Discarding none is Mathlib's measure pullback along the measurable embedding some.

    @[simp]

    Embedding every outcome as a successful value and discarding failure preserves the measure.

    theorem MeasureTheory.Measure.dropNone_map {α : Type u_1} [MeasurableSpace α] {β : Type u_2} [MeasurableSpace β] (μ : Measure (Option α)) (f : α → β) (hf : Measurable f) :

    Mapping successful values commutes with discarding the absent outcomes.

    theorem MeasureTheory.Measure.dropNone_bind {α : Type u_1} [MeasurableSpace α] {β : Type u_2} [MeasurableSpace β] (μ : Measure (Option α)) (f : α → Measure (Option β)) (hf : Measurable f) :
    (μ.bind fun (value : Option α) => value.elim (dirac none) f).dropNone = μ.dropNone.bind fun (x : α) => (f x).dropNone

    Discarding failure after an optional bind is the bind of the successful input mass with the discarded successful mass of each continuation.

    The success mass at x is the original mass at some x.

    This is the computation rule that carries a pointwise mass statement across dropNone.

    Discarding none cannot increase the total mass.

    Discarding the absent outcomes of a subprobability measure preserves its mass bound.

    theorem MeasureTheory.Measure.lintegral_dropNone {α : Type u_1} [MeasurableSpace α] (μ : Measure (Option α)) {g : α → ENNReal} (hg : Measurable g) :
    ∫⁻ (x : α), g x ∂μ.dropNone = ∫⁻ (o : Option α), o.elim 0 g ∂μ

    Integrating against dropNone μ integrates against μ with the none outcome discarded.

    The total mass left after discarding none is the mass of the present outcomes.

    theorem MeasureTheory.Measure.ext_dropNone {α : Type u_1} [MeasurableSpace α] {μ ν : Measure (Option α)} (hsome : μ.dropNone = ν.dropNone) (hnone : μ {none} = ν {none}) :
    μ = ν

    A measure on optional values is determined by its present outcomes and the mass of none.

    Completing a subprobability measure with an explicit failure outcome #

    noncomputable def MeasureTheory.Measure.withFailure {α : Type u_1} [MeasurableSpace α] (μ : Measure α) :

    Turn a subprobability measure into a measure on Option α by mapping successful outcomes through some and assigning all missing mass to none.

    The definition is meaningful for every measure. Its probability-measure law requires the subprobability bound μ univ ≤ 1, supplied explicitly or inferred from IsSubprobabilityMeasure μ.

    Equations
    Instances For
      @[simp]

      Completing a subprobability measure assigns total mass one.

      The failure completion of a subprobability measure is a probability measure.

      Completing a subprobability measure with its missing mass is a probability measure.

      The mass of the explicit failure outcome is exactly the missing mass.

      Failure completion preserves the mass of every successful singleton.

      @[simp]

      Discarding the failure outcome of a completion recovers the completed measure.

      A probability measure on optional values is the completion of its present outcomes. Together with dropNone_withFailure, completion and discarding none are inverse bijections between subprobability measures on α and probability measures on Option α.

      theorem MeasureTheory.Measure.sum_apply_option_map_eq_some_le_isSome {α : Type u_1} [MeasurableSpace α] {γ : Type u_2} [Fintype γ] (μ : Measure (Option α)) (select : α → Option γ) (hselect : ∀ (k : γ), MeasurableSet {r : Option α | Option.map select r = some (some k)}) :
      ∑ k : γ, μ {r : Option α | Option.map select r = some (some k)} ≤ μ {r : Option α | r.isSome = true}

      Finite selector fibers of optional outputs have total mass at most the mass of present outputs. Only the fibers need be measurable; the selector's target needs no measurable space.