QuPRS: Quantum Path-sum Reduction and Solver
QuPRS("kyu-parse") is a tool for Quantum Circuit tool integrate Path-sum Reduction and Solver.
In quantum computing, verifying whether an optimized or compiled quantum circuit is functionally equivalent to the original circuit is a crucial task. QuPRS aims to solve this problem, and its features include:
- Novel verification method: Based on pathsum, which is a circuit representation method different from traditional matrix products.
- Multiple verification strategies:
- Hybrid mode (RR + WMC): Combines the efficiency of reduction rules and the completeness of weighted model counting.
- Reduction rules only (RR): Extremely fast, suitable for circuits that can be simplified by local rules.
- WMC only: A powerful SAT-based method for more complex circuit structures.
- Seamless integration with Qiskit ecosystem: Circuits can be directly loaded from Qiskit
QuantumCircuitobjects or QASM files.
Contents
Installation
It is recommended to install QuPRS in a virtual environment.
-
Create and activate a Conda virtual environment:
conda create --name QuPRS python=3.12 # Or your preferred Python version conda activate QuPRS
-
Install
QuPRSusing pip:pip install QuPRS
Platform Support
QuPRS provides pre-built wheels for the following operating systems and architectures:
| OS | Architecture | Status | Note |
|---|---|---|---|
| Linux | x86_64 | ✅ Supported | Tested on Ubuntu |
| Linux | ARM64 (aarch64) | ✅ Supported | Tested on Ubuntu |
| macOS | Intel (x86_64) | ✅ Supported | macOS 15+ |
| macOS | Apple Silicon (M1/M2/M3) | ✅ Supported | macOS 14+ |
| Windows | x86_64 / ARM64 | ⚠️ WSL2 Only | Please use WSL2 |
Using QuPRS
This tool can build quantum circuit using path-sum formulation.
First, import the necessary components from the QuPRS library.
from QuPRS.pathsum import PathSum
Create pathsum Circuit
Create a pathsum Circuit
You can create a PathSum.QuantumCircuit object directly:
qubit_num = 2
circuit = PathSum.QuantumCircuit(qubit_num)
circuit = circuit.h(0) # Apply Hadamard gate to qubit 0
circuit = circuit.h(0) # Apply Hadamard gate to qubit 0 again (H*H = I)
# Add more gates as needed
# e.g., circuit = circuit.cx(0, 1)
Import From qasm
pathsum supports importing circuits from QASM files or strings.
From a QASM file:
filename = "my_circuit.qasm"
# Ensure my_circuit.qasm exists and contains valid QASM code
# Example my_circuit.qasm:
# OPENQASM 2.0;
# include "qelib1.inc";
# qreg q[2];
# h q[0];
# cx q[0],q[1];
circuit = PathSum.load_from_qasm_file(filename)
Or
qasm_str = """
OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
h q[0];
cx q[0],q[1];
"""
circuit = PathSum.load_from_qasm_str(qasm_str)
Equivalence Checking
QuPRS provides tools for checking the equivalence of two quantum circuits, potentially imported from Qiskit or QASM files.
Importing Circuits for Equivalence Checking You can load circuits from QASM files or define them directly using Qiskit for comparison.
Circuit Prepare
- Load from QASM files
# Assuming circuit1.qasm and circuit2.qasm exist from QuPRS.interface.load_qiskit import load_circuit circuit1 = load_circuit("circuit1.qasm") circuit2 = load_circuit("circuit2.qasm")
- Direct import from Qiskit
QuantumCircuitobjects:from qiskit import QuantumCircuit # Define circuit1 using Qiskit circuit1 = QuantumCircuit(2) circuit1.h(1) circuit1.cx(0, 1) circuit1.h(1) # Define circuit2 using Qiskit circuit2 = QuantumCircuit(2) circuit2.cz(0, 1)
Run Equivalence Checking
-
Hybrid: Reduction Rules (RR) and Weighted Model Counting (WMC)
This method combines RR with WMC for equivalence checking.
from QuPRS import check_equivalence result = check_equivalence(circuit1, circuit2, method = "hybrid",)
-
Using Reduction Rules (RR)
from QuPRS import check_equivalence result = check_equivalence(circuit1, circuit2, method = "reduction_rules",)
-
WMC only (without RR)
To perform equivalence checking using only WMC, you need to disable the Reduction Rules switch.
from QuPRS import check_equivalence result = check_equivalence(circuit1, circuit2, method = "wmc_only",)
Cite
If you use QuPRS in your research, please cite our paper:
Equivalence Checking of Quantum Circuits via Path-Sum and Weighted Model Counting
Wei-Jia Huang, Christophe Chareton, Yu-Fang Chen, Kai-Min Chung, Min-Hsiu Hsieh, Alfons Laarman, and Jingyi Mei.
In Tools and Algorithms for the Construction and Analysis of Systems (TACAS 2026), Lecture Notes in Computer Science, vol. 15668, pp. 419–439. Springer, 2026.
DOI: 10.1007/978-3-032-22749-2_21
@inproceedings{huang2026equivalence,
author = {Huang, Wei-Jia and Chareton, Christophe and Chen, Yu-Fang and Chung, Kai-Min and Hsieh, Min-Hsiu and Laarman, Alfons and Mei, Jingyi},
title = {Equivalence Checking of Quantum Circuits via Path-Sum and Weighted Model Counting},
booktitle = {Tools and Algorithms for the Construction and Analysis of Systems (TACAS 2026)},
series = {Lecture Notes in Computer Science},
pages = {419--439},
year = {2026},
publisher = {Springer Nature Switzerland},
doi = {10.1007/978-3-032-22749-2_21},
url = {https://doi.org/10.1007/978-3-032-22749-2_21}
}
You can also cite this software repository via Zenodo:
License Information
-
The original source code of this project is licensed under the MIT License.
-
This project utilizes and depends on several third-party components and libraries, which are governed by their own licenses. For detailed copyright notices and the full license texts of these components, please see the NOTICE.md file.
Acknowledgements
This project utilizes gpmc, a binary component developed by Kenji Hashimoto, for parts of its Weighted Model Counting functionality.
Metadata
Release files for QuPRS 0.13.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| quprs-0.13.1.tar.gz | 1.5 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| quprs-0.13.1-cp38-abi3-manylinux_2_28_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.28+ x86-64 | Details |
| quprs-0.13.1-cp38-abi3-manylinux_2_28_aarch64.whl | CPython 3.8 | abi3 | Linux glibc 2.28+ ARM64 | Details |
| quprs-0.13.1-cp38-abi3-macosx_15_0_x86_64.whl | CPython 3.8 | abi3 | macOS 15.0+ x86-64 | Details |
| quprs-0.13.1-cp38-abi3-macosx_14_0_arm64.whl | CPython 3.8 | abi3 | macOS 14.0+ ARM64 | Details |
Total release size: 87.1 MB
Release files / quprs-0.13.1.tar.gz
| Download URL | quprs-0.13.1.tar.gz |
|---|---|
| Size | 1.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e4c9cacade88380e01b27bb0856ae6718c513094a3929a17e61f37753a3e9bc2
|
|
BLAKE2b-256 checksum How to use checksums |
f8349b3cf4c380d40204f94165059e4f7c21ad227444e85baccdfb593d0afe01
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency logRelease files / quprs-0.13.1-cp38-abi3-manylinux_2_28_x86_64.whl
| Download URL | quprs-0.13.1-cp38-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 33.7 MB |
| Tags | CPython 3.8 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
eed0ceaba8a2f1c3ba5fd32ec2f23aaa06c7b4a654dd4a411d54c99a714027d7
|
|
BLAKE2b-256 checksum How to use checksums |
c107fca5b88edecdb03b69021a7c3945ee0ee7115cc975be0348f9c35dee7000
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency logRelease files / quprs-0.13.1-cp38-abi3-manylinux_2_28_aarch64.whl
| Download URL | quprs-0.13.1-cp38-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 32.4 MB |
| Tags | CPython 3.8 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
a184b2f6adfc693b99925693b5c66ed01dc2622c20663bc31e8959dad7f56e41
|
|
BLAKE2b-256 checksum How to use checksums |
2c3707374b9856f8b26329d00d32eda2a5a02a31f600f196860279fe7aa4b23d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency logRelease files / quprs-0.13.1-cp38-abi3-macosx_15_0_x86_64.whl
| Download URL | quprs-0.13.1-cp38-abi3-macosx_15_0_x86_64.whl |
|---|---|
| Size | 10.3 MB |
| Tags | CPython 3.8 abi3 macOS 15.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
e2b82fea1282e69a6cf2f921084ad0d1ba03294454238c37b0d195ae85203c42
|
|
BLAKE2b-256 checksum How to use checksums |
3ea9df8e2b928a3f20a42591abedf6927441819e250555738c0f426fcbc692ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency logRelease files / quprs-0.13.1-cp38-abi3-macosx_14_0_arm64.whl
| Download URL | quprs-0.13.1-cp38-abi3-macosx_14_0_arm64.whl |
|---|---|
| Size | 9.2 MB |
| Tags | CPython 3.8 abi3 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
73d98d841857149c0d07951f13d426ca1729e208f6d2194ca4bf2ffbe12cd980
|
|
BLAKE2b-256 checksum How to use checksums |
d816fb68dc3956c492243bdddb2f057615264e755d997b98dd0c9fdf2c7323dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 24, 2026.
Transparency log