Lean, informalized

Nielsen & Chuang · Chapter 6, Quantum search algorithms · p. 261

Exercise 6.13 - The spread of the sampling estimate of the number of solutions, and a linear bound on the draws it needs

Classical sampling needs order NN draws to count solutions.

Hover over a blue or green term in the text, or a node in the graph, to find it in the other. Select it to read its declaration both in Lean and in words.

The Exercise

A search space holds NN items, MM of them solutions, and an oracle answers whether a given item is a solution. A classical algorithm estimates MM by sampling: it draws kk items uniformly and independently, asks the oracle about each, and returns the fraction of draws that turned up a solution, multiplied by NN. The exercise asks for the standard deviation of this estimate, and then for the number of draws it takes to get MM right to within M\sqrt{M} with probability at least three quarters, whatever the value of MM; the answer is a number of draws linear in NN.

Sampling the Search Space

The success probability pp of a draw from NN items of which MM are solutions is the number p=min⁡(MN,1).p = \min\Bigl(\frac{M}{N},\, 1\Bigr).(1)✦

A draw has two outcomes, yes\mathrm{yes} when the oracle finds a solution and no\mathrm{no} when it does not. The distribution μp\mu_p of a single draw is the Bernoulli distribution with parameter pp on these two outcomes: μp(yes)=p,μp(no)=1−p.\mu_p(\mathrm{yes}) = p, \qquad \mu_p(\mathrm{no}) = 1 - p.(2)✦

A run of kk draws is a sequence ω=(ω1,…,ωk)\omega = (\omega_1, \dots, \omega_k) of outcomes. The distribution PN,M,kP_{N,M,k} of a run is the product of kk copies of μp\mu_p, one for each draw, so that the draws are independent: PN,M,k(ω)=∏i=1kμp(ωi).P_{N,M,k}(\omega) = \prod_{i=1}^{k} \mu_p(\omega_i).(3)✦

The indicator XiX_i of the iith draw is the function on runs that equals one when that draw finds a solution and zero otherwise: Xi(ω)={1,ωi=yes,0,ωi=no.X_i(\omega) = \begin{cases} 1, & \omega_i = \mathrm{yes},\\ 0, & \omega_i = \mathrm{no}. \end{cases}(4)✦ The sampling estimator SS is the function on runs that counts the successful draws and scales the count by N/kN/k: S(ω)=Nk∑i=1kXi(ω).S(\omega) = \frac{N}{k} \sum_{i=1}^{k} X_i(\omega).(5)✦ It does not depend on MM; only the distribution of the runs does.

The standard deviation ΔS\Delta S of the estimator is the square root of its variance, where 𝔼\mathbb{E} denotes the expectation over runs distributed according to PN,M,kP_{N,M,k}: ΔS=𝔼[(S−𝔼S)2].\Delta S = \sqrt{\mathbb{E}\bigl[(S - \mathbb{E}\,S)^2\bigr]}.(6)✦

The Claim

Theorem 1. For a search space of N≥1N \ge 1 items with M≤NM \le N solutions and a run of k≥1k \ge 1 draws, the standard deviation of the sampling estimator is ΔS=M(N−M)k.\Delta S = \sqrt{\frac{M(N-M)}{k}}.(7)✦

The number of successes ∑iXi\sum_i X_i is binomial with variance kp(1−p)kp(1-p); scaling by N/kN/k and putting p=M/Np = M/N gives (7).

Theorem 2. Let a run have k≥1k \ge 1 draws from a search space of NN items, and suppose that for every number of solutions MM with 1≤M≤N−11 \le M \le N-1 the sampling estimator satisfies PN,M,k(|S−M|≤M)≥34.P_{N,M,k}\bigl(\,\lvert S - M \rvert \le \sqrt{M}\,\bigr) \ge \frac{3}{4}.(8)✦ Then N<4kN < 4k.✦

What Is Checked

Both claims are stated over the distribution PN,M,kP_{N,M,k} of a run of kk independent draws, the product (3) of Bernoulli distributions with parameter pp, and over the estimator SS built from the indicators of the draws; the first claim is also stated over the standard deviation ΔS\Delta S. The library proves of these constructions that the success probability (1) is at most one, p≤1p \le 1, for every NN and MM.✦