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.

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

Formal Methods in Software Engineering
Nested state diagrams:Problems with flat state diagram
Finite State Machines (FSMs)
Models of Concurrency Manna, Pnueli.
 Calculus Reasoning about concurrency and communication (Part 2). CS5204 – Operating Systems1.
Programming Paradigms for Concurrency Lecture 11 Part III – Message Passing Concurrency TexPoint fonts used in EMF. Read the TexPoint manual before you.
Behavioral Equivalence Hossein Hojjat Formal Lab University of Tehran.
State Machines. What are they? Sometimes called a “Finite State Machine” Depicted as a “state diagram” It’s a tool for specifying a system’s behavior.
Cosc 2150: Computer Organization Chapter 3: Boolean Algebra and Digital Logic.
Algebra Problems… Solutions Algebra Problems… Solutions © 2007 Herbert I. Gross Set 4 By Herb I. Gross and Richard A. Medeiros next.
Finite state machines.
CPSC 668Set 14: Simulations1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
FUNCTIONS AND MODELS Chapter 1. Preparation for calculus :  The basic ideas concerning functions  Their graphs  Ways of transforming and combining.
An Introduction to Input/Output Automata Qihua Wang.
Chair of Software Engineering 1 Concurrent Object-Oriented Programming Arnaud Bailly, Bertrand Meyer and Volkan Arslan.
1 Ivan Lanese Computer Science Department University of Bologna Roberto Bruni Computer Science Department University of Pisa A mobile calculus with parametric.
56 Rumination on the Formal Definition of DPDA In the definition of DPDA, there are some parts that do not agree with our intuition. Let M = (Q, , ,
1 Ivan Lanese Computer Science Department University of Bologna Italy Concurrent and located synchronizations in π-calculus.
Digital Fundamentals with PLD Programming Floyd Chapter 4
In this module you will learn: What the various logic gates do. How to represent logic gates on a circuit diagram. The truth tables for the logic gates.
Logic Gates Circuits to manipulate 0’s and 1’s. 0’s and 1’s used for numbers Also to make decisions within the computer. In that context, 1 corresponds.
Models of Computation: FSM Model Reading: L. Lavagno, A.S. Vincentelli and E. Sentovich, “Models of computation for Embedded System Design”
CS5204 – Operating Systems 1 Communicating Sequential Processes (CSP)
Lecture 03: Theory of Automata:08 Finite Automata.
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.
Lecture 07: Formal Methods in SE Finite Automata Lecture # 07 Qaisar Javaid Assistant Professor.
Reactive systems – general
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.
CS5204 – Operating Systems 1  -Calculus Reasoning about concurrency and communication (Part 1).
1 Lecture 22 Sequential Circuits Analysis. 2 Combinational vs. Sequential  Combinational Logic Circuit  Output is a function only of the present inputs.
College Algebra Sixth Edition James Stewart Lothar Redlin Saleem Watson.
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.
1 Kyung Hee University Statecharts Spring Kyung Hee University Specifying Objects’ Behaviour  Interaction diagrams show message-passing behaviour.
Petri Nets Lecturer: Roohollah Abdipour. Agenda Introduction Petri Net Modelling with Petri Net Analysis of Petri net 2.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
1 Finite State Machines (FSMs) Now that we understand sequential circuits, we can use them to build: Synchronous (Clocked) Finite State Machines Finite.
State Table Problem #1 An electronic lock is controlled by a keypad, which has three buttons labeled A, B, and R. The keypad is restricted such that, at.
CS3773 Software Engineering Lecture 06 UML State Machines.
CSCI1600: Embedded and Real Time Software Lecture 11: Modeling IV: Concurrency Steven Reiss, Fall 2015.
Concurrency 5 The theory of CCS Specifications and Verification Expressive Power Catuscia Palamidessi
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 10: Statecharts.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Presented by: Belgi Amir Seminar in Distributed Algorithms Designing correct concurrent algorithms Spring 2013.
LECTURE 4 Logic Design. LOGIC DESIGN We already know that the language of the machine is binary – that is, sequences of 1’s and 0’s. But why is this?
Specifying the Interactions Builds on agent types and scenario descriptors Interaction Diagrams( IDs) involve –Replacing each functionality with the agent.
1 Theoretical Foundations of Concurrency A formal study of concurrency enables: understanding the essential nature of concurrency reasoning about the behavior.
Copyright © Cengage Learning. All rights reserved. Fundamentals.
L ECTURE 3 T HEORY OF AUTOMATA. E QUIVALENT R EGULAR E XPRESSIONS Definition Two regular expressions are said to be equivalent if they generate the same.
Lecture #4 Thinking of designing an abstract machine acts as finite automata. Advanced Computation Theory.
Prof. R K Joshi IIT Bombay
Finite-State Machines (FSM) Chuck Cusack Based partly on Chapter 11 of “Discrete Mathematics and its Applications,” 5 th edition, by Kenneth Rosen.
Boolean Algebra & Logic Gates
Basics of Logic gates - Part 1
Introduction to Formal Methods
Lesson 16: State-Based Sequential Design
Transformations of Functions
The Coordinate Plane; Graphs of Equations; Circles
BASIC & COMBINATIONAL LOGIC CIRCUIT
Week 12: Activity & Sequence Diagrams
Reasoning about concurrency and communication (Part 1).
Formal Methods in software development
Advanced Topics in Software Engineering 1
Control Systems (CS) Signal Flow Graphs Abdul Qadir Ansari, PhD
Digital Fundamentals Floyd Chapter 4 Tenth Edition
EGR 2131 Unit 12 Synchronous Sequential Circuits
Presentation transcript:

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 and is not part of the formalism. The structural diagram shows the agent as a circle. The name of the agent is written inside the circle. At the borders of the circle are the ports through which the agent interacts with other agents. Ports are represented as blacks dots. Each port has a name. Names with overbars are often interpreted as “output” ports while names without overbars are often interpreted as “input’” ports. The agent pictured below is named ``C'' and has one input port, “in”, and one output port, “out”. What does C do? What is the behavior of C? C in out

CS 5204 Spring 99 2 An Agent with Sequential Behavior The behavior of an agent is expressed by algebraic equations. Suppose that we want C to behave so that it accepts a value at its input port and transmits that value at its output port. The corresponding equations are: C = in(x).C’(x) C'(x) = out(x).C These equations use the CCS “prefix” operator represented by a dot (“.”). The operator expresses sequential behavior. The above equations are read as follows: agent C accepts an input value at its port in and then acts like the agent C' with that input value. Agent C' transmits the value at its out port and then acts like agent C. Later, the values will be dropped and only the port names will be important. C in out

CS 5204 Spring 99 3 An Agent with Alternative Behavior A vending machine that dispenses chocolate candies allows either a 1p (p for pence) or a 2p coin to be inserted. After inserting a 1p coin, a button labelled little may be pressed and the machine will then dispense a small chocolate. After inserting a 2p coin, the big button may be pressed and the machine will then dispense a large chocolate. The candy must be collected before additional coins are inserted. biglittle 1p 2p collect VM = 2p.big.collect.VM + 1p.little.collect.VM

CS 5204 Spring 99 4 Composing Agents Agents are autonomous, free to take their actions whenever their behavior allows such actions. Agents can composed, allowing them to communicate through ports with complementary names (i.e., one agent has an output port and the other has an input port with the same name). Composed and communicating agents can synchronize their behaviors through their willingness or unwillingness to communicate. This reflects a rendezvous style of interaction used in CSP and Ada. Agents: A = a.A’ B = c.B’ A' = c.A B’ = b.B A system of agents: System = A | B The vertical bar is the composition operator.

CS 5204 Spring 99 5 Composing Agents The behavior of this composite system of interacting agents is represented by the following transitions: ( A | B ) ­­a­­> ( A' | B ) ­­  ­­> ( A | B' ) ­­b­­> ( A | B) where the label “  ” (pronounced “tau”) is used to denote the “handshake” communication between the two agents. A a B b c c Agents: A = a.A' B = c.B' A' = c.A B' = b.B A system of agents: System = A | B

CS 5204 Spring 99 6 Encapsulating Agents The agents A and B can interact through their ports c and c. However, any other agents may also use these names an interact with either A or B. If such other interactions are not desired, then the names of the port may be encapsulated or restricted or given a scope that includes only agents A and B. This is done as follows: A = a.A' B = c.B A' = c.A B' = b.B An encapsulated system of agents: System = ( A | B ) \ { c } where “\{...}” is the restriction operator. A a B b c c Thus, the port names c and c are no longer visible to other agents.

CS 5204 Spring 99 7 Reusing an Agent Definition It is useful to be able to create a system by composing several agents that have the same behavior. To allow them interact it is necessary to change the names of their ports. If A is an agent the re-labeling operator A [ new­name / old­name ] is an agent where all of the ports named old­name are changed to new­name and all ports named old­name are changed to new­ name. Note that the re-labeling applies to both barred and unbarred forms of the port name.

CS 5204 Spring 99 8 Reusing an Agent Definition CELL a b c c a b d d a b c c CELL = a.b.CELL C0 = CELL [ c / b ] C1 = CELL [ c / a ] BUFF2 = ( C0 | C1 ) \ { c } C0 = CELL [ c / b ] C1 = CELL [ c / a, d / b ] C2 = CELL [ d / a ] BUFF3 = ( C0 | C1 | C2 ) \ { c, d}

CS 5204 Spring 99 9 Next Steps Using CCS to model interesting systems? Using CCS to represent “specifications” and “implementations” Representing the “behavior”' of a system in a way that it can be examined by a tool Proving that this representation is correct (equivalently, precisely defining the semantics of the CCS operators) Showing the equality between two agents for: substitutability (can one implementation be replaced with another without changing the behavior of the overall system?) satisfaction (does an implementation behavior according to its specification)

CS 5204 Spring Modeling Mutual Exclusion A lock to control access to a critical region is modeled by: Lock = lock.Locked Locked = unlock.Lock A generic process enters and exits the critical region and follows the locking protocol is: Process = lock.enter.exit.unlock.Process A system of two processes is: Process1 = Process [ enter1 / enter, exit1 /exit] Process2 = Process [ enter2 / enter, exit2 / exit] System = (Process1 | Process2 | Lock ) \ {lock, unlock} A ``specification'' for this system is: SafeSpec = enter1.exit1.SafeSpec + enter2.exit2.SafeSpec

CS 5204 Spring Modeling a Bounded Buffer Suppose that the buffer has get and put operations and can hold up to three messages. Buffer 0 = put.Buffer 1 Buffer 1 = put.Buffer 2 + get.Buffer 0 Buffer 2 = put.Buffer 3 + get.Buffer 1 Buffer 3 = get.Buffer 2 It is sometimes useful to think of the “agent” as being Buffer 0 while the other equations define “states” of this agent. So, Buffer 2 might be thought of as the “state” of the buffer when there are two messages present. Notice that this captures the idea that a get operation is not possible when the buffer is empty (i.e., in state Buffer 0 ) and a put operation is not possible when the buffer is full (i.e., in state Buffer 3 ).

CS 5204 Spring Modeling a Bounded Buffer The Buffer equations might be thought of as the “specification” of the bounded buffer because it only refers to states of the buffer and not to any internal components or machinery to create these states. An “implementation” of the bounded buffer is readily available by re-labeling the BUFF3 agent developed earlier CELL = a.b.CELL C0 = CELL [ c / b ] C1 = CELL [ c / a, d / b ] C2 = CELL [ d / a ] BUFF3 = ( C0 | C1 | C2 ) \ { c, d} BufferImpl = BUFF3 [ put / a, get / b ]

CS 5204 Spring Depicting an Agent's Behavior a ... (A|B)\c (A'|B)\c (A|B')\c... Recall: A = a.A' B = c.B' A' = c.A B' = b.B System = ( A | B ) \ { c } Draw a graph to show all possible sequences of actions. Here is the start:

CS 5204 Spring More of the Agent’s Behavior

CS 5204 Spring Depicting an Agent's Behavior a  (A|B)\c (A'|B)\c (A|B')\c a (A'|B')\c b b But how do we know (formally) that this graph correctly depicts the behavior of the agents? Answer: the following axioms.

CS 5204 Spring The Axioms

CS 5204 Spring Using the Axioms

CS 5204 Spring Equivalence of Agents

CS 5204 Spring Equivalence of Agents

CS 5204 Spring Equivalence of Agents

CS 5204 Spring The Edinburgh Concurrency Workbench

CS 5204 Spring The Edinburgh Concurrency Workbench