Bit sampling answers the (c, r)-near neighbor query with constant probability full
This proof shows: correctness.
Let P⊆{0,1}d with ∣P∣=n≥1, let c>1 and 0<cr<d, and let H be the Hamming distance. Put p1=1−r/d, p2=1−cr/d, ρ=ln(1/p1)/ln(1/p2), k=⌈lnn/ln(1/p2)⌉ and L=⌈nρ/p1⌉. The positions of line L2 are independent and uniform. Fix a query q. Write gj(x) for the key of x in table j.
Claim 1. If the query returns x, then H(q,x)≤cr.
Proof. The only line that returns a string is L6, after the test H(q,x)≤cr. □
So if no string is within cr, the answer none is correct. From now on let p∗∈P have H(q,p∗)≤r.
Claim 2. For one uniform position i, Pr[x[i]=y[i]]=1−H(x,y)/d.
Proof. The bits of x and y differ at exactly H(x,y) of the d positions, and i is uniform over the d positions. □
Claim 3. Pr[gj(p∗)=gj(q)]≥p1k, and Pr[gj(x)=gj(q)]≤p2k≤1/n for each x with H(q,x)>cr.
Proof. The k positions of table j are independent, so the key probability is the product of k equal factors 1−H/d from Claim 2. For p∗, each factor is at least 1−r/d=p1. For x with H(q,x)>cr, each factor is less than 1−cr/d=p2. Finally k≥lnn/ln(1/p2) gives p2k≤e−lnn=1/n. □
Claim 4. Let E1 be the event that gj(p∗)=gj(q) for some j. Then Pr[E1]≥1−1/e.
Proof. Since k<lnn/ln(1/p2)+1 and p1≤1,
p1k≥p1⋅p1lnn/ln(1/p2)=p1⋅e−lnn⋅ln(1/p1)/ln(1/p2)=p1n−ρ. So Lp1k≥1. The tables are independent, so Pr[not E1]≤(1−p1k)L≤e−Lp1k≤1/e. □
Claim 5. Let Z be the number of pairs (j,x) with H(q,x)>cr and gj(x)=gj(q), and let E2 be the event Z<3L. Then Pr[E2]≥2/3.
Proof. By Claim 3 and linearity of expectation, E[Z]≤L⋅n⋅(1/n)=L. By Markov's inequality, Pr[Z≥3L]≤1/3. □
Claim 6. If E1 and E2 hold, the query returns a string within cr.
Proof. Assume the query returns none. Then the test of line L6 failed for every counted pair, so every counted pair (j,x) has H(q,x)>cr and is counted in Z. So the count stays below 3L, line L7 never stops the loop, and line L5 visits every pair of every bucket of q. By E1 one of them is (j,p∗) with H(q,p∗)≤r≤cr, and line L6 returns it. This is a contradiction. So the query returns a string, which is within cr by Claim 1. □
Conclusion. By the union bound, Pr[E1 and E2]≥1−1/e−1/3=2/3−1/e>0.29. By Claim 6 the query then returns a string within cr. Together with Claim 1 this proves the theorem.
The exponent. Let x=r/d, so 0<cx<1. Bernoulli's inequality gives (1−x)c≥1−cx for real c≥1 and 0≤x≤1. Taking logarithms, cln(1−x)≥ln(1−cx), and dividing by the negative number cln(1−cx) gives ρ=ln(1−x)/ln(1−cx)≤1/c. So L=O(n1/c/p1). ■