{ "format": "wai.quantum-intent-conformance/1", "about": "Programs, what each must do (its intents), and the verdict the engine must give: the level, whether the intents hold, each intent's outcome, strength, check and distance. A sampled intent holds the run's samples to a stated distribution by a stated test: evidence, never proof. The distances are known by hand: 0 for an exact match, 1/2 for a Bell pair against one outcome, 2·0.02·0.98 = 0.0392 for a Bell pair whose bits each flip with 0.02. An intent of the answer (outcomes, conserves, counts, agrees) is held to the counts the job returned, or, where the run is the program's own and the engine can compute its distribution, to that. Every verdict names the layer that decided it.", "expect": { "level": "the verdict's level: refused, parsed, executed, evidence or proof", "holds": "whether the intents held: true, false, or null when one was not decided", "intents": "each intent's outcome (holds, fails, unchecked), strength (proof, evidence, none), check (how: for a sampled intent, its test) and, for a distribution, its total variation distance within 1e-12", "code": "for a job refused: the last code its refusal gives", "method": "the method the run took", "repairs": "the codes of the repairs made before the run, in order", "repaired": "the program the run took, in repaired/NAME.qasm", "layer": "the layer that decided the verdict: the weakest of its checks' layers (each check's own under its `layer`), and unchecked when an intent was not decided or none was given" }, "cases": [ { "name": "bell-distribution", "covers": [ "an exact distribution, by the state vector" ], "program": "programs/bell.qasm", "run": { "shots": 100 }, "intent": [ { "distribution": { "00": 0.5, "11": 0.5 } } ], "expect": { "level": "proof", "holds": true, "intents": [ { "outcome": "holds", "strength": "proof", "how": "statevector", "distance": 0.0 } ], "layer": "exact_simulation" } }, { "name": "bell-wrong-distribution", "covers": [ "a distribution that fails, with its distance" ], "program": "programs/bell.qasm", "run": { "shots": 100 }, "intent": [ { "distribution": { "00": 1.0 } } ], "expect": { "level": "proof", "holds": false, "intents": [ { "outcome": "fails", "strength": "proof", "how": "statevector", "distance": 0.5 } ] } }, { "name": "bell-under-readout-noise", "covers": [ "a distribution under noise, by the density matrix, within a tolerance" ], "program": "programs/bell.qasm", "run": { "shots": 100, "noise": { "readout": 0.02 } }, "intent": [ { "distribution": { "00": 0.5, "11": 0.5 }, "tolerance": 0.05 } ], "expect": { "level": "proof", "holds": true, "intents": [ { "outcome": "holds", "strength": "proof", "how": "density_matrix", "distance": 0.0392 } ] } }, { "name": "bell-under-readout-noise-tight", "covers": [ "the same distance past a tighter tolerance" ], "program": "programs/bell.qasm", "run": { "shots": 100, "noise": { "readout": 0.02 } }, "intent": [ { "distribution": { "00": 0.5, "11": 0.5 }, "tolerance": 0.01 } ], "expect": { "level": "proof", "holds": false, "intents": [ { "outcome": "fails", "strength": "proof", "how": "density_matrix", "distance": 0.0392 } ] } }, { "name": "ghz-prepares-the-chain-s-state", "covers": [ "the same state from |0…0⟩ as a reference" ], "program": "programs/ghz.qasm", "run": { "shots": 100 }, "intent": [ { "prepares": { "file": "programs/ghz-chain.qasm" } } ], "expect": { "level": "proof", "holds": true, "intents": [ { "outcome": "holds", "strength": "proof", "how": "state" } ] } }, { "name": "ghz-is-not-the-chain-s-circuit", "covers": [ "the same state but not the same circuit: decided by tableau" ], "program": "programs/ghz.qasm", "run": { "shots": 100 }, "intent": [ { "equivalent": { "file": "programs/ghz-chain.qasm" } } ], "expect": { "level": "proof", "holds": false, "intents": [ { "outcome": "fails", "strength": "proof", "how": "tableau" } ], "layer": "stabilizer" } }, { "name": "grover-two-intents", "covers": [ "two intents, both by proof" ], "program": "programs/grover.qasm", "run": { "shots": 100 }, "intent": [ { "equivalent": { "file": "programs/grover-cx.qasm" } }, { "distribution": { "11": 1.0 } } ], "expect": { "level": "proof", "holds": true, "intents": [ { "outcome": "holds", "strength": "proof", "how": "tableau" }, { "outcome": "holds", "strength": "proof", "how": "statevector", "distance": 0.0 } ] } }, { "name": "rotations-merge", "covers": [ "off the Clifford angles, on every basis state" ], "program": "programs/rz-pair.qasm", "run": { "observables": [ "Z0 Z1" ] }, "intent": [ { "equivalent": { "file": "programs/rz-merged.qasm" } } ], "expect": { "level": "proof", "holds": true, "intents": [ { "outcome": "holds", "strength": "proof", "how": "exact" } ] } }, { "name": "rotations-that-differ", "covers": [ "a small difference in an angle, found on every basis state" ], "program": "programs/rz-pair.qasm", "run": { "observables": [ "Z0 Z1" ] }, "intent": [ { "equivalent": { "file": "programs/rz-near.qasm" } } ], "expect": { "level": "proof", "holds": false, "intents": [ { "outcome": "fails", "strength": "proof", "how": "exact" } ] } }, { "name": "a-relative-phase", "covers": [ "a relative phase is a difference" ], "program": "programs/relative-phase.qasm", "run": { "amplitudes": [ "0", "1" ] }, "intent": [ { "equivalent": { "file": "programs/plus.qasm" } } ], "expect": { "level": "proof", "holds": false, "intents": [ { "outcome": "fails", "strength": "proof", "how": "exact" } ] } }, { "name": "wide-by-rewrites", "covers": [ "wider than every basis state, proved by checked rewrites" ], "program": "programs/wide-merge.qasm", "run": { "observables": [ "Z3" ] }, "intent": [ { "equivalent": { "file": "programs/wide-merged.qasm" } } ], "expect": { "level": "proof", "holds": true, "intents": [ { "outcome": "holds", "strength": "proof", "how": "rewrites" } ], "layer": "pass_equivalence" } }, { "name": "wide-by-random-inputs", "covers": [ "evidence, not proof: random product states" ], "program": "programs/wide-swap.qasm", "run": { "observables": [ "Z3" ] }, "intent": [ { "equivalent": { "file": "programs/wide-swap-cx.qasm" } } ], "expect": { "level": "evidence", "holds": true, "intents": [ { "outcome": "holds", "strength": "evidence", "how": "random" } ], "layer": "random_states" } }, { "name": "wide-proof-required", "covers": [ "evidence counted as unchecked when proof is required" ], "program": "programs/wide-swap.qasm", "run": { "observables": [ "Z3" ] }, "intent": [ { "equivalent": { "file": "programs/wide-swap-cx.qasm" }, "require": "proof" } ], "expect": { "level": "executed", "holds": null, "intents": [ { "outcome": "unchecked", "strength": "none", "how": "random" } ], "layer": "unchecked" } }, { "name": "evidence-and-proof", "covers": [ "the level is the weakest check" ], "program": "programs/wide-swap.qasm", "run": { "observables": [ "Z3" ] }, "intent": [ { "equivalent": { "file": "programs/wide-swap-cx.qasm" } }, { "equivalent": { "file": "programs/wide-swap.qasm" } } ], "expect": { "level": "evidence", "holds": true, "intents": [ { "outcome": "holds", "strength": "evidence", "how": "random" }, { "outcome": "holds", "strength": "proof" } ] } }, { "name": "clifford-at-forty-qubits", "covers": [ "Clifford circuits at any width, by tableau" ], "program": "programs/clifford40.qasm", "run": { "shots": 10 }, "intent": [ { "equivalent": { "file": "programs/clifford40-reordered.qasm" } } ], "expect": { "level": "proof", "holds": true, "intents": [ { "outcome": "holds", "strength": "proof", "how": "tableau" } ] } }, { "name": "feedback-is-unchecked", "covers": [ "a program that acts on what it measured: its distribution unchecked" ], "program": "programs/feedback.qasm", "run": { "shots": 100 }, "intent": [ { "distribution": { "00": 0.5, "11": 0.5 } } ], "expect": { "level": "executed", "holds": null, "intents": [ { "outcome": "unchecked", "strength": "none", "how": "none" } ], "layer": "unchecked" } }, { "name": "bell-sampled", "covers": [ "samples held to a distribution by Pearson's chi-squared test: evidence, never proof" ], "program": "programs/bell.qasm", "run": { "shots": 100, "seed": 7 }, "intent": [ { "sampled": { "00": 0.5, "11": 0.5 }, "test": "chi_squared", "alpha": 0.01, "shots": 4000 } ], "expect": { "level": "evidence", "holds": true, "intents": [ { "outcome": "holds", "strength": "evidence", "how": "chi_squared" } ], "layer": "samples" } }, { "name": "bell-sampled-biased", "covers": [ "a biased claim rejected by the G-test" ], "program": "programs/bell.qasm", "run": { "shots": 100, "seed": 7 }, "intent": [ { "sampled": { "00": 0.6, "11": 0.4 }, "test": "g_test", "alpha": 0.01, "shots": 4000 } ], "expect": { "level": "evidence", "holds": false, "intents": [ { "outcome": "fails", "strength": "evidence", "how": "g_test" } ] } }, { "name": "bell-sampled-ruled-out", "covers": [ "an outcome the claim gives probability 0, sampled: fails outright" ], "program": "programs/bell.qasm", "run": { "shots": 100 }, "intent": [ { "sampled": { "00": 1.0 }, "test": "chi_squared", "alpha": 0.05, "shots": 100 } ], "expect": { "level": "evidence", "holds": false, "intents": [ { "outcome": "fails", "strength": "evidence", "how": "chi_squared" } ] } }, { "name": "bell-sampled-proof-required", "covers": [ "a statistical test counted as unchecked when proof is required" ], "program": "programs/bell.qasm", "run": { "shots": 100 }, "intent": [ { "sampled": { "00": 0.5, "11": 0.5 }, "test": "chi_squared", "alpha": 0.01, "shots": 1000, "require": "proof" } ], "expect": { "level": "executed", "holds": null, "intents": [ { "outcome": "unchecked", "strength": "none", "how": "chi_squared" } ] } }, { "name": "bell-sampled-under-readout-noise", "covers": [ "samples under the job's noise, held to its exact noisy distribution" ], "program": "programs/bell.qasm", "run": { "shots": 100, "seed": 3, "noise": { "readout": 0.02 } }, "intent": [ { "sampled": { "00": 0.4804, "01": 0.0196, "10": 0.0196, "11": 0.4804 }, "test": "chi_squared", "alpha": 0.001, "shots": 20000 } ], "expect": { "level": "evidence", "holds": true, "intents": [ { "outcome": "holds", "strength": "evidence", "how": "chi_squared" } ] } }, { "name": "proof-and-a-test", "covers": [ "the level is the weakest check: an exact distribution and a test of samples" ], "program": "programs/bell.qasm", "run": { "shots": 100, "seed": 7 }, "intent": [ { "distribution": { "00": 0.5, "11": 0.5 } }, { "sampled": { "00": 0.5, "11": 0.5 }, "test": "g_test", "alpha": 0.01, "shots": 2000 } ], "expect": { "level": "evidence", "holds": true, "intents": [ { "outcome": "holds", "strength": "proof", "how": "statevector", "distance": 0.0 }, { "outcome": "holds", "strength": "evidence", "how": "g_test" } ] } }, { "name": "no-intent", "covers": [ "a verdict asked for with no intent" ], "program": "programs/bell.qasm", "run": { "shots": 100, "verdict": true }, "expect": { "level": "executed", "holds": null, "intents": [], "method": "stabilizer", "layer": "unchecked" } }, { "name": "compiled-first", "covers": [ "a run compiled to Clifford+T, its intent checked on the program" ], "program": "programs/rotation.qasm", "run": { "shots": 100, "compile": { "epsilon": 0.001 } }, "intent": [ { "distribution": { "0": 0.75, "1": 0.25 } } ], "expect": { "level": "proof", "holds": true, "method": "exact", "intents": [ { "outcome": "holds", "strength": "proof", "how": "statevector", "distance": 0.0 } ] } }, { "name": "repaired-first", "covers": [ "a missing `;` and a measurement with no target, repaired before the run" ], "program": "programs/bell-broken.qasm", "run": { "shots": 100, "repair": true }, "intent": [ { "distribution": { "00": 0.5, "11": 0.5 } } ], "expect": { "level": "proof", "holds": true, "repairs": [ "Q004", "Q320" ], "repaired": "bell-repaired", "intents": [ { "outcome": "holds", "strength": "proof", "how": "statevector", "distance": 0.0 } ] } }, { "name": "a-bound-chosen", "covers": [ "an unbounded while, given the bound the person chose" ], "program": "programs/unbounded.qasm", "run": { "shots": 100, "repair": { "max_iterations": 4 }, "verdict": true }, "expect": { "level": "executed", "holds": null, "repairs": [ "Q310" ], "intents": [] } }, { "name": "bell-expectation", "covers": [ "an observable's exact value, by the state vector: a Bell pair's Z0 Z1 is 1 and its Z0 is 0" ], "program": "programs/bell.qasm", "run": { "shots": 100 }, "intent": [ { "expectation": { "observable": "Z0 Z1", "value": 1.0 } }, { "expectation": { "observable": "Z0", "value": 0.0 } } ], "expect": { "level": "proof", "holds": true, "layer": "exact_simulation", "intents": [ { "outcome": "holds", "strength": "proof", "how": "statevector", "layer": "exact_simulation", "distance": 0.0 }, { "outcome": "holds", "strength": "proof", "how": "statevector", "layer": "exact_simulation", "distance": 0.0 } ] } }, { "name": "bell-wrong-expectation", "covers": [ "an expectation value that fails, by proof, with its distance: 1 against 0.5" ], "program": "programs/bell.qasm", "run": { "shots": 100 }, "intent": [ { "expectation": { "observable": "Z0 Z1", "value": 0.5 }, "tolerance": 0.25 } ], "expect": { "level": "proof", "holds": false, "layer": "exact_simulation", "intents": [ { "outcome": "fails", "strength": "proof", "how": "statevector", "layer": "exact_simulation", "distance": 0.5 } ] } }, { "name": "bell-outcomes-and-parity", "covers": [ "a set of outcomes and a conserved quantity, by the program's exact distribution where the run is the program's own" ], "program": "programs/bell.qasm", "run": { "shots": 100 }, "intent": [ { "outcomes": [ "00", "11" ] }, { "conserves": { "parity": 0 } } ], "expect": { "level": "proof", "holds": true, "layer": "exact_simulation", "intents": [ { "outcome": "holds", "strength": "proof", "how": "statevector", "layer": "exact_simulation" }, { "outcome": "holds", "strength": "proof", "how": "statevector", "layer": "exact_simulation" } ] } }, { "name": "bell-does-not-conserve-weight-one", "covers": [ "a conserved quantity the program does not keep: fails by proof" ], "program": "programs/bell.qasm", "run": { "shots": 100 }, "intent": [ { "conserves": { "weight": 1 } } ], "expect": { "level": "proof", "holds": false, "layer": "exact_simulation", "intents": [ { "outcome": "fails", "strength": "proof", "how": "statevector", "layer": "exact_simulation" } ] } }, { "name": "bell-counts-within-a-distance", "covers": [ "the job's own counts held to a stated distribution within a total variation distance: evidence" ], "program": "programs/bell.qasm", "run": { "shots": 1000, "seed": 7 }, "intent": [ { "counts": { "00": 0.5, "11": 0.5 }, "tolerance": 0.1 } ], "expect": { "level": "evidence", "holds": true, "layer": "samples", "intents": [ { "outcome": "holds", "strength": "evidence", "how": "total_variation", "layer": "samples" } ] } }, { "name": "bell-counts-ruled-out", "covers": [ "the job's own counts hold an outcome the stated distribution gives probability 0: fails" ], "program": "programs/bell.qasm", "run": { "shots": 1000, "seed": 7 }, "intent": [ { "counts": { "00": 1.0 }, "test": "g_test", "alpha": 0.01 } ], "expect": { "level": "evidence", "holds": false, "layer": "samples", "intents": [ { "outcome": "fails", "strength": "evidence", "how": "g_test", "layer": "samples" } ] } }, { "name": "bell-agrees-with-simulation", "covers": [ "the job's own counts held to the exact distribution the engine computes of the program: agreement, evidence", "the verdict's layer is the weakest of its checks'" ], "program": "programs/bell.qasm", "run": { "shots": 1000, "seed": 7 }, "intent": [ { "distribution": { "00": 0.5, "11": 0.5 } }, { "agrees": "simulation", "tolerance": 0.1 } ], "expect": { "level": "evidence", "holds": true, "layer": "agreement", "intents": [ { "outcome": "holds", "strength": "proof", "how": "statevector", "layer": "exact_simulation", "distance": 0.0 }, { "outcome": "holds", "strength": "evidence", "how": "total_variation", "layer": "agreement" } ] } }, { "name": "feedback-outcomes-on-the-counts", "covers": [ "a program the engine computes no distribution of (it acts on what it measured): its outcomes held to the counts it returned, physical consistency, evidence" ], "program": "programs/feedback.qasm", "run": { "shots": 200, "seed": 3 }, "intent": [ { "outcomes": [ "00", "11" ] }, { "conserves": { "parity": 0 } } ], "expect": { "level": "evidence", "holds": true, "layer": "physical_consistency", "intents": [ { "outcome": "holds", "strength": "evidence", "how": "counts", "layer": "physical_consistency" }, { "outcome": "holds", "strength": "evidence", "how": "counts", "layer": "physical_consistency" } ] } }, { "name": "feedback-outcomes-proof-required", "covers": [ "samples are evidence: an intent that requires a proof is unchecked, said plainly" ], "program": "programs/feedback.qasm", "run": { "shots": 200, "seed": 3 }, "intent": [ { "outcomes": [ "00", "11" ], "require": "proof" } ], "expect": { "level": "executed", "holds": null, "layer": "unchecked", "intents": [ { "outcome": "unchecked", "strength": "none", "how": "none", "layer": "unchecked" } ] } }, { "name": "feedback-does-not-agree-with-what-is-not-computed", "covers": [ "no layer available: the engine computes no distribution of the program, so agreement with it is unchecked" ], "program": "programs/feedback.qasm", "run": { "shots": 200, "seed": 3 }, "intent": [ { "agrees": "simulation", "tolerance": 0.1 } ], "expect": { "level": "executed", "holds": null, "layer": "unchecked", "intents": [ { "outcome": "unchecked", "strength": "none", "how": "none", "layer": "unchecked" } ] } }, { "name": "clifford-at-forty-qubits-expectation", "covers": [ "no layer available: forty qubits are wider than the engine computes an expectation value, so it is unchecked beside a proof by tableau" ], "program": "programs/clifford40.qasm", "run": { "shots": 10 }, "intent": [ { "expectation": { "observable": "Z0", "value": 0.0 } }, { "equivalent": { "file": "programs/clifford40-reordered.qasm" } } ], "expect": { "level": "executed", "holds": null, "layer": "unchecked", "intents": [ { "outcome": "unchecked", "strength": "none", "how": "none", "layer": "unchecked" }, { "outcome": "holds", "strength": "proof", "how": "tableau", "layer": "stabilizer" } ] } }, { "name": "an-answer-intent-that-does-not-read", "covers": [ "an intent of the answer that says how close two ways" ], "program": "programs/bell.qasm", "run": { "shots": 100 }, "intent": [ { "counts": { "00": 0.5, "11": 0.5 }, "test": "g_test", "alpha": 0.01, "tolerance": 0.1 } ], "expect": { "level": "parsed", "code": "J020" } }, { "name": "a-bound-not-chosen", "covers": [ "an unbounded while with no bound chosen: refused with its code" ], "program": "programs/unbounded.qasm", "run": { "shots": 100, "repair": true }, "intent": [ { "distribution": { "0": 1.0 } } ], "expect": { "level": "refused", "code": "Q310" } }, { "name": "a-program-that-does-not-read", "covers": [ "refused by the reader: nothing runs" ], "program": "programs/unknown-gate.qasm", "run": { "shots": 100 }, "intent": [ { "distribution": { "0": 1.0 } } ], "expect": { "level": "refused", "code": "Q103" } }, { "name": "an-intent-that-does-not-read", "covers": [ "an intent whose outcomes are not the program's bits" ], "program": "programs/bell.qasm", "run": { "shots": 100 }, "intent": [ { "distribution": { "0": 1.0 } } ], "expect": { "level": "parsed", "code": "J020" } } ] }