scribbling interactions with a formal foundation
TRANSCRIPT
![Page 1: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/1.jpg)
Scribbling Interactions with a Formal Foundation
by Kohei Honda, Aybek Mukhamedov, Gary Brown, Tzu-Chun Chen, and Nobuko Yoshida
Slides by Jes Hansen - University of Southern Denmark
![Page 2: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/2.jpg)
Overview of Presentation• Motivations & Background
• Protocols
• The challenge
• Overview of Scribble
• Scribble: The language
• Example
• Types
![Page 3: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/3.jpg)
Motivations and Background
• We have a good understanding of sequential programming - not distributed
• Distributed systems are becoming frequent and large
• examples: Serverparks, multiprocessor chips, webservers, distributed big data processing
![Page 4: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/4.jpg)
Protocols• Protocol: Agreement of how to communicate
among multiple processes
• Scribble and structured communication: Protocols
• Use every day - internet
• Multicore chip
• Heart of distributed communication
![Page 5: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/5.jpg)
Protocols in the financial world (FP)
• Controlled by: the Technical Committee for Global Financial Services in ISO
• Message format not enough
• Flow of asynchronous messages - need choreography
![Page 6: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/6.jpg)
The description of the message choreography through the current technology has severe limitations:
1. It is imprecise: The descriptions of protocols are unclear, ambiguous and misleading, and legally unusable.
2. It is incomplete: It is impossible to describe the structure and constraints of FPs in their entirety up to a suitable abstraction level.
3. It is informal: The description cannot be used for formal reasoning about protocols; for checking their internal consistency; for verifying, either by hand or by machine, the conformance of endpoint programs against a given protocol; for code generation; for testing; and for runtime control.
![Page 7: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/7.jpg)
The challenge
• Distributed systems are here to stay - Deal with it
• There is no core descriptive framework for large distributed systems
• Create such a System
![Page 8: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/8.jpg)
The Answer: Scribble
• Based on π-calculus
• Simple language for describing communication, using protocols
• Session types -> interaction of overlapping protocols
![Page 9: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/9.jpg)
Overview of Scribble
API: Should use; Java, python, C++…..
Protocol type checker: Inspects the application code - does communication follow protocol
Runtime monitor: Reads in a Scribble protocol specification and inspects runtime communication behaviour of an application.
![Page 10: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/10.jpg)
Transport characteristics• We assume the following:
• Asynchrony: send actions are non-blocking.
• Message order preservation: the order of messages from the same participant to another participant in a single conversation is preserved.
• Reliability: a message is never lost or tampered with during transmission.
![Page 11: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/11.jpg)
Hello World!
![Page 12: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/12.jpg)
Main constructs• At most one preamble - one or more imports
• A single protocol definition: keyword protocol, the name, protocol body {}.
• Protocol body: role declarations and interaction descripters
• Roles: placeholders for endpoints
![Page 13: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/13.jpg)
The language - Roles
• role role1, ..., roleN; is equivalent to
• role role1; ...role roleN;
![Page 14: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/14.jpg)
Interaction Descriptions• msgType from role1 to role2;
• Message type msgType is imported
• Message type can be base or composite
• Base: int, bool or user defined
• Composite: Sequence of base types
![Page 15: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/15.jpg)
Sequencing• I1; I2; ...; In
• Interaction sentence, where if the same role name appears in both Ii and I(i + k), then communication order is given
• If none of the role names overlap between I1 and In, then no order is specified
![Page 16: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/16.jpg)
Unordered (Parallel)
• I1 & I2 & ... In
• represents interleaved interactions that may be observed in any order. We write: msgType from role1 to role2,.., roleK; ormsgType from role1 to role2 & .. & msgType from role1 to roleK;
![Page 17: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/17.jpg)
Directed Choice
Interaction flow branching, role1 makes a choice msgTypej to continue interaction following scenario
in Ij
![Page 18: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/18.jpg)
Example
![Page 19: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/19.jpg)
Recursion• rec BlockName { I }
• when #BlockName is encountered - the whole block is executed
![Page 20: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/20.jpg)
Nested Protocols
• run Protocol(param1,.., paramk, roleInChild1=roleInParent1,.., roleInChildn= roleInParentn);
• Method for running a protocol within a protocol
![Page 21: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/21.jpg)
Example
• Web services: Travel Agent.
![Page 22: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/22.jpg)
![Page 23: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/23.jpg)
![Page 24: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/24.jpg)
![Page 25: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/25.jpg)
Formal Foundations of Scribble - Types
• Based on π-calculus and its type theory, session types
• Session types set rules of conversation - Global type: describes the whole conversation
• Like protocol in scribble
![Page 26: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/26.jpg)
![Page 27: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/27.jpg)
Safety Assurance by Session Types.
• Session types provide a static type check
• “well-typed processes never exchange wrong values.”
• Each session has linearity: “an output is never shared by more than one inputs, and vice versa.”
• “interactions inside a session among well-typed processes under a global type, never violate the scenarios given in that type.”
![Page 28: Scribbling Interactions with a Formal Foundation](https://reader033.vdocuments.mx/reader033/viewer/2022052602/55c10b99bb61eb4b348b4616/html5/thumbnails/28.jpg)
Thanks
• Q&A