A Polymorphic Type and System for Multi-Staged Exceptions
|
|
- Gloria Long
- 6 years ago
- Views:
Transcription
1 A Polymorphic Type System for Multi-Staged Exceptions Seoul National University 08/04/2006 This is a joint work with In-Sook Kim and Kwangkeun Yi
2 Outlie 1. Introduction and Examples 2. Operational Semantics 3. Monomorphic Type System (APLAS 2006) 4. Polymorphic Type System 5. Conclusion
3 Introduction and Examples
4 Multi-Staged Languages Macros, partial evaluation, code generation, etc. Normal computation (at stage 0) λ-calculus Code composition (at stage > 0) quasi-quote in Lisp backquote ( ): create code template comma (,): code substitution eval (eval): execute code template let x = 1 let y = (,x+2) in eval y
5 Exceptions Control diverter Raised exceptions can escape control structures Error handler When error occurs, we raise an exception. Then, handlers can catch the raised exception to handle it. Possible safety hole Uncaught exceptions cause abnormal termination of programs fun find [] x = raise NotFound find h::t x = if h=x then raise Found else find t x find [1,2,3] 2 handle Found => true NotFound => false
6 Exceptions in Multi-Staged Languages Restriction exceptions must be raised and handled only at stage 0 Most interesting feature exceptions raised during code composition can be raised and handled at stage 0 can cross stages upwards by comma(,) and downwards by backquote( )
7 Staged Exception Examples (1/4) fun g [] = 1 g x::r = (,x *,(g r)) fun f ls = (a *,(g ls)) input: 2:: 0:: 3::[] output: (a * 2 * 0 * 3 * 1)
8 Staged Exception Examples (2/4) Raise exception Zero when input has 0 fun g [] = 1 g x::r = if x = 0 then raise Zero else (,x *,(g r)) fun f ls = (a *,(g ls)) input: 2:: 0:: 3::[] output: uncaught exception Zero
9 Staged Exception Examples (3/4) We can handle Zero at stage 0 in the code composition fun g [] = 1 g x::r = if x = 0 then raise Zero else (,x *,(g r)) fun f ls = (a *,((g ls) handle Zero => 0)) input: 2:: 0:: 3::[] output: (a * 0)
10 Staged Exception Examples (4/4) Or, we can handle Zero at stage 0 outside the code composition fun g [] = 1 g x::r = if x = 0 then raise Zero else (,x *,(g r)) fun f ls = (a *,(g ls)) handle Zero => 0 input: 2:: 0:: 3::[] output: 0
11 Goal A static type system that supports Lisp/Scheme s quasi-quote operators and exception facilities
12 Idea effect E: set of possible uncaught exceptions expression e has effect E and c E means that the expression may raise uncaught exception c. code s type: annotated with latent effect evaluation of code (raise c) : (Γ A, {c}), eval (raise c) : A, {c}
13 Example fun g [] = 1 g x::r = if x = 0 then raise Zero else (,x *,(g r)) g : ( int, ) list {Zero} ( int, ), fun f ls = (a *,(g ls)) handle Zero => 0 handler at stage 0 f : ( int, ) list ({a : int} int, ), fun f ls = (a *,(g ls) handle Zero => 0) handler at stage 1 f : ( int, ) list {Zero} ({a : int} int, ),
14 Operational Semantics
15 Language e Exp ::= i c x λx.e e 1e 2 box e code template e unbox k e code substitution, e eval e code execution eval e raise e exception raise handle e 1 c e 2 exception handle Evaluation where e n r n: a stage number r: a value v or raised exception c
16 Operational Semantics Exceptions must be raised and handled only at stage 0 Normal computations (at stage 0) and Propagation of code compositions (at stage n > 0) raised exceptions (ERAISE) (EHANDLE) e 0 c raise e 0 c n e v e raise e n (n > 0) raise v e 1 0 v handle e 1 c e 2 0 v e 1 0 c e 2 0 v handle e 1 c e 2 0 v e 1 0 c handle e 1 c e 2 0 c n c raise e n (n 0) c n e 1 c n (n > 0) handle e 1 c e 2 c n e 1 c handle e 1 c n (n > 0) e 2 c n e 2 c n (n > 0) handle e 1 c e 2 c
17 Operational Semantics Exceptions can cross stages upwards or downwards Normal computations (at stage 0) and Propagation of code compositions (at stage n > 0) raised exceptions (EBOX) (EUNBOX) (EEVAL) e n+1 v e box e n (n 0) box v e 0 box v unbox k e n (n = k > 0) v v e unbox k e n (n > k > 0) unbox k v e n k e 0 box v 1 v 1 0 v 0 eval e 0 v 0 n e v e eval e n (n > 0) eval v n+1 c box e n (n 0) c n k c unbox k e n (n k > 0) c n c eval e n (n 0) c
18 Monomorphic Type System
19 Type and effect A, B Type ::= int exn(e) A E B (Γ A, E) E Effects = 2 Exn c Exn = set of exception names Typing judgment Γ 0 Γ n e : A, E n E 0
20 Typing rules c E Γ 0 Γ n c : exn(e), E n 1 E 0 (TEXN) Γ 0 Γ n e : exn(e), E n E n 1 E 0 Γ 0 Γ n raise e : A, (E E n )E n 1 E 0 (TRAISE) Γ 0 Γ n e 1 : A, E n E n 1 E 0 Γ 0 Γ n e 2 : A, E n E n 1 (THANDLE) E 0 Γ 0 Γ n handle e 1 c e 2 : A, ((E n \ {c}) E n )(E n 1 E n 1 ) (E 0 E 0 )
21 Typing rules Γ 0 Γ n Γ e : A, EE n E 0 Γ 0 Γ n box e : (Γ A, E), E n E 0 (TBOX) Γ 0 Γ n e : (Γ n+k A, E), E n E 0 Γ 0 Γ n Γ n+k unbox k e : A, E k 1 E n E 0 (TUNBOX) Γ 0 Γ n e : ( A, E), E n E n 1 E 0 Γ 0 Γ n eval e : A, (E E n )E n 1 E 0 (TEVAL)
22 Typing rules Γ 0 Γ n + x : A e : B, E n E n 1 E 0 Γ 0 Γ n λx.e : A En B, E n 1 E 0 (TABS) Γ 0 Γ n e 1 : A E B, E n E n 1 E 0 Γ 0 Γ n e 2 : A, E ne n 1 E 0 Γ 0 Γ n e 1 e 2 : B, (E E n E n )(E n 1 E n 1 ) (E 0 E 0 ) (TAPP) Γ 0 Γ n e : A, E n E 0 E n E n E 0 E 0 Γ 0 Γ n e : A, E n E 0 (TSUB)
23 Example fun g [] = 1 g x::r = if x = 0 then raise Zero else (,x *,(g r)) g : ( int, ) list {Zero} ( int, ), fun f ls = (a *,(g ls)) handle Zero => 0 ( int, ), {Zero}
24 Example fun g [] = 1 g x::r = if x = 0 then raise Zero else (,x *,(g r)) g : ( int, ) list {Zero} ( int, ), fun f ls = (a *,(g ls)) handle Zero => 0 ( int, ), {Zero}
25 Example fun g [] = 1 g x::r = if x = 0 then raise Zero else (,x *,(g r)) g : ( int, ) list {Zero} ( int, ), fun f ls = (a *,(g ls)) handle Zero => 0 int, {Zero}
26 Example fun g [] = 1 g x::r = if x = 0 then raise Zero else (,x *,(g r)) g : ( int, ) list {Zero} ( int, ), fun f ls = (a *,(g ls)) handle Zero => 0 ({a : int} int, ), {Zero}
27 Example fun g [] = 1 g x::r = if x = 0 then raise Zero else (,x *,(g r)) g : ( int, ) list {Zero} ( int, ), fun f ls = (a *,(g ls)) handle Zero => 0 ({a : int} int, ),
28 Example fun g [] = 1 g x::r = if x = 0 then raise Zero else (,x *,(g r)) g : ( int, ) list {Zero} ( int, ), fun f ls = (a *,(g ls)) handle Zero => 0 f : ( int, ) list ({a : int} int, ),
29 Example fun g [] = 1 g x::r = if x = 0 then raise Zero else (,x *,(g r)) g : ( int, ) list {Zero} ( int, ), fun f ls = (a *,(g ls)) handle Zero => 0 handler at stage 0 int, {Zero} fun f ls = (a *,(g ls) handle Zero => 0) handler at stage 1 int, {Zero}
30 Example fun g [] = 1 g x::r = if x = 0 then raise Zero else (,x *,(g r)) g : ( int, ) list {Zero} ( int, ), fun f ls = (a *,(g ls)) handle Zero => 0 handler at stage 0 ({a : int} int, ), {Zero} fun f ls = (a *,(g ls) handle Zero => 0) handler at stage 1 int, {Zero}
31 Example fun g [] = 1 g x::r = if x = 0 then raise Zero else (,x *,(g r)) g : ( int, ) list {Zero} ( int, ), fun f ls = (a *,(g ls)) handle Zero => 0 handler at stage 0 ({a : int} int, ), fun f ls = (a *,(g ls) handle Zero => 0) handler at stage 1 ({a : int} int, ), {Zero}
32 Soundness Lemma (Demotion and Promotion) Suppose Γ 1 Γ n v : A, E n E If Γ 1 = then Γ 1 Γ n v : A, E n E For all Γ 1 Γ m, E m E 1, Γ 1 Γ mγ 1 Γ n v : A, E n E 1E m E 1E 0. Lemma (Empty Effect of v 0 ) If Γ 0 v : A, E then Γ 0 v : A,. Theorem (Soundness) Suppose Γ 1 Γ n e : A, E n E If e n v then Γ 1 Γ n v : A, E n E If e n c then E n {c}.
33 Polymorphic Type System
34 What s the type of the following function? λx.box (unbox 1 (raise x)) How can we generalize it? We need variables. exn({c}) {c} ( int, ) exn({c }) {c } ( exn({c}), {c }) exn({c, c }) {c,c } ( int {c } int, ) α, ρ, ϕ, ϕ.exn(ϕ) ϕ (ρ α, ϕ ) Problem: set operations (, \), and subset order ( ) for variables. Two approaches Bounded polymorphism Row polymorphism our approache
35 Row Polymorphism Record type f = λx.(x.a) : {a : int} int f {a : 1} : int - O.K. f {a : 1, b : true} : - Error!! Row polymorphism f = λx.(x.a) : {a : int; ρ} int f {a : 1} : int - O.K. f {a : 1, b : true} : int - O.K. ρ represents all of the extra fields Set operations (, \) and subset order ( ): Unification
36 Type and effect A, B Type ::= α int exn(e) A E B (Γ A, E) α, β TyVar Γ TyEnv ::= ρ x : F ; Γ ρ TyEnvVar F Field ::= θ A θ FieldVar E Effect ::= ϕ c : π; E ϕ EffectVar π Presence ::= Pre δ δ PresenceVar
37 Type and effect τ TyScheme ::= ξ.τ A ξ Var ::= α ρ θ ϕ δ µ FieldScheme ::= θ τ TySchemeEnv ::= ρ x : µ; Typing judgment 0 n e : A, E n E 0
38 Typing Rules n (x) A 0 n x : A, E n E 0 (TVAR) 0 n + x : A e : B, EE n 1 E 0 0 n λx.e : A E B, E n E 0 (TABS) 0 n e 1 : A E B, EE n 1 E 0 0 n e 2 : A, EE n 1 E 0 (TAPP) 0 n e 1 e 2 : B, EE n 1 E 0 0 n e 1 : A, E n E 0 0 n + x : GEN A ( 0 n, E n E 0 ) e 2 : B, E n E 0 0 n let (x e 1 ) e 2 : B, E n E 0 (TLET) GEN A ( 0 n, E n E 0 ) = ξ 1 ξ n.a such that {ξ 1 ξ n } = F V (A) \ (F V ( 0 n ) F V (E n E 0 ))
39 Typing Rules 0 n e : A, EE n E 0 0 n box e : (Γ A, E), E n E 0 (TBOX) 0 n e : (Γ n+k A, E n+k ), E n E 0 n+k Γ n+k 0 n n+k unbox k e : A, E n+k E n E 0 (TUNBOX) 0 n e : ( A, E), EE n 1 E 0 0 n eval e : A, EE n 1 E 0 (TEVAL) Rank-1 polymorphism: Arguments and results of a function can not be polymorphic.
40 Typing Rules 0 n c : exn(c : Pre; E), E n E 0 (TEXN) 0 n e : exn(e), EE n 1 E 0 0 n raise e : A, EE n 1 E 0 (TRAISE) 0 n e 1 : A, (c : Pre; E)E n 1 E 0 0 n e 2 : A, (c : π; E)E n 1 E 0 0 n handle e 1 c e 2 : A, (c : π; E)E n 1 E 0 (THANDLE)
41 Example ρ λx.box (unbox 1 (raise x)) : α, ϕ ϕ 1 {α = α 1 α2 } ρ 1 box (unbox 1 (raise x)) : α 2, ϕ 1 {ρ 1 = (x : α 1 ; ρ 2 ), ρ 2 = ρ} ρ 1 ρ 3 unbox 1 (raise x) : α 3, ϕ 2 ϕ 1 {α 2 = (ρ 3 α 3, ϕ 2 )} ρ 1 raise x : (ρ 3 α 4, ϕ 2 ), ϕ 1 ρ 1 x : exn(ϕ 1 ), ϕ 1 {(x : α 1 ; ρ 2 ) = (x : exn(ϕ 1 ); ρ 4 )} {α 1 = exn(ϕ 1 )} {α = exn(ϕ 1 ) ϕ1 (ρ 3 α 3, ϕ 2 )} ρ λx.box (unbox 1 (raise x)) : exn(ϕ 1 ) ϕ1 (ρ 3 α 3, ϕ 2 ), ϕ
42 Example ρ let (f λx.box (unbox 1 (raise x))) f c : α, ϕ ρ λx.box (unbox 1 (raise x)) : α 1, ϕ {α 1 = exn(ϕ 1) ϕ 1 (ρ 1 α 2, ϕ 2)} ρ 2 f c : α, ϕ {ρ 2 = f : α 2ρ 1ϕ 1ϕ 2.exn(ϕ 1) ϕ 1 (ρ 1 α 2, ϕ 2); ρ 3, ρ 3 = ρ} ϕ ρ 2 f : α 3 α, ϕ {ϕ = ϕ 1, α 3 = exn(ϕ 1), α = (ρ 1 α 2, ϕ 2)} ρ 2 c : α 3, ϕ {α 3 = exn(c : Pre; ϕ 3), ϕ 1 = (c : Pre; ϕ 3)} {α = (ρ 1 α 2, ϕ 2)} {ϕ = (c : Pre; ϕ 3)} May-uncaught exception c ρ let (f λx.box (unbox 1 (raise x))) f c : (ρ 1 α 2, ϕ 2), (c : Pre; ϕ 3)
43 Example ρ let (f λx.box (unbox 1 (raise x))) handle (f c) c (box 1) : α, ϕ ρ λx.box (unbox 1 (raise x)) : α 1, ϕ {α 1 = exn(ϕ 1) ϕ 1 (ρ 1 α 2, ϕ 2)} ρ 2 handle (f c) c (box 1) : α, ϕ {ρ 2 = f : α 2ρ 1ϕ 1ϕ 2.exn(ϕ 1) ϕ 1 (ρ 1 α 2, ϕ 2); ρ 3, ρ 3 = ρ} ρ 2 f c : α, ϕ {α = (ρ 1 α 2, ϕ 2), (c : Pre; ϕ 4) = (c : Pre; ϕ 3)} ρ 2 box 1 : α, (c : δ; ϕ 4) {ϕ = (c : δ; ϕ 4), α = (ρ 3 α 4, ϕ 5)} ρ 2ρ 3 1 : α 4, ϕ 5(c : δ; ϕ 4) {α 4 = int} {α = (ρ 3 int, ϕ 5)} {ϕ = (c : δ; ϕ 3)} No uncaught exception!!
44 Conclusion
45 Conclusion A type system for λ-calculus + Lisp s quasi-quote + exception exception-raise and -handle can appear at any stage exceptions (raised during code composition) can escape stages our effect type system safely supports such features empty effect implies no uncaught exceptions
Simply 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 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 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 informationDeclarative Computation Model. Conditional. Case statement. Procedure values (2) Procedure values. Sequential declarative computation model
Declarative Computation Model Kernel language semantics revisited (VRH.4.5) From kernel to practical language (VRH.6) Exceptions (VRH.7) Carlos Varela RPI October 0, 009 Adapted with permission from: Seif
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 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 informationHigh-Level Small-Step Operational Semantics for Transactions (Technical Companion)
High-Level Small-Step Operational Semantics for Transactions (Technical Companion) Katherine F. Moore, Dan Grossman July 15, 2007 Abstract This document is the technical companion to our POPL 08 submission
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 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 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 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 informationA Subtyping for Extensible, Incomplete Objects
Fundamenta Informaticae XX (1999) 1 39 1 IOS Press A Subtyping for Extensible, Incomplete Objects To Helena Rasiowa: in memoriam Viviana Bono Dipartimento di Informatica Università di Torino C.so Svizzera
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 informationLambda Calculus! Gunnar Gotshalks! LC-1
Lambda Calculus! LC-1 λ Calculus History! Developed by Alonzo Church during mid 1930 s! One fundamental goal was to describe what can be computed.! Full definition of λ-calculus is equivalent in power
More informationSafety Analysis versus Type Inference
Information and Computation, 118(1):128 141, 1995. Safety Analysis versus Type Inference Jens Palsberg palsberg@daimi.aau.dk Michael I. Schwartzbach mis@daimi.aau.dk Computer Science Department, Aarhus
More informationLocksmith: Context-Sensitive Correlation Analysis for Race Detection
Locksmith: Context-Sensitive Correlation Analysis for Race Detection Polyvios Pratikakis polyvios@cs.umd.edu Jeffrey S. Foster jfoster@cs.umd.edu Michael Hicks mwh@cs.umd.edu DRAFT Abstract One common
More informationType Inference. For the Simply-Typed Lambda Calculus. Peter Thiemann, Manuel Geffken. Albert-Ludwigs-Universität Freiburg. University of Freiburg
Type Inference For the Simply-Typed Lambda Calculus Albert-Ludwigs-Universität Freiburg Peter Thiemann, Manuel Geffken University of Freiburg 24. Januar 2013 Outline 1 Introduction 2 Applied Lambda Calculus
More informationThe syntactic guard condition of Coq
The syntactic guard condition of Coq Bruno Barras February 2, 2010 Overview 1 Theory Basic criterion Extensions 2 Algorithm Efficiency 3 Discussion 4 Attic A short history of the syntactic guard criterion
More informationRelative Hilbert-Post completeness for exceptions
Relative Hilbert-Post completeness for exceptions Dominique Duval with J.-G. Dumas, B. Ekici, D. Pous, J.-C. Reynaud LJK University of Grenoble-Alpes and ENS Lyon November 12., 2015 MACIS 2015, Berlin
More informationMechanics of Static Analysis
Escuela 03 III / 1 Mechanics of Static Analysis David Schmidt Kansas State University www.cis.ksu.edu/~schmidt Escuela 03 III / 2 Outline 1. Small-step semantics: trace generation 2. State generation and
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 informationA Generalized Let-Polymorphic Type Inference Algorithm
ROPAS Research On Program Analysis System National Creative Research Initiative Center Korea Advanced Institute of Science and Technology ROPAS MEMO 2000-5 March 31, 2000 A Generalized Let-Polymorphic
More informationTrust in the λ-calculus
J. Functional Programming, 3(2):75-85, 1997. c Cambridge University Press 1 Trust in the λ-calculus P. ØRBÆK AND J. PALSBERG BRICS, Centre of the Danish National Research Foundation, Dept. of Computer
More informationThe L Machines are very high-level, in two senses:
What is a Computer? State of the machine. CMPSCI 630: Programming Languages An Abstract Machine for Control Spring 2009 (with thanks to Robert Harper) Internal registers, memory, etc. Initial and final
More informationTheories of Programming Languages Assignment 5
Theories of Programming Languages Assignment 5 December 17, 2012 1. Lambda-Calculus (see Fig. 1 for initions of = β, normal order evaluation and eager evaluation). (a) Let Ω = ((λx. x x) (λx. x x)), and
More informationLock Inference for Atomic Sections
Lock Inference for Atomic Sections Michael Hicks University of Maryland, College Park mwh@cs.umd.edu Jeffrey S. Foster University of Maryland, College Park jfoster@cs.umd.edu Polyvios Pratikakis University
More informationA Simple Semantics and Static Analysis for Java Security
A Simple Semantics and Static Analysis for Java Security Anindya Banerjee and David A. Naumann Stevens Institute of Technology, CS Report 2001-1 July 5, 2001 Abstract: Security in Java depends on an access
More informationG54FOP: Lecture 17 & 18 Denotational Semantics and Domain Theory III & IV
G54FOP: Lecture 17 & 18 Denotational Semantics and Domain Theory III & IV Henrik Nilsson University of Nottingham, UK G54FOP: Lecture 17 & 18 p.1/33 These Two Lectures Revisit attempt to define denotational
More informationCMSC 631 Program Analysis and Understanding Fall Type Systems
Program Analysis and Understanding Fall 2017 Type Systems Type Systems A type system is a tractable syntactic method for proving the absence of certain program behaviors by classifying phrases according
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 informationMeta-programming & you
Meta-programming & you Robin Message Cambridge Programming Research Group 10 th May 2010 What s meta-programming about? 1 result=somedb. customers. select 2 { first_name+ +last_name } 3 where name LIKE
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 informationA Call-by-Name CPS Hierarchy
A Call-by-Name CPS Hierarchy Asami Tanaka and Yukiyoshi Kameyama University of Tsukuba, Japan asami@logic.cs.tsukuba.ac.jp,kameyama@acm.org Abstract. The Continuation-Passing-Style (CPS) translation gives
More informationReasoning about Trace Properties of Higher-order Programs
Reasoning about Trace Properties of Higher-order Programs Limin Jia Joint work with Deepak Garg and Anupam Datta CyLab University Goal: Compositional security S 1 ψ 1 + ϕ S 2 ψ 2! Do S 1 + S 2 satisfy
More informationLocksmith: Context-Sensitive Correlation Analysis for Race Detection
Locksmith: Context-Sensitive Correlation Analysis for Race Detection Polyvios Pratikakis polyvios@cs.umd.edu Jeffrey S. Foster jfoster@cs.umd.edu Michael Hicks mwh@cs.umd.edu DRAFT Abstract One common
More informationRecitation 2: Binding, Semantics, and Safety : Foundations of Programming Languages
Recitation 2: Binding, Semantics, and Safety 15-312: Foundations of Programming Languages Charles Yuan, Jeanne Luning Prak September 5, 2018 1 Abstract Binding Trees The abstract syntax trees we saw previously
More informationPrinciples of Program Analysis: A Sampler of Approaches
Principles of Program Analysis: A Sampler of Approaches Transparencies based on Chapter 1 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis Springer Verlag
More informationDenotational semantics: proofs
APPENDIX A Denotational semantics: proofs We show that every closed term M has a computable functional [[M ] as its denotation. A.1. Unification We show that for any two constructor terms one can decide
More informationStatic Program Analysis
Static Program Analysis Lecture 13: Abstract Interpretation III (Abstract Interpretation of WHILE Programs) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de
More informationSound and Efficient Language-Integrated Query
Sound and Efficient Language-Integrated Query Maintaining the ORDER Oleg Kiselyov Tatsuya Katsushima Tohoku University, Japan APLAS 2017 November, 2017 2 Outline Motivation Core SQUR Core SQUR with Ranking
More informationAn extension of HM(X) with bounded existential and universal data-types
Groupe de travail Cristal July, 2003 An extension of HM(X) with bounded existential and universal data-types (To appear at ICFP 03) Vincent Simonet INRIA Rocquencourt Cristal project Vincent.Simonet@inria.fr
More informationc i r i i=1 r 1 = [1, 2] r 2 = [0, 1] r 3 = [3, 4].
Lecture Notes: Rank of a Matrix Yufei Tao Department of Computer Science and Engineering Chinese University of Hong Kong taoyf@cse.cuhk.edu.hk 1 Linear Independence Definition 1. Let r 1, r 2,..., r m
More informationFrom Polyvariant Flow Information to Intersection and Union Types
Journal of Functional Programming, 11(3):263 317, May 2001. From Polyvariant Flow Information to Intersection and Union Types Jens Palsberg Christina Pavlopoulou Purdue University September 20, 2000 Abstract
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 informationVerified Characteristic Formulae for CakeML. Armaël Guéneau, Magnus O. Myreen, Ramana Kumar, Michael Norrish April 18, 2017
Verified Characteristic Formulae for CakeML Armaël Guéneau, Magnus O. Myreen, Ramana Kumar, Michael Norrish April 18, 2017 CakeML Has: references, modules, datatypes, exceptions, a FFI,... Doesn t have:
More informationCMSC 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 informationFunctional Big-step Semantics
Functional Big-step Semantics FM talk, 11 Mar 2015 Magnus Myréen Books Big-step semantics are defined as inductively defined relation. Functions are better! me Context: CakeML verified compiler Old compiler:
More informationPrinciples of Program Analysis: Control Flow Analysis
Principles of Program Analysis: Control Flow Analysis Transparencies based on Chapter 3 of the book: Flemming Nielson, Hanne Riis Nielson and Chris Hankin: Principles of Program Analysis. Springer Verlag
More informationM ::= x M M x = M M :: M x :: x
Mini-ML expressions M ::= x variable true boolean values false if M then M else M conditional lx (M) function abstraction MM function application let x = M in M local declaration nil nil list M :: M list
More informationLinearity and Passivity
Linearity and Passivity David A. 1 School of Computing University of Tasmania GPO Box 252-100 Hobart 7001 Australia Abstract A simple symmetric logic is proposed which captures both the notions of Linearity
More informationMeta-reasoning in the concurrent logical framework CLF
Meta-reasoning in the concurrent logical framework CLF Jorge Luis Sacchini (joint work with Iliano Cervesato) Carnegie Mellon University Qatar campus Nagoya University, 27 June 2014 Jorge Luis Sacchini
More informationExceptionally Safe Futures
Purdue University Purdue e-pubs Department of Computer Science Technical Reports Department of Computer Science 2008 Exceptionally Safe Futures Armand Navabi Suresh Jagannathan Purdue University, suresh@cs.purdue.edu
More informationOn the Correctness and Efficiency of the Krivine Machine
On the Correctness and Efficiency of the Krivine Machine Mitchell Wand Northeastern University Daniel P. Friedman Indiana University February 12, 2003 Abstract We provide a short derivation of the Krivine
More informationCIS 500 Software Foundations. Final Exam. May 9, Answer key. Hoare Logic
CIS 500 Software Foundations Final Exam May 9, 2011 Answer key Hoare Logic 1. (7 points) What does it mean to say that the Hoare triple {{P}} c {{Q}} is valid? Answer: {{P}} c {{Q}} means that, for any
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 informationPolymorphism, Subtyping, and Type Inference in MLsub
Polymorphism, Subtyping, and Type Inference in MLsub Stephen Dolan and Alan Mycroft November 8, 2016 Computer Laboratory University of Cambridge The select function select p v d = if (p v) then v else
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 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 informationSafety Analysis versus Type Inference for Partial Types
Safety Analysis versus Type Inference for Partial Types Jens Palsberg palsberg@daimi.aau.dk Michael I. Schwartzbach mis@daimi.aau.dk Computer Science Department, Aarhus University Ny Munkegade, DK-8000
More informationProgramming Language Concepts, CS2104 Lecture 3
Programming Language Concepts, CS2104 Lecture 3 Statements, Kernel Language, Abstract Machine 31 Aug 2007 CS2104, Lecture 3 1 Reminder of last lecture Programming language definition: syntax, semantics
More informationPredicate Logic. Xinyu Feng 09/26/2011. University of Science and Technology of China (USTC)
University of Science and Technology of China (USTC) 09/26/2011 Overview Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic?
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 informationLists, Stacks, and Queues (plus Priority Queues)
Lists, Stacks, and Queues (plus Priority Queues) The structures lists, stacks, and queues are composed of similar elements with different operations. Likewise, with mathematics: (Z, +, 0) vs. (Z,, 1) List
More informationProbabilistic Applicative Bisimulation and Call-by-Value Lam
Probabilistic Applicative and Call-by-Value Lambda Calculi Joint work with Ugo Dal Lago ENS Lyon February 9, 2014 Probabilistic Applicative and Call-by-Value Lam Introduction Fundamental question: when
More informationHoare Logic: Reasoning About Imperative Programs
Hoare Logic: Reasoning About Imperative Programs COMP1600 / COMP6260 Dirk Pattinson Australian National University Semester 2, 2018 Programming Paradigms Functional. (Haskell, SML, OCaml,... ) main paradigm:
More informationSemantics of Higher-Order Functional Programming
Semantics of Higher-Order Functional Programming Petros Barbagiannis µ λ July 14, 2014 Petros Barbagiannis Semantics of Higher-Order Functional Programming July 14, 2014 1 / 18 Introduction Higher-order
More informationSemantical study of intuitionistic modal logics
Semantical study of intuitionistic modal logics Department of Intelligence Science and Technology Graduate School of Informatics Kyoto University Kensuke KOJIMA January 16, 2012 Abstract We investigate
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 informationExistential Label Flow Inference via CFL Reachability
Existential Label Flow Inference via CFL Reachability Polyvios Pratikakis Michael Hicks Jeffrey S. Foster July, 2005 Abstract Label flow analysis is a fundamental static analysis problem with a wide variety
More informationOn Typability for Rank-2 Intersection Types with Polymorphic Recursion
On Typability for Rank-2 Intersection Types with Polymorphic Recursion Tachio Terauchi EECS Department University of California, Berkeley Alex Aiken Computer Science Department Stanford University Abstract
More informationProof Theoretical Studies on Semilattice Relevant Logics
Proof Theoretical Studies on Semilattice Relevant Logics Ryo Kashima Department of Mathematical and Computing Sciences Tokyo Institute of Technology Ookayama, Meguro, Tokyo 152-8552, Japan. e-mail: kashima@is.titech.ac.jp
More information3 Propositional Logic
3 Propositional Logic 3.1 Syntax 3.2 Semantics 3.3 Equivalence and Normal Forms 3.4 Proof Procedures 3.5 Properties Propositional Logic (25th October 2007) 1 3.1 Syntax Definition 3.0 An alphabet Σ consists
More informationDenoting computation
A jog from Scott Domains to Hypercoherence Spaces 13/12/2006 Outline Motivation 1 Motivation 2 What Does Denotational Semantic Mean? Trivial examples Basic things to know 3 Scott domains di-domains 4 Event
More informationKomponenten- und Service-orientierte Softwarekonstruktion
Komponenten- und Service-orientierte Softwarekonstruktion Vorlesung 5: Combinatory Logic Synthesis Jakob Rehof LS XIV Software Engineering TU Dortmund Sommersemester 2015 SS 2015 J. Rehof (TU Dortmund)
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 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 informationSubtyping and Intersection Types Revisited
Subtyping and Intersection Types Revisited Frank Pfenning Carnegie Mellon University International Conference on Functional Programming (ICFP 07) Freiburg, Germany, October 1-3, 2007 Joint work with Rowan
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 informationRelating Nominal and Higher-Order Pattern Unification
Relating Nominal and Higher-Order Pattern Unification James Cheney University of Edinburgh UNIF 2005 April 22, 2005 1 Motivation Higher-order unification: studied since ca. 1970 Undecidable, infinitary,
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 informationRefined Environment Classifiers
Refined Environment Classifiers Type- and Scope-safe Code Generation with Mutable Cells Oleg Kiselyov Yukiyoshi Kameyama Yuto Sudo Tohoku University University of Tsukuba APLAS 2016 November 22, 2016 Region
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 informationAdvanced Topics in LP and FP
Lecture 1: Prolog and Summary of this lecture 1 Introduction to Prolog 2 3 Truth value evaluation 4 Prolog Logic programming language Introduction to Prolog Introduced in the 1970s Program = collection
More informationPrincipal Type Schemes for Functional Programs with Overloading and Subtyping
Principal Type Schemes for Functional Programs with Overloading and Subtyping Geoffrey S. Smith Cornell University December 1994 Abstract We show how the Hindley/Milner polymorphic type system can be extended
More informationStrong Normalization with Singleton Types
Electronic Notes in Theoretical Computer Science 70 No 1 (2002) URL: http://wwwelseviernl/locate/entcs/volume70html 19 pages Strong Normalization with Singleton Types Judicaël Courant 1 LRI, CNRS UMR 8623
More informationHomework 5: Parallelism and Control Flow : Types and Programming Languages Fall 2015 TA: Evan Cavallo
Homework 5: Parallelism and Control Flow 15-814: Types and Programming Languages Fall 2015 TA: Evan Cavallo (ecavallo@cs.cmu.edu) Out: 11/5/15 Due: 11/17/15, 10:30am 1 Cost Dynamics In this section, we
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 informationHarvard School of Engineering and Applied Sciences CS 152: Programming Languages
Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 17 Tuesday, April 2, 2013 1 There is a strong connection between types in programming languages and propositions
More informationA Machine Checked Model of Idempotent MGU Axioms For a List of Equational Constraints
A Machine Checked Model of Idempotent MGU Axioms For a List of Equational Constraints Sunil Kothari, James Caldwell Department of Computer Science, University of Wyoming, USA Machine checked proofs of
More informationSupplementary Notes on Inductive Definitions
Supplementary Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 August 29, 2002 These supplementary notes review the notion of an inductive definition
More informationAbstract Interpretation and Static Analysis
/ 1 Abstract Interpretation and Static Analysis David Schmidt Kansas State University www.cis.ksu.edu/~schmidt Welcome! / 2 / 3 Four parts 1. Introduction to static analysis what it is and how to apply
More informationML-like Inference for Classifiers
ML-like Inference for Classifiers Cristiano Calcagno 1, Eugenio Moggi 2, and Walid Taha 3 1 Imperial College, London, UK (ccris@doc.ic.ac.uk) 2 DISI, Univ. of Genova, v Dodecaneso 35, Genova, Italy (moggi@disi.unige.it)
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 categorical model for a quantum circuit description language
A categorical model for a quantum circuit description language Francisco Rios (joint work with Peter Selinger) Department of Mathematics and Statistics Dalhousie University CT July 16th 22th, 2017 What
More informationInterprocedural Analysis: Sharir-Pnueli s Call-strings Approach
Interprocedural Analysis: Sharir-Pnueli s Call-strings Approach Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 04 September 2013 Outline 1 Motivation
More informationInteger Clocks and Local Time Scales
Integer Clocks and Local Time Scales Part I Part II Adrien Guatto ENS - PARKAS SYNCHRON 2014 Adrien Guatto (ENS - PARKAS) Integer Clocks and Local Time Scales SYNCHRON 2014 1 / 31 Part I Adrien Guatto
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 informationAbstracting Definitional Interpreters. David Van Horn
Abstracting Definitional Interpreters David Van Horn Abstracting Definitional Interpreters David Van Horn Northeastern University Definitional interpreters written in monadic style can express a wide variety
More informationPredicate Logic - Semantic Tableau
CS402, Spring 2016 Informal Construction of a Valid Formula Example 1 A valid formula: x(p(x) q(x)) ( xp(x) xq(x)) ( x(p(x) q(x)) ( xp(x) xq(x))) x(p(x) q(x)), ( xp(x) xq(x)) x(p(x) q(x)), xp(x), xq(x)
More informationDynamic Noninterference Analysis Using Context Sensitive Static Analyses. Gurvan Le Guernic July 14, 2007
Dynamic Noninterference Analysis Using Context Sensitive Static Analyses Gurvan Le Guernic July 14, 2007 1 Abstract This report proposes a dynamic noninterference analysis for sequential programs. This
More information