Single-qubit interference with conditional environment states (source code)

= Single-qubit interference with conditional environment states
{title2=$P_0=\tfrac12[1+v\cos(\phi+\alpha)]$}

Prepare a <qubit> in $|+\rangle$, apply a <phase gate> $P(\phi)=\operatorname{diag}(1,e^{i\phi})$, and correlate its <computational basis> states with normalized environment states $|e_0\rangle,|e_1\rangle$. Write $\langle e_0|e_1\rangle=ve^{i\alpha}$. After a final <Hadamard gate>, the environment amplitude accompanying output zero is $(|e_0\rangle+e^{i\phi}|e_1\rangle)/2$. Its squared <norm> is $P_0=[1+v\cos(\phi+\alpha)]/2$. Thus $v$ is the <interference visibility>, while $\alpha$ shifts the fringe. This <quantum decoherence> map commutes with the <phase gate>, so placing it immediately before that gate gives the same probabilities.