Download presentation
Presentation is loading. Please wait.
Published byScot Moore Modified over 9 years ago
1
Reduction of inductive predicates for shape analysis of circular lists Daniel Stutzman April 27, 2010
2
circular lists
3
shape analysis of circular lists
4
inductive predicates for shape analysis of circular lists
5
Reduction of inductive predicates for shape analysis of circular lists
6
Let’s make a sorted linked list struct ListNode { int data; struct ListNode* next; struct ListNode* prev; }
7
Let’s make a sorted linked list 3 0 47 0 x
8
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); }
9
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); }
10
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)); }
11
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))
12
? 0 x is_sll2 Example in a shape domain
13
Unfolding ? 0 x is_sll2 ?
14
Unfolding ? 0 x is_sll2
15
Unfolding ? 0 0 x
16
? 0 x is_sll2 ? ? 0 0 x V
17
Let’s make a circular list 3 0 47 0 x
18
3 0 47 x
19
347 x
20
Walking backwards ? ? ? x is_circular_list
21
Walking backwards ? ? ? x is_circular_list
22
Walking backwards ? ? ? x is_circular_list Error: Unable to find an appropriate edge to unfold
23
Reduction ?? x is_list
24
Reduction ?? x is_list
25
Reduction ?? is_list ? x
26
Two equivalent summaries is_bounded_list
27
Two equivalent summaries is_bounded_list
28
Two equivalent summaries is_bounded_list
29
Two equivalent summaries is_bounded_ list is_bounded_ list
30
Two equivalent summaries is_ bound ed_list is_ bound ed_list
31
Two equivalent summaries
32
is_list
33
Two equivalent summaries is_list
34
Two equivalent summaries is_list
35
Two equivalent summaries is_list
36
Two equivalent summaries
37
Other equivalent summaries dll1 NULL
38
Other equivalent summaries dll1 NULL
39
Other equivalent summaries dll1 NULL
40
Other equivalent summaries dll1 NULL
41
Other equivalent summaries dll1 NULL
42
Other equivalent summaries NULL
43
Other equivalent summaries dll2 NULL
44
Other equivalent summaries dll2 NULL
45
Other equivalent summaries dll2 NULL
46
Other equivalent summaries dll2 NULL
47
Other equivalent summaries dll2 NULL
48
Other equivalent summaries NULL
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.