Skip to main content

smt-switch

Python bindings for smt-switch, a generic C++ API for SMT solving. It provides a single abstract interface that several SMT solvers implement, so you can write solver-agnostic code and switch back ends without rewriting it.

Installation

python3 -m pip install smt-switch

The published wheels bundle the solver back ends with permissive licenses: Bitwuzla, cvc5, and Z3. Boolector, MathSAT, and Yices 2 are supported by smt-switch but are not included in the wheels; to use those, build from source as described in the main README.

Two optional extras are available: smt-switch[pysmt] installs the pySMT front end, and smt-switch[test] installs pytest for running the test suite.

Usage

Every back end is created through the same factory interface and driven through the same solver object:

import smt_switch as ss

solver = ss.create_cvc5_solver(logging=False)
solver.set_opt("produce-models", "true")

bv8 = solver.make_sort(ss.sortkinds.BV, 8)
x = solver.make_symbol("x", bv8)
y = solver.make_symbol("y", bv8)

# x + y == 10 and x != 0
solver.assert_formula(
    solver.make_term(
        ss.primops.Equal,
        solver.make_term(ss.primops.BVAdd, x, y),
        solver.make_term(10, bv8),
    )
)
solver.assert_formula(
    solver.make_term(ss.primops.Distinct, x, solver.make_term(0, bv8))
)

result = solver.check_sat()
if result.is_sat():
    print("x =", int(solver.get_value(x)))
    print("y =", int(solver.get_value(y)))

The back ends compiled into your installation are available in the smt_switch.solvers dictionary, which maps a name such as "cvc5" to its factory function. This is the easiest way to run the same code across every available solver:

import smt_switch as ss

for name, create_solver in ss.solvers.items():
    solver = create_solver(logging=False)
    ...

Documentation and support

Further documentation, the C++ API, build instructions for the other solver back ends, and known limitations are in the main repository. Please report problems on the issue tracker.

License

smt-switch is distributed under the BSD 3-Clause license. Note that the solver back ends carry their own licenses. See LICENSE for details.

Release files for smt-switch 1.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for smt-switch 1.1.6
File
smt_switch-1.1.6-cp314-cp314-macosx_15_0_arm64.whl CPython 3.14 CPython 3.14 macOS 15.0+ ARM64 Details
smt_switch-1.1.6-cp313-cp313-macosx_15_0_arm64.whl CPython 3.13 CPython 3.13 macOS 15.0+ ARM64 Details
smt_switch-1.1.6-cp312-cp312-macosx_15_0_arm64.whl CPython 3.12 CPython 3.12 macOS 15.0+ ARM64 Details
smt_switch-1.1.6-cp311-cp311-macosx_15_0_arm64.whl CPython 3.11 CPython 3.11 macOS 15.0+ ARM64 Details
smt_switch-1.1.6-cp310-cp310-macosx_15_0_arm64.whl CPython 3.10 CPython 3.10 macOS 15.0+ ARM64 Details

Total release size: 103.4 MB

Release files / smt_switch-1.1.6-cp314-cp314-macosx_15_0_arm64.whl

Download URL smt_switch-1.1.6-cp314-cp314-macosx_15_0_arm64.whl
Size 20.7 MB
Tags CPython 3.14 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
bd23cff549f2a0daf419f1dbea8972cec4a74d541bc1fbde603eb7582902d9d7
BLAKE2b-256 checksum
How to use checksums
2e56cf5da682a32ed55998275b92f6d44a8590649a722b5ec5fa390df20c586b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / smt_switch-1.1.6-cp313-cp313-macosx_15_0_arm64.whl

Download URL smt_switch-1.1.6-cp313-cp313-macosx_15_0_arm64.whl
Size 20.7 MB
Tags CPython 3.13 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
17e546a1812d0fa58d9b608a70d99f257c2ad2e288621993df9a1a65d9df56ed
BLAKE2b-256 checksum
How to use checksums
f77064101cc3931cde6ec094c1e63af7f4b132402e97218036a4cf149b19ff0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / smt_switch-1.1.6-cp312-cp312-macosx_15_0_arm64.whl

Download URL smt_switch-1.1.6-cp312-cp312-macosx_15_0_arm64.whl
Size 20.7 MB
Tags CPython 3.12 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
2eb28b794dbe75ae525c62fcf8157f233b0efffcfb67873b5fa0caef186578ed
BLAKE2b-256 checksum
How to use checksums
3becf8cc8576a4c28f0239ddc1425d8de51023b1288662d224c280ae7039c23b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / smt_switch-1.1.6-cp311-cp311-macosx_15_0_arm64.whl

Download URL smt_switch-1.1.6-cp311-cp311-macosx_15_0_arm64.whl
Size 20.7 MB
Tags CPython 3.11 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
045a4a0c6b3c3f3525d92558e1dededbe3c646c3eba3514c0ba5d916c4938927
BLAKE2b-256 checksum
How to use checksums
511ec14583f88ee549d26474a0ec4a0b86a084102b40a3858ff5041478455ce6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release files / smt_switch-1.1.6-cp310-cp310-macosx_15_0_arm64.whl

Download URL smt_switch-1.1.6-cp310-cp310-macosx_15_0_arm64.whl
Size 20.7 MB
Tags CPython 3.10 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
1c107fae92398871c6df4fbfa4ad0d7e36ba763344153231fc64693a78f5233c
BLAKE2b-256 checksum
How to use checksums
740ca956fe7e711f7c78d270712c07ea347b42fb33ad4d0373d31efa65f0bfc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Release history Release notifications | RSS feed

This release

1.1.6 This release

5 release files

1.1.4

4 release files

1.1.3

4 release files

1.1.2

4 release files

1.1.1

4 release files

1.1.0

4 release files

0.3.0

4 release files

0.2.2

4 release files

0.2.0

4 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page