In the previous part of the series we discussed how quantum theory prohibits copying of an arbitrary quantum state. In computing terms, this means that regardless of the richness of features provided by high-level quantum-specific languages such as Q#, we cannot implement a classical functionality of copy-and-paste on a quantum computer.
It turns out, however, that we can achieve a cut-and-paste type of effect, through a remarkable process of quantum teleportation.
Quantum teleportation 🔗
Quantum teleportation was theoretically proposed in a 1993 paper Teleporting an unknown quantum state via dual classical and Einstein-Podolsky-Rosen channels by Charles Bennett, Gilles Brassard, Claude Crépeau, Richard Jozsa, Asher Peres, and William Wootters.
The usage of the flashy name teleportation was justified by the authors in the following fashion:
We call the process we are about to describe teleportation, a term from science fiction meaning to make a person or object disappear while an exact replica appears somewhere else. It must be emphasized that our teleportation, unlike some science fiction versions, defies no physical laws. In particular, it cannot take place instantaneously or over a spacelike interval, because it requires, among other things, sending a classical message from Alice to Bob.
Few years after it was theoretically proposed, Anton Zeilinger and his team provided an experimental confirmation of the teleportation. In the summary of their experiment they reflected on the exciting new frontiers that lie ahead of quantum mechanics thanks to the realization of teleportation.
As any arbitrary state can be teleported, so can the fully undetermined state of a particle which is member of an entangled pair. Doing so, one transfers the entanglement between particles. This allows us not only to chain the transmission of quantum states over distances, where decoherence would have already destroyed the state completely, but it also enables us to perform a test of Bell’s theorem on particles which do not share any common past, a new step in the investigation of the features of quantum mechanics.
Mathematics of quantum teleportation 🔗
As we established earlier in this series, it is quite difficult, if not impossible, to develop a picture or intuition for quantum processes using our classical macroscopic thinking. Therefore - and this should be of no surprise, given that this is part 7 of this series already - the most reliable approach to attempt to reason about teleportation of quantum objects, even before we dive into Q# code, is to use the mathematical formalism of quantum mechanics, namely linear algebra. We already do know almost all the necessary constituent pieces - the CNOT gate, a number of single qubit gates or the phenomenon of entanglement in general. As we’ll see in a moment, we shall also require to perform the so-called Bell-basis measurement, but that is also something we briefly touched upon earlier.
The outgoing positions consist of Alice’s qubit in a superposition state
The first two kets in the equation describe Alice’s qubits, first the state to teleport, then her part of the entangled pair, while the last one describes Bob’s qubit, which is his part of the entangled pair and shall act as the target onto which the state
We can describe this mathematically in the following way:
In the next step, Alice perform an
Finally, Alice measures both of the qubits in her possession. She could obviously obtain
- when Alice measures
, Bob’s qubit would end up in the state - when Alice measures
, Bob’s qubit would end up in the state - when Alice measures
, Bob’s qubit would end up in the state - when Alice measures
, Bob’s qubit would end up in the state
We can observe based in the above relations that:
- when Bob’s qubit ends up in the state
, it is already the original state - when Bob’s qubit ends up in the state
, it is the equivalent to - when Bob’s qubit ends up in the state
, it is the equivalent to - when Bob’s qubit ends up in the state
, it is the equivalent to
This is where the classical information channel comes into play. For Bob to be able to restore the original state, he needs to be informed by Alice about her measurement outcomes. Therefore, she duly sends those results to Bob, and she can do it over any traditional communication channel. Based on that he simply needs to apply
Because the classical communication medium is required to exist between Alice and Bob to complete the protocol, even though the quantum state “moves” from location one to location two instantly, teleportation is not considered to violate special relativity because no information has been transferred - the classical channel holds the metadata needed for “decoding” the quantum state.
Qubit teleportation in Q# 🔗
Let us now write teleportation as a Q# program. It is of course a lot more exciting to consider teleportation with quantum communications networks over large distances, though the technological challenges related to it are still considerable. At the same time, even with a simple Q# program we will still be able to go through all the same steps that we outlined here, and we will succeed in orchestrating a real teleportation effect. Since we mentioned that the message to be teleported could be an arbitrary quantum state, we will do just that - and we will be teleporting a state specified in the Pauli X (Hadamard) basis (
In order to make it more digestible, the code will be split into multiple blocks. The first part of Q# code looks as follows:
operation Teleport (signToSend : Bool) : Unit {
using ((message, resource, target) = (Qubit(), Qubit(), Qubit())) {
// prepare |-> or |+>
if (signToSend == false) { X(message); }
H(message);
// create entanglement between resource and target
H(resource);
CNOT(resource, target);
// reverse Bell circuit on message and resource
CNOT(message, resource);
H(message);
// mesaure message and resource
// to complete the Bell measurement
let messageResult = MResetZ(message);
let resourceResult = MResetZ(resource);
// to do - decode the target based on
// message and resource results
}
}
We start off by preparing the
Once the message to teleport is prepared, we proceed to create a Bell state using the
The snippet below shows Bob’s corrective actions depending on the results obtained by Alice.
// if we got |00>, there is nothing to do on the target
if (messageResult == Zero and resourceResult == Zero) {
Message("Measured |00>, applying I");
I(target);
}
// if we got |01>, we need to apply X on the target
if (messageResult == Zero and resourceResult == One) {
Message("Measured |01>, applying X");
X(target);
}
// if we got |10>, we need to apply Z on the target
if (messageResult == One and resourceResult == Zero) {
Message("Measured |10>, applying Z");
Z(target);
}
// if we got |11>, we need to apply XZ on the target
if (messageResult == One and resourceResult == One) {
Message("Measured |11>, applying XZ");
X(target);
Z(target);
}
let teleportedResult = Measure([PauliX], [target]);
Message("Teleported state was measured to be: " + (teleportedResult == Zero ? "|+>" | "|->"));
Reset(target);
We shall simply follow the rules we already defined - based on the results of Alice’s measurement, an
To cap things off, we can define the entry point operation for our Q# code and pass in the “sign” parameter we defined on the
@EntryPoint()
operation Start() : Unit {
for (idx in 0..3) {
Message("Teleporting |->");
Teleport(false); // send |->
}
Message("***********");
for (idx in 0..3) {
Message("Teleporting |+>");
Teleport(true); // send |+>
}
}
The program repeats the teleportation of both
Teleporting |->
Measured |11>, applying XZ
Teleported state was measured to be: |->
Teleporting |->
Measured |11>, applying XZ
Teleported state was measured to be: |->
Teleporting |->
Measured |10>, applying Z
Teleported state was measured to be: |->
Teleporting |->
Measured |00>, applying I
Teleported state was measured to be: |->
***********
Teleporting |+>
Measured |00>, applying I
Teleported state was measured to be: |+>
Teleporting |+>
Measured |00>, applying I
Teleported state was measured to be: |+>
Teleporting |+>
Measured |11>, applying XZ
Teleported state was measured to be: |+>
Teleporting |+>
Measured |11>, applying XZ
Teleported state was measured to be: |+>
Final words 🔗
In the next part of this series, we shall continue exploring the interesting application scenarios around entanglement, by looking at a concept of “superdense coding”.