\documentclass[11pt]{article}
\include{lecture}
\usepackage{subfigure}

\begin{document}
\lecture{7}{9/20/10}{Query Lower Bounds}{Cong Han Lim}


Last class, we covered Grover's quantum search algorithm, which gives us a quadratic speedup over classical and probabilistic algorithms. Today, we review some applications of Grover's algorithm and prove the optimality of the algorithm (up to a constant factor).

\section{Applications of Grover's Algorithm}

\subsection{Amplitude Amplification}

Suppose we are given a function $f$ and a quantum algorithm $A$ that produces a superposition over the base states, which can be partitioned into a good set ($f(x) = 1$) and a bad set of states ($f(x) = 0$):

\begin{align*}
\text{Output of } A = \sum_{x:f(x)=1} \alpha_x \ket{x}\ket{\text{Garbage}(x)} + \sum_{x:f(x)=0} \alpha_x \ket{x}\ket{\text{Garbage}(x)}
\end{align*}
(Grover's quantum search algorithm produces precisely such an output, with the additional restriction that our $\alpha_x$ are uniform within each of the partitions). Our goal is to boost the probability of observing a good state, which is
\begin{align*}
\text{Pr}[\text{observing a good state}] = \sum_{x \in \text{GOOD}} \left| \alpha_x \right|^2 .
\end{align*}
This can be done by applying the technique of Amplitude Amplification, which we will briefly outline since its a generalization of Grover's algorithm. The notation here is the same as the one used in our previous lecture.

Consider the state after we apply $A$. Just as in Grover's algorithm we can think of the state as a point on the unit circle on $\mathbb{R}^2$ with axes denoted by $B$ and $C$ (bad and correct), where the angle between the point and the axes give the probabilities of observing a bad or good state.
\begin{figure}[!hb]
\begin{center} 
\includegraphics[height = 38mm]{phase.png}
\end{center} 
\caption{State after one run of $A$}
\end{figure}
\\
As in Grover's algorithm, in each step we will be applying
\begin{enumerate}
\item{Flips about the $B$ axis}
\item{Rotation about the axis defined by the point.}
\end{enumerate}
To implement the flips, we simply need to apply $U_f$ (phase kickback). For the rotations, we will
\begin{enumerate}
\item{apply $A^{-1}$ to `shift' the axis defined by the point to the $B$ axis,}
\item{perform a reflection about the $B$ axis, denoted by $U_{\ket{0^n}}$, and finally}
\item{apply $A$.}
\end{enumerate}
Hence, we can describe each iteration of amplitude amplification as:
\begin{align*}
AU_{\ket{0^n}}A^{-1}U_f
\end{align*}
(Note that if we consider Grover's algorithm in this framework, the $A$ here is simply the Hadamard gate $H^{\otimes n}$.)

Repeating the same analysis as last lecture, we know the number of iterations required is $O(\frac{1}{\sqrt{p}})$, where $p$ is the probability of observing a good state after one run of $A$. This is again a quadratic speedup over the classical case which requires $\Omega(\frac{1}{p})$ trials.




\subsection{Finding a Witness for an NP Problem}

Consider the Satisfiability problem. In the classical setting, the brute force approach would take $O(2^n)$ trial to obtain a valid assignment. However, using Grover's algorithm, we can search over the space of all assignments and obtain a valid assigment in $O(2^{\sqrt{n}})$ trials. While this does not necessarily mean that for any classical algorithm for $SAT$ we can always find a quantum algorithm that gives a quadratic speedup, this has been true for known algorithms. Current known deterministic methods for solving SAT gives us a search space that we can recast in a quantum setting to allow Grover's algorithm to work efficiently.

\subsection{Unstructured Database Search}

One can view Grover's algorithm as a way to search over an unstructured database where the keys are precisely the boolean strings $x$ of length $n$, corresponding to the $2^n$ base states $\ket{x}$. While this is often presented as an application of the algorithm (Grover's original paper does this), this is impractical in reality. Firstly, it is unlikely that a set of real-world data has no intrinsic structure. Secondly, both the number of quantum gates required and the time needed to transform the real-world data into the appropriate form for the algorithm will be at least linear in the number of inputs.

\subsection{Deciding $OR(f)$}

We have been considering the search problem of finding an input $x$ such that a given function $f: \{ 0,1\}^n \rightarrow \{ 0,1\}$ evaluates to $f(x) =1$. We can consider a related decision problem $OR(f)$: Given the function  $f: \{ 0,1\}^n \rightarrow \{ 0,1\}$, does there exist an $x \in \{0 ,1 \}^n$ such that $f(x)=1$? (This is equivalent to computing the boolean $OR$ over all possible $f(x)$). 

It is clear that the search problem is at least as difficult as deciding $OR(f)$, and we will make use of this fact to obtain a lower bound for quantum search.

\section{Tight Lower Bound for Quantum Search}
From the previous lecture we know that Grover's algorithm runs in $O(\sqrt{N})$, where $N=2^n$ denotes the number of binary strings of length $n$. We will show that this is optimal by proving the following theorem:
\begin{theorem} \label{7:thm:main}
Any quantum black-box algorithm that decides $OR(f)$ with constant error $\epsilon<\frac{1}{2}$ needs to make $\Omega(\sqrt{N})$ queries to $f$.
\end{theorem}

\subsection{Structure of Quantum Circuit}
To prove Theorem \ref{7:thm:main}, we first need to consider the structure of any quantum circuit that makes $q$ many queries. Each quantum circuit consists of two types of operators:
\begin{enumerate}
\item{Unitary operators $V_i$, independent of $f$},
\item{Oracle $U_f$, which provides black-box access to $f$}.
\end{enumerate}
We will also assume that we postpone observation of the system till the end. Hence, our quantum circuits have the following form:

\begin{align*}
   \Qcircuit @C=1em @R=1.0em 
   {
 & &  & & &  &&&&&& \mbox{repeat $q$ times} &&&&&&\\
&  \qwx[7] & & & & \qwx[7]  &&&& \qwx[7]&&  &&&&&&\qwx[7]&&\qwx[7]\\
    \lstick{} &  \qw& \multigate{5}{V_1} & \qw &  \multigate{3}{U_f}& \qw & \multigate{5}{V_2}&\qw& \multigate{3}{U_f}& \qw &\qw &\cdots&& \qw &  \multigate{5}{V_q} & \qw &  \multigate{3}{U_f}& \qw &\multigate{5}{V_{final}}  &\qw &\meter & \cw& \rstick{}		\\
    \lstick{} & \qw & \ghost{V_1} & \qw & \ghost{U_f}  & \qw &\ghost{V_2} & \qw &\ghost{U_f}& \qw& \qw&\cdots&&\qw &\ghost{V_q} & \qw &\ghost{U_f}& \qw&  \ghost{V_{final}} & \qw &  \meter 	&  \cw&   \rstick{}		\\
    \lstick{} & \qw& \ghost{V_1} & \qw  & \ghost{U_f} & \qw   &\ghost{V_2} &\qw &\ghost{U_f}& \qw&\qw  &\cdots&&\qw &\ghost{V_q} & \qw &\ghost{U_f}& \qw& \ghost{V_{final}} & \qw &\meter &  \cw&     \rstick{} \\
    \lstick{} & \qw & \ghost{V_1} & \qw &\ghost{U_f} &  \qw   &\ghost{V_2} & \qw &\ghost{U_f} & \qw&\qw &\cdots&&\qw &\ghost{V_q} & \qw &\ghost{U_f}& \qw& \ghost{V_{final}} & \qw &\meter 	&  \cw&     \rstick{} \\
    \lstick{} &  \qw & \ghost{V_1} & \qw &\qw & \qw &  \ghost{V_2}   & \qw&  \qw& \qw&\qw  &\cdots&&\qw &\ghost{V_q} & \qw & \qw& \qw&	\ghost{V_{final}} & \qw &\meter & \cw&     \rstick{} \\
    \lstick{} &  \qw & \ghost{V_1} & \qw &\qw & \qw &  \ghost{V_2}   & \qw&  \qw& \qw&\qw  &\cdots&&\qw &\ghost{V_q} & \qw &\qw& \qw& \ghost{V_{final}} & \qw &\meter & \cw&     \rstick{} \\
&&&&&&&&&&&&&&&&&&&\\
    & \mbox{$\ket{\psi^{(0)}}$} &  & & &  \mbox{$\ket{\psi^{(1)}}$} &&&&\mbox{$\ket{\psi^{(2)}}$}&&&&&&&&\mbox{$\ket{\psi^{(q)}}$}&&\mbox{$\ket{\psi^{final}}$}\\
    & \mbox{Initial State} &  & & &  &&&&&&&&&&&&&&\mbox{Final State}\\
}
\end{align*}
Hence, the state after the $i$th $U_f$ gate $\ket{\psi^{(i)}}$ is given by
\begin{align*}
\ket{\psi^{(i)}} = (U_f\otimes I)\cdot V_i \cdot \ldots \cdot (U_f\otimes I)\cdot V_1 \cdot \ket{\psi^{(0)}},
\end{align*}
where $ \ket{\psi^{(0)}} = \ket{0\ldots 0}$ without loss of generality.

\subsection{Proof Idea for Theorem \ref{7:thm:main}}
Given any two functions $f,g$ such that $OR(f) \neq OR(g)$, the corresponding final states have to be almost orthogonal for us to observe the correct answer with high probability. Therefore, we can prove the theorem by picking an `adversarial' set of functions $f$ such that any quantum circuit that correctly decides $OR(f)$ for this set will require $\Omega(\sqrt{N})$ queries. 

We let $\ket{\psi^{(i)}}$ denote the states for the function $f$ such that $OR(f)=0$ and $\ket{\psi^{(i)}_{\tilde{x}}}$ for function $f_{\tilde{x}}$ such that $f_{\tilde{x}}(x)=1 \Leftrightarrow x = \tilde{x}$. Note that $\ket{\psi^{(0)}_{\tilde{x}}} = \ket{\psi^{(0)}}$, but  $\ket{\psi^{final}_{\tilde{x}}}$ and $ \ket{\psi^{final}}$ have to be nearly orthogonal. Only the oracle gate $U_f$ can affect the angles, and we will show that any query can increase the angles between  $\ket{\psi^{(i)}_{\tilde{x}}}$ and $\ket{\psi^{(i)}}$ by a small factor on average over all $\tilde{x}$. This means many queries are required, giving us a lower bound.

\subsection{Proof of Theorem \ref{7:thm:main}}
We will begin by making formal the `almost orthogonal' condition. Consider the distance between these two probability distributions:
\begin{align*}
D \left(\text{Pr}_{\psi^{final}}, 
  \text{Pr}_{\psi_{\tilde{x}}^{final}} \right) \geq &
\big| \Pr[\text{algorithm outputs 0 on } f] -
       \Pr[\text{algorithm outputs 0 on } f_{\tilde{x}}]  \big| + \\ 
& \big| \Pr[\text{algorithm outputs 1 on } f] -
       \Pr[\text{algorithm outputs 1 on } f_{\tilde{x}}]  \big| 
\end{align*}
Since we want the error rate of the algorithm to be a constant factor $\epsilon$, we obtain
\begin{align*}
D \big(\text{Pr}_{\psi^{final}}, 
  \text{Pr}_{\psi_{\tilde{x}}^{final}} \big).
\geq 2(1-2\epsilon)
\end{align*}
which implies we need
\begin{align}
\label{7:eq:norm}
 \left\lVert \ket{\psi^{final}} - 
            \ket{\psi_{\tilde{x}}^{final}} \right\rVert \geq 2(1-\delta)
\end{align}
for some $\delta > 0$ that is dependent only on $\epsilon$. 
\begin{exercise}
Verify Equation \ref{7:eq:norm} and determine $\delta(\epsilon)$ 
(there is a simple expression for $\delta(\epsilon)$).
\end{exercise}

Finally, we can begin the proof of Theorem \ref{7:thm:main}.

\begin{proof}
We will now put an upper bound on how much the norm 
$\left\lVert \ket{\psi^{(i)}} - \ket{\psi_{\tilde{x}}^{(i)}} \right\rVert $ in can change in any one step of the quantum algorithm (where each step consists of a unitary gate $V_i$ and the $U_f$ gate directly after it), thereby
showing any quantum algorithm requires $q=\Omega(\sqrt{N})$ iterations to 
satisfy Equation \ref{7:eq:norm}.  Since
\begin{align*}
 \ket{ \psi^{(i)}} & = 
  (I \otimes I)V_{i} \ket{\psi^{(i-1)}} \\
 \ket{\psi_{\tilde{x}}^{(i)}} & =
  (U_{f_{\tilde{x}}} \otimes I) V_{i} \ket{\psi_{\tilde{x}}^{(i-1)}},
\end{align*}
we have
\begin{align*}
\left\lVert \ket{\psi^{(i)}} - \ket{\psi_{\tilde{x}}^{(i)}} \right\rVert
&= \left\lVert  \left( 
	(I \otimes I) V_{i} \ket{\psi^{(i-1)}} -
	(U_{f_{\tilde{x}}} \otimes I) V_{i} \ket{\psi_{\tilde{x}}^{(i-1)}} \right) \right\rVert
\end{align*}
This equation can be simplified by applying the triangle inequality and removing the unitary terms (which does not affect the norm):
\begin{align}
\nonumber \left\lVert \ket{\psi^{(i)}} - \ket{\psi_{\tilde{x}}^{(i)}} \right\rVert 
 &\leq \left\lVert 
   (I \otimes I) V_i \ket{\psi^{(i-1)}} -
   (U_{f_{\tilde{x}}} \otimes I) V_i \ket{\psi^{(i-1)}}
 \right\rVert +
 \left\lVert 
   (U_{f_{\tilde{x}}} \otimes I)V_i
   \left(\ket{\psi^{(i-1)}} - \ket{\psi_{\tilde{x}}^{(i-1)}}\right)
 \right\rVert \\
\label{7:eq:diff} &=
 \underbrace{ \left\lVert 
   (I \otimes I) V_i \ket{\psi^{(i-1)}} -
   (U_{f_{\tilde{x}}} \otimes I) V_i \ket{\psi^{(i-1)}}
 \right\rVert}_B +
\left\lVert \ket{\psi^{(i-1)}} - \ket{\psi_{\tilde{x}}^{(i-1)}} \right\rVert .
\end{align}

We now analyze the term $B$ in Equation (\ref{7:eq:diff}), which gives us an upper bound on the change in norm. 
Let 
\begin{align*}
V_i\ket{\psi^{(i-1)}} = \sum_z \alpha_z \ket{z}
\end{align*}
where $\ket{z} = \ket{xbu}$, such that $\ket{xb}$ represents the input into $U_f$ and $\ket{b}$ represents the ancilla qubit that records the output of $U_f$. 
Note that
\begin{align*}
U_{f_{\tilde{x}}}\otimes I:\ket{ xbu} \mapsto
\begin{cases}
\ket{x\overline{b}u}  & \text{ if $x=\tilde{x}$ }  \\
\ket{xbu} & \text{ if $x \ne \tilde{x}$ }.
\end{cases} 
\end{align*}
We can now proceed to bound $B$:  
\begin{align}
\nonumber B &= 
 \left\lVert
   \Big[
     (I \otimes I)-(U_{f_{\tilde{x}}} \otimes I)
   \Big]
   \sum \alpha_z \ket{z}
 \right\rVert \\
\nonumber &=\left\lVert
   \Big[
     (I \otimes I)-(U_{f_{\tilde{x}}} \otimes I)
   \Big]
   \sum_{z = \tilde{x}bu} \alpha_z \ket{z}
 \right\rVert  \\
\nonumber & = \sqrt{ \sum_{z = \tilde{x}bu} \left( \alpha_{\tilde{x}bu} - \alpha_{\tilde{x}\overline{b}u} \right)^2} \\
\nonumber &  \leq \sqrt{ \sum_{z = \tilde{x}bu} 2 \left( \left| \alpha_{\tilde{x}bu}\right|^2  + \left| \alpha_{\tilde{x}\overline{b}u} \right|^2 \right) } \\
\nonumber & = \sqrt{4 \sum_{z = \tilde{x}bu} \left| \alpha_{\tilde{x}bu} \right|^2} \\
\label{7:eq:bbound} & =
 2\sqrt{\Pr[\text{$i^{\mathrm{th}}$ query for $f \equiv 0$ is $\tilde{x}$}]}.
\end{align}

We return to the term $\left\lVert \ket{\psi^{final}} - \ket{\psi_{\tilde{x}}^{final}} \right\rVert $ which, by removing unitary transformations, is simply $\left\lVert \ket{\psi^{(q)}} - \ket{\psi_{\tilde{x}}^{(q)}} \right\rVert$ . By combining Equations (\ref{7:eq:diff}) and (\ref{7:eq:bbound}), this gives us
\begin{align} 
\nonumber \left\lVert \ket{\psi^{final}} - \ket{\psi_{\tilde{x}}^{final}} \right\rVert &= \left\lVert \ket{\psi^{(q)}} - \ket{\psi_{\tilde{x}}^{(q)}} \right\rVert \\
\label{7:eq:finalub} &\leq 2\sum_{i=1}^{q}\sqrt{\Pr[\text{$i^{\mathrm{th}}$ query for $f \equiv 0$ is $\tilde{x}$}]} + \underbrace{\left\lVert \ket{\psi^{(0)}} - \ket{\psi_{\tilde{x}}^{(0)}} \right\rVert}_{=0}.
\end{align}
which is true for every possible $\tilde{x}$. While the probability term in Equation (\ref{7:eq:finalub}) might be large for particular $\tilde{x}$, on average they have to be small since they add up to $1$. So, we sum over all $\tilde{x}$ and apply Cauchy-Schwarz inequality to obtain:
\begin{align} 
\nonumber \sum_{\tilde{x}} \left\lVert \ket{\psi^{final}} - \ket{\psi_{\tilde{x}}^{final}} \right\rVert &\leq  2 \sum_{i=1}^{q} \sum_{\tilde{x}}\sqrt{\Pr[\text{$i^{\mathrm{th}}$ query for $f \equiv 0$ is $\tilde{x}$}]} \\
\nonumber&\leq  2 \sum_{i=1}^{q} \left( 1 \cdot \sqrt{N} \right)  \\
\label{7:eq:sumub}&\leq  2 q \sqrt{N}  
\end{align}

 Finally, we combine the lower and upper bounds (Equations (\ref{7:eq:norm}) and (\ref{7:eq:sumub}) respectively) to get
\begin{align*}
N\cdot 2(1-\delta) \leq 2q \sqrt{N} \qquad &\Rightarrow \qquad q \geq (1 -\delta)\sqrt{N},
\end{align*}
so $q = \Omega(\sqrt{N})$, as desired.\end{proof}
\subsection{Conclusion}
In the proof above, we used an adversial argument - we chose a relatively small set of functions that is easy to analyze, where distinguishing between those with different outputs requires many queries. This is a simplified form of the quantum adversial argument, which is a generalization of the method used in the classical setting.

In the next lecture, we will outline two other methods to obtain lower bounds in the quantum black-box model - the generalized quantum adversial method and the polynomial method.




\end{document}
