Programming with Quantum Communication
This work develops a formal framework for specifying, implementing, and analysing quantum communication protocols. We provide tools for developing simple proofs and analysing programs which involve communication, both via quantum channels and exhibiting the LOCC (local operations, classical communication) paradigm.
University of Toronto
University of Toronto
The term quantum communication refers to the process of transferring a quantum state between distinct physical locations. There are two ways of accomplishing this task. The first one is analogous to classical communication and involves sending a quantum bit over a quantum communication channel (just as classical communication is associated with sending classical bits over a classical communication channel). The second one has no classical analogue. In a quantum world it is possible to transfer a quantum bit without utilising a quantum channel, by using a classical communication channel and a pair of entangled states and applying quantum operations locally.
This work develops a formal framework for specifying, implementing, and analysing quantum communication protocols. We provide tools for developing simple proofs and analysing programs which involve communication, both via quantum channels and exhibiting the LOCC (local operations, classical communication) paradigm. We look at quantum communication in the context of formal methods of program development, or programming methodology. This is the field of computer science concerned with applications of mathematics and logic to software engineering tasks. In particular, the formal methods provide tools to formally express specifications, prove correctness of implementations, and reason about various properties of specifications (e.g. implementability) and of implementations (e.g. time and space complexity).
In this work the analysis of quantum communication protocols is based on quantum predicative programming ([22, 23, 21]), a recent generalisation of the well-established predicative programming ([14, 15]). It supports the style of program development in which each programming step is proved correct as it is made. We inherit the advantages of the theory, such as its generality, simple treatment of recursive programs, and of time and space complexity. The theory of quantum programming provides tools to write both classical and quantum specifications, develop quantum programs that implement these specifications, and reason about their comparative time, space, and communication complexity, all in the same framework.
There has been a number of proposals for formal approaches to quantum programming, including the language qGCL [19, 27], process algebraic approaches of [4, 17, 16], tools developed in the field of category theory [1, 2, 3, 10, 20], functional languages of [6, 7, 5, 24], as well as work of , , and . A detailed discussion of the work related to quantum predicative programming is presented in .
The contribution of this work is twofold. Firstly, we present a framework for implementing quantum communication protocols, specifying desired properties of the protocols, and formally proving whether these properties hold. The properties are not restricted to reasoning about the data sent or received by the parties involved. We provide tools to prove properties which deal with the complexity of the protocol, such as the number of classical and quantum bits sent during its execution. Secondly, the reasoning about quantum communication fits nicely in the general framework of quantum predicative programming, and thus inherits all of its advantages. The definitions of specification and program are simple: a specification is a boolean (or probabilistic) expression and a program is a specification. The treatment of recursion is simple: there is no need for additional semantics of loops. The treatment of termination simply follows from the introduction of a time variable; if the final value of the time variable is , then the program is a non-terminating one. There is a uniform method for proving correctness and time, space, and communication complexity; moreover, after proving them separately, we naturally obtain the conjunction. The use of Dirac-like notation makes it easy to write down specifications and develop algorithms. Finally, the treatment of computation with mixed states does not require any additional mechanisms.
The rest of this work is organised as follows. Section 2 is a brief introduction to quantum predicative programming. The contribution of this work is Section 3 which introduces a formal framework for specifying, implementing, and analysing quantum communication protocols and presents the analysis of two such protocols: quantum teleportation and quantum dense coding. Section 4 states conclusions and outlines directions for future research. A short introduction to quantum computing is presented in the Appendix A.
2 Quantum Predicative Programming
This section introduces the programming theory of our choice — quantum predicative programming. We briefly introduce parts of the theory necessary for understanding Section 3 of this work. For a course in predicative programming the reader is referred to . An introduction to probabilistic predicative programming can be found in . Quantum predicative programming is developed in [22, 23, 21].
2.1 Predicative programming
In predicative programming a specification is a boolean expression. The variables in a specification represent the quantities of interest, such as prestate (inputs), poststate (outputs), and computation time and space. We use primed variables to describe outputs and unprimed variables to describe inputs. For example, specification states that the final value of is its initial value plus . A computation satisfies a specification if, given a prestate, it produces a poststate, such that the pair makes the specification true. A specification is implementable if for each input state there is at least one output state that satisfies the specification.
We use standard logical notation for writing specifications: (conjunction), (disjunction), (logical implication), (equality, boolean equivalence), (non-equality, non-equivalence), and if then else. The larger operators , , and are the same as , , and , but with lower precedence. We use standard mathematical notation, such as . We use lowercase letters for variables of interest and uppercase letters for specifications.
In addition to the above, we use the following notations: (prestate), (poststate), (), and (). The notation specifies that the values of all variables are unchanged. In the assignment , is a state variable (unprimed) and is an expression (in unprimed variables) in the domain of .
If and are specifications in variables , then the sequential composition of and is defined by
where is obtained from by substituting all occurrences of primed variables with double-primed variables , and is obtained from by substituting all occurrences of unprimed variables with double-primed variables .
Various laws can be proved about sequential composition. One of the most important ones is the substitution law, which states that for any expression of the prestate, state variable , and specification ,
Specification is refined by specification if and only if is satisfied whenever is satisfied, that is . Given a specification, we are allowed to implement an equivalent specification or a stronger one.
A program is an implemented specification. A good basis for classical (non-quantum) programming is provided by: , assignment, if then else, sequential composition, booleans, numbers, bunches, and functions. Given a specification , we proceed as follows. If is a program, there is no work to be done. If it is not, we build a program , such that refines , i.e. . The refinement can proceed in steps: .
In it is possible for to appear in . No additional rules are required to prove the refinement. For example, it is trivial to prove that
The specification says that if the initial value of is non-negative, its final value must be . The solution is: if the value of is zero, do nothing, otherwise decrement and repeat.
2.2 Probabilistic predicative programming
A probability is a real number between and , inclusive. A distribution is an expression whose value is a probability and whose sum over all values of variables is . Given a distribution of several variables, we can sum out some of the variables to obtain a distribution of the rest of the variables.
To generalise boolean specifications to probabilistic specifications, we use and both as numbers and as boolean and , respectively. If and are specifications in variables , then the definition (2.1) of sequential composition of and is generalised to
where and are defined as before.
If is a probability and and are distributions, then
If is an implementable deterministic specification and is a distribution of the initial state , then the distribution of the final state is
Various laws can be proved about sequential composition. One of the most important ones, the substitution law, introduced earlier, applies to probabilistic specifications as well.
2.3 Quantum Predicative Programming
Let be the set of all complex numbers with the absolute value operator and the complex conjugate operator . Then a state of an -qubit system is a function , such that . Here notation means from (and including) to (and excluding) .
If and are two states of an -qubit system, then their inner product, denoted by , is defined by:
A basis of an -qubit system is a collection of quantum states , such that . We adopt the following Dirac-like notation for the computational basis: if is from the domain , then x denotes the corresponding -bit binary encoding of and is the following quantum state:
where is a function of a variable with domain and body . If is a state of an -qubit system and is a state of an -qubit system, then , the tensor product of and , is the following state of a composite -qubit system:
We write to mean “ tensored with itself times”. An operation defined on an -qubit quantum system is a higher-order function, whose domain and range are maps from to the complex numbers. An identity operation on a state of an -qubit system is defined by
For a linear operation , the adjoint of , written , is the (unique) operation, such that for any two states and , .
The unitary transformations that describe the evolution of an -qubit quantum system are operations defined on the system, such that .
In this setting, the tensor product of operators is defined in the usual way. If is a state of an -qubit system, is a state of an -qubit system, and and are operations defined on and -qubit systems, respectively, then the tensor product of and is defined on an qubit system by
To apply an operation defined on a -qubit system to qubit in a composite -qubit system, we apply the operation to the entire system, where is defined by:
Suppose we have a system of qubits in state and we measure (observe) it. Suppose also that we have a variable from the domain , which we use to record the result of the measurement, and variables , which are not affected by the measurement. Then the measurement corresponds to a probabilistic specification that gives the probability distribution of and (these depend on and on the type of measurement) and states that the variables are unchanged.
For a general quantum measurement described by a collection of measurement operators, which satisfy the completeness equation (see Appendix A), the specification is , where
where is an abbreviation of and means “all other variables are unchanged”.
Given an arbitrary orthonormal basis , measurement of in basis is:
The simplest and the most commonly used measurement in the computational basis is:
In this case the distribution of is and the distribution of the quantum state is:
which is precisely the mixed quantum state that results from the measurement.
In order to develop quantum programs we need to add to our list of implemented things. We add variables of type quantum state as above and we allow the following three kinds of operations on these variables. If is a state of an -qubit quantum system, is a natural variable, and is a collection of measurement operators that satisfy the completeness equation, then:
is a program
, where is a unitary transformation on an -qubit system, is a program
is a program
where the superscript means “tensored with itself times”. The special cases of measurements are therefore also allowed.
Some unitary operations that we will use in the later sections are (here ):
|X - Pauli matrix|
|Y - Pauli matrix|
|Z - Pauli matrix|
3 Distributed Quantum Systems and Communication
In predicative programming, to reason about distributed computation we (disjointly) partition the variables between the processes involved in a computation. Parallel composition is then simply boolean conjunction. For example, consider two processes and . owns integer variables and and owns an integer variable . Suppose . Parallel composition of with is then simply
In quantum predicative programming, one needs to reason about distributed quantum systems. Recall that if is a state of an -qubit system and is a state of an -qubit system, then , the tensor product of and , is the state of a composite -qubit system. On the other hand, given a composite -qubit system, it is not always possible to describe it in terms of the tensor product of the component - and -qubit systems. Such a composed system is entangled. Entanglement is one of the most non-classical, most poorly understood, and most interesting quantum phenomena. An entangled system is in some sense both distributed and shared. It is distributed in the sense that each party can apply operations and measurements to only its qubits. It is shared in the sense that the actions of one party affect the outcome of the actions of another party. Simple partitioning of qubits is therefore insufficient to reason about distributed quantum computation.
The formalism we introduce fully reflects the physical properties of a distributed quantum system. We start by partitioning the qubits between the parties involved. For example, consider two parties and . owns the first qubit of the composite entangled quantum system and owns the second qubit. A specification is a program only if each party computes with its own qubits. In our example,
are programs, if and are integer variables owned by and , respectively. Note that we cannot write down expressions for and : this is consistent with the laws of quantum mechanics as is an entangled state. Parties and can access only their own qubits: they could in theory be light years apart.
Sometimes we want to explicitly include partitioning of variables as part of a specification. For this purpose, we introduce notation to mean the bunch of variables that belong to process . In the above example we can make the partitioning of variables explicit with the specification
We define parallel composition of and which share an quantum system in state with the first qubits belonging to and the other qubits belonging to as follows. If
where is a unitary operation on an -qubit system and is a unitary operation on an -qubit system, then
Performing is equivalent to performing the identity unitary operation, and therefore if
where and are a collection of proper measurement operators for - and -qubit systems, respectively, then
where is the number that corresponds to the binary string pq.
In our example,
When explicitly specifying partitioning of variables in a parallel composition, it is convenient to allow the variables to appear as subscripts on the corresponding processes. For example, the specification denotes a parallel composition of processes and that share an entangled state , such that and belong to and and belong to .
To reason about communication between processes we use the framework of Hehner’s calculus(). A named, one-way communication channel is described by an infinite message script , an infinite time script , and read and write cursors and . The message and time scripts are the list of all messages that appear on the channel and the list of corresponding times. The read and write cursors specify how many messages have been read from and written to a channel. To specify two-way communication, we use two channels. The input and output on channel are defined by the following operations (here is the time variable):
A channel declaration defines a new channel with communication of type ; the declaration applies to the specification (here stands for naturals extended with ):
where is an infinite sequence of elements of type . One useful theorem that we use in later examples is the equivalence of communication on a local channel with assignment:
The reader is referred to  for a detailed description of formal treatment of classical communication in Hehner’s calculus.
When defining a quantum communication channel one must be careful not to introduce any unwanted behaviour, such as violation of the no-cloning principle (i.e. creation of identical copies of an unknown arbitrary quantum state). For this purpose we make the change of ownership of the transported qubit explicit in the definition:
where is a quantum communication channel from process to process and is shorthand for “the rest of the variables are unchanged”.
Now that we allow changing of ownership of the variables, the specification , “the rest of the variables of process are unchanged” is defined by .
The declaration of a quantum channel is similar to the declaration of a local classical channel:
Similarly to the above-mentioned theorem, we can prove the equivalence of communication on a local quantum channel with the change of ownership. If and , then (leaving out time)
3.1 Quantum teleportation
Quantum teleportation is the most famous quantum communication protocol. Its description first appeared in a seminal article by Bennett et al in 1993 (), it has since been extensively used as part of more complex quantum communication protocols, and has received much attention in experimental research. The protocol achieves transmission of quantum information by utilising only a classical communication channel and an entangled pair of qubits: no qubits are sent in the process.
The protocol: Alice and Bob share an entangled pair of qubits in the state . Alice has some qubit in her possession (she may not know the state of the qubit) that she wishes to transfer to Bob. Alice starts by interacting the qubit she wishes to teleport with her half of the entangled pair (she applies a controlled-not followed by a Hadamard transform) and measuring her two qubits. She then sends the results of her measurements to Bob (two classical bits). Bob receives the two classical bits and, depending of their values, applies one of the three Pauli operators or the identity to his qubit. Surprisingly, he has recovered the state Alice wished to teleport.
The protocol is usually described informally, by using a diagram as in Figure 1\@footnotemark\@footnotetextThe figure is generated with qasm2pdf. Such a description is insufficient, in part since it only describes the evolution of the quantum system and does not specify the distribution of the system nor the communication. Alternatively, the description of the protocol is given informally, in English. Our goal is to formally define and prove correctness of the quantum teleportation protocol. Some approaches proposed in the literature (e.g. ) define teleportation as a program that implements a specification of the form . We point out that this specification may as well be implemented by a program that involves sending a qubit on a quantum channel, which is not teleportation. Furthermore, the specification does not mention that two classical bits are sent on a classical channel, which is an important part of the specification of teleportation. Similarly, it is important to specify that a pair of maximally entangled qubits is required.
To formalise the quantum teleportation protocol we let be the number of classical bits sent on a communication channel and be the number of quantum bits sent. The formal specification of quantum teleportation is:
The specification says that if the computation starts with a qubit (specified in the most general form) in Alice’s possession and if Alice and Bob share a maximally entangled state , then at the end of the computation the qubit is teleported to Bob at a cost of 2 classical bits of communication and 0 qubits of communication. The specification does not restrict the quantum system to three qubits, so that teleportation can be a part of a bigger computation.
The well-known solution is the following parallel program:
That is, two processes, and , partition a 3-qubit quantum system , so that owns the first qubit (the one she wants to teleport) and the second qubit and owns the third qubit. can write to a local classical communication channel and can read from it. Finally, and are two bits that belong to , and and are two bits that belong to . The process performs local operations and measurements and sends two classical bits on the channel. The process reads from the channel and performs local operations.
Our goal is to prove that the program implements the specification . We first note the following equivalence:
Next, we simplify to prove the above implication. With implicit partitioning of variables (as it does not change):
Next we notice that the first line in the above specification (which is, in fact, the effect of Alice’s actions) conjoined with the specification of the initial state of the quantum system, result in the following distribution over the states of the computation:
That is, with probability the quantum system is in state and the values of Alice’s bits are and ; with probability the quantum system is in state and the values of Alice’s bits are and ; etc.
To prove this formally, we first note that:
Therefore, measurement of the first two qubits of the above state in the computational basis gives:
Let be the specification of the initial state of the quantum system:
Putting it all together, we get:
|one point law,|
|one point law|
where is the generalisation of for probabilistic specification (see ).
This example shows formalisation and analysis of an LOCC (local operations, classical communication) quantum communication protocol. We now turn to our attention to a protocol which involves a quantum communication channel.
3.2 Quantum dense coding
The quantum dense coding (sometimes called super-dense coding) protocol is less famous than the quantum teleportation protocol, but it is no less important. It achieves the transfer of 2 bits of classical information by sending 1 bit of quantum information and utilising 1 entangled pair of qubits. That is, its goal is the opposite of that of the quantum teleportation protocol.
Just as with teleportation, the protocol is usually described informally: either with a diagram or in English. We formalise the specification of the protocol by using the same variables as in section 3.1:
The specification says that if the computation starts with Alice and Bob sharing a maximally entangled state, with classical bits and in Alice’s possession and and in Bob’s possession, then at the end of the computation Bob has the values of Alice’s classical bits, at a cost of sending no bits on a classical channel and one qubit on a quantum channel. The program for the protocol is:
That is, Alice applies one of the three Pauli operators or an identity to her half of the entangled pair, depending on the values of her classical bits, and sends her qubit to Bob. Bob receives the qubit, applies a controlled-not followed by a Hadamard, and measures the two qubits in his possession. We now show that the program implements the specification