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]>
18 lines
1.2 KiB
Markdown
18 lines
1.2 KiB
Markdown
A real device gets each gate slightly wrong. A common model is *depolarizing* noise: with probability p a gate is followed by a random error (X, Y or Z on each qubit it touches), and with probability 1 − p it is exact. Two-qubit gates are usually several times worse than one-qubit gates, and measurement has its own *readout* error.
|
||
|
||
With noise, a program's state is no longer one vector but a *density matrix*, a mixture of the states each pattern of errors leaves. The engine evolves it exactly: a distribution intent under noise is still decided by proof, against the distribution the noise really gives. This exercise's job carries the noise, so the check runs your program as the device would.
|
||
|
||
The lesson in numbers: the fewer gates, and above all the fewer two-qubit gates, the closer a noisy run stays to the ideal. The critique's figures (`wai-quantum critique`) count both, and its modelled fidelity multiplies one survival rate per gate.
|
||
|
||
```sh runnable
|
||
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
|
||
wai-quantum run pair.qasm --noise depolarizing_2q=0.03 --noise readout=0.02 --shots 2000 --seed 3
|
||
```
|