Functional Object Calculus

Size: px
Start display at page:

Download "Functional Object Calculus"

Transcription

1 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 C evaluation context F, G, H functionals S store α, β, τ semantic types σ, γ substitutions (γ is ground ) Ψ store typing Γ type environment 1

2 Functional Object Calculus Syntax Values a, b ::= x variable [m d = ς(x d )b d ] d D object creation a.m method invocation (field selection) a.m := ς(x)b method update (field update) Λ.a type abstraction a [] type application pack a creating existential package open a as x in b opening package Free Variables v Val ::= [m d = ς(x d )b d ] d D Λ.a pack v Closed Values FV : Ter P fin (Var) FV(x) = {x} FV([m d = ς(x d )b d ] d D ) = d D (FV(b d) \ {x d }) FV(a.m) = FV(a) FV(a.m := ς(x)b) = FV(a) (FV(b) \ {x}) FV(Λ.a) = FV(a) FV(a []) = FV(a) FV(pack a) = FV(a) FV(open a as x in b) = FV(a) (FV(b) \ {x}) CVal = {v Val FV(v) = } 2

3 Applying Ground Substitutions sub : Ter (Var fin Val) Ter Notation: sub a σ = σ(a) σ(x) = σ(x) σ([m d = ς(x d )b d ] d D ) = [m d = ς(x d )σ[x d ](b d )] d D σ(a.m) = σ(a).m σ(a.m := ς(x)b) = (σ(a)).m := ς(x)σ[x ](b) σ(λ.a) = Λ.σ(a) σ(a []) = σ(a) [] σ(pack a) = pack σ(a) σ(open a as x in b) = open σ(a) as x in σ[x ](b) Small-step Operational Semantics Reduction Contexts C[ ] = C.m C.m := ς(x)b C [] pack C open C as x in b Reduction (Red-Sel) (Red-Upd) v = [m d = ς(x d )b d ] d D ] v.m e [x e v](b e ) e D e D v = [m e = ς(x)b, m d = ς(x d )b d ] d D\{e}] [m d = ς(x d )b d ] d D ].m e := ς(x)b v (Red-TApp) (Λ.a) [] a (Red-Open) open (pack v) as x in b [x v](b) (Red-Ctx) a b C[a] C[b] Properties Reduction is deterministic. Notation irred(a) = b.a b 3

4 Step-indexed Semantics Safety Safe k = {a j < k. a j b b Val irred(b)} Safe = k 0 Safe k Types Sets of index-value pairs closed under descending index. Type = {τ N Val k 0. j k. v Val. k, v τ j, v τ} Expr: k Type a : k τ : FV(a) = j < k. (a j b irred(b)) k j, b τ Substitution: k Environment Γ : Var fin Type (type environment) σ : Var fin CVal (ground substitution) σ : k Γ : x Dom(Γ). σ(x) : k Γ(x) Semantic Type Judgement Γ = k a : α : FV(a) Dom(Γ) σ : k Γ. σ(a) : k α Γ = a : α : k 0. Γ = k a : α = a : α : = a : α Properties 1. j k. a : k τ a : j τ 2. v Val. v : k τ k, v τ 3. a : k τ a Safe k 4. = a : α a Safe (type soundness) Approximation τ k = { j, v j < k} F : Type Type contractive if τ Type, k 0 we have: F (τ) k+1 = F ( τ k ) k+1 4

5 Semantic Types = = { k, v k N, v Val} [m d : τ d ] d D = { k, v v = [m e = ς(x e )b e ] e E, D E, α = [m d : τ d ] d D, d D. j < k. ([x d v](b d ) : j τ d ς(x)b. j, ς(x)b α τ d j, [m d = ς(x)b, m e = ς(x e )b e ] e E\{d} α)} where α τ = { j, ς(x)b i < j. i, v α [x v](b) : i τ} 1 µf = { k, v k, v F k+1 ( )} 2 α F = { k, Λ.a j < k. τ. τ j Type τ j α j a : j F (τ)} α F = { k, pack v τ Type. τ k α k j < k. j, k F (τ)} 1 α τ is just a set, and not a type, because methods are not values (not even terms) in the functional object calculus. 2 F is a function from types to types (functional) 5

6 Imperative Object Calculus Syntax Examples 1. Factorial a, b ::= x variables {m d = l d } d D object value [m d = ς(x d )b d ] d D object creation clone a object cloning a.m method invocation a.m := ς(x)b method update λx. b procedures a b procedure application Λ.a type abstraction a [] type application pack a creating existential package open a as x in b opening package 2. Euclid s GCD Algorithm [fac = ς(y)λn. if n = 0 then 1 else n y.fac(n 1)] [gcd = ς(y)λx. λz. if x < z then y.gcd x (z x) else if z < x then y.gcd (x z) z else x] 3. Factorial through field (could be used for explaining what higher-order store is, even though there are simpler examples to show this) Values let x = [f = ς(y)λn. n] in let z = [f = x, fac = ς(y)λn. if n = 0 then 1 else n y.f.fac(n 1)] in z.f := z v Val ::= {m d = l d } d D λx. b Λ.a pack v Programs CVal = {v Val FV(v) = } Prog = {v CVal Labels(v) = } 6

7 Small-step Operational Semantics Reduction Contexts C[ ] = C.m C.m := ς(x)b C b v C C [] pack C open C as x in b Reduction (Red-Obj) d D. l d Dom(S) S, [m d = ς(x d )b d ] d D S[l d λx d. b d ] d D, {m d = l d } d D d D. l d Dom(S) (Red-Clone) S, clone {m d = l d } d D S[l d S(l d )] d D, {m d = l d} d D (Red-Sel 3 ) (Red-Upd) (Red-Beta) (Red-Ctx) e D S, {m d = l d } d D.m e S, S(l e ) {m d = l d } d D e D S, {m d = l d } d D.m e := ς(x)b S[l e λx. b], {m d = l d } d D S, (λx. b) v S, [x v](b) S, a S, b S, C[a] S, C[b] Examples TODO: Redo examples from ioc.tex 3 This rule is not standard (basically a selection step is always succeeded by a beta reduction), but it allows us to reuse Ahmed s model, which is nice. 7

8 Step-indexed Semantics 4 Safety Safe k = {(S, a) j < k. S, b. S, a j S, b b Val irred(s, b)} Safe = k 0 Safe k Circular definition PreType = P(N StoreType Val) StoreType = Loc fin PreType Approximation τ k = { j, Ψ, v τ j < k} Ψ k = λl Loc. Ψ(l) k Stratification Invariant For all types τ, τ k+1 cannot depend on any type beyond approximation k. This invariant assures the well-foundness of the whole construction. PreType 0 = { } PreType k+1 = {τ j, Ψ, v τ. j k Ψ StoreType j } StoreType k = {Ψ l Dom(Ψ). Ψ(l) Type k } PreType = {τ k 0. τ k PreType k } StoryType = {Ψ k 0. Ψ k StoreType k } State Extension (k, Ψ) (j, Ψ ) : j k l Dom(Ψ). Ψ j (l) = Ψ j (l) Types PreTypes closed under state extension. Type = {τ PreType k, j 0. Ψ, Ψ. v Val. ((k, Ψ) (j, Ψ ) k, Ψ, v τ) j, Ψ, v τ} Well-typed Store (S : k Ψ) (S : k Ψ : Dom(Ψ) Dom(S) j < k. l Dom(Ψ). j, Ψ j, S(l) Ψ k (l) 4 All the definitions are the same as in Ahmed s thesis, modulo small notational differences. 8

9 Expr: k,ψ Type a : k,ψ τ : FV(a) = j < k, S, S, b. (S : k Ψ S, a j S, b irred(s, b)) Ψ. (k, Ψ) (k j, Ψ ) S : k j Ψ k j, Ψ, b τ Value Env.: k,ψ Type Env. Γ : Var fin Type (type environment) γ : Var fin CVal (value environment = closed-value substitution) γ : k,ψ Γ : x Dom(Γ). γ(x) : k,ψ Γ(x) Semantic Type Judgement Let a such that Labels(a) =. Γ = k a : α : FV(a) Dom(Γ) Ψ. γ : k,ψ Γ. γ(a) : k,ψ α Γ = a : α : k 0. Γ = k a : α = a : α : = a : α Properties 1. j k (k, Ψ) (j, Ψ j ) 2. (j k a : k,ψ α) a : j, Ψ j α 3. v Val. v : k,ψ τ k, Ψ, v τ 4. = a : α S. (S, a) Safe (type soundness) Semantic Types = = { k, Ψ, v k N, Ψ StoreType, v Val} α β = { k, Ψ, λx. b j < k. Ψ, v Val. ((k, Ψ) (j, Ψ ) j, Ψ, v α) [x v](b) : j,ψ τ} α = [m d : τ d ] d D = { k, Ψ, {m e = l e } e E D E α. α k Type α k α k j < k. j, Ψ, {m e = l e } e E α d D. Ψ k (l d ) = α τ d k } µf = { k, Ψ, v k, Ψ, v F k+1 ( )} α F = { k, Ψ, Λ.a j, Ψ. τ. (k, Ψ) (j, Ψ ) τ j Type τ j α j i < j. a : i, Ψ i F (τ)} (where F is non-expansive) α F = { k, Ψ, pack v τ. τ k Type τ k α k j < k. j, Ψ j, v F (τ)} (where F is non-expansive) 9

10 Semantic Typing Rules 56 (Var) Γ = x : Γ(x) Procedures Types Γ[x : α] = b : β (Lam) Γ = λx. b : α β (App) Γ = a : β α Γ Γ = a b : α = b : β Object Types Let α = [m d : τ d ] d D (Obj) d D. Γ[x d : α] = b d : τ d Γ = [m d = ς(x d )b d ] d D : α (Sel) Γ = a : α e D Γ = a.m e : τ e (Upd) Γ = a : α e D Γ[x : α] = b : τ e Γ = a.m e := ς(x)b : α (Clone) Γ = a : α Γ = clone a : α Polymorphic Types τ Type. τ α Γ = a : F (τ) (TAbs) Γ = Λ.a : α F (TApp) Γ = a : αf τ Type τ α Γ = a [] : F (τ) (Pack) τ Type. τ α Γ = a : F (τ) Γ = pack a : α F 5 Common for both calculi 6 Proved as derived lemmata from the definitions. 10

11 (Open) Γ = a : αf τ Type. τ α Γ[x : F (τ)] = b : β Γ = open a as x in b : β Recursive Types (Unfold) Γ = a : µf F contractive Γ = a : F (µf ) (Fold) Γ = a : F (µf ) F Γ = a : µf contractive Subtyping (SubSub) Γ = a : α α β Γ = a : β (SubRefl) α α (SubTrans) α τ τ β α β (SubTop) α (SubBot) α (SubArrow) α α β β α β α β (SubObj) E D [m d : τ d ] d D [m e : τ e ] e E 7 (SubRec) α, β Type. α β F (α) G(β) µf µg (SubUniv) β α τ Type. τ β F (τ) G(τ) α F β G (SubExist) α β τ Type. τ α F (τ) G(τ) α F β G 7 Still only in width without variance annotations. 11

12 Self Quantifier The self quantifier allows recursive types with proper subtyping, and is used together with object types in order to define self types. ςf = µ(λα Type. α F ) τ Type. τ ςf Γ = a : F (τ) (Wrap) Γ = pack a : ςf (Use) Γ = a : ςf τ Type. τ ςf Γ[x : F (τ)] = b : β Γ = open a as x in b : β (SubSelf) τ Type. F (τ) G(τ) ςf ςg Self Types Self types are recursive object types with proper subtyping 8. Self types have the form ς(λτ Type. [m d : F d (τ)] d D ). They have the restriction that the recursion only happens covariantly, which we formalize by requiring all F d to be monotonic. Without this additional condition the rule for selection would be unsound, while the rules for object creation and selection have this condition built in their usual preconditions. d D. α, β Type. α β F d (α) F d (β) Self object creation: pack [m d = ς(x d )b d ] d D Selection: a m d open a as x in x.m d Update: a m d := ς(x)b open a as x in pack (x.m d := ς(x)b) Let α = ς(λτ Type. [m d : F d (τ)] d D ) (SelfObj) τ Type. τ α d D. Γ[x d : τ] = b d : F d (τ) Γ = pack [m d = ς(x d )b d ] d D : α (SelfSel) Γ = a : α e D Γ = a m e : F e (α) (SelfUpd) Γ = a : α e D τ Type. τ α Γ[x : [m d : F d (τ)] d D ] = b : F e (τ) Γ = a m e := ς(x)b : α (SubSelfObj) E D ς(λτ Type. [m d : F d (τ)] d D ) ς(λτ Type. [m e : F e (τ)] e E ) 8 Please note that if we would replace ς with µ in the subtyping rule for self types, the resulting rule would be unsound. 12

13 Variance Annotations 9 In order to have subtyping in depth for objects, method selection and update can be tracked using object types with variance annotations: ν {0, +, }. Methods annotated with zero can be both selected and updated, but as before they need to be invariant when subtyping. Methods annotated with plus can only be selected but not updated, so they are covariant when subtyping. Similarly, methods annotated with minus can only be updated, and are thus contravariant. These annotations extend the usual object types, which can now be seen as a special case where all methods are invariant 10. Let α = [m d : νd τ d ] d D α = def { k, v v = [m e = ς(x e )b e ] e E, D E, d D. j < k. ((ν d {+, 0} [x d v](b d ) : j τ d ) (ν d {, 0} ς(x)b. j, ς(x)b α τ d j, [m d = ς(x)b, m e = ς(x e )b e ] e E\{d} α))} (VarObj) d D. Γ[x : α] = b d : τ d Γ = [m d = ς(x d )b d ] d D : α (VarSel) Γ = a : α e D ν e {+, 0} Γ = a.m e : τ e (VarUpd) Γ = a : α e D ν e {, 0} Γ[x : α] = b : τ e Γ = a.m e := ς(x)b : α (VarSubObj) E D e E. (ν e {+, 0} α e β e ) (ν e {, 0} β e α e ) [m d : νd α d ] d D [m e : νe β e ] e E 9 For now only for the functional calculus since we did not find a way to describe writeonly references 10 We could even go one step further and define object types with variance annotations from the start, and then allowing the invariance annotation to be omitted for the same effect as our object types without annotations. We would only have to change the (Sem-SObj), (Sem-Sel) and (Sem-Upd) rules with the ones in this section, and also the definition of self types and the (Sem-SelfSObj) rule. Actually this would make perfect sense, since it would remove a couple of useless rules and proofs. 13

14 Misc Semantic vs. Syntactic Typing Rules (Pack) τ Type. τ α Γ = a : F (τ) Γ = pack a : α F (Syn-Pack) Ψ, Γ C A Ψ, Γ a[x := C] : B[X := C] Ψ, Γ pack X A=C a : X A. B Example of what it means to belong to a type [f = ς(x)[]] : 1 [f : int] 14

arxiv: v3 [cs.pl] 15 May 2011

arxiv: v3 [cs.pl] 15 May 2011 A Step-indexed Semantic Model of Types for the Call-by-Name Lambda Calculus arxiv:1105.1985v3 [cs.pl] 15 May 2011 Abstract Step-indexed semantic models of types were proposed as an alternative to purely

More information

Realizability Semantics of Parametric Polymorphism, General References, and Recursive Types

Realizability 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 information

1 Problem 1. (20 pts)

1 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 information

CMSC 631 Program Analysis and Understanding Fall Type Systems

CMSC 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 information

Information Flow Inference for ML

Information 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 information

Type Soundness for Path Polymorphism

Type 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 information

Beyond First-Order Logic

Beyond 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 information

An extension of HM(X) with bounded existential and universal data-types

An 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 information

An Introduction to Logical Relations Proving Program Properties Using Logical Relations

An 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

AN INTRODUCTION TO SEPARATION LOGIC. 2. Assertions

AN INTRODUCTION TO SEPARATION LOGIC. 2. Assertions AN INTRODUCTION TO SEPARATION LOGIC 2. Assertions John C. Reynolds Carnegie Mellon University January 7, 2011 c 2011 John C. Reynolds Pure Assertions An assertion p is pure iff, for all stores s and all

More information

An Imperative Object Calculus

An Imperative Object Calculus An Imperative Object Calculus Mart n Abadi and Luca Cardelli Digital Equipment Corporation, Systems Research Center Abstract. We develop an imperative calculus of objects. Its main type constructor is

More information

1 Introduction. 2 Recap The Typed λ-calculus λ. 3 Simple Data Structures

1 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 information

State-Dependent Representation Independence (Technical Appendix)

State-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 information

Bicubical Directed Type Theory

Bicubical Directed Type Theory Bicubical Directed Type Theory Matthew Weaver General Examination May 7th, 2018 Advised by Andrew Appel and Dan Licata Bicubical Directed Type Theory Bicubical directed type theory is a constructive model

More information

The Locally Nameless Representation

The Locally Nameless Representation Noname manuscript No. (will be inserted by the editor) The Locally Nameless Representation Arthur Charguéraud Received: date / Accepted: date Abstract This paper provides an introduction to the locally

More information

Typing λ-terms. Types. Typed λ-terms. Base Types. The Typing Relation. Advanced Formal Methods. Lecture 3: Simply Typed Lambda calculus

Typing λ-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 information

1. Object Calculus. Object calculus is to OO languages what lambda calculus is to functional languages

1. Object Calculus. Object calculus is to OO languages what lambda calculus is to functional languages 1. Object Calculus In this section we will introduce a calculus of objects that gives a simple but powerful mathematical model to study object based languages. Object calculus is to OO languages what lambda

More information

Logical equivalence for subtyping object and recursive types

Logical equivalence for subtyping object and recursive types Logical equivalence for subtyping object and recursive types Steffen Van Bakel, Ugo De Liguoro To cite this version: Steffen Van Bakel, Ugo De Liguoro. Logical equivalence for subtyping object and recursive

More information

Extensional Equivalence and Singleton Types

Extensional Equivalence and Singleton Types Extensional Equivalence and Singleton Types CHRISTOPHER A. STONE Harvey Mudd College and ROBERT HARPER Carnegie Mellon University In this paper we study a λ-calculus enriched with singleton types, where

More information

Type 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. 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 information

Dependent Types for JavaScript Appendix

Dependent Types for JavaScript Appendix Dependent Types for JavaScript Appendix Ravi Chugh University of California, San Diego rchugh@cs.ucsd.edu David Herman Mozilla Research dherman@mozilla.com Ranjit Jhala University of California, San Diego

More information

Operational reasoning for functions with local state

Operational reasoning for functions with local state Operational reasoning for functions with local state Andrew Pitts and Ian Stark Abstract Languages such as ML or Lisp permit the use of recursively defined function expressions with locally declared storage

More information

Fully-Abstract Compilation by Approximate Back-Translation Technical Appendix

Fully-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 information

Dynamic 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 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

EDA045F: Program Analysis LECTURE 10: TYPES 1. Christoph Reichenbach

EDA045F: 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 information

An Indexed Model of Impredicative Polymorphism and Mutable References

An Indexed Model of Impredicative Polymorphism and Mutable References An Indexed Model of Impredicative Polymorphism and Mutable References Amal Ahmed Andrew W. Appel Roberto Virga Princeton University, January 2003 {amal,appel,rvirga}@cs.princeton.edu Abstract We present

More information

Formal Techniques for Software Engineering: Denotational Semantics

Formal Techniques for Software Engineering: Denotational Semantics Formal Techniques for Software Engineering: Denotational Semantics Rocco De Nicola IMT Institute for Advanced Studies, Lucca rocco.denicola@imtlucca.it May 2013 Lesson 4 R. De Nicola (IMT-Lucca) FoTSE@LMU

More information

Theories of Programming Languages Assignment 5

Theories 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 information

The Curry-Howard Isomorphism

The Curry-Howard Isomorphism The Curry-Howard Isomorphism Software Formal Verification Maria João Frade Departmento de Informática Universidade do Minho 2008/2009 Maria João Frade (DI-UM) The Curry-Howard Isomorphism MFES 2008/09

More information

Supporting Unrestricted Recursive Types

Supporting 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 information

The Lambda Calculus. Stephen A. Edwards. Fall Columbia University

The Lambda Calculus. Stephen A. Edwards. Fall Columbia University The Lambda Calculus Stephen A. Edwards Columbia University Fall 2014 Lambda Expressions Function application written in prefix form. Add four and five is (+ 4 5) Evaluation: select a redex and evaluate

More information

Subtyping and Intersection Types Revisited

Subtyping 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 information

Automatic Discovery of Covariant Read-Only Fields

Automatic Discovery of Covariant Read-Only Fields Automatic Discovery of Covariant Read-Only Fields Jens Palsberg Purdue University Tian Zhao Purdue University May 30, 2002 Trevor Jim AT&T Labs Research Abstract Read-only fields are useful in object calculi,

More information

Limitations of OCAML records

Limitations 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 information

State-Dependent Representation Independence

State-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 information

State-Dependent Representation Independence

State-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 information

Simply Typed Lambda Calculus

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 information

Denotational Semantics for a Program Logic of Objects

Denotational Semantics for a Program Logic of Objects Under consideration for publication in Math. Struct. in Comp. Science Denotational Semantics for a Program Logic of Objects B E R N H A R D R E U S 1 and J A N S C H W I N G H A M M E R 2 1 Department

More information

Operational Semantics Using the Partiality Monad

Operational Semantics Using the Partiality Monad page.1 Operational Semantics Using the Partiality Monad Nils Anders Danielsson (Göteborg) Shonan Meeting 026: Coinduction for computation structures and programming languages The research leading to these

More information

Semantic Solutions to Program Analysis Problems

Semantic Solutions to Program Analysis Problems Semantic Solutions to Program Analysis Problems Sam Tobin-Hochstadt and David Van Horn PLDI FIT 2011 A talk in three parts. 1. A provocative claim. (The thought) 2. A idea about modular program analysis.

More information

Blame for All. Amal Ahmed, Robert Bruce Findler, Jeremy Siek, Philip Wadler

Blame 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 information

A Bisimulation for Type Abstraction and Recursion

A 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 information

A Calculus for Dynamic Loading

A 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 information

A Short Introduction to Hoare Logic

A Short Introduction to Hoare Logic A Short Introduction to Hoare Logic Supratik Chakraborty I.I.T. Bombay June 23, 2008 Supratik Chakraborty (I.I.T. Bombay) A Short Introduction to Hoare Logic June 23, 2008 1 / 34 Motivation Assertion checking

More information

Principal types Robustness to program transformations Practice. Type constraints for simple types Type constraints for ML Type inference in ML F

Principal 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 information

Mathematical Synthesis of Equational Deduction Systems. Marcelo Fiore. Computer Laboratory University of Cambridge

Mathematical Synthesis of Equational Deduction Systems. Marcelo Fiore. Computer Laboratory University of Cambridge Mathematical Synthesis of Equational Deduction Systems Marcelo Fiore Computer Laboratory University of Cambridge TLCA 2009 3.VII.2009 Context concrete theories meta-theories Context concrete theories meta-theories

More information

Chapter 2. Assertions. An Introduction to Separation Logic c 2011 John C. Reynolds February 3, 2011

Chapter 2. Assertions. An Introduction to Separation Logic c 2011 John C. Reynolds February 3, 2011 Chapter 2 An Introduction to Separation Logic c 2011 John C. Reynolds February 3, 2011 Assertions In this chapter, we give a more detailed exposition of the assertions of separation logic: their meaning,

More information

CS 4110 Programming Languages & Logics. Lecture 16 Programming in the λ-calculus

CS 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 information

Spring 2016 Program Analysis and Verification. Lecture 3: Axiomatic Semantics I. Roman Manevich Ben-Gurion University

Spring 2016 Program Analysis and Verification. Lecture 3: Axiomatic Semantics I. Roman Manevich Ben-Gurion University Spring 2016 Program Analysis and Verification Lecture 3: Axiomatic Semantics I Roman Manevich Ben-Gurion University Warm-up exercises 1. Define program state: 2. Define structural semantics configurations:

More information

Dynamic Dependency Monitoring to Secure Information Flow

Dynamic Dependency Monitoring to Secure Information Flow Dynamic Dependency Monitoring to Secure Information Flow Paritosh Shroff Scott F. Smith Mark Thober Department of Computer Science Johns Hopkins University {pari,scott,mthober}@cs.jhu.edu Abstract Although

More information

A Bisimulation for Type Abstraction and Recursion

A 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 information

Adding recursion to Dpi

Adding recursion to Dpi Adding recursion to Dpi Samuel Hym and Matthew Hennessy Abstract. Dpi is a distributed version of the pi-calculus, in which processes are explicitly located, and a migration construct may be used for moving

More information

Deductive Verification

Deductive Verification Deductive Verification Mooly Sagiv Slides from Zvonimir Rakamaric First-Order Logic A formal notation for mathematics, with expressions involving Propositional symbols Predicates Functions and constant

More information

Information Flow Inference for ML

Information 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 information

Course Notes: Operational Semantics and the Parameterized Aspect Calculus

Course Notes: Operational Semantics and the Parameterized Aspect Calculus Course Notes: Operational Semantics and the Parameterized Aspect Calculus Curtis Clifton and Gary T. Leavens Dept. of Computer Science Iowa State University 226 Atanasoff Hall Ames, IA 50011-1040 USA {cclifton,leavens}@cs.iastate.edu

More information

Predicate Logic. Xinyu Feng 09/26/2011. University of Science and Technology of China (USTC)

Predicate 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 information

Consequence Relations and Natural Deduction

Consequence Relations and Natural Deduction Consequence Relations and Natural Deduction Joshua D. Guttman Worcester Polytechnic Institute September 9, 2010 Contents 1 Consequence Relations 1 2 A Derivation System for Natural Deduction 3 3 Derivations

More information

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 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 information

Relational Reasoning for Recursive Types and References

Relational Reasoning for Recursive Types and References Relational Reasoning for Recursive Types and References Nina Bohr and Lars Birkedal IT University of Copenhagen (ITU) {ninab,birkedal}@itu.dk Abstract. We present a local relational reasoning method for

More information

Taming Selective Strictness

Taming 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 information

The Marriage of Bisimulations and Kripke Logical Relations

The 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 information

Grammatical resources: logic, structure and control

Grammatical resources: logic, structure and control Grammatical resources: logic, structure and control Michael Moortgat & Dick Oehrle 1 Grammatical composition.................................. 5 1.1 Grammar logic: the vocabulary.......................

More information

COMP6463: λ-calculus

COMP6463: λ-calculus COMP6463: λ-calculus 1. Basics Michael Norrish Michael.Norrish@nicta.com.au Canberra Research Lab., NICTA Semester 2, 2015 Outline Introduction Lambda Calculus Terms Alpha Equivalence Substitution Dynamics

More information

The Marriage of Bisimulations and Kripke Logical Relations. Technical Appendix

The Marriage of Bisimulations and Kripke Logical Relations. Technical Appendix The Marriage of Bisimulations and Kripke Logical Relations Technical Appendix 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 information

Type Inference for Variant Object Types

Type Inference for Variant Object Types Boston University OpenBU Computer Science http://open.bu.edu CAS: Computer Science: Technical Reports 2000-10-16 Type Inference for Variant Object Types Bugliesi, Michele Boston University Computer Science

More information

Proving Completeness for Nested Sequent Calculi 1

Proving Completeness for Nested Sequent Calculi 1 Proving Completeness for Nested Sequent Calculi 1 Melvin Fitting abstract. Proving the completeness of classical propositional logic by using maximal consistent sets is perhaps the most common method there

More information

Verified 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 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 information

Kleene realizability and negative translations

Kleene 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 information

Prefixed Tableaus and Nested Sequents

Prefixed Tableaus and Nested Sequents Prefixed Tableaus and Nested Sequents Melvin Fitting Dept. Mathematics and Computer Science Lehman College (CUNY), 250 Bedford Park Boulevard West Bronx, NY 10468-1589 e-mail: melvin.fitting@lehman.cuny.edu

More information

Lazy Strong Normalization

Lazy Strong Normalization Lazy Strong Normalization Luca Paolini 1,2 Dipartimento di Informatica Università di Torino (ITALIA) Elaine Pimentel 1,2 Departamento de Matemática Universidade Federal de Minas Gerais (BRASIL) Dipartimento

More information

Unifying Theories of Programming

Unifying Theories of Programming 1&2 Unifying Theories of Programming Unifying Theories of Programming 3&4 Theories Unifying Theories of Programming designs predicates relations reactive CSP processes Jim Woodcock University of York May

More information

Spring 2015 Program Analysis and Verification. Lecture 4: Axiomatic Semantics I. Roman Manevich Ben-Gurion University

Spring 2015 Program Analysis and Verification. Lecture 4: Axiomatic Semantics I. Roman Manevich Ben-Gurion University Spring 2015 Program Analysis and Verification Lecture 4: Axiomatic Semantics I Roman Manevich Ben-Gurion University Agenda Basic concepts of correctness Axiomatic semantics (pages 175-183) Hoare Logic

More information

Coinductive big-step operational semantics

Coinductive big-step operational semantics Coinductive big-step operational semantics Xavier Leroy a, Hervé Grall b a INRIA Paris-Rocquencourt Domaine de Voluceau, B.P. 105, 78153 Le Chesnay, France b École des Mines de Nantes La Chantrerie, 4,

More information

Programming Languages and Types

Programming 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 information

Advanced Lambda Calculus Lecture 5

Advanced Lambda Calculus Lecture 5 Advanced Lambda Calculus Lecture 5 The fathers Alonzo Church (1903-1995) as mathematics student at Princeton University (1922 or 1924) Haskell B. Curry (1900-1982) as BA in mathematics at Harvard (1920)

More information

Nominal Syntax and Semantics

Nominal Syntax and Semantics Nominal Syntax and Semantics Andrew Pitts University of Cambridge Computer Laboratory APPSEM 2005, 1 - p. 1 How best to reconcile Mathematics of syntax syntactical issues to do with name-binding and α-conversion

More information

COMP2111 Glossary. Kai Engelhardt. Contents. 1 Symbols. 1 Symbols 1. 2 Hoare Logic 3. 3 Refinement Calculus 5. rational numbers Q, real numbers R.

COMP2111 Glossary. Kai Engelhardt. Contents. 1 Symbols. 1 Symbols 1. 2 Hoare Logic 3. 3 Refinement Calculus 5. rational numbers Q, real numbers R. COMP2111 Glossary Kai Engelhardt Revision: 1.3, May 18, 2018 Contents 1 Symbols 1 2 Hoare Logic 3 3 Refinement Calculus 5 1 Symbols Booleans B = {false, true}, natural numbers N = {0, 1, 2,...}, integers

More information

M, N ::= x λp : A.M MN (M, N) () c A. x : b p x : b

M, N ::= x λp : A.M MN (M, N) () c A. x : b p x : b A PATTERN-MATCHING CALCULUS FOR -AUTONOMOUS CATEGORIES ABSTRACT. This article sums up the details of a linear λ-calculus that can be used as an internal language of -autonomous categories. The coherent

More information

A Subtyping for Extensible, Incomplete Objects

A 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 information

BRNO UNIVERSITY OF TECHNOLOGY. Specifying and reasoning in the calculus of objects

BRNO UNIVERSITY OF TECHNOLOGY. Specifying and reasoning in the calculus of objects BRNO UNIVERSITY OF TECHNOLOGY Faculty of Information Technology Department of Information Systems Ondrej Rysavy Specifying and reasoning in the calculus of objects Short Version of Ph.D. Thesis Study Field:

More information

Traditional and Non Traditional lambda calculi

Traditional and Non Traditional lambda calculi Strategies July 2009 Strategies Syntax Semantics Manipulating Expressions Variables and substitutions Free and bound variables Subterms and substitution Grafting and substitution Ordered list of variables

More information

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions

Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions Chapter 1 Classical Program Logics: Hoare Logic, Weakest Liberal Preconditions 1.1 The IMP Language IMP is a programming language with an extensible syntax that was developed in the late 1960s. We will

More information

Overview. overview / 357

Overview. overview / 357 Overview overview6.1 Introduction Modelling parallel systems Linear Time Properties Regular Properties Linear Temporal Logic (LTL) Computation Tree Logic syntax and semantics of CTL expressiveness of CTL

More information

Invariant Generation for Parametrized Systems using Self-Reflection

Invariant Generation for Parametrized Systems using Self-Reflection Invariant Generation for Parametrized Systems using Self-Reflection Alejandro Sánchez 1 César Sánchez 1,3 Sriram Sankaranarayanan 2 Bor-Yuh Evan Chang 2 1 IMDEA Software Institute, Spain 2 University of

More information

Subtyping for Session Types in the Pi Calculus

Subtyping for Session Types in the Pi Calculus Acta Informatica manuscript No. (will be inserted by the editor) Subtyping for Session Types in the Pi Calculus Simon Gay 1, Malcolm Hole 2 1 Department of Computing Science, University of Glasgow, UK

More information

Predicate Logic. Xinyu Feng 11/20/2013. University of Science and Technology of China (USTC)

Predicate Logic. Xinyu Feng 11/20/2013. University of Science and Technology of China (USTC) University of Science and Technology of China (USTC) 11/20/2013 Overview Predicate logic over integer expressions: a language of logical assertions, for example x. x + 0 = x Why discuss predicate logic?

More information

Homotopy and Directed Type Theory: a Sample

Homotopy and Directed Type Theory: a Sample Homotopy and Directed Type Theory: a Sample Dan Doel October 24, 2011 Type Theory Overview Judgments Γ ctx Γ A type Γ M : A Families Γ, x : A B(x) type Inference Γ 1 J 1 Γ 2 J 2 Type Theory Overview Π

More information

Static Program Analysis

Static Program Analysis Static Program Analysis Xiangyu Zhang The slides are compiled from Alex Aiken s Michael D. Ernst s Sorin Lerner s A Scary Outline Type-based analysis Data-flow analysis Abstract interpretation Theorem

More information

The Many Faces of Modal Logic Day 4: Structural Proof Theory

The Many Faces of Modal Logic Day 4: Structural Proof Theory The Many Faces of Modal Logic Day 4: Structural Proof Theory Dirk Pattinson Australian National University, Canberra (Slides based on a NASSLLI 2014 Tutorial and are joint work with Lutz Schröder) LAC

More information

Roy L. Crole. Operational Semantics Abstract Machines and Correctness. University of Leicester, UK

Roy L. Crole. Operational Semantics Abstract Machines and Correctness. University of Leicester, UK Midlands Graduate School, University of Birmingham, April 2008 1 Operational Semantics Abstract Machines and Correctness Roy L. Crole University of Leicester, UK Midlands Graduate School, University of

More information

Higher-Order Abstract Non-Interference

Higher-Order Abstract Non-Interference Higher-Order Abstract Non-Interference Damiano Zanardini Dipartimento di Informatica, Università di Verona Strada Le Grazie 15, I-37134 Verona, Italy zanardini@sci.univr.it Abstract. This work proposes

More information

The Spirit of Ghost Code

The Spirit of Ghost Code The Spirit of Ghost Code Jean-Christophe Filliâtre, Léon Gondelman, Andrei Paskevich To cite this version: Jean-Christophe Filliâtre, Léon Gondelman, Andrei Paskevich. The Spirit of Ghost Code. Formal

More information

Principles of Program Analysis: Control Flow Analysis

Principles 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 information

Witnessing Side Effects

Witnessing Side Effects Witnessing Side Effects TACHIO TERAUCHI Tohoku University and ALEX AIKEN Stanford University We present a new approach to the old problem of adding global mutable state to purely functional languages.

More information

Lecture 1: Logical Foundations

Lecture 1: Logical Foundations Lecture 1: Logical Foundations Zak Kincaid January 13, 2016 Logics have two components: syntax and semantics Syntax: defines the well-formed phrases of the language. given by a formal grammar. Typically

More information

NESTED HOARE TRIPLES AND FRAME RULES FOR HIGHER-ORDER STORE

NESTED HOARE TRIPLES AND FRAME RULES FOR HIGHER-ORDER STORE Logical Methods in Computer Science Vol. 7 (3:21) 2011, pp. 1 42 www.lmcs-online.org Submitted Mar. 8, 2011 Published Sep. 28, 2011 NESTED HOARE TRIPLES AND FRAME RULES FOR HIGHER-ORDER STORE JAN SCHWINGHAMMER

More information

High-Level Small-Step Operational Semantics for Transactions (Technical Companion)

High-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 information

Principles of Program Analysis: A Sampler of Approaches

Principles 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 information

Mode checking in the Concurrent Logical Framework

Mode checking in the Concurrent Logical Framework Mode checking in the Concurrent Logical Framework Jorge Luis Sacchini Iliano Cervesato Frank Pfenning Carsten Schürmann August 2014 CMU-CS-14-134 CMU-CS-QTR-123 School of Computer Science Carnegie Mellon

More information

Lambda Calculus. Syntax. i ::= a b c d e... etc L ::= i i L L L ( L ) A Few Examples. x x y a x a (b a) c d (c e (d e)) (x (x x)) (y (y a))

Lambda Calculus. Syntax. i ::= a b c d e... etc L ::= i i L L L ( L ) A Few Examples. x x y a x a (b a) c d (c e (d e)) (x (x x)) (y (y a)) Syntax Lambda Calculus A Few Examples i ::= a b c d e... etc L ::= i i L L L ( L ) x x y a x a (b a) c d (c e (d e)) (x (x x)) (y (y a)) Semantics With Examples α β Anywhere that something of the form

More information