Skip to main content
Log in

Compositional operational semantics for Prolog programs

  • Regular Papers
  • Published:
New Generation Computing Aims and scope Submit manuscript

Abstract

To relate operational semantics of logic programs to its declarative semantics, we have to rely on SLD-trees. But this form of operational semantics does not make it easy to relate execution behaviour to program structure. The reason is that the traversal of SLD-trees decomposes in a way that is different from the decomposition (which is by disjunction and conjunction) of programs.

We propose SLD-contours, a variant of SLD-trees, that are, like programs, built up out of simpler components by means of disjunction and conjunction. The traversal of SLD-trees carries over to the traversal of SLD-contours in such a way that the trace events of the Box Model (Try, Succeed, Retry, Fail) are reproduced in the same way as during the execution of the program. ThusSLD-contours relate the trace more closely to the program than SLD-trees. SLD-contours specify the trace more completely than the Box Model does.

However, SLD-contours have the disadvantage that similar constructs are repeated. We introduce a way of collapsing repeated occurrences into a single one. The result is an elaboration of the existing Box Model. Hence we call them SLD-boxes. In this way, SLD-boxes connect the semantics of Prolog programs to the Box Model, the most widely used aid in tracing Prolog programs.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Apt, K. R. and van Emden, M. H., “Contributions to the Theory of Logic Programming,”Journal of the ACM, 29, 3, pp. 841–862, 1982.

    Article  MATH  Google Scholar 

  2. Byrd, L., “Understanding the Control Flow of Prolog Programs,” inLogic Programmign Workshop, Proceedings of the Workshop in Debrecen, Hungary, 14–16 July 1980, pp. 127–138, 1980.

  3. Clark, K. L., “Predicate Logic as a Computational Formalism,”Technical Report, DOC 79/59, Department of Computing, Imperial College, 1979.

  4. Colmerauer, A., Kanoui, H., Paséro, R. and Roussel, P., “Un système de communication homme-machine en français,”Technical Report, Groupe d’Intelligence Artificielle, Université d’Aix-Marseille II, 1972.

  5. Delrieux, C., Azero, P. and Tohmé, F., “Toward Integrating Imperative and Logic Programming Paradigms: A WYSIWYG Approach to Prolog Programming,” ACM SIGPLAN Notices,26, 3, pp. 35–44, 1991.

    Article  Google Scholar 

  6. Eisenstadt, M. and Brayshaw, M., “Graphical Debugging with the Transparent Prolog Machine,” inProc. 10th International Joint Conference on Artificial Intelligence, 1987.

  7. Horspool, R. N. and Levy, M. “Integrating Imperative and Logic Programming,”unpublished manuscript, Department of Computer Science, University of Victoria, 1991.

  8. Kowalski, R. A.,Logic for Problem-Solving, Elsevier North-Holland, 1979.

  9. Lloyd, J. W.,Foundations of Logic Programming, 2nd edition, Springer-Verlag, 1987.

  10. Numao, M., Morishita, S. and Maruyama, H., “How Should Prolog Computation Be Represented for Practical Use?,”New Generation Computing, 8, 1990.

  11. Roussel, Ph., “Prolog, manuel de référence et d’utilisation,”Technical Report, Groupe d’Intelligence Artificielle, Université d’ Aix-Marseille II, 1975.

  12. Schnupp, P. and W. Bernard, L. W.,Productive Prolog Programming, Prentice Hall, 1987.

  13. van Emden, M. H., “An Algorithm for Interpreting Prolog Programs,” inImplementations of Prolog, Ellis Horwood, pp. 93–110, 1984.

Download references

Author information

Authors and Affiliations

Authors

About this article

Cite this article

Cheng, M.H.M., Horspool, R.N., Levy, M.R. et al. Compositional operational semantics for Prolog programs. New Gener Comput 10, 315–328 (1992). https://doi.org/10.1007/BF03037941

Download citation

  • Received:

  • Revised:

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF03037941

Keywords

Navigation