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]>
49 lines
1.6 KiB
JSON
49 lines
1.6 KiB
JSON
{
|
||
"schema": "wai.quantum.exercise/1",
|
||
"id": "first-circuit",
|
||
"translations": { "zh-CN": "machine-assisted: to be reviewed by a fluent reader before it is advertised" },
|
||
"title": { "en": "A qubit, a gate, a measurement", "zh-CN": "一个量子比特、一个门、一次测量" },
|
||
"task": {
|
||
"en": "One qubit starts in |0⟩. Add one gate so that measuring it gives 1 every time.",
|
||
"zh-CN": "一个量子比特从 |0⟩ 开始。加一个门,使测量结果每次都是 1。"
|
||
},
|
||
"starter": [
|
||
"OPENQASM 3.0;",
|
||
"include \"stdgates.inc\";",
|
||
"qubit[1] q;",
|
||
"bit[1] c;",
|
||
"// your gate here",
|
||
"c = measure q;"
|
||
],
|
||
"intent": { "distribution": { "1": 1.0 } },
|
||
"hints": {
|
||
"en": [
|
||
"A measurement of |0⟩ always gives 0. What gate takes |0⟩ to |1⟩?",
|
||
"The gate is the quantum version of a NOT: its name is one letter."
|
||
],
|
||
"zh-CN": [
|
||
"测量 |0⟩ 总是得到 0。哪个门能把 |0⟩ 变成 |1⟩?",
|
||
"这个门是经典“非”运算的量子版本,名字只有一个字母。"
|
||
]
|
||
},
|
||
"reference": [
|
||
"OPENQASM 3.0;",
|
||
"include \"stdgates.inc\";",
|
||
"qubit[1] q;",
|
||
"bit[1] c;",
|
||
"x q[0];",
|
||
"c = measure q;"
|
||
],
|
||
"wrong": [
|
||
{
|
||
"fails": "intent",
|
||
"note": "a Hadamard gives 0 or 1 by chance, not 1 every time",
|
||
"qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "qubit[1] q;", "bit[1] c;", "h q[0];", "c = measure q;"]
|
||
},
|
||
{
|
||
"fails": "refused",
|
||
"note": "a gate the reader does not know",
|
||
"qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "qubit[1] q;", "bit[1] c;", "not q[0];", "c = measure q;"]
|
||
}
|
||
]
|
||
}
|