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]>
9 lines
832 B
Markdown
9 lines
832 B
Markdown
The quantum Fourier transform (QFT) writes a number into phases. On n qubits it takes the basis state |x⟩ to
|
|
|
|
Σᵧ e^{2πi·xy/2ⁿ} |y⟩ / √2ⁿ:
|
|
|
|
every outcome equally likely, the information all in the relative phases. The circuit needs only n(n+1)/2 gates: a Hadamard on each qubit, controlled phase rotations `cp(π/2ᵏ)` between pairs, and swaps that reverse the order of the qubits at the end.
|
|
|
|
The QFT is the step that turns phases into a readable number in phase estimation, and so in factoring. Phase estimation uses it backwards: the *inverse* QFT.
|
|
|
|
This exercise's intent is *equivalent*: your whole program must be the same circuit as the identity, up to a global phase. The engine decides it on every one of the 8 basis states, by proof. The angles π/2 and π/4 are dyadic, so the program also runs bit-exact.
|