Documentation

CslibFrontier.Probability.UniversalHash.MultiSample

The leftover hash lemma for several independent samples #

When the same public seed k of a universal or almost-universal hash family is used to hash several mutually independent inputs source : ι → PMF Input, the resulting tuple of digests is jointly close to independent uniform outputs even with k revealed. Conditioned on each seed k, the coordinate digests (source i).map (hash k) are independent, so the hybrid bound for conditionally independent products (Cslib.Probability.PMF.dist_bind_pair_pi_le_sum) sums the single-sample leftover-hash bounds (Cslib.Probability.IsUniversalHash.leftover_hash) across i : ι. Unlike Cslib.Probability.IsTwoUniversal.leftover_hash_pi_conditional in EntropyExtraction.lean, which hashes a single joint tuple once, these theorems hash each coordinate separately under one shared seed.

For a (1 + α) / |Output|-universal hash family and independent samples each of guessing probability at most γ, the statistical distance to uniform is at most |ι| * √(|Output| * γ + α) / 2 ([BS23], §8.10.4, Theorem 8.11, p. 334).

Deviations from the book #

Main results #

References #

theorem Cslib.Probability.IsUniversalHash.leftover_hash_pi {Seed : Type u_1} {Input : Type u_2} {Output : Type u_3} {ι : Type u_4} [Fintype Seed] [Finite Input] [Fintype Output] [Fintype ι] [DecidableEq ι] [Nonempty Output] {seed : PMF Seed} {hash : Seed → Input → Output} {ε : ENNReal} (hhash : IsUniversalHash seed hash ε) (hε : ε ≠ ⊤) (source : ι → PMF Input) :
dist (seededHash seed (PMF.pi source) fun (s : Seed) (x : ι → Input) (i : ι) => hash s (x i)) (seed.bind fun (s : Seed) => PMF.map (fun (x : ι → Output) => (s, x)) (PMF.uniformOfFintype (ι → Output))) ≤ ∑ i : ι, √(↑(Fintype.card Output) * (PMF.collisionProbability (source i) + ε.toReal) - 1) / 2

Multi-sample leftover hash lemma for ε-universal families: hashing independent samples under one shared public seed is within the sum of the single-sample leftover-hash bounds of the seed paired with an independent uniform tuple.

theorem Cslib.Probability.IsUniversalHash.leftover_hash_pi_of_mass_le {Seed : Type u_1} {Input : Type u_2} {Output : Type u_3} {ι : Type u_4} [Fintype Seed] [Finite Input] [Fintype Output] [Fintype ι] [DecidableEq ι] [Nonempty Output] {seed : PMF Seed} {hash : Seed → Input → Output} {α γ : ℝ} (hα : 0 ≤ 1 + α) (hhash : IsUniversalHash seed hash (ENNReal.ofReal ((1 + α) / ↑(Fintype.card Output)))) (source : ι → PMF Input) (hmass : ∀ (i : ι) (x : Input), ((source i) x).toReal ≤ γ) :
dist (seededHash seed (PMF.pi source) fun (s : Seed) (x : ι → Input) (i : ι) => hash s (x i)) (seed.bind fun (s : Seed) => PMF.map (fun (x : ι → Output) => (s, x)) (PMF.uniformOfFintype (ι → Output))) ≤ ↑(Fintype.card ι) * √(↑(Fintype.card Output) * γ + α) / 2

Theorem 8.11 (Leftover Hash Lemma for several samples) ([BS23], §8.10.4, p. 334), for any seed distribution: if hash is (1 + α) / |Output|-universal with 0 ≤ 1 + α and each independent sample source i has guessing probability at most γ, then hashing all samples under one shared public seed is within |ι| * √(|Output| * γ + α) / 2 of the seed paired with an independent uniform tuple.

theorem Cslib.Probability.IsUniversalHash.dist_seededHash_pi_uniformOfFintype_le {Seed : Type u_1} {Input : Type u_2} {Output : Type u_3} {ι : Type u_4} [Fintype Seed] [Finite Input] [Fintype Output] [Fintype ι] [DecidableEq ι] [Nonempty Seed] [Nonempty Output] {hash : Seed → Input → Output} {α γ : ℝ} (hα : 0 ≤ 1 + α) (hhash : IsUniversalHash (PMF.uniformOfFintype Seed) hash (ENNReal.ofReal ((1 + α) / ↑(Fintype.card Output)))) (source : ι → PMF Input) (hmass : ∀ (i : ι) (x : Input), ((source i) x).toReal ≤ γ) :
dist (seededHash (PMF.uniformOfFintype Seed) (PMF.pi source) fun (s : Seed) (x : ι → Input) (i : ι) => hash s (x i)) (PMF.uniformOfFintype (Seed × (ι → Output))) ≤ ↑(Fintype.card ι) * √(↑(Fintype.card Output) * γ + α) / 2

Theorem 8.11 (Leftover Hash Lemma) as printed ([BS23], §8.10.4, p. 334): for a (1 + α) / |Output|-universal hash function with 0 ≤ 1 + α, a uniform seed on Seed, and independent samples source i each with guessing probability at most γ, the statistical distance between (k, fun i => hash k (s i)) and the uniform distribution on Seed × (ι → Output) is at most |ι| * √(|Output| * γ + α) / 2.

theorem Cslib.Probability.IsTwoUniversal.leftover_hash_pi {Seed : Type u_1} {Input : Type u_2} {Output : Type u_3} {ι : Type u_4} [Fintype Seed] [Finite Input] [Fintype Output] [Fintype ι] [DecidableEq ι] [Nonempty Output] {seed : PMF Seed} {hash : Seed → Input → Output} (hhash : IsTwoUniversal seed hash) (source : ι → PMF Input) :
dist (seededHash seed (PMF.pi source) fun (s : Seed) (x : ι → Input) (i : ι) => hash s (x i)) (seed.bind fun (s : Seed) => PMF.map (fun (x : ι → Output) => (s, x)) (PMF.uniformOfFintype (ι → Output))) ≤ ∑ i : ι, √(↑(Fintype.card Output) * PMF.collisionProbability (source i)) / 2

Multi-sample leftover hash lemma for universal families (α = 0): hashing independent samples under one shared public seed is within ∑ i, √(|Output| * collisionProbability (source i)) / 2 of the seed paired with an independent uniform tuple.

theorem Cslib.Probability.IsTwoUniversal.leftover_hash_pi_of_mass_le {Seed : Type u_1} {Input : Type u_2} {Output : Type u_3} {ι : Type u_4} [Fintype Seed] [Finite Input] [Fintype Output] [Fintype ι] [DecidableEq ι] [Nonempty Output] {seed : PMF Seed} {hash : Seed → Input → Output} (hhash : IsTwoUniversal seed hash) (source : ι → PMF Input) {γ : ℝ} (hmass : ∀ (i : ι) (x : Input), ((source i) x).toReal ≤ γ) :
dist (seededHash seed (PMF.pi source) fun (s : Seed) (x : ι → Input) (i : ι) => hash s (x i)) (seed.bind fun (s : Seed) => PMF.map (fun (x : ι → Output) => (s, x)) (PMF.uniformOfFintype (ι → Output))) ≤ ↑(Fintype.card ι) * √(↑(Fintype.card Output) * γ) / 2

Multi-sample leftover hash lemma for universal families (α = 0) under a pointwise guessing-probability bound γ on each sample.