\documentclass[11pt]{article}

\usepackage{latexsym}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{hyperref}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{complexity}
\usepackage{graphicx}

\newcommand{\handout}[5]{
  \noindent
  \begin{center}
    \framebox[\textwidth]{
      \vbox{
        \hbox to \textwidth { {\bf Algebra and Computation } \hfill Course Instructor: #2 }
        \vspace{4mm}
        \hbox to \textwidth { {\Large \hfill #5  \hfill} }
        \vspace{2mm}
        \hbox to \textwidth { {\em #3 \hfill #4} }
      }
    }
  \end{center}
  \vspace*{4mm}
}

\newcommand{\lecture}[4]{\handout{#1}{#2}{Lecturer: #3}{Scribe: #4}{Lecture #1}}

\newtheorem{theorem}{Theorem}
\newtheorem{theorem*}{Theorem}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{observation}[theorem]{Observation}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{fact}[]{Fact}
\newtheorem{subclaim}[theorem]{Subclaim}

% my custom commands
\newcommand{\inparen}[1]{\left(#1\right)}             %\inparen{x+y}  is (x+y)
\newcommand{\inbrace}[1]{\left\{#1\right\}}           %\inbrace{x+y}  is {x+y}
\newcommand{\insquar}[1]{\left[#1\right]}             %\insquar{x+y}  is [x+y]
\newcommand{\inangle}[1]{\left\langle#1\right\rangle} %\inangle{A}    is <A>
\newcommand{\abs}[1]{\left|#1\right|}                 %\abs{x}        is |x|
\newcommand{\norm}[1]{\left\Vert#1\right\Vert}        %\norm{x}       is ||x||
\newcommand{\union}{\cup}
\newcommand{\Union}{\bigcup}
\newcommand{\intersection}{\cap}
\newcommand{\super}[2]{#1^{\inparen{#2}}}             %\super{G}{i-1} is G^{(i-1)}
\newcommand{\setdef}[2]{\inbrace{{#1}\ : \ {#2}}}
\newcommand{\inv}[1]{#1^{-1}}
\newcommand{\inrpdt}[2]{\left\langle{#1},{#2}\right\rangle}%\inrpdt{x}{y} is <x,y>.
\newcommand{\pderiv}[2]{\frac{\partial #1}{\partial #2}}
\newcommand{\zo}{\inbrace{0,1}}
\newcommand{\oneton}[1]{\inbrace{1,2,\cdots, #1}}

% Commands specific to this file
% TODO: Find the right way to typeset group index
\DeclareMathOperator{\Sym}{Sym}
\newcommand{\gpidx}[2]{\insquar{#1 : #2}}             %\gpidx{H}{K}   is [H : K]
\newcommand{\gpigs}[2]{\gpidx{\super{G}{#1}}{\super{G}{#2}}} %Group index of g super ...
\newcommand{\llhd}{\!\!\lhd\!\!\lhd}
\newcommand{\roundoff}[1]{\left\lfloor #1 \right\rceil}


% \newcommand{\ceil}[1]{\lceil #1 \rceil}
\newcommand{\floor}[1]{\left\lfloor #1 \right\rfloor}
\newcommand{\F}{\mathbb{F}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\Z}{\mathbb{Z}}
\renewcommand{\C}{\mathbb{C}}

%for algorithms
\renewcommand{\algorithmicrequire}{\textbf{Input:}}

% Problems we look at
\newcommand{\GIso}{\lang{Graph\text{-}Iso}} %Without \text, ugly minus instead of hyphen.
\newcommand{\GAut}{\lang{Graph\text{-}Aut}}
\newcommand{\SStab}{\lang{Set\text{-}Stab}}

%for Quantum computing
\newcommand{\q}[1]{\left|#1\right\rangle}
\newcommand{\qip}[2]{\left\langle#1|#2\right\rangle}
\newcommand{\outerprod}[2]{\left|#1\right\rangle\left\langle#2\right|}


\begin{document}

\lecture{20: Introduction to quantum computation}{V. Arvind}{V.  Arvind}{Vipul Naik}

\section{Physical systems and computational models}

\subsection{Computers as physical systems}

A computer program takes certain input data, manipulates it using
certain rules, and produces some output. If we assume that this
manipulation is subject to ``physical laws'' we can consider the loose
analogy:

\begin{itemize}

\item The computer is a physical system, or lab apparatus

\item Running the program is like conducting an experiment

\item The output is like the observations made from the experiment

\end{itemize}

For any computational model to be of practical interest to us, it
should be implementable as a physical system. The interesting question
is the reverse one: given any physical system, can we turn it into a
useful computational model?

\subsection{Feynman's question}

Feynman wanted to know if quantum mechanics could be used to provide a
useful computational model. There are the following questions:

\begin{itemize}

\item How can we describe an abstract computational model whose
  corresponding physical system is subject to the laws of quantum mechanics?

\item How does the computational power of such a model compare with that
  of physical systems subject to the laws of classical mechanics?

\end{itemize}

\subsection{The situation before quantum mechanics}

Turing and Church had considered various computational models, such as
Turing machines, random-access machines, and so on. All these
computational models could be implemented through physical systems
subject to the laws of classical mechanics. While studying many such
computational models, computer scientists came up with the following
Holy Grails:

\begin{enumerate}

\item {\bf Church-Turing thesis}: This states that any computational
  model is as powerful as the Turing machine. In other words,
  given any computational model, we can simulate computations
  on that model using the Turing machine. The simulation may of course
  involve a blow-up in time taken as well as in space used.

\item {\bf Strong Church-Turing thesis}: This states that for any
  computational model, a polynomial-time algorithm for a decision
  problem in that computational model can be simulated by a
  polynomial-time algorithm in the Turing machine model. In looser
  language, if we think of polynomial time as the notion of {\em tractability},
  then tractability in any computational model is equivalent to tractability
  in the Turing machine model.

\item {\bf Strong Church-Turing thesis} (randomized version): This
  states that for any computational model, a bounded-error
  probabilistic polynomial time algorithm for a decision problem in
  that computational model can be simulated by a bounded-error
  probabilistic polynomial time algorithm for the problem in the
  Turing machine model. In looser language, if we think of $\BPP$ as the notion
  of {\em tractability}, then $\BPP$ is any computational model
  is equivalent to tractability in the Turing machine model.

\end{enumerate}

While $(1)$ remains unchallenged, quantum computation challenges $(2)$
and $(3)$ -- if we can think of the quantum computation model as
sufficiently {\em reasonable}.

\section{The two-slit experiment}

\subsection{The two-slit experiment with particles}

Suppose a gun is placed behind a wall with two slits -- with the gun
firing bullets uniformly in all directions. There is a screen behind
the wall that ``picks up'' those bullets which pass through the slits.

Now, we have the following intuitively clear fact: Suppose $p$ denotes
the total number of particles hitting per unit time at a point on the
screen when both slits are open, $p_1$ denotes the number when one
slit is open, and $p_2$ denotes the number when the other slit is open. 
Then $p = p_1 + p_2$.

In other words, every particular passes either through one slit or the other.

\subsection{The two-slit experiment with waves}

In the waves version of the two-slit experiment, the ``source'' is a
light source rather than a gun, and light is radiated uniformly in all
directions.  Now, if $A$ denotes the amplitude of light received at a
point on the screen behind when both slits are open, and $A_1$ denotes
the amplitude when only the first slit is open, and $A_2$ denotes the
amplitude when only the second slit is open, then:

$$A^2 = A_1^2 + A_2^2$$

In other words, it is {\em not} true that $A = A_1 + A_2$ -- there is a {\em cancellation} due to interference. What gets added is the total {\em energy}
and not the amplitudes.

\subsection{The dual nature of matter and waves}

The surprising thing about quantum theory is that the same thing could
behave both as particle and as wave -- it behaves as a particle when
the amplitudes simply add, and it behaves like a wave when the squares
of the amplitudes add.

\section{The setup of quantum theory}

\subsection{Basic axioms}

In quantum theory, we have the following regarding the state of a physical
system:

\begin{enumerate}

\item The possible outcomes form a basis of a $\C$-vector space,
  called the state space.

\item The current state of the system is an element in the state
  space, viz a $\C$-linear combination of the outcomes. If $\psi_i$
  denotes the component of this state along outcome $i$, then we have
  $\sum_i \abs{\alpha_i}^2 = 1$

  The current state of the system is termed a quantum superposition of
  the states $i$ for which $\alpha_i \ne 0$.

\item Given the current state of the system, if we try to ``measure''
  the outcome, we will get outcome $i$ with probability $\abs{\alpha_i}^2$.

\end{enumerate}

We can express the state vector as a column vector with the $i^{th}$ entry
being $\alpha_i$.

\subsection{Hermitian inner product}

Let $V$ be a $\C$-vector space. An inner product is a map $\qip{}{}: V
\times V \to \C$ satisfying the following conditions:

\begin{enumerate}

\item It is conjugate-linear in the first variable, viz:

  \begin{eqnarray*}
    \qip{a + b}{c} = \qip{a}{c} + \qip{b}{c}\\
    \qip{\alpha a}{b} = \overline{\alpha}\qip{a}{b}
  \end{eqnarray*}

\item It is linear in the second variable, viz:

  \begin{eqnarray*}
    \qip{a}{b + c} = \qip{a}{b} + \qip{a}{c}\\
    \qip{a}{\alpha b} = \alpha\qip{a}{b}
  \end{eqnarray*}

\item It is Hermitian-symmetric, viz:

  $$\qip{a}{b} = \overline{\qip{b}{a}}$$

\item It is positive definite, viz:

  $$\qip{a}{a} > 0$$
  
  whenever $a \ne 0$

\end{enumerate}

We will follow Dirac's notation. The basis vector corresponding 
to outcome $i$ will be denoted as $\q{i}$. This is also called the
{\em ket} vector.

Given any state $A$ we denote by $\qip{A}{\psi}$ the Hermitian inner product
of $A$ and $\psi$, and we also call this the probability amplitude
of $\psi$ in $A$.

\subsection{The way quantum states evolve}

A unitary operator is an invertible linear operator from the state
space to itself under which the Hermitian inner product evolves. When
we apply a unitary operator, we essentially switch from the original
orthonormal basis to a new orthonormal basis. This means that when we
now make a measurement in the new basis, we will get one of the new
basis vectors, with probability equalling the square of the modulus of
its amplitude.

The power of quantum theory lies in the following fact: in discrete time,
the evolution of the quantum state of a system is given by a unitary operator.
That is, there is a unitary operator $U$ on the state space
that maps the initial state to the final state.

In matrix terms, we can view $U$ as a unitary matrix which takes a
state written as a column vector in the original basis, and outputs
the column vector for it in the new basis.

\subsection{Different quantum states giving the same probability}

Note that if $(\alpha_1,\alpha_2,\ldots,\alpha_n)$ and
$(\beta_1,\beta_2,\ldots,\beta_n)$ are two different states such that
$\beta_i/\alpha_i$ has norm $1$ for every $i$, then they give rise to
the same probability distribution.

In the particular case where $\beta_i/\alpha_i$ is the same for all $i$,
we say that the two quantum states differ by a {\em phase} of $\phi$
(where the common ratio is $e^{i\phi}$).

Here are two points:

\begin{itemize}

\item The quantum states that we are interested in are those on the
  unit sphere (that is, those of norm $1$) upto phase. That is, we
  identify two quantum states if they differ by a multiplicative
  factor of a phase.

  In mathematical lingo, this is the projective complex space of $n-1$
  dimensions.

  Note that if two quantum states differ only by phase, then applying
  the unitary operator to both of them again gives quantum states
  that differ by the same phase.

\item It may be possible for two inequivalent quantum states to give the same 
  probability distribution -- this happens when the ratios for each coordinate
  are complex numbers.

  However, it is {\em not} true that if two quantum states give the
  same probability distribution, then applying any unitary operator to
  both of them also yields quantum states giving the same probability
  distribution. In other words, the quantum state carries {\em more}
  information than simply the associated probability distribution.

\end{itemize}

\section{Quantum superposition versus random sampling}

\subsection{Probability distribution versus quantum superposition}

A probability distribution over a set $\oneton{n}$ is an association
of a nonnegative real number $p_i$ to each $i$ such that $\sum_i p_i =
1$. Suppose we sample randomly from this probability distribution, and
associate a reward $a_i$ to picking $i$. Then the expected reward is:

$$\sum_i a_ip_i$$

A quantum superposition over a set $\oneton{n}$ of states, on the
other hand, is an association of a complex number $\psi_i$ to each $i$
such that the corresponding probability distribution associates, to
each $i$, the value $\abs{\psi_i}^2$. In other words, given a quantum
superposition, the probability of measuring the value $i$ from that
superposition is $\abs{\psi_i}^2$.

This immediately raises some questions:

\begin{itemize}

\item If two quantum superpositions give rise to the same probability
  distribution, how are they physically distinguishable?

\item What are the ways in which we can transform one quantum
  superposition into another?

\end{itemize}

\subsection{Transforming probability distributions}

Suppose we are given a probability distribution. Then, to transform
the probability distribution, we could do the following: consider a
transition, which, if starting at state $j$, goes to state $i$ with
probability $q_{ij}$. Then if the current probability distribution vector
is $p = (p_1,p_2,\ldots,p_n)^t$, and $Q$ is the matrix of $q_{ij}$s,
the new probability distribution vector is $Qp$.

The matrix $Q$ here has the property that every column sum is exactly one;
such a matrix is termed a stochastic matrix.

Note that since we are multiplying with a stochastic matrix, and all
the entries of a stochastic matrix are nonnegative, it is not possible
to make probabilities {\em cancel}, or {\em kill}, each other.

\subsection{Transforming quantum states}

The fundamental difference between the classical probabilistic model
and the quantum model is that in the quantum model, we
perform the operator, not on the probability distribution, but on the
underlying quantum state. That is, we pick on a unitary
operator, and transform the quantum superposition according to the
unitary operator. Here are some important points to note:

\begin{itemize}

\item The entries of a unitary operator can be both positive and
  negative (in fact, they can even be complex). Hence, it is possible
  to use a unitary operator to make terms {\em cancel} each other

\item Note that we are making the unitary operator act on the
  underlying quantum state. Hence, two quantum superpositions
  that start off by giving the {\em same} probability distribution
  could end up giving separate probability distributions once we apply
  the unitary operator.

\end{itemize}

\section{Quantum theory and Boolean circuits}

\subsection{Boolean circuits}

Instead of looking at the Turing machine model (a model of
variable-length computation) let us look at the Boolean circuit model
(a model of fixed-length computation). The reason for choosing the
Boolean circuit model to compare with quantum theory is that in quantum theory,
we need to work in a state space of fixed dimension.

There are two aspects to the Boolean circuit:

\begin{itemize}

\item The values taken by a finite set of variables at any given time.
  These correspond to the classical ``state'' of the system.

\item The gates themselves, which perform Boolean functions on some values
  and output the results.

\end{itemize}

At any stage in the evaluation of a Boolean function using a Boolean
circuit, we have some Boolean variables and some values associated
with those Boolean variables. To convert this to the quantum setting,
we need to consider a state space where each possible assignment of
values to the Boolean variables constitutes an outcome. In other
words, if there are $n$ Boolean variables, there are $2^n$ possible
outcomes, and the state space is the space $\C^{2^n}$. The set of
feasible states is the unit sphere in this space, and if we go upto
phase, then the set of feasible states is the projective space.

Having converted the current state of the system to a quantum outcome,
the next step is to view the gates in terms of unitary operators which
can thus be simulated in a quantum system. There are the following
immediate problems:

\begin{itemize}

\item The Boolean gates we have seen have more inputs than outputs, so they
  don't even preserve the number of states

\item The Boolean functions for AND and OR are far from invertible, whereas
  any unitary operator must be invertible.

\end{itemize}

We shall see how to overcome both these problems at once, by
associating to any Boolean function $f$ a unitary operator $U_f$ with
approximately the same number of variables, such that computing $f$ is
classically the same as computing $U_f$.

\subsection{Unitary operator for a Boolean function}

Suppose $f: \zo^n \to \zo^m$ is a Boolean function. Then consider
first the following Boolean function: it takes as input $(m+n)$
Boolean variables $(x_1,x_2,\ldots,x_n,z_1,z_2,\ldots,z_m)$ and
outputs $(m+n)$ Boolean variables, namely
$(x_1,x_2,\ldots,x_n,u_1,u_2,\ldots,u_m)$ where $u = z \oplus f(x)$.

First of all note that this Boolean function is involutive -- it
equals its own inverse. Thus, in particular, it is also invertible.

Now, this Boolean function is a permutation (in fact, an involutive
permutation) on the set of all possible elements in $\zo^{m+n}$. Thus,
it can be viewed as a permutation matrix sitting inside
$\C^{\zo^{m+n}}$.  Since permutation matrices are unitary matrices, we
obtain a unitary operator $U_f$ that computes this function.

\subsection{Boolean circuit in the quantum language}

In the classical picture of building a Boolean circuit, we start off
with a Boolean function $\zo^n \to \zo^m$ and try to express it as a
composite of the AND, OR and NOT functions in various ways.

Note that each of these AND, OR and NOT functions take in only a small
number of variables and output only a small number of variables --
they don't touch the other variables at all. Thus, even if they
transform the state of the entire system, their actual effect is only
in some small part of the system.

The parallel in the case of unitary operators would be: Write the
unitary operator $U_f$ as a short-length product of unitary operators
each of which ``affects'' only a small number of variables. To make
these notions rigourous, we need to introduce the notion of tensor
products of operators.

\subsection{Tensor product of vector spaces}

Given two vector spaces $V$ and $W$ with bases $e_i$ and $f_j$, the tensor
product $V \otimes W$ is defined as the vector space with basis $b_{ij}$,
with a map

$V \times W \to V \otimes W$

that sends $\left(\sum_i v_i e_i, \sum_j w_je_j\right)$ to $\sum_{i,j} v_iw_jb_{ij}$.

The tensor product acquires a natural significance for state spaces.
Namely, if $V=\C^m$ is the state space spanned by outcomes $e_i$ of
experiment $I$ and $W = \C^n$ is the state space spanned by outcomes
$f_j$ of experiment $J$, then the tensor product $V \otimes W$ is the
state space for possible outcomes of the combined experiment $I,J$.

In other words, each outcome for $V \otimes W$ gives both the outcome
for experiment $I$ and the outcome for experiment $J$.

Further, the amplitude of the outcome $(i,j)$ for the combined
experiment is the product of the amplitude of outcome $i$ for
experiment $I$ and outcome $j$ for experiment $J$.

Now, given a tensor product $V \otimes W$, it makes sense to talk of
the tensor product of operators $A$ and $B$ where $A$ is a linear
operator on $V$ and $B$ is a linear operator on $W$. The idea is roughly
to map each $b_{ij}$ to the vector $Ae_i \otimes Bf_j$.

\subsection{A quantum circuit}

We can now see that if the ``memory'' stores $n$ variables at any given time,
then the state space is the $n$-fold tensor product of $\C^2$
where $\C^2$ is the state space for one quantum bit (or qubit).

Further, suppose the current state has $n$ variables and there is a
quantum gate that inputs $r$ variables and outputs $r$ of them (by
applying a unitary operator). Then, if $U_g$ denotes the unitary operator
for that quantum gate (when acting only on those $r$ variables),
the overall unitary operator is:

$$U_g \otimes I$$

where $U_g$ is viewed as acting on the space $\C^{2^r}$ of those $r$
variables, and $I$ is acting on the space of $\C^{2^{n-r}}$ for the
remaining $n-r$ variables.

This helps tell us what the notion of a good quantum circuit should be:

A quantum circuit for $U_f$ is an expression of $U_f$ as a product of
unitary operators, each of which can be expressed as the tensor
product of a unitary operator acting on a small number of variables,
with the identity map.

When the quantum circuit arises from a Boolean circuit,
each of those small unitary operators will be the unitary operators
corresponding to that Boolean circuit.

\subsection{Particular cases: controlled NOT and controlled AND}

The controlled NOT gate is obtained as a special case of the general
construction.


\subsection{Solovay's theorem}




















\end{document}