Testing and Proving using Narrowing
Licentiate thesis, 2007
In order to know if a program is correct a specification of its intended behaviour must be stated. The two main activities concerning program correctness are testing and verification. When testing a program it is run on a number of different inputs and a formal specification can be used to automatically decide whether the outcomes of the runs are correct. Formal verification of a program means proving that it is correct with respect to a formal specification.
Fully automated testing requires that the construction of program inputs is also be handled by the computer. In some cases it is enough to simply generate random input data. In other cases the restrictions on the program input are too strong, resulting in a situation where most random inputs are not valid according to the specification and are thus useless. One way to solve this problem is to, on top of writing a specification, also write special program code which generates inputs suitable for the program under test. In this thesis the possibility of instead directly using the specification to generate inputs is investigated. The work was carried out in the context of functional programming. The approach is based on using narrowing, which is a first-order search strategy for term rewrite systems. The narrowing search looks for valid inputs guided by the specification.
When proving a program correct in a formal logical system, there are often many details of the proof that are relatively simple but still takes time to establish. The thesis also contains a couple of investigations of how to add some rudimentary, automatic proof construction to Agda, which is a logical system based on Martin-Löf type theory and which is at the same time a dependently typed functional programming language. The second of these investigations is, like the work on testing, based on narrowing. In this case, the narrowing search is guided by the semantics of Agda and by the proposition to prove.
Lecture room EA, EDIT building, Rännvägen 6B, Chalmers
Opponent: Professor Colin Runciman, Department of Computer Science at the University of York, England