Skip to main content

2017 | OriginalPaper | Buchkapitel

Linearity, Control Effects, and Behavioral Types

verfasst von : Luís Caires, Jorge A. Pérez

Erschienen in: Programming Languages and Systems

Verlag: Springer Berlin Heidelberg

Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.

search-config
loading …

Abstract

Mainstream programming idioms intensively rely on state mutation, sharing, and concurrency. Designing type systems for handling and disciplining such idioms is challenging, due to long known conflicts between internal non-determinism, linearity, and control effects such as exceptions. In this paper, we present the first type system that accommodates non-deterministic and abortable behaviors in the setting of session-based concurrent programs. Remarkably, our type system builds on a Curry-Howard correspondence with (classical) linear logic conservatively extended with two dual modalities capturing an additive (co)monad, and provides a first example of a Curry-Howard interpretation of a realistic programming language with built-in internal non-determinism. Thanks to its deep logical foundations, our system elegantly addresses several well-known tensions between control, linearity, and non-determinism: globally, it enforces progress and fidelity; locally, it allows the specification of non-deterministic and abortable computations. The expressivity of our system is illustrated by several examples, including a typed encoding of a higher-order functional language with threads, session channels, non-determinism, and exceptions.

Sie haben noch keine Lizenz? Dann Informieren Sie sich jetzt über unsere Produkte:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Fußnoten
1
We use \(\oplus \) for denoting internal non-determinism in processes since this is rather standard; indeed, this notation goes back at least to De Nicola and Hennessy [19].
 
Literatur
1.
Zurück zum Zitat Andreoli, J.-M.: Logic programming with focusing proofs in linear logic. J. Log. Comput. 2(3), 297–347 (1992)MathSciNetCrossRef Andreoli, J.-M.: Logic programming with focusing proofs in linear logic. J. Log. Comput. 2(3), 297–347 (1992)MathSciNetCrossRef
2.
Zurück zum Zitat Ariola, Z.M., Herbelin, H.: Minimal classical logic and control operators. In: Baeten, J.C.M., Lenstra, J.K., Parrow, J., Woeginger, G.J. (eds.) ICALP 2003. LNCS, vol. 2719, pp. 871–885. Springer, Heidelberg (2003). doi:10.1007/3-540-45061-0_68CrossRefMATH Ariola, Z.M., Herbelin, H.: Minimal classical logic and control operators. In: Baeten, J.C.M., Lenstra, J.K., Parrow, J., Woeginger, G.J. (eds.) ICALP 2003. LNCS, vol. 2719, pp. 871–885. Springer, Heidelberg (2003). doi:10.​1007/​3-540-45061-0_​68CrossRefMATH
3.
Zurück zum Zitat Atkey, R., Lindley, S., Morris, J.G.: Conflation confers concurrency. In: Lindley, S., McBride, C., Trinder, P., Sannella, D. (eds.) A List of Successes That Can Change the World. LNCS, vol. 9600, pp. 32–55. Springer, Heidelberg (2016). doi:10.1007/978-3-319-30936-1_2CrossRef Atkey, R., Lindley, S., Morris, J.G.: Conflation confers concurrency. In: Lindley, S., McBride, C., Trinder, P., Sannella, D. (eds.) A List of Successes That Can Change the World. LNCS, vol. 9600, pp. 32–55. Springer, Heidelberg (2016). doi:10.​1007/​978-3-319-30936-1_​2CrossRef
4.
Zurück zum Zitat Barber, A.: Dual intuitionistic linear logic. Technical report LFCS-96-347 University of Edinburgh (1996) Barber, A.: Dual intuitionistic linear logic. Technical report LFCS-96-347 University of Edinburgh (1996)
5.
Zurück zum Zitat Benton, P.N., Bierman, G.M., de Paiva, V.: Computational types from a logical perspective. J. Funct. Program. 8(2), 177–193 (1998)MathSciNetCrossRef Benton, P.N., Bierman, G.M., de Paiva, V.: Computational types from a logical perspective. J. Funct. Program. 8(2), 177–193 (1998)MathSciNetCrossRef
6.
Zurück zum Zitat Benton, N., Bierman, G., Paiva, V., Hyland, M.: A term calculus for intuitionistic linear logic. In: Bezem, M., Groote, J.F. (eds.) TLCA 1993. LNCS, vol. 664, pp. 75–90. Springer, Heidelberg (1993). doi:10.1007/BFb0037099CrossRefMATH Benton, N., Bierman, G., Paiva, V., Hyland, M.: A term calculus for intuitionistic linear logic. In: Bezem, M., Groote, J.F. (eds.) TLCA 1993. LNCS, vol. 664, pp. 75–90. Springer, Heidelberg (1993). doi:10.​1007/​BFb0037099CrossRefMATH
7.
Zurück zum Zitat Boreale, M.: On the expressiveness of internal mobility in name-passing calculi. Theor. Comput. Sci. 195(2), 205–226 (1998)MathSciNetCrossRef Boreale, M.: On the expressiveness of internal mobility in name-passing calculi. Theor. Comput. Sci. 195(2), 205–226 (1998)MathSciNetCrossRef
8.
Zurück zum Zitat Caires, L.: Types and logic, concurrency and non-determinism. In: Abadi, M., Gardner, P., Gordon, A.D., Mardare, R. (eds.) Essays for the Luca Cardelli Fest, pp. 69–83. Microsoft Research TR MSR-TR–104 (2014) Caires, L.: Types and logic, concurrency and non-determinism. In: Abadi, M., Gardner, P., Gordon, A.D., Mardare, R. (eds.) Essays for the Luca Cardelli Fest, pp. 69–83. Microsoft Research TR MSR-TR–104 (2014)
9.
10.
Zurück zum Zitat Caires, L., Pérez, J.A., Pfenning, F., Toninho, B.: Behavioral polymorphism and parametricity in session-based communication. In: Felleisen, M., Gardner, P. (eds.) ESOP 2013. LNCS, vol. 7792, pp. 330–349. Springer, Heidelberg (2013). doi:10.1007/978-3-642-37036-6_19CrossRefMATH Caires, L., Pérez, J.A., Pfenning, F., Toninho, B.: Behavioral polymorphism and parametricity in session-based communication. In: Felleisen, M., Gardner, P. (eds.) ESOP 2013. LNCS, vol. 7792, pp. 330–349. Springer, Heidelberg (2013). doi:10.​1007/​978-3-642-37036-6_​19CrossRefMATH
11.
12.
Zurück zum Zitat Caires, L., Pfenning, F., Toninho, B.: Towards concurrent type theory. In: Types in Language Design and Implementation, pp. 1–12 (2012) Caires, L., Pfenning, F., Toninho, B.: Towards concurrent type theory. In: Types in Language Design and Implementation, pp. 1–12 (2012)
13.
Zurück zum Zitat Caires, L., Pfenning, F., Toninho, B.: Linear logic propositions as session types. Math. Struct. Comput. Sci. 26(03), 367–423 (2016)MathSciNetCrossRef Caires, L., Pfenning, F., Toninho, B.: Linear logic propositions as session types. Math. Struct. Comput. Sci. 26(03), 367–423 (2016)MathSciNetCrossRef
14.
Zurück zum Zitat Capecchi, S., Giachino, E., Yoshida, N.: Global escape in multiparty sessions. Math. Struct. Comput. Sci. 26(2), 156–205 (2016)MathSciNetCrossRef Capecchi, S., Giachino, E., Yoshida, N.: Global escape in multiparty sessions. Math. Struct. Comput. Sci. 26(2), 156–205 (2016)MathSciNetCrossRef
15.
Zurück zum Zitat Carbone, M., Honda, K., Yoshida, N.: Structured interactional exceptions in session types. In: Breugel, F., Chechik, M. (eds.) CONCUR 2008. LNCS, vol. 5201, pp. 402–417. Springer, Heidelberg (2008). doi:10.1007/978-3-540-85361-9_32CrossRef Carbone, M., Honda, K., Yoshida, N.: Structured interactional exceptions in session types. In: Breugel, F., Chechik, M. (eds.) CONCUR 2008. LNCS, vol. 5201, pp. 402–417. Springer, Heidelberg (2008). doi:10.​1007/​978-3-540-85361-9_​32CrossRef
16.
Zurück zum Zitat Carbone, M., Lindley, S., Montesi, F., Schürmann, C., Wadler, P.: Coherence generalises duality: a logical explanation of multiparty session types. In: CONCUR 2016, pp. 3:1–33:15 (2016) Carbone, M., Lindley, S., Montesi, F., Schürmann, C., Wadler, P.: Coherence generalises duality: a logical explanation of multiparty session types. In: CONCUR 2016, pp. 3:1–33:15 (2016)
17.
Zurück zum Zitat Carbone, M., Montesi, F., Schürmann, C., Yoshida, N.: Multiparty session types as coherence proofs. In: Proceedings of CONCUR 2015. LIPIcs, vol. 42, pp. 412–426. Schloss Dagstuhl (2015) Carbone, M., Montesi, F., Schürmann, C., Yoshida, N.: Multiparty session types as coherence proofs. In: Proceedings of CONCUR 2015. LIPIcs, vol. 42, pp. 412–426. Schloss Dagstuhl (2015)
18.
Zurück zum Zitat Cardelli, L.: Typeful Programming. IFIP State-of-the-Art Reports: Formal Description of Programming Concepts, pp. 431–507 (1991) Cardelli, L.: Typeful Programming. IFIP State-of-the-Art Reports: Formal Description of Programming Concepts, pp. 431–507 (1991)
19.
Zurück zum Zitat Nicola, R., Hennessy, M.: CCS without \(\tau \)’s. In: Ehrig, H., Kowalski, R., Levi, G., Montanari, U. (eds.) CAAP 1987. LNCS, vol. 249, pp. 138–152. Springer, Heidelberg (1987). doi:10.1007/3-540-17660-8_53CrossRef Nicola, R., Hennessy, M.: CCS without \(\tau \)’s. In: Ehrig, H., Kowalski, R., Levi, G., Montanari, U. (eds.) CAAP 1987. LNCS, vol. 249, pp. 138–152. Springer, Heidelberg (1987). doi:10.​1007/​3-540-17660-8_​53CrossRef
21.
Zurück zum Zitat Demangeon, R., Honda, K., Hu, R., Neykova, R., Yoshida, N.: Practical interruptible conversations: distributed dynamic verification with multiparty session types and python. Formal Methods Syst. Des. 46(3), 197–225 (2015)CrossRef Demangeon, R., Honda, K., Hu, R., Neykova, R., Yoshida, N.: Practical interruptible conversations: distributed dynamic verification with multiparty session types and python. Formal Methods Syst. Des. 46(3), 197–225 (2015)CrossRef
22.
23.
Zurück zum Zitat Ferreira, C., Lanese, I., Ravara, A., Vieira, H.T., Zavattaro, G.: Advanced mechanisms for service combination and transactions. In: Wirsing, M., Hölzl, M. (eds.) Rigorous Software Engineering for Service-Oriented Systems. LNCS, vol. 6582, pp. 302–325. Springer, Heidelberg (2011). doi:10.1007/978-3-642-20401-2_14CrossRef Ferreira, C., Lanese, I., Ravara, A., Vieira, H.T., Zavattaro, G.: Advanced mechanisms for service combination and transactions. In: Wirsing, M., Hölzl, M. (eds.) Rigorous Software Engineering for Service-Oriented Systems. LNCS, vol. 6582, pp. 302–325. Springer, Heidelberg (2011). doi:10.​1007/​978-3-642-20401-2_​14CrossRef
24.
25.
Zurück zum Zitat Gay, S., Vasconcelos, V.T.: Linear type theory for asynchronous session types. J. Funct. Program. 20(1), 19–50 (2010)MathSciNetCrossRef Gay, S., Vasconcelos, V.T.: Linear type theory for asynchronous session types. J. Funct. Program. 20(1), 19–50 (2010)MathSciNetCrossRef
26.
Zurück zum Zitat Griffin, T.: A formulae-as-types notion of control. In: POPL 1990, pp. 47–58 (1990) Griffin, T.: A formulae-as-types notion of control. In: POPL 1990, pp. 47–58 (1990)
28.
Zurück zum Zitat Honda, K., Vasconcelos, V.T., Kubo, M.: Language primitives and type discipline for structured communication-based programming. In: Hankin, C. (ed.) ESOP 1998. LNCS, vol. 1381, pp. 122–138. Springer, Heidelberg (1998). doi:10.1007/BFb0053567CrossRef Honda, K., Vasconcelos, V.T., Kubo, M.: Language primitives and type discipline for structured communication-based programming. In: Hankin, C. (ed.) ESOP 1998. LNCS, vol. 1381, pp. 122–138. Springer, Heidelberg (1998). doi:10.​1007/​BFb0053567CrossRef
29.
Zurück zum Zitat Hüttel, H., Lanese, I., Vasconcelos, V.T., Caires, L., et al.: Foundations of session types and behavioural contracts. ACM Comput. Surv. 49(1), 3 (2016)CrossRef Hüttel, H., Lanese, I., Vasconcelos, V.T., Caires, L., et al.: Foundations of session types and behavioural contracts. ACM Comput. Surv. 49(1), 3 (2016)CrossRef
30.
Zurück zum Zitat Kobayashi, N., Pierce, B.C., Turner, D.N.: Linearity and the pi-calculus. In: 23rd Symposium on Principles of Programming Languages, POPL 1996, pp. 358–371. ACM (1996) Kobayashi, N., Pierce, B.C., Turner, D.N.: Linearity and the pi-calculus. In: 23rd Symposium on Principles of Programming Languages, POPL 1996, pp. 358–371. ACM (1996)
31.
Zurück zum Zitat Krishnaswami, N.R., Turon, A., Dreyer, D., Garg, D.: Superficially substructural types. In: ICFP 2012, pp. 41–54 (2012) Krishnaswami, N.R., Turon, A., Dreyer, D., Garg, D.: Superficially substructural types. In: ICFP 2012, pp. 41–54 (2012)
32.
Zurück zum Zitat Lindley, S., Morris, J.G.: Embedding session types in Haskell. In: 9th International Symposium on Haskell, Haskell 2016, pp. 133–145 (2016) Lindley, S., Morris, J.G.: Embedding session types in Haskell. In: 9th International Symposium on Haskell, Haskell 2016, pp. 133–145 (2016)
35.
Zurück zum Zitat Orchard, D.A., Yoshida, N.: Effects as sessions, sessions as effects. In: Proceedings of the POPL 2016, pp. 568–581. ACM (2016) Orchard, D.A., Yoshida, N.: Effects as sessions, sessions as effects. In: Proceedings of the POPL 2016, pp. 568–581. ACM (2016)
36.
Zurück zum Zitat Parigot, M.: \(\lambda \upmu \)-calculus: an algorithmic interpretation of classical natural deduction. In: Voronkov, A. (ed.) LPAR 1992. LNCS, vol. 624, pp. 190–201. Springer, Heidelberg (1992). doi:10.1007/BFb0013061CrossRef Parigot, M.: \(\lambda \upmu \)-calculus: an algorithmic interpretation of classical natural deduction. In: Voronkov, A. (ed.) LPAR 1992. LNCS, vol. 624, pp. 190–201. Springer, Heidelberg (1992). doi:10.​1007/​BFb0013061CrossRef
37.
Zurück zum Zitat Pérez, J.A., Caires, L., Pfenning, F., Toninho, B.: Linear logical relations for session-based concurrency. In: Seidl, H. (ed.) ESOP 2012. LNCS, vol. 7211, pp. 539–558. Springer, Heidelberg (2012). doi:10.1007/978-3-642-28869-2_27CrossRef Pérez, J.A., Caires, L., Pfenning, F., Toninho, B.: Linear logical relations for session-based concurrency. In: Seidl, H. (ed.) ESOP 2012. LNCS, vol. 7211, pp. 539–558. Springer, Heidelberg (2012). doi:10.​1007/​978-3-642-28869-2_​27CrossRef
38.
Zurück zum Zitat Pfenning, F.: Structural cut elimination. In: 10th Annual IEEE Symposium on Logic in Computer Science, LICS 1995, pp. 156–166. IEEE Computer Society (1995) Pfenning, F.: Structural cut elimination. In: 10th Annual IEEE Symposium on Logic in Computer Science, LICS 1995, pp. 156–166. IEEE Computer Society (1995)
40.
Zurück zum Zitat Sangiorgi, D., Walker, D.: The \(\pi \)-Calculus: A Theory of Mobile Processes. Cambridge University Press, Cambridge (2001)MATH Sangiorgi, D., Walker, D.: The \(\pi \)-Calculus: A Theory of Mobile Processes. Cambridge University Press, Cambridge (2001)MATH
41.
Zurück zum Zitat Scalas, A., Yoshida, N.: Lightweight session programming in scala. In: 30th European Conference on Object-Oriented Programming, ECOOP 2016, pp. 21:1–21:28 (2016) Scalas, A., Yoshida, N.: Lightweight session programming in scala. In: 30th European Conference on Object-Oriented Programming, ECOOP 2016, pp. 21:1–21:28 (2016)
42.
Zurück zum Zitat Toninho, B., Caires, L., Pfenning, F.: Dependent session types via intuitionistic linear type theory. In: PPDP 2011, pp. 161–172 (2011) Toninho, B., Caires, L., Pfenning, F.: Dependent session types via intuitionistic linear type theory. In: PPDP 2011, pp. 161–172 (2011)
44.
Zurück zum Zitat Toninho, B., Caires, L., Pfenning, F.: Higher-order processes, functions, and sessions: a monadic integration. In: Felleisen, M., Gardner, P. (eds.) ESOP 2013. LNCS, vol. 7792, pp. 350–369. Springer, Heidelberg (2013). doi:10.1007/978-3-642-37036-6_20CrossRefMATH Toninho, B., Caires, L., Pfenning, F.: Higher-order processes, functions, and sessions: a monadic integration. In: Felleisen, M., Gardner, P. (eds.) ESOP 2013. LNCS, vol. 7792, pp. 350–369. Springer, Heidelberg (2013). doi:10.​1007/​978-3-642-37036-6_​20CrossRefMATH
46.
Zurück zum Zitat Tov, J.A., Pucella, R.: A theory of substructural types and control. In: OOPSLA 2011, pp. 625–642 (2011) Tov, J.A., Pucella, R.: A theory of substructural types and control. In: OOPSLA 2011, pp. 625–642 (2011)
47.
Zurück zum Zitat Tov, J.A., Pucella, R.: Practical affine types. In: POPL 2011, pp. 447–458 (2011) Tov, J.A., Pucella, R.: Practical affine types. In: POPL 2011, pp. 447–458 (2011)
48.
Zurück zum Zitat Wadler, P.: Propositions as sessions. In: ICFP 2012, pp. 273–286. ACM (2012) Wadler, P.: Propositions as sessions. In: ICFP 2012, pp. 273–286. ACM (2012)
Metadaten
Titel
Linearity, Control Effects, and Behavioral Types
verfasst von
Luís Caires
Jorge A. Pérez
Copyright-Jahr
2017
Verlag
Springer Berlin Heidelberg
DOI
https://doi.org/10.1007/978-3-662-54434-1_9