{ "schema": "wai.quantum.exercise/1", "id": "syndrome", "translations": { "zh-CN": "machine-assisted: to be reviewed by a fluent reader before it is advertised" }, "title": { "en": "Finding the flip without reading the data", "zh-CN": "不读数据也能找到翻转" }, "task": { "en": "Data qubits q[0], q[1], q[2] hold the code word |000⟩, and the error flips q[err]. Measure the two parity checks into the ancillas, q[0]⊕q[1] into s[0] through q[3] and q[1]⊕q[2] into s[1] through q[4], without measuring a data qubit. The syndrome must read 01, 11 and 10 for err = 0, 1 and 2.", "zh-CN": "数据量子比特 q[0]、q[1]、q[2] 存有码字 |000⟩,错误翻转了 q[err]。把两个奇偶校验测量到辅助量子比特中:q[0]⊕q[1] 经 q[3] 测到 s[0],q[1]⊕q[2] 经 q[4] 测到 s[1],且不测量任何数据量子比特。对 err = 0、1 和 2,校验子(syndrome)必须分别读出 01、11 和 10。" }, "starter": [ "OPENQASM 3.0;", "include \"stdgates.inc\";", "input uint err;", "qubit[5] q;", "bit[2] s;", "// the error, on a data qubit the check chooses", "x q[err];", "// the parity checks: your gates here", "s[0] = measure q[3];", "s[1] = measure q[4];" ], "cases": [ { "inputs": { "err": 0 }, "name": { "en": "a flip of q[0]", "zh-CN": "q[0] 被翻转" }, "intent": { "distribution": { "01": 1.0 } } }, { "inputs": { "err": 1 }, "name": { "en": "a flip of q[1]", "zh-CN": "q[1] 被翻转" }, "intent": { "distribution": { "11": 1.0 } } }, { "inputs": { "err": 2 }, "name": { "en": "a flip of q[2]", "zh-CN": "q[2] 被翻转" }, "intent": { "distribution": { "10": 1.0 } } } ], "constraints": { "allow": ["x", "cx"], "counts": { "x": { "max": 1 }, "cx": { "max": 4 } }, "qubits": { "max": 5 }, "inject": "err" }, "hints": { "en": [ "A controlled-NOT from a data qubit onto an ancilla in |0⟩ adds that qubit's value to the ancilla, mod 2.", "Each ancilla takes two controlled-NOTs, one from each of the data qubits its check compares." ], "zh-CN": [ "从一个数据量子比特到处于 |0⟩ 的辅助量子比特的受控非门,会把该量子比特的值(模 2)加到辅助量子比特上。", "每个辅助量子比特需要两个受控非门,分别来自它的校验所比较的两个数据量子比特。" ] }, "reference": [ "OPENQASM 3.0;", "include \"stdgates.inc\";", "input uint err;", "qubit[5] q;", "bit[2] s;", "x q[err];", "cx q[0], q[3];", "cx q[1], q[3];", "cx q[1], q[4];", "cx q[2], q[4];", "s[0] = measure q[3];", "s[1] = measure q[4];" ], "wrong": [ { "fails": "intent", "note": "the checks swapped between the ancillas", "qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "input uint err;", "qubit[5] q;", "bit[2] s;", "x q[err];", "cx q[1], q[3];", "cx q[2], q[3];", "cx q[0], q[4];", "cx q[1], q[4];", "s[0] = measure q[3];", "s[1] = measure q[4];"] } ] }