Documente Academic
Documente Profesional
Documente Cultură
Why Quantum Programming Languages? For certain problems, quantum algorithms have an exponential speedup over best known classical algorithms. Most research in quantum computing has focused on algorithms and complexity theory. Quantum algorithms are traditionally described in terms of hardware: quantum circuits or quantum Turing machines. Want compositionality. Also, how do quantum features interact with other language features such as structured data, recursion, i/o, higher-order.
The QRAM abstract machine [Knill96] Classical device: master (general purpose) control results Quantum device: slave
General-purpose classical computer controls a special quantum hardware device Quantum device provides a bank of individually addressable qubits. Left-to-right: instructions. Right-to-left: results.
Linear Algebra Review Scalars C, column vectors u Cn, matrices A Cnm . Adjoint A = (aji)ij, trace tr A = A 2 = ij |aij|2.
i aii, norm
Hermitian matrix A Cnn : if A = A. Hermitian positive: uAu 0 for all u Cn . Diagonalization: A = SDS, S unitary, D real diagonal. Tensor product A B, e.g.
0 1 1 0
B=
0 B B 0
state of one qubit: |0 + |1 (superposition of |0 and |1 ). state of two qubits: |00 + |01 + |10 + |11 . independent: (a|0 + b|1 ) (c|0 + d|1 ) = ac|00 + ad|01 + bc|10 + bd|11 . otherwise entangled.
Lexicographic convention Identify the basis states |00 , basis vectors 1 0 0 1 , 0 0 0 0 in the lexicographic order.
0 0 1 0
0 0 0 1
Unary:
Binary:
N=
1 H=
0 1 1 0
Nc =
I 0 0 N I 0 0 H I 0 0 V I 0 0 W
1 1 1 1 ,
Hc =
V=
1 0 0 i 1 0 i 0
Vc =
W=
Wc =
X=
1 0 0 0
0 0 1 0
0 1 0 0
0 0 0 1
.
9
Measurement
|0 + |1
||2
0 1
||2
|0
|1
10
Two Measurements
||2+||2
||2+||2
|00 + |01
||2 ||2+||2
0 1
|10 + |11
||2 ||2+||2 ||2 ||2+||2
0 1
||2 ||2+||2
|00
|01
|10
|11
Pure vs. mixed states A mixed state is a (classical) probability distribution on quantum states. Ad hoc notation:
1 2
1 2
Note: A mixed state is a description of our knowledge of a state. An actual closed quantum system is always in a (possibly unknown) pure state.
12
vv
1 v 1 v + . . . + n v n v . n 1
This representation is not one-to-one, e.g.
1 2 1 2 1 2
1 0 1 1
+ 1 2
1 2 1 2
0 1 1 1
1 2 =
1 0 0 0 1 2
1 2
0 0 0 1 + 1 2
.5 0 0 .5 = .5 0 0 .5
.5 .5 .5 .5
.5 .5 .5 .5
Measurement:
v Uv
0 1
vv UvvU
0 1
A UAU a b c d
0 1
||2
||2
0 0 0
0 0 0
a 0 0 0
0 0 0 d
14
A complete partial order of density matrices Let Dn = {A Cnn | A is positive hermitian and tr A 1}. Denition. We write A
B if B A is positive.
A2
15
16
Knill (1996): conventions for writing pseudo-code Omer (1998): scratch space management, user dened operators
Bettelli, Calarco, and Serani (2001): based on C++ Imperative languages, run-time checks and errors, no formal semantics.
17
b, c : bit
branch b
0 1
b, c : bit
output b, c : bit
18
00 01 10
11
( branch b ) ( b := c ) ( c := 0 ) ( merge )
output b, c : bit
00 01 10
11
19
00 01 10 11 A B C D
0 0 C D 0 D
( branch b ) ( b := c ) ( c := 0 ) ( merge )
C 0 C 0
D 0
output b, c : bit
A+C 00
B D 0 01 10 11
19-a
b, c : bit
branch b
0 1
b, c : bit
output b, c : bit
20
b, c : bit = (A, B, C, D)
branch b
0 1
b, c : bit = (A + C, B, D, 0)
output b, c : bit
20-a
=A
new bit b := 0
b : bit, = (A, B)
discard b
b : bit, = (A, 0)
=A+B
Assignment:
Branching:
b : bit, = (A, B)
branch b 0 1 b : bit, = (A, 0) b : bit, = (0, B)
Merge:
Initial:
Permutation:
=A
=B
b1 , . . . , bn : bit = A0 , . . . , A2n 1
permute
=A+B
=0
input p, q : qbit
p, q : qbit
measure p
0 1
p, q : qbit q = N p, q : qbit
output p, q : qbit
22
input p, q : qbit
p, q : qbit =
measure p
A B C D
p, q : qbit =
A 0 0 0 0 q = N
0 0 0 D D 0 0 0
p, q : qbit =
NAN 0 0 0
NAN + D 0 0 0
output p, q : qbit
22-a
=A
new qbit q := 0
q : qbit, =
discard q
A C
B D
q : qbit, =
A 0
0 0
=A+D
Unitary transformation:
Measurement:
q : qbit, = A 0
A C
B D 0 0 0 D
I)
q : qbit, =
measure q 0 0 1 q : qbit, = 0
Initial:
Permutation:
=A
=B
=A+B
=0
23
Combining classical data with quantum data Consider typing contexts of the form
Denition. A state for the above typing context is a (A0, . . . , A2n1) of density matrices, each of dimension
2n-tuple 2 m 2m .
our language is functional (no side eects) and statically typed (no run-time errors).
it combines quantum and classical features (the compiler can separate them again).
it has high-level features (such as loops, recursion, and structured data types) [not shown in this talk]
The denotation of a quantum ow chart The denotation of a ow chart is a function which maps (tuples of) matrices to (tuples of) matrices. Example: the denotation of the quantum ow chart from previous slide is the function
A B C D
NAN + D 0 0 0
26
Superoperators
1) linear
2) positive: A positive F(A) positive 3) trace non-increasing: A positive tr F(A) tr(A) 4) completely positive: F idn positive for all n Theorem: The above conditions are necessary and sucient.
27
f : C n 1 n 1 . . . C n k n k C m 1 m 1 . . . C m k m k
symmetric monoidal category (horiz.+vert. composition) coproducts (merge, initial) CPO-enriched (xpoints, recursion) traced monoidal (loops)
28
Structural and denotational equivalence Denition. An elementary quantum ow chart category is a symmetric monoidal category with traced nite coproducts, such that A () is a traced monoidal functor for every object A, together with a distinguished object qbit and morphisms : I I qbit and : qbit I I, such that = id. Denition. Two quantum ow charts X, Y are structurally equivalent if for every elementary quantum ow chart category C and every interpretation of basic operator symbols, [[X]] = [[Y]].
We say X and Y are denotationally equivalent if [[X]] = [[Y]] for the canonical interpretation in the category Q of signatures and superoperators.
29
Higher-order quantum computation Consider functions of higher-order types such as (qbit bit) qbit etc. let q = new qbit() in (x.H(x, x))q. Bits are always duplicable, qubits are never duplicable. What about functions? Consider
Quantum data is subject to linearity constraints. Need to avoid terms that lead to runtime errors such as
q:qbit q:qbit
Both closures have type qbit qbit, but only the rst one is duplicable.
30
Linear type system [Selinger,Valiron04] Types: A, B ::= Subtyping: !A <: A. Typing rules: If FV(M) | | = :
!A
A B
A B.
x:A, M : B ( ) x.M : A B 1
f : qbit bit bit g : bit bit qbit f g = idbitbit g f = idqbit Thus, are the types qbit and bit bit isomorphic?
Answer: No, because each such pair f, g can only be used once. Thus we have a single-use type isomorphism. This is a curious phenomenon.
32
Overview of some recent research Quantum process calculi. Lalire-Jorrand (2004), Gay-Nagarajan (2004), Ado-Mateus (2005) a Higher-order quantum computation. Van Tonder (2003, 2004), Selinger-Valiron (2004), Altenkirch-Grattage (2004) Categorical quantum computation. Abramsky-Coecke (2004), Selinger (2005) Measurement based quantum computation. Danos-DHondt-Kashe-Panangaden (2004, 2005) Quantum specication. Zuliani (2001-2004), DHondt-Panangaden (2004), Taiovich (2004) Quantum coherent spaces. Girard (2003), Selinger (2004)
33