## Polymorphically Typed Logic Programs (1991)

Venue: | Types in Logic Programming |

Citations: | 28 - 2 self |

### BibTeX

@INPROCEEDINGS{Yardeni91polymorphicallytyped,

author = {Eyal Yardeni and Thom Fruehwirth and Ehud Shapiro},

title = {Polymorphically Typed Logic Programs},

booktitle = {Types in Logic Programming},

year = {1991},

pages = {63--90},

publisher = {MIT Press}

}

### OpenURL

### Abstract

We introduce polymorphically typed logic programs, an integration of a polymorphic type system with logic programs. The first-order notion of predicates is extended to parametric predicates, which are parameterized by types. The type system accommodates both subtypes and parametric polymorphism. It unifies features of value-based and name-based approaches. The denotation of a typed logic program is given by its type completion, a transformation that incorporates explicit type conditions into a parametric logic program. The result of the transformation is a restricted form of a HiLog program. We give fixpoint semantics to our language (actually to full HiLog). We define a notion of well-typing, which relates type declarations for predicates in the program to an approximation of the denotation of the type completed program. We present a type-checking algorithm for verifying that a program is indeed well-typed. Finally we discuss some extensions to the type system.

### Citations

2438 |
The Design and Analysis of Computer Algorithms
- Aho, Hopcroft, et al.
- 1974
(Show Context)
Citation Context ...ges 4 . Therefore we restrict our attention to a well-known subclass of tuple-distributive sets, the socalled regular sets. Algorithms for the intersection, union and equivalence of regular languages =-=[AHU74]-=- are known. Definition. A set of terms is regular iff it is the denotation of a type constant in some set of type definitions. Note that the type definition of a type constant is in standard BNF-synta... |

936 | A theory of type polymorphism in progra.mming - Milner - 1978 |

709 | The semantics of predicate logic as a programming language
- Emden, Kowalski
- 1976
(Show Context)
Citation Context ...he minimal Herbrand model of a HiLog program P if and only if there exists a refutation of P [ fGg. Definition. We define an operator TP , which is syntactically identical to van Emden and Kowalski's =-=[vEK76]-=-, except that it operates on another domain: TP : 2 BL !2 BL TP (I ) = fA 2 BL j A / B 1 ,B 2 ,: : :,B n L C, C 2 P, and B 1 ,B 2 ,: : :,B n 2 I g. where A L B means that A is a ground instance of B o... |

94 | A finite presentation theorem for approximating logic programs
- Heintze, Jaffar
- 1990
(Show Context)
Citation Context ...m uses the notion of tuple-distributivity [Mis84]. The tuple distributive closure of a set is an approximation of the initial set where argument dependencies are eliminated. Definition. (Adapted from =-=[HJ90]-=-). Let S be a set of ground HiLog terms. The tuple distributive closure (or cartesian closure) of S, written ff(S), is recursively defined as: ff(S) := fc : c is a constant, c 2 Sg [ ff(t 1 ;: : : ; t... |

74 | E.: A type system for logic programs - Yardeni, Shapiro - 1990 |

71 | Three approaches to type structure - Reynolds - 1985 |

50 | An Instance of Abstract Interpretation Integrating Type and Mode - Bruynooghe, Jennsens - 1988 |

47 |
A semantics for typed logic programs
- Hill, Topor
- 1992
(Show Context)
Citation Context ...ructors in a program can be assigned a well-formed ranking (as defined below). Explanation. Requirement 2 means that there are no local type variables. This requirement is called type transparency in =-=[HT90]-=- and type preserving in [Han89]. All type variables are assumed to be universally quantified over all possible types. We do not think that the advantages of local type variables would justify the resu... |

34 |
Hilog: A first-order semantics for higher-order logic programming constructs
- Chen, Kifer, et al.
- 1989
(Show Context)
Citation Context ...yping based on an approximation of the denotation of the program. ffl Algorithms for type checking polymorphically typed logic programs. ffl As a by-product, fixpoint semantics for the language HiLog =-=[CKW89]-=-. The idea of types in logic programming traces back as early as 1982, when [Bru82] suggested to add `useful redundancy' to logic programs in the form of mode and type declarations. In their classical... |

29 | Derivation of polymorphic types for Prolog programs - Zobel - 1987 |

24 | A type inference system for Prolog - Xu, Warren - 1988 |

22 | Taxonomic reasoning with many-sorted logics - Cohn - 1989 |

20 |
Logic programming with polymorphically order-sorted types. Pages 53–70 of: Algebraic and logic programming ALP’88
- Smolka
- 1988
(Show Context)
Citation Context ... Unfortunately, this property does not hold for extensions of Mycroft's and O'Keefe's type checker like subtypes [DH88, Fru89a, Fru90] or type declarations for higher-order predicates [Han89]. Smolka =-=[Smo88]-=- developed a typed predicate logic with subtyping relation. Based on it he defines syntax and semantics of relational programs computing on polymorphically order-sorted types. More recently, [YS87a, Y... |

17 |
Towards a theory of types
- Mishra
- 1984
(Show Context)
Citation Context ...ram. As parametric logic programs are instances of HiLog programs, we give fixpoint semantics for HiLog programs. We employ the well-known notion of types based on the concept of tuple-distributivity =-=[Mis84]-=-. A tuple-distributive abstraction of the fixpoint operator [YS87a] allows us to relate types to the denotation of a parametric logic program. 3.1 Fixpoint Semantics of HiLog By defining fixpoint sema... |

14 |
Adding redundancy to obtain more reliable and more readable Prolog programs
- Bruynooghe
- 1982
(Show Context)
Citation Context ...r type checking polymorphically typed logic programs. ffl As a by-product, fixpoint semantics for the language HiLog [CKW89]. The idea of types in logic programming traces back as early as 1982, when =-=[Bru82]-=- suggested to add `useful redundancy' to logic programs in the form of mode and type declarations. In their classical paper, [MO83] adopted the outlook of [Mil78] that `well-typed programs do not go w... |

13 |
Inference of polymorphic types for logic programs
- Pyo, Reddy
- 1989
(Show Context)
Citation Context ...y type of the variable. ffl If t i is not a variable, then let T i be a new type and recursively construct the inferred type T i of t i . Note that this construction parallels the function `build' in =-=[PR89]-=-. Claim. Let S be a regular set. Then p(T 1 ; : : : ; T k ) is well-typed by S iff the type checking algorithm succeeds. Proof. Analogous to the proof in [YS89] 4.3 Type Checking Parametric Predicates... |

9 |
Type definitions with parameters
- Solomon
- 1978
(Show Context)
Citation Context ...ch is a contradiction. As the denotation of types can be represented by automata, equivalence of such types would correspond to the open problem of the equivalence of deterministic push-down automata =-=[Sol78]-=-. 2.2 Type Declaration Type declarations relate predicates to the type of their arguments. Definition. A type declaration for a predicate p( 1 ,: : :, m ) of arity n has the form procedure p( 1 ,: : :... |

5 | Type inference by program transformation and partial evaluation - Fruehwirth - 1988 |

5 |
Using meta-interpreters for polymorphic type checking
- Fruehwirth
- 1990
(Show Context)
Citation Context ...on can be viewed as a kind of type definition for the type procedure. This interpretation unifies typing for functions and predicates and therefore enables the straightforward typing of meta-programs =-=[Fru90]-=-. 2.3 Typed Logic Programs The syntax of parametric and typed logic programs is an extension of first-order logic programs in that type arguments are added to predicates and in that types (including t... |

5 | Specification = program + types - Naish - 1987 |

4 |
Polymorphic higher-order programming
- Hanus
- 1989
(Show Context)
Citation Context ... by their types. Unfortunately, this property does not hold for extensions of Mycroft's and O'Keefe's type checker like subtypes [DH88, Fru89a, Fru90] or type declarations for higher-order predicates =-=[Han89]-=-. Smolka [Smo88] developed a typed predicate logic with subtyping relation. Based on it he defines syntax and semantics of relational programs computing on polymorphically order-sorted types. More rec... |

4 |
A polymorphic type system
- Mycroft, O’Keefe
- 1983
(Show Context)
Citation Context ...ea of types in logic programming traces back as early as 1982, when [Bru82] suggested to add `useful redundancy' to logic programs in the form of mode and type declarations. In their classical paper, =-=[MO83]-=- adopted the outlook of [Mil78] that `well-typed programs do not go wrong', where welltyping is a well-formedness condition stated through inference rules. They proved for their ML-style type system, ... |

4 |
Tree automata: an informal survey, Currents in the Theory of Computing
- Thatcher
- 1973
(Show Context)
Citation Context ... completion are regular unary predicate logic programs [Yar87b], they can also be represented by finite automata [AHU74] (suggested by [Mis84]) as well as deterministic root-to-frontier tree automata =-=[Tha73]-=-. Note that regular sets are closed under intersection and tuple-distributive union (but not under union). Definition. Given a program P . The denotation of a ground type T in P is defined by [[T ]] P... |

3 | A polymorphic type system with subtypes for - Dietrich, Hagl - 1988 |

2 |
A polymorphic type checking system for Prolog
- Fruehwirth
- 1989
(Show Context)
Citation Context ...n subsection 4.1 we will define well-typing of a typed program as a condition on the type completed program. Type definitions are translated into unary HiLog predicates, a representation suggested in =-=[Fru89a]-=-. Definition. The type completion of a type definition of the form T ::= f 1 (T 1 1 ; : : : ; T 1 n1 ); : : : ; f k (T k 1 ; : : : ; T k nk ) is a set of parametric clauses defining the type predicate... |

2 | Untersuchungen zur mehrsortigen Quantorenlogik, Mathematische Annalen - Oberschlep - 1962 |

2 |
A type system for logic programs, Concurrent Prolog
- Yardeni, Shapiro
- 1987
(Show Context)
Citation Context ...ly order-sorted types. More recently, [YS87a, YS89] introduced the intuitive idea that a program is well-typed if its type declarations approximate the denotation of the program. It has been shown in =-=[YS87a]-=- that abstraction of the fixpoint semantics provides a useful and intuitive characterization of types and well-typing in logic programs. This choice of the notion of well-typing is the main factor tha... |