Picture of neon light reading 'Open'

Discover open research at Strathprints as part of International Open Access Week!

23-29 October 2017 is International Open Access Week. The Strathprints institutional repository is a digital archive of Open Access research outputs, all produced by University of Strathclyde researchers.

Explore recent world leading Open Access research content this Open Access Week from across Strathclyde's many research active faculties: Engineering, Science, Humanities, Arts & Social Sciences and Strathclyde Business School.

Explore all Strathclyde Open Access research outputs...

Productive coprogramming with guarded recursion

Atkey, Robert and McBride, Conor (2013) Productive coprogramming with guarded recursion. In: Proceedings of the 2013 ACM SIGPLAN International Conference on Functional Programming. ACM, New York, NY. (In Press)

Full text not available in this repository. Request a copy from the Strathclyde author

Abstract

Total functional programming offers the beguiling vision that, just by virtue of the compiler accepting a program, we are guaranteed that it will always terminate. In the case of programs that are not in- tended to terminate, e.g., servers, we are guaranteed that programs will always be productive. Productivity means that, even if a pro- gram generates an infinite amount of data, each piece will be gen- erated in finite time. The theoretical underpinning for productive programming with infinite output is provided by the category theo- retic notion of final coalgebras. Hence, we speak of coprogramming with non-well-founded codata, as a dual to programming with well- founded data like finite lists and trees. Systems that offer facilities for productive coprogramming, such as the proof assistants Coq and Agda, currently do so through syntactic guardedness checkers, which ensure that all self-recursive calls are guarded by a use of a constructor. Such a check ensures productivity. Unfortunately, these syntactic checks are not compo- sitional, and severely complicate coprogramming. Guarded recursion, originally due to Nakano, is tantalising as a basis for a flexible and compositional type-based approach to co- programming. However, as we show, guarded recursion by itself is not suitable for coprogramming due to the fact that there is no way to make finite observations on pieces of infinite data. In this paper, we introduce the concept of clock variables that index Nakano’s guarded recursion. Clock variables allow us to “close over” the generation of infinite codata, and to make finite observations, some- thing that is not possible with guarded recursion alone.