While thorough testing of software reduces the likelihood of errors, formal verification can guarantee the correct behaviour of programs for all inputs through proofs. Consequently, for the ubiquitous data structures and algorithms like those found in standard libraries, used by thousands of applications, formal verification is especially desirable.
In this case study, we specify and verify a Java implementation of red-black trees with KeY. The KeY system is a tool for the formal verification of Java programs, and uses dynamic frames for memory reasoning, that is, framing. Red-black trees are a popular data structure for the efficient storage and retrieval of ordered elements, for example implemented in the class java.util.TreeMap of the Java Class Library. There exist various case studies in both areas – those in KeY, however, rarely consider tree structures, and existing red-black-tree verifications use different approaches to framing compared to KeY.
In this work, we conclude that successful reasoning over tree structures with dynamic frames is possible, yet very work-intensive compared to other framing approaches. Apart from this, we explore general strengths and limitations of KeY and give suggestions on how to improve its usability. Furthermore, we test out methods for automising and persisting proofs with the new KeY features of JML Scripts and Proof Caching.
| Related KIT institution | Institute of Information Security and Dependability (KASTEL) |
|---|---|
| Language | English |
| KITopen ID | 1000162878 |
| Keywords | KeY, Java Modeling Language, deductive verification, red-black trees |
| Publisher | Karlsruher Institut für Technologie (KIT) |
| Size | 66 p. |
| Exam data | 11.09.2023 |
| Supervisors | Bernhard Beckert Mattias Ulbrich Wolfram Pfeifer |