Abstract
In this paper we formally state and prove theorems characterizing when a function can be constructively reformulated using the recursion operators fold and unfold, i.e. given a function h, when can a function g be constructed such that h = fold g or h = unfold g? These results are refinements of the classical characterization of fold and unfold given by Gibbons, Hutton and Altenkirch in [6]. The proofs presented here have been formalized in Nuprl’s constructive type theory [5] and thereby yield program transformations which map a function h (accompanied by the evidence that h satisfies the required conditions), to a function g such that h = fold g or, as the case may be, h = unfold g.
This work was supported by NSF grant CCR-9985239, a DoD Multidisciplinary University Research Initiative (MURI) program administered by the Office of Naval Research under grant N00014-01-1-0765, and by the PhD program Logic in Computer Science of the German Research Foundation.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Allen, S.: NuprlPrimitives - Explanations of Nuprl Primitives and Conventions. Department of Computer Science, Cornell University, Ithaca, NY (2003), http://www.cs.cornell.edu/Info/People/sfa/Nuprl/NuprlPrimitives/
Bird, R.S.: Functional algorithm design. In: Möller, B. (ed.) MPC 1995. LNCS, vol. 947, pp. 2–17. Springer, Heidelberg (1995)
Burstall, R.M., Darlington, J.: A transformation system for developing recursive programs. Journal of the ACM 24(1), 44–67 (1977)
Caldwell, J.: Extracting recursion operators in Nuprl’s type-theory. In: Leuschel, M. (ed.) LOPSTR 2002. LNCS, vol. 2664, pp. 124–131. Springer, Heidelberg (2003)
Constable, R.L., Allen, S.F., Bromley, H.M., Cleaveland, W.R., Cremer, J.F., Harper, R.W., Howe, D.J., Knoblock, T.B., Mendler, N.P., Panangaden, P., Sasaki, J.T., Smith, S.F.: Implementing Mathematics with the Nuprl Proof Development System. Prentice-Hall, Englewood Cliffs (1986)
Gibbons, J., Hutton, G., Altenkirch, T.: When is a function a fold or an unfold? In: Corradini, A., Lenisa, M., Montanari, U. (eds.) Proceedings 4th Workshop on Coalgebraic Methods in Computer Science, CMCS 2001, Genova, Italy, April 6-7, vol. 44(1), Elsevier, Amsterdam (2001)
Gibbons, J., Jones, G.: The under-appreciated unfold. In: Proceedings 3rd ACM SIGPLAN Int. Conf. on Functional Programming, ICFP 1998, Baltimore, MD, USA, September 26-29, vol. 34(1), pp. 273–279. ACM Press, New York (1998)
Hutton, G.: Fold and unfold for program semantics. In: Proceedings 3rd ACM SIGPLAN Int. Conf. on Functional Programming, ICFP 1998, Baltimore, MD, USA, September 26–29, vol. 34(1), pp. 280–288. ACM Press, New York (1998)
Hutton, G.: A tutorial on the universality and expressiveness of fold. Journal of Functional Programming 9(4), 355–372 (1999)
MacLane, S.: Categories for the Working Mathematician, 2nd edn. Graduate Texts in Mathematics, vol. 5. Springer, New York (1997) (1st ed., 1971)
Malcolm, G.: Algebraic data types and program transformation. Science of Computer Programming 14(2–3), 255–280 (1990)
Martin-Löf, P.: Constructive mathematics and computer programming. In: Sixth International Congress for Logic, Methodology, and Philosophy of Science, pp. 153–175 (1982)
Meijer, E., Fokkinga, M., Paterson, R.: Functional programming with bananas, lenses, envelopes and barbed wire. In: Hughes, J. (ed.) FPCA 1991. LNCS, vol. 523, pp. 124–144. Springer, Heidelberg (1991)
Wadler, P.: Deforestation: Transforming programs to eliminate trees. In: Ganzinger, H. (ed.) ESOP 1988. LNCS, vol. 300, pp. 344–358. Springer, Heidelberg (1988)
Weber, T.: Program transformations in Nuprl. Master’s thesis, University of Wyoming, Laramie, WY (August 2002)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2004 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Weber, T., Caldwell, J. (2004). Constructively Characterizing Fold and Unfold. In: Bruynooghe, M. (eds) Logic Based Program Synthesis and Transformation. LOPSTR 2003. Lecture Notes in Computer Science, vol 3018. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-25938-1_11
Download citation
DOI: https://doi.org/10.1007/978-3-540-25938-1_11
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-22174-6
Online ISBN: 978-3-540-25938-1
eBook Packages: Springer Book Archive