Lazy and Faithful Assertions for Functional Logic Programs

by Michael Hanus

Proc. of the 19th International Workshop on Functional and (Constraint) Logic Programming (WFLP 2010), Universidad Politecnica de Madrid, pp. 50-64, 2010

Assertions or contracts are an important technique to improve the quality of software. Thus, assertions are also desirable for functional logic programming. Unfortunately, there is no established meaning of assertions in languages with a demand-driven evaluation strategy. Strict assertions are immediately checked but may influence the behavior of programs. Lazy assertions do not modify the behavior but may not be faithful since some assertions might not be checked at all. This paper proposes an intermediate approach where the user can choose between lazy or faithful assertions. In order to avoid disadvantages of faithful assertions, we propose to delay them until an explicit point where faith is required, e.g., at the end of the program execution or before I/O actions. We describe a prototypical implementation of this idea in the functional logic language Curry.

Preprint (PDF) BibTeX-Entry