Skip to main content

DOI PyPI version Python Version codecov License

Docker Pulls PyPI Downloads GitHub last commit Ask DeepWiki

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:
    1. Hybrid mode (RR + WMC): Combines the efficiency of reduction rules and the completeness of weighted model counting.
    2. Reduction rules only (RR): Extremely fast, suitable for circuits that can be simplified by local rules.
    3. WMC only: A powerful SAT-based method for more complex circuit structures.
  • Seamless integration with Qiskit ecosystem: Circuits can be directly loaded from Qiskit QuantumCircuit objects or QASM files.

Contents

Installation

It is recommended to install QuPRS in a virtual environment.

  1. Create and activate a Conda virtual environment:

    conda create --name QuPRS python=3.12 # Or your preferred Python version
    conda activate QuPRS
    
  2. Install QuPRS using 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 QuantumCircuit objects:
    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 consider citing it.

This code is associated with a forthcoming publication. Please cite this repository for now, and check back for the full paper citation.

DOI

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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for QuPRS 0.13.0
File Size Uploaded Provenance Actions
quprs-0.13.0.tar.gz 1.5 MB With provenance Details for quprs-0.13.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for QuPRS 0.13.0
File Actions
quprs-0.13.0-cp38-abi3-manylinux_2_28_x86_64.whl CPython 3.8 abi3 Linux glibc 2.28+ x86-64 Details for quprs-0.13.0-cp38-abi3-manylinux_2_28_x86_64.whl
quprs-0.13.0-cp38-abi3-manylinux_2_28_aarch64.whl CPython 3.8 abi3 Linux glibc 2.28+ ARM64 Details for quprs-0.13.0-cp38-abi3-manylinux_2_28_aarch64.whl
quprs-0.13.0-cp38-abi3-macosx_15_0_x86_64.whl CPython 3.8 abi3 macOS 15.0+ x86-64 Details for quprs-0.13.0-cp38-abi3-macosx_15_0_x86_64.whl
quprs-0.13.0-cp38-abi3-macosx_14_0_arm64.whl CPython 3.8 abi3 macOS 14.0+ ARM64 Details for quprs-0.13.0-cp38-abi3-macosx_14_0_arm64.whl

Total release size: 87.1 MB

Release files / quprs-0.13.0.tar.gz

Download URL quprs-0.13.0.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
c04ae5e1e4decde40e4433792b7c07fba1d1ea5e90aa8c1de03a10a3e5c46deb
BLAKE2b-256 checksum
How to use checksums
105b7452853db103e928c773244670a8252a935a2d1547ea68a890897f3303bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 18, 2026.

Transparency log

Release files / quprs-0.13.0-cp38-abi3-manylinux_2_28_x86_64.whl

Download URL quprs-0.13.0-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
51b6e2e15b262e955e64256e1beba1c04352e2642cce6c39f2bf20401eda78a2
BLAKE2b-256 checksum
How to use checksums
34bcbe4de4531ce5ce8befcd9e227c048e8c5e86713412af930086dcda416bcb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 18, 2026.

Transparency log

Release files / quprs-0.13.0-cp38-abi3-manylinux_2_28_aarch64.whl

Download URL quprs-0.13.0-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
d0d851b61e620a1c46baa5627df35b0e2682844acce98d47371a00c1078dc89d
BLAKE2b-256 checksum
How to use checksums
c471aa9790a7ac193f191f24dd403f7fed8a9cb64ddf7c43dabea3faa77b1973
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 18, 2026.

Transparency log

Release files / quprs-0.13.0-cp38-abi3-macosx_15_0_x86_64.whl

Download URL quprs-0.13.0-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
ecd8c3bb9511989cf39801e8238268beead822f4672941b2b099d25c1dc50261
BLAKE2b-256 checksum
How to use checksums
6d89981550601793be8f1305e307e4a278e2ddbfbaadf3d50ea2aac7ec7747dc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 18, 2026.

Transparency log

Release files / quprs-0.13.0-cp38-abi3-macosx_14_0_arm64.whl

Download URL quprs-0.13.0-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
a7b39f277bf7a7e0517feb29a93f2e53ba057fe6e311927f1e2c5e86150d4d6e
BLAKE2b-256 checksum
How to use checksums
28c56fa108010bd6e30a9cdaac6b692812bddd5ed9989dfb238bbd06fad698c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Mar 18, 2026.

Transparency log

Security for QuPRS 0.13.0

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.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for quprs-0.13.0.tar.gz

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 Mar 18, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.13.0 This release

5 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page