Abstract
One recent advance in program development has been the application of abstract interpretation to verify the partial correctness of a (constraint) logic program. Traditionally forwards analysis has been applied that starts with an initial goal and traces the execution in the direction of the control-flow to approximate the program state at each program point. This is often enough to verify assertions that a property holds. The dual approach is to apply backwards analysis to propagate properties of the allowable states against the control-flow to infer queries for which the program will not violate any assertion. Backwards analysis also underpins other program development tasks such as verifying the termination of a logic program or proving that a logic program with a delay mechanism cannot reduce to a state that contains sub-goals which suspend indefinitely. This paper reviews various backwards analyses that have been proposed for logic programs, identifying common threads in these techniques. The analyses are explained through a series of worked examples. The paper concludes with some suggestions for research in backwards analysis for logic program development.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Aiken, A., Lakshman, T.K.: Directional Type Checking of Logic Programs. In: LeCharlier, B. (ed.) SAS 1994. LNCS, vol. 864, pp. 43–60. Springer, Heidelberg (1994)
Armstrong, T., Marriott, K., Schachte, P., Søndergaard, H.: Two Classes of Boolean Functions for Dependency Analysis. Science of Computer Programming 31(1), 3–45 (1998)
Benoy, F., King, A.: Inferring Argument Size Relationships with CLP(R). In: Gallagher, J.P. (ed.) LOPSTR 1996. LNCS, vol. 1207, pp. 204–224. Springer, Heidelberg (1997)
Boye, J., Drabent, W., Małuszyński, J.: Declarative Diagnosis of Constraint Programs: an Assertion-based Approach. In: Proceedings of the Third International Workshop on Automated Debugging, pp. 123–141. University of Linköping Press (1997)
Brodsky, A., Sagiv, Y.: Inference of Monotonicity Constraints in Datalog Programs. In: Symposium on Principles of Database Systems, pp. 190–199. ACM Press, New York (1989)
Bruynooghe, M., Leuschel, M., Sagonas, K.: A Polyvariant Binding-Time Analysis for Off-line Partial Deduction. In: Hankin, C. (ed.) ESOP 1998. LNCS, vol. 1381, pp. 27–41. Springer, Heidelberg (1998)
Carlsson, M.: Freeze, Indexing, and Other Implementation Issues in the WAM. In: Lassez, J.-L. (ed.) International Conference on Logic Programming, pp. 40–58. MIT Press, Cambridge (1987)
Codish, M., Falaschi, M., Marriott, K.: Suspension Analyses for Concurrent Logic Programs. Transactions on Programming Languages and Systems 16(3), 649–686 (1994)
Codish, M., Lagoon, V.: Type Dependencies for Logic Programs using ACIunification. Theoretical Computer Science 238, 131–159 (2000)
Codish, M., Taboch, C.: A Semantic Basis for the Termination Analysis of Logic Programs. The Journal of Logic Programming 41(1), 103–123 (1999)
Codognet, C., Codognet, P., Corsini, M.: Abstract Interpretation for Concurrent Logic Languages. In: Debray, S.K., Hermenegildo, M.V. (eds.) North American Conference on Logic Programming, pp. 215–232. MIT Press, Cambridge (1990)
Comini, M., Gori, R., Levi, G., Volpe, P.: Abstract Interpretation based Verification of Logic Programs. Electronic Notes of Theoretical Computer Science 30(1) (1999)
Cortesi, B.: Le Charlier, and P. Van Hentenryck. Type Analysis of Prolog using Type Graphs. The Journal of Logic Programming 22(3), 179–208 (1995)
Cousot, P., Cousot, R.: Inductive Principles for Proving Invariance Properties of Programs. In: Tools and Notions for Program Construction, pp. 75–119. Cambridge University Press, Cambridge (1982)
Cousot, P., Halbwachs, N.: Automatic Discovery of Linear Restraints Among Variables of a Program. In: Symposium on Principles of Programming Languages, pp. 84–97. ACM Press, New York (1978)
Debray, S.K.: QD-Janus: a Sequential Implementation of Janus in Prolog. Software Practice and Experience 23(12), 1337–1360 (1993)
Debray, S.K., Gudeman, D., Bigot, P.: Detection and Optimization of Suspension-free Logic Programs. The Journal of Logic Programming 29(1-3), 171–194 (1992)
Dyber, P.: Inverse Image Analysis Generalises Strictness Analysis. Information and Computation 90(2), 194–216 (1991)
Falaschi, M., Hicks, P., Winsborough, W.: Demand Transformation Analysis for Concurrent Constraint Programs. The Journal of Logic Programming 41(3), 185–215 (2000)
Gabbrielli, M., Giacobazzi, R.: Goal Independency and Call Patterns in the Analysis of Logic Programs. In: ACM Symposium on Applied Computing, pp. 394–399. ACM Press, New York (1994)
Gabbrielli, M., Levi, G., Meo, M.C.: Resultants Semantics for Prolog. Journal of Logic and Computation 6(4), 491–521 (1996)
Gallagher, J.P.: A Program Transformation for Backwards Analysis of Logic Programs. In: Bruynooghe, M. (ed.) Pre-proceedings of the International Symposium on Logic-based Program Synthesis and Transformation. Katholieke Universiteit Leuven, Technical Report, vol. CW 365, pp. 113–122 (2003)
Gallagher, J.P., Puebla, G.: Abstract Interpretation over Non-deterministic Finite Tree Automata for Set-based Analysis of Logic Programs. In: Krishnamurthi, S., Ramakrishnan, C.R. (eds.) PADL 2002. LNCS, vol. 2257, pp. 243–261. Springer, Heidelberg (2002)
Genaim, S., Codish, M.: Inferring Termination Conditions for Logic Programs using Backwards Analysis. In: Nieuwenhuis, R., Voronkov, A. (eds.) LPAR 2001. LNCS (LNAI), vol. 2250, pp. 681–690. Springer, Heidelberg (2001); Technical report version available at http://www.cs.bgu.ac.il/~mcodish/Papers/Pages/lpar01.html
Genaim, S., Codish, M., Gallagher, J.P., Lagoon, V.: Combining Norms to Prove Termination. In: Cortesi, A. (ed.) VMCAI 2002. LNCS, vol. 2294, pp. 126–138. Springer, Heidelberg (2002)
Genaim, S., King, A.: Goal-Independent Suspension Analysis for Logic Programs with Dynamic Scheduling. In: Degano, P. (ed.) ESOP 2003. LNCS, vol. 2618, pp. 84–98. Springer, Heidelberg (2003)
Giacobazzi, R.: Abductive Analysis of Modular Logic Programs. Journal of Logic and Computation 8(4), 457–484 (1998)
Giacobazzi, R., Debray, S.K., Levi, G.: Generalized Semantics and Abstract Interpretation for Constraint Logic Programs. The Journal of Logic Programming 25(3), 191–248 (1995)
Giacobazzi, R., Ranzato, F., Scozzari, F.: Making Abstract Domains Condensing. ACM Transactions on Computational Logic (to appear)
Giacobazzi, R., Scozzari, F.: A Logical Model for Relational Abstract Domains. ACM Transactions on Programming Languages and Systems 20(5), 1067–1109 (1998)
Hall, C., Wise, D.: Generating Function Versions with Rational Strictness Patterns. Science of Computer Programming 12, 39–74 (1989)
Hanus, M.: Compile-time Analysis of Nonlinear Constraints in CLP(R). New Generation Computing 13(2), 155–186 (1995)
Heaton, A., Abo-Zaed, M., Codish, M., King, A.: A Simple Polynomial Groundness Analysis for Logic Programs. The Journal of Logic Programming 45(1-3), 143–156 (2000)
Hoarau, S., Mesnard, F.: Inferring and Compiling Termination for Constraint Logic Programs. In: Flener, P. (ed.) LOPSTR 1998. LNCS, vol. 1559, pp. 240–254. Springer, Heidelberg (1999)
Hoare, C.A.R., Hayes, I.J., He, J., Morgan, C., Roscoe, A.W., Sanders, J.W., Sorensen, I.H., Spivey, J.M., Sufrin, B.: Laws of Programming. Communications of the ACM 30(8), 672–686 (1987)
Howe, J.M., King, A.: Abstracting Numeric Constraints with Boolean Functions. Information Processing Letters 75(1-2), 17–23 (2000)
Howe, J.M., King, A.: Positive Boolean Functions as Multiheaded Clauses. In: Codognet, P. (ed.) ICLP 2001. LNCS, vol. 2237, pp. 120–134. Springer, Heidelberg (2001)
Howe, J.M., King, A.: Efficient Groundness Analysis in Prolog. Theory and Practice of Logic Programming 3(1), 95–124 (2003)
King, A., Lu, L.: A Backward Analysis for Constraint Logic Programs. Theory and Practice of Logic Programming 2, 517–547 (2002)
King, A., Lu, L.: Forward versus Backward Verification of Logic Programs. In: Palamidessi, C. (ed.) ICLP 2003. LNCS, vol. 2916, pp. 315–330. Springer, Heidelberg (2003)
King, A., Soper, P.: Schedule Analysis of Concurrent Logic Programs. In: Apt, K.R. (ed.) Joint International Conference and Symposium on Logic Programming, pp. 478–492. MIT Press, Cambridge (1992)
Le Charlier, B., Leclére, C., Rossi, S., Cortesi, A.: Automatic Verification of Prolog Programs. The Journal of Logic Programming 39(1-3), 3–42 (1999)
Lindenstrauss, N., Sagiv, Y., Serebrenik, A.: Unfolding the Mystery of Mergesort. In: Fuchs, N.E. (ed.) LOPSTR 1997. LNCS, vol. 1463, pp. 206–225. Springer, Heidelberg (1998)
Lu, L., King, A.: Backward Type Inference Generalises Type Checking. In: Hermenegildo, M.V., Puebla, G. (eds.) SAS 2002. LNCS, vol. 2477, pp. 85–101. Springer, Heidelberg (2002)
Marriott, K., GarcÃa de la Banda, M., Hermenegildo, M.V.: Analyzing Logic Programs with Dynamic Scheduling. In: Principles of Programming Languages, pp. 240–254. ACM Press, New York (1994)
Marriott, K., Søndergaard, H.: Precise and Efficient Groundness Analysis for Logic Programs. ACM Letters on Programming Languages and Systems 2(4), 181–196 (1993)
Martin, J.C., King, A.: Generating Efficient, Terminating Logic Programs. In: Bidoit, M., Dauchet, M. (eds.) CAAP 1997, FASE 1997, and TAPSOFT 1997. LNCS, vol. 1214, pp. 273–284. Springer, Heidelberg (1997)
Mazur, N., Janssens, G., Bruynooghe, M.: A Module Based Analysis for Memory Reuse in Mercury. In: Palamidessi, C., Moniz Pereira, L., Lloyd, J.W., Dahl, V., Furbach, U., Kerber, M., Lau, K.-K., Sagiv, Y., Stuckey, P.J. (eds.) CL 2000. LNCS (LNAI), vol. 1861, pp. 1255–1269. Springer, Heidelberg (2000)
Mazur, N., Janssens, G., Van Hoof, V.: Collecting Potential Optimizations. In: Leuschel, M. (ed.) LOPSTR 2002. LNCS, vol. 2664, pp. 109–110. Springer, Heidelberg (2003)
Mesnard, F.: Inferring Left-terminating Classes of Queries for Constraint Logic Programs. In: Joint International Conference and Symposium on Logic Programming, pp. 7–21. MIT Press, Cambridge (1996)
Mesnard, F., Neumerkel, U.: Applying Static Analysis Techniques for Inferring Termination Conditions of Logic Programs. In: Cousot, P. (ed.) SAS 2001. LNCS, vol. 2126, pp. 93–110. Springer, Heidelberg (2001)
Mesnard, F., Payet, É., Neumerkel, U.: Detecting Optimal Termination Conditions of Logic Programs. In: Hermenegildo, M.V., Puebla, G. (eds.) SAS 2002. LNCS, vol. 2477, pp. 509–526. Springer, Heidelberg (2002)
Mesnard, F., Ruggieri, S.: On Proving Left Termination of Constraint Logic Programs. ACM Transactions on Computational Logic 4(2), 207–259 (2003)
Naish, L.: Negation and Quantifiers in NU-Prolog. In: Shapiro, E. (ed.) ICLP 1986. LNCS, vol. 225, pp. 624–634. Springer, Heidelberg (1986)
Pedreschi, D., Ruggieri, S.: Weakest Preconditions for Pure Prolog Programs. Information Processing Letters 67(3), 145–150 (1998)
Puebla, G., Bueno, F., Hermenegildo, M.V.: An Assertion Language for Constraint Logic Programs. In: Deransart, P., Małuszyński, J. (eds.) DiSCiPl 1999. LNCS, vol. 1870, pp. 23–61. Springer, Heidelberg (2000)
Puebla, G., Bueno, F., Hermenegildo, M.V.: A Generic Preprocessor for Program Validation and Debugging. In: Deransart, P., Małuszyński, J. (eds.) DiSCiPl 1999. LNCS, vol. 1870, pp. 63–107. Springer, Heidelberg (2000)
Puebla, G., Hermenegildo, M.V.: Abstract Multiple Specialization and its Application to Program Parallelization. The Journal of Logic Programming 41(2&3), 279–316 (1999)
Rychlikowski, P., Truderung, T.: Polymorphic Directional Types for Logic Programming. In: International Conference on Principles and Practice of Declarative Programming, pp. 61–72. ACM Press, New York (2001)
Saraswat, V.A.: Concurrent Constraint Programming. MIT Press, Cambridge (1993)
Saraswat, V.A., Kahn, K., Levy, J.: Janus: a Step Towards Distributed Constraint Programming. In: North American Conference on Logic Programming, pp. 431–446. MIT Press, Cambridge (1990)
Somogyi, Z., Henderson, F., Conway, T.: The Execution Algorithm of Mercury, an Efficient Purely Declarative Logic Programming Language. The Journal of Logic Programming 29(1-3), 17–64 (1996)
Vielle, L.: Recursive Query Processing: The Power of Logic. Theoretical Computer Science 69(1), 1–53 (1989)
Volpe, P.: A First-Order Language for Expressing Aliasing and Type Properties of Logic Programs. Science of Computer Programming 39(1), 125–148 (2001)
Wadler, P., Hughes, R.J.M.: Projections for Strictness Analysis. In: Kahn, G. (ed.) FPCA 1987. LNCS, vol. 274, pp. 385–407. Springer, Heidelberg (1987)
Yardeni, E., Shapiro, E.Y.: A Type System for Logic Programs. The Journal of Logic Programming 10(2), 125–153 (1991)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2004 Springer-Verlag Berlin Heidelberg
About this chapter
Cite this chapter
Howe, J.M., King, A., Lu, L. (2004). Analysing Logic Programs by Reasoning Backwards. In: Bruynooghe, M., Lau, KK. (eds) Program Development in Computational Logic. Lecture Notes in Computer Science, vol 3049. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-25951-0_6
Download citation
DOI: https://doi.org/10.1007/978-3-540-25951-0_6
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-22152-4
Online ISBN: 978-3-540-25951-0
eBook Packages: Springer Book Archive