{ "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];"] } ] }