open-standards/wai/wai-quantum/course/lessons/bit-flip-code/exercise.json
Transaction Science 12496404b5
Some checks failed
standards workspaces build + test / which workspaces this change touches (pull_request) Successful in 8s
wai-audit collector and player integration / does this change touch it (pull_request) Successful in 6s
WAI breaking changes and the conformance runner / WAI breaking · does this change touch WAI (pull_request) Successful in 7s
WAI operation catalogue / does this change touch it (pull_request) Successful in 10s
WAI conformance / does this change touch it (pull_request) Successful in 7s
WAI energy receipts / does this change touch it (pull_request) Successful in 7s
WAI examples / WAI examples · does this change touch them (pull_request) Successful in 8s
wai-quantum command line / does this change touch it (pull_request) Successful in 8s
wai-quantum contract / does this change touch it (pull_request) Successful in 6s
wai-quantum dataflow member / does this change touch it (pull_request) Successful in 7s
wai-quantum CUDA member / does this change touch it (pull_request) Successful in 8s
wai-quantum docs, course and locales / does this change touch it (pull_request) Successful in 7s
wai-quantum signal processor / does this change touch it (pull_request) Successful in 10s
wai-quantum editors / does this change touch it (pull_request) Successful in 6s
wai-quantum resource estimation / does this change touch it (pull_request) Successful in 9s
wai-quantum other formats / does this change touch it (pull_request) Successful in 5s
wai-quantum FPGA member / does this change touch it (pull_request) Successful in 8s
wai-quantum HIP member / does this change touch it (pull_request) Successful in 8s
wai-quantum for JavaScript / does this change touch it (pull_request) Successful in 10s
wai-quantum OpenQASM reader / does this change touch it (pull_request) Successful in 5s
wai-quantum Metal member / does this change touch it (pull_request) Successful in 6s
wai-quantum npu-cores member / does this change touch it (pull_request) Successful in 5s
wai-quantum neural-processor member / does this change touch it (pull_request) Successful in 6s
wai-quantum OpenCL member / does this change touch it (pull_request) Successful in 5s
wai-quantum pulse and dynamics / does this change touch it (pull_request) Successful in 6s
wai-quantum for Python / does this change touch it (pull_request) Successful in 5s
wai-quantum error correction and mitigation / does this change touch it (pull_request) Successful in 5s
wai-quantum-qpu / does this change touch it (pull_request) Successful in 5s
wai-quantum extension points / does this change touch it (pull_request) Successful in 8s
wai-quantum service / does this change touch it (pull_request) Successful in 5s
wai-quantum matrix-extension member / does this change touch it (pull_request) Successful in 7s
wai-quantum studio and desktop / does this change touch it (pull_request) Successful in 5s
wai-quantum tensor-engine member / does this change touch it (pull_request) Successful in 9s
wai-quantum portable tensor program / does this change touch it (pull_request) Successful in 6s
wai-quantum variational and algorithm library / does this change touch it (pull_request) Successful in 5s
wai-quantum CPU vector units / does this change touch it (pull_request) Successful in 7s
wai-quantum on every processor / emulated · aarch64-unknown-linux-gnu (pull_request) Successful in 4m54s
wai-quantum verdicts and repairs / does this change touch it (pull_request) Successful in 6s
wai-quantum views in agent hosts / does this change touch it (pull_request) Successful in 7s
wai-quantum WebGPU member / does this change touch it (pull_request) Successful in 6s
wai-sink-android native sink library / does this change touch it (pull_request) Successful in 7s
wai-sink-swift native sink package / does this change touch it (pull_request) Successful in 7s
WAI Studio / does this change touch it (pull_request) Successful in 7s
wai-web reach builds / wai-web reach · does this change touch it (pull_request) Successful in 6s
wai-quantum on every processor / emulated · i686-unknown-linux-gnu (pull_request) Successful in 3m5s
wai-web wasm32 / does this change touch it (pull_request) Successful in 7s
wai-quantum on every processor / emulated · armv7-unknown-linux-gnueabihf (pull_request) Successful in 5m26s
wai-quantum on every processor / emulated · powerpc64-unknown-linux-gnu (pull_request) Successful in 7m6s
wai-quantum on every processor / emulated · loongarch64-unknown-linux-gnu (pull_request) Successful in 7m24s
wai-quantum on every processor / emulated · s390x-unknown-linux-gnu (pull_request) Successful in 6m55s
wai-quantum on every processor / emulated · sparc64-unknown-linux-gnu (pull_request) Successful in 15m49s
WAI conformance / fast integer kernels, every x86_64 kernel set (AVX-512 silicon) (pull_request) Failing after 0s
wai-quantum on every processor / emulated · powerpc64le-unknown-linux-gnu (pull_request) Successful in 42m40s
wai-quantum on every processor / emulated · riscv64gc-unknown-linux-gnu (pull_request) Successful in 48m37s
wai-quantum HIP member / member · HIP (framework-128gb) (pull_request) Successful in 1m29s
wai-quantum WebGPU member / member · DX12 and Vulkan (cbio-windows) (pull_request) Successful in 11m49s
wai-quantum npu-cores member / member · npu-cores, neural processor (framework-128gb silicon) (pull_request) Successful in 1m27s
wai-quantum OpenCL member / member · OpenCL GPU (framework-128gb) (pull_request) Successful in 26s
wai-quantum portable tensor program / tensor program · integrated GPU (framework-128gb) (pull_request) Successful in 22s
wai-quantum CPU vector units / member · vector units, avx2 and avx512 (framework-128gb silicon) (pull_request) Successful in 27s
wai-quantum WebGPU member / member · integrated GPU, Vulkan (framework-128gb) (pull_request) Successful in 9m39s
repository checks / lockfiles, advisories, tests in CI, workflow hygiene, spec and section references, public text (pull_request) Successful in 4m43s
wai-quantum CUDA member / member · CUDA (thor) (pull_request) Successful in 2m1s
wai-quantum OpenCL member / member · OpenCL GPU and CPU (thor) (pull_request) Successful in 49s
wai-quantum WebGPU member / member · GPU, Vulkan (thor) (pull_request) Successful in 24m36s
wai-audit collector and player integration / collector · linux (pull_request) Successful in 1m59s
WAI breaking changes and the conformance runner / WAI breaking and conform · their tests, and the independent verifiers through wai conform · linux (pull_request) Successful in 3m15s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 29s
WAI conformance / faces from keypoints under wasm32-wasip2 (wasmtime) (pull_request) Successful in 1m39s
WAI breaking changes and the conformance runner / WAI breaking · wire, record and API against main · linux (pull_request) Failing after 6m1s
WAI conformance / quantum core and corpus under wasm32-wasip2 (wasmtime) (pull_request) Successful in 4m13s
wai-quantum contract / the policy is linked, and the deprecations page reads (pull_request) Successful in 5s
wai-quantum command line / command line · linux (pull_request) Successful in 3m19s
wai-audit collector and player integration / collector, player integration and the browser end to end · macos (pull_request) Successful in 2m2s
wai-quantum dataflow member / member · dataflow device, simulated (pci 1e52:401e) (pull_request) Successful in 1m34s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 39s
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Successful in 1m45s
wai-quantum contract / schemas and the committed tool lists · linux (pull_request) Successful in 6m33s
WAI operation catalogue / the catalogue and every door · linux (pull_request) Successful in 15m0s
wai-quantum docs, course and locales / the Studio's words in every locale · linux (pull_request) Successful in 50s
WAI examples / WAI examples · portable · linux (pull_request) Successful in 9m32s
wai-quantum dataflow member / member · dataflow device, simulated (pci 1e52:b140) (pull_request) Successful in 6m34s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 15m56s
wai-quantum CUDA member / member · CUDA absent (linux) (pull_request) Successful in 6m20s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 10m28s
wai-quantum docs, course and locales / the course and the command line's languages · linux (pull_request) Successful in 11m2s
wai-quantum contract / API compatibility · linux (pull_request) Successful in 15m40s
wai-quantum dataflow member / member · dataflow device absent (macos) (pull_request) Successful in 34s
WAI conformance / cargo-class corpora · macos (pull_request) Failing after 16m1s
wai-quantum command line / command line · macos (pull_request) Successful in 3m9s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 8m58s
wai-quantum resource estimation / estimation and calibration · linux, release (pull_request) Successful in 2m17s
wai-quantum docs, course and locales / every command and snippet in the docs · linux (pull_request) Successful in 17m25s
wai-quantum editors / editors · macos (pull_request) Successful in 1m18s
wai-quantum FPGA member / member · FPGA simulation absent (linux) (pull_request) Successful in 35s
wai-quantum editors / editors · linux (pull_request) Successful in 10m34s
wai-quantum other formats / the set under wasm32-wasip2 (wasmtime) (pull_request) Successful in 6m29s
wai-quantum Metal member / member · Metal absent (linux) (pull_request) Successful in 31s
wai-quantum OpenQASM reader / corpus under wasm32-wasip2 (wasmtime) (pull_request) Successful in 1m8s
wai-quantum OpenQASM reader / reader and corpus · linux (pull_request) Successful in 1m47s
wai-quantum signal processor / processor and member · signal processor, emulated (pull_request) Successful in 22m48s
wai-quantum neural-processor member / member · neural processor absent (linux) (pull_request) Successful in 28s
wai-quantum OpenCL member / member · OpenCL absent (linux) (pull_request) Successful in 26s
wai-quantum pulse and dynamics / reader, simulator and pulse jobs under wasm32-wasip2 (wasmtime) (pull_request) Successful in 58s
wai-quantum pulse and dynamics / reader, simulator and pulse jobs · linux, release (pull_request) Successful in 1m25s
wai-quantum FPGA member / member · FPGA datapath, simulated (macos) (pull_request) Successful in 5m13s
wai-quantum Metal member / member · Metal (macos) (pull_request) Successful in 33s
wai-quantum other formats / readers, writers and the set · linux (pull_request) Successful in 16m49s
wai-quantum for JavaScript / javascript · linux (pull_request) Successful in 11m36s
wai-quantum error correction and mitigation / codes, decoders, texts and mitigation · linux, release (pull_request) Successful in 2m19s
wai-quantum-qpu / clients against their contracts (linux) (pull_request) Successful in 2m6s
wai-quantum for Python / python · linux (pull_request) Successful in 5m42s
wai-quantum extension points / the registry under wasm32-wasip2 (wasmtime) (pull_request) Successful in 51s
wai-quantum OpenCL member / member · OpenCL GPU (macos) (pull_request) Successful in 32s
WAI examples / WAI examples · the archive, the readiness check, the browser and Apple · macos (pull_request) Successful in 26m41s
wai-quantum pulse and dynamics / the same bits · macos (pull_request) Successful in 1m22s
wai-quantum matrix-extension member / member · matrix extension, emulated (aarch64 Linux) (pull_request) Successful in 14s
wai-quantum for Python / python · macos (pull_request) Successful in 2m16s
wai-quantum-qpu / credentials in the keychain (macos) (pull_request) Successful in 26s
wai-quantum neural-processor member / member · neural processor (macos) (pull_request) Successful in 6m2s
wai-quantum service / service · linux (pull_request) Successful in 5m48s
wai-quantum portable tensor program / tensor program · CPU, mutants, GPU builds (pull_request) Successful in 31s
wai-quantum studio and desktop / studio · browser (pull_request) Successful in 5m22s
wai-quantum CPU vector units / member · vector unit, rvv 1024-bit (riscv64, emulated) (pull_request) Successful in 13s
wai-quantum CPU vector units / member · vector unit, rvv 128-bit (riscv64, emulated) (pull_request) Successful in 11s
wai-quantum CPU vector units / member · vector unit, sve 128-bit (aarch64, emulated) (pull_request) Successful in 20s
wai-quantum tensor-engine member / member · tensor engine, the kernel toolchain's simulator (linux) (pull_request) Successful in 4m56s
wai-quantum CPU vector units / member · vector unit, sve 2048-bit (aarch64, emulated) (pull_request) Successful in 11s
wai-quantum CPU vector units / member · vector unit, avx2 (x86_64 silicon) (pull_request) Successful in 9s
wai-quantum CPU vector units / member · vector unit, sve 512-bit (aarch64, emulated) (pull_request) Successful in 11s
wai-quantum studio and desktop / desktop app · linux (pull_request) Successful in 6m29s
wai-quantum variational and algorithm library / parameters, gradients, optimisers, VQE, QAOA and builders · linux, release (pull_request) Successful in 2m50s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 50m31s
wai-quantum extension points / the registry and the example · linux (pull_request) Successful in 10m30s
wai-quantum matrix-extension member / member · matrix extension absent (macos) (pull_request) Successful in 13s
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Successful in 26s
wai-quantum verdicts and repairs / verdicts, repairs and the intent set · linux (pull_request) Successful in 4m26s
wai-quantum views in agent hosts / views · the page and its engine (pull_request) Successful in 3m21s
wai-quantum verdicts and repairs / the intent set and the verdict under wasm32-wasip2 (wasmtime) (pull_request) Successful in 4m43s
wai-quantum studio and desktop / desktop app · macos (pull_request) Successful in 4m19s
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Successful in 21s
wai-quantum WebGPU member / shader checks · browser build · wasip2 inertness (pull_request) Successful in 3m25s
WAI Studio / the catalogue's actions, the unit tests and the core · linux (pull_request) Successful in 1m54s
wai-web reach builds / wai-web reach builds · the package of record, every output as recorded (pull_request) Successful in 2m27s
wai-quantum WebGPU member / member · software Vulkan (linux) (pull_request) Successful in 4m57s
wai-quantum service / service · macos (pull_request) Successful in 11m49s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 5m26s
wai-web reach builds / wai-web reach builds · this tree's wai-web, every rung on its engine line (pull_request) Successful in 8m0s
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Successful in 2m30s
wai-quantum views in agent hosts / views · a scripted host (pull_request) Successful in 11m38s
wai-quantum studio and desktop / desktop app · windows (pull_request) Successful in 9m44s
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Successful in 6m42s
WAI Studio / Studio in Chromium and Firefox · macos (pull_request) Successful in 10m25s
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Successful in 13m13s
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Successful in 15m4s
WAI Studio / Studio in WebKit · linux (pull_request) Successful in 41m50s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Has been cancelled
wai-quantum CUDA member / member · CUDA (jetson-hub) (pull_request) Successful in 1m58s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Has been cancelled
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Has been cancelled
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Has been cancelled
WAI conformance / each feature of the independent verifiers' steps compiles alone (pull_request) Has been cancelled
WAI conformance / delivery telemetry · CMCD and CMSD against an independent library (pull_request) Has been cancelled
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Has been cancelled
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Has been cancelled
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Has been cancelled
WAI examples / WAI examples · android-app · linux-arm64 (pull_request) Has been cancelled
wai-quantum OpenCL member / member · OpenCL GPU and CPU (jetson-hub) (pull_request) Successful in 54s
wai-quantum HIP member / member · HIP absent (linux-arm64) (pull_request) Has been cancelled
wai-quantum service / service energy · linux packages (pull_request) Failing after 57s
wai-quantum npu-cores member / member · npu-cores absent (linux-arm64) (pull_request) Has been cancelled
wai-quantum portable tensor program / tensor program · GPUs (jetson-hub) (pull_request) Successful in 49s
wai-quantum pulse and dynamics / the same bits · linux-arm64 (pull_request) Has been cancelled
wai-quantum extension points / the registry and the example · linux-arm64 (pull_request) Has been cancelled
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Has been cancelled
wai-quantum variational and algorithm library / parameters, gradients, optimisers, VQE, QAOA and builders · linux-arm64, release (pull_request) Has been cancelled
wai-quantum WebGPU member / member · GPU, Vulkan (jetson-hub) (pull_request) Has been cancelled
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (pull_request) Has been cancelled
wai-quantum: an injected error is corrected from the qubits, never read: the error-correction lessons check behaviour
The second review found finding 1 closed only for undeclared inputs. A program that
declared `input uint err;` and never used it passed the bit-flip lesson at proof, and
one that branched on the classical err passed the syndrome lesson.

A new constraint, `inject`, names the input whose value is the qubit an error flips.
The cases' programs may then differ in that one gate alone, an x on the qubit the case
names, every other gate, measurement and step the same (course::injected). So the error
is in the quantum state, the program cannot read it classically, and what finds and
corrects it is the program's quantum operations, the same in every case. A program
that never applies the error, reads it elsewhere, or flips another qubit fails, saying
which. A second, `qubits` ({"max": n}), closes the last way round: an answer kept on a
qubit no error reaches. bit-flip-code and syndrome set both; their solutions and wrong
answers keep their results. The exercise schema names both, and a case set an
injection cannot be made from is refused.

Test an_injected_error_is_corrected_from_the_qubits_and_never_read, failing on
ba59c776e for the reason it states (the declared, unused input passed bit-flip-code).
Course tests 13 -> 14 in wai-quantum-docs.yml.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-06 07:58:36 -05:00

70 lines
3.4 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": "bit-flip-code",
"translations": { "zh-CN": "machine-assisted: to be reviewed by a fluent reader before it is advertised" },
"title": { "en": "Three copies against one flip", "zh-CN": "用三份副本抵御一次翻转" },
"task": {
"en": "q[0] holds |1⟩. Encode it into three qubits, let the error flip the qubit q[err] (the check tries err = 0, 1 and 2), then decode and correct so that q[0] reads 1 in every case. Use no x besides the two the program has.",
"zh-CN": "q[0] 存有 |1⟩。把它编码到三个量子比特中,让错误翻转量子比特 q[err](检查会依次尝试 err = 0、1 和 2),然后解码并纠正,使 q[0] 在每种情况下都读出 1。除了程序中已有的两个 x,不要再使用 x。"
},
"starter": [
"OPENQASM 3.0;",
"include \"stdgates.inc\";",
"input uint err;",
"qubit[3] q;",
"bit[1] c;",
"// the state to protect",
"x q[0];",
"// encode: your gates here",
"// the error, on a qubit the check chooses",
"x q[err];",
"// decode and correct: your gates here",
"c[0] = measure q[0];"
],
"cases": [
{ "inputs": { "err": 0 }, "name": { "en": "a flip of q[0]", "zh-CN": "q[0] 被翻转" } },
{ "inputs": { "err": 1 }, "name": { "en": "a flip of q[1]", "zh-CN": "q[1] 被翻转" } },
{ "inputs": { "err": 2 }, "name": { "en": "a flip of q[2]", "zh-CN": "q[2] 被翻转" } }
],
"intent": { "distribution": { "1": 1.0 } },
"constraints": { "allow": ["x", "cx", "ccx"], "counts": { "x": { "max": 2 } }, "qubits": { "max": 3 }, "inject": "err" },
"hints": {
"en": [
"Encode with two controlled-NOTs from q[0]: |1⟩ becomes |111⟩, and one flip leaves two copies right.",
"Decoding with the same two controlled-NOTs leaves q[1] and q[2] saying whether each disagrees with q[0].",
"q[0] is wrong exactly when both other qubits disagree with it. Which gate flips a qubit when two others are both 1?"
],
"zh-CN": [
"用两个以 q[0] 为控制的受控非门编码:|1⟩ 变成 |111⟩,一次翻转之后仍有两份副本是对的。",
"用同样的两个受控非门解码后,q[1] 和 q[2] 分别表示它是否与 q[0] 不一致。",
"恰好当另外两个量子比特都与 q[0] 不一致时,q[0] 才是错的。哪个门会在另外两个量子比特都为 1 时翻转一个量子比特?"
]
},
"reference": [
"OPENQASM 3.0;",
"include \"stdgates.inc\";",
"input uint err;",
"qubit[3] q;",
"bit[1] c;",
"x q[0];",
"cx q[0], q[1];",
"cx q[0], q[2];",
"x q[err];",
"cx q[0], q[1];",
"cx q[0], q[2];",
"ccx q[2], q[1], q[0];",
"c[0] = measure q[0];"
],
"wrong": [
{
"fails": "intent",
"note": "without correction a flip of q[0] is read as 0",
"qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "input uint err;", "qubit[3] q;", "bit[1] c;", "x q[0];", "cx q[0], q[1];", "cx q[0], q[2];", "x q[err];", "cx q[0], q[1];", "cx q[0], q[2];", "c[0] = measure q[0];"]
},
{
"fails": "intent",
"note": "correcting with one copy fixes some flips and makes others",
"qasm": ["OPENQASM 3.0;", "include \"stdgates.inc\";", "input uint err;", "qubit[3] q;", "bit[1] c;", "x q[0];", "cx q[0], q[1];", "cx q[0], q[2];", "x q[err];", "cx q[0], q[1];", "cx q[0], q[2];", "cx q[1], q[0];", "c[0] = measure q[0];"]
}
]
}