Skip to main content

Prolog Program Transformations and Meta-Interpreters

  • Conference paper
Logic Program Synthesis and Transformation

Part of the book series: Workshops in Computing ((WORKSHOPS COMP.))

Abstract

Partial Evaluation in Prolog (generally associated to Folding/Unfolding techniques) is a code optimization technique, which transforms a readable and structured program in a more efficient program (that is to say better adapted to the interpreter or compiler). These programs are Prolog programs semantically equivalent with respect to the least Herbrand model. Our context is the operational equivalence of programs, and not the efficiency of program transformations.

We introduce first the notion of Strong Operational Equivalence (s.-o.e.), and then we propose to study strong operational equivalence preserving transformations. Strong operational equivalence means that the solution order is preserved and, when using inference as complexity unit, the runtime of any solution in the transformed program is linearly dependent on the runtime of the corresponding solution in the original program. This equivalence allows us to consider programs including non-logical features. We will restrict our study to Cut and Read/Write predicates and our framework is the standard resolution (depth first, leftmost atom).

Then, two meta-interpreters are studied. Using the Vanilla meta-interpreter and a new meta-interpreter (that we introduce and call quasiiterative meta-interpreter), we show that any Prolog program ? can be transformed to a meta-program (that is, an instance of these metainterpreters) which is strongly operationally equivalent to the original one. The structure of the quasi-iterative meta-interpreter is the simpliest one known up to date, that is, composed of three unit clauses and one right linear recursive rule.

partially supported by the G.D.R. Greco de la Programmation

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. C. Böhm and G. Jacopini, Flow diagrams, Türing machines and languages with only two formation rules, Communications of ACM, vol. 9, pages 366–371, 1966.

    Article  MATH  Google Scholar 

  2. M. Bugliesi and F.Russo, Partial Evaluation in Prolog: some Improvements about Cut, in Proceedings of the north-american conference on logic programming, pages 645-660, 1989.

    Google Scholar 

  3. J.-P.Delahaye, Sémantique logique et dénotationnelle des interpréteurs Prolog, Informatique Théorique et Applications, Vol. 22, n. 1, 1988, pages 3–42.

    MathSciNet  MATH  Google Scholar 

  4. F.Denis and J.-P.Delahaye, Unfolding, Procedural and Fixpoint Semantics of Logic Programs, in Proceedings of STACS’91, Lecture Notes in Computer Science, vol.480, Springer-Verlag Ed., pages 511-522.

    Google Scholar 

  5. H. Fujita, An algorithm for partial evaluation with constraints, ICOT Technical Memorandum, ICOT 1987.

    Google Scholar 

  6. J. Gallagher and M. Bruynooghe, Some low-level source transformations for logic programs, in Proceedings of the second workshop on meta-programming in logic, April 1990, Leuven, Belgium, Bruynooghe editor, pages 229-244.

    Google Scholar 

  7. T. Kawamura and T. Kanamori, Preservation of stronger equivalence in unfold/fold logic transformation, in Proceedings of the international conference on fifth generation computer systems, pages 413-421, ICOT 1988.

    Google Scholar 

  8. R. Kowalski, Imperial College, London, Meta-matters, in Second Workshop on Meta-programming in logic, April 1990, Louvain, Belgique.

    Google Scholar 

  9. M. Falaschi, G. Levi, C. Palamidessi and M. Martelli, Declarative Modeling of the Operational Behaviour of Logic Languages, in Theoretical Computer Science, vol. 69, 1989, pages 289–318.

    Article  MathSciNet  MATH  Google Scholar 

  10. J.W. Lloyd, Foundations of logic programming, Springer-Verlag, 2nd ed., 1987.

    Google Scholar 

  11. M.J. Maher, Equivalences of logic programs, in Foundations of deductive databases and logic programming, J.Minker Ed., Morgan Kaufmann Publishers, pages 627-658, 1987.

    Google Scholar 

  12. K.Marriott, L.Naish and J.-L.Lassez, Most specific logic programs, in Proceedings of the Fifth International Conference and Symposium on Logic Programming,Washington, Seattle, August 1988, pages 909-923.

    Google Scholar 

  13. A.Parrain, P.Devienne and P.Lebegue, .Equivalence Opérationnelle et Evaluation Partielle, Rapport Interne, LIFL, 1990.

    Google Scholar 

  14. M.Proietti and A.Pettorossi, Semantics Preserving Transformation Rules for Prolog, ACM Symposium on Partial Evaluation and Semantics Based Program Manipulation, New-Haven, U.S.A., 17-19 June 1991.

    Google Scholar 

  15. D. Sahlin, An Automatic Partial Evaluator for Full Prolog, Ph.D.Thesis, Swedish Institute of Computer Science, Stockholm, March 1991.

    Google Scholar 

  16. H. Tamaki and T. Sato, Unfold/Fold transformation of logic programs, in Proceedings of the second International Conference on. Logic Programming, Uppsala, 1984, pages 127-138.

    Google Scholar 

  17. R. Venken and B. Demoen, A Partial Evaluation System: some Practical Considerations, in New Generation Computing, Vol. 6, n. 2,3, pages 279–290, 1988.

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 1992 Springer-Verlag London

About this paper

Cite this paper

Parrain, A., Devienne, P., Lebegue, P. (1992). Prolog Program Transformations and Meta-Interpreters. In: Clement, T.P., Lau, KK. (eds) Logic Program Synthesis and Transformation. Workshops in Computing. Springer, London. https://doi.org/10.1007/978-1-4471-3494-7_17

Download citation

  • DOI: https://doi.org/10.1007/978-1-4471-3494-7_17

  • Publisher Name: Springer, London

  • Print ISBN: 978-3-540-19742-3

  • Online ISBN: 978-1-4471-3494-7

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics