Mode Analysis Domains for Typed Logic Programs

  • Jan-Georg Smaus
  • Patricia M. Hill
  • Andy King
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1817)


Precise mode information is important for compiler optimisations and in program development tools. Within the framework of abstract compilation, the precision of a mode analysis depends, in part, on the expressiveness of the abstract domain and its associated abstraction function. This paper considers abstract domains for polymorphically typed logic programs and shows how specialised domains may be constructed for each type in the program. These domains capture the degree of instantiation to a high level of precision. By providing a generic definition of abstract unification, the abstraction of a program using these domains is formalised. The domain construction procedure is fully implemented using the Gödel language and tested on a number of example programs to demonstrate the viability of the approach.

Note: Some proofs have been omitted for space reasons. They can be found in the full version of this paper [17].


Logic Program Operational Semantic Abstract Term Type Graph Abstract Domain 
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.
    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)Google Scholar
  2. 2.
    Christiansen, H.: Deriving declarations from programs. Technical report, Roskilde University, P.O.Box 260, DK-4000 Roskilde (1997)Google Scholar
  3. 3.
    Codish, M., Demoen, B.: Deriving polymorphic type dependencies for logic programs using multiple incarnations of Prop. In: LeCharlier, B. (ed.) SAS 1994. LNCS, vol. 864, pp. 281–297. Springer, Heidelberg (1994)Google Scholar
  4. 4.
    Codish, M., Demoen, B.: Analyzing logic programs using PROP-ositional logic programs and a Magic Wand. Journal of Logic Programming 25(3), 249–274 (1995)zbMATHCrossRefMathSciNetGoogle Scholar
  5. 5.
    Codish, M., Lagoon, V.: Type dependencies for logic programs using ACI unification. In: Israeli Symposium on Theory of Computing and Systems, pp. 136–145. IEEE Press, Los Alamitos (1996)Google Scholar
  6. 6.
    Cousot, P., Cousot, R.: Comparing the Galois connection and widening/ narrowing approaches to abstract interpretation. In: Bruynooghe, M., Wirsing, M. (eds.) PLILP 1992. LNCS, vol. 631, pp. 269–295. Springer, Heidelberg (1992)CrossRefGoogle Scholar
  7. 7.
    Gallagher, J., Boulanger, D., Sağlam, H.: Practical model-based static analysis for definite logic programs. In: Lloyd, J.W. (ed.) ILPS 1995, pp. 351–365. MIT Press, Cambridge (1995)Google Scholar
  8. 8.
    Heaton, A., Hill, P., King, A.: Analysing logic programs with delay for downward-closed properties. In: Fuchs, N.E. (ed.) LOPSTR 1997. LNCS, vol. 1463, p. 148. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  9. 9.
    Hill, P.M., King, A.: Determinacy and determinacy analysis. Journal of Programming Languages 5(1), 135–171 (1997)Google Scholar
  10. 10.
    Hill, P.M., Lloyd, J.W.: The Gödel Programming Language. MIT Press, Cambridge (1994)zbMATHGoogle Scholar
  11. 11.
    Kahrs, S.: Limits ofML-definability. In: Kuchen, H., Swierstra, S.D. (eds.) PLILP 1996. LNCS, vol. 1140, pp. 17–31. Springer, Heidelberg (1996)Google Scholar
  12. 12.
    Kfoury, A.J., Tiuryn, J., Urzyczyn, P.: Type recursion in the presence of polymorphic recursion. ACM Transactions on Programming Languages and Systems 15(2), 290–311 (1993)CrossRefGoogle Scholar
  13. 13.
    Lloyd, J.W.: Foundations of Logic Programming. Springer, Heidelberg (1987)zbMATHGoogle Scholar
  14. 14.
    Meertens, L.: First steps towards the theory of rose trees. CWI, Amsterdam; IFIP Working Group 2.1 working paper 592 ROM-25 (1988)Google Scholar
  15. 15.
    Mycroft, A., O’Keefe, R.: A polymorphic type system for Prolog. Artificial Intelligence 23, 295–307 (1984)zbMATHCrossRefMathSciNetGoogle Scholar
  16. 16.
    Pfenning, F. (ed.): Types in Logic Programming, ch. 1. MIT Press, Cambridge (1992)Google Scholar
  17. 17.
    Smaus, J.-G., Hill, P.M., King, A.M.: Mode analysis domains for typed logic programs. Technical Report, 06, School of Computer Studies, University of Leeds (2000) Springer-VerlagGoogle Scholar
  18. 18.
    Somogyi, Z.: A system of precise modes for logic programs. In: ICLP 1987, pp. 769–787. MIT Press, Cambridge (1987)Google Scholar
  19. 19.
    Somogyi, Z., Henderson, F., Conway, T.: The execution algorithm of Mercury, an efficient purely declarative logic programming language. Journal of Logic Programming (November 1996)Google Scholar
  20. 20.
    Stroetmann, K., Glaβ, T.: A semantics for types in Prolog: The type system of pan version 2.0. Technical report, Siemens AG, München, Germany (1995)Google Scholar
  21. 21.
    Tan, J., Lin, I.-P.: Recursive modes for precise analysis of logic programs. In: ILPS 1997, pp. 277–290. MIT Press, Cambridge (1997)Google Scholar
  22. 22.
    van Emden, M.: AVL tree insertion: A benchmark program biased towards Prolog. Logic Programming Newsletter 2 (1981)Google Scholar
  23. 23.
    Van Hentenryck, P., Cortesi, A., Le Charlier, B.: Type analysis of Prolog using type graphs. Technical Report CS-93-52, Brown University Box 1910, Providence, RI 02912 (November 1993)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2000

Authors and Affiliations

  • Jan-Georg Smaus
    • 1
  • Patricia M. Hill
    • 2
  • Andy King
    • 3
  1. 1.INRIA-RocquencourtFrance
  2. 2.University of LeedsUnited Kingdom
  3. 3.University of Kent at CanterburyUnited Kingdom

Personalised recommendations