from common import alice_gates, branch, correct, fidelity, rounded, share_pair
from qsim import make_state

psi = make_state(0.6, 0.8j)  # l'état à envoyer : 0,6|0⟩ + 0,8i|1⟩
state = alice_gates(share_pair(psi))

for m0 in (0, 1):
    for m1 in (0, 1):
        p, bob = branch(state, m0, m1)
        print(f"Alice lit {m0}{m1} (probabilité {rounded(p):.3f}) | fidélité de Bob : "
              f"avant correction {rounded(fidelity(psi, bob)):.3f}, après {rounded(fidelity(psi, correct(bob, m0, m1))):.3f}")
