An Implementation of the Language Lambda Prolog Organized around Higher-Order Pattern Unification
نویسنده
چکیده
The automation of meta-theoretic aspects of formal systems typically requires the treatment of syntactically complex objects. Thus, programs must be represented and manipulated by program development systems, mathematical expressions by computer-based algebraic systems, and logic formulas and proofs by automatic proof systems and proof assistants. The notion of bound variables plays an important role in the structures of such syntactic objects, and should therefore be reflected in their representations and properly accounted for in their manipulation. The λ-calculus was designed specifically to treat binding in a logically precise way and the terms of such a calculus turn out to be an especially suitable representational device for the application tasks of interest. Moreover, the equality relation associated with these terms and the accompanying notion of higher-order unification leads to a convenient means for analyzing and decomposing these representations in a way that respects the binding structure inherent in the formal objects. This thesis concerns the language λProlog that has been designed to provide support for the kinds of meta-programming tasks discussed above. In its essence, λProlog is a logic programming language that builds on a conventional language like Prolog by using typed λ-terms instead of first-order terms as data structures, by using higher-order unification rather than first-order unification to manipulate these data structures and by including new devices for restricting the scopes of names and of code and thereby providing the basis for realizing recursion over binding constructs. These features make λProlog a convenient programming vehicle in the domain of interest. However, they also raise significant implementation questions that must be addressed adequately if the language is to be an effective tool in these contexts. It is this task that is undertaken in this thesis. An efficient implementation of λProlog can potentially exploit the processing structure that has been previously designed for realizing Prolog. In this context, the main new issue to be treated becomes that of higher order unification. This computation has characteristics that make it difficult to embed it effectively within a low-level implementation: higher-order unification is in general undecidable, it does not admit a notion of most general unifiers and a branching search is involved in the task of looking for unifiers. However, a sub-class of this computation that is referred to as Lλ or higher-order pattern unification has been discovered that is substantially better behaved: in particular, for this class, unification is decidable, most general unifiers exist and a deterministic unification procedure can be provided. This class is also interesting from a programming point-of-view: most natural computations i carried out using λProlog fall within it. Finally, a treatment of full higher-order unification within the context of λProlog can be realized by solving only higher-order pattern unification problems at intermediate stages, delaying any branching and possibly costly search to the end of the computation. This thesis examines the use of the strategy described above in providing an implementation of λProlog . In particular, it develops a new virtual machine and compilation based scheme for the language by embedding a higher-order pattern unification algorithm due to Nadathur and Linnell within the well-known Warren Abstract Machine model for Prolog. In executing this idea, it exposes and treats various auxiliary issues such as the low-level representation of λ-terms, the implementation of reduction on such terms, the optimized processing of types in computation and the representation of unification problems whose solution must be deferred till a later point in computation. Another important component of this thesis is the development of an actual implementation of λProlog—called Teyjus Version 2—that is based on the conceptual design that is presented. This system contains an emulator for the virtual machine that is written in the C language for efficiency and a compiler that is written in the OCaml language so as to enhance readability and extensibility. This mix of languages within one system raises interesting software issues that are handled. Portability across architectures for the emulator is also treated by developing a modular mapping from term representation to actual machine structures. A final contribution of the thesis is an assessment of the efficacy of the various design ideas through experiments carried out with the assistance of the system.
منابع مشابه
An Overview of Lambda-PROLOG
λ-Prolog is a logic programming language that extends Prolog by incorporating notions of higher-order functions, λ-terms, higher-order unification, polymorphic types, and mechanisms for building modules and secure abstract data types. These new features are provided in a principled fashion by extending the classical first-order theory of Horn clauses to the intuitionistic higher-order theory of...
متن کاملA treatment of higher-order features in logic programming
The logic programming paradigm provides the basis for a new intensional view of higherorder notions. This view is realized primarily by employing the terms of a typed lambda calculus as representational devices and by using a richer form of unification for probing their structures. These additions have important meta-programming applications but they also pose non-trivial implementation problem...
متن کاملLambda-Prolog: An Extended Logic Programming Language
The logic programming language AProlog is an extension of conventional Prolog in several different directions. These extensions provide higher-order functions, A-terms, a polymorphic typing discipline, modules, and a mechanism for providing secure abstract datatypes. Our original goal in developing AProlog was to understand the essential logical and proof theoretic nature of these extensions. T...
متن کاملA Colored Version of the λ-Calculus
Rippling is a technique developed for inductive theorem proving which uses syntactic differences of terms to guide the proof search. Annotations (like colors) to terms are used to maintain this information. This technique has several advantages, e.g. it is highly goal oriented and involves little search. In this paper we give a general formalisation of coloring terms in a higher-order setting. ...
متن کاملUsing Higher-Order Logic Programming for Semantic Interpretation of Coordinate Constructs
Many theories of semantic interpretation use λ-term manipulation to compositionally compute the meaning of a sentence. These theories are usually implemented in a language such as Prolog that can simulate λ-term operations with first-order unification. However, for some interesting cases, such as a Combinatory Categorial Grammar account of coordination constructs, this can only be done by obscu...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- CoRR
دوره abs/0911.5203 شماره
صفحات -
تاریخ انتشار 2009