Locating Type Errors in Untyped CLP Programs

  • Włodzimierz Drabent
  • Jan Małuszyński
  • Paweł Pietrzak
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1870)


This chapter presents a static diagnosis tool that locates type errors in untyped CLP programs without executing them. The existing prototype is specialised for the programming language CHIP [4.10], but the idea applies to any CLP language. The tool works with approximated specifications which describe types of procedure calls and successes. The specifications are expressed as a certain kind of term grammars. The tool automatically locates at compile time all the errors (with respect to a given specification) in a program. The located erroneous program fragments are (prefixes of) clauses. The tool aids the user in constructing specifications incrementally; often a fragment of the specification is already sufficient to locate an error. The presentation is informal. The focus is on the motivation of this work and on the functionality of the tool. Some related formal aspects are discussed in [4.15, 4.29]. The prototype tool is available from .


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Bossi, A., Cocco, N.: Verifying correctness of logic programs. In: Díaz, J., Orejas, F. (eds.) TAPSOFT 1989 and CCIPL 1989. LNCS, vol. 352, pp. 96–110. Springer, Heidelberg (1989)Google Scholar
  2. 2.
    Boye, J., Małuszyński, J.: Directional types and the annotation method. Journal of Logic Programming 33(3), 179–220 (1997)zbMATHCrossRefMathSciNetGoogle Scholar
  3. 3.
    Bueno, F., Deransart, P., Drabent, W., Ferrand, G., Hermenegildo, M., Małuszyński, J., Puebla, G.: On the role of semantic approximations in validation and diagnosis of constraint logic programs. In: Kamkar, M. (ed.) Proceedings of the AADEBUG 1997 (The Third International Workshop on Automated Debugging), pp. 155–169. Linköping University (1997)Google Scholar
  4. 4.
    Charatonik, W., Podelski, A.: Directional type inference for logic programs. In: Levi, G. (ed.) SAS 1998. LNCS, vol. 1503, pp. 278–294. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  5. 5.
    Clark, K.L.: Predicate logic as computational formalism. Technical Report 79/59, Imperial College, London (December 1979)Google Scholar
  6. 6.
    Comini, M., Drabent, W., Małuszyński, J., Pietrzak, P.: A type-based diagnoser for CHIP. ESPRIT DiSCiPl deliverable (September 1998)Google Scholar
  7. 7.
    Comini, M., Drabent, W., Pietrzak, P.: Diagnosis of CHIP programs using type information. In: Proceedings of APPIA-GULP-PRODE 1999 – 1999 Joint Conference on Declarative Programming, L’Aquila, Italy (1999); Preliminary version appeared in Proceedings of Types for Constraint Logic Programming, post-conference workshop of JICSLP 1998, Manchester (1998)Google Scholar
  8. 8.
    Comini, M., Levi, G., Meo, M.C., Vitiello, G.: Abstract diagnosis. Journal of Logic Programming 39(1–3), 43–95 (1999)zbMATHCrossRefMathSciNetGoogle Scholar
  9. 9.
    Codish, M.: Efficient goal directed bottom-up evaluation of logic programs. Journal of Logic Programming 38(3), 355–370 (1999)zbMATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    Cosytec SA. CHIP System Documentation (1998) Google Scholar
  11. 11.
    Dart, P., Zobel, J.: A regular type language for logic programs. In: Pfenning, F. (ed.) Types in Logic Programming, pp. 157–187. The MIT Press, Cambridge (1992)Google Scholar
  12. 12.
    Deransart, P.: Proof method of declarative properties of definite programs. Theoretical Computer Science 118, 99–166 (1993)zbMATHCrossRefMathSciNetGoogle Scholar
  13. 13.
    Deransart, P., Małuszyński, J.: A Grammatical View of Logic Programming. MIT Press, Cambridge (1993)zbMATHGoogle Scholar
  14. 14.
    Drabent, W., Małuszyński, J.: Inductive Assertion Method for Logic Programs. Theoretical Computer Science 59(1), 133–155 (1988)zbMATHCrossRefMathSciNetGoogle Scholar
  15. 15.
    Drabent, W., Pietrzak, P.: Inferring call and success types for CLP programs. ESPRIT DiSCiPl deliverable (September 1998)Google Scholar
  16. 16.
    Drabent, W., Pietrzak, P.: Type Analysis for CHIP. In: Haeberer, A.M. (ed.) AMAST 1998. LNCS, vol. 1548, pp. 389–405. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  17. 17.
    Drabent, W., Małuszyński, J., Pietrzak, P.: Type-based Diagnosis of CLP Programs. Electronic Notes in Theoretical Computer Science 30(4) (2000)Google Scholar
  18. 18.
    Ferrand, G.: Error Diagnosis in Logic Programming, an Adaptation of E. Y. Shapiro’s Method. Journal of Logic Programming 4, 177–198 (1987)zbMATHCrossRefMathSciNetGoogle Scholar
  19. 19.
    Frühwirth, T., Shapiro, E., Vardi, M., Yardeni, E.: Logic Programs as Types for Logic Programs. In: Kahn, G. (ed.) Annual IEEE Symposium on Logic in Computer Science (LICS), pp. 300–309. IEEE Computer Society Press, Los Alamitos (1991), Corrected version available from Google Scholar
  20. 20.
    Gallagher, J., de Waal, D.A.: Fast and Precise Regular Approximations of Logic Programs. In: Van Hentenryck, P. (ed.) Proc. of the Eleventh International Conference on Logic Programming, pp. 599–613. The MIT Press, Cambridge (1994)Google Scholar
  21. 21.
    Gécseg, F., Steinby, M.: Tree languages. In: Rozenberg, G., Salomaa, A. (eds.) Handbook of Formal Languages, vol. 3, Beyond Words. Springer, Heidelberg (1997)Google Scholar
  22. 22.
    Heaton, A., Hill, P., King, A.: Analysis of Logic Programs with Delay. In: Fuchs, N.E. (ed.) LOPSTR 1997. LNCS, vol. 1463, pp. 148–167. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  23. 23.
    Hermenegildo, M., Puebla, G., Bueno, F.: Using Global Analysis, Partial Specifications, and an Extensible Assertion Language for Program Validation and Debugging. In: Apt, K.R., Marek, V., Truszczynski, M., Warren, D.S. (eds.) The Logic Programming Paradigm: a 25–Year Perspective. LNCS (LNAI), pp. 161–192. Springer, Heidelberg (1999)Google Scholar
  24. 24.
    Janssens, G., Bruynooghe, M.: Deriving descriptions of possible values of program variables by means of abstract interpretation. Journal of Logic Programming 13(2 & 3), 205–258 (1992)zbMATHCrossRefMathSciNetGoogle Scholar
  25. 25.
    Lloyd, J.W.: Declarative error diagnosis. New Generation Computing 5(2), 133–154 (1987)zbMATHCrossRefGoogle Scholar
  26. 26.
    Lloyd, J.W.: Foundations of Logic Programming, 2nd edn. (extended). Springer, Heidelberg (1987)zbMATHGoogle Scholar
  27. 27.
    Mildner, P.: Type Domains for Abstract Interpretation, A Critical Study. PhD thesis, Uppsala University (1999)Google Scholar
  28. 28.
    Mishra, P.: Towards a theory of types in Prolog. In: Proceedings of the IEEE International Symposium on Logic Programming, pp. 289–298 (1984)Google Scholar
  29. 29.
    Pietrzak, P.: Static Incorrectness Diagnosis of CLP(FD). Linköping Studies in Science and Technology, Lic. Thesis no. 742, Linköping University (1998)Google Scholar
  30. 30.
    SICStus Prolog User’s Manual. Intelligent Systems Laboratory, Swedish Institute of Computer Science (1998)Google Scholar
  31. 31.
    Shapiro, E.Y.: Algorithmic program debugging. In: Proc. Ninth Annual ACM Symp. on Principles of Programming Languages, pp. 412–531. ACM Press, New York (1982)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2000

Authors and Affiliations

  • Włodzimierz Drabent
    • 1
    • 2
  • Jan Małuszyński
    • 1
  • Paweł Pietrzak
    • 1
  1. 1.Department of Computer and Information ScienceLinköpings UniversitetLinköpingSweden
  2. 2.Institute of Computer SciencePolish Academy of SciencesWarszawaPoland

Personalised recommendations