View on GitHub
Open this notebook in GitHub to run it yourself
Algorithm Description
At the start Alice holds two qubits, one that she wishes to teleport (alice_qubit) and one that will be used during the protocol (bell_pair_qubit).
Bob holds one qubit (bob_qubit).
- Bell State Creation
- Apply a Hadamard (
H) gate tobell_pair_qubit. - Apply a CNOT gate with
bell_pair_qubitas control andbob_qubitas target.
These two qubits now form a Bell state.
- Entangling Alice’s Qubit with the Bell Pair
- Apply a CNOT gate from
alice_qubittobell_pair_qubit. - Apply a Hadamard (
H) gate onalice_qubit.
This step entangles Alice’s qubit with the Bell pair.
- Mid-Circuit Measurement
alice_qubit and bell_pair_qubit.The measurement results will be later used to apply conditional corrections.
- Classically Controlled Corrections
alice_qubit and bell_pair_qubit, the system collapses to one of the four possible states shown above.
Each collapsed state differs from Alice’s original state by a known unitary transformation.
To recover the exact state that Alice initially held, appropriate correction operations must be applied to bob_qubit based on the measurement results.
Depending on the measurement outcomes:
- If
alice_qubitmeasures0andbell_pair_qubitmeasures0- do nothing. - If
alice_qubitmeasures0andbell_pair_qubitmeasures1, applyXonbob_qubit. - If
alice_qubitmeasures1andbell_pair_qubitmeasures0, applyZonbob_qubit. - If
alice_qubitmeasures1andbell_pair_qubitmeasures1, applyXonbob_qubitand thenZonbob_qubit.
bob_qubit.
A complete derivation is provided in the Technical Notes section at the end of this notebook.

Mid-Circuit Measurement
Mid-circuit measurement is a key feature in quantum computation that allows measuring a qubit while the circuit is still running, rather than only at the end of execution.This capability enables classical feedback - where measurement results influence subsequent quantum operations within the same program. In Qmod, mid-circuit measurement is implemented through the
measure() function.Unlike a final measurement, which collapses the qubit state at the end of a circuit,
measure() can be invoked within a quantum function to extract partial information and conditionally control later operations.
The measure() function returns a Qmod classical variable (symbolic), representing the outcome of the measurement (either 0 or 1).This symbolic value can be used to define conditional logic at circuit construction time, and is determined only during the actual quantum run of the program.
How to Build the Algorithm with Classiq
We define a qunatum functionquantum_teleportation that takes three qubits:
one for Alice (alice_qubit), one for Bob (bob_qubit), and one for their shared Bell pair (bell_pair_qubit).
Classiq’s implematation
Output:
| bob_qubit | count | probability | bitstring | |
|---|---|---|---|---|
| 0 | 0 | 1065 | 0.52002 | 0 |
| 1 | 1 | 983 | 0.47998 | 1 |