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]>
56 lines
2.2 KiB
JSON
56 lines
2.2 KiB
JSON
{
|
||
"schema": "wai.quantum.exercise/1",
|
||
"id": "folding",
|
||
"translations": { "zh-CN": "machine-assisted: to be reviewed by a fluent reader before it is advertised" },
|
||
"title": { "en": "Amplifying noise on purpose", "zh-CN": "有意放大噪声" },
|
||
"task": {
|
||
"en": "Fold the Bell pair's two-qubit gate for zero-noise extrapolation: replace its one cx by three, so that the program is still the same circuit but carries three times the two-qubit noise.",
|
||
"zh-CN": "为零噪声外推折叠 Bell 对中的双比特门:把那一个 cx 换成三个,使程序仍是同一条线路,却承受三倍的双比特噪声。"
|
||
},
|
||
"starter": [
|
||
"OPENQASM 3.0;",
|
||
"include \"stdgates.inc\";",
|
||
"qubit[2] q;",
|
||
"bit[2] c;",
|
||
"h q[0];",
|
||
"cx q[0], q[1];",
|
||
"c = measure q;"
|
||
],
|
||
"intent": {
|
||
"equivalent": "OPENQASM 3.0;\ninclude \"stdgates.inc\";\nqubit[2] q;\nbit[2] c;\nh q[0];\ncx q[0], q[1];\nc = measure q;\n"
|
||
},
|
||
"constraints": { "allow": ["h", "cx"], "counts": { "cx": { "min": 3, "max": 3 }, "h": { "max": 1 } } },
|
||
"hints": {
|
||
"en": [
|
||
"A gate followed by its inverse does nothing. What is the inverse of cx?",
|
||
"G becomes G G⁻¹ G: the same circuit, with three times the gate's noise."
|
||
],
|
||
"zh-CN": [
|
||
"一个门后面跟着它的逆,就什么也不做。cx 的逆是什么?",
|
||
"G 变成 G G⁻¹ G:线路不变,而这个门的噪声变为三倍。"
|
||
]
|
||
},
|
||
"reference": [
|
||
"OPENQASM 3.0;",
|
||
"include \"stdgates.inc\";",
|
||
"qubit[2] q;",
|
||
"bit[2] c;",
|
||
"h q[0];",
|
||
"cx q[0], q[1];",
|
||
"cx q[0], q[1];",
|
||
"cx q[0], q[1];",
|
||
"c = measure q;"
|
||
],
|
||
"wrong": [
|
||
{
|
||
"fails": "constraint",
|
||
"note": "two copies cancel each other and leave no entangling gate",
|
||
"qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "qubit[2] q;", "bit[2] c;", "h q[0];", "cx q[0], q[1];", "cx q[0], q[1];", "c = measure q;"]
|
||
},
|
||
{
|
||
"fails": "intent",
|
||
"note": "three cx with the direction of one reversed is a different circuit",
|
||
"qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "qubit[2] q;", "bit[2] c;", "h q[0];", "cx q[0], q[1];", "cx q[1], q[0];", "cx q[0], q[1];", "c = measure q;"]
|
||
}
|
||
]
|
||
}
|