Skip to main content

pydepqbf: bindings to DepQBF (a QBF solver)

Authors:

A lot of Python binding code and documentation has been lifted from PycoSAT <https://pypi.python.org/pypi/pycosat>

DepQBF is owned by Florian Lonsing <http://lonsing.github.io/depqbf/>

The pydepqbf Python module is distributed under the same terms as DepQBF.

Abstract

DepQBF is an efficient QBF solver written by Florian Lonsing in pure C. This package provides efficient Python bindings to DepQBF on the C level, i.e., when importing pydepqbf, the DepQBF solver becomes part of the Python process itself.

Usage

The pydepqbf module has one function: solve.

The function solve returns a tuple containing two elements. The first element is an integer, that is either QDPLL_RESULT_SAT or QDPLL_RESULT_UNSAT or QDPLL_RESULT_UNKNOWN. The second element contains a partial certificate for the input problem. If the outermost (leftmost) quantifier block of a satisfiable QBF is existentially quantified, then the partial certificate is an assignment to the variables of this block (and dual for unsatisfiable QBFs and universal variables from the outermost block, if that block is universally quantified). The partial certificate is None if the outermost block of a satisfiable QBF is universally quantified or if the outermost block of an unsatisfiable QBF is existentially quantified.

Example

Let us consider the following problem, represented by using the QDIMACS QDIMACS format:

p cnf 5 3
a 1 2 0
e 3 4 0
-1 -3 0
1 2 4 0
1 -4 0

Here, we have 4 variables and 3 clauses, the first clause being (not x1 or not x3). In Python, each clause is most conveniently represented as a list of integers. Naturally, it makes sense to represent each solution also as a list of integers, where the sign corresponds to the Boolean value (+ for True and - for False) and the absolute value corresponds to ith variable:

>>> from pydepqbf import solve, QDPLL_QTYPE_FORALL, QDPLL_QTYPE_EXISTS
>>> quantifiers = ((QDPLL_QTYPE_FORALL, (1, 2)), (QDPLL_QTYPE_EXISTS, (3, 4)))
>>> clauses = ((-1, -3), (1, 2, 4), (1, -4))
>>> solve(quantifiers, clauses)
(20, [-1, -2])

The first element of the resulting pair is 20 (defined as QDPLL_RESULT_UNSAT in the pydepqbf package) and the partial certificate translates to: x1 = x2 = False.

Metadata

Release files for pydepqbf 0.0.2

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

Source distribution (sdist)

Source distribution for pydepqbf 0.0.2
File Size Uploaded Provenance Actions
pydepqbf-0.0.2.tar.gz 325.6 kB Without provenance Details for pydepqbf-0.0.2.tar.gz

Release files / pydepqbf-0.0.2.tar.gz

Download URL pydepqbf-0.0.2.tar.gz
Size 325.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7f762764a19db42fbe154216d75eca07953abe29905f4d0b6ff2af8fbf93e802
BLAKE2b-256 checksum
How to use checksums
5bc6b56208db66b807eeaa8151a9085955e058a1991b5f43f9f21f0bfaf1a37d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for pydepqbf 0.0.2

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.0.2 This release

1 release file No 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