k-wise independent hash families #
A family of functions h i : X → Y, indexed by a seed i drawn uniformly from a finite type ι,
is k-wise independent (Cslib.Probability.IsKWiseIndependentHash) if for every set T of at
most k points the restriction of h i to T is uniformly distributed on T → Y: the values at
any k distinct points are independent and uniform Vadhan, Section 3.5.5; Wegman and
Carter call such families strongly universal_k [WC81]. For k ≥ 2 they are pairwise
independent in the sense of Cslib.Probability.IsPairwiseIndependentHash, and 2-wise
independence is exactly pairwise independence with a seed
(Cslib.Probability.isKWiseIndependentHash_two_iff). As in the pairwise case,
probabilities over the seed are densities Finset.dens and averages are uniform expectations
𝔼 i.
Every function of at most k values has the same average as for a truly random function
(Cslib.Probability.IsKWiseIndependentHash.expect_restrict); in particular the average of a
product of functions of the values at k points is the product of their averages
(Cslib.Probability.IsKWiseIndependentHash.expect_prod). Expanding the 2 m-th power of a sum of
centered bounded scores, a tuple of points contributes only when every point occurs at least twice,
so at most m distinct points occur. This gives the 2 m-th moment bound
𝔼 (∑ x ∈ S, Z x) ^ (2 m) ≤ m ^ (2 m) |S| ^ m, and Markov's inequality gives the tail bound
Pr[|∑ x ∈ S, Z x| ≥ a] ≤ (m² |S| / a²) ^ m. This is the k-th moment method for limited
independence of Bellare and Rompel [BR94], whose sharper counting of the contributing
tuples gives a better constant.
Main definitions #
Cslib.Probability.IsKWiseIndependentHash:k-wise independent hash families.
Main results #
Cslib.Probability.IsKWiseIndependentHash.expect_restrict,Cslib.Probability.IsKWiseIndependentHash.expect_prod: functions of at mostkvalues average as for a truly random function.Cslib.Probability.IsKWiseIndependentHash.isPairwiseIndependentHash,Cslib.Probability.isKWiseIndependentHash_two_iff: fork ≥ 2the family is pairwise independent, and2-wise independence is pairwise independence with a seed.Cslib.Probability.isKWiseIndependentHash_of_surjective: an additive family whose restrictions to sets of at mostkpoints are onto isk-wise independent.Cslib.Probability.IsKWiseIndependentHash.expect_sum_pow_le: the2 m-th moment bound.Cslib.Probability.IsKWiseIndependentHash.dens_filter_le_abs_sum,Cslib.Probability.IsKWiseIndependentHash.dens_filter_le_abs_sum_sub_expect: the tail bounds for centered scores in[-1, 1]and for scores in[0, 1].
References #
A family of functions h i : X → Y, indexed by a seed i : ι drawn uniformly at random, is
k-wise independent if for every set T of at most k points the restriction of h i to T
is uniformly distributed on T → Y: a 1 / |Y| ^ #T fraction of the seeds restricts to each
y : T → Y. Taking T = ∅ forces a seed to exist.
The usual definition asks this only for sets of exactly k points. When X has at least k
elements the two agree, since a set of fewer points extends to one of k points and the
restriction to the smaller set is a marginal; when X has fewer than k elements the usual
definition is vacuous, while this one still asks for uniformity on all of X.
- dens_filter_restrict_eq {T : Finset X} (hT : T.card ≤ k) (y : ↥T → Y) : {i : ι | T.restrict (h i) = y}.dens = (↑(Fintype.card Y) ^ T.card)⁻¹
The values at any set of at most
kpoints are independent and uniform.
Instances For
A k-wise independent family has a seed.
A k-wise independent family is k'-wise independent for every k' ≤ k.
Restrictions are uniform: a function of the values of a k-wise independent family at a
set T of at most k points has the same average as on a uniformly random y : T → Y.
Products of values average to products of averages: for a k-wise independent family and
a set T of at most k points, the average of ∏ x ∈ T, f x (h i x) is
∏ x ∈ T, 𝔼 y, f x y.
A k-wise independent family with k ≥ 2 is pairwise independent.
Pairwise independence is 2-wise independence: a family is 2-wise independent exactly
when it is pairwise independent and has a seed. So the pairwise independent families, such as
Cslib.Probability.isPairwiseIndependentHash_affineHash, carry the k-wise API for k = 2.
The 2 m-th moment bound for limited independence: for a 2 m-wise independent family and
scores Z x : Y → ℝ with average 0 and values in [-1, 1] at the points x of a finite set
S, the 2 m-th moment of ∑ x ∈ S, Z x (h i x) is at most m ^ (2 m) * #S ^ m. Expanding the
power, only tuples of points in which every point occurs at least twice contribute, and these
tuples have at most m distinct entries.
The tail bound for limited independence: for a 2 m-wise independent family and scores
Z x : Y → ℝ with average 0 and values in [-1, 1] at the points of a finite set S, the sum
∑ x ∈ S, Z x (h i x) has absolute value at least a > 0 with probability at most
(m² #S / a²) ^ m.
The tail bound for limited independence, for scores in [0, 1]: for a 2 m-wise
independent family and scores g x : Y → [0, 1], the sum ∑ x ∈ S, g x (h i x) deviates from its
mean ∑ x ∈ S, 𝔼 y, g x y by at least a > 0 with probability at most (m² #S / a²) ^ m.
The surjectivity criterion: let the seeds ι form a finite additive group and let the
functions g i : X → Y into a finite additive group depend additively on i. If for every set
T of at most k points the restrictions of the g i to T take every value in T → Y, then
the family is k-wise independent.