Results 1 -
8 of
8
Type Constraint Solving for Parametric and Ad-hoc Polymorphism
, 1999
"... . Unification has long been used as a mechanism for type checking and type inference for Hindley-Milner types in functional programming. The programmer defines the possible types, and the compiler uses unification to check and infer types for function definitions. In constraint logic programming it ..."
Abstract
-
Cited by 14 (7 self)
- Add to MetaCart
. Unification has long been used as a mechanism for type checking and type inference for Hindley-Milner types in functional programming. The programmer defines the possible types, and the compiler uses unification to check and infer types for function definitions. In constraint logic programming it is natural to extend the functional programming case by allowing overloading of predicate and function definitions, that is, ad-hoc polymorphism. Mycroft and O'Keefe showed how to check predicate type declarations under these assumptions. In this paper, we show how to infer predicate types, by translating a constraint logic program with given types into a logic program over types. The program can then be used to check and infer the possible types for the predicates and variables appearing in the original program. Since executing the translated program can be inefficient when there are highly disjunctive type definitions, we use methods of propagation based constraint solving and memoing to ...
On the Use of Types in Logic Programming
, 1996
"... In procedural and functional languages it is rather clear what a type error is and the main purpose of typing is to detect programming errors automatically. Furthermore, in these languages the semantics of a program is usually independent of types. Type systems for logic programming languages differ ..."
Abstract
-
Cited by 4 (2 self)
- Add to MetaCart
In procedural and functional languages it is rather clear what a type error is and the main purpose of typing is to detect programming errors automatically. Furthermore, in these languages the semantics of a program is usually independent of types. Type systems for logic programming languages differ considerably on these aspects. We will show that these differences lead to several theoretical and practical problems. The mixture of static type checking purposes on the one hand and computations with type constraints in the CLP(X) style on the other hand will be marked as the central source of problems. As a solution we propose a typing scheme which separates these issues. We distinguish three almost independent dimensions of types in logic programming: types as approximations, types as constraints and types for proving partial correctness. Based on the notion of useless expressions, we develop a method that allows static program analysis for finding type errors, which enables error detec...
Debugging Prolog Using Annotations
, 2000
"... We present an annotation language well-suited for rendering aspects of Prolog execution. Our annotations are special Prolog goals that act as executable comments, performing debugging at run-time. No restrictions are placed upon the object language, the concern being verification of (full) Standard ..."
Abstract
-
Cited by 3 (1 self)
- Add to MetaCart
We present an annotation language well-suited for rendering aspects of Prolog execution. Our annotations are special Prolog goals that act as executable comments, performing debugging at run-time. No restrictions are placed upon the object language, the concern being verification of (full) Standard Prolog programs. Here we discuss the merits of the annotations for Prolog debugging. All the examples are actual runs of our system, Nope.
A Generic Type System for CLP(X)
- Ecole Normale Superieure LIENS
, 1997
"... We propose a generic static type system for Constraint Logic Programming including subtyping and parametric polymorphism. The first aim of this prescriptive type system is to detect type errors statically in CLP programs. The system introduces a type discipline on the way CLP programs and libraries ..."
Abstract
-
Cited by 3 (3 self)
- Add to MetaCart
We propose a generic static type system for Constraint Logic Programming including subtyping and parametric polymorphism. The first aim of this prescriptive type system is to detect type errors statically in CLP programs. The system introduces a type discipline on the way CLP programs and libraries can be composed, while still maintaining the ability to type meta-programming predicates, thanks to the flexibility of subtyping. We show that subject reduction holds under very general assumptions. We give a polynomial-time algorithm for type checking, and we indicate that type inference for variables and predicates is possible in the universe of infinite regular types, but is an open problem in the universe of finite types. 1 Introduction The class of Constraint Logic Programming languages, CLP(X ), as introduced by Jaffar and Lassez [18], is a class of programming languages based on the logic programming paradigm, parametrized by some mathematical structure X , the domain of discourse. C...
Typing Constraint Logic Programs
"... We present a prescriptive type system with parametric polymorphism and subtyping for constraint logic programs. The aim of this type system is to detect programming errors statically. It introduces a type discipline for constraint logic programs and modules, while maintaining the capabilities of per ..."
Abstract
-
Cited by 2 (1 self)
- Add to MetaCart
We present a prescriptive type system with parametric polymorphism and subtyping for constraint logic programs. The aim of this type system is to detect programming errors statically. It introduces a type discipline for constraint logic programs and modules, while maintaining the capabilities of performing the usual coercions between constraint domains, and of typing meta-programming predicates, thanks to the exibility of subtyping. The property of subject reduction expresses the consistency of a prescriptive type system w.r.t. the execution model: if a program is \well-typed", then all derivations starting from a \well-typed" goal are again \well-typed". That property is proved w.r.t. the abstract execution model of constraint programming which proceeds by accumulation of constraints only, and w.r.t. an enriched execution model with type constraints for substitutions. We describe our implementation of the system for type checking and type inference. We report our experimental results on type checking ISO-Prolog, the (constraint) libraries of Sicstus Prolog and other Prolog programs.
Annotations for Prolog -- A concept and runtime handling
- LOPSTR'99: 9th Int. Workshop on Logic-based Program Synthesis and Transformation, Venezia, volume 1817 of LNCS
, 2000
"... Abstract. A concept of annotations for rendering procedural aspects of Prolog is presented, built around wellknown procedural concepts of Standard Prolog. Annotations describe properties of predicates. Such properties can be pre or post conditions, which must hold true when a predicate is called or ..."
Abstract
-
Cited by 2 (2 self)
- Add to MetaCart
Abstract. A concept of annotations for rendering procedural aspects of Prolog is presented, built around wellknown procedural concepts of Standard Prolog. Annotations describe properties of predicates. Such properties can be pre or post conditions, which must hold true when a predicate is called or exited, respectively. Our concept transcends pre/post conditions: we introduce two more kinds of annotations, fail and redo annotations, hence incorporating a whole model of Prolog execution into our language. This enables natural rendering of many procedural properties of Prolog which cannot be expressed with only pre/post conditions. There are four more novelties in our approach. First, any annotation can be “narrowed down ” to a subset of calls, via templates and contexts, giving much more flexible assertions. Notably the novel idea of calling context adds significant expressive power, as a bridge towards program-point assertions. The annotations are defined simply as Prolog goals, making them fully parametric and therefore very comfortable for debugging. Finally, the annotations are applied via a general kind of matching instead of unification, enabling the use of local variables. All examples presented here are actual runs of our system Nope, which is a Prolog module. 1
Typed Constraint Logic Programs: checking domain coercions and metaprograms through subtyping
"... We propose a general prescriptive type system with parametric polymorphism and subtyping for constraint logic programs. The aim of this type system is to detect programming errors statically. It introduces a type discipline for constraint logic programs and modules, while maintaining the capabilitie ..."
Abstract
- Add to MetaCart
We propose a general prescriptive type system with parametric polymorphism and subtyping for constraint logic programs. The aim of this type system is to detect programming errors statically. It introduces a type discipline for constraint logic programs and modules, while maintaining the capabilities of performing the usual coercions between constraint domains and of typing meta-programming predicates, thanks to the flexibility of subtyping. The property of subject reduction expresses the consistency of the type system w.r.t. the execution model: if a program is "well-typed", then all derivations starting in a "well-typed" goal are again "well-typed". That property is proved w.r.t. the abstract execution model of constraint programming which proceeds by accumulation of constraints. We describe our implementation of the system for type checking and type inference. We report our experimental results on type checking the libraries of Sicstus Prolog and other Prolog programs....

