Deutsch algorithm with pure dephasing (source code)

= Deutsch algorithm with pure dephasing
{c}
{title2=$P_{\mathrm{correct}}=\tfrac12(1+v\cos\alpha)$}

If the input <qubit> of the <Deutsch algorithm> acquires conditional environment states with overlap $\langle e_0|e_1\rangle=ve^{i\alpha}$ between its two <Hadamard gates>, its fixed zero-for-constant, one-for-balanced rule succeeds with probability $(1+v\cos\alpha)/2$. A known phase can be compensated before the last <Hadamard gate>, raising the success probability to $(1+v)/2$. An orthogonal pair of environment states gives $v=0$ and destroys all information in the input <qubit> about the answer; unit overlap modulus preserves coherence up to a known phase.