Verifying Red-Black Trees

We show how to verify the correctness of insertion of elements into red-black trees—a form of balanced search trees—using analysis techniques developed for graph rewriting. We first model red-black trees and operations on them using hypergraph rewriting. Then we use the tool Augur, which computes approximated unfoldings, in order to show that insertion preserves the property that there are no two consecutive red nodes in a tree, a requirement for red-black trees. Furthermore, we prove that the tree remains balanced by exploiting a type system that can be obtained as an instance of a general framework.

[1]  Barbara König,et al.  A general framework for types in graph rewriting , 2000, Acta Informatica.

[2]  Arend Rensink,et al.  Canonical Graph Shapes , 2004, ESOP.

[3]  Reinhard Wilhelm,et al.  Parametric shape analysis via 3-valued logic , 1999, POPL '99.

[4]  Paolo Baldan,et al.  Approximating the Behaviour of Graph Transformation Systems , 2002, ICGT.

[5]  Arend Rensink,et al.  Model Checking Graph Grammars , 2003 .

[6]  Fernando Luís Dotti,et al.  Verification of Distributed Object-Based Systems , 2003, FMOODS.

[7]  Grzegorz Rozenberg,et al.  Handbook of Graph Grammars and Computing by Graph Transformations, Volume 1: Foundations , 1997 .

[8]  Bjarne Steensgaard,et al.  Points-to analysis in almost linear time , 1996, POPL '96.

[9]  Arend Rensink State Space Abstraction using Shape Graphs , 2004 .

[10]  Monica S. Lam,et al.  Efficient context-sensitive pointer analysis for C programs , 1995, PLDI '95.

[11]  Michael I. Schwartzbach,et al.  Compile-Time Debugging of C Programs Working on Trees , 2000, ESOP.

[12]  Dániel Varró Towards Symbolic Analysis of Visual Modeling Languages , 2003, Electron. Notes Theor. Comput. Sci..

[13]  Leila Ribeiro,et al.  Parallel composition and unfolding semantics of graph grammars , 1996 .

[14]  Michael Löwe,et al.  An algebraic framework for the transformation of attributed graphs , 1993 .

[15]  Colin Runciman,et al.  Checking the Shape Safety of Pointer Manipulations , 2003, RelMiCS.

[16]  Ugo Montanari,et al.  Unfolding and Event Structure Semantics for Graph Grammars , 1999, FoSSaCS.

[17]  Andrea Corradini,et al.  A Static Analysis Technique for Graph Transformation Systems , 2001, CONCUR.

[18]  Javier Esparza,et al.  jMoped: A Java Bytecode Checker Based on Moped , 2005, TACAS.

[19]  Kurt Mehlhorn,et al.  Data Structures and Algorithms 1: Sorting and Searching , 2011, EATCS Monographs on Theoretical Computer Science.

[20]  Daniel Jackson,et al.  Checking Properties of Heap-Manipulating Procedures with a Constraint Solver , 2003, TACAS.

[21]  Detlef Plump,et al.  Hypergraph rewriting: critical pairs and undecidability of confluence , 1993 .

[22]  Pascal Fradet,et al.  Shape types , 1997, POPL '97.

[23]  Davide Sangiorgi,et al.  Typing and subtyping for mobile processes , 1993, [1993] Proceedings Eighth Annual IEEE Symposium on Logic in Computer Science.