Graph grammars and logic programming

  • Andrea Corradini
  • Ugo Montanari
  • Francesca Rossi
  • Hartmut Ehrig
  • Michael Löwe
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 532)


In this paper we investigate the relationship between the algebraic definition of graph grammars and logic programming. In particular, we show that the operational semantics of any logic program can be faithfully simulated by a particular context-free hypergraph grammar. In the process of doing that, we consider the issue of representing terms, formulas, and clauses as particular graphs or graph productions, by first evaluating the approaches already proposed for Term Rewriting Systems (TRS), and then by giving an original extension of those approaches, to be able to deal with the unique features of logic programming. Actually, not only does our representation of definite clauses by graph productions allow us to deal correctly with logical unification, but also it overcomes some of the problems encountered by other approaches for representing TRS's as graph grammars. The main result of the paper states the soundness and completeness of the representation of clauses by productions, and this correspondence is extended to entire computations, showing how a context-free grammar (over a suitable category of graphs) can be associated with a logic program. The converse holds as well, i.e. given any context-free graph grammar (over that category), a logic program can be extracted from it.


Logic Programming Graph Grammars Term Rewriting Systems Hypergraphs Jungles Dags 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

6. References

  1. [AM89]
    A. Asperti, S. Martini, Projections instead of variables, A category theoretic interpretation of logic programs, Proc. 6th Int. Conf. on Logic Programming, MIT Press, 1989, pp. 337–352.Google Scholar
  2. [BC87]
    M. Bauderon, B. Courcelle, Graph Expressions and Graph Rewritings, Mathematical System Theory 20, 1987, pp. 83–127.CrossRefGoogle Scholar
  3. [BvEGKPS87]
    H.P. Barendregt, M.C.J.D. van Eekelen, J.R.W. Glauert, J.R. Kennaway, M.J. Plasmeijer, M.R. Sleep, Term graph reduction, in Proc. PARLE, LNCS 259, 1987, pp. 141–158.Google Scholar
  4. [CER79]
    V. Claus, H. Ehrig, G. Rozenberg, (Eds.) Proceedings of the 1 st International Workshop on Graph-Grammars and Their Application to Computer Science and Biology, LNCS 73, 1979.Google Scholar
  5. [Cou88]
    B. Courcelle, On using context-free graph grammars for analyzing recursive definitions, in Programming of Future Generation Computers II, K. Fuchi, L. Kott (Eds.), Elsevier-North-Holland, 1988, pp. 83–122.Google Scholar
  6. [Eh83]
    H. Ehrig, Aspects of concurrency in graph grammars, in [ENR83], pp. 58–81.Google Scholar
  7. [Eh87]
    H. Ehrig, Tutorial introduction to the algebraic approach of graph-grammars, in [ENRR87] pp. 3–14.Google Scholar
  8. [EHKP91]
    H. Ehrig, A. Habel, H.-J. Kreowski, F. Parisi-Presicce, High-Level Replacement Systems, in [EKR91].Google Scholar
  9. [EKR91]
    H. Ehrig, H.-J. Kreowski, G. Rozenberg, (Eds.) Proceedings of the 4 th International Workshop on Graph-Grammars and Their Application to Computer Science, LNCS, 1991, this volume.Google Scholar
  10. [ENR83]
    H. Ehrig, M. Nagl, G. Rozenberg, (Eds.) Proceedings of the 2 nd International Workshop on Graph-Grammars and Their Application to Computer Science, LNCS 153, 1983.Google Scholar
  11. [ENRR87]
    H. Ehrig, M. Nagl, G. Rozenberg, A. Rosenfeld, (Eds.) Proceedings of the 3 rd International Workshop on Graph-Grammars and Their Application to Computer Science, LNCS 291, 1987.Google Scholar
  12. [EPS73]
    H. Ehrig, M. Pfender, H.J. Schneider, Graph-grammars: an algebraic approach, Proc, IEEE Conf. on Automata and Switching Theory, 1973, pp. 167–180.Google Scholar
  13. [FLMP89]
    M. Falaschi, G. Levi, M. Martelli, C. Palamidessi, Declarative Modeling of the Operational Behaviour of Logic Languages, Theoretical Computer Science, 69(3), 1989, pp. 289–318.CrossRefGoogle Scholar
  14. [FLP84]
    M. Falaschi, G. Levi, C. Palamidessi, A Synchronization Logic: Axiomatics and Formal Semantics of Generalized Horn Clauses, in Information and Control, 60(1–3), Academic Press, 1984.Google Scholar
  15. [Go89]
    J.A. Goguen, What is Unification? A Categorical View of Substitution, Equation and Solution, in M. Nivat and H. Aït-Kaci (Eds.), Resolution of Equations in Algebraic Structures, Academic Press, 1989.Google Scholar
  16. [Ha89]
    A. Habel, Hyperedge Replacement: Grammars and Languages, Ph.D. Thesis, University of Bremen, 1989.Google Scholar
  17. [HKP88]
    A. Habel, H-J. Kreowski, D. Plump, Jungle evaluation, in Proc. Fifth Workshop on Specification of Abstract Data Types, LNCS 332, 1988, pp. 92–112.Google Scholar
  18. [Ken87]
    J.R. Kennaway, On ‘On Graph Rewritings', Theoretical Computer Science, 52, 1987, pp. 37–58.CrossRefGoogle Scholar
  19. [Ken91]
    J.R. Kennaway, Graph rewriting in some categories of partial morphisms, in [EKR91].Google Scholar
  20. [Le88]
    G. Levi, Models, Unfolding Rules and Fixpoint Semantics, in Proc. 5th Int. Conf. Symp. on Logic Programming, Seattle, MIT Press, pp. 1649–1665, 1988.Google Scholar
  21. [Ll87]
    J.W. Lloyd, Foundations of Logic Programming, Springer Verlag, 1984, (Second Edition 1987).Google Scholar
  22. [ML71]
    S. Mac Lane, Categories for the Working Mathematician, Springer Verlag, New York, 1971.Google Scholar
  23. [PEM87]
    F. Parisi-Presicce, H. Ehrig and U. Montanari, Graph Rewriting with Unification and Composition, in [ENRR87], pp. 496–514.Google Scholar
  24. [Rao84]
    J.C. Raoult, On Graph Rewritings, Theoretical Computer Science, 32, 1984, pp. 1–24.CrossRefGoogle Scholar
  25. [RB85]
    D.E. Rydeheard, R.M. Burstall, A Categorical Unification Algorithm, Proc. of the Workshop on Category Theory and Computer Programming, LNCS 240, 1985.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1991

Authors and Affiliations

  • Andrea Corradini
    • 1
  • Ugo Montanari
    • 1
  • Francesca Rossi
    • 1
  • Hartmut Ehrig
    • 2
  • Michael Löwe
    • 2
  1. 1.Dipartimento di InformaticaUniversità di PisaPisaItaly
  2. 2.Fachbereich Informatik 20Technische University BerlinBerlin 10Germany

Personalised recommendations