Simple Theorem Prover, an efficient SMT solver for bitvectors https://stp.github.io/
  • C++ 68.3%
  • SMT 22.7%
  • CMake 3.1%
  • Yacc 1.8%
  • Python 1.4%
  • Other 2.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Trevor Hansen ede27ada88
Point the ABC pin at the linear leaf collection (#1051)
Moves ABC_GIT_TAG from c8920763 to bdacd8988 -- the same revision plus
two commits: the leaf collection change (stp/abc#7) and the Aig_And
operand canonicalisation (stp/abc#8). Held by the tag
stp-at-953930643-pr1051, alongside stp-at-953930643-pr971 which holds
the revision pinned until now.

Cnf_CollectLeaves() suppressed duplicate leaves with
Vec_PtrPushUnique(), which rescans the whole vector on every push, so
collecting an n-leaf gate cost O(n^2). The widest gate in the benchmark
set has 2.4M leaves: about 3e12 comparisons before, about 5e7 after.

Measured to the point where the CNF is complete, over a tail-weighted
1,251-file subset of the non-incremental SMT-LIB benchmarks: -60.75% of
retired instructions, -99.2% on the file that prompted the work, and
+0.61% on the worst single file. The emitted CNF is byte-identical on
1,138 of those files and changed on the other 113.
2026-08-30 15:04:00 +10:00
.github Build CryptoMiniSat without its CaDiCaL, build it here, and retire setup-cms.sh (#1040) 2026-08-29 16:04:37 +10:00
bindings Look for libstp next to the installed Python package as well 2026-08-28 14:44:48 +01:00
cmake Point the ABC pin at the linear leaf collection (#1051) 2026-08-30 15:04:00 +10:00
docs Build CryptoMiniSat without its CaDiCaL, build it here, and retire setup-cms.sh (#1040) 2026-08-29 16:04:37 +10:00
include/stp A third bit-blasting backend, over ABC's Gia (#1049) 2026-08-30 12:19:30 +10:00
lib A third bit-blasting backend, over ABC's Gia (#1049) 2026-08-30 12:19:30 +10:00
papers Build the website and the manual as one Sphinx site (#875) 2026-08-14 22:21:46 +10:00
scripts Reach the AIG through the node manager, not through ABC (#1041) 2026-08-29 16:16:12 +10:00
tests Unit-test the Gia backend, gates and CNF seam both (#1050) 2026-08-30 12:55:22 +10:00
tools A third bit-blasting backend, over ABC's Gia (#1049) 2026-08-30 12:19:30 +10:00
utils Remove packaging and helper scripts that no longer run (#1014) 2026-08-28 17:14:29 +10:00
windows refactored gettimeofday() for Win32 2017-04-17 20:02:45 +02:00
.clang-format Reflowing code as per agreed clang-format 2017-10-08 17:53:55 +01:00
.dockerignore Fix the Docker image, keep one on Ubuntu 26.04, and build it in CI (#1016) 2026-08-28 16:36:01 +10:00
.gitignore Fetch ankerl::unordered_dense rather than carrying a copy of its header 2026-08-23 19:04:41 +01:00
AUTHORS Record an author, and settle on one spelling of a name 2026-08-04 09:59:45 +01:00
CMakeLists.txt Build CryptoMiniSat without its CaDiCaL, build it here, and retire setup-cms.sh (#1040) 2026-08-29 16:04:37 +10:00
configure.sh Merge remote-tracking branch 'upstream/master' into local-deps-build-mode 2026-08-28 14:23:59 +01:00
CONTRIBUTING.md Record the licensing position: CONTRIBUTING.md, LICENSE and LICENSE_COMPONENTS (#894) 2026-08-17 19:16:00 +10:00
Dockerfile Build CryptoMiniSat without its CaDiCaL, build it here, and retire setup-cms.sh (#1040) 2026-08-29 16:04:37 +10:00
LICENSE Record the licensing position: CONTRIBUTING.md, LICENSE and LICENSE_COMPONENTS (#894) 2026-08-17 19:16:00 +10:00
LICENSE_COMPONENTS Build CryptoMiniSat without its CaDiCaL, build it here, and retire setup-cms.sh (#1040) 2026-08-29 16:04:37 +10:00
README.markdown Build CryptoMiniSat without its CaDiCaL, build it here, and retire setup-cms.sh (#1040) 2026-08-29 16:04:37 +10:00
STPConfig.cmake.in Build CryptoMiniSat without its CaDiCaL, build it here, and retire setup-cms.sh (#1040) 2026-08-29 16:04:37 +10:00
STPConfigVersion.cmake.in Provide STPConfigVersion file which allows clients to request a 2015-04-24 00:50:23 +01:00

License: MIT CI

STP

STP is a constraint solver (or SMT solver) for the quantifier-free theories of bitvectors, arrays and floating-point. These types of constraints are generated by program analysis tools, theorem provers, automated bug finders, cryptographic attack tools, intelligent fuzzers, model checkers, and by many other applications.

Comprehensive details are provided in the manual and homepage: https://stp.github.io/

Build and install

For a quick install:

sudo apt-get install git build-essential cmake bison flex python3 \
                     libgmp-dev pkg-config zlib1g-dev
git clone https://github.com/stp/stp
cd stp
./configure.sh --auto-download
cmake --build build -j$(nproc)
sudo cmake --install build

CryptoMiniSat is the backend STP solves with by default, and --auto-download covers it like every other dependency: STP clones and builds stp/cryptominisat at a pinned commit. An installed one is found and preferred. libgmp-dev, pkg-config and zlib1g-dev are its packages, not STP's.

CaDiCaL is compiled in alongside it, and is what a build without CryptoMiniSat solves with. --cryptominisat, --cadical or --minisat selects a compiled-in backend for one run.

STP builds CryptoMiniSat with -DNOCADICAL=ON, so it bundles no CaDiCaL of its own and STP links the revision it pins -- which is what keeps --cadical-factor available. That option removes only backbone extraction, which STP never asks for.

There are no submodules: --auto-download fetches every dependency at a pinned revision and builds it with this build's own compiler and flags. Without it, configuration stops and says what to install or where to point it -- nothing here reaches the network unless it is asked to.

Or, using Homebrew:

brew install stp

Or, with Docker, which needs nothing installed but Docker itself and reads the problem on standard input:

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

Building STP covers the rest: the configuration variables, the SAT backends and how to choose between them, building against dependencies you have built but not installed, static builds, and Windows.

Usage

Run with an SMT-LIB2 file, which is the recommended input format:

stp myproblem.smt2

STP also reads from standard input, as in the Docker example above.

Overflowing a 32-bit integer using the Python interface:

import stp

s = stp.Solver()
x = s.bitvec('x', width=32)
y = s.bitvec('y', width=32)
s.add(x + y < 20)
s.add(x > 10)
s.add(y > 10)
print(s.check())  # True
print(s.model())  # e.g. {'x': 4294967287, 'y': 11}

The manual documents the accepted subset of SMT-LIB2, the C and C++ interfaces, incremental solving and array extensionality, and how STP works. Its sources are in docs/, and docs/README.md says how to build and read it locally.

Contributing

Source code layout describes what lives where, and Testing how to build and run the test suite. STP is written by many people, who work on it in their own time, or because it helps with their work or study.