Implementing a Quantum Key Distribution and Quantum Teleport Protocol
- Quantum Key Distribution (15 pts.) Download the Python file QuantumKeyDistribution but do not look inside the file. Import its contents to your notebook using the following import:
from QuantumKeyDistribution import *
This file contains two classes representing two people you are interacting with by establishing a secret key through quantum key distribution. One person has a spy listening to your communications and your job is to figure out which person. The two person classes, PersonA and PersonB, have the following behavior. To define a person, you can use something similar to the following code, where message is a list of qiskit qubits that are used to enocode your message and share_size is the length of the string to be shared at the end.
= PersonA(message, share_size)
alice = PersonB(message, share_size) bob
You can interact with PersonA and PersonB in the following manner. To tell them to decrypt the message you can use:
alice.decrypt_message()
To have them share the order they applied to filters you can use the following command which will return a Numpy array. A 1 means that the person used filter 1 and a 2 means the person used filter 2 on the quantum circuit at the same index.
= bob.share_filter_order() filter_order_bob
To tell the person which indices to remove from the secret string, you need to use the following function call, where remove_indices is a list of indices to be removed:
alice.remove_bits(remove_indices)
To have the person share their portion of the secret string with you, use the following command, which will return a string of the size you specified when you created the person:
= bob.share_secret_string() bob_string
Finally, once you believe you have determined which person has the spy, you can use this function to check to see if you are correct, where boolean is True if you think that person has a spy and False if you do not.
print(alice.is_spy(boolean))
Once you have determined who is the spy, to recieve full credit for the question you must explain which person has the spy and how you determined this.
- Quantum Teleport Protocol (20 pts. for coding, 25 pts. for conceptual)
Assume that Alice and Bob are sharing a three qubit system. Alice has control of the first two qubits and Bob has control of the last qubit. Perform the following steps by (a) implementing what is required using the qiskit library, (b) determining the state of each qubit after the gates are applied, and (c) determining if and when quantum teleportation took place.
A. Create the quantum circuit, label or explain which qubits you are using as Alice’s and which one is Bob’s.
B. Create the \(|\Phi^+\rangle\) Bell State between Bob’s qubit and one of Alice’s qubits. Add a barrier after the necessary gates.
C. For Alice’s qubit that is not involved in the Bell State, apply a Hadamard gate.
D. For Alice’s two qubits, apply a controlled NOT gate where the control is the qubit not involved in the Bell State, and the target is the qubit involved in the Bell State. Then, apply a Hadamard gate to the qubit not involved in the Bell State. This combination of gates is called a teleportation gate as it projects the qubit not currently involved in the Bell State to the Bell basis.
E. Alice should measure both of her qubits.
F. Now that Alice has collapsed her qubits by measuring them, Bob can use them in his circuit. Bob should apply a controlled NOT gate where the control is Alice’s qubit not involved in the Bell State and the target was Alice’s Bell State qubit.
G. Next, Bob should apply a controlled Z gate where the control is Alice’s qubit not involved in the Bell State and the target is Bob’s qubit.
H. Finally Bob should measure his qubit.
Display a diagram of the finished circuit. Simulate running the circuit and explain the results. Finally, re-run the above but replace the Hadamard if step C with a NOT gate and compare the results.
- Quantum Coin Flipping (15 pts.) Implement a quantum coin flipping protocol, using the algorithm discussed in class. As we did in class with the quantum key distribution, implement what Person 1 would do and what Person 2 would do.