open-standards/wai/wai-quantum/course/lessons/t-count/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

58 lines
2.1 KiB
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"schema": "wai.quantum.exercise/1",
"id": "t-count",
"translations": { "zh-CN": "machine-assisted: to be reviewed by a fluent reader before it is advertised" },
"title": { "en": "Counting what costs", "zh-CN": "统计真正的代价" },
"task": {
"en": "This program uses eight T and T† gates. Rewrite it as the same circuit with no T or T† gate at all.",
"zh-CN": "这个程序用了八个 T 和 T† 门。把它改写成同一条线路,而且完全不用 T 或 T† 门。"
},
"starter": [
"OPENQASM 3.0;",
"include \"stdgates.inc\";",
"qubit[2] q;",
"t q[0];",
"t q[0];",
"cx q[0], q[1];",
"t q[1];",
"tdg q[1];",
"t q[1];",
"t q[1];",
"t q[1];",
"t q[1];"
],
"intent": {
"equivalent": "OPENQASM 3.0;\ninclude \"stdgates.inc\";\nqubit[2] q;\nt q[0];\nt q[0];\ncx q[0], q[1];\nt q[1];\ntdg q[1];\nt q[1];\nt q[1];\nt q[1];\nt q[1];\n"
},
"constraints": { "t_count": { "max": 0 } },
"hints": {
"en": [
"T is a quarter turn of S: T·T = S, and S·S = Z. A T next to a T† does nothing.",
"The rewrite lens does it one checked step at a time: `wai-quantum rewrite simplify`, or **Rewrites** in the Studio."
],
"zh-CN": [
"T 是 S 的一半:T·T = S,而 S·S = Z。T 与 T† 相邻时什么也不做。",
"重写透镜(rewrite lens)会一次一步地完成它,每一步都经过检查:`wai-quantum rewrite simplify`,或 Studio 中的 **Rewrites**。"
]
},
"reference": [
"OPENQASM 3.0;",
"include \"stdgates.inc\";",
"qubit[2] q;",
"s q[0];",
"cx q[0], q[1];",
"z q[1];"
],
"wrong": [
{
"fails": "intent",
"note": "S and Z swapped: a different circuit",
"qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "qubit[2] q;", "z q[0];", "cx q[0], q[1];", "s q[1];"]
},
{
"fails": "constraint",
"note": "merged, but T gates remain",
"qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "qubit[2] q;", "s q[0];", "cx q[0], q[1];", "t q[1];", "t q[1];", "s q[1];"]
}
]
}