contracts for mobile processes
play

Contracts for Mobile Processes Giuseppe Castagna Luca Padovani - PowerPoint PPT Presentation

Contracts for Mobile Processes Giuseppe Castagna Luca Padovani Laboratoire PPS, CNRS, Universit e Paris Diderot Istituto di Scienze e Tecnologie dellInformazione, Universit` a di Urbino CONCUR 2009 [ slides by L.Padovani ] Contracts for


  1. Contracts for Mobile Processes Giuseppe Castagna Luca Padovani Laboratoire PPS, CNRS, Universit´ e Paris Diderot Istituto di Scienze e Tecnologie dell’Informazione, Universit` a di Urbino CONCUR 2009 [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 1 / 24

  2. Outline 1 Motivation Protocols and processes Contracts and mobile systems 2 Contracts Syntax Semantics 3 Results 4 Concluding remarks [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 2 / 24

  3. Protocols and processes Session types • prescriptions on the use of channels u : σ, v : τ, · · · ⊢ P Contracts • overall process behavior u : Ch , v : Ch , · · · ⊢ P : T Summary • both are behavioral types • σ = projection of T on u [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 3 / 24

  4. What session types and contracts are for Characterizing well-formed systems • the system eventually terminates • the system never deadlocks Characterizing well-typed processes • sent messages have the correct/expected type • messages sent/delivered in the right order Reasoning about processes by means of their type • refactoring processes • searching for services [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 4 / 24

  5. A problem of abstraction Session types Contracts ? Int . ? Int . (! Real ⊕ ! Error ) a . a . ( b ⊕ c ) ?(! Bool . ! Bool ) a ? A natural candidate Contracts without channel passing ⇒ ccs Contracts with channel passing ⇒ π -calculus [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 5 / 24

  6. A problem of abstraction Session types Contracts ? Int . ? Int . (! Real ⊕ ! Error ) a . a . ( b ⊕ c ) ?(! Bool . ! Bool ) a ? A natural candidate Contracts without channel passing ⇒ ccs Contracts with channel passing ⇒ π -calculus [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 5 / 24

  7. An example process store ?( x ) . x ?( y : Item ) . if y is in stock then bank ! � x � else x ! � available( y ) � ⇓ contract store ?( x ) . x ? Item . ( bank ! x . 1 ⊕ x ! Date . 1 ) [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 6 / 24

  8. An example process store ?( x ) . x ?( y : Item ) . if y is in stock then bank ! � x � else x ! � available( y ) � ⇓ contract store ?( x ) . x ? Item . ( bank ! x . 1 ⊕ x ! Date . 1 ) [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 6 / 24

  9. An example process store ?( x ) . x ?( y : Item ) . if y is in stock then bank ! � x � else x ! � available( y ) � ⇓ contract store ?( x ) . x ? Item . ( bank ! x . 1 ⊕ x ! Date . 1 ) [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 6 / 24

  10. An example process store ?( x ) . x ?( y : Item ) . if y is in stock then bank ! � x � else x ! � available( y ) � ⇓ contract store ?( x ) . x ? Item . ( bank ! x . 1 ⊕ x ! Date . 1 ) [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 6 / 24

  11. Some typing rules v-send v-recv Γ ⊢ e : t Γ ⊢ P : T Γ , x : t ⊢ P : T Γ ⊢ α ! e . P : α ! t . T Γ ⊢ α ?( x : t ) . P : α ? t . T c-send c-recv Γ ⊢ P : T Γ , x : Ch ⊢ P : T Γ ⊢ α ! � β � . P : α ! β. T Γ ⊢ α ? � x � . P : α ?( x ) . T [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 7 / 24

  12. Some typing rules v-send v-recv Γ ⊢ e : t Γ ⊢ P : T Γ , x : t ⊢ P : T Γ ⊢ α ! e . P : α ! t . T Γ ⊢ α ?( x : t ) . P : α ? t . T c-send c-recv Γ ⊢ P : T Γ , x : Ch ⊢ P : T Γ ⊢ α ! � β � . P : α ! β. T Γ ⊢ α ? � x � . P : α ?( x ) . T undecidable → decidable [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 7 / 24

  13. Outline 1 Motivation Protocols and processes Contracts and mobile systems 2 Contracts Syntax Semantics 3 Results 4 Concluding remarks [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 8 / 24

  14. Syntax failure, success ::= 0 | 1 π. T | T + T | T ⊕ T T | T | ( ν a ) T T ::= α ? f | α ! f | α !( a ) π x | ( x ) | a | Int | Bool | · · · f ::= Infinite behaviors = infinite terms • regularity X = c ? Int . X • boundedness X = a ?( x ) . ( c ! x . 1 | X ) [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 9 / 24

  15. Syntax dynamic operators ::= 0 | 1 π. T | T + T | T ⊕ T T | T | ( ν a ) T T ::= α ? f | α ! f | α !( a ) π x | ( x ) | a | Int | Bool | · · · f ::= Infinite behaviors = infinite terms • regularity X = c ? Int . X • boundedness X = a ?( x ) . ( c ! x . 1 | X ) [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 9 / 24

  16. Syntax systems ::= 0 | 1 π. T | T + T | T ⊕ T T | T | ( ν a ) T T ::= α ? f | α ! f | α !( a ) π x | ( x ) | a | Int | Bool | · · · f ::= Infinite behaviors = infinite terms • regularity X = c ? Int . X • boundedness X = a ?( x ) . ( c ! x . 1 | X ) [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 9 / 24

  17. Syntax ::= 0 | 1 π. T | T + T | T ⊕ T T | T | ( ν a ) T T ::= α ? f | α ! f | α !( a ) prefixes π x | ( x ) | a | Int | Bool | · · · f ::= Infinite behaviors = infinite terms • regularity X = c ? Int . X • boundedness X = a ?( x ) . ( c ! x . 1 | X ) [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 9 / 24

  18. Syntax ::= 0 | 1 π. T | T + T | T ⊕ T T | T | ( ν a ) T T ::= α ? f | α ! f | α !( a ) π x | ( x ) | a | Int | Bool | · · · f ::= Infinite behaviors = infinite terms patterns = sets of values and names + binders • regularity X = c ? Int . X • boundedness X = a ?( x ) . ( c ! x . 1 | X ) [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 9 / 24

  19. Syntax ::= 0 | 1 π. T | T + T | T ⊕ T T | T | ( ν a ) T T ::= α ? f | α ! f | α !( a ) π x | ( x ) | a | Int | Bool | · · · f ::= Infinite behaviors = infinite terms • regularity X = c ? Int . X • boundedness X = a ?( x ) . ( c ! x . 1 | X ) [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 9 / 24

  20. Labeled operational semantics � − → 1 1 m ∈ f � σ m ∈ f c ! m c ! m . T − → T c ? m c ? f . T − → T σ c ! f . T − → c ! m . T 20 ∈ Int 20 ∈ Real � ∅ Example � c ! Int . 1 | c ? Real . 1 − → c !20 . 1 | c ? Real . 1 − → 1 | 1 − → [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 10 / 24

  21. Contracts as behavioral types Systems def = T 1 | T 2 | · · · | T n S 1 when is a system well-formed? 2 when is a process well-typed? 3 when are two types equal? [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 11 / 24

  22. Participant satisfaction Definition ⇒ T ′ | S ′ and T ′ � T ⊳ S if T | S = − → implies • T ′ µ 1 → and S ′ µ 2 − ⇒ = • µ 1 # µ 2 ( c ! m # c ? m , � # � ) for some µ 1 and µ 2 Examples • c ! Int . 1 ⊳ c ? Real . 1 • c ! Real . 1 � ⊳ c ? Int . 1 √ c ! Real . 1 | c ? Int . 1 − → c ! 2 . 1 | c ? Int . 1 stuck [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 12 / 24

  23. Well-formed systems def = T 1 | T 2 | · · · | T n S Definition � S is well formed if for every 1 ≤ k ≤ n T k ⊳ T i i ∈{ 1 ,..., n }\{ k } Examples • c ! Int . 1 | c ? Real . 1 is well formed • c ! Real . 1 | c ? Int . 1 is ill formed [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 13 / 24

  24. Well-typed participant Definition T is viable if T | S is well formed for some S Example def T = c ? Int . 1 + c ? Bool . 0 def = c ? Int . 0 + c ? Bool . 1 S • T is viable • S is viable • T ⊕ S is not viable [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 14 / 24

  25. Example: global order on channels def P = a ? � x � . b ? � y � . x !3 . x ?( z : Int ) . y ! true . 0 def P ′ = a ? � x � . b ? � y � . x !3 . y ! true . x ?( z : Int ) . 0 def Q = a !( c ) . b !( d ) . c ?( z : Int ) . d ?( z : Bool ) . c !5 . 0 a !( c ) . b !( d ) . c ?( z : Int ) . c !5 . d ?( z ′ : Bool ) . 0 def Q ′ = • deadlock because of cyclic dependency • T P | T Q ill-formed ( not viable! ) [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 15 / 24

  26. Example: global order on channels def P = a ? � x � . b ? � y � . x !3 . x ?( z : Int ) . y ! true . 0 def P ′ = a ? � x � . b ? � y � . x !3 . y ! true . x ?( z : Int ) . 0 def Q = a !( c ) . b !( d ) . c ?( z : Int ) . d ?( z : Bool ) . c !5 . 0 a !( c ) . b !( d ) . c ?( z : Int ) . c !5 . d ?( z ′ : Bool ) . 0 def Q ′ = • imposing global order • T P | T Q ′ well-formed [ slides by L.Padovani ] Contracts for Mobile Processes (G.Castagna/L.Padovani) CONCUR 2009 15 / 24

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