Verifying the Composite Pattern using Separation Logic Bart Jacobs - - PowerPoint PPT Presentation

verifying the composite pattern using separation logic
SMART_READER_LITE
LIVE PREVIEW

Verifying the Composite Pattern using Separation Logic Bart Jacobs - - PowerPoint PPT Presentation

Verifying the Composite Pattern using Separation Logic Bart Jacobs Jan Smans Frank Piessens Katholieke Universiteit Leuven, Belgium Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Overview


slide-1
SLIDE 1

Verifying the Composite Pattern using Separation Logic

Bart Jacobs Jan Smans Frank Piessens

Katholieke Universiteit Leuven, Belgium

slide-2
SLIDE 2

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Overview

General Idea Example: Binary Tree

Interface Client Specification Client Proof Implementation and Implementation Proof Non-contiguous Focus Changes

Demonstration Conclusion

slide-3
SLIDE 3

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

General Idea

Module Client Invariant

slide-4
SLIDE 4

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Interface

slide-5
SLIDE 5

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Client

slide-6
SLIDE 6

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Specification

slide-7
SLIDE 7

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Specification: Datatype tree

n0 n1 n2 n3 tree(n0, tree(n1, tree(n2, nil, nil), tree(n3, nil, nil)), nil)

slide-8
SLIDE 8

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Spec’n: Pure function count

count(tree(n0, tree(n1, tree(n2, nil, nil), tree(n3, nil, nil)), nil)) = 4 n0 n1 n2 n3

slide-9
SLIDE 9

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Spec’n: Datatype context

root n0 left_context(root, n0, nil) n0 n1 n2 right_context(left_context(root, n0, nil), n1, tree(n2, nil, nil))

slide-10
SLIDE 10

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Spec’n: Predicate tree

n0 n1 n2 n3 memory region tree(n0, root, tree(n0, tree(n1, tree(n2, nil, nil), tree(n3, nil, nil)), nil)) focus node

slide-11
SLIDE 11

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Spec’n: Predicate tree

n0 n1 n2 n3 memory region tree(n1, left_context(root, n0, nil), tree(n1, tree(n2, nil, nil), tree(n3, nil, nil))) focus node

slide-12
SLIDE 12

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Spec’n: Predicate tree

n0 n1 n2 n3 memory region tree(n3, right_context( left_context(root, n0, nil), n1, tree(n2, nil, nil)), tree(n3, nil, nil)) focus node

slide-13
SLIDE 13

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Spec’n: Function create_tree

result focus node

slide-14
SLIDE 14

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

c

Example: Binary Tree Spec’n: Function tree_add_left

node r focus node c node r result focus node

slide-15
SLIDE 15

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

c

Example: Binary Tree Spec’n: Function tree_get_count

node t focus node c node t focus node

slide-16
SLIDE 16

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Spec’n: Function tree_get_parent

node t focus node pns r p node t pns r p focus node (case left_context)

slide-17
SLIDE 17

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Spec’n: Function tree_dispose

node focus node

slide-18
SLIDE 18

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Client Proof

slide-19
SLIDE 19

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Implementation: struct node

slide-20
SLIDE 20

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Implementation: predicate tree

c node subtree focus node c node node subtree context(node, parent, count(subtree), c) subtree(node, parent, subtree)

slide-21
SLIDE 21

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Implementation: predicate subtree

left left- Nodes right- Nodes node right node-> left | -> left node-> right | -> right node-> parent | -> parent node-> count | -> count(t) malloc_block_node(node) left left- Nodes right right- Nodes

slide-22
SLIDE 22

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Implementation: predicate context

n pns r p right p-> left | -> n p-> right | -> right p-> parent | -> gp p-> count | -> pcount malloc_block_node(p) right r pns p

slide-23
SLIDE 23

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Implementation: function create_tree

slide-24
SLIDE 24

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Impl’n: function subtree_get_count

slide-25
SLIDE 25

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Impl’n: function fixup_ancestors

slide-26
SLIDE 26

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Impl’n: function tree_add_left

slide-27
SLIDE 27

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Impl’n: function tree_get_count

slide-28
SLIDE 28

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Example: Binary Tree Impl’n: function tree_get_parent

slide-29
SLIDE 29

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Overview

General Idea Example: Binary Tree

Interface Client Specification Client Proof Implementation and Implementation Proof Non-contiguous Focus Changes

Demonstration Conclusion

slide-30
SLIDE 30

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Non-contiguous Focus Changes Example Client Program

slide-31
SLIDE 31

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Non-contiguous Focus Changes Additional Specification Elements

slide-32
SLIDE 32

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Non-contiguous Focus Changes Proof of Example Client Program

slide-33
SLIDE 33

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Non-contiguous Focus Changes Proof of lemma change_focus

slide-34
SLIDE 34

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Overview

General Idea Example: Binary Tree

Interface Client Specification Client Proof Implementation and Implementation Proof Non-contiguous Focus Changes

Demonstration Conclusion

slide-35
SLIDE 35

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Overview

General Idea Example: Binary Tree

Interface Client Specification Client Proof Implementation and Implementation Proof Non-contiguous Focus Changes

Demonstration Conclusion

slide-36
SLIDE 36

Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic

Conclusion

Approach:

Structure = 1 seplogic predicate In proof: Separate out focus node In client: Change focus node using

lemma

VeriFast:

www.cs.kuleuven.be/ ~ bartj/ verifast