satisfiability modulo theory (smt) › ~agurfink › stqam.w18 › assets › pdf › ...2 2...

24
Satisfiability Modulo Theory (SMT) Testing, Quality Assurance, and Maintenance Winter 2018 Prof. Arie Gurfinkel

Upload: others

Post on 25-Jun-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

Satisfiability Modulo Theory (SMT)

Testing, Quality Assurance, and MaintenanceWinter 2018

Prof. Arie Gurfinkel

Page 2: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

2 2

Satisfiability Modulo Theory (SMT)

Satisfiability is the problem of determining wither a formula F has a model• if F is propositional, a model is a truth assignment to Boolean variables• if F is first-order formula, a model assigns values to variables and

interpretation to all the function and predicate symbols

SAT Solvers• check satisfiability of propositional formulas

SMT Solvers• check satisfiability of formulas in a decidable first-order theory (e.g., linear

arithmetic, uninterpreted functions, array theory, bit-vectors)

Page 3: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

3 3

Background Reading: SMT

September 2011

Page 4: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

4 4

Page 5: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

5 5

Page 6: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

6 6

Page 7: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

7 7

Page 8: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

8 8

Page 9: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

9 9

Page 10: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

10 10

Page 11: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

11 11

Page 12: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

12 12

Page 13: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

13 13

Page 14: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

14 14

Page 15: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

15 15

SMT - Milestonesyear Milestone1977 Efficient Equality Reasoning

1979 Theory Combination Foundations

1979 Arithmetic + Functions

1982 Combining Canonizing Solvers

1992-8 Systems: PVS, Simplify, STeP, SVC

2002 Theory Clause Learning

2005 SMT competition

2006 Efficient SAT + Simplex

2007 Efficient Equality Matching

2009 Combinatory Array Logic, …

SATTheorySolvers

SMT

15KLOC + 285KLOC = Z3

Includes progress from SAT:

Simplify (of ’01) time

1sec

0.1

1

10

100

1000

Z3TimeOn VCC

Regression

Nov 08 March 09

Z3(of ’07)TimeOn

BoogieRegression

Page 16: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

16 16

SAT/SMT Revolution

Solve any computational problem by effective reduction to SAT/SMT• iterate as necessary

Problem

encode

decode

SAT/SMT Solver

Page 17: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

17 17

SATTheorySolvers

SMT

SMT : Basic Architecture

Equality + UFArithmeticBit-vectors

Case Analysis

Page 18: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

18 18

SAT + Theory solvers

Basic Idea

x ³ 0, y = x + 1, (y > 2 Ú y < 1)

p1, p2, (p3 Ú p4)

Abstract (aka “naming” atoms)

p1 º (x ³ 0), p2 º (y = x + 1), p3 º (y > 2), p4 º (y < 1)

Page 19: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

19 19

SAT + Theory solvers

Basic Idea

x ³ 0, y = x + 1, (y > 2 Ú y < 1)

p1, p2, (p3 Ú p4)

Abstract (aka “naming” atoms)

p1 º (x ³ 0), p2 º (y = x + 1), p3 º (y > 2), p4 º (y < 1)

SAT Solver

Page 20: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

20 20

SAT + Theory solvers

Basic Idea

x ³ 0, y = x + 1, (y > 2 Ú y < 1)

p1, p2, (p3 Ú p4)

Abstract (aka “naming” atoms)

p1 º (x ³ 0), p2 º (y = x + 1), p3 º (y > 2), p4 º (y < 1)

SAT Solver

Assignmentp1, p2, ¬p3, p4

Page 21: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

21 21

SAT + Theory solversBasic Idea

x ³ 0, y = x + 1, (y > 2 Ú y < 1)

p1, p2, (p3 Ú p4)

Abstract (aka “naming” atoms)

p1 º (x ³ 0), p2 º (y = x + 1), p3 º (y > 2), p4 º (y < 1)

SAT Solver

Assignmentp1, p2, ¬p3, p4

x ³ 0, y = x + 1, ¬(y > 2), y < 1

Page 22: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

22 22

SAT + Theory solversBasic Idea

x ³ 0, y = x + 1, (y > 2 Ú y < 1)

p1, p2, (p3 Ú p4)

Abstract (aka “naming” atoms)

p1 º (x ³ 0), p2 º (y = x + 1), p3 º (y > 2), p4 º (y < 1)

SAT Solver

Assignmentp1, p2, ¬p3, p4

x ³ 0, y = x + 1, ¬(y > 2), y < 1

TheorySolver

Unsatisfiablex ³ 0, y = x + 1, y < 1

Page 23: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

23 23

SAT + Theory solvers

Basic Idea

x ³ 0, y = x + 1, (y > 2 Ú y < 1)

p1, p2, (p3 Ú p4)

Abstract (aka “naming” atoms)

p1 º (x ³ 0), p2 º (y = x + 1), p3 º (y > 2), p4 º (y < 1)

SAT Solver

Assignmentp1, p2, ¬p3, p4

x ³ 0, y = x + 1, ¬(y > 2), y < 1

TheorySolver

Unsatisfiablex ³ 0, y = x + 1, y < 1

New Lemma¬p1Ú¬p2Ú¬p4

Page 24: Satisfiability Modulo Theory (SMT) › ~agurfink › stqam.w18 › assets › pdf › ...2 2 Satisfiability Modulo Theory (SMT) Satisfiability is the problem of determining wither

24 24

SAT + Theory solvers

TheorySolver

Unsatisfiablex ³ 0, y = x + 1, y < 1

New Lemma¬p1Ú¬p2Ú¬p4

AKATheory conflict