Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Marek Perkowski
Sources
Origin of slides: John Hayes, Peter Shor, Martin Lukac, Mikhail Pivtoraiko, Alan Mishchenko, Pawel Kerntopf, Mosca, Ekert Mosca, Hayes, Ekert, Lee Spector in collaboration with Herbert J. Bernstein, Howard Barnum, Nikhil Swamy {lspector, hbernstein, hbarnum, nikhil_swamy}@hampshire.edu} School of Cognitive Science, School of Natural Science Institute for Science and Interdisciplinary Studies (ISIS) Hampshire College
Introduction
Short-Term Objectives
Introduce Quantum Computing Basics to interested students at KAIST. Especially non-physics students
Long-Term Objectives
Engage into AI/CS/Math Research projects benefiting from Quantum Computing. Continue our previous projects in quantum computing
Prerequisite
- No linear algebra or quantum mechanics assumed - A ECE, math, physics or CS background would be beneficial, practically-oriented class.
Introduction
MainTextbook
Quantum Computation & Quantum Information
Michael A. Nielsen Isaac L. Chuang ISBN: 0 521 63503 9 Paperback ISBN: 0 521 63235 8 Hardback Cost: $48.00 New Paperback $35.45 Used Paperback
Presentation Overview
Qubits
Quantum Computation
Study of information processing tasks that can be accomplished using quantum mechanical systems
Absurd but taken seriously (not just quantum mechanics but also quantum computation)
Under active investigation by many of the top physics labs around the world (including CalTech, MIT, AT&T, Stanford, Los Alamos, UCLA, Oxford, lUniversit de Montral, University of Innsbruck, IBM Research . . .) In the mass media (including The New York Times, The Economist, American Scientist, Scientific American, . . .) Here.
A beam splitter
Half of the photons leaving the light source arrive at detector A; the other half arrive at detector B.
A beam-splitter beam0 1
0
50%
50%
The simplest explanation is that the beam-splitter acts as a classical coin-flip, randomly sending each photon one way or the other.
An interferometer
Equal path lengths, rigid mirrors. Only one photon in the apparatus at a time. All photons leaving the source arrive at B. WHY?
Possibilities count
There is a quantity that well call the amplitude for each possible path that a photon can take. The amplitudes can interfere constructively and destructively, even though each photon takes only one path. The amplitudes at detector A interfere destructively; those at detector B interfere constructively.
Calculating interference
Arrows for each possibility. Arrows rotate; speed depends on frequency. Arrows flip 180o at mirrors, rotate 90o counter-clockwise when reflected from beam splitters. Add arrows and square the length of the result to determine the probability for any possibility.
Quantum Interference
0 1
0
100%
The simplest explanation must be wrong, since it would predict a 50-50 distribution.
N 0 sin 2 2 N 1 cos 2
2
A new theory
The particle can exist in a linear combination or superposition of the two paths
0 1
N
N 0 sin 2 2 N 1 cos 2
2 iN
i 1 0 1 2 2
i e 0 1 2 2
e iN 1 i(eiN 1) 0 1 2 2
0 1
E0 E1
E 0 E1 ! 1
Quantum Operations
The operations are induced by the apparatus linearly, i 1 that is, if 0 p 0 1
2 2
and then
1 i 1 p 0 1 2 2
1 1 E1 2 1 0 E0 2 1 i 0 1 2 2 1 i E1 1 2 2
i E 0 0 E1 1 p E 0 0 2 i ! E0 E1 2
Quantum Operations
Any linear operation that takes states 2 2 satisfying E 0 0 E1 1 E 0 E1 ! 1 and maps them to states ' ' E 0 0 E1 1 satisfying must be UNITARY
2 2
' 0
E
' 1
!1
Linear Algebra
u00 U! u10 u01 u11
u00 t UU ! u10
u01 u 00 u u11 * 01
*
u10 1 0 * ! !I u11 0 1
*
Linear Algebra
0 1 E 0 0 E1 1
1 0
0 1
1 0 E0 E 0 E1 ! 0 1 E 1
Linear Algebra
corresponds to
i 2 1 2 1 2 i 2
corresponds to
1 0 0 e iN
Linear Algebra
0
N
corresponds to
i 2 1 2 1 2 i 2
1 0 0 eiN
i 2 1 2
1 2 i 2
1 0
Abstraction
The two position states of a photon in a Mach-Zehnder apparatus is just one example of a quantum bit or qubit Except when addressing a particular physical implementation, we will simply talk about basis states 0 and 1 and unitary operations like
and
where
H
N
corresponds to
1 2 1 2
1 2 1 2
and
corresponds to
1 0 0 eiN
An arrangement like
0
N
E
0 0 ! 00
0 E1 1
0 F1 1
1 1 ! 11
or by the vector
where there is no factorization into the tensor product of two independent qubits. These states are called entangled.
Entanglement
Qubits in a multi-qubit system are not independentthey can become entangled. To represent the state of n qubits we use 2n complex number amplitudes.
we get
x y
with probability
E xy
Measurement
|E|2, for amplitudes of all states matching an output bit-pattern, gives the probability that it will be read. Example:
0.316|00 + 0.447|01 + 0.548|10 + 0.632|11 The probability to read the rightmost bit as 0 is |0.316|2 + |0.548|2 = 0.4
Measurement during a computation changes the state of the system but can be used in some cases to increase efficiency (measure and halt or continue).
= !
c i
i!0
i n 1 n1
i ~i0
Operations are defined by linear algebra over Hilbert Space and can be represented by unitary matrices with complex elements Severe restrictions exist on copying and measuring signals Many universal gate sets exist but the best types are not obvious Circuits must use microscopic technologies that are slow, fragile, and not yet scalable, e.g., NMR
Classical logic behavior can be represented by permutation matrices Non-classical logic behavior can be represented including state sign (phase) and entanglement
cn
Carry
Here we use Pauli rotations notation. Controlled x is the same as controlled NOT Controlled-controlled x is the same as Toffoli Controlled x is the same as Feynman
Reversible Circuits
Reversible Circuits
Reversibility was studied around 1980 motivated by power minimization considerations Bennett, Toffoli et al. showed that any classical logic circuit C can be made reversible with modest overhead
f(i)
m outputs
n inputs
Junk
f(i)
Junk
Reversible Circuits
How to make a given f reversible
Suppose f :i p f(i) has n inputs m outputs Introduce n extra outputs and m extra inputs Replace f by frev: i, j p i, f(i) j where is XOR
a b c a b f
0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 1 0
a b f = ab c
This is the well-known Toffoli gate, which realizes AND when c = 0, and NAND when c = 1.
Reversible Circuits
Reversible gate family [Toffoli 1980]
(Toffoli gate)
Every Boolean function has a reversible implementation using Toffoli gates. There is no universal reversible gate with fewer than three inputs
Quantum Gates
Quantum Gates
One-Input gate: NOT
Input state: c0` + c1` NOT Output state: c1` + c0` Pure states are mapped thus: ` p ` and ` p ` Gate operator (matrix) is 0 1 0 1
1 0
0 ! 0
1 ! 1
As expected:
0 10 1 1 0 ! 1 01 0 0 1
NOT NOT
Quantum Gates
One-Input gate: Square root of NOT
Some matrix elements are imaginary Gate operator (matrix): We find:
i / 1/ 2 1/ 1/ 2 1 i 1 ! 1 1/ 2 i / 1/ 2 2 i 1/
so ` p ` with probability |i/2|2 = 1/2 1 1 i 1 1 i ! 1 1 2 i 0 2 and ` p ` with probability |1/ 2|2 = 1/2 Similarly, this gate randomizes input ` But concatenation of two gates eliminates the randomness!
1 i 1i 1 0 i ! 1 1 2 i i i 0
NOT
NOT
Other variant of square root of not - we do not use complex numbers - only real numbers
Quantum Gates
One-Input gate: Hadamard
1 2 1 1 1 1
Quantum Gates
Universal One-Input Gate Sets Requirement:
`
Any state `]
Hadamard and phase-shift gates form a universal gate set of 1-qubit gates, every 1-qubit gate can be built from them. Example: The following circuit generates `] = cos U `0 + eiJ sin U `1 up to a global factor
2U
T J 2
Quantum Gates
Two-Input Gate: Controlled NOT (CNOT)
`x
CNOT
`x `x y
`y
1 0 0 0
0 1 0 0
0 0 0 0 0 1 1 0
`x `y
`x `x y
CNOT maps `x` p `x``x and `x` p `x``NOT x `x` p `x``x looks like cloning, but its not. These mappings are valid only for the pure states ` and ` Serves as a non-demolition measurement gate
Quantum Gates
3-Input gate: Controlled CNOT (C2NOT or Toffoli gate)
1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0
`a `b `c
`a `b `ab c
Quantum Gates
General controlled gates that control some 1qubit unitary operation U are useful
u00 u10 u01 u11
etc.
U U
C(U)
C2(U)
Quantum Gates
Universal Gate Sets To implement any unitary operation on n qubits exactly requires an infinite number of gate types The (infinite) set of all 2-input gates is universal Any n-qubit unitary operation can be implemented using 5(n34n) gates [Reck et al. 1994] CNOT and the (infinite) set of all 1-qubit gates is universal
Quantum Gates
Discrete Universal Gate Sets
The error on implementing U by V is defined as
E(U,V ) ! max (U V ) =
=
If U can be implemented by K gates, we can simulate U with a total error less than I with a gate overhead that is polynomial in log(K/I) A discrete set of gate types G is universal, if we can approximate any U to within any I > 0 using a sequence of gates from G
Quantum Gates
Discrete Universal Gate Set
Example 1: Four-member standard gate set
1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0
1 1 1 1 2 1
1 0 0 i
1 0
0 e iT / 4
T/8
CNOT
Hadamard
Phase
Quantum Circuits
Quantum Circuits
A quantum (combinational) circuit is a sequence of quantum gates, linked by wires The circuit has fixed width corresponding to the number of qubits being processed Logic design (classical and quantum) attempts to find circuit structures for needed operations that are
Functionally correct Independent of physical technology Low-cost, e.g., use the minimum number of qubits or gates
Quantum Circuits
Ad hoc designs known for many specific functions and gates Example 1 illustrating a theorem by [Barenco et al. 1995]: Any C2(U) gate can be built from CNOTs, C(V), and C(V) gates, where V2 = U
=
U
(1+i) (1-i) (1-i) (1+i) 1/2
1/2
Quantum Circuits
Example 1: Simulation
|0 |1 |x |0 |1 |x |0 |0 |1 V|x |0 |1 |0 |1 |x |0 |1 |0 |1 |x
|1 |x
Quantum Circuits
Example 1: Simulation (contd.)
|1 |1 |x |1 |1 U|x |1 |1 |1 V|x |1 |0 |1 |0 V|x |1 |1 |1 |1 U|x
|1 |x
Quantum Circuits
Example 1: Algebraic analysis
x1 x2 x3
U U0
? =
V U1 U2 V U3 U4 V U5
Is U0(x1, x2, x3) = U5U4U3U2U1(x1, x2, x3) = (x1, x2, x1x2 U (x3) ) ? We will verify unitary matrix of Toffoli gate
Observe that the order of matrices Ui is inverted.
Quantum Circuits
Example 1 (contd);
U1 ! I1 C(V) 1 0 0 0 0 0 ! v01 0 v11 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 v 00 0 0 0 0 0 v10 0 0 0 0 0 0 v01 0 v11 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 v01 v11
1 1 0 0 ! 0 1 0 0
1 0 0 v00 0 v10
0 v00 0 v10
Quantum Circuits
Example 1 (contd);
U2 ! U4 ! CNOT(x1 , x2 ) I1 1 0 0 0 0 1 0 0 ! 0 1 0 1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0
1 0 ! 0 0
0 0 1 0 0 0 0 1
As we can check in the schematics, the Unitary Matrices U2 and U4 are the same
Quantum Circuits
Example 1 (contd);
U2 ! U4 ! CNOT(x1 , x2 ) I1 1 0 0 0 0 0 0 1 0 0 ! 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0
1 0 ! 0 0
0 1 0 0
Quantum Circuits
Example 1 (contd);
U5 is the same as U1 but has x1and x2 permuted (tricky!) It remains to evaluate the product of five 8 x 8 matrices U5U4U3U2U1 using the fact that VV = I and VV = U
1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 v01 0 v11 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 v 00 v10 0 v 01 0 0 0 0 0 0 0 0 v11 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 v10 0 v11 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 v00 0 v10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 v01 0 0 v11 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 v00 v10 0 0 0 0 0 0 v01 v11
0 0 0 0 1 0 0 v00
0 0 0
0 0 v 01
0 0
1 0 0 0 ! 0 0 0 0
0 1 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
0 0 0 0 0 0
0 0
Quantum Circuits
Example 1 (contd);
We calculate matrix U3 1 0 0 0 This is a hermitian matrix, so we transpose and next calculate complex conjugates, we denote complex conjugates by bold symbols
0 0 0 0 0 0 v 00
0 1 0 0 0 0 0
0 1 0 0 0 0 0 v0 v0 0 0 00 10 0 0 0 0 0 0 0 v01 v11 1 0 0 0 0
0 0 0 0
1 0 0 0
0 0 0 1
0 0 0 0
0 1 0 0
v10
0 0 0 0 1 0
0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0
0 0 1 0 0 v 00 0 v 01 0 0 0 0 0 0 0 0
Quantum Circuits
Example 1 (contd);
U5 is the same as U1 but has x1and x2 permuted because in U1 black dot is in variable x2 and in U5 black dot is in variable x1 This can be also checked by definition, see next slide.
1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 v 01 v11 0 0 0 0 0 0 0 0 v 00 v10 0 1 0 0 0 0 0 0 0 0 0 0 v01 0 v11 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0
U5 =
0 0 v00 0 0 v10 0 0 0 0 0 0
Quantum Circuits
Example 1 (here we explain in detail how to calculate U5)
x1 x2 x3
.
V
x1 x2 x3
.
V
U5
U6 is calculated as a Kronecker product of U7 and I1 U7 is a unitary matrix of a swap gate
U6
U1 U6 U5 = U6 U 1 U 6
Quantum Circuits
Example 1 (contd);
It remains to evaluate the product of five 8 x 8 matrices U5U4U3U2U1 using the fact that VV = I and VV = U
1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 v01 0 v11 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 v 00 v10 0 v 01 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 v10 0 v11 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 v01 v11 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 v00 v10 0 0 0 0 0 0 v01 v11 1 0 0 v00 0 v10 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 v00 v 01 0 0 0 v10 0 0 0 0 0 0 0 0
v11 0 0 0 1 0 0 0 0
v11 0 0 v 00 0 v10
0 1 0 0 0 v00 0 0 v 01
1 0 0 0 ! 0 0 0 0
U1
0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 ! U 0 0 0 v 00v01 v10v11 v01v01 v11v11 0 0
Quantum Circuits
Implementing a Half Adder
Problem: Implement the classical functions sum = x1 x0 and carry = x1x0
Generic design:
|x1 |x0 |y1 |y0
Uadd
Quantum Circuits
Half Adder: Generic design (contd.)
1 0 0 0 0 0 0 0 U ADD ! 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
Quantum Circuits
Half Adder: Specific (reduced) design
|x1 |x0 |y
C2NOT (Toffoli) CNOT