Acta Informatica

, Volume 47, Issue 1, pp 1–31 | Cite as

Automata-based verification of programs with tree updates

  • Peter Habermehl
  • Radu Iosif
  • Tomáš Vojnar
Original Article


This paper describes a verification framework for Hoare-style pre- and post-conditions of programs manipulating balanced tree-like data structures. Since the considered verification problem is undecidable, we appeal to the standard semi-algorithmic approach in which the user has to provide loop invariants, which are then automatically checked, together with the program pre- and post-conditions. We specify sets of program states, representing tree-like memory configurations, using Tree Automata with Size Constraints (TASC). The main advantage of this new class of tree automata is that they recognise tree languages based on arithmetic reasoning about the lengths of various (possibly all) paths in trees, like, e.g., in AVL trees or red–black trees. TASCs are closed under union, intersection, and complement, and their emptiness problem is decidable. Thus we obtain a class of automata which are an interesting theoretical contribution by itself. Further, we show that, under few restrictions, one can automatically compute the effect of tree-updating program statements on the set of configurations represented by a TASC, which makes TASC a practical verification tool. We tried out our approach on the insertion procedure for red–black trees, for which we verified that the output on an arbitrary balanced red–black tree is also a balanced red–black tree.


Transition Rule Size Function Balance Tree Tree Automaton Black Node 
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.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Alur, R., Madhusudan, P.: Visibly pushdown languages. In: Proceedings of STOC’04. ACM Press (2004)Google Scholar
  2. 2.
    Baldan, P., Corradini, A., Esparza, J., Heindel, T., König, B., Kozioura, V.: Verifying red–black trees. In: Proceedings of COSMICAH’05 (2005)Google Scholar
  3. 3.
    Barnett, M., Rustan, K., Leino, M., Schulte, W.: The Spec# programming system: an overview. In: Proceedings of CASSIS’04. Lectures Notes in Computer Science, vol. 3362. Springer (2004)Google Scholar
  4. 4.
    Bouajjani, A., Esparza, J., Maler, O.: Reachability analysis of pushdown automata: application to model-checking. In: Proceedings of CONCUR’97. Lectures Notes in Computer Science, vol. 1243. Springer (1997)Google Scholar
  5. 5.
    Bouajjani, A., Habermehl, P., Rogalewicz, A., Vojnar, T.: Abstract regular tree model checking of complex dynamic data structures. In: Proceedings of the 13th International Symposium Static Analysis (SAS’06). Lecture Notes in Computer Science, vol. 4134, pp. 52–70. Springer (2006)Google Scholar
  6. 6.
    Burdy L., Cheon Y., Cok D., Ernst M., Kiniry J., Leavens G.T., Rustan K., Leino M., Poll E.: An overview of JML tools and applications. Int. J. Softw. Tools Technol. Transf. 7(3), 212–232 (2005)CrossRefGoogle Scholar
  7. 7.
    Calcagno, C., Gardner, P., Zarfaty, U.: Context logic and tree update. In: Proceedings of POPL’05. ACM Press (2005)Google Scholar
  8. 8.
    Comon-Lundh H., Cortier V.: Tree automata with one memory, set constraints and cryptographic protocols. Theo. Comput. Sci. 331, 143–214 (2005)CrossRefGoogle Scholar
  9. 9.
    Comon-Lundh, H., Dauchet, M., Gilleron, R., Jacquemard, F., Lugiez, D., Tison, S., Tommasi. M.: Tree automata techniques and applications. Available at: Release Oct 1, 2002 (1997)
  10. 10.
    Comon-Lundh, H., Jaquemard, F., Perrin, N.: Tree automata with memory, visibility and structural constraints. In: Proceedings of FoSSaCS. Lecture Notes in Computer Science, vol. 4423. Springer (2007)Google Scholar
  11. 11.
    Cormen T.H., Leiserson C.E., Rivest R.L.: Introduction to Algorithms. The MIT Press, Cambridge (1990)zbMATHGoogle Scholar
  12. 12.
    Dal Zilio, S., Lugiez, D.: Multitrees automata, Presburger’s constraints and tree logics. Technical Report 08-2002, LIF (2002)Google Scholar
  13. 13.
    Darga, P.T., Boyapati, C.: Efficient software model checking of data structure properties. In: Proceedings of OOPSLA’06. ACM Press (2006)Google Scholar
  14. 14.
    Geidmanis D.: Unsolvability of the emptiness problem for alternating 1-way multi-head and multi-tape finite automata over single-letter alphabet. Comput. Artif. Intell. 10, 133–141 (1991)zbMATHMathSciNetGoogle Scholar
  15. 15.
    Khurshid S., Marinov D.: TestEra: specification-based testing of Java programs using SAT. Automat. Softw. Eng. 11(4), 403–434 (2004)CrossRefGoogle Scholar
  16. 16.
    Manna, Z., Sipma, H.B., Zhang, T.: Verifying balanced trees. In: Proceedings of the Symposium on Logical Foundations of Computer Science (LFCS 2007). Lecture Notes in Computer Science, vol. 4514. Springer (2007)Google Scholar
  17. 17.
    Moeller, A., Schwartzbach, M.: The pointer assertion logic engine. In: Proceeedings of PLDI’01. ACM Press (2001)Google Scholar
  18. 18.
    Nguyen, H.H., David, C., Qin, S., Chin, W.N.: Automated verification of shape and size properties via separation logic. In: Proceedings of VMCAI’07. Lecture Notes in Computer Science, vol. 4349. Springer (2007)Google Scholar
  19. 19.
    Parduhn, S.: Algorithm animation using shape analysis with special regard to binary trees. Technical Report, Universität des Saarlandes (2005)Google Scholar
  20. 20.
    Petersen, H.: Alternation in simple devices. In: Proceedings of ICALP’95. Lecture Notes in Computer Science, vol. 944. Springer (1995)Google Scholar
  21. 21.
    Rabin M.O.: Decidability of second order theories and automata on infinite trees. Trans. Am. Math. Soc. 141, 1–35 (1969)zbMATHCrossRefMathSciNetGoogle Scholar
  22. 22.
    Reynolds, J.C.: Separation logic: a logic for shared mutable data structures. In: Proceedings of LICS’02. IEEE Computer Society Press (2002)Google Scholar
  23. 23.
    Rugina, R.: Quantitative shape analysis. In: Proceedings of SAS’04. Lecture Notes in Computer Sciences, vol. 3148. Springer (2004)Google Scholar
  24. 24.
    Sagiv S., Reps T.W., Wilhelm R.: Parametric shape analysis via 3-valued logic. TOPLAS 24(3), 217–298 (2002)CrossRefGoogle Scholar
  25. 25.
    Seidl, H., Schwentick, T., Muscholl, A., Habermehl, P.: Counting in trees for free. In: Proceedings of ICALP’04. Lecture Notes in Computer Sciences, vol. 3142. Springer (2004)Google Scholar

Copyright information

© Springer-Verlag 2009

Authors and Affiliations

  1. 1.LIAFA, Université Paris Diderot—Paris 7/CNRSParis 13France
  2. 2.VERIMAG, Université Joseph Fourier/CNRS/INPGGièresFrance
  3. 3.FIT, Brno University of TechnologyBrnoCzech Republic

Personalised recommendations