{"id":13831180,"url":"https://github.com/stp/stp","last_synced_at":"2025-07-09T13:32:34.303Z","repository":{"id":10278174,"uuid":"12393467","full_name":"stp/stp","owner":"stp","description":"Simple Theorem Prover, an efficient SMT solver for bitvectors","archived":false,"fork":false,"pushed_at":"2024-07-16T07:11:42.000Z","size":34750,"stargazers_count":498,"open_issues_count":51,"forks_count":128,"subscribers_count":34,"default_branch":"master","last_synced_at":"2024-08-05T10:16:13.150Z","etag":null,"topics":["cnf","cryptography","sat-solver","smt","symbolic-execution","verification"],"latest_commit_sha":null,"homepage":"https://stp.github.io/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stp.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-08-27T00:53:59.000Z","updated_at":"2024-07-26T15:58:57.000Z","dependencies_parsed_at":"2024-07-16T09:24:09.315Z","dependency_job_id":null,"html_url":"https://github.com/stp/stp","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stp%2Fstp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stp%2Fstp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stp%2Fstp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stp%2Fstp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stp","download_url":"https://codeload.github.com/stp/stp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225553307,"owners_count":17487293,"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":["cnf","cryptography","sat-solver","smt","symbolic-execution","verification"],"created_at":"2024-08-04T10:01:21.137Z","updated_at":"2024-11-20T12:31:18.682Z","avatar_url":"https://github.com/stp.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Windows build](https://ci.appveyor.com/api/projects/status/35983b7cnrg37whk?svg=true)](https://ci.appveyor.com/project/msoos/stp)\n[![Documentation](https://readthedocs.org/projects/stp/badge/?version=latest)](https://stp.readthedocs.io/en/latest/?badge=latest)\n[![Coverity](https://scan.coverity.com/projects/861/badge.svg)](https://scan.coverity.com/projects/861)\n\n# STP\n\nSTP is a constraint solver (or SMT solver) aimed at solving constraints of bitvectors and arrays. These types of constraints can be generated by program analysis  tools, theorem provers, automated bug finders, cryptographic attack tools, intelligent fuzzers, model checkers, and by many other applications.\n\n* Homepage:      https://stp.github.io/\n* Ubuntu PPA:    https://launchpad.net/~simple-theorem-prover/+archive/ubuntu/ppa/+packages\n* Docker image:  `docker pull msoos/stp`\n\n\n## Build and install\n\nFor a quick install:\n\n```\nsudo apt-get install git cmake bison flex libboost-all-dev libgmp-dev python2 perl\ngit clone https://github.com/stp/stp\ncd stp\ngit submodule init \u0026\u0026 git submodule update\n./scripts/deps/setup-gtest.sh\n./scripts/deps/setup-outputcheck.sh\n./scripts/deps/setup-cms.sh\n./scripts/deps/setup-minisat.sh\nmkdir build\ncd build\ncmake ..\ncmake --build .\nsudo cmake --install .\n```\n\nOr, using [Homebrew](https://brew.sh):\n```\nbrew install stp\n```\n\nFor more detailed instructions, see towards the end of the page.\n\n\n## Input format\n\nThe [SMT-LIB2](https://smtlib.cs.uiowa.edu/language.shtml) format is the recommended file format, because it is parsed by all modern bitvector solvers. Only quantifier-free bitvectors and arrays are implemented from the SMT-LIB2 format.\n\n### Usage\n\nRun with an SMT-LIB2 file:\n```\nstp myproblem.smt2\n```\n\nOverflowing a 32-bit integer using the python interface:\n```\nimport stp\nIn [1]: import stp\nIn [2]: a = stp.Solver()\nIn [3]: x = a.bitvec('x')\nIn [4]: y = a.bitvec('y')\nIn [5]: a.add(x + y \u003c 20)\nIn [6]: a.add(x  \u003e 10)\nIn [7]: a.add(y  \u003e 10)\nIn [8]: a.check()\nOut[8]: True\nIn [9]: a.model()\nOut[9]: {'x': 4294967287L, 'y': 11L}\n```\n\nWith Docker:\n```\ndocker pull msoos/stp\necho \"(set-logic QF_BV)\n(assert (= (bvsdiv (_ bv3 2) (_ bv2 2)) (_ bv0 2)))\n(check-sat)\n(exit)\" | docker run --rm -i msoos/stp\n```\n\n## Architecture\n\nThe system performs word-level preprocessing followed by translation to SAT which is then solved by a SAT solver. In particular, we introduce several new heuristics for the preprocessing step, including abstraction-refinement in the context of arrays, a new bitvector linear arithmetic equation solver, and some interesting simplifications. These heuristics help us achieve several magnitudes of order performance over other tools, and also over straight-forward translation to SAT. STP has been heavily tested on thousands of examples sourced from various real-world applications such as program analysis and bug-finding tools like EXE, and equivalence checking tools and theorem-provers.\n\n\n## Detailed Building and Installation\n\nSTP is built with [CMake](https://cmake.org/), version 3.0.2 or newer. CMake is a\nmeta build system that generates build files for other tools such as\nmake(1), Visual Studio, Xcode, etc.\n\n### Configuration variables\nHere are a few interesting configuration variables. These apply to all\ngenerators.\n\n- `CMAKE_BUILD_TYPE` - The build type (e.g. Release)\n- `CMAKE_INSTALL_PREFIX` - The prefix for install (e.g. /usr/local )\n- `ENABLE_ASSERTIONS` - If TRUE STP will be built with asserts.\n- `ENABLE_TESTING` - Enable running tests\n- `ENABLE_PYTHON_INTERFACE` - Enable building the Python interface\n- `PYTHON_EXECUTABLE` - Set python executable in case you have more than one python installed\n- `SANITIZE` - Use Clang's sanitization checks\n- `STATICCOMPILE` - Build static libraries and binaries instead of dynamic\n\n### Dependencies\nSTP relies on : boost, flex, bison and minisat. You can install these by:\n\n```\n$ sudo apt-get install cmake bison flex libboost-all-dev python perl minisat\n```\n\nIf your distribution does not come with minisat, STP maintains an updated fork. It can be built as follows:\n\n```\n$ git clone https://github.com/stp/minisat\n$ cd minisat\n$ mkdir build \u0026\u0026 cd build\n$ cmake ..\n$ cmake --build .\n$ sudo cmake --install .\n$ command -v ldconfig \u0026\u0026 sudo ldconfig\n```\n\nSTP uses minisat as its SAT solver by default but it also supports other SAT solvers including CryptoMiniSat as an optional extra. If installed, it will be detected during the cmake and used:\n\n```\n$ git clone https://github.com/msoos/cryptominisat\n$ cd cryptominisat\n$ mkdir build \u0026\u0026 cd build\n$ cmake ..\n$ cmake --build .\n$ sudo cmake --install .\n$ command -v ldconfig \u0026\u0026 sudo ldconfig\n```\n\nAlternatively, these commands are pre-configused in `scripts/deps/setup-minisat.sh` and `scripts/deps/setup-cms.sh` (respectively).\n\n#### Building against non-installed libraries\n\nIf you wish to build STP's dependencies without installing them, you can tell CMake where to find the non-installed artefacts. For example:\n\n* `-DMINISAT_INCLUDE_DIRS:PATH=\u003cpath\u003e` and `-DMINISAT_LIBDIR:PATH=\u003cpath\u003e` -- the paths to `minisat/core/Solver.h` and the `minisat` libraries (respectively)\n* `-Dcryptominisat5_DIR:PATH=\u003cpath\u003e` -- the path to `cryptominisat5Config.cmake`\n\nIf you did not install these development libraries, then `MINISAT_LIBDIR` can be set to your `build` folder for minisat and `cryptominisat5_DIR` to your `build` folder for CryptoMiniSat.\n\n### Building a static library and binary\n\n```\n$ mkdir build \u0026\u0026 cd build\n$ cmake -DSTATICCOMPILE=ON ..\n$ cmake --build .\n$ sudo cmake --install .\n$ command -v ldconfig \u0026\u0026 sudo ldconfig\n```\n\n### Configuration and build options\n\nTo tweak the build configuration:\n\n* Run `cmake-gui /path/to/stp/source/root` instead of `cmake`. This\n  user interface lets you control the value of various configuration\n  variables and lets you pick the build system generator.\n\n* Run `ccmake` instead of `cmake`. This provides an ncurses terminal\n  interface for changing configuration variables.\n\n* Pass `-D\u003cVARIABLE\u003e=\u003cVALUE\u003e` options to `cmake` (not very user friendly).\n  It is probably best if you **only** configure this way if you are writing\n  scripts.\n\nYou can also tweak configuration later by running `make edit_cache` and edit any configuration variables, reconfigure and then regenerate the build system. After configuration, build by running `make`.\n\nYou can use the `-j\u003cn\u003e` flag to significantly to decrease build time by running `\u003cn\u003e` jobs in parallel (e.g. `make -j4`).\n\n### Testing\n\n```\ngit clone https://github.com/stp/stp\ngit submodule update --init\npip install lit\nmkdir build\ncd build\ncmake -DENABLE_TESTING=ON ..\nmake\nmake test\n```\n\n### Installing\n\nTo install run `make install` and to uninstall run `make uninstall`. The root of installation is controlled by the `CMAKE_INSTALL_PREFIX` variable at configure time. You can change this by running `make edit_cache` and editing the value of `CMAKE_INSTALL_PREFIX`.\n\n\n### Building on Windows/Visual Studio\n\nYou will need to install [cmake](https://cmake.org/download/) and follow the steps that AppVeyor [follows](https://github.com/stp/stp/blob/master/appveyor.yml). In case you need the static binary, you can always access it as a binary artifact at the [AppVeyor build page](https://ci.appveyor.com/project/msoos/stp). In case you still have trouble, please see the mini-HOWTO [at issue #319](https://github.com/stp/stp/issues/319).\n\n### Building Docker\n\n```\ngit clone https://github.com/stp/stp\ncd stp\ndocker build -t stp .\necho \"(set-logic QF_BV)\n(assert (= (bvsdiv (_ bv3 2) (_ bv2 2)) (_ bv0 2)))\n(check-sat)\n(exit)\" | docker run --rm -i stp\n```\n\n\n# Authors\n\n* Vijay Ganesh\n* Trevor Hansen\n* Mate Soos\n* Dan Liew\n* Ryan Govostes\n* Andrew V. Jones\n* And many others...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstp%2Fstp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstp%2Fstp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstp%2Fstp/lists"}