Skip to main content
Log in

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

  • Published:
New Generation Computing Aims and scope Submit manuscript

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.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  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.

  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.

  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.

  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.

  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.

  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.

    Article  Google Scholar 

  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.

  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.

    MATH  Google Scholar 

  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.

  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.

  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.

    Article  MATH  MathSciNet  Google Scholar 

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

    Article  MATH  MathSciNet  Google Scholar 

  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.

  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.

  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.

  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.

  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.

  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.

  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.

  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.

  22. Pugh, W., “A Practical Algorithm for Exact Array Dependence Analysis,” Communications of the ACM, 35, 8, pp. 102-114, August 1992.

    Article  Google Scholar 

  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.

  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.

    Article  MATH  Google Scholar 

  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.

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Pedro Lopez-Garcia.

About this article

Cite this article

Lopez-Garcia, P., Bueno, F. & Hermenegildo, M. Automatic Inference of Determinacy and Mutual Exclusion for Logic Programs Using Mode and Type Analyses. New Gener. Comput. 28, 177–206 (2010). https://doi.org/10.1007/s00354-008-0085-1

Download citation

  • Received:

  • Revised:

  • Published:

  • Issue Date:

  • DOI: https://doi.org/10.1007/s00354-008-0085-1

Keywords

Navigation