Optimizing the Runtime Processing of Types in Polymorphic Logic Programming Languages

The traditional purpose of types in programming languages of providing correctness assurances at compile time is increasingly being supplemented by a direct role for them in the computational process. In the context of typed logic programming, this is manifest in their effect on the unification operation. Their influence takes two different forms. First, in a situation where polymorphism is permitted, type information is needed to determine if different occurrences of the same name in fact denote an identical constant. Second, type information may determine the form of bindings for variables. When types are needed for the second purpose as in the case of higher-order unification, these have to be available with every variable and constant. However, in situations such as first-order and higher-order pattern unification, types have no impact on the variable binding process. As a consequence, type examination is needed in these situations only for the first of the two purposes described and even here a careful preprocessing can considerably reduce their runtime footprint. We develop a scheme for treating types in these contexts that exploits this observation. Under this scheme, type information is elided in most cases and is embedded into term structure when this is not entirely possible. Our approach obviates types when properties known as definitional genericity and type preservation are satisfied and has the advantage of working even when these conditions are violated.

[1]  Gopalan Nadathur,et al.  System description : Teyjus : A compiler and abstract machine based implementation of λprolog , 1999 .

[2]  Jaime G. Carbonell,et al.  Automated Deduction — CADE-16 , 2002, Lecture Notes in Computer Science.

[3]  Dale Miller,et al.  A Logic Programming Language with Lambda-Abstraction, Function Variables, and Simple Unification , 1991, J. Log. Comput..

[4]  Gérard P. Huet,et al.  A Unification Algorithm for Typed lambda-Calculus , 1975, Theor. Comput. Sci..

[5]  Michael Hanus Horn Clause Programs with Polymorphic Types: Semantics and Resolution , 1991, Theor. Comput. Sci..

[6]  T. Nipkom Functional unification of higher-order patterns , 1993, LICS 1993.

[7]  Gopalan Nadathur,et al.  Practical Higher-Order Pattern Unification with On-the-Fly Raising , 2005, ICLP.

[8]  Alan Mycroft,et al.  A Polymorphic Type System for Prolog , 1984, Logic Programming Workshop.

[9]  Gopalan Nadathur,et al.  The Type System of a Higher-Order Logic Programming Language , 1992, Types in Logic Programming.

[10]  Gopalan Nadathur,et al.  System Description: Teyjus - A Compiler and Abstract Machine Based Implementation of lambda-Prolog , 1999, CADE.

[11]  Frank Pfenning,et al.  An Empirical Study of the Runtime Behavior of Higher-Order Logic Programs , 1992 .

[12]  Uday S. Reddy,et al.  Typed Prolog: A Semantic Reconstruction of the Mycroft-O'Keefe Type System , 1991, ISLP.

[13]  Frank Pfenning,et al.  Elf: a language for logic definition and verified metaprogramming , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[14]  Peter Lee,et al.  TIL: a type-directed, optimizing compiler for ML , 2004, SIGP.

[15]  Gopalan Nadathur,et al.  Uniform Proofs as a Foundation for Logic Programming , 1991, Ann. Pure Appl. Log..

[16]  Gopalan Nadathur,et al.  Implementing Polymorphic Typing in a Logic Programming Language , 1994, Comput. Lang..

[17]  Frank Pfenning,et al.  Types in Logic Programming , 1992, ICLP.