All Projects → stp → Stp

stp / Stp

Licence: other
Simple Theorem Prover, an efficient SMT solver for bitvectors

Projects that are alternatives of or similar to Stp

Alive2
Automatic verification of LLVM optimizations
Stars: ✭ 199 (-41.64%)
Mutual labels:  symbolic-execution, verification, smt
Symbiotic
Symbiotic is a tool for finding bugs in computer programs based on instrumentation, program slicing and KLEE
Stars: ✭ 212 (-37.83%)
Mutual labels:  symbolic-execution, verification
Sat smt by example
"SAT/SMT by example" free ebook
Stars: ✭ 339 (-0.59%)
Mutual labels:  verification, smt
Cryptominisat
An advanced SAT solver
Stars: ✭ 502 (+47.21%)
Mutual labels:  cryptography, verification
Triton
Triton is a Dynamic Binary Analysis (DBA) framework. It provides internal components like a Dynamic Symbolic Execution (DSE) engine, a dynamic taint engine, AST representations of the x86, x86-64, ARM32 and AArch64 Instructions Set Architecture (ISA), SMT simplification passes, an SMT solver interface and, the last but not least, Python bindings.
Stars: ✭ 1,934 (+467.16%)
Mutual labels:  symbolic-execution, smt
Manticore
Symbolic execution tool
Stars: ✭ 2,599 (+662.17%)
Mutual labels:  symbolic-execution, smt
Kremlin
KreMLin is a tool for extracting low-level F* programs to readable C code
Stars: ✭ 285 (-16.42%)
Mutual labels:  cryptography, verification
Liquidhaskell
Liquid Types For Haskell
Stars: ✭ 863 (+153.08%)
Mutual labels:  verification, smt
Hacl Star
HACL*, a formally verified cryptographic library written in F*
Stars: ✭ 1,360 (+298.83%)
Mutual labels:  cryptography, verification
Brightid
Reference mobile app for BrightID
Stars: ✭ 101 (-70.38%)
Mutual labels:  cryptography, verification
Smack
SMACK Software Verifier and Verification Toolchain
Stars: ✭ 305 (-10.56%)
Mutual labels:  verification, smt
Stainless
Verification framework and tool for higher-order Scala programs
Stars: ✭ 241 (-29.33%)
Mutual labels:  verification, smt
Fstar
A Proof-oriented Programming Language
Stars: ✭ 2,171 (+536.66%)
Mutual labels:  verification, smt
vigor
Main repository of the Vigor NF verification project.
Stars: ✭ 40 (-88.27%)
Mutual labels:  verification, symbolic-execution
Sbv
SMT Based Verification in Haskell. Express properties about Haskell programs and automatically prove them using SMT solvers.
Stars: ✭ 125 (-63.34%)
Mutual labels:  verification, smt
Ed25519 Dalek
Fast and efficient ed25519 signing and verification in Rust.
Stars: ✭ 383 (+12.32%)
Mutual labels:  cryptography, verification
Pysmt
pySMT: A library for SMT formulae manipulation and solving
Stars: ✭ 352 (+3.23%)
Mutual labels:  verification, smt
Ssri
Standard Subresource Integrity library for Node.js
Stars: ✭ 69 (-79.77%)
Mutual labels:  cryptography, verification
stevia
A simple (unfinished) SMT solver for QF_ABV.
Stars: ✭ 30 (-91.2%)
Mutual labels:  symbolic-execution, smt
Rel
Binsec/Rel is an extension of Binsec that implements relational symbolic execution for constant-time verification and secret-erasure at binary-level.
Stars: ✭ 27 (-92.08%)
Mutual labels:  verification, symbolic-execution

License: MIT Linux build Windows build Documentation Coverity Codacy Badge

STP

STP 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.

Build and install

For a quick install:

sudo apt-get install cmake bison flex libboost-all-dev python perl minisat
git clone https://github.com/stp/stp
git submodule init && git submodule update
cd stp
mkdir build
cd build
cmake ..
cmake --build .
sudo cmake --install .

For more detailed instructions, see towards the end of the page.

Input format

The file based input formats that STP reads are the: CVC, SMT-LIB1, and SMT-LIB2 formats. The SMT-LIB2 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 SMTLibv2 format.

Usage

Run with an SMTLibv2 file:

stp myproblem.smt

Overflowing a 32b integer using the python interface:

import stp
In [1]: import stp
In [2]: a = stp.Solver()
In [3]: x = a.bitvec('x')
In [4]: y = a.bitvec('y')
In [5]: a.add(x + y < 20)
In [6]: a.add(x  > 10)
In [7]: a.add(y  > 10)
In [8]: a.check()
Out[8]: True
In [9]: a.model()
Out[9]: {'x': 4294967287L, 'y': 11L}

With Docker:

docker pull msoos/stp
echo "(set-logic QF_BV)
(assert (= (bvsdiv (_ bv3 2) (_ bv2 2)) (_ bv0 2)))
(check-sat)
(exit)" | docker run --rm -i msoos/stp

Architecture

The 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.

Detailed Building and Installation

STP is built with CMake, version 3.0.2 or newer. CMake is a meta build system that generates build files for other tools such as make(1), Visual Studio, Xcode, etc.

Configuration variables

Here are a few interesting configuration variables. These apply to all generators.

  • CMAKE_BUILD_TYPE - The build type (e.g. Release)
  • CMAKE_INSTALL_PREFIX - The prefix for install (e.g. /usr/local )
  • ENABLE_ASSERTIONS - If TRUE STP will be built with asserts.
  • ENABLE_TESTING - Enable running tests
  • ENABLE_PYTHON_INTERFACE - Enable building the Python interface
  • PYTHON_EXECUTABLE - Set python executable in case you have more than one python installed
  • SANITIZE - Use Clang's sanitization checks
  • STATICCOMPILE - Build static libraries and binaries instead of dynamic

Dependencies

STP relies on : boost, flex, bison and minisat. You can install these by:

$ sudo apt-get install cmake bison flex libboost-all-dev python perl minisat

If your distribution does not come with minisat, STP maintains an updated fork. It can be built as follows:

$ git clone https://github.com/stp/minisat
$ cd minisat
$ mkdir build && cd build
$ cmake ..
$ cmake --build .
$ sudo cmake --install .
$ command -v ldconfig && sudo ldconfig

STP 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:

$ git clone https://github.com/msoos/cryptominisat
$ cd cryptominisat
$ mkdir build && cd build
$ cmake ..
$ cmake --build .
$ sudo cmake --install .
$ command -v ldconfig && sudo ldconfig

Building against non-installed libraries

If you wish to build STP's dependencies without installing them, you can tell CMake where to find the non-installed artefacts. For example:

  • -DMINISAT_INCLUDE_DIRS:PATH=<path> and -DMINISAT_LIBDIR:PATH=<path> -- the paths to minisat/core/Solver.h and the minisat libraries (respectively)
  • -Dcryptominisat5_DIR:PATH=<path> -- the path to cryptominisat5Config.cmake

If 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.

Building a static library and binary

$ mkdir build && cd build
$ cmake -DSTATICCOMPILE=ON ..
$ cmake --build .
$ sudo cmake --install .
$ command -v ldconfig && sudo ldconfig

Configuration and build options

To tweak the build configuration:

  • Run cmake-gui /path/to/stp/source/root instead of cmake. This user interface lets you control the value of various configuration variables and lets you pick the build system generator.

  • Run ccmake instead of cmake. This provides an ncurses terminal interface for changing configuration variables.

  • Pass -D<VARIABLE>=<VALUE> options to cmake (not very user friendly). It is probably best if you only configure this way if you are writing scripts.

You 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.

You can use the -j<n> flag to significantly to decrease build time by running <n> jobs in parallel (e.g. make -j4).

Testing

git clone https://github.com/stp/stp
git submodule update --init
pip install lit
mkdir build
cd build
cmake -DENABLE_TESTING=ON ..
make
make check

Installing

To 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.

Building on Windows/Visual Studio

You will need to install cmake and follow the steps that AppVeyor follows. In case you need the static binary, you can always access it as a binary artifact at the AppVeyor build page. In case you still have trouble, please see the mini-HOWTO at issue #319.

Building Docker

git clone https://github.com/stp/stp
cd stp
docker build -t stp .
echo "(set-logic QF_BV)
(assert (= (bvsdiv (_ bv3 2) (_ bv2 2)) (_ bv0 2)))
(check-sat)
(exit)" | docker run --rm -i stp

Authors

  • Vijay Ganesh
  • Trevor Hansen
  • Mate Soos
  • Dan Liew
  • Ryan Govostes
  • Andrew V. Jones
  • And many others...
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].