Lean, informalized

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

Exercise 6.14 - A classical algorithm that estimates the number of solutions to within cMc\sqrt{M} must query a fixed fraction of all items

Classical counting needs a linear number of queries.

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 problem on NN items is given by an oracle, a function ff from {0,…,N−1}\{0, \dots, N-1\} to {0,1}\{0, 1\}. The items xx with f(x)=1f(x) = 1 are the solutions, and MM is their number.✦ A classical algorithm learns about ff only by calling the oracle on one item at a time, and it may choose each item from the answers it has had and from coins of its own. The exercise asks how many calls such an algorithm needs if it is to estimate MM to within cMc\sqrt{M}, for a constant cc, with probability at least 3/43/4, and to do so for every oracle, whatever the value of MM. The answer is a number of calls at least proportional to NN, once NN is large compared with c2c^2.

Counting Algorithms

The number of solutions M(f)M(f) of an oracle ff on NN items is the number of items xx with f(x)=1f(x) = 1: M(f)=|{x∈{0,…,N−1}:f(x)=1}|.M(f) = \bigl|\{\, x \in \{0, \dots, N-1\} : f(x) = 1 \,\}\bigr|.(1)✦

A decision tree tt on NN items is either a leaf, which carries a real number rr, its estimate, or a node, which queries an item ii and has a subtree t0t_0 for the answer 00 and a subtree t1t_1 for the answer 11.✦ It is a deterministic classical algorithm. The output t(f)t(f) of the tree on an oracle ff is rr if tt is a leaf with estimate rr; if tt queries ii, it is the output of the subtree that the answer f(i)f(i) selects, t(f)=tf(i)(f).t(f) = t_{f(i)}(f).(2)✦ The depth of a tree is the largest number of queries on a path from its root to a leaf, the number of oracle calls it makes in the worst case.

A randomized counting algorithm 𝒜\mathcal{A} on NN items is a family of decision trees tωt_\omega on NN items, indexed by the outcomes ω\omega of a probability space (Ω,μ)(\Omega, \mu), with a budget TT, a natural number that bounds the depth of every tree, such that for each oracle ff the output tω(f)t_\omega(f) is a random variable on Ω\Omega.✦ The output 𝒜(f)\mathcal{A}(f) of a randomized counting algorithm 𝒜\mathcal{A} on an oracle ff is the random number obtained by drawing ω\omega from μ\mu and taking the output of tωt_\omega on ff: 𝒜(f)=tω(f),ω∼μ,depth⁡(tω)≤Tfor every ω∈Ω.\mathcal{A}(f) = t_\omega(f), \quad \omega \sim \mu, \qquad \operatorname{depth}(t_\omega) \le T \ \text{for every } \omega \in \Omega.(3)

The Claim

Theorem 1. Let c≥0c \ge 0. There is a constant a>0a > 0 with the following property. Let N≥2(⌈c2⌉+1)N \ge 2(\lceil c^2 \rceil + 1), and let 𝒜\mathcal{A} be a randomized counting algorithm on NN items with budget TT whose estimate lies within cM(f)c\sqrt{M(f)} of M(f)M(f) with probability at least 3/43/4 for every oracle ff: μ({ω∈Ω:|tω(f)−M(f)|≤cM(f)})≥34.\mu\bigl(\{\, \omega \in \Omega : |t_\omega(f) - M(f)| \le c\sqrt{M(f)} \,\}\bigr) \ge \tfrac{3}{4}.(4)✦ Then T≥aNT \ge aN.

What Is Checked

The claim is stated over the randomized counting algorithm (3), its decision trees with their output (2), and the number of solutions (1). What the library proves about these constructions is Theorem 1, for every c≥0c \ge 0.