{ "format": "wai.quantum-answer-conformance-bundle/1", "about": "manifest.json's cases with every answer inline, for builds that read no files (the browser, the edge); a test holds it equal to the files", "cases": [ { "name": "bell", "file": "cases/bell.wqa", "covers": [ "a well-formed answer: a program, a sample, a verdict and a seal" ], "expect": { "errors": [], "warnings": [], "root": "root", "order": [ "bell", "counts", "check", "seal" ], "run": { "counts": { "total": 1000, "outcomes": [ "00", "11" ] }, "check": { "level": "proof", "holds": true }, "seal": { "sealed": [ "bell", "counts", "check" ] } } }, "answer": "root = Answer([bell, counts, check, seal])\n```qasm bell\nOPENQASM 3.0;\nqubit[2] q;\nbit[2] c;\nh q[0];\ncx q[0], q[1];\nc = measure q;\n```\ncounts = Histogram(@Sample(bell, 1000))\ncheck = Verdict(@Check(bell, {\"00\": 0.5, \"11\": 0.5}))\nseal = Receipt(@Seal([bell, counts, check]))\n" }, { "name": "bell-crlf", "file": "cases/bell-crlf.wqa", "covers": [ "CRLF line ends read as LF: the same answer and the same digest" ], "expect": { "errors": [], "warnings": [], "root": "root", "order": [ "bell", "counts", "check", "seal" ], "same_as": "bell" }, "answer": "root = Answer([bell, counts, check, seal])\r\n```qasm bell\r\nOPENQASM 3.0;\r\nqubit[2] q;\r\nbit[2] c;\r\nh q[0];\r\ncx q[0], q[1];\r\nc = measure q;\r\n```\r\ncounts = Histogram(@Sample(bell, 1000))\r\ncheck = Verdict(@Check(bell, {\"00\": 0.5, \"11\": 0.5}))\r\nseal = Receipt(@Seal([bell, counts, check]))\r\n" }, { "name": "ghz-prepares", "file": "cases/ghz-prepares.wqa", "covers": [ "an intent named by a reference program whose state it must prepare" ], "expect": { "errors": [], "warnings": [], "root": "root", "order": [ "ghz", "check" ], "run": { "check": { "level": "proof", "holds": true } } }, "answer": "root = Answer([ghz, check])\n```qasm ghz\nOPENQASM 3.0;\ninclude \"stdgates.inc\";\nqubit[4] q;\nbit[4] c;\nh q[0];\ncx q[0], q[1];\ncx q[0], q[2];\ncx q[1], q[3];\nc = measure q;\n```\n```qasm chain\nOPENQASM 3.0;\ninclude \"stdgates.inc\";\nqubit[4] q;\nbit[4] c;\nh q[0];\ncx q[0], q[1];\ncx q[1], q[2];\ncx q[2], q[3];\nc = measure q;\n```\ncheck = Verdict(@Check(ghz, {\"prepares\": chain}))\n" }, { "name": "grover-equivalent", "file": "cases/grover-equivalent.wqa", "covers": [ "the equivalence ladder, and a distribution of one outcome" ], "expect": { "errors": [], "warnings": [], "root": "root", "order": [ "same", "check" ], "run": { "same": { "verdict": "equivalent" }, "check": { "level": "proof", "holds": true } } }, "answer": "root = Answer([same, check])\n```qasm grover\nOPENQASM 3.0;\ninclude \"stdgates.inc\";\nqubit[2] q;\nbit[2] c;\nh q;\ncz q[0], q[1];\nh q;\nx q;\ncz q[0], q[1];\nx q;\nh q;\nc = measure q;\n```\n```qasm grover_cx\nOPENQASM 3.0;\ninclude \"stdgates.inc\";\nqubit[2] q;\nbit[2] c;\nh q;\nh q[1];\ncx q[0], q[1];\nh q[1];\nh q;\nx q;\nh q[1];\ncx q[0], q[1];\nh q[1];\nx q;\nh q;\nc = measure q;\n```\nsame = Equivalence(@Equivalent(grover, grover_cx))\ncheck = Verdict(@Check(grover, {\"11\": 1.0}))\n" }, { "name": "wrong-distribution", "file": "cases/wrong-distribution.wqa", "covers": [ "an intent that fails, decided by proof" ], "expect": { "errors": [], "warnings": [], "root": "root", "order": [ "check" ], "run": { "check": { "level": "proof", "holds": false } } }, "answer": "root = Answer([check])\n```qasm bell\nOPENQASM 3.0;\nqubit[2] q;\nbit[2] c;\nh q[0];\ncx q[0], q[1];\nc = measure q;\n```\ncheck = Verdict(@Check(bell, {\"00\": 1.0}))\n" }, { "name": "state-views", "file": "cases/state-views.wqa", "covers": [ "a circuit, expectation values, amplitudes and a Bloch vector, each the engine's" ], "expect": { "errors": [], "warnings": [], "root": "root", "order": [ "circ", "z", "amps", "plus" ], "run": { "z": { "expectations": [ 1.0, 1.0 ] }, "plus": { "bloch_x": 1.0 } } }, "answer": "root = Answer([circ, z, amps, plus])\n```qasm p\nOPENQASM 3.0;\nqubit[2] q;\nh q[0];\ncx q[0], q[1];\n```\n```qasm one\nOPENQASM 3.0;\nqubit[1] q;\nh q[0];\n```\ncirc = Circuit(p)\nz = Expectation(@Expect(p, [\"Z0 Z1\", \"X0 X1\"]))\namps = Amplitudes(@Amplitudes(p, [\"00\", \"11\"]))\nplus = Bloch(@State(one, 0))\n" }, { "name": "calls-named-apart", "file": "cases/calls-named-apart.wqa", "covers": [ "an engine call as a statement of its own, named by the view; a forward reference; a value no view uses" ], "expect": { "errors": [], "warnings": [ "J112" ], "root": "root", "order": [ "counts", "check" ], "run": { "counts": { "total": 200, "outcomes": [ "00", "11" ] } } }, "answer": "root = Answer([counts, check])\ns = @Sample(bell, 200, 7)\ncounts = Histogram(s)\n```qasm bell\nOPENQASM 3.0;\nqubit[2] q;\nbit[2] c;\nh q[0];\ncx q[0], q[1];\nc = measure q;\n```\nwant = {\"00\": 0.5, \"11\": 0.5}\ncheck = Verdict(@Check(bell, {\"00\": 0.5, \"11\": 0.5}, 1e-9))\n" }, { "name": "no-root", "file": "cases/no-root.wqa", "covers": [ "no root: the views in the order written" ], "expect": { "errors": [], "warnings": [ "J107" ], "root": null, "order": [ "circ", "counts" ] }, "answer": "```qasm bell\nOPENQASM 3.0;\nqubit[2] q;\nbit[2] c;\nh q[0];\ncx q[0], q[1];\nc = measure q;\n```\ncirc = Circuit(bell)\ncounts = Histogram(@Sample(bell, 100))\n" }, { "name": "number-in-a-view", "file": "cases/number-in-a-view.wqa", "covers": [ "a number where a view takes the engine's call" ], "expect": { "errors": [ "J106", "J104" ], "warnings": [ "J112" ], "root": "root", "order": [] }, "answer": "root = Answer([counts])\n```qasm bell\nOPENQASM 3.0;\nqubit[2] q;\nbit[2] c;\nh q[0];\ncx q[0], q[1];\nc = measure q;\n```\ncounts = Histogram(1000)\n" }, { "name": "unknown-view-and-call", "file": "cases/unknown-view-and-call.wqa", "covers": [ "a view and engine calls the layer does not have; the root listing an engine call, which it does not take, leaves it out" ], "expect": { "errors": [ "J104", "J106", "J101", "J102", "J102" ], "warnings": [ "J112" ], "root": "root", "order": [] }, "answer": "root = Answer([a, b, c])\n```qasm bell\nOPENQASM 3.0;\nqubit[2] q;\nbit[2] c;\nh q[0];\ncx q[0], q[1];\nc = measure q;\n```\na = Barchart(@Sample(bell, 10))\nb = Histogram(@Run(bell, 10))\nc = @Simulate(bell)\n" }, { "name": "missing-and-extra-arguments", "file": "cases/missing-and-extra-arguments.wqa", "covers": [ "an argument missing, and one too many" ], "expect": { "errors": [ "J106", "J103" ], "warnings": [ "J105" ], "root": "root", "order": [ "b" ] }, "answer": "root = Answer([a, b])\n```qasm bell\nOPENQASM 3.0;\nqubit[2] q;\nbit[2] c;\nh q[0];\ncx q[0], q[1];\nc = measure q;\n```\na = Histogram(@Sample(bell))\nb = Circuit(bell, bell)\n" }, { "name": "a-program-that-does-not-read", "file": "cases/a-program-that-does-not-read.wqa", "covers": [ "the reader's refusal keeps its code; what names the program falls with it; a name nothing declares" ], "expect": { "errors": [ "J106", "Q103", "J106", "J106" ], "warnings": [], "root": "root", "order": [] }, "answer": "root = Answer([counts, circ])\n```qasm bad\nOPENQASM 3.0;\nqubit[1] q;\nfoo q[0];\n```\ncounts = Histogram(@Sample(bad, 10))\ncirc = Circuit(nowhere)\n" }, { "name": "truncated-program", "file": "cases/truncated-program.wqa", "covers": [ "the text ends inside a program" ], "expect": { "errors": [ "J106", "J106", "J108" ], "warnings": [], "root": "root", "order": [] }, "answer": "root = Answer([bell, counts])\ncounts = Histogram(@Sample(bell, 10))\n```qasm bell\nOPENQASM 3.0;\nqubit[2] q;\nh q[0];\n" }, { "name": "truncated-statement", "file": "cases/truncated-statement.wqa", "covers": [ "the text ends inside a statement" ], "expect": { "errors": [ "J106", "J108" ], "warnings": [], "root": "root", "order": [ "bell" ] }, "answer": "root = Answer([bell, counts])\n```qasm bell\nOPENQASM 3.0;\nqubit[2] q;\nbit[2] c;\nh q[0];\ncx q[0], q[1];\nc = measure q;\n```\ncounts = Histogram(@Sample(bell, 10" }, { "name": "cycle", "file": "cases/cycle.wqa", "covers": [ "statements that name each other" ], "expect": { "errors": [ "J106", "J109", "J109" ], "warnings": [ "J112" ], "root": "root", "order": [] }, "answer": "root = Answer([a])\n```qasm bell\nOPENQASM 3.0;\nqubit[2] q;\nbit[2] c;\nh q[0];\ncx q[0], q[1];\nc = measure q;\n```\na = Receipt(@Seal([b]))\nb = @Seal([a])\n" }, { "name": "edit-by-redeclaring", "file": "cases/edit-by-redeclaring.wqa", "covers": [ "a later declaration stands: an edit" ], "expect": { "errors": [], "warnings": [ "J110" ], "root": "root", "order": [ "counts" ], "run": { "counts": { "total": 500, "outcomes": [ "00", "11" ] } } }, "answer": "root = Answer([counts])\n```qasm bell\nOPENQASM 3.0;\nqubit[2] q;\nbit[2] c;\nh q[0];\ncx q[0], q[1];\nc = measure q;\n```\ncounts = Histogram(@Sample(bell, 10))\ncounts = Histogram(@Sample(bell, 500))\n" }, { "name": "prose-and-unused", "file": "cases/prose-and-unused.wqa", "covers": [ "a number in prose, and a view the root does not reach" ], "expect": { "errors": [], "warnings": [ "J111", "J112" ], "root": "root", "order": [ "note", "circ" ] }, "answer": "root = Answer([note, circ])\n```qasm bell\nOPENQASM 3.0;\nqubit[2] q;\nbit[2] c;\nh q[0];\ncx q[0], q[1];\nc = measure q;\n```\nnote = Text(\"about 50% read 00, the rest 11\")\ncirc = Circuit(bell)\nextra = Plan(@Plan(bell))\n" }, { "name": "lines-that-are-not-statements", "file": "cases/lines-that-are-not-statements.wqa", "covers": [ "prose, a fence that opens no program, and a marker this layer does not read" ], "expect": { "errors": [ "J100", "J100", "J100" ], "warnings": [], "root": "root", "order": [ "circ" ] }, "answer": "root = Answer([circ])\n```qasm bell\nOPENQASM 3.0;\nqubit[2] q;\nbit[2] c;\nh q[0];\ncx q[0], q[1];\nc = measure q;\n```\ncirc = Circuit(bell)\nThe program above makes a Bell pair.\n```python\n]]>wai:summary {}\n" }, { "name": "bell-stored", "file": "cases/bell-stored.wqa", "covers": [ "a stored answer with its receipt marker: run again, the receipt verifies" ], "expect": { "errors": [], "warnings": [], "root": "root", "order": [ "bell", "counts", "check", "seal" ], "stored": { "valid": true } }, "answer": "root = Answer([bell, counts, check, seal])\n```qasm bell\nOPENQASM 3.0;\nqubit[2] q;\nbit[2] c;\nh q[0];\ncx q[0], q[1];\nc = measure q;\n```\ncounts = Histogram(@Sample(bell, 1000))\ncheck = Verdict(@Check(bell, {\"00\": 0.5, \"11\": 0.5}))\nseal = Receipt(@Seal([bell, counts, check]))\n]]>wai:receipt {\"statement\":\"seal\",\"receipt\":{\"alg\":\"ed25519\",\"canon\":\"rfc8785\",\"key\":\"ed4928c628d1c2c6eae90338905995612959273a5c63f93636c14614ac8737d1\",\"digest\":\"740b4568e82f915953179d2396c920d382f1e6c366d42f55fe8cd4b98f5ab217\",\"signature\":\"06734b0397057bfc5938116d3b88b22029aebe24a91f8fc067098154e874e46c625f887c782c274ab4e5248e54211de802c8e538acf048af4ae7eca7d560e602\"}}\n" }, { "name": "bell-stored-changed", "file": "cases/bell-stored-changed.wqa", "covers": [ "the stored answer with a statement changed: the receipt does not verify" ], "expect": { "errors": [], "warnings": [], "root": "root", "order": [ "bell", "counts", "check", "seal" ], "stored": { "valid": false } }, "answer": "root = Answer([bell, counts, check, seal])\n```qasm bell\nOPENQASM 3.0;\nqubit[2] q;\nbit[2] c;\nh q[0];\ncx q[0], q[1];\nc = measure q;\n```\ncounts = Histogram(@Sample(bell, 999))\ncheck = Verdict(@Check(bell, {\"00\": 0.5, \"11\": 0.5}))\nseal = Receipt(@Seal([bell, counts, check]))\n]]>wai:receipt {\"statement\":\"seal\",\"receipt\":{\"alg\":\"ed25519\",\"canon\":\"rfc8785\",\"key\":\"ed4928c628d1c2c6eae90338905995612959273a5c63f93636c14614ac8737d1\",\"digest\":\"740b4568e82f915953179d2396c920d382f1e6c366d42f55fe8cd4b98f5ab217\",\"signature\":\"06734b0397057bfc5938116d3b88b22029aebe24a91f8fc067098154e874e46c625f887c782c274ab4e5248e54211de802c8e538acf048af4ae7eca7d560e602\"}}\n" } ] }