Pure cuckoo tables, displacement, and replay #
This module defines the pure two-table cuckoo model used by the graph analysis and the Word-RAM
implementation. It has no dependency on a machine model. The table scale and eviction cap are the
parameters used by the quantitative analysis; SlotEntry, PureTable, WellPlaced, pureEvict,
and pureReplay describe table contents and insertion-order replay independently of memory layout.
GoodForSet requires successful replay for every duplicate-free insertion order in a set.
cuckooWalkRounds is the supremum of the displacement rounds over every ValidPlacement of that
set and every allocation index. These are original strengthened sufficient notions inspired by
Pagh and Rodler [PR04], Section 2.3 (8 December 2003 manuscript, pp. 6–10): Lemma 1 on
p. 7 concerns the distinct-subsequence structure of displacement walks, Eq. (3) on p. 9 bounds
expected displacement iterations, and pp. 9–10 analyze rehashing. The chosen sub-table size
2 ^ tableBits n_max ≥ 32 * max n_max 4 is a stronger load condition than their
m ≥ (1 + ε) n.
Main definitions #
tableBits,tableSize,maxEvictions,cuckooK: table scale, eviction cap, and required independence level.SlotEntry,PureTable,WellPlaced,lookupEntry,pureEvictRound,pureEvict,pureReplay: pure two-table state, lookup, displacement, and replay.GoodForSet,ValidPlacement,cuckooWalkRounds,survivingSeeds: uniform replay goodness, worst-case walk counts, and the set of successful replay seeds.
Main results #
pureReplay_append_singleton,pureReplay_lookupEntry_of_mem: incremental insertion agrees with replay, and lookup recovers the inserted key's allocation index.survivingSeeds_append_subset,mem_survivingSeeds_of_goodForSet: surviving replay seeds shrink on insertion, and set-level goodness implies successful replay.pureReplay_isSome_of_length_le_two: replay of at most two keys succeeds for every hash pair with a positive eviction cap.
References #
- R. Pagh and F. F. Rodler, "Cuckoo hashing" (8 December 2003 author manuscript, Section 2.3, pp. 6–10).
Section 1: Table scale and eviction cap parameters #
Sub-table bit-width M = ⌈log₂ (32 * max n_max 4)⌉, ensuring each of the two cuckoo sub-tables
has size m = 2 ^ M ≥ 32 * max n_max 4.
Sub-table capacity m = 2 ^ tableBits n_max.
Maximum number of two-table cuckoo displacement rounds 6 * (⌈log₂ max(n_max, 2)⌉ + 2) before
triggering a full-table rehash.
Independence parameter k = 2 * maxEvictions n_max + 2 required by the two-table cuckoo hashing
analysis on eviction walks of length up to maxEvictions n_max.
Section 2: Pure two-table cuckoo displacement and replay model #
The empty cuckoo table pair in which every slot of T₁ and T₂ is none.
Well-placed cuckoo table invariant under hash pair (h₁, h₂):
every entry in T₁ sits at its h₁-home slot, every entry in T₂ sits at its h₂-home slot,
and no key appears simultaneously in both T₁ and T₂.
Section 3: Set-monotone cuckoo goodness, walk bounds, and conditional-uniform invariance #
Original strengthened sufficient goodness predicate: a hash pair (h₁, h₂) is good for key set
S with cap maxLoop if replaying every duplicate-free (Nodup) key list ks with ks ⊆ S
succeeds within maxLoop displacement rounds per insertion.
Original strengthened worst-case displacement round count: supremum (sSup) of evictRounds
to insert u over all ValidPlacements of S under (h₁, h₂) with cap maxLoop.
In any valid placement of a key set S of cardinality at most 1, if T₁ contains an entry
e₁, then every slot of T₂ is empty (by key disjointness between T₁ and T₂).
In any valid placement of a key set S of cardinality at most 1, a single two-table
displacement round pureEvictRound always terminates without displacing an entry from T₂.
Whenever S.card ≤ 1, inserting any key u into any valid placement of S completes in at
most 1 displacement round for every hash pair (h₁, h₂).
Finset of hash seeds θ : Θ under which insertion-order replay
pureReplay (h₁ θ) (h₂ θ) maxLoop ks succeeds without exhausting the displacement cap maxLoop.
When ks has length at most 1 and 0 < maxLoop, pureReplay succeeds for every hash pair
(h₁, h₂) in a single probe into T₁.
When ks has length at most 2 and 0 < maxLoop, pureReplay succeeds for every hash pair
(h₁, h₂) in at most 1 displacement round per key: the first key lands in T₁, and even if the
second key collides with the first in T₁, the displaced first key lands in T₂, which is
empty.