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.
Similar content being viewed by others
References
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).
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.
Barendregt, H.P.The Lambda Calculus: Its Syntax and Semantics. North-Holland, Amsterdam (1981).
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).
Burge, W. H.Recursive Programming Techniques. Addison-Wesley, Reading, MA (1975).
Campbell, J. A.Implementations of Prolog. Ellis Horwood, Ltd., Chichester, UK (1984).
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.
Church, A. A formulation of the simple theory of types.Journal of Symbolic Logic,5 (1940) 56–68.
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).
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).
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).
Courcelle, B. Fundamental properties of infinite trees.Theoretical Computer Science,25 (1983) 95–169.
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.
Curien, P. L.Categorical Combinators, Sequential Algorithms and Functional Programming. Research Notes in Theoretical Computer Science, Pitman, London, UK (1986).
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).
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.
DeGroot, D. and Lindstrom, G., editors.Logic Programming: Functions, Relations, and Equations. Prentice-Hall, Englewood Cliffs, NJ (1986).
Dershowitz, N.Applications of the Knuth-Bendix Completion Procedure. Aerospace Report ATR83(8478)-2, Lab. Operations, The Aerospace Corporation, El Segundo, CA (May 1983).
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).
Dershowitz, N. and Manna, Z. Proving termination with multiset ordering.Communications of the ACM,22, 8 (1979) 465–476.
Fay, M. First-order unification in an equational theory. InProceedings of the 4th Conference on Automated Deduction, Austin, TX (1979) 161–167.
Felleisen, M.Transliterating Prolog into Scheme. Technical Report 182, Computer Science Department, Indiana University, Bloomington, IN (1985).
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.
Gallier, J. H.n-Rational algebras, part I: basic properties and free algebras.SIAM Journal on Computing,13, 4 (November 1984) 750–775.
Gallier, J. H.n-Rational algebras, part II: varieties and logic of inequalities.SIAM Journal on Computing,13, 4 (November 1984) 776–794.
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.
Goguen, J. and Meseguer, J.An Initiality Primer. Technical Draft, Computer Science Laboratory, SRI International, Menlo Prk, CA (March 1983).
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.
Goldfarb, W. D. The undecidability of the second-order unification problem.Theoretical Computer Science,13 (1981) 225–230.
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.
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).
Hughes, J.Graph Reduction with Super-Combinators. Technical Monograph PRG-28, Programming Research Group, Oxford University, Oxford, UK (1982).
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.
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).
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.
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).
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).
Kirchner, C. Computing unification algorithms. InProceedings of IEEE Computer Society Symposium on Logic in Computer Science, Cambridge, MA (June 1986) 206–217.
Klop, J. W. Term rewriting systems. Lecture Notes, Seminar on Reduction Machines, Ustica, Italy (September 1985).
Landin, P. J. The mechanical evaluation of expressions.Computer Journal,6, 4 (1963) 308–320.
Lincoln, P. D.DisCoRd: Distributed Combinator Reduction. Bachelor Thesis, Department of EECS, Massachussets Institute of Technology, Cambridge, MA (May 1986).
Mahr, B. and Makowsky, J. A. Characterizing specification languages which admit initial semantics.Theoretical Computer Science,31 (1984) 49–60.
Martelli, A. and Montanari, U. An efficient unification algorithm.ACM Transactions on Programming Languages and Systems,4, 2 (April 1982) 258–282.
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).
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.
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.
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.
Milner, R. A theory of type polymorphism in programming.Journal of Computing Systems and Science, 17,3, (December 1978) 348–375.
Nadathur, G.Higher-Order Logic Programming and Applications. PhD thesis, Department of Computer and Information Science, University of Pennsylvania, Philadelphia, PA (December 1986).
Naish, L.MU-Prolog 3.1 db Reference Manual. Computer Science Department, University of Melbourne, Melbourne, Australia (May 1984).
Nikhil, R., Pingali, K., and Arvind.ID Nouveau. Computational Structures Group Memo 265, Massachussets Institute of Technology, Cambridge, MA (July 1986).
Peterson, G. and Stickel, M. Complete sets of reductions for some equational theories.Journal of the ACM,28 (1983) 233–264.
Peyton Jones, S. L.The Implementation of Functional Programming Languages. Prentice-Hall, Englewood Cliffs, NJ (1987).
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.
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.
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.
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).
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.
Shapiro, E.A Subset of Concurrent Prolog and its Interpreter. Technical report TR-003, Institute for 5th Generation Computing, Tokyo, Japan (January 1983).
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.
Smolka, G. Some thoughts on logic programming. Lecture Notes, Microelectronics and Computer Technology Corporation, Austin, TX (July 23 1986).
Smolka, G.TEL Version 0.9: Report and User Manual. SEKI Report ST-87-11, Universität Kaiserslautern, Kaiserslautern, W. Germany (February 1988).
Turner, D. A. A new implementation technique for applicative languages.Software—Practice and Experience,9 (1979) 31–49.
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.
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.
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.
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.
Author information
Authors and Affiliations
Additional information
This article is a revised and extended version of [1].
Rights 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
Issue Date:
DOI: https://doi.org/10.1007/BF01806313