sat & smt. software verification & testing sat & smt test case generation predicate...

58
Constraint Satisfaction in Software Verification & Testing NSF Workshop on Symbolic Computation for Constraint Satisfaction - 2008 Leonardo de Moura Microsoft Research SAT & SMT

Upload: lily-carroll

Post on 03-Jan-2016

228 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Constraint Satisfaction inSoftware Verification & TestingNSF Workshop on Symbolic Computation for Constraint Satisfaction - 2008

Leonardo de MouraMicrosoft Research

SAT & SMT

Page 2: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

SAT & SMT in Software Verification & Testing

Software Verification & Testing

SAT & SMT

Test case generation

Predicate AbstractionVerifying

Compilers

Page 3: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Satisfiability Modulo Theories (SMT)

Software Verification & Testing

SAT

Theories

SMT

ArithmeticBit-vectorsArrays…

Page 4: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

SMT in Software Verification & Testing

Software Verification & Testing

SMT

Test case generation

Predicate AbstractionVerifying

Compilers

Page 5: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Test case generation

unsigned GCD(x, y) {

requires(y > 0);

while (true) {unsigned m = x % y; if (m == 0) return y; x = y; y = m;

}}

Software Verification & Testing

We want a trace where the loop is executed twice.

(y0 > 0) and

(m0 = x0 % y0) and

not (m0 = 0) and

(x1 = y0) and

(y1 = m0) and

(m1 = x1 % y1) and

(m1 = 0)

model

x0 = 2

y0 = 4

m0 = 2

x1 = 4

y1 = 2

m1 = 0

SSA

SMTSolver

Page 6: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Test-case generation

Software Verification & Testing

Test (correctness + usability) is 95% of the deal:Dev/Test is 1-1 in products.Developers are responsible for unit tests.

Tools:File FuzzingUnit test case generation

Page 7: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Security is critical

Software Verification & Testing

Security bugs can be very expensive:Cost of each MS Security Bulletin: $600k to $Millions.Cost due to worms: $Billions.

Most security exploits are initiated via files or packets.Ex: Internet Explorer parses dozens of file formats.

Security testing: hunting for million dollar bugsWrite A/VRead A/VNull pointer dereferenceDivision by zero

Page 8: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Hunting for Security Bugs.

Two main techniques used by “black hats”:Code inspection (of binaries).Black box fuzz testing.

Black box fuzz testing:A form of black box random testing.Randomly fuzz (=modify) a well formed input.Grammar-based fuzzing: rules to encode how to fuzz.

Heavily used in security testingAt MS: several internal tools.Conceptually simple yet effective in practice

Software Verification & Testing

Page 9: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Directed Automated Random Testing ( DART)

Software Verification & Testing

Execution Path

Run Test and Monitor Path Condition

Solve

seed

New input

TestInputs

Constraint System

KnownPaths

SMTSolver

Page 10: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Constraint System Generation

Software Verification & Testing

Unit x ApplicationTrade off between performance and precisionExecution path mutation:

existing execution path

new path

Concretizationx = y * z x = 128 (if y = 2 and z = 64 in the existing path)

Page 11: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

DARTish projects at Microsoft

PEX Implements DART for .NET.

SAGE Implements DART for x86 binaries.

YOGI Implements DART to check the feasibility of program paths generated statically using a SLAM-like tool.

Vigilante Partially implements DART to dynamically generate worm filters.

Software Verification & Testing

Page 12: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

What is Pex?

Test input generatorPex starts from parameterized unit testsGenerated tests are emitted as traditional unit tests

Visual Studio Plugin

Software Verification & Testing

Page 13: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

ArrayList: The Spec

Software Verification & Testing

Page 14: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

ArrayList: AddItem Test

Software Verification & Testing

class ArrayList { object[] items; int count;

ArrayList(int capacity) { if (capacity < 0) throw ...; items = new object[capacity]; }

void Add(object item) { if (count == items.Length) ResizeArray();

items[this.count++] = item; }...

class ArrayListTest { [PexMethod] void AddItem(int c, object item) { var list = new ArrayList(c); list.Add(item); Assert(list[0] == item); }}

Page 15: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

ArrayList: Starting Pex…

class ArrayList { object[] items; int count;

ArrayList(int capacity) { if (capacity < 0) throw ...; items = new object[capacity]; }

void Add(object item) { if (count == items.Length) ResizeArray();

items[this.count++] = item; }...

class ArrayListTest { [PexMethod] void AddItem(int c, object item) { var list = new ArrayList(c); list.Add(item); Assert(list[0] == item); }}

Inputs

Page 16: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

ArrayList: Run 1, (0,null)Inputs

(0,null)

class ArrayList { object[] items; int count;

ArrayList(int capacity) { if (capacity < 0) throw ...; items = new object[capacity]; }

void Add(object item) { if (count == items.Length) ResizeArray();

items[this.count++] = item; }...

class ArrayListTest { [PexMethod] void AddItem(int c, object item) { var list = new ArrayList(c); list.Add(item); Assert(list[0] == item); }}

Page 17: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

ArrayList: Run 1, (0,null)Inputs Observed

Constraints

(0,null)

!(c<0)

class ArrayList { object[] items; int count;

ArrayList(int capacity) { if (capacity < 0) throw ...; items = new object[capacity]; }

void Add(object item) { if (count == items.Length) ResizeArray();

items[this.count++] = item; }...

class ArrayListTest { [PexMethod] void AddItem(int c, object item) { var list = new ArrayList(c); list.Add(item); Assert(list[0] == item); }}

c < 0 false

Page 18: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

ArrayList: Run 1, (0,null)Inputs Observed

Constraints

(0,null) !(c<0) && 0==c

class ArrayList { object[] items; int count;

ArrayList(int capacity) { if (capacity < 0) throw ...; items = new object[capacity]; }

void Add(object item) { if (count == items.Length) ResizeArray();

items[this.count++] = item; }...

class ArrayListTest { [PexMethod] void AddItem(int c, object item) { var list = new ArrayList(c); list.Add(item); Assert(list[0] == item); }}

0 == c true

Page 19: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

ArrayList: Run 1, (0,null)Inputs Observed

Constraints

(0,null) !(c<0) && 0==c

class ArrayList { object[] items; int count;

ArrayList(int capacity) { if (capacity < 0) throw ...; items = new object[capacity]; }

void Add(object item) { if (count == items.Length) ResizeArray();

items[this.count++] = item; }...

class ArrayListTest { [PexMethod] void AddItem(int c, object item) { var list = new ArrayList(c); list.Add(item); Assert(list[0] == item); }}

item == item true

This is a tautology, i.e. a constraint that is always true,regardless of the chosen values.

We can ignore such constraints.

Page 20: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

ArrayList: Picking the next branch to coverConstraints to solve

Inputs Observed Constraints

(0,null) !(c<0) && 0==c

!(c<0) && 0!=c

class ArrayList { object[] items; int count;

ArrayList(int capacity) { if (capacity < 0) throw ...; items = new object[capacity]; }

void Add(object item) { if (count == items.Length) ResizeArray();

items[this.count++] = item; }...

class ArrayListTest { [PexMethod] void AddItem(int c, object item) { var list = new ArrayList(c); list.Add(item); Assert(list[0] == item); }}

SMTSolver

Page 21: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

ArrayList: Solve constraints using SMT solver

Constraints to solve

Inputs Observed Constraints

(0,null) !(c<0) && 0==c

!(c<0) && 0!=c

(1,null)

class ArrayList { object[] items; int count;

ArrayList(int capacity) { if (capacity < 0) throw ...; items = new object[capacity]; }

void Add(object item) { if (count == items.Length) ResizeArray();

items[this.count++] = item; }...

class ArrayListTest { [PexMethod] void AddItem(int c, object item) { var list = new ArrayList(c); list.Add(item); Assert(list[0] == item); }}

SMTSolver

Page 22: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

ArrayList: Run 2, (1, null)Constraints to solve

Inputs Observed Constraints

(0,null) !(c<0) && 0==c

!(c<0) && 0!=c

(1,null) !(c<0) && 0!=c

class ArrayList { object[] items; int count;

ArrayList(int capacity) { if (capacity < 0) throw ...; items = new object[capacity]; }

void Add(object item) { if (count == items.Length) ResizeArray();

items[this.count++] = item; }...

class ArrayListTest { [PexMethod] void AddItem(int c, object item) { var list = new ArrayList(c); list.Add(item); Assert(list[0] == item); }}

0 == c false

Page 23: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

ArrayList: Pick new branchConstraints to solve

Inputs Observed Constraints

(0,null) !(c<0) && 0==c

!(c<0) && 0!=c

(1,null) !(c<0) && 0!=c

c<0

class ArrayList { object[] items; int count;

ArrayList(int capacity) { if (capacity < 0) throw ...; items = new object[capacity]; }

void Add(object item) { if (count == items.Length) ResizeArray();

items[this.count++] = item; }...

class ArrayListTest { [PexMethod] void AddItem(int c, object item) { var list = new ArrayList(c); list.Add(item); Assert(list[0] == item); }}

SMTSolver

Page 24: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

ArrayList: Run 3, (-1, null)Constraints to solve

Inputs Observed Constraints

(0,null) !(c<0) && 0==c

!(c<0) && 0!=c

(1,null) !(c<0) && 0!=c

c<0 (-1,null)

class ArrayList { object[] items; int count;

ArrayList(int capacity) { if (capacity < 0) throw ...; items = new object[capacity]; }

void Add(object item) { if (count == items.Length) ResizeArray();

items[this.count++] = item; }...

class ArrayListTest { [PexMethod] void AddItem(int c, object item) { var list = new ArrayList(c); list.Add(item); Assert(list[0] == item); }}

SMTSolver

Page 25: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

ArrayList: Run 3, (-1, null)Constraints to solve

Inputs Observed Constraints

(0,null) !(c<0) && 0==c

!(c<0) && 0!=c

(1,null) !(c<0) && 0!=c

c<0 (-1,null)

c<0

class ArrayList { object[] items; int count;

ArrayList(int capacity) { if (capacity < 0) throw ...; items = new object[capacity]; }

void Add(object item) { if (count == items.Length) ResizeArray();

items[this.count++] = item; }...

class ArrayListTest { [PexMethod] void AddItem(int c, object item) { var list = new ArrayList(c); list.Add(item); Assert(list[0] == item); }}

c < 0 true

Page 26: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

ArrayList: Run 3, (-1, null)Constraints to solve

Inputs Observed Constraints

(0,null) !(c<0) && 0==c

!(c<0) && 0!=c

(1,null) !(c<0) && 0!=c

c<0 (-1,null)

c<0

class ArrayList { object[] items; int count;

ArrayList(int capacity) { if (capacity < 0) throw ...; items = new object[capacity]; }

void Add(object item) { if (count == items.Length) ResizeArray();

items[this.count++] = item; }...

class ArrayListTest { [PexMethod] void AddItem(int c, object item) { var list = new ArrayList(c); list.Add(item); Assert(list[0] == item); }}

Page 27: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Apply DART to large applications (not units).Start with well-formed input (not random).Combine with generational search (not DFS).

Negate 1-by-1 each constraint in a path constraint.Generate many children for each parent run.

SAGE

Software Verification & Testing

parent

generation 1

Page 28: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

SAGE (cont.)

SAGE is very effective at finding bugsWorks on large applicationsFully automatedEasy to deploy (x86 analysis – any language)Used in various groups inside MicrosoftFound > 100 security bugs in Windows 7Gold medal in an internal file fuzzing competitionPowered by SMT

Software Verification & Testing

Page 29: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Challenges

Trade off between precision and performanceScalabilityMachine arithmetic (aka Bitvectors)Floating point arithmetic. FP operations are:

Concretized in SAGEApproximated using rational numbers in Pex

Software Verification & Testing

Page 30: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

SMT in Software Verification & Testing

Software Verification & Testing

SMT

Test case generation

Predicate AbstractionVerifying

Compilers

Page 31: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Overview

SLAM/SDV is a software model checker.Application domain: device drivers.Architecture:c2bp C program → boolean program (predicate abstraction).bebop Model checker for boolean programs.newton Model refinement (check for path feasibility)SMT solvers are used to perform predicate abstraction and to check path feasibility.c2bp makes several calls to the SMT solver. The formulas are relatively small.

Page 32: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Predicate Abstraction: c2bp

Given a C program P and F = {p1, … , pn}.Produce a Boolean program B(P, F)

Same control flow structure as P.Boolean variables {b1, … , bn} to match {p1, … , pn}.Properties true in B(P, F) are true in P.

Each pi is a pure Boolean expression.Each pi represents set of states for which pi is true.Performs modular abstraction.

Software Verification & Testing

Page 33: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Example

do {KeAcquireSpinLock();

nPacketsOld = nPackets;

if(request){request = request->Next;KeReleaseSpinLock();nPackets++;

}} while (nPackets != nPacketsOld);

KeReleaseSpinLock();

Do this code obey the looking

rule?

Page 34: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Example

do {KeAcquireSpinLock();

if(*){

KeReleaseSpinLock();

}} while (*);

KeReleaseSpinLock();

Model checking Boolean program

U

L

L

L

L

U

L

U

U

U

E

Page 35: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Example

do {KeAcquireSpinLock();

nPacketsOld = nPackets;

if(request){request = request->Next;KeReleaseSpinLock();nPackets++;

}} while (nPackets != nPacketsOld);

KeReleaseSpinLock();

Is error path feasible?

U

L

L

L

L

U

L

U

U

U

E

Page 36: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Example

do {KeAcquireSpinLock();

nPacketsOld = nPackets;

if(request){request = request->Next;KeReleaseSpinLock();nPackets++;

}} while (nPackets != nPacketsOld);

KeReleaseSpinLock();

Add new predicate to Boolean program

b: (nPacketsOld == nPackets)

U

L

L

L

L

U

L

U

U

U

E

b = true;

b = b ? false : *;

!b

Page 37: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Example

do {KeAcquireSpinLock();

b = true;

if(*){

KeReleaseSpinLock();b = b ? false : *;

}} while (!b);

KeReleaseSpinLock();

Model Checking Refined Program

b: (nPacketsOld == nPackets)

U

L

L

L

L

U

L

U

U

U

E

b

b

b

b

b

b

!b

Page 38: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Example

do {KeAcquireSpinLock();

b = true;

if(*){

KeReleaseSpinLock();b = b ? false : *;

}} while (!b);

KeReleaseSpinLock();

Model Checking Refined Program

b: (nPacketsOld == nPackets)

U

L

L

L

L

U

L

U

U

b

b

b

b

b

b

!b

Page 39: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Example

do {KeAcquireSpinLock();

b = true;

if(*){

KeReleaseSpinLock();b = b ? false : *;

}} while (!b);

KeReleaseSpinLock();

Model Checking Refined Program

b: (nPacketsOld == nPackets)

U

L

L

L

L

U

L

U

U

b

b

b

b

b

b

!b

Page 40: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Abstracting Expressions via F

ImpliesF (e)Best Boolean function over F that implies e.

ImpliedByF (e)Best Boolean function over F that is implied by e.ImpliedByF (e) = not ImpliesF (not e)

Software Verification & Testing

Page 41: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Computing ImpliesF(e)

minterm m = l1 ... ∧ ∧ ln, where li = pi, or li = not pi.ImpliesF (e): disjunction of all minterms that imply e.Naive approach

Generate all 2n possible minterms.For each minterm m, use SMT solver to check validity of m

⇒ e.Many possible optimizations

Software Verification & Testing

Page 42: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Computing ImpliesF(e)F = { x < y, x = 2}e : y > 1Minterms over F

!x<y, !x=2 implies y>1 x<y, !x=2 implies y>1!x<y, x=2 implies y>1 x<y, x=2 implies y>1

ImpliesF(y>1) = x<y x=2ImpliesF(y>1) = b1 b2

Software Verification & Testing

Page 43: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Newton

Given an error path p in the Boolean program B.Is p a feasible path of the corresponding C program?

Yes: found a bug.No: find predicates that explain the infeasibility.

Execute path symbolically.Check conditions for inconsistency using SMT Solver.

Software Verification & Testing

Page 44: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Beyond Satisfiability

All-SATBetter (more precise) Predicate Abstraction

Unsatisfiable coresWhy the abstract path is not feasible?Fast Predicate Abstraction

Interpolants

Software Verification & Testing

Page 45: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Unsatisfiable cores

Let S be an unsatisfiable set of formulas.S’ S is an unsatisfiable core of S if:

S’ is also unsatisfiable, andThere is no S’’ S’ that is also unsatisfiable.

Computing ImpliesF(e) with F = {p1, p2, p3, p4}Assume p1, p2, p3, p4 e is validThat is p1, p2, p3, p4, e is unsatNow assume p1, p3, e is the unsatisfiable coreThen it is unnecessary to check:

p1, p2, p3, p4 ep1, p2, p3, p4 ep1, p2, p3, p4 e

Page 46: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

SMT in Software Verification & Testing

Software Verification & Testing

SMT

Test case generation

Predicate AbstractionVerifying

Compilers

Page 47: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Verifying Compilers

A verifying compiler uses automated reasoning to check thecorrectness of a program that is compiles.

Correctness is specified by types, assertions, . . . and otherredundant annotations that accompany the program.

Tony Hoare 2004

Page 48: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Spec# Approach for a Verifying Compiler

Source LanguageC# + goodies = Spec#

Specificationsmethod contracts,invariants,field and type annotations.

Program Logic: Dijkstra’s weakest preconditions.

Automatic Verificationtype checking,verification condition generation (VCG),SMT

Spec# (annotated C#)

Boogie PL

Spec# Compiler

VC Generator

Formulas

SMT Solver

Page 49: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Spec#: Example

class C { private int a, z; invariant z > 0

public void M() requires a != 0

{ z = 100/a; }

}

Page 50: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

A Verifying C Compiler

VCC translates an annotated C program into a Boogie PL program.A C-ish memory model

Abstract heapsBit-level precision

Microsoft Hypervisor: verification grand challenge.

Software Verification & Testing

Page 51: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Main Challenge

Quantifiers, quantifiers, quantifiers, …Modeling the runtime h,o,f:

IsHeap(h) o ≠ null read(h, o, alloc) = tread(h,o, f) = null read(h, read(h,o,f),alloc)

= t

Software Verification & Testing

Page 52: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Main Challenge

Quantifiers, quantifiers, quantifiers, …Modeling the runtimeFrame axioms o, f:

o ≠ null read(h0, o, alloc) = t read(h1,o,f) = read(h0,o,f) (o,f) M

Software Verification & Testing

Page 53: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Main Challenge

Quantifiers, quantifiers, quantifiers, …Modeling the runtimeFrame axiomsUser provided assertions i,j: i j read(a,i) read(b,j)

Software Verification & Testing

Page 54: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Main Challenge

Quantifiers, quantifiers, quantifiers, …Modeling the runtimeFrame axiomsUser provided assertionsTheories" x: p(x,x)" x,y,z: p(x,y), p(y,z) p(x,z)" x,y: p(x,y), p(y,x) x = y

Software Verification & Testing

Page 55: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Main Challenge

Quantifiers, quantifiers, quantifiers, …Modeling the runtimeFrame axiomsUser provided assertionsTheoriesSolver must be fast in satisfiable instances.

Software Verification & Testing

We want to find bugs!

Page 56: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Quantifiers & SMT

Undecidable“False positives”Very fragile

Software Verification & Testing

PSpace-complete(QBF)

Undecidable(First-order logic)

NP-complete(Propositional logic)

NEXPTime-complete(EPR)

P-time(Equality)

Page 57: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Quantifiers & SMT: approaches

E-matching

Complete instantiation

Decidable fragments

Model checking

Superposition Calculus

Software Verification & Testing

Page 58: SAT & SMT. Software Verification & Testing SAT & SMT Test case generation Predicate Abstraction Verifying Compilers

Conclusion

Software Verification & Testing

SMT is hot at Microsoft (> 15 projects)Many applications

CryptographySchedulingOptimization

Many challenges

Thank You!