25
4/30/2010 1 Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010 circular lists

Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

1

Reduction of

inductive predicates

for shape analysis

of circular lists

Daniel Stutzman

April 27, 2010

circular lists

Page 2: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

2

shape analysis

of circular lists

inductive predicates

for shape analysis

of circular lists

Page 3: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

3

Reduction of

inductive predicates

for shape analysis

of circular lists

Let’s make a sorted linked list

struct ListNode {

int data;

struct ListNode* next;

struct ListNode* prev;

}

Page 4: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

4

Let’s make a sorted linked list

3

0

4 7

0

x

Run-time “checker” functions

boolean is_sll(ListNode* x) {

return (x->prev == NULL) && is_sll2(x);

}

boolean is_sll2(ListNode* x, int min_data) {

return (x->data >= min_data) &&

(x->next->prev == x) &&

is_sll2(x->next, x->data);

}

Page 5: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

5

Run-time “checker” functions

boolean is_sll(ListNode* x) {

return (x->prev == NULL) && is_sll2(x);

}

boolean is_sll2(ListNode* x) {

return (x->next->data >= x->data) &&

(x->next->prev == x) &&

is_sll2(x->next);

}

Run-time “checker” functions

boolean is_sll(ListNode* x) {

return (x->prev == NULL) && is_sll2(x);

}

boolean is_sll2(ListNode* x) {

return (x->next == NULL) ||

((x->next->data >= x->data) &&

(x->next->prev == x) &&

is_sll2(x->next));

}

Page 6: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

6

Static inductive predicates

is_sll(x) = null(x->prev) /\ is_sll2(x)

is_sll2(x) = null(x->next) V

((x->next->data >= x->data) /\

(x->next->prev == x) /\

is_sll2(x->next))

?

0

x

is_sll2

Example in a shape domain

Page 7: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

7

Unfolding

?

0

x

is_sll2

?

Unfolding

?

0

x

is_sll2

Page 8: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

8

Unfolding

?

0

0

x

Unfolding

?

0

x

is_sll2

?

?

0

0

x

V

Page 9: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

9

Let’s make a circular list

3

0

4 7

0

x

Let’s make a circular list

3

0

4 7

x

Page 10: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

10

Let’s make a circular list

3 4 7

x

Walking backwards

?

?

?

x

is_circular_list

Page 11: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

11

Walking backwards

?

?

?

x

is_circular_list

Walking backwards

?

?

?

x

is_circular_list

Error: Unable to find an

appropriate edge to unfold

Page 12: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

12

Reduction

? ?

x

is_list

Reduction

? ?

x

is_list

Page 13: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

13

Reduction

? ?

is_list

?

x

Two equivalent summaries

is_bounded_list

Page 14: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

14

Two equivalent summaries

is_bounded_list

Two equivalent summaries

is_bounded_list

Page 15: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

15

Two equivalent summaries

is_bounded_

list

Two equivalent summaries

is_

bound

ed_list

Page 16: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

16

Two equivalent summaries

Two equivalent summaries

is_list

Page 17: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

17

Two equivalent summaries

is_list

Two equivalent summaries

is_list

Page 18: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

18

Two equivalent summaries

is_list

Two equivalent summaries

Page 19: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

19

Other equivalent summaries

dll1NULL

Other equivalent summaries

dll1NULL

Page 20: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

20

Other equivalent summaries

dll1NULL

Other equivalent summaries

dll1NULL

Page 21: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

21

Other equivalent summaries

dll1NULL

Other equivalent summaries

NULLNULL

Page 22: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

22

Other equivalent summaries

dll2

NULLNULL

NULLNULL

Other equivalent summaries

dll2

NULLNULL

NULL

NULL

Page 23: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

23

Other equivalent summaries

dll2

NULLNULL

NULL

NULL

Other equivalent summaries

dll2

NULLNULL

NULL

NULL

Page 24: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

24

Other equivalent summaries

dll2

NULLNULL

NULL

NULL

Other equivalent summaries

NULLNULL

NULLNULL

Page 25: Reduction of inductive predicates for shape analysis of ...bec/courses/csci5535-s10/slides/stutz… · Reduction of inductive predicates for shape analysis of circular lists Daniel

4/30/2010

25