Documentation

CslibFrontier.Probability.StatisticalDistance.XOR

The XOR construction for statistical distance #

Given two distributions p₀ and p₁ on a finite type, xorMix p₀ p₁ k c draws selector bits b : BitString k uniformly among those of parity c, then draws coordinate i from p_{b i}, independently. Statistical distance between c = false and c = true is multiplicative: for k ≥ 1,

dist (xorMix p₀ p₁ k false) (xorMix p₀ p₁ k true) = dist p₀ p₁ ^ k (dist_xorMix).

This is the XOR Lemma of Sahai and Vadhan [SahaiVadhan2003, Lemma 3.5]. The construction pushes small distances towards 0. The proof writes the difference of the two masses at x as a signed sum over selectors and factors it as ∏ i, (p₀ (x i) - p₁ (x i)) / 2 ^ (k - 1) (toReal_xorMix_sub); summing absolute values factors again over the coordinates.

When k = 0 there are no selectors of parity true, and xorMix returns the product of copies of p₀ on both sides; the identity then fails, since dist p₀ p₁ ^ 0 = 1.

Main definitions #

Main results #

References #

noncomputable def Cslib.Probability.PMF.xorMix {α : Type u_1} [Fintype α] (p₀ p₁ : PMF α) (k : ℕ) (c : Bool) :
PMF (Fin k → α)

The XOR construction [SahaiVadhan2003, Lemma 3.5]: draw selector bits b of k coordinates uniformly among those of parity c, then draw coordinate i from p₀ or p₁ according to b i, independently. With no selector of parity c (only when k = 0 and c = true), it draws from p₀ in every coordinate.

theorem Cslib.Probability.PMF.toReal_xorMix {α : Type u_1} [Fintype α] (p₀ p₁ : PMF α) {k : ℕ} (hk : k ≠ 0) (c : Bool) (x : Fin k → α) :
((xorMix p₀ p₁ k c) x).toReal = (∑ b : BitString k, if parity k b = c then ∏ i : Fin k, ((bif b i then p₁ else p₀) (x i)).toReal else 0) / 2 ^ (k - 1)

Masses of the XOR construction: for k ≥ 1, the average over the selectors of parity c of the product of the selected masses.

theorem Cslib.Probability.PMF.toReal_xorMix_sub {α : Type u_1} [Fintype α] (p₀ p₁ : PMF α) {k : ℕ} (hk : k ≠ 0) (x : Fin k → α) :
((xorMix p₀ p₁ k false) x).toReal - ((xorMix p₀ p₁ k true) x).toReal = (∏ i : Fin k, ((p₀ (x i)).toReal - (p₁ (x i)).toReal)) / 2 ^ (k - 1)

The masses differ by a product: for k ≥ 1 the masses of the XOR construction for c = false and c = true at x differ by ∏ i, (p₀ (x i) - p₁ (x i)) / 2 ^ (k - 1).

theorem Cslib.Probability.PMF.dist_xorMix {α : Type u_1} [Fintype α] (p₀ p₁ : PMF α) {k : ℕ} (hk : k ≠ 0) :
dist (xorMix p₀ p₁ k false) (xorMix p₀ p₁ k true) = dist p₀ p₁ ^ k

XOR Lemma [SahaiVadhan2003, Lemma 3.5]: for k ≥ 1 coordinates, the XOR construction raises the statistical distance to the k-th power.

theorem Cslib.Probability.PMF.dist_xorMix_le {α : Type u_1} [Fintype α] (p₀ p₁ : PMF α) (k : ℕ) :
dist (xorMix p₀ p₁ k false) (xorMix p₀ p₁ k true) ≤ dist p₀ p₁ ^ k

The XOR construction never increases the statistical distance beyond its k-th power; for k = 0 the right side is 1.