Towards a Judgmental Reconstruction of Logical Relation Proofs

Total Page:16

File Type:pdf, Size:1020Kb

Towards a Judgmental Reconstruction of Logical Relation Proofs Towards a Judgmental Reconstruction of Logical Relation Proofs Carsten Sch¨urmann and Jeffrey Sarnat Yale University and IT University of Copenhagen [email protected] and [email protected] Abstract. Tait’s method (a.k.a. proof by logical relations) is a powerful proof technique frequently used for showing foundational properties of languages based on typed lambda-calculi. Historically, these proofs have been difficult to formalize in proof assistants with weak meta-logics, such as Twelf. Logical relations are notoriously difficult to define judgmentally. In this paper, we present and discuss a Twelf proof of weak normalization for System F making use of higher-order encodings. We exhibit a modular technique on how to formalize proofs of this kind, and make explicit all logical principles that one needs to trust in order believe in the proof. 1 Introduction When formalizing meta-theoretic proofs about formal systems, one is usually first confronted with the choice of proof assistant. Driven by concerns of the expressive power of the proof assistant, the trust in its logical foundation, performance, the features of the tactic language, and often also the ease with which we can encode the formal system, the final decision of which system to choose varies in practice. Thomas Hales for example, has chosen HOL light [Har96] for his work on the formalization of Kepler’s conjecture, George Necula has chosen variants of the LF type theory for his work on proof-carrying code [Nec97], Daniel Lee, Karl Crary, and Bob Harper have chosen the Twelf system for formalizing the proof of the soundness of a SML type system [LCH07] and Georges Gonthier has used Coq for his formalized proof of the four color theorem [Gon05]. The proof theoretic strengths of different systems vary, and once the proof assistant question is settled and a proof development has begun, there is often no turning back. If unforseen challenges in the formalization of a meta-theoretic argument arise, one can find oneself in a situation where one is seemingly stuck. This might suggest that the best proof assistant is necessarily the most expres- sive, but such a perspective is too naive with respect to other considerations that influence the choice of proof assistant. In this paper we illustrate how limitations imposed by the meta-logic can sometimes be circumvented. We show in the setting of Twelf how one can push some of the burden related to logical expressivity down into an auxiliary logical system that is represented in LF. This trick not only works, but it allows us to point to the principles that we need to trust in order to believe the overall proof. This logical system is called assertion logic. We discuss a proof of weak normalization for System F in Twelf via logical relations. In formalizing the proof, we overcome two significant technical obsta- cles. First, we solve a previously open problem as to whether logical relations are representable in Twelf at all. Second, because the theorems provable in Twelf can informally be seen to be a subset of those provable in Peano arithmetic, G¨odel’s second incompleteness theorem tells us that we should not be able to prove normalization of a calculus as proof-theoretically strong as System F. In- deed, Twelf cannot certify the validity of our entire proof: the consistency of a second-order assertion logic must be explicitly assumed, a leap of faith no larger than the one required to trust the soundness of any proof-assistant with the built-in expressive power to certify our proof in its entirety. In our encoding we carefully distinguish between the logical framework, in our case LF [HHP93], the assertion logic, encoded in LF, and the meta logic of LF, Twelf, in which we prove the aforementioned conjecture. Our proof is constructive and executable. This paper is structured as follows: In Section 2 we encode in LF both System F and the judgments that characterize when terms are weakly normalizing. In Section 3 we describe the assertion logic, its properties, and the formalization in LF. Next, we define the logical relation in the assertion logic by meta-level induction. With this definition, we are able to prove that for every term in System F there is an assertion-logic proof that the term is convertible to a canonical form. The desired theorem then follows from the assumption that our cut-elimination procedure for second-order logic terminates. In Section 4, we discuss implications and extensions of the result before we conclude. Please find the accompanying Twelf source code at http://www.cs.yale.edu/~sarnat/tphols. 2 System F in LF System F [GTL90], independently discovered by Jean-Yves Girard and John Reynolds, is an extension of the simply typed λ-calculus by polymorphic types. Inspired by Church’s definition of higher-order logic using the simply-typed cal- culus as a logical framework [Chu40], we define our System F in the dependently typed logical framework LF [HHP93]. We define the syntactic category of types as follows. Types: A ::= α | A1 ⇒ A2 | ∀(λα : tp.A) λ stands for the binding construct of LF, and tp is an LF type constant. Next, we define the syntactic category of terms of type A. We write tm A for the corresponding LF type taking advantage of the fact that in LF type families may be indexed by LF objects. Terms: e ::= x | lam (λx : tm A. e) | app e1 e2 | tlam (λα : tp. e) | tapp e A The symbols lam, app, tlam and tapp are represented as constants in LF. In the interest of readability, we will not discuss the encoding of terms and types tm : tp → type. tp : type. lam :(tm A → tm B) → tm (A ⇒ B). ⇒: tp → tp → tp. app : tm (A ⇒ B) → tm A → tm B. ∀ :(tp → tp) → tp. tlam :(Πα:tp. tm (A α)) → tm (∀ (λα:tp. A α)). tapp : tm (∀ (λα:tp. A α)) → (Πα:tp. tm (A α)). Fig. 1. LF Encoding of Types and Terms any further, simply because there is no difference between the formalized and the informal presentation. Every syntactic category given in this paper can be adequately represented in LF. Our encoding of terms ensures that all expressible terms are well-typed: 1. If e : tm B is a term with a hole, say x : tm A, then lam (λx : tm A. e): tm (A ⇒ B). 2. If e1 : tm (A ⇒ B) and e2 : tm A then app e1 e2 : tm B. 3. If e : tm B is a term with a hole, say α : tp, then tlam (λα : tp. e): tm (∀(λα : tp.A)). 4. If e : tm (∀(λα : tp.A)) and A0 : tp then tapp e A0 : tm (A[A0/α]). The actual LF encoding of System F is given in Figure 1. →, Π, λ, and jux- tapositions are defined by LF and substitutions are provided by LF. We follow the syntactic convention of Twelf by omitting leading Π abstraction from types that are easily inferable. In the setting of the logical framework LF, we usually encode judgments-as- types and derivations-as-objects where inferences rules are encoded as constants. We write e ⇓ if e is atomic, which means that the head of e is not a β-redex. We write e ⇑ if e is canonical, which means that it is a β-normal, η-long form. Note that the rule n1 can only be applied when e is of type tm α, which we express using a form a type ascription (e : tm α). e1 ⇓ e2 ⇑ e ⇓ p1 p2 app e1 e2 ⇓ tapp e A ⇓ u x ⇓ . (e : tm α) ⇓ e ⇑ e ⇑ n1 n2x,u n3α (e : tm α) ⇑ lam (λx : tm A. e) ⇑ tlam (λα : tp. e) ⇑ Next we define three judgments e −→ e0, e −→∗ e0, e −→whr e0. r1 r2 app (lam (λx : tm A. e1)) e2 −→ e1[e2/x] tapp (tlam (λα : tp. e)) A −→ e[A/α] r3 r4 e −→ lam (λx : tm A. app e x) e −→ tlam (λα : tp. tapp e α) 0 0 0 e1 −→ e1 e2 −→ e2 e −→ e r5 r6 r7 0 0 0 app e1 e2 −→ app e1 e2 app e1 e2 −→ app e1 e2 tapp e A −→ tapp e A e −→ e0 e −→ e0 r8x r9α lam (λx : tm A. e) −→ lam (λx : tm A. e0) tlam (λα : tp. e) −→ tlam (λα : tp. e0) r1 and r2 define β-reduction for objects and types, respectively, r3 and r4 define η expansion, and rules r5 – r9 define the usual congruence closure for βη. The following two rules describe the reflexive transitive closure of −→. ∗ e1 −→ e2 e2 −→ e3 r1∗ r2∗ ∗ ∗ e −→ e e1 −→ e3 Next, we define weak head reduction. w1 whr app (lam (λx : tm A. e1)) e2 −→ e1[e2/x] w2 tapp (tlam (λα : tp. e)) A −→whr e[A/α] whr 0 whr 0 e1 −→ e1 e −→ e w3 w4 whr 0 whr 0 app e1 e2 −→ app e1 e2 tapp e A −→ tapp e A w1 and w2 execute a β-reduction step, and w3 and w4 define the congruence closure for weak-head reduction. It is worth mentioning the reduction rules are only applicable to terms of the same type. Finally we define a judgment about the existence of atomic and canonical forms that will play a central role in our development. We capture the meaning that a term e can be reduced to canonical or atomic form with the judgments e ↓ and e ↑, respectively. e1 ↓ e2 ↑ e ↓ a1 a2 app e1 e2 ↓ tapp e A1 ↓ u x ↓ . app e x ↑ tapp e α ↓ c1x,u c2α e : tm (A1 ⇒ A2) ↑ e : tm (∀ (λα.
Recommended publications
  • No-Longer-Foreign: Teaching an ML Compiler to Speak C “Natively”
    Electronic Notes in Theoretical Computer Science 59 No. 1 (2001) URL: http://www.elsevier.nl/locate/entcs/volume59.html 16 pages No-Longer-Foreign: Teaching an ML compiler to speak C “natively” Matthias Blume 1 Lucent Technologies, Bell Laboratories Abstract We present a new foreign-function interface for SML/NJ. It is based on the idea of data- level interoperability—the ability of ML programs to inspect as well as manipulate C data structures directly. The core component of this work is an encoding of the almost 2 complete C type sys- tem in ML types. The encoding makes extensive use of a “folklore” typing trick, taking advantage of ML’s polymorphism, its type constructors, its abstraction mechanisms, and even functors. A small low-level component which deals with C struct and union declarations as well as program linkage is hidden from the programmer’s eye by a simple program-generator tool that translates C declarations to corresponding ML glue code. 1 An example Suppose you are an ML programmer who wants to link a program with some C rou- tines. The following example (designed to demonstrate data-level interoperability rather than motivate the need for FFIs in the first place) there are two C functions: input reads a list of records from a file and findmin returns the record with the smallest i in a given list. The C library comes with a header file ixdb.h that describes this interface: typedef struct record *list; struct record { int i; double x; list next; }; extern list input (char *); extern list findmin (list); Our ml-nlffigen tool translates ixdb.h into an ML interface that corre- sponds nearly perfectly to the original C interface.
    [Show full text]
  • What I Wish I Knew When Learning Haskell
    What I Wish I Knew When Learning Haskell Stephen Diehl 2 Version This is the fifth major draft of this document since 2009. All versions of this text are freely available onmywebsite: 1. HTML Version ­ http://dev.stephendiehl.com/hask/index.html 2. PDF Version ­ http://dev.stephendiehl.com/hask/tutorial.pdf 3. EPUB Version ­ http://dev.stephendiehl.com/hask/tutorial.epub 4. Kindle Version ­ http://dev.stephendiehl.com/hask/tutorial.mobi Pull requests are always accepted for fixes and additional content. The only way this document will stayupto date and accurate through the kindness of readers like you and community patches and pull requests on Github. https://github.com/sdiehl/wiwinwlh Publish Date: March 3, 2020 Git Commit: 77482103ff953a8f189a050c4271919846a56612 Author This text is authored by Stephen Diehl. 1. Web: www.stephendiehl.com 2. Twitter: https://twitter.com/smdiehl 3. Github: https://github.com/sdiehl Special thanks to Erik Aker for copyediting assistance. Copyright © 2009­2020 Stephen Diehl This code included in the text is dedicated to the public domain. You can copy, modify, distribute and perform thecode, even for commercial purposes, all without asking permission. You may distribute this text in its full form freely, but may not reauthor or sublicense this work. Any reproductions of major portions of the text must include attribution. The software is provided ”as is”, without warranty of any kind, express or implied, including But not limitedtothe warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authorsor copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, Arising from, out of or in connection with the software or the use or other dealings in the software.
    [Show full text]
  • Idris: a Functional Programming Language with Dependent Types
    Programming Languages and Compiler Construction Department of Computer Science Christian-Albrechts-University of Kiel Seminar Paper Idris: A Functional Programming Language with Dependent Types Author: B.Sc. Finn Teegen Date: 20th February 2015 Advised by: M.Sc. Sandra Dylus Contents 1 Introduction1 2 Fundamentals2 2.1 Universes....................................2 2.2 Type Families..................................2 2.3 Dependent Types................................3 2.4 Curry-Howard Correspondence........................4 3 Language Overview5 3.1 Simple Types and Functions..........................5 3.2 Dependent Types and Functions.......................6 3.3 Implicit Arguments...............................7 3.4 Views......................................8 3.5 Lazy Evaluation................................8 3.6 Syntax Extensions...............................9 4 Theorem Proving 10 4.1 Propositions as Types and Terms as Proofs................. 10 4.2 Encoding Intuitionistic First-Order Logic................... 12 4.3 Totality Checking................................ 14 5 Conclusion 15 ii 1 Introduction In conventional Hindley-Milner based programming languages, such as Haskell1, there is typically a clear separation between values and types. In dependently typed languages, however, this distinction is less clear or rather non-existent. In fact, types can depend on arbitrary values. Thus, they become first-class citizens and are computable like any other value. With types being allowed to contain values, they gain the possibility to describe prop- erties of their own elements. The standard example for dependent types is the type of lists of a given length - commonly referred to as vectors - where the length is part of the type itself. When starting to encode properties of values as types, the elements of such types can be seen as proofs that the stated property is true.
    [Show full text]
  • Constrained Type Families (Extended Version)
    Constrained Type Families (extended version) J. GARRETT MORRIS, e University of Edinburgh and e University of Kansas 42 RICHARD A. EISENBERG, Bryn Mawr College We present an approach to support partiality in type-level computation without compromising expressiveness or type safety. Existing frameworks for type-level computation either require totality or implicitly assume it. For example, type families in Haskell provide a powerful, modular means of dening type-level computation. However, their current design implicitly assumes that type families are total, introducing nonsensical types and signicantly complicating the metatheory of type families and their extensions. We propose an alternative design, using qualied types to pair type-level computations with predicates that capture their domains. Our approach naturally captures the intuitive partiality of type families, simplifying their metatheory. As evidence, we present the rst complete proof of consistency for a language with closed type families. CCS Concepts: •eory of computation ! Type structures; •So ware and its engineering ! Func- tional languages; Additional Key Words and Phrases: Type families, Type-level computation, Type classes, Haskell ACM Reference format: J. Garre Morris and Richard A. Eisenberg. 2017. Constrained Type Families (extended version). PACM Progr. Lang. 1, 1, Article 42 (January 2017), 38 pages. DOI: hp://dx.doi.org/10.1145/3110286 1 INTRODUCTION Indexed type families (Chakravarty et al. 2005; Schrijvers et al. 2008) extend the Haskell type system with modular type-level computation. ey allow programmers to dene and use open mappings from types to types. ese have given rise to further extensions of the language, such as closed type families (Eisenberg et al.
    [Show full text]
  • Twelf User's Guide
    Twelf User’s Guide Version 1.4 Frank Pfenning and Carsten Schuermann Copyright c 1998, 2000, 2002 Frank Pfenning and Carsten Schuermann Chapter 1: Introduction 1 1 Introduction Twelf is the current version of a succession of implementations of the logical framework LF. Previous systems include Elf (which provided type reconstruction and the operational semantics reimplemented in Twelf) and MLF (which implemented module-level constructs loosely based on the signatures and functors of ML still missing from Twelf). Twelf should be understood as research software. This means comments, suggestions, and bug reports are extremely welcome, but there are no guarantees regarding response times. The same remark applies to these notes which constitute the only documentation on the present Twelf implementation. For current information including download instructions, publications, and mailing list, see the Twelf home page at http://www.cs.cmu.edu/~twelf/. This User’s Guide is pub- lished as Frank Pfenning and Carsten Schuermann Twelf User’s Guide Technical Report CMU-CS-98-173, Department of Computer Science, Carnegie Mellon University, November 1998. Below we state the typographic conventions in this manual. code for Twelf or ML code ‘samp’ for characters and small code fragments metavar for placeholders in code keyboard for input in verbatim examples hkeyi for keystrokes math for mathematical expressions emph for emphasized phrases File names for examples given in this guide are relative to the main directory of the Twelf installation. For example ‘examples/guide/nd.elf’ may be found in ‘/usr/local/twelf/examples/guide/nd.elf’ if Twelf was installed into the ‘/usr/local/’ directory.
    [Show full text]
  • Session Arrows: a Session-Type Based Framework for Parallel Code Generation
    MENG INDIVIDUAL PROJECT IMPERIAL COLLEGE LONDON DEPARTMENT OF COMPUTING Session Arrows: A Session-Type Based Framework For Parallel Code Generation Supervisor: Prof. Nobuko Yoshida Author: Dr. David Castro-Perez Shuhao Zhang Second Marker: Dr. Iain Phillips June 19, 2019 Abstract Parallel code is notorious for its difficulties in writing, verification and maintenance. However, it is of increasing importance, following the end of Moore’s law. Modern pro- grammers are expected to utilize the power of multi-core CPUs and face the challenges brought by parallel programs. This project builds an embedded framework in Haskell to generate parallel code. Combining the power of multiparty session types with parallel computation, we create a session typed monadic language as the middle layer and use Arrow, a general interface to computation as an abstraction layer on top of the language. With the help of the Arrow interface, we convert the data-flow of the computation to communication and generate parallel code according to the communication pattern between participants involved in the computation. Thanks to the addition of session types, not only the generated code is guaranteed to be deadlock-free, but also we gain a set of local types so that it is possible to reason about the communication structure of the parallel computation. In order to show that the framework is as expressive as usual programming lan- guages, we write several common parallel computation patterns and three algorithms to benchmark using our framework. They demonstrate that users can express computa- tion similar to traditional sequential code and gain, for free, high-performance parallel code in low-level target languages such as C.
    [Show full text]
  • Ur/Web: a Simple Model for Programming the Web
    Ur/Web: A Simple Model for Programming the Web The MIT Faculty has made this article openly available. Please share how this access benefits you. Your story matters. Citation Chlipala, Adam. "Ur/Web: A Simple Model for Programming the Web." The 42nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL '15), January 15-17, 2015, Mumbai, India. As Published http://dl.acm.org/citation.cfm?id=2676726 Publisher Association for Computing Machinery (ACM) Version Author's final manuscript Citable link http://hdl.handle.net/1721.1/92321 Terms of Use Creative Commons Attribution-Noncommercial-Share Alike Detailed Terms http://creativecommons.org/licenses/by-nc-sa/4.0/ Ur/Web: A Simple Model for Programming the Web Adam Chlipala rtifact Comple * A t * te n * te A is W s E * e n l l C o L D MIT CSAIL C o P * * c u e m s O E u e e P n R t v e [email protected] o d t * y * s E a a l d u e a t Abstract for network communication, and on a language or API like SQL The World Wide Web has evolved gradually from a document de- for storing persistent, structured data on servers. Code fragments livery platform to an architecture for distributed programming. This in these different languages are often embedded within each other largely unplanned evolution is apparent in the set of interconnected in complex ways, and the popular Web development tools provide languages and protocols that any Web application must manage. little help in catching inconsistencies.
    [Show full text]
  • A Verifying Compiler for Embedded Networked Systems Kalyan Chakradhar Regula Clemson University, [email protected]
    Clemson University TigerPrints All Theses Theses 8-2010 A Verifying Compiler for Embedded Networked Systems Kalyan chakradhar Regula Clemson University, [email protected] Follow this and additional works at: https://tigerprints.clemson.edu/all_theses Part of the Computer Sciences Commons Recommended Citation Regula, Kalyan chakradhar, "A Verifying Compiler for Embedded Networked Systems" (2010). All Theses. 899. https://tigerprints.clemson.edu/all_theses/899 This Thesis is brought to you for free and open access by the Theses at TigerPrints. It has been accepted for inclusion in All Theses by an authorized administrator of TigerPrints. For more information, please contact [email protected]. A Verifying Compiler for Embedded Networked Systems A Thesis Presented to the Graduate School of Clemson University In Partial Fulfillment of the Requirements for the Degree Master Of Science Computer Science by Kalyan Chakradhar Regula August 2010 Accepted by: Dr. Jason O. Hallstrom, Committee Chair Dr. Murali Sitaraman Dr. Brain Malloy Abstract Embedded networked devices are required to produce dependable outputs and communicate with peer devices given limited computing resources. These devices monitor and control processes within the physical world. They are used in applications related to environmental monitoring, telecommunications, social networking, and also life-critical applications in domains such as health care, aeronautics, and automotive manufacturing. For such applications, software errors can be costly - both in terms of financial and human costs. Therefore, software programs installed on these devices must meet the appropriate requirements. To guarantee this, one must verify that the implemented code meets the corresponding specifications. Manual trial-and-error validation of such applications, especially life-critical software programs, is not a feasible option.
    [Show full text]
  • Type Theory & Functional Programming
    Type Theory & Functional Programming Simon Thompson Computing Laboratory, University of Kent March 1999 c Simon Thompson, 1999 Not to be reproduced i ii To my parents Preface Constructive Type theory has been a topic of research interest to computer scientists, mathematicians, logicians and philosophers for a number of years. For computer scientists it provides a framework which brings together logic and programming languages in a most elegant and fertile way: program development and verification can proceed within a single system. Viewed in a different way, type theory is a functional programming language with some novel features, such as the totality of all its functions, its expressive type system allowing functions whose result type depends upon the value of its input, and sophisticated modules and abstract types whose interfaces can contain logical assertions as well as signature information. A third point of view emphasizes that programs (or functions) can be extracted from proofs in the logic. Up until now most of the material on type theory has only appeared in proceedings of conferences and in research papers, so it seems appropriate to try to set down the current state of development in a form accessible to interested final-year undergraduates, graduate students, research workers and teachers in computer science and related fields – hence this book. The book can be thought of as giving both a first and a second course in type theory. We begin with introductory material on logic and functional programming, and follow this by presenting the system of type theory itself, together with many examples. As well as this we go further, looking at the system from a mathematical perspective, thus elucidating a number of its important properties.
    [Show full text]
  • Servant Documentation
    Servant Documentation Servant Contributors Oct 24, 2018 Contents 1 Tutorial 3 1.1 A web API as a type...........................................3 1.2 Serving an API..............................................9 1.3 Querying an API............................................. 27 1.4 Generating Javascript functions to query an API............................ 31 1.5 Documenting an API........................................... 39 1.6 Authentication in Servant........................................ 44 2 Cookbook 53 2.1 Structuring APIs............................................. 53 2.2 Using generics.............................................. 56 2.3 Serving web applications over HTTPS................................. 58 2.4 SQLite database............................................. 59 2.5 PostgreSQL connection pool....................................... 60 2.6 Using a custom monad.......................................... 62 2.7 Basic Authentication........................................... 64 2.8 Combining JWT-based authentication with basic access authentication................ 67 2.9 File Upload (multipart/form-data)............................... 70 2.10 Pagination................................................ 72 3 Example Projects 77 4 Helpful Links 79 5 Principles 81 i ii Servant Documentation servant is a set of Haskell libraries for writing type-safe web applications but also deriving clients (in Haskell and other languages) or generating documentation for them, and more. This is achieved by taking as input a description
    [Show full text]
  • Reducing the Cost of Precise Types
    View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by KU ScholarWorks Reducing the Cost of Precise Types By Nicolas Frisby Submitted to the graduate degree program in Electrical Engineering & Computer Science and the Graduate Faculty of the University of Kansas in partial fulfillment of the requirements for the degree of Doctor of Philosophy Dr. Warren Perry Alexander, Chairperson Dr. Andy Gill Committee members Dr. Prasad Kulkarni Dr. Bo Luo Dr. Sara Wilson Date defended: 28 August 2012 The Dissertation Committee for Nicolas Frisby certifies that this is the approved version of the following dissertation : Reducing the Cost of Precise Types Dr. Warren Perry Alexander, Chairper- son Date approved: 28 August 2012 ii Abstract Programs involving precise types enforce more properties via type-checking, but precise types also prevent the reuse of functions throughout a program since no single precise type is used throughout a large program. My work is a step toward eliminating the underlying dilemma regarding type precision versus func- tion reuse. It culminates in a novel traversal operator that recovers the reuse by automating most of each conversion between \similar" precise types, for a notion of similarity that I characterize in both the intuitive and technical senses. The benefits of my techniques are clear in side-by-side comparisons; in particular, I apply my techniques to two definitions of lambda-lifting. I present and imple- ment my techniques in the Haskell programming language, but the fundamental ideas are applicable to any statically- and strongly-typed programming functional language with algebraic data types.
    [Show full text]
  • Trees That Grow in the Paragon Compiler a Step Towards Modularity
    Trees that Grow in the Paragon Compiler A Step Towards Modularity Bachelor of Science Thesis in Computer Science and Engineering John Andersson, Anders Berggren Sjöblom, Anders Bäckelie, Johannes Ljung Ekeroth, Lukas Skystedt, Lina Terner Department of Computer Science and Engineering Chalmers University of Technology University of Gothenburg Gothenburg, Sweden 2020 Bachelor of Science Thesis DATX02-20-30 Trees that Grow in the Paragon Compiler A Step Towards Modularity John Andersson Anders Berggren Sjöblom Anders Bäckelie Johannes Ljung Ekeroth Lukas Skystedt Lina Terner Department of Computer Science and Engineering Chalmers University of Technology University of Gothenburg Gothenburg, Sweden 2020 Trees that Grow in the Paragon Compiler A Step Towards Modularity John Andersson, Anders Berggren Sjöblom, Anders Bäckelie, Johannes Ljung Ekeroth, Lukas Skystedt, Lina Terner © John Andersson, Anders Berggren Sjöblom, Anders Bäckelie, Johannes Ljung Ekeroth, Lukas Skystedt, Lina Terner, 2020. Supervisor: Niklas Broberg, Department of Computer Science and Engineering Examiner: David Sands, Department of Computer Science and Engineering Bachelor of Science Thesis DATX02-20-30 Department of Computer Science and Engineering Chalmers University of Technology University of Gothenburg SE-412 96 Gothenburg Telephone +46 31 772 1000 iii Abstract Paragon is a programming language that extends Java with statically checked information flow control policies. Paragon’s compiler, which is written in Haskell, has a large type checker. Its current implementation is monolithic, making the compiler challenging to develop. Paragon’s authors, Broberg et al., have proposed to partition the type checker into five phases, and this project is a step towards such an implementation. We identify the representation of Paragon’s abstract syntax tree as an essential design aspect and emphasize extensibility to conform to the phases’ varying re- quirements.
    [Show full text]