towards refinable choreographies
play

Towards Refinable Choreographies Ugo deLiguoro a , Hern an Melgratti - PowerPoint PPT Presentation

Introduction Choreographies A type system Refinement Conclusions Towards Refinable Choreographies Ugo deLiguoro a , Hern an Melgratti b , Emilio Tuosto c a - University of Turin, Italy b - Universidad de Buenos Aires, Argentina c - Gran


  1. Introduction Choreographies A type system Refinement Conclusions Towards Refinable Choreographies Ugo de’Liguoro a , Hern´ an Melgratti b , Emilio Tuosto c a - University of Turin, Italy b - Universidad de Buenos Aires, Argentina c - Gran Sasso Science Institute, Italy ICE 2020 - 19th June Research partly supported by the EU H2020 RISE programme under the Marie Sk� lodowska-Curie grant agreement No 778233. de’Liguoro, Melgratti, Tuosto Towards Refinable Choreographies

  2. Introduction Choreographies A type system Refinement Conclusions W3C service choreography : project comply Local Local Global view view systems A major issue with choreographies is lack of modularity “The basic pattern of my approach will be to compose the program in minute steps, deciding each time as little as possible. As the problem analysis proceeds, so does the further refinement of my program” E. W. Dijkstra: Notes on Structured Programming We propose a framework of step-by-step refinement of abstract choreographies into concrete ones de’Liguoro, Melgratti, Tuosto Towards Refinable Choreographies

  3. Introduction Choreographies A type system Refinement Conclusions Global choreographies Syntax of global choreographies ( g-choreographies for short), G : → B | G; G ′ | G | G ′ | G + G ′ m G ::= 0 | A − Example: md req done − − → S + C − − → S; S − − → C C Adding refinable (and multiple) interaction: m1 ... mn G ::= · · · | A ������� B 1 . . . B n Which are legal refinements of the following? md req done C ���� S + C ���� S; S ����� C Sound and wrong refinements: md req stats done − − → S + C − − → S; (S − − → C; S − − → C) C ✓ req md md stats done (C − − → B; B − − → S) + C − − → S; (S − − → C; S − − → C) ✗ md md start req stats done (C − − → B; B − − → S) + (C − − → B; B − − → S); (S − − → C; S − − → C) ✓ de’Liguoro, Melgratti, Tuosto Towards Refinable Choreographies

  4. Introduction Choreographies A type system Refinement Conclusions Well-formed choreographies � E if certain conditions are satisfied [ [G] ] = ⊥ otherwise where E = ( E , ≤ , # , λ ) is a labelled (prime) event structure , namely ( E , ≤ ) is a poset, # ⊆ E 2 s.t. for all e , e ′ , e ′′ ∈ E : { e ′ ∈ E | e ′ ≤ e } is finite e # e ′ & e ′ ≤ e ′′ = ⇒ e # e ′′ λ : E → M with λ ( e ) = A B!m “A sends m to B” (whose subject is A) λ ( e ) = A B?m “B receives m from A” (whose subject is B) ] � = ⊥ . We say that G is well-formed if [ [G] de’Liguoro, Melgratti, Tuosto Towards Refinable Choreographies

  5. Introduction Choreographies A type system Refinement Conclusions Well-branched choice A branch of E = ( E , ≤ , # , λ ) is a maximal subest x ⊆ E of conflict free events (also called a maximal configuration ) [ [G 1 ] ] = E 1 and [ [G 2 ] ] = E 2 are well-branched if there is a unique active A that locally and unambiguously decides which branch to take in a choice all B � = A either behaves the same in all branches, or its behaviour functionally depends on the messages it receives on each branch A opted for: these are passive where the actives and passives are participants of G 1 , G 2 (and so subjects of labels of E 1 , E 2 ) de’Liguoro, Melgratti, Tuosto Towards Refinable Choreographies

  6. Introduction Choreographies A type system Refinement Conclusions A well-formed choreography req md stats done Consider G = C − − → S + C − − → S; S − − → C; S − − → C C S!req C S!md C S?req req md stats done [ [C − − → S] ] = and [ [C − − → S; S − − → C; S − − → C] ] = C S?md S C!stats S C!done S C?stats S C?done md The sum operation on event structures introduces conflicts between the events in [ [C − − → S] ] and req stats done those in [ [C − − → S; S − − → C; S − − → C] ], hence: # C S!req C S!md C S?md C S?req md req stats done [ [G] ] = [ [C − − → S] ] + [ [C − − → S; S − − → C; S − − → C] ] = S C!stats S C!done S C?stats S C?done de’Liguoro, Melgratti, Tuosto Towards Refinable Choreographies

  7. Introduction Choreographies A type system Refinement Conclusions Breaking well-branchedness On the contrary G ′ = C req md md done − − → B; B − − → S + C − − → S; S − − → C C S!req C B!md C B?md C S?req req md md stats done [ [C − − → B; B − − → S] ] = and [ [C − − → S; S − − → C; S − − → C] ] = B S!md S C!stats S C!done B S?done S C?stats S C?done but # C S!req C B!md C B?md C S?req B S!md S C!stats S C!done B S?done S C?stats S C?done is not well-branched because of B which is not passive in the right branch de’Liguoro, Melgratti, Tuosto Towards Refinable Choreographies

  8. Introduction Choreographies A type system Refinement Conclusions Abstracting properties of well-formed choreographies To determine when [ [G 1 ⊙ G 2 ] ] � = ⊥ it suffices to know: the set Π i of participants of G i the set φ i = min ([ [G i ] ] ↾ A) of the (labels of) the minimal events in the projection of [ [G i ] ] to A, for all A ∈ Π i the set Λ i = max ([ [G i ] ] ↾ A) of the (labels of) the maximal events in the projection of [ [G i ] ] to A, for all A ∈ Π i Idea We introduce a typing judgement Π ⊢ G : � φ, Λ � meaning that Π = P (G), φ and Λ are the minimal and maximal actions of all participants in G respectively, and define typing rules that are sound w.r.t. well-formedness de’Liguoro, Melgratti, Tuosto Towards Refinable Choreographies

  9. Introduction Choreographies A type system Refinement Conclusions Type rules for interaction and sequencing φ = Λ = { A B!m , A B?m } t-int m { A , B } ⊢ A − → B : � φ, Λ � Π 1 ⊢ G 1 : � φ 1 , Λ 1 � Π 2 ⊢ G 2 : � φ 2 , Λ 2 � t-seq Π 1 ∪ Π 2 ⊢ G 1 ; G 2 : � φ 1 ∪ ( φ 2 − Π 1 ) , Λ 2 ∪ ( Λ 1 − Π 2 ) � where for L ⊆ L and Π ⊆ P we set L − Π = { l ∈ L | sbj l �∈ Π } Example: φ 1 = Λ 1 = { C S!req , C S?req } φ 2 = Λ 2 = { S C!done , S C?done } req done { C , S } ⊢ C − − → S : � φ 1 , Λ 1 � { C , S } ⊢ S − − → C : � φ 2 , Λ 2 � req done { C , S } ⊢ C − − → S; S − − → C : � φ 1 , Λ 2 � de’Liguoro, Melgratti, Tuosto Towards Refinable Choreographies

  10. Introduction Choreographies A type system Refinement Conclusions Type rule for choice Let � L (A) = { l ∈ L | sbj l = A } for L ⊆ L Π ⊢ G 1 : � φ 1 , Λ 1 � Π ⊢ G 2 : � φ 2 , Λ 2 � φ 1 ⊲ ⊳ Π φ 2 t-ch Π ⊢ G 1 + G 2 : � φ 1 ∪ φ 2 , Λ 1 ∪ Λ 2 � where the condition φ 1 ⊲ ⊳ Π φ 2 is defined by the clauses: there is a unique A ∈ Π such that � φ 1 (A) and � φ 2 (A) are disjoint sets of output actions and both non-empty; for all B � = A ∈ Π, � φ 1 (B) and � φ 2 (B) are disjoint sets of input actions and � φ 1 (B) = ∅ if and only if � φ 2 (B) = ∅ Example: φ 1 = Λ 1 = { C S!md , C S?md } md req done { C , S } ⊢ C − − → S : � φ 1 , Λ 1 � { C , S } ⊢ C − − → S; S − − → C : � φ 2 , Λ 3 � md req done { C , S } ⊢ C − − → S + C − − → S; S − − → C : � φ 1 ∪ φ 2 , Λ 1 ∪ Λ 3 � where φ 2 = Λ 2 = { C S!req , C S?req } and φ 3 = Λ 3 = { C B!md , C B?md } de’Liguoro, Melgratti, Tuosto Towards Refinable Choreographies

  11. Introduction Choreographies A type system Refinement Conclusions The type system φ = Λ = { A B!m , A B?m } t-emp t-int m ∅ ⊢ 0 : �∅ , ∅� { A , B } ⊢ A − → B : � φ, Λ � Π 1 ⊢ G 1 : � φ 1 , Λ 1 � Π 2 ⊢ G 2 : � φ 2 , Λ 2 � t-seq Π 1 ∪ Π 2 ⊢ G 1 ; G 2 : � φ 1 ∪ ( φ 2 − Π 1 ) , Λ 2 ∪ ( Λ 1 − Π 2 ) � Π 1 ⊢ G 1 : � φ 1 , Λ 1 � Π 2 ⊢ G 2 : � φ 2 , Λ 2 � Π 1 ∩ Π 2 = ∅ t-par Π 1 ∪ Π 2 ⊢ G 1 | G 2 : � φ 1 ∪ φ 2 , Λ 1 ∪ Λ 2 � Π ⊢ G 1 : � φ 1 , Λ 1 � Π ⊢ G 2 : � φ 2 , Λ 2 � φ 1 ⊲ ⊳ Π φ 2 t-ch Π ⊢ G 1 + G 2 : � φ 1 ∪ φ 2 , Λ 1 ∪ Λ 2 � de’Liguoro, Melgratti, Tuosto Towards Refinable Choreographies

  12. Introduction Choreographies A type system Refinement Conclusions Theorem (Soundness) If Π ⊢ G : � φ, Λ � is derivable then [ [G] ] � = ⊥ , Π = P (G) , and � � φ (A) = min([ [G] ] ↾ A) and Λ(A) = max([ [G] ] ↾ A) holds for all A ∈ Π . Remark: a choreography G has at most one typing Π ⊢ G : � φ, Λ � and it is computable de’Liguoro, Melgratti, Tuosto Towards Refinable Choreographies

  13. Introduction Choreographies A type system Refinement Conclusions The refinement relation m1 ... mn m m Let A ��� B ≡ A ������� B 1 . . . B n , then a ground g-choreography G refines A ��� B, written m G ref A ��� B, if [ [G] ] = E � = ⊥ ; sbj min( E ) = { A } , by which we say that A is the (unique) initiator of G; for all branch x of E and 1 ≤ h ≤ n there exists C ∈ P (G) such that C B h ?m h ∈ max( x ↾ B h ) de’Liguoro, Melgratti, Tuosto Towards Refinable Choreographies

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