Documentation

CslibFrontier.DataStructure.NearNeighbor.Hamming

Probabilistic LSH query-failure step in Hamming space #

This module formalizes the LSH exponent bound ρ ≤ 1 / c and probabilistic candidate-collision / query-failure step on unbucketed point-set filtering for bit sampling in Hamming space (after [IM98] and [HPIM12], Section 3.2.1; not a bucketed sublinear approximate near-neighbour data structure, tracked in #3361).

Bit sampling is (r, c r, 1 - r / d, 1 - c r / d)-sensitive for Hamming distance on words of length d (Cslib.Probability.isLocalitySensitive_bitSampling). Concavity of t ↦ log (1 - t) at 0 gives ρ ≤ 1 / c (Cslib.DataStructure.NearNeighbor.rho_one_sub_le), table count L < n ^ (1 / c) / p₁ + 1 (numTables_bitSampling_lt), and unbucketed query failure at most e⁻¹ + 1 / 3 (toOuterMeasure_query_bitSampling_eq_none_le). Word-RAM hash buckets, seed storage, and native O(n ^ (1 / c)) query running time remain open in #3361.

Main results #

References #

theorem Cslib.DataStructure.NearNeighbor.rho_one_sub_le {a c : ℝ} (ha : 0 < a) (hc : 1 < c) (hca : c * a < 1) :
rho (1 - a) (1 - c * a) ≤ 1 / c

Parameter-exponent step ρ(1 - a, 1 - c a) ≤ 1 / c (after [IM98] and [HPIM12], Section 3.2.1; #3361): for 0 < a and 1 < c with c a < 1, log (1 / (1 - a)) / log (1 / (1 - c a)) ≤ 1 / c.

theorem Cslib.DataStructure.NearNeighbor.toOuterMeasure_query_bitSampling_eq_none_le {κ : Type u_1} [Fintype κ] [Nonempty κ] {β : Type u_2} [DecidableEq β] {r c : ℝ} (hr : 0 < r) (hc : 1 < c) (hcr : c * r < ↑(Fintype.card κ)) {P : List (κ → β)} {q x₀ : κ → β} (hx₀ : x₀ ∈ P) (hnear : ↑(hammingDist x₀ q) ≤ r) :
((Probability.PMF.iid (Probability.PMF.iid (Probability.PMF.uniformOfFintype κ) (numHashes P.length (1 - c * r / ↑(Fintype.card κ)))) (numTables P.length (1 - r / ↑(Fintype.card κ)) (1 - c * r / ↑(Fintype.card κ)))).toOuterMeasure {s : Fin (numTables P.length (1 - r / ↑(Fintype.card κ)) (1 - c * r / ↑(Fintype.card κ))) → Fin (numHashes P.length (1 - c * r / ↑(Fintype.card κ))) → κ | query (Probability.andHash (fun (i : κ) (z : κ → β) => z i) (numHashes P.length (1 - c * r / ↑(Fintype.card κ)))) (fun (x y : κ → β) => c * r ≤ ↑(hammingDist x y)) s (3 * numTables P.length (1 - r / ↑(Fintype.card κ)) (1 - c * r / ↑(Fintype.card κ))) P q = none}).toReal ≤ Real.exp (-1) + 1 / 3

Probabilistic query-failure step for bit sampling on unbucketed point-set filtering in Hamming space (after [IM98] and [HPIM12], Section 3.2.1; not a bucketed sublinear near-neighbour data structure, #3361). On words of length d = |κ| with 0 < r, 1 < c, c r < d, p₁ = 1 - r / d, p₂ = 1 - c r / d, k = numHashes n p₂, L = numTables n p₁ p₂, and T = 3 L, if some x₀ ∈ P is within Hamming distance r of q, query returns none with probability at most e⁻¹ + 1 / 3; any returned word is within distance c r (query_eq_some).

theorem Cslib.DataStructure.NearNeighbor.numTables_bitSampling_lt {r c d : ℝ} (hr : 0 < r) (hc : 1 < c) (hcr : c * r < d) {n : ℕ} (hn : 0 < n) :
↑(numTables n (1 - r / d) (1 - c * r / d)) < ↑n ^ (1 / c) / (1 - r / d) + 1

Parameter table-count step for bit sampling (#3361): L < n ^ (1 / c) / (1 - r / d) + 1.