29 research outputs found

    Offline Specialisation in Prolog Using a Hand-Written Compiler Generator

    No full text
    The so called "cogen approach" to program specialisation, writing a compiler generator instead of a specialiser, has been used with considerable success in partial evaluation of both functional and imperative languages. This paper demonstrates that the "cogen" approach is also applicable to the specialisation of logic programs (called partial deduction when applied to pure logic programs) and leads to effective specialisers. Moreover, using good binding-time annotations, the speed-ups of the specialised programs are comparable to the speed-ups obtained with online specialisers. The paper first develops a generic approach to offline partial deduction and then a specific offline partial deduction method, leading to the offline system LIX for pure logic programs. While this is a usable specialiser by itself, its specialisation strategy is used to develop the "cogen" system LOGEN. Given a program, a specification of what inputs will be static, and an annotation specifying which calls should be unfolded, LOGEN generates a specialised specialiser for the program at hand. Running this specialiser with particular values for the static inputs results in the specialised program. While this requires two steps instead of one, the efficiency of the specialisation process is improved in situations where the same program is specialised multiple times. The paper also presents and evaluates an automatic binding-time analysis that is able to derive the annotations. While the derived annotations are still suboptimal compared to hand-crafted ones, they enable non-expert users to use the LOGEN system in a fully automated way Finally, LOGEN is extended so as to directly support a large part of Prolog's declarative and non-declarative features and so as to be able to perform so called mixline specialisations. In mixline specialisation some unfolding decisions depend on the outcome of tests performed at specialisation time instead of being hardwired into the specialiser

    Logic Programming: Context, Character and Development

    Get PDF
    Logic programming has been attracting increasing interest in recent years. Its first realisation in the form of PROLOG demonstrated concretely that Kowalski's view of computation as controlled deduction could be implemented with tolerable efficiency, even on existing computer architectures. Since that time logic programming research has intensified. The majority of computing professionals have remained unaware of the developments, however, and for some the announcement that PROLOG had been selected as the core language for the Japanese 'Fifth Generation' project came as a total surprise. This thesis aims to describe the context, character and development of logic programming. It explains why a radical departure from existing software practices needs to be seriously discussed; it identifies the characteristic features of logic programming, and the practical realisation of these features in current logic programming systems; and it outlines the programming methodology which is proposed for logic programming. The problems and limitations of existing logic programming systems are described and some proposals for development are discussed. The thesis is in three parts. Part One traces the development of programming since the early days of computing. It shows how the problems of software complexity which were addressed by the 'structured programming' school have not been overcome: the software crisis remains severe and seems to require fundamental changes in software practice for its solution. Part Two describes the foundations of logic programming in the procedural interpretation of Horn clauses. Fundamental to logic programming is shown to be the separation of the logic of an algorithm from its control. At present, however, both the logic and the control aspects of logic programming present problems; the first in terms of the extent of the language which is used, and the second in terms of the control strategy which should be applied in order to produce solutions. These problems are described and various proposals, including some which have been incorporated into implemented systems, are described. Part Three discusses the software development methodology which is proposed for logic programming. Some of the experience of practical applications is related. Logic programming is considered in the aspects of its potential for parallel execution and in its relationship to functional programming, and some possible criticisms of the problem-solving potential of logic are described. The conclusion is that although logic programming inevitably has some problems which are yet to be solved, it seems to offer answers to several issues which are at the heart of the software crisis. The potential contribution of logic programming towards the development of software should be substantial

    Extensible Languages for Flexible and Principled Domain Abstraction

    Get PDF
    Die meisten Programmiersprachen werden als Universalsprachen entworfen. UnabhĂ€ngig von der zu entwickelnden Anwendung, stellen sie die gleichen Sprachfeatures und Sprachkonstrukte zur VerfĂŒgung. Solch universelle Sprachfeatures ignorieren jedoch die spezifischen Anforderungen, die viele Softwareprojekte mit sich bringen. Als Gegenkraft zu Universalsprachen fördern domĂ€nenspezifische Programmiersprachen, modellgetriebene Softwareentwicklung und sprachorientierte Programmierung die Verwendung von DomĂ€nenabstraktion, welche den Einsatz von domĂ€nenspezifischen Sprachfeatures und Sprachkonstrukten ermöglicht. Insbesondere erlaubt DomĂ€nenabstraktion Programmieren auf dem selben Abstraktionsniveau zu programmieren wie zu denken und vermeidet dadurch die Notwendigkeit DomĂ€nenkonzepte mit universalsprachlichen Features zu kodieren. Leider ermöglichen aktuelle AnsĂ€tze zur DomĂ€nenabstraktion nicht die Entfaltung ihres ganzen Potentials. Einerseits mangelt es den AnsĂ€tzen fĂŒr interne domĂ€nenspezifische Sprachen an FlexibilitĂ€t bezĂŒglich der Syntax, statischer Analysen, und WerkzeugunterstĂŒtzung, was das tatsĂ€chlich erreichte Abstraktionsniveau beschrĂ€nkt. Andererseits mangelt es den AnsĂ€tzen fĂŒr externe domĂ€nenspezifische Sprachen an wichtigen Prinzipien, wie beispielsweise modularem Schließen oder Komposition von DomĂ€nenabstraktionen, was die Anwendbarkeit dieser AnsĂ€tze in der Entwicklung grĂ¶ĂŸerer Softwaresysteme einschrĂ€nkt. Wir verfolgen in der vorliegenden Doktorarbeit einen neuartigen Ansatz, welcher die Vorteile von internen und externen domĂ€nenspezifischen Sprachen vereint um flexible und prinzipientreue DomĂ€nenabstraktion zu unterstĂŒtzen. Wir schlagen bibliotheksbasierte erweiterbare Programmiersprachen als Grundlage fĂŒr DomĂ€nenabstraktion vor. In einer erweiterbaren Sprache kann DomĂ€nenabstraktion durch die Erweiterung der Sprache mit domĂ€nenspezifischer Syntax, statischer Analyse, und WerkzeugunterstĂŒtzung erreicht werden . Dies ermöglicht DomĂ€nenabstraktionen die selbe FlexibilitĂ€t wie externe domĂ€nenspezifische Sprachen. Um die Einhaltung ĂŒblicher Prinzipien zu gewĂ€hrleisten, organisieren wir Spracherweiterungen als Bibliotheken und verwenden einfache Import-Anweisungen zur Aktivierung von Erweiterungen. Dies erlaubt modulares Schließen (durch die Inspektion der Import-Anweisungen), unterstĂŒtzt die Komposition von DomĂ€nenabstraktionen (durch das Importieren mehrerer Erweiterungen), und ermöglicht die uniforme Selbstanwendbarkeit von Spracherweiterungen in der Entwicklung zukĂŒnftiger Erweiterungen (durch das Importieren von Erweiterungen in einer Erweiterungsdefinition). Die Organisation von Erweiterungen in Form von Bibliotheken ermöglicht DomĂ€nenabstraktionen die selbe Prinzipientreue wie interne domĂ€nenspezifische Sprachen. Wir haben die bibliotheksbasierte erweiterbare Programmiersprache SugarJ entworfen und implementiert. SugarJ Bibliotheken können Erweiterungen der Syntax, der statischen Analyse, und der WerkzeugunterstĂŒtzung von SugarJ deklarieren. Eine syntaktische Erweiterung besteht dabei aus einer erweiterten Syntax und einer Transformation der erweiterten Syntax in die Basissyntax von SugarJ. Eine Erweiterung der Analyse testet Teile des abstrakten Syntaxbaums der aktuellen Datei und produziert eine Liste von Fehlern. Eine Erweiterung der WerkzeugunterstĂŒtzung deklariert Dienste wie SyntaxfĂ€rbung oder CodevervollstĂ€ndigung fĂŒr bestimmte Sprachkonstrukte. SugarJ Erweiterungen sind vollkommen selbstanwendbar: Eine erweiterte Syntax kann in eine Erweiterungsdefinition transformiert werden, eine erweiterte Analyse kann Erweiterungsdefinitionen testen, und eine erweiterte WerkzeugunterstĂŒtzung kann Entwicklern beim Definieren von Erweiterungen assistieren. Um eine Quelldatei mit Erweiterungen zu verarbeiten, inspizieren der SugarJ Compiler und die SugarJ IDE die importierten Bibliotheken um die aktiven Erweiterungen zu bestimmen. Der Compiler und die IDE adaptieren den Parser, den Codegenerator, die Analyseroutine und die WerkzeugunterstĂŒtzung der Quelldatei entsprechend der aktiven Erweiterungen. Wir beschreiben in der vorliegenden Doktorarbeit nicht nur das Design und die Implementierung von SugarJ, sondern berichten darĂŒber hinaus ĂŒber Erweiterungen unseres ursprĂŒnglich Designs. Insbesondere haben wir eine Generalisierung des SugarJ Compilers entworfen und implementiert, die neben Java alternative Basissprachen unterstĂŒtzt. Wir haben diese Generalisierung verwendet um die bibliotheksbasierten erweiterbaren Programmiersprachen SugarHaskell, SugarProlog, und SugarFomega zu entwickeln. Weiterhin haben wir SugarJ ergĂ€nzt um polymorphe DomĂ€nenabstraktion und KommunikationsintegritĂ€t zu unterstĂŒtzen. Polymorphe DomĂ€nenabstraktion ermöglicht Programmierern mehrere Transformationen fĂŒr die selbe domĂ€nenspezifische Syntax bereitzustellen. Dies erhöht die FlexibilitĂ€t von SugarJ und unterstĂŒtzt bekannte Szenarien aus der modellgetriebenen Entwicklung. KommunikationsintegritĂ€t spezifiziert, dass die Komponenten eines Softwaresystems nur ĂŒber explizite KanĂ€le kommunizieren dĂŒrfen. Im Kontext von Codegenerierung stellt dies eine interessante Eigenschaft dar, welche die Generierung von impliziten ModulabhĂ€ngigkeiten untersagt. Wir haben KommunikationsintegritĂ€t als weiteres Prinzip zu SugarJ hinzugefĂŒgt. Basierend auf SugarJ und zahlreicher Fallstudien argumentieren wir, dass flexible und prinzipientreue DomĂ€nenabstraktion ein skalierbares Programmiermodell fĂŒr die Entwicklung komplexer Softwaresysteme darstellt

    DYNAMIC LANGUAGE UPDATING

    Get PDF
    With respect to traditional systems, language interpreters are hard to evolve and the adoption of evolved languages is slow. Language evolution is hindered by the fact that their implementations often overlook design principles, especially those related to modularity. Consequently, language implementations and their updates are monolithic. Language evolution often breaks the backward compatibility and requires developers to rewrite their applications. Furthermore, there is little or no support to evolve language interpreters at runtime. This would be useful for systems that cannot be shut down and to support context-aware interpreters. To tackle these issues, we designed the concept of open interpreters which provide support for language evolution through reflection. Open interpreters allow one to partially update a language to maintain the backward compatibility. Furthermore, they allow one to dynamically update a language without stopping the overlying application. Open interpreters can be dynamically tailored on the task to be solved. The peculiarity of this approach is that the evolution code is completely separated from the application or the original interpreter code. In this dissertation we define the concept of open interpreters, we design a possible implementation model, we describe a prototype implantation and provide the proof-of-concept examples applied to various domains

    Metalevel and reflexive extension in mechanical theorem proving

    Get PDF
    In spite of many years of research into mechanical assistance for mathematics it is still much more difficult to construct a proof on a machine than on paper. Of course this is partly because, unlike a proof on paper, a machine checked proof must be formal in the strictest sense of that word, but it is also because usually the ways of going about building proofs on a machine are limited compared to what a mathematician is used to. This thesis looks at some possible extensions to the range of tools available on a machine that might lend a user more flexibility in proving theorems, complementing whatever is already available.In particular, it examines what is possible in a framework theorem prover. Such a system, if it is configured to prove theorems in a particular logic T, must have a formal description of the proof theory of T written in the framework theory F of the system. So it should be possible to use whatever facilities are available in F not only to prove theorems of T, but also theorems about T that can then be used in their turn to aid the user in building theorems of T.The thesis is divided into three parts. The first describes the theory FS₀, which has been suggested by Feferman as a candidate for a framework theory suitable for doing meta-theory. The second describes some experiments with FS₀, proving meta-theorems. The third describes an experiment in extending the theory PRA, declared in FS₀, with a reflection facility.More precisely, in the second section three theories are formalised: propositional logic, sorted predicate logic, and the lambda calculus (with a deBruijn style binding). For the first two the deduction theorem and the prenex normal form theorem are respectively proven. For the third, a relational definition of beta-reduction is replaced with an explicit function.In the third section, a method is proposed for avoiding the work involved in building a full Godel style proof predicate for a theory. It is suggested that the language be extended with quotation and substitution facilities directly, instead of providing them as definitional extensions. With this, it is possible to exploit an observation of Solovay's that the Lob derivability conditions are sufficient to capture the schematic behaviour of a proof predicate. Combining this with a reflection schema is enough to produce a non-conservative extension of PRA, and this is demonstrated by some experiments

    Extensions of nominal terms

    Get PDF
    This thesis studies two major extensions of nominal terms. In particular, we study an extension with -abstraction over nominal unknowns and atoms, and an extension with an arguably better theory of freshness and -equivalence. Nominal terms possess two levels of variable: atoms a represent variable symbols, and unknowns X are `real' variables. As a syntax, they are designed to facilitate metaprogramming; unknowns are used to program on syntax with variable symbols. Originally, the role of nominal terms was interpreted narrowly. That is, they were seen solely as a syntax for representing partially-speci ed abstract syntax with binding. The main motivation of this thesis is to extend nominal terms so that they can be used for metaprogramming on proofs, programs, etc. and not just for metaprogramming on abstract syntax with binding. We therefore extend nominal terms in two signi cant ways: adding -abstraction over nominal unknowns and atoms| facilitating functional programing|and improving the theory of -equivalence that nominal terms possesses. Neither of the two extensions considered are trivial. The capturing substitution action of nominal unknowns implies that our notions of scope, intuited from working with syntax possessing a non-capturing substitution, such as the -calculus, is no longer applicable. As a result, notions of -abstraction and -equivalence must be carefully reconsidered. In particular, the rst research contribution of this thesis is the two-level - calculus, intuitively an intertwined pair of -calculi. As the name suggests, the two-level -calculus has two level of variable, modelled by nominal atoms and unknowns, respectively. Both levels of variable can be -abstracted, and requisite notions of -reduction are provided. The result is an expressive context-calculus. The traditional problems of handling -equivalence and the failure of commutation between instantiation and -reduction in context-calculi are handled through the use of two distinct levels of variable, swappings, and freshness side-conditions on unknowns, i.e. `nominal technology'. The second research contribution of this thesis is permissive nominal terms, an alternative form of nominal term. They retain the `nominal' rst-order avour of nominal terms (in fact, their grammars are almost identical) but forego the use of explicit freshness contexts. Instead, permissive nominal terms label unknowns with a permission sort, where permission sorts are in nite and coin nite sets of atoms. This in nite-coin nite nature means that permissive nominal terms recover two properties|we call them the `always-fresh' and `always-rename' properties that nominal terms lack. We argue that these two properties bring the theory of -equivalence on permissive nominal terms closer to `informal practice'. The reader may consider -abstraction and -equivalence so familiar as to be `solved problems'. The work embodied in this thesis stands testament to the fact that this isn't the case. Considering -abstraction and -equivalence in the context of two levels of variable poses some new and interesting problems and throws light on some deep questions related to scope and binding
    corecore