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.1 KiB
JSON
53 lines
2.1 KiB
JSON
{
|
||
"schema": "wai.quantum.exercise/1",
|
||
"id": "ghz",
|
||
"translations": { "zh-CN": "machine-assisted: to be reviewed by a fluent reader before it is advertised" },
|
||
"title": { "en": "Three in agreement, with the right sign", "zh-CN": "三个比特一致,而且符号正确" },
|
||
"task": {
|
||
"en": "Three qubits. Prepare the state (|000⟩ + |111⟩)/√2, with a plus sign, and measure every qubit into c. The check compares the state itself, not only its outcomes.",
|
||
"zh-CN": "三个量子比特。制备状态 (|000⟩ + |111⟩)/√2(加号),并把每个量子比特都测量到 c 中。检查比较的是状态本身,而不只是结果。"
|
||
},
|
||
"starter": [
|
||
"OPENQASM 3.0;",
|
||
"include \"stdgates.inc\";",
|
||
"qubit[3] q;",
|
||
"bit[3] c;",
|
||
"// your gates here",
|
||
"c = measure q;"
|
||
],
|
||
"intent": {
|
||
"prepares": "OPENQASM 3.0;\ninclude \"stdgates.inc\";\nqubit[3] q;\nbit[3] c;\nh q[0];\ncx q[0], q[1];\ncx q[0], q[2];\nc = measure q;\n"
|
||
},
|
||
"hints": {
|
||
"en": [
|
||
"Start from the Bell pair and bring a third qubit into the agreement.",
|
||
"The state (|000⟩ − |111⟩)/√2 has the same outcomes and is a different state: watch for a stray z."
|
||
],
|
||
"zh-CN": [
|
||
"从 Bell 对出发,再让第三个量子比特也加入这种一致。",
|
||
"状态 (|000⟩ − |111⟩)/√2 的结果相同,却是另一个状态:留意多余的 z。"
|
||
]
|
||
},
|
||
"reference": [
|
||
"OPENQASM 3.0;",
|
||
"include \"stdgates.inc\";",
|
||
"qubit[3] q;",
|
||
"bit[3] c;",
|
||
"h q[0];",
|
||
"cx q[0], q[1];",
|
||
"cx q[1], q[2];",
|
||
"c = measure q;"
|
||
],
|
||
"wrong": [
|
||
{
|
||
"fails": "intent",
|
||
"note": "the same outcomes with a minus sign: a different state",
|
||
"qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "qubit[3] q;", "bit[3] c;", "h q[0];", "cx q[0], q[1];", "cx q[1], q[2];", "z q[0];", "c = measure q;"]
|
||
},
|
||
{
|
||
"fails": "intent",
|
||
"note": "only two qubits agree",
|
||
"qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "qubit[3] q;", "bit[3] c;", "h q[0];", "cx q[0], q[1];", "c = measure q;"]
|
||
}
|
||
]
|
||
}
|