Skip to main content

Program Derivation = Rules + Strategies

  • Chapter
  • First Online:
Computational Logic: Logic Programming and Beyond

Part of the book series: Lecture Notes in Computer Science ((LNAI,volume 2407))

Abstract

In a seminal paper [38] Prof. Robert Kowalski advocated the paradigm Algorithm = Logic + Control which was intended to characterize program executions. Here we want to illustrate the corresponding paradigm Program Derivation = Rules + Strategies which is intended to characterize program derivations, rather than executions. During program execution, the Logic component guarantees that the computed results are correct, that is, they are true facts in the intended model of the given program, while the Control component ensures that those facts are derived in an efficient way. Likewise, during program derivation, the Rules component guarantees that the derived programs are correct and the Strategies component ensures that the derived programs are efficient. In this chapter we will consider the case of logic programs with locally stratified negation and we will focus on the following three important methodologies for program derivation: program transformation, program synthesis, and program verification. Based upon the Rules + Strategies approach, we will propose a unified method for applying these three programming methodologies. In particular, we will present: (i) a set of rules for program transformation which preserve the perfect model semantics and (ii) a general strategy for applying the transformation rules. We will also show that we can synthesize correct and efficient programs from first order specifications by: (i) converting an arbitrary first order formula into a logic program with locally stratified negation by using a variant of the Lloyd-Topor transformation, and then (ii) applying our transformation rules according to our general strategy. Finally, we will demonstrate that the rules and the strategy for program transformation and program synthesis can also be used for program verification, that is, for proving first order properties of systems described by logic programs with locally stratified negation.

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 84.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 109.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. K. R. Apt and M. Bezem. Acyclic programs. In D.H.D. Warren and P. Szeredi, editors, Proceedings of the 7th International Conference on Logic Programming, Jerusalem, Israel, pages 617–633. MIT Press, 1990.

    Google Scholar 

  2. K. R. Apt and R. N. Bol. Logic programming and negation: A survey. Journal of Logic Programming, 19, 20:9–71, 1994.

    Article  MathSciNet  Google Scholar 

  3. N. Azibi. TREQUASI: Un système pour la transformation automatique de programmes Prolog récursifs en quasi-itératifs. PhD thesis, Université de Paris-Sud, Centre d’Orsay, France, 1987.

    Google Scholar 

  4. N. Bensaou and I. Guessarian. Transforming constraint logic programs. Theoretical Computer Science, 206:81–125, 1998.

    Article  MATH  MathSciNet  Google Scholar 

  5. P. Borovansky, C. Kirchner, H. Kirchner, and C. Ringeissen. Rewriting with strategies in elan: A functional semantics. International Journal of Foundations of Computer Science, 12(1):69–95, 2001.

    Article  MathSciNet  Google Scholar 

  6. A. Bossi, N. Cocco, and S. Etalle. Transforming normal programs by replacement. In A. Pettorossi, editor, Proceedings 3rd International Workshop on Meta-Pro-gramming in Logic, Meta’ 92, Uppsala, Sweden, Lecture Notes in Computer Science 649, pages 265–279. Springer-Verlag, 1992.

    Google Scholar 

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

    Article  MATH  Google Scholar 

  8. A. Bundy, A. Smaill, and G. Wiggins. The synthesis of logic programs from inductive proofs. In J. W. Lloyd, editor, Computational Logic, Symposium Proceedings, Brussels, November 1990, pages 135–149, Berlin, 1990. Springer-Verlag.

    Google Scholar 

  9. A. Bundy, F. van Harmelen, C. Horn, and A. Smaill. The oyster-clam system. In M. E. Stickel, editor, 10th International Conference on Automated Deduction, Kaiserslautern, Germany, Lecture Notes in Computer Science, Vol. 449, pages 647–648. Springer, 1990.

    Google Scholar 

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

    Google Scholar 

  11. K. L. Clark and S. Sickel. Predicate logic: A calculus for deriving programs. In Proceedings 5th International Joint Conference on Artificial Intelligence, Cambridge, Massachusetts, USA, pages 419–420, 1977.

    Google Scholar 

  12. K. L. Clark and S.-Å. Tärnlund. A first order theory of data and programs. In Proceedings Information Processing’ 77, pages 939–944. North-Holland, 1977.

    Google Scholar 

  13. E. Clarke, O. Grumberg, and D. Peled. Model Checking. MIT Press, 2000.

    Google Scholar 

  14. B. Courcelle. Equivalences and Transformations of Regular Systems-Applications to Recursive Program Schemes and Grammars. Theoretical Computer Science, 42:1–122, 1986.

    Article  MATH  MathSciNet  Google Scholar 

  15. P. Cousot and R. Cousot. Abstract interpretation: A unified lattice model for static analysis of programs by construction of approximation of fixpoints. In Proceedings 4th ACM-SIGPLAN Symposium on Principles of Programming Languages (POPL’ 77), pages 238–252. ACM Press, 1977.

    Google Scholar 

  16. D. De Schreye, R. Glück, J. Jørgensen, M. Leuschel, B. Martens, and M. H. Sørensen. Conjunctive partial deduction: Foundations, control, algorithms, and experiments. Journal of Logic Programming, 41(2–3):231–277, 1999.

    Article  MATH  MathSciNet  Google Scholar 

  17. S. K. Debray. Optimizing almost-tail-recursive Prolog programs. In Proceedings IFIP International Conference on Functional Programming Languages and Computer Architecture, Nancy, France, Lecture Notes in Computer Science 201, pages 204–219. Springer-Verlag, 1985.

    Google Scholar 

  18. G. Delzanno and A. Podelski. Model checking in CLP. In R. Cleaveland, editor, 5th International Conference TACAS’99, Lecture Notes in Computer Science 1579, pages 223–239. Springer-Verlag, 1999.

    Google Scholar 

  19. Y. Deville. Logic Programming: Systematic Program Development. Addison-Wesley, 1990.

    Google Scholar 

  20. Y. Deville and K.-K. Lau. Logic program synthesis. Journal of Logic Programming, 19, 20:321–350, 1994.

    Article  MathSciNet  Google Scholar 

  21. E.W. Dijkstra. A Discipline of Programming. Prentice-Hall, Englewod Cliffs, N.J., 1976.

    MATH  Google Scholar 

  22. S. Etalle and M. Gabbrielli. Transformations of CLP modules. Theoretical Computer Science, 166:101–146, 1996.

    Article  MATH  MathSciNet  Google Scholar 

  23. S. Etalle, M. Gabbrielli, and M. Meo. Unfold/fold transformations of CCP programs. In D. Sangiorgi and R. de Simone, editors, Proceedings of the International Conference on Concurrency Theory, Concur98, Lecture Notes in Computer Science 1466, pages 348–363, 1998.

    Chapter  Google Scholar 

  24. F. Fioravanti, A. Pettorossi, and M. Proietti. Verifying CTL properties of infinite state systems by specializing constraint logic programs. In Proceedings of the ACM Sigplan Workshop on Verification and Computational Logic VCL’01, Florence (Italy), Technical Report DSSE-TR-2001-3, pages 85–96. University of Southampton, UK, 2001.

    Google Scholar 

  25. L. Fribourg. Extracting logic programs from proofs that use extended Prolog execution and induction. In D. H. D. Warren and P. Szeredi, editors, Proceedings Seventh International Conference on Logic Programming, Jerusalem, Israel, June 18–20, 1990, pages 685–699. The MIT Press, 1990.

    Google Scholar 

  26. L. Fribourg and H. Olsén. A decompositional approach for computing least fixed-points of Datalog programs with z-counters.

    Google Scholar 

  27. J. P. Gallagher. Tutorial on specialization of logic programs. In Proceedings of ACM SIGPLAN Symposium on Partial Evaluation and Semantics Based Program Manipulation, PEPM’ 93, Copenhagen, Denmark, pages 88–98. ACM Press, 1993.

    Google Scholar 

  28. J. P. Gallagher and J. C. Peralta. Using regular approximations for generalisation during partial evalution. In Proceedings of the 2000 ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation (PEPM’ 00), Boston, Massachusetts, USA, January 22–23, 2000., pages 44–51. ACM Press, November 1999.

    Google Scholar 

  29. 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, 1991.

    Google Scholar 

  30. M. Gergatsoulis. Unfold/fold transformations for disjunctive logic programs. Information Processing Letters, 62:23–29, 1997.

    Article  MathSciNet  Google Scholar 

  31. C.A.R. Hoare. An axiomatic basis for computer programming. CACM, 12(10):576–580, 583, October 1969.

    Google Scholar 

  32. C. J. Hogger. Derivation of logic programs. Journal of the ACM, 28(2):372–392, 1981.

    Article  MATH  MathSciNet  Google Scholar 

  33. N. D. Jones, C. K. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Prentice Hall, 1993.

    Google Scholar 

  34. T. Kanamori and K. Horiuchi. Construction of logic programs based on generalized unfold/fold rules. In Proceedings of the Fourth International Conference on Logic Programming, pages 744–768. The MIT Press, 1987.

    Google Scholar 

  35. T. Kawamura. Logic program synthesis from first-order specifications. Theoretical Computer Science, 122:69–96, 1994.

    Article  MATH  MathSciNet  Google Scholar 

  36. L. Kott. Unfold/fold program transformation. In M. Nivat and J.C. Reynolds, editors, Algebraic Methods in Semantics, pages 411–434. Cambridge University Press, 1985.

    Google Scholar 

  37. R. A. Kowalski. Predicate logic as a programming language. In Proceedings IFIP’ 74, pages 569–574. North-Holland, 1974.

    Google Scholar 

  38. R. A. Kowalski. Algorithm = Logic + Control. Communications of the ACM, 22(7):424–436, 1979.

    Article  MATH  Google Scholar 

  39. R. A. Kowalski. Logic for Problem Solving. North Holland, 1979.

    Google Scholar 

  40. D. Kozen. Results on the propositional μ-calculus. Theoretical Computer Science, 27:333–354, 1983.

    Article  MATH  MathSciNet  Google Scholar 

  41. K.-K. Lau and M. Ornaghi. Logic for component-based software development. In A. Kakas and F. Sadri, editors, Computational Logic: From Logic Programming into the Future. Springer. This volume.

    Google Scholar 

  42. K.-K. Lau and S.D. Prestwich. Top-down synthesis of recursive logic procedures from first-order logic specifications. In D.H.D. Warren and P. Szeredi, editors, Proceedings of the Seventh International Conference on Logic Programming (ICLP’ 90), pages 667–684. MIT Press, 1990.

    Google Scholar 

  43. M. Leuschel. Program specialisation and abstract interpretation reconciled. In J. Jaffar, editor, Proceedings of the Joint International Conference and Symposium on Logic Programming, Manchester, UK, 15–19 June 1998., pages 220–234. The MIT Press, 1998.

    Google Scholar 

  44. M. Leuschel, B. Martens, and D. de Schreye. Some achievements and prospects in partial deduction. ACM Computing Surveys, 30 (Electronic Section)(3es):4-es, 1998.

    Google Scholar 

  45. M. Leuschel and T. Massart. Infinite state model checking by abstract interpretation and program specialization. In A. Bossi, editor, Proceedings of LOPSTR’ 99, Venice, Italy, Lecture Notes in Computer Science 1817, pages 63–82. Springer, 1999.

    Google Scholar 

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

    MATH  Google Scholar 

  47. 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 

  48. M. J. Maher. A transformation system for deductive database modules with perfect model semantics. Theoretical Computer Science, 110:377–403, 1993.

    Article  MATH  MathSciNet  Google Scholar 

  49. Z. Manna and R. Waldinger. A deductive approach to program synthesis. ACM Toplas, 2:90–121, 1980.

    Article  MATH  Google Scholar 

  50. Ulf Nilsson and Johan Lübcke. Constraint logic programming for local and symbolic model-checking. In J. Lloyd et al., editor, CL 2000: Computational Logic, number 1861 in Lecture Notes in Artificial Intelligence, pages 384–398, 2000.

    Google Scholar 

  51. L. C. Paulson. The foundation of a generic theorem prover. J. Automated Reasoning, 5:363–397, 1989.

    Article  MATH  MathSciNet  Google Scholar 

  52. A. Pettorossi and M. Proietti. Rules and strategies for transforming functional and logic programs. ACM Computing Surveys, 28(2):360–414, 1996.

    Article  Google Scholar 

  53. A. Pettorossi and M. Proietti. Transformation of logic programs. In D. M. Gabbay, C. J. Hogger, and J. A. Robinson, editors, Handbook of Logic in Artificial Intelligence and Logic Programming, volume 5, pages 697–787. Oxford University Press, 1998.

    Google Scholar 

  54. A. Pettorossi and M. Proietti. Synthesis and transformation of logic programs using unfold/fold proofs. Journal of Logic Programming, 41(2&3): 197–230, 1999.

    Article  MATH  MathSciNet  Google Scholar 

  55. A. Pettorossi and M. Proietti. Perfect model checking via unfold/fold transformations. In J.W. Lloyd et al., editor, First International Conference on Computational Logic, CL’2000, London, 24–28 July, 2000, Lecture Notes in Artificial Intelligence 1861, pages 613–628. Springer, 2000.

    Google Scholar 

  56. A. Pettorossi, M. Proietti, and S. Renault. Reducing nondeterminism while specializing logic programs. In Proc. 24-th ACM Symposium on Principles of Programming Languages, Paris, France, pages 414–427. ACM Press, 1997.

    Google Scholar 

  57. V. Pratt. A decidable μ-calculus. In 22nd Symposium on Foundations of Computer Science, Washington (DC), 1981. IEEE Computer Society Press.

    Google Scholar 

  58. M. Proietti and A. Pettorossi. Unfolding-definition-folding, in this order, for avoiding unnecessary variables in logic programs. Theoretical Computer Science, 142(1): 89–124, 1995.

    Article  MATH  MathSciNet  Google Scholar 

  59. T. C. Przymusinski. On the declarative and procedural semantics of logic programs. Journ. of Automated Reasoning, 5:167–205, 1989.

    MATH  MathSciNet  Google Scholar 

  60. G. Puebla and M. Hermenegildo. Abstract multiple specialization and its application to program parallelization. J. of Logic Programming. Special Issue on Synthesis, Transformation and Analysis of Logic Programs, 41(2&3):279–316, November 1999.

    Google Scholar 

  61. Y. S. Ramakrishna, C. R. Ramakrishnan, I. V. Ramakrishnan, S. A. Smolka, T. Swift, and D. S. Warren. Efficient model checking using tabled resolution. In CAV’ 97, Lecture Notes in Computer Science 1254, pages 143–154. Springer-Verlag, 1997.

    Google Scholar 

  62. J. A. Robinson. A machine-oriented logic based on the resolution principle. Journal of the ACM, 12(1):23–41, 1965.

    Article  MATH  Google Scholar 

  63. A. Roychoudhury, K. Narayan Kumar, C. R. Ramakrishnan, I. V. Ramakrishnan, and S. A. Smolka. Verification of parameterized systems using logic program transformations. In Proceedings of the Sixth International Conference on Tools and Algorithms for the Construction and Analysis of Systems, TACAS 2000, Berlin, Germany, Lecture Notes in Computer Science 1785, pages 172–187. Springer, 2000.

    Google Scholar 

  64. A. Roychoudhury, K. Narayan Kumar, C. R. Ramakrishnan, and I.V. Ramakrishnan. Beyond tamaki-sato style unfold/fold transformations for normal logic programs. In P. S. Thiagarajan and R. H. C. Yap, editors, Proceedings of ASIAN’99, 5th Asian Computing Science Conference, Phuket, Thailand, December 10-12, Lecture Notes in Computer Science 1742, pages 322–333. Springer-Verlag, 1999.

    Google Scholar 

  65. A. Roychoudhury, K. Narayan Kumar, C.R. Ramakrishnan, and I.V. Ramakrishnan. Proofs by program transformation. In PreProceedings of LOPSTR’ 99, Venice, Italy, pages 57–64. Università Ca’ Foscari di Venezia, Dipartimento di Informatica, 1999.

    Google Scholar 

  66. A. Roychoudhury and I.V. Ramakrishnan. Automated inductive verification of parameterized protocols. In CAV 2001, pages 25–37, 2001.

    Google Scholar 

  67. D. Sahlin. Mixtus: An automatic partial evaluator for full Prolog. New Generation Computing, 12:7–51, 1993.

    Article  MATH  Google Scholar 

  68. T. Sato and H. Tamaki. Transformational logic program synthesis. In Proceedings of the International Conference on Fifth Generation Computer Systems, pages 195–201. ICOT, 1984.

    Google Scholar 

  69. T. Sato and H. Tamaki. First order compiler: A deterministic logic program synthesis algorithm. Journal of Symbolic Computation, 8:625–627, 1989.

    Article  MathSciNet  Google Scholar 

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

    Article  MATH  MathSciNet  Google Scholar 

  71. H. Seki. Unfold/fold transformation of general logic programs for well-founded semantics. Journal of Logic Programming, 16(1&2):5–23, 1993.

    Article  MATH  MathSciNet  Google Scholar 

  72. H. Seki and K. Furukawa. Notes on transformation techniques for generate and test logic programs. In Proceedings of the International Symposium on Logic Programming, San Francisco, USA, pages 215–223. IEEE Press, 1987.

    Google Scholar 

  73. D. R. Smith. KIDS: A semi-automatic program development system. IEEE Transactions on Software Engineering —Special Issue on Formal Methods, September 1990.

    Google Scholar 

  74. H. Tamaki and T. Sato. Unfold/fold transformation of logic programs. In S.-A. Tärnlund, editor, Proceedings of the Second International Conference on Logic Programming, Uppsala, Sweden, pages 127–138. Uppsala University, 1984.

    Google Scholar 

  75. D. H. D. Warren. Implementing Prolog-compiling predicate logic programs. Research Report 39 & 40, Department of Artificial Intelligence, University of Edinburgh, 1977.

    Google Scholar 

  76. D. S. Warren. Memoing for logic programs. Communications of the ACM, 35(3):93–111, 1992.

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2002 Springer-Verlag Berlin Heidelberg

About this chapter

Cite this chapter

Pettorossi, A., Proietti, M. (2002). Program Derivation = Rules + Strategies. In: Kakas, A.C., Sadri, F. (eds) Computational Logic: Logic Programming and Beyond. Lecture Notes in Computer Science(), vol 2407. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45628-7_12

Download citation

  • DOI: https://doi.org/10.1007/3-540-45628-7_12

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

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

  • Online ISBN: 978-3-540-45628-5

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics