122 research outputs found

    Managing interlingual references - a type generic approach

    Get PDF
    This thesis presents a framework to make ubiquitous low level references between arbitrary constructs in source code given in arbitrary programming languages explicit. While the problems that arise due to these implicit interlingual references are well-known to practitioners, there is no adequate tool-based solution up to today. The reason is, that such a tool needs to be capable to analyze source code in many languages and that the choice of these languages is subject to the specific requirements of a project: The tool has to be parametric in the languages themselves. The concept of datatype generic programming, developed in the functional programming community in recent years, builds up on ideas from category theory and there are working implementations especially in the Haskell-community. This approach finally allows to write type-safe software engineering tools that can be reused for (i.e. parametrized by) many languages. After the presentation of the underlying machinery and its application to real-life software engineering, we define these implicit interlingual references as links between specific subtrees in abstract syntax trees of possibly different languages. The notion of consistency for such a pair is then the definition of a function that maps two arbitrary subterms to a Boolean value. Based on this definition, we develop a framework that allows to manage such references, i.e. we can define, check and adapt them in a type-safe way. Finally, we perform a case study that proves that our approach works for real life languages and projects. We highlight the contributions of this work in the field of tension between theory and application: A theme that often reoccurs in scientific software engineering is abstraction - we seek for solutions that are independent of application specific context. But software engineering is about engineering, thus there are real-life problems in real-life applications that have to be solved. That means we have to identify a practical problem, abstract from everything unnecessary, find a solution, and bring that solution back into practice. This is quite a long way, and especially the last step is often overseen. In our case, the practical problem is well known among practitioners. At the same time, the abstract theories of programming languages and the relations to the even more abstract realms of algebra and category theory are well known to computer scientists and mathematicians for a long time (the fixed point result of Lambek dates back to 1968). In this work, we start with the problem of inconsistencies between artifacts of a different kind. Because the underlying references are interlingual, we need a consistent formal framework to formulate the problem. We express the underlying artifacts as terms that are typed with some algebraic datatype. This is implemented using Haskell which has both algebraic datatypes and a lot of parsers and general infrastructure. To argue about references between terms of arbitrary algebraic datatypes, we need an accessible specification of the signatures themselves. Formally this specification of specifications can be expressed using category theory: The notion of a functor that specifies the structure of a datatype is central in this respect and we find the according implementation in Haskell under the term "datatype generic programming". We use this as the technical basis of the prototype. In summary, the contribution of this thesis is not only the development of a framework that solves a known problem in a quite complicated way (though we are not aware of other more promising solutions) but also an example of the complete way from a practical problem to the deep theoretical formalization and back again to a practical solution

    A programming logic based on type theory

    Get PDF

    The prospects for mathematical logic in the twenty-first century

    Get PDF
    The four authors present their speculations about the future developments of mathematical logic in the twenty-first century. The areas of recursion theory, proof theory and logic for computer science, model theory, and set theory are discussed independently.Comment: Association for Symbolic Logi

    Optimizing and Incrementalizing Higher-order Collection Queries by AST Transformation

    Get PDF
    In modernen, universellen Programmiersprachen sind Abfragen auf Speicher-basierten Kollektionen oft rechenintensiver als erforderlich. Während Datenbankenabfragen vergleichsweise einfach optimiert werden können, fällt dies bei Speicher-basierten Kollektionen oft schwer, denn universelle Programmiersprachen sind in aller Regel ausdrucksstärker als Datenbanken. Insbesondere unterstützen diese Sprachen meistens verschachtelte, rekursive Datentypen und Funktionen höherer Ordnung. Kollektionsabfragen können per Hand optimiert und inkrementalisiert werden, jedoch verringert dies häufig die Modularität und ist oft zu fehleranfällig, um realisierbar zu sein oder um Instandhaltung von entstandene Programm zu gewährleisten. Die vorliegende Doktorarbeit demonstriert, wie Abfragen auf Kollektionen systematisch und automatisch optimiert und inkrementalisiert werden können, um Programmierer von dieser Last zu befreien. Die so erzeugten Programme werden in derselben Kernsprache ausgedrückt, um weitere Standardoptimierungen zu ermöglichen. Teil I entwickelt eine Variante der Scala API für Kollektionen, die Staging verwendet um Abfragen als abstrakte Syntaxbäume zu reifizieren. Auf Basis dieser Schnittstelle werden anschließend domänenspezifische Optimierungen von Programmiersprachen und Datenbanken angewandt; unter anderem werden Abfragen umgeschrieben, um vom Programmierer ausgewählte Indizes zu benutzen. Dank dieser Indizes kann eine erhebliche Beschleunigung der Ausführungsgeschwindigkeit gezeigt werden; eine experimentelle Auswertung zeigt hierbei Beschleunigungen von durchschnittlich 12x bis zu einem Maximum von 12800x. Um Programme mit Funktionen höherer Ordnung durch Programmtransformation zu inkrementalisieren, wird in Teil II eine Erweiterung der Finite-Differenzen-Methode vorgestellt [Paige and Koenig, 1982; Blakeley et al., 1986; Gupta and Mumick, 1999] und ein erster Ansatz zur Inkrementalisierung durch Programmtransformation für Programme mit Funktionen höherer Ordnung entwickelt. Dabei werden Programme zu Ableitungen transformiert, d.h. zu Programmen die Eingangsdifferenzen in Ausgangdifferenzen umwandeln. Weiterhin werden in den Kapiteln 12–13 die Korrektheit des Inkrementalisierungsansatzes für einfach-getypten und ungetypten λ-Kalkül bewiesen und Erweiterungen zu System F besprochen. Ableitungen müssen oft Ergebnisse der ursprünglichen Programme wiederverwenden. Um eine solche Wiederverwendung zu ermöglichen, erweitert Kapitel 17 die Arbeit von Liu and Teitelbaum [1995] zu Programmen mit Funktionen höherer Ordnung und entwickeln eine Programmtransformation solcher Programme im Cache-Transfer-Stil. Für eine effiziente Inkrementalisierung ist es weiterhin notwendig, passende Grundoperationen auszuwählen und manuell zu inkrementalisieren. Diese Arbeit deckt einen Großteil der wichtigsten Grundoperationen auf Kollektionen ab. Die Durchführung von Fallstudien zeigt deutliche Laufzeitverbesserungen sowohl in Praxis als auch in der asymptotischen Komplexität.In modern programming languages, queries on in-memory collections are often more expensive than needed. While database queries can be readily optimized, it is often not trivial to use them to express collection queries which employ nested data and first-class functions, as enabled by functional programming languages. Collection queries can be optimized and incrementalized by hand, but this reduces modularity, and is often too error-prone to be feasible or to enable maintenance of resulting programs. To free programmers from such burdens, in this thesis we study how to optimize and incrementalize such collection queries. Resulting programs are expressed in the same core language, so that they can be subjected to other standard optimizations. To enable optimizing collection queries which occur inside programs, we develop a staged variant of the Scala collection API that reifies queries as ASTs. On top of this interface, we adapt domain-specific optimizations from the fields of programming languages and databases; among others, we rewrite queries to use indexes chosen by programmers. Thanks to the use of indexes we show significant speedups in our experimental evaluation, with an average of 12x and a maximum of 12800x. To incrementalize higher-order programs by program transformation, we extend finite differencing [Paige and Koenig, 1982; Blakeley et al., 1986; Gupta and Mumick, 1999] and develop the first approach to incrementalization by program transformation for higher-order programs. Base programs are transformed to derivatives, programs that transform input changes to output changes. We prove that our incrementalization approach is correct: We develop the theory underlying incrementalization for simply-typed and untyped λ-calculus, and discuss extensions to System F. Derivatives often need to reuse results produced by base programs: to enable such reuse, we extend work by Liu and Teitelbaum [1995] to higher-order programs, and develop and prove correct a program transformation, converting higher-order programs to cache-transfer-style. For efficient incrementalization, it is necessary to choose and incrementalize by hand appropriate primitive operations. We incrementalize a significant subset of collection operations and perform case studies, showing order-of-magnitude speedups both in practice and in asymptotic complexity

    Tractable Ontology-Mediated Query Answering with Datatypes

    Get PDF
    Adding datatypes to ontology-mediated queries (OMQs) often makes query answering hard, even for lightweight languages. As a consequence, the use of datatypes in ontologies, e.g. in OWL 2 QL, has been severely restricted. We propose a new, non-uniform, way of analyzing the data-complexity of OMQ answering with datatypes. Instead of restricting the ontology language we aim at a classification of the patterns of datatype atoms in OMQs into those that can occur in non-tractable OMQs and those that only occur in tractable OMQs. To this end we establish a close link between OMQ answering with datatypes and constraint satisfaction problems (CSPs) over the datatypes. Given that query answering in this setting is undecidable in general already for very simple datatypes, we introduce, borrowing from the database literature, a property of OMQs called the Bounded Match Depth Property (BMDP). We apply the link to CSPs– using results and techniques in universal algebra and model theory–to prove PTIME/co-NP dichotomies for OMQs with the BDMP over Horn-ALCHI extended with (1) all finite datatypes, (2) rational numbers with linear order and (3) certain families of datatypes over the integers with the successor relation

    Foundations of Software Science and Computation Structures

    Get PDF
    This open access book constitutes the proceedings of the 23rd International Conference on Foundations of Software Science and Computational Structures, FOSSACS 2020, which took place in Dublin, Ireland, in April 2020, and was held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2020. The 31 regular papers presented in this volume were carefully reviewed and selected from 98 submissions. The papers cover topics such as categorical models and logics; language theory, automata, and games; modal, spatial, and temporal logics; type theory and proof theory; concurrency theory and process calculi; rewriting theory; semantics of programming languages; program analysis, correctness, transformation, and verification; logics of programming; software specification and refinement; models of concurrent, reactive, stochastic, distributed, hybrid, and mobile systems; emerging models of computation; logical aspects of computational complexity; models of software security; and logical foundations of data bases.
    • …
    corecore