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

Integrating logic and functional programming

  • 37 Accesses

  • 21 Citations

Abstract

The intent of this article is twofold: To survey prominent proposals for the integration of logic and functional programming and to present a new paradigm for the same purpose. We categorize current research into four types of approaches, depending on the level at which the proposed integration is achieved. Unlike most current work, our approach is not based on extending unification to general-purpose equation solving. Rather, we propose a computation delaying mechanism calledresiduation. This allows a clear distinction between functionalevaluation and logicaldeduction. The former is based on theλ-calculus, and the latter on Horn clause resolution. Residuation is built into the unification operation which may then account forβ-reduction. In clear contrast with equation-solving approaches, our model supports higher-order function evaluation and efficient compilation of both functional and logic programming expressions, without being plagued by non-deterministic term-rewriting. In addition, residuation lends itself naturally to process synchronization and constrained search. We describe an operational semantics and an implementation of a prototype language called LeFun—Logic, equations, and Functions.

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

References

  1. 1.

    Aït-Kaci, H. and Nasr, R.Residuation: A Paradigm for Integrating Logic and Functional Programming. MCC Technical Report Number AI-359-86, Microelectronics and Computer Technology Corporation, Austin, TX (October 1986).

  2. 2.

    Barbuti, R.et al. LEAF: a language which integrates logic, equations, and functions. In DeGroot, D. and Lindstrom, G., editors,Logic Programming: Functions, Relations, and Equations, Prentice-Hall, Englewood Cliffs, NJ (1986) 201–238.

  3. 3.

    Barendregt, H.P.The Lambda Calculus: Its Syntax and Semantics. North-Holland, Amsterdam (1981).

  4. 4.

    Bosco, P. G. and Giovanetti, E.A Prolog-Compiled Higher-Order Functional and Logic Programming Language. Technical Draft, CSELT, Torino, Italy (1986). An abridged version of this paper has appeared in the proceedings of the 3rd IEEE Symposium on Logic Programming, Salt Lake City, UT (September 1986).

  5. 5.

    Burge, W. H.Recursive Programming Techniques. Addison-Wesley, Reading, MA (1975).

  6. 6.

    Campbell, J. A.Implementations of Prolog. Ellis Horwood, Ltd., Chichester, UK (1984).

  7. 7.

    Chew, L. P. An improved algorithm for computing with equations. InProceedings of the 21st Annual IEEE Symposium on the Foundations of Computer Science, Syracuse, NY (1980) 108–117.

  8. 8.

    Church, A. A formulation of the simple theory of types.Journal of Symbolic Logic,5 (1940) 56–68.

  9. 9.

    Clark, K. L. and Gregory, S.Parlog: A Parallel Logic Programming Language. Research Report DOC-83/5, Department of Computing, Imperial College, London, UK (May 1983).

  10. 10.

    Coehlo, H., Cotta, J. C., and Pereira, L. M.How to solve it with Prolog. Technical Report, Ministério da Habitação e Obras Públicas, Laboratorio de Engenharia Civil, Lisbon, Portugal (1980).

  11. 11.

    Colmerauer, A.et al. Prolog H: Reference Manual and Theoretical Model. Technical Report, Groupe d'Intelligence Artificielle, Faculté des Sciences d'Aix-Luminy, Marseille, France (1982).

  12. 12.

    Courcelle, B. Fundamental properties of infinite trees.Theoretical Computer Science,25 (1983) 95–169.

  13. 13.

    Cousineau, G., Curien, P. L. and Mauny, M. The categorical abstract machine. In Jouannaud, J.-P., editor,Functional Programming Languages and Computer Architecture, LNCS 201, Springer-Verlag, Berlin, W. Germany (September 1985) 50–64.

  14. 14.

    Curien, P. L.Categorical Combinators, Sequential Algorithms and Functional Programming. Research Notes in Theoretical Computer Science, Pitman, London, UK (1986).

  15. 15.

    Damm, W. Languages defined by higher program schemes. InProceedings of the 4th International Conference on Automata, Languages, and Programming, LNCS 52, Springer-Verlag, Berlin, W. Germany (1977).

  16. 16.

    Darlington., J. The unification of functional and logic programming. In DeGrott, D. and Lindstrom, G., editors,Logic Programming: Functions, Relations, and Equations, Prentice-Hall, Englewood Cliffs, NJ (1986) 37–72.

  17. 17.

    DeGroot, D. and Lindstrom, G., editors.Logic Programming: Functions, Relations, and Equations. Prentice-Hall, Englewood Cliffs, NJ (1986).

  18. 18.

    Dershowitz, N.Applications of the Knuth-Bendix Completion Procedure. Aerospace Report ATR83(8478)-2, Lab. Operations, The Aerospace Corporation, El Segundo, CA (May 1983).

  19. 19.

    Dershowitz, N. Completion and its applications. In Aït-Kaci, H. and Nivat, N., editors,Resolution of Equations in Algebraic Structures, Academic-Press, Boston, MA (Forthcoming in 1989).

  20. 20.

    Dershowitz, N. and Manna, Z. Proving termination with multiset ordering.Communications of the ACM,22, 8 (1979) 465–476.

  21. 21.

    Fay, M. First-order unification in an equational theory. InProceedings of the 4th Conference on Automated Deduction, Austin, TX (1979) 161–167.

  22. 22.

    Felleisen, M.Transliterating Prolog into Scheme. Technical Report 182, Computer Science Department, Indiana University, Bloomington, IN (1985).

  23. 23.

    Fribourg, L. Handling function definition through innermost superposition and rewriting. In Jouannaud, J.-P., editor,Proceedings of the 1st International Conference on Rewriting Techniques and Applications, LNCS 202, Springer-Verlag, Berlin, W. Germany (May 1985) 325–344.

  24. 24.

    Gallier, J. H.n-Rational algebras, part I: basic properties and free algebras.SIAM Journal on Computing,13, 4 (November 1984) 750–775.

  25. 25.

    Gallier, J. H.n-Rational algebras, part II: varieties and logic of inequalities.SIAM Journal on Computing,13, 4 (November 1984) 776–794.

  26. 26.

    Gallier, J. H.Logic for Computer Science: Foundations of Theorem-Proving. Harper & Row, New York NY (1986) chapter 10, §6: Decision Procedures Based on Congruence Closure, 461–474.

  27. 27.

    Goguen, J. and Meseguer, J.An Initiality Primer. Technical Draft, Computer Science Laboratory, SRI International, Menlo Prk, CA (March 1983).

  28. 28.

    Goguen, J. and Meseguer, J. Eqlog: equality, types, and generic modules for logic programming. In DeGroot, D. and Lindstrom, G., editors,Logic Programming: Functions, Relations, and Equations, Prentice-Hall, Englewood Cliffs, NJ (1986) 295–364.

  29. 29.

    Goldfarb, W. D. The undecidability of the second-order unification problem.Theoretical Computer Science,13 (1981) 225–230.

  30. 30.

    Hsiang, J. and Dershowitz, N. Rewrite methods for clausal and nonclausal theorem proving. InProceedings of the 10th International Conference on Automata, Languages and Programming, LNCS 154, Springer-Verlag, Berlin, W. Germany (1983) 331–346.

  31. 31.

    Huet, G.Constrained Resolution: A Complete Method for Higher-Order Logic. PhD thesis, Depatment of Computing and Information Sciences, Case Western Reserve University (August 1972).

  32. 32.

    Hughes, J.Graph Reduction with Super-Combinators. Technical Monograph PRG-28, Programming Research Group, Oxford University, Oxford, UK (1982).

  33. 33.

    Hullot, J.-M. Canonical forms and unification. InProceedings of the 5th Conference on Automated Deduction, LNCS 87, Springer-Verlag, Berlin, W. Germany (1980) 318–334.

  34. 34.

    Jaffar, J. and Lassez, J.-L. Constraint logic programming. InProceedings of the 14th ACM Symposium on Principles of Programming Languages, Munich, W. Germany (January 1987).

  35. 35.

    Josephson, A. and Dershowitz, N. An implementation of narrowing: the RITE way. InProceedings of the 3rd IEEE Symposium on Logic Programming, Salt Lake City, UT (September 1986) 187–199.

  36. 36.

    Jouannaud, J.-P., editor.Proceedings of the 1st International Conference on Rewriting Techniques and Applications. Volume 202 ofLNCS, Springer-Verlag, Berlin, W. Germany (May 1985).

  37. 37.

    Jouannaud, J.-P. and Kirchner, H.Completion of a Set of Rules Modulo a Set of Equations. Rapport de Recherche 84-R-046, CRIN, Vandœuvre-lès-Nancy, France (1985). A preliminary version of this paper was presented at the 11th ACM Symposium on Principles of Programming Languages, in Salt Lake City, UT (1984).

  38. 38.

    Kirchner, C. Computing unification algorithms. InProceedings of IEEE Computer Society Symposium on Logic in Computer Science, Cambridge, MA (June 1986) 206–217.

  39. 39.

    Klop, J. W. Term rewriting systems. Lecture Notes, Seminar on Reduction Machines, Ustica, Italy (September 1985).

  40. 40.

    Landin, P. J. The mechanical evaluation of expressions.Computer Journal,6, 4 (1963) 308–320.

  41. 41.

    Lincoln, P. D.DisCoRd: Distributed Combinator Reduction. Bachelor Thesis, Department of EECS, Massachussets Institute of Technology, Cambridge, MA (May 1986).

  42. 42.

    Mahr, B. and Makowsky, J. A. Characterizing specification languages which admit initial semantics.Theoretical Computer Science,31 (1984) 49–60.

  43. 43.

    Martelli, A. and Montanari, U. An efficient unification algorithm.ACM Transactions on Programming Languages and Systems,4, 2 (April 1982) 258–282.

  44. 44.

    Martelli, A., Rossi, G. F., and C., Moiso. Lazy unification algorithms for canonical rewrite systems. In Aït-Kaci, H. and Nivat, N., editors,Resolution of Equations in Algebraic Structures, Academic-Press, Boston, MA (Forthcoming in 1989).

  45. 45.

    Mellish, C. and Hardy, S. Integrating Prolog in the PopLog environment. In Campbell, J. A., editor,Implementations of Prolog, Ellis Horwood, Ltd., Chichester, UK (1984) 147–162.

  46. 46.

    Meseguer, J. and Goguen, J. A. Initiality, induction, and computability. In Nivat, M. and Reynolds, J., editors,Algebraic Methods in Semantics, Chapter 14, Cambridge University Press, Cambridge, UK (1985) 459–541.

  47. 47.

    Miller, D. A. and Nadathur, G. Higher-order logic programming. In Shapiro, E., editor,Proceedings of the 3rd International Conference on Logic Programming, LNCS 225, Springer-Verlag, Berlin, W. Germany (July 1986) 448–462.

  48. 48.

    Milner, R. A theory of type polymorphism in programming.Journal of Computing Systems and Science, 17,3, (December 1978) 348–375.

  49. 49.

    Nadathur, G.Higher-Order Logic Programming and Applications. PhD thesis, Department of Computer and Information Science, University of Pennsylvania, Philadelphia, PA (December 1986).

  50. 50.

    Naish, L.MU-Prolog 3.1 db Reference Manual. Computer Science Department, University of Melbourne, Melbourne, Australia (May 1984).

  51. 51.

    Nikhil, R., Pingali, K., and Arvind.ID Nouveau. Computational Structures Group Memo 265, Massachussets Institute of Technology, Cambridge, MA (July 1986).

  52. 52.

    Peterson, G. and Stickel, M. Complete sets of reductions for some equational theories.Journal of the ACM,28 (1983) 233–264.

  53. 53.

    Peyton Jones, S. L.The Implementation of Functional Programming Languages. Prentice-Hall, Englewood Cliffs, NJ (1987).

  54. 54.

    Ramakrishnan, R. and Silberschatz, A. Annotations for distributed programming in logic. InProceedings of the 13th ACM Symposium on Principles of Programming Languages, St-Petersburg Beach, FL (January 1986) 255–262.

  55. 55.

    Reddy, U. On the relationship between logic and functional programming. In DeGroot, D. and Lindstrom, G., editors,Logic Programming: Functions, Relations, and Equations, Prentice-Hall, Englewood Cliffs, NJ (1986) 3–36.

  56. 56.

    Réty, P.et al. Narrower: a new algorithm for unification and its application to logic programming. In Jouannaud, J.-P., editor,Proceedings of the 1st International Conference on Rewriting Techniques and Applications, Springer-Verlag, Berlin, W. Germany (1985) 141–157.

  57. 57.

    Robinson, J. A. and Greene, K. J.New Generation Knowledge Processing: Final Report on the SUPER System. CASE Center Technical Report No. 8707, Syracuse University, Syracuse, NY (May 1987).

  58. 58.

    Sato, M. and Sakurai, T. QUTE: a functional language based on unification. In DeGroot, D. and Lindstrom, G., editors,Logic Programming: Functions, Relations, and Equations, Prentice-Hall, Englewood Cliffs, NJ (1986) 131–155.

  59. 59.

    Shapiro, E.A Subset of Concurrent Prolog and its Interpreter. Technical report TR-003, Institute for 5th Generation Computing, Tokyo, Japan (January 1983).

  60. 60.

    Smolka, G. FRESH: a higher-order language with unification and multiple results. In DeGroot, D. and Lindstrom, G., editors,Logic Programming: Functions, Relations, and Equations, Prentice-Hall, Englewood Cliffs, NJ (1986) 469–524.

  61. 61.

    Smolka, G. Some thoughts on logic programming. Lecture Notes, Microelectronics and Computer Technology Corporation, Austin, TX (July 23 1986).

  62. 62.

    Smolka, G.TEL Version 0.9: Report and User Manual. SEKI Report ST-87-11, Universität Kaiserslautern, Kaiserslautern, W. Germany (February 1988).

  63. 63.

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

  64. 64.

    Turner, D. A. Recursion equations as a programming language. In Darlington, J., Henderson, P., and Turner, D. A., editors,Functional Programming and its Applications: An Advanced Course, Cambridge University Press, Cambridge, UK (1982) 1–29.

  65. 65.

    Warren, D. H. D. Higher-order extensions of Prolog—are they needed? In Michie, D., editor,Machine Intelligence 10, Edinburgh University Press, Edinburgh, UK (1982) 441–454.

  66. 66.

    Yelick, K. Combining unification algorithms for confined equational theories. In Jouannaud, J.-P., editor,Proceedings of the 1st International Conference on Rewriting Techniques and Applications, Springer-Verlag, Berlin, W. Germany (1985) 365–380.

  67. 67.

    You, J. H. and Subrahmanyam, P. A. Equational logic programming: an extension to equational programming. InProceedings of the 13th ACM Symposium on Principles of Programming Languages, St-Petersburg Beach, FL (January 1986) 209–218.

Download references

Author information

Additional information

This article is a revised and extended version of [1].

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Ait-Kaci, H., Nasr, R. Integrating logic and functional programming. Lisp and Symbolic Computation 2, 51–89 (1989). https://doi.org/10.1007/BF01806313

Download citation

Keywords

  • Operating System
  • Artificial Intelligence
  • Function Evaluation
  • Current Work
  • Clear Distinction