Enforcing Structural Invariants Using Dynamic Frames

  • Diego Garbervetsky
  • Daniel Gorín
  • Ariel Neisen
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6605)


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.


Structural Invariant Representation Region Semantic Rule Binary Search Tree Dynamic Frame 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Barnett, M., Leino, K.R.M., Schulte, W.: The spec# programming system: An overview. In: Barthe, G., Burdy, L., Huisman, M., Lanet, J.-L., Muntean, T. (eds.) CASSIS 2004. LNCS, vol. 3362, pp. 49–69. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  2. 2.
    Clarke, D., Potter, J., Noble, J.: Ownership types for flexible alias protection. In: Proceedings of the 13th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 1998), pp. 48–64. ACM Press, New York (1998)CrossRefGoogle Scholar
  3. 3.
    Huizing, K., Kuiper, R.: Verification of object oriented programs using class invariants. In: FASE 2000. LNCS, vol. 1783, pp. 208–221. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  4. 4.
    Jacobs, B., Smans, J., Piessens, F.: VeriFast: Imperative Programs as Proofs. In: VSTTE Workshop on Tools & Experiments (2010)Google Scholar
  5. 5.
    Kassios, I.T.: The dynamic frames theory. In: Formal Aspects of Computing (2010)Google Scholar
  6. 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
  7. 7.
    Leino, K.R.M.: Dafny: An automatic program verifier for functional correctness. In: Clarke, E.M., Voronkov, A. (eds.) LPAR-16 2010. LNCS, vol. 6355, pp. 348–370. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  8. 8.
    Leino, K.R.M., Müller, P.: A basis for verifying multi-threaded programs. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 378–393. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  9. 9.
    Leino, K.R.M., Nelson, G.: Data abstraction and information hiding. ACM TOPLAS 24(5), 491–553 (2002)CrossRefGoogle Scholar
  10. 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
  11. 11.
    Lu, Y., Potter, J.: A type system for reachability and acyclicity. In: Gao, X.-X. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 479–503. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  12. 12.
    Neisen, A.: Automatic verification of acyclic data structures using theorem provers. Master’s thesis, Universidad de Buenos Aires (2010)Google Scholar
  13. 13.
    Sagiv, M., Reps, T., Wilhelm, R.: Parametric shape analysis via 3-valued logic. ACM TOPLAS 24(3), 217–298 (2002)CrossRefGoogle Scholar
  14. 14.
    Smans, J., Jacobs, B., Piessens, F.: VeriCool: An automatic verifier for a concurrent object-oriented language. In: Barthe, G., de Boer, F.S. (eds.) FMOODS 2008. LNCS, vol. 5051, pp. 220–239. Springer, Heidelberg (2008)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2011

Authors and Affiliations

  • Diego Garbervetsky
    • 1
  • Daniel Gorín
    • 1
  • Ariel Neisen
    • 1
  1. 1.Departamento de Computación, FCEyNUniversidad de Buenos AiresArgentina

Personalised recommendations