49
Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Embed Size (px)

Citation preview

Page 1: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Reduction ofinductive predicatesfor shape analysis

of circular lists

Daniel Stutzman

April 27, 2010

Page 2: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

circular lists

Page 3: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

shape analysisof circular lists

Page 4: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

inductive predicatesfor shape analysis

of circular lists

Page 5: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Reduction ofinductive predicatesfor shape analysis

of circular lists

Page 6: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Let’s make a sorted linked list

struct ListNode {

int data;

struct ListNode* next;

struct ListNode* prev;

}

Page 7: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Let’s make a sorted linked list

3

0

4 7

0

x

Page 8: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Run-time “checker” functionsboolean 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 9: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Run-time “checker” functionsboolean 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);

}

Page 10: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Run-time “checker” functionsboolean 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 11: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

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))

Page 12: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

?

0

x

is_sll2is_sll2

Example in a shape domain

Page 13: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Unfolding

?

0

x

is_sll2is_sll2

?

Page 14: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Unfolding

?

0

x

is_sll2is_sll2

Page 15: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Unfolding

?

0

0

x

Page 16: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Unfolding

?

0

x

is_sll2is_sll2

?

?

0

0

x

V

Page 17: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Let’s make a circular list

3

0

4 7

0

x

Page 18: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Let’s make a circular list

3

0

4 7

x

Page 19: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Let’s make a circular list

3 4 7

x

Page 20: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Walking backwards

?

?

?

x

is_circular_listis_circular_list

Page 21: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Walking backwards

?

?

?

x

is_circular_listis_circular_list

Page 22: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Walking backwards

?

?

?

x

is_circular_listis_circular_list

Error: Unable to find anappropriate edge to unfold

Page 23: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Reduction

? ?

x

is_listis_list

Page 24: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Reduction

? ?

x

is_listis_list

Page 25: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Reduction

? ?

is_listis_list

?

x

Page 26: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Two equivalent summaries

is_bounded_listis_bounded_list

Page 27: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Two equivalent summaries

is_bounded_listis_bounded_list

Page 28: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Two equivalent summaries

is_bounded_listis_bounded_list

Page 29: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Two equivalent summaries

is_bounded_list

is_bounded_list

Page 30: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Two equivalent summaries

is_bounded_list

is_bounded_list

Page 31: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Two equivalent summaries

Page 32: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Two equivalent summaries

is_listis_list

Page 33: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Two equivalent summaries

is_listis_list

Page 34: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Two equivalent summaries

is_listis_list

Page 35: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Two equivalent summaries

is_listis_list

Page 36: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Two equivalent summaries

Page 37: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Other equivalent summaries

dll1dll1NULL

Page 38: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Other equivalent summaries

dll1dll1NULL

Page 39: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Other equivalent summaries

dll1dll1NULL

Page 40: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Other equivalent summaries

dll1dll1NULL

Page 41: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Other equivalent summaries

dll1dll1NULL

Page 42: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Other equivalent summaries

NULLNULL

Page 43: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Other equivalent summaries

dll2dll2

NULLNULL

NULLNULL

Page 44: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Other equivalent summaries

dll2dll2

NULLNULL

NULL

NULL

Page 45: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Other equivalent summaries

dll2dll2

NULLNULL

NULL

NULL

Page 46: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Other equivalent summaries

dll2dll2

NULLNULL

NULL

NULL

Page 47: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Other equivalent summaries

dll2dll2

NULLNULL

NULL

NULL

Page 48: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010

Other equivalent summaries

NULLNULL

NULLNULL

Page 49: Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010