verifying the composite pattern using separation logic
play

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


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

  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

  3. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic General Idea Module Client Invariant

  4. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Interface

  5. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Client

  6. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Specification

  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)

  8. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Spec’n: Pure function count n0 n1 n2 n3 count(tree(n0, tree(n1, tree(n2, nil, nil), tree(n3, nil, nil)), nil)) = 4

  9. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Spec’n: Datatype context root left_context(root, n0, nil) right_context(left_context(root, n0, nil), n1, tree(n2, nil, nil)) n0 n0 n1 n2

  10. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Spec’n: Predicate tree focus node memory region n0 tree(n0, root, n1 tree(n0, tree(n1, tree(n2, nil, nil), n2 n3 tree(n3, nil, nil)), nil))

  11. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Spec’n: Predicate tree memory region n0 tree(n1, focus node n1 left_context(root, n0, nil), tree(n1, tree(n2, nil, nil), n2 n3 tree(n3, nil, nil)))

  12. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Spec’n: Predicate tree memory region n0 tree(n3, n1 right_context( left_context(root, n0, nil), n1, n2 n3 tree(n2, nil, nil)), tree(n3, nil, nil)) focus node

  13. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Spec’n: Function create_tree focus node result

  14. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Spec’n: Function tree_add_left focus node c c node node result focus node r r

  15. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Spec’n: Function tree_get_count focus node focus node c c node node t t

  16. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Spec’n: Function tree_get_parent (case left_context) focus node pns pns p p node node t r t r focus node

  17. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Spec’n: Function tree_dispose focus node node

  18. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Client Proof

  19. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Implementation: struct node

  20. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Implementation: predicate tree focus node context(node, parent, c count(subtree), c) node c node node subtree(node, subtree parent, subtree) subtree

  21. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Implementation: predicate subtree left left- Nodes node-> left | -> left node node-> right | -> right left right right node-> parent | -> parent left- right- right- node-> count | -> count(t) Nodes Nodes Nodes malloc_block_node(node)

  22. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Implementation: predicate context pns p p-> left | -> n pns p-> right | -> right p n right right p-> parent | -> gp p-> count | -> pcount r r malloc_block_node(p)

  23. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Implementation: function create_tree

  24. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Impl’n: function subtree_get_count

  25. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Impl’n: function fixup_ancestors

  26. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Impl’n: function tree_add_left

  27. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Impl’n: function tree_get_count

  28. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Example: Binary Tree Impl’n: function tree_get_parent

  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

  30. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Non-contiguous Focus Changes Example Client Program

  31. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Non-contiguous Focus Changes Additional Specification Elements

  32. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Non-contiguous Focus Changes Proof of Example Client Program

  33. Bart Jacobs, Jan Smans, Frank Piessens - Verifying the Composite Pattern using Separation Logic Non-contiguous Focus Changes Proof of lemma change_focus

  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

  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

  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

Recommend


More recommend