Advanced Topics in Software Engineering 1

Slides:



Advertisements
Similar presentations
Chapter 2 Revision of Mathematical Notations and Techniques
Advertisements

Lecture #12 EGR 272 – Circuit Theory II
Copyright © Cengage Learning. All rights reserved. CHAPTER 1 SPEAKING MATHEMATICALLY SPEAKING MATHEMATICALLY.
Introduction to Computability Theory
1 Introduction to Computability Theory Lecture7: PushDown Automata (Part 1) Prof. Amos Israeli.
Ordering and Consistent Cuts Presented By Biswanath Panda.
Programming Language Semantics Denotational Semantics Chapter 5 Part III Based on a lecture by Martin Abadi.
Timed UML State Machines Ognyana Hristova Tutor: Priv.-Doz. Dr. Thomas Noll June, 2007.
Introduction to Formal Methods Based on Jeannette M. Wing. A Specifier's Introduction to Formal Methods. IEEE Computer, 23(9):8-24, September,
SDS Foil no 1 Process Algebra Process Algebra – calculating with behaviours.
Advanced Topics in SE Spring Process Algebra Hossein Hojjat Formal Methods Lab University of Tehran.
2G1516 Formal Methods2005 Mads Dam IMIT, KTH 1 CCS: Operational Semantics And Process Algebra Mads Dam Reading: Peled 8.3, 8.4, 8.6 – rest of ch. 8.
Regular Expressions and Languages A regular expression is a notation to represent languages, i.e. a set of strings, where the set is either finite or contains.
11/19/20151 Metodi formali nello sviluppo software a.a.2013/2014 Prof.Anna Labella.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Formal Methods for Software Engineering Part II: Modelling & Analysis of System Behaviour.
Mathematical Preliminaries
Overview of Previous Lesson(s) Over View  Symbol tables are data structures that are used by compilers to hold information about source-program constructs.
CS 5204 Spring 99 1 A Simple Agent A CCS agent is described both by a structural diagram and one or more algebraic equations. The diagram is for readability.
1 / 48 Formal a Language Theory and Describing Semantics Principles of Programming Languages 4.
Hwajung Lee.  Models are simple abstractions that help understand the variability -- abstractions that preserve the essential features, but hide the.
2G1516 Formal Methods2005 Mads Dam IMIT, KTH 1 CCS: Processes and Equivalences Mads Dam Reading: Peled 8.5.
2G1516/2G1521 Formal Methods2004 Mads Dam IMIT, KTH 1 CCS: Processes and Equivalences Mads Dam Reading: Peled 8.1, 8.2, 8.5.
State Modeling. Introduction A state model describes the sequences of operations that occur in response to external stimuli. As opposed to what the operations.
Lecture #2 Advanced Theory of Computation. Languages & Grammar Before discussing languages & grammar let us deal with some related issues. Alphabet: is.
Chapter 1 INTRODUCTION TO THE THEORY OF COMPUTATION.
Prof. R K Joshi IIT Bombay
20 G M aaba acba aaba.. What is it about? Models of Language Generation Models of Language Recognition.
Capabilities, Minimization, and Transformation of Sequential Machines
Functional Programming
Introduction to Formal Methods
lec02-parserCFG May 8, 2018 Syntax Analyzer
Context-Free Grammars: an overview
CIS Automata and Formal Languages – Pei Wang
CSE 105 theory of computation
Copyright © Cengage Learning. All rights reserved.
Complexity and Computability Theory I
[Week#03,04] (b) - Finite Automata
Jaya Krishna, M.Tech, Assistant Professor
REGULAR LANGUAGES AND REGULAR GRAMMARS
Transformations of Functions
Logical architecture refinement
Parallel and Distributed Algorithms
Objective of This Course
Internet of Things A Process Calculus Approach
Copyright © Cengage Learning. All rights reserved.
Formal Methods in software development
CHAPTER 2 Context-Free Languages
CSE341: Programming Languages Lecture 12 Equivalence
Finite Automata.
Event-Based Architecture Definition Language
CSE341: Programming Languages Lecture 12 Equivalence
CSE341: Programming Languages Lecture 12 Equivalence
MA/CSSE 474 More Math Review Theory of Computation
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
CSE 105 theory of computation
Department of Computer Science Abdul Wali Khan University Mardan
Copyright © Cengage Learning. All rights reserved.
Chapter 1 Introduction to the Theory of Computation
CSE341: Programming Languages Lecture 12 Equivalence
Copyright © Cengage Learning. All rights reserved.
Copyright © Cengage Learning. All rights reserved.
Basics of Relations.
lec02-parserCFG May 27, 2019 Syntax Analyzer
Chapter 15 Functional Programming 6/1/2019.
CSE341: Programming Languages Lecture 12 Equivalence
CSE 105 theory of computation
CSE341: Programming Languages Lecture 12 Equivalence
Visual Programming Languages ICS 539 Icon System Visual Languages & Visual Programming, Chapter 1, Editor Chang, 1990 ICS Department KFUPM Sept. 1,
CSE 105 theory of computation
Presentation transcript:

Advanced Topics in Software Engineering 1 CCS Introduction Modeling Communication The Basic Language Advanced Topics in Software Engineering 1

Advanced Topics in Software Engineering 2 What is CCS? CCS is a theory of communicating systems that reveals the essence of concurrency and communication. It can also be considered as a formal notation to model and analyze the behavior of concurrent systems. Advanced Topics in Software Engineering 2

Advanced Topics in Software Engineering 3 Why CCS? Offers deep insights about concurrency and communication Helps to distinguish essential differences from accidental ones Provides a mathematic treatment that highlights precise modeling and analysis Accidental: occur by chance Essential: determined by nature Advanced Topics in Software Engineering 3

Advanced Topics in Software Engineering 4 CCS vs Net Theory Net theory is a generalization of the theory of automata that allows for the occurrence of independent actions. CCS is based on the notion of observational equivalence, while net theory is concerned with the causality of the actions. Advanced Topics in Software Engineering 4

Advanced Topics in Software Engineering 5 CCS Introduction Modeling Communication The Basic Language Advanced Topics in Software Engineering 5

Advanced Topics in Software Engineering 6 Agent A complex system is often composed of several parts that communicate with each other. Each of the parts has its own identity and is called an agent. The term agent will be used broadly: For one purpose, we take it to be atomic; for other purposes, we take it as a composition of sub-agents. Advanced Topics in Software Engineering 6

Advanced Topics in Software Engineering 7 Action Each action of an agent is either an interaction with its neighboring agents, and then it is communication, or it occurs independently of them and then it may occur concurrently with their actions. A central idea in CCS is observational equivalence: Two agents are equivalent if they exhibit the same behavior in terms of observable actions. Advanced Topics in Software Engineering 7

Advanced Topics in Software Engineering 8 Medium - Ether sender ETHER receiver The sender may always send a message The receiver may always receive a message, provided that a medium is not empty The order of messages may not be preserved. Advanced Topics in Software Engineering 8

Advanced Topics in Software Engineering 9 Medium – Bounded Ether Bounded ETHER sender receiver The sender may always send a message, provided the medium is not full. The receiver may always receive a message, provided that a medium is not empty The order of messages may not be preserved. Advanced Topics in Software Engineering 9

Advanced Topics in Software Engineering 10 Medium – Buffer sender Buffer receiver The sender may always send a message. The receiver may always receive a message, provided that a medium is not empty The order of messages is preserved. Advanced Topics in Software Engineering 10

Medium – Bounded Buffer sender receiver The sender may always send a message, provided the medium is not full. The receiver may always receive a message, provided the medium is not empty. The order of messages is preserved. Advanced Topics in Software Engineering 11

Advanced Topics in Software Engineering 12 Medium – Shared Memory sender receiver The sender may always write an item to a memory location. The receiver may always read an item from a memory location. Writing and reading may occur in any order. Advanced Topics in Software Engineering 12

Advanced Topics in Software Engineering 13 Handshake Each arrow in each diagram is a single action, called handshake, that is indivisible in time and consists of the passage of a piece of information between two entities. We consider that medium is no different from sender/receiver, in the sense that they are participants of a handshake. sender receiver Advanced Topics in Software Engineering 13

Advanced Topics in Software Engineering 14 Agent Expression C’(x) def out(x).C C in(x).C’(x) C in out def C in(x).out(x).C C is an agent that may hold a single data item. It can accept an item at port in, and deliver an item at port out. in(x) stands for a handshake in which an item is received at in, and out(x) stands for a handshake in which an item is delivered at out. Advanced Topics in Software Engineering 14

Advanced Topics in Software Engineering 15 Scope The scope of a variable on the left-hand side of a defining equation is the entire equation. The scope of a variable in a prefix on the right-hand side is the agent expression which begins with the prefix. Note that a variable never has scope larger than a single equation. Advanced Topics in Software Engineering 15

Advanced Topics in Software Engineering 16 Abstraction An agent can be specified at different levels of abstraction – either directly in terms of its interactions with the environment, or indirectly in terms of its composition from smaller agents. One important power provided by CCS is to prove that agents specified at different levels of abstractions are equivalent. Advanced Topics in Software Engineering 16

Advanced Topics in Software Engineering 17 N-cell Buffer (1) C in out def C(n) C ^ C ^ ... ^ C C ^ C represents an agent formed by linking the out port of the first sub-agent C with the in port of the second sub-agent C. Advanced Topics in Software Engineering 17

Advanced Topics in Software Engineering 18 N-cell Buffer (2) Buffern in out Buffn() def in(x).Buffn(x) Buffn(s:v) out(v).Buffn(s) (|s| = n – 1) in(x).Buffn(x : s : v) + out(v).Buffn(s) (|s| < n – 1) P + Q represents an agent that behaves like P or Q; as soon as one performs its first action, the other is discarded.  - empty sequence; : - sequence concatenation. Advanced Topics in Software Engineering 18

Advanced Topics in Software Engineering 19 Buffers with acks (1) D in out ackin ackout def D in(x).out(x).ackout.ackin.D D will acknowledge the receipt of an input value only after it has delivered the value as output and also received acknowledgement for it. Advanced Topics in Software Engineering 19

Advanced Topics in Software Engineering 20 Buffer with acks (2) D in out ackin ackout D(n) def D ^ D ^ ... ^ D Question: What is the capacity of D(n)? Advanced Topics in Software Engineering 20

Advanced Topics in Software Engineering 21 Semaphore (1) Semn(0) def get.Semn(1) Semn(k) get.Semn(k+1) + put.Semn(k-1) Semn(n) put.Semn(n-1) Note that Semn admits any sequence of gets and puts in which the number of gets minus the number of puts lies in the range of 0 to n inclusive. Question: What is the difference between Semn and Buffn? Advanced Topics in Software Engineering 21

Advanced Topics in Software Engineering 22 Semaphore (2) Sem(n) def Sem | Sem | ... | Sem Sem get put Sem get put Sem get put Composition (|) : Agent P | Q is a system in which P and Q may proceed independently but may also interact through complementary ports. Advanced Topics in Software Engineering 22

Advanced Topics in Software Engineering 23 CCS Introduction Modeling Communication The Basic Language Advanced Topics in Software Engineering 23

Advanced Topics in Software Engineering 24 Synchronization Synchronization is a special form of communication in which no data value was transmitted. We will first focus on a basic calculus of pure synchronizations, which has no value variables and expressions. Later we will show that calculus involving value variables, expressions and conditions can be translated it into the basic calculus. Advanced Topics in Software Engineering 24

Advanced Topics in Software Engineering 25 Transition Each action transforms an agent from one state to another. def P Q a P a.Q Advanced Topics in Software Engineering 25

Advanced Topics in Software Engineering 26 Composition (1) A a c B c b def a.A’ B def c.B’ A A’ def c.A B’ def b.B What are the transition rules for agent A | B? Advanced Topics in Software Engineering 26

Advanced Topics in Software Engineering 27 Composition (2) A a c B b A A’ a a A | B A’ | B A’ A c c A’ | B A| B B B’ c A | B A | B’ B’ B b A | B’ A | B B B’ c A’ | B A| B’  A’ A Advanced Topics in Software Engineering 27

Advanced Topics in Software Engineering 28 Internal Action An important feature of CCS is to ignore, as far as possible, internal actions when analyzing the behavior of composite systems. The reason is that internal actions are not directly observable. Two systems will be regarded as equivalent if they exhibit the same pattern of external actions. P P1    Pn P Pn  Advanced Topics in Software Engineering 28

Advanced Topics in Software Engineering 29 Restriction A composite system can be restricted from performing some actions. P Q  P\L Q\L  if  and  are not in L For example, consider the composite system (A | B) \ c. What are the transition rules of this system? A a B b Advanced Topics in Software Engineering 29

Advanced Topics in Software Engineering 30 Transition Graph C0 (A|B’) \ c (A|B) \ c (A’|B) \ c (A’|B’) \ c b a start  C1 C2 C3 C0 b.C1 + a.C2 def C1 a.C3 def C2 b.C3 def C3 .C0 def Advanced Topics in Software Engineering 30

Advanced Topics in Software Engineering 31 .P = P ? Consider the following two agents: def B a.B + b.B def A a.A + .b.A A a  A’ b B a b Advanced Topics in Software Engineering 31

Advanced Topics in Software Engineering 32 The Basic Language (1) A/A: An infinite set of names/co-names  = A  A, Act =   {} a, b, c range over A, , , ... range over Act f: a relabelling function f is a function from  to  such that f(l) = f(l), where l  , and f() = . Advanced Topics in Software Engineering 32

Advanced Topics in Software Engineering 33 The Basic Language (2) Given a set X of agent variables and a set K of agents, the set  of agent expressions is the smallest set as defined below: X  , K   Let E and Ei be two expressions in . .E, a prefix (   Act) iI Ei, a summation, where I is an indexing set E1 | E2, a composition E\L, a Restriction ( L  ) E[f], a relabelling (f: a relabelling function) Advanced Topics in Software Engineering 33

Advanced Topics in Software Engineering 34 The Basic Language (3) iI Ei is also written as E1 + E2 if I = {1, 2}. iI Ei = 0, if I is empty. Note that 0 is an inactive agent. Binding power: Restriction = Relabelling > Prefix > Composition > summation An agent expression is an agent if it contains no free variables. A Constant is an agent whose meaning is given by a defining equation. E1  E2 : E1 and E2 are syntactically identical. E1 = E2 : E1 and E2 are equivalent in terms of their behavior. Advanced Topics in Software Engineering 34

Advanced Topics in Software Engineering 35 Transition Rules (1) Com1 E|F  E’|F E E’ .E  E Act Com2 E|F  E|F’ F F’ i  I Ei  E’j Sumj Ej Com3 E|F  E’|F’ E  E’ F F’ Advanced Topics in Software Engineering 35

Advanced Topics in Software Engineering 36 Transition Rules (2)  E E’ ,   L Res  E\L E’\L Rel E[f] f() E’[f] E  E’ Con A  A’ P P’ def (A = P) Advanced Topics in Software Engineering 36

Advanced Topics in Software Engineering 37 Inference Diagram (1) An inference diagram can be used to justify a transition of any agent expression. For example, consider how to justify the following transition: ((a.E + b.0) | a.F)\a  (E|F) \a Advanced Topics in Software Engineering 37

Advanced Topics in Software Engineering 38 Inference Diagram (2) a.E a E Act a.F a F Act a.E + b.0 a E Sum1 Com3 (a.E + b.0) | a.F  E|F Res  ((a.E + b.0) | a.F)\a (E|F)\a Advanced Topics in Software Engineering 38

Advanced Topics in Software Engineering 39 Inference Diagram (3) (A|B)\c a (A’|B) \c a.A’ a A’ Act A Con A|B A’|B Com1 (A|B)\c (A’|B)\c Res Advanced Topics in Software Engineering 39

Advanced Topics in Software Engineering 40 Derivative  Whenever E  E’, we call the pair (, E’) an immediate derivative of E, we call  an action of E, and we call E’ an -derivative of E. Whenever E  ...  E’, we call (1 ... n, E’) a derivative of E, we call 1 ... n an action-sequence of E, and we call E’ an 1 ... n–derivative of E. Note that if n = 0, we have that  is an action-sequence of E, and E is a derivative of itself. 1 n Advanced Topics in Software Engineering 40

Advanced Topics in Software Engineering 41 Derivative Tree (1) A derivative tree of an agent expression E consists of all the derivatives of E. A derivative tree is total if every terminal node has no immediate derivatives, otherwise partial. E E1 E11 E12 a1 a11 a12 a2 Advanced Topics in Software Engineering 41

Advanced Topics in Software Engineering 42 Derivative Tree (2) ((a.E + b.0) | a.F)\a (E|F)\a (0|a.F)\a  b The meaning of an agent should be a property of its derivation tree disregarding the expressions which lie at the nodes. Advanced Topics in Software Engineering 42

Advanced Topics in Software Engineering 43 Sort For any L  , if the actions of an agent and all its derivatives lie in L  {} then we say P has sort L, or L is a sort of P, and write P : L. For every E and L, L is a sort of E if and only if whenever E  E’, then (1)   L  {} (2) L is a sort of E’.  Advanced Topics in Software Engineering 43

Advanced Topics in Software Engineering 44 Syntactic Sort (1) Given the sorts L(A) and L(X) of constants and variables, the syntactic sort L(E) of an agent expression E is defined below: L(a.E) = {a}  L(E) L(.E) = L(E) L(iI Ei) = iI L(Ei) L(E|F) = L(E)  L(F) L(E\L) = L(E) – (L  L) L(E[f]) = {f(a): a  L(E)) In addition, if A = P, then L(P)  L(A) must hold. def Advanced Topics in Software Engineering 44

Advanced Topics in Software Engineering 45 Syntactic Sort (2) In many cases, calculating L(E) involves little more than collecting up the labels which occur “free” in E, i.e., not bound by a restriction. P ((a.0 + b.0) | (b.0 + c.0)) \ b What is the sort of P? Advanced Topics in Software Engineering 45

Advanced Topics in Software Engineering 46 Value Passing The full calculus with value passing can be reduced to the basic calculus. C’(x) def out(x).C C in(x).C’(x) C’v def outv.C C vVinv.Cv (v  V) Advanced Topics in Software Engineering 46