Automatic Abstraction in SMT-Based Unbounded Software Model Checking

72
© Anvesh Komuravelli Spacer Automatic Abstraction in SMT- Based Unbounded Software Model Checking Anvesh Komuravelli Carnegie Mellon University Joint work with Arie Gurfinkel, Sagar Chaki and Edmund Clarke

description

Automatic Abstraction in SMT-Based Unbounded Software Model Checking. Anvesh Komuravelli Carnegie Mellon University. Joint work with Arie Gurfinkel , Sagar Chaki and Edmund Clarke. The Problem. Safe. + Proof. Automatic analysis for assertion failures. Program P + Assertions. Unsafe. - PowerPoint PPT Presentation

Transcript of Automatic Abstraction in SMT-Based Unbounded Software Model Checking

Page 1: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer

Automatic Abstraction in SMT-Based Unbounded Software Model Checking

Anvesh KomuravelliCarnegie Mellon University

Joint work with Arie Gurfinkel, Sagar Chaki and Edmund Clarke

Page 2: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 2

The Problem

Program P+ Assertions

Automatic analysis for

assertion failures

Safe

Unsafe

Unknown

Software Model Checking

+ Proof

+ Counterexample

+ Partial Proof

reach(P) error(P)

Is it empty?

Page 3: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 3

reach(P) error(P)

Over-approximation Driven (OD)

Page 4: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 4

reach(P) error(P)

Over-approximation driven (OD)

Page 5: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 5

Over-approximation driven (OD)

Key Idea CEGAR based on Predicate Abstraction

Symbolic Method

BDDs for fixed point computation,SMT for new predicates

Tools SLAM, BLAST, SDV, etc.

Page 6: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 6

reach(P)

Under-approximation Driven (UD)

error(P)

Page 7: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 7

Under-approximation driven (UD)

reach(P) error(P)

Page 8: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 8

Under-approximation driven (UD)

Key Idea BMC based Approach

Symbolic Method SMT

Tools IMPACT, UFO, etc.

Page 9: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 9

Key Recent Advancements

2003 Interpolation for Hardware Model Checking McMillan

2006 IMPACT (Path Interpolants) McMillan

2009 Path Interpolants for Hardware Model Checking Grumberg et al.

2010 IC3 (Different way of computing Interpolants, Hardware) Bradley

2011 WOLVERINE (Bit-level Implementation of IMPACT) Kroening et al.

2012 UFO (DAG Interpolation method, Predicate Abstraction + Interpolation) Gurfinkel et al.

2012 VINTA (Abstract Interpretation + Interpolation) Gurfinkel et al.

2011 FunFrog (Interprocedural) Sharygina et al.

2012 μZ (Horn clause solver based on GPDR) Bjorner et al.

2012 Duality (Horn clause solver based on Interpolation) McMillan, Rybalchenko

2012 WHALE (Interprocedural) Gurfinkel et al.

Page 10: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 10

reach(P) error(P)

Our Strategy

Under-approx. Abstract Under-approx.

Page 11: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 11

reach(P) error(P)

Our Strategy

Under-approx. Abstract Under-approx. Refine

Page 12: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 12

error(P)reach(P)

Our Strategy

Under-approx. Abstract Under-approx. Refine Abstract

Page 13: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 13

error(P)reach(P)

Our Strategy

And so on …

Page 14: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 14

error(P)reach(P)

reach(P) is covered

Our Strategy

Abstractions guide the SMT solver to look for general proofs

Page 15: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 15

It’s based on UD

……

Under-approximations

Abstract

Page 16: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 16

It’s based on UD

……

Under-approximations

Abstract

need not be monotonic

Page 17: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 17

Spacer is based on UD

……

Under-approximations

Abstract

non-trivial abstraction

Page 18: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 18

SpacerProgram

Under-Approximate

Check Safety Feasible?Feasible?

Abstract Refine

Proof-Based Abstraction CEGARNo No

Yes Yes

Safety Proof Counterexample

Page 19: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 19

Why Abstraction?

x = y = z = w = 0;while (*) {

x = *; y = *;assume (0 ≤ y ≤ 100x);if (y > 10w && z ≥ 100x) {

y = −y;}t = 1;w += t; z += 10t;

}assert (0 ≤ y)

only way to fail the assertion

Page 20: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 20

UD Reasoning

x = y = z = w = 0;while (*) {

x = *; y = *;assume (0 ≤ y ≤ 100x);if (y > 10w && z ≥ 100x) {

y = −y;}t = 1;w += t; z += 10t;

}assert (0 ≤ y)

1st Iteration:w = 0, z = 0

y ≤ 100x

Page 21: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 21

UD Reasoning

x = y = z = w = 0;while (*) {

x = *; y = *;assume (0 ≤ y ≤ 100x);if (y > 10w && z ≥ 100x) {

y = −y;}t = 1;w += t; z += 10t;

}assert (0 ≤ y)

2nd Iteration:w = 1, z =10

y ≤ 100x

Page 22: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 22

UD Reasoning

x = y = z = w = 0;while (*) {

x = *; y = *;assume (0 ≤ y ≤ 100x);if (y > 10w && z ≥ 100x) {

y = −y;}t = 1;w += t; z += 10t;

}assert (0 ≤ y)

3rd Iteration:w = 2, z = 20

y ≤ 100x

And so on…

Page 23: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 23

But …

x = y = z = w = 0;while (*) {

x = *; y = *;assume (0 ≤ y ≤ 100x);if (y > 10w && z ≥ 100x) {

y = −y;}t = 1;w += t; z += 10t;

}assert (0 ≤ y)

The value ‘1’ doesn’t matter!

Page 24: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 24

But …

x = y = z = w = 0;while (*) {

x = *; y = *;assume (0 ≤ y ≤ 100x);if (y > 10w && z ≥ 100x) {

y = −y;}t = *;w += t; z += 10t;

}assert (0 ≤ y)

Page 25: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 25

UD Reasoning on the Abstraction

x = y = z = w = 0;while (*) {

x = *; y = *;assume (0 ≤ y ≤ 100x);if (y > 10w && z ≥ 100x) {

y = −y;}t = *;w += t; z += 10t;

}assert (0 ≤ y)

2nd Iteration

w = t, z = 10t

z = 10w

All Iterations

Resolve t away

y ≤ 100x

Redundant

Page 26: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 26

Original Example

x = y = z = w = 0;while (*) {

if (*) {x++; y += 100;}else if (*)

if (x ≥ 4) {x++; y++;}else if (y > 10w && z ≥ 100x) {

y = −y;}t = 1;w += t; z += 10t;

}assert (!(x ≥ 4 && y ≤ 2))

Source: Automatically Refining Abstract Interpretations, Gulavani, Chakraborty, Nori and Rajamani, TACAS ‘08.

μZ (SMT-Based Model Checker,part of Z3)

Cannot solve in an hour

Spacer (our tool)

Finds a proof in a min.

Solves an abstraction in < 1 sec.

t = *;

Page 27: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 27

What’s the magic?

Focused Proofs

Abstractions guide the SMT solver to look for certain kind of proofs Avoid proofs specific to an under-approximation

How to obtain abstractions?

From proofs of under-approximations! (Proof-Based Abstraction) Hope: What’s sufficient for the under-approximation is sufficient in general Downside: If abstraction is too coarse, need to refine (CEGAR)

Page 28: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 28

SpacerProgram

Under-Approximate

Check Safety Feasible?Feasible?

Abstract Refine

Proof-Based Abstraction CEGARNo No

Yes Yes

Safety Proof Counterexample

Page 29: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 29

Schematic Example

init_stmt;c = 0;

while (*) {// invar_1, invar_2// invar_3, invar_4assume (c < k1);if (*) {

v1 = e1; v2 = e2;} else {

v3 = e3; v4 = e4;}v5 = e5; v6 = e6;c += 1;

}

assert (safe);

Add Counters

Under-approximate Solve

Loop Invariants

Page 30: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 30

Schematic Example

Under-approximate Solve Feasible?

init_stmt;c = 0;assume (invar_1, invar_2);while (*) {

// invar_1, invar_2// invar_3, invar_4assume (c < k1);if (*) {

v1 = e1; v2 = e2;} else {

v3 = e3; v4 = e4;}v5 = e5; v6 = e6;c += 1;assume (invar_1, invar_2);

}

assert (safe);

Unbounded!

Specific to under-approx.

Treat as guessedunbounded invariants.

Essentially like Houdini [FL’01].

Extract UnboundedInvariants

Strengthenwith

Invariants

[FL’01] Houdini, an annotationassistant for ESC/Java,C. Flanagan and K.R.M. Leino, 2001

Page 31: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 31

init_stmt;c = 0;assume (invar_1, invar_2);while (*) {

// invar_1, invar_2

if (*) {v1 = e1; v2 = e2;

} else {v3 = e3; v4 = e4;

}v5 = e5; v6 = e6;c += 1;assume (invar_1, invar_2);

}

assert (safe);

Does not provethe assertion

Schematic Example

Under-approximate Solve Feasible? NO

Page 32: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 32

init_stmt;c = 0;assume (invar_1, invar_2);while (*) {

// invar_1, invar_2// invar_3, invar_4assume (c < k1);if (*) {

v1 = e1; v2 = e2;} else {

v3 = e3; v4 = e4;}v5 = e5; v6 = e6;c += 1;assume (invar_1, invar_2);

}

assert (safe);

Redundantfor the proof

Schematic Example

Under-approximate Solve Feasible? NO Abstract

Page 33: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 33

Schematic Example

Under-approximate Solve Feasible? NO Abstract

init_stmt;c = 0;assume (invar_1, invar_2);while (*) {

// invar_1, invar_2// invar_3, invar_4assume (c < k1);if (*) {

v1 = e1; v2 = *;} else {

v3 = e3; v4 = *;}v5 = e5; v6 = *;c += 1;assume (invar_1, invar_2);

}

assert (safe);

Proof-BasedAbstraction

Page 34: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 34

init_stmt;c = 0;assume (invar_1, invar_2);while (*) {

assume (c < k2);if (*) {

v1 = e1; v2 = *;} else {

v3 = e3; v4 = *;}v5 = e5; v6 = *;c += 1;assume (invar_1, invar_2);

}

assert (safe);

Concretize

k2 > k1

Schematic Example

Under-approximate Solve

AbstractCounterexample!

Feasible?

Concrete controlpath is infeasible

NO Refine

Page 35: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 35

Schematic Example

Under-approximate Solve Feasible? NO Refine

init_stmt;c = 0;assume (invar_1, invar_2);while (*) {

assume (c < k2);if (*) {

v1 = e1; v2 = e2;} else {

v3 = e3; v4 = e4;}v5 = e5; v6 = *;c += 1;assume (invar_1, invar_2);

}

assert (safe);

CEGAR

Page 36: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 36

init_stmt;c = 0;assume (invar_1, invar_2);while (*) {

// invar_5// invar_6assume (c < k2);if (*) {

v1 = e1; v2 = e2;} else {

v3 = e3; v4 = e4;}v5 = e5; v6 = *;c += 1;assume (invar_1, invar_2);

}

assert (safe);

Unbounded

Schematic Example

Under-approximate Solve Feasible? YES

Invariants

Page 37: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 37

SpacerProgram

Under-Approximate

Check Safety Feasible?Feasible?

Abstract Refine

Proof-Based Abstraction CEGARNo No

Yes Yes

Safety Proof Counterexample

Page 38: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 38

Detailed Example

x = y = z = w = 0;

while (*) {

if:: x++; y += 100;:: (x ≥ 4) -> x++; y++;:: (y > 10w && z ≥ 100x) -> y = −y;fiw++; z += 10;

}

assert (!(x ≥ 4 && y ≤ 2));

if (nd ()) {x++; y += 100;}else if (nd () && x ≥ 4) {x++; y++;}else if (y > 10w && z ≥ 100x) {y = −y;}else assume (0);

non-deterministic choice(e.g. as in Promela)

C-like

Page 39: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 39

Detailed Example

x = y = z = w = 0;c = 0;

while (*) {// (y > 10w) => (z < 100x), z ≤ 100x,// x ≤ 2, c ≤ 0 => x ≤ 0, c ≤ 1 => x ≤ 1assume (c < 2);if:: x++; y += 100;:: (x ≥ 4) -> x++; y++;:: (y > 10w && z ≥ 100x) -> y = −y;fiw++; z += 10;c += 1;

}

assert (!(x ≥ 4 && y ≤ 2));

Add Counters

Under-approximate Solve

Loop Invariants

Page 40: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 40

Detailed Example

x = y = z = w = 0;c = 0;

while (*) {// (y > 10w) => (z < 100x), z ≤ 100x,// x ≤ 2, c ≤ 0 => x ≤ 0, c ≤ 1 => x ≤ 1assume (c < 2);if:: x++; y += 100;:: (x ≥ 4) -> x++; y++;:: (y > 10w && z ≥ 100x) -> y = −y;fiw++; z += 10;c += 1;

}

assert (!(x ≥ 4 && y ≤ 2));

Inductive Invariant

Under-approximate Solve

Safe

Page 41: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 41

Detailed Example

x = y = z = w = 0;c = 0;assume (y > 10w => z < 100x, z ≤ 100x);while (*) {

// (y > 10w) => (z < 100x), z ≤ 100x,// x ≤ 2, c ≤ 0 => x ≤ 0, c ≤ 1 => x ≤ 1assume (c < 2);if:: x++; y += 100;:: (x ≥ 4) -> x++; y++;:: (y > 10w && z ≥ 100x) -> y = −y;fiw++; z += 10;c += 1;assume (y > 10w => z < 100x, z ≤ 100x);

}

assert (!(x ≥ 4 && y ≤ 2));

Under-approximate Solve Feasible?

Preserved!Specific to under-approx.

Depend on counter

Extract UnboundedInvariants

Strengthenwith

Invariants

Page 42: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 42

Detailed Example

x = y = z = w = 0;c = 0;assume (y > 10w => z < 100x, z ≤ 100x);while (*) {

// (y > 10w) => (z < 100x), z ≤ 100x,

if:: x++; y += 100;:: (x ≥ 4) -> x++; y++;:: (y > 10w && z ≥ 100x) -> y = −y;fiw++; z += 10;c += 1;assume (y > 10w => z < 100x, z ≤ 100x);

}

assert (!(x ≥ 4 && y ≤ 2));

Under-approximate Solve Feasible? NO

Does not provethe assertion

Page 43: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 43

Detailed Example

x = y = z = w = 0;c = 0;assume (y > 10w => z < 100x, z ≤ 100x);while (*) {

// (y > 10w) => (z < 100x), z ≤ 100x,// x ≤ 2, c ≤ 0 => x ≤ 0, c ≤ 1 => x ≤ 1assume (c < 2);if:: x++; y += 100;:: (x ≥ 4) -> x++; y++;:: (y > 10w && z ≥ 100x) -> y = −y;fiw++; z += 10;c += 1;assume (y > 10w => z < 100x, z ≤ 100x);

}

assert (!(x ≥ 4 && y ≤ 2));

Under-approximate Solve Feasible? NO Abstract

Redundant

Page 44: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 44

Detailed Example

x = y = z = w = 0;c = 0;assume (y > 10w => z < 100x, z ≤ 100x);while (*) {

// (y > 10w) => (z < 100x), z ≤ 100x,// x ≤ 2, c ≤ 0 => x ≤ 0, c ≤ 1 => x ≤ 1assume (c < 2);if:: x++; y = *;:: (x ≥ 4) -> x++; y = *;:: (y > 10w && z ≥ 100x) -> y = *;fiw = *; z = *;c += 1;assume (y > 10w => z < 100x, z ≤ 100x);

}

assert (!(x ≥ 4 && y ≤ 2));

Under-approximate Solve Feasible? NO Abstract

Fails Enlarge error

Page 45: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 45

Detailed Example

x = y = z = w = 0;c = 0;assume (y > 10w => z < 100x, z ≤ 100x);while (*) {

// (y > 10w) => (z < 100x), z ≤ 100x,// x ≤ 2, c ≤ 0 => x ≤ 0, c ≤ 1 => x ≤ 1assume (c < 2);if:: x++; y = *;:: (x ≥ 4) -> x++; y = *;:: (y > 10w && z ≥ 100x) -> y = *;fiw = *; z = *;c += 1;assume (y > 10w => z < 100x, z ≤ 100x);

}

assert (!(x ≥ 4));

Under-approximate Solve Feasible? NO Abstract

Page 46: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 46

Detailed Example

x = y = z = w = 0;c = 0;assume (y > 10w => z < 100x, z ≤ 100x);while (*) {

assume (c < 4);if:: x++; y = *;:: (x ≥ 4) -> x++; y = *;:: (y > 10w && z ≥ 100x) -> y = *;fiw = *; z = *;c += 1;assume (y > 10w => z < 100x, z ≤ 100x);

}

assert (!(x ≥ 4));

Under-approximate Solve

Counterexample!

Increment x to 4Choose y arbitrarily

Feasible?

Concrete controlpath is infeasible

NO Refine

Concretize

Page 47: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 47

Detailed Example

x = y = z = w = 0;c = 0;assume (y > 10w => z < 100x, z ≤ 100x);while (*) {

assume (c < 4);if:: x++; y += 100;:: (x ≥ 4) -> x++; y++;:: (y > 10w && z ≥ 100x) -> y = −y;fiw = *; z = *;c += 1;assume (y > 10w => z < 100x, z ≤ 100x);

}

assert (!(x ≥ 4 && y ≤ 2));

Under-approximate Solve Feasible? NO Refine

Page 48: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 48

Detailed Example

x = y = z = w = 0;c = 0;assume (y > 10w => z < 100x, z ≤ 100x);while (*) {

// (y > 10w) => (z < 100x), z ≤ 100x// y > 0, (x > 0) => (y ≥ 100)assume (c < 4);if:: x++; y += 100;:: (x ≥ 4) -> x++; y++;:: (y > 10w && z ≥ 100x) -> y = −y;fiw = *; z = *;c += 1;assume (y > 10w => z < 100x, z ≤ 100x);

}

assert (!(x ≥ 4 && y ≤ 2));

Under-approximate Solve Feasible? YES

Inductive Invariant

Safe

Unbounded

Page 49: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 49

Implementation Details – Unbounded Invariants

Pre-Lemmas Post-LemmasConcrete Counters

Goal Find maximal such that

Page 50: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 50

Implementation Details – Unbounded Invariants

UNSAT

SAT with true

SAT?

Repeat until fixed point

Page 51: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 51

Implementation Details – Unbounded Invariants

Maximal subset of true post-lemmasMinimal number of bi’s to be set to falseFixed point Iteration:

Introduce Assumption

variables

Page 52: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 52

Implementation Details – Unbounded Invariants

Iteration 1

Iteration 2

disableddisabled

Page 53: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 53

Implementation Details – Abstraction

Introduce Assumption

variables

Page 54: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 54

Implementation Details – Abstraction

Are all lemmas necessary?

Page 55: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 55

Implementation Details – Abstraction

Introduce Assumption variables for

lemmas

Page 56: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 56

Spacer ToolProgram

Under-Approximate

Check Safety Feasible?Feasible?

Abstract Refine

Proof-Based Abstraction CEGARNo No

Yes Yes

Safety Proof Counterexample

Page 57: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 57

Spacer ToolProgram

Under-Approximate

Check Safety Feasible?Feasible?

Abstract Refine

Proof-Based Abstraction CEGARNo No

Yes Yes

Safety Proof Counterexample

μZ Horn-Clause Solver(part of Z3)

Page 58: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 58

Spacer ToolProgram

Under-Approximate

Check Safety Feasible?Feasible?

Abstract Refine

Proof-Based Abstraction CEGARNo No

Yes Yes

Safety Proof Counterexample

Horn-Clause Encoding

μZ Horn-Clause Solver(part of Z3)

Page 59: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 59

Spacer Tool

C Program

Preprocessing UFO Frontend (based on LLVM)Simplification, Large Block Encoding, etc.

Horn Clause Encoding Implemented using UFO Frontend

Page 60: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 60

Results on SV-COMP’13 Benchmarks

0 50 100 1500

50

100

150

UNSAFE Benchmarks

μZ (secs)

Spac

er (s

ecs)

Abstraction did not helpfor UNSAFE

ALSO,not a challenging pool

of benchmarks

Page 61: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 61

Results on SV-COMP’13 Benchmarks

0 100 200 300 400 500 600 700 800 9000

100

200

300

400

500

600

700

800

900

SAFE Benchmarks

μZ (secs)

Spac

er (s

ecs)

Page 62: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 62

Results on SV-COMP’13 Benchmarks

0 100 200 300 400 500 600 700 800 9000

100

200

300

400

500

600

700

800

900

SAFE Benchmarks

μZ (secs)

Spac

er (s

ecs)

~1 min.Not very meaningful

to compare

Page 63: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 63

Results on SV-COMP’13 Benchmarks

0 100 200 300 400 500 600 700 800 9000

100

200

300

400

500

600

700

800

900

SAFE Benchmarks

μZ (secs)

Spac

er (s

ecs)

< 5 min.Mixed

Results

Page 64: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 64

Results on SV-COMP’13 Benchmarks

0 100 200 300 400 500 600 700 800 9000

100

200

300

400

500

600

700

800

900

SAFE Benchmarks

μZ (secs)

Spac

er (s

ecs)

Advantage!

Page 65: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 65

Results on SV-COMP’13 Benchmarks

0 100 200 300 400 500 600 700 800 9000

100

200

300

400

500

600

700

800

900

SAFE Benchmarks

μZ (secs)

Spac

er (s

ecs)

Advantage!

Time-out

Mem-out

Page 66: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 66

Conclusion

Focused Proofs

Abstractions guide the SMT solver to look for certain kind of proofs Avoid proofs specific to an under-approximation

How to obtain abstractions?

From proofs of under-approximations! (Proof-Based Abstraction) Hope: What’s sufficient for the under-approximation is sufficient in general Downside: If abstraction is too coarse, need to refine (CEGAR)

A framework for automated abstraction in SMT-based Software Model Checking Implementation using an existing SMT-based model checker with practical

advantage

Contributions

Page 67: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 67

Conclusion (contd…)

Post-pruning of Proofs during Abstraction (Local vs. Global Proofs) Non-monotonic abstractions Major role of invariants (exploit the generality of proofs of under-approximations

Visit spacer.bitbucket.org todownload tool and detailed slides!

Why does PBA work?

Page 68: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 68

On-going and Future Work

Observation: Fixed granularity of abstraction – at the program levelObservation: Restricted space of abstractions

Questions: When/How to abstract/refine?

Observation: Proofs too dependent on counter constraints (i.e. underapprox.)

Question: How to use counters only when needed? In general, how to minimize the use of a given set of assumptions?

Observation: Abstraction is done offline, after obtaining a proof of an under-approximation.

Question: How does an on-the-fly abstraction work? When each transition is treated as a recursion-free procedure, it is similar to summarizing procedures on-the-fly. Also, how to handle recursion?

Page 69: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 69

Read our CAV’13 paper for details…

Questions?

Page 70: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 70

Extra Slides

Page 71: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 71

SMT-Based Model Checking

init

error

CFG Loop-Free Unrolling

Possibility 1 : UNSAFE

Possibility 2 : SAFE

Path Interpolants (McMillan ‘06)

Discharge Verification Condition on SMT solver

Page 72: Automatic Abstraction in SMT-Based Unbounded Software Model Checking

© Anvesh KomuravelliSpacer 72

SMT-Based Model Checking

init

error

CFG

Further Unrolling

Possibility 1 : UNSAFE

Possibility 2 : SAFE

DAG Interpolants [AGC’12]

Continue Until Convergence

Discharge Verification Condition on SMT solver

[AGC’12] : From Under-approximations to Over-approximations and Back,Albarghouthi, Gurfinkel and Chechik, TACAS ‘12