widening with landmarks · widening with landmarks related work axel simon and andy king widening...

58
The Basics of Convex Polyhedra An Example from String-Buffer Analysis Acceleration Techniques Widening with Landmarks Axel Simon and Andy King Computing Laboratory, University of Kent, Canterbury, CT2 7NF, UK {A.Simon,A.King}@kent.ac.uk November 9, 2006 Axel Simon and Andy King Widening with Landmarks

Upload: others

Post on 22-Sep-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Widening with Landmarks

Axel Simon and Andy King

Computing Laboratory, University of Kent,Canterbury, CT2 7NF, UK

{A.Simon,A.King}@kent.ac.ukNovember 9, 2006

Axel Simon and Andy King Widening with Landmarks

Page 2: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Outline of the Talk

The Basics of Convex PolyhedraPolyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

An Example from String-Buffer AnalysisThe idea of tracking nul positionsAnalysing the LoopNeed for Acceleration

Acceleration TechniquesThe Widening/Narrowing ApproachWidening With LandmarksRelated Work

Axel Simon and Andy King Widening with Landmarks

Page 3: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

The Idea of Polyhedra in Program Analysis

Treat valuations of x, y as points in 2-dimensional space:

1

2

1 2 5

y

x10

5

8

Each point is valuation in one run.

Axel Simon and Andy King Widening with Landmarks

Page 4: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

The Idea of Polyhedra in Program Analysis

Treat valuations of x, y as points in 2-dimensional space:

1

2

1 2 5

y

x10

5

8

-x+y≤2

y≤8x+y≤17

x-y≤5

y≥1

-x-2y≤-6

x≥2

Approximate with finite set of inequalities.

Axel Simon and Andy King Widening with Landmarks

Page 5: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

The Idea of Polyhedra in Program Analysis

Treat valuations of x, y as points in 2-dimensional space:

1

2

1 2 5

y

x10

5

8

Use polyhedra to describe possible program states.

Axel Simon and Andy King Widening with Landmarks

Page 6: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

Principal Operations on Polyhedra

Evaluate: if (x<y) { x=3; }

1

1 5

y

x10

5

Initial state: P

1

1 5

y

x10

5

x≥y

1

1 5

y

x10

5

x-y≤-1

Else-branch: Then-branch:Q = P u {x ≥ y} R = P u {x < y}

Axel Simon and Andy King Widening with Landmarks

Page 7: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

Principal Operations on Polyhedra

Evaluate: if (x<y) { x=3; }

1

1 5

y

x10

5

Initial state: P

1

1 5

y

x10

5

x≥y

1

1 5

y

x10

5

Else-branch: Evaluate x=3:Q = P u {x ≥ y} S = ∃x(R)

Axel Simon and Andy King Widening with Landmarks

Page 8: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

Principal Operations on Polyhedra

Evaluate: if (x<y) { x=3; }

1

1 5

y

x10

5

Initial state: P

1

1 5

y

x10

5

x≥y

1

1 5

y

x10

5

x=3

Else-branch: S = ∃x(R)Q = P u {x ≥ y} T = S u {x = 3}

Axel Simon and Andy King Widening with Landmarks

Page 9: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

Principal Operations on Polyhedra

Evaluate: if (x<y) { x=3; }

1

1 5

y

x10

5

x≥y

1

1 5

y

x10

5

x=3

Else-branch: S = ∃x(R)Q = P u {x ≥ y} T = S u {x = 3}

1

1 5

y

x10

5

then-branch

else-branch

Join branches:U = Q t T

Axel Simon and Andy King Widening with Landmarks

Page 10: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

Principal Operations on Polyhedra

Evaluate: if (x<y) { x=3; }

1

1 5

y

x10

5

x≥y

1

1 5

y

x10

5

x=3

Else-branch: S = ∃x(R)Q = P u {x ≥ y} T = S u {x = 3}

1

1 5

y

x10

5

Join branches:U = Q t T

Axel Simon and Andy King Widening with Landmarks

Page 11: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

Principal Operations on Polyhedra

Evaluate: if (x<y) { x=3; }

1

1 5

y

x10

5

x≥y

1

1 5

y

x10

5

x=3

Else-branch: S = ∃x(R)Q = P u {x ≥ y} T = S u {x = 3}

1

1 5

y

x10

5

-7x+y≤-12

Join branches:U = Q t T

Axel Simon and Andy King Widening with Landmarks

Page 12: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

Idea of Polyhedral Analysis

1. Infer all possible states of a program.

I Track polyhedron for each basic block.I Define semantics of statements on polyhedra.

I Approximate non-linear functions.I Assume worst-case for all inputs.I Assume unrestricted polyhedron at main.

I Fixpoint: Apply transfer functions until stable.

2. Ensure that none of these are erroneous.

Axel Simon and Andy King Widening with Landmarks

Page 13: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

Idea of Polyhedral Analysis

1. Infer all possible states of a program.

I Track polyhedron for each basic block.I Define semantics of statements on polyhedra.

I Approximate non-linear functions.I Assume worst-case for all inputs.I Assume unrestricted polyhedron at main.

I Fixpoint: Apply transfer functions until stable.

2. Ensure that none of these are erroneous.

Axel Simon and Andy King Widening with Landmarks

Page 14: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

Idea of Polyhedral Analysis

1. Infer all possible states of a program.

I Track polyhedron for each basic block.

I Define semantics of statements on polyhedra.

I Approximate non-linear functions.I Assume worst-case for all inputs.I Assume unrestricted polyhedron at main.

I Fixpoint: Apply transfer functions until stable.

2. Ensure that none of these are erroneous.

Axel Simon and Andy King Widening with Landmarks

Page 15: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

Idea of Polyhedral Analysis

1. Infer all possible states of a program.

I Track polyhedron for each basic block.I Define semantics of statements on polyhedra.

I Approximate non-linear functions.I Assume worst-case for all inputs.I Assume unrestricted polyhedron at main.

I Fixpoint: Apply transfer functions until stable.

2. Ensure that none of these are erroneous.

Axel Simon and Andy King Widening with Landmarks

Page 16: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

Idea of Polyhedral Analysis

1. Infer all possible states of a program.

I Track polyhedron for each basic block.I Define semantics of statements on polyhedra.

I Approximate non-linear functions.I Assume worst-case for all inputs.I Assume unrestricted polyhedron at main.

I Fixpoint: Apply transfer functions until stable.

2. Ensure that none of these are erroneous.

Axel Simon and Andy King Widening with Landmarks

Page 17: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

Practical Polyhedral Analysis

Polyhedral operations are exponential in no. of variables.

I cannot infer information on individual array elements

I use TVPI sub-domain of general polyhedra: only axi + bxj ≤ c

I tightening around contained integral points available for TVPI

For precise analysis of string buffers:

I ignore string buffer contents, but track nul character

Axel Simon and Andy King Widening with Landmarks

Page 18: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

Polyhedral AbstractionsPrincipal OperationsIdea of Polyhedral Analysis

Practical Polyhedral Analysis

Polyhedral operations are exponential in no. of variables.

I cannot infer information on individual array elements

I use TVPI sub-domain of general polyhedra: only axi + bxj ≤ c

I tightening around contained integral points available for TVPI

For precise analysis of string buffers:

I ignore string buffer contents, but track nul character

Axel Simon and Andy King Widening with Landmarks

Page 19: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The idea of tracking nul positionsAnalysing the LoopNeed for Acceleration

Prove String-Buffer Operation Correct

Prove the absence of out-of-bound array accesses:

char s[32] = "the string";while (*s) s++;

Method:

I Expand while-loop.

I Use the following polyhedral variables:I s is offset of pointer sI n is first nul position in string bufferI c is character at *s

Axel Simon and Andy King Widening with Landmarks

Page 20: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The idea of tracking nul positionsAnalysing the LoopNeed for Acceleration

Prove String-Buffer Operation Correct

Prove the absence of out-of-bound array accesses:

char s[32] = "the string";while (*s) s++;

Method:

I Expand while-loop.I Use the following polyhedral variables:

I s is offset of pointer sI n is first nul position in string bufferI c is character at *s

Axel Simon and Andy King Widening with Landmarks

Page 21: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The idea of tracking nul positionsAnalysing the LoopNeed for Acceleration

Calculating a fixpoint (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q = ∅ */c = *s;/*R = ∅*/if (c==0) break;/* T = ∅*/s++;

/* U = ∅*/};/* S = ∅ */Let P ≡ {s = 0, n = 10}, Q = P t U, T = R u {c > 0}, S = . . .,

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 22: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The idea of tracking nul positionsAnalysing the LoopNeed for Acceleration

Calculating a fixpoint (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q0 ≡ {s = 0} */c = *s;/*R = ∅*/if (c==0) break;/* T = ∅*/s++;

/* U = ∅*/};/* S = ∅ */Calculate Q0 = P t U = P.

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 23: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The idea of tracking nul positionsAnalysing the LoopNeed for Acceleration

Calculating a fixpoint (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q0 ≡ {s = 0} */c = *s;/* R0 ≡ {s = 0, 1 ≤ c ≤ 255}*/if (c==0) break;/* T = ∅*/s++;

/* U = ∅*/};/* S = ∅ */

R

255

1

1 10

c

s

2

5

0

Intersection with s = n and s > n yields two empty polyhedra.

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 24: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The idea of tracking nul positionsAnalysing the LoopNeed for Acceleration

Calculating a fixpoint (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q0 ≡ {s = 0} */c = *s;/*R0 ≡ {s = 0, 1 ≤ c ≤ 255}*/if (c==0) break;/* T0 ≡ {s = 0, 1 ≤ c ≤ 255}*/s++;

/* U = ∅*/};/* S = ∅ */

R

255

1

1 10

c

s

2

5

0

Loop invariant c!=0 holds for all of R.

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 25: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The idea of tracking nul positionsAnalysing the LoopNeed for Acceleration

Calculating a fixpoint (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q0 ≡ {s = 0} */c = *s;/*R0 ≡ {s = 0, 1 ≤ c ≤ 255}*/if (c==0) break;/* T0 ≡ {s = 0, 1 ≤ c ≤ 255}*/s++;

/* U0 ≡ {s = 1, 1 ≤ c ≤ 255}*/};/* S = ∅ */

U

255

1

1 10

c

s

2

5

0

Increment s by linearly translating T .

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 26: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The idea of tracking nul positionsAnalysing the LoopNeed for Acceleration

Calculating a fixpoint (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q1 ≡ {0 ≤ s ≤ 1} */c = *s;/*R0 ≡ {s = 0, 1 ≤ c ≤ 255}*/if (c==0) break;/* T0 ≡ {s = 0, 1 ≤ c ≤ 255}*/s++;

/*U0 ≡ {s = 1, 1 ≤ c ≤ 255}*/};/* S = ∅ */

U

255

1

1 10

c

s

2

5

0

Calculate Q1 = P t U0.

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 27: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The idea of tracking nul positionsAnalysing the LoopNeed for Acceleration

Calculating a fixpoint (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q1 ≡ {0 ≤ s ≤ 1} */c = *s;/* R1 ≡ {0 ≤ s ≤ 1, 1 ≤ c ≤ 255}*/if (c==0) break;/* T0 ≡ {s = 0, 1 ≤ c ≤ 255}*/s++;

/*U0 ≡ {s = 1, 1 ≤ c ≤ 255}*/};/* S = ∅ */

255

1

1 10

c

s

2

5

R1

First case of R is enabled.

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 28: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The idea of tracking nul positionsAnalysing the LoopNeed for Acceleration

Calculating a fixpoint (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q1 ≡ {0 ≤ s ≤ 1} */c = *s;/*R1 ≡ {0 ≤ s ≤ 1, 1 ≤ c ≤ 255}*/if (c==0) break;/* T1 ≡ {0 ≤ s ≤ 1, 1 ≤ c ≤ 255}*/s++;

/* U1 ≡ {1 ≤ s ≤ 2, 1 ≤ c ≤ 255}*/};/* S = ∅ */

255

1

1 10

c

s

2

5

U1

This process continues for another 8 iterations.

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 29: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The idea of tracking nul positionsAnalysing the LoopNeed for Acceleration

Calculating a fixpoint (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q10 ≡ {0 ≤ s ≤ 10} */c = *s;/* R10 ≡ {c ≤ 255, i + 10c ≥ 10,

255i + c ≤ 2550}*/

if (c==0) break;/* T9 ≡ {0 ≤ s ≤ 9, 1 ≤ c ≤ 255}*/s++;

/*U9 ≡ {1 ≤ s ≤ 10, 1 ≤ c ≤ 255}*/};/* S = ∅ */

255

1

1 10

c

s

2

5

R

The first two of the following equations now contribute:

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 30: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The idea of tracking nul positionsAnalysing the LoopNeed for Acceleration

Calculating a fixpoint (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q10 ≡ {0 ≤ s ≤ 10} */c = *s;/*R10 ≡ {c ≤ 255, i + 10c ≥ 10,

255i + c ≤ 2550}*/

if (c==0) break;/* T10 ≡ {0 ≤ s ≤ 9, 1 ≤ c ≤ 255}*/s++;

/*U10 ≡ {1 ≤ s ≤ 10, 1 ≤ c≤255}*/};/* S0 ≡ {c = 0, s = 10} */

255

1

1 10

c

s

2

5

T2

S0

The loop invariant separates the two behaviours again.

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 31: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The idea of tracking nul positionsAnalysing the LoopNeed for Acceleration

Accelerating the Fixpoint-Calculation

Analyzing a loop using polyhedra:

I Requires repeated analysis of the loop body.

I Needs acceleration to ensure practical analysis times.

I Apply Widening in one node of every loop (SCC).

I Idea: Given iterates Qi−1 and Qi , calculate Qi+1 = Qi−1∇Qi

by removing unstable bounds from Qi−1.

Axel Simon and Andy King Widening with Landmarks

Page 32: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The idea of tracking nul positionsAnalysing the LoopNeed for Acceleration

Accelerating the Fixpoint-Calculation

Analyzing a loop using polyhedra:

I Requires repeated analysis of the loop body.

I Needs acceleration to ensure practical analysis times.

I Apply Widening in one node of every loop (SCC).

I Idea: Given iterates Qi−1 and Qi , calculate Qi+1 = Qi−1∇Qi

by removing unstable bounds from Qi−1.

Axel Simon and Andy King Widening with Landmarks

Page 33: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Accelerating the String-Buffer Example

Applying Widening to the Example:I Calculate Qi+1 = Qi−1∇Qi by removing unstable bounds in

Qi−1.

I Q0 ≡ {0 ≤ s ≤ 0}I Q1 ≡ {0 ≤ s ≤ 1}I Q2 ≡ {0 ≤ s}

255

1

1 10

c

s

2

5 20 30

R

0≤s≤0

Axel Simon and Andy King Widening with Landmarks

Page 34: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Accelerating the String-Buffer Example

Applying Widening to the Example:I Calculate Qi+1 = Qi−1∇Qi by removing unstable bounds in

Qi−1.I Q0 ≡ {0 ≤ s ≤ 0}

I Q1 ≡ {0 ≤ s ≤ 1}I Q2 ≡ {0 ≤ s}

255

1

1 10

c

s

2

5 20 30

R

0≤s≤0

Axel Simon and Andy King Widening with Landmarks

Page 35: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Accelerating the String-Buffer Example

Applying Widening to the Example:I Calculate Qi+1 = Qi−1∇Qi by removing unstable bounds in

Qi−1.I Q0 ≡ {0 ≤ s ≤ 0}I Q1 ≡ {0 ≤ s ≤ 1}

I Q2 ≡ {0 ≤ s}

255

1

1 10

c

s

2

5 20 30

R

0≤s≤1

Axel Simon and Andy King Widening with Landmarks

Page 36: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Accelerating the String-Buffer Example

Applying Widening to the Example:I Calculate Qi+1 = Qi−1∇Qi by removing unstable bounds in

Qi−1.I Q0 ≡ {0 ≤ s ≤ 0}I Q1 ≡ {0 ≤ s ≤ 1}I Q2 ≡ {0 ≤ s}

255

1

1 10

c

s

2

5 20 30

R

Axel Simon and Andy King Widening with Landmarks

Page 37: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Recovering Precision: Narrowing

Narrowing: recover precision after widening.

I calculate Qi+1 = Qi−1 u Qi for a few loop iterations

I has no effect in exampleI can recover precision for for (i=0; i<100; i++) {}:

I Q0 ≡ {i = 0}, Q1 ≡ {0 ≤ i ≤ 1}I Widen: Q2 ≡ {0 ≤ i}I Narrow: Q3 ≡ {0 ≤ i ≤ 99}

I cannot recover precision for for (i=0; i!=100; i++) {}

I other difficulties due to non-monotone state growth

Axel Simon and Andy King Widening with Landmarks

Page 38: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Recovering Precision: Narrowing

Narrowing: recover precision after widening.

I calculate Qi+1 = Qi−1 u Qi for a few loop iterations

I has no effect in example

I can recover precision for for (i=0; i<100; i++) {}:

I Q0 ≡ {i = 0}, Q1 ≡ {0 ≤ i ≤ 1}I Widen: Q2 ≡ {0 ≤ i}I Narrow: Q3 ≡ {0 ≤ i ≤ 99}

I cannot recover precision for for (i=0; i!=100; i++) {}

I other difficulties due to non-monotone state growth

Axel Simon and Andy King Widening with Landmarks

Page 39: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Recovering Precision: Narrowing

Narrowing: recover precision after widening.

I calculate Qi+1 = Qi−1 u Qi for a few loop iterations

I has no effect in exampleI can recover precision for for (i=0; i<100; i++) {}:

I Q0 ≡ {i = 0}, Q1 ≡ {0 ≤ i ≤ 1}

I Widen: Q2 ≡ {0 ≤ i}I Narrow: Q3 ≡ {0 ≤ i ≤ 99}

I cannot recover precision for for (i=0; i!=100; i++) {}

I other difficulties due to non-monotone state growth

Axel Simon and Andy King Widening with Landmarks

Page 40: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Recovering Precision: Narrowing

Narrowing: recover precision after widening.

I calculate Qi+1 = Qi−1 u Qi for a few loop iterations

I has no effect in exampleI can recover precision for for (i=0; i<100; i++) {}:

I Q0 ≡ {i = 0}, Q1 ≡ {0 ≤ i ≤ 1}I Widen: Q2 ≡ {0 ≤ i}

I Narrow: Q3 ≡ {0 ≤ i ≤ 99}I cannot recover precision for for (i=0; i!=100; i++) {}

I other difficulties due to non-monotone state growth

Axel Simon and Andy King Widening with Landmarks

Page 41: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Recovering Precision: Narrowing

Narrowing: recover precision after widening.

I calculate Qi+1 = Qi−1 u Qi for a few loop iterations

I has no effect in exampleI can recover precision for for (i=0; i<100; i++) {}:

I Q0 ≡ {i = 0}, Q1 ≡ {0 ≤ i ≤ 1}I Widen: Q2 ≡ {0 ≤ i}I Narrow: Q3 ≡ {0 ≤ i ≤ 99}

I cannot recover precision for for (i=0; i!=100; i++) {}

I other difficulties due to non-monotone state growth

Axel Simon and Andy King Widening with Landmarks

Page 42: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Recovering Precision: Narrowing

Narrowing: recover precision after widening.

I calculate Qi+1 = Qi−1 u Qi for a few loop iterations

I has no effect in exampleI can recover precision for for (i=0; i<100; i++) {}:

I Q0 ≡ {i = 0}, Q1 ≡ {0 ≤ i ≤ 1}I Widen: Q2 ≡ {0 ≤ i}I Narrow: Q3 ≡ {0 ≤ i ≤ 99}

I cannot recover precision for for (i=0; i!=100; i++) {}

I other difficulties due to non-monotone state growth

Axel Simon and Andy King Widening with Landmarks

Page 43: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Recovering Precision: Narrowing

Narrowing: recover precision after widening.

I calculate Qi+1 = Qi−1 u Qi for a few loop iterations

I has no effect in exampleI can recover precision for for (i=0; i<100; i++) {}:

I Q0 ≡ {i = 0}, Q1 ≡ {0 ≤ i ≤ 1}I Widen: Q2 ≡ {0 ≤ i}I Narrow: Q3 ≡ {0 ≤ i ≤ 99}

I cannot recover precision for for (i=0; i!=100; i++) {}

I other difficulties due to non-monotone state growth

Axel Simon and Andy King Widening with Landmarks

Page 44: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Widening with Landmarks (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q0 ≡ {s = 0} */c = *s;/*R = ∅*/if (c==0) break;/* T = ∅*/s++;

/* U = ∅*/};/* S = ∅ */Calculate Q0 = P t U = P.

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 45: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Widening with Landmarks (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q0 ≡ {s = 0} */c = *s;/* R0 ≡ {s = 0, 1 ≤ c ≤ 255}*/if (c==0) break;/* T = ∅*/s++;

/* U = ∅*/};/* S = ∅ */

R

255

1

1 10

c

s

2

5

0

d0e0

Measure distance d0, e0 to unsatisfiable inequalities.

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 46: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Widening with Landmarks (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q1 ≡ {0 ≤ s ≤ 1} */c = *s;/* R1 ≡ {0 ≤ s ≤ 1, 1 ≤ c ≤ 255}*/if (c==0) break;/* T0 ≡ {s = 0, 1 ≤ c ≤ 255}*/s++;

/* U0 ≡ {s = 1, 1 ≤ c ≤ 255}*/};/* S = ∅ */

255

1

1 10

c

s

2

5

R1

d1e1

Measure a second sample d1, e1.

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 47: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Widening with Landmarks (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q2 ≡ {0 ≤ s ≤ 2} */c = *s;/*R1 ≡ {0 ≤ s ≤ 1, 1 ≤ c ≤ 255}*/if (c==0) break;/* T1 ≡ {0 ≤ s ≤ 1, 1 ≤ c ≤ 255}*/s++;

/* U1 ≡ {1 ≤ s ≤ 2, 1 ≤ c ≤ 255}*/};/* S = ∅ */

255

1

1 10

c

s

2

5

R1

d1e1

Relax inequalities in Q1 until closest landmark is reached

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 48: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Widening with Landmarks (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q3 ≡ {0 ≤ s ≤ 10} */c = *s;/*R1 ≡ {0 ≤ s ≤ 1, 1 ≤ c ≤ 255}*/if (c==0) break;/* T1 ≡ {0 ≤ s ≤ 1, 1 ≤ c ≤ 255}*/s++;

/* U1 ≡ {1 ≤ s ≤ 2, 1 ≤ c ≤ 255}*/};/* S = ∅ */

255

1

1 10

c

s

2

5

R1

d1e1

Relax d1/(d0 − d1) times difference of s ≤ 0, s ≤ 1.

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 49: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Widening with Landmarks (n = 10 omitted for brevity):

char s[32] = "the string";while (true) {

/* Q3 ≡ {0 ≤ s ≤ 10} */c = *s;/* R3 ≡ {c ≤ 255, i + 10c ≥ 10,

255i + c ≤ 2550}*/

if (c==0) break;/* T1 ≡ {0 ≤ s ≤ 1, 1 ≤ c ≤ 255}*/s++;

/* U1 ≡ {1 ≤ s ≤ 2, 1 ≤ c ≤ 255}*/};/* S = ∅ */

255

1

1 10

c

s

2

5

R

The extrapolated state enables the next behavior.

R = ∃c(Q) u {s < n} u {1 ≤ c ≤ 255}t ∃c(Q) u {s = n} u {c = 0}t ∃c(Q) u {s > n} u {0 ≤ c ≤ 255}

Axel Simon and Andy King Widening with Landmarks

Page 50: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Widening with Landmarks

Landmark: inequality which renders a polyhedron empty onintersection.

I Track landmarks in two consecutive loop iterations.

I Extrapolate changing inequalities at widening point.

I Apply standard widening if no more landmarks are found.

Observations:

I Need two loop iterations to perform linear extrapolation.

I Landmarks can contain variables not in scope at wideningpoint.

I Measuring distance may have no overhead.

Axel Simon and Andy King Widening with Landmarks

Page 51: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Widening with Landmarks

Landmark: inequality which renders a polyhedron empty onintersection.

I Track landmarks in two consecutive loop iterations.

I Extrapolate changing inequalities at widening point.

I Apply standard widening if no more landmarks are found.

Observations:

I Need two loop iterations to perform linear extrapolation.

I Landmarks can contain variables not in scope at wideningpoint.

I Measuring distance may have no overhead.

Axel Simon and Andy King Widening with Landmarks

Page 52: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Related Work: Cousot et al.

Narrowing [Cousot and Halbwachs, POPL 78]:

I Insufficient precision.

I Difficult to implement.

Widening with thresholds [Cousot et al., ESOP 05]:

I Manually set thresholds for extrapolation.

I Can only deal with bounds on single variables.

Axel Simon and Andy King Widening with Landmarks

Page 53: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Related Work: Cousot et al.

Narrowing [Cousot and Halbwachs, POPL 78]:

I Insufficient precision.

I Difficult to implement.

Widening with thresholds [Cousot et al., ESOP 05]:

I Manually set thresholds for extrapolation.

I Can only deal with bounds on single variables.

Axel Simon and Andy King Widening with Landmarks

Page 54: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Related Work: Gopan and Reps

Lookahead Widening [Gopan, Reps, CAV ’06]:

I Use 2 polyhedra (pilot and main).

I Perform widening/narrowing on pilot.

I Only evaluate behaviors that are enabled w.r.t. main.

I Promote pilot to main once stable.

Compared to Widening with Landmarks:

I Can use off-the-shelf polyhedra libraries.

I Uses two polyhedra (but can often share one).

I More algebraic.

Axel Simon and Andy King Widening with Landmarks

Page 55: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Related Work: Gopan and Reps

Lookahead Widening [Gopan, Reps, CAV ’06]:

I Use 2 polyhedra (pilot and main).

I Perform widening/narrowing on pilot.

I Only evaluate behaviors that are enabled w.r.t. main.

I Promote pilot to main once stable.

Compared to Widening with Landmarks:

I Can use off-the-shelf polyhedra libraries.

I Uses two polyhedra (but can often share one).

I More algebraic.

Axel Simon and Andy King Widening with Landmarks

Page 56: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Related Work: Gonnord and Halbwachs

Widening and Acceleration [Gonnord and Halbwachs, SAS ’06]:

I Geared towards timed automata.

I Infer displacement (delta) of state for different paths.

I Accelerate state growth for each delta.

Compared to Widening with Landmarks:

I Set of paths in C programs not obvious.

I Not clear where loop invariants reside in programs.

I Cannot analyze programs with deltas (pointer dereferences).

Axel Simon and Andy King Widening with Landmarks

Page 57: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Related Work: Gonnord and Halbwachs

Widening and Acceleration [Gonnord and Halbwachs, SAS ’06]:

I Geared towards timed automata.

I Infer displacement (delta) of state for different paths.

I Accelerate state growth for each delta.

Compared to Widening with Landmarks:

I Set of paths in C programs not obvious.

I Not clear where loop invariants reside in programs.

I Cannot analyze programs with deltas (pointer dereferences).

Axel Simon and Andy King Widening with Landmarks

Page 58: Widening with Landmarks · Widening With Landmarks Related Work Axel Simon and Andy King Widening with Landmarks. The Basics of Convex Polyhedra An Example from String-Buffer Analysis

The Basics of Convex PolyhedraAn Example from String-Buffer Analysis

Acceleration Techniques

The Widening/Narrowing ApproachWidening With LandmarksRelated Work

Conclusion

Widening with Landmarks:

I Measure distance to unsatisfiable inequalities.

I Extrapolate until nearest unsatisfiable inequality becomessatisfiable.

Properties:

I Consecutive test for fixpoint when reaching next behavior.

I Low overhead.

I Fully automatic.

I Precise for linear state space growth.

Axel Simon and Andy King Widening with Landmarks