open-standards/wai/quantum-conformance
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Transaction Science 4ea226d025 wai/quantum-conformance: check the browser leg against the same pinned corpus
The extension claims identical reconstruction native, in the browser, and at the
edge. Native and wasm32-wasip2 were checkable with the existing vectors binary;
the browser was not checkable by anything, so it was the one surface taken on
trust.

browser_verify.mjs drives the deployed wasm-bindgen bundle in headless Chromium
and holds it to expected_hashes.json -- the same corpus pinned 2026-07-30, so all
three surfaces are now checked against one reference rather than against each
other. All four vectors pass, circuit hash and statevector hash both, with no
console errors.

Two things the harness had to learn, now written down: statevector_hash_hex()
returns empty until run() is called, because the circuit is built eagerly and the
state is not -- which reads as a hash mismatch rather than as a missing step; and
the bundle must be served over HTTP rather than file:// for the wasm import to
resolve.

Adds the README the directory never had, covering all three invocations and
stating the corpus's scope honestly: it pins the byte-exact dyadic core, where
hash equality is the right bar. The f64 layers have no WQC circuit to pin and are
held to exact IEEE-754 bits by unit tests instead.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-10 12:30:26 -04:00
..
vectors wai-quantum: Add wai.quantum.circuit — deterministic quantum-simulation transport 2026-07-30 23:10:18 -04:00
browser_verify.mjs wai/quantum-conformance: check the browser leg against the same pinned corpus 2026-09-10 12:30:26 -04:00
expected_hashes.json wai-quantum: Add wai.quantum.circuit — deterministic quantum-simulation transport 2026-07-30 23:10:18 -04:00
README.md wai/quantum-conformance: check the browser leg against the same pinned corpus 2026-09-10 12:30:26 -04:00

quantum-conformance

Statevector-equivalence for the wai.quantum.circuit extension: given the same WQC circuit, a conforming sink MUST reconstruct the identical fixed-point statevector — hash equality, no tolerance.

vectors/*.wqc plus expected_hashes.json are the pinned corpus. They are the one reference all three surfaces are checked against, rather than being checked against each other.

Native

cargo build --release --no-default-features --features quantum --bin wai_quantum_vectors
./target/release/wai_quantum_vectors verify wai/quantum-conformance

WASI (the edge)

Same binary, same source, different architecture:

cargo build --release --target wasm32-wasip2 --no-default-features --features quantum \
  --bin wai_quantum_vectors
wasmtime run --dir wai/quantum-conformance::/corpus \
  target/wasm32-wasip2/release/wai_quantum_vectors.wasm verify /corpus

Browser

node wai/quantum-conformance/browser_verify.mjs [path/to/quantum-ml/pkg]

Drives the deployed wasm-bindgen bundle in headless Chromium. Note that statevector_hash_hex() is empty until run() is called — the circuit is built eagerly, the state is not.

Scope

The corpus covers the byte-exact dyadic core, where hash equality is the right bar. The floating-point layers (quantum_source, quantum_channel) are held to exact IEEE-754 bits by unit tests instead, since they have no WQC circuit to pin — see entropy_is_bit_identical_across_architectures.