Solution (source code)

= Solution

The reflection is $I_{|\psi\rangle}=I-2|\psi\rangle\langle\psi|$. Hence $I_{|x_0\rangle}|x\rangle=-|x_0\rangle$ for $x=x_0$ and equals $|x\rangle$ otherwise.