Documentation

CslibFrontier.Probability.KWiseIndependent.DoubleTabulation.Parameters

Parameter arithmetic for Thorup's Double Tabulation bound #

Consumers of card_not_isKUnique_eight_mul_le (dictionaries hashing with Double Tabulation at q = 4, d = 8 * c) all instantiate it the same way: c = 2 * max c_exp 1 characters of bit-width b = (1 + Nat.clog 2 (max n_max 4)) / 2 for a polynomial universe U ≤ max n_max 4 ^ c_exp above doubleTabThreshold c_exp, and then turn the counting bound into a high-probability statement for a load factor B. This file packages those steps.

Main results #

References #

theorem Cslib.Probability.two_mul_card_not_isKUnique_mul_le {c b k B : ℕ} (hc : 1 ≤ c) (hB : 1 ≤ B) (hbound : 2 * B * doubleTabCodeBound c (8 * c) 4 k ≤ 2 ^ (3 * b)) :
2 * {T₁ : DoubleTabTopSeed c (8 * c) b | ¬IsKUnique k (simpleTabTuple T₁)}.card * B ≤ Fintype.card (DoubleTabTopSeed c (8 * c) b)

High-probability k-uniqueness of Double Tabulation top tables ([Thorup2013], Theorem 1(a)): when 1 ≤ B and 2 * B * doubleTabCodeBound c (8 * c) 4 k ≤ 2 ^ (3 * b), the number of top-level tables T₁ whose simpleTabTuple T₁ fails to be k-unique is at most a 1 / (2 * B) fraction of all top-level tables.

theorem Cslib.Probability.doubleTab_canonical_params {c_exp n_max U : ℕ} (hge : doubleTabThreshold c_exp ≤ n_max) (hU : U ≤ max n_max 4 ^ c_exp) :
U ≤ 2 ^ (2 * max c_exp 1 * ((1 + Nat.clog 2 (max n_max 4)) / 2)) ∧ doubleTabMinB c_exp ≤ (1 + Nat.clog 2 (max n_max 4)) / 2 ∧ max n_max 4 ≤ 2 ^ (2 * ((1 + Nat.clog 2 (max n_max 4)) / 2))

Canonical Double Tabulation parameters: for c = 2 * max c_exp 1 characters of bit-width b = (1 + Nat.clog 2 (max n_max 4)) / 2, a polynomial universe U ≤ max n_max 4 ^ c_exp fits in c characters, the capacity satisfies max n_max 4 ≤ 2 ^ (2 * b), and above doubleTabThreshold c_exp the bit-width clears doubleTabMinB c_exp.

theorem Cslib.Probability.mul_doubleTabCodeBound_le {c_exp b k A : ℕ} (hb : doubleTabMinB c_exp ≤ b) (hk : k ≤ b ^ 2) (hA : A ≤ 2 ^ (2 * b) * b ^ 2) :
A * doubleTabCodeBound (2 * max c_exp 1) (8 * (2 * max c_exp 1)) 4 k ≤ 2 ^ (3 * b)

Code-bound budget for the canonical parameters: with c = 2 * max c_exp 1 and doubleTabMinB c_exp ≤ b, a load factor A ≤ 2 ^ (2 * b) * b ^ 2 times doubleTabCodeBound c (8 * c) 4 k for a key count k ≤ b ^ 2 is at most 2 ^ (3 * b).