Python and Rust architecture
QuPRS provides two execution interfaces built around Path-sum reduction and weighted model counting.
Python integration
The Python entry point QuPRS.check_equivalence() accepts supported Qiskit QuantumCircuit objects and QASM inputs. The backend argument selects either the Python implementation or the Rust implementation exposed through PyO3.
With backend="rust" and safe_mode=False (the default), Python calls the Rust extension in-process. With backend="rust" and safe_mode=True, Python instead supervises an isolated worker that loads the same PyO3 extension. Isolation bounds worker communication and enforces a worker deadline, but parent-side Qiskit serialization is not forcibly preemptible. Memory enforcement depends on operating-system support.
For backend="python", safe_mode=True uses the Python strategy's isolation mechanism; it does not run the standalone Rust CLI.
Native Rust
The quprs crate exposes a typed verification engine, QuantumCircuit, VerificationOptions, and symbolic PathSum types for native callers. The package name is quprs; pathsum remains the name of a Rust source directory and a compatibility namespace in older integrations. See the Rust crate reference and native Rust usage guide. The separate Rust CLI provides command-line input and process execution.
Verification paths
- Reduction rules: try to establish a verdict by simplifying Path-sum expressions.
- Weighted model counting: use an explicitly selected solver to classify a weighted count.
- Hybrid: pass the residual Path-sum to WMC if reduction is inconclusive.
GPMC and Ganak are independent solver choices; solver failures do not silently imply equivalence or inequivalence. WMC numerical verdicts must be interpreted separately from exact source semantics and certified accuracy.
See the Python API for parameters and return types, and Verification for result classifications.