Simple Theorem Prover, an efficient SMT solver for bitvectors https://stp.github.io/
  • C++ 71.5%
  • SMT 16.3%
  • Python 5%
  • CMake 2.7%
  • C 1.7%
  • Other 2.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Andrew Teylu 38c9735fb1
Merge pull request #1350 from aytey/agents_md
Add the rules for agents working in this repository
2026-10-14 16:05:24 +01:00
.github Cover Satsuma preprocessing with the Kissat backend 2026-10-13 09:26:42 +01:00
bindings Enumerate stable options by pinned enum ID 2026-10-14 09:48:08 +01:00
cmake Move the ABC pin on to the unsigned GIA hash 2026-10-14 09:51:24 +01:00
docs Document repeated incremental SAT performance results 2026-10-14 12:56:04 +01:00
include/stp Tune incremental SAT profiles and expose Kissat probing control 2026-10-14 12:56:04 +01:00
lib Tune incremental SAT profiles and expose Kissat probing control 2026-10-14 12:56:04 +01:00
papers Build the website and the manual as one Sphinx site (#875) 2026-08-14 22:21:46 +10:00
scripts Make tuning sample sizes configurable for overnight sweeps 2026-10-14 07:45:51 +01:00
tests Merge updated automatic SAT tuning parent into incremental performance work 2026-10-14 13:17:16 +01:00
tools Add an optional incremental Kissat backend and pinned external project 2026-10-13 09:10:58 +01: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
.gitattributes Host an external theory propagator on CaDiCaL and CryptoMiniSat 2026-09-25 20:06:18 +01:00
.gitignore Move the Python package to bindings/python 2026-09-28 19:36:45 +01:00
AGENTS.md Correct dependency and contention guidance for agents 2026-10-14 15:44:54 +01:00
AUTHORS Record an author, and settle on one spelling of a name 2026-08-04 09:59:45 +01:00
CMakeLists.txt Merge master to include Satsuma preprocessing 2026-10-13 09:20:46 +01:00
configure.sh Add an optional incremental Kissat backend and pinned external project 2026-10-13 09:10:58 +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 5.17.0, and treat it as a dependency STP builds 2026-10-12 12:50:59 +01:00
LICENSE Record the licensing position: CONTRIBUTING.md, LICENSE and LICENSE_COMPONENTS (#894) 2026-08-17 19:16:00 +10:00
LICENSE_COMPONENTS Add optional Satsuma CNF preprocessing with both-backend CI 2026-10-13 08:18:06 +01:00
README.markdown Add an optional incremental Kissat backend and pinned external project 2026-10-13 09:10:58 +01:00
STPConfig.cmake.in Make libstp2 the only provider of the 2.x C API 2026-09-28 14:04:15 +01:00

License: MIT CI

STP

STP is a constraint solver (or SMT solver) for the quantifier-free theories of bitvectors, arrays, floating-point and linear real arithmetic. 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 that carries the IPASIR-UP propagator interface the linear-arithmetic theory drives. A CryptoMiniSat without the interface still builds STP; the theory then runs full-lazy on it, configure warns about it, and --cadical restores propagation for a run. 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.

Incremental Kissat is an optional backend. Configure STP with --kissat --auto-download to build the pinned fork, then select it with stp --kissat input.smt2. A prebuilt checkout can be selected with --kissat-dir=/path/to/kissat. The Kissat integration guide describes the build options and incremental API.

With --cadical, --cadical-elim=0|1 controls variable elimination, and --cadical-elimmineff=N / --cadical-elimmaxeff=N set its minimum and maximum effort. For example:

stp input.smt2 --cadical --cadical-elim=0
stp input.smt2 --cadical --cadical-elimmineff=10000 --cadical-elimmaxeff=100000

Unspecified options retain the backend settings and STP's automatic policies. Explicit values override the corresponding CADICAL_* environment variables and search-bias settings, survive backend rebuilds, and an explicit --cadical-elim=1 keeps elimination enabled when incremental inprocessing is retired. Invalid values and requests with another backend are rejected before solving. Add -s to see the effective settings. Effort limits follow CaDiCaL's cost model; it can raise the allowance for large formulas, so the maximum is not a hard resolution-count limit. These are tuning controls with measured tradeoffs; none of them is set by default.

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. Running STP describes the command line: input formats, output and exit status, choosing a SAT solver, limits, statistics, and writing CNF.

Overflowing a 32-bit integer using the Python interface:

from stp import *

x, y = BitVecs('x y', 32)
s = Solver()
s.add(ULT(x + y, 20), UGT(x, 10), UGT(y, 10))
print(s.check())  # sat
print(s.model())  # e.g. [x = 4294967288, y = 11]

The manual documents the accepted subset of SMT-LIB2, the C, C++ and Python API, 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, Testing how to build and run the test suite, and Developer tools the programs under tools/ other than stp. STP is written by many people, who work on it in their own time, or because it helps with their work or study.