Program Derivation = Rules + Strategies

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.

[1]  Sandro Etalle,et al.  Transforming Normal Programs by Replacement , 1992, META.

[2]  Kung-Kiu Lau,et al.  Top-down Synthesis of Recursive Logic Procedures from First-order Logic Specifications , 1990, ICLP.

[3]  Hisao Tamaki,et al.  First Order Compiler: A Deterministic Logic Program Synthesis Algorithm , 1989, J. Symb. Comput..

[4]  Sandro Etalle,et al.  Transformations of CLP Modules , 1996, Theor. Comput. Sci..

[5]  Christopher J. Hogger,et al.  Derivation of Logic Programs , 1981, JACM.

[6]  Hisao Tamaki,et al.  Unfold/Fold Transformation of Logic Programs , 1984, ICLP.

[7]  John P. Gallagher,et al.  Tutorial on specialisation of logic programs , 1993, PEPM '93.

[8]  Keith L. Clark,et al.  A First Order Theory of Data and Programs , 1977, IFIP Congress.

[9]  Koichi Furukawa,et al.  Notes on Transformation Techniques for Generate and Test Logic Programs , 1987, SLP.

[10]  K. Clark,et al.  Predicate logic: a calculus for deriving programs , 1977, IJCAI 1977.

[11]  John Darlington,et al.  A Transformation System for Developing Recursive Programs , 1977, J. ACM.

[12]  Kung-Kiu Lau,et al.  Logic for Component-Based Software Development , 2002, Computational Logic: Logic Programming and Beyond.

[13]  Frank van Harmelen,et al.  The Oyster-Clam System , 1990, CADE.

[14]  Robert A. Kowalski,et al.  Algorithm = logic + control , 1979, CACM.

[15]  Alberto Pettorossi,et al.  Synthesis and Transformation of Logic Programs Using Unfold/Fold Proofs , 1999, J. Log. Program..

[16]  C. R. Ramakrishnan,et al.  Verification of Parameterized Systems Using Logic Program Transformations , 2000, TACAS.

[17]  Manuel V. Hermenegildo,et al.  Abstract Multiple Specialization and Its Application to Program Parallelization , 1999, J. Log. Program..

[18]  John P. Gallagher,et al.  Using regular approximations for generalisation during partial evalution , 1999, PEPM '00.

[19]  Zohar Manna,et al.  A Deductive Approach to Program Synthesis , 1979, TOPL.

[20]  Danny De Schreye,et al.  Some achievements and prospects in partial deduction , 1998, CSUR.

[21]  John C. Shepherdson,et al.  Unfold/fold transformations of logic programs , 1992, Mathematical Structures in Computer Science.

[22]  Bruno Courcelle,et al.  Equivalences and Transformations of Regular Systems-Applications to Recursive Program Schemes and Grammars , 1986, Theor. Comput. Sci..

[23]  Teodor C. Przymusinski On the declarative and procedural semantics of logic programs , 1989, Journal of Automated Reasoning.

[24]  Lawrence C. Paulson,et al.  The foundation of a generic theorem prover , 1989, Journal of Automated Reasoning.

[25]  David Scott Warren,et al.  Memoing for logic programs , 1992, CACM.

[26]  I. V. Ramakrishnan,et al.  Automated Inductive Verification of Parameterized Protocols , 2001, CAV.

[27]  Tadashi Kawamura,et al.  Logic Program Synthesis from First-Order Logic Specifications , 1994, Theor. Comput. Sci..

[28]  C. A. R. Hoare,et al.  An axiomatic basis for computer programming , 1969, CACM.

[29]  Michael J. Maher A Tranformation System for Deductive Databases Modules with Perfect Model Semantics , 1993, Theor. Comput. Sci..

[30]  John Wylie Lloyd,et al.  Foundations of Logic Programming , 1987, Symbolic Computation.

[31]  Michael Leuschel,et al.  Program Specialisation and Abstract Interpretation Reconciled , 1998, IJCSLP.

[32]  Robert A. Kowalski,et al.  Predicate Logic as Programming Language , 1974, IFIP Congress.

[33]  Laurent Fribourg,et al.  A Decompositional Approach for Computing Least Fixed-Points of Datalog Programs with Z-Counters , 2004, Constraints.

[34]  Giorgio Delzanno,et al.  Model Checking in CLP , 1999, TACAS.

[35]  Peter Sestoft,et al.  Partial evaluation and automatic program generation , 1993, Prentice Hall international series in computer science.

[36]  Laurent Fribourg,et al.  Extracting Logic Programs from Proofs that Use Extended Prolog Execution and Induction , 1990, ICLP.

[37]  Hirohisa Seki,et al.  Unfold/Fold Transformations of Stratified Programs , 1991, Theor. Comput. Sci..

[38]  Dexter Kozen,et al.  RESULTS ON THE PROPOSITIONAL’p-CALCULUS , 2001 .

[39]  Ulf Nilsson,et al.  Constraint Logic Programming for Local and Symbolic Model-Checking , 2000, Computational Logic.

[40]  Thierry Massart,et al.  Infinite State Model Checking by Abstract Interpretation and Program Specialisation , 1999, LOPSTR.

[41]  Alberto Pettorossi,et al.  Rules and strategies for transforming functional and logic programs , 1996, CSUR.

[42]  Alan Bundy,et al.  The Synthesis of Logic Programs from Inductive Proofs , 1990 .

[43]  Edmund M. Clarke,et al.  Model Checking , 1999, Handbook of Automated Reasoning.

[44]  Alberto Pettorossi,et al.  Reducing nondeterminism while specializing logic programs , 1997, POPL '97.

[45]  Edsger W. Dijkstra,et al.  A Discipline of Programming , 1976 .

[46]  Krzysztof R. Apt,et al.  Logic Programming and Negation: A Survey , 1994, The Journal of Logic Programming.

[47]  Yves Deville,et al.  Logic programming - systematic program development , 1990, International series in logic programming.

[48]  Tadashi Kanamori,et al.  Construction of Logic Programs Based on Generalized Unfold/Fold Rules , 1987, ICLP.

[49]  Saumya K. Debray,et al.  Optimizing Almost-Tail-Recursive Prolog Programs , 1985, FPCA.

[50]  Alberto Pettorossi,et al.  Verifying CTL properties of infinite state systems by specializing constraint logic programs , 2001 .

[51]  Hisao Tamaki,et al.  Transformational Logic Program Synthesis , 1984, FGCS.

[52]  Yves Deville,et al.  Logic Program Synthesis , 1994, J. Log. Program..

[53]  Robert A. Kowalski,et al.  Logic for problem solving , 1982, The computer science library : Artificial intelligence series.

[54]  Hirohisa Seki,et al.  Unfold/Fold Transformation of General Logic Programs for the Well-Founded Semantics , 1993, J. Log. Program..

[55]  Sandro Etalle,et al.  Unfold/Fold Transformations of CCP Programs , 1998, CONCUR.

[56]  Douglas R. Smith,et al.  KIDS: A Semiautomatic Program Development System , 1990, IEEE Trans. Software Eng..

[57]  Manolis Gergatsoulis,et al.  Unfold/fold Transformations for Disjunctive Logic Programs , 1997, Inf. Process. Lett..

[58]  I. V. Ramakrishnan,et al.  Proofs by Program Transformations , 1999 .

[59]  Patrick Cousot,et al.  Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints , 1977, POPL.

[60]  Irène Guessarian,et al.  Transforming Constraint Logic Programs , 1994, Theor. Comput. Sci..

[61]  J. A. Robinson,et al.  A Machine-Oriented Logic Based on the Resolution Principle , 1965, JACM.

[62]  C. R. Ramakrishnan,et al.  Efficient Model Checking Using Tabled Resolution , 1997, CAV.

[63]  Nadia Azibi Trequasi : un système pour la transformation automatique de programmes PROLOG récursifs en quasi-itératifs , 1987 .

[64]  Claude Kirchner,et al.  Rewriting with Strategies in ELAN: A Functional Semantics , 2001, Int. J. Found. Comput. Sci..

[65]  Alberto Pettorossi,et al.  Perfect Model Checking via Unfold/Fold Transformations , 2000, Computational Logic.

[66]  C. R. Ramakrishnan,et al.  Beyond Tamaki-Sato Style Unfold/Fold Transformations for Normal Logic Programs , 1999, ASIAN.

[67]  L Kott,et al.  Unfold/fold program transformations , 1986 .

[68]  Maurice Bruynooghe,et al.  Compiling Control , 1989, J. Log. Program..

[69]  J. W. Lloyd,et al.  Foundations of logic programming; (2nd extended ed.) , 1987 .

[70]  M. Sørensen,et al.  Conjunctive Partial Deduction: Foundations, Control, Algorithms, and Experiments , 1999, J. Log. Program..

[71]  Semantics-Based Program Manipulation,et al.  Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, PEPM'93, Copenhagen, Denmark, June 14-16, 1993 , 1993, PEPM.

[72]  John W. Lloyd,et al.  Partial Evaluation in Logic Programming , 1991, J. Log. Program..

[73]  Alberto Pettorossi,et al.  Unfolding - Definition - Folding, in this Order, for Avaoiding Unnecessary Variables in Logic Programs , 1995, Theor. Comput. Sci..