Bachelor thesis
Cite …

Comparing Deductive Program Verification of Graph Data-Structures

Abstract

Graphs and graph-based algorithms are ubiquitous. With their omnipresence, it is important that these graph-algorithms work correctly. To ensure that those algorithms behave correctly, they can be formally verified. Deductive program verification is used, to show that a program fulfills a formal specification of its behavior for every valid input, which is a non-trivial task. Also, there is not only one single implementation of graphs. Graphs can be represented by a variety of data structures that all have their advantages and disadvantages in terms of e.g. runtime or memory-usage.

It is unclear, where potential bottlenecks might occur during the verification of graph-algorithms. Throughout these data structures, there are differences with respect to their suitability for deductive program-verification of graph-algorithms. Knowing with which graph-representations graph-algorithms are easier to verify, provides an additional decision aid, when selecting an implementation.

In this thesis, we look at one specific algorithm: depth-first search. DFS is a simple algorithm for traversing graphs. Many graph algorithms are based on DFS. So, despite its simplicity, the verification of depth-first search is of interest. We specify and verify two different implementations of depth-first search. To do so, we use the formal specification language JML, to specify Java programs, and the KeY tool for deductive verification. We study each implementation with four different graph-representations. The considered graph data structures are the adjacency matrix, adjacency array and adjacency lists as well as a linked data structure using objects and pointers. As implementation of depth-first search, we use the recursive versions, using recursive method-calls, and the non-recursive version, iterating a loop instead of recursive calls. We show that the recursive version is verified for all four data structures, while the non-recursive version is only verified for the adjacency matrix version.

Additionally to the verification of DFS with different data structures, we define the depth-first property of a graph traversal, in order to prove that the algorithm traverses the graph in a valid order.

Finally, we compare the verification-process of recursive and non-recursive depth-first search, for all four representations. We compare them in terms of different aspects, like the time effort of the verification process or the size of the resulting proof.

In the end, this thesis discusses advantages and disadvantages of the four graph-representations, during the verification of a graph-algorithm. Additionally, we see how the recursive implementation of DFS can be easier to verify with KeY, than the non-recursive version. Furthermore, we give a general definition of the depth-first property of a graph traversal and a set of rules to handle bounded sums in KeY.