# Quantum Teleportation — coherent deferred-measurement demonstration of |+> transfer
# Joint quantum gates are used; this does not demonstrate separated-party communication.
import pennylane as qml

dev = qml.device("default.qubit", wires=3, shots=1000)

@qml.qnode(dev)
def teleportation():
    # Prepare state to teleport: |+>
    qml.Hadamard(wires=0)
    # Create Bell pair
    qml.Hadamard(wires=1)
    qml.CNOT(wires=[1, 2])
    # Bell-basis transform (measurements deferred)
    qml.CNOT(wires=[0, 1])
    qml.Hadamard(wires=0)
    # Coherent corrections controlled by qubits; not classical feedforward
    qml.CNOT(wires=[1, 2])
    qml.CZ(wires=[0, 2])
    return qml.counts()

result = teleportation()
