A job's receipt showed that a result is the one its signer sealed. A verdict (wai.quantum.verdict/1) already said how far the engine checked a circuit job's intent, as a level. It now names what did the checking, a job on a provider's device and a qudit job carry one, and a verifier works a sealed verdict out again. The contract is quantum-providers §8.9. The layer. Every check, and the verdict, names its layer and that layer's limits: exact_simulation, stabilizer, pass_equivalence, reading, certificate, random_states, agreement, samples, physical_consistency or unchecked (verdict::LAYERS). The verdict's is the weakest of its checks', and unchecked where an intent was not decided or none was given. The result's accuracy class is beside it under executed.accuracy. More intents. expectation (an observable's exact value on the program's state), and four of the answer the job returned: outcomes, conserves (weight or parity), counts (the job's own counts held to a stated distribution, by a test at a level or within a distance) and agrees (those counts held to the exact distribution the engine computes of the program). outcomes and conserves are decided by the program's exact distribution where the run is the program's own, and on the counts otherwise. More jobs. provider::read reads an intent before the job is sent and refuses a sampled one there (J020); provider::seal seals the verdict with the device's answer. A qudit job takes an intent of its counts. An energy-landscape job's own sealed word reads as a verdict (verdict::of_job, which panicked on one: its `verdict` is a word, not an object). A job whose form holds no intent, or one another host sealed, is signed off (engine::signoff, wai.quantum.signoff/1, schemas/signoff.v1.json): a job about that job, sealing its digest, the intent and the verdict together. Verifying. job::answer_of routes a job that seals a verdict to job::rerun, and job::verdict and verdict_of_text work it out again too (verdict::recheck, within the state vector of 22 qubits): `answer` gives the level, holds, the layer and its limits, the accuracy class, and `again`: reproduced, partly, host_statement or differs. A verdict that is not of its own form, names another method or class than the result, another job than a sign-off holds, or a check decided here otherwise, differs, and the job is not valid though its seal holds. A sampled check's samples and a proof another engine version reached are the host's statement, not a difference. A verdict sealed before layers were named is held to its level and its checks. A job that asks for no verdict gives the bytes it gave. Conformance. quantum-conformance/verdicts/: 21 sealed jobs and what a verifier must say of each, written by hand from §8.9: verdicts that hold, one that fails, ones no layer decided, ones past what a verifier works out again, five a host sealed that its job does not bear out, one changed after its seal, a provider's, a qudit job's, and sign-offs of a wasmQ job and an energy-landscape job. tests/verdict_conformance.rs holds the kept jobs to the manifest (natively and under wasm32-wasip2) and makes each again with this engine. quantum-conformance/intents/ gains twelve cases, and its harness holds each verdict to its layer, every kind of intent and every layer a circuit job's verdict can stand on. wai-quantum-verdict.yml runs the new set and requires the new tests by name. What moves with it: the answer set's stored seal is over a verdict, so it is written again (WAI_ANSWER_BUNDLE_WRITE=1); wai-web's pinned course check holds each case's verdict, so its digest moves, and the page gains QuantumEngine.signoff and a wasm test (wai-web-wasm.yml counts 24); schema::FILES gains signoff.v1.json (acknowledged in the changes entry); the qudit referee reads `intent` as a member of a request. Co-Authored-By: Claude Fable 5.2 <[email protected]>
2.8 KiB
Intent conformance
Programs, what each must do (its intents), and the verdict the engine must
give when the program runs as a job with them (wai_quantum::engine::verdict,
the verdict page).
| Path | What |
|---|---|
programs/ |
The programs and the references their intents name: a Bell pair, GHZ states built two ways, a Grover search written with cz and with cx, rotations that merge, twelve-qubit circuits that only checked rewrites or random inputs decide, a forty-qubit Clifford pair, a program that acts on what it measured, and programs that do not read until they are repaired. |
repaired/ |
The program a repaired case must run, as the repair writes it. |
manifest.json |
Each case: its program, its run (the job's other fields), its intents, and what its verdict must say (the manifest's expect says what each field means). |
bundle.json |
The manifest's cases with every program and reference inline, for builds that read no files. |
A case's verdict is held to its level (refused, parsed, executed,
evidence, proof), to whether its intents hold, to the layer that decided
it, and to each intent's outcome, strength, check and layer. Every kind of
intent has a case, and so has every layer a circuit job's verdict can stand
on, unchecked among them: an intent no layer could decide is unchecked,
never guessed. A distribution's total variation distance is
held within 1e-12 of a value known by hand: 0 for an exact match, 1/2 for a
Bell pair against one outcome, and 2 · 0.02 · 0.98 = 0.0392 for a Bell pair
whose bits each flip with probability 0.02. A sampled case holds the run's samples to a
stated distribution by a stated test at a stated level, at a fixed seed: it is
evidence, never proof, and its outcome is held to the manifest's. A refused
case is held to the last code its refusal gives. Every level of the ladder has
a case.
Native
cd wai/wai-quantum
cargo test --release --features full --test intent_conformance
Two tests: every case against its verdict, and the bundle held equal to the files. After changing a program or the manifest, write the bundle:
WAI_INTENT_BUNDLE_WRITE=1 cargo test --release --features full --test intent_conformance the_bundle_is_the_corpus
WASI (the edge)
CARGO_TARGET_WASM32_WASIP2_RUNNER='wasmtime run -W nan-canonicalization=y -W relaxed-simd-deterministic=y' \
cargo test --target wasm32-wasip2 --features full --test intent_conformance
The cases come from the bundle compiled into the test.
Browser
wai-web's wasm32 tests (--features quantum_engine, under
wasm-bindgen-test-runner) run every case of the bundle through the page's
engine (QuantumEngine.run), and work each verdict out again with
engine_verdict.
CI: wai-quantum-verdict.yml (native and wasm32-wasip2) and
wai-web-wasm.yml (the browser build).