Partitioned-bucket, micro-bucket, and slab-hysteresis model for succinct dictionaries #
This file develops the pure structural, combinatorial, and probabilistic core of the fixed-capacity succinct dictionary with deletions. It combines the bucket partition and fingerprint-indexed buckets of Bender, Farach-Colton, J. Kuszmaul and W. Kuszmaul, SOSA 2024, Sections 3–4 with one-round Feistel quotienting (Arbitman, Naor and Segev, FOCS 2010, Claim 5.7; Bender, Conway, Farach-Colton, Kuszmaul and Tagliavini, J. ACM 2023, Section 7). Storage uses zero-wasted-slot full-slab / tail-item packing (Bender, Farach-Colton, J. Kuszmaul, W. Kuszmaul and M. Liu, STOC 2022, Sections 5.2 and 6.1, Lemma 24) together with this formalization's own micro-bucket chains and slab-hysteresis potential:
- Unified bucket and micro-bucket decomposition (
totalMicroBits_eq_log): At capacityn_max, each key is assigned abucketBits n_max-bit Feistel bucket (numBuckets n_max = 2 ^ bucketBits n_max) and amicroBits n_max-bit local micro-bucket (microBits n_max = min ⌊log₂ n_max⌋ (3 * logLogFactor n_max)), wheretotalMicroBits n_max = bucketBits n_max + microBits n_max = ⌊log₂ n_max⌋across alln_max. Thus the total number of(bucket, microBucket)chains across the entire table istotalMicroBuckets n_max = 2 ^ ⌊log₂ n_max⌋ ∈ (n_max / 2, max n_max 1], and each bucket indexes up toeffBucketCap n_max = 4 * 2 ^ microBits n_maxlocal slots usingeffBucketPosBits n_max ≤ microBits n_max + 3 ≤ 6 * logLogFactor n_maxbits per pointer. - Pointwise hysteresis slab potential (
bucketPotential): When0 < bucketBits n_max, each bucket partitions itsc_b = q_b * K + r_bitems intoq_bfull slabs ofK = slabSize n_max = (slabScale n_max)^2items andr_b < 2 * Ktail items (with1 ≤ r_bwhenever0 < q_b). PromotingKtail items whenr_breaches2 * Kand demoting a full slab whenr_bdrops to0with0 < q_bare paid for deterministically (pointwise for every hash seed) by the hysteresis potentialbucketPotential K q_b r_b. - 3-wise independent expected collision and overflow bounds (
expect_probeExcess_le_three_on,tsum_uniform_probeExcess_twoStage_le): A single 3-wise independent hash familyH : ι → Q → Fin (2 ^ totalMicroBits n_max)provides both the combined(bucket, microBucket)hashfeistelMicroHashand (by bit-prefix projection) the 3-wise independent bucket hashfeistelBucketHash. For any key setSand keyuwith#(S.erase u) ≤ n_max, when the first stageqOfis quotient-injective oninsert u (S.erase u),expect_probeExcess_le_three_onbounds the expected micro-bucket collisions with keys inS.erase uby2and the expected bucket overflow aboveeffBucketCap n_maxby1, giving at most3expected excess probes. For a two-stage hash family whose first stage has collision boundC_bad,tsum_uniform_probeExcess_twoStage_lebounds expected excess probes by3 + C_badwhenever#(S.erase u) ≤ n_max, across operation sequences of arbitrary length without sticky collision flags or seed resampling.
Main definitions #
Cslib.DataStructure.Dictionary.SuccinctBucket.microBits,numMicroPerBucket,totalMicroBits,totalMicroBuckets,effBucketCap,effBucketPosBits,slabBits,slabSize,dirSlabsPerBucket,tailCapPerBucket,maxFullSlabs,maxTailItems,globalPtrBits: dimension and bit-width parameters.Cslib.DataStructure.Dictionary.SuccinctBucket.bucketPotential,pushBackCounts,pushBackWork,popBackCounts,popBackWork: hysteresis slab potential and transitions.Cslib.DataStructure.Dictionary.SuccinctBucket.feistelMicroHash,feistelBucketHash,feistelLocalMicro,microCollCount,bucketOvfCount,probeExcess: Feistel micro-bucket and bucket hashes and per-operation excess probe counts.
Main results #
totalMicroBits_eq_log,numBuckets_mul_effBucketCap_le,numBuckets_mul_slabScale_cubed_le,globalPtrBits_le_two_mul_slabScale: exact bit-budget identities across alln_max.bucketPotential_pushBack_le,bucketPotential_popBack_le: deterministic hysteresis amortization bounds.expect_microCollCount_le_two_on,expect_bucketOvfCount_le_one_on,expect_probeExcess_le_three_on,sum_probeExcess_le_three_mul_card_on,tsum_uniform_probeExcess_twoStage_le: expected probe-excess bounds under 3-wise independence.succinct_space_le_succinctWords,tableArrays_words_le_succinctWords: master word-level space accounting.
References #
- Y. Arbitman, M. Naor and G. Segev, Backyard Cuckoo Hashing: Constant Worst-Case Operations with a Succinct Representation, Claim 5.7
- M. A. Bender, M. Farach-Colton, J. Kuszmaul and W. Kuszmaul, Modern Hashing Made Simple, Sections 3–4
- M. A. Bender, M. Farach-Colton, J. Kuszmaul, W. Kuszmaul and M. Liu, On the Optimal Time/Space Tradeoff for Hash Tables, Sections 5.2 and 6.1, Lemma 24
- M. A. Bender, A. Conway, M. Farach-Colton, W. Kuszmaul and G. Tagliavini, Iceberg Hashing: Optimizing Many Hash-Table Criteria at Once, Section 7
Section 1: Micro-bucket, effective bucket capacity, and slab parameters #
Number of local micro-bucket bits min ⌊log₂ n⌋ (3 * logLogFactor n) within each Feistel
bucket.
Number of micro-buckets 2 ^ microBits n per Feistel bucket.
Total number of (bucket, microBucket) address bits bucketBits n + microBits n = ⌊log₂ n⌋.
Total number of micro-buckets 2 ^ totalMicroBits n = 2 ^ ⌊log₂ n⌋ across all buckets.
Effective per-bucket indexed local slot capacity 4 * 2 ^ microBits n.
Bit-width ⌈log₂ (min n (effBucketCap n) + 1)⌉ of 1-based local slot pointers
0 .. min n (effBucketCap n).
Base-2 logarithm of the slab size: 0 when bucketBits n = 0 (single-bucket regime) and
2 * logLogFactor n when 0 < bucketBits n (multi-bucket slab regime).
Full-slab size K = 2 ^ slabBits n (1 when bucketBits n = 0, (slabScale n)^2 when
0 < bucketBits n).
Number of direct-indexed full-slab directory entries per bucket: 0 when bucketBits n = 0 and
4 * slabScale n when 0 < bucketBits n (covering all 4 * (slabScale n)^3 = effBucketCap n
indexed local slots).
Maximum number of tail items per bucket (0 when bucketBits n = 0, 2 * slabSize n when
0 < bucketBits n).
Maximum number of full slabs across the entire table (0 when bucketBits n = 0,
n / slabSize n when 0 < bucketBits n).
Maximum number of tail items across the entire table (numBuckets n * tailCapPerBucket n).
Bit-width ⌈log₂ (n + 1)⌉ capable of representing any global index or count in 0 .. n.
Quotient keyQuotient (bucketBits n) u.val packaged in Fin (2 ^ quotientBits U n).
When n ≤ U, (quotientFin U n u).val = keyQuotient (bucketBits n) u.val.
When n ≤ U, equality of quotientFin U n implies equality of keyQuotient (bucketBits n).
For every n : ℕ, totalMicroBits n = Nat.log 2 n.
bucketBits n is at most totalMicroBits n.
microBits n is at most 3 * Dynamic.logLogFactor n.
Whenever n ≤ U, totalMicroBits n ≤ keyBits U.
If U ≤ 2 ^ w and n ≤ U, then totalMicroBits n ≤ w.
numMicroPerBucket n is always positive.
totalMicroBuckets n is always positive.
totalMicroBuckets n factors as numBuckets n * numMicroPerBucket n.
For every n : ℕ, totalMicroBuckets n ≤ max n 1.
When 1 ≤ n, totalMicroBuckets n ≤ n.
For every n : ℕ, n ≤ 2 * totalMicroBuckets n.
For every n : ℕ, n ≤ (2 * numMicroPerBucket n) * numBuckets n.
effBucketCap n is at least 4.
effBucketCap n is always positive.
When bucketBits n = 0, n < effBucketCap n (so bucket 0 never overflows
effBucketCap n).
When 0 < bucketBits n, microBits n = 3 * Dynamic.logLogFactor n and
effBucketCap n = 4 * (slabScale n) ^ 3.
Every 1-based local slot pointer 0 .. min n (effBucketCap n) fits strictly below
2 ^ effBucketPosBits n.
At capacity 0, effBucketPosBits 0 = 0.
effBucketPosBits n is at most 6 * Dynamic.logLogFactor n.
Total indexed local slots across all buckets satisfy
numBuckets n * effBucketCap n = 4 * totalMicroBuckets n ≤ 4 * max n 1.
When 1 ≤ n, numBuckets n * effBucketCap n ≤ 4 * n.
When 0 < bucketBits n, slabSize n = (slabScale n) ^ 2 and 4 ≤ slabSize n.
When 0 < bucketBits n, numBuckets n * (slabScale n) ^ 3 ≤ n.
n is strictly less than 2 ^ globalPtrBits n.
At capacity 0, globalPtrBits 0 = 0.
effBucketPosBits n is at most globalPtrBits n.
Whenever n ≤ U and U < 2 ^ w, globalPtrBits n ≤ w.
Whenever n ≤ U and U < 2 ^ w, effBucketPosBits n ≤ w.
When 0 < bucketBits n, globalPtrBits n ≤ 2 * slabScale n.
For every n : ℕ, maxTailItems n ≤ n.
For every n : ℕ, maxFullSlabs n ≤ n.
For every n : ℕ, maxTailItems n * globalPtrBits n ≤ 4 * n.
For every n : ℕ, (numBuckets n * dirSlabsPerBucket n) * globalPtrBits n ≤ 4 * n.
For every n : ℕ, maxFullSlabs n * globalPtrBits n ≤ n.
For every n : ℕ, when 0 < bucketBits n, 2 * (numBuckets n * globalPtrBits n) ≤ n.
For every n : ℕ, when 0 < bucketBits n, numBuckets n * globalPtrBits n ≤ n.
Section 2: Hysteresis slab potential (bucketPotential) #
Per-bucket slab hysteresis potential ϕ(K, q, r) for slab size K:
r - KwhenK ≤ r(accumulating potential toward a slab promotion atr = 2 * K);K - rwhen0 < q ∧ r < K(accumulating potential toward a slab demotion atr = 0);0whenq = 0 ∧ r < K.
An empty bucket (q = 0, r = 0) has zero hysteresis potential.
When r ≤ 2 * K, bucketPotential K q r ≤ K.
Number of items moved between the tail pool and full-slab pool by pushBackCounts.
Number of items moved between the full-slab pool and tail pool by popBackCounts.
pushBackCounts increments the total item count q * K + r by 1.
pushBackCounts preserves the hysteresis upper bound r' < 2 * K and positivity 1 ≤ r'.
popBackCounts decrements the total item count q * K + r by 1 when 1 ≤ r.
popBackCounts preserves r' < 2 * K and (0 < q' → 1 ≤ r').
Pointwise hysteresis amortization for pushBack:
bucketPotential K q' r' + pushBackWork K r ≤ bucketPotential K q r + 1.
Pointwise hysteresis amortization for popBack:
bucketPotential K q' r' + popBackWork K q r ≤ bucketPotential K q r + 1.
Section 3: Feistel micro-bucket and bucket hash decomposition & expected cost bounds #
Combined (bucket, microBucket) Feistel hash mapping u : Fin U into
Fin (2 ^ totalMicroBits n_max).
Feistel bucket hash mapping u : Fin U into Fin (2 ^ bucketBits n_max) (the low
bucketBits n_max bits of feistelMicroHash).
Local micro-bucket index (H i (qOf u)).val / 2 ^ bucketBits n_max < numMicroPerBucket n_max
within u's Feistel bucket.
The Feistel XOR only touches the low bucketBits n_max bits, so the high bits of
feistelMicroHash are the local micro-bucket feistelLocalMicro.
(feistelMicroHash n_max qOf H i u).val decomposes into feistelBucketHash in the low
bucketBits n_max bits and feistelLocalMicro in the high microBits n_max bits.
Two keys land in the same global micro-bucket feistelMicroHash if and only if they land in
the same Feistel bucket feistelBucketHash and the same local micro-bucket feistelLocalMicro.
feistelBucketHash agrees with feistelBucket on the integer hash output (H i (qOf u)).val.
Number of keys in S.erase u colliding with u in the combined (bucket, microBucket) hash
feistelMicroHash.
Number of keys in S.erase u in u's Feistel bucket beyond the indexed local capacity
effBucketCap n_max.
Combined excess probe count microCollCount + bucketOvfCount for key u against S.
Expected micro-bucket collision bound: under a pairwise-independent hash H, for any
S : Finset (Fin U) with #(S.erase u) ≤ n_max such that qOf is quotient-injective on
insert u (S.erase u), the expected number of keys in S.erase u landing in u's micro-bucket is
at most 2.
Expected bucket overflow bound: under a 3-wise independent hash H, for any
S : Finset (Fin U) with #(S.erase u) ≤ n_max such that qOf is quotient-injective on
insert u (S.erase u), the expected overflow above effBucketCap n_max in u's Feistel bucket is
at most 1.
Master expected probe-excess bound: under a 3-wise independent hash H, for any
S : Finset (Fin U) with #(S.erase u) ≤ n_max such that qOf is quotient-injective on
insert u (S.erase u), the expected combined probe excess probeExcess n_max qOf H i S u is at
most 3.
Natural-number sum form of expect_probeExcess_le_three_on: the sum of probeExcess over all
seeds i : ι is at most 3 * Fintype.card ι.
Deterministic worst-case bound on probeExcess: for any seed i,
probeExcess n_max qOf H i S u ≤ 2 * #(S.erase u).
Two-stage universe-reduced expected probe-excess bound: for a product seed space
ι₁ × ι₂ where the first stage qOf : ι₁ → Fin U → Q is quotient-injective on
insert u (S.erase u) on a good seed set G ⊆ univ with
#(univ \ G) * (2 * #(S.erase u)) ≤ C_bad * Fintype.card ι₁, and the second stage
H : ι₂ → Q → Fin (2 ^ totalMicroBits n_max) is 3-wise independent, the expected probeExcess
under PMF.uniformOfFintype (ι₁ × ι₂) is at most 3 + C_bad.
Section 4: Cardinality bounds for injective bucket and micro-bucket slot maps #
If a finset J : Finset ℕ of local slot indices injects via keyAt : ℕ → Fin U into the keys
of S landing in u's micro-bucket, then #J ≤ 1 + microCollCount n_max qOf H i S u.
If a bucket contains c_b items that inject via keyAt : Fin c_b → Fin U into the keys of S
landing in u's Feistel bucket, then the overflow count c_b - effBucketCap n_max is at most
1 + bucketOvfCount n_max qOf H i S u.
Section 5: Master word-level space accounting (succinctWords) #
Master succinct word-space bound: if the auxiliary bit budget B_aux is at most
C_aux * n_max * Dynamic.logLogFactor n_max, then storing n_max quotients of
quotientBits U n_max bits, n_max values of valBits V bits, B_aux auxiliary bits (with
additive word overhead C_pad), and C_hdr header/hash words uses at most
Dynamic.succinctWords (C_aux + 5) (C_pad + C_hdr) U V w n_max words across all w.
Total number of effBucketPosBits n-bit entries in the local micro-bucket metadata array
LocalMeta: for each of the numBuckets n buckets, numMicroPerBucket n micro-bucket heads plus
2 * effBucketCap n doubly-linked list pointers (next and prev).
Number of variable per-bucket and per-slab globalPtrBits n-bit entries in GlobalMeta: 0 in
the single-bucket regime (bucketBits n = 0), and numBuckets n * (3 + dirSlabsPerBucket n + 2 * tailCapPerBucket n) + 4 * maxFullSlabs n in the multi-bucket slab regime (0 < bucketBits n).
Total number of globalPtrBits n-bit entries in GlobalMeta: 4 global header slots (slots
0 and 1 store n_slabs and n_tails; slots 2 and 3 are unused) plus globalMetaVarLen n.
For every n : ℕ, localMetaLen n * effBucketPosBits n ≤ 54 * n * Dynamic.logLogFactor n.
For every n : ℕ, globalMetaVarLen n * globalPtrBits n ≤ 18 * n.
For every n : ℕ, globalMetaLen n * globalPtrBits n ≤ 20 * n * Dynamic.logLogFactor n.
When 0 < bucketBits n, globalMetaLen n ≤ n.
Succinct table word-space bound: the sum of the word sizes of Quotients,
Values, the 9 LocalMeta sub-arrays of length totalMicroBuckets n_max, GlobalMeta, and
C_hdr header/hash words is at most Dynamic.succinctWords 79 (35 + C_hdr) U V w n_max across
all w.