INTEROPERATION FOR LAZY AND EAGER EVALUATION. A Thesis. Presented to. the Faculty of California Polytechnic State University.

Size: px
Start display at page:

Download "INTEROPERATION FOR LAZY AND EAGER EVALUATION. A Thesis. Presented to. the Faculty of California Polytechnic State University."

Transcription

1 INTEROPERATION FOR LAZY AND EAGER EVALUATION A Thesis Presented to the Faculty of California Polytechnic State University San Luis Obispo In Partial Fulfillment of the Requirements for the Degree Master of Science in Computer Science by William Faught May 2011

2 2011 William Faught ALL RIGHTS RESERVED ii

3 COMMITTEE MEMBERSHIP TITLE: Interoperation for Lazy and Eager Evaluation AUTHOR: William Faught DATE SUBMITTED: May 2011 COMMITTEE CHAIR: COMMITTEE MEMBER: COMMITTEE MEMBER: John Clements, Dr. Gene Fisher, Dr. Phillip Nico, Dr. iii

4 Abstract Interoperation for Lazy and Eager Evaluation by William Faught Programmers forgo existing solutions to problems in other programming languages where software interoperation proves too cumbersome; they remake solutions, rather than reuse them. To facilitate reuse, interoperation must resolve language incompatibilities transparently. To address part of this problem, we present a model of computation that resolves incompatible lazy and eager evaluation strategies using dual notions of evaluation contexts and values to mirror the lazy evaluation strategy in the eager one. This method could be extended to resolve incompatible evaluation strategies for any pair of languages with common expressions. iv

5 Acknowledgements I am grateful for the support of my parents, Jerry and Jo Ann, and my uncle, Tim. I could not have done this without them. v

6 Contents List of Figures vii 1 Introduction 1 2 Model of Computation 5 3 Proof of Type Soundness 28 4 Conclusion 31 Bibliography 32 vi

7 List of Figures 1.1 Transparency broken for list construction operands Transparency not broken for list construction operands Transparency broken for function arguments Transparency not broken for function arguments Symbol names Syntax names Syntax names The unbrand function The lump equality relation The Haskell syntax and evaluation contexts The Haskell typing rules The Haskell operational semantics The Haskell-ML operational semantics The Haskell-Scheme operational semantics The ML syntax and evaluation contexts The ML typing rules The ML operational semantics The ML-Haskell operational semantics The ML-Scheme operational semantics The Scheme syntax and evaluation contexts The Scheme typing rules The Scheme operational semantics vii

8 2.19 The Scheme-Haskell operational semantics The Scheme-ML operational semantics viii

9 Chapter 1 Introduction Programmers forgo existing solutions to problems in other programming languages where software interoperation proves too cumbersome; they remake solutions, rather than reuse them. To facilitate reuse, interoperation must resolve language incompatibilities transparently. To address part of this problem, we present a model of computation that resolves incompatible lazy and eager evaluation strategies. Matthews and Findler presented a method of type-safe interoperation between languages with incompatible polymorphic static and dynamic type systems [3]. We observe that their method is insufficient for transparent interoperation between languages with incompatible lazy and eager evaluation strategies. We explain the underlying problem and present a method of interoperation that resolves this incompatibility. The model of computation of Matthews and Findler comprises two eager languages based on ML and Scheme. We extend their model of computation with a third language that is based on Haskell and identical to their ML-like 1

10 language, except it is lazy. We introduce lists to all three languages. Types are equal up to alpha equivalence. Letter subscripts denote languages. Languages do not share variables or type variables. Hereafter, we use the names of Haskell, ML, and Scheme to refer to their counterparts in our model of computation. Unlike ML and Scheme, Haskell does not evaluate function arguments or list construction operands. These three evaluation contexts comprise the set of incompatible evaluation contexts between Haskell and ML, and Haskell and Scheme. Since Haskell permits unused erroneous or divergent expressions in these evaluation contexts and ML and Scheme do not, there are Haskell values that have no counterpart in ML and Scheme. Attempting to convert such values to ML and Scheme forces the evaluation of such expressions and breaks the transparency of interoperation. Figure 1.1 demonstrates how a straightforward introduction of Haskell to the model of Matthews and Findler breaks the transparency of interoperation when converting a list construction from Haskell to Scheme. The Haskell list construction contains an erroneous operand that Scheme forces to evaluate in the process of converting the Haskell list construction. Figure 1.2 demonstrates Scheme correctly deferring the evaluation of the erroneous Haskell list construction operand and producing as a result the counterpart Scheme list construction. Moreover, since the conversion of functions from ML and Scheme to Haskell requires the application of the original function to the converted Haskell argument, ML and Scheme always force the evaluation of the converted Haskell argument, even if it is never used. The application of such converted functions effectively changes the order of evaluation of Haskell and breaks the transparency of interoperation. 2

11 Likewise, figure 1.3 demonstrates the conversion of a function from Haskell to Scheme. Scheme forces the evaluation of the erroneous Haskell argument in the process of applying the Scheme function, even though the Haskell argument is never used. From the perspective of the outermost Haskell application, the argument must have been used, but it was not. Figure 1.4 demonstrates Scheme not forcing the evaluation of the Haskell argument, which allows the Scheme function to produce a number. 3

12 Figure 1.1: Transparency broken for list construction operands. sh {N} (cons (wrong N Not a number ) (nil N)) cons (sh N (wrong N Not a number )) (sh {N} (nil N)) Error: Not a number Figure 1.2: Transparency not broken for list construction operands. sh {N} (cons (wrong N Not a number ) (nil N)) cons (sh N (wrong N Not a number )) (sh {N} (nil N)) cons (sh N (wrong N Not a number )) (nil N) Figure 1.3: Transparency broken for function arguments. (hs (N N) (λx S.0)) (wrong N Not a number ) (λx H : N.hs N ((λx S.0) (sh N x H ))) (wrong N Not a number ) hs N ((λx S.0) (sh N (wrong N Not a number ))) Error: Not a number Figure 1.4: Transparency not broken for function arguments. (hs (N N) (λx S.0)) (wrong N Not a number ) (λx H : N.hs N ((λx S.0) (sh N x H ))) (wrong N Not a number ) hs N ((λx S.0) (sh N (wrong N Not a number ))) hs N 0 0 4

13 Chapter 2 Model of Computation To preserve the transparency of interoperation, ML and Scheme must not force Haskell to evaluate reducible expressions in Haskell boundaries in the incompatible evaluation contexts, and must force their evaluation in all other evaluation contexts. Haskell boundaries must be a new kind of value that ML and Scheme can force to become a reducible expression in certain evaluation contexts, and thereby force the evaluation of the inner Haskell reducible expressions to Haskell values and the conversion of those values to ML or Scheme. Since ML and Scheme do not force Haskell to evaluate in some evaluation contexts, we must factor Haskell boundaries out of ML and Scheme evaluation context nonterminals, E, into new evaluation context nonterminals. We name these new nonterminals F because they allow ML and Scheme to force Haskell to evaluate, and we rename the primary evaluation context nonterminals from E to U (unforced) because they do not. Likewise, we factor Haskell boundaries out of ML and Scheme value nonterminals, v, into new value nonterminals. We name these new nonterminals f (forced) and rename the old value nonterminals from v to u (unforced). We rename Haskell evaluation contexts and values to F and 5

14 f, respectively. In ML and Scheme, we tie F and U together by replacing U with F in the syntax and operational semantics in all evaluation contexts except the incompatible ones. Likewise, we tie f and u together by replacing u with f in the syntax and operational semantics in those same evaluation contexts. F evaluation contexts produce f values, and U evaluation contexts produce u values. U only applies to incompatible evaluation contexts, and F applies to all others. ML and Scheme use F to evaluate expressions. We rename the meta evaluation context from E to F. Transparency is restored for interoperation in all cases with our changes to the model of computation of Matthews and Findler. Theorem 1. Interoperation is transparent: 1. e H hm t H t M (mh t M t H e H ) hs k H (sh k H e H ) 2. e M mh t M t H (hm t H t M e M ) ms k M (sm k M e M ) 3. e S sh k H (hs k H e S ) sm k M (ms k M e S ) where denotes observational equivalence [1]. Proof. By structural induction. The conversion of type abstractions between Haskell and ML was not straightforward. The application of a converted type abstraction cannot substitute the type argument into the nested expression because the type argument is meaningless in the nested expression s language. Instead, the application substitutes the type argument and a lump into the boundary s outer and inner types, respectively. Since the natural embedding requires the boundary s outer and inner 6

15 types to be equal [3], we use a new notion of equality called lump equality that allows lumps within the boundary s inner type to match any corresponding type in the boundary s outer type. Figures present legends of symbol and syntax names; figure 2.4 presents the unbrand function; figure 2.5 presents the lump equality relation; figures present Haskell; figures present ML; and figures present Scheme. 7

16 b k e F f Figure 2.1: Symbol names Brand Conversion scheme Expression Forced evaluation context Forced value L Lump. = Lump equality relation F n N t y Γ U u x Meta evaluation context Natural number Natural number Reduction relation Type Type variable Typing environment Typing relation Unforced evaluation context Unforced value Variable 8

17 Figure 2.2: Syntax names + e e Addition if0 e e e Condition nil t Empty list nil Empty list null? e Empty list predicate wrong t string Error wrong string Error λx : t.e Function abstraction λx S.e S Function abstraction fun? e S Function abstraction predicate e e Function application hm t H t M e M Haskell-ML guard hs k H e S Haskell-Scheme guard cons e e List construction hd e List head list? e S List predicate tl e List tail mh t M t H e H ML-Haskell guard ms k M e S ML-Scheme guard num? e S Number predicate sh k H e H Scheme-Haskell guard sm k M e M Scheme-ML guard e e Subtraction Λy.e Type abstraction e t Type application 9

18 Figure 2.3: Syntax names b t y.t y.k t t k k {t} {k} Branded type Forall type Forall conversion scheme Function abstraction Function abstraction List List 10

19 Figure 2.4: The unbrand function. L = L N = N y H = y H y M = y M {k H } = { k H } {k M } = { k M } k H k H = k H k H k M k M = k M k M y H.k H = y H. k H y M.k M = y M. k M b t H = t H b t M = t M 11

20 Figure 2.5: The lump equality relation. x =. x x =. y y =. x x =. y and y =. z x =. z. t H = L. = L t M t H = t M t H. = tm 12

21 Figure 2.6: The Haskell syntax and evaluation contexts. e H = x H f H e H e H e H t H a e H e H if0 e H e H e H c e H null? e H wrong t H string hm t H t M e M hs k H e S f H = λx H : t H.e H Λy H.e H n nil t H cons e H e H hm L t M f M hs L f S t H = L N y H {t H } t H t H y H.t H k H = L N y H {k H } k H k H y H.k H b t H a = + c = hd tl F H = [ ] H F H e H F H t H a F H e H a f H F H if0 F H e H e H c F H null? F H hm t H t M F M hs k H F S 13

22 Figure 2.7: The Haskell typing rules. H L H N Γ, y H H y H Γ H t H Γ H {t H } Γ H t H Γ H t H Γ H t H t H Γ, y H H t H Γ H y H.t H Γ H t H Γ, x H : t H H e H : t H Γ H (λx H : t H.e H ) : t H t H Γ H t H Γ H nil t H : {t H } Γ, y H H e H : t H Γ H Λy H.e H : y H.t H Γ H e H : t H Γ H e H : {t H } Γ H cons e H e H : {t H } H n : N Γ, x H : t H H x H : t H Γ H e H : N Γ H e H : t H t H Γ H e H : t H Γ H t H Γ H e H : y H.t H Γ H e H e H : t H Γ H e H t H : t H [t H /y H ] Γ H e H : N Γ H e H : N Γ H e H : t H Γ H e H : t H Γ H a e H e H : N Γ H if0 e H e H e H : t H Γ H e H : {t H } Γ H null? e H : N Γ H e H : {t H } Γ H e H : {t H } Γ H hd e H : t H Γ H tl e H : {t H } Γ H t H Γ H k H Γ S e S : TST Γ H wrong t H string : t H Γ H hs k H e S : k H Γ H t H Γ M t M Γ M e M : t M t. H = t M t M = t M Γ H hm t H t M e M : t H 14

23 Figure 2.8: The Haskell operational semantics. F [(λx H : t H.e H ) e H ] H F [e H [e H /x H ]] F [(Λy H.e H ) t H ] H F [e H [b t H /y H ]] F [+ n n ] H F [n + n ] F [ n n ] H F [max(n n, 0)] F [if0 0 e H e H ] H F [e H ] F [if0 n e H e H ] H F [e H ] (n 0) F [hd (nil t H )] H F [wrong t H Empty list ] F [tl (nil t H )] H F [wrong {t H } Empty list ] F [hd (cons e H e H )] H F [e H ] F [tl (cons e H e H )] H F [e H ] F [null? (nil t H )] H F [0] F [null? (cons e H e H )] H F [1] F [wrong t H string] H Error: string 15

24 Figure 2.9: The Haskell-ML operational semantics. F [hm t H t M (mh t M t H e H )] H F [e H ] (t H L t H = t H ) F [hm t H t M (mh t M t H e H )] H F [wrong t H Type mismatch ] (t H L t H t H ) F [hm t H L (ms L f S )] H F [wrong t H Bad value ] (t H L) F [hm N N n] H F [n] F [hm {t H } {t M } (nil t M )] H F [nil t H ] F [hm {t H } {t M } (cons u M u M )] H F [cons (hm t H t M u M ) (hm {t H } {t M } u M )] F [hm (t H t H ) (t M t M ) (λx M : t M.e M )] H F [λx H : t H.hm t H t M ((λx M : t M.e M ) (mh t M t H x H ))] F [hm ( y H.t H ) ( y M.t M ) (Λy M.e M )] H F [Λy H.hm t H t M [L/y M ] e M [L/y M ]] 16

25 Figure 2.10: The Haskell-Scheme operational semantics. F [hs t H (sh t H e H )] H F [e H ] (t H = t H ) F [hs N n] H F [n] F [hs N f S ] H F [wrong N Not a number ] (f S n) F [hs {k H } nil] H F [nil k H ] F [hs {k H } (cons u S u S )] H F [cons (hs k H u S ) (hs {k H } u S )] F [hs {k H } f S ] H F [wrong {k H } Not a list ] (f S nil and f S cons u S u S ) F [hs (b t H ) (sh (b t H ) e H )] H F [e H ] F [hs (b t H ) f S ] H F [wrong t H Brand mismatch ] (f S sh (b t H ) e H ) F [hs (k H k H ) (λx S.e S )] H F [λx H : k H.hs k H ((λx S.e S ) (sh k H x H ))] F [hs (k H k H ) f S] H F [wrong k H k H Not a function ] (f S λx S.e S ) F [hs ( y H.k H ) f S ] H F [Λy H.hs k H f S ] 17

26 Figure 2.11: The ML syntax and evaluation contexts. e M = x M u M e M e M e M t M a e M e M if0 e M e M e M cons e M e M c e M null? e M wrong t M string ms k M e S u M = f M mh t M t H e H f M = λx M : t M.e M Λy M.e M n nil t M cons u M u M mh L t H e H ms L f S t M = L N y M {t M } t M t M y M.t M k M = L N y M {k M } k M k M y M.k M b t M a = + c = hd tl F M = U M mh t M t H F H U M = [ ] M F M e M f M U M F M t M a F M e M a f M F M if0 F M e M e M cons U M e M cons u M U M c F M null? F M ms k M F S 18

27 Figure 2.12: The ML typing rules. M L M N Γ, y M M y M Γ M t M Γ M {t M } Γ M t M Γ M t M Γ M t M t M Γ, y M M t M Γ M y M.t M Γ M t M Γ, x M : t M M e M : t M Γ M (λx M : t M.e M ) : t M t M Γ M t M Γ M nil t M : {t M } Γ, y M M e M : t M Γ M Λy M.e M : y M.t M Γ M e M : t M Γ M e M : {t M } Γ M cons e M e M : {t M } M n : N Γ, x M : t M M x M : t M Γ M e M : t M t M Γ M e M : t M Γ M t M Γ M e M : y M.t M Γ H e M e M : t M Γ M e M t M : t M [t M /y M ] Γ M e M : N Γ M e M : N Γ M e M : N Γ M e M : t M Γ M e M : t M Γ M a e M e M : N Γ M if0 e M e M e M : t M Γ M e M : {t M } Γ M null? e M : N Γ M e M : {t M } Γ M e M : {t M } Γ M hd e M : t M Γ M tl e M : {t M } Γ M t M Γ M k M Γ S e S : TST Γ M wrong t M string : t M Γ M ms k M e S : k M Γ M t M Γ H t H Γ H e H : t H t M. = th t H = t H Γ M mh t M t H e H : t M 19

28 Figure 2.13: The ML operational semantics. F [(λx M : t M.e M ) u M ] M F [e M [u M /x M ]] F [(Λy M.e M ) t M ] M F [e M [b t M /y M ]] F [+ n n ] M F [n + n ] F [ n n ] M F [max(n n, 0)] F [if0 0 e M e M ] M F [e M ] F [if0 n e M e M ] M F [e M ] (n 0) F [hd (nil t M )] M F [wrong t M Empty list ] F [tl (nil t M )] M F [wrong {t M } Empty list ] F [hd (cons u M u M )] M F [u M ] F [tl (cons u M u M )] M F [u M ] F [null? (nil t M )] M F [0] F [null? (cons u M u M )] M F [1] F [wrong t M string] H Error: string 20

29 Figure 2.14: The ML-Haskell operational semantics. F [mh t M t H (hm t H t M f M )] M F [f M ] (t M L t M = t M ) F [mh t M t H (hm t H t M f M )] M F [wrong t M Type mismatch ] (t M L t M t M ) F [mh t M L (hs L f S )] H F [wrong t M Bad value ] (t M L) F [mh N N n] M F [n] F [mh {t M } {t H } (nil t H )] M F [nil t M ] F [mh {t M } {t H } (cons e H e H )] M F [cons (mh t M t H e H ) (mh {t M } {t H } e H )] F [mh (t M t M ) (t H t H ) (λx H : t H.e H )] M F [λx M : t M.mh t M t H ((λx H : t H.e H ) (hm t H t M x M ))] F [mh ( y M.t M ) ( y H.t H ) (Λy H.e H )] M F [Λy M.mh t M t H [L/y H ] e H [L/y H ]] 21

30 Figure 2.15: The ML-Scheme operational semantics. F [ms N n] M F [n] F [ms N f S ] M F [wrong N Not a number ] (f S n) F [ms {k M } nil] M F [nil k M ] F [ms {k M } (cons u S u S )] M F [cons (ms k M u S ) (ms {k M } u S )] F [ms {k M } f S ] M F [wrong {k M } Not a list ] (f S nil and f S cons u S u S ) F [ms (b t M ) (sm (b t M ) u M )] M F [u M ] F [ms (b t M ) f S ] M F [wrong b t M Brand mismatch ] (f S sm (b t M ) e M ) F [ms (k M k M ) (λx S.e S )] M F [λx M : k M.ms k M ((λx S.e S ) (sm k M x M ))] F [ms (k M k M ) f S] M F [wrong k M k M Not a function ] (f S λx S.e S ) F [ms ( y M.k M ) f S ] M F [Λy M.ms k M f S ] 22

31 Figure 2.16: The Scheme syntax and evaluation contexts. e S = x S u S e S e S a e S e S p e S if0 e S e S e S cons e S e S c e S wrong string sm k M e M u S = f S sh k H e H f S = λx S.e S n nil cons u S u S sh (b t H ) e H sm (b t M ) f M a = + c = hd tl p = fun? list? null? num? F S = U S sh k H F H U S = [ ] S F S e S f S U S a F S e S a f S F S p F S if0 F S e S e S cons U S e S cons u S U S c F S sm k M F M 23

32 Figure 2.17: The Scheme typing rules. S TST Γ, x S : TST S e S : TST Γ S λx S.e S : TST S n : TST S nil : TST Γ S e S : TST Γ S e S : TST Γ S cons e S e S : TST Γ, x S : TST S x S : TST Γ S e S : TST Γ S e S : TST Γ S e S : TST Γ S e S : TST Γ H e S e S : TST Γ S a e S e S : TST Γ S e S : TST Γ S e S : TST Γ S e S : TST Γ S if0 e S e S e S : TST Γ S e S : TST Γ S c e S : TST S wrong string : TST Γ H k H Γ H e H : t H k H = t H Γ S sh k H e H : TST Γ M k M Γ M e M : t M k M = t M Γ S sm k M e M : TST Γ S e S : TST Γ S p e S : TST 24

33 Figure 2.18: The Scheme operational semantics. F [(λx S.e S ) u S ] S F [e S [u S /x S ]] F [f S u S ] S F [wrong Not a function ] (f S λx S.e S ) F [+ n n ] S F [n + n ] F [ n n ] S F [max(n n, 0)] F [a f S f S ] S F [wrong Not a number ] (f S n or f S n) F [if0 0 e S e S ] S F [e S ] F [if0 n e S e S ] S F [e S ] (n 0) F [if0 f S e S e S ] S F [wrong Not a number ] (f S n) F [c nil] S F [wrong Empty list ] F [hd (cons u S u S )] S F [u S ] F [tl (cons u S u S )] S F [u S ] F [c f S ] S F [wrong Not a list ] (f S nil and f S cons u S u S ) F [fun? (λx S.e S )] S F [0] F [fun? f S ] S F [1] (f S λx S.e S ) F [list? nil] S F [0] F [list? (cons u S u S )] S F [0] F [list? f S ] S F [1] (f S nil and f S cons u S u S ) F [null? nil] S F [0] F [null? f S ] S F [1] (f S nil) F [num? n] S F [0] F [num? f S ] S F [1] (f S n) F [wrong string] S Error: string 25

34 Figure 2.19: The Scheme-Haskell operational semantics. F [sh k H (hs k H f S)] S F [f S ] F [sh L (hm L k M f M )] S F [wrong Bad value ] F [sh N n] S F [n] F [sh {k H } (nil t H )] S F [nil] F [sh {k H } (cons e H e H )] S F [cons (sh k H e H ) (sh {k H } e H )] F [sh (k H k H ) (λx H : t H.e H )] S F [λx S.sh k H ((λx H : t H.e H ) (hs k H x S ))] F [sh ( y H.k H ) (Λy H.e H )] S F [sh k H [L/y H ] e H [L/y H ]] 26

35 Figure 2.20: The Scheme-ML operational semantics. F [sm L (ms L f S )] S F [f S ] F [sm L (mh L k H e H )] S F [wrong Bad value ] F [sm N n] S F [n] F [sm {k M } (nil t M )] S F [nil] F [sm {k M } (cons u M u M )] S F [cons (sm k M u M ) (sm {k M } u M )] F [sm (k M k M ) f M ] S F [λx S.sm k M (f M (ms k M x S ))] F [sm ( y M.k M ) (Λy M.e M )] S F [sm k M [L/y M ] e M [L/y M ]] 27

36 Chapter 3 Proof of Type Soundness The proof of correctness is similar to that of Kinghorn [2], mutatis mutandis. Lemma 1. Inversion of the Typing Relation The syntactic forms of well-typed expressions determine the types of their subexpressions. Proof. Immediate from the typing rules. Lemma 2. Uniqueness of Types If e H, e M, and e S are well-typed then they have only one type. Proof. By structural induction on e H, e M, and e S and lemma 1. Lemma 3. Canonical Forms The syntactic forms of unforced values for each type. Proof. Immediate from the definitions of unforced values and the typing relations. 28

37 Theorem 2. Haskell Progress If H e H : t H then e H is an unforced value or e H e H or e H Error: string. Proof. By structural induction on e H and theorems 3 and 4. Theorem 3. ML Progress If M e M : t M then e M is an unforced value or e M e M or e M Error: string. Proof. By structural induction on e M and theorems 2 and 4. Theorem 4. Scheme Progress If S e S : TST then e S is an unforced value or e S e S or e S Error: string. Proof. By structural induction on e S and theorems 2 and 3. Lemma 4. Expression Substitution Preservation If Γ, x H : t H H e H : t H and Γ H e H : t H then Γ H e H [e H /x H ] : t H. If Γ, x M : t M M e M : t M and Γ M e M : t M then Γ M e M [e M /x M ] : t M. If Γ, x S : TST S e S : TST and Γ S e S : TST then Γ S e S [e S /x S] : TST. Proof. By structural induction. Lemma 5. Type Substitution Preservation If Γ, y H H e H : t H and Γ H t H then Γ H e H [t H /y H ] : t H [t H /y H ]. If Γ, y M M e M : t M and Γ M t M then Γ M e M [t M /y M ] : t M [t M /y M ]. Proof. By structural induction. Lemma 6. Evaluation Context Preservation 29

38 If H e H : t H, H e H : t H, and H F [e H ] H : t H then H F [e H ] H : t H. If M e M : t M, M e M : t M, and M F [e M ] M : t M then M F [e M ] M : t M. If S e S : TST, S e S : TST, and S F [e S ] S : TST then S F [e S ] S : TST. Proof. By structural induction. Theorem 5. Haskell Preservation If Γ H e H : t H and F [e H ] H F [e H ] then Γ H e H : t H. Proof. By cases on the reduction F [e H ] H F [e H ], lemma 6, and theorems 6 and 7. Theorem 6. ML Preservation If Γ M e M : t M and e M e M then Γ M e M : t M. Proof. By cases on the reduction F [e M ] H F [e M ], lemma 6, and theorems 5 and 7. Theorem 7. Scheme Preservation If Γ S e S : TST and e S e S then Γ S e S : TST. Proof. By cases on the reduction F [e S ] S F [e S ], lemma 6, and theorems 5 and 6. 30

39 Chapter 4 Conclusion Our method of interoperation resolves incompatible lazy and eager evaluation strategies transparently. The eager evaluation strategy mirrors the lazy one for reducible expressions inside the lazy language s boundaries in incompatible evaluation contexts common to both languages. Forced and unforced evaluation contexts and values comprise a simple framework that implements such a system. This method could be extended to resolve incompatible evaluation strategies for any pair of languages with common expressions. 31

40 Bibliography [1] M. Felleisen, R. B. Findler, and M. Flatt. Semantics Engineering with PLT Redex. The MIT Press, [2] D. L. Kinghorn. Preserving parametricity while sharing higher-order, polymorphic functions between scheme and ml. Master s thesis, California Polytechnic State University, San Luis Obispo, June [3] J. Matthews and R. B. Findler. Operational semantics for multi-language programs. SIGPLAN Not., 42(1):3 10,

Interoperation for Lazy and Eager Evaluation

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

Recitation 2: Binding, Semantics, and Safety : Foundations of Programming Languages

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

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

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

Threesomes, With and Without Blame

Threesomes, With and Without Blame hreesomes, With and Without Blame Jeremy G. Siek 1 and Philip Wadler 2 1 University of Colorado at Boulder 2 University of Edinburgh Abstract. he blame calculus of Wadler and Findler gives a high-level

More information

Programming Languages

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

A Calculus of Definitions

A Calculus of Definitions A Calculus of Definitions June 13, 2017 1 Type theory We describe how to implement a core type theory. This is very close to a functional programming language with λ abstraction and data types defined

More information

Theoretical Computer Science

Theoretical Computer Science Theoretical Computer Science 411 (2010) 1372 1386 Contents lists available at ScienceDirect Theoretical Computer Science journal homepage: www.elsevier.com/locate/tcs A trajectory-based strict semantics

More information

Introduction to lambda calculus Part 6

Introduction 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

Safety Analysis versus Type Inference

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

Semantics and Generative Grammar. A Little Bit on Adverbs and Events

Semantics and Generative Grammar. A Little Bit on Adverbs and Events A Little Bit on Adverbs and Events 1. From Adjectives to Adverbs to Events We ve just developed a theory of the semantics of adjectives, under which they denote either functions of type (intersective

More information

Extending the Lambda Calculus: An Eager Functional Language

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

Introduction to lambda calculus Part 2

Introduction to lambda calculus Part 2 Introduction to lambda calculus Part 2 Antti-Juhani Kaijanaho 2017-01-24... 1 Untyped lambda calculus 1.1 Syntax... x, y, z Var t, u Term t, u ::= x t u λx t... In this document, I will be using the following

More information

Theory of Computation

Theory of Computation Thomas Zeugmann Hokkaido University Laboratory for Algorithmics http://www-alg.ist.hokudai.ac.jp/ thomas/toc/ Lecture 12: Turing Machines Turing Machines I After having dealt with partial recursive functions,

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

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel

7. Propositional Logic. Wolfram Burgard and Bernhard Nebel Foundations of AI 7. Propositional Logic Rational Thinking, Logic, Resolution Wolfram Burgard and Bernhard Nebel Contents Agents that think rationally The wumpus world Propositional logic: syntax and semantics

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

Consequence Relations and Natural Deduction

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

More information

INDUCTIVE DEFINITION

INDUCTIVE DEFINITION 1 INDUCTIVE DEFINITION OUTLINE Judgements Inference Rules Inductive Definition Derivation Rule Induction 2 META-VARIABLES A symbol in a meta-language that is used to describe some element in an object

More information

Partial model checking via abstract interpretation

Partial model checking via abstract interpretation Partial model checking via abstract interpretation N. De Francesco, G. Lettieri, L. Martini, G. Vaglini Università di Pisa, Dipartimento di Ingegneria dell Informazione, sez. Informatica, Via Diotisalvi

More information

Review. Principles of Programming Languages. Equality. The Diamond Property. The Church-Rosser Theorem. Corollaries. CSE 230: Winter 2007

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

Type Systems. Lecture 2 Oct. 27th, 2004 Sebastian Maneth.

Type Systems. Lecture 2 Oct. 27th, 2004 Sebastian Maneth. Type Systems Lecture 2 Oct. 27th, 2004 Sebastian Maneth http://lampwww.epfl.ch/teaching/typesystems/2004 Today 1. What is the Lambda Calculus? 2. Its Syntax and Semantics 3. Church Booleans and Church

More information

The λ-calculus and Curry s Paradox Drew McDermott , revised

The λ-calculus and Curry s Paradox Drew McDermott , revised The λ-calculus and Curry s Paradox Drew McDermott drew.mcdermott@yale.edu 2015-09-23, revised 2015-10-24 The λ-calculus was invented by Alonzo Church, building on earlier work by Gottlob Frege and Moses

More information

Logics with Counting. Ian Pratt-Hartmann School of Computer Science University of Manchester Manchester M13 9PL, UK

Logics with Counting. Ian Pratt-Hartmann School of Computer Science University of Manchester Manchester M13 9PL, UK Logics with Counting Ian Pratt-Hartmann School of Computer Science University of Manchester Manchester M13 9PL, UK 2 Chapter 1 Introduction It is well-known that first-order logic is able to express facts

More information

HORSes: format, termination and confluence

HORSes: format, termination and confluence HORSes: format, termination and confluence Jean-Pierre Jouannaud INRIA-LIAMA and singhua Software Chair Joint on-going work with Jianqi Li School of Software, singhua University Project CoqLF NList Cross-discipline

More information

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence Foundations of Artificial Intelligence 7. Propositional Logic Rational Thinking, Logic, Resolution Joschka Boedecker and Wolfram Burgard and Frank Hutter and Bernhard Nebel Albert-Ludwigs-Universität Freiburg

More information

Real-Time Software Transactional Memory: Contention Managers, Time Bounds, and Implementations

Real-Time Software Transactional Memory: Contention Managers, Time Bounds, and Implementations Real-Time Software Transactional Memory: Contention Managers, Time Bounds, and Implementations Mohammed El-Shambakey Dissertation Submitted to the Faculty of the Virginia Polytechnic Institute and State

More information

3.2 Reduction 29. Truth. The constructor just forms the unit element,. Since there is no destructor, there is no reduction rule.

3.2 Reduction 29. Truth. The constructor just forms the unit element,. Since there is no destructor, there is no reduction rule. 32 Reduction 29 32 Reduction In the preceding section, we have introduced the assignment of proof terms to natural deductions If proofs are programs then we need to explain how proofs are to be executed,

More information

EXTRACTING COST RECURRENCES FROM SEQUENTIAL AND PARALLEL FUNCTIONAL PROGRAMS

EXTRACTING COST RECURRENCES FROM SEQUENTIAL AND PARALLEL FUNCTIONAL PROGRAMS Wesleyan University EXTRACTING COST RECURRENCES FROM SEQUENTIAL AND PARALLEL FUNCTIONAL PROGRAMS By Justin Raymond Faculty Advisor: Norman Danner A Dissertation submitted to the Faculty of Wesleyan University

More information

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence Foundations of Artificial Intelligence 7. Propositional Logic Rational Thinking, Logic, Resolution Joschka Boedecker and Wolfram Burgard and Bernhard Nebel Albert-Ludwigs-Universität Freiburg May 17, 2016

More information

Foundations of Artificial Intelligence

Foundations of Artificial Intelligence Foundations of Artificial Intelligence 7. Propositional Logic Rational Thinking, Logic, Resolution Wolfram Burgard, Maren Bennewitz, and Marco Ragni Albert-Ludwigs-Universität Freiburg Contents 1 Agents

More information

Non-Idempotent Typing Operators, beyond the λ-calculus

Non-Idempotent Typing Operators, beyond the λ-calculus Non-Idempotent Typing Operators, beyond the λ-calculus Soutenance de thèse Pierre VIAL IRIF (Univ. Paris Diderot and CNRS) December 7, 2017 Non-idempotent typing operators P. Vial 0 1 /46 Certification

More information

Equivalent Computers. Lecture 39: Lambda Calculus. Lambda Calculus. What is Calculus? Real Definition. Why?

Equivalent Computers. Lecture 39: Lambda Calculus. Lambda Calculus. What is Calculus? Real Definition. Why? #,, - Lecture 39: Lambda Calculus Equivalent Computers z z z... term = variable term term (term) λ variable. term λy. M α λv. (M [y α v]) where v does not occur in M. (λx. M)N β M [ x α N ] Turing Machine

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

Context Free Grammars

Context Free Grammars Automata and Formal Languages Context Free Grammars Sipser pages 101-111 Lecture 11 Tim Sheard 1 Formal Languages 1. Context free languages provide a convenient notation for recursive description of languages.

More information

Notes from Yesterday s Discussion. Big Picture. CIS 500 Software Foundations Fall November 1. Some lessons.

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

Solutions to Exercises. Solution to Exercise 2.4. Solution to Exercise 2.5. D. Sabel and M. Schmidt-Schauß 1

Solutions to Exercises. Solution to Exercise 2.4. Solution to Exercise 2.5. D. Sabel and M. Schmidt-Schauß 1 D. Sabel and M. Schmidt-Schauß 1 A Solutions to Exercises Solution to Exercise 2.4 We calculate the sets of free and bound variables: FV ((λy.(y x)) (λx.(x y)) (λz.(z x y))) = FV ((λy.(y x)) (λx.(x y)))

More information

Operational Semantics

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

Nunchaku: Flexible Model Finding for Higher-Order Logic

Nunchaku: Flexible Model Finding for Higher-Order Logic Nunchaku: Flexible Model Finding for Higher-Order Logic Simon Cruanes, Jasmin Blanchette, Andrew Reynolds Veridis, Inria Nancy https://cedeela.fr/~simon/ April 7th, 2016 1 / 21 Summary Introduction Nunchaku

More information

Lectures Notes on Progress

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

Automatic Deduction for Theories of. Algebraic Data Types. Igor A. Chikanian

Automatic Deduction for Theories of. Algebraic Data Types. Igor A. Chikanian Automatic Deduction for Theories of Algebraic Data Types by Igor A. Chikanian A dissertation submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy Department of Computer

More information

On the Correctness of the Krivine Machine

On the Correctness of the Krivine Machine On the Correctness of the Krivine Machine Mitchell Wand Northeastern University 2003-10-03 15:55:00 wand October 3, 2003 Abstract We provide a short proof of the correctness of the Krivine machine by showing

More information

A Trajectory-based Strict Semantics for Program Slicing

A Trajectory-based Strict Semantics for Program Slicing A Trajectory-based Strict Semantics for Program Slicing Richard W. Barraclough a David Binkley b Sebastian Danicic a Mark Harman c Robert M. Hierons d Ákos Kiss e Mike Laurence a Lahcen Ouarbya a a Dept.

More information

How to Prove Similarity a Precongruence in Non-Deterministic Call-by-Need Lambda Calculi

How to Prove Similarity a Precongruence in Non-Deterministic Call-by-Need Lambda Calculi How to Prove Similarity a Precongruence in Non-Deterministic Call-by-Need Lambda Calculi Matthias Mann and Manfred Schmidt-Schauß Institut für Informatik Johann Wolfgang Goethe-Universität Postfach 11

More information

Lecture Notes on Inductive Definitions

Lecture Notes on Inductive Definitions Lecture Notes on Inductive Definitions 15-312: Foundations of Programming Languages Frank Pfenning Lecture 2 September 2, 2004 These supplementary notes review the notion of an inductive definition and

More information

The syntactic guard condition of Coq

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

Knowledge Representation and Reasoning in Modal Higher-order Logic

Knowledge Representation and Reasoning in Modal Higher-order Logic Knowledge Representation and Reasoning in Modal Higher-order Logic J.W. Lloyd Computer Sciences Laboratory College of Engineering and Computer Science The Australian National University August 23, 2007

More information

From Polyvariant Flow Information to Intersection and Union Types

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

Lecture Notes on Data Abstraction

Lecture Notes on Data Abstraction Lecture Notes on Data Abstraction 15-814: Types and Programming Languages Frank Pfenning Lecture 14 October 23, 2018 1 Introduction Since we have moved from the pure λ-calculus to functional programming

More information

From Operational Semantics to Abstract Machines

From Operational Semantics to Abstract Machines From Operational Semantics to Abstract Machines John Hannan Department of Computer Science, University of Copenhagen, Universitetsparken 1, DK-2100 Copenhagen East, Denmark. hannan@diku.dk Dale Miller

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

Why Can t You Behave? Non-Termination Analysis of Direct Recursive Rules with Constraints

Why Can t You Behave? Non-Termination Analysis of Direct Recursive Rules with Constraints Why Can t You Behave? Non-Termination Analysis of Direct Recursive Rules with Constraints Thom Frühwirth Ulm University, Germany thom.fruehwirth@uni-ulm.de Abstract. This paper is concerned with rule-based

More information

Certification of Safe Polynomial Memory Bounds (Extended Version)

Certification of Safe Polynomial Memory Bounds (Extended Version) Certification of Safe Polynomial Memory Bounds (Extended Version) Javier de Dios and Ricardo Peña Departamento de Sistemas Informáticos y Computación Universidad Complutense de Madrid, Spain jdcastro@aventia.com,

More information

Introduction to Logic in Computer Science: Autumn 2006

Introduction to Logic in Computer Science: Autumn 2006 Introduction to Logic in Computer Science: Autumn 2006 Ulle Endriss Institute for Logic, Language and Computation University of Amsterdam Ulle Endriss 1 Plan for Today Today s class will be an introduction

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

Knowledge representation DATA INFORMATION KNOWLEDGE WISDOM. Figure Relation ship between data, information knowledge and wisdom.

Knowledge representation DATA INFORMATION KNOWLEDGE WISDOM. Figure Relation ship between data, information knowledge and wisdom. Knowledge representation Introduction Knowledge is the progression that starts with data which s limited utility. Data when processed become information, information when interpreted or evaluated becomes

More information

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

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

A Stochastic l-calculus

A Stochastic l-calculus A Stochastic l-calculus Content Areas: probabilistic reasoning, knowledge representation, causality Tracking Number: 775 Abstract There is an increasing interest within the research community in the design

More information

Erasable Contracts. Abstract. 1. Introduction. Harvard University {jchinlee,

Erasable Contracts. Abstract. 1. Introduction. Harvard University {jchinlee, Erasable Contracts Jao-ke Chin-Lee Louis Li Harvard University {jchinlee, louisli}@college.harvard.edu Abstract Contract programming is a design approach that allows programmers to design formal specifications

More information

CS 6110 Lecture 28 Subtype Polymorphism 3 April 2013 Lecturer: Andrew Myers

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

Structure. Background. them to their higher order equivalents. functionals in Standard ML source code and converts

Structure. Background. them to their higher order equivalents. functionals in Standard ML source code and converts Introduction 3 Background functionals factor out common behaviour map applies a function to every element of a list fun map [ ] = [ ] map f ( x : : xs ) = f x : : map f xs filter keeps only those elements

More information

Safety Analysis versus Type Inference for Partial Types

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

Type Systems. Today. 1. What is the Lambda Calculus. 1. What is the Lambda Calculus. Lecture 2 Oct. 27th, 2004 Sebastian Maneth

Type Systems. Today. 1. What is the Lambda Calculus. 1. What is the Lambda Calculus. Lecture 2 Oct. 27th, 2004 Sebastian Maneth Today 1. What is the Lambda Calculus? Type Systems 2. Its Syntax and Semantics 3. Church Booleans and Church Numerals 4. Lazy vs. Eager Evaluation (call-by-name vs. call-by-value) Lecture 2 Oct. 27th,

More information

An Introduction to Modal Logic III

An Introduction to Modal Logic III An Introduction to Modal Logic III Soundness of Normal Modal Logics Marco Cerami Palacký University in Olomouc Department of Computer Science Olomouc, Czech Republic Olomouc, October 24 th 2013 Marco Cerami

More information

Computational Soundness of a Call by Name Calculus of Recursively-scoped Records. UMM Working Papers Series, Volume 2, Num. 3.

Computational Soundness of a Call by Name Calculus of Recursively-scoped Records. UMM Working Papers Series, Volume 2, Num. 3. Computational Soundness of a Call by Name Calculus of Recursively-scoped Records. UMM Working Papers Series, Volume 2, Num. 3. Elena Machkasova Contents 1 Introduction and Related Work 1 1.1 Introduction..............................

More information

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω

The non-logical symbols determine a specific F OL language and consists of the following sets. Σ = {Σ n } n<ω 1 Preliminaries In this chapter we first give a summary of the basic notations, terminology and results which will be used in this thesis. The treatment here is reduced to a list of definitions. For the

More information

The Call-by-Need Lambda Calculus

The Call-by-Need Lambda Calculus The Call-by-Need Lambda Calculus John Maraist, Martin Odersky School of Computer and Information Science, University of South Australia Warrendi Road, The Levels, Adelaide, South Australia 5095 fmaraist,oderskyg@cis.unisa.edu.au

More information

Proof. Theorems. Theorems. Example. Example. Example. Part 4. The Big Bang Theory

Proof. Theorems. Theorems. Example. Example. Example. Part 4. The Big Bang Theory Proof Theorems Part 4 The Big Bang Theory Theorems A theorem is a statement we intend to prove using existing known facts (called axioms or lemmas) Used extensively in all mathematical proofs which should

More information

Propositional Logic. CS 3234: Logic and Formal Systems. Martin Henz and Aquinas Hobor. August 26, Generated on Tuesday 31 August, 2010, 16:54

Propositional Logic. CS 3234: Logic and Formal Systems. Martin Henz and Aquinas Hobor. August 26, Generated on Tuesday 31 August, 2010, 16:54 Propositional Logic CS 3234: Logic and Formal Systems Martin Henz and Aquinas Hobor August 26, 2010 Generated on Tuesday 31 August, 2010, 16:54 1 Motivation In traditional logic, terms represent sets,

More information

Parametric Polymorphism and Operational Improvement

Parametric Polymorphism and Operational Improvement Parametric Polymorphism and Operational Improvement JENNIFER HACKETT, University of Nottingham, UK GRAHAM HUTTON, University of Nottingham, UK Parametricity, in both operational and denotational forms,

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

Isomorphism of Finitary Inductive Types

Isomorphism of Finitary Inductive Types Isomorphism of Finitary Inductive Types Christian Sattler joint work (in progress) with Nicolai Kraus University of Nottingham May 2014 Motivating Example Generic data may be represented in a multitude

More information

Interpreting the Full λ-calculus in the π-calculus

Interpreting the Full λ-calculus in the π-calculus Interpreting the Full λ-calculus in the π-calculus Xiaojuan Cai Joint work with Yuxi Fu BASICS Lab October 12, 2009 Motivation The λ-calculus: sequential model; The π-calculus: concurrent model A deep

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

Equational Reasoning in Algebraic Structures: a Complete Tactic

Equational Reasoning in Algebraic Structures: a Complete Tactic Equational Reasoning in Algebraic Structures: a Complete Tactic Luís Cruz-Filipe 1,2 and Freek Wiedijk 1 1 NIII, University of Nijmegen, Netherlands and 2 CLC, Lisbon, Portugal Abstract We present rational,

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

Elaborating evaluation-order polymorphism

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

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic

The Importance of Being Formal. Martin Henz. February 5, Propositional Logic The Importance of Being Formal Martin Henz February 5, 2014 Propositional Logic 1 Motivation In traditional logic, terms represent sets, and therefore, propositions are limited to stating facts on sets

More information

Generalized Lowness and Highness and Probabilistic Complexity Classes

Generalized Lowness and Highness and Probabilistic Complexity Classes Generalized Lowness and Highness and Probabilistic Complexity Classes Andrew Klapper University of Manitoba Abstract We introduce generalized notions of low and high complexity classes and study their

More information

The Lifting Lemma. Ralf Hinze

The Lifting Lemma. Ralf Hinze The Lifting Lemma Ralf Hinze Computing Laboratory, University of Oxford Wolfson Building, Parks Road, Oxford, OX1 3QD, England ralf.hinze@comlab.ox.ac.uk http://www.comlab.ox.ac.uk/ralf.hinze/ June 2009

More information

Coinductive big-step semantics and Hoare logics for nontermination

Coinductive big-step semantics and Hoare logics for nontermination Coinductive big-step semantics and Hoare logics for nontermination Tarmo Uustalu, Inst of Cybernetics, Tallinn joint work with Keiko Nakata COST Rich Models Toolkit meeting, Madrid, 17 18 October 2013

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

Notes for Comp 497 (Comp 454) Week 10 4/5/05

Notes for Comp 497 (Comp 454) Week 10 4/5/05 Notes for Comp 497 (Comp 454) Week 10 4/5/05 Today look at the last two chapters in Part II. Cohen presents some results concerning context-free languages (CFL) and regular languages (RL) also some decidability

More information

Outline. A recursive function follows the structure of inductively-defined data.

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

Specification of Core Agda Subtitle

Specification of Core Agda Subtitle 1 Specification of Core Agda Subtitle THE AGDA SPECIFICATION TEAM, Institution1 FIRST2 LAST2, Institution2a and Institution2b This document specifies the abstract syntax, evaluation rules, and typing rules

More information

Online Appendix to: Types for Atomicity: Static Checking and Inference for Java

Online Appendix to: Types for Atomicity: Static Checking and Inference for Java Online Appendix to: Types for Atomicity: Static Checking and Inference for Java CORMAC FLANAGAN University of California at Santa Cruz STEPHEN N. FREUND and MARINA LIFSHIN Williams College and SHAZ QADEER

More information

Theory of Computation

Theory of Computation Thomas Zeugmann Hokkaido University Laboratory for Algorithmics http://www-alg.ist.hokudai.ac.jp/ thomas/toc/ Lecture 3: Finite State Automata Motivation In the previous lecture we learned how to formalize

More information

Stochastic Histories. Chapter Introduction

Stochastic Histories. Chapter Introduction Chapter 8 Stochastic Histories 8.1 Introduction Despite the fact that classical mechanics employs deterministic dynamical laws, random dynamical processes often arise in classical physics, as well as in

More information

On the Semantics of Parsing Actions

On the Semantics of Parsing Actions On the Semantics of Parsing Actions Hayo Thielecke School of Computer Science University of Birmingham Birmingham B15 2TT, United Kingdom Abstract Parsers, whether constructed by hand or automatically

More information

Lecture 7. Logic. Section1: Statement Logic.

Lecture 7. Logic. Section1: Statement Logic. Ling 726: Mathematical Linguistics, Logic, Section : Statement Logic V. Borschev and B. Partee, October 5, 26 p. Lecture 7. Logic. Section: Statement Logic.. Statement Logic..... Goals..... Syntax of Statement

More information

A Simple Semantics and Static Analysis for Java Security

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

Step-Indexed Biorthogonality: a Tutorial Example

Step-Indexed Biorthogonality: a Tutorial Example Step-Indexed Biorthogonality: a Tutorial Example Andrew Pitts University of Cambridge Computer Laboratory 1 Introduction The purpose of this note is to illustrate the use of step-indexing [2] combined

More information

Notes for Comp 497 (454) Week 10

Notes for Comp 497 (454) Week 10 Notes for Comp 497 (454) Week 10 Today we look at the last two chapters in Part II. Cohen presents some results concerning the two categories of language we have seen so far: Regular languages (RL). Context-free

More information

On the Correctness and Efficiency of the Krivine Machine

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