Documentation

CslibFrontier.Probability.Hellinger

Hellinger distance and the Bhattacharyya coefficient #

The Bhattacharyya coefficient BC(p, q) = ∑' a, √((p a).toReal * (q a).toReal), squared Hellinger distance h²(p, q) = 1 - BC(p, q) = (∑' a, (√(p a).toReal - √(q a).toReal)²) / 2, and Hellinger distance h(p, q) = √(h²(p, q)) on discrete distributions (PMF α).

No competing MetricSpace (PMF α) instance is registered because Cslib.Probability.PMF already uses that typeclass slot for half-L¹ statistical distance (dist); instead, symmetry, definiteness, and hellingerDist_triangle are exposed directly.

Main definitions #

Main results #

References #

theorem Cslib.Probability.PMF.summable_sqrt_toReal_mul {α : Type u_1} (p q : PMF α) :
Summable fun (a : α) => √((p a).toReal * (q a).toReal)

Summability of the pointwise geometric mean √((p a).toReal * (q a).toReal).

noncomputable def Cslib.Probability.PMF.bhattacharyya {α : Type u_1} (p q : PMF α) :

The Bhattacharyya coefficient ∑' a, √((p a).toReal * (q a).toReal) between two discrete distributions. It lies in [0, 1], equals 1 iff p = q, and equals 0 iff the supports are disjoint.

noncomputable def Cslib.Probability.PMF.hellingerSq {α : Type u_1} (p q : PMF α) :

The squared Hellinger distance 1 - bhattacharyya p q between two discrete distributions.

noncomputable def Cslib.Probability.PMF.hellingerDist {α : Type u_1} (p q : PMF α) :

The Hellinger distance √(1 - bhattacharyya p q) between two discrete distributions.

theorem Cslib.Probability.PMF.bhattacharyya_eq_tsum {α : Type u_1} (p q : PMF α) :
bhattacharyya p q = ∑' (a : α), √((p a).toReal * (q a).toReal)
theorem Cslib.Probability.PMF.bhattacharyya_eq_sum {α : Type u_1} [Fintype α] (p q : PMF α) :
bhattacharyya p q = ∑ a : α, √((p a).toReal * (q a).toReal)
@[simp]
theorem Cslib.Probability.PMF.hellingerSq_eq_tsum {α : Type u_1} (p q : PMF α) :
hellingerSq p q = (∑' (a : α), (√(p a).toReal - √(q a).toReal) ^ 2) / 2
theorem Cslib.Probability.PMF.hellingerSq_eq_sum {α : Type u_1} [Fintype α] (p q : PMF α) :
hellingerSq p q = (∑ a : α, (√(p a).toReal - √(q a).toReal) ^ 2) / 2
@[simp]
theorem Cslib.Probability.PMF.hellingerSq_self {α : Type u_1} (p : PMF α) :
@[simp]
@[simp]

The Hellinger distance satisfies the triangle inequality on finite types.

theorem Cslib.Probability.PMF.hellingerSq_le_dist {α : Type u_1} [Fintype α] (p q : PMF α) :

Lower bound on half-L¹ statistical distance: h²(p, q) ≤ dist p q.

Le Cam's sharp upper bound relating statistical distance and Hellinger distance: dist p q ^ 2 ≤ hellingerSq p q * (2 - hellingerSq p q).

Le Cam's sharp upper bound: dist p q ≤ h(p, q) * √(2 - h²(p, q)).

Upper bound on half-L¹ statistical distance: dist p q ≤ √2 * hellingerDist p q.

Lower bound on Mathlib's full-L¹ total variation distance: 2 * h²(p, q) ≤ tvDist p q.

Upper bound on Mathlib's full-L¹ total variation distance: tvDist p q ≤ 2 * √2 * hellingerDist p q.

theorem Cslib.Probability.PMF.bhattacharyya_pi {ι : Type u_3} [Fintype ι] {α : ι → Type u_4} [∀ (i : ι), Finite (α i)] (p q : (i : ι) → PMF (α i)) :
bhattacharyya (pi p) (pi q) = ∏ i : ι, bhattacharyya (p i) (q i)

Tensorization of the Bhattacharyya coefficient over finite independent products: BC(pi p, pi q) = ∏ i, BC(p i, q i).

theorem Cslib.Probability.PMF.bhattacharyya_iid {α : Type u_1} [Finite α] (p q : PMF α) (n : ℕ) :
bhattacharyya (iid p n) (iid q n) = bhattacharyya p q ^ n

Tensorization of the Bhattacharyya coefficient for n i.i.d. draws: BC(iid p n, iid q n) = BC(p, q) ^ n.

theorem Cslib.Probability.PMF.hellingerSq_pi {ι : Type u_3} [Fintype ι] {α : ι → Type u_4} [∀ (i : ι), Finite (α i)] (p q : (i : ι) → PMF (α i)) :
hellingerSq (pi p) (pi q) = 1 - ∏ i : ι, (1 - hellingerSq (p i) (q i))

Exact formula for the squared Hellinger distance between finite product distributions.

theorem Cslib.Probability.PMF.hellingerSq_pi_le_sum {ι : Type u_3} [Fintype ι] {α : ι → Type u_4} [∀ (i : ι), Finite (α i)] (p q : (i : ι) → PMF (α i)) :
hellingerSq (pi p) (pi q) ≤ ∑ i : ι, hellingerSq (p i) (q i)

Subadditivity of squared Hellinger distance for finite independent products.

theorem Cslib.Probability.PMF.hellingerSq_iid {α : Type u_1} [Finite α] (p q : PMF α) (n : ℕ) :
hellingerSq (iid p n) (iid q n) = 1 - (1 - hellingerSq p q) ^ n

Exact formula for the squared Hellinger distance between n-fold i.i.d. distributions.

theorem Cslib.Probability.PMF.hellingerSq_iid_le {α : Type u_1} [Finite α] (p q : PMF α) (n : ℕ) :
hellingerSq (iid p n) (iid q n) ≤ ↑n * hellingerSq p q

Subadditivity of squared Hellinger distance for n-fold i.i.d. distributions.

theorem Cslib.Probability.PMF.hellingerDist_iid_le {α : Type u_1} [Finite α] (p q : PMF α) (n : ℕ) :
hellingerDist (iid p n) (iid q n) ≤ √↑n * hellingerDist p q

Subadditivity of Hellinger distance for n-fold i.i.d. distributions: h(iid p n, iid q n) ≤ √n * h(p, q).

theorem Cslib.Probability.PMF.dist_pi_le_sqrt_two_mul_sum_hellingerSq {ι : Type u_3} [DecidableEq ι] [Fintype ι] {α : ι → Type u_4} [(i : ι) → Fintype (α i)] (p q : (i : ι) → PMF (α i)) :
dist (pi p) (pi q) ≤ √(2 * ∑ i : ι, hellingerSq (p i) (q i))

Product-distribution TV bound via squared Hellinger distance: dist (pi p) (pi q) ≤ √(2 * ∑ i, h²(p i, q i)).

theorem Cslib.Probability.PMF.dist_iid_le_sqrt_two_mul_nat_mul_hellingerDist {α : Type u_1} [Fintype α] (p q : PMF α) (n : ℕ) :
dist (iid p n) (iid q n) ≤ √(2 * ↑n) * hellingerDist p q

Acceptance bound for n i.i.d. samples: dist (iid p n) (iid q n) ≤ √(2 * n) * hellingerDist p q.

theorem Cslib.Probability.PMF.sum_mul_bhattacharyya_le_bhattacharyya_bind {α : Type u_1} {β : Type u_2} [Finite α] [Finite β] (μ : PMF α) (p q : α → PMF β) :
∑' (a : α), (μ a).toReal * bhattacharyya (p a) (q a) ≤ bhattacharyya (μ.bind p) (μ.bind q)

Joint concavity of the Bhattacharyya coefficient under mixing with weights μ.

noncomputable def Cslib.Probability.PMF.weightedSqrt {α : Type u_4} (p : PMF α) (f : α → ℝ) :

Square roots of outcome weights, with each coordinate weighted by the square root of its sampling probability.

theorem Cslib.Probability.PMF.norm_weightedSqrt_sq {α : Type u_4} [Fintype α] (p : PMF α) (f : α → ℝ) (hf : ∀ (i : α), 0 ≤ f i) :
‖weightedSqrt p f‖ ^ 2 = ∑ i : α, (p i).toReal * f i

The squared norm of the weighted square roots is the mean of the outcome weights.

theorem Cslib.Probability.PMF.norm_sub_weightedSqrt_sq {α : Type u_4} [Fintype α] (p : PMF α) (a b : α → ℝ) :
‖weightedSqrt p a - weightedSqrt p b‖ ^ 2 = ∑ i : α, (p i).toReal * (√(a i) - √(b i)) ^ 2

The squared distance between the weighted vectors is the mean squared change in roots.

theorem Cslib.Probability.PMF.sq_sqrt_mean_sub_le {α : Type u_4} [Fintype α] (p : PMF α) (a b : α → ℝ) (ha : ∀ (i : α), 0 ≤ a i) (hb : ∀ (i : α), 0 ≤ b i) :
(√(∑ i : α, (p i).toReal * a i) - √(∑ i : α, (p i).toReal * b i)) ^ 2 ≤ ∑ i : α, (p i).toReal * (√(a i) - √(b i)) ^ 2

Mixing nonnegative weights contracts the squared difference of their square roots. This is the single-outcome form of joint convexity used when only acceptance is scored.

theorem Cslib.Probability.PMF.hellingerSq_bind_le_sum {α : Type u_1} {β : Type u_2} [Finite α] [Finite β] (μ : PMF α) (p q : α → PMF β) :
hellingerSq (μ.bind p) (μ.bind q) ≤ ∑' (a : α), (μ a).toReal * hellingerSq (p a) (q a)

Joint convexity of squared Hellinger distance under mixing with weights μ.

theorem Cslib.Probability.PMF.bhattacharyya_le_bhattacharyya_bind {α : Type u_1} {β : Type u_2} [Finite α] [Finite β] (p q : PMF α) (kernel : α → PMF β) :
bhattacharyya p q ≤ bhattacharyya (p.bind kernel) (q.bind kernel)

Data processing inequality for the Bhattacharyya coefficient: applying a shared Markov kernel kernel never decreases bhattacharyya.

theorem Cslib.Probability.PMF.hellingerSq_bind_le {α : Type u_1} {β : Type u_2} [Finite α] [Finite β] (p q : PMF α) (kernel : α → PMF β) :
hellingerSq (p.bind kernel) (q.bind kernel) ≤ hellingerSq p q

Data processing inequality for squared Hellinger distance under a Markov kernel.

theorem Cslib.Probability.PMF.hellingerDist_bind_le {α : Type u_1} {β : Type u_2} [Finite α] [Finite β] (p q : PMF α) (kernel : α → PMF β) :
hellingerDist (p.bind kernel) (q.bind kernel) ≤ hellingerDist p q

Data processing inequality for Hellinger distance under a Markov kernel.

theorem Cslib.Probability.PMF.bhattacharyya_le_bhattacharyya_map {α : Type u_1} {β : Type u_2} [Finite α] [Finite β] (p q : PMF α) (f : α → β) :

Data processing inequality for the Bhattacharyya coefficient under deterministic maps.

theorem Cslib.Probability.PMF.hellingerSq_map_le {α : Type u_1} {β : Type u_2} [Finite α] [Finite β] (p q : PMF α) (f : α → β) :

Data processing inequality for squared Hellinger distance under deterministic maps.

theorem Cslib.Probability.PMF.hellingerDist_map_le {α : Type u_1} {β : Type u_2} [Finite α] [Finite β] (p q : PMF α) (f : α → β) :

Data processing inequality for Hellinger distance under deterministic maps.

theorem Cslib.Probability.PMF.bhattacharyya_map_of_injective {α : Type u_1} {β : Type u_2} [Finite α] [Finite β] (p q : PMF α) {f : α → β} (hf : Function.Injective f) :

Injective relabeling preserves the Bhattacharyya coefficient.

theorem Cslib.Probability.PMF.hellingerSq_map_of_injective {α : Type u_1} {β : Type u_2} [Finite α] [Finite β] (p q : PMF α) {f : α → β} (hf : Function.Injective f) :

Injective relabeling preserves squared Hellinger distance.

theorem Cslib.Probability.PMF.hellingerDist_map_of_injective {α : Type u_1} {β : Type u_2} [Finite α] [Finite β] (p q : PMF α) {f : α → β} (hf : Function.Injective f) :

Injective relabeling preserves Hellinger distance.