Picture of person typing on laptop with programming code visible on the laptop screen

World class computing and information science research at Strathclyde...

The Strathprints institutional repository is a digital archive of University of Strathclyde's Open Access research outputs. Strathprints provides access to thousands of Open Access research papers by University of Strathclyde researchers, including by researchers from the Department of Computer & Information Sciences involved in mathematically structured programming, similarity and metric search, computer security, software systems, combinatronics and digital health.

The Department also includes the iSchool Research Group, which performs leading research into socio-technical phenomena and topics such as information retrieval and information seeking behaviour.

Explore

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.