Documentation

CslibFrontier.Probability.LocalitySensitiveHash.BitSampling

Bit sampling for the Hamming distance #

The bit-sampling family of Indyk and Motwani [IM98] hashes a word x : n → β to one coordinate x i, where the index i is uniform. Two words collide with probability 1 - d_H(x, y) / |n| (Cslib.Probability.collisionProb_bitSampling), so the family is (r₁, r₂, 1 - r₁ / |n|, 1 - r₂ / |n|)-sensitive for the Hamming distance (Cslib.Probability.isLocalitySensitive_bitSampling; [LRU20], Section 3.7.1). The coordinates may take values in any alphabet β, not only bits.

Main results #

References #

theorem Cslib.Probability.collisionProb_bitSampling {n : Type u_1} [Fintype n] [Nonempty n] {β : Type u_2} [DecidableEq β] (x y : n → β) :
collisionProb (PMF.uniformOfFintype n) (fun (i : n) (z : n → β) => z i) x y = 1 - ↑(hammingDist x y) / ↑(Fintype.card n)

Bit sampling [IM98]: a uniformly random coordinate separates two words with probability their relative Hamming distance.

theorem Cslib.Probability.isLocalitySensitive_bitSampling {n : Type u_1} [Fintype n] [Nonempty n] {β : Type u_2} [DecidableEq β] (r₁ r₂ : ℝ) :
IsLocalitySensitive (collisionProb (PMF.uniformOfFintype n) fun (i : n) (z : n → β) => z i) (fun (x y : n → β) => ↑(hammingDist x y) ≤ r₁) (fun (x y : n → β) => r₂ ≤ ↑(hammingDist x y)) (1 - r₁ / ↑(Fintype.card n)) (1 - r₂ / ↑(Fintype.card n))

Bit sampling is (r₁, r₂, 1 - r₁ / |n|, 1 - r₂ / |n|)-sensitive for the Hamming distance ([IM98]; [LRU20], Section 3.7.1).