ESOP 1986: ESOP 86 pp 111-118

# Reducing recursion to iteration by algebraic extension

Extended abstract
Functional Programming Languages
Part of the Lecture Notes in Computer Science book series (LNCS, volume 213)

## Abstract

Heterogeneous absolutely free algebras with a finite number of carriers and constructors have been proved very fruitful since the specification, through systems of equations, of iterative functions on such algebras may be automatically translated into terms of second order typed lambda-calculus [Böhm Berarducci, 1985]. Since many definitions of functions on data structures are given by systems of recursive (but not iterative) equations it follows that reducing recursion to iteration becomes even more suitable.

In this paper we recall the definition (first given in the previous paper) of the family D of algebraic data systems (without parameters) and of the class I of iterative functions over D. We next define a primitive recursive scheme for functions whose domain is any finite cartesian product of components of D, generalizing the well known scheme for functions over the set N of nonnegative integers. Let PR be the family of functions obtained by replacing the iterative scheme by the primitive recursive scheme inside the definition of I. We prove that PR = I.

The method of proof essentially consists in adding new carriers and new constructors. Especially in the case of homogeneous algebras the heterogeneous algebras resulting from the extension become meaningful from the computer science point of view, as it is pointed out in the paper by examples. The relationship with the case of N is further discussed.

## Keywords

Functional programming algebraic data types initial algebras term algebras subrecursive function theory

## References

1. Böhm,C. and Berarducci,A., Automatic Synthesis of typed Λ-programs on Term Algebras, Theor. Comput. Science 39 (1985).Google Scholar
2. Gladstone, M.D., A Reduction of the Recursion Scheme, J. of Symbolic Logic, 32, 4, 505–508 (1967).Google Scholar
3. Gordon, M.J.C., An investigation of lit:where lit((A 1 ..., A n ),A n+1 , f)=f(A 1 ,f(A 2 ,..., f(A n ,A n+1 )...)), Memorandum MIP-R-101, School of AI, University of Edinburgh (1973).Google Scholar
4. Robinson, M.L., Primitive recursive functions, Bulletin of Am. Math. Soc., 53, 925–942 (1947).Google Scholar