Skip to main content

Determinacy Analysis for Logic Programs Using Mode and Type Information

  • Conference paper
Logic Based Program Synthesis and Transformation (LOPSTR 2004)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 3573))

Abstract

We propose an analysis for detecting procedures and goals that are deterministic (i.e. that produce at most one solution), 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 (because they call other predicates that can produce more than one solution). Applications of such determinacy information include detecting programming errors, performing certain high-level program transformations for improving search efficiency, optimizing low level code generation and parallel execution, and estimating tighter upper bounds on the computational costs of goals and data sizes, which can be used for program debugging, resource consumption and granularity control, 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 chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Aspvall, B., 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, October 1979, pp. 205–217 (1979)

    Google Scholar 

  2. Braem, C., Le Charlier, B., Modart, S., Van Hentenryck, P.: Cardinality analysis of prolog. In: Proc. International Symposium on Logic Programming, Ithaca, NY, pp. 457–471. MIT Press, Cambridge (1994)

    Google Scholar 

  3. Dart, P.W., Zobel, J.: A Regular Type Language for Logic Programs. In: Types in Logic Programming, pp. 157–187. MIT Press, Cambridge (1992)

    Google Scholar 

  4. Dawson, S., Ramakrishnan, C.R., Ramakrishnan, I.V., Sekar, R.C.: Extracting Determinacy in Logic Programs. In: 1993 International Conference on Logic Programming, pp. 424–438. MIT Press, Cambridge (1993)

    Google Scholar 

  5. Debray, S.K., Lin, N.W.: Cost analysis of logic programs. ACM Transactions on Programming Languages and Systems 15(5), 826–875 (1993)

    Article  Google Scholar 

  6. Debray, S.K., Warren, D.S.: Functional computations in logic programs. ACM Transactions on Programming Languages and Systems 11(3), 451–481 (1989)

    Article  Google Scholar 

  7. Demoen, B., Garcia de la Banda, M., Harvey, W., Marriott, K., Stuckey, P.: An overview of HAL. In: PPCP1999: Principles and Practice of Constraint Programming, pp. 174–178 (1999)

    Google Scholar 

  8. Gallagher, J.P., de Waal, D.A.: Fast and precise regular approximations of logic programs. In: Van Hentenryck, P. (ed.) Proc. of the 11th International Conference on Logic Programming, pp. 599–613. MIT Press, Cambridge (1994)

    Google Scholar 

  9. Garey, M.R., Johnson, D.S.: Computers and Intractability: A Guide to the Theory of NP-Completeness. W.H. Freeman, New York (1979)

    MATH  Google Scholar 

  10. Giacobazzi, R., Ricci, L.: Detecting determinate computations by bottom-up abstract interpretation. In: Symposium proceedings on 4th European symposium on programming, pp. 167–181. Springer, Heidelberg (1992)

    Google Scholar 

  11. Gupta, G., Pontelli, E., Ali, K., Carlsson, M., Hermenegildo, M.: Parallel Execution of Prolog Programs: a Survey. ACM Transactions on Programming Languages and Systems 23(4), 472–602 (2001)

    Article  Google Scholar 

  12. Henderson, F., Somogyi, Z., Conway, T.: Determinism analysis in the Mercury compiler. In: Proc. Australian Computer Science Conference, Melbourne, Australia, January 1996, pp. 337–346 (1996)

    Google Scholar 

  13. Hermenegildo, M., Carro, M.: Relating Data–Parallelism and (And–) Parallelism in Logic Programs. The Computer Languages Journal 22(2/3), 143–163 (1996)

    Article  Google Scholar 

  14. Hermenegildo, M., Puebla, G., Bueno, F., López-García, P.: Program Development Using Abstract Interpretation (and The Ciao System Preprocessor). In: Cousot, R. (ed.) SAS 2003. LNCS, vol. 2694, pp. 127–152. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  15. Hill, P.M., King, A.: Determinacy and determinacy analysis. Journal of Programming Languages 5(1), 135–171 (1997)

    Google Scholar 

  16. Janssens, G., Bruynooghe, M.: Deriving Descriptions of Possible Values of Program Variables by means of Abstract Interpretation. Journal of Logic Programming 13(2 and 3), 205–258 (1992)

    Article  MATH  MathSciNet  Google Scholar 

  17. Kunen, K.: Answer Sets and Negation as Failure. In: Proc. of the Fourth International Conference on Logic Programming, pp. 219–228. MIT Press, Cambridge (1987)

    Google Scholar 

  18. Lassez, J.-L., Maher, M., Marriott, K.: Unification Revisited. In: Minker, J. (ed.) Foundations of Deductive Databases and Logic Programming, pp. 587–626. Morgan Kaufmann, San Francisco (1988)

    Google Scholar 

  19. López-García, P., Bueno, F., Hermenegildo, M.: Towards Determinacy Analysis for Logic Programs Using Mode and Type Information. Technical Report CLIP4/2005.0, Technical University of Madrid (UPM), School of Computer Science, UPM (April 2005)

    Google Scholar 

  20. López-García, P., Hermenegildo, M., Debray, S.K.: A Methodology for Granularity Based Control of Parallelism in Logic Programs. Journal of Symbolic Computation, Special Issue on Parallel Symbolic Computation 22, 715–734 (1996)

    Google Scholar 

  21. Morales, J., Carro, M., Hermenegildo, M.: Improving the Compilation of Prolog to C Using Moded Types and Determinism Information. In: Crestani, F., Ruthven, I. (eds.) CoLIS 2005. LNCS, vol. 3507, pp. 86–103. Springer, Heidelberg (2005)

    Google Scholar 

  22. Muthukumar, K., Hermenegildo, M.: Combined Determination of Sharing and Freeness of Program Variables Through Abstract Interpretation. In: 1991 International Conference on Logic Programming, June 1991, pp. 49–63. MIT Press, Cambridge (1991)

    Google Scholar 

  23. Pugh, W.: A Practical Algorithm for Exact Array Dependence Analysis. Communications of the ACM 35(8), 102–114 (1992)

    Article  Google Scholar 

  24. Santos-Costa, V., Warren, D.H.D., Yang, R.: Andorra-I: A Parallel Prolog System that Transparently Exploits both And- and Or-parallelism. In: Proceedings of the 3rd. ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, July 1991, vol. 7, pp. 83–93. ACM, New York (1991); SIGPLAN Notices vol 26(7) (July 1991)

    Chapter  Google Scholar 

  25. Somogyi, Z., Henderson, F., Conway, T.: The execution algorithm of Mercury: an efficient purely declarative logic programming language. JLP 29(1-3) (1996)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2005 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

López-García, P., Bueno, F., Hermenegildo, M. (2005). Determinacy Analysis for Logic Programs Using Mode and Type Information. In: Etalle, S. (eds) Logic Based Program Synthesis and Transformation. LOPSTR 2004. Lecture Notes in Computer Science, vol 3573. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11506676_2

Download citation

  • DOI: https://doi.org/10.1007/11506676_2

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-26655-6

  • Online ISBN: 978-3-540-31683-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics