{"id":13748962,"url":"https://github.com/krobelus/rate","last_synced_at":"2025-03-17T17:30:54.458Z","repository":{"id":55415081,"uuid":"159724819","full_name":"krobelus/rate","owner":"krobelus","description":"DRAT/DPR proof checker","archived":false,"fork":false,"pushed_at":"2022-02-12T05:44:34.000Z","size":5950,"stargazers_count":9,"open_issues_count":14,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-22T20:33:31.002Z","etag":null,"topics":["proof-checker","rust","sat-solver","verification"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krobelus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-29T20:41:57.000Z","updated_at":"2023-08-15T11:04:09.000Z","dependencies_parsed_at":"2022-08-14T23:50:38.073Z","dependency_job_id":null,"html_url":"https://github.com/krobelus/rate","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krobelus%2Frate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krobelus%2Frate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krobelus%2Frate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krobelus%2Frate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krobelus","download_url":"https://codeload.github.com/krobelus/rate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243871904,"owners_count":20361380,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["proof-checker","rust","sat-solver","verification"],"created_at":"2024-08-03T07:00:53.287Z","updated_at":"2025-03-17T17:30:52.572Z","avatar_url":"https://github.com/krobelus.png","language":"Rust","funding_links":[],"categories":["Projects"],"sub_categories":["Verification"],"readme":"# rate\n\n[![crates.io](https://img.shields.io/crates/v/rate.svg)](https://crates.io/crates/rate)\n[![CircleCI branch](https://img.shields.io/circleci/project/github/krobelus/rate/master.svg)](https://circleci.com/gh/krobelus/rate/tree/master)\n![](https://img.shields.io/crates/l/rate.svg)\n\nThis is a proof checker that can verify proofs for [SAT\ninstances](https://en.wikipedia.org/wiki/Boolean_satisfiability_problem),\njust like fellow checkers\n[`drat-trim`](https://github.com/marijnheule/drat-trim),\n[`dpr-trim`](https://github.com/marijnheule/dpr-trim) or\n[`gratgen`](http://www21.in.tum.de/~lammich/grat/).  The notable\ndifference is that `rate` does not [ignore deletions of unit\nclauses](https://github.com/marijnheule/drat-trim#clause-deletion-details)\nby default.  You can cite our [CPP 2020 conference paper] (bibtex record\n[here](https://dblp.uni-trier.de/rec/bibtex/conf/cpp/AltmanningerP20))\nwhich describes the problem that `rate` tries to solve.\n\n# Features\n- check [DRAT](http://www.cs.cmu.edu/~mheule/publications/drat-trim.pdf)\n  proofs (default) and\n  [DPR](http://www.cs.cmu.edu/~mheule/publications/spr.pdf) proofs (file\n  extension`.pr` or `.dpr`)\n- competitive performance (faster than `drat-trim` and `dpr-trim`, almost as\n  fast as `gratgen`)\n- output a trimmed proof as DRAT, DPR, LRAT or GRAT after verifying a proof\n- check and output a SICK certificate of incorrectness after rejecting a proof\n- optionally ignore unit deletions for compatibility with `drat-trim`\n  (flag `--skip-unit-deletions`)\n- transparently read compressed input files (Gzip, Zstandard, Bzip2, XZ, LZ4)\n- detect and report many errors like numeric overflows\n- mostly safe Rust, should not have any undefined behavior\n\n# Installation\n\nInstall [Rust](https://www.rust-lang.org/en-US/install.html).  Recent versions\nof stable Rust are supported (1.36 or later).\n\n## Stable version\n\nReleases are hosted on [crates.io](https://crates.io/) and can be\ninstalled using `cargo`, Rust's package manager.\n\n```sh\n$ cargo install rate --force\n```\n\nAfter this has finished compiling, it will place the `rate` binary in\n`~/.cargo/bin/`.\n\n## Building from source\n\nAlternatively, you can install the development version from a checkout of this\nrepository:\n\n```sh\n$ git clone https://github.com/krobelus/rate\n$ cd rate\n$ cargo install --path ./rate --force\n```\n\n# Usage\n\nRun the proof checker like this:\n```sh\n$ rate formula.cnf proof.drat\n```\n\nWhenever the proof is accepted, this will exit with code 0 after printing\n`s VERIFIED` and some metrics. See `rate --help` for more options.\n\n## SICK certificates\n\nIf `rate` rejects a proof, it checks a certificate of incorrectness that\ncontains information on which proof step failed and why.  The certificate\ncan be written to a file with the `-S` option and checked separately with\nthe `sick-check` binary which is much faster than a full proof checker\n(install `sick-check` using `cargo install rate-sick-check` for a stable\nversion, or `cargo install --path rate-sick-check` to install from a\nlocal checkout). These certificates are useful to protect against bugs\nin the checker code.\n\n## Other utilities\n\nInstall the crate `rate-proof-utils` (just like `rate` or\n`rate-sick-check`) for some binaries that can be useful when working\nwith clausal proofs:\n\n- `drat2bdrat` and `bdrat2drat` convert a DRAT proof to the [Binary DRAT Format]\n  and vice versa. Also works for DPR proofs.\n- `apply-proof` applies a proof up to a given proof step, and outputs the\n  accumulated formula as well as the rest of the proof. This can be very\n  useful for delta-debugging a tool that works with proofs.\n\n[Binary DRAT Format]: \u003chttps://github.com/marijnheule/drat-trim#binary-drat-format\u003e\n\n# Unexpected rejections\n\nIf you are using a solver based on\n[MiniSat](https://github.com/niklasso/minisat), then your proof might\nbe rejected by `rate` while it is accepted by other checkers, like\n`drat-trim`. This is because the proof can contain some clause deletions\nthat are ignored by other checkers. There are two options:\n\n1. Use `rate --skip-unit-deletions` to make it behave like other checkers.\n\n2. Alternatively, you can patch your solver to not generate those extra\ndeletions.  This will make the proof valid for every checker.  Look for\n`reason deletions shrinking trail` in the output of `rate`; this is the\nnumber of deletions in the proof that delete information - it should\nprobably be zero, unless you are using certain advanced inprocessing\ntechniques.  Example patches that avoid these deletions: MiniSat\n([1](https://github.com/krobelus/minisat/commit/keep-locked-clauses) or\n[2](https://github.com/krobelus/minisat/commit/add-unit-before-deleting-locked-clause))\nand `MapleLCMDistChronoBT`\n([1](https://github.com/krobelus/MapleLCMDistChronoBT/commit/keep-locked-clauses)\nor\n[2](https://github.com/krobelus/MapleLCMDistChronoBT/commit/add-unit-before-deleting-locked-clause)).\n\n# Caveats\n\nPlease note that `rate` accepts proofs that are technically not fully\ncorrect.  Just like other checkers, we perform some transformations\non the proof before actually verifying the proofs steps.  This is done\nto improve performance.  These transformations can ignore unnecessary\nclauses or proof steps.  These are effectively removed from the formula\nor proof, respectively.  This means that `rate` might accept a proof\nthat contains lemmas that are not valid inferences, but this should\nnever happen for satisfiable formulas.\n\nHere are the transformations we do:\n- If `--skip-unit-deletions` is specified, then deletions of clauses that\n  are unit with respect to the accumulated formula are ignored, as in\n  `drat-trim` and `gratgen`.\n- When traversing the proof, we stop as soon as a conflict is inferred.\n  Any proof steps thereafter are ignored.  This means that an explicit empty\n  clause at the end of the proof is not required.\n- Clauses and lemmas that are not part of the reason for above conflict\n  are ignored, even if they could be resolution candidates, find an explanation\n  why this is sound [here].\n- RAT checks are done upon every possible pivot and not just the first literal\n  in a clause, unless `--assume-pivot-is-first` is specified.\n\n[here]: \u003chttp://www21.in.tum.de/~lammich/grat/gratgen-doc/Unmarked_RAT_Candidates.html\u003e\n\n# Tests\n\nRun unit tests and the system test suite, respectively:\n\n```sh\ncargo test \u0026\u0026 ./test.py\n```\n\nYou can also selectively run tests, for example use `./test.py -k default\nbenchmarks/crafted benchmarks/sadical/add4.cnf` to only run test functions\nmatching `default` on the crafted benchmarks and on `add4.{cnf,dpr}`. See\n`./test.py -h` for more options.\n\nAbove tests require\n- `python3` (version 3.6 or above)\n- optionally any of the following executables:\n  - [`lrat-check`](https://github.com/acl2/acl2/tree/master/books/projects/sat/lrat)\n    to validate the produced LRAT proofs.\n  - [`pr2drat`](https://github.com/marijnheule/pr2drat) to produce\n    DRAT and LRAT proofs from PR proofs.\n  - `gratchk` to validate produced GRAT proofs.\n  - If any of `drat-trim`, `rupee`, or `gratgen` are executable they will be\n    run on the benchmarks and their verdicts will be compared to the output of\n    `rate`.\n\nYou can use the [docker\nimage](https://cloud.docker.com/repository/docker/krobelus/rate-test-environment)\nused by our [CI](.circleci/config.yml) which contains [builds of above\ndependencies](scripts/test-environment/).\n\n# Documentation\n\nRefer to our [CPP 2020 conference paper] or my [thesis] for some\nbackground information.\n\n[CPP 2020 conference paper]: \u003chttps://dl.acm.org/doi/10.1145/3372885.3373821\u003e\n[thesis]: \u003chttps://github.com/krobelus/rate-experiments/blob/master/thesis.pdf\u003e\n\nThe source code includes an abundance of doc comments. Use this command\nto turn them into internal documentation at `target/doc/rate*/index.html`.\n```sh\n$ cargo doc --document-private-items --no-deps\n```\n\n# Contributing\n\nPlease let us know if `rate` behaves in a way that is unexpected to you,\nor if you need some feature.  We currently do not guarantee stability of the\nlibrary modules in `rate-common` (only the binaries are considered an API),\nbut we can integrate more tools that work on proofs in this repository.\n\n# Roadmap\n\nSome possible improvements:\n\n- expose a Rust (and possibly C) API\n- support other clausal proof formats\n- compute other features about clausal proofs (e.g. the lifespan of clauses)\n- speed up handling of reason clause deletions that do not shrink the trail\n- speed up RAT checks by caching resolution candidates\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrobelus%2Frate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrobelus%2Frate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrobelus%2Frate/lists"}