[PYTHON] Quantum teleportation with Qiskit!

Introduction

I would like to experiment with quantum teleportation using IBM's Qiskit. Since it is difficult to explain theoretically, this time the goal is to actually make a circuit and run it on a simulator. It means, "Let's do it first, rather than understand it." Let's get started.

environment

Q Experience JupyterNotebook

What is Qiskit

It is a Python OSS that can actually run "IBM Q", which is an IBM quantum computer. It also includes a simulator function, so you can practice quantum programming. Anyone can use it immediately on IBM Q Experience (https://www.ibm.com/quantum-computing/technology/experience/).

What is quantum teleportation?

It is a phenomenon that the ** quantum state at hand is transferred far away in an instant **.

In Einstein's theory of relativity, nothing is faster than light. However, there is a ** lie ** that quantum teleportation can transmit interactions beyond the speed of light.

Will Quantum Teleportation Change the World?

Since the quantum state at hand can be reproduced far away, I think that some kind of transportation problem can be solved. However, since it is actually a very small world event, it is expected to be applied to information and communication rather than material transportation.

But if the application progresses, true teleportation may not be a dream ...?

Quantum teleportation quantum experiment

The explanation is about to start the experiment.

Preparing Qiskit

No preparation is required to use Q Experience. If you want to run it locally, you can install it with pip.

pip install qiskit

Make a quantum circuit and run it on a simulator

First, prepare the library.

#Library import
from qiskit import QuantumRegister, ClassicalRegister, BasicAer

Make a base circuit.

#Prepare classic registers (bottom 3 of the circuit diagram)
cr0 = ClassicalRegister(1)
cr1 = ClassicalRegister(1)
cr2 = ClassicalRegister(1)

#Make a base circuit (3 quantum registers + 3 classical registers)
circ = QuantumCircuit(QuantumRegister(3), cr0, cr1, cr2)

#Display confirmation
circ.draw(output='mpl')

output_2_0.png

It's done. The role of the circuit is as follows. It is assumed that the third quantum register and the third classical register are far away.

image.png

Next, we will place the gate in the circuit. It's easy to make, just place the gate on the circuit.

#Make a circuit up to measurement
circ.h(0)
circ.h(1)
circ.cx(1,2)
circ.cx(0,1)
circ.h(0)

#Display confirmation
circ.draw(output='mpl')

output_3_0.png

It's very easy. Let's make the rest of the circuit. After putting a break with a barrier, I will put the gate again. The value of the classical register (1st and 2nd) causes the gate operation of the quantum register (3rd), so c_if is entered, but the procedure is the same.

#Make the rest of the circuit
circ.barrier(range(3))
circ.measure(0, 0)
circ.measure(1, 1)
circ.z(2).c_if(cr0, 1)
circ.x(2).c_if(cr1, 1)
circ.measure(2, 2)

#Display confirmation
circ.draw(output='mpl')

output_4_0.png

It's very easy, the circuit is now complete. Quantum teleportation seems difficult, but it's just this in circuit representation.

Let's run it on the simulator.

#Run in simulator
backend = BasicAer.get_backend('qasm_simulator')
#Run 1024 times by default
job = execute(circ, backend) 
result = job.result()

This completes the execution. Let's see the execution result.

#Display execution results, 8 patterns total 1024 times
result.get_counts(circ)

The output result is as follows.

    {'0 0 0': 100,
     '1 1 0': 127,
     '1 0 1': 147,
     '1 0 0': 140,
     '0 0 1': 131,
     '0 1 0': 128,
     '0 1 1': 131,
     '1 1 1': 120}

The view is as follows.

image.png

When actually teleporting, the third quantum register is not measured and is used as it is.

If no measurement is performed, the same state as the first quantum register of the transfer source is reproduced (teleported) in the third quantum register. When I measure it, the "superposition" state is broken, but since this is an experiment, I measure it to see if it really teleports.

Wait a minute

Let's take a closer look at the resulting circuit.

image.png

Based on the first and second classical registers (corresponding to the measurement results of the first and second quantum registers) of the transfer source, perform the gate operation (Z, X) of the quantum register (third) of the transfer destination. You can see that there is.

In fact, in order to realize quantum teleportation, it is necessary to "notify the transfer destination of the measurement results of the transfer source". How do you tell ...? Is it LINE?

Anyway, if you don't do this, the qubit at the transfer destination may be in a slightly different state from the transfer source.

There are pitfalls in quantum teleportation! !! (In the end, it was a story that classical communication is not necessary!)

in conclusion

This time I wrote a commentary there. Quantum computers are difficult to understand at first, so I think it is possible to "touch them first." Let's touch and learn to deepen your understanding. (I'm telling myself, because the theory is difficult)

reference

https://qiskit.org/documentation/index.html https://github.com/Qiskit/qiskit-iqx-tutorials/blob/master/qiskit/fundamentals/1_getting_started_with_qiskit.ipynb https://github.com/maru-labo/ibm-q-handson/blob/master/5_ibm_q.ipynb

Recommended Posts

Quantum teleportation with Qiskit!
Qiskit: Quantum Fourier Transform
Qiskit: Realizing artificial neurons with quantum circuits (implementation)
Combinatorial optimization with quantum annealing
Qiskit: Implementation of quantum Boltzmann machine
Qiskit: Implementation of Quantum Hypergraph States
Qiskit: Implementation of Quantum Circuit Learning (QCL)