Documentation

Linglib.Core.Probability.Distributions.Bernoulli

Bernoulli distribution: bind, variance, posterior, stochastic order #

Binding a kernel through Ber(x, y, p) is the p-mixture of its two values, as is a lower integral against it, and the variance of a real observable under Ber(x, y, p) is p * (1 - p) * (f x - f y) ^ 2. Conditioning on an observation that both points emit with positive likelihood, the posterior mass of a point is strictly increasing in its Bernoulli prior.

Main results #

[UPSTREAM] candidates for Mathlib.Probability.Distributions.Bernoulli and Mathlib.Probability.Kernel.Posterior.

theorem ProbabilityTheory.bernoulliMeasure_bind {X : Type u_1} {Y : Type u_2} [MeasurableSpace X] [MeasurableSpace Y] [MeasurableSingletonClass X] (x y : X) (p : ↑unitInterval) {f : X → MeasureTheory.Measure Y} (hf : Measurable f) :
(bernoulliMeasure x y p).bind f = unitInterval.toNNReal p • f x + unitInterval.toNNReal (unitInterval.symm p) • f y
theorem ProbabilityTheory.map_piecewise_const_eq_bernoulliMeasure {X : Type u_1} [MeasurableSpace X] (x y : X) {Ω : Type u_3} [MeasurableSpace Ω] (μ : MeasureTheory.Measure Ω) [MeasureTheory.IsProbabilityMeasure μ] {s : Set Ω} [DecidablePred fun (x : Ω) => x ∈ s] (hs : MeasurableSet s) :
MeasureTheory.Measure.map (s.piecewise (fun (x_1 : Ω) => x) fun (x : Ω) => y) μ = bernoulliMeasure x y ⟨μ.real s, ⋯⟩

The law of a two-valued random variable is Bernoulli.

theorem ProbabilityTheory.lintegral_bernoulliMeasure {X : Type u_1} [MeasurableSpace X] [MeasurableSingletonClass X] (x y : X) (p : ↑unitInterval) (f : X → ENNReal) :
∫⁻ (z : X), f z ∂bernoulliMeasure x y p = ↑(unitInterval.toNNReal p) * f x + ↑(unitInterval.toNNReal (unitInterval.symm p)) * f y
theorem ProbabilityTheory.variance_bernoulliMeasure {X : Type u_1} [MeasurableSpace X] [MeasurableSingletonClass X] (x y : X) (p : ↑unitInterval) {f : X → ℝ} (hf : AEMeasurable f (bernoulliMeasure x y p)) :
variance f (bernoulliMeasure x y p) = ↑p * (1 - ↑p) * (f x - f y) ^ 2
theorem ProbabilityTheory.eq_or_eq_of_bernoulliMeasure_singleton_ne_zero {X : Type u_1} [MeasurableSpace X] [MeasurableSingletonClass X] (x y : X) (p : ↑unitInterval) {z : X} (hz : (bernoulliMeasure x y p) {z} ≠ 0) :
z = x ∨ z = y
theorem ProbabilityTheory.strictMono_posterior_bernoulliMeasure {X : Type u_1} [MeasurableSpace X] [MeasurableSingletonClass X] (x y : X) [Fintype X] [StandardBorelSpace X] [Nonempty X] {𝓧 : Type u_3} [MeasurableSpace 𝓧] [MeasurableSingletonClass 𝓧] (κ : Kernel X 𝓧) [IsFiniteKernel κ] {u : 𝓧} (hxy : x ≠ y) (hκx : (κ x) {u} ≠ 0) (hκy : (κ y) {u} ≠ 0) :
StrictMono fun (p : ↑unitInterval) => ((posterior κ (bernoulliMeasure x y p)) u).real {x}

At an observation that both points emit with positive likelihood, the posterior mass of a point is strictly increasing in its Bernoulli prior: a state that is more likely a priori is more likely a posteriori.

theorem ProbabilityTheory.exists_isMonotoneCoupling_bernoulliMeasure {X : Type u_1} [MeasurableSpace X] [MeasurableSingletonClass X] {x y : X} {p : ↑unitInterval} [Preorder X] {q : ↑unitInterval} (hyx : y ≤ x) (hpq : p ≤ q) :
∃ (γ : MeasureTheory.Measure (X × X)), γ.IsMonotoneCoupling (bernoulliMeasure x y p) (bernoulliMeasure x y q)

Bernoulli measures on a pair y ≤ x are coupled monotonically in the weight of the upper point: the coupling moves the extra mass q - p from y up to x.

theorem ProbabilityTheory.bernoulliMeasure_stochasticLE {X : Type u_1} [MeasurableSpace X] [MeasurableSingletonClass X] {x y : X} {p : ↑unitInterval} [Preorder X] {q : ↑unitInterval} (hyx : y ≤ x) (hpq : p ≤ q) :
(bernoulliMeasure x y p).StochasticLE (bernoulliMeasure x y q)

The Bernoulli measure on a pair y ≤ x is stochastically increasing in the weight of x.