Advertisement

New Generation Computing

, Volume 28, Issue 2, pp 177–206 | Cite as

Automatic Inference of Determinacy and Mutual Exclusion for Logic Programs Using Mode and Type Analyses

  • Pedro Lopez-GarciaEmail author
  • Francisco Bueno
  • Manuel Hermenegildo
Article

Abstract

We propose an analysis for detecting procedures and goals that are deterministic (i.e., that produce at most one solution at most once), or predicates whose clause tests are mutually exclusive (which implies that at most one of their clauses will succeed) even if they are not deterministic. The analysis takes advantage of the pruning operator in order to improve the detection of mutual exclusion and determinacy. It also supports arithmetic equations and disequations, as well as equations and disequations on terms, for which we give a complete satisfiability testing algorithm, w.r.t. available type information. Information about determinacy can be used for program debugging and optimization, resource consumption and granularity control, abstraction carrying code, etc. We have implemented the analysis and integrated it in the CiaoPP system, which also infers automatically the mode and type information that our analysis takes as input. Experiments performed on this implementation show that the analysis is fairly accurate and efficient.

Keywords

Determinacy Inference and Checking Types Program Analysis Debugging Optimization 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Aspvall, B. and Shiloach, Y., “A polynomial time algorithm for solving systems of linear inequalities with two variables per inequality,” in Proc. 20th ACM Symposium on Foundations of Computer Science, pp. 205-217, October 1979.Google Scholar
  2. 2.
    Braem, C., Le Charlier, B., Modart, S. and Van Hentenryck, P., “Cardinality analysis of prolog,” in Proc. International Symposium on Logic Programming, pp. 457-471, Ithaca, NY, MIT Press, November 1994.Google Scholar
  3. 3.
    Bueno, F., Deransart, P., Drabent, W., Ferrand, G., Hermenegildo, M., Maluszynski, J. and Puebla, G., “On the Role of Semantic Approximations in Validation and Diagnosis of Constraint Logic Programs,” in Proc. of the 3rd. Int'l Workshop on Automated Debugging-AADEBUG 97, pp. 155-170, Linköping, Sweden, U. of Linköping Press, May 1997.Google Scholar
  4. 4.
    Dart, P.W. and Zobel, J., “A Regular Type Language for Logic Programs,” in Types in Logic Programming, pp. 157-187, MIT Press, 1992.Google Scholar
  5. 5.
    Dawson, S., Ramakrishnan, C. R., Ramakrishnan, I. V. and Sekar, R. C., “Extracting Determinacy in Logic Programs,” in 1993 International Conference on Logic Programming, pp. 424-438, MIT Press, June 1993.Google Scholar
  6. 6.
    Debray, S. K. and Warren, D. S., “Functional computations in logic programs,” ACM Transactions on Programming Languages and Systems, 11, 3, pp. 451-481, 1989.CrossRefGoogle Scholar
  7. 7.
    Demoen, B., García de la Banda, M., Harvey, W., Marriott, K. and Stuckey, P., “An Overview of HAL,” in 5th International Conference on Principles and Practice of Constraint Programming (CP 99), vol. 1713 of LNCS (Jaffar, J. ed.), pp. 174-188, Springer-Verlag, October 1999.Google Scholar
  8. 8.
    Garey, M. R. and Johnson, D. S., Computers and Intractability: A Guide to the Theory of NP-Completeness, W.H. Freeman, New York, 1979.zbMATHGoogle Scholar
  9. 9.
    Giacobazzi, R. and Ricci, L., “Detecting Determinate Computations by Bottom-up Abstract Interpretation,” in 4th European Symposium on Programming (ESOP'92), vol. 582 of LNCS (Krieg-Brückner, B. ed.), pp. 167-181, Springer-Verlag, February 1992.Google Scholar
  10. 10.
    Henderson, F., Somogyi, Z. and Conway, T., “Determinism Analysis in the Mercury Compiler,” in Proc. of the 9th Australian Computer Science Conference, vol. 18 of Australian Computer Science Communications (Kotagiri, R. ed.), pp. 337-346, RMIT, The University of Melbourne, January 1996.Google Scholar
  11. 11.
    Hermenegildo, M., Puebla, G., Bueno, F. and López-García, P., “Integrated Program Debugging, Verification, and Optimization Using Abstract Interpretation (and The Ciao System Preprocessor),” Science of Computer Programming, 58, 1-2, pp. 115-140, October 2005.zbMATHCrossRefMathSciNetGoogle Scholar
  12. 12.
    Hill, P. M. and King, A., “Determinacy and determinacy analysis,” Journal of Programming Languages, 5, 1, pp. 135-171, December 1997.Google Scholar
  13. 13.
    Janssens, G. and Bruynooghe, M., “Deriving Descriptions of Possible Values of Program Variables by means of Abstract Interpretation,” Journal of Logic Programming, 13, 2-3, pp. 205-258, July 1992.zbMATHCrossRefMathSciNetGoogle Scholar
  14. 14.
    King, A., Lu, L. and Genaim, S., “Detecting Determinacy in Prolog Programs,” in Logic Programming, 22nd International Conference, ICLP 2006, Seattle, WA, USA, August 17-20, 2006, Proc., vol. 4079 of LNCS (Etalle, S. and Truszczynski, M. eds.), pp. 132-147, Springer, 2006.Google Scholar
  15. 15.
    Kunen, K., “Answer Sets and Negation as Failure,” in Proc. of the Fourth International Conference on Logic Programming, pp. 219-228, MIT Press, Melbourne, May 1987.Google Scholar
  16. 16.
    Lassez, J.-L., Maher, M. and Marriott, K., “Unification Revisited,” in Foundations of Deductive Databases and Logic Programming (Minker, J. ed.), pp. 587-626, Morgan Kaufmann, 1988.Google Scholar
  17. 17.
    López-García, P., Bueno, F. and Hermenegildo, M., “Determinacy Analysis for Logic Programs Using Mode and Type Information,” in Proc. of the 14th International Symposium on Logic-based Program Synthesis and Transformation (LOPSTR'04), vol. 3573 of LNCS, pp. 19-35, Springer-Verlag, August 2005.Google Scholar
  18. 18.
    López-García, P., Bueno, F. and Hermenegildo, M., “Inferring Determinacy and Mutual Exclusion in Logic Programs Using Mode and Type Analysis,” Technical Report CLIP2/2009.0, Technical University of Madrid (UPM), School of Computer Science, UPM, February 2009.Google Scholar
  19. 19.
    Lu, L. and King, A., “Determinacy Inference for Logic Programs,” in Programming Languages and Systems, 14th European Symposium on Programming (ESOP 2005), vol. 3444 of LNCS (Sagiv, M. ed.), pp. 108-123, Springer, 2005.Google Scholar
  20. 20.
    Æ Mogensen, T., “A Semantics-Based Determinacy Analysis for Prolog with Cut,” in Perspectives of System Informatics, Second International Andrei Ershov Memorial Conference, vol. 1181 of LNCS, pp. 374-385, Springer, 1996.Google Scholar
  21. 21.
    Muthukumar, K. and Hermenegildo M., “Combined Determination of Sharing and Freeness of Program Variables through Abstract Interpretation,” in 1991 International Conference on Logic Programming, pp. 49-63, MIT Press, June 1991.Google Scholar
  22. 22.
    Pugh, W., “A Practical Algorithm for Exact Array Dependence Analysis,” Communications of the ACM, 35, 8, pp. 102-114, August 1992.CrossRefGoogle Scholar
  23. 23.
    Sahlin, D., “Determinacy Analysis for Full Prolog,” in Proc. of the 1991 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation (PEPM'91), pp. 23-30, ACM Press, 1991.Google Scholar
  24. 24.
    Somogyi, Z., Henderson, F. and Conway, T., “The Execution Algorithm of Mercury: an Efficient Purely Declarative Logic Programming Language,” Journal of Logic Programming, 29, 1-3, pp. 17-64, October 1996.zbMATHCrossRefGoogle Scholar
  25. 25.
    Vaucheret, C. and Bueno, F., “More Precise yet Efficient Type Inference for Logic Programs,” in International Static Analysis Symposium, vol. 2477 of LNCS, pp. 102-116, Springer-Verlag, September 2002.Google Scholar

Copyright information

© Ohmsha and Springer Japan jointly hold copyright of the journal. 2010

Authors and Affiliations

  • Pedro Lopez-Garcia
    • 1
    • 2
    Email author
  • Francisco Bueno
    • 3
  • Manuel Hermenegildo
    • 1
    • 3
  1. 1.IMDEA SoftwareMadridSpain
  2. 2.Spanish Research Council (CSIC)MadridSpain
  3. 3.Technical University of Madrid (UPM)MadridSpain

Personalised recommendations