Algebraic Method Qcomputing
Algebraic Method Qcomputing
COMPUTATION
arXiv:1510.02198v1 [quant-ph] 8 Oct 2015
by
Neil J. Ross
at
Dalhousie University
Halifax, Nova Scotia
August 2015
⃝
c Copyright by Neil J. Ross, 2015
À mes maı̂tres.
ii
Table of Contents
Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii
Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
Chapter 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.3 Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.4 Contributions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
iii
3.1.3 Norms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.3 Linearity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.3.1 Contraction, weakening, and strict linearity . . . . . . . . . . 38
4.3.2 Reintroducing non-linearity . . . . . . . . . . . . . . . . . . . 39
iv
5.1.4 Ellipses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
5.1.5 The enclosing ellipse of a bounded convex set . . . . . . . . . 55
5.1.6 General solution to grid problems over Z[i] . . . . . . . . . . . 55
5.1.7 Scaled grid problems over Z[i] . . . . . . . . . . . . . . . . . . 56
v
Chapter 9 Type-safety of Proto-Quipper . . . . . . . . . . . . . . . . 127
9.1 Properties of the type system . . . . . . . . . . . . . . . . . . . . . . 127
9.2 Subject reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
9.3 Progress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
vi
List of Figures
vii
Abstract
viii
List of Abbreviations and Symbols Used
ix
<: The subtyping relation.
[Q, L, a] A closure of the quantum lambda calculus.
up(A) The uprightness of the set A.
BBox(A) The bounding box of the set A.
area(A) The area of the set A.
Grid(A) The grid for the set A.
O(.) The big-O notation.
Skew(D) The skew of the ellipse D.
Bias(D, ∆) The bias of the state (D, ∆).
sinhλ (.) The hyperbolic sine in base λ.
coshλ (.) The hyperbolic cosine in base λ.
Rε The ε-region.
D The closed unit disk.
Re(a) The real part of the complex number a.
Pf (X) The set of finite subsets of the set X.
FQ(a) The free quantum variables of a term a.
Bijf (X) The set of finite bijections on the set X.
SpecX (T ) An X-specimen for T .
[C, a] A closure of Proto-Quipper.
⌊.⌋ The floor function.
∪· The disjoint union.
x
Acknowledgements
I would like to express my profound gratitude to the people who, in one way or
another, have contributed to the writing of this thesis.
I want to thank my supervisor Peter Selinger, for his insight, his guidance, and,
most importantly, his contagious passion for mathematics. Special thanks are due to
the members of my supervisory committee, Dorette Pronk and Richard Wood, for
accepting to read a thesis which, alas, contains so few arrows. I am very grateful to
Prakash Panangaden for accepting to be my external examiner.
The staff of the Department of Mathematics and Statistics of Dalhousie Univer-
sity have played a large part in making my stay in Halifax enjoyable. I am very
appreciative of their hard work.
I am greatly indebted to the many teachers I had the chance to learn from during
the past ten years. In particular, I want to acknowledge the profound influence of Su-
sana Berestovoy, Julien Dutant, Vincent Homer, Jean-Baptiste Joinet, and Damiano
Mazza.
I want to thank the researchers I had the pleasure to collaborate with, notably
D. Scott Alexander, Henri Chataing, Alexander S. Green, Peter LeFanu Lumsdaine,
Jonathan M. Smith, and Benoı̂t Valiron.
My fellow students have always provided inspiration, support, and laughter. I
especially want to thank Abdullah Al-Shaghay, Ali Alilooee, Chloé Berruyer, Samir
Blakaj, Méven Cadet, Antonio Chavez, Hoda Chuangpishit, Hugo Férée, Florent
Franchette, Brett Giles, Giulio Guerrieri, François Guignot, Zhenyu Victor Guo,
D. Leigh Herman, Ben Hersey, Joey Mingrone, Lucas Mol, Alberto Naibo, Mattia
Petrolo, Francisco Rios, Kira Scheibelhut, Matthew Stephen, Aurélien Tonneau, An-
tonio Vargas, Kim Whoriskey, Bian Xiaoning, Amelia Yzaguirre, and Kevin Zatloukal.
Finally, I want to thank my friends and loved ones, far and near. My brother and
my sister. My parents, for their unwavering support. And Kira, for her kindness.
xi
Chapter 1
Introduction
n
C2 = C2 ⊗ . . . ⊗ C2 .
n
1
2
The unitary group of order 2, denoted U(2), is the group of 2 × 2 complex unitary
matrices. The special unitary group of order 2, denoted SU(2), is the subgroup of
U(2) consisting of unitary matrices of determinant 1.
Let S ⊆ U(2) be a set of unitaries and ⟨S⟩ be the set of words over S. In the
context of quantum computing, the elements of S are called single-qubit gates and the
elements of ⟨S⟩ are called single-qubit circuits over S. Matrix multiplication defines
a map µ : ⟨S⟩ → U(2). However, we often abuse notation and simply write W for
3
µ(W ).
We think of S ⊆ U(2) as the set of unitary operations that can be performed
natively on a quantum computer. Because a quantum computer is a physical device, S
is finite and the set ⟨S⟩ of circuits expressible on our quantum computer is countable.
In contrast, both U(2) and SU(2) are uncountable. Hence, regardless of which S is
chosen, there will be U ∈ SU(2) such that U ∈
/ ⟨S⟩. This is a fortiori true of U(2)
also. This might be problematic, as it is often desirable to have all unitaries at our
disposal when writing quantum algorithms. This tension is alleviated by the fact that
unitaries can be approximated.
The notion of distance introduced in Definition 1.1.1, based on the operator norm,
is adopted because the physically observable difference between two unitaries U and
W is a function of ∥U − W ∥. As a result, if ε is small enough, the action of the
unitaries U and W are observably almost indistinguishable. The finiteness of the
gate set S can therefore be remedied if ⟨S⟩ is dense in SU(2).
Definition 1.1.2. A set S ⊆ U(2) is universal if for any U ∈ SU(2) and any ε > 0,
there exists W ∈ ⟨S⟩ such that ∥U − W ∥ < ε.
Note that a set S of gates is universal if it is dense in SU(2), rather than in U(2).
This is due to the fact that since a global phase has no observable effect in quantum
mechanics, we can without loss of generality focus on special unitary matrices.
If a gate set S is universal, then any special unitary can be approximated up to an
arbitrarily small precision by a circuit over S. However, the fact that S is universal
does not provide an efficient method which, given a special unitary U and a precision
ε, allows us to construct the approximating circuit W . An algorithm that performs
such a task is a solution to the approximate synthesis problem for S.
Problem 1.1.3 (Approximate synthesis problem for S). Given a unitary U ∈ SU(2)
and a precision ε > 0, construct a circuit W over S such that ∥W − U ∥ 6 ε.
Note that ω is a complex number, rather than a matrix. By a slight abuse of notation,
we write ω to denote the unitary ωI, where I is the identity 2 × 2 matrix. The
Clifford group is of great interest in quantum computation because Clifford circuits
can be fault-tolerantly implemented at very low cost in most error-correcting schemes.
For this reason, the Clifford group is often seen as a prime candidate for practical
quantum computing. However, the Clifford group is finite and therefore not universal
for quantum computing. Moreover, Gottesman and Knill showed that Clifford circuits
can be efficiently simulated on a classical computer [26]. It is therefore necessary to
consider universal extensions of the Clifford group.
The first extension we will consider, the Clifford+V gate set, arises by adding the
following V -gates to the set of Clifford generators
[ ] [ ] [ ]
1 1 2i 1 1 2 1 1 + 2i 0
VX = √ , VY = √ , and VZ = √ .
5 2i 1 5 −2 1 5 0 1 − 2i
The V -gates were introduced in [46] and [47] and later considered in the context of
approximate synthesis in [32], [7], [54], and [5].
The second extension we will consider, the Clifford+T gate set, arises by adding
the following T -gate to the set of Clifford generators
[ ]
1 0
T =
0 ω
5
where ω = eiπ/4 as above. The T gate is the most common extension of the Clifford
group considered in the literature. One reason for this is that the Clifford+T gate set
enjoys nice error-correction properties [50]. This gate set has often been considered
in the approximate synthesis literature (see, e.g., [41], [40], [60], and [56]).
Until recently, there were two main approaches to the approximate synthesis prob-
lem: the ones based on exhaustive search, like Fowler’s algorithm of [20], and the ones
based on geometric methods, like the Solovay-Kitaev algorithm ([37], [14], [38]). The
methods based on exhaustive search achieve optimal circuit sizes but, due to their
exponential runtimes, are impractical for small ε. In contrast, the well-known Solovay-
Kitaev algorithm has polynomial runtime and achieves circuit sizes of O(logc (1/ε)),
where c > 3. However, the information-theoretic lower bound is O(log(1/ε)), so the
Solovay-Kitaev algorithm leaves ample room for improvement.
In the past few years, number theoretic methods, and in particular Diophantine
equations, have been used to define new synthesis algorithms. This has rejuvenated
the field of quantum circuit synthesis and significant progress has been made ([42],
[7], [54], [5], [41], [40], [60], [56]).
The algorithms we introduce in this thesis belong to this new kind of number-
theoretic algorithms. We give algorithms for Clifford+V and Clifford+T circuits.
Both algorithms are efficient (they run in probabilistic polynomial time) and achieve
near-optimal circuit length. In certain specific cases, the algorithms are optimal.
That is, the produced circuits are the shortest approximations possible. This solves
a long-standing open problem, as no such efficient optimal synthesis method was
previously known for any gate set.
6
Quipper is a programming language for quantum computation (see [1], [27], [28], and
[55]). The Quipper language was developed in 2011–2013 in the context of a research
contract for the U.S. Intelligence Advanced Research Project Activity (see [35]). As
part of this project, seven non-trivial algorithms from the quantum computing lit-
erature were implemented in Quipper ([10], [2], [30], [65], [31], [53], and [48]). I
participated in the development of the Quipper language and in the implementation
of the Triangle Finding Algorithm [48] and the Unique Shortest Vector Algorithm
[53].
• provide a linear type system to guarantee that the produced circuits are physi-
cally meaningful (in particular, properties like no-cloning are respected).
To achieve these goals, we extend the types of the quantum lambda calculus with
a type Circ(T, U ) of circuits, and add constant terms to capture some of Quipper’s
circuit-level operations, like reversing. We give a formal operational semantics of
Proto-Quipper in terms of a reduction relation on pairs [C, t] of a term t of the
language and a so-called circuit state C. The state C represents the circuit currently
being built. The reduction is defined as a rewrite procedure on such pairs, with the
state being affected when terms involve quantum constants.
1.3 Outline
The thesis can be divided into three parts, whose contents are outlined below.
8
• The first part of the thesis, which corresponds to chapters 2 – 4, contains back-
ground material. Chapter 2 is an exposition of the basic notions of quantum
computation. Chapter 3 introduces concepts and methods from algebraic num-
ber theory. Chapter 4 presents the lambda calculus as well as the quantum
lambda calculus.
• The third and last part of the thesis, which corresponds to chapters 8 and
9, contains logical contributions to quantum computation. In Chapter 8 we
introduce the syntax, type system, and operational semantics of Proto-Quipper.
In Chapter 9 we prove that Proto-Quipper enjoys the subject reduction and
progress properties.
In the interest of brevity, the introductory chapters 2 – 4 contain only the material
that is necessary to the subsequent chapters. In particular, most proofs are omitted.
In each of these chapters, we provide references to the relevant literature.
1.4 Contributions
with Henri Chataing and Peter Selinger. The results in these chapters are my original
work; Peter Selinger’s role was supervisory, and Henri Chataing was a summer intern
whom I helped supervise.
Chapter 2
Quantum computation
We write N for the semiring of non-negative integers (including 0) and Z for the ring
of integers. The fields of rational numbers, real numbers, and complex numbers are
denoted by Q, R, and C respectively. Recall that C = {a + bi ; a, b ∈ R} so that the
complex numbers can be identified with the two-dimensional real plane R2 . Recall
moreover that if α = a + bi is a complex number, then its conjugate is α† = a − bi.
We will be interested in complex vector spaces of the form Cn for some n ∈ N. The
integer n is called the dimension of Cn . The vector space Cn has a canonical basis,
whose elements we denote by ei , for 1 6 i 6 n. Every element α ∈ Cn can be uniquely
written as a linear combination
α = a1 e 1 + . . . + an e n (2.1)
We identify C1 with C and frequently refer to the elements of C as scalars. The vector
space Cn is equipped with the usual operations of addition and scalar multiplication.
10
11
Note that under the identification of C1 and C, no ambiguity arises from using (−)†
to denote the dual of a vector and the conjugate of a scalar. The norm of a vector α
√
is defined as ||α|| = α† α, where α† α is obtained by matrix multiplication. A vector
whose norm is 1 is called a unit vector. Equipped with the norm || − ||, the vector
space Cn has the structure of an n-dimensional Hilbert space.
Figure 2.1: The Hadamard matrix H and the Pauli matrices X, Y , and Z.
determinant of U is defined as
([ ])
α β
det = αδ − βγ.
γ δ
Examples of useful unitary matrices are provided in Figure 2.1. The matrix H is
known as the Hadamard matrix and the matrices X, Y , and Z are known as the
Pauli matrices.
A complex matrix U is Hermitian if U = U † . If U is hermitian, then u† U u is
always real. Note that all the matrices in Figure 2.1 are Hermitian.
A matrix U is positive semidefinite (resp. positive definite) if U is hermitian and
α† U α > 0 (resp. α† U α > 0) for all α ∈ Cn .
13
The tensor product of vectors spaces and matrices is defined as usual and denoted by
⊗. We note that Cn ⊗ Cm = Cnm and that the tensor product acts on square matrices
as
⊗ : Mn,n (C) × Mm,m (C) → Mnm,nm (C).
forms a basis for C2 ⊗ C2 = C4 . We note, however, that not all elements of C4 are of
the form α ⊗ β with α, β ∈ C2 .
Recall that the fundamental unit of classical computation is the bit. By analogy, the
fundamental unit of quantum computation is called the quantum bit, or qubit.
As is customary, we use the so-called ket notation to denote the state of a qubit,
which is written |φ⟩. Moreover, we write |0⟩ and |1⟩ for the elements e1 and e2 of the
standard basis for C2 . In the context of quantum computation, the basis {|0⟩, |1⟩} is
referred to as the computational basis. Since the state of a (classical) bit is an element
of the set {0, 1}, we sometimes refer to the states |0⟩ = 1|0⟩+0|1⟩ and |1⟩ = 0|0⟩+1|1⟩
as the classical states.
By Definition 2.2.1, the state of a qubit can be one of the classical states but
also any linear combination α|0⟩ + β|1⟩ such that ||α||2 + ||β||2 = 1. The coefficients
α and β in such a linear combination are called the amplitudes of the state. When
14
Figure 2.2: The Bloch sphere representation of the state of a qubit. The state (θ, φ)
is represented by the black dot, with θ corresponding to the angle pictured in red and
φ to the angle pictured in green.
both amplitudes of the state of a qubit are non-zero, then the qubit is said to be in
a superposition of |0⟩ and |1⟩.
The fact that the vector in Definition 2.2.1 is considered only up to a phase gives
rise to a nice geometric representation of the state of a qubit. Let α|0⟩ + β|1⟩ be a
unit vector. We can rewrite this linear combination as
θ θ
α|0⟩ + β|1⟩ = eiγ (cos( )|0⟩ + eiφ sin( )|1⟩)
2 2
for some real numbers θ ∈ [0, π] and γ, φ ∈ [0, 2π]. Since the state of qubit is defined
up to a phase, the same state is described by
θ θ
cos( )|0⟩ + eiφ sin( )|1⟩
2 2
with θ, φ ∈ R. The pair (θ, φ) defines a point on the 2-sphere known as the Bloch
sphere representation of the state, as pictured in Figure 2.2. The Cartesian coordi-
nates of the point (θ, φ) on the Bloch sphere are given by (sin θ cos φ, sin θ sin φ, cos θ).
then the two qubits are said to be separable. Otherwise, they are said to be entangled.
Unitary evolution
The state of a system of n qubits can evolve under the action of a unitary operator.
n
If |φ⟩ is such a state (viewed as a column vector in C2 ) and U is a unitary matrix,
the evolution of |φ⟩ under U is given by |φ⟩ ↦→ U |φ⟩. For this reason, we sometimes
refer to a unitary matrix of dimension 2n as an n-qubit unitary.
Recall from Section 2.2.1 that the state of a qubit can be interpreted as a point
on the Bloch sphere. This interpretation extends to single-qubit unitary matrices,
which can be seen as rotations of the Bloch sphere. Let v = (x, y, z) be a unit vector
in R3 and θ ∈ R and define the matrix
θ θ
Rv (θ) = cos( )I − sin( )(xX + yY + zZ),
2 2
where X, Y , and Z are the Pauli matrices. The matrix Rv (θ) defines a rotation of
the Bloch sphere by θ radians about the v-axis. For example, the Pauli matrices X,
16
Y , and Z correspond to rotations about the x-, y-, and z-axes by π radians. The
following theorem states that, up to a phase, every unitary can be seen as a rotation
of the Bloch sphere.
Theorem 2.2.3. If U ∈ U(2), then there exist real numbers α and θ, and a unit
vector w in R3 such that U = eiα Rw (θ).
Measurement
The second way in which one can act on the state of a system of qubits is by mea-
surement. Unlike unitary evolutions, measurements are probabilistic processes.
We first describe the effect of a measurement on a single qubit. Assume a qubit is
in the state α|0⟩ + β|1⟩. If the qubit is measured, then the result of the measurement
is either 0 or 1 and the state of the qubit post-measurement is the corresponding
classical state. Moreover, the measurement result 0 occurs with probability ||α||2 and
the measurement result 1 occurs with probability ||β||2 . Since the state of a qubit
was described by a unit vector, these probabilities sum to 1.
We now discuss the case of a complex system. For simplicity, we only consider a
two-qubit system. Assume the state of our system is given by the following vector
If the first qubit is measured, then with probability ||α0 ||2 + ||α1 ||2 the measurement
result is 0 and the post-measurement state is
α0 α1
√ |00⟩ + √ |01⟩,
2
||α0 || + ||α1 ||2 ||α0 ||2 + ||α1 ||2
while with probability ||α2 ||2 + ||α3 ||2 the measurement result is 1 and the post-
measurement state is
α2 α3
√ |10⟩ + √ |11⟩.
||α2 ||2 + ||α3 ||2 ||α2 ||2 + ||α3 ||2
Note that the linear combinations have been renormalized to ensure that the resulting
states are described by unit vectors.
17
No-cloning
• measure qubits.
The execution of a program in this model proceeds as follows. The source code of the
program resides on the classical device where it is compiled into an executable. When
the program is executed on the classical device, it can communicate with the quantum
device if required. Through this communication, it can instruct the quantum device
18
Instructions
Classical Quantum
Measurement results
Quantum circuits
While the QRAM model of quantum computation describes the overall architecture of
a quantum computer, quantum circuits are a language to express (parts of) quantum
algorithms. In particular, one can think of a quantum circuit as the description of a
sequence of operations that, in the QRAM model, the classical device would send to
its quantum counterpart.
In the quantum circuit model, a quantum computation is thought of as a sequence
of unitary gates applied to an array of qubits, followed by a measurement of some or
all of the qubits. The sequence of unitary operations are arranged in the form of a
circuit, akin to the classical boolean circuits.
The identity matrix on n qubits, i.e., the identity matrix of dimension 2n , is
represented by n distinct wires. For example, the identity on 3 qubits is represented
by
.
A non-identity unitary U acting on n qubits is depicted as a box, labelled U , with n
input wires and n output wires. For example, the Hadamard matrix H is represented
19
as
H .
Because of the similarities between quantum circuits and classical boolean circuits,
we sometimes refer to a unitary U as a quantum gate.
The graphical representation of the composition U V , of two unitary matrices U
and V acting on n qubits, is obtained by horizontally concatenating the gates for U
and V . That is, by connecting the output wires of the gate for V to the input wires
of the gate for U , as illustrated below in the case of matrices on 4 qubits.
V U
.
V .
Now let S be a set of unitary matrices and write S † for the set {U † ; U ∈ S}. A
circuit over S is constructed using the gates of S ∪ S † , as well as arbitrary identity
gates, using the graphical representations for composition and tensor product. For
example, a circuit over S = {U, V, W }, where U acts on 2 qubits and V and W both
act on 3 qubits, is represented below
U U†
V W V†
.
Note that C could have alternatively been interpreted as the unitary (I2 ◦H)⊗(H ◦X).
However, both interpretations coincide since (I2 ◦ H) ⊗ (H ◦ X) = (I2 ⊗ H) ◦ (H ⊗ X).
This is due to the so-called bifunctoriality of ⊗, which guarantees in particular that
(U ◦ U ′ ) ⊗ (V ◦ V ′ ) = (U ⊗ V ) ◦ (U ′ ⊗ V ′ )
3.1.1 Extensions of Z
Definition 3.1.1 (Extensions of Z). We are interested in the following four ring
extensions of Z.
21
22
√
• The ring Z[ 2] of quadratic integers with radicand 2.
√
• The ring Z[ω] of cyclotomic integers of degree 8, where ω = eiπ/4 = (1 + i)/ 2.
√
We note that since i = ω 2 and 2 = ω−ω 3 , we have the inclusions Z ⊆ Z[i] ⊆ Z[ω]
√ √
and Z ⊆ Z[ 2] ⊆ Z[ω]. Moreover, one can show that Z[ 2] and Z[ω] are dense in
R and C respectively. The rings introduced in Definition 3.1.1 are rings of algebraic
integers. Indeed we have
√
Z = OQ , Z[i] = OQ(i) , Z[ 2] = OQ(√2) , and Z[ω] = OQ(ω) .
√
Explicit expressions for the elements of Z[i], Z[ 2], and Z[ω] are given below.
Note that there is a bijection between Z[i] and Z2 . As the following proposition shows,
√ √
there is also a bijection between Z[ω] and and two disjoint copies of Z[ 2] × Z[ 2].
Proof. The right-to-left implication is trivial. For the left-to-right implication, let
1+i
α = a + bω + cω 2 + dω 3 , where a, b, c, d ∈ Z. Noting that ω = √ ,
2
we have
b − d√ b + d√
α = (a + 2) + (c + 2)i.
2 2
√
If b − d (and therefore b + d) is even, then α is of the first form, with a0 = a + b−d
2
2
√
and a1 = c + b+d2
2. If b − d (and therefore b + d) is odd, then α is of the second
√ √
form, with a0 = a + b−d−1
2
2 and a1 = c + b+d−1
2
2.
We close this subsection with the definition of two algebraic integers which will
be useful in chapters 5, 6, and 7.
√
Definition 3.1.3. The algebraic integers λ ∈ Z[ 2] and δ ∈ Z[ω] are defined as
follows
√
• λ=1+ 2 and
• δ = 1 + ω.
23
3.1.2 Automorphisms
(a0 + a1 ω + a2 ω 2 + a3 ω 3 )• = a0 − a1 ω + a2 ω 2 − a3 ω 3 .
•
The remaining two automorphisms of Z[ω] are the identity as well as (−)• † = (−)† .
√
The rings Z[i] and Z[ 2] both have two automorphisms, while Z has exactly one.
All of these are obtained by restricting the automorphisms of Z[ω]. Because (−)† acts
√ √
trivially on Z[ 2], the only non-identity automorphism of Z[ 2] is (−)• . Explicitly,
√ √ √
the action of (−)• on an element of Z[ 2] is given by (a + b 2)• = a − b 2. Similarly,
the only non-identity automorphism of Z[i] is (−)† , whose action is explicitly given
by (a + bi)† = a − bi. The ring Z has no non-trivial automorphism.
√
We note that for t ∈ Z[ω], we have t ∈ Z[ 2] iff t = t† , t ∈ Z[i] iff t = t• , and
t ∈ Z iff t = t† and t = t• .
3.1.3 Norms
√
Let R be one of the rings Z, Z[i], Z[ 2], or Z[ω]. We define the norm NR (α) of an
element α ∈ R to be
∏
NR (α) = σ(α),
σ
• If α ∈ Z, then NZ (α) = α.
• If α = a0 + a1 ω + a2 ω 2 + a3 ω 3 ∈ Z[ω], then
•
NZ[ω] (α) = α† α† α• α = (a20 + a21 + a22 + a23 )2 − 2(a3 a2 + a2 a1 + a1 a0 − a3 a0 )2 .
All the norms introduced in Definition 3.1.4 are multiplicative and integer valued.
This means that NR (αβ) = NR (α)NR (β) and NR (α) ∈ Z. The norms NZ[ω] and NZ[i]
are moreover valued in the non-negative integers. Finally, we have NR (α) = 0 iff
α = 0 and NR (α) is a unit if and only if α is a unit, that is, an invertible element.
√
Remark 3.1.5. If α and β are two distinct elements of Z[ 2], then the following
inequality holds:
|α − β| · |α• − β • | > 1, (3.1)
This follows from the fact that |α−β|·|α• −β • | = |NZ[√2] (α−β)|. The same inequality
holds for α, β ∈ Z[ω].
Euclidean domain is also a unique factorization domain, which means that every non-
zero non-unit element of the ring can be factored into primes in an essentially unique
way.
Problem 3.2.3 (Relative norm equation over Z[i]). Given β ∈ Z, find α ∈ Z[i] such
that α† α = β.
√
Problem 3.2.4 (Relative norm equation over Z[ω]). Given β ∈ Z[ 2], find α ∈ Z[ω]
such that α† α = β.
Solving Problem 3.2.3 amounts to finding α ∈ Z[i] such that NZ[i] (α) = β. The
equation to be solved is therefore a norm equation. In Problem 3.2.4, however, α† α ̸=
NZ[ω] (α). In this case, we do not consider all the automorphic images of α. Instead,
we consider the automorphic images of α under the automorphisms of Z[ω] that fix
√
Z[ 2]. For this reason the equation in Problem 3.2.4 is a relative norm equation. For
uniformity, we refer to both equations as relative norm equations.
A Diophantine equation is a polynomial equation in integer variables. By writing
α = a + bi with a, b ∈ Z, Problem 3.2.3 becomes equivalent to the Diophantine
equation
a2 + b2 = β.
√
Similarly, by writing α = a + bω + cω 2 + dω 3 and β = a′ + b′ 2 with a, a′ , b, b′ , c, d ∈ Z,
Problem 3.2.4 becomes equivalent to the system of Diophantine equations
a2 + b2 + c2 + d2 = a′
ab − ad + cb + cd = b′ .
In light of these equivalences, we sometimes abuse terminology and refer to the equa-
tions of problems 3.2.3 and 3.2.4 as Diophantine equations.
Remark 3.2.5. Problems 3.2.3 and 3.2.4 are computational problems. This means that
a solution to either of these problems is an algorithm which decides whether the given
26
equation has a solution and produces a solution if one exists. The algorithms solving
problems 3.2.3 and 3.2.4 that we consider here are probabilistic in the sense that they
make certain choices at random. We evaluate the time-complexity of an algorithm
by estimating the number of arithmetic operations it requires to solve one the above
problems. By arithmetic operations, we mean addition, subtraction, multiplication,
division, exponentiation, and logarithm. When we say that an algorithm runs in
probabilistic polynomial time, we mean that the algorithm is probabilistic, requires
a polynomial number of expected arithmetic operations to solve the given problem,
and produces a correct solution with probability greater than 1/2.
Since α† α > 0, a necessary condition for Problem 3.2.3 to have a solution is β > 0.
Similarly, necessary conditions for Problem 3.2.4 to have a solution are β > 0 and
β • > 0. This follows from the fact that α† α = β implies (α• )† (α• ) = β • . There are
also sufficient conditions for the above relative norm equations to have solutions.
Proposition 3.2.6. Let β ∈ Z be such that β > 0. If β is prime and β ≡ 1 (mod 4),
then the equation α† α = β has a solution.
√
Proposition 3.2.7. Let β ∈ Z[ 2] be such that β > 0 and β • > 0 and let n = β • β ∈
Z. If n is prime and n ≡ 1 (mod 8), then the equation α† α = β has a solution.
We close this chapter by stating that there are solutions to problems 3.2.3 and
3.2.4.
In this chapter, we introduce the untyped lambda calculus as well as various typed
lambda calculi, including the quantum lambda calculus. The standard reference for
the untyped lambda calculus is [4]. For typed lambda calculi, see [24]. For the
quantum lambda calculus, see [64], [61], or [58].
Definition 4.1.1. The concrete terms of the untyped lambda calculus are defined
by
a, b ::= x (λx.a) (ab)
In Definition 4.1.1, concrete terms are given in the so-called Backus-Naur Form.
This notation should be interpreted as defining the collection L of all concrete terms
as the smallest set of words on the alphabet V ∪ {(, ), λ, .} such that
• V ⊆ L,
• if a, b ∈ L, then (ab) ∈ L.
A concrete term of the form (λx.a) is called a lambda abstraction and we say
that a is the body of the abstraction. A concrete term of the form (ab) is called an
application. The operations of lambda abstraction and application are called term
forming operations.
27
28
• the body of a lambda abstraction extends as far to the right as possible, and
This implies, for example, that the term (λx.(λy.((xy)x))) will be written λxy.xyx.
The intended interpretation of concrete terms is as follows. The lambda abstrac-
tion λx.a represents the function defined by the rule x ↦→ a. The application ab
represents the application of the function a to the argument b.
As a first example, consider the identity function. Since it acts as x ↦→ x, its
representation as a concrete term should be λx.x. The application of the identity
function to some input a is written as (λx.x)a. As a second example, consider the
function that acts as x ↦→ (y ↦→ x). This function inputs x and outputs the constant
function to x. Its representation as a concrete term is λxy.x.
4.1.2 Reduction
We now define the operational semantics of the terms of the untyped lambda calculus.
That is, we attribute meaning to the terms by specifying their behavior.
For the concrete term λx.x to be an acceptable representative for the identity
function, it should “behave” accordingly, i.e., the concrete term (λx.x)a should reduce
to a. One way to achieve this is to define the reduction relation by
where b[a/x] stands for the substitution of a for every occurrence of x in b. Under
this definition of the reduction relation we have (λx.x)a → a, as intended.
Now consider the concrete term λxy.x. Under the interpretation of terms given
above, it represents the function x ↦→ (y ↦→ x). If we apply this concrete term to x′ y ′ ,
then (4.1) yields the expected result
However, if we apply λxy.x to the variable y and reduce according to (4.1) again, we
get
(λxy.x)y → (λy.x)[y/x] = λy.y.
This is unsatisfactory because the concrete term λy.y represents the identity function,
not the constant function to y. The way around this problem is to start by renaming
λxy.x to, say, λxz.x. Under this renaming, the reduction of (4.1) would produce the
concrete term λz.y, representing a constant function to y. We therefore need to define
a substitution method that appropriately renames variables.
Definition 4.1.2. Let x and y be two variables and a be a concrete term. The
renaming of x by y in a, written a{y/x}, is defined as
• x{y/x} = y,
• z{y/x} = z if x ̸= z,
• ab{y/x} = (a{y/x})(b{y/x}),
• λz.a{y/x} = λz.(a{y/x}) if x ̸= z.
Definition 4.1.3. The set of free variables of a concrete term a, written FV(a), is
defined as
• FV(x) = {x},
Any variable that appears in a but does not belong to FV(a) is said to be bound. For
this reason, we call λ a binder.
In the terminology of Definition 4.1.3, the problem with the relation defined by
(4.1) is that the variable y is free on the left of → but bound on the right. The
variable y is said to have been captured in the course of the reduction. Hence, we
introduce a capture-avoiding notion of substitution.
Definition 4.1.5. Let x be a variable, and a and b be two concrete terms. The
substitution of b for x in a, written a[b/x], is defined as
• if a = x, then a[b/x] = b,
Remark 4.1.6. The last clause of Definition 4.1.5 is slightly ambiguous. Indeed, the
variable z is not specified, but only required to belong to V \ (FV(b) ∪ FV(c)). We
say of such a z that it is fresh with respect to b and c. To be more rigorous, we
should require the set V to be well-ordered and choose z to be the least element of
V \ (FV(b) ∪ FV(c)). Since this ambiguity will be lifted below when we move from
concrete terms to abstract ones, we leave the definition unchanged.
To formally define the reduction relation, we start by identifying the strings, within
a concrete term, that will give rise to a reduction. As one might expect, a reduction
will take place whenever a function is applied to an argument.
a → a′ b → b′ a → a′ .
(λx.a)b → a[b/x] ab → a′ b ab → ab′ λx.a → λx.a′
Remark 4.1.9. In Definition 4.1.8, is defined as the reflexive and transitive closure
of →. This defines as the smallest relation containing → that is reflexive and
transitive.
With the reduction of concrete terms now defined, we can confirm that the con-
crete terms λx.x and λxy.x behave as expected since for any concrete term a we
have
(λx.x)a → a and (λxy.x)a → λz.a
where z ∈
/ FV(a) ∪ {x}.
As noted in Remark 4.1.6, the reduction (λxy.x)a → λz.a depends on the choice of
an ordering of the set V, since z is the least element of V \ (FV(a) ∪ {x}). Thus, two
different orderings of V will yield two different concrete terms λz.a and λz ′ .a. This
difference, however, is inessential since both terms define the same function L → L
because z, z ′ ∈
/ FV(a). The same inessential difference occurs between the concrete
terms λz.z and λz ′ .z ′ . To remove this distinction, we define an equivalence relation
=α on L that equates the concrete terms differing only in the name of their bound
variables. The idea behind this equivalence is that in the concrete term λx.a, the
occurrences of the variable x in a are place holders, rather than variables possessing
an intrinsic identity. They can therefore be renamed without affecting the overall
meaning of the concrete term.
where y ∈
/ a means that y does not appear in a.
Definition 4.1.11. The abstract terms of the untyped lambda calculus are the ele-
ments of L/=α . We write Λ for the set of all abstract terms.
If two concrete terms a and b are α-equivalent, then they have the same structure
(i.e., a is an application if and only if b is an application, and so on). For this reason,
32
we keep writing x, ab, and λx.a for abstract terms even though we are dealing with
equivalence classes of concrete terms.
When defining a function or a relation on abstract terms using the underlying
concrete terms, we should make sure that this function or relation is well-defined.
For example, if we define a function F on abstract terms in this way, then we should
verify that a =α b implies F (a) = F (b). One can check that the notions of free
variable, capture-avoiding substitution and β-reduction are well-defined on abstract
terms. In these cases, and in what follows, we generally overlook this obligation and
omit the proofs of well-definedness.
Because from now on we will always be manipulating abstract terms, we refer to
these as terms for brevity.
A term a may have any number of redexes. If a has no redexes, then the compu-
tation of a is finished.
Definition 4.1.13. A term that does not contain any redexes is reduced or in normal
form. If b is reduced and a b we say that b is a normal form for a.
For example, a variable x is reduced. Similarly, the terms λx.x and λxy.x are both
reduced. The following term, on the other hand, is not reduced, since it contains two
redexes
(λx.x)((λy.z)x′ ).
When reducing such a term, nothing in the definition of the β-reduction tells us which
redex to reduce first. We say that the β-reduction is non-deterministic.
Proposition 4.1.14 was first established by Church and Rosser in [11] and is there-
fore known as the Church-Rosser property. It is also referred to as the confluence
property of the β-reduction. Confluence guarantees that, despite the non-determinism
of the reduction, normal forms are unique.
The uniqueness of normal forms implies that the lambda calculus is consistent in
the sense that not all terms are equated by the β-reduction.
Corollary 4.1.16. The untyped lambda calculus is consistent, i.e., there exists two
terms a and b such that a ̸≡β b, where ≡β denotes the reflexive, symmetric, and
transitive closure of →.
4.2.1 Terms
The language of the simply typed lambda calculus is an extension of the language of
the untyped lambda calculus.
Definition 4.2.1. The terms of the simply typed lambda calculus are defined by
Definition 4.2.1 extends the language of the untyped lambda calculus by adding
the constant ∗ as well as two new term forming operations. The intended meaning of
these new terms is as follows.
34
• let ⟨x, y⟩ = a in b is a term that will reduce a and in case a ⟨b1 , b2 ⟩ will
assign b1 to x and b2 to y.
We extend the notion of free-variables of a term to account for the new term
forming operations.
Definition 4.2.2. The set of free variables of a term a of the simply typed lambda
calculus, written FV(a), is defined as
• FV(x) = {x},
• FV(∗) = ∅,
To account for the new term forming operations of our extended language, we intro-
duce additional reduction rules.
35
Figure 4.1: Additional reduction rules for the simply typed lambda calculus.
4.2.3 Types
Definition 4.2.4. The types of the simply typed lambda calculus are defined by
A, B ::= X (A × B) 1 (A → B)
(ax)
Γ, x : A ⊢ x : A
Γ, x : A ⊢ b : B
(λ) Γ ⊢ c : A → B Γ ⊢ a : A (app)
Γ ⊢ λx.b : A → B Γ ⊢ ca : B
(∗ ) Γ ⊢ b : 1 Γ ⊢ a : A (∗ )
Γ ⊢ ∗ : 1 i Γ ⊢ let ∗ = b in a : A e
Γ ⊢ a : A Γ ⊢ b : B (× ) Γ ⊢ b : (B1 × B2 ) Γ, x : B1 , y : B2 ⊢ a : A (× )
i e
Γ ⊢ ⟨a, b⟩ : A × B Γ ⊢ let ⟨x, y⟩ = b in a : A
Figure 4.2: Typing rules for the simply typed lambda calculus.
Γ⊢a:A
Definition 4.2.7. A typing judgment is valid if it can be inferred from the rules
given in Figure 4.2.
x : X, y : Y ⊢ x : X
x:X⊢x:X x : X ⊢ λy.x : Y → X
⊢ λx.x : X → X ⊢ λxy.x : X → (Y → X)
The term xx, however, is not well-typed. Indeed, suppose a typing derivation π
of Γ ⊢ xx : B exists. Then the last rule of π must be the (app) rule, since this rule
is the only one allowing the construction of an application. Moreover, the only rule
permitting the introduction of a variable is the (ax) rule. The typing derivation π
37
Γ, x : A → B ⊢ x : A → B Γ, x : A ⊢ x : A .
Γ ⊢ xx : B
But there are no types A and B such that A = A → B. Hence there is no typing
derivation of Γ ⊢ xx : B.
The type system of the simply typed lambda calculus restricts the construction of
terms in order to syntactically rule out “ill-behaved” terms. To verify that the type
system achieves this intended goal, we need to prove that all well-typed terms “behave
well”. This intuitive idea is captured by establishing the type safety of the language.
Following [17], we consider that a language is type safe if it enjoys the subject reduction
and progress properties. The latter property relies on a notion of value. These values
are a particular set of distinguished normal forms. The definition of value varies from
language to language. For now, we can take the set of values to consist of all normal
forms. Later, when we consider specific languages, this definition will be adjusted
and explicitly stated.
Subject reduction: This property guarantees that the type of a term is stable under
reduction. As a corollary, it also shows that if a term is well-typed, then it never
reduces to an ill-typed term.
Progress: This property shows that a well-typed closed term is either a value or
admits further reductions.
The simply typed lambda calculus is type safe as it enjoys both of the above
properties.
The simply typed lambda calculus also enjoys a property known as strong nor-
malization.
38
Note that any strongly normalizing term is also weakly normalizing. Variables
are examples of strongly normalizing terms. As an example of a term that is neither
strongly nor weakly normalizing, consider ΩΩ, where Ω is the term λx.xx. ΩΩ is
neither weakly nor strongly normalizing since we have
4.3 Linearity
We now sketch a version of Girard’s intuitionistic linear logic ([23]). As we shall see
in the next section the use of linear logic in the context of quantum computation is
motivated by the no-cloning property of quantum information.
Informally, a variable is used linearly if it is used exactly once. In the simply typed
lambda calculus, variables can be used non-linearly. As a first example, consider the
following typing derivation.
x:A⊢x:A x:A⊢x:A
x : A ⊢ ⟨x, x⟩ : A × A
39
In the above derivation the variable x is used non-linearly, in the sense that only a
single occurrence of x in the context is required to construct the pair ⟨x, x⟩ in which x
occurs twice. This is possible because the two occurrences of the declaration x : A in
the leaves of the typing derivation were implicitly contracted by the application of the
(×i ) rule. As another example, note that the typing judgement x : A, y : B ⊢ y : B
is valid by the (ax) rule. In this case, the variable x is handled non-linearly because
it appears in the context but is not used at all. This second kind of non-linearity is
due to the implicit weakening of the context in the (ax) rule.
It is possible to modify the typing rules of the simply typed lambda calculus to
force variables to be used in a strictly linear fashion. To obtain such a system, we
can replace the (ax) and (∗i ) rules with
.
x:A⊢x:A and ⊢∗:1
In the above rules, the typing contexts are minimal, which guarantees that no implicit
weakening can occur. To forbid implicit contractions we need to ensure that contexts
are not merged but juxtaposed in binary rules. This can be achieved in the case of
the (×i ) rule as follows.
Γ1 ⊢ a : A Γ2 ⊢ b : B
Γ1 , Γ2 ⊢ ⟨a, b⟩ : A × B
The above rule carries the side condition that the contexts Γ1 and Γ2 are distinct, so
that the notation Γ1 , Γ2 denotes the disjoint union of the two contexts.
If contexts are removed from all nullary rules and juxtaposed rather than merged
in all binary rules, then we obtain a strictly linear system. In this system, a variable
occurs in the context of a valid typing judgement if and only if it appears exactly
once in the term being typed.
The restrictions imposed by the strictly linear type system sketched above are very
strong. Our interest in Girard’s linear logic is the fact that it allows us to reintroduce
a controlled form of non-linearity. The idea is to use a modality called bang and
denoted ! to identify the variables that can be used non-linearly. To this end, we
extend the grammar of types as follows.
A, B ::= X 1 (A × B) (A → B) !A
40
The new type !A consists of all the elements of the type A that can be used non-
linearly. One can think of the elements of type !A as those elements of A that have
the property of being reusable or duplicable.
We can modify the typing rules to account for this new modality. For example,
the (×i ) rule becomes
!∆, Γ1 ⊢ a : A !∆, Γ2 ⊢ b : B .
!∆, Γ1 , Γ2 ⊢ ⟨a, b⟩ : A × B
where the context !∆ denotes a set of declarations of the form x1 : !A1 , . . . xn : !An . In
this new rule, the contracted part of the context consists exclusively of declarations
of the form x : !A. This ensures that the only variables that are used non-linearly are
the ones of a non-linear type.
It should be possible to use a duplicable variable only once. In other words, if a
variable x is declared of type !A, it should also have type A. One way to achieve this
is to equip the type system with a subtyping relation, denoted <:, satisfying !A <: A
for every type A.
Various lambda calculi for quantum computation have appeared in the literature
(e.g., [63], [3]). Here, we focus on the quantum lambda calculus (see [64], [61], or [58])
as it is the main inspiration for the Proto-Quipper language defined and studied in
chapters 8 and 9.
The quantum lambda calculus is based on the QRAM model of quantum com-
putation described in Section 2.2.4. To embody the QRAM model, the reduction
relation of the quantum lambda calculus is defined on closures. These closures are
triples [Q, L, a] where Q is a unit vector in ni=1 C2 for some integer n, L is a list of
⨂
4.4.1 Terms
Definition 4.4.1. The terms of the quantum lambda calculus are defined by
a, b, c ::= x u λx.a ab ⟨a, b⟩ ∗
let ⟨x, y⟩ = a in b let rec x y = b in c
injl(a) injr(a) match a with (x ↦→ b | y ↦→ c)
where u comes from a set U of quantum constants and x, y come from a countable
set V of variables.
• The term new represents an initialization function. It inputs a bit (i.e., one of 0
or 1 as defined above) and produces a qubit in the corresponding classical state
(i.e., |1⟩ or |0⟩ respectively).
• The term meas represents a measurement function. It inputs a qubit and mea-
sures it in the computational basis, returning the corresponding bit.
Assume that U contains a constant H representing the Hadamard gate and con-
sider the term coin defined as
This term represents a “fair coin”. When applied to any argument, it will prepare a
qubit in the state |0⟩ and apply a Hadamard gate to it. This results in the superpo-
sition
|0⟩ + |1⟩
√ .
2
The qubit is then measured, which results in 0 or 1 with equal probability.
42
In the quantum lambda calculus, one must choose a reduction strategy. To see why
this is the case, assume that bplus is a term from the quantum lambda calculus
representing addition modulo 2 and consider the following term
The term a has two redexes. If the outer redex is reduced first, we obtain the term
bplus ⟨(coin ∗), (coin ∗)⟩, which will reduce to 0 or 1 with equal probability. How-
ever, if we evaluate (coin ∗) first, then a reduces to
with equal probability. Either way, the final result of computation will be 0. This ex-
ample shows that confluence fails in the quantum lambda calculus, forcing us to choose
an order of evaluation. In the quantum lambda calculus, evaluation of terms follows
a call-by-value reduction strategy. In particular, this means that when evaluating an
application we reduce the argument before applying the function. To determine when
a term is reduced, we define a notion of value.
Definition 4.4.2. The values of the quantum lambda calculus are defined by
n
• Q is a normalized vector of C2 for some n > 0 called a quantum array,
The rules are separated in three groups. The first group contains the congruence
rules. In particular, the rules for the reduction of an application can be seen to define
a call-by-value reduction strategy. The second group of rules contains the classical
rules. These rules define the reduction of redexes that do not involve any of the
constants from the set U . The last group of rules contains the quantum rules. These
rules define the interaction between the classical device and the quantum device. In
the first quantum rule, we have Q′ = u(Q). This rule corresponds to the application
of the unitary u to the relevant qubits. Note that the only probabilistic reduction
step is the one corresponding to measurement.
The chosen reduction strategy guarantees that, at every step of a reduction, only
one rule applies. Hence, unlike the untyped lambda calculus, the quantum lambda
calculus is deterministic.
Proposition 4.4.5. If [Q, L, a] is a closure, then at most one reduction rule applies
to it.
4.4.3 Types
Definition 4.4.6. The types of the quantum lambda calculus are defined by
The type system of the quantum lambda calculus is based on intuitionistic linear
logic as sketched in Section 4.3. The notation is adopted from linear logic, with A⊗B
for the type of pairs, A⊕B for the type of sums, and A ( B for the type of functions.
The type qubit represents the set of all 1-qubit states. As in Section 4.3, the type
!A can be understood as the subset of A consisting of values that have the additional
property of being duplicable or reusable. We will sometimes write !n A, with n ∈ N,
to mean
!.
. .! A.
n
A ⊗ ... ⊗ A.
n
45
Definition 4.4.7. The subtyping relation <: is the smallest relation on types satis-
fying the rules given in Figure 4.4.
To define the type system of the quantum lambda calculus, we first introduce
axioms for the elements of the set U .
Definition 4.4.9. We introduce a type for the constants of U . For new and meas we
set
Anew = bit ( qubit, Ameas = qubit ( !bit,
Av = qubit⊗n ( qubit⊗n .
There are two rules for the construction of a lambda abstraction. The rule (λ1 ) is
similar to the (λ) rule of the simply typed lambda calculus. However, the produced
function is not duplicable. In contrast, the rule (λ2 ) produces a duplicable function.
The main difference is that in the (λ2 ) rule, the free variables that appear in b must
46
all be of a duplicable type. This prevents b from having any embedded quantum data,
which could not be cloned. Note that the type system prevents us from assigning the
type qubit ( qubit ⊗ qubit to the term λx.⟨x, x⟩.
[Q, L, a] : A,
x1 : qubit, . . . , xn : qubit ⊢ a : A
The quantum lambda calculus is a type safe language, in the sense that it enjoys
the subject reduction and progress properties.
47
[Q, L, a] →p [Q′ , L′ , a′ ],
Proposition 4.4.13. Let [Q, L, a] be a valid typed closure of type A. Then either
[Q, L, a] is a value, or there is a valid typed closure [Q′ , L′ , a′ ] such that [Q, L, a] →p
[Q′ , L′ , a′ ]. Moreover, the total probability of all possible one-step reductions from
[Q, L, a] is 1.
Chapter 5
Grid problems
In this chapter, we present an efficient method to solve a type of lattice point enumer-
ation problem which we call a grid problem. As a first approximation, a grid problem
can be thought of as follows: given a discrete subset L ⊆ R2 (such as a lattice), which
we call the grid, and a bounded convex subset A ⊆ R2 with non-empty interior, enu-
merate all the points u ∈ A ∩ L. Specifically, we will be interested in grid problems
for which L is a subset of Z[i] or of Z[ω], as defined in Chapter 3. We refer to the
first kind of problem as a grid problem over Z[i] and to the second kind of problem
as a grid problem over Z[ω]. As we shall see in chapters 6 and 7, these problems have
applications in quantum computation. However, they are treated here independently
of any quantum considerations. The results contained in this chapter first appeared
in [54] and [56].
We note that the method presented here is not the only method for solving grid
problems. Alternatively, grid problems over Z[i] or Z[ω] can be reduced to so-called
integer programming problems in some fixed dimension which can be efficiently solved
using the techniques pioneered by Lenstra in [45]. Nevertheless, we believe our method
is novel and interesting.
Even though grid problems over Z[i] are significantly simpler than grid problems
over Z[ω], the overall method remains the same. For this reason, the case of Z[i],
which is treated first, is used as an introduction to the case of Z[ω], which is treated
second.
Let R be one of Z[i] or Z[ω]. As in Chapter 3, we quantify the complexity of our
methods by estimating the number of arithmetic operations required to produce an
element u ∈ A ∩ L, for L ⊆ R. Our algorithms will input bounded convex subsets
A ⊆ R2 (as well as closed intervals [x0 , x1 ] ⊆ R). If we were to give a rigorous
complexity-theoretic account, we should indicate what it means for a subset A of R2
to be “given” as the input to an algorithm. The details of this do not matter much.
48
49
For our purposes, it will suffice to assume that a convex set is given along with the
following information.
• A convex polygon enclosing A, say with rational vertices, and such that the
area of the polygon exceeds that of A by at most a fixed constant factor;
Recall from Chapter 3 that the elements of Z[i] are of the form a + bi, with a and b
in Z. We can therefore identify Z[i] with the set Z2 ⊆ R2 . When viewed in this way,
we refer to Z[i] as the grid and to elements u ∈ Z[i] as grid points.
Problem 5.1.1 (Grid problem over Z[i]). Given a bounded convex subset A of R2
with non-empty interior, enumerate all the points u ∈ A ∩ Z[i].
A point u ∈ A ∩ Z[i] is called a solution to the grid problem over Z[i] for A.
Figure 5.1 (a) illustrates a grid problem for which A is a disk centered at the origin.
The grid is shown as black dots and the set A is shown in red.
We first consider grid problems over Z[i] for which A is an upright rectangle, i.e., of
the form [x1 , x2 ] × [y1 , y2 ]. These instances are easily solved, as they can be reduced
to a problem in a lower dimension. Indeed, it suffices to independently solve the grid
problem in the x-axis (i.e., by enumerating the integers in [x1 , x2 ]) and in the y-axis
(i.e. by enumerating the integers in interval [y1 , y2 ]), as illustrated in Figure 5.1 (b).
4 4
(a) 3 (b) 3
A
2 2
1 1
A
0 0
−4 −3 −2 −1 0 1 2 3 4 −4 −3 −2 −1 0 1 2 3 4
−1 −1
−2 −2
−3 −3
−4 −4
Figure 5.1: (a) A grid problem over Z[i] for which A is a disk of radius 1.5 centered at
the origin. (b) A grid problem over Z[i] for which A is an upright rectangle, together
with the projections of A along the x- and y-axes.
We now generalize the method of the previous subsection to convex sets that are close
to upright rectangles in a suitable sense.
Proof. By Proposition 5.1.2, we can efficiently enumerate the solutions of the grid
problem for BBox(A). For each such candidate solution u, we only need to check
51
3
A1
2
A2
1
0
−4 −3 −2 −1 0 1 2 3 4
−1
−2
A3
−3
−4
Figure 5.2: Grid problems over Z[i] for upright and non-upright sets.
Figure 5.2 shows three different examples of grid problems over Z[i]. The sets Ai
are again shown in red, for i = 1, 2, 3, and their bounding boxes are shown in outline.
The typical case of an upright set is A1 . Here, a fixed proportion of grid points from
the bounding box of A1 are elements of A1 . The exceptional case of an upright set is
A2 . Its bounding box spans only two columns of the grid. Therefore, although the
bounding box contains many grid points, A2 does not. However, this case is easily
dealt with by solving the problem in a lower dimension for each of the grid columns
separately. Finally, the set A3 is not upright. In this case, Lemma 5.1.4 is not helpful,
and a priori, it could be a difficult problem to find grid points in A3 .
52
The method of the previous subsection can be further generalized by using certain
linear transformations to turn non-upright sets into upright sets. The linear trans-
formations that are useful for this purpose are special grid operators.
Remark 5.1.6. If A is a subset of R2 and G is a grid operator, then G(A), the direct
image of A, is defined as usual by G(A) = {G(v) ; v ∈ A}.
Remark 5.1.7. The interest in special grid operators lies in the fact that u is a solution
to the grid problem over Z[i] for A if and only if G(u) is a solution to the grid problem
over Z[i] for G(A).
5.1.4 Ellipses
Combining the results of the previous two subsections, we know that the grid problem
over Z[i] for A can be solved efficiently provided that we can find a operator G such
that G(A) is sufficiently upright. In this subsection, we show that if A is an ellipse,
then this can always be done.
Definition 5.1.8 (Ellipse). Let D be a positive definite real 2 × 2-matrix with non-
zero determinant, and let p ∈ R2 be a point. The ellipse defined by D and centered
at p is the set
E = {u ∈ R2 ; (u − p)† D(u − p) 6 1}.
The notion of uprightness introduced above was defined for an arbitrary bounded
convex subset of R2 . If the set in question is an ellipse, we can expand the definition
of uprightness into an explicit expression.
53
Proof. We can compute the area of E and the area of its bounding box using D.
√ √
Indeed, we have area(E) = π/ det(D) and area(BBox(E)) = 4 ad/ det(D). Sub-
stituting these in Definition 5.1.3, yields the desired expression for uprightness
√ BBox(E)
area(E) π det(D)
up(E) = = . E
area(BBox(E)) 4 ad
Remark 5.1.11. The uprightness of an ellipse is invariant under translation and scalar
multiplication.
Definition 5.1.12 (Skew). The skew of a matrix is the product of its anti-diagonal
entries. The skew of an ellipse defined by D is the skew of D.
By Proposition 5.1.10, the skew of an ellipse is small if and only if its uprightness
is large. Our strategy for increasing the uprightness will therefore be to reduce the
skew.
Proposition 5.1.13. Let E be an ellipse. There exists a grid operator G such that
G(E) is 1/2-upright. Moreover, if E is M -upright, then G can be efficiently computed
in O(log(1/M )) arithmetic operations.
that E is centered at the origin and that D has determinant 1. Suppose moreover
that the entries of D are as follows
[ ]
a b
.
b d
Note that D can be written in this form because it is symmetric. We first show
that there exists a grid operator G such that Skew(G(E)) 6 1. Indeed, assume that
Skew(E) = b2 > 1. In case a 6 d, choose n such that |na + b| 6 a/2. Then we have:
[ ]
· · · na + b
An† DAn = .
na + b ···
1, we have
π 1 π
M 6 up(E) = √ = √ .
4 ad 4 b2 + 1
Therefore Skew(E) = b2 6 (π 2 /16M 2 ) − 1, so that the computation of G requires
O(log(1/M )) arithmetic operations.
The final step in our solution of grid problems over Z[i] is to generalize Proposi-
tion 5.1.13 from ellipses to arbitrary bounded convex sets with non-empty interior.
This can be done because every such set A can be inscribed in an ellipse whose area
is not much greater than that of A, as stated in the following proposition, which was
proved in [56].
4π
area(E) 6 √ area(A). (5.1)
3 3
4π
Note that √
3 3
≈ 2.4184. We remark that the bound in Proposition 5.1.14 is sharp;
the bound is attained in case A is an equilateral triangle. In this case, the enclosing
4π
ellipse is a circle, and the ratio of the areas is exactly √ .
3 3
Proof. Given A, with an enclosing ellipse A′ whose area only exceeds that of A by a
fixed constant factor N , use Proposition 5.1.13 to find a grid operator G such that
G(A′ ) is 1/2-upright. Then, use Proposition 5.1.4 to enumerate the grid points of
G(A′ ). For each grid point u found, check whether it belongs to G(A). This is the
case if and only if G−1 (u) is a solution to the grid problem over Z[i] for A.
Remark 5.1.16. Note that the complexity of O(log(1/M )) overall operations in Propo-
sition 5.1.15 is exponentially better than the complexity of O(1/M ) per candidate we
obtained in Proposition 5.1.4. This improvement is entirely due to the use of grid
operators in Proposition 5.1.13.
We finish this subsection with some lower bounds on the number of solutions to
scaled grid problems.
√
Remark 5.1.18. If a bounded convex subset A ⊆ R2 contains a circle of radius 1/ 5k ,
√ √
then the grid problem over Z[i] for A and 2k 5ℓ has at least three solutions.
We now turn to grid problems where the lattice L is a subset of Z[ω]. Viewing C as
the real plane, we can consider the elements of Z[ω] as points in R2 . However, we
know from Chapter 3 that Z[ω] is dense in C and therefore does not form a lattice
in the plane. To circumvent this issue, we consider subsets of Z[ω] that arise as
the image, under the automorphism (−)• , of the intersection of Z[ω] and a bounded
convex set B ∈ R2 with non-empty interior. We use this notion of grid to formulate
grid problems over Z[ω].
Definition 5.2.1. Let B be a subset of R2 . The (complex) grid for B is the set
Remark 5.2.2. We will only be interested in the case where B is a bounded convex
set with non-empty interior. In this case, the grid is discrete and infinite. It is infinite
by the density of Z[ω]: there are infinitely many points u ∈ B ∩ Z[ω], and for each
of them, u• is a grid point. To see that it is discrete, recall from Remark 3.1.5 of
Chapter 3 that for u, v ∈ Z[ω] we have
|u − v| · |u• − v • | > 1.
58
(a) 4 (b) 4
3 3
2 2
1 1
B B
0 0
−4 −3 −2 −1 0 1 2 3 4 −4 −3 −2 −1 0 1 2 3 4
−1 −1
−2 −2
−3 −3
−4 −4
(c) 4
2
B
1
0
−4 −3 −2 −1 0 1 2 3 4
−1
−2
−3
−4
Figure 5.3: The complex grid for three different convex sets B. In each case, the set
B is shown in green and grid points are shown as black dots. (a) B = [−1, 1]2 . (b)
B = {(x, y) | x2 + y 2 6 2}. (c) B = {(x, y) | 6x2 + 16xy + 11y 2 6 2}.
Since the distance between points in B is bounded above, the distance between their
bullets is bounded below.
Figure 5.3 illustrates the complex grids for several different convex sets B. Note
that the grid has a 90-degree symmetry in (a), a 45-degree symmetry in (b), and a
180-degree symmetry in (c).
Problem 5.2.3 (Grid problem over Z[ω]). Given two bounded convex subsets A and
B of R2 with non-empty interior, enumerate all the points u ∈ A ∩ Grid(B).
59
(a) B
−8 −7 −6 −5 −4 −3 −2 −1 0 1 2 3 4 5 6 7 8
(b) B
−8 −7 −6 −5 −4 −3 −2 −1 0 1 2 3 4 5 6 7 8
Figure 5.4: The real grid for two different intervals B. In both cases, the interval B
is shown in green, and grid points are shown as black dots.
Alternatively, grid problems over Z[ω] can be understood as looking for points in
Z[ω] such that u ∈ A and u• ∈ B. We also refer to the conditions u ∈ A and u• ∈ B
as grid constraints. As before, an element u ∈ A ∩ Grid(B) is called a solution to the
grid problem over Z[ω] for A and B.
We solve grid problems over Z[ω] by reasoning as in the previous section. That
is, we first deal with the case of upright rectangles and then generalize our methods
to arbitrary convex sets using ellipses.
A grid problem over Z[i] for an upright rectangle A is solved by considering the x and
y coordinates of the problem independently. To extend this method to grid problems
over Z[ω], we define a one-dimensional analogue of Problem 5.2.3.
Definition 5.2.4. Let B be a subset of R. The (real) grid for B is the set
√
Grid(B) = {u ∈ Z[ 2] | u• ∈ B}. (5.3)
Remark 5.2.5. In the following, we will only be interested in the case where B is a
closed interval [y0 , y1 ] with y0 < y1 . In this case also the grid is discrete and infinite.
Figure 5.4 illustrates the grids for the intervals [−1, 1] and [−3, 3], respectively.
√
For example, the first few non-negative points in Grid([−1, 1]) are 0, 1, 1 + 2,
√ √ √ √
2 + 2, 2 + 2 2, 3 + 2 2, and 4 + 3 2. As one would expect, the grid for [−3, 3]
is about three times denser than that for [−1, 1]. We also note that B ⊆ B ′ implies
Grid(B) ⊆ Grid(B ′ ).
Problem 5.2.6 (One-dimensional grid problem). Given two sets of real numbers A
and B of R, enumerate all the points u ∈ A ∩ Grid(B).
60
Lemma 5.2.7. Let A = [x0 , x1 ] and B = [y0 , y1 ] be closed real intervals, such that
x1 − x0 = δ and y1 − y0 = ∆. If δ∆ < 1, then the one-dimensional grid problem for
√
A and B has at most one solution. If δ∆ > (1 + 2)2 , then the one-dimensional grid
problem for A and B has at least one solution.
Proposition 5.2.8. Let A = [x0 , x1 ] and B = [y0 , y1 ] be closed real intervals. There
is an algorithm which enumerates all solutions to the one-dimensional grid problem
for A and B. Moreover, the algorithm only requires a constant number of arithmetic
operations per solution produced.
Proof. It was already noted in [60, Lemma 17] that there is an efficient algorithm for
computing one solution. To see that we can efficiently enumerate all solutions, let
δ = x1 − x0 and ∆ = y1 − y0 as before. Recall from Definition 3.1.3 of Chapter 3 that
√
λ = 2 + 1 and that λ−1 = −λ• . The grid problem for the sets A and B is equivalent
to the grid problem for λ−1 A and −λB, because u ∈ A and u• ∈ B hold if and only
if λ−1 u ∈ λ−1 A and (λ−1 u)• ∈ −λB. Using such rescaling, we may without loss of
generality assume that λ−1 6 δ < 1.
√ √
Now consider any solution u = a + b 2 ∈ Z[ 2]. From u ∈ [x0 , x1 ], we know that
√ √
x0 − b 2 6 a 6 x1 − b 2. But since x1 − x0 < 1, it follows that for any b ∈ Z, there
√
is at most one a ∈ Z yielding a solution. Moreover, we note that b = (u − u• )/ 23 ,
√ √
so that any solution satisfies (x0 − y1 )/ 23 6 b 6 (x1 − y0 )/ 23 . The algorithm then
√ √
proceeds by enumerating all the integers b in the interval [(x0 −y1 )/ 23 , (x1 −y0 )/ 23 ].
√ √
For each such b, find the unique integer a (if any) in the interval [x0 − b 2, x1 − b 2].
√
Finally, check if a + b 2 is a solution. The runtime is governed by the number of
b ∈ Z that need to be checked, of which there are at most O(y1 − y0 ) = O(δ∆). As a
consequence of Lemma 5.2.7, the total number of solutions is at least Ω(δ∆), and so
the algorithm is efficient.
61
Recall, from Proposition 3.1.2 of Chapter 3, that Z[ω] can be seen as two disjoint
√ √
copies of Z[ 2]×Z[ 2]. We use this fact to reduce two dimensional grid problems over
Z[ω] for upright rectangles A and B to independent one-dimensional grid problems.
Now that we are able to solve grid problem over Z[ω] for upright rectangles A and
B, we can reason as in Subsection 5.1.2 to establish the following proposition.
We now adapt the notion of grid operator from Subsection 5.1.3 to the setting of grid
problems over Z[ω].
62
where x1 , x2 , y1 , y2 are integers and x2 ≡ y2 (mod 2). It can then be shown by com-
putation that every operator of the form (5.4) is a grid operator. For the converse,
consider an arbitrary grid operator G. We prove the claim by applying G to the three
points [ 10 ], [ 01 ], and √1 [ 1 ] ∈ Z[ω]. From G[ 10 ] ∈ Z[ω] and G[ 01 ] ∈ Z[ω], it follows that
2 1
the columns of G are of the form (5.5), so that G is of the form (5.4), with integers
a, b, c, d, a′ , b′ , c′ , d′ satisfying a′ ≡ c′ (mod 2) and b′ ≡ d′ (mod 2). Moreover, we have
⎡ ⎤
[ √ ] a′ +b′ a+b
+ 2
√
G 1/ √
1/ 2
2
= ⎣ ′2 ′ ⎦ ∈ Z[ω],
c +d c+d
2
+ √
2
Remark 5.2.13. The composition of two (special) grid operators is again a (special)
grid operator. If G is a special grid operator, then G is invertible and G−1 is a
special grid operator. If G is a (special) grid operator, then G• is a (special) grid
operator, defined by applying (−)• separately to each matrix entry, and satisfying
G• u• = (Gu)• .
63
(a) 4 (b) 4
3 3
2 2
A G(A)
1 1
B
G• (B)
0 0
−4 −3 −2 −1 0 1 2 3 4 −4 −3 −2 −1 0 1 2 3 4
−1 −1
−2 −2
−3 −3
−4 −4
Figure 5.5: (a) The grid problem over Z[ω] for two sets A and B. (b) The grid
problem over Z[ω] for G(A) and G• (B). Note that the solutions of (a), which are the
grid points in the set A, are in one-to-one correspondence with the solutions of (b),
which are the grid points in the set G(A).
Proposition 5.2.14. Let G be a special grid operator, and let A and B be subsets of
R2 . Define
G(A) = {Gu | u ∈ A},
G• (B) = {G• u | u ∈ B}.
Then u ∈ Z[ω] is a solution to the grid problem over Z[ω] for A and B if and only if
Gu is a solution to the grid problem over Z[ω] for G(A) and G• (B). In particular, the
grid problem over Z[ω] for A and B is computationally equivalent to that for G(A)
and G• (B).
Proof. Let u ∈ Z[ω]. Then u is a solution to the grid problem for A and B if and
only if u ∈ A and u• ∈ B, if and only if Gu ∈ G(A) and G• u• = (Gu)• ∈ G• (B), if
and only if Gu is a solution to the grid problem for G(A) and G• (B).
Figure 5.5(a) illustrates the grid problem for a pair of sets A and B. As before,
the set B is shown in green, and Grid(B) is shown as black dots. The set A is shown
in red, and the solutions to the grid problem are the seven grid points that lie in A.
64
Figure 5.5(b) shows the grid problem for the sets G(A) and G• (B), where G is the
special grid operator
[ √ ]
1 2
G= .
0 1
Note that, as predicted by Proposition 5.2.14, the solutions of the transformed grid
problem are in one-to-one correspondence with those of the original problem; namely,
in each case, there are seven solutions.
5.2.4 Ellipses
Proceeding as in Subsection 5.1.4 we now prove that if A and B are two ellipses, then
the grid problem for A and B over Z[ω] can be solved efficiently. For this, we show
that one can find a grid operator G such that G(A) and G• (B) are both sufficiently
upright. Indeed, we know from Proposition 5.2.10 that if both A and B are upright
sets, then the grid problem over Z[ω] for A and B can be solved efficiently. The fact
that two ellipses have to be made simultaneously upright make the problem of finding
an appropriate grid operator significantly more complicated.
We start by reformulating the problem in more convenient terms. Recall from
√
Definition 3.1.3 of Chapter 3 that λ = 2 + 1. The matrix D corresponding to an
ellipse E therefore has determinant 1 if and only if it can be written in the form
[ ]
eλ−z b
D= (5.6)
b eλz
π π
up(E) = 2
= √ . (5.7)
4e 4 b2 + 1
2 π2
b = − 1. (5.8)
16M 2
Since we now have to deal with pairs of ellipses, it is convenient to introduce the
following terminology for discussing pairs of matrices.
65
Note that the skew of a state is small if and only if both b2 and β 2 are small, which
happens, by (5.7), if and only if the ellipses corresponding to D and ∆ both have
large uprightness. So our strategy for increasing the uprightness will be to reduce the
skew, as in Subsection 5.1.4. In what follows, we use (D, ∆) to denote an arbitrary
state and always assume that the entries of D and ∆ are given as in (5.9). For future
reference, we record here another useful property of states.
Remark 5.2.16. If (D, ∆) is a state with b > 0, then −be 6 −b2 . Indeed:
Definition 5.2.17. The action of special grid operators on states is defined as follows.
Here, G† denotes the transpose of G, and G• is defined by applying (−)• separately
to each matrix entry, as in Remark 5.2.13.
Lemma 5.2.18. Let (D, ∆) be a state, and let A and B be the ellipses centered at the
origin that are defined by D and ∆, respectively. Then the ellipses G(A) and G• (B)
are defined by the matrices D′ and ∆′ , where
Proof. We have
G(A) = {G(u) ∈ R2 | u† Du 6 1}
= {v ∈ R2 | (G−1 v)† D(G−1 v) 6 1}
= {v ∈ R2 | v † (G−1 )† DG−1 v 6 1},
66
so the ellipse G(A) is defined by the positive operator D′ = (G−1 )† DG−1 . The proof
for G• (B) is similar.
The main ingredient in our proof that states can be made upright is the following
Step Lemma.
Lemma 5.2.19 (Step Lemma). For any state (D, ∆), if Skew(D, ∆) > 15, then
there exists a special grid operator G such that Skew((D, ∆) · G) 6 0.9 Skew(D, ∆).
Moreover, G can be computed using a constant number of arithmetic operations.
Before proving the Step Lemma, we show how it can be used to derive the following
proposition.
Proposition 5.2.20. Let A and B be ellipses. Then there exists a grid operator G
such that G(A) and G• (B) are 1/6-upright. Moreover, if A and B are M -upright,
then G can be efficiently computed in O(log(1/M )) arithmetic operations.
Proof. Let D and ∆ be the matrices defining A and B respectively, in the sense of
Definition 5.1.8. Since uprightness is invariant under translations and scaling, we may
without loss of generality assume that both ellipses are centered at the origin, and
that det D = det ∆ = 1.
The pair (D, ∆) is a state. By applying Lemma 5.2.19 repeatedly, we get grid
operators G1 , . . . , Gn such that:
Now let (D′ , ∆′ ) = (D, ∆) · G1 . . . Gn and set G = (G1 · · · Gn )−1 . By Lemma 5.2.18,
the ellipses G(A) and G• (B) are defined by the matrices D′ and ∆′ , respectively. Let
b and β be the anti-diagonal entries of the matrices D′ and ∆′ , respectively. We have:
π π
up(G(A)) = √ > √ > 1/6
2
4 b +1 4 16
π2 π2
log(Skew(D, ∆)) = log(b2 + β 2 ) 6 log(( − 1) + ( − 1)) = O(log(1/M )).
16M 2 16M 2
The remainder of this subsection is devoted to proving the Step Lemma. To each
state, we associate the pair (z, ζ). The proof of the Step Lemma is essentially a case
distinction on the location of the pair (z, ζ) in the plane. We find coverings of the plane
with the property that if the point (z, ζ) belongs to some region O of our covering,
then it is easy to compute a special grid operator G such that Skew((D, ∆) · G) 6
0.9 Skew(D, ∆). The relevant grid operators are given in Figure 5.6.
Each one of the next five subsections is dedicated to a particular region of the
plane.
In this section, we consider states (D, ∆) such that |Bias(D, ∆)| > 1. Any such state
can be “shifted” to a state (D′ , ∆′ ) of equal skew but with |Bias(D′ , ∆′ )| 6 1.
Even though σ and τ are not grid operators, we can use them to define an operation
on states called a shift by k. By abuse of notation, we write this operation as an action.
Definition 5.2.22. Given a state (D, ∆) and k ∈ Z, the k-shift of (D, ∆) is defined
as:
(D, ∆) · Shiftk = (σ k Dσ k , τ k ∆τ k ).
(D, ∆) · Shiftk = (σ k Dσ k , τ k ∆τ k )
[ ] [ ]
−z −ζ
eλ b ελ β
= (σ k σk , τ k τ k)
z ζ
b eλ β ελ
[ ] [ ]
eλ−z+k b ελ−ζ−k (−1)k β
= ( , )
b eλz−k (−1)k β ελζ+k
The resulting matrices are clearly symmetric and positive definite. Moreover, since
σ k and τ k have determinant ±1, both σ k Dσ k and τ k ∆τ k have determinant 1. Finally:
For every special grid operator G, there is a special grid operator G′ whose action
on a state corresponds to shifting the state by k, applying G and then shifting the
state by −k.
Since all the factors in the above product are grid operators, the result is also a grid
operator. Moreover det(σGσ) = det(G) = 1 so that σGσ is special. Finally:
[ ] [ ]
λ• w• x• −λ−1 w• x•
G′• = (σGσ)• = = = −τ G• τ.
• −1 • • • •
y (λ ) z y −λz
Shifts allow us to consider only states (D, ∆) with Bias(D, ∆) ∈ [−1, 1] in the
proof of the Step Lemma.
Lemma 5.2.26. If the Step Lemma holds for all states (D, ∆) with Bias(D, ∆) ∈
[−1, 1], then it holds for all states.
Proof. Let (D, ∆) be some state with Skew(D, ∆) > 15. Let x = Bias(D, ∆) and
set k = ⌊ 1−x
2
⌋. Then by Lemma 5.2.23, we have Skew((D, ∆) · Shiftk ) = Skew(D, ∆)
70
and Bias((D, ∆) · Shiftk ) ∈ [−1, 1]. Then by assumption, there exists a special grid
operator G such that Skew(((D, ∆) · Shiftk ) · G) 6 0.9 Skew((D, ∆) · Shiftk ). Now by
Lemma 5.2.24 we know that G′ = σ k G σ k is a special grid operator. Moreover, by
Lemma 5.2.25 and 5.2.23, we have:
The R Lemma
e(λz −λ−z )
[ ] [ ]
... 2
... e sinhλ (z)
= e(λz −λ−z )
= ,
2
... e sinhλ (z) ...
[ ][ ][ ]
1 −1 −1 ελ−ζ β −1 1
R•† ∆R• =
2 1 −1 β ελζ −1 −1
ε(λζ −λ−ζ )
[ ] [ ]
... 2
... ε sinhλ (ζ)
= ε(λζ −λ−ζ )
= .
2
... ε sinhλ (ζ) ...
We assumed −0.8 6 z, ζ 6 0.8 and this implies that sinh2λ (ζ), sinh2λ (z) 6 sinh2λ (0.8).
Writing y = sinh2λ (0.8) for brevity, and using the assumption that Skew(D, ∆) > 15,
we get:
The K Lemma
λx + λ−x
coshλ (x) = .
2
Lemma 5.2.30. Recall the operator K from Figure 5.6. If (D, ∆) is a state such
that Bias(D, ∆) ∈ [−1, 1], Skew(D, ∆) > 15, and such that b, β > 0, z 6 0.3, and
0.8 6 ζ, then:
K † DK
[ ][ ][ ]
1 −λ−1 λ eλ−z b −λ−1 −1
=
2 −1 1 b eλz λ 1
[ √ ]
1 ... e(λz+1 + λ−z−1 ) − 2 2b
= √
2 e(λz+1 + λ−z−1 ) − 2 2b ...
[ √ ]
... e coshλ (z + 1) − 2b
= √ ,
e coshλ (z + 1) − 2b ...
72
K •† ∆K •
[ ][ ][ ]
1 λ −λ−1 ελ−ζ β λ −1
=
2 −1 1 β ελζ −λ−1 1
[ √ ]
1 ... −ε(λζ−1 + λ−ζ+1 ) + 2 2β
= √
2 −ε(λζ−1 + λ−ζ+1 ) + 2 2β ...
[ √ ]
... 2β − ε coshλ (ζ − 1)
= √ .
2β − ε coshλ (ζ − 1) ...
Therefore:
√ √
Skew((D, ∆) · K) = ( 2b − e coshλ (z + 1))2 + ( 2β − ε coshλ (ζ − 1))2 . (5.11)
But recall that e2 = b2 + 1, and from Remark 5.2.16 that b > 0 implies −be 6 −b2 ,
so:
√
( 2b − e coshλ (z + 1))2
√
= 2b2 − 2 2 be coshλ (z + 1) + e2 cosh2λ (z + 1)
√
6 2b2 − 2 2 b2 coshλ (z + 1) + (b2 + 1) cosh2λ (z + 1)
√
= b2 (2 − 2 2 coshλ (z + 1) + cosh2λ (z + 1)) + cosh2λ (z + 1)
√
= b2 ( 2 − coshλ (z + 1))2 + cosh2λ (z + 1). (5.12)
√ √
b2 ( 2 − coshλ (z + 1))2 + cosh2λ (z + 1) 6 b2 ( 2 − coshλ (0))2 + cosh2λ (1.3) (5.14)
and
√ √
β 2 ( 2 − coshλ (ζ − 1))2 + cosh2λ (ζ − 1) 6 β 2 ( 2 − coshλ (0))2 + cosh2λ (1.3). (5.15)
73
Combining (5.11)–(5.15), together with the assumption that Skew(D, ∆) > 15, yields:
√ √
Skew((D, ∆) · K) = ( 2b − e coshλ (z + 1))2 + ( 2β − ε coshλ (ζ − 1))2
√
6 (b2 + β 2 )( 2 − coshλ (0))2 + 2 cosh2λ (1.3)
√
= Skew(D, ∆)( 2 − coshλ (0))2 + 2 cosh2λ (1.3)
√ 2
6 Skew(D, ∆)(( 2 − coshλ (0))2 + cosh2λ (1.3))
15
√ 2
This completes the proof since ( 2 − coshλ (0))2 + 15 cosh2λ (1.3) ≈ 0.571 6 0.9.
The A Lemma
Lemma 5.2.32. Recall the operator A from Figure 5.6. If (D, ∆) is a state such that
Bias(D, ∆) ∈ [−1, 1], Skew(D, ∆) > 15, and such that b, β > 0 and 0.3 6 z, ζ, then
there exists n ∈ Z such that:
c
Proof. Let c = min{z, ζ} and n = max{1, ⌊ λ2 ⌋}. Compute the action of An on
(D, ∆):
[ ][ ][ ]
1 0 eλ−z b 1 −2n
An † DAn =
−2n 1 b eλz 0 1
[ ]
−z
... b − 2neλ
= ,
b − 2neλ−z ...
An •† ∆An • = An † ∆An
[ ]
... β − 2nελ−ζ
= .
β − 2nελ−ζ ...
Therefore:
Skew((D, ∆) · An ) = (b − 2neλ−z )2 + (β − 2nελ−ζ )2
But recall that e2 = b2 + 1 and ε2 = β 2 + 1, and from Remark 5.2.16 that b, β > 0
implies −be 6 −b2 and −εβ 6 −β 2 . Using these facts, we can expand the above
74
formula as follows:
Skew((D, ∆) · An )
= (b − 2neλ−z )2 + (β − 2nελ−ζ )2
= b2 − 4nbeλ−z + 4n2 e2 λ−2z + β 2 − 4nβελ−ζ + 4n2 ε2 λ−2ζ
6 b2 − 4nb2 λ−z + 4n2 (b2 + 1)λ−2z + β 2 − 4nβ 2 λ−ζ + 4n2 (β 2 + 1)λ−2ζ
= b2 (1 − 4nλ−z + 4n2 λ−2z ) + β 2 (1 − 4nλ−ζ + 4n2 λ−2ζ ) + 4n2 (λ−2z + λ−2ζ )
= b2 (1 − 2nλ−z )2 + β 2 (1 − 2nλ−ζ )2 + 4n2 (λ−2z + λ−2ζ )
= b2 g(nλ−z ) + β 2 g(nλ−ζ ) + 4n2 (λ−2z + λ−2ζ ).
Writing y = max{g(nλ−z ), g(nλ−ζ )} for brevity, and using the assumption that
Skew(D, ∆) > 15 together with the fact that c 6 z, ζ, we get:
The B Lemma
√
Definition 5.2.33. Let h(x) = (1 − 2x)2 .
Lemma 5.2.34. Recall the operator B from Figure 5.6. If (D, ∆) is a state such that
Bias(D, ∆) ∈ [−1, 1], Skew(D, ∆) > 15, and such that b 6 0 6 β and −0.2 6 z, ζ,
then there exists n ∈ Z such that:
Therefore:
√ √
Skew((D, ∆) · B n ) = (b + 2 neλ−z )2 + (β − 2 nελ−ζ )2 .
Skew((D, ∆) · B n )
√ √
= (b + 2 neλ−z )2 + (β − 2 nελ−ζ )2
√ √
= b2 + 2 2 nbeλ−z + 2n2 e2 λ−2z + β 2 − 2 2 nβελ−ζ + 2n2 ε2 λ−2ζ
√ √
6 b2 − 2 2 nb2 λ−z + 2n2 (b2 + 1)λ−2z + β 2 − 2 2 nβ 2 λ−ζ + 2n2 (β 2 + 1)λ−2ζ
√ √
= b2 (1 − 2 2 nλ−z + 2n2 λ−2z ) + β 2 (1 − 2 2 nλ−ζ + 2n2 λ−2ζ ) + 2n2 (λ−2z + λ−2ζ )
√ √
= b2 (1 − 2 nλ−z )2 + β 2 (1 − 2 nλ−ζ )2 + 2n2 (λ−2z + λ−2ζ ).
= b2 h(nλ−z ) + β 2 h(nλ−ζ ) + 2n2 (λ−2z + λ−2ζ ).
76
Writing y = max{h(nλ−z ), h(nλ−ζ )} for brevity, and using the assumption that
Skew(D, ∆) > 15, together with the fact that c 6 z, ζ, we get:
c c λc λc
• If ⌊ √λ 2 ⌋ > 1, then λ
√
2 2
6n6 √
2
. From n 6 √
2
, we have 2n2 λ−2c 6 1, and so
4n2 λ−2c 2
15
6 15
. Moreover, because Bias(D, ∆) ∈ [−1, 1], we have c 6 z, ζ 6 c + 1.
c
Hence √1
2 2λ
= 2λ√2 λ−c−1 6 nλ−c−1 6 nλ−z , nλ−ζ 6 nλ−c 6 √12 . On the interval
[ 2√12 λ , √12 ], the function h(x) assumes its maximum at x = 2√12 λ . This implies
that y 6 h( 2√12 λ ). This completes the present case since we get:
4 2 −2c 1 2
y+ nλ 6 h( √ ) + ≈ 0.762 6 0.9.
15 2 2λ 15
c √ 4 2 −2c
• If ⌊ √λ 2 ⌋ < 1, then n = 1 and λc < 2. From −0.2 6 c, we have 15
nλ 6
4 0.4
15
λ . Moreover, because Bias(D, ∆) ∈ [−1, 1], we have −0.2 6 c 6 z, ζ 6
√
c + 1. With λc 6 2, this implies that √12 λ 6 λ−c−1 6 λ−z , λ−ζ 6 λ0.2 .
Therefore both λ−z and λ−ζ are in the interval [ √12 λ , λ0.2 ]. On this interval, the
function h(x) assumes its maximum at x = λ0.2 , and therefore y 6 h(λ0.2 ). This
completes the proof since:
4 2 −2c 4
y+ nλ 6 h(λ0.2 ) + λ0.4 ≈ 0.851 6 0.9.
15 15
The proof of the Step Lemma is now basically a case distinction, using the cases
enumerated in lemmas 5.2.26–5.2.34, as well as some additional symmetric cases. In
particular, the following remark will allow us to use the grid operators X and Z to
reduce the number of cases to consider.
77
Remark 5.2.35. The grid operator Z negates the anti-diagonal entries of a state while
the operator X swaps the diagonal entries of a state. This follows by simple compu-
tation since ([ ] [ ])
eλ−z −b ελ−ζ −β
(D, ∆) · Z = ,
−b eλz −β ελζ
and ([ ] [ ])
eλz b ελζ β
(D, ∆) · X = , .
b eλ−z β ελ−ζ
Lemma (Step Lemma). For any state (D, ∆), if Skew(D, ∆) > 15, then there exists
a special grid operator G such that Skew((D, ∆) · G) 6 0.9 Skew(D, ∆). Moreover, G
can be computed using a constant number of arithmetic operations.
Proof. Let (D, ∆) be a state such that Skew(D, ∆) > 15. By Lemma 5.2.26 we can
assume w.l.o.g. that Bias(D, ∆) ∈ [−1, 1]. Moreover, by Remark 5.2.35, we can also
assume that β > 0 and z + ζ > 0. Note that the application of the grid operators
X and/or Z in Remark 5.2.35 preserves the fact that Bias(D, ∆) ∈ [−1, 1]. We now
treat in turn the cases b > 0 and b 6 0.
We now consider in turn the possible locations of the pair (z, ζ) in this covering.
ζ ζ
(a) (b)
K An Bn
1 1
R R
XK • z z
•
1K
1
XAn XK XB n
Figure 5.7: (a) A covering of the region z − ζ ∈ [−1, 1] and z + ζ > 0 for the case
b > 0. (b) A covering of the region z − ζ ∈ [−1, 1] and z + ζ > 0 for the case b 6 0.
Finally, note that only a constant number of calculations are required to decide which
of the above cases applies. Moreover, each case only requires a constant number of
operations. Specifically, the computation of k and σ k in Lemma 5.2.26, of n and An
79
in Lemma 5.2.32, and of n and B n in Lemma 5.2.34 each require just a fixed number
of operations, and each of the remaining cases produces a fixed grid operator.
Proposition 5.2.36. There is an algorithm which, given two bounded convex subset
A and B of R2 with non-empty interior, enumerates all solutions of the grid problem
over Z[ω] for A and B. Moreover, if A and B are M -upright, then the algorithm
requires O(log(1/M )) arithmetic operations overall, plus a constant number of arith-
metic operations per solution produced.
Proof. Analogous to the proof of Proposition 5.1.15, using Proposition 5.2.20 to find
the appropriate grid operator.
Proposition 5.2.37. There is an algorithm which, given two bounded convex subset
A and B of R2 with non-empty interior, enumerates (the infinite sequence of ) all
solutions of the scaled grid problem over Z[ω] for A, B, and k in order of increasing
k. Moreover, if A and B are M -upright, then the algorithm requires O(log(1/M ))
arithmetic operations overall, plus a constant number of arithmetic operations per
solution produced.
Finally, we give some lower bounds on the number of solutions to scaled grid
problems over Z[ω].
80
Lemma 5.2.38. Let A and B be convex subsets of R2 , and let k > 0. Assume A
contains a circle of radius r and B contains a circle of radius R, such that rR >
1
√
2k
(1 + 2)2 . Then the scaled grid problem over Z[ω] for A, B, and k has at least 2
solutions.
√ √ √
Proof. By assumption, ( 2k )A contains a circle of radius r′ = 2k r and (− 2)k B
√ √ √
contains a circle of radius R′ = 2k R, with rR > (1 + 2)2 . Let δ = r′ / 2 and
√
∆ = R′ 2, and inscribe two squares of size δ × δ in the first circle, and one square of
size ∆ × ∆ in the second circle, as shown here:
∆ w0
y1 δ δ
• • b•
b • •
y0
w1
x0 a x1x2 a′ x3 z0 a′• a• z1
√ √
Since δ∆ = r′ R′ > (1 + 2)2 , by Lemma 5.2.7, we can find a, a′ , b ∈ Z[ 2] such that
a ∈ [x0 , x1 ], a• ∈ [z0 , z1 ], a′ ∈ [x2 , x3 ], a′• ∈ [z0 , z1 ], b ∈ [y0 , y1 ], and b• ∈ [w0 , w1 ].
Then u = a + ib and v = a′ + ib are two different solutions to the scaled grid problem
over Z[ω] for A, B, and k as claimed.
Lemma 5.2.39. Let A and B be convex subsets of R2 , and assume that the two-
dimensional scaled grid problem for k has at least two distinct solutions. Then for all
ℓ > 0, the scaled grid problem for k + 2ℓ has at least 2ℓ + 1 solutions.
Recall moreover that the Clifford+V group is obtained by adding the following V -
gates to the generators of the Clifford group
[ ] [ ] [ ]
1 1 2i 1 1 2 1 1 + 2i 0
VX = √ , VY = √ , and VZ = √ .
5 2i 1 5 −2 1 5 0 1 − 2i
81
82
The problem of exact synthesis of Pauli+V operators was first solved in [7] using
the arithmetic of quaternions. Here, we extend this result to the Clifford+V group.
To characterize Clifford+V operators, we consider the following set of unitaries.
Proof. Clifford gates and V-gates can be commuted in the sense that for every pair
C, V of a Clifford gate and a V-gate, there exists a pair C ′ , V ′ such that CV = V ′ C ′ .
This implies that a Clifford+V operator U can always be written as U = AA′ , where
A is a product of V-gates and A′ is a Clifford operator. Furthermore, the Pauli+S
group has index 6 as a subgroup of the Clifford group and its cosets are: Pauli+S,
Pauli+S · H, Pauli+S · HS, Pauli+S · ω, Pauli+S · Hω, and Pauli+S · HSω. It
thus follows that a Clifford operator A′ can always be written as A′ = BC with B a
Pauli+S operator and C one of I, H, HS, ω, Hω, and HSω.
Proof. It suffices to show that the generators of the Clifford group preserve the least
√
5-denominator exponent of u. The general result then follows by induction. To this
end, write u as in (6.2), with α = a + ib and β = c + id:
[ ]
1 a + ib
u= √ √ .
2k 5ℓ c + id
84
Lemma 6.1.8. If u is a unit vector of the form (6.2) with least denominator exponent
(k, ℓ), then there exists a Clifford circuit W such that W u has least denominator
exponent (0, ℓ).
Proof. By Lemma 6.1.7, we need not worry about ℓ and only have to focus on reducing
k. Write u as in (6.2), with 0 6 k 6 2, α = a + ib, and β = c + id. Since u has unit
norm, we have a2 + b2 + c2 + d2 = 2k · 5ℓ . We prove the lemma by case distinction on
k. If k = 0, there is nothing to prove. The remaining cases are treated as follows.
Remark 6.1.9. Let V be one of the V-gates, u be a vector of the form (6.2), and ℓ and
√
ℓ′ be the least 5-denominator exponents of u and V u respectively. Then ℓ′ 6 ℓ + 1.
√
Moreover, if it were the case that ℓ′ < ℓ − 1, then the least 5-denominator exponent
of V † V u = u would be strictly less ℓ which is absurd. Thus ℓ − 1 6 ℓ′ 6 ℓ + 1.
Lemma 6.1.10. If u is a unit vector of the form (6.2) with least denominator expo-
nent (0, ℓ), then there exists a Pauli+V circuit W of V-count ℓ such that W u = e1 ,
the first standard basis vector.
Proof. Write u as in (6.2) with k = 0, α = a + ib, and β = c + id. Since u has unit
norm, we have a2 + b2 + c2 + d2 = 20 · 5ℓ = 5ℓ . We prove the lemma by induction on ℓ.
• ℓ > 0. In this case a2 + b2 + c2 + d2 ≡ 0 (mod 5). We will show that there exists
a Pauli+V operator U of V-count 1 such that the least denominator exponent
of U u is ℓ − 1. It then follows by the induction hypothesis that there exists U ′
of V-count ℓ − 1 such that U ′ U u = e1 , which then completes the proof.
Consider the residues modulo 5 of a, b, c, and d. Since 0, 1, and 4 are the only
squares modulo 5, then, up to a reordering of the tuple (a, b, c, d), we must have:
⎧
⎨ (0, 0, 0, 0)
⎪
⎪
(a, b, c, d) ≡ (±2, ±1, 0, 0)
⎪
⎪
⎩ (±2, ±2, ±1, ±1).
[ ]
1 (a + 2b) + i(b − 2a)
VZ † u = √ k+1
5 (c − 2d) + i(d + 2c)
(a, b, c, d) U
(2, 1, 0, 0) VZ
(2, 0, 1, 0) VY †
(2, 0, 0, 1) VX
(2, −1, 0, 0) VZ†
(2, 0, −1, 0) VY
(2, 0, 0, −1) VX †
Now assume that two of a, b, c, d are congruent to ±2 while the remaining two
are congruent to ±1. We can use Pauli operators to guarantee that a ≡ 2
and c > 0. As above, we list the desired operators in a table for conciseness.
It can be checked that in each case the given operator is such that the least
denominator exponent of U u is ℓ − 1.
87
(a, b, c, d) U
(2, 2, 1, 1) VY †
(2, 1, 2, 1) VX
(2, 1, 1, 2) VZ
(2, 1, 2, −1) VZ
(2, −1, 2, 1) VZ †
(2, 2, 1, −1) VX †
(2, −2, 1, 1) VX
(2, 1, 1, −2) VY †
(2, −1, 1, 2) VY †
(2, −1, 1, −2) VZ †
(2, −1, 2, −1) VX †
(2, −2, 1, −1) VY †
Proof. The left-to-right implication is given by Corollary 6.1.6. For the right-to-left
implication, it suffices to show that there exists a Clifford+V circuit W of V-count ℓ
such that W U = I, since we then have U = W † . To construct W , apply Lemma 6.1.8
and Lemma 6.1.10 to the first column u1 of U . This yields a circuit W ′ such that the
first column of W ′ U is e1 . Since W ′ U is unitary, it follows that its second column u2
is a unit vector orthogonal to e1 . Therefore u2 = λe2 where λ is a unit of the Gaussian
integers. Since the determinant of W ′ is im for some integer m, the determinant of
W ′ U is in+m , so that λ = in+m . Thus one of the following equalities must hold
W ′ U = I, ZW ′ U = I, SW ′ U = I or ZSW ′ U = I.
√
To prove the second claim, suppose that the least 5-denominator exponent of U is
ℓ. Then W can be efficiently computed because the algorithm described in the proofs
88
of Lemma 6.1.8 and Lemma 6.1.10 requires O(ℓ) arithmetic operations. Moreover,
W has V-count ℓ by Lemma 6.1.10, which is minimal since any Clifford+V circuit of
√
V-count up to ℓ − 1 has least 5-denominator exponent at most ℓ − 1.
We now turn to the approximate synthesis of z-rotations over the Clifford+V gate
set. A z-rotation is a unitary matrix of the form
[ ]
e−iθ/2 0
Rz (θ) = (6.3)
0 eiθ/2
for some real number θ. Matrices of the form (6.3) are called z-rotations because they
act as rotations of the Bloch sphere along the z-axis.
Lemma 6.2.2. Let cV = |1 − eiπ/4 |. If ε < cV , then all solutions to Problem 6.2.1
have determinant 1. If ε > cV , then there exists a solution of the form ω n for some
n ∈ N.
for a, b ∈ C and φ ∈ [−π, π]. This, together with the characterization of Clifford+V
operators given by Proposition 6.1.11, implies that a complex 2 × 2 unitary operator
U can be exactly synthesized over the Clifford+V gate set if and only if
[ ]
1 α −β † in
U=√ √ ,
2k 5ℓ β α† in
89
ε2
D 2
1
θ
2
Rε
⃗z
Definition 6.2.3. Let θ be an angle and ε > 0 a precision. The ε-region for θ is the
subset of the plane defined by
ε2
Rε = {u ∈ D ; u · z > 1 − }
2
The ε-region is illustrated in Figure 6.1. We now show how to reduce Problem 6.2.1
to three distinct problems.
√ k√ ℓ
Moreover, the least 2 5 for which the above three problems can be solved yields
an optimal solution to Problem 6.2.1.
The fact that, by Lemma 6.2.2, all the solutions to Problem 6.2.1 are of the form
(6.4) completes the reduction. Since by Proposition 6.1.11 the minimal V-count of
√ √ √
an element U ∈ V is its least 5-denominator exponent, then the least 2k 5ℓ for
which problems 1-3 can be solved is an optimal solution.
91
1. Use the algorithm from Proposition 5.1.17 of Chapter 5 to enumerate the infinite
√ √
sequence of solutions to the scaled grid problem over Z[i] for Rε and 2k 5ℓ
in order of increasing ℓ.
(a) Let n = 2k 5ℓ − α† α.
(c) Use the algorithm from Proposition 3.2.8 of Chapter 3 to solve the equation
β † β = n. If a solution β exists, go to step 3; otherwise, continue with the
next α.
3. Define U as [ ]
1 α −β †
U=√ √
2k 5ℓ β α†
and use the exact synthesis algorithm of Proposition 6.1.11 to find a Clifford+V
circuit for U . Output this circuit and stop.
Remark 6.2.6. In analogy with Remark 6.1.12, we note that restricting k to be equal
to 0 throughout the algorithm yields a method for the approximate synthesis of z-
rotations in the Pauli+V basis.
We now discuss the properties of Algorithm 6.2.5. We are interested in three aspects
of the algorithm: its correctness, its circuit complexity, and its time complexity. We
treat each of these aspects in turn. We note that the results established here also
hold for the restricted algorithm of Remark 6.2.6.
92
Correctness
Circuit complexity
In the presence of a factoring oracle, the algorithm has optimal circuit complexity.
Proof. By construction, step (1) of the algorithm enumerates all solutions α to the
√ √
scaled grid problem over Z[i] for Rε and 2k 5ℓ in order of increasing ℓ. Step 2(a)
always succeeds and, in the presence of the factoring oracle, so does step 2(b). When
step 2(c) succeeds, the algorithm has found a solution of Problem 6.2.1 of minimal
√
5-denominator exponent, which therefore has minimal V-count.
In the absence of a factoring oracle, the algorithm is still nearly optimal. Our
proof of this near-optimality relies on the following number-theoretic hypothesis. We
do not have a proof of this hypothesis, but it appears to be valid in practice.
Hypothesis 6.2.9. For each number n produced in step 2(a) of Algorithm 6.2.5, write
n = 2j m, where m is odd. Then m is asymptotically as likely to be a prime congruent
to 1 modulo 4 as a randomly chosen odd number of comparable size. Moreover, each
m can be modelled as an independent random event.
Definition 6.2.10. Let U ′ and U ′′ be the following two solutions of the approximate
synthesis problem
[ ] [ ]
α′ −β ′† α′′ −β ′′†
U′ = and U ′′ = . (6.5)
β′ α′† β ′′ α′′†
2. The expected value of ℓ is ℓ′′′ + O(log(log(1/ε))), where ℓ′ , ℓ′′ , and ℓ′′′ are the
V-counts of the optimal, second-to-optimal, and third-to-optimal solutions of the
approximate synthesis problem (up to equivalence).
Proof. If ε > |1 − eiπ/4 |, then by Lemma 6.2.2 there is a solution of V-count 0 and
the algorithm easily finds it. In this case there is nothing to show, so assume without
loss of generality that ε < |1 − eiπ/4 |. Then by Lemma 6.2.2, all solutions are of the
form (6.4).
Next, we will estimate ℓ3 . First note that if the ε region contains a circle of
√
radius greater than 1/ 5ℓ , then it contains at least 3 solutions to the scaled grid
√
problem for Rε with 5-denominator exponent ℓ. The width of the ε-region
Rε is ε2 /2 at the widest point, and we can inscribe a disk of radius r = ε2 /4 in
it. Hence the scaled grid problem over Z[i] for Rε , as in step 1 of the algorithm,
has at least three solutions with denominator exponent ℓ, provided that
ε2 1
r= >√ ,
4 5ℓ
or equivalently, provided that
It follows that
ℓ3 = O(log(1/ε)), (6.10)
95
To finish the proof of part (i), recall that j0 was defined to be the smallest
index such that mj0 is a prime congruent to 1 modulo 4. The primality of
mj0 ensures that step (ii.b) of the algorithm succeeds for the candidate αj0 .
Furthermore, because mj0 ≡ 1 (mod 4), the equation β † β = n has a solution by
Proposition 3.2.6. Hence the remaining steps of the algorithm also succeed for
αj0 .
This calculation applies to any one run of the algorithm. Taking expected values
over many randomized runs, we therefore have
Note that we have used the law E(log j0 ) 6 log(E(j0 )), which holds because
log is a concave function. Combining (6.12) with (6.11), we therefore have the
96
desired result:
E(ℓ) = ℓ′′′ + O(log(log(1/ε))).
Time complexity
Finally, we turn to the time complexity of the algorithm. For this again, we rely on
our number theoretic conjecture on the distribution of primes to estimate how many
candidates must be tried before one that is prime is reached.
Proof. Let M be the uprightness of the ε-region. Let j0 be the average number of
candidates tried in steps 2(a)–(c) of the algorithm, and let ℓj0 be the least denominator
exponent of the final candidate. Let n be the largest integer that appears in step 2(a)
of the algorithm.
By Proposition 5.1.17, step 1 of the algorithm requires O(log(1/M )) arithmetic
operations, plus a constant number per candidate. For each of the j0 candidates,
step 2(a) requires O(1) arithmetic operations. Step 2(b) also requires O(1) arithmetic
operations, either due to the use of a factoring oracle, or else, because we can put
an arbitrary fixed bound on the amount of effort invested in factoring any given
integer. At minimum, this will succeed when the integer in question is prime, which
is sufficient for the estimates of Proposition 6.2.11. Step 2(c) requires O(polylog(n))
operations by Proposition 3.2.8. Finally, step 3 requires O(ℓj0 ) arithmetic operations
by Proposition 6.1.11. So the total expected number of arithmetic operations is
Recall that the ε-region Rε , shown in Figure 6.1, contains a disk of radius ε2 /4;
π 4
therefore, area(Rε ) > 16
ε. On the other hand, the square [−1, 1] × [−1, 1] is a (not
very tight) bounding box for Rε . It follows that
area(Rε )
M = up(Rε ) = = Ω(ε4 ),
area(BBox(Rε ))
97
Now note that for any i, ni 6 5ℓi +1 . This, together with the fact that candidates are
enumerated in order of increasing denominator exponent, we have n 6 4ℓj0 , hence
Combining all of these estimates with (6.13), the expected number of arithmetic
operations for the algorithm is O(polylog(1/ε)). Moreover, each individual arithmetic
operation can be performed with precision O(log(1/ε)), taking time O(polylog(1/ε)).
Therefore the total expected time complexity of the algorithm is O(polylog(1/ε)), as
desired.
Using the Hadamard gate, the central x-rotation can be expressed as a z-rotation.
Thus
U = Rz (θ1 )HRz (θ2 )HRz (θ3 ).
We can therefore use Algorithm 6.2.5 to find a Clifford+V circuit approximating each
of the Rz (θi ) up to ε/3. Since the Hadamard gate is a Clifford operator, this yields a
Clifford+V approximation of U up to ε.
98
and approximate each z-rotation using Algorithm 6.2.5, we obtain a circuit whose
length exceeds the optimal one by a factor of 3 in the typical case.
Chapter 7
The Clifford+T gate set is obtained by adding the T gate to the generators ω, H,
and S of the Clifford group.
The results presented in this chapter are obtained by adapting the methods of
Chapter 6 to the Clifford+T setting. Like in Chapter 6, we first consider the exact
synthesis of Clifford+T operators. This provides a characterization of Clifford+T
circuits which we then use to define an algorithm for the approximate synthesis of
z-rotations. Because of the similarities between this chapter and the previous one, we
omit most proofs in order to avoid redundancy. However, we explain the differences
when they occur.
The approximate synthesis algorithms introduced in this chapter (Algorithm 7.2.5
and Algorithm 7.3.9) have been implemented in Haskell. The implementations are
freely available [57].
Problem 7.1.1 was first solved in [41]. A version of Problem 7.1.1 generalized to
multi-qubit circuits was solved in [21].
To characterize Clifford+T operators, we consider the following set of unitaries.
99
100
The above proposition can be proved by a technique similar to the one used to
establish Proposition 6.1.11. To this end one first shows that every vector of the
form (7.2) can be reduced to e1 = [ 10 ] by applying well-chosen Clifford+T operators.
Applying this method to the first column of an element U of T then yields a circuit
for U .
Recall that in Proposition 6.1.11, the minimal V -count of the operator U was equal
√
to its least 5-denominator exponent. The relation between denominator exponent
and minimal T -count is slightly more complicated.
101
∥U − Rz (θ)∥ 6 ε. (7.3)
An algorithm to solve Problem 7.2.1 can be used to solve the problem of approx-
imate synthesis of arbitrary special unitaries using Euler angles, as in Section 6.3.
Our algorithm solving Problem 7.2.1 relies on a reduction of the problem to a
grid problem, a Diophantine equation and an exact synthesis problem. This is anal-
ogous to the reduction described in the Clifford+V case by Proposition 6.2.4. In the
Clifford+T context, we must first show that enumerating candidate solutions in order
of increasing denominator exponents allows us to also enumerate candidate solutions
in order of minimal T -count. This is not immediate, due to Proposition 7.1.5.
Lemma 7.2.2. If ε < |1 − eiπ/8 |, then all solutions to Problem 7.2.1 have the form
[ ]
1 u −t†
U=√ . (7.4)
2k t u†
If ε > |1 − eiπ/8 |, then there exists a solution of T -count 0 (i.e., a Clifford operator),
and it is also of the form (7.4).
Lemma 7.2.3. Let U be a unitary operator as in (7.4) with least denominator ex-
ponent k. Then the T -count of U is either 2k − 2 or 2k. Moreover, if k > 0 and
U has T -count 2k, then U ′ = T U T † has T -count 2k − 2. We further note that
∥Rz (θ) − U ′ ∥ = ∥Rz (θ) − U ∥, so for the purpose of solving (7.3), it does not matter
whether U or U ′ is used. Hence, without loss of generality, we may assume that U as
in (7.4) always has T -count exactly 2k − 2 when k > 0, and 0 when k = 0.
102
Proof. The claims about the T -counts of U and U ′ follow by inspection of Figure 2
of [22]. Using the terminology of Definitions 7.4 and 7.6 of [22], this figure shows
every possible k-residue of a Clifford+T operator, modulo a right action of the group
⟨S, X, ω⟩. Because U is of the form (7.4), only a subset of the k-residues is actually
possible, and the figure shows that for this subset, the T -count is 2k or 2k − 2.
Moreover, in each of the possible cases where k > 0 and U has T -count 2k, the figure
also shows that U ′ = T U T † has T -count 2k − 2.
For the final claim, we have ∥Rz (θ) − U ∥ = ∥T Rz (θ)T † − T U T † ∥ = ∥Rz (θ) − U ′ ∥
because Rz (θ) and T commute.
We can now state a reduction for Problem 7.2.1 as we did in Proposition 7.2.4 for
Problem 6.2.1.
Moreover, the least k for which the above three problems can be solved yields an optimal
solution to Problem 7.2.1.
Note that item 1 of Proposition 7.2.4 is a grid problem over Z[ω]. This is in
contrast with the corresponding item of Proposition 7.2.4, which was a grid problem
over Z[i]. In both cases, we look for points in a scaled ε-region in order of increasing
denominator exponent. However, in the Clifford+T case, the desired points must be
elements of Z[ω]. Since Z[ω] is dense in R2 , there are infinitely many elements in
Rε ∩ Z[ω] for any fixed denominator exponent. To circumvent this issue, we only
103
consider those elements of Rε ∩ Z[ω] for which the Diophantine equation of item 2
can potentially be solved. Since we have
√ √
α† α + β † β = 2k =⇒ α ∈ 2k D and α• ∈ (− 2)k D,
where D is the closed unit disk, the points of interest are precisely the solutions to
the scaled grid problem over Z[ω] for Rε and D.
1. Use the algorithm from Proposition 5.2.37 of Chapter 5 to enumerate the infinite
sequence of solutions to the scaled grid problem over Z[ω] for Rε and D and k
in order of increasing k.
(c) Use the algorithm from Proposition 3.2.9 of Chapter 3 to solve the equation
β † β = n. If a solution β exists, go to step 3; otherwise, continue with the
next α.
3. Define U as [ ]
1 α −β †
U=√
2k β α†
and use the exact synthesis algorithm of Proposition 7.1.4 to find a Clifford+V
circuit for U or T U T † , whichever has the smallest T -count. Output this circuit
and stop.
We now state the properties of Algorithm 7.2.5. In most cases it enjoys the same
properties as the Clifford+V algorithm.
Hypothesis 7.2.8. For each n produced in step 2(a) of Algorithm 7.2.5, write n =
2j m, where m is odd. Then m is asymptotically as likely to be prime as a randomly
chosen odd number of comparable size. Moreover, the primality of each m can be
modelled as an independent random event.
Note that Hypothesis 7.2.8 is slightly different than Hypothesis 6.2.9. Indeed,
Hypothesis 6.2.9 makes an additional assumption on the residue class of the integer
m. Here it is not necessary to make such an assumption, since we can prove that the
number n produced in step 2(a) of the algorithm satisfies n > 0 and moreover is such
that either n = 0 or n ≡ 1 (mod 8). A proof of this fact can be found in Appendix D
of [56].
2. The expected value of m is m′′ + O(log(log(1/ε))), where m′ and m′′ are the
T -counts of the optimal and second-to-optimal solutions of the approximate syn-
thesis problem (up to equivalence).
Note that in Proposition 7.2.9, we use the second-to-optimal solution, rather than
the third-to-optimal solution as in Proposition 6.2.11. This is due to the fact that
√ √
2 ∈ Z[ω] whereas 5 ∈ / Z[i]. Indeed, if α and α′ are two solutions of least denom-
inator exponent k and k ′ with k 6 k ′ , then they are both solutions of denominator
105
exponent k ′ . But in the case of the Clifford+V gates, we need to have three solutions
to guarantee that two will have the same denominator exponent.
The last property of the algorithm can be proved just like the corresponding one
from Chapter 6.
So far, we have considered the problem of approximate synthesis “on the nose”, i.e.,
the operator U in Problem 7.2.1 was literally required to approximate Rz (θ) in the
operator norm. However, it is well-known that global phases have no observable effect
in quantum mechanics, so in quantum computing, it is also common to consider the
problem of approximate synthesis “up to a phase”. This is made precise in the
following definition.
Problem 7.3.1. Given θ and some ε > 0, the approximate synthesis problem for
z-rotations up to a phase is to find an operator U expressible in the single-qubit
Clifford+T gate set, and a unit scalar λ, such that
In this section, we will give a version of Algorithm 7.2.5 that optimally solves the
approximate synthesis problem up to a phase. The central insight is that it is in fact
√
sufficient to restrict λ to only two possible phases, namely λ = 1 and λ = ω = eiπ/8 .
First, note that if W is a unitary 2 × 2-matrix and det W = 1, then tr W is real.
This is obvious, because det W = 1 ensures that the two eigenvalues of W are each
other’s complex conjugates.
Lemma 7.3.2. Let W be a unitary 2 × 2-matrix, and assume that det W = 1 and
tr W > 0. Then for all unit scalars λ, we have
∥I − W ∥ 6 ∥I − λW ∥.
106
Proof. We may assume without loss of generality that W is diagonal. Since det W =
1, we can write
[ ]
eiφ 0
W =
0 e−iφ
for some φ. By symmetry, we can assume without loss of generality that 0 6 φ 6 π.
Since tr W > 0, we have φ 6 π/2. Now consider a unit scalar λ = eiψ , where
−π 6 ψ 6 π. Then ∥I−λW ∥ = max{|1−ei(ψ+φ) |, |1−ei(ψ−φ) |} and ∥I−W ∥ = |1−eiφ |.
If ψ > 0, then |1 − eiφ | 6 |1 − ei(ψ+φ) |. Similarly, if ψ 6 0, then |1 − eiφ | 6 |1 − ei(ψ−φ) |.
In either case, we have ∥I − W ∥ 6 ∥I − λW ∥, as claimed.
Lemma 7.3.3. Fix ε, a unitary operator R with det R = 1, and a Clifford+T operator
U . The following are equivalent:
∥R − λU ∥ 6 ε;
∥R − einπ/8 U ∥ 6 ε.
Proof. It is obvious that (2) implies (1). For the opposite implication, first note that,
because U is a Clifford+T operator, we have det U = ω k for some k ∈ Z, and therefore
det(R−1 U ) = ω k . Let V = e−ikπ/8 R−1 U , so that det V = 1. If tr V > 0, let W = V ;
otherwise, let W = −V . Either way, we have W = einπ/8 R−1 U , where n ∈ Z, and
det W = 1, tr W > 0. Let λ′ = e−inπ/8 λ. By Lemma 7.3.2, we have
∥I − W ∥ 6 ∥I − λ′ W ∥
⇒ ∥I − einπ/8 R−1 U ∥ 6 ∥I − λ′ einπ/8 R−1 U ∥
⇒ ∥R − einπ/8 U ∥ 6 ∥R − λ′ einπ/8 U ∥,
⇒ ∥R − einπ/8 U ∥ 6 ∥R − λU ∥,
Remark 7.3.4. A version of Lemma 7.3.3 applies to gate sets other than Clifford+T ,
as long as the gate set has discrete determinants.
107
Proof. Suppose U is a Clifford+T operator satisfying (7.5) for some unit scalar λ.
By Lemma 7.3.3, there exists a λ of the form einπ/8 also satisfying (7.5). Then we
can write λ = ω k λ′ , where k ∈ Z and λ′ ∈ {1, eiπ/8 }. Letting U ′ = ω k U , we have
λ′ U ′ = λU , and therefore
∥Rz (θ) − λ′ U ′ ∥ 6 ε,
as claimed. Moreover, since ω = eiπ/4 is a Clifford operator, U and U ′ have the same
T -count.
We use a sequence of steps very similar to those of Proposition 7.2.4 to reduce this
to a grid problem and a Diophantine equation. We first consider the form of U .
Lemma 7.3.6. If ε < |1 − eiπ/8 |, then all solutions of (7.6) have the form
[ ]
u −t† ω −1
U= . (7.7)
t u† ω −1
Proof. This is completely analogous to the proof of Lemma 7.2.2, using eiπ/8 U in
place of U .
δ
Recall that δ = 1 + ω, and note that |δ| = eiπ/8 . Also note that δω −1 = δ † , and
√
that δ −1 = (ω − i)/ 2. Suppose that U is of the form (7.7). Let u′ = δu and t′ = δt.
We have:
[ ]
iπ/8
δ u −t† ω −1
∥Rz (θ) − e U ∥ = Rz (θ) −
|δ| t † −1
uω
[ ]
1 δu −δ † t†
= Rz (θ) −
|δ| δt † †
δu
[ ]
1 u′ −t′ †
= Rz (θ) − .
|δ| t′ u ′†
108
Using exactly the same argument as in Proposition 7.2.4, it follows that (7.6) holds
u′
if and only if |δ|
∈ Rε , i.e., u′ ∈ |δ|Rε .
As before, in order for U to be unitary, of course it must satisfy u† u + t† t = 1, and
a necessary condition for this is u, u• ∈ D. The latter condition can be equivalently
re-expressed in terms of u′ by requiring u′ ∈ |δ| D and u′ • ∈ |δ •| D. Therefore, finding
solutions to (7.6) of the form (7.7) reduces to the two-dimensional grid problem u′ ∈
|δ|Rε and u′ • ∈ |δ •| D, together with the usual Diophantine equation u† u+t† t = 1. The
last remaining piece of the puzzle is to compute the T -count of U , and in particular,
to ensure that potential solutions are found in order of increasing T -count.
Lemma 7.3.7. Let U be a Clifford+T operator of the form (7.7), and let k be the
least denominator exponent of u′ = δu. Then the T -count of U is either 2k − 1 or
2k + 1. Moreover, if k > 0 and U has T -count 2k + 1, then U ′ = T U T † has T -count
2k − 1.
Proof. This can be proved by a tedious but easy induction, analogous to Lemma 7.2.3.
We therefore arrive at the following algorithm for solving (7.6). Here we assume
ε < |1 − eiπ/8 |, so that Lemma 7.3.6 applies.
Proof. The correctness and time complexity of Algorithm 7.3.9 follows from that
of Algorithms 7.2.5 and 7.3.8. The optimality results follow from those of Algo-
rithms 7.2.5 and 7.3.8, keeping in mind that Algorithm 7.2.5 finds an optimal (or
near-optimal) solution for the phase λ = 1, Algorithm 7.3.8 finds an optimal (or
near-optimal) solution for the phase λ = eiπ/8 , and by Corollary 7.3.5, these are the
only two phases that need to be considered.
The only subtlety that must be pointed out is that in part (b) of the near-
optimality, we use the T -count of the third-to-optimal solution, rather than the
second-to-optimal one as in Proposition 7.2.9. This is because the optimal and second-
to-optimal solutions may belong to Algorithms 7.2.5 and 7.3.8, respectively, so that
it may not be until the third-to-optimal solution that the near-optimality result of
either Algorithm 7.2.5 or Algorithm 7.3.8 can be invoked.
110
Remark 7.3.11. Algorithms 7.2.5 and 7.3.8 share the same ε-region up to scaling, and
therefore the uprightness computation only needs to be done once.
Remark 7.3.12. By Lemmas 7.2.3 and 7.3.7, Algorithm 7.2.5 always produces circuits
with even T -count, and Algorithm 7.3.8 always produces circuits with odd T -count.
Instead of running both algorithms to completion, it is possible to interleave the two
algorithms, so that all potential solutions are considered in order of increasing T -
count. This is a slight optimization which does not, however, affect the asymptotic
time complexity.
Chapter 8
In this chapter, we introduce the syntax and operational semantics of the Proto-
Quipper language.
111
112
• provide a linear type system to guarantee that the produced circuits are physi-
cally meaningful (in particular, properties like no-cloning are respected).
In this section, we present in detail the syntax and type system of Proto-Quipper.
Among the types, we single out the subset of quantum data types
T, U ::= qubit 1 T ⊗ U.
the set of all circuits having an input interface of type T and an output interface of
type U .
where x and y come from a countable set V of term variables, q comes from a countable
set Q of quantum variables, and C comes from a countable set C of circuit constants.
Among the terms, we single out the subset of quantum data terms
Moreover, we assume that C is equipped with two functions In, Out : C → Pf (Q) and
that Q is well-ordered. Here, Pf (Q) denotes the set of finite subsets of Q.
The meaning of most terms is intended to be the standard one. For example ⟨a, b⟩
is the pair of a and b, True and False are the booleans and λx.a is the function which
maps x to a. We briefly discuss the meaning of the more unusual terms.
represents the circuit C, but also specifies what it means to apply this circuit to
a quantum data term ⟨p, ⟨r, s⟩⟩. Namely, in this case, the circuit inputs q2 , q3 ,
and q1 will be applied to qubits p, r, and s, respectively. Moreover, if the output
of this circuit is to be matched against the pattern ⟨⟨x, y⟩, z⟩, then the variables
x, y, and z will be bound, respectively, to the quantum bits at endpoints q4 , q6 ,
and q5 .
Terms of the form (t, C, a) are not intended to be written by the user of the pro-
gramming language; in fact, a Proto-Quipper implementation would not provide
a concrete syntax for such terms. Rather, these terms are internally generated
during the evaluation of Proto-Quipper programs. However, the circuits for
certain basic gates may be made available to the user as pre-defined symbols.
• unbox is a built-in function for turning a circuit regarded as data into a circuit-
producing function. It is an inverse of boxT .
Note that the term boxT is parameterized by a type T . This Church-style typing of
the language is the reason why types were introduced before terms. Also note that
in a term like (t, C, a), t is assumed to be a quantum data term, but a is not. The
type system to be introduced below will guarantee that even though a is not yet a
quantum data term it will eventually reduce to one.
Examples 8.2.3. Suppose that H is the circuit constant for the Hadamard gate. The
term ⟨q1 , H, q2 ⟩ then represents the circuit consisting only of the Hadamard gate,
regarded as Proto-Quipper data. We can then define the circuit producing function
H = unbox⟨q1 , H, q2 ⟩. Similarly, if CN OT is the circuit constant for the controlled-
not gate, then the term CNOT = unbox⟨⟨q1 , q2 ⟩, CN OT, ⟨q3 , q4 ⟩⟩ is the corresponding
circuit producing function. In an implementation of the Proto-Quipper language, a fi-
nite set of such circuit producing functions would be provided as basic operations. For
example, a candidate such gate set would consist of the Clifford+T gate set extended
115
with the controlled-not gate: H, S, T, CNOT. Basic gates can then be combined. For
example, the term
λx. T(S(H x))
is the circuit producing function which applies in sequence the H, S, and T gates.
Using the boxT operator, we can turn this circuit producing function into a circuit
Note that according to Definition 8.2.4, some applications are values, namely
terms of the form unbox v. This is consistent with the meaning of the unbox constant
discussed above. Indeed, if unbox turns a circuit into a circuit-generating function,
then a term of the form unbox v should be seen as a function awaiting an argument,
much like a term of the form λx.a, and therefore considered a value.
We now introduce some useful syntactic operations on types and terms. We start
by defining the notion of free variable for Proto-Quipper terms.
Definition 8.2.5. The set of free (term) variables of a term a, written FV(a), is
defined as
• FV(x) = {x},
The above definition of free variables extends the standard one. Note that the free
variables of a term of the form (t, C, a) are the free variables of a. This is justified
since no variables ever appear in the quantum data term t.
The notions of α-equivalence, capture-avoiding substitution, etc., are defined in a
straightforward manner.
By analogy with the free term variables of a term, we introduce a notion of quan-
tum variable of a term.
Definition 8.2.6. The set of free quantum variables of a term a, written FQ(a), is
defined as
• FQ(q) = {q},
• FQ(λx.a) = FQ(a),
Note that FQ((t, C, a)) = ∅. This reflects the idea that the quantum variables
appearing in t and a are “bound” in (t, C, a).
To append circuits, we will need to be able to express the way in which wires
should be connected. For this, we use the notion of a binding.
Definition 8.2.10. The partial function bind : QDataTerm2 → Bijf (Q) is defined as
• bind(∗, ∗) = ∅;
• SpecX (1) = ∗,
Definition 8.2.12. The subtyping relation <: is the smallest relation on types satis-
fying the rules given in Figure 8.1.
!A <: A .
We write Γ or ∆ for a typing context and Q for a quantum context. We also adopt
the previous notational conventions when dealing with typing contexts: |Γ|, Γ(xi ),
!Γ, and Γ <: Γ′ . Moreover, we still write Γ, Γ′ to denote the union of two contexts,
which is defined when |Γ| ∩ |Γ′ | = ∅.
119
Definition 8.2.16. Let T, U be quantum data types. For each of the constants boxT ,
unbox, and rev, we introduce a type as follows
Γ; Q ⊢ a : A
As mentioned Section 8.1, the reduction relation for Proto-Quipper is defined in the
presence of a circuit constructor. This is a device capable of performing certain basic
circuit building operations. It is not necessary to have a detailed description of the
inner workings of this device. In fact, all that is required for the definition of Proto-
Quipper’s operational semantics is the existence of some primitive operations. We
now axiomatize these operations. Their intuitive meaning will be explained following
Definition 8.3.1.
120
A <: B (axc ) (axq )
!∆, x : A; ∅ ⊢ x : B !∆; {q} ⊢ q : qubit
!Ac (T, U ) <: B
(cst) (∗i )
!∆; ∅ ⊢ c : B !∆; ∅ ⊢ ∗ : !n 1
Γ, x : A; Q ⊢ b : B !∆, x : A; ∅ ⊢ b : B
(λ1 ) (λ2 )
Γ; Q ⊢ λx.b : A ( B !∆; ∅ ⊢ λx.b : !n+1 (A ( B)
Γ1 , !∆; Q1 ⊢ c : A ( B Γ2 , !∆; Q2 ⊢ a : A
(app)
Γ1 , Γ2 , !∆; Q1 , Q2 ⊢ ca : B
Γ1 , !∆; Q1 ⊢ a : !n A Γ2 , !∆; Q2 ⊢ b : !n B
(⊗i )
Γ1 , Γ2 , !∆; Q1 , Q2 ⊢ ⟨a, b⟩ : !n (A ⊗ B)
Γ1 , !∆; Q1 ⊢ b : !n (B1 ⊗ B2 ) Γ2 , !∆, x : !n B1 , y : !n B2 ; Q2 ⊢ a : A
(⊗e )
Γ1 , Γ2 , !∆; Q1 , Q2 ⊢ let ⟨x, y⟩ = b in a : A
Γ1 , !∆; Q1 ⊢ b : !n 1 Γ2 , !∆; Q2 ⊢ a : A
(∗ )
Γ1 , Γ2 , !∆; Q1 , Q2 ⊢ let ∗ = b in a : A e
(⊤) (⊥)
!∆; ∅ ⊢ True : !n bool !∆; ∅ ⊢ False : !n bool
Γ1 , !∆; Q1 ⊢ b : bool Γ2 , !∆; Q2 ⊢ a1 : A Γ2 , !∆; Q2 ⊢ a2 : A
(if )
Γ1 , Γ2 , !∆; Q1 , Q2 ⊢ if b then a1 else a2 : A
Q1 ⊢ t : T !∆; Q2 ⊢ a : U In(C) = Q1 Out(C) = Q2
(circ)
!∆; ∅ ⊢ (t, C, a) : !n Circ(T, U )
• New : Pf (Q) → S,
• In : S → Pf (Q),
• Out : S → Pf (Q),
• Rev : S → S,
1. Rev ◦ Rev = 1S ,
121
If ⟨Q, S⟩ is a circuit constructor, we call the elements of S circuit states and the
elements of Q wire identifiers. We now explain the intended meaning of a circuit
constructor and its constituents. An element C ∈ S is a quantum circuit, such as
q1 H q3
C =
q2 • q4 .
Each circuit has a finite set of inputs and a finite set of outputs, given by the functions
In and Out. For example, In(C) = {q1 , q2 } and Out(C) = {q3 , q4 }. For X ⊆ Q, the
circuit New(X) is the identity circuit with inputs and outputs X; for example,
q1 q1
New(q1 , q2 , q3 ) = q2 q2
q3 q3 .
The operator Rev reverses a circuit, swapping its inputs and outputs in the process.
When (C ′ , b′ ) = Append(C, D, b), the circuit C ′ is obtained by appending the circuit
D to the end of the circuit C. The function b is used to specify along which wires
to compose C and D while the function b′ updates the wire names post composition.
An illustration of this is given in Figure 8.3.
We note that the axiomatization of Definition 8.3.1 does not mention the concept
of a gate. Indeed, any gate is a circuit, and thus a member of the set S; conversely,
any circuit can be used as a gate. In Proto-Quipper, we simply assume that certain
members of S are available as pre-defined constants, serving as “elementary” gates.
The operation of appending a gate to a circuit is subsumed by the more general
operation of composing circuits.
Proto-Quipper’s quantum variables and circuit constants are supposed to be the
syntactic representatives of a circuit constructor’s wire identifiers. This idea is for-
malized in the following definition.
122
b
b′
q1 q1 q1′ p1 p′1
q2 q2 q2′ p2 p′2
D
q3 q3 q3′ p3 p′3
C
q4 q4 q4
q5 q5 q5
Remark 8.3.3. The existence of the bijections Wire and Name has the following con-
sequences:
• If t and u are quantum data terms such that bind(t, u) = b, then we can define
b = Wire ◦ b ◦ Wire−1 ∈ Bijf (Q).
From now on, we always assume an adequate circuit constructor. Moreover, we work
under the simplifying assumptions that Q = Q, C = S, Wire = 1Q , and Name = 1S .
This notably implies that In = In and Out = Out.
The rules are separated in three groups. The first group and second group contain
the congruence rules and classical rules respectively. Except for the rule for (t, D, a),
these rules are standard. They describe a call-by-value reduction strategy. The
circuit generating rule for rev(t, C, t′ ) rule is straightforward. We briefly discuss the
remaining rules.
The rule for boxT (v) is to be understood as follows. To reduce a closure of the
form [C, boxT (v)], start by generating a specimen of type T . Then apply the function
v on the input t in the context of an empty circuit of the appropriate arity. By the
congruence rule for (t, D, a), this computation will continue until a value is reached,
i.e., a term of the form (t, D, t′ ). Note that while this computation is taking place,
the state C is not accessible. When a value of the form (t, D, t′ ) is reached, the
construction of C can resume. Note that it was necessary to know the type T in
order to generate the appropriate specimen. This explains the choice of a Church-
style typing of the box operator.
The rule for (unbox (u, D, u′ ))v will first generate a binding from v and the input
u of D. Then, it will compose C and D along that binding and update the names of
the wire identifiers appearing in u′ according to b′ .
The recursive nature of the reduction rules explains why closures are not required
to satisfy FQ(a) = Out(C). The requirement that FQ(a) ⊆ Out(C) is justified by
the idea that a term should not affect a wire outside of C. But if we also asked for
the opposite inclusion, it would not be possible to define a recursive reduction in a
straightforward way. For example, the reduction of a pair is done component-wise: to
reduce ⟨a, b⟩ one first reduces b. The simplest way to express this in terms of closures
is to carry the whole circuit state along. This implies that if both a and b contain
wire identifiers, then the equality FQ(a) = Out(C) cannot be satisfied.
Unlike in the quantum lambda calculus, Proto-Quipper’s reduction is not proba-
bilistic, in the sense that the right member of any reduction rule is a unique closure.
124
[C, a] → [C ′ , a′ ] [C, b] → [C ′ , b′ ]
(f un) (arg)
[C, ab] → [C ′ , a′ b] [C, vb] → [C ′ , vb′ ]
[C, b] → [C ′ , b′ ] [C, a] → [C ′ , a′ ]
(right) (lef t)
[C, ⟨a, b⟩] → [C ′ , ⟨a, b′ ⟩] [C, ⟨a, v⟩] → [C ′ , ⟨a′ , v⟩]
[C, a] → [C ′ , a′ ]
(let∗)
[C, let ∗ = a in b] → [C ′ , let ∗ = a′ in b]
[C, a] → [C ′ , a′ ]
(let)
[C, let ⟨x, y⟩ = a in b] → [C ′ , let ⟨x, y⟩ = a′ in b]
[C, a] → [C ′ , a′ ]
(cond)
[C, if a then b else c] → [C ′ , if a′ then b else c]
[D, a] → [D′ , a′ ]
(circ)
[C, (t, D, a)] → [C, (t, D′ , a′ )]
(β)
[C, (λx.a)v] → [C, a[v/x]]
(unit)
[C, let ∗ = ∗ in a] → [C, a]
(pair)
[C, let ⟨x, y⟩ = ⟨v, w⟩ in a] → [C, a[v/x, w/y]]
(if F )
[C, if False then a else b] → [C, b]
(if T )
[C, if True then a else b] → [C, a]
SpecFQ(v) (T ) = t new(FQ(t)) = D
(box)
[C, boxT (v)] → [C, (t, D, vt)]
bind(v, u) = b Append(C, D, b) = (C ′ , b′ ) FQ(u′ ) ⊆ dom(b′ )
(unbox)
[C, (unbox (u, D, u′ ))v] → [C ′ , b′ (u′ )]
(rev)
[C, rev (t, C, t′ )] → [C, (t′ , C −1 , t)]
Proposition 8.3.6. If [C, a] is a closure, then at most one reduction rule applies to
it.
Since F can be given the type qubit ⊗ qubit ( qubit ⊗ qubit, we can use
boxqubit⊗qubit to turn F into a Proto-Quipper circuit. Now consider the closure
where − is any circuit state. The (box) rule applies, so that a specimen of type
qubit ⊗ qubit is created, say ⟨q1 , q2 ⟩, and (8.1) reduces to
We now repeatedly consider reducts of this closure until a value is reached. For clarity,
we represent circuit states as circuits. In two classical reductions we reach the closure
q1 q1
q2 q2 CNOT⟨H q1 , S q2 ⟩.
Here we assumed for simplicity that the output wire of the S was not renamed. Since
q1 is a value, we now reduce S q2 . This yields
q1 H q1
CNOT⟨q1 , q2 ⟩.
q2 S q2
q1 H q1
⟨q1 , q2 ⟩. (8.2)
q2 S • q2
Since ⟨q1 , q2 ⟩ is a value, the execution is finished. The final circuit is now returned in
the form of a term of the language, e.g., as
where D is the constant representing the circuit on the left hand side of (8.2).
Chapter 9
Type-safety of Proto-Quipper
Before proving the subject reduction and progress, we record some properties of the
type system, including the technical but important Substitution Lemma. Note that
the typing rules enforce a strict linearity on variables and quantum variables. In
particular, if a quantum variable appears in the quantum context of a valid typing
judgement for a term a, then it must belong to the free quantum variables of a.
Lemma 9.1.1.
127
128
• If T = qubit, then SpecX (T ) = q for some quantum variable q and we can use
the (axq ) rule.
Lemma 9.1.5. If a term a is not a value then it is of one of the following forms
• (t, C, a′ ) with a′ ∈
/ Val,
• ⟨a1 , a2 ⟩ with a1 ∈
/ Val or a2 ∈
/ Val,
• if a1 then a2 else a3 ,
• let ∗ = a1 in a2 ,
• let ⟨x, y⟩ = a1 in a2 , or
• a1 a2 with a1 ̸= unbox or a2 ∈
/ Val.
Lemma 9.1.8. If T is a quantum data type and v1 , v2 are well-typed values of type
T , then b = bind(v1 , v2 ) is a well-defined binding, dom(b) = FQ(v1 ), and cod(b) =
FQ(v2 ).
Proof. By Corollary 9.1.7, we know that v1 and v2 are quantum data terms so that
the statement of the lemma makes sense. The proof then proceeds by induction on
T , using Lemma 9.1.6.
B <: A (axc )
!∆, x : B; ∅ ⊢ x : A
A′ <: A (axc )
!∆, x : !B ′ , y : A′ ; ∅ ⊢ y : A
130
• If the last rule of π1 is one of (axq ), (cst), (∗i ), (⊤) and (⊥), and a is the
corresponding constant, then x ∈
/ FV(a) and x must be declared of some type
!B ′ . We can therefore reason as in the previous case.
• If the last rule of π1 is (app), and a = ca′ , then π1 can be of one of three forms
depending on B. If B is duplicable, then π1 is
.. ..
. .
Γ1 , x : !B ′ , !∆; Q1 ⊢ c : A′ ( A Γ2 , x : !B ′ , !∆; Q2 ⊢ a′ : A′
(app)
Γ1 , Γ2 , !∆, x : !B ′ ; Q1 , Q2 ⊢ ca′ : A
or
.. ..
. .
Γ1 , !∆; Q1 ⊢ c : A′ ( A Γ2 , x : B, !∆; Q2 ⊢ a′ : A′
(app).
Γ1 , Γ2 , !∆, x : B; Q1 , Q2 ⊢ ca′ : A
In the first case, the induction hypothesis implies that Γ1 , Γ′ !∆; Q1 , Q′ ⊢ c[v/x] :
A′ ( A is valid and we can conclude by (app). The second case is treated
analogously.
• If the last rule of π1 is one of (⊗i ), (⊗e ), (∗e ) and (if ), and a is the corresponding
term, then we can reason as above by considering in turn the case where B is
duplicable and the case where B is non-duplicable.
We now prove that Proto-Quipper enjoys the subject reduction property. Since the
reduction relation is defined on closures but the typing rules apply to terms, we start
by extending the notions of typing judgement and validity to closures.
Proof. By induction on the derivation of [C, a] → [C ′ , a′ ]. In all but the (unbox) case,
the result follows either from the induction hypothesis or from the fact that C = C ′ .
In the (unbox) case, use Definition 8.3.1.4a.
Proof. We prove the theorem by induction on the derivation of the reduction [C, a] →
[C ′ , a′ ]. In each case, we start by reconstructing the unique typing derivation π of
Γ; FQ(a) ⊢ a : A and we use it to prove that Γ; FQ(a′ ) ⊢ [C ′ , a′ ] : A, (Q′ |Q′′ ) is valid.
By Lemma 9.2.2 we never need to verify that In(C ′ ) = Q′ so that we only need to
show:
• Γ; FQ(a′ ) ⊢ a′ : A is valid.
Throughout the proof, we write IH(π) to denote the proof obtained by applying the
induction hypothesis to π.
Congruence rules: These rules are treated uniformly. We illustrate the (f un) and
(circ) cases.
[C, c] → [C ′ , c′ ]
[C, cb] → [C ′ , c′ b]
and Γ1 , Γ2 ; FQ(c), FQ(b) ⊢ [C, cb], (Q′ |Q′′ ) is valid. It follows that
is valid and, by the induction hypothesis, this implies that Γ1 , !∆; FQ(c′ ) ⊢
[C ′ , c′ ] : B ( A, (Q′ | FQ(b), Q′′ ) is also valid. In particular, it follows that
Out(C ′ ) = FQ(c′ ), FQ(b), Q′′ . This, together with the following typing
derivation,
.. ..
. IH(π1 ) . π2
Γ1 , !∆; FQ(c′ ) ⊢ c′ : B ( A Γ2 , !∆; FQ(b) ⊢ b : B
Γ1 , Γ2 , !∆; FQ(c′ ), FQ(b) ⊢ c′ b : A
[D, b] → [D′ , b′ ]
(circ)
[C, (t, D, b)] → [C, (t, D′ , b′ )]
.. ..
. π1 . π2 Out(D) = FQ(b)
FQ(t) ⊢ t : T !∆; FQ(b) ⊢ b : U In(D) = FQ(t)
!∆; ∅ ⊢ (t, D, b) : !n Circ(T, U )
and !∆; ∅ ⊢ [C, (t, D, b)] : !n Circ(T, U ), (Q′ |Q′′ ) is valid. Disregarding π1 ,
it follows from the assumptions in the above rule that !∆; FQ(b) ⊢ [D, b] :
U, (FQ(t)|∅) is valid and, by the induction hypothesis, this implies that
!∆, FQ(b′ ) ⊢ [D′ , b′ ] : U, (FQ(t)|∅) is also valid. This, together with the
following typing derivation,
.. ..
. π1 . IH(π2 ) Out(D′ ) = FQ(b′ )
FQ(t) ⊢ t : T !∆; FQ(b′ ) ⊢ b′ : U In(D′ ) = FQ(t) .
!∆; ∅ ⊢ (t, D, b′ ) : !n Circ(T, U )
Classical rules: These rules are also treated uniformly, we illustrate the (β) case.
134
and Γ1 , Γ2 , !∆; FQ(b), FQ(v) ⊢ [C, (λx.b)v] : A, (Q′ |Q′′ ) is valid. We then
know, by Lemma 9.1.9, that Γ1 , Γ2 , !∆; FQ(b), FQ(v) ⊢ b[v/x] : A is a valid
typing judgement which implies that
Circuit generating rules: These rules represent the most interesting cases. We
treat them individually.
and !∆; ∅ ⊢ [C, boxT (v)] : !n Circ(T, U ), (Q′ |Q′′ ) is valid. There exists
a typing derivation π2 of FQ(t) ⊢ t : T , by Lemma 9.1.2. Applying
Lemma 9.1.1.4 to π1 we get a derivation π1′ of !∆; ∅ ⊢ v : T ( U . We can
therefore construct the following derivation τ :
.. ′ .. ′
. π1 . π2
!∆; ∅ ⊢ v : T ( U !∆; FQ(t) ⊢ t : T
!∆; FQ(t) ⊢ vt : U
135
Hence !∆; ∅ ⊢ [C, (t, D, vt)] : !n Circ(T, U )(Q′ |Q′′ ) is a valid typed closure.
• (unbox): the reduction rule is
bind(v, u) = b Append(C, D, b) = (C ′ , b′ ) FQ(u′ ) ⊆ dom(b′ )
[C, (unbox (u, D, u′ ))v] → [C ′ , b′ (u′ )]
with a = (unbox (u, D, u′ ))v and a′ = b′ (u′ ). To reconstruct the typing
derivation π, first note that we have the following derivation π1 of !∆; ∅ ⊢
unbox (u, D, u′ ) : T ( U
.. 1 .. 2
. π1 . π1
FQ(u) ⊢ u : T !∆; FQ(u′ ) ⊢ u′ : U
!∆; ∅ ⊢ unbox : Circ(T, U ) ( (T ( U ) !∆; ∅ ⊢ (u, D, u′ ) : Circ(T, U )
′
!∆; ∅ ⊢ unbox (u, D, u ) : T ( U
with a = rev (t, D, t′ ) and a′ = (t′ , D−1 , t). The typing derivation π is
therefore
.. ..
. π1 . π2
FQ(t) ⊢ t : T !∆; FQ(t′ ) ⊢ t′ : U
n
!∆; ∅ ⊢ rev : Circ(T, U ) ( ! Circ(U, T ) !∆; ∅ ⊢ (t, D, t′ ) : Circ(T, U )
!∆; ∅ ⊢ rev (t, D, t′ ) : !n Circ(U, T )
Corollary 9.2.4. If Γ; FQ(a) ⊢ [C, a] : A, (Q′ |Q′′ ) is a valid typed closure and
[C, a] →∗ [C ′ , a′ ], then Γ; FQ(a′ ) ⊢ [C ′ , a′ ] : A, (Q′ |Q′′ ) is also a valid typed closure.
Proof. By induction on the length of the reduction sequence. The base case is pro-
vided by Theorem 9.2.3.
The above formulation of Subject Reduction explains why a typed closure contains
information about the input and output wires of the circuit state. Indeed, Subject
Reduction now guarantees (1) that the input wires of a circuit remain unchanged
through reduction and (2) that a term can only affect wires whose identifiers are
among its quantum variables.
137
9.3 Progress
Theorem 9.3.1 (Progress). If FQ(a) ⊢ [C, a] : A, (Q′ |Q′′ ) is a valid typed closure
then either a ∈ Val or there exists a closure [C ′ , a′ ] such that [C, a] → [C ′ , a′ ].
First, note that the Progress property is stated for a typed closure whose typing
context is empty. This is because the property is not expected to hold if we allow
for a non-empty typing context. Indeed, it is easy to see that there are well-typed,
non-closed closures such as [C, xy], which are neither values nor reduce. We now
prove the theorem.
1. If a = (t, D, a′ ) with a′ ∈
/ Val, then the typing derivation π is:
.. ..
. π1 . π2 Out(D) = FQ(a′ )
FQ(t) ⊢ t : T FQ(a′ ) ⊢ a′ : U In(D) = FQ(t) .
′
∅ ⊢ (t, D, a ) : Circ(T, U )
is therefore valid. Since a′ is not a value, the induction hypothesis implies that
there exists a′′ such that [D, a′ ] → [D′ , a′′ ] and [C, (t, D, a′ )] therefore reduces
to [C, (t, D′ , a′′ )] by the (circ) reduction rule.
2. If a = ⟨a1 , a2 ⟩ with a1 ∈
/ Val or a2 ∈
/ Val, then the typing derivation π is:
.. ..
. π1 . π2
FQ(a1 ) ⊢ a1 : ! A1 FQ(a2 ) ⊢ a2 : !n A2 .
n
Conclusion
In this thesis, we applied tools from algebraic number theory and mathematical logic
to problems in the theory of quantum computation. We described algorithms to
solve the problem of approximate synthesis of special unitaries over the Clifford+V
and Clifford+T gate sets. We also defined a typed lambda calculus for quantum
computation called Proto-Quipper which serves as a mathematical foundation for the
Quipper quantum programming language. In conclusion, we briefly describe some
avenues for future research.
The synthesis methods described in chapters 6 and 7 belong to a very recent fam-
ily of number-theoretic algorithms. Many generalization of these methods can be
considered.
• The algorithms described in chapters 6 and 7 are only optimal for z-rotations.
While Euler angle decompositions can be used to extend these methods to
arbitrary special unitaries, optimality is lost in the process. A first potential
generalization of the methods of chapters 6 and 7 is to define optimal number-
theoretic synthesis algorithms for arbitrary special unitaries.
140
141
devised for a relatively general family of gate sets ([19] and [43]). While these
exact synthesis methods have not yet been extended to approximate synthesis
algorithms, we expect that, at least in some cases, this extension should carry
through with relative ease.
We note that the decomposition algorithm of Fowler [20] as well as the Solovay-Kitaev
algorithm [14] are both very general. Indeed, both algorithms allow the synthesis
of arbitrary special unitaries over any gate set and in any dimension. Since the
algorithms presented in chapters 6 and 7 rely on specific properties of the rings of
algebraic integers associated with the Clifford+V and Clifford+T gate set, there is
no reason for these methods to generalize to arbitrary gate sets. However, it might
be possible to identify a general class of gate sets to which these methods apply.
Another interesting avenue of future research lies in a modification of the state-
ment of the synthesis problem itself, by allowing a broader notion of circuit. As a first
such generalization, one can introduce ancillary qubits in the approximating circuit.
Suppose a special unitary U and a precision ε > 0 are given. Instead of searching for
W ∈ U(2) such that ∥U − W ∥ < ε one can look for W ∈ U(2n+1 ) such that for any
state |φ⟩ we have
In other words, unitaries acting on more than one qubit can be considered, provided
that they return the additional qubits nearly unchanged. The advantage of such a
generalized notion of circuit is that it opens the door to a certain form of paralleliza-
tion. In particular, even if the number of non-Clifford gates in the approximating
circuit remains unchanged, applying them in parallel, rather than sequentially, may
represent a gain.
142
10.2 Proto-Quipper
• In the current version of Proto-Quipper, all circuits are reversible. This follows
from the definition of the (rev) and (circ) typing rules and will have to be
modified to accommodate non-reversible gates such as measurements. In such
a setting, the type system should ensure that circuits are reversed only if it is
meaningful to do so. In particular, if a circuit contains a measurement, then it
should not be possible to reverse it.
• A circuit generating function that inputs a list of qubits does not define just one
circuit, but rather a family of circuits parameterized by the length n of the list.
To box such a function, a particular value of n has to be given. In Quipper, we
refer to n as the “shape” of the argument of the function. Operations such as
boxing and reversing often require shape information. An alternative solution
would be to equip Proto-Quipper with a dependent type system. This would
allow shape information to be stored at the type level.
[1] D.S. Alexander, Neil J. Ross, P. Selinger, J.M. Smith, and B. Valiron. Program-
ming the quantum future. Communications of the ACM, 2015. To appear.
[2] A. Ambainis, A. M. Childs, B.W. Reichardt, R. Špalek, and S. Zhang. Any AND-
1
OR formula of size n can be evaluated in time n 2 +o(1) on a quantum computer.
SIAM J. Comput., 39:2513–2530, 2010.
[4] H.P. Barendregt. The Lambda Calculus : Its Syntax and Semantics., volume 103
of Studies in Logic and the Foundations of Mathematics. MIT Press, 1981.
[5] Andreas Blass, Alex Bocharov, and Yuri Gurevich. Optimal ancilla-free Pauli+V
circuits for axial rotations. Available from arXiv:1412.1033, December 2014.
[6] Alex Bocharov, Xingshan Cui, Vadym Kliuchnikov, and Zhenghan Wang. Effi-
cient topological compilation for weakly-integral anyon model. Available from
arXiv:1504.03383, April 2015.
[7] Alex Bocharov, Yuri Gurevich, and Krysta M. Svore. Efficient decomposition
of single-qubit gates into V basis circuits. Phys. Rev. A, 88:012313 (13 pages),
2013. Also available from arXiv:1303.1411.
[8] Alex Bocharov, Martin Roetteler, and Krysta M. Svore. Efficient synthesis of
universal repeat-until-success circuits. Available from arXiv:1404.5320, April
2014.
[12] Koen Claessen. Embedded Languages for Describing and Verifying Hardware.
PhD thesis, Chalmers University of Technology and Göteborg University, 2001.
144
145
[13] Henri Cohen. Advanced topics in computational number theory. Graduate texts
in mathematics. Springer, New York, N.Y., Berlin, Heidelberg,, 2000.
[15] David Deutsch. Quantum theory, the Church-Turing principle and the univer-
sal quantum computer. Proceedings of the Royal Society of London, Series A,
Mathematical and Physical Sciences, 400:97–117, 1985.
[19] Simon Forest, David Gosset, Vadym Kliuchnikov, and David McKinnon. Exact
synthesis of single-qubit unitaries over Clifford-cyclotomic gate sets. Available
from arXiv:1501.4150, January 2015.
[20] Austin G. Fowler. Constructing arbitrary Steane code single logical qubit fault-
tolerant gates. Quantum Information and Computation, 11(9–10):867–873, 2011.
Also available from arXiv:quant-ph/0411206.
[21] Brett Giles and Peter Selinger. Exact synthesis of multiqubit Clifford+T circuits.
Physical Review A, 87:032332, 2013. Also available from arXiv:1212.0506.
[22] Brett Giles and Peter Selinger. Remarks on Matsumoto and Amano’s normal
form for single-qubit Clifford+T operators. Available from arXiv:1312.6584,
December 2013.
[23] J.-Y. Girard. Linear logic. Theoretical Computer Science, 50(1):1–102, 1987.
[24] Jean-Yves Girard, Yves Lafont, and Paul Taylor. Proofs and Types. Number 7
in Cambridge Tracts in Theoretical Computer Science. Cambridge University
Press, 1989.
[39] Vadym Kliuchnikov, Alex Bocharov, and Krysta M. Svore. Asymptotically opti-
mal topological quantum compiling. Available from arXiv:1310.4150, October
2013.
[40] Vadym Kliuchnikov, Dmitri Maslov, and Michele Mosca. Practical approxima-
tion of single-qubit unitaries by single-qubit quantum Clifford and T circuits.
Also available from arXiv:1212.6964, December 2012.
[41] Vadym Kliuchnikov, Dmitri Maslov, and Michele Mosca. Asymptotically optimal
approximation of single qubit unitaries by Clifford and T circuits using a constant
number of ancillary qubits. Phys. Rev. Lett., 110:190502 (5 pages), 2013. Also
available from arXiv:1212.0822v2.
[42] Vadym Kliuchnikov, Dmitri Maslov, and Michele Mosca. Fast and efficient exact
synthesis of single qubit unitaries generated by Clifford and T gates. Quan-
tum Information and Computation, 13(7–8):607–630, 2013. Also available from
arXiv:1206.5236v4.
[43] Vadym Kliuchnikov and Jon Yard. A framework for exact synthesis. Available
from arXiv:1504.04350, April 2015.
[44] E. Knill. Conventions for quantum pseudocode, 1996.
[45] H.W. Lenstra, Jr. Integer programming with a fixed number of variables. Math.
Oper. Res., 8:538 – 548, 1983.
[46] A. Lubotzky, R. Phillips, and P. Sarnak. Hecke operators and distributing points
on the sphere I. Communications on Pure and Applied Mathematics, 39:S149–
S186, 1986.
[47] A. Lubotzky, R. Phillips, and P. Sarnak. Hecke operators and distributing points
on S 2 II. Communications on Pure and Applied Mathematics, 40:401–420, 1987.
[48] Frédéric Magniez, Miklos Santha, and Mario Szegedy. Quantum algorithms for
the triangle problem. quant-ph/0310134, 2003.
[49] Wladyslaw Narkiewicz. Elementary and analytic theory of algebraic numbers.
Springer-Verlag Warszawa, Berlin, 1990.
[50] Michael A. Nielsen and Isaac L. Chuang. Quantum Computation and Quantum
Information. Cambridge University Press, 2002.
[51] Adam Paetznick and Krysta M. Svore. Repeat-until-success: Non-deterministic
decomposition of single-qubit unitaries. Available from arXiv:1311.1074,
November 2013.
[52] Robert Raussendorf and Hans J. Briegel. Computational model underlying the
one-way quantum computer. Quantum Info. Comput., 2(6):443–486, October
2002.
148
[53] Oded Regev. Quantum computation and lattice problems. SIAM J. Comput.,
33(3):738–760, 2004.
[55] Neil J. Ross, P. Selinger, J.M. Smith, and B. Valiron. Quipper: Concrete resource
estimation in quantum algorithms. Extended abstract for QAPL 2014. Available
from arXiv:1412.0625, 2014.
[56] Neil J. Ross and Peter Selinger. Optimal ancilla-free Clifford+T approximation
of z-rotations. Available from arXiv:1403.2975, March 2014.
[57] Neil J. Ross and Peter Selinger. Exact and approximate synthesis of quantum
circuits, version 0.3.0.1. Software implementation available from http://www.
mathstat.dal.ca/~selinger/newsynth/, 2015.
[58] P. Selinger and B. Valiron. Quantum lambda calculus. In S. Gay and I. Mackie,
editors, Semantic Techniques in Quantum Computation, pages 135–172. Cam-
bridge University Press, 2009.
[61] Peter Selinger and Benoı̂t Valiron. A lambda calculus for quantum computation
with classical control. Mathematical Structures in Computer Science, 16(3):527–
552, 2006.
[63] André van Tonder. A lambda calculus for quantum computation. SIAM J.
Comput., 33(5):1109–1135, May 2004.
[66] Nathan Wiebe and Vadym Kliuchnikov. Floating point representations in quan-
tum circuit synthesis. Available from arXiv:1305.5528, May 2013.
[67] Nathan Wiebe and Martin Roetteler. Quantum arithmetic and numerical anal-
ysis using repeat-until-success circuits. Available from arXiv:1406.2040, June
2014.