Skip to main content

Best-first Strategies for Incremental Transformations of Logic Programs

  • Chapter
Logic Program Synthesis and Transformation

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

Abstract

We propose some techniques for mechanizing a class of rule-based transformations of logic programs. Analogous techniques can be applied also in the case of functional programs for which the program transformation methodology was first introduced [4].

We consider the following abstract Transformation Problem: given a program P and a property Φ, we are required to find a program, say TransfP, equivalent to P such that Φ holds for TransfP. The property Φ characterizes the desired ‘shape’ of the program to be derived (for instance, linear recursive, tail recursive, without intermediate variables, etc.).

We propose some restrictions on the property Φ which make it possible to perform the desired transformation in an incremental way, in the sense that, if a clause which does not satisfy Φ is transformed into clauses which do satisfy Φ, then these resulting clauses need not be considered again during the transformation process.

The core of our technique is a procedure, called Incremental Transformation, which is a generalization of the procedure for eliminating unnecessary variables introduced in [13]. The generalization basically consists in the fact that we have parametrized our transformation procedure w.r.t. the property Φ which the transformed program is required to satisfy.

The proposed procedure is nondeterministic and it generates a possibly infinite tree of programs which are all derivable from the given program P. We study the use of best-first search strategies for traversing this tree of programs. We finally provide a sufficient condition for solving a given transformation problem by using a best-first strategy, in case our Incremental Transformation procedure can find a solution by using any other strategy.

This work has been partially supported by the ‘Progetto Finalizzato Sistemi Informatici e Calcolo Parallelo’ of the CNR and MURST 40%, Italy under grant n. 89.00026.69.

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. A. Bossi, N. Cocco, and S. Etalle. Transforming normal programs by replacement. In A. Pettorossi, editor, Proceedings of the Third International Workshop on Meiaprogramming in Logic (Meta ′92), Uppsala (Sweden), pages 204–220. Uppsala University, June 1992.

    Google Scholar 

  2. M. Bruynooghe, D. D. Schreye, and B. Krekels. Compiling control. Journal of Logic Programming, 6: 135–162, 1989.

    Article  MATH  Google Scholar 

  3. A. Bundy. The Computer Modelling of Mathematical Reasoning. Academic Press, 1983.

    Google Scholar 

  4. R. M. Burst all and J. Darlington. A transformation system for developing recursive programs. Journal of the ACM, 24 (1): 44–67, January 1977.

    Article  Google Scholar 

  5. M. S. Feather. A system for assisting program transformation. TOPLAS, 4 (1): 1–20, January 1982.

    Article  MATH  Google Scholar 

  6. P. A. Gardner and J. C. Shepherdson. Unfold/fold transformations of logic programs. In J.-L. Lassez and G. Plotkin, editors, Computational Logic, Essays in Honor of Alan Robinson, pages 565-583. MIT Press, 1990.

    Google Scholar 

  7. H. J. Komorowski. Partial evaluation as a means for inferencing data structures in an applicative language: A theory and implementation in the case of Prolog. In Proceedings of the Ninth ACM Symposium on Principles of Programming Languages, Albuquerque, New Mexico (USA), pages 255 - 267, 1982.

    Google Scholar 

  8. J. W. Lloyd. Foundations of Logic Programming. Springer-Verlag, Berlin, Second Edition, 1987.

    Book  Google Scholar 

  9. J. W. Lloyd and J. C. Shepherdson. Partial evaluation in logic programming. Journal of Logic Programming, 11: 217 - 242, 1991.

    Article  MathSciNet  MATH  Google Scholar 

  10. D. Miller and G. Nadathur. A logic programming approach to manipulating formulas and programs. In Proceedings of the 1987 IEEE Symposium on Logic Programming, San Francisco, CA (USA), pages 379-388. IEEE Press, 1987.

    Google Scholar 

  11. N. J. Nilsson. Principles of Artificial Intelligence. Springer-Verlag, 1982.

    Google Scholar 

  12. M. Proietti and A. Pettorossi. Semantics preserving transformation rules for Prolog. In Proceedings of the ACM Symposium on Partial Evaluation and Semantics Based Program Manipulation, PEPM '91, New Haven, CT (U.S.A.), pages 274-284. SIGPLAN NOTICES, 26, 9 ( 1991 ), 1991.

    Google Scholar 

  13. M. Proietti and A. Pettorossi. Unfolding-definition-folding, in this order, for avoiding unnecessary variables in logic programs. In N. Jones, editor, LNCS n. 528, Proceedings PLILP 91, Passau (Germany), pages 347-358. Springer-Verlag, 1991.

    Google Scholar 

  14. T. Sato. An equivalence preserving first order unfold/fold transformation system. In LNCS n. ^63, Proceedings ALP 90, Nancy (France), pages 175-188. Springer-Verlag, 1990.

    Google Scholar 

  15. H. Seki. Unfold/fold transformation of stratified programs. Theoretical Computer Science, 86: 107 - 139, 1991.

    Article  MathSciNet  MATH  Google Scholar 

  16. H. Tamaki and T. Sato. Unfold/fold transformation of logic programs. In S.-A. Tarlund, editor, Proceedings of the Second International Conference on Logic Programming, Uppsala (Sweden), pages 243-251. Uppsala University, 1984.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 1993 Springer-Verlag London

About this chapter

Cite this chapter

Proietti, M., Pettorossi, A. (1993). Best-first Strategies for Incremental Transformations of Logic Programs. In: Lau, KK., Clement, T.P. (eds) Logic Program Synthesis and Transformation. Workshops in Computing. Springer, London. https://doi.org/10.1007/978-1-4471-3560-9_7

Download citation

  • DOI: https://doi.org/10.1007/978-1-4471-3560-9_7

  • Publisher Name: Springer, London

  • Print ISBN: 978-3-540-19806-2

  • Online ISBN: 978-1-4471-3560-9

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics