Type inference in Prolog

  • H. Azzoune
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 310)


This paper presents a type inference system for Prolog. The idea is to describe sets of terms for which the predicates may succeed. We calculate ordered sets of terms containing some variables called "type variables" (corresponding to variables appearing in simultaneously heads and bodies of clauses), and we generate inequations (from the bodies of clauses) on these type variables. The inequations are then solved in order to instanciate type variables by their domains, obtained from this resolution. The resolution of inequations is done by unification and strategy resolution simulation, with a particular treatment of recursive calls.

Key words

Prolog Type Type Inference 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    Apt, K.R. and Van Emden M.H., "Contributions to the Theory of Logic Programming", Journal of ACM, Vol 29 No 3 pp 841–862 1982.CrossRefGoogle Scholar
  2. [2]
    Bruynooghe M., "Abstract Interpretation: Towards the Global Optimization of Prolog Programs", Proceedings 1987 Symposium on Logic Programming August 31–September 1987 San Francisco IEEE Society Press pp 192–204.Google Scholar
  3. [3]
    Bruynooghe M., "Adding redundancy to obtain more reliable and more readable Prolog Programs", Proc. First Int. Logic Prog. Conf pp 129–133 1982.Google Scholar
  4. [4]
    Gordon, M.J.C.,Milner,A.J.R.G., Morris,L.,Newey,M.and Wadsworth,C., "A Metalanguage for interactive proof in LCF", in Proc. 5 th ACM Symposium Principles of Programming Language, Tucson AZ, 1978.Google Scholar
  5. [5]
    Kanamori T. and Horiuchi K., "Type Inference in Prolog and its Applications", ICOT TR 95, December 1984.Google Scholar
  6. [6]
    Kowalski R.A., "Logic for Problem Solving", Elsevier Science Publishing, 1979 North Holland.Google Scholar
  7. [7]
    Mellish C.S., "An Automatic Generation of Mode Declaration for Prolog Programs", D.A.I. Research Paper No 163, University of Edinburgh 1981.Google Scholar
  8. [8]
    Mishra P., "Towards a Theory of Types in Prolog", Proc 1984 Inter. Symp. on Logic Programmig, pp289–298.Google Scholar
  9. [9]
    Mycroft A. and O'Keefe R.A., "A polymorphic Type System for Prolog", Logic Programming Workshop 1983.Google Scholar
  10. [10]
    Nilsson J.F., "On the Compilation of a Domain-Based Prolog", Information Processing pp 293–298 1983.Google Scholar
  11. [11]
    Pereira L.M., Pereira F.C.N. and Warren D.H.D., "User's Guide to DEC system-10 Prolog", Occasional Paper 15, Dept of Artificial Intelligence, Edinburgh 1979.Google Scholar
  12. [12]
    Tamaki H. and Sato T., "Unfold/Fold Transformation of Logic Programs", Second International Logic Programming Conference, Uppsala 1984.Google Scholar
  13. [13]
    Van Emden, M.H. and Kowalski, R.A., "The Semantics of Predicate Logic as Programming", Journal of ACM Vol 23 No 4, pp733–742 1976.CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1988

Authors and Affiliations

  • H. Azzoune
    • 1
  1. 1.Laboratoire de Genie InformatiqueGrenoble CedexFrance

Personalised recommendations