Home Knowledge Base Satisfiability Modulo Theories (SMT)

Satisfiability Modulo Theories (SMT) is a decision problem for determining the satisfiability of logical formulas with respect to combinations of background theories — extending boolean satisfiability (SAT) with theories like arithmetic, arrays, bit-vectors, and uninterpreted functions, enabling powerful automated reasoning for program verification, test generation, and constraint solving.

What Is SMT?

Why SMT?

How SMT Solvers Work

1. SAT Solver: Find boolean assignment satisfying formula structure. 2. Theory Solver: Check if assignment is consistent with theory constraints. 3. Conflict: If inconsistent, SAT solver learns conflict clause and tries again. 4. Iterate: Repeat until consistent assignment found or proven unsatisfiable.

Example: SMT Problem

Formula: (x + y == 10) ∧ (x > 5) ∧ (y < 3)

SMT solver reasoning:
  - x + y == 10
  - x > 5 → x >= 6
  - y < 3 → y <= 2
  - If x >= 6 and y <= 2, then x + y <= 6 + 2 = 8
  - But we need x + y == 10
  - Contradiction!
  - Result: UNSAT (unsatisfiable)

Modified formula: (x + y == 10) ∧ (x > 5) ∧ (y < 5)
  - x > 5 → x >= 6
  - y < 5 → y <= 4
  - x + y == 10 with x = 6, y = 4 ✓
  - Result: SAT with model x=6, y=4

SMT Theories

Applications

``python # Path constraint: (x > 0) ∧ (x + y < 10) ∧ (y > 5) # SMT solver finds: x=1, y=6 ``

`` # Verify: x >= 0 ∧ y >= 0 → x + y >= 0 # SMT solver: Valid (always true) ``

SMT Solvers

Example: Using Z3

from z3 import *

# Variables
x = Int('x')
y = Int('y')

# Constraints
solver = Solver()
solver.add(x + y == 10)
solver.add(x > 5)
solver.add(y < 5)

# Check satisfiability
if solver.check() == sat:
    model = solver.model()
    print(f"SAT: x={model[x]}, y={model[y]}")
else:
    print("UNSAT")

# Output: SAT: x=6, y=4

SMT in Symbolic Execution

def test(x, y):
    if x + y > 10:
        if x > 5:
            return "A"
    return "B"

# Symbolic execution path: x + y > 10 ∧ x > 5
# SMT query: Is (x + y > 10) ∧ (x > 5) satisfiable?
# Z3 returns: SAT with x=6, y=5
# Test input: test(6, 5) → "A"

SMT in Program Verification

// Verify: If x >= 0 and y >= 0, then x + y >= 0
// SMT formula: (x >= 0) ∧ (y >= 0) → (x + y >= 0)
// Equivalently: ¬((x >= 0) ∧ (y >= 0) ∧ (x + y < 0))
// SMT solver: UNSAT (no counterexample exists)
// Conclusion: Property is valid ✓

Challenges

Optimization

LLMs and SMT

Benefits

Limitations

SMT solving is a foundational technology for automated reasoning — it powers symbolic execution, program verification, test generation, and many other applications, providing automated decision procedures for complex logical formulas.

satisfiability modulo theories (smt)satisfiability modulo theoriessmtsoftware engineering

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.