One-round Feistel quotienting and universal succinct bit accounting #
This file formalizes the one-round Feistel permutation used for quotienting keys in succinct hash
tables (Arbitman, Naor and Segev, FOCS 2010, Claim 5.7;
Bender, Conway, Farach-Colton, Kuszmaul and Tagliavini, J. ACM 2023, Section 7, arXiv
pp. 31–33) together with the universal
bit-accounting inequality comparing quotient + value storage against the information-theoretic
optimum Dynamic.optBits U V n = ⌈log₂ C(U, n)⌉ + n * ⌈log₂ V⌉ for every n.
Given a universe bound U, capacity n ≤ U, and bucket bit-width
b = bucketBits n = ⌊log₂ n⌋ - 3 * logLogFactor n:
- Every key
u < UhaskeyBits U = ⌈log₂ U⌉bits and splits into a lowb-bit partkeyLow b u = u % 2^band a high(keyBits U - b)-bit quotientkeyQuotient b u = u / 2^b. - Given a hash function
h1 : ℕ → ℕ, keyumaps to bucketfeistelBucket b h1 u = (h1 (keyQuotient b u) % 2^b) ^^^ keyLow b u < 2^band stores onlykeyQuotient b u < 2^(quotientBits U n). - From
(bucket, keyQuotient b u),feistelReconstruct b h1 bucket (keyQuotient b u)recoversuuniquely (feistelReconstruct_feistelBucket). Consequently, distinct keys sharing the same quotient always map to distinct Feistel buckets (feistelBucket_ne_of_keyQuotient_eq_of_ne). - For every
n, storingnquotients ofquotientBits U nbits andnvalues ofvalBits V = ⌈log₂ V⌉bits uses at mostDynamic.optBits U V n + 5 * n * Dynamic.logLogFactor nbits (quotient_val_bits_le_optBits).
Main definitions #
Cslib.DataStructure.Dictionary.FeistelQuotient.keyBits,valBits,slabScale,bucketBits,numBuckets,quotientBits: bit-width and bucket/slab parameters.Cslib.DataStructure.Dictionary.FeistelQuotient.keyLow,keyQuotient,feistelBucket,feistelReconstruct,feistelXor: one-round Feistel bucket assignment and key reconstruction.
Main results #
bucketBits_le_keyBits,quotientBits_add_bucketBits:bucketBits n ≤ keyBits UandquotientBits U n + bucketBits n = keyBits Ufor alln ≤ U.feistelReconstruct_feistelBucket,eq_of_feistelBucket_eq_of_keyQuotient_eq,feistelBucket_ne_of_keyQuotient_eq_of_ne: exact invertibility of Feistel quotienting.pow_le_pow_mul_choose:U ^ n ≤ n ^ n * U.choose nfor alln ≤ U.quotient_bits_le_choose,quotient_val_bits_le_optBits: universal succinct bit accounting valid for alln.expect_card_feistelXor_eq_on,expect_feistelXor_mul_sub_one_le_on,expect_feistelXor_overflow_le_on: pairwise and 3-wise independence bounds for Feistel bucket and micro-chain collisions and bucket overflow.
References #
Section 1: Bit-width parameters and bucket/slab scales #
Number of bits ⌈log₂ U⌉ needed to represent keys in Fin U.
Number of bits ⌈log₂ V⌉ needed to represent values in Fin V.
Poly-logarithmic scale parameter L = 2^(logLogFactor n) ≥ 2, satisfying
log₂ n ≤ L ≤ 2 * ⌈log₂ (max n 4)⌉.
Number of bucket index bits b = ⌊log₂ n⌋ - 3 * logLogFactor n.
Number of Feistel buckets M = 2^(bucketBits n).
Number of stored quotient bits per key q_bits = ⌈log₂ U⌉ - bucketBits n.
numBuckets n is always positive.
Whenever n ≤ U, the bucket bit-width bucketBits n is at most keyBits U.
Whenever n ≤ U, quotientBits U n + bucketBits n = keyBits U.
If U ≤ 2 ^ w, then quotientBits U n ≤ w.
For every n, n ≤ 2 ^ (bucketBits n + 3 * Dynamic.logLogFactor n + 1).
For every n, n ≤ 2 * numBuckets n * (slabScale n) ^ 3.
Section 2: One-round Feistel quotienting and exact key reconstruction #
The low b bits u % 2^b of a key u.
The quotient u / 2^b obtained by dropping the low b bits of u.
Inverse reconstruction of key u from its Feistel bucket index bucket and stored quotient
q = keyQuotient b u.
feistelBucket b h1 u is strictly less than 2 ^ b.
Whenever n ≤ U and u < U, the quotient keyQuotient (bucketBits n) u fits in
quotientBits U n bits (< 2 ^ (quotientBits U n)).
Reconstructing from feistelBucket b h1 u and keyQuotient b u recovers u exactly.
Reconstructing any (bucket, q) with bucket < 2 ^ b produces a key whose Feistel bucket is
bucket and whose quotient is q.
Two keys landing in the same Feistel bucket with the same quotient are equal.
Two distinct keys that share the same quotient keyQuotient b u₁ = keyQuotient b u₂ always map
to distinct Feistel buckets for every hash function h1.
Section 3: Universal quotienting bit accounting against Dynamic.optBits #
Universal quotient bit bound: for every n, storing n quotients of quotientBits U n bits
uses at most ⌈log₂ C(U, n)⌉ + 5 * n * Dynamic.logLogFactor n bits. When U < n the binomial
vanishes and quotientBits U n ≤ 3 * Dynamic.logLogFactor n + 1.
Universal quotient + value bit bound: for every n and V, storing n quotients of
quotientBits U n bits and n values of valBits V = ⌈log₂ V⌉ bits uses at most
Dynamic.optBits U V n + 5 * n * Dynamic.logLogFactor n bits.
Section 4: Pairwise and 3-wise independence bounds for Feistel buckets and micro-chains #
Typed Feistel XOR map sending key u : Fin U to
⟨(H i (qOf u)).val ^^^ keyLow b u.val, ...⟩ : Fin (2 ^ m) whenever b ≤ m.
When m = b, this is the Feistel bucket index in Fin (2 ^ b); when m = b + p, its low b
bits give the Feistel bucket index and its high p bits give the per-bucket micro-chain index.
Two distinct keys sharing the same qOf value and the same keyQuotient b value never collide
under feistelXor, for any seed i.
For a pairwise independent hash family H and distinct quotients q₁ ≠ q₂, the probability
that H i q₁ = e (H i q₂) is 1 / |Y|.
Under a pairwise independent hash H : ι → Q → Fin (2 ^ m), for any S : Finset (Fin U) and
u : Fin U such that qOf is quotient-injective on insert u (S.erase u), the expected number of
keys x ∈ S.erase u colliding with u under feistelXor is
#({x ∈ S.erase u | qOf x ≠ qOf u}) / 2 ^ m.
Under a 3-wise independent hash family H, the values at three pairwise distinct inputs
q, q₁, q₂ are mutually independent and uniform.
Under a 3-wise independent hash family H and pairwise distinct q, q₁, q₂, the probability
that H i q₁ = e₁ (H i q) and H i q₂ = e₂ (H i q) is 1 / |Y|².
Under a 3-wise independent hash H : ι → Q → Fin (2 ^ m), when qOf is quotient-injective on
insert u (S.erase u), the second factorial moment of the number of keys in S.erase u colliding
with u under feistelXor is at most (#({x ∈ S.erase u | qOf x ≠ qOf u}) / 2 ^ m) ^ 2.
Pointwise quadratic upper bound on truncated excess above 2 * D: for any N, D : ℕ and
0 ≤ μ ≤ D in ℚ, ((N - 2 * D : ℕ) : ℚ) * D ≤ ((N : ℚ) - μ) ^ 2.
3-wise independent Feistel bucket overflow bound: under a 3-wise independent hash
H : ι → Q → Fin (2 ^ m), for any D ≥ 1 and S : Finset (Fin U) with
#(S.erase u) ≤ D * 2 ^ m such that qOf is quotient-injective on insert u (S.erase u), the
expected overflow above 2 * D in u's Feistel bucket is at most 1.