Beating the Productivity Checker Using Embedded Languages

Beating the Productivity Checker Using Embedded Languages
Nils Anders Danielsson
In the proceedings of the Workshop on Partiality and Recursion in Interactive Theorem Provers (PAR 2010), EPTCS 43, 2010. [pdf, highlighted code, tarball with code]

Abstract

Some total languages, like Agda and Coq, allow the use of guarded corecursion to construct infinite values and proofs. Guarded corecursion is a form of recursion in which arbitrary recursive calls are allowed, as long as they are guarded by a coinductive constructor. Guardedness ensures that programs are productive, i.e. that every finite prefix of an infinite value can be computed in finite time. However, many productive programs are not guarded, and it can be nontrivial to put them in guarded form.

This paper gives a method for turning a productive program into a guarded program. The method amounts to defining a problem-specific language as a data type, writing the program in the problem-specific language, and writing a guarded interpreter for this language.

Erratum

In Section 7 three italicised occurrences of map (in nats₂, nats and nats₂′) should be replaced by the constructor map (set in a sans-serif font).

Nils Anders Danielsson
Disclaimer
Last updated Mon May 13 12:35:04 UTC 2013.