Abstract
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
-
a)
abandon the hypothesis—made there on logical grounds—that unification has to be done with occur check,
-
b)
base our treatment on pure copying instead of interweaving copying with structure sharing, and
-
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.
Preview
Unable to display preview. Download preview PDF.
Bibliography
Arbab, B. & Berry, D. M. 1987: Operational and Denotational Semantics of Prolog. J. Logic Programming 4, pp. 309–329.
Blakley, R. 1990: Ph.D. Thesis, University of Michigan (in preparation).
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 440
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).
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.).
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1990 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Börger, E. (1990). A logical operational semantics of full Prolog. In: Rovan, B. (eds) Mathematical Foundations of Computer Science 1990. MFCS 1990. Lecture Notes in Computer Science, vol 452. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0029592
Download citation
DOI: https://doi.org/10.1007/BFb0029592
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-52953-8
Online ISBN: 978-3-540-47185-1
eBook Packages: Springer Book Archive