Polymorphic type checking with subtypes in Prolog

  • Thom W. Frühwirth
Part of the Lecture Notes in Computer Science book series (LNCS, volume 429)


In this paper, we give an executable specification of a state-of-the-art polymorphic type checking system with subtypes in Prolog. We show that the implementation reduces to modifying simple well-known meta-interpreters into type meta-interpreters and applying the so-called generate-and-test approach to programming in Prolog. This study emphasizes that Prolog is suitable as a language for defining executable specifications and that Prolog can be augmented with a simple but powerful type system. The type language augmenting Prolog programs with type definitions and type declarations is a subset of Prolog itself. Therefore it is possible to use types explicitly in a program.


Meta-Interpreter Executable Specification Partial Evaluation Type Checking Type Languages Subtypes Polymorphism 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [Bruynooghe]
    Bruynooghe M, Adding Redundancy to Obtain More Reliable and More Readable Prolog Programs, 1st Int Conference on Logic Programming, Marseille France, 1982Google Scholar
  2. [Cardelli-1]
    Cardelli L, Basic Polymorphic Type Checking, Draft, AT&T Bell Laboratories, Murray Hill New Jersey, ≥ 1984Google Scholar
  3. [Cardelli-2]
    Cardelli L, Structural Subtyping and the Notion of Power Type, 15th ACM Symposium on Principles of Programming Languages, San Diego California, ACM Press, January 1988Google Scholar
  4. [Chen/Kifer/Warren]
    Chen W, Kifer M and Warren D, HiLog: A First-Order Semantics for Higher-Order Logic Programming Constructs, SUNY at Stony Brook, accepted at the North American Conference on Logic Programming, USA, 1989Google Scholar
  5. [Cheng et al]
    Cheng M H M, van Emden M H and Strooper P A, Complete Sets of Frontiers in Logic-based Program Transformation, Meta 88 Workshop, Bristol England, July 1988Google Scholar
  6. [Dietrich/Hagl]
    Dietrich R and Hagl F, A Polymorphic Type System with Subtypes for Prolog, 2nd European Symposium on Programming, Nancy France, 1988Google Scholar
  7. [Frühwirth-1]
    Frühwirth Thom W, Type Inference by Program Transformation and Partial Evaluation, Meta-Programming in Logic Programming, Abramson H and Rogers M H (eds), MIT Press, Cambridge Massachusetts, 1989Google Scholar
  8. [Frühwirth-2]
    Frühwirth Thom W, A Polymorphic Type Checking System for Prolog in HiLog, 6th Israel Conference on Artificial Intelligence and Computer Vision, Ramat Gan Israel, December 1989Google Scholar
  9. [Frühwirth-3]
    Frühwirth Thom W, Types in Logic Programming, Ph.D. Thesis, Technical University Vienna, Computer Science Department E181B, Vienna Austria, March 1990Google Scholar
  10. [Hanus]
    Hanus M, Horn Clause Programs with Polymorphic Types: Semantics and Resolution, TAPSOFT '89, Lecture Notes in Computer Science 351, Goos G and Hartmanis J (eds), Springer, New York New York, 1989Google Scholar
  11. [Jacobs]
    Jacobs D, A Type System for Algebraic Database Programming Languages, 2nd International Workshop on Database Programming Languages, Gleneden Beach Oregon, June 1989Google Scholar
  12. [Kanamori/Horiuchi]
    Kanamori T and Horiuchi K, Polymorphic Type Inference in Prolog by Abstract Interpretation, Logic Programming '87 6th Conf., Lecture Notes in Computer Science 315, Goos G and Hartmanis J (eds), Springer, New York New York, 1987Google Scholar
  13. [Lloyd]
    Lloyd J W, Foundations of Logic Programming, Second, extended Edition, Springer Verlag, Berlin Germany, 1987Google Scholar
  14. [Milner]
    Milner R, A Theory of Type Polymorphism in Programming, Journal on Computer and System Sciences Vol 17 No 3, 1978, pp 348–375Google Scholar
  15. [Mycroft/O'Keefe]
    Mycroft A and O'Keefe R A, A Polymorphic Type System for Prolog, Artificial Intelligence, Vol 23, No 3, August 1984, pp 295–307Google Scholar
  16. [Smolka]
    Smolka G, Logic Programming with Polymorphically Order-Sorted Types, Lilog-Report 55, IBM Deutschland GmbH, Germany, October 1988Google Scholar
  17. [Sterling/Shapiro]
    Sterling L and Shapiro E, The Art of Prolog, MIT Press, Cambridge Massachusetts, 1986Google Scholar
  18. [Takeuchi/Furukawa]
    Takeuchi A and Furukawa K, Partial Evaluation of Prolog Programs and its Application to Meta Programming, Information Processing 86, 415–420, North Holland, 1986Google Scholar
  19. [van Emden]
    van Emden M H, Conditonal Answers for Polymorphic Type Inference, in 5th Int Logic programming Conference and 5th Int Symposium on Logic programming, Kowalski R A and Bowen K A (eds), MIT Press, Cambridge Massachusetts, 1988Google Scholar
  20. [Venken]
    Venken R, A Prolog Meta-Interpreter for Partial Evaluation and its Application to Source to Source Transformation and Query-Optimization, in T. O'Shea (ed), Advances in Artificial Intelligence, ECCAI, Elsevier Science Publisher, Holland, 1985Google Scholar
  21. [Wegner/Cardelli]
    Wegner P and Cardelli L, On Understanding Types, Data Abstraction, and Polymorphism, Computing Surveys, Vol 17, No 4, December 1985Google Scholar
  22. [Xu/Warren]
    Xu J and Warren D S, A Theory of Types and Type Inference in Logic Programming Languages, Ph.D. Thesis, State University of New York at Stony Brook, Department of Computer Science, Stony Brook New York, July 1989Google Scholar
  23. [Yardeni/Shapiro]
    Yardeni E and Shapiro E, A Type System for Logic Programs, in Concurrent Prolog: Collected papers, Shapiro E (ed), Vol 2, MIT Press, Cambridge Massachusetts, 1987, pp 211–244Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1990

Authors and Affiliations

  • Thom W. Frühwirth
    • 1
  1. 1.Department of Computer ScienceSUNY at Stony BrookLong IslandUSA

Personalised recommendations