Documentation

ToCslib.MeasureTheory.Measure.Except

Pulling an exception-valued measure back to successful results #

Mathlib's Measure.comap along the measurable embedding Except.ok retains exactly the successful branch of an exception-valued measure. This file supplies its Giry-bind normal form and composition laws, without introducing a second transformer-specific measure operation.

theorem MeasureTheory.Measure.measurable_comap_ok_kernel {ε : Type u_1} {α : Type u_2} [MeasurableSpace ε] [MeasurableSpace α] :
Measurable fun (value : Except ε α) => match value with | Except.error a => 0 | Except.ok x => dirac x

The measurable kernel that keeps successful exception values and discards errors.

theorem MeasureTheory.Measure.comap_ok_eq_bind {ε : Type u_1} {α : Type u_2} [MeasurableSpace ε] [MeasurableSpace α] (μ : Measure (Except ε α)) :
comap Except.ok μ = μ.bind fun (value : Except ε α) => match value with | Except.error a => 0 | Except.ok x => dirac x

Pullback along Except.ok is Giry bind with errors sent to the zero measure.

Pullback along Except.ok varies measurably with the exception-valued measure.

@[simp]
theorem MeasureTheory.Measure.comap_ok_dirac_error {ε : Type u_1} {α : Type u_2} [MeasurableSpace ε] [MeasurableSpace α] (error : ε) :
theorem MeasureTheory.Measure.comap_ok_map {ε : Type u_1} {α : Type u_2} [MeasurableSpace ε] [MeasurableSpace α] {β : Type u_3} [MeasurableSpace β] (μ : Measure (Except ε α)) (f : α → β) (hf : Measurable f) :

Mapping successful exception values commutes with pulling back along Except.ok.

theorem MeasureTheory.Measure.comap_ok_bind {ε : Type u_1} {α : Type u_2} [MeasurableSpace ε] [MeasurableSpace α] {β : Type u_3} [MeasurableSpace β] (μ : Measure (Except ε α)) (f : α → Measure (Except ε β)) (hf : Measurable f) :
comap Except.ok (μ.bind fun (value : Except ε α) => match value with | Except.error error => dirac (Except.error error) | Except.ok x => f x) = (comap Except.ok μ).bind fun (x : α) => comap Except.ok (f x)

Pulling back after exception bind is the bind of the successful input mass with the successful mass of each continuation.