7.2 Superdense coding
In this section, we are going to use our newly-acquired skills to simulate the superdense coding protocol. This may be a very good moment to go back to Section 6.1 if you need a refresher on how the protocol works.
To start with, we need Alice and Bob to create and share a Bell pair. This can be accomplished with the following instructions:
circuit = QuantumCircuit (2)
# Bell state preparation
circuit . h (0)
circuit . cx (0,1)
circuit . barrier ()
Here, the qubit with index 0 will be kept by Alice and the qubit with index 1 will be kept by Bob. We have included a barrier after the creation of the entangled pair to make it clear that this is the first step in the protocol and that it happens before the actual communication takes place.
Later on, Alice wants to send two bits of information, which we will denote by b1 and b2, to Bob. Imagine that b1 = 1 and b2 = 0. Then, she needs to perform the following operations:
b 1 = 1
b 2 = 0...