Gradual Typing with Union and Intersection Types
|
|
- Jessica Harvey
- 5 years ago
- Views:
Transcription
1 Gradual Typing with Union and Intersection Types Giuseppe Castagna, Victor Lanvin ICFP 17 September 6, / 14
2 Outline 1 Motivating Example 2 Types and Subtyping 3 Function Types and Operators 4 Conclusion 1 / 14
3 Motivating Example (1/3) [Siek and Vachharajani, 2008] let succ : Int -> Int =... let not : Bool -> Bool =... let f (condition : Bool) (x : ) : = if condition then succ x else not x 2 / 14
4 Motivating Example (1/3) [Siek and Vachharajani, 2008] let succ : Int -> Int =... let not : Bool -> Bool =... let f (condition : Bool) (x :?) :? = if condition then succ x else not x Cannot be typed with simple types, but valid with gradual types. 2 / 14
5 Motivating Example (1/3) [Siek and Vachharajani, 2008] let succ : Int -> Int =... let not : Bool -> Bool =... let f (condition : Bool) (x :?) :? = if condition then succ x else not x Cannot be typed with simple types, but valid with gradual types. What if we apply it to a string? 2 / 14
6 Motivating Example (2/3) Set-theoretic version: let f (condition : Bool) (x : (Int Bool)) : (Int Bool) = if condition then if x Int then succ x else assert false else if x Bool then not x else assert false 3 / 14
7 Motivating Example (2/3) Set-theoretic version: let f (condition : Bool) (x : (Int Bool)) : (Int Bool) = if condition then if x Int then succ x else assert false else if x Bool then not x else assert false Syntactically heavy, but safe 3 / 14
8 Motivating Example (3/3) Mixing the two: let f (condition : Bool) (x : (Int Bool) &?) : (Int Bool) = if condition then succ x else not x 4 / 14
9 Motivating Example (3/3) Mixing the two: let f (condition : Bool) (x : (Int Bool) &?) : (Int Bool) = if condition then succ x else not x Cannot be applied to something else than an integer or a boolean, and has a precise return type Syntactically straightforward 4 / 14
10 Summary of the Motivations Gradualization of single expressions is sometimes too coarse Set-theoretic types are powerful but syntactically heavy (no reconstruction) 5 / 14
11 Summary of the Motivations Gradualization of single expressions is sometimes too coarse Set-theoretic types are powerful but syntactically heavy (no reconstruction) Mixing the two would: Make the transition between dynamic types and static types smoother Reduce the syntactic overhead of set-theoretic types 5 / 14
12 Outline 1 Motivating Example 2 Types and Subtyping 3 Function Types and Operators 4 Conclusion 5 / 14
13 Type Syntax t STypes ::= b t t t t t t t Empty Any τ GTypes ::=? b τ τ τ τ τ τ t Empty Any 6 / 14
14 Type Syntax t STypes ::= b t t t t t t t Empty Any τ GTypes ::=? b τ τ τ τ τ τ t Empty Any Note:? Any Any = unknown type, explicitly deconstructed? = unknown type, implicitly deconstructed 6 / 14
15 Type Semantics: Concretization First idea: apply AGT [Garcia et al., 2016] 7 / 14
16 Type Semantics: Concretization First idea: apply AGT [Garcia et al., 2016] We define a concretization function γ : GTypes P(STypes). γ(?) = STypes γ(τ 1 τ 2 ) = {t 1 t 2 t i γ(τ i )} γ(τ 1 τ 2 ) = {t 1 t 2 t i γ(τ i )} γ(b) = {b} etc... 7 / 14
17 Type Semantics: Concretization First idea: apply AGT [Garcia et al., 2016] We define a concretization function γ : GTypes P(STypes). γ(?) = STypes γ(τ 1 τ 2 ) = {t 1 t 2 t i γ(τ i )} γ(τ 1 τ 2 ) = {t 1 t 2 t i γ(τ i )} γ(b) = {b} etc... For example, γ((? Int)?) = {(t Int) t (t, t ) STypes 2 } 7 / 14
18 Type Semantics: Subtyping (1/2) Consistent subtyping [Garcia et al., 2016] σ τ (s, t) γ(σ) γ(τ), s t 8 / 14
19 Type Semantics: Subtyping (1/2) Consistent subtyping [Garcia et al., 2016] σ τ (s, t) γ(σ) γ(τ), s t However, we can show the existence of extremal concretizations: t γ(τ), τ t τ 8 / 14
20 Type Semantics: Subtyping (1/2) Consistent subtyping [Garcia et al., 2016] σ τ (s, t) γ(σ) γ(τ), s t However, we can show the existence of extremal concretizations: t γ(τ), τ t τ (??) = (Any Empty) (??) = (Empty Any) 8 / 14
21 Type Semantics: Subtyping (2/2) Consistent subtyping σ τ σ τ 9 / 14
22 Type Semantics: Subtyping (2/2) Consistent subtyping σ τ σ τ = Consistent subtyping reduces in linear time to semantic subtyping! 9 / 14
23 Type Semantics: Subtyping (2/2) Consistent subtyping σ τ σ τ = Consistent subtyping reduces in linear time to semantic subtyping! Note: emphasizes the fact that consistent subtyping is not transitive. 9 / 14
24 Type Semantics: Abstraction? What about the abstraction function? 10 / 14
25 Type Semantics: Abstraction? What about the abstraction function? Problem: and are connectives, not constructors. 10 / 14
26 Type Semantics: Abstraction? What about the abstraction function? Problem: and are connectives, not constructors. α({int Bool,Int Int, Int Empty}) = 10 / 14
27 Type Semantics: Abstraction? What about the abstraction function? Problem: and are connectives, not constructors. α({int Bool,Int Int, Int Empty}) = 10 / 14
28 Type Semantics: Abstraction? What about the abstraction function? Problem: and are connectives, not constructors. α({int Bool,Int Int, Int Empty}) = α({int, Int, Int}) α({bool, Int, Empty}) 10 / 14
29 Type Semantics: Abstraction? What about the abstraction function? Problem: and are connectives, not constructors. α({int Bool,Int Int, Int Empty}) = α({int, Int, Int}) α({bool, Int, Empty}) = Int 10 / 14
30 Type Semantics: Abstraction? What about the abstraction function? Problem: and are connectives, not constructors. α({int Bool,Int Int, Int Empty}) = α({int, Int, Int}) α({bool, Int, Empty}) = Int? 10 / 14
31 Type Semantics: Abstraction? What about the abstraction function? Problem: and are connectives, not constructors. α({int Bool,Int Int, Int Empty}) = α({int, Int, Int}) α({bool, Int, Empty}) = Int? α({int Bool, Bool Int}) =??? 10 / 14
32 Type Semantics: Abstraction? What about the abstraction function? Problem: and are connectives, not constructors. α({int Bool,Int Int, Int Empty}) = α({int, Int, Int}) α({bool, Int, Empty}) = Int? α({int Bool, Bool Int}) =?? 10 / 14
33 Type Semantics: Abstraction? What about the abstraction function? Problem: and are connectives, not constructors. α({int Bool,Int Int, Int Empty}) = α({int, Int, Int}) α({bool, Int, Empty}) = Int? α({int Bool, Bool Int}) = Int Bool 10 / 14
34 Outline 1 Motivating Example 2 Types and Subtyping 3 Function Types and Operators 4 Conclusion 10 / 14
35 Typing Applications: Modus Ponens We start from the usual rule: Γ e 1 : σ 1 τ 1 Γ e 2 : σ 2 σ 2 σ 1 Γ e 1 e 2 : τ 1 Three components: 11 / 14
36 Typing Applications: Modus Ponens We start from the usual rule: Γ e 1 : σ 1 τ 1 Γ e 2 : σ 2 σ 2 σ 1 Γ e 1 e 2 : τ 1 Three components: Domain 11 / 14
37 Typing Applications: Modus Ponens We start from the usual rule: Γ e 1 : σ 1 τ 1 Γ e 2 : σ 2 σ 2 σ 1 Γ e 1 e 2 : τ 1 Three components: Domain Subtyping check 11 / 14
38 Typing Applications: Modus Ponens We start from the usual rule: Γ e 1 : σ 1 τ 1 Γ e 2 : σ 2 σ 2 σ 1 Γ e 1 e 2 : τ 1 Three components: Domain Subtyping check Result 11 / 14
39 Typing Applications: Modus Ponens Revisited Problem: what is the domain of ((Int Bool) Int) ( (Bool Int) (Int Int))? 12 / 14
40 Typing Applications: Modus Ponens Revisited Problem: what is the domain of ((Int Bool) Int) ( (Bool Int) (Int Int))? What is the result of ((Int Bool) (Bool Int)) (Nat Nat) applied to Nat? 12 / 14
41 Typing Applications: Modus Ponens Revisited Problem: what is the domain of ((Int Bool) Int) ( (Bool Int) (Int Int))? What is the result of ((Int Bool) (Bool Int)) (Nat Nat) applied to Nat? Γ e 1 : σ Γ e 2 : τ τ dom(σ) Γ e 1 e 2 : σ τ 12 / 14
42 Typing Applications: Modus Ponens Revisited Problem: what is the domain of ((Int Bool) Int) ( (Bool Int) (Int Int))? Int What is the result of ((Int Bool) (Bool Int)) (Nat Nat) applied to Nat? Nat Bool Γ e 1 : σ Γ e 2 : τ τ dom(σ) Γ e 1 e 2 : σ τ 12 / 14
43 Function Operators: Examples dom((int Int) (??)) = 13 / 14
44 Function Operators: Examples dom((int Int) (??)) = Any since it can accept any value 13 / 14
45 Function Operators: Examples dom((int Int) (??)) = Any since it can accept any value dom((int Int) (??)) = 13 / 14
46 Function Operators: Examples dom((int Int) (??)) = Any since it can accept any value dom((int Int) (??)) = Int 13 / 14
47 Function Operators: Examples dom((int Int) (??)) = Any since it can accept any value dom((int Int) (??)) = Int ((? Int) (? Bool)) Int = 13 / 14
48 Function Operators: Examples dom((int Int) (??)) = Any since it can accept any value dom((int Int) (??)) = Int ((? Int) (? Bool)) Int = Int Bool 13 / 14
49 Outline 1 Motivating Example 2 Types and Subtyping 3 Function Types and Operators 4 Conclusion 13 / 14
50 Conclusion and Future Work Current results: + Efficient characterization of consistent subtyping + Sound system + Supports polymorphism (W.I.P.) No blame theorem, and no gradual guarantee yet 14 / 14
51 Conclusion and Future Work Current results: + Efficient characterization of consistent subtyping + Sound system + Supports polymorphism (W.I.P.) No blame theorem, and no gradual guarantee yet Future work: Provide a statically-typed cast-calculus and prove the gradual guarantee Study blame 14 / 14
Gradual Typing with Union and Intersection Types
41 Gradual Typing with Union and Intersection Types GIUSEPPE CSTGN, CNRS - Université Paris Diderot, France VICTOR LNVIN, École Normale Supérieure de Cachan, France We propose a type system for functional
More informationConsistent Subtyping for All
Consistent Subtyping for All Ningning Xie Xuan Bi Bruno C. d. S. Oliveira 11 May, 2018 The University of Hong Kong 1 Background There has been ongoing debate about which language paradigm, static typing
More informationThe Polymorphic Blame Calculus and Parametricity
1 / 31 The Polymorphic Blame Calculus and Parametricity Jeremy G. Siek Indiana University, Bloomington University of Strathclyde August 2015 2 / 31 Integrating static and dynamic typing Static Dynamic
More informationIntroduction to System F. Lecture 18 CS 565 4/20/09
Introduction to System F Lecture 18 CS 565 4/20/09 The Limitations of F 1 (simply-typed λ- calculus) In F 1 each function works exactly for one type Example: the identity function id = λx:τ. x : τ τ We
More information1 Introduction. 3 Syntax
CS 6110 S18 Lecture 19 Typed λ-calculus 1 Introduction Type checking is a lightweight technique for proving simple properties of programs. Unlike theorem-proving techniques based on axiomatic semantics,
More informationProgramming Languages Lecture 14: Sum, Product, Recursive Types
CSE 230: Winter 200 Principles of Programming Languages Lecture 4: Sum, Product, Recursive Types The end is nigh HW 3 No HW 4 (= Final) Project (Meeting + Talk) Ranjit Jhala UC San Diego Recap Goal: Relate
More informationPolymorphism. Lecture 19 CS 565 4/17/08
Polymorphism Lecture 19 CS 565 4/17/08 The Limitations of F 1 (simply-typed λ- calculus) In F 1 each function works exactly for one type Example: the identity function id = λx:τ. x : τ τ We need to write
More informationCS 6110 S11 Lecture 25 Typed λ-calculus 6 April 2011
CS 6110 S11 Lecture 25 Typed λ-calculus 6 April 2011 1 Introduction Type checking is a lightweight technique for proving simple properties of programs. Unlike theorem-proving techniques based on axiomatic
More informationConsistent Subtyping for All
Consistent Subtyping for All Ningning Xie, Xuan Bi, and Bruno C. d. S. Oliveira The University of Hong Kong {nnxie,xbi,bruno}@cs.hku.hk Abstract. Consistent subtyping is employed in some gradual type systems
More informationIntermediate Code Generation Part II
Intermediate Code Generation Part II Chapter 6: Type checking, Control Flow Slides adapted from : Robert van Engelen, Florida State University Static versus Dynamic Checking Static checking: the compiler
More informationA CRASH COURSE IN SEMANTICS
LAST TIME Recdef More induction NICTA Advanced Course Well founded orders Slide 1 Theorem Proving Principles, Techniques, Applications Slide 3 Well founded recursion Calculations: also/finally {P}... {Q}
More informationCSE-321 Programming Languages 2010 Final
Name: Hemos ID: CSE-321 Programming Languages 2010 Final Prob 1 Prob 2 Prob 3 Prob 4 Prob 5 Prob 6 Total Score Max 18 28 16 12 36 40 150 There are six problems on 16 pages, including two work sheets, in
More informationType Checking and Type Inference
Type Checking and Type Inference Principles of Programming Languages CSE 307 1 Types in Programming Languages 2 Static Type Checking 3 Polymorphic Type Inference Version: 1.8 17:20:56 2014/08/25 Compiled
More informationGradual Parametricity, Revisited
aaachicbvddssmwge39nfov6qu30sf4y2lfuerk6i3etbbys0jtdmtle1lkgqj7nrh8am81sfwtrwvh8d3mo12ozshkpyc7zvkywlsrqwy7s9jbn5hcwm5sljdvvf2ds3tlsyyqqmtzywrlgbkorrtpqkkkbcvbaub4y0g8f1uw8/ecfpwu/vmcv+jhqcrhqjpawuuedfiucmqdecljy61nvfofruusouxdk1a7zll4czxjmqgpig0tw/vtdbwuy4wgxj2hsvpk5eopirkzvl5mkriaeqsjkucxk5efmued7qsqj2tnqguv3tyfes5taodgemvf9o1wrxv1onu9gzn1oezopwph4oyhhucsxygsevbcs21arhqfwseperqfjp9kpeacxdelfoi+tksofitkcws1rhlmnbzt1jr41sagcdse+oaqooav1camaoakweatp4aw8gk/gm/fufixb54yjzwf8gfh5a4h9n/m=
More informationProgramming Languages Lecture 15: Recursive Types & Subtyping
CSE 230: Winter 2008 Principles of Programming Languages Lecture 15: Recursive Types & Subtyping Ranjit Jhala UC San Diego News? Formalize first-order type systems Simple types (integers and booleans)
More informationPart III. Chapter 15: Subtyping
Part III Chapter 15: Subtyping Subsumption Subtype relation Properties of subtyping and typing Subtyping and other features Intersection and union types Subtyping Motivation With the usual typing rule
More informationA First-Order Logic with First-Class Types
A First-Order Logic with First-Class Types joint work with Peter H. Schmitt and Mattias Ulbrich Institute for Theoretical Computer Science The 8th KeY Symposium, Speyer, 2009 Java Card DL modal logic based
More information3.7 Denotational Semantics
3.7 Denotational Semantics Denotational semantics, also known as fixed-point semantics, associates to each programming language construct a well-defined and rigorously understood mathematical object. These
More informationCOMP 4161 NICTA Advanced Course. Advanced Topics in Software Verification. Toby Murray, June Andronick, Gerwin Klein
COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Toby Murray, June Andronick, Gerwin Klein λ 1 Last time... λ calculus syntax free variables, substitution β reduction α and η conversion
More informationSecond-Order Type Systems
#1 Second-Order Type Systems Homework 5 Summary Student : 37.9704 Student : 44.4466 ORIGINAL : 50.2442 Student : 50.8275 Student : 50.8633 Student : 50.9181 Student : 52.1347 Student : 52.1633 Student
More informationSubtyping. Lecture 13 CS 565 3/27/06
Subtyping Lecture 13 CS 565 3/27/06 Polymorphism Different varieties of polymorphism: Parametric (ML) type variables are abstract, and used to encode the fact that the same term can be used in many different
More informationSubsumption. Principle of safe substitution
Recap on Subtyping Subsumption Some types are better than others, in the sense that a value of one can always safely be used where a value of the other is expected. Which can be formalized as by introducing:
More informationProgramming Languages
CSE 230: Winter 2008 Principles of Programming Languages Ocaml/HW #3 Q-A Session Push deadline = Mar 10 Session Mon 3pm? Lecture 15: Type Systems Ranjit Jhala UC San Diego Why Typed Languages? Development
More informationPart III Chapter 15: Subtyping
Part III Chapter 15: Subtyping Subsumption Subtype relation Properties of subtyping and typing Subtyping and other features Intersection and union types Subtyping Motivation With the usual typing rule
More informationThe gradual typing approach to mixing static and dynamic typing
1 / 38 The gradual typing approach to mixing static and dynamic typing Jeremy G. Siek University of Colorado = Indiana University TFP 2013 at Provo, Utah, May 2013 The Goals of Gradual Typing Enjoy the
More informationAt build time, not application time. Types serve as statically checkable invariants.
Static Typing Thus far we have only considered statically typed languages. CMPSCI 630: Programming Languages Static and Dynamic Typing Spring 2008 (with thanks to Robert Harper) Type system is based on
More informationCS558 Programming Languages
CS558 Programming Languages Fall 2016 Lecture 7a Andrew Tolmach Portland State University 1994-2016 Values and Types We divide the universe of values according to types A type is a set of values and a
More informationGradual Typing with Inference
Gradual Typing with Inference Jeremy Siek University of Colorado at Boulder joint work with Manish Vachharajani Overview Motivation Background Gradual Typing Unification-based inference Exploring the Solution
More informationCS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012
CS-XXX: Graduate Programming Languages Lecture 9 Simply Typed Lambda Calculus Dan Grossman 2012 Types Major new topic worthy of several lectures: Type systems Continue to use (CBV) Lambda Caluclus as our
More informationCSCI-GA Scripting Languages
CSCI-GA.3033.003 Scripting Languages 12/02/2013 OCaml 1 Acknowledgement The material on these slides is based on notes provided by Dexter Kozen. 2 About OCaml A functional programming language All computation
More informationAssignment 4: Semantics
Assignment 4: Semantics 15-411: Compiler Design Jan Hoffmann Jonathan Burns, DeeDee Han, Anatol Liu, Alice Rao Due Thursday, November 3, 2016 (9:00am) Reminder: Assignments are individual assignments,
More informationGADTs meet Subtyping
GADTs meet Subtyping Gabriel Scherer, Didier Rémy Gallium INRIA 2014 Gabriel Scherer, Didier Rémy (Gallium INRIA) GADTs meet Subtyping 2014 1 / 21 A reminder on GADTs GADTs are algebraic data types that
More informationTypes and Static Type Checking (Introducing Micro-Haskell)
Types and Static (Introducing Micro-Haskell) Informatics 2A: Lecture 13 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 16 October, 2012 1 / 21 1 Types 2 3 4 2 / 21 Thus far
More informationTypes and Programming Languages. Lecture 5. Extensions of simple types
Types and Programming Languages Lecture 5. Extensions of simple types Xiaojuan Cai cxj@sjtu.edu.cn BASICS Lab, Shanghai Jiao Tong University Fall, 2016 Coming soon Simply typed λ-calculus has enough structure
More informationLecture 6. Abstract Interpretation
Lecture 6. Abstract Interpretation Wei Le 2014.10 Outline Motivation History What it is: an intuitive understanding An example Steps of abstract interpretation Galois connection Narrowing and Widening
More informationCombining Programming with Theorem Proving
Combining Programming with Theorem Proving Chiyan Chen and Hongwei Xi Boston University Programming with Theorem Proving p.1/27 Motivation for the Research To support advanced type systems for practical
More informationCOS 320. Compiling Techniques
Topic 5: Types COS 320 Compiling Techniques Princeton University Spring 2016 Lennart Beringer 1 Types: potential benefits (I) 2 For programmers: help to eliminate common programming mistakes, particularly
More informationTyped Lambda Calculus and Exception Handling
Typed Lambda Calculus and Exception Handling Dan Zingaro zingard@mcmaster.ca McMaster University Typed Lambda Calculus and Exception Handling p. 1/2 Untyped Lambda Calculus Goal is to introduce typing
More informationGradual Typing for Functional Languages. Jeremy Siek and Walid Taha (presented by Lindsey Kuper)
Gradual Typing for Functional Languages Jeremy Siek and Walid Taha (presented by Lindsey Kuper) 1 Introduction 2 What we want Static and dynamic typing: both are useful! (If you re here, I assume you agree.)
More informationWe defined congruence rules that determine the order of evaluation, using the following evaluation
CS 4110 Programming Languages and Logics Lectures #21: Advanced Types 1 Overview In this lecture we will extend the simply-typed λ-calculus with several features we saw earlier in the course, including
More informationStructural polymorphism in Generic Haskell
Structural polymorphism in Generic Haskell Andres Löh andres@cs.uu.nl 5 February 2005 Overview About Haskell Genericity and other types of polymorphism Examples of generic functions Generic Haskell Overview
More informationNote that in this definition, n + m denotes the syntactic expression with three symbols n, +, and m, not to the number that is the sum of n and m.
CS 6110 S18 Lecture 8 Structural Operational Semantics and IMP Today we introduce a very simple imperative language, IMP, along with two systems of rules for evaluation called small-step and big-step semantics.
More informationLambda Calculi With Polymorphism
Resources: The slides of this lecture were derived from [Järvi], with permission of the original author, by copy & x = 1 let x = 1 in... paste or by selection, annotation, or rewording. [Järvi] is in turn
More informationStatic Checking and Type Systems
1 Static Checking and Type Systems Chapter 6 COP5621 Compiler Construction Copyright Robert van Engelen, Florida State University, 2007-2009 2 The Structure of our Compiler Revisited Character stream Lexical
More informationGADTs. Wouter Swierstra and Alejandro Serrano. Advanced functional programming - Lecture 7. [Faculty of Science Information and Computing Sciences]
GADTs Advanced functional programming - Lecture 7 Wouter Swierstra and Alejandro Serrano 1 Today s lecture Generalized algebraic data types (GADTs) 2 A datatype data Tree a = Leaf Node (Tree a) a (Tree
More informationGADTs. Alejandro Serrano. AFP Summer School. [Faculty of Science Information and Computing Sciences]
GADTs AFP Summer School Alejandro Serrano 1 Today s lecture Generalized algebraic data types (GADTs) 2 A datatype data Tree a = Leaf Node (Tree a) a (Tree a) This definition introduces: 3 A datatype data
More informationTypes for References, Exceptions and Continuations. Review of Subtyping. Γ e:τ τ <:σ Γ e:σ. Annoucements. How s the midterm going?
Types for References, Exceptions and Continuations Annoucements How s the midterm going? Meeting 21, CSCI 5535, Spring 2009 2 One-Slide Summary Review of Subtyping If τ is a subtype of σ then any expression
More informationCombining Static and Dynamic Contract Checking for Curry
Michael Hanus (CAU Kiel) Combining Static and Dynamic Contract Checking for Curry LOPSTR 2017 1 Combining Static and Dynamic Contract Checking for Curry Michael Hanus University of Kiel Programming Languages
More informationWhere is ML type inference headed?
1 Constraint solving meets local shape inference September 2005 2 Types are good A type is a concise description of the behavior of a program fragment. Typechecking provides safety or security guarantees.
More informationThe story so far. Elements of Programming Languages. Pairs in various languages. Pairs
Elements of Programming Languages Lecture 6: Data structures James Cheney University of Edinburgh October 9, 2017 The story so far We ve now covered the main ingredients of any programming language: Abstract
More informationA Brief Introduction to Standard ML
A Brief Introduction to Standard ML Specification and Verification with Higher-Order Logic Arnd Poetzsch-Heffter (Slides by Jens Brandt) Software Technology Group Fachbereich Informatik Technische Universität
More informationMotivation At the very begining Ni won t be complete until it has static typing 1 Maintenance needs nipkgs: 1M sloc Errors hard to spot 1 Eelco Dolstr
A type-system for Ni Théophane Hufschmitt October 28 2017 1 / 24 Motivation At the very begining Ni won t be complete until it has static typing 1 Maintenance needs nipkgs: 1M sloc Errors hard to spot
More informationDynamic Logic with Non-rigid Functions
Dynamic Logic with Non-rigid Functions A Basis for Object-oriented Program Verification Bernhard Beckert 1 André Platzer 2 1 University of Koblenz-Landau, Department of Computer Science beckert@uni-koblenz.de
More informationLecture Notes on Program Equivalence
Lecture Notes on Program Equivalence 15-312: Foundations of Programming Languages Frank Pfenning Lecture 24 November 30, 2004 When are two programs equal? Without much reflection one might say that two
More informationCSE-321 Programming Languages 2011 Final
Name: Hemos ID: CSE-321 Programming Languages 2011 Final Prob 1 Prob 2 Prob 3 Prob 4 Prob 5 Prob 6 Total Score Max 15 15 10 17 18 25 100 There are six problems on 18 pages in this exam, including one extracredit
More informationLecture Notes on Aggregate Data Structures
Lecture Notes on Aggregate Data Structures 15-312: Foundations of Programming Languages Frank Pfenning Lecture 8 September 23, 2004 In this lecture we discuss various language extensions which make MinML
More informationCS422 - Programming Language Design
1 CS422 - Programming Language Design From SOS to Rewriting Logic Definitions Grigore Roşu Department of Computer Science University of Illinois at Urbana-Champaign In this chapter we show how SOS language
More informationGADTs. Wouter Swierstra. Advanced functional programming - Lecture 7. Faculty of Science Information and Computing Sciences
GADTs Advanced functional programming - Lecture 7 Wouter Swierstra 1 Today s lecture Generalized algebraic data types (GADTs) 2 A datatype data Tree a = Leaf Node (Tree a) a (Tree a) This definition introduces:
More informationFundamental Concepts. Chapter 1
Chapter 1 Fundamental Concepts This book is about the mathematical foundations of programming, with a special attention on computing with infinite objects. How can mathematics help in programming? There
More informationSimple Unification-based Type Inference for GADTs
Simple Unification-based Type Inference for GADTs Stephanie Weirich University of Pennsylvania joint work with Dimitrios Vytiniotis, Simon Peyton Jones and Geoffrey Washburn Overview Goal: Add GADTs to
More informationBoolean expressions. Elements of Programming Languages. Conditionals. What use is this?
Boolean expressions Elements of Programming Languages Lecture 3: Booleans, conditionals, and types James Cheney So far we ve considered only a trivial arithmetic language L Arith Let s extend L Arith with
More informationLesson 4 Typed Arithmetic Typed Lambda Calculus
Lesson 4 Typed Arithmetic Typed Lambda 1/28/03 Chapters 8, 9, 10 Outline Types for Arithmetic types the typing relation safety = progress + preservation The simply typed lambda calculus Function types
More informationHarvard School of Engineering and Applied Sciences CS 152: Programming Languages
Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 14 Tuesday, March 24, 2015 1 Parametric polymorphism Polymorph means many forms. Polymorphism is the ability of
More informationCSE-321 Programming Languages 2014 Final
Name: Hemos ID: CSE-321 Programming Languages 2014 Final Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Total Score Max 15 12 14 14 30 15 100 There are six problems on 12 pages in this exam.
More informationExploring the Design Space of Higher-Order Casts ; CU-CS
University of Colorado, Boulder CU Scholar Computer Science Technical Reports Computer Science Fall 10-1-2008 Exploring the Design Space of Higher-Order Casts ; CU-CS-1047-08 Jeremy Siek University of
More informationλ calculus is inconsistent
Content Rough timeline COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Gerwin Klein, June Andronick, Toby Murray λ Intro & motivation, getting started [1] Foundations & Principles
More informationType Systems Winter Semester 2006
Type Systems Winter Semester 2006 Week 9 December 13 December 13, 2006 - version 1.0 Plan PREVIOUSLY: unit, sequencing, let, pairs, sums TODAY: 1. recursion 2. state 3.??? NEXT: exceptions? NEXT: polymorphic
More informationType Systems. Pierce Ch. 3, 8, 11, 15 CSE
Type Systems Pierce Ch. 3, 8, 11, 15 CSE 6341 1 A Simple Language ::= true false if then else 0 succ pred iszero Simple untyped expressions Natural numbers encoded as succ succ
More informationLambda Calculus and Type Inference
Lambda Calculus and Type Inference Björn Lisper Dept. of Computer Science and Engineering Mälardalen University bjorn.lisper@mdh.se http://www.idt.mdh.se/ blr/ August 17, 2007 Lambda Calculus and Type
More informationChapter 13: Reference. Why reference Typing Evaluation Store Typings Safety Notes
Chapter 13: Reference Why reference Typing Evaluation Store Typings Safety Notes References Computational Effects Also known as side effects. A function or expression is said to have a side effect if,
More informationCS131 Typed Lambda Calculus Worksheet Due Thursday, April 19th
CS131 Typed Lambda Calculus Worksheet Due Thursday, April 19th Name: CAS ID (e.g., abc01234@pomona.edu): I encourage you to collaborate. collaborations below. Please record your Each question is worth
More informationRecursive Types and Subtyping
Recursive Types and Subtyping #1 One-Slide Summary Recall: Recursive types (e.g., τ list) make the typed lambda calculus as powerful as the untyped lambda calculus. If τ is a subtype of σ then any expression
More informationCSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter p. 1/27
CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer Science (Arkoudas and Musser) Chapter 2.1-2.7 p. 1/27 CSCI.6962/4962 Software Verification Fundamental Proof Methods in Computer
More informationLogic - CM0845 Introduction to Haskell
Logic - CM0845 Introduction to Haskell Diego Alejandro Montoya-Zapata EAFIT University Semester 2016-1 Diego Alejandro Montoya-Zapata (EAFIT University) Logic - CM0845 Introduction to Haskell Semester
More informationOrnaments in ML. Thomas Williams, Didier Rémy. April 18, Inria - Gallium
Ornaments in ML Thomas Williams, Didier Rémy Inria - Gallium April 18, 2017 1 Motivation Two very similar functions let rec add m n = match m with Z n S m S (add m n) let rec append ml nl = match ml with
More informationOutline Mousavi: ADT
Outline Abstract Data Types Mohammad Mousavi Eindhoven University of Technology, The Netherlands Requirement Analysis and Design Verification (RADV) Outline Outline Basic Concepts Booleans Standard Data
More informationCMSC 631 Program Analysis and Understanding. Dynamic Typing, Contracts, and Gradual Typing
CMSC 631 Program Analysis and Understanding Dynamic Typing, Contracts, and Gradual Typing Static vs. Dynamic Typing Languages with Static Typing Examples: Ocaml, Java, C#, Scala, Haskell Typechecker proves
More informationPierce Ch. 3, 8, 11, 15. Type Systems
Pierce Ch. 3, 8, 11, 15 Type Systems Goals Define the simple language of expressions A small subset of Lisp, with minor modifications Define the type system of this language Mathematical definition using
More information2 Blending static and dynamic typing
2 Blending static and dynamic typing We begin this chapter presenting a little bit of the history behind combining static and dynamic typing in the same language. Then, we introduce optional type systems
More informationCS 320: Concepts of Programming Languages
CS 320: Concepts of Programming Languages Wayne Snyder Computer Science Department Boston University Lecture 02: Bare Bones Haskell Syntax: Data == Abstract Syntax Trees Functions == Rewrite Rules on ASTs
More informationType-indexed functions in Generic Haskell
Type-indexed functions in Generic Haskell Johan Jeuring September 15, 2004 Introduction Today I will talk about: a Types of polymorphism. b Type-indexed functions. c Dependencies. Read about b, and c in
More informationSemantic Subtyping. Alain Frisch (ENS Paris) Giuseppe Castagna (ENS Paris) Véronique Benzaken (LRI U Paris Sud)
Semantic Subtyping Alain Frisch (ENS Paris) Giuseppe Castagna (ENS Paris) Véronique Benzaken (LRI U Paris Sud) http://www.cduce.org/ Semantic Subtyping - Groupe de travail BD LRI p.1/28 CDuce A functional
More informationType-directed Syntax Transformations for ATS-style Programs with Proofs
Type-directed Syntax Transformations for ATS-style Programs with Proofs Andrei Lapets August 14, 2007 1 Introduction In their work on ATS [CX05] and ATS LF [CX04], the authors present an ML-like language
More informationType Checking. Outline. General properties of type systems. Types in programming languages. Notation for type rules.
Outline Type Checking General properties of type systems Types in programming languages Notation for type rules Logical rules of inference Common type rules 2 Static Checking Refers to the compile-time
More informationProgramming Languages Fall 2014
Programming Languages Fall 2014 Lecture 7: Simple Types and Simply-Typed Lambda Calculus Prof. Liang Huang huang@qc.cs.cuny.edu 1 Types stuck terms? how to fix it? 2 Plan First I For today, we ll go back
More informationSyntax and Grammars 1 / 21
Syntax and Grammars 1 / 21 Outline What is a language? Abstract syntax and grammars Abstract syntax vs. concrete syntax Encoding grammars as Haskell data types What is a language? 2 / 21 What is a language?
More informationType Checking. Error Checking
Type Checking Error Checking Dynamic checking takes place while program is running Static checking takes place during compilation Type checks Flow-of-control checks Uniqueness checks Name-related checks
More informationOutline. Introduction Concepts and terminology The case for static typing. Implementing a static type system Basic typing relations Adding context
Types 1 / 15 Outline Introduction Concepts and terminology The case for static typing Implementing a static type system Basic typing relations Adding context 2 / 15 Types and type errors Type: a set of
More informationOutline. General properties of type systems. Types in programming languages. Notation for type rules. Common type rules. Logical rules of inference
Type Checking Outline General properties of type systems Types in programming languages Notation for type rules Logical rules of inference Common type rules 2 Static Checking Refers to the compile-time
More informationNegations in Refinement Type Systems
Negations in Refinement Type Systems T. Tsukada (U. Tokyo) 14th March 2016 Shonan, JAPAN This Talk About refinement intersection type systems that refute judgements of other type systems. Background Refinement
More informationRecursive Types and Subtyping
Recursive Types and Subtyping #1 One-Slide Summary Recursive types (e.g., list) make the typed lambda calculus as powerful as the untyped lambda calculus. If is a subtype of then any expression of type
More informationSimply-Typed Lambda Calculus
#1 Simply-Typed Lambda Calculus #2 Back to School What is operational semantics? When would you use contextual (small-step) semantics? What is denotational semantics? What is axiomatic semantics? What
More information7. Introduction to Denotational Semantics. Oscar Nierstrasz
7. Introduction to Denotational Semantics Oscar Nierstrasz Roadmap > Syntax and Semantics > Semantics of Expressions > Semantics of Assignment > Other Issues References > D. A. Schmidt, Denotational Semantics,
More informationCS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011
CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics Dan Grossman Spring 2011 Review e ::= λx. e x e e c v ::= λx. e c τ ::= int τ τ Γ ::= Γ, x : τ (λx. e) v e[v/x] e 1 e 1 e 1 e
More informationSupplementary Notes on Exceptions
Supplementary Notes on Exceptions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 9 September 25, 2002 In this lecture we first give an implementation of the C-machine for the fragment
More informationAgenda. CS301 Session 11. Common type constructors. Things we could add to Impcore. Discussion: midterm exam - take-home or inclass?
Agenda CS301 Session 11 Discussion: midterm exam - take-home or inclass? Interlude: common type constructors Type soundness 1 2 Things we could add to Impcore Common type constructors Array is a type constructor,
More informationProgramming Languages Assignment #7
Programming Languages Assignment #7 December 2, 2007 1 Introduction This assignment has 20 points total. In this assignment, you will write a type-checker for the PolyMinML language (a language that is
More informationDenotational Semantics. Domain Theory
Denotational Semantics and Domain Theory 1 / 51 Outline Denotational Semantics Basic Domain Theory Introduction and history Primitive and lifted domains Sum and product domains Function domains Meaning
More informationLecture Notes on Data Representation
Lecture Notes on Data Representation 15-814: Types and Programming Languages Frank Pfenning Lecture 9 Tuesday, October 2, 2018 1 Introduction In this lecture we ll see our type system in action. In particular
More informationExercise 1 (2+2+2 points)
1 Exercise 1 (2+2+2 points) The following data structure represents binary trees only containing values in the inner nodes: data Tree a = Leaf Node (Tree a) a (Tree a) 1 Consider the tree t of integers
More information