# Reducing recursion to iteration by algebraic extension

## 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

- Böhm,C. and Berarducci,A., Automatic Synthesis of typed Λ-programs on Term Algebras, Theor. Comput. Science 39 (1985).Google Scholar
- Gladstone, M.D., A Reduction of the Recursion Scheme, J. of Symbolic Logic, 32, 4, 505–508 (1967).Google Scholar
- 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 - Robinson, M.L., Primitive recursive functions, Bulletin of Am. Math. Soc., 53, 925–942 (1947).Google Scholar