Abstract
This article provides a gentle introduction to multiparty session types, a class of behavioural types specifically targeted at describing protocols in distributed systems based on asynchronous communication. The type system ensures well-typed processes to enjoy non-trivial properties, including communication safety, protocol fidelity, as well as progress. The adoption of multiparty session types can positively affect the whole software lifecycle, from design to deployment, improving software reliability and reducing its development costs.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Apims (2014). http://thelas.dk/index.php?title=Apims
Bartoletti, M., Castellani, I., Deniélou, P.-M., Dezani-Ciancaglini, M., Ghilezan, S., Pantovic, J., Pérez, J.A., Thiemann, P., Toninho, B., Vieira, H.T.: Combining behavioural types with security analysis (2014, Submitted for Journal Publication)
Bettini, L., Coppo, M., D’Antoni, L., De Luca, M., Dezani-Ciancaglini, M., Yoshida, N.: Global progress in dynamically interleaved multiparty sessions. In: van Breugel, F., Chechik, M. (eds.) CONCUR 2008. LNCS, vol. 5201, pp. 418–433. Springer, Heidelberg (2008)
Bhargavan, K., Corin, R., Deniélou, P.-M., Fournet, C., Leifer, J.J.: Cryptographic protocol synthesis and verification for multiparty sessions. In: Mitchell, J.C. (ed.) CSF 2009, pp. 124–140. IEEE Computer Society Press, Los Alamitos (2009)
Bocchi, L., Chen, T.-C., Demangeon, R., Honda, K., Yoshida, N.: Monitoring networks through multiparty session types. In: Beyer, D., Boreale, M. (eds.) FORTE 2013 and FMOODS 2013. LNCS, vol. 7892, pp. 50–65. Springer, Heidelberg (2013)
Bocchi, L., Demangeon, R., Yoshida, N.: A multiparty multi-session logic. In: Palamidessi, C., Ryan, M.D. (eds.) TGC 2012. LNCS, vol. 8191, pp. 97–111. Springer, Heidelberg (2013)
Bocchi, L., Honda, K., Tuosto, E., Yoshida, N.: A theory of design-by-contract for distributed multiparty interactions. In: Gastin, P., Laroussinie, F. (eds.) CONCUR 2010. LNCS, vol. 6269, pp. 162–176. Springer, Heidelberg (2010)
Bocchi, L., Melgratti, H., Tuosto, E.: Resolving non-determinism in choreographies. In: Shao, Z. (ed.) ESOP 2014 (ETAPS). LNCS, vol. 8410, pp. 493–512. Springer, Heidelberg (2014)
Bocchi, L., Yang, W., Yoshida, N.: Timed multiparty session types. In: Baldan, P., Gorla, D. (eds.) CONCUR 2014. LNCS, vol. 8704, pp. 419–434. Springer, Heidelberg (2014)
Bonelli, E., Compagnoni, A.B.: Multipoint session types for a distributed calculus. In: Barthe, G., Fournet, C. (eds.) TGC 2007. LNCS, vol. 4912, pp. 240–256. Springer, Heidelberg (2008)
Brand, D., Zafiropulo, P.: On communicating finite-state machines. J. ACM 30, 323–342 (1983)
Capecchi, S., Castellani, I., Dezani-Ciancaglini, M.: Typing access control and secure information flow in sessions. Inf. Comput. 238, 68–105 (2014)
Capecchi, S., Castellani, I., Dezani-Ciancaglini, M.: Information flow safety in multiparty sessions. Math. Struct. Comput. Sci. 1–43 (2015). http://journals.cambridge.org/article_S0960129514000619
Capecchi, S., Castellani, I., Dezani-Ciancaglini, M., Rezk, T.: Session types for access and information flow control. In: Gastin, P., Laroussinie, F. (eds.) CONCUR 2010. LNCS, vol. 6269, pp. 237–252. Springer, Heidelberg (2010)
Capecchi, S., Giachino, E., Yoshida, N.: Global escape in multiparty sessions. Math. Struct. Comput. Sci. 1–50 (2015). http://journals.cambridge.org/article_S0960129514000164
Carbone, M., Honda, K., Yoshida, N.: Structured communication-centered programming for web services. ACM Trans. Program. Lang. Syst. 34(2), 8 (2012)
Carbone, M., Montesi, F.: Deadlock-freedom-by-design: multiparty asynchronous global programming. In: Giacobazzi, R., Cousot, R. (eds.) POPL 2013, pp. 263–274. ACM, New York (2013)
Castagna, G., Dezani-Ciancaglini, M., Padovani, L.: On global types and multi-party session. Logical Methods Comput. Sci. 8(1), 24 (2012)
Castellani, I., Dezani-Ciancaglini, M., Pérez, J.A.: Self-adaptation and secure information flow in multiparty structured communications: a unified perspective. In: Carbone, M. (ed.) BEAT 2014. EPTCS, vol. 162, pp. 9–18 (2014)
Chen, T.-C., Bocchi, L., Deniélou, P.-M., Honda, K., Yoshida, N.: Asynchronous distributed monitoring for multiparty session enforcement. In: Bruni, R., Sassone, V. (eds.) TGC 2011. LNCS, vol. 7173, pp. 25–45. Springer, Heidelberg (2012)
Chen, T.-C., Honda, K.: Specifying stateful asynchronous properties for distributed programs. In: Koutny, M., Ulidowski, I. (eds.) CONCUR 2012. LNCS, vol. 7454, pp. 209–224. Springer, Heidelberg (2012)
Coppo, M., Dezani-Ciancaglini, M., Padovani, L., Yoshida, N.: Inference of global progress properties for dynamically interleaved multiparty sessions. In: De Nicola, R., Julien, C. (eds.) COORDINATION 2013. LNCS, vol. 7890, pp. 45–59. Springer, Heidelberg (2013)
Coppo, M., Dezani-Ciancaglini, M., Venneri, B.: Self-adaptive multiparty sessions. SOCA 1–20 (2014). http://dx.doi.org/10.1007/s11761-014-0171-9
Coppo, M., Dezani-Ciancaglini, M., Yoshida, N.: Asynchronous session types and progress for object oriented languages. In: Bonsangue, M.M., Johnsen, E.B. (eds.) FMOODS 2007. LNCS, vol. 4468, pp. 1–31. Springer, Heidelberg (2007)
Coppo, M., Dezani-Ciancaglini, M., Yoshida, N., Padovani, L.: Global progress for dynamically interleaved multiparty sessions. Math. Struct. Comput. Sci. 1–65 (2015). http://journals.cambridge.org/article_S0960129514000188
Dalla Preda, M., Giallorenzo, S., Lanese, I., Mauro, J., Gabbrielli, M.: AIOCJ: a choreographic framework for safe adaptive distributed applications. In: Combemale, B., Pearce, D.J., Barais, O., Vinju, J.J. (eds.) SLE 2014. LNCS, vol. 8706, pp. 161–170. Springer, Heidelberg (2014)
Dardha, O., Giachino, E., Sangiorgi, D.: Session types revisited. In: De Schreye, D., Janssens, G., King, A. (eds.) PPDP 2012, pp. 139–150. ACM Press, New york (2012)
Demangeon, R., Honda, K.: Nested protocols in session types. In: Koutny, M., Ulidowski, I. (eds.) CONCUR 2012. LNCS, vol. 7454, pp. 272–286. Springer, Heidelberg (2012)
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. 1–29 (2014). http://dx.doi.org/10.1007/s10703-014-0218-8
Deniélou, P.-M., Yoshida, N.: Buffered communication analysis in distributed multiparty sessions. In: Gastin, P., Laroussinie, F. (eds.) CONCUR 2010. LNCS, vol. 6269, pp. 343–357. Springer, Heidelberg (2010)
Deniélou, P.-M., Yoshida, N.: Dynamic multirole session types. In: Ball, T., Sagiv, M. (eds.) POPL 2011, pp. 435–446. ACM Press, New York (2011)
Deniélou, P.-M., Yoshida, N.: Multiparty session types meet communicating automata. In: Seidl, H. (ed.) Programming Languages and Systems. LNCS, vol. 7211, pp. 194–213. Springer, Heidelberg (2012)
Deniélou, P.-M., Yoshida, N.: Multiparty compatibility in communicating automata: characterisation and synthesis of global session types. In: Fomin, F.V., Freivalds, R., Kwiatkowska, M., Peleg, D. (eds.) ICALP 2013, Part II. LNCS, vol. 7966, pp. 174–186. Springer, Heidelberg (2013)
Deniélou, P.-M., Yoshida, N., Bejleri, A., Hu, R.: Parameterised multiparty session types. Logical Methods Comput. Sci. 8(4), 1–46 (2012)
Dezani-Ciancaglini, M., de’Liguoro, U.: Sessions and session types: an overview. In: Laneve, C., Su, J. (eds.) WS-FM 2009. LNCS, vol. 6194, pp. 1–28. Springer, Heidelberg (2010)
Dezani-Ciancaglini, M., Mostrous, D., Yoshida, N., Drossopoulou, S.: Session types for object-oriented languages. In: Thomas, D. (ed.) ECOOP 2006. LNCS, vol. 4067, pp. 328–352. Springer, Heidelberg (2006)
Fossati, L., Hu, R., Yoshida, N.: Multiparty session nets. In: Maffei, M., Tuosto, E. (eds.) TGC 2014. LNCS, vol. 8902, pp. 112–127. Springer, Heidelberg (2014)
Henriksen, A.S., Nielsen, L., Hildebrandt, T.T., Yoshida, N., Henglein, F.: Trustworthy pervasive healthcare services via multiparty session types. In: Weber, J., Perseil, I. (eds.) FHIES 2012. LNCS, vol. 7789, pp. 124–141. Springer, Heidelberg (2013)
Honda, K.: Types for dyadic interaction. In: Best, E. (ed.) CONCUR 1993. LNCS, vol. 715, pp. 509–523. Springer, Heidelberg (1993)
Honda, K., Hu, R., Neykova, R., Chen, T.-C., Demangeon, R., Deniélou, P.-M., Yoshida, N.: Structuring Communication with session types. In: Agha, G., Igarashi, A., Kobayashi, N., Masuhara, H., Matsuoka, S., Shibayama, E., Taura, K. (eds.) Concurrent Objects and Beyond. LNCS, vol. 8665, pp. 105–127. Springer, Heidelberg (2014)
Honda, K., Mukhamedov, A., Brown, G., Chen, T.-C., Yoshida, N.: Scribbling interactions with a formal foundation. In: Natarajan, R., Ojo, A. (eds.) ICDCIT 2011. LNCS, vol. 6536, pp. 55–75. Springer, Heidelberg (2011)
Honda, K., Vasconcelos, V.T., Kubo, M.: Language primitives and type disciplines for structured communication-based programming. In: Hankin, C. (ed.) ESOP 1998. LNCS, vol. 1381, pp. 122–138. Springer, Heidelberg (1998)
Honda, K., Yoshida, N., Carbone, M.: Multiparty asynchronous session types. In: Necula, G.C., Wadler, P. (eds.) POPL’08, pp. 273–284. ACM Press, New York (2008)
Hu, R., Neykova, R., Yoshida, N., Demangeon, R., Honda, K.: Practical interruptible conversations. In: Legay, A., Bensalem, S. (eds.) RV 2013. LNCS, vol. 8174, pp. 130–148. Springer, Heidelberg (2013)
Hüttel, H., Lanese, I., Vasconcelos, V.T., Caires, L., Carbone, M., Deniélou, P.-M., Mostrous, D., Padovani, L., Ravara, A., Tuosto, E., Vieira, H.T., Zavattaro, G.: Foundations of Behavioural Types (2014). Submitted for journal publication
Kouzapas, D., Yoshida, N.: Globally governed session semantics. Logical Methods Comput. Sci. 10, 1–45 (2015)
Kouzapas, D., Yoshida, N., Raymond, H., Honda, K.: On asynchronous eventful session semantics. Math. Struct. Comput. Sci. 29, 1–62 (2015)
Lange, J., Tuosto, E.: Synthesising choreographies from local session types. In: Koutny, M., Ulidowski, I. (eds.) CONCUR 2012. LNCS, vol. 7454, pp. 225–239. Springer, Heidelberg (2012)
Lange, J., Tuosto, E., Yoshida, N.: From communicating machines to graphical choreographies. In: Rajamani, S.K., Walker, D. (eds.) POPL 2015, pp. 221–232. ACM Press, New York (2015)
Milner, R.: Communicating and Mobile Systems: The \(\pi \)-Calculus. Cambridge University Press, Cambridge (1999)
Montesi, F., Yoshida, N.: Compositional choreographies. In: D’Argenio, P.R., Melgratti, H. (eds.) CONCUR 2013 – Concurrency Theory. LNCS, vol. 8052, pp. 425–439. Springer, Heidelberg (2013)
Mostrous, D., Yoshida, N., Honda, K.: Global principal typing in partially commutative asynchronous sessions. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 316–332. Springer, Heidelberg (2009)
Neykova, R., Bocchi, L., Yoshida, N.: Timed runtime monitoring for multiparty conversations. In: Carbone, M. (eds.) BEAT 2014. EPTCS, vol. 162, pp. 19–26 (2014)
Neykova, R., Yoshida, N.: Multiparty session actors. In: Kühn, E., Pugliese, R. (eds.) COORDINATION 2014. LNCS, vol. 8459, pp. 131–146. Springer, Heidelberg (2014)
Neykova, R., Yoshida, N., Hu, R.: SPY: local verification of global protocols. In: Legay, A., Bensalem, S. (eds.) RV 2013. LNCS, vol. 8174, pp. 358–363. Springer, Heidelberg (2013)
Ng, N., de Figueiredo Coutinho, J.G., Yoshida, N.: Protocols by default: safe MPI code generation based on session types. In: Franke, B. (ed.) CC 2015. LNCS, vol. 9031, pp. 212–232. Springer, Heidelberg (2015)
Ng, N., Yoshida, N.: Pabble: parameterised Scribble. SOCA 1–16 (2014). http://dx.doi.org/10.1007/s11761-014-0172-8
Ng, N., Yoshida, N., Honda, K.: Multiparty session C: safe parallel programming with message optimisation. In: Furia, C.A., Nanz, S. (eds.) TOOLS 2012. LNCS, vol. 7304, pp. 202–218. Springer, Heidelberg (2012)
Ng, N., Yoshida, N., Luk, W.: Scalable session programming for heterogeneous high-performance systems. In: Counsell, S., Núñez, M. (eds.) SEFM 2013. LNCS, vol. 8368, pp. 82–98. Springer, Heidelberg (2014)
Ng, N., Yoshida, N., Niu, X.Y., Tsoi, K.H., Luk, W.: Session types: towards safe and fast reconfigurable programming. SIGARCH CAN 40, 22–27 (2012)
Nielsen, L., Yoshida, N., Honda, K.: Multiparty symmetric sum types. In: Fröschle, S.B., Valencia, F.D. (eds.) EXPRESS 2010. EPTCS, vol. 41, pp. 121–135 (2010)
Ocean Observatories Initiative (2010). http://www.oceanleadership.org/programs-and-partnerships/ocean-observing/ooi/
Padovani, L.: Deadlock and Lock Freedom in the Linear \(\pi \)-Calculus. In: Henzinger, T.A., Miller, D. (eds.) CSL-LICS 2014, pp. 72:1–72:10. ACM Press, New York (2014). Extended technical report available at http://hal.archives-ouvertes.fr/hal-00932356v2/document
Padovani, L.: Fair subtyping for multi-party session types. Math. Struct. Comput. Sci. 1–41 (2015). http://journals.cambridge.org/article_S096012951400022X
Pierce, B., Sangiorgi, D.: Typing and subtyping for mobile processes. J. Math. Struct. Comput. SCi. 6(5), 409–454 (1996)
Benjamin, C.: Types and Programming Languages. MIT Press, Cambridge (2002)
Planul, J., Corin, R., Fournet, C.: Secure enforcement for global process specifications. In: Bravetti, M., Zavattaro, G. (eds.) CONCUR 2009. LNCS, vol. 5710, pp. 511–526. Springer, Heidelberg (2009)
Savara. SAVARA JBoss RedHat Project (2010). http://www.jboss.org/savara
Scribble. Scribble JBoss RedHat Project (2008). http://www.jboss.org/scribble
Sivaramakrishnan, K.C., Nagaraj, K., Ziarek, L., Eugster, P.: Efficient session type guided distributed interaction. In: Clarke, D., Agha, G. (eds.) COORDINATION 2010. LNCS, vol. 6116, pp. 152–167. Springer, Heidelberg (2010)
Swamy, N., Chen, J., Fournet, C., Strub, P.-Y., Bhargavan, K., Yang, J.: Secure distributed programming with value-dependent types. In: Chakravarty, M.M.T., Hu, Z., Danvy, O. (eds.) ICFP 2011, pp. 266–278. ACM Press, New York (2011)
UNIFI. International Organization for Standardization ISO 20022 UNIversal Financial Industry message scheme (2002). http://www.iso20022.org
Web Services Choreography Working Group. Web Services Choreography Description Language (2002). http://www.w3.org/2002/ws/chor/
Yoshida, N.: Graph types for monadic mobile processes. In: Chandru, V., Vinay, V. (eds.) FSTTCS 1996. LNCS, vol. 1180, pp. 371–386. Springer, Heidelberg (1996)
Yoshida, N., Hu, R., Neykova, R., Ng, N.: The Scribble protocol language. In: Abadi, M., Lluch Lafuente, A. (eds.) TGC 2013. LNCS, vol. 8358, pp. 22–41. Springer, Heidelberg (2014)
Acknowledgements
The research reported in this chapter has been partially supported by COST IC1201. The first three authors have been partially supported by MIUR PRIN Project CINA Prot. 2010LHT4KM and Torino University/Compagnia San Paolo Project SALT. The last author has been partially supported by EPSRC EP/K011715/01, EP/K034413/01 and EP/L00058X/1 and the EU project FP7-612985 UpScale.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
A Properties of the Communication Type System
A Properties of the Communication Type System
This appendix completes the description of the communication type system given in Sect. 4. Auxiliary lemmas, in particular inversion lemmas, are the content of Sect. A.1. Lastly Sect. A.2 proves subject reduction.
1.1 A.1 Auxiliary Lemmas
We start with inversion lemmas which can be easily shown by induction on derivations.
Lemma 2
(Inversion Lemma for Pure Processes).
-
1.
If \(\varGamma \vdash u:{S}\), then \(u:{S}\in \varGamma \).
-
2.
If \(\varGamma \vdash {\mathsf{true}}:{S}\), then \({S}={\mathsf{bool}} \).
-
3.
If \(\varGamma \vdash {\mathsf{false}}:{S}\), then \({S}={\mathsf{bool}} \).
-
4.
If \(\varGamma \vdash {e_1\ {\mathsf{and}}\ e_2}:{S}\), then \(\varGamma \vdash e_1:{\mathsf{bool}} \) and \(\varGamma \vdash e_2:{\mathsf{bool}} \) and \({S}={\mathsf{bool}} \).
-
5.
If \({\varGamma \vdash {{\overline{\,{ a}\,}[{\mathtt {p}}]({y})}.{ P}}\triangleright {\varDelta }}\), then \({\varGamma \vdash { a}:{ \mathsf {{G}}}}\) and \({\varGamma \vdash { P}\triangleright {\varDelta },{y}{:}\mathsf {{G}}\upharpoonright {\mathtt {p}}}\) and \({\mathtt {p}}={\text {mp}(\mathsf {{G}})}\).
-
6.
If \({\varGamma \vdash {{{ a}[{\mathtt {p}}]({y})}.{ P}}\triangleright {\varDelta }}\), then \({\varGamma \vdash { a}:{ \mathsf {{G}}}}\) and \({\varGamma \vdash { P}\triangleright {\varDelta },{y}{:}\mathsf {{G}}\upharpoonright {\mathtt {p}}}\) and \({\mathtt {p}}<{\text {mp}(\mathsf {{G}})}\).
-
7.
If \({\varGamma \vdash {{c}!\langle {\mathtt {p}},{e}\rangle .{ P}}\triangleright {\varDelta }}\), then \({\varDelta }={\varDelta }',{c}:{!}\langle {\mathtt {p}},{{{S}}}\rangle .{T}\) and \({\varGamma \vdash {{e}}:{{{S}}}}\) and \({\varGamma \vdash { P}\triangleright {\varDelta }',{c}:{T}}\).
-
8.
If \({\varGamma \vdash {{c}?( {\mathtt {q}},{x}).{ P}}\triangleright {\varDelta }}\), then \({\varDelta }={\varDelta }',{c}:{?( {\mathtt {q}},{{{S}}} )}.{T}\) and \({\varGamma ,{{{x}}}:{{{S}}}\vdash { P}\triangleright {\varDelta }',{c}:{T}}\).
-
9.
If \({\varGamma \vdash {{c}!\langle \! \langle {\mathtt {p}},{c}'\rangle \!\rangle .{ P}}\triangleright {\varDelta }}\), then \({\varDelta }={\varDelta }',{c}:{!}\langle {\mathtt {p}},\mathsf {{T}}\rangle .{T},{c}':\mathsf {{T}}\) and \({\varGamma \vdash { P}\triangleright {\varDelta }',{c}:{T}}\).
-
10.
If \({\varGamma \vdash {{c}?(\!({\mathtt {q}},{y})\!).{ P}}\triangleright {\varDelta }}\), then \({\varDelta }={\varDelta }',{c}:{?( {\mathtt {q}},\mathsf {{T}} )}.{T}\) and \({\varGamma \vdash { P}\triangleright {\varDelta }',{c}:{T},{y}:\mathsf {{T}}}\).
-
11.
If \({\varGamma \vdash {{c} \oplus {\langle {\mathtt {p}}, l_j\rangle }.{ P}}\triangleright {\varDelta }}\), then \({\varDelta }={\varDelta }',{c}:\oplus \langle {\mathtt {p}},\{l_i:{T}_i\}_{i\in I} \rangle \) and \({\varGamma \vdash { P}\triangleright {\varDelta }',{c}:}\) \({{T}_j}\) and \(j\in I\).
-
12.
If \( {\varGamma \vdash {{c} \& ({{\mathtt {p}}},{\{L_i : { P}_i\}_{i \in I}})}\triangleright {\varDelta }}\), then \( {\varDelta }={\varDelta }', {c}: \& ({\mathtt {p}},\{l_i:{T}_i\}_{i\in I})\) and \({\varGamma \vdash { P}_i\triangleright {\varDelta }',{c}:{T}_i}\) \( \forall i\in I\).
-
13.
If \({\varGamma \vdash { P}{\ |\ }{Q}\triangleright {\varDelta }}\), then \({\varDelta }={\varDelta }',{\varDelta }''\) and \( {\varGamma \vdash { P}\triangleright {\varDelta }}'\) and \({\varGamma \vdash {Q}\triangleright {\varDelta }''}\).
-
14.
If \({\varGamma \vdash {\mathsf{if}} ~{{e}}~{\mathsf{then}} ~{{ P}}~{\mathsf{else}} ~{{Q}}\triangleright {\varDelta }}\), then \( {\varGamma \vdash {e}:{\mathsf{bool}}}\) and \({\varGamma \vdash { P}\triangleright {\varDelta }} \) and \( {\varGamma \vdash {Q}\triangleright {\varDelta }}\).
-
15.
If \({\varGamma \vdash {\mathbf {0}}\triangleright {\varDelta }}\), then \(\varDelta \ {\mathsf{end}}\ \text {only}\).
-
16.
If \(\varGamma \vdash (\nu a) P \triangleright \varDelta \), then \(\varGamma ,a:\mathsf {{G}}\vdash P\triangleright \varDelta \).
-
17.
If \({\varGamma \vdash {{X}\langle {{{e}}},{{{c}}}\rangle }\triangleright {\varDelta }}\), then \(\varGamma =\varGamma ', {X : S\;T}\) and \({\varDelta }={\varDelta }', {{{c}}}:{{{T}}}\) and \({\varGamma \vdash {{{e}}}:{{{S}}}}\) and \(\varDelta '\ {\mathsf{end}}\ \text {only}\).
-
18.
If \({\varGamma \vdash {{\mathsf{def}} \ {{{X}({x}, {y})}={ P}}\ {\mathsf{in}}\ }{{Q}}\triangleright {\varDelta }}\), then \({\varGamma , {{X}: {{{S}}}\;\mathbf t }, {x}:{{{S}}}\vdash { P}\triangleright \{{y}:{{{{T}}}}\}}\) and \({\varGamma , {{X}: {{{S}}}\;\mu \mathbf t .{{{{T}}}}}\vdash {Q}\triangleright {\varDelta }}\).
Lemma 3
(Inversion Lemma for Processes).
-
1.
If \({\varGamma \vdash _{\varSigma } { P} \triangleright {\varDelta }}\) and \({ P}\) is a pure process, then \(\varSigma =\emptyset \) and \({\varGamma \vdash { P}\triangleright {\varDelta }}\).
-
2.
If \({\varGamma \vdash _{\varSigma } {{ s} : {h}} \triangleright {\varDelta }}\), then \(\varSigma = {\{{ s}\}}\).
-
3.
If \({\varGamma \vdash _{{\{{ s}\}}} {{ s} : \phi } \triangleright {\varDelta }}\), then \({\varDelta }~\mathtt{end}\,only\).
-
4.
If \({\varGamma }\vdash _{\{{ s}\}} {{{ s}} : {{h} \cdot {({{\mathtt {q}}},{{\mathtt {p}}},{v})}}} \triangleright {{\varDelta }}\), then \({\varDelta }\approx {\varDelta }';\{{{ s}[{\mathtt {q}}]} : \;!\langle {{\mathtt {p}}},{S}\rangle \} \) and \({\varGamma } \vdash _{\{{ s}\}} {{{ s}} : {h}} \triangleright {{\varDelta }'}\) and \({\varGamma }\vdash {v}:{S}\).
-
5.
If \({\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{{{h}} \cdot {({\mathtt {q}},{{\mathtt {p}}},{{ s}'[{\mathtt {p}}']})}}}} \triangleright {\varDelta }}\), then \({{\varDelta }\approx ({\varDelta }'{;}{\{{{ s}[{\mathtt {q}}]} :\;{!}\langle {\mathtt {p}},\mathsf {{T}}\rangle \}}),{{ s}'[{\mathtt {p}}']}:\mathsf {{T}}} \) and \({\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{h}}} \triangleright {\varDelta }'}\).
-
6.
If \({\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{{{h}} \cdot {({\mathtt {q}},{\mathtt {p}},l)}}}} \triangleright {\varDelta }}\), then \({{\varDelta }\approx {\varDelta }'{;}{\{{{ s}[{\mathtt {q}}]} :\oplus \langle {\mathtt {p}},l\rangle \}}}\) and \({\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{h}}} \triangleright {\varDelta }'}\).
-
7.
If \({\varGamma \vdash _{\varSigma } { P}{\ |\ }{Q} \triangleright {\varDelta }}\), then \(\varSigma = \varSigma _1\cup \varSigma _2\) and \(\varSigma _1\cap \varSigma _2=\emptyset \) and \({\varDelta }= {\varDelta }_1\,{*}\,{\varDelta }_2\) and \({\varGamma \vdash _{\varSigma _1} { P} \triangleright {\varDelta }_1}\) and \({\varGamma \vdash _{\varSigma _2} {Q} \triangleright {\varDelta }_2}\).
-
8.
If \({\varGamma \vdash _{\varSigma } (\nu { s}){ P} \triangleright {\varDelta }}\), then \(\varSigma =\varSigma '\setminus { s}\) and \({\varDelta }={\varDelta }'\setminus { s}\) and \({\mathsf {co}({{\varDelta }'},{{ s}})}\) and \({\varGamma \vdash _{\varSigma '} { P} \triangleright {\varDelta }'}\).
-
9.
If \({\varGamma \vdash _{\varSigma } (\nu { a}){ P} \triangleright {\varDelta }}\), then \({\varGamma ,{ a}:\mathsf {{G}} \vdash _{\varSigma } { P} \triangleright {\varDelta }}\).
-
10.
If \({\varGamma \vdash _{\varSigma } {{\mathsf{def}} \ {{{X}({x}, {y})}={ P}}\ {\mathsf{in}}\ }{{Q}} \triangleright {\varDelta }}\), then \({\varGamma , {{X}: {{{S}}}\;\mathbf t }, {x}:{{{S}}}\vdash { P}\triangleright {y}:{{{{T}}}}}\) and \({\varGamma , {{X}: {{{S}}}\;\mu \mathbf t .{{{{T}}}}} \vdash _{\varSigma } {Q} \triangleright {\varDelta }}\).
The following lemma allows to characterise the types due to the messages which occur in queues. The proof is standard by induction on the lengths of queues.
Lemma 4
-
1.
If \({\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{{{h}}_1 \cdot {{({\mathtt {q}},{\mathtt {p}},{ v})} \cdot {{h}}_2}}}} \triangleright {\varDelta }}\), then \({\varDelta }= {\varDelta }_1\,{*}\,{\{{{ s}[{\mathtt {q}}]}:\;{!}\langle {\mathtt {p}},{{{S}}}\rangle \}}\,{*}\,{\varDelta }_2 \) and \({\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{h}}}_i \triangleright {\varDelta }_i}\) (\(i=1,2\)) and \( {\varGamma \vdash v:{{{S}}}}\).
Vice versa \({\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{h}}}_i \triangleright {\varDelta }_i} \) (\(i=1,2\)) and \( {\varGamma \vdash v:{{{S}}}}\) imply
$${\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{{{h}}_1 \cdot {{({\mathtt {q}},{\mathtt {p}},{ v})} \cdot {{h}}_2}}}} \triangleright {\varDelta }_1{*}{\{{{ s}[{\mathtt {q}}]} :\;{!}\langle {\mathtt {p}},{{{S}}}\rangle \}}{*}{\varDelta }_2}.$$ -
2.
If \({\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{{{h}}_1 \cdot {{({\mathtt {q}},{{\mathtt {p}}},{{ s}'[{\mathtt {p}}']})} \cdot {{h}}_2}}}} \triangleright {\varDelta }}\), then \({\varDelta }= ({\varDelta }_1{*}{\{{{ s}[{\mathtt {q}}]} :\;{!}\langle {\mathtt {p}},\mathsf {{T}}\rangle \}}{*}{\varDelta }_2),{{ s}'[{\mathtt {p}}']}:\mathsf {{T}}\) and \({\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{h}}}_i \triangleright {\varDelta }_i} \) (\(i=1,2\)).
Vice versa \({\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{h}}}_i \triangleright {\varDelta }_i} \) (\(i=1,2\)) imply
$${\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{{{h}}_1 \cdot {{({\mathtt {q}},{{\mathtt {p}}},{{ s}'[{\mathtt {p}}']})} \cdot {{h}}_2}}}} \triangleright ({\varDelta }_1{*}{\{{{ s}[{\mathtt {q}}]} :\;{!}\langle {\mathtt {p}},\mathsf {{T}}\rangle \}}{*}{\varDelta }_2),{{ s}'[{\mathtt {p}}']}:\mathsf {{T}}}.$$ -
3.
If \({\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{{{h}}_1 \cdot {{({\mathtt {q}},{\mathtt {p}},l)} \cdot {{h}}_2}}}} \triangleright {\varDelta }}\), then \({\varDelta }= {\varDelta }_1{*}{\{{{ s}[{\mathtt {q}}]} :\oplus \langle {\mathtt {p}},l\rangle \}}{*}{\varDelta }_2\) and \({\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{h}}}_i \triangleright {\varDelta }_i}\) (\(i=1,2\)). para Vice versa \({\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{h}}}_i \triangleright {\varDelta }_i} \) (\(i=1,2\)) imply
$${\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{{{h}}_1 \cdot {{({\mathtt {q}},{\mathtt {p}},l)} \cdot {{h}}_2}}}} \triangleright {\varDelta }_1{*}{\{{{ s}[{\mathtt {q}}]} :\oplus \langle {\mathtt {p}},l\rangle \}}{*}{\varDelta }_2}.$$
We end this subsection with two classical results: type preservation under substitution and under equivalence of processes.
Lemma 5
(Substitution Lemma).
-
1.
If \({\varGamma ,{{{x}}}:{{{S}}}\vdash { P}\triangleright {\varDelta }}\) and \({\varGamma \vdash {{v}}:{{{S}}}}\), then \({\varGamma \vdash { P}{\{{{{ v}}} / {{{x}}}\}}\triangleright {\varDelta }}\).
-
2.
If \({\varGamma \vdash { P}\triangleright {\varDelta },{y}:{T}}\), then \({\varGamma \vdash { P}{\{{{ s}[{\mathtt {p}}]}/{y}\}}\triangleright {\varDelta },{{ s}[{\mathtt {p}}]}:{T}}\).
Proof
Standard induction on type derivations, with a case analysis on the last applied rule. \(\square \)
Theorem 2
(Type Preservation Under Equivalence). If \({\varGamma \vdash _{\varSigma } { P} \triangleright {\varDelta }}\) and \({ P}\equiv { P}'\), then \({\varGamma \vdash _{\varSigma } { P}' \triangleright {\varDelta }}\).
Proof
By induction on \(\equiv \). We only consider some interesting cases (the other cases are straightforward).
-
\({ P}{\ |\ }{\mathbf {0}}\equiv { P}\). First we assume \({\varGamma \vdash _{\varSigma } { P} \triangleright {\varDelta }}\). From \({\varGamma \vdash _{\emptyset } {\mathbf {0}} \triangleright \emptyset }\) by applying (GPar) to these two sequents we obtain \({\varGamma \vdash _{\varSigma } { P}|{\mathbf {0}} \triangleright {\varDelta }}\).
For the converse direction assume \({\varGamma \vdash _{\varSigma } { P}|{\mathbf {0}} \triangleright {\varDelta }}\). Using 3(7) we obtain: \({\varGamma \vdash _{\varSigma _1} { P} \triangleright {\varDelta }_1}\), \({\varGamma \vdash _{\varSigma _2} {\mathbf {0}} \triangleright {\varDelta }_2}\), where \({\varDelta }={\varDelta }_1{*}{\varDelta }_2,\ \varSigma =\varSigma _1\cup \varSigma _2\) and \(\varSigma _1\cap \varSigma _2=\emptyset \). Using 3(1) we get \(\varSigma _2=\emptyset \), which implies \(\varSigma =\varSigma _1\), and \({\varGamma \vdash {\mathbf {0}}\triangleright {\varDelta }_2}\). Using 2(15) we get \({\varDelta }_2\ {\mathsf{end}}\ \text {only}\) which implies \({{\varDelta }_1\approx {\varDelta }_1 {*}{\varDelta }_2}\), so we conclude \({\varGamma \vdash _{\varSigma } { P} \triangleright {\varDelta }_1 {*}{\varDelta }_2}\) by applying (Equiv).
-
\({ P}{\ |\ }{Q}\equiv {Q}{\ |\ }{ P}\). By the symmetry of the rule we have to show only one direction. Suppose \({\varGamma \vdash _{\varSigma } { P}{\ |\ }{Q} \triangleright {\varDelta }}\). Using 3(7) we obtain \({\varGamma \vdash _{\varSigma _1} { P} \triangleright {\varDelta }_1}\), \({\varGamma \vdash _{\varSigma _2} {Q} \triangleright {\varDelta }_2}\), where \({\varDelta }={\varDelta }_1{*}{\varDelta }_2\), \(\varSigma =\varSigma _1\cup \varSigma _2\) and \(\varSigma _1\cap \varSigma _2=\emptyset \). Using (GPar) we get \({\varGamma \vdash _{\varSigma } {Q}{\ |\ }{ P} \triangleright {\varDelta }_2{*}{\varDelta }_1}\). Thanks to the commutativity of \({*}\), we get \({\varDelta }_2{*}{\varDelta }_1={\varDelta }\) and so we are done.
-
\({ P}{\ |\ }({Q}{\ |\ }R) \equiv ({ P}{\ |\ }{Q}){\ |\ }R\). Suppose \({\varGamma \vdash _{\varSigma } { P}{\ |\ }({Q}{\ |\ }R) \triangleright {\varDelta }}\). Using 3(7) we obtain \({\varGamma \vdash _{\varSigma _1} { P} \triangleright {\varDelta }_1}\), \({\varGamma \vdash _{\varSigma _2} {Q}{\ |\ }R \triangleright {\varDelta }_2}\), where \({\varDelta }={\varDelta }_1{*}{\varDelta }_2\), \(\varSigma =\varSigma _1\cup \varSigma _2\) and \(\varSigma _1\cap \varSigma _2=\emptyset \). Using 3(7) we obtain \({\varGamma \vdash _{\varSigma _{21}} {Q} \triangleright {\varDelta }_{21}}\), \({\varGamma \vdash _{\varSigma _{22}} R \triangleright {\varDelta }_{22}}\) where \({\varDelta }_2={\varDelta }_{21}{*}{\varDelta }_{22},\ \varSigma _2=\varSigma _{21}\cup \varSigma _{22}\) and \(\varSigma _{21}\cap \varSigma _{22}=\emptyset \). Using (GPar) we get \({\varGamma \vdash _{\varSigma _1\cup \varSigma _{21}} { P}{\ |\ }{Q} \triangleright {\varDelta }_1{*}{\varDelta }_{21}}\). Using (GPar) again we get \({\varGamma \vdash _{\varSigma } ({ P}{\ |\ }{Q}){\ |\ }R \triangleright {\varDelta }_1{*}{\varDelta }_{21}{*}{\varDelta }_{22}}\) and so we are done by the associativity of \({*}\). The proof for the other direction is similar.
-
\( {{ s} : {{{{h}}_1 \cdot {{{({\mathtt {q}},{\mathtt {p}}, { v})} \cdot {({\mathtt {q}}',{\mathtt {p}}', { v}')}} \cdot {{h}}_2}}} } \equiv {{ s} : {{{{h}}_1 \cdot { {{({\mathtt {q}}',{\mathtt {p}}', { v}')} \cdot {({\mathtt {q}},{\mathtt {p}}, { v})}} \cdot {{h}}_2}}} }\) where \({\mathtt {p}}\ne {\mathtt {p}}'\) or \({\mathtt {q}}\ne {\mathtt {q}}'\). We assume \({\mathtt {p}}\ne {\mathtt {p}}'\) and \({\mathtt {q}}= {\mathtt {q}}'\), the proof in the case \({\mathtt {q}}\ne {\mathtt {q}}'\) being similar and simpler. If \({\varGamma \vdash _{\varSigma } {{ s} : {{{{h}}_1 \cdot {{{({\mathtt {q}},{\mathtt {p}}, { v})} \cdot {({\mathtt {q}},{\mathtt {p}}', { v}')}} \cdot {{h}}_2}}}} \triangleright {\varDelta }}\), then \(\varSigma = {\{{ s}\}}\) by Lemma 3(2). This implies \({\varDelta }= {\varDelta }_1{*}{\{{{ s}[{\mathtt {q}}]} :\;{!}\langle {\mathtt {p}},{{{S}}}\rangle ;\;{!}\langle {\mathtt {p}}',{{{S}}}'\rangle \}}{*}{\varDelta }_2 \) and \({\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{h}}}_i \triangleright {\varDelta }_i} \) (\(i=1,2\)) and \( {\varGamma \vdash v:{{{S}}}}\) and \( {\varGamma \vdash v':{{{S}}}'}\) by Lemma 4(1). By the same lemma we can derive
$${\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{{{h}}_1 \cdot {{{({\mathtt {q}},{\mathtt {p}}', { v}')} \cdot {({\mathtt {q}},{\mathtt {p}}, { v})}} \cdot {{h}}_2}}}} \triangleright {\varDelta }_1{*}{\{{{ s}[{\mathtt {q}}]} :\;{!}\langle {\mathtt {p}}',{{{S}}}'\rangle ;\;{!}\langle {\mathtt {p}},{{{S}}}\rangle \}}{*}{\varDelta }_2},$$and we conclude using rule (Equiv), since by definition
$${{\varDelta }_1{*}{\{{{ s}[{\mathtt {q}}]} :\;{!}\langle {\mathtt {p}}',{{{S}}}'\rangle ;\;{!}\langle {\mathtt {p}},{{{S}}}\rangle \}}{*}{\varDelta }_2\approx {\varDelta }}.$$
\(\square \)
1.2 A.2 Proof of Subject Reduction
We show the Main Lemma first and then the Subject Reduction Theorem.
Lemma 1 (Main Lemma). Let \({\varGamma \vdash _{\varSigma } { P} \triangleright {\varDelta }}\), and \( {{ P}{\longrightarrow }{ P}'}\) be obtained by any reduction rule different from [Ctxt], [Str], and \({\varDelta }\,{*}\,{\varDelta }_0\) be consistent, for some \({\varDelta }_0\). Then there is \({\varDelta }'\) such that \({\varGamma \vdash _{\varSigma } { P}' \triangleright {\varDelta }'}\) and \({{{\varDelta }}~\Rightarrow ^*~{{\varDelta }'}}\) and \({\varDelta }'\,{*}\,{\varDelta }_0\) is consistent.
Proof
The proof is by cases on process reduction rules. We only consider some paradigmatic cases.
-
[Init] \({{{ a}[1]( {y})}.{ P}_1} {\ |\ }...{\ |\ }{{\overline{\,{ a}\,}[n]( {y})}.{ P}_n}\) \({\longrightarrow }(\nu { s})( { P}_{1}{\{{{ s}[1]}/{y}_{1}\}} {\ |\ }...{\ |\ }{ P}_n{\{{{ s}[n]}/ {y}\}}{\ |\ }s :~\phi )\).
By hypothesis \({\varGamma \vdash _{\varSigma } {{{ a}[1]( {y})}.{ P}_1}{\ |\ }{{{ a}[2]({y}_2)}.{ P}_2}{\ |\ }\ldots {\ |\ }{{\overline{\,{ a}\,}[n]( {y})}.{ P}_n} \triangleright {\varDelta }}\); then, since the redex is a pure process, \(\varSigma =\emptyset \) and \({\varGamma \vdash {{{ a}[1]( {y})}.{ P}_1}{\ |\ }{{{ a}[2]({y}_2)}.{ P}_2}{\ |\ }\ldots \triangleright }\) \({\vdash {\ |\ }{{\overline{\,{ a}\,}[n]( {y})}.{ P}_n}\triangleright {\varDelta }}\) by Lemma 3(1). Using Lemma 2(13) on all the processes in parallel we have
$$\begin{aligned}&{\varGamma \vdash {{{ a}[i]( {y})}.{ P}_i}\triangleright {\varDelta }_i}\quad (1\le i\le n-1) \end{aligned}$$(1)$$\begin{aligned}&{\varGamma \vdash {{\overline{\,{ a}\,}[n]( {y})}.{ P}_n}\triangleright {\varDelta }_n} \end{aligned}$$(2)where \({\varDelta }= \bigcup _{i=1}^n {\varDelta }_i\). Using Lemma 2(6) on (1) we have
$$\begin{aligned}&\quad \qquad \qquad \quad \ {\varGamma \vdash { a}:{ \mathsf {{G}}}}\nonumber \\&{\varGamma \vdash { P}_i\triangleright {\varDelta }_i, {y}{:}\mathsf {{G}}\upharpoonright i} \quad (1\le i\le n-1). \end{aligned}$$(3)Using Lemma 2(5) on (2) we have
$$\begin{aligned}&\qquad \,{\varGamma \vdash { a}:{ \mathsf {{G}}}}\nonumber \\&{\varGamma \vdash { P}_n\triangleright {\varDelta }_n, {y}:\mathsf {{G}}\upharpoonright n} \end{aligned}$$(4)and \({\text {mp}(\mathsf {{G}})}= n\). Using Lemma 5(2) on (4) and (3) we have
$$\begin{aligned} {\varGamma \vdash { P}_i{\{{{ s}[i]}/ {y}\}}\triangleright {\varDelta }_i,{{ s}[i]}:\mathsf {{G}}\upharpoonright i} \quad (1\le i\le n). \end{aligned}$$(5)Using (Par) on all the processes of (5) we have
$$\begin{aligned}&{\varGamma \vdash { P}_1{\{{{ s}[1]}/ {y}\}} | ... | { P}_n{\{{{ s}[n]}/ {y}\}}\triangleright \bigcup _{i=1}^n ({\varDelta }_i,{{ s}[i]}:\mathsf {{G}}\upharpoonright i)}. \end{aligned}$$(6)Note that \(\bigcup _{i=1}^n ({\varDelta }_i,{{ s}[i]}{:}\mathsf {{G}}\upharpoonright i) = {\varDelta },{{ s}[1]}{:}{G}\upharpoonright 1,\ldots ,{{ s}[n]}{:}\mathsf {{G}}\upharpoonright n\). Using (GInit), (QInit) and (GPar) on (6) we derive
$$\begin{aligned}&{\varGamma \vdash _{\{{ s}\}} { P}_1{\{{{ s}[1]}/ {y}\}} | ... | { P}_n{\{{{ s}[n]}/ {y}\}}{\ |\ }s : \phi \triangleright {\varDelta },{{ s}[1]}{:}\mathsf {{G}}\upharpoonright 1,\ldots ,{{ s}[n]}{:}\mathsf {{G}}\upharpoonright n}. \end{aligned}$$(7)Using (GSRes) on (7) we conclude
$$\begin{aligned}&{\varGamma \vdash _{\emptyset } (\nu { s})({ P}_1{\{{{ s}[1]}/ {y}\}} | ... | { P}_n{\{{{ s}[n]}/ {y}\}}{\ |\ }s : \phi ) \triangleright {\varDelta }} \end{aligned}$$since \({\{{{ s}[1]}{:}\mathsf {{G}}\upharpoonright 1,\ldots ,{{ s}[n]}{:}\mathsf {{G}}\upharpoonright n\}}\) is consistent and
$$({\varDelta },{{ s}[1]}{:}\mathsf {{G}}\upharpoonright 1,\ldots ,{{ s}[n]}{:}\mathsf {{G}}\upharpoonright n )\setminus {{ s}} = {\varDelta }.$$ -
[Send] \({{{{ s}[{\mathtt {p}}]}!\langle {\mathtt {q}},{e}\rangle .{ P}} {\ |\ }{{ s} : {{h}}}{\longrightarrow }{ P}{\ |\ }{{ s} : {{{{h}} \cdot {({\mathtt {p}},{\mathtt {q}},{ v})}}}}} \ \ ({{e}}\downarrow {{ v}})\).
By hypothesis, \({\varGamma \vdash _{\varSigma } {{{ s}[{\mathtt {p}}]}!\langle {\mathtt {q}},{e}\rangle .{ P}} {\ |\ }{{ s} : {{h}}} \triangleright {\varDelta }}.\) Using Lemma 3(7), (1), and (2) we have \(\varSigma ={\{{ s}\}}\) and
$$\begin{aligned}&{\varGamma \vdash {{{ s}[{\mathtt {p}}]}!\langle {\mathtt {q}},{e}\rangle .{ P}}\triangleright {\varDelta }_1}\end{aligned}$$(8)$$\begin{aligned}&{\varGamma \vdash _{\{s\}} {{ s} : {{h}}} \triangleright {\varDelta }_2} \end{aligned}$$(9)where \({\varDelta }={\varDelta }_2{*}{\varDelta }_1\). Using 2(7) on (8) we have
$$\begin{aligned}&{\varDelta }_1={\varDelta }_1',{{ s}[{\mathtt {p}}]}:{!}\langle {\mathtt {q}},{{{S}}}\rangle .{T}\nonumber \\&\qquad \ \ \ {\varGamma \vdash {{e}}:{{{S}}}}\end{aligned}$$(10)$$\begin{aligned}&\ \ {\varGamma \vdash { P}\triangleright {\varDelta }_1',{{ s}[{\mathtt {p}}]}:{T}}. \end{aligned}$$(11)From (10) by subject reduction on expressions we have
$$\begin{aligned} {\varGamma \vdash {{v}}:{{{S}}}}. \end{aligned}$$(12)Using (QSend) on (9) and (12) we derive
$$\begin{aligned} {\varGamma \vdash _{\{s\}} {{ s} : {{{{h}} \cdot {({\mathtt {p}},{\mathtt {q}},{ v})}}}} \triangleright {\varDelta }_2{;}{\{ {{ s}[{\mathtt {p}}]} : \;{!}\langle {\mathtt {q}},{{{S}}}\rangle \}}}. \end{aligned}$$(13)Using (GInit) on (11) we derive
$$\begin{aligned} {\varGamma \vdash _{\emptyset } { P} \triangleright {\varDelta }_1',{{ s}[{\mathtt {p}}]}:{T}} \end{aligned}$$(14)and then using (GPar) on (14), (13) we conclude
$$\begin{aligned} {\varGamma \vdash _{\{{ s}\}} { P}{\ |\ }{{ s} : {{{{h}} \cdot {({\mathtt {p}},{\mathtt {q}},{ v})}}}} \triangleright ({\varDelta }_2{;}{\{{{ s}[{\mathtt {p}}]} : \;{!}\langle {\mathtt {q}},{{{S}}}\rangle \}}){*}({\varDelta }_1',{{ s}[{\mathtt {p}}]}:{T})}. \end{aligned}$$Note that \({\varDelta }_2{*}({\varDelta }_1',{{ s}[{\mathtt {p}}]}:{!}\langle {\mathtt {q}},{{{S}}}\rangle .{T}) ~\Rightarrow ({\varDelta }_2{;}{\{ {{ s}[{\mathtt {p}}]} : {!}\langle {\mathtt {q}},{{{S}}}\rangle \}}){*}({\varDelta }_1',{{ s}[{\mathtt {p}}]}:{T})\) and the consistency of \(({\varDelta }_2{*}({\varDelta }_1',{{ s}[{\mathtt {p}}]}:{!}\langle {\mathtt {q}},{{{S}}}\rangle .{T})){*}{\varDelta }_0\) implies the consistency of \((({\varDelta }_2{;}{\{ {{ s}[{\mathtt {p}}]} : {!}\langle {\mathtt {q}},{{{S}}}\rangle \}}){*}({\varDelta }_1',{{ s}[{\mathtt {p}}]}:{T})){*}{\varDelta }_0\).
-
[Rcv] \({{{ s}[{\mathtt {p}}]}?( {\mathtt {q}},{x}).{ P}} {\ |\ }{{ s} : {{{({\mathtt {q}},{\{{\mathtt {p}}\}},{ v})} \cdot {{h}}}}} {\longrightarrow }{ P}{\{{{{ v}}} / {{{x}}}\}} {\ |\ }{ s}:{h}\).
By hypothesis, \({\varGamma \vdash _{\varSigma } {{{ s}[{\mathtt {p}}]}?( {\mathtt {q}},{x}).{ P}} {\ |\ }{{ s} : {{{({\mathtt {q}},{\{{\mathtt {p}}\}},{ v})} \cdot {{h}}}}} \triangleright {\varDelta }}.\) By Lemma 3(7), (1), and (2) we have \(\varSigma ={\{{ s}\}}\) and
$$\begin{aligned}&{\varGamma \vdash {{{ s}[{\mathtt {p}}]}?( {\mathtt {q}},{x}).{ P}}\triangleright {\varDelta }_1}\end{aligned}$$(15)$$\begin{aligned}&{\varGamma \vdash _{\{{ s}\}} {{ s} : {{{({\mathtt {q}},{\{{\mathtt {p}}\}},{ v})} \cdot {{h}}}}} \triangleright {\varDelta }_2} \end{aligned}$$(16)where \({\varDelta }={\varDelta }_2{*}{\varDelta }_1\). Using Lemma 2(8) on (15) we have
$$\begin{aligned}&{\varDelta }_1={\varDelta }_1',{{ s}[{\mathtt {p}}]}:{?( {\mathtt {q}},{{{S}}} )}.{T}\nonumber \\&{\varGamma ,{{{x}}}:{{{S}}}\vdash { P}\triangleright {\varDelta }_1',{{ s}[{\mathtt {p}}]}:{T}} \end{aligned}$$(17)Using Lemma 4(1) on (16) we have
$$\begin{aligned}&{\varDelta }_2={\{{{ s}[{\mathtt {q}}]} :\;{!}\langle {\{{\mathtt {p}}\}},{{{S}}}'\rangle \}}{*}{\varDelta }_2'\nonumber \\&\quad \quad \ \ {\varGamma \vdash _{{\{{ s}\}}} {{ s} : {{h}}} \triangleright {\varDelta }_2'}\end{aligned}$$(18)$$\begin{aligned}&{\varGamma \vdash v:{{{S}}}'}. \end{aligned}$$(19)The consistency of \({\varDelta }{*}{\varDelta }_0\) implies \({{{S}}}={{{S}}}'\). Using Lemma 5(1) from (17) and (19) we get
\({\varGamma \vdash { P}{\{{{{ v}}} / {{{x}}}\}}\triangleright {\varDelta }_1',{{ s}[{\mathtt {p}}]}:{T}}\), which implies by rule (GInit)
$$\begin{aligned} {\varGamma \vdash _{\emptyset } { P}{\{{{{ v}}} / {{{x}}}\}} \triangleright {\varDelta }_1',{{ s}[{\mathtt {p}}]}:{T}}. \end{aligned}$$(20)Using rule (GPar) on (20) and (18) we conclude
$$\begin{aligned} {\varGamma \vdash _{\{{ s}\}} { P}{\{{{{ v}}} / {{{x}}}\}}{\ |\ }{ s}:{h} \triangleright {\varDelta }_2'{*}({\varDelta }_1',{s[{\mathtt {p}}]}:{T}}).\end{aligned}$$Note that \(({\{{{ s}[{\mathtt {q}}]} :\;{!}\langle {\{{\mathtt {p}}\}},{{{S}}}\rangle \}}{*}{\varDelta }_2')\,{*}\,({\varDelta }_1',{ s}[{\mathtt {p}}]:{?( {\mathtt {q}},{{{S}}} )};{T})~\Rightarrow {\varDelta }_2'\,{*}\,({\varDelta }_1',{{ s}[{\mathtt {p}}]}:{T})\) and the consistency of \((({\{{{ s}[{\mathtt {q}}]} :\;{!}\langle {\{{\mathtt {p}}\}},{{{S}}}\rangle \}}\,{*}\,{\varDelta }_2')\,{*}\,({\varDelta }_1',{ s}[{\mathtt {p}}]:{?( {\mathtt {q}},{{{S}}} )};{T}))\,{*}\,{\varDelta }_0\) implies the consistency of \(({\varDelta }_2'\,{*}\,({\varDelta }_1',{{ s}[{\mathtt {p}}]}:{T}))\,{*}\,{\varDelta }_0\).
-
[Sel] \({{{{ s}[{\mathtt {p}}]} \oplus {\langle {\mathtt {p}}, l\rangle }.{ P}} {\ |\ }{{ s} : {{h}}}{\longrightarrow }{ P}{\ |\ }{{ s} : {{{{h}} \cdot {({\mathtt {p}},{\mathtt {q}},l)}}}}}\).
By hypothesis, \({\varGamma \vdash _{\varSigma } {{{ s}[{\mathtt {p}}]} \oplus {\langle {\mathtt {q}}, l\rangle }.{ P}} {\ |\ }{{ s} : {{h}}} \triangleright {\varDelta }}\). Using Lemma 3(7), (1), and (2) we have \(\varSigma ={\{{ s}\}}\) and
$$\begin{aligned}&{\varGamma \vdash {{{ s}[{\mathtt {p}}]} \oplus {\langle {\mathtt {q}}, l\rangle }.{ P}}\triangleright {\varDelta }_1}\end{aligned}$$(21)$$\begin{aligned}&{\varGamma \vdash _{\{{ s}\}} {{ s} : {{h}}} \triangleright {\varDelta }_2} \end{aligned}$$(22)where \({\varDelta }={\varDelta }_2\,{*}\,{\varDelta }_1\). Using Lemma 2(2) on (21) we have for \(l=l_j\) \((j\in I)\):
$$\begin{aligned}&{\varDelta }_1={\varDelta }_1',{ s}[{\mathtt {p}}]:\oplus \langle {\mathtt {q}},\{l_i:{T}_i\}_{i\in I} \rangle \nonumber \\&\qquad \ \ {\varGamma \vdash { P}\triangleright {\varDelta }_1',{ s}[{\mathtt {p}}]:T_j}. \end{aligned}$$(23)Using rule (QSel) on (22) we derive
$$\begin{aligned} {\varGamma \vdash _{\{s\}} {{ s} : {{{{h}} \cdot {({\mathtt {p}},{\mathtt {q}},l)}}}} \triangleright {\varDelta }_2{;}{\{ {{ s}[{\mathtt {p}}]} : \oplus \langle {\mathtt {q}},l\rangle \}}}. \end{aligned}$$(24)Using (GPar) on (23) and (24) we conclude
$$\begin{aligned} {\varGamma \vdash _{\{{ s}\}} { P}{\ |\ }{{ s} : {{{{h}} \cdot {({\mathtt {p}},{\mathtt {q}},l)}}}} \triangleright ({\varDelta }_2{;}{\{ {{ s}[{\mathtt {p}}]} : \oplus \langle {\mathtt {q}},l\rangle \}}){*}({\varDelta }_1', {{ s}[{\mathtt {p}}]} : {T}_j )}. \end{aligned}$$Note that \({\varDelta }_2\,{*}\,({\varDelta }_1',{ s}[{\mathtt {p}}]:\oplus \langle {\mathtt {q}},\{l_i:{T}_i\}_{i\in I} \rangle )~\Rightarrow ({\varDelta }_2{;}{\{ {{ s}[{\mathtt {p}}]} : \oplus \langle {\mathtt {q}},l\rangle \}})\,{*}\,({\varDelta }_1', {{ s}[{\mathtt {p}}]} : {T}_j )\) and the consistency of \(({\varDelta }_2\,{*}\,({\varDelta }_1',{ s}[{\mathtt {p}}]:\oplus \langle {\mathtt {q}},\{l_i:{T}_i\}_{i\in I} \rangle ))\,{*}\,{\varDelta }_0\) implies the consistency of \((({\varDelta }_2{;}{\{ {{ s}[{\mathtt {p}}]} :\oplus \langle {\mathtt {q}},l\rangle \}})\,{*}\,({\varDelta }_1', {{ s}[{\mathtt {p}}]} : {T}_j ))\,{*}\,{\varDelta }_0\).
-
[Branch] \( {{{ s}[{\mathtt {p}}]} \& ({{\mathtt {q}}},{\{L_i : { P}_i\}_{i \in I}})} {\ |\ }{{ s} : {{{({\mathtt {q}},{\{{\mathtt {p}}\}},l_{j})} \cdot {{h}}}}} {\longrightarrow }{ P}_{j} {\ |\ }{ s}:{h}\).
By hypothesis, \( {\varGamma \vdash _{\varSigma } {{{ s}[{\mathtt {p}}]} \& ({{\mathtt {q}}},{\{L_i : { P}_i\}_{i \in I}})} {\ |\ }{{ s} : {{{({\mathtt {q}},{\{{\mathtt {p}}\}},l_{j})} \cdot {{h}}}}} \triangleright {\varDelta }}\). Using Lemma 3(7), (1), and (2) we have \(\varSigma ={\{{ s}\}}\) and
$$ \begin{aligned}&{\varGamma \vdash {{{ s}[{\mathtt {p}}]} \& ({{\mathtt {q}}},{\{L_i : { P}_i\}_{i \in I}})}\triangleright {\varDelta }_1}\end{aligned}$$(25)$$\begin{aligned}&{\varGamma \vdash _{\{{ s}\}} {{ s} : {{{({\mathtt {q}},{\{{\mathtt {p}}\}},l_{j})} \cdot {{h}}}}} \triangleright {\varDelta }_2} \end{aligned}$$(26)where \({\varDelta }={\varDelta }_2\,{*}\,{\varDelta }_1\). Using Lemma 2(12) on (25) we have
$$ \begin{aligned}&{\varDelta }_1={\varDelta }_1', {{ s}[{\mathtt {p}}]}: \& ({\mathtt {q}},\{l_i:T_i\}_{i\in I})\nonumber \\&\ \ {\varGamma \vdash { P}_i\triangleright {\varDelta }_1',{{ s}[{\mathtt {p}}]}:{T}_i}\ \ \ \forall i\in I. \end{aligned}$$(27)Using Lemma 4(3) on (26) we have
$$\begin{aligned}&{\varDelta }_2={\{{{ s}[{\mathtt {q}}]} :\oplus \langle {\mathtt {p}},l_j\rangle \}}\,{*}\,{\varDelta }_2'\nonumber \\&\quad \quad \ \, {\varGamma \vdash _{\{s\}} {{ s} : {h}} \triangleright {\varDelta }_2'}. \end{aligned}$$(28)Using (GPar) on (27) and (28) we conclude
$$\begin{aligned} {\varGamma \vdash _{\{{ s}\}} { P}_{j} {\ |\ }{ s}:h \triangleright {\varDelta }_2'\,{*}\,({\varDelta }_1',{{ s}[{\mathtt {p}}]}:{T}_{j})}. \end{aligned}$$Note that
$$ \begin{aligned} ({\{{{ s}[{\mathtt {q}}]} :\oplus \langle {\mathtt {p}},l_j\rangle \}}\,{*}\,{\varDelta }_2')\,{*}\,({\varDelta }_1', {{ s}[{\mathtt {p}}]}: \& ({\mathtt {q}},\{l_{i}:T_i\}_{i\in I}))~\Rightarrow {\varDelta }_2'\,{*}\,({\varDelta }_1',{{ s}[{\mathtt {p}}]}:{T}_{j}). \end{aligned}$$and the consistency of \( (({\{{{ s}[{\mathtt {q}}]} \!:\!\oplus \langle {\mathtt {p}},l_j\rangle \}}{*}{\varDelta }_2')\,{*}\,({\varDelta }_1', {{ s}[{\mathtt {p}}]}\!:\! \& ({\mathtt {q}},\{l_{i}\!:\!T_i\}_{i\in I})))\,{*}\,{\varDelta }_0\) implies the consistency of \(({\varDelta }_2'\,{*}\,({\varDelta }_1',{{ s}[{\mathtt {p}}]}:{T}_{j}))\,{*}\,{\varDelta }_0\) for \(j\in I\) \(\square \)
Theorem 1 (Subject Reduction). If \({\varGamma \vdash _{\varSigma } { P} \triangleright {\varDelta }}\) with \({\varDelta }\) consistent and \({{ P}{\longrightarrow }^*{ P}'}\), then \({\varGamma \vdash _{\varSigma } { P}' \triangleright {{\varDelta }'}}\) for some consistent \({{\varDelta }'}\) such that \({{{\varDelta }}~\Rightarrow ^*~{{{\varDelta }'}}}\).
Proof
Let \({ P}\equiv {\mathcal {E}}[{ P}_0]\) and \({ P}'\equiv {\mathcal {E}}[{ P}_0']\), where \({{ P}_0{\longrightarrow }{ P}_0'}\) by one of the rules considered in Lemma 1. By structural equivalence we can assume \({\mathcal {E}}{=}(\overrightarrow{\nu a})(\overrightarrow{{{\mathsf{def}}\ {D}\ {\mathsf{in}}\ }}(\overrightarrow{\nu { s}})([\;]{\ |\ }{ P}_1))\) without loss of generality. Theorem 2 and Lemma 3(9), (10) and (8) applied to \({\varGamma \vdash _{\varSigma } { P} \triangleright {\varDelta }}\) give \({\varGamma , \overrightarrow{a:\mathsf {{G}}}, \overrightarrow{X:S\,\mu \mathbf t .T} \vdash _{\varSigma _0} { P}_0 \triangleright {\varDelta }_0}\), and \({\varGamma , \overrightarrow{a:\mathsf {{G}}}, \overrightarrow{X:S\,\mu \mathbf t .T} \vdash _{\varSigma _1} { P}_1 \triangleright {\varDelta }_1}\) and \(\overrightarrow{{\varGamma , \overrightarrow{a:\mathsf {{G}}}, X:S\;\mathbf t \vdash _{} {Q} \triangleright {\{y:T\}}}} \), where \(\overrightarrow{D}=\overrightarrow{X(x,y)=Q}\), \(\varSigma =(\varSigma _0\cup \varSigma _1)\setminus \overrightarrow{{ s}}\) and \({\varDelta }=({\varDelta }_0\,{*}\,{\varDelta }_1)\setminus \overrightarrow{{ s}}\). The consistency of \({\varDelta }\) implies the consistency of \({\varDelta }_0\,{*}\,{\varDelta }_1\) by Lemma 3(8). By Lemma 1 there is \({\varDelta }_0'\) such that \({\varGamma , \overrightarrow{a:\mathsf {{G}}}, \overrightarrow{X:S\,\mu \mathbf t .T} \vdash _{\varSigma _0} { P}'_0 \triangleright {\varDelta }'_0}\) and \({{{\varDelta }_0}~\Rightarrow ^*~{{\varDelta }_0'}}\) and \({\varDelta }'_0\,{*}\,{\varDelta }_1\) is consistent. We derive \({\varGamma \vdash _{\varSigma } { P}' \triangleright {{\varDelta }'}}\), where \({\varDelta }'= ({\varDelta }_0\,{*}\,{\varDelta }'_1)\setminus \overrightarrow{{ s}}\) by applying typing rules (GPar), (GSRes), (GDef) and (GNRes). Observe that \({{{\varDelta }}~\Rightarrow ^*~{{\varDelta }'}}\) and \({\varDelta }'\) is consistent. \(\square \)
Rights and permissions
Copyright information
© 2015 Springer International Publishing Switzerland
About this chapter
Cite this chapter
Coppo, M., Dezani-Ciancaglini, M., Padovani, L., Yoshida, N. (2015). A Gentle Introduction to Multiparty Asynchronous Session Types. In: Bernardo, M., Johnsen, E. (eds) Formal Methods for Multicore Programming. SFM 2015. Lecture Notes in Computer Science(), vol 9104. Springer, Cham. https://doi.org/10.1007/978-3-319-18941-3_4
Download citation
DOI: https://doi.org/10.1007/978-3-319-18941-3_4
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-18940-6
Online ISBN: 978-3-319-18941-3
eBook Packages: Computer ScienceComputer Science (R0)