A toolkit for static analysis of constraint logic programs

Generic systems for the analysis of logic programs have been proposed over the last decade or so. Considerable progress has been made in terms of frameworks, algorithms, abstract domains and implementations. A number of generic top-down procedural frameworks are widely available. However, implementation efforts for bottom-up declarative frameworks are in a preliminary stage. In this thesis we design and implement a program analysis framework for (constraint) logic programs. Our aim is to build a general purpose, versatile toolkit which is simple, practical and flexible, and provides reasonably precise approximations, as well as allowing complex analyses to be constructed for proving program properties. This is done by providing a set of general approximation techniques parameterised by a property of interest, which is defined using pre-interpretations. Abstract compilation is used to incorporate properties into the program to be analysed. Then a bottom-up fixpoint computation of an immediate consequences operator is performed. Goal dependent analyses are realised through a set of query-answer transformation options. Our framework is based on declarative semantics, in particular on the standard logical notions of interpretation, model and logical consequence, and avoids the classical complex procedural ingredients used in other frameworks. Constraint logic programming is used as a meta-languge to express properties of terms. A pre-interpretation is a CLP program with arbitrary complexity. We present the framework, introduce the components, options and combinations of the components, provide a guide for using the toolkit, and demonstrate a numb er of applications using the framework.

[1]  Kazunori Ueda Making Exhaustive Search Programs Deterministic, Part II , 1987, ICLP.

[2]  William H. Winsborough,et al.  Path-Dependent Reachability Analysis for Multiple Specialization , 1989, NACLP.

[3]  M. Codish,et al.  Goal Dependent vs . Goal Independent Analysis of Logic Programs , 1994 .

[4]  Maurizio Gabbrielli,et al.  Declarative Interpretations Reconsidered , 1994, ICLP.

[5]  Patrick Cousot,et al.  Methods and Logics for Proving Programs , 1991, Handbook of Theoretical Computer Science, Volume B: Formal Models and Sematics.

[6]  John P. Gallagher,et al.  Static Analysis of Logic Programs Using CLP as a Meta-language , 1996 .

[7]  Maurice Bruynooghe,et al.  Abstracting s-semantincs Using A Model-Theoretic Approach , 1994, PLILP.

[8]  Michael Codish,et al.  Type Dependencies for Logic Programs Using ACI-Unification , 2000, ISTCS.

[9]  William H. Winsborough,et al.  Multiple Specialization using Minimal-Function Graph Semantics , 1992, J. Log. Program..

[10]  Bart Demoen,et al.  Improving the Execution Speed of Compiled Prolog with Modes, Clause Selection, and Determinism , 1987, TAPSOFT, Vol.2.

[11]  Saumya K. Debray,et al.  Detection and Optimization of Functional Computations in Prolog , 1986, ICLP.

[12]  Uday S. Reddy,et al.  Transformation of Logic Programs into Functional Programs , 1984, SLP.

[13]  Graem A. Ringwood,et al.  An Algebraic Framework for Abstract Interpretation of Definite Programs , 1990, NACLP.

[14]  Nicolas Halbwachs,et al.  Verification of Linear Hybrid Systems by Means of Convex Approximations , 1994, SAS.

[15]  Henri Beringer,et al.  A CLP Language Handling Disjunctions of Linear Constraints , 1993, ICLP.

[16]  Pierre De Boeck,et al.  Static Type Analysis of Prolog Procedures for Ensuring Correctness , 1990, PLILP.

[17]  Maurice Bruynooghe,et al.  Analysis of Shared Data Structures for Compile-Time Garbage , 1990, ICLP.

[18]  Fosca Giannotti,et al.  A Technique for Recursive Invariance Detection and Selective Program Specification , 1991, PLILP.

[19]  John P. Gallagher,et al.  Towards Semantics-Based Partial Evaluation of Imperative Programs , 1997 .

[20]  Prateek Mishra,et al.  Towards a Theory of Types in Prolog , 1984, SLP.

[21]  Krzysztof R. Apt,et al.  An Analysis of Loop Checking Mechanisms for Logic Programs , 1991, Theor. Comput. Sci..

[22]  Jeffrey D. Ullman,et al.  Efficient tests for top-down termination of logical rules , 1988, JACM.

[23]  Andrei Mantsivoda,et al.  Flang and its Implementation , 1993, PLILP.

[24]  Owen V. Evans Factory Scheduling Using Finite Domains , 1992, Logic Programming Summer School.

[25]  Andy King,et al.  Depth-k Sharing and Freeness , 1994, ICLP.

[26]  Peter Naur,et al.  Checking of operand types in algol compilers , 1965 .

[27]  Kim Marriott,et al.  Semantics-Based Dataflow Analysis of Logic Programs , 1989, IFIP Congress.

[28]  Charles N. Fischer,et al.  Automatic, transparent parallelization of logic programs at compile time , 1988 .

[29]  Manuel V. Hermenegildo,et al.  Compile-Time Derivation of Variable Dependency Using Abstract Interpretation , 1992, J. Log. Program..

[30]  John S. Conery,et al.  An Abstract Interpretation Scheme for Groundedness, Freeness, and Sharing Analysis of Logic Programs , 1992, FSTTCS.

[31]  Raghu Ramakrishnan,et al.  Review - Magic Sets and Other Strange Ways to Implement Logic Programs , 1999, ACM SIGMOD Digit. Rev..

[32]  Pascal Van Hentenryck,et al.  The Impact of Granularity in Abstract Interpretation of Prolog , 1993, WSA.

[33]  Annika Wærn,et al.  Transparent And-Parallelism in the Presence of Shared Free Variables , 1988, ICLP/SLP.

[34]  Patrick Cousot,et al.  Comparing the Galois Connection and Widening/Narrowing Approaches to Abstract Interpretation , 1992, PLILP.

[35]  John P. Gallagher,et al.  Using Safe Approximations of Fixed Points for Analysis of Logic Programs , 1989, META.

[36]  Michael J. Maher,et al.  Constraint Logic Programming: A Survey , 1994, J. Log. Program..

[37]  Hisao Tamaki,et al.  Enumeration of Success Patterns in Logic Programs , 1983, Theor. Comput. Sci..

[38]  Ivan E. Sutherland,et al.  Sketchpad a man-machine graphical communication system , 1988, DAC 1988.

[39]  John C. Reynolds,et al.  Automatic computation of data set definitions , 1968, IFIP Congress.

[40]  Erik Schon,et al.  On the Computation of Fixpoints in Static Program Analysis with an Application to Analysis of AKL , 1995 .

[41]  Michael Leuschel,et al.  Advanced Techniques for Logic Program Specialisation , 1997, AI Commun..

[42]  Manuel V. Hermenegildo,et al.  Determination of variable dependence information at compile-time through abstract interpretation , 1989 .

[43]  Haim Gaifman,et al.  Fully abstract compositional semantics for logic programs , 1989, POPL '89.

[44]  Dean Jacobs,et al.  Static Analysis of Logic Programs for Independent And-Parallelism , 1992, J. Log. Program..

[45]  Manuel V. Hermenegildo,et al.  Combined Determination of Sharing and Freeness of Program Variables through Abstract Interpretation , 1991, ICLP.

[46]  Roberto Barbuti,et al.  A Bottom-Up Polymorphic Type Inference in Logic Programming , 1992, Sci. Comput. Program..

[47]  John Gallagher A Bottom-Up Analysis Toolkit , 1995 .

[48]  Allen Van Gelder,et al.  Deriving constraints among argument sizes in logic programs , 1990, PODS '90.

[49]  Saumya K. Debray,et al.  Automatic Mode Inference for Logic Programs , 1988, J. Log. Program..

[50]  John W. Lloyd,et al.  Foundations of Logic Programming, 1st Edition , 1984 .

[51]  Saumya K. Debray Static Analysis of Parallel Logic Programs , 1988, ICLP/SLP.

[52]  R. Stephenson A and V , 1962, The British journal of ophthalmology.

[53]  Kim Marriott,et al.  Suspension analyses for concurrent logic programs , 1994, TOPL.

[54]  Bart Demoen,et al.  Analysing Logic Programs Using 'Prop'-ositional Logic Programs and a Magic Wand , 1993, ILPS.

[55]  Gerda Janssens,et al.  An Instance of Abstract Interpretation Integrating Type and Mode Inferencing , 1988, ICLP/SLP.

[56]  Giorgio Levi,et al.  Abstract Interpretation of Prolog Programs , 1999, AMAST.

[57]  Saumya K. Debray,et al.  Abstract Interpretation of Logic Programs using Magic Transformations , 1994, J. Log. Program..

[58]  Saumya K. Debray,et al.  Static inference of modes and data dependencies in logic programs , 1989, TOPL.

[59]  François Bourdoncle,et al.  Efficient chaotic iteration strategies with widenings , 1993, Formal Methods in Programming and Their Applications.

[60]  John W. Lloyd Practical Model-Based Static Analysis for Definite Logic Programs , 1995 .

[61]  Alan Mycroft,et al.  A Polymorphic Type System for Prolog , 1984, Logic Programming Workshop.

[62]  Maurice Bruynooghe,et al.  Freeness, Sharing, Linearity and Correctness - All at Once , 1993, WSA.

[63]  S. Debray Eecient Dataaow Analysis of Logic Programs , 1992 .

[64]  Pascal Van Hentenryck,et al.  A Generic Abstract Interpretation Algorithm and its Complexity Analysis , 1990, ICLP.

[65]  Maurizio Gabbrielli,et al.  The s-Semantics Approach: Theory and Applications , 1994, J. Log. Program..

[66]  Gerda Janssens,et al.  Deriving Descriptions of Possible Values of Program Variables by Means of Abstract Interpretation , 1990, J. Log. Program..

[67]  Neil D. Jones,et al.  Data flow analysis of applicative programs using minimal function graphs , 1986, POPL '86.

[68]  Emmanouil I. Marakakis Logic program development based on typed moded schemata and data types , 1997 .

[69]  Maurice Bruynooghe Adding Redundancy to Obtain more Reliable and Readable Prolog Programs , 1982, ICLP.

[70]  I-Peng Lin,et al.  Compiling dataflow analysis of logic programs , 1992, PLDI '92.

[71]  Philippe Codognet,et al.  A Minimal Extension of the WAM for clp(FD) , 1993, ICLP.

[72]  Pascal Van Hentenryck,et al.  Type analysis of Prolog using type graphs , 1994, PLDI '94.

[73]  Robert W. Floyd,et al.  Assigning meaning to programs , 1967 .

[74]  Andrew Taylor,et al.  LIPS on a MIPS: Results from a Prolog Compiler for a RISC , 1990, ICLP.

[75]  Roberto Barbuti,et al.  A general framework for semantics-based bottom-up abstract interpretation of logic programs , 1993, TOPL.

[76]  Michel Sintzoff,et al.  Calculating properties of programs by valuations on specific models , 1972, Proving Assertions About Programs.

[77]  C. R. Ramakrishnan,et al.  A symbolic constraint solving framework for analysis of logic programs , 1995, PEPM '95.

[78]  Saumya K. Debray Flow Analysis of a Simple Class of Dynamic Logic Programs , 1987, SLP.

[79]  Andreas Krall,et al.  A Progress Report on Incremental Global Compilation of Prolog , 1994, ILPS Workshop: Implementation Techniques for Logic Programming Languages.

[80]  Bart Demoen,et al.  Abstract Interpretation: Towards the Global Optimization of Prolog Programs , 1987, SLP.

[81]  David Andre De Waal,et al.  Analysis and transformation of proof procedures , 1994 .

[82]  Ulf Nilsson Abstract Interpretation: A Kind of Magic , 1991, PLILP.

[83]  Doug DeGroot,et al.  AND-Parallelism of Logic Programs Based on a Static Data Dependency Analysis , 1985, COMPCON.

[84]  Justin Zobel,et al.  Derivation of Polymorphic Types for PROLOG Programs , 1987, ICLP.

[85]  John P. Gallagher,et al.  Constrained Regular Approximation of Logic Programs , 1997, LOPSTR.

[86]  Kim Marriott,et al.  Bottom-Up Dataflow Analysis of Normal Logic Programs , 1992, J. Log. Program..

[87]  Ulf Nilsson,et al.  Systematic Semantic Approximations of Logic Programs , 1990, PLILP.

[88]  Maurice Bruynooghe,et al.  On the Automatic Generation of Events in Delta Prolog , 1990, PLILP.

[89]  Robert E. Tarjan,et al.  Depth-First Search and Linear Graph Algorithms , 1972, SIAM J. Comput..

[90]  Frédéric Mesnard,et al.  Towards Automatic Control for CLP(x) Programs , 1995, LOPSTR.

[91]  Danny De Schreye,et al.  Deriving of Linear Size Relations by Abstract Interpretation , 1992, PLILP.

[92]  Michael Codish,et al.  Bottum-up abstract interpretation of logic programs , 1992 .

[93]  Luca Cardelli,et al.  On understanding types, data abstraction, and polymorphism , 1985, CSUR.

[94]  Bart Demoen,et al.  Deriving Polymorphic Type Dependencies for Logic Programs Using Multiple Incarnations of Prop , 1994, SAS.

[95]  Patrick Cousot,et al.  'A la Floyd' induction principles for proving inevitability properties of programs , 1986 .

[96]  Gerda Janssens,et al.  Abstracting Numerical Values in CLP(H, N) , 1994, PLILP.

[97]  Andrew Taylor Removal of Dereferencing and Trailing in Prolog Compilation , 1989, ICLP.

[98]  A. Cortesi,et al.  Prop revisited: propositional formula as abstract domain for groundness analysis , 1991, [1991] Proceedings Sixth Annual IEEE Symposium on Logic in Computer Science.

[99]  Joxan Jaffar,et al.  A finite presentation theorem for approximating logic programs , 1989, POPL '90.

[100]  Gerda Janssens,et al.  A Blueprint for an Abstract Machine for Abstract Interpretation of (Constraint) Logic Programs , 1995, ILPS.

[101]  Erik Ruf,et al.  On the specialization of online program specializers , 1992, Journal of Functional Programming.

[102]  Frédéric Benhamou,et al.  Programming in CLP(BNR) , 1993, PPCP.

[103]  Keith L. Clark Predicate logic as a computational formalism , 1979 .

[104]  Pascal Van Hentenryck,et al.  Generic abstract interpretation algorithms for Prolog: Two optimization techniques and their experimental evaluation , 1992, Softw. Pract. Exp..

[105]  Michael Hanus,et al.  Analysis of Nonlinear Constraints in CLP(R) , 1993, ICLP.

[106]  Pascal Van Hentenryck,et al.  The Constraint Logic Programming Language CHIP , 1988, FGCS.

[107]  Alvin M. Despain,et al.  An Empirical Study of the Warren Abstract Machine , 1987, SLP.

[108]  Saumya K. Debray,et al.  Functional computations in logic programs , 1989, TOPL.

[109]  Heikki Mannila,et al.  Flow Analysis of Prolog Programs , 1987, SLP.

[110]  Saumya K. Debray,et al.  Towards Banishing the Cut from Prolog , 1990, IEEE Trans. Software Eng..

[111]  Harald Søndergaard,et al.  An Application of Abstract Interpretation of Logic Programs: Occur Check Reduction , 1986, ESOP.

[112]  Michael Codish,et al.  Derivation and Safety of an Abstract Unification Algorithm for Groundness and Aliasing Analysis , 1991, ICLP.

[113]  Roland H. C. Yap,et al.  The CLP( R ) language and system , 1992, TOPL.

[114]  Akira Aiba,et al.  Constraints Logic Programming Language CAL , 1988, FGCS.

[115]  Maurice Bruynooghe,et al.  A Systematic Construction of Abstract Domains , 1994, SAS.

[116]  Thomas C. Bartee,et al.  Modern Applied Algebra , 1999 .

[117]  M. Hermenegildo,et al.  Deriving a fixpoint computation algorithm for top-down abstract interpretation of logic programs , 1990 .

[118]  Saumya K. Debray,et al.  Global Flow Analysis as a Practical Compilation Tool , 1992, J. Log. Program..

[119]  Maurice Bruynooghe,et al.  A Practical Framework for the Abstract Interpretation of Logic Programs , 1991, J. Log. Program..

[120]  Manuel V. Hermenegildo,et al.  An assertion language for debugging of constraint logic programs , 1997 .

[121]  Roland Dietrich,et al.  A Polymorphic Type System with Subtypes for Prolog , 1988, ESOP.

[122]  Patrick Cousot,et al.  Abstract Interpretation and Application to Logic Programs , 1992, J. Log. Program..

[123]  Joachim Schimpf,et al.  ECLiPSe: A Platform for Constraint Logic Programming , 1997 .

[124]  Ehud Shapiro,et al.  Abstract Algorithmic Debugging , 1988, ICLP/SLP.

[125]  Nicolas Halbwachs,et al.  Automatic discovery of linear restraints among variables of a program , 1978, POPL.

[126]  Peter Naur The Design of the GIER ALGOL Compiler , 1963 .

[127]  John P. Gallagher,et al.  Approximating Constraint Logic Programs Using Polymorphic Types and Regular Descriptions , 1995, PLILP.

[128]  Pascal Van Hentenryck,et al.  Groundness analysis for Prolog: implementation and evaluation of domain prop , 1993, PEPM '93.

[129]  Dean Jacobs,et al.  Accurate and Efficient Approximation of Variable Aliasing in Logic Programs , 1989, NACLP.

[130]  Ehud Shapiro,et al.  A Type System for Logic Programs , 1988, J. Log. Program..

[131]  Pascal Van Hentenryck,et al.  Experimental evaluation of a generic abstract interpretation algorithm for PROLOG , 1994, TOPL.

[132]  Peter J. Stuckey,et al.  The 3 R's of optimizing constraint logic programs: refinement, removal and reordering , 1993, POPL '93.

[133]  Hoon Hong RISC-CLP(Real): Logic Programming with Non-linear Constraints over the Reals , 1991, WCLP.

[134]  Justin Zobel,et al.  A Regular Type Language for Logic Programs , 1992, Types in Logic Programming.

[135]  Laura Ricci,et al.  Pipeline optimizations in and-parallelism by abstract interpretation , 1990 .

[136]  Maurice Bruynooghe,et al.  Abstract Interpretation for (Constraint) Logic Programming , 1992, NATO ASI CP.