周期函数:
f ( x ) = a x m o d N f(x) = a^x \bmod{N} f(x)=axmodN
问题:如何找到一个周期函数的周期r?
Shor’s algorithm
Shor’s solution中函数U: U ∣ y ⟩ ≡ ∣ a y m o d N ⟩ U|y\rangle \equiv |ay \bmod N \rangle U∣y⟩≡∣aymodN⟩
接下来,我们可以多次作用U,便可以得到周期函数f的结果:
U ∣ 1 ⟩ = ∣ 3 ⟩ U 2 ∣ 1 ⟩ = ∣ 9 ⟩ U 3 ∣ 1 ⟩ = ∣ 27 ⟩ ⋮ U ( r − 1 ) ∣ 1 ⟩ = ∣ 12 ⟩ U r ∣ 1 ⟩ = ∣ 1 ⟩ \begin{aligned} U|1\rangle &= |3\rangle & \\ U^2|1\rangle &= |9\rangle \\ U^3|1\rangle &= |27\rangle \\ & \vdots \\ U^{(r-1)}|1\rangle &= |12\rangle \\ U^r|1\rangle &= |1\rangle \end{aligned} U∣1⟩U2∣1⟩U3∣1⟩U(r−1)∣1⟩Ur∣1⟩=∣3⟩=∣9⟩=∣27⟩⋮=∣12⟩=∣1⟩
因此第一个想法便是构建叠加态,然后测量相同f(x)的x的叠加态。
So a superposition of the states in this cycle ( ∣ u 0 ⟩ ) (|u_0\rangle) (∣u0⟩) would be an eigenstate of U:
∣ u 0 ⟩ = 1 r ∑ k = 0 r − 1 ∣ a k m o d N ⟩ |u_0\rangle = \tfrac{1}{\sqrt{r}}\sum_{k=0}^{r-1}{|a^k \bmod N\rangle} ∣u