Enforcing Structural Invariants Using Dynamic Frames
The theory of dynamic frames is a promising approach to handle the so-called framing problem, that is, giving a precise characterizations of the locations in the heap that a procedure may modify.
In this paper, we show that the machinery used for dynamic frames may be exploited even further. In particular, we use it to check that implementations of abstract data types maintain certain structural invariants that are very hard to express with usual means, including being acyclic (like non-circular linked lists and trees) and having a unique path between nodes (like in a tree).
The idea is that regions in this formalism over-approximate the set of reachable objects. We can then maintain this structural invariants by including special preconditions in assignments, of the kind that can be verified by state-of-the-art SMT-based tools. To test this approach we modified the verifier for the Dafny programming language in a suitable way and were able to enforce these invariants in non-trivial examples.
KeywordsStructural Invariant Representation Region Semantic Rule Binary Search Tree Dynamic Frame
- 4.Jacobs, B., Smans, J., Piessens, F.: VeriFast: Imperative Programs as Proofs. In: VSTTE Workshop on Tools & Experiments (2010)Google Scholar
- 5.Kassios, I.T.: The dynamic frames theory. In: Formal Aspects of Computing (2010)Google Scholar
- 6.Lahiri, S., Qadeer, S.: Verifying properties of well-founded linked lists. In: Proceedings of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2006), pp. 115–126. ACM Press, New York (2006)Google Scholar
- 10.Lev-Ami, T., Immerman, N., Reps, T., Sagiv, M., Srivastava, S., Yorsh, G.: Simulating reachability using first-order logic with applications to verification of linked data structures. In: Nieuwenhuis, R. (ed.) CADE 2005. LNCS (LNAI), vol. 3632, pp. 99–115. Springer, Heidelberg (2005)CrossRefGoogle Scholar
- 12.Neisen, A.: Automatic verification of acyclic data structures using theorem provers. Master’s thesis, Universidad de Buenos Aires (2010)Google Scholar