unsat
A Z3-inspired SMT solver written in pure Python 3.14+ with zero runtime dependencies.
unsat pairs a standalone CDCL SAT core with online CDCL(T) theory solvers (EUF, LRA, LIA, Arrays), eager bit-vector bit-blasting with shared-term propagation, Model-Based Theory Combination (MBTC), E-matching and MBQI quantifier instantiation, AST preprocessing tactics, a Z3Py-style Python DSL, and an SMT-LIB2 / DIMACS CLI.
Features
- CDCL SAT solver (
unsat.sat): Two-watched literals (dedicated binary watches + blocker literals), 1-UIP conflict learning with recursive minimization, EVSIDS, phase saving, Glucose LBD restarts and DB reduction, incremental assumptions, assumption-basedunsat_core(), lazy theory explanation hooks, and resource budgets (max_conflicts,deadline). - Theories & Combination (
unsat.theories,unsat.smt):- EUF: Congruence closure with signature table, copy-free trail-undo log, and proof forest minimal conflict explanations.
- LRA / LIA: Exact rational
fractions.FractionSimplex with infinitesimals (a + b * delta), branch-and-bound, and Gomory cuts. - Bit-Vectors: Word-level simplification and Tseitin/AIG bit-blasting with shared-term bit propagation.
- Arrays: Lazy Read-over-Write (
select/store), constant arrays (const), and extensionality lemmas. - MBTC: Model-Based Theory Combination across EUF, arithmetic, bit-vectors, and arrays.
- Quantifiers (
unsat.quantifiers): E-matching with pattern tables and Model-Based Quantifier Instantiation (MBQI) bounded by configurable round/match/conflict/timeout budgets. - Tactics (
unsat.tactics): Composable AST preprocessing (SimplifyTactic,NNFTactic,BitBlastTactic,SkolemizeTactic,CtxSimplifyTactic,GaussianElimTactic,PropagateBoundsTactic) withModelConverterreconstruction viasolve_with_tactic. - Frontends (
unsat.api,unsat.parser,unsat.cli): Python DSL (Solver,Int,Real,BitVec,Array,Bool,Function,ForAll,Exists), DIMACS CNF parser/formatter, and interactive SMT-LIB2 command runner.
Supported SMT-LIB2 Logics & Commands
- Logics:
QF_BOOL,QF_UF,QF_LRA,QF_LIA,QF_UFLRA,QF_UFLIA,QF_LIRA,QF_BV,QF_UFBV,QF_AX,QF_ABV,QF_AUFBV,QF_ALIA,QF_ALRA,QF_AUFLIA,QF_AUFLRA,QF_AUFLIRA,UF,LIA,LRA,LIRA,UFLIA,UFLRA,UFLIRA,BV,UFBV,AX,ABV,AUFBV,ALIA,ALRA,AUFLIA,AUFLRA,AUFLIRA,ALL. - Commands:
set-logic,set-option,set-info,declare-sort,define-sort,declare-const,declare-fun,define-fun,assert(with top-level:named),check-sat,check-sat-assuming,get-model,get-value,get-unsat-core,get-assertions,push,pop,reset,reset-assertions,echo,exit.
Installation
Requires Python 3.14 or newer.
uv add unsat
# or
pip install unsat
For local development (includes pytest, hypothesis, z3-solver for differential tests, ruff, ty, import-linter, and rumdl):
uv sync --locked --all-extras --dev
Quick Start
Python DSL
from unsat import Eq, Int, IntVal, SAT, Solver
x, y = Int("x"), Int("y")
solver = Solver(timeout=5.0, max_conflicts=10_000)
solver.add(Eq(x + y, IntVal(10)), x > y, y >= 2)
if solver.check() is SAT:
model = solver.model()
print(model.eval_int(x), model.eval_int(y))
Preprocessing Tactics
from unsat import Context
from unsat.smt import SolveResult, solve_with_tactic
from unsat.tactics import (
CtxSimplifyTactic,
GaussianElimTactic,
PropagateBoundsTactic,
SimplifyTactic,
Then,
)
ctx = Context()
x, y = ctx.mk_int("x"), ctx.mk_int("y")
pipeline = Then(
CtxSimplifyTactic(),
GaussianElimTactic(),
PropagateBoundsTactic(),
SimplifyTactic(),
)
verdict, model = solve_with_tactic([ctx.mk_eq(x, y + 3), y >= 4, x <= 10], pipeline)
assert verdict is SolveResult.SAT and model is not None
Command Line Interface
unsat problem.smt2
unsat problem.cnf --stats --timeout 5.0 --max-conflicts 5000
python -m unsat - --format smt2 < script.smt2
Available CLI options include --format {auto,dimacs,smt2}, --stats, --timeout, --max-conflicts, --max-quantifier-rounds, --max-quantifier-matches, and --version.
Development & Benchmarks
uv run ruff check .
uv run ruff format --check .
uv run ty check
uv run lint-imports
uv run rumdl check .
uv run pytest tests
uv run python benchmarks/run.py --check
uv run python benchmarks/run.py --z3 --check
Documentation
License
Licensed under the Apache License 2.0.
Metadata
Release files for unsat 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| unsat-0.1.0.tar.gz | 124.1 kB | Without provenance | Details for unsat-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| unsat-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for unsat-0.1.0-py3-none-any.whl |
Total release size: 267.6 kB
Release files / unsat-0.1.0.tar.gz
| Download URL | unsat-0.1.0.tar.gz |
|---|---|
| Size | 124.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ad508e61a02df382975fe6a6d06fdd862929b31cfcb4ecf25a7538a6912b61b
|
|
BLAKE2b-256 checksum How to use checksums |
7e95aaeb3e1e8c0b830cf7128eef689106885eb173120458268e31be72b022de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / unsat-0.1.0-py3-none-any.whl
| Download URL | unsat-0.1.0-py3-none-any.whl |
|---|---|
| Size | 143.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dc6ad1c6c219a4180fb5352f19c5d0fb05ca2086f74277f2f5bc5d9763171d3b
|
|
BLAKE2b-256 checksum How to use checksums |
9fe05a20e9cf32034ed89ec9c3f52c33688600652e338c81fb2ce3947cb5bfb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.10 {"installer":{"name":"uv","version":"0.13.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for unsat 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.