Springer Nature is making SARS-CoV-2 and COVID-19 research free. View research | View latest news | Sign up for updates

Combinator evaluation of functional programs with logical variables

Abstract

A technique is presented that brings logical variables into the scope of the well-known Turner method for normal order evaluation of functional programs by S, K, I combinator graph reduction. This extension is illustrated bySASL+LV, an extension of Turner's languageSASL in which arbitrary expressions serve as formal parameters, and parameter passage is done by unification. The conceptual and practical advantages of such an extension are discussed, as well as semantic pitfalls that arise from the attendant weakening of referential transparency. Only five new combinators (LV, BV, FN, FB and UNIFY) are introduced. The resulting object code is fully upward compatible in the sense that previously compiledSASL programs remain executable with unchanged semantics. However,read-only variable usage inSASL+LV programs requires amultitasking extension of the customary stack-based evaluation method. Mechanisms are presented for managing this multitasking on both single and multiprocessor systems. Finally, directions are mentioned for applying this technique to implementations involving larger granularity combinators, and fuller semantic treatment of logical variables (e.g. accommodation of failing unifications).

This is a preview of subscription content, log in to check access.

References

  1. 1.

    Ali, K. M. and Haridi, S. Global garbage collection for distributed heap storage systems.International Journal of Parallel Programming, 15, 35 (October 1987) 339–387.

  2. 2.

    Ariola, Zena and Arvind. P-TAC: a parallel intermediate language. In MacQueen, David, editor,Proc. Conf. on Functional Programming Languages and Computer Architectures, London, Springer Verlag (1989).

  3. 3.

    Arvind, Kathail, Vinod, and Pingali, Keshav. Sharing of computation in functional language implementations. InProceedings of International Workshop on High-level Computer Architecture, Los Angeles (May 21–25 1984).

  4. 4.

    Arvind, Nikhil, Rishiyur S., and Pingali, Keshav K. I-structures: data structures for parallel computing.ACM Transactions on Programming Languages and Systems, 11, 4 (October 1989) 598–632.

  5. 5.

    Båge, Göran and Lindstrom, Gary. Committed choice functional programming. InProc. International Conference on Fifth Generation Computer Systems, Institute for New Generation Computer Technology (ICOT), Tokyo (November 1988) 666–674.

  6. 6.

    Burton, F. W. Speculative computation, parallelism and functional programming.IEEE Transactions on Computers, C-34, 12 (1985) 1190–1193.

  7. 7.

    Camilleri, Albert, Gordon, Michael C., and Melham, Tom. Hardware specification and verification using higher order logic. In Borrione, Dominique, editor,Proceedings of the IFIP Working conference “From HDL Descriptions to Guaranteed Correct Circuit Designs”, North-Holland, Grenoble, France (1987).

  8. 8.

    Clack, C. and Peyton Jones, S. L. Generating parallelism from strictness analysis. InProc. Conf. on Func. Prog. Lang. and Comp. Arch., IFIP, Nancy, France (September 1985). Lecture Notes in Computer Science, number 201.

  9. 9.

    Clarke, T. J. W., Gladstone, P. J. S., Maclean, C. D., and Norman, A. C. SKIM — the S, K, I reduction machine. InProc. Symp. on Lisp and Func. Pgmming. and Computer Architectures, ACM (1980) 128–135.

  10. 10.

    Cohen, Jacques and Hickey, Timothy. Parsing and compiling using Prolog.ACM Transactions on Programming Languages and Systems, 9, 2 (1987) 125–163.

  11. 11.

    Curry, H. B. and Feys, R.Combinatory Logic. Volume 1, North Holland (1958).

  12. 12.

    Danforth, S. H.Logical Variables for a Functional Language. Technical Report PP-120-85, Microelectronics and Computer Technology Corp. (1985).

  13. 13.

    Davison, Andrew. Blackboard systems in Polka.International Journal of Parallel Programming, 16, 5 (October 1987) 401–424.

  14. 14.

    Debray, Saumya K. and Warren, David S. Automatic mode inference for Prolog programs. In Keller, Robert M., editor,Symposium on Logic Programming, IEEE Computer Society, Salt Lake City (September 1986) 78–88.

  15. 15.

    Deutsch, L. P. and Bobrow, D. G. An efficient incremental automatic garbage collector.Communications of the ACM, 9, 9 (1966) 522–526.

  16. 16.

    Goldberg, B. and Hudak, P. Serial combinators: optimal grains of parallelism. InProc. Conf. on Functional Programming Languages and Computer Architectures, Springer Verlag, Nancy, France (1985) 382–399. Lecture Notes in Computer Science, number 201.

  17. 17.

    Haridi, A. Seif.Logic Programming Based on a Natural Deduction System. PhD thesis, Royal Institute of Technology (1981).

  18. 18.

    Hughes, John. Super combinators: a new implementation method for applicative languages. InProc. Symp. on Lisp and Func. Pgmming. and Computer Architectures, ACM, Pittsburgh, Pa. (1982) 1–10.

  19. 19.

    Hughes, J. Lazy memo-functions. InProc. Conf. on Func. Prog. Lang. and Comp. Arch., IFIP, Nancy, France (September 1985).

  20. 20.

    Hughes, J. A simple implementation of concurrent graph reduction. In Keller, R. M. and Fasel, J., editors,Proc. Santa Fe Workshop on Graph Reduction, Springer-Verlag (1987). Lecture Notes in Computer Science 279.

  21. 21.

    Jagadeesan, Radha, Panangaden, Prakash, and Pingali, Keshav. A fully abstract semantics for a functional language with logical variables. InProc. of Symposium on Logic in Computer Science (1989).

  22. 22.

    Johnsson, T. Efficient compilation of lazy evaluation. InProc. Symp. on Compiler Const., ACM SIGPLAN, Montreal (1984).

  23. 23.

    Kahn, K., Tribble, E. D., Miller, M. S., and Bobrow, D. G. Objects in concurrent object programming systems. InProc. OOPSLA '86, Portland, OR (1986) 242–257.

  24. 24.

    Keller, R. M. and Lin, F. C. H. Simulated performance of a reduction-based multiprocessor.IEEE Computer, 17, 7 (July 1984) 70–82.

  25. 25.

    Keller, R. M., Jayaraman, B., Rose, D., and Lindstrom, G.FGL (Function Graph Language) Programmers' Guide. Technical Report AMPS Technical Memorandum No. 1, University of Utah, Computer Science Department (July 1980).

  26. 26.

    Kieburtz, R. B. The G machine: a fast graph-reduction evaluator. InProc. Conf. on Functional Programming Languages and Computer Architectures, Nancy, France, Springer Verlag (1985) 400–413. Lecture Notes in Computer Science, number 201.

  27. 27.

    Kieburtz, Richard B. Semantics of a functions + logic language. (September 3, 1986). 17 pp. unpublished paper.

  28. 28.

    Kieburtz, Richard B: When chasing your tail saves time.Information Processing Letters, 23 (December 1986) 321–324.

  29. 29.

    Kieburtz, Richard B.Functions + Logic in Theory and Practice. technical report CSE-87-002, Oregon Graduate Institute (February 25, 1987 (revised June, 1988)). 21 pp.

  30. 30.

    Kuo, T.-M. and Mishra, P. On strictness and its analysis. InProc. Symp. on Princ. of Pgmming. Lang., ACM, Munich, West Germany (March 1987).

  31. 31.

    Lindstrom, Gary. Scanning list structures without stacks or tag bits.Information Processing Letters, 2 (1973) 47–51.

  32. 32.

    Lindstrom, G. OR-parallelism on applicative architectures. InProc. 2nd Int'l. Logic Programming Conf., Uppsala University (July 1984) 159–170.

  33. 33.

    Lindstrom, G. Functional programming and the logical variable. InProc. Symp. on Princ. of Pgmming. Lang., ACM, New Orleans (January 1985) 266–280. Also available as INRIA Rapport de Recherche No. 357.

  34. 34.

    Lindstrom, G. Implementing logical variables on a graph reduction architecture. In Keller, R. M. and Fasel, J., editors,Proc. Santa Fe Workshop on Graph Reduction, Springer-Verlag (1987) 382–400. Lecture Notes in Computer Science 279.

  35. 35.

    Lindstrom, Gary. Static analysis of functional programs with logical variables. InProc. International Workshop on Programming Language Implementation and Logic Programming (PLILP '88), Springer Lecture Notes in Computer Science Number 348, Orleans, France (1989) 1–19.

  36. 36.

    Lindstrom, G., George, L., and Yeh, D. Generating efficient code from strictness annotations. InTAPSOFT'87: Proc. Second International Joint Conference on Theory and Practice of Software Development, Pisa, Italy (March 1987) 140–154. Springer Lecture Notes in Computer Science No. 250.

  37. 37.

    Mantha, Surya, George, Lal, and Lindstrom, Gary. A denotational semantics for a lazy functional language with logical variables. (December 1989). Unpublished 11 pp. technical summary.

  38. 38.

    Milner, R. A theory of type polymorphism.J. of Comp. and Sys. Sci., 17, 3 (1978) 348–375.

  39. 39.

    Nikhil, R. S.Id World Reference Manual (for Lisp Machines). Technical Report Computation Structures Group Memo, MIT Laboratory for Computer Science (April 24, 1987).

  40. 40.

    Patel, Dorab, Schlag, Martine, and Ercegovac, Miloš.vFP, an environment for the multi-level specification, analysis and synthesis of hardware algorithms. InProc. Conf. on Functional Programming Languages and Computer Architectures, Springer Verlag, Nancy, France (1985) 238–255. Lecture Notes in Computer Science, number 201.

  41. 41.

    Reddy, U.S. On the relationship between functional and logic languages. In DeGroot, D. and Lindstrom, G., editors,Logic Programming: Functions, Relations, and Equations, Prentice Hall (1986).

  42. 42.

    Saraswat, Vijay A. A somewhat logical formulation of CLP synchronization primitives. In Kowalski, Robert A. and Bowen, Kenneth A., editors,Logic Programming: Proceedings of the Fifth International Conference and Symposium, MIT Press, Seattle (1988) 1298–1314.

  43. 43.

    Scheevel, Mark. Norma: a graph reduction processor. InProc. Symp. on Lisp and Func. Pgmming., ACM, Cambridge, MA (1986) 212–219.

  44. 44.

    Schorr, H. and Waite, W. M. An efficient machine-independent procedure for garbage collection in various list structures.Communications of the ACM, 10, 8 (1967) 501–506.

  45. 45.

    Scott, Dana. Domains for denotational semantics. InInternational Conference on Foundations of Programming Languages, Springer-Verlag Lecture Notes in Computer Science 140 (1982) 577–613.

  46. 46.

    Shapiro, E.Y.A Subset of Concurrent Prolog and Its Interpreter. Technical Report TR-003, Institute for New Generation Computer Technology (January 1983).

  47. 47.

    Shapiro, Ehud. Concurrent Prolog: a progress report.IEEE Computer, 19, 8 (August 1986) 44–58.

  48. 48.

    Sheeran, Mary. Designing regular array architectures using higher order functions. InProc. Conf. on Functional Programming Languages and Computer Architectures, Springer Verlag, Nancy, France (1985) 220–237. Lecture Notes in Computer Science, number 201.

  49. 49.

    Stroustrup, Bjarne. A set of C++ classes for co-routine style programming. (1985). Appendix toUNIX (tm) System V C++ Translator Release Notes.

  50. 50.

    Tinker, P. and Lindstrom, G. A performance oriented design for OR-parallel logic programming. In Lassez, Jean-Louis, editor,Proc. International Conference on Logic Programming, MIT Press, Melbourne, Australia (May 1987) 601–615.

  51. 51.

    Turner, D. A. A new implementation technique for applicative languages.Software Practice and Experience, 9 (1979) 31–49.

  52. 52.

    Turner, David A. Miranda: a non-strict functional language with polymorphic types. In Journannaud, J.-P., editor,Proc. Symp. on Functional Programming Languages and Computer Architectures, Springer-Verlag (1985) 1–16.

  53. 53.

    Yeh, Dowming and Lindstrom, Gary. Polymorphic typing and strictness analysis. (November 1989). Unpublished 12 pp. technical summary.

Download references

Author information

Additional information

Research was supported in part by the Marcus Wallenberg Foundation.

Research supported in part by grant CCR-8704778 from the National Science Foundation, and by an unrestricted gift from Telefonaktiebolaget LM Ericsson, Stockholm.

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Båge, G., Lindstrom, G. Combinator evaluation of functional programs with logical variables. Lisp and Symbolic Computation 3, 289–320 (1990). https://doi.org/10.1007/BF01806101

Download citation

Keywords

  • Artificial Intelligence
  • Evaluation Method
  • Formal Parameter
  • Order Evaluation
  • Practical Advantage