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
The GHZ state (|000⟩ + |111⟩)/√2 extends the Bell pair to three qubits: all agree, all 0 or all 1.
Two states can give the same outcomes and still differ. (|000⟩ − |111⟩)/√2 measures exactly like the GHZ state, but the minus sign is a relative phase between its two parts, and a later gate can turn that phase into a different outcome. A distribution cannot see it.
So this exercise states its intent as a state: prepares. The engine runs your program and its own reference from |0…0⟩ and compares the two states up to a global phase (a phase on the whole state, which no measurement can see), and the verdict is a proof. Two programs can prepare the same state and still be different circuits, so more than one answer passes.
On the command line an intent is a file:
cat > pair.qasm <<'QASM'
OPENQASM 3.0;
include "stdgates.inc";
qubit[2] q;
bit[2] c;
h q[0];
cx q[0], q[1];
c = measure q;
QASM
echo '{"distribution": {"00": 0.5, "11": 0.5}}' > pair-intent.json
wai-quantum run pair.qasm --intent pair-intent.json --shots 100