Documentation

CslibFrontier.Probability.StatisticalDistance.XORSampling

Sampling the XOR construction from uniform bits #

The XOR construction xorMix p₀ p₁ k c draws its selector uniformly among the bit strings of parity c. A sampler that only has uniform bits draws k - 1 of them, r, and completes them to parityComplete c r = Fin.snoc r (c ⊕ parity r), the unique string of parity c extending r. This is a bijection between BitString (k - 1) and the selectors of parity c (parityCompleteEquiv), so the completed selector is uniform among them (uniformOfFintype_map_parityComplete). When p₀ and p₁ are themselves images of uniform seeds under f₀ and f₁, the whole construction is the image of uniform selector bits and seeds (xorMix_map_uniform). This is the form in which a circuit computes the XOR construction of two samplers [SahaiVadhan2003, Lemma 3.5]. The XOR construction also commutes with images (xorMix_map).

Main definitions #

Main results #

References #

theorem Cslib.Probability.PMF.xorMix_map {α : Type u_1} {β : Type u_2} [Fintype α] [Fintype β] (p₀ p₁ : PMF α) (g : α → β) (k : ℕ) (c : Bool) :
xorMix (PMF.map g p₀) (PMF.map g p₁) k c = PMF.map (fun (x : Fin k → α) (i : Fin k) => g (x i)) (xorMix p₀ p₁ k c)

Naturality of the XOR construction: mapping both distributions by g maps every coordinate of the construction by g.

theorem Cslib.Probability.PMF.xorMix_map_uniform {γ : Type u_1} {α : Type u_2} [Fintype γ] [Nonempty γ] [Fintype α] (f₀ f₁ : γ → α) (j : ℕ) (c : Bool) :
xorMix (PMF.map f₀ (uniformOfFintype γ)) (PMF.map f₁ (uniformOfFintype γ)) (j + 1) c = PMF.map (fun (p : BitString j × (Fin (j + 1) → γ)) (i : Fin (j + 1)) => bif BitString.parityComplete c p.1 i then f₁ (p.2 i) else f₀ (p.2 i)) (uniformOfFintype (BitString j × (Fin (j + 1) → γ)))

The XOR construction from uniform bits: on j + 1 coordinates, the XOR construction of the images of a uniform seed under f₀ and f₁ is the image of j uniform selector bits r and j + 1 uniform seeds s under i ↦ f_{b i} (s i), where b = parityComplete c r.