dl
play

DL A Linear -Calculus with Dependent Types in Agda Luca Ciccone - PowerPoint PPT Presentation

DL A Linear -Calculus with Dependent Types in Agda Luca Ciccone Luca Padovani 5 June 2020 Luca Ciccone, Luca Padovani DL 5 June 2020 1 / 33 Motivation and Goal Motivation and Goal 1 DL - Language 2 DL - Agda Formalization 3


  1. DL π A Linear π -Calculus with Dependent Types in Agda Luca Ciccone Luca Padovani 5 June 2020 Luca Ciccone, Luca Padovani DL π 5 June 2020 1 / 33

  2. Motivation and Goal Motivation and Goal 1 DL π - Language 2 DL π - Agda Formalization 3 Examples 4 Encoding 5 Conclusions 6 Luca Ciccone, Luca Padovani DL π 5 June 2020 2 / 33

  3. Motivation and Goal Motivation Session types = linear channels + pairs + sums [Dardha et al., 2017] Session = chain of one-shot communications Messages are pairs : payload + continuation channel Luca Ciccone, Luca Padovani DL π 5 June 2020 3 / 33

  4. Motivation and Goal Motivation Session types = linear channels + pairs + sums [Dardha et al., 2017] Session = chain of one-shot communications Messages are pairs : payload + continuation channel Dependent session types = linear channels + dependent pairs? Value-dependent session types [Toninho et al., 2011] Liquid Pi [Griffith and Gunter, 2013] Dependent protocols in Idris [Brady, 2017] Dependent session-typed processes [Toninho and Yoshida, 2018] Label-dependent session types [Thiemann and Vasconcelos, 2020] Luca Ciccone, Luca Padovani DL π 5 June 2020 3 / 33

  5. Motivation and Goal Motivation Session types = linear channels + pairs + sums [Dardha et al., 2017] Session = chain of one-shot communications Messages are pairs : payload + continuation channel Dependent session types = linear channels + dependent pairs? Value-dependent session types [Toninho et al., 2011] Liquid Pi [Griffith and Gunter, 2013] Dependent protocols in Idris [Brady, 2017] Dependent session-typed processes [Toninho and Yoshida, 2018] Label-dependent session types [Thiemann and Vasconcelos, 2020] Yes! Luca Ciccone, Luca Padovani DL π 5 June 2020 3 / 33

  6. Motivation and Goal Goal Develop a minimal, Agda-based, linear π -calculus with dependent pairs ( DL π ) in which dependent session types can be encoded Luca Ciccone, Luca Padovani DL π 5 June 2020 4 / 33

  7. Motivation and Goal Goal Develop a minimal, Agda-based, linear π -calculus with dependent pairs ( DL π ) in which dependent session types can be encoded Analogous expressiveness of Brady [2017]’s DSL and Toninho and Yoshida [2018]’s calculus, but: different type structure linear channels + dependent pairs instead of session types Agda mechanisation of the metatheory we lift from Agda all the machinery related to dependent types computation of data-dependent types and processes Luca Ciccone, Luca Padovani DL π 5 June 2020 4 / 33

  8. DL π - Language Motivation and Goal 1 DL π - Language 2 DL π - Agda Formalization 3 Examples 4 Encoding 5 Conclusions 6 Luca Ciccone, Luca Padovani DL π 5 June 2020 5 / 33

  9. DL π - Language DL π - Processes M , N ::= p pure term Terms | u name | M , N pair Processes P , Q ::= idle inaction | u ( x ) . P input | u � M � output | let x , y = M in P pair splitting | P | Q parallel composition | ( a ) P restriction | ∗ P replication Luca Ciccone, Luca Padovani DL π 5 June 2020 6 / 33

  10. DL π - Language DL π - Processes M , N ::= p pure term Terms | u name | M , N pair Processes P , Q ::= idle inaction | u ( x ) . P input | u � M � output | let x , y = M in P pair splitting | P | Q parallel composition | ( a ) P restriction | ∗ P replication Pure terms injected in DL π Luca Ciccone, Luca Padovani DL π 5 June 2020 6 / 33

  11. DL π - Language DL π - Types Domains A , B ∈ A pure types σ , ρ ∈ { 0 , 1 , ω } multiplicities t , s ::= A pure type Types σ , ρ [ t ] | channel type | Σ( x : t ) s linear dependent pair Luca Ciccone, Luca Padovani DL π 5 June 2020 7 / 33

  12. DL π - Language DL π - Types Domains A , B ∈ A pure types σ , ρ ∈ { 0 , 1 , ω } multiplicities t , s ::= A pure type Types σ , ρ [ t ] | channel type | Σ( x : t ) s linear dependent pair Multiplicities can be combined with a sum Luca Ciccone, Luca Padovani DL π 5 June 2020 7 / 33

  13. DL π - Language DL π - Types Domains A , B ∈ A pure types σ , ρ ∈ { 0 , 1 , ω } multiplicities t , s ::= A pure type Types σ , ρ [ t ] | channel type | Σ( x : t ) s linear dependent pair Multiplicities can be combined with a sum 1 + 1 = ω , ω + ω = ω Luca Ciccone, Luca Padovani DL π 5 June 2020 7 / 33

  14. DL π - Language DL π - Types Domains A , B ∈ A pure types σ , ρ ∈ { 0 , 1 , ω } multiplicities t , s ::= A pure type Types σ , ρ [ t ] | channel type | Σ( x : t ) s linear dependent pair Multiplicities can be combined with a sum 1 + 1 = ω , ω + ω = ω Types can be combined Luca Ciccone, Luca Padovani DL π 5 June 2020 7 / 33

  15. DL π - Language DL π - Types Domains A , B ∈ A pure types σ , ρ ∈ { 0 , 1 , ω } multiplicities t , s ::= A pure type Types σ , ρ [ t ] | channel type | Σ( x : t ) s linear dependent pair Multiplicities can be combined with a sum 1 + 1 = ω , ω + ω = ω Types can be combined Partial operation (in Agda represented as a relation ) Luca Ciccone, Luca Padovani DL π 5 June 2020 7 / 33

  16. DL π - Language DL π - Types Domains A , B ∈ A pure types σ , ρ ∈ { 0 , 1 , ω } multiplicities t , s ::= A pure type Types σ , ρ [ t ] | channel type | Σ( x : t ) s linear dependent pair Multiplicities can be combined with a sum 1 + 1 = ω , ω + ω = ω Types can be combined Partial operation (in Agda represented as a relation ) Pairs are linear Luca Ciccone, Luca Padovani DL π 5 June 2020 7 / 33

  17. DL π - Language Parallel composition t-par Γ 1 ⊢ P Γ 2 ⊢ Q Γ 1 + Γ 2 ⊢ P | Q Luca Ciccone, Luca Padovani DL π 5 June 2020 8 / 33

  18. DL π - Language Parallel composition t-par Γ 1 ⊢ P Γ 2 ⊢ Q Γ 1 + Γ 2 ⊢ P | Q Resources are combined Γ 1 + Γ 2 = Γ 1 , Γ 2 dom(Γ 1 ) ∩ dom(Γ 2 ) = ∅ ( u : t , Γ 1 ) + ( u : s , Γ 2 ) = ( u : t + s ) , (Γ 1 + Γ 2 ) Luca Ciccone, Luca Padovani DL π 5 June 2020 8 / 33

  19. DL π - Language Parallel composition t-par Γ 1 ⊢ P Γ 2 ⊢ Q Γ 1 + Γ 2 ⊢ P | Q Resources are combined Γ 1 + Γ 2 = Γ 1 , Γ 2 dom(Γ 1 ) ∩ dom(Γ 2 ) = ∅ ( u : t , Γ 1 ) + ( u : s , Γ 2 ) = ( u : t + s ) , (Γ 1 + Γ 2 ) Sum of types 1 , 0 [ t ] + 0 , 1 [ t ] = 1 , 1 [ t ] Luca Ciccone, Luca Padovani DL π 5 June 2020 8 / 33

  20. DL π - Language Receive - Send t-input t-output Γ 1 ⊢ u : 1 , 0 [ t ] Γ 1 ⊢ u : 0 , 1 [ t ] Γ 2 , x : t ⊢ P Γ 2 ⊢ M : t Γ 1 + Γ 2 ⊢ u ( x ) . P Γ 1 + Γ 2 ⊢ u � M � Resources must be combined Luca Ciccone, Luca Padovani DL π 5 June 2020 9 / 33

  21. DL π - Language Receive - Send t-input t-output Γ 1 ⊢ u : 1 , 0 [ t ] Γ 1 ⊢ u : 0 , 1 [ t ] Γ 2 , x : t ⊢ P Γ 2 ⊢ M : t Γ 1 + Γ 2 ⊢ u ( x ) . P Γ 1 + Γ 2 ⊢ u � M � Resources must be combined Linear channels Input 1 , 0 Output 0 , 1 Luca Ciccone, Luca Padovani DL π 5 June 2020 9 / 33

  22. DL π - Language Receive - Send t-input t-output Γ 1 ⊢ u : 1 , 0 [ t ] Γ 1 ⊢ u : 0 , 1 [ t ] Γ 2 , x : t ⊢ P Γ 2 ⊢ M : t Γ 1 + Γ 2 ⊢ u ( x ) . P Γ 1 + Γ 2 ⊢ u � M � Resources must be combined Linear channels Input 1 , 0 Output 0 , 1 Luca Ciccone, Luca Padovani DL π 5 June 2020 9 / 33

  23. DL π - Language Dependent Pairs t-pair Γ 1 ⊢ M : t Γ 2 ⊢ N : s { � M � / x } Γ 1 + Γ 2 ⊢ M , N : Σ( x : t ) s Luca Ciccone, Luca Padovani DL π 5 June 2020 10 / 33

  24. DL π - Language Dependent Pairs t-pair Γ 1 ⊢ M : t Γ 2 ⊢ N : s { � M � / x } Γ 1 + Γ 2 ⊢ M , N : Σ( x : t ) s Filter function introduced Luca Ciccone, Luca Padovani DL π 5 June 2020 10 / 33

  25. DL π - Language Dependent Pairs t-pair Γ 1 ⊢ M : t Γ 2 ⊢ N : s { � M � / x } Γ 1 + Γ 2 ⊢ M , N : Σ( x : t ) s Filter function introduced Map from DL π terms to pure terms � p � = p � x � = x � a � = tt � M , N � = � M � , � N � Luca Ciccone, Luca Padovani DL π 5 June 2020 10 / 33

  26. DL π - Language Dependent Pairs t-pair Γ 1 ⊢ M : t Γ 2 ⊢ N : s { � M � / x } Γ 1 + Γ 2 ⊢ M , N : Σ( x : t ) s Filter function introduced Map from DL π terms to pure terms � p � = p � x � = x � a � = tt � M , N � = � M � , � N � From the point of view of types � σ , ρ [ t ] � = ⊤ � A � = A � Σ( x : t ) s � = Σ( x : � t � ) � s � Luca Ciccone, Luca Padovani DL π 5 June 2020 10 / 33

  27. DL π - Language Dependent Pairs t-pair Γ 1 ⊢ M : t Γ 2 ⊢ N : s { � M � / x } Γ 1 + Γ 2 ⊢ M , N : Σ( x : t ) s Filter function introduced Map from DL π terms to pure terms � p � = p � x � = x � a � = tt � M , N � = � M � , � N � From the point of view of types � σ , ρ [ t ] � = ⊤ � A � = A � Σ( x : t ) s � = Σ( x : � t � ) � s � Channels are erased Luca Ciccone, Luca Padovani DL π 5 June 2020 10 / 33

  28. DL π - Language Dependent Pairs t-pair Γ 1 ⊢ M : t Γ 2 ⊢ N : s { � M � / x } Γ 1 + Γ 2 ⊢ M , N : Σ( x : t ) s Filter function introduced Map from DL π terms to pure terms � p � = p � x � = x � a � = tt � M , N � = � M � , � N � From the point of view of types � σ , ρ [ t ] � = ⊤ � A � = A � Σ( x : t ) s � = Σ( x : � t � ) � s � Channels are erased No dependency on channels Luca Ciccone, Luca Padovani DL π 5 June 2020 10 / 33

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend