A logical operational semantics of full Prolog

Part II. Built-in predicates for database manipulations
  • Egon Börger
Invited Lectures
Part of the Lecture Notes in Computer Science book series (LNCS, volume 452)


Y. Gurevich recently proposed a framework for semantics of programming concepts which directly reflects the dynamic and resource-bounded aspects of computation. This approach is based on (essentially first-order) structures that evolve over time and are finite in the same way as real computers are (so-called “dynamic algebras”). See Gurevich 1988 for the idea of dynamic algebras and its application to an operational semantics for Modula 2 (Gurevich & Morris 1988), Smalltalk (Blakley 1990), Occam (Gurevich & Moss 1990).

We use dynamic algebras to give an operational semantics for Prolog which, far from being hopelessly complicated, unnatural or machine-dependent, is simple, natural and abstract and in particular supports the process oriented understanding of programs by programmers. In spite of its abstractness, our semantics can easily be made machine executable (see Kappel 1990 for an implementation). It is designed for extensibility and as a result of the inherent extensibility of dynamic algebra semantics, we are able to proceed by stepwise refinement.

We give this semantics for the full language of Prolog including all the usual non-logical built-in predicates. Our specific aim is to provide a mathematically precise but simple framework in which standards can be defined rigorously and concisely and in which different implementations may be compared and judged.

Part I deals with the core of Prolog which governs the selection mechanism of clauses for goal satisfaction including backtracking and cut and closely related built-in control predicates. In the present part II the database built-in predicates are treated. Part III deals with the remaining built-in predicates.

The paper is organized as follows: in section 1 we will define the notion of dynamic algebra adapted from Gurevich 1988 and fix our language. In sections 2 and 3 we will review the core of Prolog algebras which governs the selection mechanism of clauses under bracktracking and the usual control features. To take into account reactions and suggestions of practitioners to our treatment in Part I we
  1. a)

    abandon the hypothesis—made there on logical grounds—that unification has to be done with occur check,

  2. b)

    base our treatment on pure copying instead of interweaving copying with structure sharing, and

  3. c)

    describe in just one step all the current backtracking alternatives of the goal under consideration (instead of keeping track of the first alternative which then kept track of the second, etc.)


In this way, this paper can be read independently of Part I although for sake of brevity we do not repeat here many verbal explanations, examples and motivating discussion, for which the interested reader is refered to Part I. In section 4 we describe the extensions needed for the usual built-in dabase predicates. In section 5 we will give references to related work in the literature.


Logic Program Operational Semantic Transition Rule Resolution State Denotational Semantic 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. Arbab, B. & Berry, D. M. 1987: Operational and Denotational Semantics of Prolog. J. Logic Programming 4, pp. 309–329.Google Scholar
  2. Blakley, R. 1990: Ph.D. Thesis, University of Michigan (in preparation).Google Scholar
  3. Börger, E. 1990: A Logical Operational Semantics of Full Prolog. Part I. Selection Core and Control in: CSL'89. 3rd Workshop on Computer Science Logic.Springer LNCS 440Google Scholar
  4. Börger, E. 1990: A Logical Operational Semantics of Full Prolog. Part III. Built-in Predicates for Files, Terms, In-Output and Arithmetic. In: Proc. Workshop Logic for Computer Science, Berkeley, MSRI, November, 1989 (to appear with Springer Verlag, ed. Y. Moschovakis).Google Scholar
  5. Deransart, P. & Ferrand, G. 1987: An operational formal definition of Prolog. INRIA RR763 (revised version of the abstract in Proc. 4th Symposium on Logic Programming, San Francisco 1987, pp. 162–172).Google Scholar
  6. DFPS 1989: Deransart, P., Folkjaer, P., Pique, J.-F., Scowen, R. S.: Prolog. Draft for Working Draft 2.0. ISO/IEC YTC1 SC22 WG17 No. 40, pp. VI + 96.Google Scholar
  7. Gurevich, Y. 1988: Logic and the Challenge of Computer Science in: Trends in Theoretical Computer Science (E. Börger, ed.), Computer Science Press, 1988, pp. 1–57.Google Scholar
  8. Gurevich, Y. 1988: Algorithms in the World of Bounded Resources. In: The Universal Turing Machine—a Half-Century Story (Ed. R. Herken), Oxford University Press, pp. 407–416.Google Scholar
  9. Gurevich, Y. & Morris, J. M. 1988: Algebraic Operational Semantics and Modula-2 in: CSL'87. 1st Workshop on Computer Science Logic (Eds. E. Börger, H. Kleine Büning, M. Richter), Springer LNCS 329, pp. 81–101.Google Scholar
  10. Gurevich, Y. & Moss, L. S. 1990: Algebraic Operational Semantics and Occam in: CSL'89, 3rd Workshop on Computer Science Logic (Eds. E. Börger, H. Kleine Büning, M. Richter), Springer LNCS.Google Scholar
  11. Jones, N. D. & Mycroft, A. 1984: Stepwise Development of Operational and Denotational Semantics for Prolog in: Proc. Int. Symp. on Logic Programming 2/84, Atlantic City, IEEE, pp. 289–298.Google Scholar
  12. Kappel, A. 1990: Implementation of Dynamic Algebras with an Application to Semantics for Prolog (tentative title). Diploma Thesis (ongoing project), University of Dortmund, Fed. Rep. of Germany.Google Scholar
  13. Lindholm, T.G. & O'Keefe R.A. 1987: Efficient Implementation of a Defensible Semantics for Dynamic Prolog Code Proceedings of the Fourth International Conference on Logic Programming, 21–39.Google Scholar
  14. North, N. 1988: A Denotational Definition of Prolog. NPL Report DITC 106/88. National Physical Lab, Teddington, Middlesex (submitted to the Journal of Logic Programming. I have seen this manuscript in the form of November 16, 1989.).Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1990

Authors and Affiliations

  • Egon Börger
    • 1
  1. 1.IBM Germany, Heidelberg Scientific Center Institute for Knowledge Based SystemsHeidelberg 1Federal Republic of Germany

Personalised recommendations