A Logical Foundation for Session-based Concurrent Computation

Size: px
Start display at page:

Download "A Logical Foundation for Session-based Concurrent Computation"

Transcription

1 A Logical Foundation for Session-based Concurrent Computation Bernardo Toninho [Co-advised by: Luís Caires and Frank Pfenning] Computer Science Department Carnegie Mellon University Universidade Nova de Lisboa Thesis Defense Bernardo Toninho (UNL&CMU) Thesis Defense 1 / 40

2 Motivation Concurrency and Distribution Concurrent and Distributed Systems Systems composed of multiple logically and/or physically distinct interacting components. Pervasive in today s society. Quite error prone, with real consequences: Private information leaks due to security problems. Unavailability of services due to internal orchestration errors. Bernardo Toninho (UNL&CMU) Thesis Defense 2 / 40

3 Motivation Concurrency and Distribution Concurrent and Distributed Systems Systems composed of multiple logically and/or physically distinct interacting components. Pervasive in today s society. Quite error prone, with real consequences: Private information leaks due to security problems. Unavailability of services due to internal orchestration errors. Challenges Coordination of multiple interacting agents to offer a service. Resource availability and correct usage disciplines. How to ensure such a system is well-behaved? Bernardo Toninho (UNL&CMU) Thesis Defense 2 / 40

4 Motivation Goals When is a system well-behaved? System doesn t get stuck / deadlock. System is responsive (i.e. it exhibits some observable behavior). System behavior adheres to some specified protocol. Bernardo Toninho (UNL&CMU) Thesis Defense 3 / 40

5 Motivation Goals When is a system well-behaved? Goals System doesn t get stuck / deadlock. System is responsive (i.e. it exhibits some observable behavior). System behavior adheres to some specified protocol. Study and develop language-based models of concurrency. Developing a logical foundation for message-passing concurrent computation. Robust enough to account for a variety of relevant phenomena. Ensuring strong safety properties by construction. Bernardo Toninho (UNL&CMU) Thesis Defense 3 / 40

6 Motivation Language-based Models Process Calculi Algebraic model of concurrent message-passing processes. Enable study of behavior and interaction of systems. Enriched with types to enforce properties on processes. Bernardo Toninho (UNL&CMU) Thesis Defense 4 / 40

7 Motivation Language-based Models Process Calculi Algebraic model of concurrent message-passing processes. Enable study of behavior and interaction of systems. Enriched with types to enforce properties on processes. Types and Process Calculi Specify what data can be sent along channels (Simple types). Specify input/output capabilities of channels (I/O types). Specify communication behavior along channels (Session types). Bernardo Toninho (UNL&CMU) Thesis Defense 4 / 40

8 Motivation Connections with Logic Issues Many different, sometimes ad-hoc, language features. Hard to reason about these languages in a uniform way. Challenging concerns when compared to non-concurrent setting: Interactive behavior. Non-local state and irreversible actions. Resource awareness No deep connection with logic. Bernardo Toninho (UNL&CMU) Thesis Defense 5 / 40

9 Motivation Connections with Logic Issues Many different, sometimes ad-hoc, language features. Hard to reason about these languages in a uniform way. Challenging concerns when compared to non-concurrent setting: Interactive behavior. Non-local state and irreversible actions. Resource awareness No deep connection with logic. Why does logic matter? New means of reasoning about concurrent phenomena. Good metalogical properties map to good program properties. Enables compositional and incremental study of language features. Bernardo Toninho (UNL&CMU) Thesis Defense 5 / 40

10 Thesis Statement Thesis Statement Linear logic, specifically in its intuitionistic formulation, is a suitable logical foundation for message-passing concurrent computation, providing an elegant framework in which to express and reason about a multitude of naturally occurring phenomena in such a concurrent setting. Bernardo Toninho (UNL&CMU) Thesis Defense 6 / 40

11 Contributions Linear logic and message-passing concurrency: Background Basic interpretation Properties Extensions Bernardo Toninho (UNL&CMU) Thesis Defense 7 / 40

12 Contributions Linear logic and message-passing concurrency: Background Basic interpretation Properties Extensions A concurrent programming language: Monadic encapsulation of concurrent computation Recursion Reconciliation with Logic Bernardo Toninho (UNL&CMU) Thesis Defense 7 / 40

13 Contributions Linear logic and message-passing concurrency: Background Basic interpretation Properties Extensions A concurrent programming language: Monadic encapsulation of concurrent computation Recursion Reconciliation with Logic Reasoning Techniques: Linear logical relations Logical equivalence Bernardo Toninho (UNL&CMU) Thesis Defense 7 / 40

14 Background Linear Logic [Girard 87] A logic of resources and interaction. Resource independence captures parallelism. Linear logic as the logic of concurrency? Bernardo Toninho (UNL&CMU) Thesis Defense 8 / 40

15 Background Linear Logic [Girard 87] A logic of resources and interaction. Resource independence captures parallelism. Linear logic as the logic of concurrency? Linear Logic and Concurrency Initial efforts explored the connections to concurrency: Abramsky s computational interpretation [Abramsky 93] Bellin and Scott s refinement to a -calculus [BellinScott 94] No real Curry-Howard interpretation Bernardo Toninho (UNL&CMU) Thesis Defense 8 / 40

16 Session Types and Linear Logic Session Types [Honda 93] A structuring discipline for message passing concurrency. Session: Predetermined sequence of interactions along a channel. Session Types: Types are descriptions of communication behavior. Type correct programs adhere to the session discipline. Bernardo Toninho (UNL&CMU) Thesis Defense 9 / 40

17 Session Types and Linear Logic Session Types [Honda 93] A structuring discipline for message passing concurrency. Session: Predetermined sequence of interactions along a channel. Session Types: Types are descriptions of communication behavior. Type correct programs adhere to the session discipline. Example A server that receives login information from a client, on success, clients send a product name and receive back a purchase receipt: ServerT, login ( (suclogin badlogin) suclogin, prodname ( purchreceipt 1 Bernardo Toninho (UNL&CMU) Thesis Defense 9 / 40

18 Logical Interpretation Session Types and ILL (SILL) [CairesPfenning10] Its possible to interpret session types as linear logic propositions. Proofs as typing derivations. Proof dynamics as process dynamics. Bernardo Toninho (UNL&CMU) Thesis Defense 10 / 40

19 Logical Interpretation Session Types and ILL (SILL) [CairesPfenning10] Its possible to interpret session types as linear logic propositions. Proofs as typing derivations. Proof dynamics as process dynamics. SILL in hindsight Assigns -calculus processes to proofs Not syntax driven. Channel forwarding as a derived concept. A few key proof reductions do not map to process interactions. Bernardo Toninho (UNL&CMU) Thesis Defense 10 / 40

20 Logical Interpretation Session Types and ILL (SILL) [CairesPfenning10] Its possible to interpret session types as linear logic propositions. Proofs as typing derivations. Proof dynamics as process dynamics. SILL in hindsight Assigns -calculus processes to proofs Not syntax driven. Channel forwarding as a derived concept. A few key proof reductions do not map to process interactions. Deviating from SILL Explicit linear forwarders. Syntax-driven assignment. Consistently mapped to -calculus processes. Bernardo Toninho (UNL&CMU) Thesis Defense 10 / 40

21 Logical Interpretation Propositions as Types A B Output a session of type A and continue as B A ( B Input a session of type A and continue as B A N B Offer a choice between a session of type A or B A B Select a session of type A or B!A A persistent session of type A 1 Terminated session Bernardo Toninho (UNL&CMU) Thesis Defense 11 / 40

22 Logical Interpretation Propositions as Types A B Output a session of type A and continue as B A ( B Input a session of type A and continue as B A N B Offer a choice between a session of type A or B A B Select a session of type A or B!A A persistent session of type A 1 Terminated session Judgments Process expression typing: ; ` P :: x:a -calculus process typing: ; ) ˆP :: x:a Bernardo Toninho (UNL&CMU) Thesis Defense 11 / 40

23 Logical Interpretation - Judgmental Principles Typing Judgment z } { A 1,..., A m ; z } { A 1,..., A n ` A Bernardo Toninho (UNL&CMU) Thesis Defense 12 / 40

24 Logical Interpretation - Judgmental Principles Typing Judgment z } { u 1 :A 1,...,u m :A m ; z x } { 1 :A 1,...,x n :A n ` P :: x:a Process P provides A along x if composed with sessions in and. Bernardo Toninho (UNL&CMU) Thesis Defense 12 / 40

25 Logical Interpretation - Judgmental Principles Typing Judgment z } { u 1 :A 1,...,u m :A m ; z x } { 1 :A 1,...,x n :A n ` P :: x:a Process P provides A along x if composed with sessions in and. Cut as Composition ; ` A ; 0, A ` C ;, 0 ` C cut Bernardo Toninho (UNL&CMU) Thesis Defense 12 / 40

26 Logical Interpretation - Judgmental Principles Typing Judgment z } { u 1 :A 1,...,u m :A m ; z x } { 1 :A 1,...,x n :A n ` P :: x:a Process P provides A along x if composed with sessions in and. Cut as Composition ; ` P :: x:a ; 0, A ` C ;, 0 ` C cut Bernardo Toninho (UNL&CMU) Thesis Defense 12 / 40

27 Logical Interpretation - Judgmental Principles Typing Judgment z } { u 1 :A 1,...,u m :A m ; z x } { 1 :A 1,...,x n :A n ` P :: x:a Process P provides A along x if composed with sessions in and. Cut as Composition ; ` P :: x:a ; 0, x:a ` Q :: z:c ;, 0 ` C cut Bernardo Toninho (UNL&CMU) Thesis Defense 12 / 40

28 Logical Interpretation - Judgmental Principles Typing Judgment z } { u 1 :A 1,...,u m :A m ; z x } { 1 :A 1,...,x n :A n ` P :: x:a Process P provides A along x if composed with sessions in and. Cut as Composition ; ` P :: x:a ; 0, x:a ` Q :: z:c ;, 0 ` new x.(p k Q) ::z:c cut Bernardo Toninho (UNL&CMU) Thesis Defense 12 / 40

29 Logical Interpretation - Judgmental Principles Typing Judgment z } { u 1 :A 1,...,u m :A m ; z x } { 1 :A 1,...,x n :A n ` P :: x:a Process P provides A along x if composed with sessions in and. Cut as Composition ; ` P :: x:a ; 0, x:a ` Q :: z:c ;, 0 ` new x.(p k Q) ::z:c cut Parallel composition of P, offering x:a and Q, using x:a. Identity as Forwarding ; A ` A id Bernardo Toninho (UNL&CMU) Thesis Defense 12 / 40

30 Logical Interpretation - Judgmental Principles Typing Judgment z } { u 1 :A 1,...,u m :A m ; z x } { 1 :A 1,...,x n :A n ` P :: x:a Process P provides A along x if composed with sessions in and. Cut as Composition ; ` P :: x:a ; 0, x:a ` Q :: z:c ;, 0 ` new x.(p k Q) ::z:c cut Parallel composition of P, offering x:a and Q, using x:a. Identity as Forwarding ; x:a ` A id Bernardo Toninho (UNL&CMU) Thesis Defense 12 / 40

31 Logical Interpretation - Judgmental Principles Typing Judgment z } { u 1 :A 1,...,u m :A m ; z x } { 1 :A 1,...,x n :A n ` P :: x:a Process P provides A along x if composed with sessions in and. Cut as Composition ; ` P :: x:a ; 0, x:a ` Q :: z:c ;, 0 ` new x.(p k Q) ::z:c cut Parallel composition of P, offering x:a and Q, using x:a. Identity as Forwarding ; x:a ` fwd xz:: z:a id Bernardo Toninho (UNL&CMU) Thesis Defense 12 / 40

32 Logical Interpretation - Tensor as Output Session Output ; ` A ; 0 ` B ;, 0 ` A B R Bernardo Toninho (UNL&CMU) Thesis Defense 13 / 40

33 Logical Interpretation - Tensor as Output Session Output ; ` P :: y:a ; 0 ` Q :: z:b ;, 0 ` A B R Bernardo Toninho (UNL&CMU) Thesis Defense 13 / 40

34 Logical Interpretation - Tensor as Output Session Output ; ` P :: y:a ; 0 ` Q :: z:b ;, 0 ` output z (y.p); Q :: z:a B R Bernardo Toninho (UNL&CMU) Thesis Defense 13 / 40

35 Logical Interpretation - Tensor as Output Session Output ; ` P :: y:a ; 0 ` Q :: z:b ;, 0 ` output z (y.p); Q :: z:a B R ;, A, B ` C ;, A B ` C L Bernardo Toninho (UNL&CMU) Thesis Defense 13 / 40

36 Logical Interpretation - Tensor as Output Session Output ; ` P :: y:a ; 0 ` Q :: z:b ;, 0 ` output z (y.p); Q :: z:a B R ;, y : A, x : B ` R :: z:c ;, A B ` C L Bernardo Toninho (UNL&CMU) Thesis Defense 13 / 40

37 Logical Interpretation - Tensor as Output Session Output ; ` P :: y:a ; 0 ` Q :: z:b ;, 0 ` output z (y.p); Q :: z:a B R ;, y : A, x : B ` R :: z:c ;, x:a B ` y input x; R :: z:c L Bernardo Toninho (UNL&CMU) Thesis Defense 13 / 40

38 Logical Interpretation - Tensor as Output Session Output ; ` P :: y:a ; 0 ` Q :: z:b ;, 0 ` output z (y.p); Q :: z:a B R ;, y : A, x : B ` R :: z:c ;, x:a B ` y input x; R :: z:c L Proof Reduction ;, 0 ` new x.((output x (y.p); Q) k y input x; R) ::z:c Bernardo Toninho (UNL&CMU) Thesis Defense 13 / 40

39 Logical Interpretation - Tensor as Output Session Output ; ` P :: y:a ; 0 ` Q :: z:b ;, 0 ` output z (y.p); Q :: z:a B R ;, y : A, x : B ` R :: z:c ;, x:a B ` y input x; R :: z:c L Proof Reduction ;, 0 ` new x.((output x (y.p); Q) k y input x; R) ::z:c! ;, 0 ` new x.(q k new y.(p k R)) :: z:c Bernardo Toninho (UNL&CMU) Thesis Defense 13 / 40

40 Logical Interpretation - Implication as Input Session Input ;, A ` B ; ` A ( B (R Bernardo Toninho (UNL&CMU) Thesis Defense 14 / 40

41 Logical Interpretation - Implication as Input Session Input ;, x : A ` P :: z:b ; ` A ( B (R Bernardo Toninho (UNL&CMU) Thesis Defense 14 / 40

42 Logical Interpretation - Implication as Input Session Input ;, x : A ` P :: z:b ; ` x input z; P :: z:a ( B (R Bernardo Toninho (UNL&CMU) Thesis Defense 14 / 40

43 Logical Interpretation - Implication as Input Session Input ;, x : A ` P :: z:b ; ` x input z; P :: z:a ( B (R ; ` A ; 0, B ` C ;, 0, A ( B ` C (L Bernardo Toninho (UNL&CMU) Thesis Defense 14 / 40

44 Logical Interpretation - Implication as Input Session Input ;, x : A ` P :: z:b ; ` x input z; P :: z:a ( B (R ; ` Q 1 :: y:a ; 0, x:b ` Q 2 :: z:c ;, 0, A ( B ` C (L Bernardo Toninho (UNL&CMU) Thesis Defense 14 / 40

45 Logical Interpretation - Implication as Input Session Input ;, x : A ` P :: z:b ; ` x input z; P :: z:a ( B (R ; ` Q 1 :: y:a ; 0, x:b ` Q 2 :: z:c ;, 0, x:a ( B ` output x (y.q 1 ); Q 2 )::z:c (L Bernardo Toninho (UNL&CMU) Thesis Defense 14 / 40

46 Logical Interpretation - Implication as Input Session Input ;, x : A ` P :: z:b ; ` x input z; P :: z:a ( B (R ; ` Q 1 :: y:a ; 0, x:b ` Q 2 :: z:c ;, 0, x:a ( B ` output x (y.q 1 ); Q 2 )::z:c (L Linear Implication as input. Reduction is the same as for. Bernardo Toninho (UNL&CMU) Thesis Defense 14 / 40

47 Logical Interpretation - Multiplicative Unit as Termination Multiplicative Unit ; ` 1 1R Bernardo Toninho (UNL&CMU) Thesis Defense 15 / 40

48 Logical Interpretation - Multiplicative Unit as Termination Multiplicative Unit ; `close z :: z:1 1R Bernardo Toninho (UNL&CMU) Thesis Defense 15 / 40

49 Logical Interpretation - Multiplicative Unit as Termination Multiplicative Unit ; `close z :: z:1 1R ; ` C ;, 1 ` C 1L Bernardo Toninho (UNL&CMU) Thesis Defense 15 / 40

50 Logical Interpretation - Multiplicative Unit as Termination Multiplicative Unit ; `close z :: z:1 1R ; ` Q :: z:c ;, 1 ` C 1L Bernardo Toninho (UNL&CMU) Thesis Defense 15 / 40

51 Logical Interpretation - Multiplicative Unit as Termination Multiplicative Unit ; `close z :: z:1 1R ; ` Q :: z:c ;, x:1 ` wait x; Q :: z:c 1L Proof Reduction ; ` new x.(close x k (wait x; Q)) :: z:c Bernardo Toninho (UNL&CMU) Thesis Defense 15 / 40

52 Logical Interpretation - Multiplicative Unit as Termination Multiplicative Unit ; `close z :: z:1 1R ; ` Q :: z:c ;, x:1 ` wait x; Q :: z:c 1L Proof Reduction ; ` new x.(close x k (wait x; Q)) :: z:c! ; ` Q :: z:c Bernardo Toninho (UNL&CMU) Thesis Defense 15 / 40

53 Logical Interpretation - Additive Conjunction as Alternative Behavior Additive Conjunction ; ` A ; ` B ; ` A N B NR Bernardo Toninho (UNL&CMU) Thesis Defense 16 / 40

54 Logical Interpretation - Additive Conjunction as Alternative Behavior Additive Conjunction ; ` P 1 :: x:a ; ` P 2 :: x:b ; ` A N B NR Bernardo Toninho (UNL&CMU) Thesis Defense 16 / 40

55 Logical Interpretation - Additive Conjunction as Alternative Behavior Additive Conjunction ; ` P 1 :: x:a ; ` P 2 :: x:b ; ` x.case(p 1, P 2 )::x:a N B NR Bernardo Toninho (UNL&CMU) Thesis Defense 16 / 40

56 Logical Interpretation - Additive Conjunction as Alternative Behavior Additive Conjunction ; ` P 1 :: x:a ; ` P 2 :: x:b ; ` x.case(p 1, P 2 )::x:a N B NR ;, A ` C ;, A N B ` C NL 1 Bernardo Toninho (UNL&CMU) Thesis Defense 16 / 40

57 Logical Interpretation - Additive Conjunction as Alternative Behavior Additive Conjunction ; ` P 1 :: x:a ; ` P 2 :: x:b ; ` x.case(p 1, P 2 )::x:a N B NR ;, x:a ` Q :: z:c ;, A N B ` C NL 1 Bernardo Toninho (UNL&CMU) Thesis Defense 16 / 40

58 Logical Interpretation - Additive Conjunction as Alternative Behavior Additive Conjunction ; ` P 1 :: x:a ; ` P 2 :: x:b ; ` x.case(p 1, P 2 )::x:a N B NR ;, x:a ` Q :: z:c ;, x:a N B ` x.inl; Q :: z:c NL 1 Bernardo Toninho (UNL&CMU) Thesis Defense 16 / 40

59 Logical Interpretation - Additive Conjunction as Alternative Behavior Additive Conjunction ; ` P 1 :: x:a ; ` P 2 :: x:b ; ` x.case(p 1, P 2 )::x:a N B NR ;, x:a ` Q :: z:c ;, x:a N B ` x.inl; Q :: z:c NL 1 Proof Reduction ;, 0 ` new x.(x.case(p 1, P 2 ) k x.inl; Q) ::z:c! ;, 0 ` new x.(p 1 k Q) ::z:c Bernardo Toninho (UNL&CMU) Thesis Defense 16 / 40

60 Logical Interpretation - Additive Conjunction as Alternative Behavior Additive Conjunction ; ` P 1 :: x:a ; ` P 2 :: x:b ; ` x.case(p 1, P 2 )::x:a N B NR ;, x:a ` Q :: z:c ;, x:a N B ` x.inl; Q :: z:c NL 1 Proof Reduction ;, 0 ` new x.(x.case(p 1, P 2 ) k x.inl; Q) ::z:c! ;, 0 ` new x.(p 1 k Q) ::z:c Additive disjunction is dual. Bernardo Toninho (UNL&CMU) Thesis Defense 16 / 40

61 Example A Server and a Client ServerT, login ( (suclogin badlogin) suclogin, prodname ( purchreceipt 1 Bernardo Toninho (UNL&CMU) Thesis Defense 17 / 40

62 Example A Server and a Client ServerT, login ( (suclogin badlogin) suclogin, prodname ( purchreceipt 1 c:servert ` Client :: z:1 Bernardo Toninho (UNL&CMU) Thesis Defense 17 / 40

63 Example A Server and a Client ServerT, login ( (suclogin badlogin) suclogin, prodname ( purchreceipt 1 c:servert ` Client :: z:1 Client, output c login; c.case(buy, Error) Buy, output c ticket; r input c; wait c; close z Bernardo Toninho (UNL&CMU) Thesis Defense 17 / 40

64 Example A Server and a Client ServerT, login ( (suclogin badlogin) suclogin, prodname ( purchreceipt 1 c:servert ` Client :: z:1 Client, output c login; c.case(buy, Error) Buy, output c ticket; r input c; wait c; close z ` new c.(server k Client) ::z:1 Bernardo Toninho (UNL&CMU) Thesis Defense 17 / 40

65 Type Safety Type Preservation If ; ) P :: z:a and P! P 0 then ; ) P 0 :: z:a Bernardo Toninho (UNL&CMU) Thesis Defense 18 / 40

66 Type Safety Type Preservation If ; ) P :: z:a and P! P 0 then ; ) P 0 :: z:a Global Progress Let ; )P :: z:1. If P is live then P! Q. Bernardo Toninho (UNL&CMU) Thesis Defense 18 / 40

67 Extending the Interpretation - Value Dependencies and Session Polymorphism Limitations of (simple) Session Types Hard to extend beyond simple communication patterns. No uniform way of expressing properties of exchanged data. Can scale to richer settings, but technically challenging. Bernardo Toninho (UNL&CMU) Thesis Defense 19 / 40

68 Extending the Interpretation - Value Dependencies and Session Polymorphism Limitations of (simple) Session Types Hard to extend beyond simple communication patterns. No uniform way of expressing properties of exchanged data. Can scale to richer settings, but technically challenging. Logical Foundation New means of reasoning about concurrent phenomena. Compositional and incremental study of language features: Value-dependent Session Types Polymorphic Session Types Bernardo Toninho (UNL&CMU) Thesis Defense 19 / 40

69 Extending the Interpretation - Value Dependencies Value-dependent Session Types [Toninho et al.11] Two new types: 8x:.A and 9x:.A Parametric in the language of types. 8x:.A - Input a term M :, continue as A(M). 9x:.A - Output a term M :, continue as A(M). If s are dependent: proof communication. Bernardo Toninho (UNL&CMU) Thesis Defense 20 / 40

70 Extending the Interpretation - Value Dependencies Value-dependent Session Types [Toninho et al.11] Two new types: 8x:.A and 9x:.A Parametric in the language of types. 8x:.A - Input a term M :, continue as A(M). 9x:.A - Output a term M :, continue as A(M). If s are dependent: proof communication. Revisiting the Server-Client ServerT 89, 8u : uid.(suclogin 89 badlogin) suclogin 89, 8p : prodname.8c:cupon(u, p).9r : receipt(u, p).1 Bernardo Toninho (UNL&CMU) Thesis Defense 20 / 40

71 Extending the Interpretation - Value Dependencies Extend the Judgment ; ; ` P :: z:a accounts for variables from the language of. Bernardo Toninho (UNL&CMU) Thesis Defense 21 / 40

72 Extending the Interpretation - Value Dependencies Extend the Judgment Universal Quantification ; ; ` P :: z:a accounts for variables from the language of., ; ; ` A ; ; ` 8x:.A 8R Bernardo Toninho (UNL&CMU) Thesis Defense 21 / 40

73 Extending the Interpretation - Value Dependencies Extend the Judgment Universal Quantification ; ; ` P :: z:a accounts for variables from the language of., x : ; ; ` P :: z:a ; ; ` 8x:.A 8R Bernardo Toninho (UNL&CMU) Thesis Defense 21 / 40

74 Extending the Interpretation - Value Dependencies Extend the Judgment Universal Quantification ; ; ` P :: z:a accounts for variables from the language of., x : ; ; ` P :: z:a ; ; ` x input z; P :: z:8x:.a 8R ` M : ; ;, A{M/x} ` C ; ;, 8x:.A ` C 8L Bernardo Toninho (UNL&CMU) Thesis Defense 21 / 40

75 Extending the Interpretation - Value Dependencies Extend the Judgment Universal Quantification ; ; ` P :: z:a accounts for variables from the language of., x : ; ; ` P :: z:a ; ; ` x input z; P :: z:8x:.a 8R ` M : ; ;, A{M/x} ` C ; ;, 8x:.A ` C 8L Bernardo Toninho (UNL&CMU) Thesis Defense 21 / 40

76 Extending the Interpretation - Value Dependencies Extend the Judgment Universal Quantification ; ; ` P :: z:a accounts for variables from the language of., x : ; ; ` P :: z:a ; ; ` x input z; P :: z:8x:.a 8R ` M : ; ;, x:a{m/x} `Q :: z:c ; ;, 8x:.A ` C 8L Bernardo Toninho (UNL&CMU) Thesis Defense 21 / 40

77 Extending the Interpretation - Value Dependencies Extend the Judgment Universal Quantification ; ; ` P :: z:a accounts for variables from the language of., x : ; ; ` P :: z:a ; ; ` x input z; P :: z:8x:.a 8R ` M : ; ;, x:a{m/x} `Q :: z:c ; ;, x:8x:.a ` output xm; Q :: z:c 8L Bernardo Toninho (UNL&CMU) Thesis Defense 21 / 40

78 Extending the Interpretation - Value Dependencies Refining Quantification [Toninho et al.11, Pfenning et al.11] Proof Irrelevance: [ ] Proofs of are not used at runtime. Affirmation: K K affirms the existence of a proof of. Bernardo Toninho (UNL&CMU) Thesis Defense 22 / 40

79 Extending the Interpretation - Value Dependencies Refining Quantification [Toninho et al.11, Pfenning et al.11] Proof Irrelevance: [ ] Proofs of are not used at runtime. Affirmation: K K affirms the existence of a proof of. Refining the Example suclogin [], 8p : prodname.8c:[cupon(u, p)].9r : receipt(u, p).1 Bernardo Toninho (UNL&CMU) Thesis Defense 22 / 40

80 Extending the Interpretation - Value Dependencies Refining Quantification [Toninho et al.11, Pfenning et al.11] Proof Irrelevance: [ ] Proofs of are not used at runtime. Affirmation: K K affirms the existence of a proof of. Refining the Example suclogin [], 8p : prodname.8c:[cupon(u, p)].9r : receipt(u, p).1 suclogin, 8p : prodname.8c:[cupon(u, p)].9r : S [mreceipt(u, p)].1 Bernardo Toninho (UNL&CMU) Thesis Defense 22 / 40

81 Extending the Interpretation - Value Dependencies Refining Quantification [Toninho et al.11, Pfenning et al.11] Proof Irrelevance: [ ] Proofs of are not used at runtime. Affirmation: K K affirms the existence of a proof of. Refining the Example suclogin [], 8p : prodname.8c:[cupon(u, p)].9r : receipt(u, p).1 suclogin, 8p : prodname.8c:[cupon(u, p)].9r : S [mreceipt(u, p)].1 Type safety (preservation and progress) also entails adherence to constraints on data! Bernardo Toninho (UNL&CMU) Thesis Defense 22 / 40

82 Extending the Interpretation - Parametric Polymorphism Parametric Polymorphism [Pérez et al.11, Wadler11] Second-order quantification. Communication of session types / abstract protocols. Parametricity results in the style of System F. Universal Quantification (Second Order), X; ; ` A ; ; ` 8X.A 8R2 Bernardo Toninho (UNL&CMU) Thesis Defense 23 / 40

83 Extending the Interpretation - Parametric Polymorphism Parametric Polymorphism [Pérez et al.11, Wadler11] Second-order quantification. Communication of session types / abstract protocols. Parametricity results in the style of System F. Universal Quantification (Second Order), X; ; ` P :: z:a ; ; ` 8X.A 8R2 Bernardo Toninho (UNL&CMU) Thesis Defense 23 / 40

84 Extending the Interpretation - Parametric Polymorphism Parametric Polymorphism [Pérez et al.11, Wadler11] Second-order quantification. Communication of session types / abstract protocols. Parametricity results in the style of System F. Universal Quantification (Second Order), X; ; ` P :: z:a ; ; ` X input z; P :: z:8x.a 8R2 Bernardo Toninho (UNL&CMU) Thesis Defense 23 / 40

85 Extending the Interpretation - Parametric Polymorphism Parametric Polymorphism [Pérez et al.11, Wadler11] Second-order quantification. Communication of session types / abstract protocols. Parametricity results in the style of System F. Universal Quantification (Second Order), X; ; ` P :: z:a ; ; ` X input z; P :: z:8x.a 8R2 ` B type ; ;, A{B/X} ` C ; ;, 8X.A ` C 8L2 Bernardo Toninho (UNL&CMU) Thesis Defense 23 / 40

86 Extending the Interpretation - Parametric Polymorphism Parametric Polymorphism [Pérez et al.11, Wadler11] Second-order quantification. Communication of session types / abstract protocols. Parametricity results in the style of System F. Universal Quantification (Second Order), X; ; ` P :: z:a ; ; ` X input z; P :: z:8x.a 8R2 ` B type ; ;, x:a{b/x} `Q :: z:c ; ;, 8X.A ` C 8L2 Bernardo Toninho (UNL&CMU) Thesis Defense 23 / 40

87 Extending the Interpretation - Parametric Polymorphism Parametric Polymorphism [Pérez et al.11, Wadler11] Second-order quantification. Communication of session types / abstract protocols. Parametricity results in the style of System F. Universal Quantification (Second Order), X; ; ` P :: z:a ; ; ` X input z; P :: z:8x.a 8R2 ` B type ; ;, x:a{b/x} `Q :: z:c ; ;, x:8x.a ` output xb; Q :: z:c 8L2 Bernardo Toninho (UNL&CMU) Thesis Defense 23 / 40

88 Extending the Interpretation - Parametric Polymorphism Parametric Polymorphism CloudServer, 8X.!(api ( X) (!X Bernardo Toninho (UNL&CMU) Thesis Defense 24 / 40

89 Extending the Interpretation - Parametric Polymorphism Parametric Polymorphism CloudServer, 8X.!(api ( X) (!X Specifies a generic service that: Inputs any type (e.g. GMaps). Bernardo Toninho (UNL&CMU) Thesis Defense 24 / 40

90 Extending the Interpretation - Parametric Polymorphism Parametric Polymorphism Specifies a generic service that: CloudServer, 8X.!(api ( X) (!X Inputs any type (e.g. GMaps). Inputs a persistent session that, given an implementation of api, provides the previously input type (e.g.!(api ( GMaps)). Bernardo Toninho (UNL&CMU) Thesis Defense 24 / 40

91 Extending the Interpretation - Parametric Polymorphism Parametric Polymorphism Specifies a generic service that: CloudServer, 8X.!(api ( X) (!X Inputs any type (e.g. GMaps). Inputs a persistent session that, given an implementation of api, provides the previously input type (e.g.!(api ( GMaps)). Composes the received session accordingly, subsequently providing a persistent session of the given type (e.g.!gmaps). Bernardo Toninho (UNL&CMU) Thesis Defense 24 / 40

92 A Concurrent Programming Language Overview Programming using the Logical Interpretation Syntax focuses solely on communication behavior. No values nor functions. Hard to write interesting programs. Bernardo Toninho (UNL&CMU) Thesis Defense 25 / 40

93 A Concurrent Programming Language Overview Programming using the Logical Interpretation Syntax focuses solely on communication behavior. No values nor functions. Hard to write interesting programs. Towards a Concurrent Programming Language Approximate the syntax of the logical interpretation. Introduce recursion for expressiveness. Combine concurrent session-typed processes with -calculus. Bernardo Toninho (UNL&CMU) Thesis Defense 25 / 40

94 A Concurrent Programming Language Overview Programming using the Logical Interpretation Syntax focuses solely on communication behavior. No values nor functions. Hard to write interesting programs. Towards a Concurrent Programming Language Approximate the syntax of the logical interpretation. Introduce recursion for expressiveness. Combine concurrent session-typed processes with -calculus. Types A and ^ A Input and output of data. {a i :A i ` c:a} Monadic encapsulation of process expressions. Bernardo Toninho (UNL&CMU) Thesis Defense 25 / 40

95 A Concurrent Programming Language Integrating Concurrency in a Functional Language Contextual Monad Isolate concurrency (and linearity) in a contextual monad. Embed into a typical -calculus with recursive types. Functional programs can refer to processes and vice-versa: Process layer may send/receive functional values. Monadic objects may be executed (in the process layer). Functions can construct monadic objects. Bernardo Toninho (UNL&CMU) Thesis Defense 26 / 40

96 A Concurrent Programming Language Integrating Concurrency in a Functional Language Contextual Monad Isolate concurrency (and linearity) in a contextual monad. Embed into a typical -calculus with recursive types. Functional programs can refer to processes and vice-versa: Process layer may send/receive functional values. Monadic objects may be executed (in the process layer). Functions can construct monadic objects. Example - A Stream of Naturals We want to produce a stream of naturals, starting at a given number: Bernardo Toninho (UNL&CMU) Thesis Defense 26 / 40

97 A Concurrent Programming Language Integrating Concurrency in a Functional Language Contextual Monad Isolate concurrency (and linearity) in a contextual monad. Embed into a typical -calculus with recursive types. Functional programs can refer to processes and vice-versa: Process layer may send/receive functional values. Monadic objects may be executed (in the process layer). Functions can construct monadic objects. Example - A Stream of Naturals We want to produce a stream of naturals, starting at a given number: stype natstream = nat /\ natstream Bernardo Toninho (UNL&CMU) Thesis Defense 26 / 40

98 A Concurrent Programming Language Integrating Concurrency in a Functional Language Contextual Monad Isolate concurrency (and linearity) in a contextual monad. Embed into a typical -calculus with recursive types. Functional programs can refer to processes and vice-versa: Process layer may send/receive functional values. Monadic objects may be executed (in the process layer). Functions can construct monadic objects. Example - A Stream of Naturals We want to produce a stream of naturals, starting at a given number: stype natstream = nat /\ natstream init : nat -> {c:natstream} c <- init n = { output c n c <- init (n+1) } Bernardo Toninho (UNL&CMU) Thesis Defense 26 / 40

99 A Concurrent Programming Language Examples A Stream Filter Given a predicate on naturals p, erase from a stream d all naturals not satisfying the predicate. Bernardo Toninho (UNL&CMU) Thesis Defense 27 / 40

100 A Concurrent Programming Language Examples A Stream Filter Given a predicate on naturals p, erase from a stream d all naturals not satisfying the predicate. filter :(nat -> bool) -> {d:natstream - c:natstream} Bernardo Toninho (UNL&CMU) Thesis Defense 27 / 40

101 A Concurrent Programming Language Examples A Stream Filter Given a predicate on naturals p, erase from a stream d all naturals not satisfying the predicate. filter :(nat -> bool) -> {d:natstream - c:natstream} c <- filter p <- d = { n <- input d if (p n) then output c n c <- filter p <- d else c <- filter p <- d } Bernardo Toninho (UNL&CMU) Thesis Defense 27 / 40

102 A Concurrent Programming Language Examples A Stream Filter Given a predicate on naturals p, erase from a stream d all naturals not satisfying the predicate. filter :(nat -> bool) -> {d:natstream - c:natstream} c <- filter p <- d = { n <- input d if (p n) then output c n c <- filter p <- d else c <- filter p <- d } A stream of all the even natural numbers: {c. d <- init 0 ; filter (fn x => x % 2 = 0) <- d} Bernardo Toninho (UNL&CMU) Thesis Defense 27 / 40

103 A Concurrent Programming Language Examples A Stream Filter Given a predicate on naturals p, erase from a stream d all naturals not satisfying the predicate. filter :(nat -> bool) -> {d:natstream - c:natstream} c <- filter p <- d = { n <- input d if (p n) then output c n c <- filter p <- d else c <- filter p <- d } A stream of all the even natural numbers: {c. d <- init 0 ; filter (fn x => x % 2 = 0) <- d} Bernardo Toninho (UNL&CMU) Thesis Defense 27 / 40

104 A Concurrent Programming Language Examples Sending and Receiving Processes stype AppStore = Choice{weather: {d:api,g:gps - c:weather} /\ 1, travel: {d:api - c:travel} /\ 1} Bernardo Toninho (UNL&CMU) Thesis Defense 28 / 40

105 A Concurrent Programming Language Examples Sending and Receiving Processes stype AppStore = Choice{weather: {d:api,g:gps - c:weather} /\ 1, travel: {d:api - c:travel} /\ 1} ActivateGPS : unit -> {g:gps} WeatherClient : unit -> {a:appstore,d:api - c:weather} c <- WeatherClient () <- a,d = { a.weather w <- input a wait a g <- ActivateGPS () c <- w <- d,g } Bernardo Toninho (UNL&CMU) Thesis Defense 28 / 40

106 A Concurrent Programming Language Examples Sending and Receiving Processes stype AppStore = Choice{weather: {d:api,g:gps - c:weather} /\ 1, travel: {d:api - c:travel} /\ 1} ActivateGPS : unit -> {g:gps} WeatherClient : unit -> {a:appstore,d:api - c:weather} c <- WeatherClient () <- a,d = { a.weather w <- input a wait a g <- ActivateGPS () c <- w <- d,g } Deadlock-freedom/Global Progress in the presence of HO mobility. Bernardo Toninho (UNL&CMU) Thesis Defense 28 / 40

107 A Concurrent Programming Language Reconciling with Logic Divergence Recursive types introduce divergence. Logical soundness is therefore lost. What is the behavior of: {c. d <- init 0 ; filter (fn x => false) <- d} Bernardo Toninho (UNL&CMU) Thesis Defense 29 / 40

108 A Concurrent Programming Language Reconciling with Logic Divergence Recursive types introduce divergence. Logical soundness is therefore lost. What is the behavior of: {c. d <- init 0 ; filter (fn x => false) <- d} Recovering Non-Divergence [Toninho et al. 14] Restrict to coinductive types. Only allow productive definitions: Process definitions must be guarded. Self-interaction with recursive calls must be disallowed. Bernardo Toninho (UNL&CMU) Thesis Defense 29 / 40

109 Reasoning Techniques Using Logic Reasoning using Logic Up to this point we have identified concurrent features that can be justified logically. Can we do more? Can we use the logical foundation to reason about concurrent programs? Bernardo Toninho (UNL&CMU) Thesis Defense 30 / 40

110 Reasoning Techniques Using Logic Reasoning using Logic Up to this point we have identified concurrent features that can be justified logically. Can we do more? Can we use the logical foundation to reason about concurrent programs? Properties of Interest Does a (well-typed) concurrent program diverge? When do two programs have the same behavior? What are the behavioral consequences of polymorphism? When are different behaviors compatible? Bernardo Toninho (UNL&CMU) Thesis Defense 30 / 40

111 Reasoning Techniques Linear Logical Relations Linear Logical Relations [Pérez et al. 12, Caires et al. 13, Toninho et al. 14] Based on logical relations for -calculus. Uniform framework for our session-typed processes. Scales to handle polymorphism and coinductive types. Allow us to show that well-typed processes are compositionally non-divergent. Bernardo Toninho (UNL&CMU) Thesis Defense 31 / 40

112 Reasoning Techniques Linear Logical Relations Equivalence Process Equivalence Observational equivalence is a fundamental tool for reasoning about processes. Canonical observational equivalence: Barbed Congruence. Hard to reason about Quantification over all contexts. Bernardo Toninho (UNL&CMU) Thesis Defense 32 / 40

113 Reasoning Techniques Linear Logical Relations Equivalence Process Equivalence Observational equivalence is a fundamental tool for reasoning about processes. Canonical observational equivalence: Barbed Congruence. Hard to reason about Quantification over all contexts. Logical Equivalence Relational extension of unary formulation of LRs. Contextual typed bisimulation Logical Equivalence. Easy to reason about. Turns out to be a proof technique for barbed congruence. Bernardo Toninho (UNL&CMU) Thesis Defense 32 / 40

114 Reasoning Techniques Linear Logical Relations Equivalence Observational Equivalence ;, x:a B, z:c D ) x(y).z(w).p L z(w).x(y).p :: e:t For open processes, we must place them in a (typed) closed context. Actions along x and z will not be visible, only those along e. Prefix permutation is safe since actions are not observable. Bernardo Toninho (UNL&CMU) Thesis Defense 33 / 40

115 Reasoning Techniques Linear Logical Relations Equivalence Parametricity Recall our CloudServer example and consider: CloudServer, 8X.!(api ( X) (!X A restaurant finding service rest, relying on some maps app. Both C 1 and C 2 will use the CloudServer for its maps infrastructure to offer service rest. One wishes to use GMaps, the other AMaps (related but not quite the same). Bernardo Toninho (UNL&CMU) Thesis Defense 34 / 40

116 Reasoning Techniques Linear Logical Relations Equivalence Parametricity Recall our CloudServer example and consider: CloudServer, 8X.!(api ( X) (!X A restaurant finding service rest, relying on some maps app. Both C 1 and C 2 will use the CloudServer for its maps infrastructure to offer service rest. One wishes to use GMaps, the other AMaps (related but not quite the same). s:!(api ( X) (!X ) C 1 L C 2 :: z:rest[x 7! GMaps, X 7! AMaps] Regardless of the impl. of the CloudServer, parametricity ensures it behaves uniformly. Bernardo Toninho (UNL&CMU) Thesis Defense 34 / 40

117 Reasoning Techniques Linear Logical Relations Equivalence Session Type Isomorphisms Two session behaviors A and B may be different, but compatible... Can we construct A from B and vice-versa? Can we do it seamlessly? i.e. Are A and B isomorphic (written A ' B)? Bernardo Toninho (UNL&CMU) Thesis Defense 35 / 40

118 Reasoning Techniques Linear Logical Relations Equivalence Session Type Isomorphisms Two session behaviors A and B may be different, but compatible... Can we construct A from B and vice-versa? Can we do it seamlessly? i.e. Are A and B isomorphic (written A ' B)? Isomorphisms A B ' B A We have P hx,yi and Q hy,xi such that: (1) x:a B ) P hx,yi :: y:b A and y:b A ) Q hy,zi :: z:a B (2) x:a B ) ( y)(p hx,yi Q hy,zi ) L [x $ z] ::z:a B Bernardo Toninho (UNL&CMU) Thesis Defense 35 / 40

119 Reasoning Techniques Linear Logical Relations Equivalence Isomorphisms A B ' B A A ( (B ( C) ' (A B) ( C (A B) ( C ' (A ( C) N (B ( C)... Coercions can mediate between the two types, representing isomorphic behavior. Bernardo Toninho (UNL&CMU) Thesis Defense 36 / 40

120 Conclusion Summary of Contributions Logical foundation of session types using linear logic: Concurrent language features explained logically. Logical features explained using concurrency. A concurrent programming language: Monadic integration of session-based concurrency. General recursion and (re)connections with logic. Deadlock-freedom in a higher-order setting. Reasoning techniques: Non-trivial properties (e.g. Termination, Parametricity). Logical equivalence as behavioral equivalence. Session Type Isomorphisms Bernardo Toninho (UNL&CMU) Thesis Defense 37 / 40

121 Conclusion Open Problems / Future Work Logical equivalence in the higher-order setting. Full dependent types. Explicit distribution concerns. Non-determinism.... Bernardo Toninho (UNL&CMU) Thesis Defense 38 / 40

122 Bibliography B. Toninho, L. Caires, F. Pfenning. Dependent Session Types via Intuitionistic Linear Type Theory. PPDP 11 F. Pfenning, L. Caires, B. Toninho. Proof-Carrying Code in a Session-Typed Process Calculus. CPP 11 J. Pérez, L. Caires, F. Pfenning, B. Toninho. Linear Logical Relations for Session-Based Concurrency. ESOP 12 B. Toninho, L. Caires, F. Pfenning. Functions as Session-Typed Processes. FoSSaCS 12 L. Caires, J. Pérez, F. Pfenning, B. Toninho. Behavioral Polymorphism and Parametricity in Session-Based Communication. ESOP 13 B. Toninho, L. Caires, F. Pfenning. Higher-Order Processes, Functions, and Sessions: A Monadic Integration. ESOP 13 B. Toninho, L. Caires, F. Pfenning. Corecursion and Non-Divergence in Session Types. TGC 14 Bernardo Toninho (UNL&CMU) Thesis Defense 39 / 40

123 A Logical Foundation for Session-based Concurrent Computation Bernardo Toninho [Co-advised by: Luís Caires and Frank Pfenning] Computer Science Department Carnegie Mellon University Universidade Nova de Lisboa Thesis Defense Bernardo Toninho (UNL&CMU) Thesis Defense 40 / 40

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

Linear Dependent Types

Linear Dependent Types Linear Dependent Types Zhaohui Luo Royal Holloway University of London (Based on work with Yu Zhang at Chinese Academy of Sciences) Linear types and dependent types Linear types (Girard 1987): A B, Dependent

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

Towards Concurrent Type Theory

Towards Concurrent Type Theory Invited talk at TLDI 12 Towards Concurrent Type Theory Luís Caires Universidade Nova de Lisboa luis.caires@di.fct.unl.pt Frank Pfenning Carnegie Mellon University fp@cs.cmu.edu Bernardo Toninho Carnegie

More information

Intersections and Unions of Session Types

Intersections and Unions of Session Types 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

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

Kripke-Style Contextual Modal Type Theory

Kripke-Style Contextual Modal Type Theory Kripke-Style Contextual Modal Type Theory YUITO MURASE THE UNIVERSITY OF TOKYO Agenda Background Logic Type System Future Plan/Related Work Background: Syntactical Metaprogramming Extend the syntax of

More information

Where is ML type inference headed?

Where is ML type inference headed? 1 Constraint solving meets local shape inference September 2005 2 Types are good A type is a concise description of the behavior of a program fragment. Typechecking provides safety or security guarantees.

More information

Lecture Notes on Computational Interpretations of Modalities

Lecture Notes on Computational Interpretations of Modalities Lecture Notes on Computational Interpretations of Modalities 15-816: Modal Logic Frank Pfenning Lecture 4 January 21, 2010 1 Introduction In this lecture we present the first two of many possible computational

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

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

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

Lesson 4 Typed Arithmetic Typed Lambda Calculus

Lesson 4 Typed Arithmetic Typed Lambda Calculus Lesson 4 Typed Arithmetic Typed Lambda 1/28/03 Chapters 8, 9, 10 Outline Types for Arithmetic types the typing relation safety = progress + preservation The simply typed lambda calculus Function types

More information

On the Expressiveness of Polyadicity in Higher-Order Process Calculi

On the Expressiveness of Polyadicity in Higher-Order Process Calculi On the Expressiveness of Polyadicity in Higher-Order Process Calculi Ivan Lanese, Jorge A. Pérez, Davide Sangiorgi (Univ. di Bologna) Alan Schmitt (INRIA Grenoble - Rhône Alpes) ICTCS 09 Cremona, September

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

Proofs-Programs correspondance and Security

Proofs-Programs correspondance and Security Proofs-Programs correspondance and Security Jean-Baptiste Joinet Université de Lyon & Centre Cavaillès, École Normale Supérieure, Paris Third Cybersecurity Japanese-French meeting Formal methods session

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

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

Lecture slides & distribution files:

Lecture slides & distribution files: Type Theory Lecture slides & distribution files: http://www.cs.rhul.ac.uk/home/zhaohui/ttlectures.html Zhaohui Luo Department of Computer Science Royal Holloway, University of London April 2011 2 Type

More information

Gradual Parametricity, Revisited

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

More information

An Evolution of Mathematical Tools

An Evolution of Mathematical Tools An Evolution of Mathematical Tools From Conceptualization to Formalization Here's what we do when we build a formal model (or do a computation): 0. Identify a collection of objects/events in the real world.

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

Dependent Types and Irrelevance

Dependent Types and Irrelevance Dependent Types and Irrelevance Christoph-Simon Senjak Technische Universität München Institut für Informatik Boltzmannstraße 3 85748 Garching PUMA Workshop September 2012 Dependent Types Dependent Types

More information

TRELLYS and Beyond: Type Systems for Advanced Functional Programming

TRELLYS and Beyond: Type Systems for Advanced Functional Programming TRELLYS and Beyond: Type Systems for Advanced Functional Programming Aaron Stump Computer Science The University of Iowa Joint work with Tim Sheard, Vilhelm Sjöberg, and Stephanie Weirich. Supported by

More information

Web Services Choreography and Process Algebra

Web Services Choreography and Process Algebra Web Services Choreography and Process Algebra 29th April 2004 Steve Ross-Talbot Chief Scientist, Enigmatec Corporation Ltd Chair W3C Web Services Activity Co-chair W3C Web Services Choreography Agenda

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

Rule Formats for Nominal Modal Transition Systems

Rule Formats for Nominal Modal Transition Systems Rule Formats for Nominal Modal Transition Systems Anke Stüber Universitet Uppsala, Uppsala, Sweden anke.stuber@it.uu.se Abstract. Modal transition systems are specification languages that allow the expression

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

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

Proofs are Programs. Prof. Clarkson Fall Today s music: Two Sides to Every Story by Dyan Cannon and Willie Nelson

Proofs are Programs. Prof. Clarkson Fall Today s music: Two Sides to Every Story by Dyan Cannon and Willie Nelson Proofs are Programs Prof. Clarkson Fall 2016 Today s music: Two Sides to Every Story by Dyan Cannon and Willie Nelson Review Currently in 3110: Advanced topics Futures Monads Today: An idea that goes by

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

Programming with Universes, Generically

Programming with Universes, Generically Programming with Universes, Generically Andres Löh Well-Typed LLP 24 January 2012 An introduction to Agda Agda Functional programming language Static types Dependent types Pure (explicit effects) Total

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

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

GADTs. Wouter Swierstra and Alejandro Serrano. Advanced functional programming - Lecture 7. [Faculty of Science Information and Computing Sciences]

GADTs. Wouter Swierstra and Alejandro Serrano. Advanced functional programming - Lecture 7. [Faculty of Science Information and Computing Sciences] GADTs Advanced functional programming - Lecture 7 Wouter Swierstra and Alejandro Serrano 1 Today s lecture Generalized algebraic data types (GADTs) 2 A datatype data Tree a = Leaf Node (Tree a) a (Tree

More information

Processes as Types: A Generic Framework of Behavioral Type Systems for Concurrent Processes

Processes as Types: A Generic Framework of Behavioral Type Systems for Concurrent Processes Processes as Types: A Generic Framework of Behavioral Type Systems for Concurrent Processes Atsushi Igarashi (Kyoto Univ.) based on joint work [POPL2001, TCS2003] with Naoki Kobayashi (Tohoku Univ.) Programming

More information

Type Theory. Lecture 2: Dependent Types. Andreas Abel. Department of Computer Science and Engineering Chalmers and Gothenburg University

Type Theory. Lecture 2: Dependent Types. Andreas Abel. Department of Computer Science and Engineering Chalmers and Gothenburg University Type Theory Lecture 2: Dependent Types Andreas Abel Department of Computer Science and Engineering Chalmers and Gothenburg University Type Theory Course CM0859 (2017-1) Universidad EAFIT, Medellin, Colombia

More information

GADTs. Alejandro Serrano. AFP Summer School. [Faculty of Science Information and Computing Sciences]

GADTs. Alejandro Serrano. AFP Summer School. [Faculty of Science Information and Computing Sciences] GADTs AFP Summer School Alejandro Serrano 1 Today s lecture Generalized algebraic data types (GADTs) 2 A datatype data Tree a = Leaf Node (Tree a) a (Tree a) This definition introduces: 3 A datatype data

More information

Introduction to Homotopy Type Theory

Introduction to Homotopy Type Theory Introduction to Homotopy Type Theory Lecture notes for a course at EWSCS 2017 Thorsten Altenkirch March 5, 2017 1 What is this course about? To explain what Homotopy Type Theory is, I will first talk about

More information

Computational Higher-Dimensional Type Theory

Computational Higher-Dimensional Type Theory 1 Computational Higher-Dimensional Type Theory Carlo Angiuli 1 Robert Harper 1 Todd Wilson 2 1 Carnegie Mellon University 2 California State University, Fresno January 20, 2017 Homotopy Type Theory (HoTT)

More information

Wellfounded Recursion with Copatterns

Wellfounded Recursion with Copatterns Wellfounded Recursion with Copatterns Andreas Abel Department of Computer Science and Engineering Chalmers and Gothenburg University, Sweden 25th Nordic Workshop on Programming Theory Tallinn, Estonia

More information

The Next 700 Syntactic Models of Type Theory

The Next 700 Syntactic Models of Type Theory The Next 700 Syntactic Models of Type Theory Simon Boulier 1 Pierre-Marie Pédrot 2 Nicolas Tabareau 1 1 INRIA, 2 University of Ljubljana CPP 17th January 2017 Pédrot & al (INRIA & U Ljubljana) The Next

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

Linearity, Control Effects, and Behavioral Types

Linearity, Control Effects, and Behavioral Types Linearity, Control Effects, and Behavioral Types Luís Caires 1 and Jorge A. Pérez 1,2 1 NOVA LINCS and Departamento de Informática, FCT, Universidade Nova de Lisboa 2 University of Groningen & CWI, Amsterdam

More information

GADTs. Wouter Swierstra. Advanced functional programming - Lecture 7. Faculty of Science Information and Computing Sciences

GADTs. Wouter Swierstra. Advanced functional programming - Lecture 7. Faculty of Science Information and Computing Sciences GADTs Advanced functional programming - Lecture 7 Wouter Swierstra 1 Today s lecture Generalized algebraic data types (GADTs) 2 A datatype data Tree a = Leaf Node (Tree a) a (Tree a) This definition introduces:

More information

Lecture Notes on Binary Decision Diagrams

Lecture Notes on Binary Decision Diagrams Lecture Notes on Binary Decision Diagrams 15-122: Principles of Imperative Computation William Lovas Notes by Frank Pfenning Lecture 25 April 21, 2011 1 Introduction In this lecture we revisit the important

More information

Dependent types and program equivalence. Stephanie Weirich, University of Pennsylvania with Limin Jia, Jianzhou Zhao, and Vilhelm Sjöberg

Dependent types and program equivalence. Stephanie Weirich, University of Pennsylvania with Limin Jia, Jianzhou Zhao, and Vilhelm Sjöberg Dependent types and program equivalence Stephanie Weirich, University of Pennsylvania with Limin Jia, Jianzhou Zhao, and Vilhelm Sjöberg What are dependent types? Types that depend on values of other types

More information

Introduction to dependent types in Coq

Introduction to dependent types in Coq October 24, 2008 basic use of the Coq system In Coq, you can play with simple values and functions. The basic command is called Check, to verify if an expression is well-formed and learn what is its type.

More information

Static Use Based Object Confinement. Christian Skalka and Scott Smith The Johns Hopkins University

Static Use Based Object Confinement. Christian Skalka and Scott Smith The Johns Hopkins University Static Use Based Object Confinement Christian Skalka and Scott Smith The Johns Hopkins University Object confinement: what is it? Object confinement is concerned with the encapsulation, or protection,

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

Functional Logic Design Patterns

Functional Logic Design Patterns FLOPS 2002 Functional Logic Design Patterns Michael Hanus Christian-Albrechts-Universität Kiel joint work with Sergio Antoy Portland State University 1 SOME HISTORY AND MOTIVATION 1993 ([POPL 94, JACM

More information

Dependent types and program equivalence. Stephanie Weirich, University of Pennsylvania with Limin Jia, Jianzhou Zhao, and Vilhelm Sjöberg

Dependent types and program equivalence. Stephanie Weirich, University of Pennsylvania with Limin Jia, Jianzhou Zhao, and Vilhelm Sjöberg Dependent types and program equivalence Stephanie Weirich, University of Pennsylvania with Limin Jia, Jianzhou Zhao, and Vilhelm Sjöberg Doing dependent types wrong without going wrong Stephanie Weirich,

More information

Tracing Ambiguity in GADT Type Inference

Tracing Ambiguity in GADT Type Inference Tracing Ambiguity in GADT Type Inference ML Workshop 2012, Copenhagen Jacques Garrigue & Didier Rémy Nagoya University / INRIA Garrigue & Rémy Tracing ambiguity 1 Generalized Algebraic Datatypes Algebraic

More information

HOL DEFINING HIGHER ORDER LOGIC LAST TIME ON HOL CONTENT. Slide 3. Slide 1. Slide 4. Slide 2 WHAT IS HIGHER ORDER LOGIC? 2 LAST TIME ON HOL 1

HOL DEFINING HIGHER ORDER LOGIC LAST TIME ON HOL CONTENT. Slide 3. Slide 1. Slide 4. Slide 2 WHAT IS HIGHER ORDER LOGIC? 2 LAST TIME ON HOL 1 LAST TIME ON HOL Proof rules for propositional and predicate logic Safe and unsafe rules NICTA Advanced Course Forward Proof Slide 1 Theorem Proving Principles, Techniques, Applications Slide 3 The Epsilon

More information

Course on Probabilistic Methods in Concurrency. (Concurrent Languages for Probabilistic Asynchronous Communication) Lecture 1

Course on Probabilistic Methods in Concurrency. (Concurrent Languages for Probabilistic Asynchronous Communication) Lecture 1 Course on Probabilistic Methods in Concurrency (Concurrent Languages for Probabilistic Asynchronous Communication) Lecture 1 The pi-calculus and the asynchronous pi-calculus. Catuscia Palamidessi INRIA

More information

On the Boolean Algebra of Shape Analysis Constraints

On the Boolean Algebra of Shape Analysis Constraints On the Boolean Algebra of Shape Analysis Constraints Viktor Kuncak and Martin Rinard Computer Science and Artificial Intelligence Laboratory Massachusetts Institute of Technology Cambridge, MA 02139, USA

More information

Automata and Formal Languages - CM0081 Introduction to Agda

Automata and Formal Languages - CM0081 Introduction to Agda Automata and Formal Languages - CM0081 Introduction to Agda Andrés Sicard-Ramírez Universidad EAFIT Semester 2018-2 Introduction Curry-Howard correspondence Dependent types Constructivism Martin-Löf s

More information

Inductive Definitions, continued

Inductive Definitions, continued 1 / 27 Inductive Definitions, continued Assia Mahboubi Jan 7th, 2016 2 / 27 Last lecture Introduction to Coq s inductive types: Introduction, elimination and computation rules; Twofold implementation :

More information

Proofs are Programs. Prof. Clarkson Fall Today s music: Proof by Paul Simon

Proofs are Programs. Prof. Clarkson Fall Today s music: Proof by Paul Simon Proofs are Programs Prof. Clarkson Fall 2017 Today s music: Proof by Paul Simon Review Previously in 3110: Functional programming in Coq Logic in Coq Today: A fundamental idea that goes by many names...

More information

Second-Order Type Systems

Second-Order Type Systems #1 Second-Order Type Systems Homework 5 Summary Student : 37.9704 Student : 44.4466 ORIGINAL : 50.2442 Student : 50.8275 Student : 50.8633 Student : 50.9181 Student : 52.1347 Student : 52.1633 Student

More information

Programming with Math and Logic

Programming with Math and Logic .. Programming with Math and Logic an invitation to functional programming Ed Morehouse Wesleyan University The Plan why fp? terms types interfaces The What and Why of Functional Programming Computing

More information

Software Quality. Chapter What is Quality?

Software Quality. Chapter What is Quality? Chapter 1 Software Quality 1.1 What is Quality? The purpose of software quality analysis, or software quality engineering, is to produce acceptable products at acceptable cost, where cost includes calendar

More information

Mechanizing Metatheory with LF and Twelf

Mechanizing Metatheory with LF and Twelf Mechanizing Metatheory with LF and Twelf Robert Harper with Daniel R. Licata Carnegie Mellon University University of Oregon Summer School on Logic and Theorem Proving in Programming Languages July, 2008

More information

Hoare logic. A proof system for separation logic. Introduction. Separation logic

Hoare logic. A proof system for separation logic. Introduction. Separation logic Introduction Hoare logic Lecture 6: Examples in separation logic In the previous lecture, we saw how reasoning about pointers in Hoare logic was problematic, which motivated introducing separation logic.

More information

` e : T. Gradual Typing. ` e X. Ronald Garcia University of British Columbia

` e : T. Gradual Typing. ` e X. Ronald Garcia University of British Columbia aaab/hicbvbns8naen34wetxtecvi0xwvbirfe9fd3qs0c9oqplsnu3s3stsbgqh1l/ixymixv0h3vw3btsctpxbwoo9gwbmbslnsjvot7w2vrg5tv3ake/u7r8c2kfhbzvkktawsxgiuweoyllmw5pptruppcactjvb6g7md8zukpbetz2n1bcwifnecggj9e2kdw9capbgiaghpvggn/t21ak5c+bv4hakigo0+vaxfyykeztwhinspddjtt8bqrnhdfr2mkvticmy0j6hmqiq/mn8+ck+m0qio0saijweq78njicuykvgogxoovr2zuj/xi/t0bu/yxgaarqtxaio41gnejyedpmkrppceccsmvsxgyieok1ezrocu/zykmlf1fyn5j5evuu3rrwldijo0tly0rwqowfuqc1eui6e0st6s56sf+vd+li0rlnftax9gfx5a8zmk40=

More information

Resource-bound process algebras for Schedulability and Performance Analysis of Real-Time and Embedded Systems

Resource-bound process algebras for Schedulability and Performance Analysis of Real-Time and Embedded Systems Resource-bound process algebras for Schedulability and Performance Analysis of Real-Time and Embedded Systems Insup Lee 1, Oleg Sokolsky 1, Anna Philippou 2 1 RTG (Real-Time Systems Group) Department of

More information

Operational Semantics 1 / 13

Operational Semantics 1 / 13 Operational Semantics 1 / 13 Outline What is semantics? Operational Semantics What is semantics? 2 / 13 What is the meaning of a program? Recall: aspects of a language syntax: the structure of its programs

More information

Reasoning about modules: data refinement and simulation

Reasoning about modules: data refinement and simulation Reasoning about modules: data refinement and simulation David Naumann naumann@cs.stevens-tech.edu Stevens Institute of Technology Naumann - POPL 02 Java Verification Workshop p.1/17 Objectives of talk

More information

Lambda Calculus. Type Systems, Lectures 3. Jevgeni Kabanov Tartu,

Lambda Calculus. Type Systems, Lectures 3. Jevgeni Kabanov Tartu, Lambda Calculus Type Systems, Lectures 3 Jevgeni Kabanov Tartu, 13.02.2006 PREVIOUSLY ON TYPE SYSTEMS Arithmetical expressions and Booleans Evaluation semantics Normal forms & Values Getting stuck Safety

More information

Universes. Universes for Data. Peter Morris. University of Nottingham. November 12, 2009

Universes. Universes for Data. Peter Morris. University of Nottingham. November 12, 2009 for Data Peter Morris University of Nottingham November 12, 2009 Introduction Outline 1 Introduction What is DTP? Data Types in DTP Schemas for Inductive Families 2 of Data Inductive Types Inductive Families

More information

Observable Behaviour Observable behaviour can be defined in terms of experimentation.

Observable Behaviour Observable behaviour can be defined in terms of experimentation. Observable Behaviour Observable behaviour can be defined in terms of experimentation. Consider a coffee machine. We don t need to understand and don t what to understand how the coffee machine works. All

More information

Type-driven Development of Communicating Systems in Idris

Type-driven Development of Communicating Systems in Idris Type-driven Development of Communicating Systems in Idris Edwin Brady (ecb10@st-andrews.ac.uk) University of St Andrews, Scotland, UK @edwinbrady Lambda World, October 1st 2016 Idris is a pure functional

More information

A Modal Analysis of Staged Computation Rowan Davies and Frank Pfenning Carnegie Mellon University We show that a type system based on the intuitionist

A Modal Analysis of Staged Computation Rowan Davies and Frank Pfenning Carnegie Mellon University We show that a type system based on the intuitionist A Modal Analysis of Staged Computation Rowan Davies and Frank Pfenning Carnegie Mellon University We show that a type system based on the intuitionistic modal logic S4 provides an expressive framework

More information

Programming Languages Fall 2014

Programming Languages Fall 2014 Programming Languages Fall 2014 Lecture 7: Simple Types and Simply-Typed Lambda Calculus Prof. Liang Huang huang@qc.cs.cuny.edu 1 Types stuck terms? how to fix it? 2 Plan First I For today, we ll go back

More information

Introduction to Denotational Semantics. Brutus Is An Honorable Man. Class Likes/Dislikes Survey. Dueling Semantics

Introduction to Denotational Semantics. Brutus Is An Honorable Man. Class Likes/Dislikes Survey. Dueling Semantics Brutus Is An Honorable Man HW2 will not be due today. Homework X+1 will never be due until after I have returned Homework X to you. Normally this is never an issue, but I was sick yesterday and was hosting

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

JVM ByteCode Interpreter

JVM ByteCode Interpreter JVM ByteCode Interpreter written in Haskell (In under 1000 Lines of Code) By Louis Jenkins Presentation Schedule ( 15 Minutes) Discuss and Run the Virtual Machine first

More information

Static Use-Based Object Confinement. Christian Skalka and Scott Smith The Johns Hopkins University

Static Use-Based Object Confinement. Christian Skalka and Scott Smith The Johns Hopkins University Static Use-Based Object Confinement Christian Skalka and Scott Smith The Johns Hopkins University Object confinement: what is it? Object confinement is concerned with the encapsulation, or protection,

More information

type classes & locales

type classes & locales Content Rough timeline Intro & motivation, getting started [1] COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Gerwin Klein, June Andronick, Toby Murray type classes & locales

More information

A Logical View of Effects

A Logical View of Effects A Logical View of Effects Sungwoo Park and Robert Harper Computer Science Department Carnegie Mellon University {gla,rwh}@cs.cmu.edu Abstract Despite their invaluable contribution to the programming language

More information

Logical Verification Course Notes. Femke van Raamsdonk Vrije Universiteit Amsterdam

Logical Verification Course Notes. Femke van Raamsdonk Vrije Universiteit Amsterdam Logical Verification Course Notes Femke van Raamsdonk femke@csvunl Vrije Universiteit Amsterdam autumn 2008 Contents 1 1st-order propositional logic 3 11 Formulas 3 12 Natural deduction for intuitionistic

More information

BCS-FACS 7th Refinement Workshop

BCS-FACS 7th Refinement Workshop ELECTRONIC WORKSHOPS IN COMPUTING Series edited by Professor C.J. van Rijsbergen He Jifeng, Oxford University Computing Laboratory, UK, John Cooke, Loughborough University, UK, and Peter Wallis, University

More information

Shared Variables and Interference

Shared Variables and Interference Solved Shared Variables and Interference CS 536: Science of Programming, Fall 2018 A. Why Parallel programs can coordinate their work using shared variables, but it s important for threads to not interfere

More information

Type Systems. Pierce Ch. 3, 8, 11, 15 CSE

Type Systems. Pierce Ch. 3, 8, 11, 15 CSE Type Systems Pierce Ch. 3, 8, 11, 15 CSE 6341 1 A Simple Language ::= true false if then else 0 succ pred iszero Simple untyped expressions Natural numbers encoded as succ succ

More information

Lambda Calculi With Polymorphism

Lambda Calculi With Polymorphism Resources: The slides of this lecture were derived from [Järvi], with permission of the original author, by copy & x = 1 let x = 1 in... paste or by selection, annotation, or rewording. [Järvi] is in turn

More information

The Fox Project: Advanced Development of Systems Software

The Fox Project: Advanced Development of Systems Software The Fox Project: Advanced Development of Systems Software R&D Status Report July 1 to September 30, 1999 School of Computer Science Carnegie Mellon University Pittsburgh, PA 15213 19991222 022 This research

More information

Multi-paradigm Declarative Languages

Multi-paradigm Declarative Languages Michael Hanus (CAU Kiel) Multi-paradigm Declarative Languages ICLP 2007 1 Multi-paradigm Declarative Languages Michael Hanus Christian-Albrechts-University of Kiel Programming Languages and Compiler Construction

More information

Modal Logic Revisited

Modal Logic Revisited Modal Logic Revisited Frank Pfenning The Scottfest In honor of Dana Scott on his 70th Birthday Pittsburgh, Pennsylvania October 12, 2002 1 Source [1] Dana Scott, Advice on Modal Logic. In: Philosophical

More information

3.7 Denotational Semantics

3.7 Denotational Semantics 3.7 Denotational Semantics Denotational semantics, also known as fixed-point semantics, associates to each programming language construct a well-defined and rigorously understood mathematical object. These

More information

Logic and Computation

Logic and Computation Logic and Computation From Conceptualization to Formalization Here's what we do when we build a formal model (or do a computation): 0. Identify a collection of objects/events in the real world. This is

More information

Computer Science 190 (Autumn Term, 2010) Semantics of Programming Languages

Computer Science 190 (Autumn Term, 2010) Semantics of Programming Languages Computer Science 190 (Autumn Term, 2010) Semantics of Programming Languages Course instructor: Harry Mairson (mairson@brandeis.edu), Volen 257, phone (781) 736-2724. Office hours Monday and Wednesday,

More information

Lecture 5. Logic I. Statement Logic

Lecture 5. Logic I. Statement Logic Ling 726: Mathematical Linguistics, Logic. Statement Logic V. Borschev and B. Partee, September 27, 2 p. Lecture 5. Logic I. Statement Logic. Statement Logic...... Goals..... Syntax of Statement Logic....2.

More information

REFLECTIONS ON OPERATOR SUITES

REFLECTIONS ON OPERATOR SUITES REFLECTIONS ON OPERATOR SUITES FOR REFACTORING AND EVOLUTION Ralf Lämmel, VU & CWI, Amsterdam joint work with Jan Heering, CWI QUESTIONS What s the distance between refactoring and evolution? What are

More information

Denotational Semantics. Domain Theory

Denotational Semantics. Domain Theory Denotational Semantics and Domain Theory 1 / 51 Outline Denotational Semantics Basic Domain Theory Introduction and history Primitive and lifted domains Sum and product domains Function domains Meaning

More information

Dagger Traced Symmetric Monoidal Categories and Reversible Programming

Dagger Traced Symmetric Monoidal Categories and Reversible Programming Dagger Traced Symmetric Monoidal Categories and Reversible Programming William J. Bowman, Roshan P. James, and Amr Sabry School of Informatics and Computing, Indiana University {wilbowma,rpjames,sabry}@indiana.edu

More information

The University of Nottingham

The University of Nottingham The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER 2013-2014 G54FOP FOUNDATIONS OF PROGRAMMING Time allowed 2 hours Candidates may complete the front cover of their

More information

Introduction to Denotational Semantics. Class Likes/Dislikes Survey. Dueling Semantics. Denotational Semantics Learning Goals. You re On Jeopardy!

Introduction to Denotational Semantics. Class Likes/Dislikes Survey. Dueling Semantics. Denotational Semantics Learning Goals. You re On Jeopardy! Introduction to Denotational Semantics Class Likes/Dislikes Survey would change [the bijection question] to be one that still tested students' recollection of set theory but that didn't take as much time

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

Shared Variables and Interference

Shared Variables and Interference Illinois Institute of Technology Lecture 24 Shared Variables and Interference CS 536: Science of Programming, Spring 2018 A. Why Parallel programs can coordinate their work using shared variables, but

More information