Intersections and Unions of Session Types

Size: px
Start display at page:

Download "Intersections and Unions of Session Types"

Transcription

1 Intersections and Unions of Session Types Coşku Acay Frank Pfenning Carnegie Mellon University School of Computer Science ITRS 2016 C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

2 Overview 1 Background Message-passing Concurrency Session Types Subtyping Configurations and Reduction 2 Intersections and Unions Intersection Types Union Types Reinterpreting Choice 3 Algorithmic System 4 Metatheory C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

3 Plan 1 Background Message-passing Concurrency Session Types Subtyping Configurations and Reduction 2 Intersections and Unions Intersection Types Union Types Reinterpreting Choice 3 Algorithmic System 4 Metatheory C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

4 Setting Processes represented as nodes Channels go between processes and represented as edges Each channel is provided by a specific process (e.g. P provides c, Q provides d etc.): one-to-one correspondence between channels and processes g T c d e P Q R f S C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

5 Communication Processes compute internally Exchange messages along channels c d e P Q R

6 Communication Processes compute internally Exchange messages along channels c P d Q e R 3

7 Communication Processes compute internally Exchange messages along channels c d e P Q R 3 "aaa" end

8 Communication Processes compute internally Exchange messages along channels c d e P Q R 3 "aaa" end Note that communication is synchronous. C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

9 Higher-order Messages Processes can also send channels they own e R c d e P Q R

10 Higher-order Messages Processes can also send channels they own e R c d e P Q R e

11 Higher-order Messages Processes can also send channels they own e R c d e P Q R e C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

12 Session Types Don t want to send int if expecting string Don t try to receive if other process is not sending C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

13 Session Types Don t want to send int if expecting string Don t try to receive if other process is not sending Solution: Assign types to each channel C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

14 Session Types Don t want to send int if expecting string Don t try to receive if other process is not sending Solution: Assign types to each channel (from provider s perspective). C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

15 Session Types Don t want to send int if expecting string Don t try to receive if other process is not sending Solution: Assign types to each channel (from provider s perspective). c : A d : d int : string d string : B B B e : 1 P Q R

16 Session Types Don t want to send int if expecting string Don t try to receive if other process is not sending Solution: Assign types to each channel (from provider s perspective). c : A d : d int : string d string : B B B e : 1 P Q R 3

17 Session Types Don t want to send int if expecting string Don t try to receive if other process is not sending Solution: Assign types to each channel (from provider s perspective). c : A d : d int : string d string : B B B e : 1 P Q R 3 "aaa"

18 Session Types Don t want to send int if expecting string Don t try to receive if other process is not sending Solution: Assign types to each channel (from provider s perspective). c : A d : d int : string d string : B B B e : 1 P Q R 3 end "aaa"

19 Session Types Don t want to send int if expecting string Don t try to receive if other process is not sending Solution: Assign types to each channel (from provider s perspective). c : A d : d int : string d string : B B B e : 1 P Q R 3 end "aaa" C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

20 Why linear? Sessions are resources: communicating along a channel consumes the old type Contraction would violate type safety Weakening would work, but we keep things simple C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

21 Linear Propositions as Session Types 1 send end and terminate A B send channel of type A and continue as B τ B send value of type τ and continue as B {lab k : A k } k I send lab i and continue as A i for some i I A B receive channel of type A and continue as B τ B receive value of type τ and continue as B &{lab k : A k } k I receive lab i and continue as A i for some i I µt.a t (equi-)recursive type C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

22 Linear Propositions as Session Types 1 send end and terminate A B send channel of type A and continue as B τ B send value of type τ and continue as B {lab k : A k } k I send lab i and continue as A i for some i I A B receive channel of type A and continue as B τ B receive value of type τ and continue as B &{lab k : A k } k I receive lab i and continue as A i for some i I µt.a t (equi-)recursive type Example: Queue Interface type queue = &{ enq : A -o queue, deg : +{ none : 1, some : A * queue } } C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

23 Proof Terms as Concurrent Processes P, Q, R ::= x P x ; Q x cut (spawn) c d id (forward) close c wait c ; P 1 send c (y P y ) ; Q x recv c ; R x A B, A B c.lab ; P case c of {lab k Q k } k I &{lab k : A k } k I, {lab k : A k } k I C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

24 Example: An Implementation of Queues type queue = &{ enq : A -o queue, deg : +{ none : 1, some : A * queue } } empty : queue q <- empty = case q of enq -> x <- recv q; e <- empty ; q <- elem x e deq -> q. none ; close q elem : A -o queue -o queue q <- elem x r = case q of enq -> y <- recv q; r. enq ; send r y; q <- elem x r deq -> q. some ; send q x; q <- r C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

25 Process Typing Typing judgement has the form Ψ η P :: (c : A) meaning process P offers along channel c the session A under the context Ψ. η tracks recursive variables. C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

26 Process Typing Typing judgement has the form Ψ η P :: (c : A) meaning process P offers along channel c the session A under the context Ψ. η tracks recursive variables. Some examples: c : A d c :: (d : A) id Ψ P c :: (c : A) Ψ, c : A Q c :: (d : D) Ψ, Ψ c P c ; Q c :: (d : D) cut close c :: (c : 1) 1R Ψ P :: (d : A) Ψ, c : 1 wait c ; P :: (d : A) 1L Ψ P :: (d : A) Ψ Q :: (c : B) Ψ, Ψ send c (d P d ) ; Q :: (c : A B) R C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

27 Subtyping Width and depth subtyping for n-ary choices Width: &{lab k : A k } k I &{lab k : A k } k J whenever J I Depth: &{lab k : A k } k I &{lab k : A k} k I whenever A i A i C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

28 Subtyping Width and depth subtyping for n-ary choices Width: &{lab k : A k } k I &{lab k : A k } k J whenever J I Depth: &{lab k : A k } k I &{lab k : A k} k I whenever A i A i Defined coinductively because of recursive types C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

29 Subtyping Width and depth subtyping for n-ary choices Width: &{lab k : A k } k I &{lab k : A k } k J whenever J I Depth: &{lab k : A k } k I &{lab k : A k} k I whenever A i A i Defined coinductively because of recursive types Introduced to process typing using subsumption: Ψ η P :: (c : A ) A A Ψ η P :: (c : A) SubR Ψ, c : A η P :: (d : B) A A Ψ, c : A η P :: (d : B) SubL C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

30 Configurations A processes by itself is not very useful in concurrent setting Need to be able to talk about interactions C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

31 Configurations A processes by itself is not very useful in concurrent setting Need to be able to talk about interactions Use a process configuration, which is simply a set of labelled processes: Ω = proc c1 (P 1 ),..., proc cn (P n ). C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

32 Configurations A processes by itself is not very useful in concurrent setting Need to be able to talk about interactions Use a process configuration, which is simply a set of labelled processes: Ω = proc c1 (P 1 ),..., proc cn (P n ). Typing judgement, = Ω :: Ψ, imposes a tree structure (ensures linearity) C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

33 Reduction Configurations reduce by interaction. Some examples: id : proc c (c d) {c = d} cut : proc c (x P x ; Q x ) { a.proc a (P a ) proc c (Q a )} one : proc c (close c) proc d (wait c ; P) {proc d (P)} C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

34 Plan 1 Background Message-passing Concurrency Session Types Subtyping Configurations and Reduction 2 Intersections and Unions Intersection Types Union Types Reinterpreting Choice 3 Algorithmic System 4 Metatheory C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

35 Intersections and Unions What if we want to track more properties of queues? C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

36 Intersections and Unions What if we want to track more properties of queues? Empty, non-empty, even length? C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

37 Intersections and Unions What if we want to track more properties of queues? Empty, non-empty, even length? These can be defined in the base system: type empty - queue = &{ enq : A -o queue, deg : +{ none : 1} } type nonempty - queue = &{ enq : A -o queue, deg : +{ some : A * queue } } C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

38 Intersections and Unions What if we want to track more properties of queues? Empty, non-empty, even length? These can be defined in the base system: type empty - queue = &{ enq : A -o queue, deg : +{ none : 1} } type nonempty - queue = &{ enq : A -o queue, deg : +{ some : A * queue } } However, there is no way to properly track them! C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

39 We cannot track multiple refinements. C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

40 We cannot track multiple refinements. Consider concat : queue -o queue -o queue that concatenates two queues. It has many types but no most general type: concat : empty - queue -o empty - queue -o empty - queue concat : queue -o nonempty - queue -o nonempty - queue concat : nonempty - queue -o queue -o nonempty - queue C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

41 Intersection Types Intersection of two types: A B c : A B if channel c offers both behaviors simultaneously C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

42 Intersection Types Intersection of two types: A B c : A B if channel c offers both behaviors simultaneously Ψ η P :: (c : A) Ψ η P :: (c : B) Ψ η P :: (c : A B) R Ψ, c : A η P :: (d : D) Ψ, c : A B η P :: (d : D) L 1 Ψ, c : B η P :: (d : D) Ψ, c : A B η P :: (d : D) L 2 C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

43 Intersections Solve the Previous Problem We can now specify multiple behavioral properties: concat : empty - queue -o empty - queue -o empty - queue and queue -o nonempty - queue -o nonempty - queue and nonempty - queue -o queue -o nonempty - queue C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

44 Union Types Union of two types: A B c : A B if channel c offers either behavior C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

45 Union Types Union of two types: A B c : A B if channel c offers either behavior Dual to intersections C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

46 Union Types Union of two types: A B c : A B if channel c offers either behavior Dual to intersections Ψ η P :: (c : A) Ψ η P :: (c : A B) R 1 Ψ η P :: (c : B) Ψ η P :: (c : A B) R 2 Ψ, c : A η P :: (d : D) Ψ, c : B η P :: (d : D) Ψ, c : A B η P :: (d : D) L C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

47 Reasons for Adding Unions Maintain the symmetry of the system Makes working with internal choice more convenient Interpretation of internal choice (we will explain later) C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

48 Reasons for Adding Unions Maintain the symmetry of the system Makes working with internal choice more convenient Interpretation of internal choice (we will explain later) We can also write things like: type queue = empty - queue or nonempty - queue C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

49 Reinterpreting Choice Consider &{inl : A, inr : B} C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

50 Reinterpreting Choice Consider &{inl : A, inr : B} This type says: I will act as A if you send me inl and I will act as B if you send me inr. C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

51 Reinterpreting Choice Consider &{inl : A, inr : B} This type says: I will act as A if you send me inl and I will act as B if you send me inr. Interpreting and as gives &{inl : A, inr : B} &{inl : A} &{inr : B}. C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

52 Reinterpreting Choice - General Case Generalizing to n-ary choice and dualising gives: &{lab k : A k } k I k I &{lab k : A k } {lab k : A k } k I k I {lab k : A k } Easy to verify these definitions satisfy the typing rules. C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

53 Reinterpreting Choice - General Case Generalizing to n-ary choice and dualising gives: &{lab k : A k } k I k I &{lab k : A k } {lab k : A k } k I k I {lab k : A k } Easy to verify these definitions satisfy the typing rules. Suggests treating intersections and unions as implicit choice. C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

54 Plan 1 Background Message-passing Concurrency Session Types Subtyping Configurations and Reduction 2 Intersections and Unions Intersection Types Union Types Reinterpreting Choice 3 Algorithmic System 4 Metatheory C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

55 Algorithmic Subtyping Idea: make L {1,2} and R {1,2} invertible so we can apply eagerly. A {1,2} B A 1 A 2 B L {1,2} A B {1,2} A B 1 B 2 R {1,2} α, A 1, A 2 β α, A 1 A 2 β L α β, A 1, A 2 α β, A 1 A 2 R C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

56 Algorithmic Subtyping Idea: make L {1,2} and R {1,2} invertible so we can apply eagerly. A {1,2} B A 1 A 2 B L {1,2} A B {1,2} A B 1 B 2 R {1,2} α, A 1, A 2 β α, A 1 A 2 β L α β, A 1, A 2 α β, A 1 A 2 R Also admits distributivity: (A 1 B) (A 2 B) (A 1 A 2 ) B (A 1 A 2 ) B (A 1 B) (A 2 B) Turns out to be necessary for soundness of algorithmic typing. C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

57 Algorithmic Type Checking Make L {1,2} and R {1,2} invertible so we can apply eagerly. C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

58 Algorithmic Type Checking Make L {1,2} and R {1,2} invertible so we can apply eagerly. Delay subtyping to id Label cut with it s type C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

59 Algorithmic Type Checking Make L {1,2} and R {1,2} invertible so we can apply eagerly. Delay subtyping to id Label cut with it s type Ψ, c : A 1,2 η P :: (d : D) Ψ, c : A 1 A 2 η P :: (d : D) L1,2 Ψ, c : (α, A, B) η P :: (d : β) Ψ, c : (α, A B) η P :: (d : β) L Ψ η P :: (c : A 1,2 ) Ψ η P :: (c : A 1 A 2 ) R 1,2 Ψ η P :: (c : A, B, α) Ψ η P :: (c : A B, α) R C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

60 Algorithmic Type Checking Make L {1,2} and R {1,2} invertible so we can apply eagerly. Delay subtyping to id Label cut with it s type Ψ, c : A 1,2 η P :: (d : D) Ψ, c : A 1 A 2 η P :: (d : D) L1,2 Ψ, c : (α, A, B) η P :: (d : β) Ψ, c : (α, A B) η P :: (d : β) L Ψ η P :: (c : A 1,2 ) Ψ η P :: (c : A 1 A 2 ) R 1,2 Ψ η P :: (c : A, B, α) Ψ η P :: (c : A B, α) R α β c : α η d c :: (d : β) id Ψ η P c :: (c : A) Ψ, c : A η Q c :: (d : α) Ψ, Ψ η c : A P c ; Q c :: (d : α) cut C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

61 Results Theorem (Completeness of Algorithmic Subtyping) Algorithmic subtyping is complete with respect to declarative subtyping. Theorem (Equivalence of Algorithmic Typing) Algorithmic typing is sound and complete with respect to declarative typing. C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

62 Plan 1 Background Message-passing Concurrency Session Types Subtyping Configurations and Reduction 2 Intersections and Unions Intersection Types Union Types Reinterpreting Choice 3 Algorithmic System 4 Metatheory C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

63 Type Safety We have proved progress and preservation for the system extended with intersections and unions. C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

64 Type Safety We have proved progress and preservation for the system extended with intersections and unions. Progress deadlock-freedom Type preservation session fidelity C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

65 Progress Theorem (Progress) If = Ω :: Ψ then either 1 Ω Ω for some Ω, or 2 Ω is poised. Proof. By induction on = Ω :: Ψ followed by a nested induction on the typing of the root process. When two processes are involved, we also need inversion on client s typing. A process is poised if it is waiting to communicate with its client. C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

66 Type Preservation Theorem (Preservation) If = Ω :: Ψ and Ω Ω then = Ω :: Ψ. Proof. By inversion on Ω Ω, followed by induction on the typing judgments of the involved processes. Each branch requires a hand-rolled induction hypothesis. C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

67 Conclusion and Highlights We introduced intersection and union types to a session-typed process calculus and demonstrated their usefulness. Unions work naturally. The elimination rule we give has been shown unsound in the presence of effects (even non-termination). C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

68 Conclusion and Highlights We introduced intersection and union types to a session-typed process calculus and demonstrated their usefulness. Unions work naturally. The elimination rule we give has been shown unsound in the presence of effects (even non-termination). More general than refinement system of Freeman and Pfenning C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

69 Conclusion and Highlights We introduced intersection and union types to a session-typed process calculus and demonstrated their usefulness. Unions work naturally. The elimination rule we give has been shown unsound in the presence of effects (even non-termination). More general than refinement system of Freeman and Pfenning Subtyping resembles Gentzen s multiple conclusion calculus C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

70 Conclusion and Highlights We introduced intersection and union types to a session-typed process calculus and demonstrated their usefulness. Unions work naturally. The elimination rule we give has been shown unsound in the presence of effects (even non-termination). More general than refinement system of Freeman and Pfenning Subtyping resembles Gentzen s multiple conclusion calculus Algorithmic typing mirrors subtyping C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

71 Future Work Simple: integrate a functional language, extend to shared channels and asynchronous communication C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

72 Future Work Simple: integrate a functional language, extend to shared channels and asynchronous communication More interesting: Add polymorphism and abstract types Polymorphism is non-trivial with equirecursive types C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

73 Future Work Simple: integrate a functional language, extend to shared channels and asynchronous communication More interesting: Add polymorphism and abstract types Polymorphism is non-trivial with equirecursive types Applications other than refinements? C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

74 The End C. Acay & F. Pfenning (CMU) Intersections and Unions of Session Types ITRS / 35

Intersections and Unions of Session Types

Intersections and Unions of Session Types Intersections and Unions of Session Types Coşku Acay Carnegie Mellon University Pennsylvania, USA cacay@cmu.edu Frank Pfenning Carnegie Mellon University Pennsylvania, USA fp@cs.cmu.edu Prior work has

More information

A Rehabilitation of Message-Passing Concurrency

A Rehabilitation of Message-Passing Concurrency A Rehabilitation of Message-Passing Concurrency Frank Pfenning Carnegie Mellon University PWLConf 2018, St. Louis A Paper I Love Types for Dyadic Interaction, Kohei Honda, CONCUR 1993 With some newer developments

More information

Verifying Program Invariants with Refinement Types

Verifying Program Invariants with Refinement Types Verifying Program Invariants with Refinement Types Rowan Davies and Frank Pfenning Carnegie Mellon University Princeton and Yale Colloquium Talks February, 2001 Acknowledgments: Robert Harper 1 Overview

More information

Type assignment for intersections and unions in call-by-value languages

Type assignment for intersections and unions in call-by-value languages Type assignment for intersections and unions in call-by-value languages Joshua Dunfield and Frank Pfenning Triple Project Carnegie Mellon University 8 April 2003 FOSSACS 03, Warsaw, Poland Type assignment

More information

Modal Logic: Implications for Design of a Language for Distributed Computation p.1/53

Modal Logic: Implications for Design of a Language for Distributed Computation p.1/53 Modal Logic: Implications for Design of a Language for Distributed Computation Jonathan Moody (with Frank Pfenning) Department of Computer Science Carnegie Mellon University Modal Logic: Implications for

More information

CSE-321 Programming Languages 2014 Final

CSE-321 Programming Languages 2014 Final Name: Hemos ID: CSE-321 Programming Languages 2014 Final Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Problem 6 Total Score Max 15 12 14 14 30 15 100 There are six problems on 12 pages in this exam.

More information

CSE-321 Programming Languages 2010 Final

CSE-321 Programming Languages 2010 Final Name: Hemos ID: CSE-321 Programming Languages 2010 Final Prob 1 Prob 2 Prob 3 Prob 4 Prob 5 Prob 6 Total Score Max 18 28 16 12 36 40 150 There are six problems on 16 pages, including two work sheets, in

More information

Refinement Types as Proof Irrelevance. William Lovas with Frank Pfenning

Refinement Types as Proof Irrelevance. William Lovas with Frank Pfenning Refinement Types as Proof Irrelevance William Lovas with Frank Pfenning Overview Refinement types sharpen existing type systems without complicating their metatheory Subset interpretation soundly and completely

More information

Subtyping. Lecture 13 CS 565 3/27/06

Subtyping. Lecture 13 CS 565 3/27/06 Subtyping Lecture 13 CS 565 3/27/06 Polymorphism Different varieties of polymorphism: Parametric (ML) type variables are abstract, and used to encode the fact that the same term can be used in many different

More information

Programming Languages

Programming Languages CSE 230: Winter 2008 Principles of Programming Languages Ocaml/HW #3 Q-A Session Push deadline = Mar 10 Session Mon 3pm? Lecture 15: Type Systems Ranjit Jhala UC San Diego Why Typed Languages? Development

More information

Work Analysis with Resource-Aware Session Types

Work Analysis with Resource-Aware Session Types Work Analysis with Resource-Aware Session Types Ankush Das Jan Hoffmann Frank Pfenning LICS, July 10, 2018 1 Goal for this Talk Resource Analysis for Concurrent Programs Execution Time Memory Usage 2 Why

More information

CMSC 336: Type Systems for Programming Languages Lecture 5: Simply Typed Lambda Calculus Acar & Ahmed January 24, 2008

CMSC 336: Type Systems for Programming Languages Lecture 5: Simply Typed Lambda Calculus Acar & Ahmed January 24, 2008 CMSC 336: Type Systems for Programming Languages Lecture 5: Simply Typed Lambda Calculus Acar & Ahmed January 24, 2008 Contents 1 Solution to the Exercise 1 1.1 Semantics for lambda calculus.......................

More information

Part III. Chapter 15: Subtyping

Part III. Chapter 15: Subtyping Part III Chapter 15: Subtyping Subsumption Subtype relation Properties of subtyping and typing Subtyping and other features Intersection and union types Subtyping Motivation With the usual typing rule

More information

Objects as Session-Typed Processes

Objects as Session-Typed Processes Objects as Session-Typed Processes Stephanie Balzer and Frank Pfenning Computer Science Department, Carnegie Mellon University AGERE! 2015 The essence of object-orientation 2 The essence of object-orientation

More information

Goal. CS152: Programming Languages. Lecture 15 Parametric Polymorphism. What the Library Likes. What The Client Likes. Start simpler.

Goal. CS152: Programming Languages. Lecture 15 Parametric Polymorphism. What the Library Likes. What The Client Likes. Start simpler. Goal Understand what this interface means and why it matters: CS152: Programming Languages Lecture 15 Parametric Polymorphism Dan Grossman Spring 2011 type a mylist; val mt_list : a mylist val cons : a

More information

Lecture Notes on Aggregate Data Structures

Lecture Notes on Aggregate Data Structures Lecture Notes on Aggregate Data Structures 15-312: Foundations of Programming Languages Frank Pfenning Lecture 8 September 23, 2004 In this lecture we discuss various language extensions which make MinML

More information

Tradeoffs. CSE 505: Programming Languages. Lecture 15 Subtyping. Where shall we add useful completeness? Where shall we add completeness?

Tradeoffs. CSE 505: Programming Languages. Lecture 15 Subtyping. Where shall we add useful completeness? Where shall we add completeness? Tradeoffs CSE 505: Programming Languages Lecture 15 Subtyping Zach Tatlock Autumn 2017 Desirable type system properties (desiderata): soundness - exclude all programs that get stuck completeness - include

More information

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011 CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics Dan Grossman Spring 2011 Review e ::= λx. e x e e c v ::= λx. e c τ ::= int τ τ Γ ::= Γ, x : τ (λx. e) v e[v/x] e 1 e 1 e 1 e

More information

Session-Typed Concurrent Contracts HANNAH GOMMERSTADT

Session-Typed Concurrent Contracts HANNAH GOMMERSTADT Session-Typed Concurrent Contracts HANNAH GOMMERSTADT LIMIN JIA & FRANK PFENNING 1 Sorting Process 2 Sorting Process 3 3 Sorting Process 3 5 4 Sorting Process 3 5 4 5 Sorting Process 3 5 4 6 Session Types?!

More information

Function compose, Type cut, And the Algebra of logic

Function compose, Type cut, And the Algebra of logic Function compose, Type cut, And the Algebra of logic XIE Yuheng SZDIY community xyheme@gmail.com Abstract In this paper, I demonstrate the Curry-Howard correspondence of Gentzen s sequent calculus, and

More information

From Linear Logic to Session- Typed Concurrent Programming

From Linear Logic to Session- Typed Concurrent Programming From Linear Logic to Session- Typed Concurrent Programming Frank Pfenning Joint work with Luís Caires, Bernardo Toninho, Dennis Griffith January 13, 2015 POPL 2015 Tutorial, Mumbai 1 Outline The Curry-

More information

CSE-321 Programming Languages 2011 Final

CSE-321 Programming Languages 2011 Final Name: Hemos ID: CSE-321 Programming Languages 2011 Final Prob 1 Prob 2 Prob 3 Prob 4 Prob 5 Prob 6 Total Score Max 15 15 10 17 18 25 100 There are six problems on 18 pages in this exam, including one extracredit

More information

Uncurrying for Termination

Uncurrying for Termination Uncurrying for Termination Nao Hirokawa and Aart Middeldorp Institute of Computer Science University of Innsbruck 6020 Innsbruck, Austria {nao.hirokawa,aart.middeldorp}@uibk.ac.at Abstract. In this note

More information

Parallel Complexity Analysis with Temporal Session Types

Parallel Complexity Analysis with Temporal Session Types Parallel Complexity Analysis with Temporal Session Types ANKUSH DAS, Carnegie Mellon University, USA JAN HOFFMANN, Carnegie Mellon University, USA FANK PFENNING, Carnegie Mellon University, USA We study

More information

Review. CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Let bindings (CBV) Adding Stuff. Booleans and Conditionals

Review. CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Let bindings (CBV) Adding Stuff. Booleans and Conditionals Review CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics e ::= λx. e x ee c v ::= λx. e c (λx. e) v e[v/x] e 1 e 2 e 1 e 2 τ ::= int τ τ Γ ::= Γ,x : τ e 2 e 2 ve 2 ve 2 e[e /x]:

More information

Negations in Refinement Type Systems

Negations in Refinement Type Systems Negations in Refinement Type Systems T. Tsukada (U. Tokyo) 14th March 2016 Shonan, JAPAN This Talk About refinement intersection type systems that refute judgements of other type systems. Background Refinement

More information

Parallel Complexity Analysis with Temporal Session Types

Parallel Complexity Analysis with Temporal Session Types 1 Parallel Complexity Analysis with Temporal Session Types ANKUSH DAS, Carnegie Mellon University, USA JAN HOFFMANN, Carnegie Mellon University, USA FANK PFENNING, Carnegie Mellon University, USA We study

More information

Part III Chapter 15: Subtyping

Part III Chapter 15: Subtyping Part III Chapter 15: Subtyping Subsumption Subtype relation Properties of subtyping and typing Subtyping and other features Intersection and union types Subtyping Motivation With the usual typing rule

More information

Topic: Orientation, Surfaces, and Euler characteristic

Topic: Orientation, Surfaces, and Euler characteristic Topic: Orientation, Surfaces, and Euler characteristic The material in these notes is motivated by Chapter 2 of Cromwell. A source I used for smooth manifolds is do Carmo s Riemannian Geometry. Ideas of

More information

Symmetry in Type Theory

Symmetry in Type Theory Google May 29th, 2012 What is Symmetry? Definition Symmetry: Two or more things that initially look distinct, may actually be instances of a more general underlying principle. Why do we care? Simplicity.

More information

Programming with Dependent Types Interactive programs and Coalgebras

Programming with Dependent Types Interactive programs and Coalgebras Programming with Dependent Types Interactive programs and Coalgebras Anton Setzer Swansea University, Swansea, UK 14 August 2012 1/ 50 A Brief Introduction into ML Type Theory Interactive Programs in Dependent

More information

Binary Decision Diagrams

Binary Decision Diagrams Logic and roof Hilary 2016 James Worrell Binary Decision Diagrams A propositional formula is determined up to logical equivalence by its truth table. If the formula has n variables then its truth table

More information

CS-XXX: Graduate Programming Languages. Lecture 17 Recursive Types. Dan Grossman 2012

CS-XXX: Graduate Programming Languages. Lecture 17 Recursive Types. Dan Grossman 2012 CS-XXX: Graduate Programming Languages Lecture 17 Recursive Types Dan Grossman 2012 Where are we System F gave us type abstraction code reuse strong abstractions different from real languages (like ML),

More information

Harvard School of Engineering and Applied Sciences Computer Science 152

Harvard School of Engineering and Applied Sciences Computer Science 152 Harvard School of Engineering and Applied Sciences Computer Science 152 Lecture 17 Tuesday, March 30, 2010 1 Polymorph means many forms. Polymorphism is the ability of code to be used on values of different

More information

CSE-321 Programming Languages 2012 Midterm

CSE-321 Programming Languages 2012 Midterm Name: Hemos ID: CSE-321 Programming Languages 2012 Midterm Prob 1 Prob 2 Prob 3 Prob 4 Prob 5 Prob 6 Total Score Max 14 15 29 20 7 15 100 There are six problems on 24 pages in this exam. The maximum score

More information

Subsumption. Principle of safe substitution

Subsumption. Principle of safe substitution Recap on Subtyping Subsumption Some types are better than others, in the sense that a value of one can always safely be used where a value of the other is expected. Which can be formalized as by introducing:

More information

Assistant for Language Theory. SASyLF: An Educational Proof. Corporation. Microsoft. Key Shin. Workshop on Mechanizing Metatheory

Assistant for Language Theory. SASyLF: An Educational Proof. Corporation. Microsoft. Key Shin. Workshop on Mechanizing Metatheory SASyLF: An Educational Proof Assistant for Language Theory Jonathan Aldrich Robert J. Simmons Key Shin School of Computer Science Carnegie Mellon University Microsoft Corporation Workshop on Mechanizing

More information

TOPOLOGY, DR. BLOCK, FALL 2015, NOTES, PART 3.

TOPOLOGY, DR. BLOCK, FALL 2015, NOTES, PART 3. TOPOLOGY, DR. BLOCK, FALL 2015, NOTES, PART 3. 301. Definition. Let m be a positive integer, and let X be a set. An m-tuple of elements of X is a function x : {1,..., m} X. We sometimes use x i instead

More information

CSE-505: Programming Languages. Lecture 20.5 Recursive Types. Zach Tatlock 2016

CSE-505: Programming Languages. Lecture 20.5 Recursive Types. Zach Tatlock 2016 CSE-505: Programming Languages Lecture 20.5 Recursive Types Zach Tatlock 2016 Where are we System F gave us type abstraction code reuse strong abstractions different from real languages (like ML), but

More information

Subtyping. Preciseness of Subtyping on Intersection and Union Types. Subtyping. Silvia Ghilezan. Joint work with Mariangiola Dezani-Ciancaglini

Subtyping. Preciseness of Subtyping on Intersection and Union Types. Subtyping. Silvia Ghilezan. Joint work with Mariangiola Dezani-Ciancaglini Subtyping Preciseness of Subtyping on Intersection and Union Types Silvia Ghilezan University of Novi Sad Serbia Université Paris Diderot, 21 April 2016 Joint work with Mariangiola Dezani-Ciancaglini M.

More information

4.5 Pure Linear Functional Programming

4.5 Pure Linear Functional Programming 4.5 Pure Linear Functional Programming 99 4.5 Pure Linear Functional Programming The linear λ-calculus developed in the preceding sections can serve as the basis for a programming language. The step from

More information

Lecture Notes on Data Representation

Lecture Notes on Data Representation Lecture Notes on Data Representation 15-814: Types and Programming Languages Frank Pfenning Lecture 9 Tuesday, October 2, 2018 1 Introduction In this lecture we ll see our type system in action. In particular

More information

Coherent Coercion Abstraction with a step-indexed strong-reduction semantics

Coherent Coercion Abstraction with a step-indexed strong-reduction semantics preprint version Coherent Coercion Abstraction with a step-indexed strong-reduction semantics Julien Cretin Didier Rémy INRIA {julien.cretin,didier.remy}@inria.fr Abstract The usual notion of type coercions

More information

Constrained Types and their Expressiveness

Constrained Types and their Expressiveness Constrained Types and their Expressiveness JENS PALSBERG Massachusetts Institute of Technology and SCOTT SMITH Johns Hopkins University A constrained type consists of both a standard type and a constraint

More information

Lecture Notes on Program Equivalence

Lecture Notes on Program Equivalence Lecture Notes on Program Equivalence 15-312: Foundations of Programming Languages Frank Pfenning Lecture 24 November 30, 2004 When are two programs equal? Without much reflection one might say that two

More information

Recursive Types and Subtyping

Recursive Types and Subtyping Recursive Types and Subtyping #1 One-Slide Summary Recursive types (e.g., list) make the typed lambda calculus as powerful as the untyped lambda calculus. If is a subtype of then any expression of type

More information

Subtyping (cont) Lecture 15 CS 565 4/3/08

Subtyping (cont) Lecture 15 CS 565 4/3/08 Subtyping (cont) Lecture 15 CS 565 4/3/08 Formalization of Subtyping Inversion of the subtype relation: If σ

More information

Lecture 13: Subtyping

Lecture 13: Subtyping Lecture 13: Subtyping Polyvios Pratikakis Computer Science Department, University of Crete Type Systems and Programming Languages Pratikakis (CSD) Subtyping CS546, 2018-2019 1 / 15 Subtyping Usually found

More information

Design and Implementation of Concurrent C0

Design and Implementation of Concurrent C0 Design and Implementation of Concurrent C0 Max Willsey Carnegie Mellon University mwillsey@cmu.edu Rokhini rabhu Carnegie Mellon University rokhini@gmail.com Frank fenning Carnegie Mellon University fp@cmu.edu

More information

Typed Lambda Calculus

Typed Lambda Calculus Department of Linguistics Ohio State University Sept. 8, 2016 The Two Sides of A typed lambda calculus (TLC) can be viewed in two complementary ways: model-theoretically, as a system of notation for functions

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 14 Tuesday, March 24, 2015 1 Parametric polymorphism Polymorph means many forms. Polymorphism is the ability of

More information

Featherweight Java (FJ)

Featherweight Java (FJ) x = 1 let x = 1 in... x(1).!x(1) x.set(1) Programming Language Theory Featherweight Java (FJ) Ralf Lämmel This lecture is based on David Walker s lecture: Computer Science 441, Programming Languages, Princeton

More information

Type Soundness and Race Freedom for Mezzo

Type Soundness and Race Freedom for Mezzo Type Soundness and Race Freedom for Mezzo Thibaut Balabonski François Pottier Jonathan Protzenko INRIA FLOPS 2014 1 / 42 Mezzo in a few words Mezzo is a high-level programming language, equipped with:

More information

LOGIC AND DISCRETE MATHEMATICS

LOGIC AND DISCRETE MATHEMATICS LOGIC AND DISCRETE MATHEMATICS A Computer Science Perspective WINFRIED KARL GRASSMANN Department of Computer Science University of Saskatchewan JEAN-PAUL TREMBLAY Department of Computer Science University

More information

Open Modules: Modular Reasoning about Advice

Open Modules: Modular Reasoning about Advice Open Modules: Modular Reasoning about Advice Jonathan Aldrich December 2004 CMU-ISRI-04-141 Institute for Software Research International School of Computer Science Carnegie Mellon University 5000 Forbes

More information

4.6 Recursive Types. 4.6 Recursive Types 105

4.6 Recursive Types. 4.6 Recursive Types 105 4.6 Recursive Types 105 4.6 Recursive Types The language so far lacks basic data types, such as natural numbers, integers, lists, trees, etc. Moreover, except for finitary ones such as booleans, they are

More information

Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description)

Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description) Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description) Brigitte Pientka and Joshua Dunfield McGill University, Montréal, Canada {bpientka,joshua}@cs.mcgill.ca Abstract.

More information

From IMP to Java. Andreas Lochbihler. parts based on work by Gerwin Klein and Tobias Nipkow ETH Zurich

From IMP to Java. Andreas Lochbihler. parts based on work by Gerwin Klein and Tobias Nipkow ETH Zurich From IMP to Java Andreas Lochbihler ETH Zurich parts based on work by Gerwin Klein and Tobias Nipkow 2015-07-14 1 Subtyping 2 Objects and Inheritance 3 Multithreading 1 Subtyping 2 Objects and Inheritance

More information

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 CME 305: Discrete Mathematics and Algorithms Instructor: Professor Aaron Sidford (sidford@stanford.edu) January 11, 2018 Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1 In this lecture

More information

1.7 The Heine-Borel Covering Theorem; open sets, compact sets

1.7 The Heine-Borel Covering Theorem; open sets, compact sets 1.7 The Heine-Borel Covering Theorem; open sets, compact sets This section gives another application of the interval halving method, this time to a particularly famous theorem of analysis, the Heine Borel

More information

SCHOOL: a Small Chorded Object-Oriented Language

SCHOOL: a Small Chorded Object-Oriented Language SCHOOL: a Small Chorded Object-Oriented Language S. Drossopoulou, A. Petrounias, A. Buckley, S. Eisenbach { s.drossopoulou, a.petrounias, a.buckley, s.eisenbach } @ imperial.ac.uk Department of Computing,

More information

Contractive Signatures with Recursive Types, Type Parameters, and Abstract Types

Contractive Signatures with Recursive Types, Type Parameters, and Abstract Types Contractive Signatures with Recursive Types, Type Parameters, and Abstract Types Hyeonseung Im 1, Keiko Nakata 2, and Sungwoo Park 3 1 LRI - Université Paris-Sud 11, Orsay, France 2 Institute of Cybernetics

More information

Verification and Parallelism in Intro CS. Dan Licata Wesleyan University

Verification and Parallelism in Intro CS. Dan Licata Wesleyan University Verification and Parallelism in Intro CS Dan Licata Wesleyan University Starting in 2011, Carnegie Mellon revised its intro CS curriculum Computational thinking [Wing] Specification and verification Parallelism

More information

Gradual Parametricity, Revisited

Gradual Parametricity, Revisited aaachicbvddssmwge39nfov6qu30sf4y2lfuerk6i3etbbys0jtdmtle1lkgqj7nrh8am81sfwtrwvh8d3mo12ozshkpyc7zvkywlsrqwy7s9jbn5hcwm5sljdvvf2ds3tlsyyqqmtzywrlgbkorrtpqkkkbcvbaub4y0g8f1uw8/ecfpwu/vmcv+jhqcrhqjpawuuedfiucmqdecljy61nvfofruusouxdk1a7zll4czxjmqgpig0tw/vtdbwuy4wgxj2hsvpk5eopirkzvl5mkriaeqsjkucxk5efmued7qsqj2tnqguv3tyfes5taodgemvf9o1wrxv1onu9gzn1oezopwph4oyhhucsxygsevbcs21arhqfwseperqfjp9kpeacxdelfoi+tksofitkcws1rhlmnbzt1jr41sagcdse+oaqooav1camaoakweatp4aw8gk/gm/fufixb54yjzwf8gfh5a4h9n/m=

More information

Typed Lambda Calculus for Syntacticians

Typed Lambda Calculus for Syntacticians Department of Linguistics Ohio State University January 12, 2012 The Two Sides of Typed Lambda Calculus A typed lambda calculus (TLC) can be viewed in two complementary ways: model-theoretically, as a

More information

CMPSCI 250: Introduction to Computation. Lecture #22: Graphs, Paths, and Trees David Mix Barrington 12 March 2014

CMPSCI 250: Introduction to Computation. Lecture #22: Graphs, Paths, and Trees David Mix Barrington 12 March 2014 CMPSCI 250: Introduction to Computation Lecture #22: Graphs, Paths, and Trees David Mix Barrington 12 March 2014 Graphs, Paths, and Trees Graph Definitions Paths and the Path Predicate Cycles, Directed

More information

On the Logical Foundations of Staged Computation

On the Logical Foundations of Staged Computation On the Logical Foundations of Staged Computation Frank Pfenning PEPM 00, Boston, MA January 22, 2000 1. Introduction 2. Judgments and Propositions 3. Intensional Types 4. Run-Time Code Generation 5. The

More information

Type Assignment for Intersections and Unions in Call-by-Value Languages

Type Assignment for Intersections and Unions in Call-by-Value Languages Type Assignment for Intersections and Unions in Call-by-Value Languages Joshua Dunfield and Frank Pfenning Department of Computer Science Carnegie Mellon University Pittsburgh, PA 15213 {joshuad,fp}@cs.cmu.edu

More information

Lecture 3: Recursion; Structural Induction

Lecture 3: Recursion; Structural Induction 15-150 Lecture 3: Recursion; Structural Induction Lecture by Dan Licata January 24, 2012 Today, we are going to talk about one of the most important ideas in functional programming, structural recursion

More information

Recursive Types and Subtyping

Recursive Types and Subtyping Recursive Types and Subtyping #1 One-Slide Summary Recall: Recursive types (e.g., τ list) make the typed lambda calculus as powerful as the untyped lambda calculus. If τ is a subtype of σ then any expression

More information

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS

This is already grossly inconvenient in present formalisms. Why do we want to make this convenient? GENERAL GOALS 1 THE FORMALIZATION OF MATHEMATICS by Harvey M. Friedman Ohio State University Department of Mathematics friedman@math.ohio-state.edu www.math.ohio-state.edu/~friedman/ May 21, 1997 Can mathematics be

More information

Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5

Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5 Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5 [talking head] This lecture we study theory design and implementation. Programmers have two roles to play here. In one role, they

More information

Reasoning About Programs Panagiotis Manolios

Reasoning About Programs Panagiotis Manolios Reasoning About Programs Panagiotis Manolios Northeastern University February 26, 2017 Version: 100 Copyright c 2017 by Panagiotis Manolios All rights reserved. We hereby grant permission for this publication

More information

Meta-programming with Names and Necessity p.1

Meta-programming with Names and Necessity p.1 Meta-programming with Names and Necessity Aleksandar Nanevski Carnegie Mellon University ICFP, Pittsburgh, 05 October 2002 Meta-programming with Names and Necessity p.1 Meta-programming Manipulation of

More information

Lecture Notes on Session Types

Lecture Notes on Session Types Lecture Notes on Session Types 15-814: Types and Programming Languages Frank Pfenning Lecture 22 November 27, 2018 1 Introduction Some of the material in this lecture, specifically, the discussion of external

More information

4&5 Binary Operations and Relations. The Integers. (part I)

4&5 Binary Operations and Relations. The Integers. (part I) c Oksana Shatalov, Spring 2016 1 4&5 Binary Operations and Relations. The Integers. (part I) 4.1: Binary Operations DEFINITION 1. A binary operation on a nonempty set A is a function from A A to A. Addition,

More information

Consistent Subtyping for All

Consistent Subtyping for All Consistent Subtyping for All Ningning Xie Xuan Bi Bruno C. d. S. Oliveira 11 May, 2018 The University of Hong Kong 1 Background There has been ongoing debate about which language paradigm, static typing

More information

Mathematics for Computer Scientists 2 (G52MC2)

Mathematics for Computer Scientists 2 (G52MC2) Mathematics for Computer Scientists 2 (G52MC2) L07 : Operations on sets School of Computer Science University of Nottingham October 29, 2009 Enumerations We construct finite sets by enumerating a list

More information

CLF: A logical framework for concurrent systems

CLF: A logical framework for concurrent systems CLF: A logical framework for concurrent systems Thesis Proposal Kevin Watkins Carnegie Mellon University Committee: Frank Pfenning, CMU (Chair) Stephen Brookes, CMU Robert Harper, CMU Gordon Plotkin, University

More information

Integer Programming as Projection

Integer Programming as Projection Integer Programming as Projection H. P. Williams London School of Economics John Hooker Carnegie Mellon University INFORMS 2015, Philadelphia USA A Different Perspective on IP Projection of an IP onto

More information

3 No-Wait Job Shops with Variable Processing Times

3 No-Wait Job Shops with Variable Processing Times 3 No-Wait Job Shops with Variable Processing Times In this chapter we assume that, on top of the classical no-wait job shop setting, we are given a set of processing times for each operation. We may select

More information

Hiding local state in direct style: a higher-order anti-frame rule

Hiding local state in direct style: a higher-order anti-frame rule 1 / 65 Hiding local state in direct style: a higher-order anti-frame rule François Pottier January 28th, 2008 2 / 65 Contents Introduction Basics of the type system A higher-order anti-frame rule Applications

More information

Mechanising a type-safe model of multithreaded Java with a verified compiler

Mechanising a type-safe model of multithreaded Java with a verified compiler Mechanising a type-safe model of multithreaded Java with a verified compiler Andreas Lochbihler Digital Asset (Switzerland) GmbH Andreas Lochbihler 2 = Isabelle λ β HOL α Andreas Lochbihler 3 Timeline

More information

Type checking in the presence of meta-variables

Type checking in the presence of meta-variables Type checking in the presence of meta-variables Ulf Norell and Catarina Coquand Department of Computer Science and Engineering Chalmers University of Technology {ulfn,catarina}@cs.chalmers.se Abstract.

More information

Lecture Notes on Static and Dynamic Semantics

Lecture Notes on Static and Dynamic Semantics Lecture Notes on Static and Dynamic Semantics 15-312: Foundations of Programming Languages Frank Pfenning Lecture 4 September 9, 2004 In this lecture we illustrate the basic concepts underlying the static

More information

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph.

Trees. 3. (Minimally Connected) G is connected and deleting any of its edges gives rise to a disconnected graph. Trees 1 Introduction Trees are very special kind of (undirected) graphs. Formally speaking, a tree is a connected graph that is acyclic. 1 This definition has some drawbacks: given a graph it is not trivial

More information

Lecture Note: Types. 1 Introduction 2. 2 Simple Types 3. 3 Type Soundness 6. 4 Recursive Types Subtyping 17

Lecture Note: Types. 1 Introduction 2. 2 Simple Types 3. 3 Type Soundness 6. 4 Recursive Types Subtyping 17 Jens Palsberg Sep 24, 1999 Contents Lecture Note: Types 1 Introduction 2 2 Simple Types 3 3 Type Soundness 6 4 Recursive Types 12 5 Subtyping 17 6 Decision Procedure for Subtyping 19 7 First-Order Unification

More information

Chapter 6. Curves and Surfaces. 6.1 Graphs as Surfaces

Chapter 6. Curves and Surfaces. 6.1 Graphs as Surfaces Chapter 6 Curves and Surfaces In Chapter 2 a plane is defined as the zero set of a linear function in R 3. It is expected a surface is the zero set of a differentiable function in R n. To motivate, graphs

More information

Chapter 21: Metatheory of Recursive Types. Induction and Coinduction Finite and Infinite Types/Subtyping Membership Checking

Chapter 21: Metatheory of Recursive Types. Induction and Coinduction Finite and Infinite Types/Subtyping Membership Checking Chapter 21: Metatheory of Recursive Types Induction and Coinduction Finite and Infinite Types/Subtyping Membership Checking Review of Chapter 20 Recursive Types Lists NatList =

More information

CMPSCI 250: Introduction to Computation. Lecture #14: Induction and Recursion (Still More Induction) David Mix Barrington 14 March 2013

CMPSCI 250: Introduction to Computation. Lecture #14: Induction and Recursion (Still More Induction) David Mix Barrington 14 March 2013 CMPSCI 250: Introduction to Computation Lecture #14: Induction and Recursion (Still More Induction) David Mix Barrington 14 March 2013 Induction and Recursion Three Rules for Recursive Algorithms Proving

More information

Actors and Channels in Core λ-calculi. Simon Fowler Joint work with Sam Lindley and Philip Wadler

Actors and Channels in Core λ-calculi. Simon Fowler Joint work with Sam Lindley and Philip Wadler Actors and Channels in Core λ-calculi Simon Fowler Joint work with Sam Lindley and Philip Wadler ABCD Meeting, January 2016 Actors and Channels Hopac Actors and Channels Process Actor Process Process Hopac

More information

Programming Languages Lecture 14: Sum, Product, Recursive Types

Programming Languages Lecture 14: Sum, Product, Recursive Types CSE 230: Winter 200 Principles of Programming Languages Lecture 4: Sum, Product, Recursive Types The end is nigh HW 3 No HW 4 (= Final) Project (Meeting + Talk) Ranjit Jhala UC San Diego Recap Goal: Relate

More information

Lecture Notes on Monadic Logic Programming

Lecture Notes on Monadic Logic Programming Lecture Notes on Monadic Logic Programming 15-816: Linear Logic Frank Pfenning Lecture 20 We have discussed both forward and backward chaining at length; in this lecture we address the question how they

More information

GADTs meet Subtyping

GADTs meet Subtyping GADTs meet Subtyping Gabriel Scherer, Didier Rémy Gallium INRIA 2014 Gabriel Scherer, Didier Rémy (Gallium INRIA) GADTs meet Subtyping 2014 1 / 21 A reminder on GADTs GADTs are algebraic data types that

More information

CS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012

CS-XXX: Graduate Programming Languages. Lecture 9 Simply Typed Lambda Calculus. Dan Grossman 2012 CS-XXX: Graduate Programming Languages Lecture 9 Simply Typed Lambda Calculus Dan Grossman 2012 Types Major new topic worthy of several lectures: Type systems Continue to use (CBV) Lambda Caluclus as our

More information

Mathematics for Computer Scientists 2 (G52MC2)

Mathematics for Computer Scientists 2 (G52MC2) Mathematics for Computer Scientists 2 (G52MC2) L03 : More Coq, Classical Logic School of Computer Science University of Nottingham October 8, 2009 The cut rule Sometimes we want to prove a goal Q via an

More information

Dependent Object Types - A foundation for Scala s type system

Dependent Object Types - A foundation for Scala s type system Dependent Object Types - A foundation for Scala s type system Draft of September 9, 2012 Do Not Distrubute Martin Odersky, Geoffrey Alan Washburn EPFL Abstract. 1 Introduction This paper presents a proposal

More information

Non-context-Free Languages. CS215, Lecture 5 c

Non-context-Free Languages. CS215, Lecture 5 c Non-context-Free Languages CS215 Lecture 5 c 2007 1 The Pumping Lemma Theorem (Pumping Lemma) Let be context-free There exists a positive integer divided into five pieces Proof for for each and Let and

More information

Let Arguments Go First

Let Arguments Go First Let Arguments Go First Ningning Xie and Bruno C. d. S. Oliveira The University of Hong Kong {nnxie,bruno}@cs.hku.hk Abstract. Bi-directional type checking has proved to be an extremely useful and versatile

More information

CSE 505, Fall 2008, Final Examination 11 December Please do not turn the page until everyone is ready.

CSE 505, Fall 2008, Final Examination 11 December Please do not turn the page until everyone is ready. CSE 505, Fall 2008, Final Examination 11 December 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