Functional Program Correctness Through Types
Doctoral thesis, 2007

This thesis addresses the problem of avoiding errors in functional programs. The thesis has three parts, discussing different aspects of program correctness, with the unifying theme that types are an integral part of the methods used to establish correctness. The first part validates a common, but not obviously correct, method for reasoning about functional programs. In this method, dubbed "fast and loose reasoning", programs written in a language with non-terminating functions are treated as if they were written in a total language. It is shown that fast and loose reasoning is sound when the programs are written in a given total subset of the language, and the resulting properties are translated back to the partial setting using certain partial equivalence relations which capture the concept of totality. The second part discusses a method for ensuring that functions meet specified time bounds. The method is aimed at implementations of purely functional data structures, which often make essential use of lazy evaluation to ensure good time complexity in the presence of persistence. The associated complexity analyses are often complicated and hence error-prone, but by annotating the type of every function with its time complexity, using an annotated monad to combine time complexities of subexpressions, it is ensured that no details are forgotten. The last part of the thesis is a case study in programming with strong invariants enforced by the type system. A dependently typed object language is represented in the meta language, which is also dependently typed, in such a way that it is impossible to form ill-typed terms. An interpreter is then implemented for the object language by using normalisation by evaluation. By virtue of the strong types used this implementation is a proof that every term has a normal form, and hence normalisation is proved. This also seems to be the first formal account of normalisation by evaluation for a dependently typed language.

well-typed syntax

normalisation by evaluation

program correctness

total languages

partial languages

lazy evaluation

time complexity

strong invariants

dependent types

Lecture room EF, ED&IT building, Rännvägen 6B, Chalmers
Opponent: Professor Martin Hofmann, Institut für Informatik, Ludwig-Maximilians-Universität München, Germany

Author

Nils Anders Danielsson

Chalmers, Computer Science and Engineering (Chalmers), Computing Science (Chalmers)

A Formalisation of a Dependently Typed Language as an Inductive-Recursive Family

Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics),; Vol. LNCS 4502(2007)p. 93-109

Paper in proceeding

Lightweight Semiformal Time Complexity Analysis for Purely Functional Data Structures

35th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL'08; San Francisco, CA; United States; 7 January 2008 through 12 January 2008,; (2008)p. 133-144

Paper in proceeding

Fast and Loose Reasoning is Morally Correct

Conference record of the 33rd ACM SIGPLAN-SIGACT symposium on Principles of programming languages (POPL 2006),; (2006)p. 206-217

Paper in proceeding

Subject Categories

Computer Science

ISBN

978-91-7385-034-6

Doktorsavhandlingar vid Chalmers tekniska högskola. Ny serie: 2715

Technical report D - Department of Computer Science and Engineering, Chalmers University of Technology and Göteborg University: 37

Lecture room EF, ED&IT building, Rännvägen 6B, Chalmers

Opponent: Professor Martin Hofmann, Institut für Informatik, Ludwig-Maximilians-Universität München, Germany

More information

Created

10/8/2017