Solution
= Solution
The state entering the controlled swap has lower-register states
$|\phi_1\rangle$ and $V|\phi_2\rangle$. The <swap test> therefore gives
$$
\boxed{p_0=\frac12\left(1+
|\langle\phi_1|V|\phi_2\rangle|^2\right)}.
$$
= Solution
The state entering the controlled swap has lower-register states
$|\phi_1\rangle$ and $V|\phi_2\rangle$. The <swap test> therefore gives
$$
\boxed{p_0=\frac12\left(1+
|\langle\phi_1|V|\phi_2\rangle|^2\right)}.
$$