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]>
851 B
Given a gate U and a state |ψ⟩ with U|ψ⟩ = e^{2πiφ}|ψ⟩, phase estimation reads φ in binary. It is the core of factoring, of quantum chemistry's energy estimates, and of many other algorithms.
The circuit has a counting register of n qubits in superposition. Counting qubit k controls U raised to the power 2ᵏ on |ψ⟩. By phase kickback each power leaves its phase on its control, and the register ends in
Σₓ e^{2πiφx} |x⟩ / √2ⁿ,
which is the quantum Fourier transform of |2ⁿφ⟩. The inverse transform turns it back into the basis state |2ⁿφ⟩, and measuring reads φ to n bits. When 2ⁿφ is a whole number the outcome is certain; otherwise it is most likely the nearest one.
A controlled T is cp(π/4), and its powers are cp(π/2) and cp(π). Here φ = 1/8 and n = 3, so the outcome is 1, written 001.