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]>
1 KiB
1 KiB
通常说受控门作用在它的目标比特上。当目标比特处于这样一种状态,使门只给它乘上一个相位时,门对目标比特毫无改变,相位转而落在控制比特上。这就是相位反冲(phase kickback)。
对 x 来说,状态 |−⟩ = (|0⟩ − |1⟩)/√2 就是这样的状态:X|−⟩ = −|−⟩。因此当 q[1] 处于 |−⟩ 时,cx q[0], q[1] 会把状态中 q[0] 为 |1⟩ 的那一部分乘以 −1,并让 q[1] 保持在 |−⟩。
OPENQASM 3.0;
include "stdgates.inc";
qubit[1] q;
x q[0];
h q[0];
这段程序制备出 |−⟩。下一单元的算法正是通过相位反冲来读出函数的答案:答案变成输入量子比特上的相位,再由干涉把相位变成结果。调试器会一步一步地展示这一过程:wai-quantum debug 打印任意一行之前的振幅,Studio 的 单步执行 面板画出每个量子比特的状态。