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]>
52 lines
1.9 KiB
JSON
52 lines
1.9 KiB
JSON
{
|
||
"schema": "wai.quantum.exercise/1",
|
||
"id": "phase",
|
||
"translations": { "zh-CN": "machine-assisted: to be reviewed by a fluent reader before it is advertised" },
|
||
"title": { "en": "A phase you cannot see, until you interfere", "zh-CN": "看不见的相位,直到干涉发生" },
|
||
"task": {
|
||
"en": "One qubit. Using only h and z, make its measurement give 1 every time.",
|
||
"zh-CN": "一个量子比特。只用 h 和 z,让它的测量每次都给出 1。"
|
||
},
|
||
"starter": [
|
||
"OPENQASM 3.0;",
|
||
"include \"stdgates.inc\";",
|
||
"qubit[1] q;",
|
||
"bit[1] c;",
|
||
"h q[0];",
|
||
"c = measure q;"
|
||
],
|
||
"intent": { "distribution": { "1": 1.0 } },
|
||
"constraints": { "allow": ["h", "z"] },
|
||
"hints": {
|
||
"en": [
|
||
"z leaves |0⟩ alone and flips the sign of |1⟩. On (|0⟩ + |1⟩)/√2 it changes nothing a measurement can see.",
|
||
"A second Hadamard turns a sign between |0⟩ and |1⟩ into a difference in outcomes."
|
||
],
|
||
"zh-CN": [
|
||
"z 不改变 |0⟩,而把 |1⟩ 的符号取反。作用在 (|0⟩ + |1⟩)/√2 上时,它不改变任何测量能看到的东西。",
|
||
"第二个 Hadamard 门会把 |0⟩ 与 |1⟩ 之间的符号差别变成结果上的差别。"
|
||
]
|
||
},
|
||
"reference": [
|
||
"OPENQASM 3.0;",
|
||
"include \"stdgates.inc\";",
|
||
"qubit[1] q;",
|
||
"bit[1] c;",
|
||
"h q[0];",
|
||
"z q[0];",
|
||
"h q[0];",
|
||
"c = measure q;"
|
||
],
|
||
"wrong": [
|
||
{
|
||
"fails": "intent",
|
||
"note": "the sign is there, but nothing interferes it into an outcome",
|
||
"qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "qubit[1] q;", "bit[1] c;", "h q[0];", "z q[0];", "c = measure q;"]
|
||
},
|
||
{
|
||
"fails": "constraint",
|
||
"note": "x gives 1, but the exercise allows only h and z",
|
||
"qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "qubit[1] q;", "bit[1] c;", "x q[0];", "c = measure q;"]
|
||
}
|
||
]
|
||
}
|