Detecting Determinacy in Prolog Programs

  • Andy King
  • Lunjin Lu
  • Samir Genaim
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4079)


In program development it is useful to know that a call to a Prolog program will not inadvertently leave a choice-point on the stack. Determinacy inference has been proposed for solving this problem yet the analysis was found to be wanting in that it could not infer determinacy conditions for programs that contained cuts or applied certain tests to select a clause. This paper shows how to remedy these serious deficiencies. It also addresses the problem of identifying those predicates which can be rewritten in a more deterministic fashion. To this end, a radically new form of determinacy inference is introduced, which is founded on ideas in ccp, that is capable of reasoning about the way bindings imposed by a rightmost goal can make a leftmost goal deterministic.


Logic Program Quiescent State Mutual Exclusion Success Pattern Determinacy Condition 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Braem, C., Le Charlier, B., Modar, S., Van Hentenryck, P.: Cardinality Analysis of Prolog. In: Bruynooghe, M. (ed.) International Symposium on Logic Programming, pp. 457–471. MIT Press, Cambridge (1994)Google Scholar
  2. 2.
    Bruynooghe, M., Codish, M., Gallagher, J., Genaim, S., Vanhoof, W.: Termination Analysis through Combination of Type Based Norms. In: ACM Transactions on Programming Languages and Systems (to appear)Google Scholar
  3. 3.
    Dawson, S., Ramakrishnan, C.R., Ramakrishnan, I.V., Sekar, R.C.: Extracting Determinacy in Logic Programs. In: International Conference on Logic Programming, pp. 424–438. MIT Press, Cambridge (1993)Google Scholar
  4. 4.
    Genaim, S., King, A.: Goal-Independent Suspension Analysis for Logic Programs with Dynamic Scheduling. In: Degano, P. (ed.) ESOP 2003 and ETAPS 2003. LNCS, vol. 2618, pp. 84–98. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  5. 5.
    King, A., Lu, L.: A Backward Analysis for Constraint Logic Programs. Theory and Practice of Logic Programming 2(4–5), 517–547 (2002)MATHCrossRefMathSciNetGoogle Scholar
  6. 6.
    King, A., Lu, L., Genaim, S.: Determinacy Inference by Suspension Inference. Technical Report 2-05, Computing Laboratory, University of Kent, CT2 7NF (2005),
  7. 7.
    Lagoon, V., Stuckey, P.J.: A Framework for Analysis of Typed Logic Programs. In: Kuchen, H., Ueda, K. (eds.) FLOPS 2001. LNCS, vol. 2024, pp. 296–310. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  8. 8.
    Le Charlier, B., Rossi, S., Van Hentenryck, P.: Sequence-based abstract interpretation of Prolog. Theory and Practice of Logic Programming 2, 25–84 (2002)MATHMathSciNetGoogle Scholar
  9. 9.
    Leuschel, M.: Personal Communication on Partial Evaluation (April 2005)Google Scholar
  10. 10.
    Leuschel, M., Jørgensen, J., Vanhoof, W., Bruynooghe, M.: Offline Specialisation in Prolog Using a Hand-Written Compiler Generator. Theory and Practice of Logic Programming 4(1), 139–191 (2004)MATHCrossRefGoogle Scholar
  11. 11.
    Lloyd, J.W.: Foundations of Logic Programming. Springer, Heidelberg (1987)MATHGoogle Scholar
  12. 12.
    López-García, P., Bueno, F., Hermenegildo, M.: Determinacy Analysis for Logic Programs Using Mode and Type Information. In: Etalle, S. (ed.) LOPSTR 2004. LNCS, vol. 3573, pp. 19–35. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  13. 13.
    Lu, L., King, A.: Determinacy Inference for Logic Programs. In: Sagiv, M. (ed.) ESOP 2005. LNCS, vol. 3444, pp. 108–123. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  14. 14.
    Mogensen, T.: A Semantics-Based Determinacy Analysis for Prolog with Cut. In: Bjorner, D., Broy, M., Pottosin, I.V. (eds.) PSI 1996. LNCS, vol. 1181, pp. 374–385. Springer, Heidelberg (1996)Google Scholar
  15. 15.
    Müller, M., Glaß, T., Stroetmann, K.: Pan - The Prolog Analyzer (Short system description). In: Cousot, R., Schmidt, D.A. (eds.) SAS 1996. LNCS, vol. 1145, pp. 387–388. Springer, Heidelberg (1996)Google Scholar
  16. 16.
    Sahlin, D.: Determinacy Analysis for Full Prolog. Partial Evaluation and Semantics Based Program Manipulation. SIGPLAN Notices 26(9), 23–30 (1991)Google Scholar
  17. 17.
    Santos Costa, V., Warren, D.H.D., Yang, R.: Andorra-I Compilation. New Generation Computing 14(1), 3–30 (1996)CrossRefGoogle Scholar
  18. 18.
    Saraswat, V.A., Rinard, M.C., Panangaden, P.: Semantic Foundations of Concurrent Constraint Programming. In: Principles of Programming Languages, pp. 333–352. ACM Press, New York (1991)Google Scholar
  19. 19.
    Shapiro, E., Sterling, L.: The Art of Prolog. MIT Press, Cambridge (1994)MATHGoogle Scholar
  20. 20.
    Zobel, J.: Analysis of Logic Programs. PhD thesis, Department of Computer Science, University of Melbourne, Parkville, Victoria 3052 (1990)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Andy King
    • 1
  • Lunjin Lu
    • 2
  • Samir Genaim
    • 3
  1. 1.University of KentCanterburyUK
  2. 2.Oakland UniversityRochesterUSA
  3. 3.Universidad Politécnica de MadridSpain

Personalised recommendations