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.

Slides:



Advertisements
Similar presentations
Process Algebra Book: Chapter 8. The Main Issue Q: When are two models equivalent? A: When they satisfy different properties. Q: Does this mean that the.
Advertisements

Chapter Three: Closure Properties for Regular Languages
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
Formal Semantics of Programming Languages 虞慧群 Topic 5: Axiomatic Semantics.
Distributed Computing 5. Snapshot Shmuel Zaks ©
– Alfred North Whitehead,
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Axiomatic Semantics.
Induction and recursion
Induction Sections 41. and 4.2 of Rosen Fall 2008 CSCE 235 Introduction to Discrete Structures Course web-page: cse.unl.edu/~cse235 Questions:
Transparency No. 4-1 Formal Language and Automata Theory Chapter 4 Patterns, Regular Expressions and Finite Automata (include lecture 7,8,9) Transparency.
Induction Sections 4.1 and 4.2 of Rosen Fall 2010
CSE115/ENGR160 Discrete Mathematics 01/31/12 Ming-Hsuan Yang UC Merced 1.
CSE115/ENGR160 Discrete Mathematics 02/01/11
Discrete Structures Chapter 2 Part B Mathematical Induction
Operational Semantics Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Variable-Length Codes: Huffman Codes
1 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY For next time: Read 2.1 & 2.2.
1 Section 3.3 Mathematical Induction. 2 Technique used extensively to prove results about large variety of discrete objects Can only be used to prove.
1 Strong Mathematical Induction. Principle of Strong Mathematical Induction Let P(n) be a predicate defined for integers n; a and b be fixed integers.
Induction and recursion
Chapter 4: A Universal Program 1. Coding programs Example : For our programs P we have variables that are arranged in a certain order: Y 1 X 1 Z 1 X 2.
Ch. 8 & 9 – Linear Sorting and Order Statistics What do you trade for speed?
Methods of Proof & Proof Strategies
MATH 224 – Discrete Mathematics
Induction and recursion
The Polynomial Time Algorithm for Testing Primality George T. Gilbert.
Discrete Mathematics, 1st Edition Kevin Ferland
Reading and Writing Mathematical Proofs
1 Introduction to Abstract Mathematics Chapter 4: Sequences and Mathematical Induction Instructor: Hayk Melikya 4.1- Sequences. 4.2,
MATH 224 – Discrete Mathematics
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.
1 Sections 1.5 & 3.1 Methods of Proof / Proof Strategy.
Logic CL4 Episode 16 0 The language of CL4 The rules of CL4 CL4 as a conservative extension of classical logic The soundness and completeness of CL4 The.
Advanced Topics in Propositional Logic Chapter 17 Language, Proof and Logic.
CS 363 Comparative Programming Languages Semantics.
11/19/20151 Metodi formali nello sviluppo software a.a.2013/2014 Prof.Anna Labella.
Mathematical Preliminaries
CS 103 Discrete Structures Lecture 13 Induction and Recursion (1)
Advanced Formal Methods Lecture 3: Simply Typed Lambda calculus Mads Dam KTH/CSC Course 2D1453, Some material from B. Pierce: TAPL + some from.
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.
Concurrency 5 The theory of CCS Specifications and Verification Expressive Power Catuscia Palamidessi
Mathematical Induction Section 5.1. Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If.
CS104:Discrete Structures Chapter 2: Proof Techniques.
CSE 311: Foundations of Computing Fall 2013 Lecture 8: Proofs and Set theory.
1 2/21/2016 MATH 224 – Discrete Mathematics Sequences and Sums A sequence of the form ar 0, ar 1, ar 2, ar 3, ar 4, …, ar n, is called a geometric sequence.
CompSci 102 Discrete Math for Computer Science March 13, 2012 Prof. Rodger Slides modified from Rosen.
Chapter 5. Section 5.1 Climbing an Infinite Ladder Suppose we have an infinite ladder: 1.We can reach the first rung of the ladder. 2.If we can reach.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AA.
Types and Programming Languages Lecture 3 Simon Gay Department of Computing Science University of Glasgow 2006/07.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
Process Algebra (2IF45) Basic Process Algebra Dr. Suzana Andova.
6/18/2016Transactional Information Systems3-1 Part II: Concurrency Control 3 Concurrency Control: Notions of Correctness for the Page Model 4 Concurrency.
Fuw-Yi Yang1 Textbook: Introduction to Cryptography 2nd ed. By J.A. Buchmann Chap 1 Integers Department of Computer Science and Information Engineering,
1 Section 4.4 Inductive Proof What do we believe about nonempty subsets of N? Since  N, <  is well-founded, and in fact it is linear, it follows that.
Chapter 5 1. Chapter Summary  Mathematical Induction  Strong Induction  Recursive Definitions  Structural Induction  Recursive Algorithms.
MATH 224 – Discrete Mathematics
Advanced Algorithms Analysis and Design
Chapter 3 The Real Numbers.
Induction and recursion
Proving Properties of Recursive List Functions
CS 154, Lecture 4: Limitations on DFAs (I),
Induction and recursion
Formal Methods in software development
Computer Security: Art and Science, 2nd Edition
Advanced Analysis of Algorithms
Program correctness Axiomatic semantics
Presentation transcript:

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

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 2 Value-passing CCS Combinators Value-passing combinators and definitions as abbreviations using labels of the form a(v) (receiving v) or b(v) (sending v) Prefix a(x), b(v)a(x).P(x) = a(v 0 ).P(v 0 ) a(v n ).P(v n ) b(v).P(v) = b(v).P(v) Definition A(x) == P(x)Buf == in(x).Buf 1 (x) Buf 1 (x) == out(x).Buf(x) Conditional if C then PTeller(x) == Deposit(x) + Withdrawal(x) Deposit(x) == deposit(x).Teller(x + y) Summation  y: P(y) Withdrawal(x) ==  y: if y  x then withdraw(y).Teller(x - y)

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 3 Transition Semantics To apply observational equivalence need a formalised semantics Each CCS expression -> state in LTS derived from that expression Compositionality: Construction of LTS follows expression syntax Inference rules: P 1   P 2 P 1 | Q   P 2 | Q Meaning: For all P 1, P 2, Q, , if there is an  transition from P 1 to P 2 then there is an  transition from P 1 | Q to P 2 | Q

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 4 P   P’ PÂL   P’ÂL CCS Transition Rules (no rule for 0!) - .P   P Prefix Def P   Q A   Q (A == P) Choice L P   P’ P+Q   P’ Choice L Q   Q’ P+Q   Q’ Com L P   P’ P|Q   P’|Q Com R Q   Q’ P|Q   P|Q’ Com P  l P’ Q  l Q’ P|Q   P’|Q’ Restr ( ,   L) Rel P   P’ P[f]  f(  P’[f]

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 5 CCS Transition Rules, II Closure assumption: !  is least relation closed under the set of rules Example derivation: Buf 1 == in.comm.Buf 1 Buf 2 == comm.out.Buf 2 (Buf 1 | Buf 2 )Â{comm}  in comm.Buf 1 | Buf 2   Buf 1 | out.Buf 2  out Buf 1 | Buf 2

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 6 Extending the Language Two ways of adding new operators: 1.By equation Example: Buffer composition P Æ Q = (P[comm/out]|Q[comm/in])Â{comm} 2.By extending the transition semantics Example: Sequential composition of processes Assume special (non-label) action X for termination Let X = X and f(X) = X for relabelling functions f Seq 1 P   P’ P;Q   P’;Q (  X)(  X) Seq 2 P  X P’ Q   Q’ P|Q   Q’

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 7 Example: Semaphores Semaphore: Unary semaphore: S 1 == p.S 1 1 S 1 1 == v.S 1 Binary semaphore: S 2 == p.S 2 1 S 2 1 == p.S v.S 2 S 2 2 == v.S 2 1 Result: S 1 | S 1  S 2 Proof: Show that {(S 1 | S 1, S 2 ), (S 1 1 | S 1, S 2 1 ), (S 1 | S 1 1, S 2 1 ), (S 1 1 | S 1 1, S 2 2 )} is a strong bisimulation relation pv

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 8 Example: Simple Protocol Spec == in.out.Spec Sender == in.Transmit Transmit == transmit.WaitAck WaitAck == ack +.Sender + ack -.Transmit Receiver == transmit.Analyze Analyze == .out.ack +.Receiver + .ack -.Receiver Protocol == (Sender | Receiver)Â{transmit,ack +,ack - } Exercise: Prove Spec  Protocol

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 9 Example: Jobshop i E : input of easy job i N : input of neutral job i D : input of difficult job O: output of finished product A == i E.A’ + i N.A’ + i D.A’ A’ == o.A Spec = A | A Hammer: H == gh.ph.H Mallet: M == gm.pm.M Jobber: J ==  x  {E,N,D} i x.J x J E == o.J J N == gh.ph.J E + gm.pm.J E J D == gh.ph.J E Jobshop == (J | J | H | M)Â{gh,ph,gm,pm} Theorem: Spec  Jobshop Exercise: Prove this.

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 10 Proving Equivalences Two main methods for establishing an equivalence P  Q: 1.Establish a weak bisimulation relation S s.t. P S Q (this is the canonical method) 2.Use equational reasoning But: What about substitutivity – replacing equals for equals?

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 11  Is Not a Congruence Congruence: Equivalence preserved under substitution But: P  P’ does not imply P + Q  P’ + Q Example: a.0  .a.0 but a.0 + b.0  .a.0 + b.0 does not hold Exercise: Show that ¼ is preserved by prefixing, parallel, restriction, and relabelling Observational Congruence: Let S  Q  Q. The relation S is an observational congruence relation if whenever q 1 S q 2 then: –q 1   q 1 ’ implies q 2  ±!  ±) q 2 ’ for some q 2 ’ such that q 1 ’  q 2 ’ –q 2   q 2 ’ implies q 1 )±!  ±) q 1 ’ for some q 1 ’ such that q 1 ’  q 2 ’ Write P = Q if o.c.r. S exists such that P S Q

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 12 Observational Congruence Problem is initial  ’s in sums: Proposition: P = P’ iff for all Q, P + Q ¼ P’ + Q Exercise: Prove this. Theorem: Observational congruence = is the largest congruence contained in  Exercise: Prove this too (follow hints in class). Let C[.] be any CCS expression with a ”hole” in it Corollary: P = Q iff for all C[.], C[P]  C[Q] Stable agents: P is stable if no Q exists such that P   Q Corollary:  and = coincides on stable processes

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 13 Laws for Observational Congruence Too many... ;-) Summation: P + Q = Q + P P + (Q + R) = (P + Q ) + R P + P = P P + 0 = P Prefixing: l. .P = l.P P + .P = .P l.(P + .Q) + l.Q = l.(P + .Q) P + .(P + Q) = .(P + Q) Two non-laws: P = .P l.(P + Q) = l.P + l.Q Definition: If A == P then A = P Expansion law: (P | Q)ÂL =  {l.(P’|Q)ÂL | P  l P’, l  L} +  {l.(P|Q’)ÂL | Q  l Q’, l  L} +  { .(P’|Q’)ÂL |  l.P  l P’, Q  l Q’}

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 14 Example Derivation P == a.P + .b.0 Q == a.Q + c.0 R == c.b.0 S == (Q | R) \ c Task: Prove P = S S = (Q | R) \ c = (a.Q + c.0 | c.b.0) \ c = a.(Q | c.b.0) \ c + .(0 | b.0) \ c = a.(Q | R) \ c + .(0 | b.0) \ c = a.S + .b.(0 | 0) \ c = a.S + .b.0 Observe: P = a.P + .b.0 and S = a.S + .b.0 Can we conclude P = S ??

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 15 Unique Fixed Point Induction Let A == P be any definition UFI principle: If A is guarded in P (every occurrence of A in P in scope of prefix l.-) A does not occur in scope of |, \ or [f] in P Q = P[Q/A] Then P = Q

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 16 Partition Refinement Algorithm for deciding strong bisimulation equivalence Note: Doesn’t work for on-the-fly state generation! T1T1 T2T2 T3T3 T 4,1 T 4,2      

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 17 Partition Refinement, II Q = set of states create initial partition P = {Q} ; change := true ; while change do change := false if exists partitions T 1,T 2 2 P and action  such that T 1,1 = {q 2 T 1 | 9 q’ 2 T 2. q !  q’} and T 1,2 = T 1 Â T 1,1 are both nonempty then P := (PÂ {T 1 }) [ {T 1,1,T 1,2 } ; change := true fi od

2G1516 Formal Methods2005 Mads Dam IMIT, KTH 18 Partition Refinement, Correctness Let P i be partition at step i of algorithm, and limP be the final partition Define: 1.p ´ q iff 9 T2 limP such that p,q 2 T 2.p ´ i q iff 9 T2 P i such that p,q 2 T Claim: ´ is a strong bisimulation relation Exercise: Check this Claim: If R is a strong bisimulation relation then R µ ´ i, for all i Proof: Induction on i. The statement holds for i=0. Suppose that p R q and p,q 2 T 2 P i. Either T 2 P i+1 as well (and we’re done) or T = T 1 [ T 2, T 1 Å T 2 = ;, and T 1, T 2 2 P i+1. In the latter case, if p 2 T 1 and q 2 T 2, say, we find some T’2 P i and p’ such that p !  p’2 T’ and whenever q!  q’ then not(q’2 T’). But then :(p’ R q’) by the induction hypothesis, so R cannot be a strong bisimulation relation.