What is Z3?
Z3 is a Satisfiability Modulo Theories (SMT) solver. Unlike simple SAT solvers that only work with boolean logic, Z3 can reason about:- Integers and real numbers
- Bit-vectors and arrays
- Algebraic datatypes
- Floating-point arithmetic
- Strings and sequences
- Quantifiers
What is SMT solving?
SMT (Satisfiability Modulo Theories) solving extends boolean satisfiability (SAT) with theories that handle specific data types and operations. Instead of working only with true/false values, you can express constraints over:Arithmetic
Linear and non-linear constraints over integers and real numbers
Bit-vectors
Fixed-width integers with operations like bitwise AND, shifts, and overflow
Arrays
Uninterpreted functions and extensional array theory
Data structures
Algebraic datatypes like lists, trees, and custom structures
Key features
Z3 stands out with several powerful capabilities:Multiple theories
Multiple theories
Z3 supports reasoning over integers, reals, bit-vectors, arrays, algebraic datatypes, floating-point numbers, strings, sequences, and finite sets. You can combine these theories in a single formula.
Optimization
Optimization
Beyond just satisfiability checking, Z3 can optimize objective functions subject to constraints using the Optimize API.
Quantifiers
Quantifiers
Z3 includes sophisticated heuristics for handling formulas with universal and existential quantifiers.
Tactics and solvers
Tactics and solvers
A rich library of tactics allows you to customize solving strategies and combine multiple solving approaches.
Multiple language bindings
Multiple language bindings
Use Z3 from Python, C++, C, Java, .NET, JavaScript/TypeScript, Go, OCaml, Julia, and more.
SMTLIB2 support
SMTLIB2 support
Full support for the standard SMTLIB2 format for solver interoperability.
Common use cases
Z3 is used in various domains: Program verification: Prove that programs meet their specifications by encoding program semantics as logical formulas. Symbolic execution: Explore program paths symbolically to find bugs or verify correctness. Test generation: Generate test inputs that satisfy specific path conditions or cover edge cases. Constraint solving: Solve complex optimization problems like scheduling, resource allocation, and configuration synthesis. Model checking: Verify properties of finite and infinite state systems. Security analysis: Find vulnerabilities by reasoning about program behavior under adversarial conditions.How Z3 works
Z3 uses a combination of techniques:- DPLL(T): Combines boolean satisfiability (SAT) solving with theory-specific decision procedures
- Conflict-driven learning: Learns from conflicts to prune the search space
- Theory propagation: Each theory can propagate constraints and detect conflicts early
- E-matching: Instantiates quantifiers based on pattern matching in the ground term set
While Z3 is highly effective for many problems, some constraint problems (especially those with complex quantifiers) may be undecidable or require significant computational resources.
System architecture
Z3’s architecture consists of several layers:License
Z3 is open source and released under the MIT License, making it free to use in both commercial and non-commercial projects.Next steps
Get started quickly
Install Z3 and solve your first problem in minutes
Install Z3
Detailed installation instructions for all platforms
Core concepts
Deep dive into SMT solving and Z3’s capabilities
API reference
Explore Z3’s comprehensive API documentation
