Skip to main content Accesibility Help
×
×
Home

A call-by-need lambda calculus with locally bottom-avoiding choice: context lemma and correctness of transformations

  • DAVID SABEL (a1) and MANFRED SCHMIDT-SCHAUSS (a1)
Abstract

We present a higher-order call-by-need lambda calculus enriched with constructors, case expressions, recursive letrec expressions, a seq operator for sequential evaluation and a non-deterministic operator amb that is locally bottom-avoiding. We use a small-step operational semantics in the form of a single-step rewriting system that defines a (non-deterministic) normal-order reduction. This strategy can be made fair by adding resources for book-keeping. As equational theory, we use contextual equivalence (that is, terms are equal if, when plugged into any program context, their termination behaviour is the same), in which we use a combination of may- and must-convergence, which is appropriate for non-deterministic computations. We show that we can drop the fairness condition for equational reasoning, since the valid equations with respect to normal-order reduction are the same as for fair normal-order reduction. We develop a number of proof tools for proving correctness of program transformations. In particular, we prove a context lemma for both may- and must- convergence that restricts the number of contexts that need to be examined for proving contextual equivalence. Combining this with so-called complete sets of commuting and forking diagrams, we show that all the deterministic reduction rules and some additional transformations preserve contextual equivalence. We also prove a standardisation theorem for fair normal-order reduction. The structure of the ordering ≤c is also analysed, and we show that Ω is not a least element and ≤c already implies contextual equivalence with respect to may-convergence.

Copyright
References
Hide All
Ariola, Z., Felleisen, M., Maraist, J., Odersky, M. and Wadler, P. (1995) A call-by-need lambda calculus. In: Proc. POPL '95, 22'nd Annual Symposium on Principles of Programming Languages, San Francisco, California, ACM Press.
Barendregt, H. (1984) The Lambda Calculus. Its Syntax and Semantics, North-Holland.
Bois, A. R. D., Pointon, R. F., Loidl, H.-W. and Trinder, P. W. (2002) Implementing declarative parallel bottom-avoiding choice. In: SBAC-PAD, IEEE Computer Society 82–92.
Carayol, A., Hirschkoff, D. and Sangiorgi, D. (2005) On the representation of McCarthy's amb in the pi-calculus. Theor. Comput. Sci. 330 (3)439473.
Fernández, M. and Khalil, L. (2003) Interaction nets with McCarthy's amb: Properties and applications. Nordic J. Comput. 10 (2)134162.
Hallgren, T. and Carlsson, M. (1995) Programming with fudgets. In: Jeuring, J. and Meijer, E. (eds.) Advanced Functional Programming. Springer-Verlag Lecture Notes in Computer Science 925 137–182.
Henderson, P. (1980) Functional Programming – Application and Implementation, Series in Computer Science, Prentice Hall International.
Henderson, P. (1982) Purely Functional Operating Systems. In: Darlington, J., Henderson, P. and Turner, D. A. (eds.) Functional Programming and its Applications, Cambridge University Press 177192.
Hughes, J. and Moran, A. (1995) Making choices lazily. In: FPCA '95: Proceedings of the seventh international conference on Functional programming languages and computer architecture, ACM Press 108–119.
Jones, M. P. and Hudak, P. (1993) Implicit and explicit parallel programming in Haskell. Technical Report CT 06520-2158, Department of Computer Science, Yale University.
Kutzner, A. (2000) Ein nichtdeterministischer call-by-need Lambda-Kalkül mit erratic choice: Operationale Semantik, Programmtransformationen und Anwendungen, Dissertation, J. W. Goethe-Universität Frankfurt (in German).
Kutzner, A. and Schmidt-Schauss, M. (1998) A nondeterministic call-by-need lambda calculus. In: International Conference on Functional Programming 1998, ACM Press 324–335.
Lassen, S. B. (1998) Relational Reasoning about Functions and Nondeterminism, Ph.D. thesis, Department of Computer Science, University of Aarhus. (BRICS Dissertation Series DS-98-2.)
Lassen, S. B. (2006) Normal Form Simulation for McCarthy's Amb. In: Proceedings of the 21st Annual Conference on Mathematical Foundations of Programming Semantics (MFPS XXI). Electronic Notes in Theoretical Computer Science 155 445465.
Lassen, S. B., Levy, P. B. and Panangaden, P. (2005) Divergence-least semantics of amb is Hoare. Short presentation at the APPSEM II workshop, Frauenchiemsee, Germany. (Available at http://www.cs.bham.ac.uk/~pbl/papers/.)
Lassen, S. B. and Moran, A. (1999) Unique fixed point induction for McCarthy's amb. In: Kutylowski, M., Pacholski, L. and Wierzbicki, T. (eds.) MFCS. Springer-Verlag Lecture Notes in Computer Science 1672 198208.
Machkasova, E. and Turbak, F. A. (2000) A calculus for link-time compilation. In: Smolka, G. (ed.) ESOP. Springer-Verlag Lecture Notes in Computer Science 1782 260274.
Mann, M. (2005a) A Non-Deterministic Call-by-Need Lambda Calculus: Proving Similarity a Precongruence by an Extension of Howe's Method to Sharing, Dissertation, J. W. Goethe-Universität, Frankfurt.
Mann, M. (2005b) Congruence of bisimulation in a non-deterministic call-by-need lambda calculus. Electronic Notes in Theoretical Computer Science 128 (1)81101.
Mann, M. and Schmidt-Schauss, M. (2006) How to prove similarity a precongruence in non-deterministic call-by-need lambda calculi. Frank Report 22, Institut für Informatik. J. W. Goethe-Universität Frankfurt.
McCarthy, J. (1963) A Basis for a Mathematical Theory of Computation. In: Braffort, P. and Hirschberg, D. (eds.) Computer Programming and Formal Systems, North-Holland3370.
Moran, A. and Sands, D. (1999) Improvement in a lazy context: an operational theory for call-by-need. In: POPL '99: Proceedings of the 26th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, ACM Press 43–56.
Moran, A. K. (1998) Call-by-name, Call-by-need, and McCarthy's Amb, Ph.D. thesis, Department of Computing Science, Chalmers University of Technology and University of Gothenburg, Gothenburg, Sweden.
Natarajan, V. and Cleaveland, R. (1995) Divergence and fair testing. In: Fülöp, Z. and Gécseg, F. (eds.) ICALP. Springer-Verlag Lecture Notes in Computer Science 944 648659.
Peyton Jones, S. (ed.) (2003) Haskell 98 language and libraries: the Revised Report, Cambridge University Press. (Website: www.haskell.org.)
Peyton Jones, S. and Marlow, S. (2002) Secrets of the Glasgow Haskell Compiler inliner. J. Funct. Programming 12 (4+5)393434.
Sabel, D. (2003a) A guide through HasFuse. (Available at http://www.ki.informatik.uni-frankfurt.de/research/diamond/hasfuse/.)
Sabel, D. (2003b) Realising nondeterministic I/O in the Glasgow Haskell Compiler. Frank Report 17, Institut für Informatik, J. W. Goethe-Universität Frankfurt am Main.
Sabel, D. and Schmidt-Schauss, M. (2006) A call-by-need lambda-calculus with locally bottom-avoiding choice: Context lemma and correctness of transformations. Frank Report 24, Institut für Informatik, J. W. Goethe-Universität Frankfurt.
Santos, A. (1995) Compilation by Transformation in Non-Strict Functional Languages, Ph.D. thesis, Glasgow University, Department of Computing Science.
Schmidt-Schauss, M. (2003) FUNDIO: A Lambda-Calculus with a letrec, case, Constructors, and an IO-Interface: Approaching a Theory of unsafePerformIO. Frank Report 16, Institut für Informatik, J. W. Goethe-Universität Frankfurt.
Schmidt-Schauss, M., Schütz, M. and Sabel, D. (2004) On the safety of Nöcker's strictness analysis. Frank Report 19, Institut für Informatik, J. W. Goethe-Universität Frankfurt.
Schmidt-Schauss, M., Schütz, M. and Sabel, D. (2005) A complete proof of the safety of Nöcker's strictness analysis. Frank Report 20, Institut für Informatik. J. W. Goethe-Universität Frankfurt.
Søndergaard, H. and Sestoft, P. (1992) Non-determinism in functional languages. Comput. J. 35 (5)514523.
Trinder, P. W., Hammond, K., Loidl, H.-W. and Peyton Jones, S. L. (1998) Algorithm + Strategy = Parallelism. J. Funct. Programming 8 (1)2360.
Wells, J. B., Plump, D. and Kamareddine, F. (2003) Diagrams for meaning preservation. In Nieuwenhuis, R. (ed.) RTA. Springer-Verlag Lecture Notes in Computer Science 270688106.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Mathematical Structures in Computer Science
  • ISSN: 0960-1295
  • EISSN: 1469-8072
  • URL: /core/journals/mathematical-structures-in-computer-science
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×

Metrics

Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed