A perfect hash family of size n * 2 ^ (25 * r) #
For all n and r ≥ 1 we construct a family of at most n * 2 ^ (25 * r) maps
Fin n → Fin r such that every r-element subset of Fin n is mapped injectively by some
member.
The construction and the bound are ours and are not optimal: Schmidt and Siegel (The spatial
complexity of oblivious k-probe hash functions, 1990) prove the sharper bound
2 ^ O(r) * (log n) ^ 2 by a more intricate construction, which is not formalized here. A
bound of the form poly(n) * 2 ^ O(r) is what the applications to hitting sets need; the
two-level scheme of Fredman, Komlós and Szemerédi gives only r ^ O(r).
The family splitHash q s, of maps ℕ → ℕ that is perfect for s-element sets of numbers
below q with values below s, is defined by recursion on s. For s ≥ 2 choose a prime
p with s ^ 2 + 1 < p ≤ 2 * (s ^ 2 + 1). A member consists of a linear hash map u from
numbers below q to numbers below p (see Cslib.linearHash), a threshold θ < p, and
members h₁, h₂ of the families for (p, s / 2) and (p, s - s / 2); it sends x to
h₁ (u x) if u x < θ and to s / 2 + h₂ (u x) otherwise. Given an s-element set S,
take u injective on S and θ with exactly s / 2 elements of u(S) below it. Splitting
into halves is essential for the size: #(splitHash q s) * s ^ 8 ≤ q * (2 ^ 25) ^ (s - 1) by
induction, using 2 * s ^ 2 ≤ 9 * ((s / 2) * (s - s / 2)).
Main definitions #
Cslib.perfectHashFamily: the family of mapsFin n → Fin r.
Main results #
Cslib.isPerfectHashFamily_perfectHashFamily: it is a perfect hash family forr-element sets when0 < r.Cslib.card_perfectHashFamily_le: it has at mostn * 2 ^ (25 * r)members.
An explicit family of maps Fin n → Fin r that is a perfect hash family for r-element
sets when 0 < r (isPerfectHashFamily_perfectHashFamily) and has at most n * 2 ^ (25 * r)
members (card_perfectHashFamily_le). It is empty when n = 0 or r = 0.
The construction, by linear hashing and recursive splitting at a threshold, is ours; Schmidt
and Siegel (1990) construct families of the smaller size 2 ^ O(r) * (log n) ^ 2.
Every r-element subset of Fin n is mapped injectively by a member of
perfectHashFamily n r, for 0 < r. (For r = 0 < n there is no map Fin n → Fin r.)
perfectHashFamily n r has at most n * 2 ^ (25 * r) members. This bound is ours;
Schmidt and Siegel (1990) prove 2 ^ O(r) * (log n) ^ 2 for a different family.