Download as pdf or txt
Download as pdf or txt
You are on page 1of 29

Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Quantum Logic and Computing - I

Atulya Kumar Verma 1 Mihir Vahanwala 1

1 Indian Institute of Technology, Bombay

Autumn 2021

1/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Outline

Motivation

Preliminaries

Quantum Logic Gates

Deutsch-Jozsa Algorithm

Next Time

2/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Computing

Proposition (Church-Turing Thesis)


Given an algorithm that runs on some arbitrary piece of hardware,
there is an equivalent algorithm that runs on a Turing Machine.
• The Turing Machine is a rigorous mathematical model that
captures what it means to compute. This model is the
foundation of all of Computer Science.

• Is this simulation efficient? Yes, says the strong thesis, and


sets up Digital Logic.

3/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Digital Logic

• Von Neumann developed a simple theoretical model to


practically construct a Turing Machine capable computer.

• Bardeen, Brattain and Shockley developed the transistor in


1947, and so began the physical realisation of the
mathematical model.

• Bits are nothing but the states of a transistor: how electrons


flow across them. We give them meaning: high and low, 1
and 0, > and ⊥.

• Our logic corresponds to our technology.

4/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Quantum Problems

• Moore’s Law: The number of transistors on a single microchip


doubles every two years.

• At this point, our technology is beginning to hit physical


limits. The flow of electrons can take to quantum tunneling.

• Another problem: can we simulate quantum systems


efficiently on a classical computer?

• Quantum problems require quantum solutions.

5/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Quantum Solutions

• Deutsch observed that the only true limits of our


computational technology are those imposed by Nature
herself: hence a model based on Quantum Physics!

• Quantum physics works counter intuitively, and hence this


model allows for more efficient solutions for some problems we
classically consider intractable.

• If realised, has far-reaching consequences in applications that


permeate our daily lives, such as cryptography!

6/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

How powerful?

• A significant part of modern cryptography hinges on RSA,


which relies on the fact that integers cannot be factorised
efficiently. Or can they?

• Integer factorisation is in NP, and it is widely believed


P ⊂ NP. A quantum computer can run Shor’s algorithm and
factorise integers in polynomial time!

• We denote the class of problems a quantum computer can


solve in polynomial time by BQP.

• It is known that P ⊆ BQP ⊆ PSPACE

7/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

In Logic, Verification and Reasoning


• Logic - a means to reason about systems, from elementary
circuits to abstract programs

• Systems arise in the natural sciences - for instance, chemistry


- complex molecules with a myriad quantum mechanical
effects to account for

• Simulating these molecules is inefficient on a classical


computer: quantum computing, that uses the logic of Nature
herself, could help!

• Back in the world classical computing, Grover’s algorithm


achieves a quadratic speedup in the #P problem of model
counting for propositional logic.

• Unitary matrices are the basis (pun intended) of this novel


logic.
8/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

The Qubit
• The classical bit is an abstraction of the two states a
transistor could be in.

• The qubit is an abstraction of a quantum system, which, on


measurement, can collapse into one of two basis states.

• We use the Dirac notation to denote the state of a Quantum


system, eg. |ψi

• An arbitrary state is a superposition of the two basis states:

|ψi = α0 |0i + α1 |1i

α0 , α1 ∈ C, |α0 |2 + |α1 |2 = 1
9/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

The System
• The state of a single qubit is a unit vector in C2 . From the
previous slide,
 
α
|ψi = 0 ; hψ| = α¯0 α¯1 ; hψ|ψi = 1
 
α1
n
• The state of a system of n qubits is a unit vector in C2 : a
superposition of 2n basis states, each described by n-bit binary
numbers, from |0i to |2n − 1i.
Remark
Although we sometimes represent |ψi = |ψ1 ψ2 i as
|ψ1 i |ψ2 i = |ψ1 i ⊗ |ψ2 i, one must think of n qubits as one
interacting, entangled system, rather than independent
components of the logical circuit. In particular, by measurement,
we mean that we let the entire system collapse into one of its 2n
basis states.
10/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Operations

Proposition (Quantum Mechanics, Postulate)


Quantum evolution is unitary.
• Any operation manipulates state |ψi into another state |ψ 0 i,
so the norm-preserving property is trivial. The profound points
are the linearity and reversibility.

Proposition (Validity of a Quantum Gate)


An operation on an n-qubit system is valid if and only if it can be
described as a 2n × 2n complex unitary matrix.

Remark
The j th column of this matrix describes what superposition the
gate/operation takes the basis state |ji to.

11/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Infinite Information?

• It is tempting to conclude that an n qubit system is way more


powerful than n bits, just because it stores the
P infinite
expansion of complex numbers in its state: j αj |ji

• However, when we observe the system by making a


measurement, it collapses into a basis state, with respective
probabilities |αj |2 .

• In order to estimate this information, we must somehow


repeat the measurement.

• Can we even replicate an arbitrary state, with no


knowledge of how it was created?

12/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

No Cloning Theorem

Theorem
Let |σi be any fixed state. It is impossible to transform an
arbitrary state |ψi |σi to |ψi |ψi.

Remark
The proof is elementary and observes that any (unitary!) operator
that attempts to do so can only clone a finite subset of states.

13/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

No Cloning Theorem: Proof


Proof.
• Suppose we have a candidate operator U and two distinct
states |ψi and |ϕi for which

U |ψi |σi = |ψi |ψi

U |ϕi |σi = |ϕi |ϕi


• Taking inner product, we get

LHS = hσ| hψ| U ∗ U |ϕi |σi = hσ| hψ|ϕi |σi = hσ|σi hψ|ϕi = hψ|ϕi

RHS = hψ| hψ| |ϕi |ϕi = (hψ|ϕi)2


• We thus have hψ|ϕi is 0 or 1, but since the two states are
distinct, the only other possibility is that they’re orthogonal.

14/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Introduction

• As we’ve seen before, quantum evolution is unitary, and every


unitary matrix is a valid quantum gate.

• One way to specify a quantum gate is to explicitly specify it


as a matrix. Eg. single or double qubit gates like Hadamard,
CNOT.

• Another is to exploit their linearity, and only describe their


action on basis states. In this case, the gate is a permutation
on the basis states, eg. Toffoli, Quantum Boolean Oracle.

• These methods aren’t disjoint: the recursive definition of


controlled-U uses both.

15/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Quantum Circuits
• The circuit is to be read from left to right: this is the
direction of evolution of the system.
• The single lines, or “wires” represent the evolution of qubits.
Double lines are classical channels carrying regular bits.
• Loops, fan-ins, and fan-outs are not allowed for qubits.
• Fan-ins violate reversibility, fan-outs violate the no-cloning
theorem.

Figure: A typical circuit with gates. Measurement done on |j3 i


16/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Hadamard Gate

• A staple in all algorithms, it helps in creating a superposition,


and hence parallelism, and also in interference, which
ultimately harnesses this power.
•  
1 1 1
H=√
2 1 −1
|0i+|1i |0i−|1i
• H |0i = √ , H |1i = √
2 2
• H 2 = I , so applying the Hadamard gate to a state twice does
nothing to it.

17/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Hadamard and superposition

• The Hadamard gate, applied to n qubits in parallel, is denoted


by H ⊗n .
• For a basis state,

H ⊗n |ji = H |j1 i H |j2 i . . . H |jn i

1
H ⊗n |ji = √ |0i + (−1)j1 |1i . . . |0i + (−1)jn |1i
 
2 n

• Denote j · k = j1 k1 + . . . jn kn . The above can be written as


X |ki
H ⊗n |ji = (−1)j·k √
k
2n

18/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

CNOT Gate
•  
1 0 0 0
0 1 0 0
UCN =
0

0 0 1
0 0 1 0
• The CNOT gate, along with the set of all single qubit gates,
is universal to build all quantum circuits.
• Classical intuition: the target qubit (unshaded) is flipped only
if the control qubit (bold dot) is set to 1.

19/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Toffoli Gate
• Similar to CNOT: “target” bit is flipped only if the two
“control” bits are set to 1.
• Permutation matrix: basis states |000i through |101i are
mapped to themselves, |110i and |111i are interchanged.
• Can be simulate NAND and fanout for classical logic, and
hence, quantum computers are at least as powerful as classical
counterparts.

20/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Controlled-U Gate
• Let U be any gate that operates on a system of n qubits.
• Define the unitary 2n+1 × 2n+1
 
I O
Uc =
O U
• This has the effect of taking the basis state |0i |ji to itself,
and |1i |ji to |1i U |ji.
• Classical intuition: generalisation of CNOT: U acts on
“target” qubits only if “control” qubit is 1

Figure: The slash denotes multiple qubits.


21/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Boolean Oracle
• Let f be a Boolean function in n variables. The Boolean
oracle Uf acts on an n + 1 qubit system.
• Its action on the basis states is given by
Uf |xi |y i = |xi |y ⊕ f (x)i
⊕ denotes logical XOR. One can see that this is a
permutation of basis states, hence unitary.
• If y = |0i−|1i
√ , then Uf |xi |y i = (−1)f (x) |xi |y i
2

Figure: The slash denotes multiple qubits.


22/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

The Problem

Problem
Bob has a function f : {0, 1}n → {0, 1}, that is either “constant”
or “balanced”: i.e. 0 on exactly an arbitrary half the input, and 1
on the other half. Alice wants to be completely certain which is
the case. How many times does she have to query Bob?

Remark
This is a toy problem, simply to illustrate the quintessential
algorithm that uses superposition and interference. Note that in
the classical case, Alice always needs 2n−1 + 1 queries to be
completely sure. In the quantum case, we show that Alice needs
just one query.

23/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

The Algorithm: Circuit

Figure: Uf is precisely the Boolean oracle described earlier. H applied on


|q0 i is technically H ⊗n

• The system starts in |0i |1i. The initial Hadamard gates take
it to  
2Xn −1  
 √1 |0i − |1i
|ji √
2n j=0 2
• Now, there is something special about the bottom input to
Uf ... 24/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

The Algorithm: Analysis

• Denote the state of the bottom qubit by |y i. For a basis state


|ji, we know that Uf takes |ji |y i to (−1)f (j) |ji |y i.
• So, the state after the application of Uf is
 
n −1
2X
1
√ (−1)f (j) |ji |y i
2n j=0

• The final Hadamard is independent of |y i. We use the


expression for the action of H ⊗n on basis states. The final
state before measurement is:
 
n −1 2n −1
2X
1
X
(−1)f (j)+j·k |ki |y i
2n
j=0 k=0
25/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

The Algorithm: Correctness


• We rewrite the final state, just rearranging the summation:
 
n −1 2n −1
2X
1 X
 (−1)f (j)+j·k |ki |y i
2n
k=0 j=0

• We focus on the stuff in the parentheses: it is of the form


P 1 P f (j)
k αk |ki. Consider α0 . It is 2n j (−1)
• If f is balanced, the positive and negative terms cancel out.
α0 = 0.
• If f is constant, all terms add up, and |α0 |2 = 1.
• On measurement, the probability of the first “register”
collapsing into |0i is |α0 |2 .
• We measure the first wire to be |0i if and only if the
function is constant.
26/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Plan For Next Time

• Quantum Fourier Transform: the cornerstone

• Grover Operator and Model Search and Counting

• Shor’s Algorithm, Integer Factorization

• Decoherence: why today’s technology has a long way to go

27/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

References so far

• Motivation and background [1, Chapters 1, 3, 4]


• Model Counting [2]

Michael A. Nielsen and Isaac L. Chuang.


Quantum Computation and Quantum Information.
Cambridge University Press, 2000.
Fabrizio Riguzzi.
Quantum weighted model counting, 2020.
arXiv:1910.13530.

28/29
Motivation Preliminaries Quantum Logic Gates Deutsch-Jozsa Algorithm Next Time

Thank you for your attention.

29/29

You might also like