Correctness of asymmetric LSH with the simple transformation full
This proof shows: correctness.
Let X={x1,…,xn}⊂Rd, M=maxi∥xi∥>0, q=0, and s(q,x)=q⋅x/(M∥q∥).
Lemma 1. ∥P(x)∥=∥Q(q)∥=1 and P(x)⋅Q(q)=s(q,x).
Proof. Since ∥x∥≤M, the number 1−∥x∥2/M2 is in [0,1] and its root is real. ∥P(x)∥2=∥x∥2/M2+(1−∥x∥2/M2)=1, and ∥Q(q)∥2=∥q∥2/∥q∥2+0=1. The last coordinate of Q(q) is 0, so P(x)⋅Q(q)=(x/M)⋅(q/∥q∥)=s(q,x). □
So by the Cauchy-Schwarz inequality s(q,x)∈[−1,1], and the angle θ(x)=arccoss(q,x) between P(x) and Q(q) is a decreasing function of q⋅x.
Lemma 2. Let a have independent standard normal entries and u,v be unit vectors at angle θ∈[0,π]. Then Pr[sign(a⋅u)=sign(a⋅v)]=1−θ/π.
Proof. Let a′ be the orthogonal projection of a onto the plane spanned by u and v (any plane containing them if u=±v). Then a⋅u=a′⋅u and a⋅v=a′⋅v. The distribution of a is invariant under rotations, so a′ is a standard normal vector in the plane, and its direction is uniform on the circle. With probability 1 it is not orthogonal to u or v. The signs differ exactly when the line orthogonal to a′ separates u from v; this line has a uniform direction, and it separates them for an arc of directions of total measure 2θ out of 2π. So the signs differ with probability θ/π. □
With u=P(x) and v=Q(q), one bit agrees with probability f(s)=1−arccos(s)/π, which is increasing in s. So when s(q,x)≥S a bit agrees with probability at least p1=f(S), and when s(q,x)≤cS with probability at most p2=f(cS); p1>p2 since S>cS. The k bits of a key use independent vectors, so a key agrees with probability f(s)k.
Theorem. Let k=⌈lnn/ln(1/p2)⌉ and L=⌈nρ/p1⌉ with ρ=ln(1/p1)/ln(1/p2). If some x∗ has s(q,x∗)≥S, then with probability at least 1−1/e QUERY returns a point x′ with s(q,x′)≥S. The expected number of candidates x with s(q,x)≤cS is at most L.
Proof. In one table, x∗ shares the bucket of q with probability at least p1k. Since k<lnn/ln(1/p2)+1,
p1k≥p1⋅p1lnn/ln(1/p2)=p1⋅e−lnn⋅ln(1/p1)/ln(1/p2)=p1n−ρ. The L tables are independent, so x∗ is missed by all of them with probability at most (1−p1n−ρ)L≤e−Lp1n−ρ≤e−1, since Lp1≥nρ. If x∗ is a candidate, line L7 returns the candidate x′ with the largest q⋅x, so q⋅x′≥q⋅x∗ and s(q,x′)≥s(q,x∗)≥S.
For the second claim, a point with s(q,x)≤cS shares the bucket of q in one table with probability at most p2k≤p2lnn/ln(1/p2)=1/n. By linearity of expectation over at most n such points and L tables, the expected number of such candidates, counted with repetition, is at most L. ■