wai-quantum: synthesis and certified compilation (Clifford+T within epsilon, KAK, phase folding, one sealed certificate per compile) #520

Closed
dcharlot wants to merge 39 commits from wai/quantum-qsynth into main
Owner

The engine synthesises and optimises circuits. Every compile carries a sealed certificate stating how close the output is to the input and how that was established.

Stacked on #519 (on #517, #516, #515 and #514). This PR's own commits are the eleven after #519.

  • Exact arithmetic (engine::synth, no new dependencies):

    • integers of any size; fixed-point reals at 320 fractional bits;
    • the rings Z[√2] and Z[ω], and matrices over D[ω];
    • the exact Matsumoto–Amano normal form (fewest T gates), multiplied back exactly before it is accepted.
  • Single-qubit synthesis: ZYZ Euler angles for any one-qubit unitary, and rotation synthesis of Rz(θ) into Clifford+T within a requested ε (grid problems, then the Diophantine step).

    • The reported distance is recomputed from the emitted word and rounded up.
    • Against every Clifford+T operator with at most 11 T gates, 21 of 24 cases reach the optimal T count and 3 are one above.
    • At ε = 1e-10 the T count is 99–101 (3·log₂(1/ε) ≈ 99.7). The same request gives the same word every time.
  • Two-qubit synthesis: the KAK decomposition into at most three CNOTs, with a deterministic Jacobi eigen-solver. It uses two CNOTs or none when the canonical coordinates allow.

  • Phase folding: phase gates on the same parity merge. The check recomputes the phase polynomial, and counts as a proof when every angle is a multiple of π/4.

  • A pass pipeline (engine::compile):

    • passes: lower, simplify (the checked rewrites), phase_fold, resynth_1q, resynth_2q, approximate;
    • levels 0–2, targets clifford_t and standard;
    • a pass whose check fails is not applied.

    One sealed certificate per compile records each pass's counts, how it was checked and its verdict, the ε budget and its split, and, up to 8 qubits, the whole output's measured distance. verify checks it. A job with "compile" runs the compiled program bit-exact, and its result states the distance.

  • Surfaces:

    • CLI: wai-quantum compile and run --compile ε;
    • stdio MCP: compile_qasm;
    • service: POST /v1/compile (bounded, answering 422 with the local command beyond the bounds) and its MCP compile_qasm;
    • wasm: QuantumEngine.compile, giving the same digest as native;
    • Studio: a compile lens that draws the circuit after any pass and verifies the certificate in the page;
    • desktop: a compile command.
  • Integration with the stack below: jobs are read by the one OpenQASM 3 reader before compiling. A compiled program keeps the outputs and calibrations, but not the timing or lowered-gate positions, which name places in the rewritten ops. The CI test-count pins are 10 (wasm32) and 16 (native).

Tests:

  • On the Linux build host after stacking:
    • wai-quantum lib 887 passed, plus integration 23 + 1 + 2 + 2 + 1 + 3;
    • CLI 1 + 42 + 5 + 2 + 5, with clippy clean both ways and smoke.sh passing with CI's relative path;
    • service 21; qpu 33 + 1 + 8 + 12; wai-web quantum_engine:: 16; edge component 10;
    • Python: 62 tests and 5 of 5 notebooks;
    • every repository check.
  • On the macOS build host: wasm32 engine tests 10 passed; the Studio e2e 152 checks, every check passed; the desktop app 7 passed, clippy clean.
  • From the builder: synthesis and compile tests 28 under wasm32-wasip2, and a level-2 compile byte-identical natively and as a WASI component.

🤖 Generated with Claude Code

The engine synthesises and optimises circuits. Every compile carries a sealed certificate stating how close the output is to the input and how that was established. Stacked on #519 (on #517, #516, #515 and #514). This PR's own commits are the eleven after #519. - **Exact arithmetic** (`engine::synth`, no new dependencies): - integers of any size; fixed-point reals at 320 fractional bits; - the rings Z[√2] and Z[ω], and matrices over D[ω]; - the exact Matsumoto–Amano normal form (fewest T gates), multiplied back exactly before it is accepted. - **Single-qubit synthesis:** ZYZ Euler angles for any one-qubit unitary, and rotation synthesis of Rz(θ) into Clifford+T within a requested ε (grid problems, then the Diophantine step). - The reported distance is recomputed from the emitted word and rounded up. - Against every Clifford+T operator with at most 11 T gates, 21 of 24 cases reach the optimal T count and 3 are one above. - At ε = 1e-10 the T count is 99–101 (3·log₂(1/ε) ≈ 99.7). The same request gives the same word every time. - **Two-qubit synthesis:** the KAK decomposition into at most three CNOTs, with a deterministic Jacobi eigen-solver. It uses two CNOTs or none when the canonical coordinates allow. - **Phase folding:** phase gates on the same parity merge. The check recomputes the phase polynomial, and counts as a proof when every angle is a multiple of π/4. - **A pass pipeline** (`engine::compile`): - passes: lower, simplify (the checked rewrites), phase_fold, resynth_1q, resynth_2q, approximate; - levels 0–2, targets `clifford_t` and `standard`; - a pass whose check fails is not applied. One sealed certificate per compile records each pass's counts, how it was checked and its verdict, the ε budget and its split, and, up to 8 qubits, the whole output's measured distance. `verify` checks it. A job with `"compile"` runs the compiled program bit-exact, and its result states the distance. - **Surfaces:** - CLI: `wai-quantum compile` and `run --compile ε`; - stdio MCP: `compile_qasm`; - service: `POST /v1/compile` (bounded, answering 422 with the local command beyond the bounds) and its MCP `compile_qasm`; - wasm: `QuantumEngine.compile`, giving the same digest as native; - Studio: a compile lens that draws the circuit after any pass and verifies the certificate in the page; - desktop: a `compile` command. - **Integration with the stack below:** jobs are read by the one OpenQASM 3 reader before compiling. A compiled program keeps the outputs and calibrations, but not the timing or lowered-gate positions, which name places in the rewritten ops. The CI test-count pins are 10 (wasm32) and 16 (native). Tests: - On the Linux build host after stacking: - wai-quantum lib 887 passed, plus integration 23 + 1 + 2 + 2 + 1 + 3; - CLI 1 + 42 + 5 + 2 + 5, with clippy clean both ways and `smoke.sh` passing with CI's relative path; - service 21; qpu 33 + 1 + 8 + 12; wai-web `quantum_engine::` 16; edge component 10; - Python: 62 tests and 5 of 5 notebooks; - every repository check. - On the macOS build host: wasm32 engine tests 10 passed; the Studio e2e 152 checks, every check passed; the desktop app 7 passed, clippy clean. - From the builder: synthesis and compile tests 28 under wasm32-wasip2, and a level-2 compile byte-identical natively and as a WASI component. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The language the reader takes, its diagnostics (each refusal with what to
write instead, held to the reader by a test of every entry), the methods
and their accuracy classes, worked examples each with its intent, and the
rules an agent keeps. Both MCP servers serve these as resources and
prompts through engine::guide::handle.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
POST /mcp now serves resources/list, resources/read, prompts/list and
prompts/get from engine::guide: the language, the diagnostics, the
methods at this service's job memory, and the worked examples; and the
three prompts, each naming this server's own tools. initialize carries
the rules. server.json describes the endpoint in the MCP registry's
format (not submitted). A test holds the command line's snapshot of these
tools (wai-quantum-cli/docs/service-mcp.json) to the live list, and the
workflow runs when that snapshot changes. The edits rule now says
history_commit is a tool of the command line's server.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- new DIR --template bell|ghz|grover|noisy-bell: the program, intent.json,
  test.sh, ci/check.sh and an example workflow, mcp.json and AGENTS.md;
  its test passes as made.
- test: every intent checked by the engine (an exact distribution by the
  state vector or, under noise, the density matrix; a reference by the
  equivalence ladder; a state from |0...0>), the run and the check both
  sealed with the user's key, the check binding the run's receipt.
- setup-agent: the block between <!-- wai-quantum:start --> and
  <!-- wai-quantum:end --> in AGENTS.md, from the live tool lists and the
  engine's rules; a rerun replaces only the block; --check for CI.
- mcp config / mcp install --file PATH: the server's entry in the common
  mcpServers form, merged keeping every other entry; a different entry is
  refused without --force.
- The stdio server serves the engine's resources and prompts.
- docs: the resources offline, llms.txt and llms-full.txt (committed in
  docs/, held by a test to both servers' tool lists and this help), and
  the Agent Skill in skills/wai-quantum/. server.json for the registry.
- Tests for every verb, an end-to-end test through the binary, and smoke
  checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum: the front door's changelog entry in wai/CHANGELOG.md
Some checks failed
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 12m32s
wai-quantum HIP member / member · HIP absent (linux-arm64) (pull_request) Successful in 27s
wai-quantum npu-cores member / member · npu-cores absent (linux-arm64) (pull_request) Successful in 24s
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Successful in 22s
WAI examples / WAI examples · android-app · linux-arm64 (pull_request) Successful in 5m21s
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (pull_request) Successful in 3m6s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 26m0s
wai-audit collector and player integration / collector, player integration and the browser end to end · macos (pull_request) Failing after 1m3s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 36s
WAI energy receipts / energy receipts · macos (pull_request) Has been cancelled
WAI examples / WAI examples · the archive, the readiness check, the browser and Apple · macos (pull_request) Has been cancelled
wai-quantum command line / command line · macos (pull_request) Has been cancelled
wai-quantum dataflow member / member · dataflow device absent (macos) (pull_request) Has been cancelled
wai-quantum FPGA member / member · FPGA datapath, simulated (macos) (pull_request) Has been cancelled
wai-quantum Metal member / member · Metal (macos) (pull_request) Has been cancelled
wai-quantum neural-processor member / member · neural processor (macos) (pull_request) Has been cancelled
wai-quantum OpenCL member / member · OpenCL GPU (macos) (pull_request) Has been cancelled
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Has been cancelled
wai-quantum service / service · macos (pull_request) Has been cancelled
wai-quantum matrix-extension member / member · matrix extension absent (macos) (pull_request) Has been cancelled
wai-quantum studio and desktop / desktop app · macos (pull_request) Has been cancelled
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Has been cancelled
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Has been cancelled
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · macos (pull_request) Has been cancelled
standards workspaces build + test / macOS energy backends (pull_request) Has been cancelled
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Has been cancelled
44140418b9
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The drawing the Studio makes from the layout, written once in the engine for
hosts with no page of their own (a notebook, a report, a file): the same
classes and geometry, a style sheet of its own scoped to .wq-circuit that
follows the text colour it is placed in, every number written to two
decimals so the same program writes the same bytes everywhere. Given whose
hand each operation is in, each gate is marked with its author and a key
under the drawing counts them; a condition legend and a note past 400
columns. Five tests: the Bell pair glyph by glyph, every layout item drawn
and the bytes repeatable, the authorship marks and key, escaping and number
writing, and the column cap.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A new crate, wai/wai-quantum-py, built by maturin 1.15.0 into one abi3 wheel
per platform (pyo3 0.29.3, Python 3.9 on), module wai_quantum. Its extension
module wraps the shared job engine and nothing else: run, plan, lint, draw
(text and the engine SVG), layout, critique, improve, shortcuts,
equivalent, verify, seal, canonical, digest, methods, accuracy_classes and
history, values crossing one to one with JSON (NaN, integers past 64 bits
and non-string keys refused). A job is the service form as a plain dict
with helpers (counts, probabilities, expectations, amplitudes, method,
accuracy, receipt); Key reads and writes the command line key files and
finds the same user key; bloch gives each qubit reduced state from the
engine expectation values. A refusal raises EngineError with the engine
message, its line, and a code slot for the engine diagnostic codes.

Service is a client in the standard library alone for the job service
(submit, status, result, cancel, run), naming itself
wai-quantum-python/<version>, its receipts checked here offline.

Widgets (the widgets extra): Circuit (the engine drawing, gates clickable,
authorship marks from a history), Result, Receipt (the engine verdict) and
Bloch (drag to turn), each a plain ES module, each with static HTML (and
SVG) fallbacks that render without the widget library.

Five doc notebooks run in CI and are held to their stored outputs.
ci/check.sh is the whole check; 62 pytest tests hold the package to the
command line (same results, plans, lints, critiques, drawings, methods,
equivalence verdicts; receipts verified both ways; the same user key; the
digest recomputed from Python canonical bytes), to the service run locally,
and run the front ends under node on the payloads; Python 3.9 smoke with
the wheel alone. Workflow wai-quantum-py.yml runs it on linux and macos.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A page that strips <style> from what it shows (a notebook sanitising an
untrusted output) would leave unstyled lines with no stroke and the
background rectangle filled black. Each line and path now carries a stroke
in the text colour, each text and dot a fill, each box, ring and meter an
outline with no fill, the background none and each key swatch its hand
colour; the style sheet still overrides them all. A sixth test checks every
element of a drawing for its attribute. The doc notebooks are written again
with the new drawing, and ci/check.sh expands an empty array the way the
bash macOS ships accepts under set -u.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum-py: release wheels on the command line tag; changelog and README
Some checks failed
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 36s
WAI examples / WAI examples · the archive, the readiness check, the browser and Apple · macos (pull_request) Has been cancelled
wai-quantum command line / command line · macos (pull_request) Has been cancelled
wai-quantum dataflow member / member · dataflow device absent (macos) (pull_request) Has been cancelled
wai-quantum FPGA member / member · FPGA datapath, simulated (macos) (pull_request) Has been cancelled
wai-quantum HIP member / member · HIP absent (linux-arm64) (pull_request) Has been cancelled
wai-quantum Metal member / member · Metal (macos) (pull_request) Has been cancelled
wai-quantum npu-cores member / member · npu-cores absent (linux-arm64) (pull_request) Has been cancelled
wai-quantum neural-processor member / member · neural processor (macos) (pull_request) Has been cancelled
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Has been cancelled
wai-quantum OpenCL member / member · OpenCL GPU (macos) (pull_request) Has been cancelled
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Has been cancelled
wai-quantum for Python / python · macos (pull_request) Has been cancelled
wai-quantum service / service · macos (pull_request) Has been cancelled
wai-quantum matrix-extension member / member · matrix extension absent (macos) (pull_request) Has been cancelled
WAI examples / WAI examples · android-app · linux-arm64 (pull_request) Has been cancelled
wai-quantum studio and desktop / desktop app · macos (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · macos (pull_request) Has been cancelled
WAI conformance / each feature of the independent verifiers' steps compiles alone (pull_request) Has been cancelled
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Has been cancelled
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · browser WebGPU (macos) (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-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Has been cancelled
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Has been cancelled
WAI energy receipts / energy receipts · macos (pull_request) Has been cancelled
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Has been cancelled
2f081db716
wai-quantum-py-release.yml builds the abi3 wheels on a wai-quantum-cli-v*
tag and attaches each with its SHA-256 to that forge release, as the
command line archives are (release/publish.sh, over the private network):
macOS arm64 and x86_64 (cross-built on the Apple-silicon runner), Linux
x86_64 and arm64 as manylinux2014 (maturin with zig 0.16.0, so the
runner glibc does not leak into the wheel; checked: the module needs
GLIBC_2.17 at most), and Windows x86_64. Each wheel that runs on its runner
is installed alone on Python 3.9 and runs tests/smoke.py first. Nothing is
published to a package index.

The changelog entry (wai/CHANGELOG.md), the crate README naming
engine::svg and the package, and ci/check.sh waiting on the service it
stops so the shell prints no job notice.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
engine::provider says what a provider job may ask (counts of a program
whose measurements come at the end and whose angles are dyadic, so it
compiles exactly to a device's gates), turns the device's counts into a
result labelled measured with the circuit's exact distribution beside
them (total variation distance, Hellinger fidelity, and what the shots
alone would leave), and seals it so job::verify checks it.

catalog::read refuses a request that names a provider, so a host that
reaches none (the job service) never runs one on its own methods.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- open_provider: the open provider protocol, wai.quantum.provider/1, over
  HTTP (curl, a credential only over https or to this machine) or a local
  process (one JSON line each way, the credential in its environment);
  a program travels in the device's gates with every angle an exact
  dyadic fraction of a turn, and its OpenQASM 3 beside it.
- reference: the protocol around the exact simulator, served both ways
  (wai-qpu reference --stdio | --http ADDR): the provider the tests run
  against, and the template to copy. Free, or priced per shot or job in
  exact decimals; polls, readout error and a credential checked by hash.
- conformance: the checker and its vectors (conformance/provider-v1.json),
  with the reference's counts pinned; jobs run only when free or allowed.
- registry: the person's list in their configuration directory, holding
  no credential; credentials in the keychain (the system security tool,
  or secret-tool), else a 0600 file, and every listing says which.
- job: the dry run (exact native compile, the check by simulation, the
  provider's estimate and billing unit), the refusal of a run that is not
  free until it is confirmed, and the seal of its counts by the engine.
- Provider gains details, estimate, a seeded submit and cancel, with
  defaults, so the three built-in clients keep working unchanged.

CI: the QPU workflow pins the three test binaries' counts and the new
tests by name, and a macOS leg runs the keychain test in its own
keychain file.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- providers add|list|remove|describe|test|free|reference: the person's
  own providers in their registry, a credential read from standard input
  (never a command line) into the keychain, or named by an environment
  variable; describe and the conformance test; what anyone can use free;
  and the reference provider served by this binary, as a template.
- run --provider NAME [--dry-run] [--yes]: the plan with the exact native
  compile, its check and the provider's estimate; a run that is not free
  refused (exit 3) until --yes; the counts sealed with this user's key,
  checked by verify.
- MCP: providers_list, provider_estimate and run_on_provider; the last
  says it can spend the person's money and refuses without
  confirm_cost: true when the run is not free.
- A `providers` feature (default) carries it, so the WASI build without
  default features stays as it was.

CI: the command line's workflow follows wai-quantum-qpu and pins the five
end-to-end tests by name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Desktop: providers_list, provider_estimate and run_on_provider
  commands; the app reads the credential from the keychain, seals the
  counts with the user's key, and refuses a run that is not free unless
  the page confirms it.
- Studio: a "Your hardware" switch. In the desktop app it lists the
  person's providers, asks for the estimate first and shows a dialog
  before a run that is not free; in a browser tab it says such runs go
  through the desktop app or the command line, since a tab must not hold
  a provider's credential.
- Tests: test/hardware.test.mjs (the switch's logic without a browser),
  a check in the browser test, and a desktop test of the estimate, the
  refusal and the sealed run. The Studio workflow runs the first and
  pins the last, and follows wai-quantum-qpu.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- extensions/quantum-providers.md: wai.quantum.provider/1, its two
  transports, its messages and error codes, the program in a device's
  own gates with exact angles, the six operations, the bit order, the
  cost and confirmation rules, what the receipt proves and what it does
  not, the conformance vectors and the reference provider.
- wai-quantum-qpu/bring-your-own-quantum.md: what is free, adding a
  provider of each kind with its credential in the keychain, running on
  it from the command line, an agent and the desktop, the reference as a
  template, the receipt, and what a person does to connect a real device.
- The READMEs of wai-quantum-qpu, the command line, the engine and the
  job service (which never routes to a provider or takes a credential),
  and the CHANGELOG.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum: agents may use the person's own providers; one tool list for every reader
Some checks failed
wai-quantum studio and desktop / studio · browser (pull_request) Has been cancelled
wai-quantum studio and desktop / desktop app · macos (pull_request) Has been cancelled
wai-quantum tensor-engine member / member · tensor engine, the kernel toolchain's simulator (linux) (pull_request) Has been cancelled
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Has been cancelled
wai-quantum portable tensor program / tensor program · CPU, mutants, GPU builds (pull_request) Has been cancelled
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Has been cancelled
wai-quantum dataflow member / member · dataflow device, simulated (pci 1e52:401e) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, rvv 1024-bit (riscv64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, sve 128-bit (aarch64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, rvv 128-bit (riscv64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, sve 2048-bit (aarch64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, avx2 (x86_64 silicon) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, sve 512-bit (aarch64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Has been cancelled
wai-quantum signal processor / processor and member · signal processor, emulated (pull_request) Has been cancelled
wai-quantum WebGPU member / shader checks · browser build · wasip2 inertness · MSRV (pull_request) Has been cancelled
wai-quantum WebGPU member / member · software Vulkan (linux) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · macos (pull_request) Has been cancelled
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Has been cancelled
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Has been cancelled
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (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 energy receipts / energy receipts · linux (pull_request) Has been cancelled
WAI examples / WAI examples · portable · linux (pull_request) Has been cancelled
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · linux (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Has been cancelled
wai-quantum WebGPU member / member · discrete GPU, Vulkan (jetson-hub) (pull_request) Has been cancelled
9ac35dcfc9
- engine::guide: the route rule allows a quantum provider the person
  added themselves, only for a run they ask for, and the Agent Skill says
  how (dry run, cost, the person's yes).
- The stdio MCP server's tools() now includes the provider tools, so
  tools/list, the generated llms.txt, llms-full.txt, the AGENTS.md block
  and the skill's tool reference list the same tools.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The engine gains `engine::editor`, the language service an editor needs,
pure and with no protocol in it:

- diagnostics: the reader's refusal on its line (one mapping function,
  `reader_diagnostic`, where stable codes and exact spans plug in), and
  the critique's smells on theirs, with their kind as the code; a
  generator is read at the given inputs, or 4;
- completion of keywords, the standard gates (with parameter
  placeholders), and the registers, gates, subroutines and variables in
  scope, by what the cursor's place takes; snippets, and sample programs
  in an empty file;
- hover: each standard gate's matrix written exactly, held entry by entry
  to the engine's own matrix under all 46 names the reader accepts; a
  user gate's matrix from the engine's matrices of its gates; each gate's
  cost as the engine counts it (two-qubit gates, T count, depth), at the
  call's angles or at generic ones, said which; a register's size;
- definition, references, highlights and rename over an index of
  declarations and scopes that reads the whole of OpenQASM 3, and a
  half-typed program; symbols, folding (blocks, comments, held blocks);
- a formatter with one layout, refusing a program whose brackets do not
  match, checked to keep every token, and tested stable and
  meaning-preserving (the engine reads the formatted program to the same
  circuit) on a corpus in every part of the language;
- lenses for Run, Plan, Critique, Shortcuts and Receipt.

The command line gains two verbs. `wai-quantum lsp` serves it over
standard input and output, UTF-16 or UTF-8 positions as agreed, the
commands run in-process on a thread of their own and signed with the
user's key; `wai-quantum fmt` formats, `--check`s and `--write`s.
tests/lsp.rs drives the binary through a scripted session from
initialize to exit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The grammar reads every statement of OpenQASM 3.1 (declarations of every
type, gates, subroutines and externs, modifiers and gphase, control flow,
timing, calibrations kept as text with their braces matched, pragmas and
annotations) and OpenQASM 2's qreg, creg, opaque, measure q -> c and
if(c==1). The parser is generated at ABI 14 with the pinned command line
(0.26.13) and committed; regenerating it reproduces it byte for byte.

Queries for highlighting, scopes and folds; 17 corpus tests checked tree
for tree, and the highlighting checked by 15 assertions.
script/check-programs.mjs parses every program in the repository's
conformance material and examples (the tracked .qasm files, the Studio's
worked examples, the language service's samples, the programs in the
command line's README and smoke script): 25 of 25 parse with no error,
and a broken program is refused, so a clean result means something.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The extension highlights OpenQASM (a TextMate grammar) and starts
`wai-quantum lsp` (path, extra arguments, generator inputs and shots in
its settings). Its lenses and palette commands run Run, Plan, Critique,
Shortcuts and Receipt through the server, and each answer goes to an
output panel; a receipt can be saved as JSON. When the command line is
missing it says so, with the install commands of the command line's
README, and offers the setting for its path. It builds to one bundled
file and packages to a .vsix with the pinned packaging tool; it is not
published.

editors/ holds a configuration for three kinds of editor: one configured
in Lua (the server through the built-in configuration or the lspconfig
plugin, the grammar through the tree-sitter plugin, and a command for each
of the server's commands), one configured by languages.toml (the server,
the formatter and the grammar, with its queries in that editor's capture
names), and one with WebAssembly extensions described by extension.toml (a
small extension that finds and starts the server, built for
wasm32-wasip2; every locked crate is at least two weeks old).

test/check.mjs (79 checks) holds the manifest to the server's commands,
the highlighting token by token, the missing-binary message to the
README, every configuration to its syntax and to the server and the
grammar, the query copies to the grammar's, and the package to exactly
the extension's files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
On linux: the language service's tests (each module shown to have run),
the language server's scripted session over standard input and output and
its unit tests, the grammar regenerated with the pinned command line and
held identical to the committed parser, its corpus and highlighting, every
program in the repository parsed with no error, `wai-quantum fmt` on each
of those programs (stable on a second pass, and drawn by the engine as the
original is, or refused alike), the editor extension packaged and checked
with the built command line, and the WebAssembly extension built for
wasm32-wasip2. On macos: the language service's tests and the server's
session.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The command line's README gains an Editors section (what the language
server brings, `wai-quantum fmt`, where the extension, the other editors'
configurations and the grammar are, and a client configuration of one's
own); the engine's README names `engine::editor` with the rest of the
engine; wai/CHANGELOG.md records the whole of it. smoke.sh checks that
fmt gives the one layout, that --check tells formatted from not, that a
program whose brace is not closed is refused with its line, and that the
server answers initialize and exits cleanly after shutdown.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum-cli docs: llms-full.txt with the lsp and fmt verbs
Some checks failed
wai-quantum studio and desktop / studio · browser (pull_request) Has been cancelled
wai-quantum studio and desktop / desktop app · macos (pull_request) Has been cancelled
wai-quantum tensor-engine member / member · tensor engine, the kernel toolchain's simulator (linux) (pull_request) Has been cancelled
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Has been cancelled
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Has been cancelled
wai-quantum portable tensor program / tensor program · CPU, mutants, GPU builds (pull_request) Has been cancelled
wai-quantum portable tensor program / tensor program · integrated GPU (framework-128gb) (pull_request) Has been cancelled
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Has been cancelled
WAI conformance / fast integer kernels, every x86_64 kernel set (AVX-512 silicon) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, rvv 1024-bit (riscv64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, sve 128-bit (aarch64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, rvv 128-bit (riscv64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, sve 2048-bit (aarch64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, avx2 (x86_64 silicon) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit, sve 512-bit (aarch64, emulated) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector units, avx2 and avx512 (framework-128gb silicon) (pull_request) Has been cancelled
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Has been cancelled
wai-quantum WebGPU member / shader checks · browser build · wasip2 inertness · MSRV (pull_request) Has been cancelled
wai-quantum WebGPU member / member · software Vulkan (linux) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · integrated GPU, Vulkan (framework-128gb) (pull_request) Has been cancelled
wai-quantum WebGPU member / member · browser WebGPU (macos) (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-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Has been cancelled
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Has been cancelled
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Has been cancelled
wai-web reach builds / wai-web reach builds · this tree's wai-web, every rung on its engine line (pull_request) Has been cancelled
wai-web reach builds / wai-web reach builds · the package of record, every output as recorded (pull_request) Has been cancelled
WAI conformance / cargo-class corpora · macos (pull_request) Has been cancelled
wai-quantum WebGPU member / member · discrete GPU, Vulkan (jetson-hub) (pull_request) Has been cancelled
67a6cb7fb7
Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum: the route rule reads plainly; a project's test.sh takes a relative command path
All checks were successful
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 20m28s
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Successful in 19s
WAI examples / WAI examples · android-app · linux-arm64 (pull_request) Successful in 4m51s
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (pull_request) Successful in 2m16s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 57m25s
wai-audit collector and player integration / collector, player integration and the browser end to end · macos (pull_request) Successful in 1m25s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 29s
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Successful in 1m22s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 10m53s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 7m22s
wai-quantum command line / command line · macos (pull_request) Successful in 42s
wai-quantum dataflow member / member · dataflow device absent (macos) (pull_request) Successful in 14s
wai-quantum editors / editors · macos (pull_request) Successful in 49s
wai-quantum FPGA member / member · FPGA datapath, simulated (macos) (pull_request) Successful in 1m10s
wai-quantum Metal member / member · Metal (macos) (pull_request) Successful in 31s
WAI examples / WAI examples · the archive, the readiness check, the browser and Apple · macos (pull_request) Successful in 12m54s
wai-quantum OpenCL member / member · OpenCL GPU (macos) (pull_request) Successful in 23s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 20m0s
wai-quantum-qpu / credentials in the keychain (macos) (pull_request) Successful in 18s
wai-quantum for Python / python · macos (pull_request) Successful in 1m18s
wai-quantum matrix-extension member / member · matrix extension absent (macos) (pull_request) Successful in 11s
wai-quantum service / service · macos (pull_request) Successful in 47s
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Successful in 17s
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Successful in 15s
wai-quantum neural-processor member / member · neural processor (macos) (pull_request) Successful in 9m24s
wai-quantum studio and desktop / desktop app · macos (pull_request) Successful in 2m45s
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Successful in 1m45s
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Successful in 2m34s
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Successful in 7m3s
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Successful in 19m2s
d7afb5f9fc
- engine::guide's route rule ends "and nowhere else": the service's
  instructions join every rule on one line, where the old ending and the
  signing-key rule read together as a comparison to the prose check.
- test.sh makes a relative WAI_QUANTUM absolute before it changes to the
  project's directory, and smoke.sh runs the binary by an absolute path:
  CI gives it ./target/release/wai-quantum.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reader is rebuilt in stages, each with the source position of what it
handles: tokens (qasm::lex), the program as written (qasm::ast, qasm::parse)
and the program run on reading (qasm::elab). qasm::diag is the table of
codes: each with its outcome (refused, lowered, carried, preserved, warned)
and a one-line meaning, served as data (codes(), codes_json()) and as
docs/qasm-diagnostics.md, which a test holds to the table. A diagnostic's
text keeps the message people read and ends with its code
("line 3: unknown gate foo [Q103]"); qasm::read gives the program, each op's
line and the warnings, and a refusal as a Diagnostic with line, column and
length. engine::job::lint carries code, column and length, and warnings
under `diagnostics`.

The language the reader now takes, each construct lowered exactly or
refused with a code: def subroutines, inlined (classical arguments by value,
qubits by reference, return values, a returned measurement written into the
caller's bit, bits a subroutine or block declares for itself); inv @, pow(k)
@ and fractional pow where an exact principal root exists, and ctrl/negctrl
on any gate, user gates included; float, angle[n] (held to n bits, with the
rounding reported), complex, uint, bool, bit arrays, arrays, casts and the
built-in functions, folded with the crate's own deterministic functions;
while (unrolled when its condition is known, or run at most
@wai.max_iterations N times on measured bits), switch, break, continue,
return and end; conditions on measured bits with comparisons, &&, || and !,
compiled to forward jumps; output declarations; delay, box, stretch, barrier
and gate durations carried as timing; defcal, cal and defcalgrammar kept
verbatim; let aliases, slices, index sets, negative indices and physical
qubits; gphase. The program carries what it declares beyond its gates in
Program::extra, and each controlled gate's native form for the bit-exact
circuit (Program::dyadic_native, qasm::exact_circuit).

A new feature, quantum_lang, holds the reader without the lowerings, so the
toolchain can read through it. Tests changed where a refusal changed:
`inv @` and a control on rz are read now; a loop variable may share a gate
parameter's name (names are scoped); `^` between integers under OPENQASM 3
is exclusive or (refused only where no version is stated); a loop may be a
loop's body; an unterminated loop body names the missing `;`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A job's result now holds what the program declares beyond its gates, each
only when there is one, so a program with none has the result (and the
receipt bytes) it always had: `outputs` (each declared output's value, or
the places of its bits in each outcome), `timing` (`applied: false`, code
Q400, when the program states durations the method does not apply), and
`diagnostics` (the reader's warnings and notes, each with its code). The
dynamic runner holds the bits a subroutine or block declares for itself
beside the program's, reads them, and keeps them out of the counts.

A test runs teleportation written as a subroutine with its own bits (every
shot reads 1), a repeat-until-success loop on measured bits under a declared
bound (15/16 of the shots succeed), outputs and a delay.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`wai-quantum diagnostics [--json]` prints every code with its outcome and
meaning; the stdio MCP server and the job service's MCP server each gain a
`qasm_diagnostics` tool (all codes, or one by `code`); the browser engine
gains `engine_diagnostic_codes()`. The service's description of what a
program may hold now names the whole language the reader takes and says
refusals carry codes. The tools-list tests of both servers name the new
tool; the smoke checks read a refusal's code, column and length from
`lint --json` and look a code up in the table; wai-web's native
quantum_engine count goes from 14 to 15 with a test of the codes and of a
subroutine, an inverse and a power run in the page.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
quantum_toolchain::from_qasm, the OpenQASM import of the edge component and
the processor clients, was a second reader that took one register, one
statement a line, no gate definitions and exact rational angles. It now
reads through qasm::read, as every other surface does, and then applies the
bit-exact circuit's own restriction, refusing with the reader's codes: a
non-dyadic angle (Q500), more than 255 qubits (Q501), a program whose
measurements do not all come at the end (Q502). A controlled gate the
modifiers write stays one gate under all its controls (Program::extra's
native forms), so to_qasm's output still reads back gate for gate and the
round-trip tests hold by hash.

Tests changed where a refusal changed: two registers, a gate definition and
two statements on one line are read now; a control on rz is a controlled
rz, exact; a qubit named twice is the reader's Q109 ("named twice in one
gate") where this reader said "invalid circuit". A bare radian number is now
held to the reader's dyadic tolerance (1e-14 of a turn), where this reader
accepted one within 1e-9 of a dyadic angle and rounded it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
What the specification's example programs need beyond the first reader:

- a bit register set by a constant (`bit[2] flags = "11";`) holds its value
  until a measurement writes it: a condition on bits known on reading is
  decided then, and known bits drop out of a condition that also reads
  measured ones; a bit holding 1 that no measurement writes, or one measured
  only on some runs, is refused (Q319), since the results carry what
  measurement writes;
- a subroutine called in gate form (`bellprep bp;`, `f(1) q, r;`);
- a duration that holds a stretch (`delay[2*g] q;`) carried as written;
- nested array values, rows and slices of them, slice assignment, `sizeof`
  by dimension, and `#dim` arguments;
- `float[16]`, rounded to half precision, ties to even;
- bits cast to a signed integer of their width read as two's complement;
- a subroutine's names are its own (a local bit may share a global
  register's name); a measurement into a classical variable is refused as
  Q128; a `let` reusing an enclosing scope's name is refused (Q101).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
59 programs, each with what the reader must do with it: the language
specification's 21 example programs, unchanged (those that run held to
their results, the rest to the code that names the first construct the
reader cannot hold exactly, or the example's own error), and a program for
each construct with a reference written without it. stdgates.qasm applies
every standard gate once, and its reference writes each in U and CX alone.

Expectations: refused (a code), warns (every warning's code), deterministic
(every shot's outcome), distribution (exact outcome probabilities),
expectations (exact Pauli values), equivalent (a reference's unitary up to a
global phase), exact (the bit-exact circuit takes it or refuses it with a
code), outputs, timing and calibrations. bundle.json holds the cases with
their text inline for builds that read no files; a test holds it equal to
the files.

CI: wai-quantum-lang.yml runs the reader's tests, the corpus natively, the
reader built without the lowerings, and the corpus under wasm32-wasip2 by
wasmtime; wai-web's wasm32 tests read every case through the page's engine
(the wasm32 count goes from 8 to 9).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
docs/qasm-feature-matrix.md lists every construct of OpenQASM 3.1 (and the
OpenQASM 2 forms in common use) with what the reader does with it,
supported, lowered, carried, preserved or refused, and its code. The crate's
README describes the one reader (feature quantum_lang) and links the matrix,
the table of codes and the corpus; the command line's README gives
`diagnostics` and the codes in lint; the Studio's says the editor marks each
problem with its code. The changelog entry is in wai/CHANGELOG.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A bit no measurement has written holds 0 and is known on reading, so the
test of a while on measured bits measures the bit first.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A test that instantiate writes defcalgrammar and defcal statements out as
they were written, and that the text reads back to the same program.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The reader ends every refusal with its diagnostic code, so the proposal the
engine cannot read goes back as "line 3: unknown gate foo [Q103]"; the
test reads it so. Q320's meaning names only what refuses it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum: the reader's codes reach the guide, the editor and Python
Some checks failed
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 9m51s
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Successful in 23s
WAI examples / WAI examples · android-app · linux-arm64 (pull_request) Successful in 4m56s
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (pull_request) Successful in 2m27s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 58m52s
wai-audit collector and player integration / collector, player integration and the browser end to end · macos (pull_request) Successful in 1m37s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 9m18s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 27s
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Successful in 1m7s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 7m9s
wai-quantum command line / command line · macos (pull_request) Successful in 50s
wai-quantum dataflow member / member · dataflow device absent (macos) (pull_request) Successful in 21s
wai-quantum editors / editors · macos (pull_request) Successful in 56s
wai-quantum FPGA member / member · FPGA datapath, simulated (macos) (pull_request) Successful in 1m40s
wai-quantum Metal member / member · Metal (macos) (pull_request) Successful in 38s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 20m11s
wai-quantum OpenCL member / member · OpenCL GPU (macos) (pull_request) Successful in 27s
wai-quantum for Python / python · macos (pull_request) Successful in 1m27s
WAI examples / WAI examples · the archive, the readiness check, the browser and Apple · macos (pull_request) Successful in 12m22s
wai-quantum-qpu / credentials in the keychain (macos) (pull_request) Successful in 20s
wai-quantum matrix-extension member / member · matrix extension absent (macos) (pull_request) Successful in 13s
wai-quantum service / service · macos (pull_request) Failing after 53s
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Successful in 19s
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Successful in 18s
wai-quantum neural-processor member / member · neural processor (macos) (pull_request) Successful in 9m38s
wai-quantum studio and desktop / desktop app · macos (pull_request) Successful in 3m0s
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Successful in 2m42s
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Successful in 1m51s
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Successful in 6m57s
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Successful in 16m11s
3e972c12bd
- engine::guide: the diagnostics resource is the reader's table (every
  code with its outcome and meaning) and worked refusals, each held by a
  test to the code and line the reader gives its example; the language
  resource carries the reader's feature matrix in place of the lists it
  kept by hand; the summary for AGENTS.md names what the reader now takes.
- engine::editor: a refusal is the reader's own diagnostic, with its code
  and the very text it names (line, column and length).
- wai-quantum-py: EngineError.code is the reader's code.
- The service's tool list holds qasm_diagnostics; the command line's
  agent docs are regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
engine::synth gains the ground the rotation synthesiser stands on, each
part held to a ground truth:

- int: signed integers of any size (Knuth division, square roots, a
  primality test, Pollard-Brent factoring within a step budget), checked
  against 128-bit arithmetic and the division identity.
- real: fixed point with 320 fractional bits; pi, the square root of 2,
  sine and cosine to the last bits.
- ring: Z[sqrt 2], Z[omega], 2x2 matrices over D[omega] and their Bloch
  rotations; any unitary over D[omega] written as a word in the
  Matsumoto-Amano normal form (fewest T gates), multiplied back exactly
  and refused if it does not match. Random words come back the same
  operator with no more T gates.
- dioph: t-dagger t = xi solved in Z[omega] prime by prime, or shown to
  have no solution; against every t with coefficients in [-6, 6].
- grid: the one- and two-dimensional grid problems, grid operators and a
  reduction that makes a thin tilted ellipse upright; against brute force.

repro: the deterministic arctangent is available to the engine.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- rz: Rz(theta) as a Clifford+T word within a requested epsilon by the
  Ross-Selinger method: the epsilon-region and the disk as a two-dimensional
  grid problem, made upright by a grid operator, each candidate tested in
  exact arithmetic, the norm equation solved, and the operator written in
  normal form. The word multiplies back exactly, and its distance to the
  rotation is computed again from the word in fixed point and rounded up;
  that is the distance reported. Against every Clifford+T operator with at
  most 11 T gates, 21 of 24 cases land on the optimal T count and the rest
  one above; T counts follow 3*log2(1/epsilon) (99 to 101 at 1e-10).
- mat: dense unitaries of a few qubits and their operator-norm distance up
  to a global phase, accurate to about 1e-15 even when they are that close.
- euler: any one-qubit unitary as Rz.Ry.Rz with the crate's own arctangent.
- kak: any two-qubit unitary as at most three CNOTs (two, or none, when the
  canonical coordinates allow), with a deterministic Jacobi eigen-solver;
  every circuit is compared with the unitary it came from.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
engine::compile carries a program through named passes, each checked where
it acts, and records them in one certificate:

- lower (every gate in h x y z s sdg t tdg cx cz swap rz, each kind held to
  its matrix), simplify (the checked rewrites), phase_fold (phase gates on
  one parity merged, checked by recomputing the phase polynomial: a proof in
  whole eighths of a turn), resynth_1q (Clifford+T runs in normal form,
  others as one rotation), resynth_2q (KAK on two-qubit blocks when it saves
  CNOTs), approximate (every rotation off the multiples of pi/4 as a
  Clifford+T word within its share of the epsilon budget).
- Levels 0 to 2 for the targets clifford_t and standard. A pass whose check
  fails is not applied, and says so.
- The certificate gives each pass's counts before and after, its check and
  verdict (proof, exact, approximate), the epsilon budget, its share per
  rotation and the bound the distances add to; up to eight qubits the whole
  output is also measured against the whole program on dense unitaries.
  Sealed with the job receipt, so the existing verify checks it.
- A job with "compile" runs the compiled program: with clifford_t it takes
  the bit-exact method, and the result's "compiled" states the distance.
- synth::lower and synth::phase: the decompositions and the phase folding,
  each against dense unitaries of random circuits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- `wai-quantum compile prog.qasm [--epsilon E] [--level 0|1|2]
  [--target clifford_t|standard]`: the compiled program to standard output,
  each pass's counts (gates, CNOTs, T, rotations) and check, the epsilon
  budget, its bound and the whole output's measured distance to standard
  error. `--json` prints the certificate sealed with the user's key, in a
  job's form, which `verify` checks; `--certificate FILE` writes it.
- `run --compile E`: the job compiles first and runs the compiled
  circuit, bit-exact for Clifford+T; the result line says how far it is.
- MCP: `compile_qasm` (sealed with the user's key), and `compile` in the
  job schema of run_quantum_circuit and plan_quantum_circuit.
- smoke.sh checks a compile, its certificate and a compiled run; CI compares
  a level-2 compile natively and as a WASI component byte for byte (they
  were equal on the build host).
- engine::compile: counts take each gate as the basis writes it, so a
  rewrite's rx(pi/4) counts as the T it is; for Clifford+T the KAK pass
  weighs rotations before CNOTs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- POST /v1/compile: the engine's compile, its result sealed with the
  service's key in a job's form, so POST /v1/verify checks it. It runs
  with the other design checks (counted per client, two at a time), and a
  compile of more than 20000 gates, more than 256 rotations to approximate,
  or a budget that leaves a rotation less than 1e-12 is refused (422) with
  the local command.
- A job with "compile" is held to the same bounds at admission, then runs
  the compiled circuit (bit-exact for Clifford+T) and says how far it is.
- MCP: compile_qasm, and compile in run_quantum_circuit's schema; a test
  pins the tool list. OpenAPI: /v1/compile and CompileOptions.
- smoke.sh: a compile, its certificate verified, a compiled job, and a
  too-fine compile sent to the command line (all held against a local
  instance on the build host).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
QuantumEngine::compile takes the service's compile request and returns the
compiled program and its certificate sealed with the page's key, which
engine_verify checks. A native test and a wasm32 test compile one request
to the same pinned BLAKE3 digest (both held on the build host, the wasm32
one under Node); the native test also runs the output bit-exact. The CI
pins move to 15 native and 9 wasm32 tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- engine::compile: with "stages": true the result holds the circuit after
  each pass, for a view that draws any of them. The certificate's reading
  now says what the bound gives exactly: the output distribution within it
  in total variation, every outcome's probability too, and an expectation
  within 2*bound*|O|.
- synth::phase: a parity is a sorted list of path variables, not a bit set
  over all of them, so folding a large Clifford+T circuit does not grow with
  every Hadamard.
- wai-quantum-cli: compile prints the certificate's digest, the hash a
  compiled job's result names.
- wai-web: the pinned digest of the sealed compile follows the new reading
  (native 15 and wasm32 9 tests held on the build host).
- wai-conformance: engine::synth and engine::compile join the unit tests
  run under wasmtime (all 28 held there).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- wai-quantum/docs/compiler.md: the passes and how each is checked, the
  levels, how to read epsilon (operator norm up to a global phase, shared
  among the rotations, the bound the distances add to and what it gives for
  distributions and expectations), the certificate's fields with a real one,
  determinism, and what the compile does not do.
- READMEs of wai-quantum, wai-quantum-cli and wai-quantum-service: compile,
  run --compile, POST /v1/compile and its bounds, compile_qasm.
- CHANGELOG: wai-quantum: synthesis and certified compilation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- quantum-studio: "Compile" under the circuit takes the program through
  the engine's passes (Clifford+T within epsilon, or the standard gates,
  levels 0 to 2). Each pass is a row with gates, CNOTs, T gates and
  rotations before and after and its check; the line above gives the bound,
  the budget and its share per rotation, the whole output's measured
  distance and whether the sealed certificate verifies here. The circuit
  after the last pass is drawn, and choosing a pass draws the circuit after
  it. "Use" offers the compiled program for review; a compile goes stale
  when the program changes. In a tab it runs in the engine's worker and is
  sealed with the browser's key.
- wai-quantum-desktop: the `compile` command, sealed with the user's key,
  off the window's thread, with a test of its pure half.
- The Studio e2e checks the lens (all 150 checks passed on the macOS build
  host, the bundle built on the Linux one); the desktop's 6 tests and
  clippy passed there.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
wai-quantum: compiling over the one reader; the stack's tool lists hold compile_qasm
Some checks failed
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Successful in 25s
WAI examples / WAI examples · android-app · linux-arm64 (pull_request) Successful in 5m30s
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (pull_request) Successful in 2m55s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 10m36s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 59m5s
wai-audit collector and player integration / collector, player integration and the browser end to end · macos (pull_request) Successful in 1m29s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 8m56s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 27s
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Successful in 57s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 4m39s
wai-quantum command line / command line · macos (pull_request) Successful in 46s
wai-quantum dataflow member / member · dataflow device absent (macos) (pull_request) Successful in 18s
wai-quantum editors / editors · macos (pull_request) Successful in 54s
wai-quantum FPGA member / member · FPGA datapath, simulated (macos) (pull_request) Successful in 1m13s
wai-quantum Metal member / member · Metal (macos) (pull_request) Successful in 32s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 16m41s
wai-quantum OpenCL member / member · OpenCL GPU (macos) (pull_request) Successful in 28s
wai-quantum for Python / python · macos (pull_request) Successful in 1m30s
WAI examples / WAI examples · the archive, the readiness check, the browser and Apple · macos (pull_request) Successful in 11m20s
wai-quantum-qpu / credentials in the keychain (macos) (pull_request) Successful in 19s
wai-quantum matrix-extension member / member · matrix extension absent (macos) (pull_request) Successful in 12s
wai-quantum service / service · macos (pull_request) Failing after 52s
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Successful in 18s
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Successful in 16s
wai-quantum neural-processor member / member · neural processor (macos) (pull_request) Successful in 9m21s
wai-quantum studio and desktop / desktop app · macos (pull_request) Successful in 3m1s
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Successful in 2m39s
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Successful in 1m48s
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Successful in 6m37s
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Successful in 14m55s
f039201d7c
- engine::compile: a compiled program keeps the program's outputs and its
  calibrations; its timing and where each controlled gate was lowered name
  places in the ops the passes rewrite, so it holds neither.
- The service's exact tool list holds compile_qasm beside qasm_diagnostics;
  the command line's agent docs are regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dcharlot closed this pull request 2026-10-27 20:09:58 -04:00
Some checks failed
wai-quantum WebGPU member / member · DX12 and Vulkan (cbio-windows) (pull_request) Successful in 12m17s
wai-quantum on every processor / emulated · aarch64-unknown-linux-gnu (pull_request) Successful in 2m28s
wai-quantum on every processor / emulated · armv7-unknown-linux-gnueabihf (pull_request) Successful in 2m38s
wai-quantum on every processor / emulated · powerpc64le-unknown-linux-gnu (pull_request) Successful in 2m12s
wai-quantum on every processor / emulated · loongarch64-unknown-linux-gnu (pull_request) Successful in 3m47s
wai-web reach builds / wai-web reach · does this change touch it (pull_request) Successful in 5s
wai-quantum on every processor / emulated · powerpc64-unknown-linux-gnu (pull_request) Successful in 5m1s
wai-quantum on every processor / emulated · riscv64gc-unknown-linux-gnu (pull_request) Successful in 4m55s
wai-quantum on every processor / emulated · sparc64-unknown-linux-gnu (pull_request) Successful in 3m44s
wai-quantum on every processor / emulated · i686-unknown-linux-gnu (pull_request) Successful in 4m33s
wai-quantum on every processor / emulated · s390x-unknown-linux-gnu (pull_request) Successful in 7m12s
standards workspaces build + test / which workspaces this change touches (pull_request) Successful in 9s
wai-audit collector and player integration / does this change touch it (pull_request) Successful in 7s
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 7s
wai-quantum command line / does this change touch it (pull_request) Successful in 7s
wai-quantum CUDA member / does this change touch it (pull_request) Successful in 7s
wai-quantum dataflow member / does this change touch it (pull_request) Successful in 7s
wai-quantum signal processor / does this change touch it (pull_request) Successful in 8s
repository checks / lockfiles, advisories, tests in CI, workflow hygiene, spec and section references, public text (pull_request) Successful in 2m42s
wai-quantum editors / does this change touch it (pull_request) Successful in 7s
wai-quantum FPGA member / does this change touch it (pull_request) Successful in 7s
wai-quantum HIP member / does this change touch it (pull_request) Successful in 7s
wai-quantum OpenQASM reader / does this change touch it (pull_request) Successful in 6s
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 6s
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 10s
wai-quantum for Python / does this change touch it (pull_request) Successful in 7s
wai-quantum-qpu / does this change touch it (pull_request) Successful in 6s
wai-quantum service / does this change touch it (pull_request) Successful in 6s
wai-quantum matrix-extension member / does this change touch it (pull_request) Successful in 6s
wai-quantum studio and desktop / does this change touch it (pull_request) Successful in 6s
wai-quantum tensor-engine member / does this change touch it (pull_request) Successful in 6s
wai-quantum portable tensor program / does this change touch it (pull_request) Successful in 9s
wai-quantum CPU vector units / does this change touch it (pull_request) Successful in 7s
wai-quantum WebGPU member / does this change touch it (pull_request) Successful in 7s
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 mbt2018_mean integer decode (regenerated vectors) / does this change touch it (pull_request) Successful in 7s
wai-web wasm32 / does this change touch it (pull_request) Successful in 7s
wai-web reach builds / wai-web reach builds · the package of record, every output as recorded (pull_request) Successful in 2m27s
wai-web reach builds / wai-web reach builds · this tree's wai-web, every rung on its engine line (pull_request) Successful in 4m48s
WAI conformance / fast integer kernels, every x86_64 kernel set (AVX-512 silicon) (pull_request) Successful in 3m19s
wai-quantum HIP member / member · HIP (framework-128gb) (pull_request) Successful in 32s
wai-quantum npu-cores member / member · npu-cores, neural processor (framework-128gb silicon) (pull_request) Successful in 1m28s
wai-quantum OpenCL member / member · OpenCL GPU (framework-128gb) (pull_request) Successful in 22s
wai-quantum portable tensor program / tensor program · integrated GPU (framework-128gb) (pull_request) Successful in 12s
wai-quantum CPU vector units / member · vector units, avx2 and avx512 (framework-128gb silicon) (pull_request) Successful in 17s
wai-quantum CUDA member / member · CUDA (jetson-hub) (pull_request) Successful in 35s
wai-audit collector and player integration / collector · linux (pull_request) Successful in 1m21s
wai-quantum OpenCL member / member · OpenCL GPU and CPU (jetson-hub) (pull_request) Successful in 32s
wai-quantum portable tensor program / tensor program · GPUs (jetson-hub) (pull_request) Successful in 25s
WAI conformance / faces from keypoints under wasm32-wasip2 (wasmtime) (pull_request) Successful in 1m56s
WAI conformance / cross-arch byte-equality · linux (pull_request) Successful in 35s
wai-quantum WebGPU member / member · integrated GPU, Vulkan (framework-128gb) (pull_request) Successful in 8m1s
WAI conformance / quantum core and corpus under wasm32-wasip2 (wasmtime) (pull_request) Successful in 3m30s
wai-quantum CUDA member / member · CUDA absent (linux) (pull_request) Successful in 27s
wai-quantum command line / command line · linux (pull_request) Successful in 1m45s
wai-quantum dataflow member / member · dataflow device, simulated (pci 1e52:401e) (pull_request) Successful in 1m33s
wai-quantum editors / editors · linux (pull_request) Failing after 1m33s
wai-quantum FPGA member / member · FPGA simulation absent (linux) (pull_request) Successful in 25s
wai-quantum dataflow member / member · dataflow device, simulated (pci 1e52:b140) (pull_request) Successful in 4m21s
wai-quantum OpenQASM reader / corpus under wasm32-wasip2 (wasmtime) (pull_request) Successful in 33s
wai-quantum Metal member / member · Metal absent (linux) (pull_request) Successful in 30s
wai-quantum OpenQASM reader / reader and corpus · linux (pull_request) Successful in 1m30s
wai-quantum neural-processor member / member · neural processor absent (linux) (pull_request) Successful in 26s
wai-quantum OpenCL member / member · OpenCL absent (linux) (pull_request) Successful in 29s
wai-quantum-qpu / clients against their contracts (linux) (pull_request) Successful in 35s
wai-quantum service / service · linux (pull_request) Failing after 54s
wai-quantum for Python / python · linux (pull_request) Successful in 1m47s
wai-quantum matrix-extension member / member · matrix extension, emulated (aarch64 Linux) (pull_request) Successful in 12s
WAI examples / WAI examples · portable · linux (pull_request) Successful in 9m21s
wai-quantum portable tensor program / tensor program · CPU, mutants, GPU builds (pull_request) Successful in 28s
wai-quantum CPU vector units / member · vector unit, rvv 1024-bit (riscv64, emulated) (pull_request) Successful in 8s
wai-quantum CPU vector units / member · vector unit, sve 128-bit (aarch64, emulated) (pull_request) Successful in 14s
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 2048-bit (aarch64, emulated) (pull_request) Successful in 11s
WAI energy receipts / energy receipts · linux (pull_request) Successful in 10m58s
wai-quantum CPU vector units / member · vector unit, avx2 (x86_64 silicon) (pull_request) Successful in 6s
wai-quantum CPU vector units / member · vector unit, sve 512-bit (aarch64, emulated) (pull_request) Successful in 10s
wai-quantum studio and desktop / studio · browser (pull_request) Successful in 2m56s
wai-quantum WebGPU member / member · software Vulkan (linux) (pull_request) Successful in 2m5s
wai-quantum tensor-engine member / member · tensor engine, the kernel toolchain's simulator (linux) (pull_request) Successful in 4m59s
wai-quantum WebGPU member / shader checks · browser build · wasip2 inertness · MSRV (pull_request) Successful in 3m27s
wai-quantum signal processor / processor and member · signal processor, emulated (pull_request) Failing after 12m19s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 17m57s
WAI mbt2018_mean integer decode (regenerated vectors) / regenerate mbt2018_mean integer vectors → Rust decode, required (pull_request) Successful in 5m50s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 5m27s
wai-quantum WebGPU member / member · discrete GPU, Vulkan (jetson-hub) (pull_request) Successful in 20m33s
WAI conformance / v2 vocabulary · manifests validate as stated (pull_request) Successful in 22s
standards workspaces build + test / joule-code-rs (joule-code/joule-code-rs, joule-code-rs, linux-arm64, true) (pull_request) Successful in 6m45s
WAI conformance / delivery telemetry · CMCD and CMSD against an independent library (pull_request) Successful in 17s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 34s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 1m55s
WAI conformance / each feature of the independent verifiers' steps compiles alone (pull_request) Successful in 10m21s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 20m6s
wai-quantum HIP member / member · HIP absent (linux-arm64) (pull_request) Successful in 34s
wai-quantum npu-cores member / member · npu-cores absent (linux-arm64) (pull_request) Successful in 31s
wai-quantum tensor-engine member / member · tensor engine absent (linux-arm64) (pull_request) Successful in 25s
WAI examples / WAI examples · android-app · linux-arm64 (pull_request) Successful in 5m30s
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (pull_request) Successful in 2m55s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 10m36s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 59m5s
wai-audit collector and player integration / collector, player integration and the browser end to end · macos (pull_request) Successful in 1m29s
standards workspaces build + test / macOS energy backends (pull_request) Successful in 8m56s
WAI conformance / cross-arch byte-equality · macos (pull_request) Successful in 27s
WAI conformance / codec wrappers · fuzz smoke, text decode limits, C entry points, provenance, the semantic path (pull_request) Successful in 57s
WAI energy receipts / energy receipts · macos (pull_request) Successful in 4m39s
wai-quantum command line / command line · macos (pull_request) Successful in 46s
wai-quantum dataflow member / member · dataflow device absent (macos) (pull_request) Successful in 18s
wai-quantum editors / editors · macos (pull_request) Successful in 54s
wai-quantum FPGA member / member · FPGA datapath, simulated (macos) (pull_request) Successful in 1m13s
wai-quantum Metal member / member · Metal (macos) (pull_request) Successful in 32s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 16m41s
wai-quantum OpenCL member / member · OpenCL GPU (macos) (pull_request) Successful in 28s
wai-quantum for Python / python · macos (pull_request) Successful in 1m30s
WAI examples / WAI examples · the archive, the readiness check, the browser and Apple · macos (pull_request) Successful in 11m20s
wai-quantum-qpu / credentials in the keychain (macos) (pull_request) Successful in 19s
wai-quantum matrix-extension member / member · matrix extension absent (macos) (pull_request) Successful in 12s
wai-quantum service / service · macos (pull_request) Failing after 52s
wai-quantum portable tensor program / tensor program · Metal and the arm64 CPU (macos) (pull_request) Successful in 18s
wai-quantum CPU vector units / member · vector unit absent (macos) (pull_request) Successful in 16s
wai-quantum neural-processor member / member · neural processor (macos) (pull_request) Successful in 9m21s
wai-quantum studio and desktop / desktop app · macos (pull_request) Successful in 3m1s
wai-quantum WebGPU member / member · Metal (macos) (pull_request) Successful in 2m39s
wai-quantum WebGPU member / member · browser WebGPU (macos) (pull_request) Successful in 1m48s
wai-sink-android native sink library / every ABI, the AAR, and the instrumented tests in a headless emulator · macos (pull_request) Successful in 6m37s
wai-sink-swift native sink package / libwai slices, desktop tests, simulator tests · macos (pull_request) Successful in 14m55s

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!520
No description provided.