Modular-addition quantum oracle (source code)

= Modular-addition quantum oracle
{title2=$U_h$}

For $h:\mathbb Z_N\to\mathbb Z_M$, its modular-addition oracle is the <unitary operator>
$$
U_h|x,y\rangle=|x,y+h(x)\bmod M\rangle.
$$
For each fixed $x$, <addition> by $h(x)$ permutes the answer register's <computational basis>. This preserves <inner products>, even when $h$ is not injective.