A Framework for Defining Declarative Languages by Feryal Fulya Horozal
Total Page:16
File Type:pdf, Size:1020Kb
A Framework for Defining Declarative Languages by Feryal Fulya Horozal A thesis submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy in Computer Science Approved, Thesis Committee Prof. Dr. Michael Kohlhase, Jacobs University Bremen (Chair) Prof. Dr. Dieter Hutter, Bremen University Prof. Dr. Herbert J¨ager,Jacobs University Bremen Prof. Dr. Till Mossakowski, Otto-von-Guericke University of Magdeburg Prof. Dr. Carsten Sch¨urmann,IT University of Copenhagen Date of Defense: November 14, 2014 Engineering and Science Statutory Declaration I, Feryal Fulya Horozal, hereby declare that I have written this PhD thesis indepen- dently, unless where clearly stated otherwise. I have used only the sources, the data and the support that I have clearly mentioned. This PhD thesis has not been submitted for conferral of degree elsewhere. The main research problems addressed by this work stem from close collaboration with the members of the LATIN project [KMR09, CHK+11], in particular, with Florian Rabe, Michael Kohlhase, Till Mossakowski and Mihai Codescu. Parts of this thesis are based on or closely related to previously published mate- rial or material that is prepared for publication at the time of this writing. These are [HR11], [HR12], [HKR12] and [HRK14]. Bremen, 31.08.2014 Abstract Declarative languages are an important family of formalisms used for formal knowledge representation in computer science. Examples include logics, type theories, set theories, specification languages and ontology languages. Despite the vast variety of declarative languages, they share a common structure: A possibly infinite collection of theories, which are sets of declarations, and a set of well-formed expressions over each theory. In fact, we can use this common structure as the defining characteristics of declarative languages. Logical frameworks are abstract formalisms that have been introduced for representing declarative languages and for studying their properties. In particular, they can be used to relate and combine different declarative languages. A key challenge in designing logical frameworks is that they should be capable of generalizing concepts, algorithms and the- orems about declarative languages while using as simple and yet expressive primitives as possible. Abstract logical frameworks, such as institutions, work with abstract categories. This has the advantage that the framework is independent of the structure of the particular declarative language; thus theory-related concepts such as model classes and satisfaction can be formulated generically. Declarative logical frameworks, such as LF, on the other hand, represent each individ- ual theory of a declarative language as a theory of the framework. This makes it easy to provide generic tool support for concrete theories. However, they do not have an abstract concept to represent the infinite collection of theories, and therefore, they cannot reason about or operate on arbitrary theories. This PhD thesis contributes to the design of declarative logical frameworks that bal- ances the trade-off between abstract and concrete representations. In particular, we iden- tify a new feature that can be added to a declarative framework as a language primitive: declaration patterns. The main idea behind this feature is to capture the common structure of the theories of declarative languages. More precisely, we exploit the observation that theories consist of a list of declarations each of which must conform to one out of a few patterns fixed by the declarative language. For instance, first-order logic has three such patterns: one each for the declaration of (i) function symbols, (ii) predicate symbols and (iii) axioms. We reify declaration patterns as a language primitive for declarative logical frameworks. While frameworks like LF focus on defining the logical symbols and the expressions, declaration patterns characterize the legal declarations of non-logical symbols by specifying their syntactic shape. Declaration patterns also prove crucial for language translations. We introduce a notion of pattern- based translation, which maps legal theories of one declarative language to legal theories of the other language. We introduce these novel notions in a calculus-based meta-framework for defining declarative languages and translations between them. Our meta-framework is independent of the underlying declarative logical framework and can be instantiated with specific logical frameworks like LF. In particular we develop a new declarative logical framework LFS (LF with sequences) that supports sequences and dependent function spaces that take sequence arguments. LFS proves very useful for defining mathematical operators of flexible arity and ellipses, which we need for writing down the declaration patterns of most declarative languages. We apply and evaluate our pattern-based approach in an atlas of declarative languages, which includes various logics ranging from traditional first-order logic to more complex languages such as polymorphic higher order logic. iii Acknowledgements Hereby I would like to thank my supervisor, Michael Kohlhase, for providing me with a challenging and inspiring research topic and for making it possible for me to pursue it in a very friendly atmosphere in his research group. I am most grateful to him for giving me the freedom to explore different ideas and for his continued encouragement, advice, patience and support in every stage of my thesis. I am profoundly indebted to Florian Rabe, whose expert insights and guidance have been crucial in shaping my path to achieve this work. I am very grateful to him for the time he spent working with me and sharing with me his knowledge and ideas. I am particularly thankful to Till Mossakowski and Carsten Sch¨urmannfor the very productive discussions with them and for their valuable feedback, as well as to all my colleagues and the students in the KWARC group at Jacobs University Bremen and the LATIN project. I would like to give my special heartfelt thanks to Andrea Kohlhase, not only for being a very kind and supportive colleague, but also for her sincere friendship and for being there for me at difficult times, supporting me very lovingly, and for motivating me. v vi Contents 1 Introduction1 1.1 Declarative Languages..............................1 1.1.1 Logics...................................2 1.1.2 Type Theories..............................4 1.2 Language Translations..............................5 1.3 Extension Principles...............................7 2 State of the Art 11 2.1 Logical Frameworks............................... 11 2.1.1 Abstract Logical Frameworks...................... 11 2.1.2 Declarative Logical Frameworks..................... 13 2.1.3 Adequacy................................. 18 2.1.4 Design Principles............................. 19 2.2 Foundation-Independent Meta-Frameworks.................. 21 2.3 Libraries of Language Representations..................... 23 3 Research Problems and Methodology 25 3.1 Representing Declarative Languages...................... 25 3.2 Representing Language Translations...................... 27 3.3 Representing Extension Principles....................... 28 3.4 Research Objectives............................... 29 3.5 Methodology................................... 29 3.5.1 Declaration Patterns........................... 30 3.5.2 Sequences................................. 30 3.5.3 Modular Foundations.......................... 31 3.6 Thesis Outline.................................. 31 4 Modular Foundations 33 4.1 Syntax....................................... 33 4.2 Type System................................... 35 4.3 Examples..................................... 37 4.4 Modularity.................................... 41 4.5 Discussion..................................... 42 5 Theory Families and Instantiations 45 5.1 Syntax....................................... 45 5.1.1 Grammar................................. 45 5.1.2 Examples................................. 47 5.1.3 Meta-Level Definitions.......................... 50 vii 5.2 Type System................................... 54 5.2.1 Judgments and Rules.......................... 54 5.2.2 Preservation of Judgments........................ 58 5.3 Discussion..................................... 75 6 A Logical Framework with Sequences 77 6.1 Sequences..................................... 77 6.1.1 Syntax................................... 77 6.1.2 Type System............................... 80 6.1.3 Conversions................................ 84 6.2 LF with Sequences................................ 85 6.2.1 Syntax................................... 85 6.2.2 Type System............................... 87 6.2.3 Conversions................................ 87 6.2.4 Stand-Alone Version........................... 90 6.3 Discussion..................................... 91 7 Declarative Languages and their Translations in TFI 95 7.1 Representing Declarative Languages...................... 95 7.2 Representing Language Translations...................... 100 7.3 Induced Languages and Translations...................... 104 7.4 Discussion..................................... 105 8 Extension Principles in TFI 107 8.1 Representing Extension Principles....................... 107 8.2 Translating Extension Principles........................ 111 8.3 Discussion..................................... 112 9 An Atlas of Declarative Languages 113 9.1 Declarative Languages.............................. 114 9.1.1 Propositional Languages........................