Skip to main content

Checks DRUP proofs against DIMACS source. Extracted from verified Why3 code.

Project description

Verified DRUP Proof Checker

As the title suggests, a verified implementation of a checker for propositional unsatisfiability proofs in the DRUP format that is produced by several solvers. The core of the checker is written in Why3, which is extracted to OCaml, compiled natively, and exported as a C library with Python bindings.

  • The checker does not support DRAT proofs, but this may be added in the future.
  • The current implementation is not optimized, and will be considerably slower than DRAT-trim on large proofs.
  • Accordingly, the frontend does not accept proofs in binary format.
  • There is currently no CLI, but one can be written as needed in a few minutes using the API described below.

The verification can be checked by running src/librupchecker/rup_pure.mlw in Why3. Most of the verification conditions complete with the Auto level 0 tactic, and the rest either with a few levels of splitting followed by Auto 0 or Auto 1, or simply with Auto 2. It was developed using Why3 1.5.1, Alt-Ergo 2.4.0, Z3 4.8.6, and CVC4 1.8. Verification has not been attempted with earlier versions of Why3 or the provers.

Installation

If you use a recent Linux distribution on x86_64, you should be able to install the compiled wheel from PyPI:

$ pip install drup

Otherwise, pip will attempt to extract and compile the library, which means that you need to have OCaml (>= 4.12), Why3 (>= 1.5.1), and Dune (>=2.9.3) installed. The most straightforward way to install these is to use opam, which is available in most package systems, and then install Why3 and Dune (a sufficiently recent version of OCaml should already be installed with Opam):

$ opam install why3 dune

If you do not intend to check the verification of the library or develop it further, then you do not need to install Why3's IDE or any of the solvers that it supports.

Once OCaml and Why3 are installed, you can use the pip command above to compile and install the library from source.

Usage

If you do not intend to use the Python bindings, then you will find the C shared object in the Python package directory:

$(PYTHON_PATH)/site-packages/rup/librupchecker.{so|dll}

The C library exposes two wrappers around the core checker:

int check_from_file(const char *dimacs_path, const char *drup_path);
int check_from_strings(const char *dimacs, const char *drup);

Before either of these can be called, the library must be initialized with a call to do_startup passing the current argv, which calls caml_startup:

int do_startup(char **argv);

Either function returns 0 if the proof is valid, and -1 otherwise.

The Python bindings expose these same functions, but will call do_startup automatically automatically when the package is imported, so there is no need to call it manually. If the arguments given to the Python bindings cannot be opened (in the case of files) or parsed, then they raise ValueError.

As described, the package is straightforward to use:

import drup

cnf = """
p cnf 4 8
 1  2 -3 0
-1 -2  3 0
 2  3 -4 0
-2 -3  4 0
 1  3  4 0
-1 -3 -4 0
-1  2  4 0
 1 -2 -4 0
"""

pf = """
1 2 0
1 0
2 0
0
"""

if drup.check_from_strings(cnf, pf) == 0:
    print("Valid")
else:
    print("Invalid")

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drup-1.0.1.tar.gz (238.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

drup-1.0.1-cp310-cp310-manylinux_2_35_x86_64.whl (240.9 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.35+ x86-64

drup-1.0.1-cp310-cp310-manylinux_2_17_x86_64.whl (719.1 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

drup-1.0.1-cp39-cp39-manylinux_2_35_x86_64.whl (240.9 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.35+ x86-64

drup-1.0.1-cp39-cp39-manylinux_2_17_x86_64.whl (719.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

drup-1.0.1-cp38-cp38-manylinux_2_35_x86_64.whl (241.0 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.35+ x86-64

drup-1.0.1-cp38-cp38-manylinux_2_17_x86_64.whl (719.2 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

File details

Details for the file drup-1.0.1.tar.gz.

File metadata

  • Download URL: drup-1.0.1.tar.gz
  • Upload date:
  • Size: 238.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for drup-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b64a7d7ed2b58012d2e99b57cbf0b92ad72093366c44e2bec6ec7a5e13bc2ba0
MD5 db6811c740aef255b3b046aefbeb3f58
BLAKE2b-256 30e551f3020f8c475fcb7ebd80e60418d40128e8c7ebb8cde83b6406d7aa1440

See more details on using hashes here.

File details

Details for the file drup-1.0.1-cp310-cp310-manylinux_2_35_x86_64.whl.

File metadata

File hashes

Hashes for drup-1.0.1-cp310-cp310-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 36f30388e032c8b72f0f4f9a8e36700b4bb0ba0dc5cb45d677aec5bf3604ee7d
MD5 9f928cab642a6670fd3738afab3cdf8d
BLAKE2b-256 e7580ba0dc69f1d5688299ab8502e11b2e89742aae2e8f80c545cb18071cab09

See more details on using hashes here.

File details

Details for the file drup-1.0.1-cp310-cp310-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for drup-1.0.1-cp310-cp310-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 15464cd23ca277b61a12fa54cd9231d08824fcd375338987de4848102737201b
MD5 5f90699a0eb3754bc7eecc70b9a1e1f2
BLAKE2b-256 379d33e5a5e7d427da69ab96c5b4243c3389f04698ebf7939ddc08fa568bb2cb

See more details on using hashes here.

File details

Details for the file drup-1.0.1-cp39-cp39-manylinux_2_35_x86_64.whl.

File metadata

  • Download URL: drup-1.0.1-cp39-cp39-manylinux_2_35_x86_64.whl
  • Upload date:
  • Size: 240.9 kB
  • Tags: CPython 3.9, manylinux: glibc 2.35+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for drup-1.0.1-cp39-cp39-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 f35ffeed34c38544703b55d6829b306e4f965692f11a0afc1eb05052446906eb
MD5 dd1632a80d8c7ae58c317d0e866ea77f
BLAKE2b-256 ce069f598232c3883f2e9bca183486bcd7b680ce0d7e0932e80ab4d7f32a5276

See more details on using hashes here.

File details

Details for the file drup-1.0.1-cp39-cp39-manylinux_2_17_x86_64.whl.

File metadata

  • Download URL: drup-1.0.1-cp39-cp39-manylinux_2_17_x86_64.whl
  • Upload date:
  • Size: 719.3 kB
  • Tags: CPython 3.9, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for drup-1.0.1-cp39-cp39-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9db78d0b6ccf4d5d105c873cd2544a5b842523819a73a4c4b1b206833a91c83a
MD5 f210e404e86ecb65e9fb5ffd8f04e2d0
BLAKE2b-256 c36269a52edf3b4490cfb2da15440986caf8fbcb04ce8679ebdbe2498f3378ed

See more details on using hashes here.

File details

Details for the file drup-1.0.1-cp38-cp38-manylinux_2_35_x86_64.whl.

File metadata

  • Download URL: drup-1.0.1-cp38-cp38-manylinux_2_35_x86_64.whl
  • Upload date:
  • Size: 241.0 kB
  • Tags: CPython 3.8, manylinux: glibc 2.35+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for drup-1.0.1-cp38-cp38-manylinux_2_35_x86_64.whl
Algorithm Hash digest
SHA256 b55b7f61259e7384cf31c63e9809748407c3b00bb7f4ced7a9437784a4d09a67
MD5 af1375edcf58cd928638746e81668d99
BLAKE2b-256 8443575d3ca29e15174fe63b6b8e2ea41f34539806ca89680e0d04282b7b0aec

See more details on using hashes here.

File details

Details for the file drup-1.0.1-cp38-cp38-manylinux_2_17_x86_64.whl.

File metadata

  • Download URL: drup-1.0.1-cp38-cp38-manylinux_2_17_x86_64.whl
  • Upload date:
  • Size: 719.2 kB
  • Tags: CPython 3.8, manylinux: glibc 2.17+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for drup-1.0.1-cp38-cp38-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 2c7abb49aef7a275f26a543c489affe1bdc7862fca73fdeac57f78d60b4265e1
MD5 0924db616f420eef49d2cfef66f3f22d
BLAKE2b-256 812da12daff4ae89162a6c9a34b82858e8320e4d9538cfef4b40affb29403913

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page