CMSC 631 Program Analysis and Understanding Fall Type Systems
|
|
- Merry Cox
- 5 years ago
- Views:
Transcription
1 Program Analysis and Understanding Fall 2017 Type Systems
2 Type Systems A type system is a tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according to the kinds of values they compute. --Pierce They are good for Detecting errors (don t add an integer and a string) Abstraction (hiding representation details) Documentation (tersely summarize an API) Designs trade off efficiency, readability, power 2
3 Review: Simply-typed λ-calculus e ::= x n λx:τ.e e e τ ::= int τ τ Γ ::= Γ,x:τ Γ `e : τ in type environment Γ, expression e has type τ x dom(γ) Γ `n : int Γ ` x : Γ(x) Γ Γ, τ:x `e : τ `λx:τ.e : τ τ Γ ` e1 : τ τ Γ ` e2 : τ Γ ` e1 e2 : τ 3
4 Type Safety (Soundness) If e : τ then either there exists a value v of type τ such that e * v, or e diverges (doesn t terminate) Corollary: e will never get stuck never evaluates to a normal form that is not a value Proof by induction on the typing derivation 4
5 More types See: Practical Foundations of Programming Languages Preprint:
6 Data Products (Records); p. 92 τ ::= τ1* τ2 e ::= (e1,e2) fst e snd e Sums (Variants, Unions); p. 98 τ ::= τ1+ τ2 e ::= inl e inr e case e l.x e1 else r.x e2 Applications: void, unit, booleans, options, enumerations 6
7 Products: Typing Γ e1 : τ1 Γ e2 : τ2 Γ (e1,e2) : τ1*τ2 Γ e : τ1*τ2 Γ fst e : τ1 Γ e : τ1*τ2 Γ snd e : τ2 Γ () : unit 7
8 Sums: Typing Γ e : τ1 Γ inl e : τ1+τ2 Γ e : τ2 Γ inr e : τ1+τ2 Γ,x:τ1 e1 : τ Γ e : τ1+τ2 Γ,x:τ2 e2 : τ Γ case e l.x e1 else r.x e2 : τ bool def= unit+unit α option def= unit+α 8
9 Polymorphism (Generics): System F Universally quantified types (p. 113) τ ::= α α.τ e ::= Λα.e e τ Typing Type environments Δ ::= Δ,α Judgments - Δ τ ( τ is a well-formed type in Δ ) - Δ; Γ e : τ ( e has type τ in Γ and Δ ) 9
10 System F: Typing WF Δ int α Δ Δ α Δ,α τ Δ α.τ Δ τ Δ τ Δ τ τ 10
11 System F: Typing Δ,α; Γ e : τ Δ; Γ Λα.e : α.τ x dom(γ) Δ; Γ x : Γ(x) Δ; Γ e : α.τ Δ τ Δ; Γ e τ : τ[α τ ] Δ; Γ,x:τ e : τ Δ τ Δ; Γ λx:τ.e : τ τ Δ; Γ e1 : τ τ Δ; Γ e2 : τ Δ; Γ e1 e2 : τ 11
12 System F Examples: What type? makepair def= Λα. Λβ. λx:α. λy:β. (x,y) first def= Λα. Λβ. λp:α*β. fst x app2 def= Λα. λf:α α. λx:α. f (f x) makepair int bool 1 true first int int (app2 int*int (λx:int*int. (snd x,fst x)) (1,2)) 12
13 System F Examples: What term? α. α α α. β. α*β β*α α. β. (α β) α β α. int α. α α. (α α) α α. β. α α 13
14 System F Metatheory Highly expressive Can encode products, sums, natural numbers Type safety Strong normalization All System F terms will terminate Parametricity Useful theorems about an expression knowing only its type (in detail: Chap 48) 14
15 Abstract Data Types Existential types (p. 123) τ ::= α.τ e ::= pack τ with e as α.τ (hide type) unpack e1 as α with x:τ in e2 (use module) Typing same judgment form as System F Surprise! Existential types can be encoded with universal types (add no expressivity) 15
16 Existential Type Example: Counter type τ : α. (unit α)*(α α)*(α bool) body1 : ((λ_:unit. false), (λx:bool. if x then false else true), (λx:bool. x)) let x = pack bool with body1 as τ in unpack x as α with y:τ in let c = (fst y) () in let c = (fst (snd y)) c in print (snd (fst y)) c -- prints false 16
17 Existential Type Example: Counter type : α. (unit α)*(α α)*(α bool) body2 : ((λ_:unit. 0), let x = pack int with body2 as τ in unpack x as α with y:τ in let c = (fst y) () in (λx:int. x+1), let c = (fst (snd y)) c in print (snd (fst y)) c (λx:int. isodd x)) -- prints false Different implementation, same outcome 17
18 Existential Types: Typing Δ,α τ Δ α.τ Δ τ Δ,α τ Δ;Γ e : τ [α τ] Δ; Γ pack τ with e as α.τ : α.τ Δ τ2 Δ;Γ e1 : α.τ Δ,α; Γ,x:τ e2 : τ2 Δ; Γ unpack e1 as α with x:τ in e2 : τ2 18
19 Existential types: Encoding α.τ def= β.( α.τ β) β assume α τ pack τ with e as α.τ def= Λβ. λx:( α.τ β). x τ e unpack e1 as α with x:τ in e2 def= e1 τ2 (Λα. λx:τ. e2) τ2 is the final type of e2 τ is the abstract type α s definition 19
20 Representation Independence Essence of type abstraction Replacing one representation with another will not affect clients of abstract type Defined in terms of a relation R, parametrized by different ADT implementations Terms operating on these different implementations will have the same behavior Follows from parametricity in System F 20
21 Recursive Types Recursive types (p. 144) τ ::= μα.τ e ::= fold e unfold e Typing: same judgment form as System F Semantics: fold and unfold are no-ops Make type checking easier Nominal types (e.g., in C, Java) often recursive Global type names are like μ-bound type variables 21
22 Recursive Types: Typing Δ,α τ Δ μα.τ Δ; Γ e : τ[α μα.τ] Δ; Γ fold e : μα.τ Δ; Γ e : μα.τ Δ; Γ unfold e : τ[α μα.τ] 22
23 Recursive type example: Lists α list def= α. μβ. unit+(α*β) nil def= Λα. fold (inl ()) cons def= Λα. λx:α. λl:α list. fold (inr (x,l)) match def= Λα. λl:α list. case (unfold l) l.x e1 else r.x e2 23
24 Recursive functions Fix combinator (p. 134) e ::= fix x:τ is e Semantics fix x:τ is e e[x fix x:τ is e] Typing Γ,x:τ e : τ Γ fix x:τ is e : τ factorial def= fix x:int int is λy:int. if y=0 then 1 else y*(x (y-1)) 24
25 Recursive types more powerful Can encode fixpoint combinator (e.g., Y) In OCaml: type 'a recc = Fold of ('a recc -> 'a) let unfold (Fold x) = x let y f = (fun x a -> f (unfold x x) a) (Fold (fun x a -> f (unfold x x) a)) let fact = y (fun g b -> if b=0 then 1 else b*(g (b-1))) 25
CMSC 336: Type Systems for Programming Languages Lecture 10: Polymorphism Acar & Ahmed 19 February 2008
CMSC 336: Type Systems for Programming Languages Lecture 10: Polymorphism Acar & Ahmed 19 February 2008 Contents 1 Polymorphism 1 2 Polymorphic λ-calculus: Syntax 1 3 Static Semantics 2 4 Dynamic Semantics
More informationAn Introduction to Logical Relations Proving Program Properties Using Logical Relations
An Introduction to Logical Relations Proving Program Properties Using Logical Relations Lau Skorstengaard lask@cs.au.dk July 27, 2018 Contents 1 Introduction 2 1.1 Simply Typed Lambda Calculus....................
More information(2) (15pts) Using Prolog, implement a type-checker for the following small subset of System F:
CS 6371 Advanced Programming Languages Sample Spring 2018 Final Exam This sample final exam is LONGER than a real final exam (to give you more practice problems) and has a medium difficulty level. You
More information1 Introduction. 2 Recap The Typed λ-calculus λ. 3 Simple Data Structures
CS 6110 S18 Lecture 21 Products, Sums, and Other Datatypes 1 Introduction In this lecture, we add constructs to the typed λ-calculus that allow working with more complicated data structures, such as pairs,
More informationProgramming Languages
CSE 230: Winter 2010 Principles of Programming Languages Lecture 10: Programming in λ-calculusc l l Ranjit Jhala UC San Diego Review The lambda calculus is a calculus of functions: e := x λx. e e 1 e 2
More informationBlame for All. Amal Ahmed, Robert Bruce Findler, Jeremy Siek, Philip Wadler
Blame for All Amal Ahmed, Robert Bruce Findler, Jeremy Siek, Philip Wadler Vs. Part I The bit you know from before with a twist A simple untyped program let inc = λx. x + 1 in let app = λf. λx. f x in
More informationFoundations of Programming Languages. Paul Downen
Foundations of Programming Languages Paul Downen July 3 8, 2018 2 Contents 1 Static and Dynamic Semantics of a Little Language 7 1.1 Syntax................................. 7 1.2 Static Scope..............................
More informationState-Dependent Representation Independence (Technical Appendix)
State-Dependent Representation Independence (Technical Appendix) Amal Ahmed Derek Dreyer Andreas Rossberg TTI-C MPI-SWS MPI-SWS amal@tti-c.org dreyer@mpi-sws.mpg.de rossberg@mpi-sws.mpg.de Contents August
More informationReview. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007
CSE 230: Winter 2007 Principles of Programming Languages Lecture 12: The λ-calculus Ranjit Jhala UC San Diego Review The lambda calculus is a calculus of functions: e := x λx. e e 1 e 2 Several evaluation
More informationCSE505, Fall 2012, Final Examination December 10, 2012
CSE505, Fall 2012, Final Examination December 10, 2012 Rules: The exam is closed-book, closed-notes, except for one side of one 8.5x11in piece of paper. Please stop promptly at 12:20. You can rip apart
More informationSimply Typed Lambda Calculus
Simply Typed Lambda Calculus Language (ver1) Lambda calculus with boolean values t ::= x variable x : T.t abstraction tt application true false boolean values if ttt conditional expression Values v ::=
More informationCSE 505, Fall 2005, Midterm Examination 8 November Please do not turn the page until everyone is ready.
CSE 505, Fall 2005, Midterm Examination 8 November 2005 Please do not turn the page until everyone is ready. Rules: The exam is closed-book, closed-note, except for one side of one 8.5x11in piece of paper.
More informationCSE 505, Fall 2009, Midterm Examination 5 November Please do not turn the page until everyone is ready.
CSE 505, Fall 2009, Midterm Examination 5 November 2009 Please do not turn the page until everyone is ready Rules: The exam is closed-book, closed-note, except for one side of one 85x11in piece of paper
More informationA Calculus for Dynamic Loading
A Calculus for Dynamic Loading Michael Hicks University of Pennsylvania Stephanie Weirich Cornell University February 6, 2001 Abstract We present the load-calculus, used to model dynamic loading, and prove
More informationElement x is R-minimal in X if y X. R(y, x).
CMSC 22100/32100: Programming Languages Final Exam M. Blume December 11, 2008 1. (Well-founded sets and induction principles) (a) State the mathematical induction principle and justify it informally. 1
More informationNon-Parametric Parametricity
Non-Parametric Parametricity Georg Neis MPI-SWS neis@mpi-sws.org Derek Dreyer MPI-SWS dreyer@mpi-sws.org Andreas Rossberg MPI-SWS rossberg@mpi-sws.org Abstract Type abstraction and intensional type analysis
More informationLambda calculus. (Advanced Functional Programming) Jeremy Yallop. January Computer Laboratory University of Cambridge 1/ 29
1/ 29 Lambda calculus (Advanced Functional Programming) Jeremy Yallop Computer Laboratory University of Cambridge January 2015 Course outline 2/ 29 3/ 29 Books OCaml from the very beginning John Whitington
More informationTyping-by-encoding. A reductionistic approach to building type systems. François Pottier.
Typing-by-encoding A reductionistic approach to building type systems François Pottier Francois.Pottier@inria.fr Overview What is typing-by-encoding? Encoding exceptions into sums (folklore). Encoding
More informationNon-Parametric Parametricity
Non-Parametric Parametricity Georg Neis MPI-SWS neis@mpi-sws.org Derek Dreyer MPI-SWS dreyer@mpi-sws.org Andreas Rossberg MPI-SWS rossberg@mpi-sws.org Abstract Type abstraction and intensional type analysis
More informationCS 611 Advanced Programming Languages. Andrew Myers Cornell University. Lecture 26 Type reconstruction. 1 Nov 04. Type reconstruction
CS 611 Advanced Programming Languages Andrew Myers Cornell University Lecture 26 Type reconstruction 1 Nov 04 Type reconstruction Simple typed language: e ::= x b λx:τ. e e 1 e 2 e 1 + e 2 if e 0 then
More informationLOGICAL STEP-INDEXED LOGICAL RELATIONS
LOGICAL STEP-INDEXED LOGICAL RELATIONS DEREK DREYER, AMAL AHMED, AND LARS BIRKEDAL MPI-SWS, Germany e-mail address: dreyer@mpi-sws.org Indiana University, USA e-mail address: amal@cs.indiana.edu IT University
More informationState-Dependent Representation Independence
State-Dependent Representation Independence Amal Ahmed TTI-C amal@tti-c.org Derek Dreyer MPI-SWS dreyer@mpi-sws.mpg.de Andreas Rossberg MPI-SWS rossberg@mpi-sws.mpg.de Abstract Mitchell s notion of representation
More informationState-Dependent Representation Independence
State-Dependent Representation Independence Amal Ahmed TTI-C amal@tti-c.org Derek Dreyer MPI-SWS dreyer@mpi-sws.mpg.de Andreas Rossberg MPI-SWS rossberg@mpi-sws.mpg.de Abstract Mitchell s notion of representation
More informationCS 6110 Lecture 28 Subtype Polymorphism 3 April 2013 Lecturer: Andrew Myers
CS 6110 Lecture 28 Subtype Polymorphism 3 April 2013 Lecturer: Andrew Myers 1 Introduction In this lecture, we make an attempt to extend the typed λ-calculus for it to support more advanced data structures
More informationBeyond First-Order Logic
Beyond First-Order Logic Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) Beyond First-Order Logic MFES 2008/09 1 / 37 FOL
More informationStep-indexed models of call-by-name: a tutorial example
Step-indexed models of call-by-name: a tutorial example Aleš Bizjak 1 and Lars Birkedal 1 1 Aarhus University {abizjak,birkedal}@cs.au.dk June 19, 2014 Abstract In this tutorial paper we show how to construct
More informationStep-Indexed Logical Relations for Probability
Step-Indexed Logical Relations for Probability Aleš Bizjak and Lars Birkedal Aarhus University {abizjak,birkedal}@cs.au.dk Abstract. It is well-known that constructing models of higher-order probabilistic
More informationTyping λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus
Course 2D1453, 200607 Advanced Formal Methods Lecture 3: Simply Typed Lambda calculus Mads Dam KTH/CSC Some material from B. Pierce: TAPL + some from G. Klein, NICTA Typing λterms The uptyped λcalculus
More informationLimitations of OCAML records
Limitations of OCAML records The record types must be declared before they are used; a label e can belong to only one record type (otherwise fun x x.e) would have several incompatible types; we cannot
More informationTotal (Co)Programming with Guarded Recursion
Total (Co)Programming with Guarded Recursion Andrea Vezzosi Department of Computer Science and Engineering Chalmers University of Technology, Gothenburg, Sweden Types for Proofs and Programs Annual Meeting
More informationA Bisimulation for Type Abstraction and Recursion
A Bisimulation for Type Abstraction Recursion EIJIRO SUMII Tohoku University BENJAMIN C. PIERCE University of Pennsylvania We present a bisimulation method for proving the contextual equivalence of packages
More informationSupporting Unrestricted Recursive Types
Supporting Unrestricted Recursive Types Zhaozhong Ni Microsoft Research One Microsoft Way, Redmond, WA 98052, U.S.A. zhaozhong.ni@microsoft.com Abstract. Recursive types capture important invariants in
More informationCS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus
CS 4110 Programming Languages & Logics Lecture 16 Programming in the λ-calculus 30 September 2016 Review: Church Booleans 2 We can encode TRUE, FALSE, and IF, as: TRUE λx. λy. x FALSE λx. λy. y IF λb.
More informationRealizability Semantics of Parametric Polymorphism, General References, and Recursive Types
Realizability Semantics of Parametric Polymorphism, General References, and Recursive Types Lars Birkedal IT University of Copenhagen Joint work with Kristian Støvring and Jacob Thamsborg Oct, 2008 Lars
More informationLogical Step-Indexed Logical Relations
Logical Step-Indexed Logical Relations Derek Dreyer MPI-SWS dreyer@mpi-sws.org Amal Ahmed TTI-Chicago amal@tti-c.org Lars Birkedal IT University of Copenhagen birkedal@itu.dk Abstract We show how to reason
More informationNon-parametric parametricity
JFP 21 (4 & 5): 497 562, 2011. c Cambridge University Press 2011 doi:10.1017/s0956796811000165 497 Non-parametric parametricity G E O R G N E I S, D E R E K D R E Y E R and A N D R E A S R O S S B E R
More informationSyntax and semantics of a GPU kernel programming language
Syntax and semantics of a GPU kernel programming language John Wickerson April 17, 2016 Abstract This document accompanies the article The Design and Implementation of a Verification Technique for GPU
More informationCSE 505, Fall 2008, Midterm Examination 29 October Please do not turn the page until everyone is ready.
CSE 505, Fall 2008, Midterm Examination 29 October 2008 Please do not turn the page until everyone is ready. Rules: The exam is closed-book, closed-note, except for one side of one 8.5x11in piece of paper.
More informationTyped Closure Conversion Preserves Observational Equivalence
Typed Closure Conversion Preserves Observational Equivalence Amal Ahmed Matthias Blume Abstract Language-based security relies on the assumption that all potential attacks are bound by the rules of the
More informationTyped Closure Conversion Preserves Observational Equivalence
Typed Closure Conversion Preserves Observational Equivalence Amal Ahmed Matthias Blume Abstract Language-based security relies on the assumption that all potential attacks are bound by the rules of the
More informationOutline. A recursive function follows the structure of inductively-defined data.
Outline A recursive function follows the structure of inductively-defined data. With lists as our example, we shall study 1. inductive definitions (to specify data) 2. recursive functions (to process data)
More informationA On Subtyping-Relation Completeness, with an Application to Iso-Recursive Types
A On Subtyping-Relation Completeness, with an Application to Iso-Recursive Types Jay Ligatti, University of South Florida Jeremy Blackburn, Telefonica Research Michael Nachtigal, University of South Florida
More informationCIS 500 Software Foundations Midterm II Answer key November 17, 2004
CIS 500 Software Foundations Midterm II Answer key November 17, 2004 Simply typed lambda-calculus The following questions refer to the simply typed lambda-calculus with booleans and error. The syntax,
More informationA Bisimulation for Type Abstraction and Recursion
University of Pennsylvania ScholarlyCommons Departmental Papers (CIS) Department of Computer & Information Science January 2005 A Bisimulation for Type Abstraction and Recursion Eijiro Sumii University
More informationSystem F. Proofs and Types. Bow-Yaw Wang. Academia Sinica. Spring 2012
Proofs and Types System F Bow-Yaw Wang Academia Sinica Spring 2012 The Calculus Types in System F are defined as follows. type variables: X, Y,.... if U and V are types, then U V is a type. if V is a type
More informationContextual equivalence
Techniques 16/22 ACS L16, lecture 2 4/10 Contextual equivalence Two phrases of a programming language are ( Morris style ) contextually equivalent ( = ctx ) if occurrences of the first phrase in any program
More informationTechniques. Contextual equivalence
Techniques 16/22 Contextual equivalence Two phrases of a programming language are ( Morris style ) contextually equivalent ( = ctx )if occurrences of the first phrase in any program can be replaced by
More informationInformation Flow Inference for ML
Information Flow Inference for ML Vincent Simonet INRIA Rocquencourt Projet Cristal MIMOSA September 27, 2001 Information flow account number bank applet order vendor account H order L bank H vendor L
More informationParametricity and GADTs
Dimitrios Vytiniotis Stephanie Weirich Computer and Information Science Department University of Pennsylvania Boston, July 2006 A very simple GADT example data R :: * -> * where Rint :: R Int Rbool ::
More informationInformation Flow Inference for ML
POPL 02 INRIA Rocquencourt Projet Cristal Francois.Pottier@inria.fr http://cristal.inria.fr/~fpottier/ Vincent.Simonet@inria.fr http://cristal.inria.fr/~simonet/ Information flow analysis account number
More informationLectures Notes on Progress
Lectures Notes on Progress 15-312: Foundations of Programming Languages Frank Pfenning Lecture 7 September 21, 2004 In this lecture we prove the progress property for MinML, discuss type safety, and consider
More informationBoxes Go Bananas: Encoding Higher-Order Abstract Syntax with Parametric Polymorphism (Extended Version)
Boxes Go Bananas: Encoding Higher-Order Abstract Syntax with Parametric Polymorphism (Extended Version) Geoffrey Washburn Stephanie Weirich Department of Computer and Information Science University of
More informationTyped Closure Conversion Preserves Observational Equivalence
Typed Closure Conversion Preserves Observational Equivalence Amal Ahmed Matthias Blume Toyota Technological Institute at Chicago {amal, blume}@tti-c.org Abstract Language-based security relies on the assumption
More informationPrincipal types Robustness to program transformations Practice. Type constraints for simple types Type constraints for ML Type inference in ML F
1 Design iml F : an implicity-typed extension of System F Types explained eml F : an explicitly-typed version of iml F 2 Results Principal types Robustness to program transformations Practice 3 Type inference
More informationTyped Arithmetic Expressions
Typed Arithmetic Expressions CS 550 Programming Languages Jeremy Johnson TAPL Chapters 3 and 5 1 Types and Safety Evaluation rules provide operational semantics for programming languages. The rules provide
More informationCombined Satisfiability Modulo Parametric Theories
Intel 07 p.1/39 Combined Satisfiability Modulo Parametric Theories Sava Krstić*, Amit Goel*, Jim Grundy*, and Cesare Tinelli** *Strategic CAD Labs, Intel **The University of Iowa Intel 07 p.2/39 This Talk
More informationEDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach
EDA045F: Program Analysis LECTURE 10: TYPES 1 Christoph Reichenbach In the last lecture... Performance Counters Challenges in Dynamic Performance Analysis Taint Analysis Binary Instrumentation 2 / 44 Types
More informationType Systems. Lecture 9: Classical Logic. Neel Krishnaswami University of Cambridge
Type Systems Lecture 9: Classical Logic Neel Krishnaswami University of Cambridge Where We Are We have seen the Curry Howard correspondence: Intuitionistic propositional logic Simply-typed lambda calculus
More informationSimply Typed Lambda-Calculi (II)
THEORY AND PRACTICE OF FUNCTIONAL PROGRAMMING Simply Typed Lambda-Calculi (II) Dr. ZHANG Yu Institute of Software, Chinese Academy of Sciences Fall term, 2011 GUCAS, Beijing Introduction PCF Programming
More informationRelational Parametricity for a Polymorphic Linear Lambda Calculus
Relational Parametricity for a Polymorphic Linear Lambda Calculus Jianzhou Zhao, Qi Zhang, and Steve Zdancewic University of Pennsylvania {jianzhou,qzh,stevez}@cis.upenn.edu Abstract. This paper presents
More informationIntensional Analysis of Quantified Types
Intensional Analysis of Quantified Types BRATIN SAHA, VALERY TRIFONOV, and ZHONG SHAO Yale University Compilers for polymorphic languages can use run-time type inspection to support advanced implementation
More informationExtending the Lambda Calculus: An Eager Functional Language
Syntax of the basic constructs: Extending the Lambda Calculus: An Eager Functional Language canonical forms z cfm ::= intcfm boolcfm funcfm tuplecfm altcfm intcfm ::= 0 1-1... boolcfm ::= boolconst funcfm
More informationProgramming Languages Fall 2013
Programming Languages Fall 2013 Lecture 11: Subtyping Prof Liang Huang huang@qccscunyedu Big Picture Part I: Fundamentals Functional Programming and Basic Haskell Proof by Induction and Structural Induction
More informationFunctional Object Calculus
Notations a, b Ter terms d D, e E iterators over some finite sets f, g, h F field names i, j, k N indices (usually i < j < k) l Loc locations m, m d, m e M method names u, v, w Val values x, y, z Var variables
More informationSimple Type Extensions
Simple Type Extensions Type Systems, Lecture 4 Jevgeni Kabanov Tartu, 14.02.2006 PREVIOUSLY ON TYPE SYSTEMS Lambda Calculus Embedded Booleans and Arithmetical expressions Fixpoints and Recursion Simple
More informationSystem F with Constraint Types
Boston University OpenBU Computer Science http://open.bu.edu CAS: Computer Science: Technical Reports 2007 System F with Constraint Types Donnelly, Kevin Boston University Computer Science Department https://hdl.handle.net/2144/1692
More information0.1 Random useful facts. 0.2 Language Definition
0.1 Random useful facts Lemma double neg : P : Prop, {P} + { P} P P. Lemma leq dec : n m, {n m} + {n > m}. Lemma lt dec : n m, {n < m} + {n m}. 0.2 Language Definition Definition var := nat. Definition
More informationFully-Abstract Compilation by Approximate Back-Translation Technical Appendix
Fully-Abstract Compilation by Approximate Back-Translation Technical Appendix Abstract This technical appendix provides the full formalisation and proofs for its paper 1 Contents 1 The Source Language
More informationType Soundness for Path Polymorphism
Type Soundness for Path Polymorphism Andrés Ezequiel Viso 1,2 joint work with Eduardo Bonelli 1,3 and Mauricio Ayala-Rincón 4 1 CONICET, Argentina 2 Departamento de Computación, FCEyN, UBA, Argentina 3
More informationTypes and Programming Languages (15-814), Fall 2018 Assignment 4: Data Representation (Sample Solutions)
Types and Programming Languages (15-814), Fall 2018 Assignment 4: Data Representation (Sample Solutions) Contact: 15-814 Course Staff Due Tuesday, October 16, 2018, 10:30am This assignment is due by 10:30am
More informationBRICS. A Computational Formalization for Partial Evaluation. (Extended Version) Basic Research in Computer Science
BRICS RS-96-34 Hatcliff & Danvy: A Computational Formalization for Partial Evaluation BRICS Basic Research in Computer Science A Computational Formalization for Partial Evaluation (Extended Version) John
More informationRelational Parametricity for Polymorphic Linear Lambda Calculus
University of Pennsylvania ScholarlyCommons Departmental Papers (CIS) Department of Computer & Information Science 1-2010 Relational Parametricity for Polymorphic Linear Lambda Calculus Jianzhou Zhao University
More informationFormal Methods Lecture 8. (B. Pierce's slides for the book Types and Programming Languages )
Formal Methods Lecture 8 (B. Pierce's slides for the book Types and Programming Languages ) Erasure and Typability Erasure We can transform terms in λ to terms of the untyped lambda-calculus simply by
More informationLecture 2: Self-interpretation in the Lambda-calculus
Lecture 2: Self-interpretation in the Lambda-calculus H. Geuvers Nijmegen, NL 21st Estonian Winter School in Computer Science Winter 2016 H. Geuvers - Radboud Univ. EWSCS 2016 Self-interpretation in λ-calculus
More informationType Systems as a Foundation for Reliable Computing
Type Systems as a Foundation for Reliable Computing Robert Harper Carnegie Mellon University Summer School on Reliable Computing University of Oregon July, 2005 References These lectures are based on the
More informationProgramming Languages and Types
Programming Languages and Types Klaus Ostermann based on slides by Benjamin C. Pierce Subtyping Motivation With our usual typing rule for applications the term is not well typed. ` t 1 : T 11!T 12 ` t
More informationCode Generation for a Simple First-Order Prover
Code Generation for a Simple First-Order Prover Jørgen Villadsen, Anders Schlichtkrull, and Andreas Halkjær From DTU Compute, Technical University of Denmark, 2800 Kongens Lyngby, Denmark Abstract. We
More informationSemantics and Verification of Software
Semantics and Verification of Software Thomas Noll Software Modeling and Verification Group RWTH Aachen University http://moves.rwth-aachen.de/teaching/ss-15/sv-sw/ The Denotational Approach Denotational
More informationThe Marriage of Bisimulations and Kripke Logical Relations
The Marriage of Bisimulations and Kripke Logical Relations Chung-Kil Hur Derek Dreyer Georg Neis Viktor Vafeiadis Max Planck Institute for Software Systems (MPI-SWS) {gil,dreyer,neis,viktor}@mpi-sws.org
More informationProgramming with Dependent Types in Coq
Programming with Dependent Types in Coq Matthieu Sozeau LRI, Univ. Paris-Sud - Démons Team & INRIA Saclay - ProVal Project PPS Seminar February 26th 2009 Paris, France Coq A higher-order, polymorphic logic:
More informationNotes from Yesterday s Discussion. Big Picture. CIS 500 Software Foundations Fall November 1. Some lessons.
CIS 500 Software Foundations Fall 2006 Notes from Yesterday s Email Discussion November 1 Some lessons This is generally a crunch-time in the semester Slow down a little and give people a chance to catch
More informationDenotational semantics
Denotational semantics Semantics and Application to Program Verification Antoine Miné École normale supérieure, Paris year 2015 2016 Course 4 4 March 2016 Course 4 Denotational semantics Antoine Miné p.
More informationImperative Insertion Sort
Imperative Insertion Sort Christian Sternagel April 17, 2016 Contents 1 Looping Constructs for Imperative HOL 1 1.1 While Loops............................ 1 1.2 For Loops.............................
More informationTechnical Report No Proofs Accompanying Fast and Loose Reasoning is Morally Correct NILS ANDERS DANIELSSON
Technical Report No. 07-15 Proofs Accompanying Fast and Loose Reasoning is Morally Correct NILS ANDERS DANIELSSON Department of Computer Science and Engineering Division of Computing Science CHALMERS UNIVERSITY
More information(Type) Constraints. Solving constraints Type inference
A (quick) tour of ML F (Graphic) Types (Type) Constraints Solving constraints Type inference Type Soundness A Fully Graphical Presentation of ML F Didier Rémy & Boris Yakobowski Didier Le Botlan INRIA
More informationKleene realizability and negative translations
Q E I U G I C Kleene realizability and negative translations Alexandre Miquel O P. D E. L Ō A U D E L A R April 21th, IMERL Plan 1 Kleene realizability 2 Gödel-Gentzen negative translation 3 Lafont-Reus-Streicher
More informationCVO103: Programming Languages. Lecture 2 Inductive Definitions (2)
CVO103: Programming Languages Lecture 2 Inductive Definitions (2) Hakjoo Oh 2018 Spring Hakjoo Oh CVO103 2018 Spring, Lecture 2 March 13, 2018 1 / 20 Contents More examples of inductive definitions natural
More informationFrom parametric polymorphism to models of polymorphic FPC
Under consideration for publication in Math. Struct. in Comp. Science From parametric polymorphism to models of polymorphic FPC Rasmus Ejlers Møgelberg IT University of Copenhagen Rued Langgaards Vej 7
More informationIf Mathematical Proof is a Game, What are the States and Moves? David McAllester
If Mathematical Proof is a Game, What are the States and Moves? David McAllester 1 AlphaGo Fan (October 2015) AlphaGo Defeats Fan Hui, European Go Champion. 2 AlphaGo Lee (March 2016) 3 AlphaGo Zero vs.
More informationFormal Methods Lecture 6. (B. Pierce's slides for the book Types and Programming Languages )
Formal Methods Lecture 6 (B. Pierce's slides for the book Types and Programming Languages ) This Saturday, 10 November 2018, room 335 (FSEGA), we will recover the following activities: 1 Formal Methods
More informationOperational Semantics
Operational Semantics Semantics and applications to verification Xavier Rival École Normale Supérieure Xavier Rival Operational Semantics 1 / 50 Program of this first lecture Operational semantics Mathematical
More information1 Problem 1. (20 pts)
CS 336 Programming Languages Homework Solution 4 Winter 2005 Due 2/24/05 1 Problem 1. (20 pts) Do Exercise 18.6.2. We define a meta-operation + on types as follows: If R is a record type with labels given
More informationSimply Typed Lambda Calculus
Simply Typed Lambda Calculus Mathias Vorreiter Pedersen November 13, 2015 1 Recalling the untyped lambda calculus 1.1 Syntax t ::= x λ x. t t t 1.2 Evaluation x x t t λx.t λx.t t 1 t 1 t 2 t 2 t 1 t 2
More informationLecture Notes: Axiomatic Semantics and Hoare-style Verification
Lecture Notes: Axiomatic Semantics and Hoare-style Verification 17-355/17-665/17-819O: Program Analysis (Spring 2018) Claire Le Goues and Jonathan Aldrich clegoues@cs.cmu.edu, aldrich@cs.cmu.edu It has
More informationA Generic Type System for the Pi-Calculus
A Generic Type System for the Pi-Calculus Atsushi Igarashi Kyoto University email:igarashi@kuis.kyoto-u.ac.jp Naoki Kobayashi Tokyo Institute of Technology email:kobayasi@cs.titech.ac.jp April 20, 2009
More informationInteroperation for Lazy and Eager Evaluation
Interoperation for Lazy and Eager Evaluation 1 Matthews & Findler New method of interoperation Type safety, observational equivalence & transparency Eager evaluation strategies Lazy vs. eager 2 Lambda
More informationTaming Selective Strictness
Taming Selective Strictness Daniel Seidel and Janis Voigtländer Technische Universität Dresden, 01062 Dresden, Germany {seideld,voigt}@tcs.inf.tu-dresden.de Abstract: Free theorems establish interesting
More informationElaborating evaluation-order polymorphism
Elaborating evaluation-order polymorphism Joshua Dunfield University of British Columbia ICFP 2015 1 (prologue) ICFP in Canada for the first time since 2008 2 (prologue) ICFP in Canada for the first time
More informationFree Groups. Joachim Breitner. April 17, 2016
Free Groups Joachim Breitner April 17, 2016 Abstract Free Groups are, in a sense, the most generic kind of group. They are defined over a set of generators with no additional relations in between them.
More informationIntroduction to lambda calculus Part 6
Introduction to lambda calculus Part 6 Antti-Juhani Kaijanaho 2017-02-16 1 Untyped lambda calculus 2 Typed lambda calculi 2.1 Dynamically typed lambda calculus with integers 2.2 A model of Lisp 2.3 Simply
More information