Synthesis and Repair for Functional Programming: A Type- and Test-Driven Approach

Matthías Páll Gissurarson

Abstract

Modern programs in languages like Haskell include a lot of information beyond what is required for compilation. This includes unit tests, property-based tests, and type annotations more specific than those necessary to resolve ambiguity. This additional specification is usually only used for post-compilation verification by running the tests to verify that the code-as-written matches the specification the types and properties provide.

In this thesis, we explore ways of going beyond verification, and how this additional information can aid the developer during development. This can be done in multiple ways, for example, by helping the programmer write an implementation that matches the specification, by helping them track down the source of a bug in the implementation, and automatically repairing an implementation that does not match the specification.

In the first part, I explore the integration of program synthesis into GHC compiler error messages using typed-hole suggestions to aid completion of partial programs during development. In the second part, we present PropR, an automatic repair tool. PropR is based on type-driven synthesis, guided by property-based testing and fault localization in conjunction with genetic algorithms. A rich specification is required for these approaches to be effective. This motivates the third part of this thesis, where we present Spectacular, a specification synthesis tool. Spectacular uses ECTA-based synthesis to automatically infer properties of programs, letting us bootstrap specifications from previous versions.

In the fourth and fifth part of this thesis, we present the lightweight trace-based and spectrum-based fault localization tools CSI: Haskell and TastySpectrum respectively, and explore how we can localize program faults and find likely sources of a bug.

Changelog

2024-08-10:

2024-07-28:

2024-07-26:

2024-07-24:

2024-07-23:

2024-06-25:

2024-06-06:

2024-06-04:

2024-06-02:

2024-06-01:

2024-04-09

Download

The thesis is available in PDF format. This contains the introduction as well as the papers in a thesis format.

There is also a short errata for chapter 6.

Table of Contents

Presented here are the papers as published/submitted. I recommend reading the standalone thesis draft as presented above, as this includes more up-to-date and less space constrained versions of the papers.