open-standards/wai/wai-quantum/course/lessons/rotation/exercise.json
Transaction Science fb230d8a62 wai-quantum: the circuits course as data, each exercise checked by the engine, and wai-quantum learn in English and Chinese
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]>
2026-10-28 08:42:54 -04:00

50 lines
1.7 KiB
JSON

{
"schema": "wai.quantum.exercise/1",
"id": "rotation",
"translations": { "zh-CN": "machine-assisted: to be reviewed by a fluent reader before it is advertised" },
"title": { "en": "Probabilities other than one half", "zh-CN": "不是二分之一的概率" },
"task": {
"en": "One qubit. Make its measurement give 1 with probability exactly 1/4, using one rotation ry(θ).",
"zh-CN": "一个量子比特。只用一个旋转门 ry(θ),让测量以恰好 1/4 的概率给出 1。"
},
"starter": [
"OPENQASM 3.0;",
"include \"stdgates.inc\";",
"qubit[1] q;",
"bit[1] c;",
"ry(pi/2) q[0];",
"c = measure q;"
],
"intent": { "distribution": { "0": 0.75, "1": 0.25 } },
"constraints": { "allow": ["ry"], "counts": { "ry": { "min": 1, "max": 1 } } },
"hints": {
"en": [
"After ry(θ) on |0⟩, the probability of 1 is sin²(θ/2).",
"Which angle has a sine of one half?"
],
"zh-CN": [
"对 |0⟩ 作用 ry(θ) 之后,得到 1 的概率是 sin²(θ/2)。",
"哪个角的正弦等于二分之一?"
]
},
"reference": [
"OPENQASM 3.0;",
"include \"stdgates.inc\";",
"qubit[1] q;",
"bit[1] c;",
"ry(pi/3) q[0];",
"c = measure q;"
],
"wrong": [
{
"fails": "intent",
"note": "θ = π/4 gives sin²(π/8), about 0.146",
"qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "qubit[1] q;", "bit[1] c;", "ry(pi/4) q[0];", "c = measure q;"]
},
{
"fails": "constraint",
"note": "two rotations where the exercise asks for one",
"qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "qubit[1] q;", "bit[1] c;", "ry(pi/6) q[0];", "ry(pi/6) q[0];", "c = measure q;"]
}
]
}