engine::course reads the course from wai-quantum/course/: 21 lessons from a first circuit through superposition, entanglement, interference, the standard algorithms, noise and mitigation, error correction and fault tolerance to resource estimates, each a Markdown text in English and Simplified Chinese and an exercise.json with a schema. A check runs each case of an exercise (a generator's inputs) with its intent and the verdict, measures its constraints (the gates allowed, counts, the T count, the critique's smells, the resource estimate's counts), and says what went wrong from the diagnostics, the verdict and the critique, never from the solution. The tests hold every solution to pass by proof, every known wrong answer to fail for its stated reason, and every locale to every text and message. wai-quantum learn shows, starts, checks, hints and explains a lesson, keeps progress only on this machine, and speaks the language --lang or LANG names; the command summaries and docs topics have Chinese translations held to the English they came from. The verdict gains of_diagnostic for a generator's refusal. llms.txt names the course. Co-Authored-By: Claude Opus 5.5 <[email protected]>
11 lines
977 B
Markdown
11 lines
977 B
Markdown
<!-- 机器辅助翻译(machine-assisted translation):在对外推广之前,须由熟练的读者审校。 -->
|
||
|
||
给定一个门 U 和一个满足 U|ψ⟩ = e^{2πiφ}|ψ⟩ 的状态 |ψ⟩,*相位估计*以二进制读出 φ。它是因数分解、量子化学能量估计以及许多其他算法的核心。
|
||
|
||
这条线路有一个由 n 个处于叠加的量子比特组成的计数寄存器。第 k 个计数量子比特控制作用在 |ψ⟩ 上的 U 的 2ᵏ 次幂。通过相位反冲,每一次幂都把它的相位留在自己的控制比特上,寄存器最终处于
|
||
|
||
Σₓ e^{2πiφx} |x⟩ / √2ⁿ,
|
||
|
||
这正是 |2ⁿφ⟩ 的量子傅里叶变换。逆变换把它变回基态 |2ⁿφ⟩,测量就以 n 个比特读出 φ。当 2ⁿφ 是整数时,结果是确定的;否则最可能得到最接近的那个整数。
|
||
|
||
受控 T 门是 `cp(π/4)`,它的幂是 `cp(π/2)` 和 `cp(π)`。这里 φ = 1/8,n = 3,所以结果是 1,写作 001。
|