Elaborating evaluation-order polymorphism

Size: px
Start display at page:

Download "Elaborating evaluation-order polymorphism"

Transcription

1 Elaborating evaluation-order polymorphism Joshua Dunfield University of British Columbia ICFP

2 (prologue) ICFP in Canada for the first time since

3 (prologue) ICFP in Canada for the first time since but this is the only paper from Canada that got in 2

4 Evaluation order Begin at the beginning. the Algol-60 committee meets in Paris 3

5 Evaluation order Begin at the beginning. the Algol-60 committee meets in Paris invents call-by-name; decides to support it and call-by-value 3

6 Evaluation order Begin at the beginning. the Algol-60 committee meets in Paris invents call-by-name; decides to support it and call-by-value everyone goes home 3

7 Evaluation order Begin at the beginning. the Algol-60 committee meets in Paris invents call-by-name; decides to support it and call-by-value everyone goes home Peter Naur makes cbn the default (one of a few matters of detail ) 3

8 Evaluation order Naur had absorbed the Holy Ghost after the Paris meeting... there was nothing one could do... it was to be swallowed for the sake of loyalty. (F.L. Bauer) 4

9 And ever since, there has been moping Standard ML Haskell 5

10 Actually, I ll take your front yard too Cbn languages borrowing cbv Haskell strictness annotations Cbv languages borrowing cbn SML/NJ lazy keyword Scala => 6

11 WARNING: fake social science Programmers choose a language based, in part, on which evaluation order they usually need 7

12 WARNING: fake social science Programmers choose a language based, in part, on which evaluation order they usually need and then tend to solve problems suited to that language s evaluation order 7

13 WARNING: fake social science Programmers choose a language based, in part, on which evaluation order they usually need and then tend to solve problems suited to that language s evaluation order confirming their Objective Opinion about which evaluation order is better. 7

14 WARNING: fake social science Programmers choose a language based, in part, on which evaluation order they usually need and then tend to solve problems suited to that language s evaluation order confirming their Objective Opinion about which evaluation order is better. Is the question which evaluation order? that different from... 7

15 WARNING: fake social science Programmers choose a language based, in part, on which evaluation order they usually need and then tend to solve problems suited to that language s evaluation order confirming their Objective Opinion about which evaluation order is better. Is the question which evaluation order? that different from... Should a language have floating-point numbers... or integers?!? 7

16 A different question Can we design languages that are unbiased about evaluation order? 8

17 A different question Can we design languages that are unbiased about evaluation order? Types keep out bad programs 8

18 A different question Can we design languages that are unbiased about evaluation order? Types keep out bad programs Types are also about more programs! 8

19 A different question Can we design languages that are unbiased about evaluation order? Types keep out bad programs Types are also about more programs! Duplicate the types: two forms:, V N two forms: V, N evaluation-order polymorphism Da. τ: write once, instantiate a = V and/or a = N 8

20 Road map Impartial type system V V + V µ V N N + N µ N D e τ Source language (e) encode types Economical type system + µ V N D e S erase types er(e) : S Target language (M) Cbv type system + µ U (thunk) elaborate M : A D: for all over evaluation order 9

21 Road map Impartial type system V V + V µ V N N + N µ N D e τ Source language (e) encode types Economical type system + µ V N D e S erase types er(e) : S Target language (M) Cbv type system + µ U (thunk) elaborate M : A D: for all over evaluation order V S and N S: suspension type 9

22 Road map Impartial type system V V + V µ V N N + N µ N D e τ Source language (e) encode types Economical type system + µ V N D e S erase types er(e) : S Target language (M) Cbv type system + µ U (thunk) elaborate M : A D: for all over evaluation order V S and N S: suspension type U A: thunk (unit A) 9

23 Source expression syntax Program variables x Source expressions e ::= () x λx. e e e 2 Λα. e e[τ] (e:τ) (e 1, e 2 ) proj k e inj k e case(e, x 1.e 1, x 2.e 2 ) Expression forms work for both V and N 10

24 Source expression syntax Program variables x Source expressions e ::= () x λx. e e e 2 Λα. e e[τ] (e:τ) (e 1, e 2 ) proj k e inj k e case(e, x 1.e 1, x 2.e 2 ) Expression forms work for both V and N Expression forms work for both V and N 10

25 Source expression syntax Program variables x Source expressions e ::= () x λx. e e e 2 Λα. e e[τ] (e:τ) (e 1, e 2 ) proj k e inj k e case(e, x 1.e 1, x 2.e 2 ) Expression forms work for both V and N Expression forms work for both V and N Expression forms work for both + V and + N 10

26 Impartial types Evaluation order vars. a Evaluation orders ɛ ::= V N a Type variables α Source types τ ::= 1 α α. τ Da. τ τ ɛ 1 τ 2 τ 1 ɛ τ 2 τ 1 + ɛ τ 2 µ ɛ α. τ 11

27 Impartial types: lists+streams Traditional encoding of datatypes into +, µ: datatype List α = Nil Cons of (α List α) 12

28 Impartial types: lists+streams Traditional encoding of datatypes into +, µ: datatype List α = Nil of 1 Cons of (α List α) 12

29 Impartial types: lists+streams Traditional encoding of datatypes into +, µ: datatype List α = Nil of 1 Cons of (α List α) datatype List α = Nil of 1 + Cons of (α List α) 12

30 Impartial types: lists+streams Traditional encoding of datatypes into +, µ: datatype List α = Nil of 1 Cons of (α List α) datatype List α = 1 + (α List α) 12

31 Impartial types: lists+streams Traditional encoding of datatypes into +, µ: datatype List α = Nil of 1 Cons of (α List α) datatype List α = 1 + (α List α) µβ. 1 + (α β) 12

32 Impartial types: lists+streams Traditional encoding of datatypes into +, µ: datatype List α = Nil of 1 Cons of (α List α) datatype List α = 1 + (α List α) µβ. 1 + (α β) Generalize over evaluation orders: type List a α = µ a β. ( 1 + a (α a β) ) 12

33 Impartial types: lists+streams type List a α = µ a β. ( 1 + a (α a β) ) List V α = µ V β. ( 1 + V (α V β) ) list of α List N α = µ N β. ( 1 + N (α N β) ) (terminable) stream of α 13

34 Impartial types: lists+streams type List a α = µ a β. ( 1 + a (α a β) ) List V α = µ V β. ( 1 + V (α V β) ) list of α List N α = µ N β. ( 1 + N (α N β) ) (terminable) stream of α Write map once, for both lists and streams: map : Da. α. (α V β) V (List a α) V (List a β) = Λα. fix map. λf. λxs. case(xs, x 1.inj 1 (), x 2.inj 2 (proj 1 x 2 ), (proj 2 x 2 ))) 13

35 Impartial typing Type safety holds for the simply-typed λ-calculus, regardless of evaluation order: Γ, x : A M : B Γ λx.m : A ɛ B -INTRO Γ M : A ɛ B Γ MN : B Γ N : A -ELIM 14

36 Impartial typing Type safety holds for the simply-typed λ-calculus, regardless of evaluation order: Γ, x : A M : B Γ λx.m : A ɛ B -INTRO Γ M : A ɛ B Γ MN : B Γ N : A -ELIM 14

37 Impartial typing Type safety holds for the simply-typed λ-calculus, regardless of evaluation order: Γ, x : A M : B Γ λx.m : A ɛ B -INTRO Γ M : A ɛ B Γ MN : B Γ N : A -ELIM Evaluation order ɛ is implicit and depends on typing: typing rules can t be syntax-directed. How can we avoid choosing ɛ at random? 14

38 Impartial typing Type safety holds for the simply-typed λ-calculus, regardless of evaluation order: Γ, x : A M : B Γ λx.m : A ɛ B -INTRO Γ M : A ɛ B Γ MN : B Γ N : A -ELIM Evaluation order ɛ is implicit and depends on typing: typing rules can t be syntax-directed. How can we avoid choosing ɛ at random? Bidirectional typing 14

39 Bidirectional typing: why? Some past answers: to handle features beyond Damas Milner (Pierce & Turner 00; Dunfield & Pfenning 04; Dunfield & Krishnaswami 13;... ) for better (earlier) type error messages Here: to make typing more predictable. 15

40 Bidirectional typing in one slide Organize the flow of information from type annotations: Given γ, e, and a known type τ, check e: γ I e τ Given γ and e, synthesize a type for e: γ I e τ The type τ in the checking judgment e τ is a goal. 16

41 Impartial bidirectional typing Frank Pfenning s recipe: intro rules check, elim rules synthesize. γ, (x τ 1 ) I e τ 2 γ I (λx. e) τ 1 ɛ τ 2 I Intro γ I e 1 τ 1 ɛ τ 2 γ I e 2 τ 1 γ I (e e 2 ) τ 2 I Elim I Intro: The type τ 1 ɛ τ 2 must flow from an annotation. I Elim: The type τ ɛ 1 τ 2 must flow from an annotation, perhaps via γ. 17

42 Impartial bidirectional typing Frank Pfenning s recipe: intro rules check, elim rules synthesize. γ, (x τ 1 ) I e τ 2 γ I (λx. e) τ 1 ɛ τ 2 I Intro γ I e 1 τ 1 ɛ τ 2 γ I e 2 τ 1 γ I (e e 2 ) τ 2 I Elim I Intro: The type τ 1 ɛ τ 2 must flow from an annotation. I Elim: The type τ ɛ 1 τ 2 must flow from an annotation, perhaps via γ. 17

43 Impartial bidirectional typing Intro rules check, elim rules synthesize. Handle D like : γ, a evalorder I e τ γ I e Da. τ IDIntro γ I e Da. τ γ ɛ evalorder γ I e [ɛ/a]τ IDElim 18

44 Impartial bidirectional typing Intro rules check, elim rules synthesize. Handle D like : γ, a evalorder I e τ γ I e Da. τ IDIntro γ I e Da. τ γ ɛ evalorder γ I e [ɛ/a]τ IDElim Back to guessing? ɛ in IDElim Can force an eval. order by annotating e In practice, probably want the ability to set a default (lexically-scoped?) for IDElim. 18

45 Road map Impartial type system V V + V µ V N N + N µ N D e τ Source language (e) encode types Economical type system + µ V N D e S erase types er(e) : S Target language (M) Cbv type system + µ U (thunk) elaborate M : A D: for all over evaluation order V S and N S: suspension type U A: thunk (unit A) 19

46 Road map Impartial type system V V + V µ V N N + N µ N D e τ Source language (e) encode types Economical type system + µ V N D e S erase types er(e) : S Target language (M) Cbv type system + µ U (thunk) elaborate M : A D: for all over evaluation order V S and N S: suspension type U A: thunk (unit A) 19

47 Road map Impartial type system V V + V µ V N N + N µ N D e τ Source language (e) encode types Economical type system + µ V N D e S erase types er(e) : S Target language (M) Cbv type system + µ U (thunk) elaborate M : A D: for all over evaluation order V S and N S: suspension type U A: thunk (unit A) 19

48 Economical types = by-value + suspensions Factor out the differences between V, N connectives: Economical types S ::= 1 α α. S Da. S ɛ S S 1 S 2 S 1 S 2 S 1 + S 2 µα. S N S N suspend S 1 S V S V suspend S S 20

49 Economical types = by-value + suspensions Factor out the differences between V, N connectives: Economical types S ::= 1 α α. S Da. S ɛ S S 1 S 2 S 1 S 2 S 1 + S 2 µα. S N S N suspend S 1 S V S V suspend S S Encode impartial types as economical types: τ 1 1 = 1 ɛ τ 2 = ( ɛ τ 1 ) τ 2 τ 1 + ɛ τ 2 = ɛ ( τ 1 + τ 2 ) τ 1 ɛ τ 2 = ( ɛ τ 1 ) ( ɛ τ 2 ) Da. τ = Da. τ µ ɛ α. τ = µα. ɛ τ α. τ = α. τ α = α 20

50 Economical types: lists+streams type List a α = µβ. a ( 1 + (α β) ) List V α = µβ. V ( 1 + (α β) ) list of α List N α = µβ. N ( 1 + (α β) ) (terminable) stream of α Write map once, for both lists and streams: map : Da. α. (α β) (List a α) (List a β) = Λα. fix map. λf. λxs. case(xs, x 1.inj 1 (), x 2.inj 2 (proj 1 x 2 ), (proj 2 x 2 ))) (body of map unchanged from the impartial system) 21

51 Road map Impartial type system V V + V µ V N N + N µ N D e τ Source language (e) encode types Economical type system + µ V N D e S erase types er(e) : S Target language (M) Cbv type system + µ U (thunk) elaborate M : A D: for all over evaluation order V S and N S: suspension type U A: thunk (unit A) 22

52 Road map Impartial type system V V + V µ V N N + N µ N D e τ Source language (e) encode types Economical type system + µ V N D e S erase types er(e) : S Target language (M) Cbv type system + µ U (thunk) elaborate M : A D: for all over evaluation order V S and N S: suspension type U A: thunk (unit A) 22

53 Road map Impartial type system V V + V µ V N N + N µ N D e τ Source language (e) encode types Economical type system + µ V N D e S erase types er(e) : S Target language (M) Cbv type system + µ U (thunk) elaborate M : A D: for all over evaluation order V S and N S: suspension type U A: thunk (unit A) 22

54 Elaboration For the metatheory, elaboration not bidirectional. For every economical typing with e S or e S we can erase types from e and elaborate to M er(e) : S M 23

55 Elaboration: rules for Γ e : S M Γ e : V S M Γ e : N S thunk M elab Intro Γ e : V S M Γ e : S M elab Elim V Γ e : N S M Γ e : S force M elab Elim N inj 1 () : N (1 + ) thunk (inj 1 ()) Given y : N (1 + ), y : (1 + ) force y 24

56 Elaboration: rules for Γ e : S M Γ e : V S M Γ e : N S thunk M elab Intro Γ e : V S M Γ e : S M elab Elim V Γ e : N S M Γ e : S force M elab Elim N inj 1 () : N (1 + ) thunk (inj 1 ()) Given y : N (1 + ), y : (1 + ) force y 24

57 Elaboration: rules for D Γ e : [V/a]S M 1 Γ e : [N/a]S M 2 Γ e : (Da. S) (M 1, M 2 ) elabdintro Γ e : (Da. S) M Γ e : [V/a]S proj 1 M Γ e : [N/a]S proj 2 M elabdelim map : Da. (map V, map N ) Given xs : List N β, xs (proj 2 map) f xs 25

58 Elaboration: rules for D Γ e : [V/a]S M 1 Γ e : [N/a]S M 2 Γ e : (Da. S) (M 1, M 2 ) elabdintro Γ e : (Da. S) M Γ e : [V/a]S proj 1 M Γ e : [N/a]S proj 2 M elabdelim map : Da. (map V, map N ) Given xs : List N β, xs (proj 2 map) f xs 25

59 Elaboration: rules for D Γ e : [V/a]S M 1 Γ e : [N/a]S M 2 Γ e : (Da. S) (M 1, M 2 ) elabdintro Γ e : (Da. S) M Γ e : [V/a]S proj 1 M Γ e : [N/a]S proj 2 M elabdelim map : Da. (map V, map N ) Given xs : List N β, xs (proj 2 map) f xs Only instantiating Da with N will succeed. 25

60 Metatheory Impartial type system V V + V µ V N N + N µ N D e τ Source language (e) encode types Economical type system + µ V N D e S erase types er(e) : S Target language (M) Cbv type system + µ U (thunk) elaborate M : A 26

61 Metatheory: consistency Impartial type system V V + V µ V N N + N µ N D e τ Source language (e) encode types Economical type system + µ V N D e S erase types er(e) : S Target language (M) Cbv type system + µ U (thunk) elaborate standard cbv evaluation ( 0 steps) M : A If er(e) : S M and M W W : A 27

62 Metatheory: consistency Impartial type system V V + V µ V N N + N µ N D e τ Source language (e) encode types Economical type system + µ V N D e S cbv + cbn evaluation ( 0 steps) erase types er(e) : S e : S Target language (M) Cbv type system + µ U (thunk) elaborate standard cbv evaluation ( 0 steps) elaborate M : A W : A If er(e) : S M and M W then er(e) e and e : S W. 27

63 Metatheory: N-freeness Theorem. If an impartial typing judgment with τ is N-free, then the corresponding economical judgment with τ is N-free. Theorem. If an economical typing judgment with e is N-free then er(e) elaborates to M, and M is N-free. Theorem (Multi-step consistency).... Moreover, if M is N-free then we can derive e e without by-name reductions. A judgment with D is not N-free (subformula property). 28

64 History Church: normal-order (leftmost-outermost) reduction Bernays (1936), reviewing Church & Rosser (1936): require arguments in normal form (not head-normal form) Naur et al. (1960): Algol-60 with cbn/cbv on per-argument basis (resentful committee members: HOPL) Wadsworth (1971), Henderson & Morris (1976), Friedman & Wise (1976): lazy evaluation 29

65 Immediate ancestors Chen et al., ICFP 2011: elaboration from intersection types (we just didn t call them that), for incremental computation ICFP 2012: elaboration from intersection types; like D, but more general and less predictable: here we only intersect V- and N-instantiations 30

66 Immediate ancestors Chen et al., ICFP 2011: elaboration from intersection types (we just didn t call them that), for incremental computation ICFP 2012: elaboration from intersection types; like D, but more general and less predictable: here we only intersect V- and N-instantiations 30

67 What s next? an implementation? let? lexically-scoped default ɛ? call-by-need Could these techniques resolve other fundamental differences between PLs? 31

68 What s next? an implementation? let? lexically-scoped default ɛ? call-by-need Could these techniques resolve other fundamental differences between PLs? One big happy family (united against the OOP enemy?) 31

69 Conclusion: Evaluation-order peace may be on its way! Paper and proofs: arxiv.org/abs/ Special thanks to: the cats of Metro Vancouver and Cambridge, England Shameless advertisement: I m looking for a research/teaching job in Canada. 32

70 Conclusion: Evaluation-order peace may be on its way! Paper and proofs: arxiv.org/abs/ Special thanks to: the cats of Metro Vancouver and Cambridge, England Shameless advertisement: I m looking for a research/teaching job in Canada. 32

71 Conclusion: Evaluation-order peace may be on its way! Paper and proofs: arxiv.org/abs/ Special thanks to: the cats of Metro Vancouver and Cambridge, England Shameless advertisement: I m looking for a research/teaching job in Canada. 32

72 33

73 Target for elaboration Standard cbv, plus thunks (type U B) G T M : B G T thunk M : U B TUIntro G T M 1 : U B G T force M 1 : B TUElim thunk type U B could be 1 B distinguished only for the metatheory 34

74 Source operational semantics Define by-value and by-name reductions: (λx. e 1 v 2 RV [v 2 /x]e 1 (λx. e 1 e 2 RN [e 2 /x]e 1 Allow reductions in the appropriate eval. contexts: C V [e] RV C V [e ] C N [e] RN C N [e ] Example: (λx. [ ] is a C V but not a C N 35

75 Source operational semantics The relation is too big, because it s not connected to typing. (λx. [ ] is a C V but not a C N In fact, is much too big in the paper, which defines C N incorrectly. But the metatheory doesn t care. Guess I m even more cbv-biased than I thought! 36

Elaborating Evaluation-Order Polymorphism

Elaborating Evaluation-Order Polymorphism Elaborating Evaluation-Order Polymorphism Joshua Dunfield University of British Columbia Vancouver, Canada joshdu nf@cs.ubc.ca Abstract We classify programming languages according to evaluation order:

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

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

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

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

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

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

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

Simply Typed λ-calculus

Simply Typed λ-calculus Simply Typed λ-calculus Lecture 1 Jeremy Dawson The Australian National University Semester 2, 2017 Jeremy Dawson (ANU) COMP4630,Lecture 1 Semester 2, 2017 1 / 23 A Brief History of Type Theory First developed

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

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

3.2 Equivalence, Evaluation and Reduction Strategies

3.2 Equivalence, Evaluation and Reduction Strategies 3.2 Equivalence, Evaluation and Reduction Strategies The λ-calculus can be seen as an equational theory. More precisely, we have rules i.e., α and reductions, for proving that two terms are intensionally

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

Continuations, Processes, and Sharing. Paul Downen, Luke Maurer, Zena M. Ariola, Daniele Varacca. September 8, 2014

Continuations, Processes, and Sharing. Paul Downen, Luke Maurer, Zena M. Ariola, Daniele Varacca. September 8, 2014 Continuations, Processes, and Sharing Paul Downen, Luke Maurer, Zena M. Ariola, Daniele Varacca University of Oregon, Université Paris Diderot September 8, 2014 The plethora of semantic artifacts Many

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

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

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

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

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications

NICTA Advanced Course. Theorem Proving Principles, Techniques, Applications NICTA Advanced Course Theorem Proving Principles, Techniques, Applications λ 1 CONTENT Intro & motivation, getting started with Isabelle Foundations & Principles Lambda Calculus Higher Order Logic, natural

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

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

Type inference in context

Type inference in context Type inference in context Adam Gundry University of Strathclyde Microsoft Research PhD Scholar Conor McBride University of Strathclyde James McKinna Radboud University Nijmegen MSFP 25 September 2010 Two

More information

Midterm Exam Types and Programming Languages Frank Pfenning. October 18, 2018

Midterm Exam Types and Programming Languages Frank Pfenning. October 18, 2018 Midterm Exam 15-814 Types and Programming Languages Frank Pfenning October 18, 2018 Name: Andrew ID: Instructions This exam is closed-book, closed-notes. You have 80 minutes to complete the exam. There

More information

Call by Effect. Kevin Ellis. Catlin Gabel

Call by Effect. Kevin Ellis. Catlin Gabel Call by Effect Kevin Ellis Catlin Gabel Abstract. Evaluation strategies specify rules for evaluation of terms in a programming language. That the choice of evaluation strategy affects the expressiveness

More information

A Concurrent Logical Framework

A Concurrent Logical Framework A Concurrent Logical Framework Frank Pfenning Carnegie Mellon University Types Workshop Torino, Italy, April 2003 Joint work with Iliano Cervesato, David Walker, and Kevin Watkins Types 03, Torino, April

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

THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521

THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 P. 1 of 7 THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 December, 2016 Time: 2 hrs. Instructions The exam contains questions totaling 100 points. Answer all questions.

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 17 Tuesday, April 2, 2013 1 There is a strong connection between types in programming languages and propositions

More information

Church and Curry: Combining Intrinsic and Extrinsic Typing

Church and Curry: Combining Intrinsic and Extrinsic Typing Church and Curry: Combining Intrinsic and Extrinsic Typing Frank Pfenning Dedicated to Peter Andrews on the occasion of his retirement Department of Computer Science Carnegie Mellon University April 5,

More information

6.001 Recitation 22: Streams

6.001 Recitation 22: Streams 6.001 Recitation 22: Streams RI: Gerald Dalley, dalleyg@mit.edu, 4 May 2007 http://people.csail.mit.edu/dalleyg/6.001/sp2007/ The three chief virtues of a programmer are: Laziness, Impatience and Hubris

More information

A Denotational Approach to Measuring Complexity in Functional Programs

A Denotational Approach to Measuring Complexity in Functional Programs A Denotational Approach to Measuring Complexity in Functional Programs Kathryn Van Stone June 2003 CMU-CS-03-150 School of Computer Science Carnegie Mellon University Pittsburgh, PA 15213 Thesis Committee:

More information

Unicity of type inhabitants; a Work in Progress

Unicity of type inhabitants; a Work in Progress Unicity of type inhabitants; a Work in Progress Gabriel Scherer Gallium (INRIA Paris-Rocquencourt) May 30, 2013 Gabriel Scherer (Gallium) Unique Inhabitants; WIP May 30, 2013 1 / 27 What? This talk is

More information

Boxes Go Bananas: Encoding Higher-Order Abstract Syntax with Parametric Polymorphism (Extended Version)

Boxes Go Bananas: Encoding Higher-Order Abstract Syntax with Parametric Polymorphism (Extended Version) Boxes Go Bananas: Encoding Higher-Order Abstract Syntax with Parametric Polymorphism (Extended Version) Geoffrey Washburn Stephanie Weirich Department of Computer and Information Science University of

More 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

Element x is R-minimal in X if y X. R(y, x).

Element x is R-minimal in X if y X. R(y, x). CMSC 22100/32100: Programming Languages Final Exam M. Blume December 11, 2008 1. (Well-founded sets and induction principles) (a) State the mathematical induction principle and justify it informally. 1

More information

A Principled approach to Ornamentation in ML

A Principled approach to Ornamentation in ML 0 0 A Principled approach to Ornamentation in ML THOMAS WILLIAMS, Inria DIDIER RÉMY, Inria Ornaments are a way to describe changes in datatype definitions reorganizing, adding, or dropping some pieces

More information

Type Systems Winter Semester 2006

Type Systems Winter Semester 2006 Type Systems Winter Semester 2006 Week 7 November 29 November 29, 2006 - version 1.0 Plan PREVIOUSLY: 1. type safety as progress and preservation 2. typed arithmetic expressions 3. simply typed lambda

More information

CSE 505, Fall 2005, Midterm Examination 8 November Please do not turn the page until everyone is ready.

CSE 505, Fall 2005, Midterm Examination 8 November Please do not turn the page until everyone is ready. CSE 505, Fall 2005, Midterm Examination 8 November 2005 Please do not turn the page until everyone is ready. Rules: The exam is closed-book, closed-note, except for one side of one 8.5x11in piece of paper.

More 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

Normalization by Evaluation

Normalization by Evaluation Normalization by Evaluation Andreas Abel Department of Computer Science and Engineering Chalmers and Gothenburg University PhD Seminar in Mathematical Engineering EAFIT University, Medellin, Colombia 9

More information

CSE 505, Fall 2009, Midterm Examination 5 November Please do not turn the page until everyone is ready.

CSE 505, Fall 2009, Midterm Examination 5 November Please do not turn the page until everyone is ready. CSE 505, Fall 2009, Midterm Examination 5 November 2009 Please do not turn the page until everyone is ready Rules: The exam is closed-book, closed-note, except for one side of one 85x11in piece of paper

More 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

lec6 8: Natural deduction

lec6 8: Natural deduction lec6 8: Natural deduction Joshua Dunfield February 1, 2018 1 Background In the early 1900s, the principal efforts towards foundations for mathematical and logical reasoning mathematical logic focused on

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

Type Systems. Lecture 9: Classical Logic. Neel Krishnaswami University of Cambridge

Type Systems. Lecture 9: Classical Logic. Neel Krishnaswami University of Cambridge Type Systems Lecture 9: Classical Logic Neel Krishnaswami University of Cambridge Where We Are We have seen the Curry Howard correspondence: Intuitionistic propositional logic Simply-typed lambda calculus

More information

Lecture Notes on Certifying Theorem Provers

Lecture Notes on Certifying Theorem Provers Lecture Notes on Certifying Theorem Provers 15-317: Constructive Logic Frank Pfenning Lecture 13 October 17, 2017 1 Introduction How do we trust a theorem prover or decision procedure for a logic? Ideally,

More information

Call-by-value non-determinism in a linear logic type discipline

Call-by-value non-determinism in a linear logic type discipline Call-by-value non-determinism in a linear logic type discipline Alejandro Díaz-Caro? Giulio Manzonetto Université Paris-Ouest & INRIA LIPN, Université Paris 13 Michele Pagani LIPN, Université Paris 13

More information

Justifying Algorithms for βη-conversion

Justifying Algorithms for βη-conversion Justifying Algorithms for βη-conversion Healfdene Goguen AT&T Labs, 180 Park Ave., Florham Park NJ 07932 USA hhg@att.com. Abstract. Deciding the typing judgement of type theories with dependent types such

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

CBV and CBN. Eduardo Bonelli. TP para LP 2012C1 1/55

CBV and CBN. Eduardo Bonelli. TP para LP 2012C1 1/55 CBV and CBN Eduardo Bonelli TP para LP 2012C1 1/55 Reduction Strategies Call-By-Value Call-by-Name Relating CBN and CBV λ-calculus Continuation Passing Style Bibliography 2/55 Reduction Strategies Reduction

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

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

INTEROPERATION FOR LAZY AND EAGER EVALUATION. A Thesis. Presented to. the Faculty of California Polytechnic State University. 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

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

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

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

Programming with Dependent Types in Coq

Programming with Dependent Types in Coq Programming with Dependent Types in Coq Matthieu Sozeau LRI, Univ. Paris-Sud - Démons Team & INRIA Saclay - ProVal Project PPS Seminar February 26th 2009 Paris, France Coq A higher-order, polymorphic logic:

More 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

A Principled Approach to Ornamentation in ML

A Principled Approach to Ornamentation in ML A Principled Approach to Ornamentation in ML Thomas Williams, Didier Rémy To cite this version: Thomas Williams, Didier Rémy. A Principled Approach to Ornamentation in ML. [Research Report] RR-9117, Inria.

More information

Homework 5: Parallelism and Control Flow : Types and Programming Languages Fall 2015 TA: Evan Cavallo

Homework 5: Parallelism and Control Flow : Types and Programming Languages Fall 2015 TA: Evan Cavallo Homework 5: Parallelism and Control Flow 15-814: Types and Programming Languages Fall 2015 TA: Evan Cavallo (ecavallo@cs.cmu.edu) Out: 11/5/15 Due: 11/17/15, 10:30am 1 Cost Dynamics In this section, we

More 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

The Turing machine model of computation

The Turing machine model of computation The Turing machine model of computation For most of the remainder of the course we will study the Turing machine model of computation, named after Alan Turing (1912 1954) who proposed the model in 1936.

More information

THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521

THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 P. 1 of 7 THE UNIVERSITY OF CALGARY FACULTY OF SCIENCE FINAL EXAMINATION COMPUTER SCIENCE 521 December, 2014 Time: 2 hrs. Instructions The exam contains questions totaling 100 points. Answer all questions.

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

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

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

States and Actions: An Automata-theoretic Model of Objects

States and Actions: An Automata-theoretic Model of Objects States and Actions: An Automata-theoretic Model of Objects Uday S. Reddy 1 Brian P. Dunphy 2 1 University of Birmingham 2 University of Illinois at Urbana-Champaign Portland, Oct 2011 Uday S. Reddy (Univ

More information

A probabilistic lambda calculus - Some preliminary investigations

A probabilistic lambda calculus - Some preliminary investigations A probabilistic lambda calculus - Some preliminary investigations Ugo Dal Lago, Margherita Zorzi Università di Bologna, Università di Verona June, 9-11, 2010, Torino Introduction: Λ P We present some results

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

Lambda calculus. (Advanced Functional Programming) Jeremy Yallop. January Computer Laboratory University of Cambridge 1/ 29

Lambda calculus. (Advanced Functional Programming) Jeremy Yallop. January Computer Laboratory University of Cambridge 1/ 29 1/ 29 Lambda calculus (Advanced Functional Programming) Jeremy Yallop Computer Laboratory University of Cambridge January 2015 Course outline 2/ 29 3/ 29 Books OCaml from the very beginning John Whitington

More information

Simply Typed Lambda-Calculi (II)

Simply Typed Lambda-Calculi (II) THEORY AND PRACTICE OF FUNCTIONAL PROGRAMMING Simply Typed Lambda-Calculi (II) Dr. ZHANG Yu Institute of Software, Chinese Academy of Sciences Fall term, 2011 GUCAS, Beijing Introduction PCF Programming

More information

Type Inference Algorithms

Type Inference Algorithms Type Inference Algorithms February 19, 2009 S. Saeidi Mobarakeh ( 0559938 ) Abstract In this paper we are going to describe the Wand s type inference algorithm and we ll try to extend this algorithm with

More information

Programming Language Concepts: Lecture 18

Programming Language Concepts: Lecture 18 Programming Language Concepts: Lecture 18 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2009 PLC 2009, Lecture 18, 30 March 2009 One step reduction

More information

Constructive approach to relevant and affine term calculi

Constructive approach to relevant and affine term calculi Constructive approach to relevant and affine term calculi Jelena Ivetić, University of Novi Sad, Serbia Silvia Ghilezan,University of Novi Sad, Serbia Pierre Lescanne, University of Lyon, France Silvia

More information

(Type) Constraints. Solving constraints Type inference

(Type) Constraints. Solving constraints Type inference A (quick) tour of ML F (Graphic) Types (Type) Constraints Solving constraints Type inference Type Soundness A Fully Graphical Presentation of ML F Didier Rémy & Boris Yakobowski Didier Le Botlan INRIA

More information

Declarative Computation Model. Conditional. Case statement. Procedure values (2) Procedure values. Sequential declarative computation model

Declarative Computation Model. Conditional. Case statement. Procedure values (2) Procedure values. Sequential declarative computation model Declarative Computation Model Kernel language semantics revisited (VRH.4.5) From kernel to practical language (VRH.6) Exceptions (VRH.7) Carlos Varela RPI October 0, 009 Adapted with permission from: Seif

More 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

Which simple types have a unique inhabitant?

Which simple types have a unique inhabitant? Which simple types have a unique inhabitant? Gabriel Scherer Didier Rémy INRIA {gabriel.scherer,didier.remy}@inria.fr Abstract We study the question of whether a given type has a unique inhabitant modulo

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

Reasoning About Imperative Programs. COS 441 Slides 10b

Reasoning About Imperative Programs. COS 441 Slides 10b Reasoning About Imperative Programs COS 441 Slides 10b Last time Hoare Logic: { P } C { Q } Agenda If P is true in the initial state s. And C in state s evaluates to s. Then Q must be true in s. Program

More information

Denotational semantics

Denotational semantics Denotational semantics Semantics and Application to Program Verification Antoine Miné École normale supérieure, Paris year 2015 2016 Course 4 4 March 2016 Course 4 Denotational semantics Antoine Miné p.

More information

Adapted with permission from: Seif Haridi KTH Peter Van Roy UCL. C. Varela; Adapted w. permission from S. Haridi and P. Van Roy 1

Adapted with permission from: Seif Haridi KTH Peter Van Roy UCL. C. Varela; Adapted w. permission from S. Haridi and P. Van Roy 1 Higher-Order Programming: Iterative computation (CTM Section 3.2) Closures, procedural abstraction, genericity, instantiation, embedding (CTM Section 3.6.1) Carlos Varela RPI September 15, 2017 Adapted

More information

Mechanizing Metatheory in a Logical Framework

Mechanizing Metatheory in a Logical Framework Under consideration for publication in J. Functional Programming 1 Mechanizing Metatheory in a Logical Framework Robert Harper and Daniel R. Licata Carnegie Mellon University (e-mail: {rwh,drl}@cs.cmu.edu)

More information

Monadic Refinements for Relational Cost Analysis (Appendix)

Monadic Refinements for Relational Cost Analysis (Appendix) Monadic Refinements for Relational Cost Analysis (Appendix) Ivan Radiček Gilles Barthe Marco Gaboardi Deepak Garg Florian Zuleger Structure of the Appendix In the appendix we give material that was omitted

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

Adapted with permission from: Seif Haridi KTH Peter Van Roy UCL. C. Varela; Adapted w. permission from S. Haridi and P. Van Roy 1

Adapted with permission from: Seif Haridi KTH Peter Van Roy UCL. C. Varela; Adapted w. permission from S. Haridi and P. Van Roy 1 Higher-Order Programming: Iterative computation (CTM Section 3.2) Closures, procedural abstraction, genericity, instantiation, embedding (CTM Section 3.6.1) Carlos Varela RPI September 15, 2015 Adapted

More information

Chiastic Lambda-Calculi

Chiastic Lambda-Calculi Chiastic Lambda-Calculi wren ng thornton Cognitive Science & Computational Linguistics Indiana University, Bloomington NLCS, 28 June 2013 wren ng thornton (Indiana University) Chiastic Lambda-Calculi NLCS,

More information

CS611 Lecture 25 Solving Domain Equations 22 October 2007 Lecturer: Andrew Myers

CS611 Lecture 25 Solving Domain Equations 22 October 2007 Lecturer: Andrew Myers CS611 Lecture 25 Solving Domain Equations 22 October 2007 Lecturer: Andrew Myers To develop a denotational semantics for a language with recursive types, or to give a denotational semantics for the untyped

More information

Propositional Logic: Part II - Syntax & Proofs 0-0

Propositional Logic: Part II - Syntax & Proofs 0-0 Propositional Logic: Part II - Syntax & Proofs 0-0 Outline Syntax of Propositional Formulas Motivating Proofs Syntactic Entailment and Proofs Proof Rules for Natural Deduction Axioms, theories and theorems

More information

Mary Southern and Gopalan Nadathur. This work was funded by NSF grant CCF

Mary Southern and Gopalan Nadathur. This work was funded by NSF grant CCF A Translation-Based Animation of Dependently-Typed Specifications From LF to hohh(and back again) Mary Southern and Gopalan Nadathur Department of Computer Science and Engineering University of Minnesota

More information

A Call-by-Name CPS Hierarchy

A Call-by-Name CPS Hierarchy A Call-by-Name CPS Hierarchy Asami Tanaka and Yukiyoshi Kameyama University of Tsukuba, Japan asami@logic.cs.tsukuba.ac.jp,kameyama@acm.org Abstract. The Continuation-Passing-Style (CPS) translation gives

More information

Multicore Semantics and Programming

Multicore Semantics and Programming Multicore Semantics and Programming Peter Sewell Tim Harris University of Cambridge Oracle October November, 2015 p. 1 These Lectures Part 1: Multicore Semantics: the concurrency of multiprocessors and

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

Program-ing in Coq. Matthieu Sozeau under the direction of Christine Paulin-Mohring

Program-ing in Coq. Matthieu Sozeau under the direction of Christine Paulin-Mohring Program-ing in Coq Matthieu Sozeau under the direction of Christine Paulin-Mohring LRI, Univ. Paris-Sud - Démons Team & INRIA Saclay - ProVal Project Foundations of Programming seminar February 15th 2008

More information

CS 6110 Lecture 35 Solving Domain Equations 19 April 2013 Lecturer: Andrew Myers

CS 6110 Lecture 35 Solving Domain Equations 19 April 2013 Lecturer: Andrew Myers CS 6110 Lecture 35 Solving Domain Equations 19 April 2013 Lecturer: Andrew Myers To develop a denotational semantics for a language with recursive types, or to give a denotational semantics for the untyped

More information

Dependent types. Paul Stansifer. March 16, 2012

Dependent types. Paul Stansifer. March 16, 2012 Dependent types Paul Stansifer March 16, 2012 1 You ve seen this before I hope you like abstraction, because we re about to use it a lot. Here s the simply-typed lambda calculus with built-in list operations

More information

Some Recent Logical Frameworks

Some Recent Logical Frameworks Some Recent Logical Frameworks Randy Pollack LFCS, University of Edinburgh Version of September 13, 2010 Outline Edinburgh Logical Framework (ELF) (LICS 1987) Reminder by Example Some Problems with ELF

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

Contextual equivalence

Contextual equivalence Techniques 16/22 ACS L16, lecture 2 4/10 Contextual equivalence Two phrases of a programming language are ( Morris style ) contextually equivalent ( = ctx ) if occurrences of the first phrase in any program

More information

Why Functional Programming Matters. John Hughes & Mary Sheeran

Why Functional Programming Matters. John Hughes & Mary Sheeran Why Functional Programming Matters John Hughes & Mary Sheeran Functional Programming à la 1940s Minimalist: who needs booleans? A boolean just makes a choice! true x y = x false x y = y We can define if-then-else!

More information

2 Results I: Lifting Computer Science

2 Results I: Lifting Computer Science Ben Greenman December 12, 2015 Call-By-Name, Call-By-Value, and the λ Calculus Abstract Plotkin s 1975 paper is strictly business. There are many theorems packed in the space of 35 pages, with little room

More information