open-standards/wai/wai-quantum/Cargo.toml
Transaction Science f0591f1bc3
Some checks failed
standards workspaces build + test / aac-rs (push) Successful in 37s
standards workspaces build + test / joule-code-rs (push) Successful in 47s
standards workspaces build + test / jouleclaw-rs (push) Successful in 2m34s
standards workspaces build + test / joulecontract-rs (push) Successful in 39s
no-vanity-metrics / Scan committed Markdown for vanity metrics (push) Has been cancelled
standards workspaces build + test / arl-rs (push) Has been cancelled
standards workspaces build + test / eoc-rs (push) Has been cancelled
standards workspaces build + test / jcp-rs (push) Has been cancelled
standards workspaces build + test / joule-ui-rs (push) Has been cancelled
standards workspaces build + test / jouledesk-rs (push) Has been cancelled
standards workspaces build + test / joulehook-rs (push) Has been cancelled
standards workspaces build + test / mesh-rs (push) Has been cancelled
standards workspaces build + test / openpay (push) Has been cancelled
standards workspaces build + test / proof-rs (push) Has been cancelled
standards workspaces build + test / sandbox-rs (push) Has been cancelled
standards workspaces build + test / sense-rs (push) Has been cancelled
standards workspaces build + test / smart-byte-rs (push) Has been cancelled
WAI conformance / cargo-class corpora · linux (push) Has been cancelled
WAI conformance / cargo-class corpora · linux-arm64 (push) Has been cancelled
WAI conformance / cargo-class corpora · macos (push) Has been cancelled
WAI conformance / cargo-class corpora · windows (push) Has been cancelled
WAI conformance / cross-arch byte-equality · linux (push) Has been cancelled
WAI conformance / cross-arch byte-equality · linux-arm64 (push) Has been cancelled
WAI conformance / cross-arch byte-equality · macos (push) Has been cancelled
WAI conformance / cross-arch byte-equality · windows (push) Has been cancelled
WAI conformance / C2PA manifest emission · signed, read back, validated (push) Has been cancelled
standards workspaces build + test / map-rs (push) Has been cancelled
wai-quantum 0.3.21: test the cross-architecture claim instead of asserting it
The crate description has long promised "identical results native, in the
browser, and as a WASI component at the edge". That was last checked around
0.3.3, and everything since -- quantum_source's f64 Jacobi eigensolver and its
hand-rolled log2, quantum_channel, the qudit and comm layers -- landed without it
being rechecked. I had also flagged, and not closed, that the entropy
reproducibility test only proved one machine agreed with itself.

Both are now closed, and the result is stronger than expected: the ENTIRE suite
passes under wasm32-wasip2 on wasmtime, 266 tests, not merely a sample.

  CARGO_TARGET_WASM32_WASIP2_RUNNER=wasmtime \
    cargo test --release --target wasm32-wasip2 --features full

Thirteen CLI invocations were also compared byte-for-byte between native
aarch64-darwin and the wasm component, covering the integer dyadic core, the f64
entropy and channel paths, CHSH, qutrits, BB84 and an Ed25519 receipt. All
identical -- including JSON that prints full-precision f64 such as
1.000000000824584, so this is bit-identical floating point rather than agreement
after rounding.

To keep it closed, two tests now pin exact IEEE-754 bits rather than tolerances:
the maximally mixed case, and -- because equal eigenvalues barely exercise the
eigensolver -- a half-depolarized |+> whose spectrum is genuinely non-trivial,
along with its Holevo bound. A platform that computes something different now
fails the suite instead of quietly returning a different number.

This is what avoiding libm bought. `ln` is free to differ in its last places
between platforms; computing log2 in-crate by repeated squaring is what makes the
bits agree, and that is now demonstrated rather than argued.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-10 12:01:42 -04:00

98 lines
4.3 KiB
TOML

[package]
name = "wai-quantum"
version = "0.3.21"
edition = "2024"
rust-version = "1.97"
license = "Apache-2.0"
description = "A deterministic quantum stack in pure Rust: byte-exact circuit simulation (statevector / stabilizer / tensor-network MPS / sparse-Pauli backends), error mitigation, qLDPC decoding, noise learning, circuit-equivalence proofs, a phasor interference-ML layer, information-theoretic limits, noisy channels and state tomography, and signed energy-accounted receipts. No QPU, no cloud, no system libraries — identical results native, in the browser, and as a WASI component at the edge."
repository = "https://git.transaction.science/Transaction-Science/open-standards"
homepage = "https://wai.transaction.science/quantum-ide"
documentation = "https://docs.rs/wai-quantum"
keywords = ["quantum", "simulation", "wasm", "deterministic", "qec"]
categories = ["science", "simulation", "wasm", "mathematics"]
readme = "README.md"
# docs.rs builds with DEFAULT features only, which would document 3 of 21
# modules and hide the entire operational + ML layers. Document everything.
[package.metadata.docs.rs]
all-features = true
[dependencies]
# Hashes for circuit / statevector / receipt identity. Required: the base
# `quantum` feature binds every reconstruction to a BLAKE3 hash.
blake3 = "1"
# Canonical receipt JSON (sorted keys, byte-stable round-trip).
serde_json = { version = "1", features = ["preserve_order"] }
# Receipt signatures. Optional — only the sealing features need it.
ed25519-dalek = { version = "2", optional = true }
[features]
default = ["quantum", "quantum_toolchain", "quantum_receipt"]
# Internal: signature support, pulled in by every sealing feature.
# (Mirrors the `world` feature in the parent `wai` crate.)
_signing = ["dep:ed25519-dalek"]
# --- core simulation -------------------------------------------------------
quantum = []
quantum_toolchain = ["quantum"]
quantum_mps = ["quantum"]
quantum_stabilizer = ["quantum"]
quantum_pauli = ["quantum"]
# Mixed states and the observables that distinguish quantum theory from a classical
# account: density matrices, the partial trace, exact Pauli expectations, CHSH.
quantum_info = ["quantum"]
# Qubits AND qutrits: the Weyl-Heisenberg group, the Fourier gate over Z_d, and
# the controlled sum. Exact for d = 2 and 3; other dimensions are refused.
quantum_qudit = ["quantum"]
# Quantum communication and security: BB84 key distribution with an
# intercept-resend eavesdropper, and the no-cloning theorem priced.
quantum_comm = ["quantum"]
# What quantum theory says about encoding and transport: von Neumann entropy, the
# Schumacher limit, and the Holevo bound that refuses classical compression.
quantum_source = ["quantum", "quantum_info"]
# Transport itself: Kraus channels, and tomography to see what arrived.
quantum_channel = ["quantum", "quantum_info", "quantum_source"]
# QIR (LLVM-based quantum IR) export — the compiler-facing sibling of OpenQASM.
quantum_qir = ["quantum", "quantum_toolchain"]
# --- receipts & operations -------------------------------------------------
quantum_receipt = ["quantum", "_signing"]
quantum_ops = ["_signing"]
quantum_cal = ["quantum_ops"]
quantum_mitigate = ["quantum_ops"]
quantum_qec = ["quantum_ops"]
quantum_control = ["quantum_cal"]
quantum_noise = ["quantum_cal"]
quantum_compile = ["quantum_ops"]
quantum_atom = ["quantum_ops"]
quantum_qbom = ["quantum_ops"]
# --- interference / ML layer ----------------------------------------------
quantum_vml = []
quantum_phasor = []
quantum_qfhrr = ["quantum_vml"]
quantum_kernel = []
quantum_qdata = []
quantum_phasor_meter = ["_signing"]
# Everything.
full = [
"quantum", "quantum_toolchain", "quantum_mps", "quantum_stabilizer", "quantum_pauli", "quantum_qir", "quantum_info", "quantum_qudit", "quantum_comm", "quantum_source", "quantum_channel",
"quantum_receipt", "quantum_ops", "quantum_cal", "quantum_mitigate", "quantum_qec",
"quantum_control", "quantum_noise", "quantum_compile", "quantum_atom", "quantum_qbom",
"quantum_vml", "quantum_phasor", "quantum_qfhrr", "quantum_kernel", "quantum_qdata",
"quantum_phasor_meter",
]
[[example]]
name = "bell"
required-features = ["quantum", "quantum_toolchain"]
[[example]]
name = "threshold"
required-features = ["quantum_qec"]
[[example]]
name = "receipt"
required-features = ["quantum_toolchain", "quantum_receipt"]