What is SMT?
Satisfiability Modulo Theories (SMT) is a decision problem for logical formulas with respect to combinations of background theories. Z3 is a state-of-the-art SMT solver that can determine whether a formula is satisfiable, unsatisfiable, or unknown.Core Concepts
Satisfiability
A formula is satisfiable if there exists an assignment of values to variables that makes the formula true. Z3 returns one of three possible results:sat- The formula is satisfiable (a model exists)unsat- The formula is unsatisfiable (no solution exists)unknown- Z3 could not determine satisfiability (timeout, resource limits, etc.)
Theories
Z3 supports multiple background theories that can be combined:Linear Arithmetic
Integer and real linear arithmetic (LIA, LRA)
Bit-Vectors
Fixed-size bit-vector arithmetic
Arrays
Extensional array theory with select/store
Uninterpreted Functions
Functions with no specified interpretation
Datatypes
Algebraic datatypes and records
Strings
String operations and regular expressions
Basic SMT Solving Example
Theory Combination
Z3’s power comes from combining multiple theories. Here’s an example mixing arithmetic and arrays:Proving Validity
To prove a formula φ is valid (true under all interpretations), check if ¬φ is unsatisfiable:Unsatisfiable Cores
When a set of constraints is unsatisfiable, Z3 can identify a minimal subset responsible for the contradiction:SMT-LIB Format
Z3 supports the standardized SMT-LIB format for portability:Performance Tips
Related Topics
Solvers
Learn about Z3’s solver interface
Expressions
Understand Z3’s expression system
Models
Working with satisfying assignments
References
- SMT-LIB Standard
- Z3 API:
src/api/api_solver.cpp - Examples:
examples/python/example.py,examples/c++/example.cpp
