from common import H, basis, cnot, describe, single

prepare = cnot(0, 1, 2) @ single(H, 0, 2)
decode = single(H, 0, 2) @ cnot(0, 1, 2)     # le circuit à l'envers : CNOT, puis H

names = {"00": "|Φ⁺⟩", "01": "|Ψ⁺⟩", "10": "|Φ⁻⟩", "11": "|Ψ⁻⟩"}
for label, name in names.items():
    print(f"{name} décodé ->", describe(decode @ prepare @ basis(label)))
