上課筆記,原文書:
Quantum Computation and Quantum Information, Michael A. Nielsen & Isaac L. Chuang
6.1 The quantum search algorithm
- Search marked items out of $N$ items
- Classical: $\Theta(N)$ operations
- Quantum: $O(\sqrt N)$ operations, $\Omega(\sqrt N)$ matching lower bound
6.1.1 The oracle
- Use a blackbox $\tilde{O_f}$ to store information about a function $f: \{0, 1\}^k\to\{0,1\}$.
- $\tilde{O_f}\vert x\rangle\vert q\rangle = \vert x\rangle\vert f(x)\oplus q\rangle$
- In the search problem, we think $f(x)=1$ as an marked item, i.e. we want to find an $x$ s.t. $f(x)=1$
- Quantum query complexity: number of $\tilde{O_f}$ you need to put in your circuit to solve the problem.
- Assume $N$ items (indexed $\{0, 1,\dots, N-1\}$), exactly $M$ marked items (i.e. solutions) $1\le M \le N$.
- find any marked item: $O(\sqrt{\frac{N}{M}})$
- find all marked item: $\Theta(\sqrt{MN})$
- find first marked item: $O(\sqrt{N})$
Phase version of quantum oracle
- Using one $\tilde{O_f}$, we can simulate one $O_f$ s.t.
- We can also simulate $\tilde{O_f}$ with one controlled-$O_f$:
- $y$ is the control qubit
- $\tilde{O_f}$ and $CO_f$ is equivalant
6.1.2 The procedure
$G$ is the grover iteration, which composed of 4 steps:
- Apply Oracle $O_f$
- Apply $H^{\otimes n}$
- Apply an conditioned phase shift $(2\vert 0\rangle\langle 0\vert -I)$ (only $\vert 0\rangle$ get an extra phase of $-1$)
- Apply $H^{\otimes n}$
Step 3 is a reflection about $\vert 0\rangle$:
- Step 2 3 4 together is a reflection around $\vert \psi\rangle$
- Step 2 3 4 no oracle calls, can be implemented efficiently $O(n)$ gates
- $G=(2\vert \psi\rangle\langle\psi\vert -I)O_f$
6.1.3 Geometric visualization
Suppose there are $M$ marked items (solutions), let $\vert \beta\rangle$ be the superposition of all marked items, $\vert \alpha\rangle$ be the superposition of non-marked items
- Consider the 2D space spanned by $\vert \psi\rangle$ and $\vert \beta\rangle$
- Oracle operation $O_f$ performs a reflection about the vector $\vert \alpha\rangle$ in the plane defined by $\vert \alpha\rangle$ and $\vert \beta\rangle$
- $(2\vert \psi\rangle\langle\psi\vert -I)$ performs a reflection about $\vert \psi\rangle$
- $G$ perfoms a rotation. Both $O_f$ and $(2\vert \psi\rangle\langle\psi\vert -I)$ doesn’t bring vectors outside of this 2D plane.
- The Grover iteration can be written as
- After that, get $\vert \beta\rangle=\frac{1}{\sqrt M}\sum_{x:f(x)=1}\vert x\rangle \Rightarrow$ measure to get random $x$
6.1.4 Performance
- How many iterations does Grover’s search need?
- $\displaystyle\langle \beta \vert \psi\rangle = \sqrt{\frac{M}{N}} = \sin\frac{\theta}{2}$
- Assume $\displaystyle M\ll N~\Rightarrow \sin\frac{\theta}{2}\approx \frac{\theta}{2}~\Rightarrow~\theta \approx 2\sqrt{\frac{M}{N}} =\Omega(\sqrt{\frac{M}{N}})$
- We want $\displaystyle\frac{2k+1}{2}\theta=\frac{\pi}{2}~\Rightarrow~ k=\frac{\pi}{2\theta}-\frac{1}{2}\approx \frac{\pi}{2\theta}\approx \frac{\pi}{4}\sqrt{\frac{M}{N}}\approx O(\sqrt{\frac{N}{M}})$
- The probability of getting a solution:
- The probability of falure:
- This algorith requires you to know $M$. Otherwise, you might overshoot.
- If you know $M$, it is possible to make success probability $100\%$. The idea is to make $\theta$ a little smaller so $k=\frac{\pi}{2\theta}-\frac{1}{2}$ is an integer
- If we don’t know $M$, we can do quantum counting to estimate $M$ first.
6.2 Quantum search as a quantum simulation
待補
6.3 Quantum Counting
- Estimate the number of solutions $M$ from $N$ items with a probability of success at least $1-\varepsilon$
- Classical: $\Omega(\frac{1}{\varepsilon^2}\frac{N}{M})$
- Quantum: $O(\frac{1}{\varepsilon}\sqrt{\frac{N}{M}})$ queries, for some $\varepsilon$ multiplicative error.
- Idea: apply phase estimation to Grover iteration $G$
- Have eigenvalues $e^{i\theta}$ and $e^{i(2\pi-\theta)}$.
- Estimate $\theta$ to $m$ bits of accuracy ($\vert\Delta\theta\vert\le2^{-m}$) with a probability of success at least $1-\varepsilon$.
Preparation:
- Assume the search space is augmented $N\to2N$ for convenient, $\sin^2(\theta/2)=M/2N$.
- Use $t=m+\lceil\log(2+\frac{1}{2\varepsilon})\rceil$ bits.
- $\vert \psi\rangle=\sum_x\vert x\rangle$ as input to oracle (superposition of all possible states)
Proof
Recall that $\sin^2\frac{\theta}{2}=\frac{M}{2N}$, we estimate $M$ by estimating $\theta$ (assume $\theta<\frac{\pi}{2}$)
Two parts:
Implies:
- Pick $\vert \Delta M\vert=\varepsilon M~\Rightarrow~ \varepsilon M\approx 2^{-m}\sqrt{MN}~\Rightarrow~2^m\approx\frac{1}{\varepsilon}\sqrt{\frac{N}{M}}$.
- Use $t=m+\lceil\log(2+\frac{1}{2\delta})\rceil$ bits, need $2^0+2^1+…+2^{t-1}=2^t-1$ Grover iterations for phase estimation $\Rightarrow$ number of quries (oracle calls) $\sim 2^t$
6.4 Speeding up the solution of NP-complete problems
待補
6.5 Quantum search of an unstructured database
待補
6.6 Optimality of the search algorithm
- No quantum algorithm can perform oracle search using fewer than $\Omega(\sqrt N)$ quries.
- Idea: adversary method
- Quantum query algorithms can be viewed as
- Consider the distance between $\vert \psi^f_k\rangle$ and $\vert \psi^{f’}_k\rangle$ for some function $f$ and $f’$
- Start with zer odistance $\vert \psi^f_0\rangle=U_0\vert 0\rangle, ~\forall~f$
- For some $(f, f’)$ pairs, $\vert \psi^f_k\rangle$ and $\vert \psi^{f’}_k\rangle$ are distinguishable $\Rightarrow$ const distance.
- for example, $f(x)=0~\forall x$ and $\exists x$ s.t. $f’(x)=1$
- In the middle, note that $U_t$ does not change the distance
- For a specific pair of $(f, f’)$, $O_f$ and $O_{f’}$ might change the distance between $\vert \psi^f_t\rangle$ and $\vert \psi^{f’}_{t}\rangle$ a lot. Eg. $\vert \psi^f_t\rangle=\vert \psi^{f’}_t=\vert x\rangle$ for some $x$ s.t. $f(x)=0$ and $f’(x)=1$ $\Rightarrow$ distance changed by const.
- So we sum over different pairs of $(f, f’)$, such that the sum of distance cannot increase a lot.
- Sum of distance start with zero, end with something big, cannot change too much each step $\Rightarrow$ need many steps.
- Quantum query algorithms can be viewed as
Way to proof:
- Consider we pair between $(f_0, f_x)~~\forall x\in\{1,2,\dots, N\}$
- Use the phase version of the oracle (ignore control, ignore ancilla)
- Define $O_x\equiv O_{f_x}=I-2\vert x\rangle\langle x\vert$
- Define
- Define “Progress function” $D_k$, the deviation after $k$ steps (simplified notations)
- Need to prove two parts
- $D_k \le O(k^2)$ (Induction)
- $D_k=\Omega(N)$ to success
- Finally $\Rightarrow~k=\Omega(\sqrt N)$
Proof $D_k\le4k^2$
By induction
Hypothesis: $D_k\le4k^2$
Base case: $k=0$, $D_k=0$
Induction step:
Applying $\left\Vert b+c\right\Vert^2\le \left\Vert b\right\Vert^2 + 2\left\Vert b\right\Vert \left\Vert c\right\Vert+\left\Vert c\right\Vert^2$ with $b\equiv O_x(\psi^x_k-\psi_k)$ and $c\equiv (O_x-I)\psi_k=-2\vert x\rangle\langle x\vert\psi_k\rangle=-2\langle x\vert \psi_k\rangle\vert x\rangle$
Because $\sum_x\left\vert \langle\psi_k\vert x\rangle \right\vert^2=\sum_x\langle\psi_k\vert x\rangle\langle x\vert \psi_k\rangle=\langle \psi_k\vert \underbrace{\left(\sum_x\vert x\rangle\langle x\vert\right)}_{I}\vert\psi_k\rangle=1$. By Cauchy’s inequality $\sum_x a_xb_x\le \sqrt{\sum_x a^2_x}\sqrt{\sum_x b^2_x}$.
By induction hypothesis $D_k\le 4k^2$
Hence, $D_k\le 4k^2$.
Proof $D_k=\Omega(N)$
Assume $\exists$ projector $P$ s.t. $\left\Vert P\vert\psi_k\rangle \right\Vert^2\le \frac{1}{9}, ~\left\Vert P\vert\psi^x_k\rangle \right\Vert^2\le \frac{8}{9}, ~\forall x$. (some magic number: distinguish prob. $\approx 1/3$)
Claim: if there $\exists~p$ s.t. $\left\Vert P\vert a\rangle \right\Vert^2\le \frac{1}{9}, ~\left\Vert P\vert b\rangle \right\Vert^2\le \frac{8}{9}~\Rightarrow~\left\Vert\vert a\rangle-\vert b\rangle\right\Vert^2\ge\frac{2}{3}$
Proof: Note that $\left\Vert(I-P)\vert b\rangle\right\Vert^2\le \frac{1}{9}$.
Consider $\vert \langle a\vert b\rangle\vert$
Thus
Let $\vert a\rangle = \vert \psi_k\rangle$ and $\vert b\rangle=\vert \psi^x_k\rangle$
Proof $k=\Omega(\sqrt N)$
By $D_k\le 4k^2$ and $D_k\ge\frac{2N}{3}$
- This can be generalized to adversary method
- Weight on different pairs
- Can put negative weight on some pairs. negative weight adversary bound is optimal.
- State distinguishment (Ch. 9)
- Trace distance: $D_\text{tr}(\rho, \sigma)=\frac{1}{2}\text{tr}\vert\rho-\sigma\vert$, maximum distinguish prob.
- Fidelity: $F(\psi, \phi)=\vert\langle\psi\vert\phi\rangle\vert$
- For pure state: $D_\text{tr}(\psi, \phi)^2+F(\psi, \phi)^2=1$
6.7 Black box algorithm limits
待補
Bonus
待補
Better bounds on distinguish quantum states
Suppose we have two quantum states $\vert a\rangle$, $\vert b\rangle$, projective measurements $\{P, I-P\}$ s.t. $\left\Vert P\vert a\rangle \right\Vert^2 \le \varepsilon$, $\left\Vert P\vert b\rangle \right\Vert^2\ge 1-\varepsilon$, $~\varepsilon\in [0, \frac{1}{2}]$.
Claim: $\vert\langle a\vert b\rangle\vert\le 2\sqrt{\varepsilon(1-\varepsilon)}$
Proof $\vert\langle a\vert b\rangle\vert\le 2\sqrt{\varepsilon(1-\varepsilon)}$
Proof 1
By Cauchy theory $x_1x_2+y_1y_2\le \sqrt{x_1^2+x_2^2}+\sqrt{y_1^2+y_2^2}$
By
By $x\le2\varepsilon$
Proof 2
The best way to distingish $\vert a\rangle$ and $\vert b\rangle$: $\vert b\rangle \sim \vert 0\rangle$ and $\vert a\rangle \sim \vert 1\rangle$
Proof 3
Let $T$ be the trace distance between $\vert a\rangle, \vert b\rangle$, $F$ be the Fidelity between $\vert a\rangle$, $\vert b\rangle$.
- Fact 1: $T\ge$ bias betweem measurement probability $\ge(1-\varepsilon)-\varepsilon=1-2\epsilon$
- $|P\vert b\rangle|^2\ge 1-\varepsilon$
- $|P\vert a\rangle|^2 \le \varepsilon$
- Fact 2: For $\vert a\rangle$ and $\vert b\rangle$ pur states
- $T^2+F^2=1$
- $F=|\langle a\vert b\rangle|=\sqrt{1-T^2}\le \sqrt{1-(1-2\varepsilon)^2}=2\sqrt{\varepsilon(1-\varepsilon)}$
Applications of Grover’s algorithm
Speed up for $NP$-complete problems
- Satisfiability: given boolean formula $\phi(i_1,i_2,\dots,i_n)$, determine whether there exist $i=i_1i_2\dots i_n$ s.t. $\phi(i)=1$ ($\phi(i)$ is easy to compute, but there are $N=2^n$ possible assignment of $i$)
- Quantum alg: construct $q$ circuit $Q_\phi$ s.t. $\vert i\rangle\to(-1)^{\phi(i)}\vert i\rangle$ ($\vert i,b\rangle\to\vert i,b\oplus \phi(i)\rangle$)
- $O_\phi$ is easy to construct because $\phi(i)$ is easy to compute
- $\Rightarrow$ use $O_\phi$ as the oracle in Grover’s search
- $\Rightarrow$ determine whether $\exists~i,$ s.t. $\phi(i)=1$ in $O(\sqrt{2^n}~\text{cost of}~O_\phi)\sim 2^{m/2}$ time
- However, not always getting quadratic speedup to $NP$ complete problem. Because $\sqrt{\text{num of assignment}}$ might be slower than known classical alg.
- e.g. Travelling Salesmans Problem (TSP) on $n$
- number of assignment $=n!\sim n^n$
- Classical alg $\sim O(2^n)$
- Best quantum algorithm $\sim O(1.728^n)$ non-trivial application of Grover’s search
- e.g. Travelling Salesmans Problem (TSP) on $n$
$OR$ of $AND$
- A boolean matrix
- Question: is there a row with all $1$’s?
- Classical: easy to see need $\Omega(N)$ queries
- Quantum alg 1: Grover search each row for an $0$
- time for each row $\sqrt{\sqrt{N}}\sim N^{1/4}$ (times $\log N$ because we want $1/N$ error)
- total time
$=\text{num of rows}\times\text{time for each row}=\sqrt{N}\cdot N^{1/4}\cdot \log N=N^{3/4}\cdot\log N$
- Quantum alg 2: run Grover’s search recursively, have an outer Grover that search through rows, and a row is “marked” iff the inner Grover cannot find zero in it
- total running time $\sqrt{\sqrt{N}}\cdot\sqrt{\sqrt{N}}\cdot\log N=\sqrt{N}\log N$ (quadratic speedup)
- $\Omega(\sqrt{N})$ lower bound
$AND$-$OR$ tree
- Game tree for chess or Go etc.
- $1$: win, $0$: lose (ignore tie)
- $OR$: Is there a move that makes me win?
- $AND$: Is there a move that makes me lose?
- Recursive Grover? Don’t actually work because error builds up through recursion
- Still has $O(\sqrt N)$ quantum alg. through quantum walk
Collision problem
- Given blackbox access to the function $f:\{1,2,\dots,N\}\to\{1,2,\dots,N\}$
- Promise: $f$ is either one-to-one or two-to-one (has lots of collision)
- e.g. one-to-one $f:1\to1,~2\to2,~3\to4,~4\to3$
- e.g. two-to-one $f:1\to1,~2\to4,~3\to1,~4\to4$
- Problom: decide whether $f$ is one-to-one or two-to-one
- Classical $\Theta(\sqrt N)$
- Birthday attach: random pair $O(1/N)$ probability to be a collision.
- If we pick $O(\sqrt N)$ items, there are $O(N)$ pairs $\Rightarrow$ const probability finding a collision in those pairs.
- Quantum alg 1: $O(\sqrt N)$ queries (no speedup)
- query $f(1)$, Grover search for an $x\ne1$ s.t. $f(x)=f(1)$
- Quantum alg 2: $\Omega(N^{1/3})$ lowerbound
- pick $N^{1/3}$ random elements $S_1$ query them classically and write down the answers
- pick another $N^{2/3}$ elements $S_2$ (don’t query them yet). Grover search through $y\in S_2$, an item $y\in S_2$ is marked iff $\exists~x\in S_1$ s.t. $f(x)=f(y)$
- Since we already reordered everything in $S_1$ only need one query $f(y)$ to determined whether $y$ is marked.
- Total number of queries: $N^{1/3}+\sqrt{N^{2/3}}=O(N^{1/3})$
- Number of pirs searched: $N^{1/3}\cdot N^{2/3}\sim O(N)\Rightarrow$ const success probability
- with smart data structure can also do $\tilde{O}(N^{1/3})$ time.
- Classical $\Theta(\sqrt N)$
Element distinctness
- also $f:\{1,2,\dots,N\}\to\{1,2,\dots,N\}$, no promise
- Problem: determine whether $f$ is one-to-one (ie. whether $f$ have collision)
- Classical: $\Theta(N)$
- Quantum alg 1: $O(N^{3/4})$
- Divide the inputs into $\sqrt{N}$ blocks of size $\sqrt{N}$
- Outer Grover search through each block $s$ and query all elements in it (check collision inside)
- Inner Grover search between pair ($x\in s, y\in s$)
- If $s$ contain an element of the collision, we find it $\Rightarrow$ prob $\frac{1}{\sqrt N}$
- Total queries: $\sqrt{\sqrt N}\cdot \sqrt{N}=O(N^{3/4})$
- Quantum alg 2: $O(N^{2/3})$ by quantum walk
- $\Omega(N^{2/3})$ lower bound by reduction from collision (pick $\sqrt{N}$ elements)
Exact Grover search
- Promised that an unique marked item, find alg. that find the marked item with prob $1$, in $O(\sqrt N)$ steps.
- Define $f’:\{1,\dots,2N\}\to\{0,1\}$
- can simulate $O_{f’}$ with one $\tilde{O_f}$
- define
- We have
- The probability that $A\vert 0\rangle^{\oplus n+1}$ is marked
$\Omega(\sqrt{\frac{N}{M}})$ query lower bound for $M$ marked items
- easy solution
$Q($search $M$ marked items from $N$ items $)$
$\ge Q($search $M$ marked items from $N$ items promised that marked items are blocks$)$
$\ge Q($search one marked item in $\frac{N}{M}$ items$)$
$=\Omega(\sqrt{\frac{N}{M}})$ - harder solution
- consider all $C^N_M$ ways to mark $M$ items
- Let $S\subset\{1,2,\dots,N\}$ with size $M$. $C^N_M$ possible $S$
- By induction
Minimum finding
- Given quantum access to input of $N$ numbers, $x_1,x_2,\dots,x_N$, find the $\min$ of them in $O(\sqrt N\log N)$ steps.
- start with random $s\in\{1,\dots,N\}$ query $x_s$.
- Grover search among the items to find some $r$ s.t. $x_r\le x_s$
- $O(\sqrt N)$ times find a random one
- keep doing this until you cannot find a smaller one
- every iteration expect number of smaller items $\Rightarrow~\log N$ iterations