krobelus / rate

DRAT/DPR proof checker
MIT License
9 stars 1 forks source link
proof-checker rust sat-solver verification

rate

crates.io CircleCI branch

This is a proof checker that can verify proofs for SAT instances, just like fellow checkers drat-trim, dpr-trim or gratgen. The notable difference is that rate does not ignore deletions of unit clauses by default. You can cite our CPP 2020 conference paper (bibtex record here) which describes the problem that rate tries to solve.

Features

Installation

Install Rust. Recent versions of stable Rust are supported (1.36 or later).

Stable version

Releases are hosted on crates.io and can be installed using cargo, Rust's package manager.

$ cargo install rate --force

After this has finished compiling, it will place the rate binary in ~/.cargo/bin/.

Building from source

Alternatively, you can install the development version from a checkout of this repository:

$ git clone https://github.com/krobelus/rate
$ cd rate
$ cargo install --path ./rate --force

Usage

Run the proof checker like this:

$ rate formula.cnf proof.drat

Whenever the proof is accepted, this will exit with code 0 after printing s VERIFIED and some metrics. See rate --help for more options.

SICK certificates

If rate rejects a proof, it checks a certificate of incorrectness that contains information on which proof step failed and why. The certificate can be written to a file with the -S option and checked separately with the sick-check binary which is much faster than a full proof checker (install sick-check using cargo install rate-sick-check for a stable version, or cargo install --path rate-sick-check to install from a local checkout). These certificates are useful to protect against bugs in the checker code.

Other utilities

Install the crate rate-proof-utils (just like rate or rate-sick-check) for some binaries that can be useful when working with clausal proofs:

Unexpected rejections

If you are using a solver based on MiniSat, then your proof might be rejected by rate while it is accepted by other checkers, like drat-trim. This is because the proof can contain some clause deletions that are ignored by other checkers. There are two options:

  1. Use rate --skip-unit-deletions to make it behave like other checkers.

  2. Alternatively, you can patch your solver to not generate those extra deletions. This will make the proof valid for every checker. Look for reason deletions shrinking trail in the output of rate; this is the number of deletions in the proof that delete information - it should probably be zero, unless you are using certain advanced inprocessing techniques. Example patches that avoid these deletions: MiniSat (1 or 2) and MapleLCMDistChronoBT (1 or 2).

Caveats

Please note that rate accepts proofs that are technically not fully correct. Just like other checkers, we perform some transformations on the proof before actually verifying the proofs steps. This is done to improve performance. These transformations can ignore unnecessary clauses or proof steps. These are effectively removed from the formula or proof, respectively. This means that rate might accept a proof that contains lemmas that are not valid inferences, but this should never happen for satisfiable formulas.

Here are the transformations we do:

Tests

Run unit tests and the system test suite, respectively:

cargo test && ./test.py

You can also selectively run tests, for example use ./test.py -k default benchmarks/crafted benchmarks/sadical/add4.cnf to only run test functions matching default on the crafted benchmarks and on add4.{cnf,dpr}. See ./test.py -h for more options.

Above tests require

You can use the docker image used by our CI which contains builds of above dependencies.

Documentation

Refer to our CPP 2020 conference paper or my thesis for some background information.

The source code includes an abundance of doc comments. Use this command to turn them into internal documentation at target/doc/rate*/index.html.

$ cargo doc --document-private-items --no-deps

Contributing

Please let us know if rate behaves in a way that is unexpected to you, or if you need some feature. We currently do not guarantee stability of the library modules in rate-common (only the binaries are considered an API), but we can integrate more tools that work on proofs in this repository.

Roadmap

Some possible improvements: