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]>
53 lines
2.2 KiB
JSON
53 lines
2.2 KiB
JSON
{
|
||
"schema": "wai.quantum.exercise/1",
|
||
"id": "noise",
|
||
"translations": { "zh-CN": "machine-assisted: to be reviewed by a fluent reader before it is advertised" },
|
||
"title": { "en": "Every gate is a chance to go wrong", "zh-CN": "每个门都是一次出错的机会" },
|
||
"task": {
|
||
"en": "This program reaches 11, but it runs on a noisy device: each one-qubit gate depolarizes with probability 0.01, each two-qubit gate with 0.03. Rewrite it so that it still reaches 11 and, under that noise, its distribution is within 0.02 of always 11.",
|
||
"zh-CN": "这个程序能到达 11,但它运行在一台有噪声的设备上:每个单比特门以 0.01 的概率发生去极化,每个双比特门以 0.03 的概率发生去极化。重写它,使它仍然到达 11,并且在这种噪声下,它的分布与“总是 11”的距离不超过 0.02。"
|
||
},
|
||
"starter": [
|
||
"OPENQASM 3.0;",
|
||
"include \"stdgates.inc\";",
|
||
"qubit[2] q;",
|
||
"bit[2] c;",
|
||
"x q[0];",
|
||
"x q[0];",
|
||
"x q[0];",
|
||
"h q[1];",
|
||
"h q[1];",
|
||
"x q[1];",
|
||
"cx q[0], q[1];",
|
||
"cx q[0], q[1];",
|
||
"c = measure q;"
|
||
],
|
||
"job": { "noise": { "depolarizing_1q": 0.01, "depolarizing_2q": 0.03 } },
|
||
"intent": { "distribution": { "11": 1.0 }, "tolerance": 0.02 },
|
||
"hints": {
|
||
"en": [
|
||
"The program's result does not need most of its gates. Which pairs of gates do nothing together?",
|
||
"A two-qubit gate costs three times the noise of a one-qubit gate here. The cheapest program that reaches 11 uses no two-qubit gate at all."
|
||
],
|
||
"zh-CN": [
|
||
"这个程序的结果用不着它的大部分门。哪些成对的门合起来什么也不做?",
|
||
"在这里,一个双比特门的噪声是单比特门的三倍。到达 11 的最便宜的程序根本不用双比特门。"
|
||
]
|
||
},
|
||
"reference": [
|
||
"OPENQASM 3.0;",
|
||
"include \"stdgates.inc\";",
|
||
"qubit[2] q;",
|
||
"bit[2] c;",
|
||
"x q[0];",
|
||
"x q[1];",
|
||
"c = measure q;"
|
||
],
|
||
"wrong": [
|
||
{
|
||
"fails": "intent",
|
||
"note": "a two-qubit gate's noise alone exceeds the tolerance",
|
||
"qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "qubit[2] q;", "bit[2] c;", "x q[0];", "cx q[0], q[1];", "c = measure q;"]
|
||
}
|
||
]
|
||
}
|