(b) extended UML state machine diagram. (a) UML state machine diagram. tr D2 tr D1 D2 D1 D2

Similar documents
Evolving Algebras and Partial Evaluation

USING ABSTRACT STATE MACHINES TO SUPPORT UML MODEL INSTANTIATION CHECKING

On Formalizing UML State Machines Using ASMs

Broy-Lamport Specification Problem: A Gurevich Abstract State Machine Solution

A Boolean Expression. Reachability Analysis or Bisimulation. Equation Solver. Boolean. equations.

Universitat Karlsruhe. Am Fasanengarten 5, Karsruhe, Germany. WWW:

Modeling Systems Using Design Patterns

Debugging Abstract State Machine Specifications: An Extension of CoreASM

Bernhard Beckert and Joachim Posegga. \term_expansion((define C as A with B), (C=>A:-B,!)). A=?B :- [A,B]=>*[D,C], D==C."

An ASM Dynamic Semantics for Standard ML

AsmL Specification and Verification of Lamport s Bakery Algorithm

Moby/plc { Graphical Development of. University of Oldenburg { Department of Computer Science. P.O.Box 2503, D Oldenburg, Germany

State Machine Diagrams

Model Driven Engineering (MDE) and Diagrammatic Predicate Logic (DPL)

Lecture 16: Hierarchical State Machines II

Program Design in PVS. Eindhoven University of Technology. Abstract. Hoare triples (precondition, program, postcondition) have

A taxonomy of race. D. P. Helmbold, C. E. McDowell. September 28, University of California, Santa Cruz. Santa Cruz, CA

such internal data dependencies can be formally specied. A possible approach to specify

KeyNote: Trust Management for Public-Key. 180 Park Avenue. Florham Park, NJ USA.

Proc. XVIII Conf. Latinoamericana de Informatica, PANEL'92, pages , August Timed automata have been proposed in [1, 8] to model nite-s

User Interface Modelling Based on the Graph Transformations of Conceptual Data Model

Structure of Abstract Syntax trees for Colored Nets in PNML

Software Engineering using Formal Methods

Flight Systems are Cyber-Physical Systems

CSE 12 Abstract Syntax Trees

How useful is the UML profile SPT without Semantics? 1

Definition of Visual Language Editors Using Declarative Languages

Formalising Concurrent UML State Machines Using Coloured Petri Nets 1

A stack eect (type signature) is a pair of input parameter types and output parameter types. We also consider the type clash as a stack eect. The set

ModelElement. AssociationEnd. Relationship 2. Association. Class. GeneralizableElement. ModelElement

Formal specification of semantics of UML 2.0 activity diagrams by using Graph Transformation Systems

Meta-Model Guided Error Correction for UML Models

Transforming UML Collaborating Statecharts for Verification and Simulation

Automation of Semantic Web based Digital Library using Unified Modeling Language Minal Bhise 1 1

Programming Languages Third Edition

76128 Karlsruhe, Germany; \term_expansion((define C as A with B), (C=>A:-B,!)).

SAMOS: an Active Object{Oriented Database System. Stella Gatziu, Klaus R. Dittrich. Database Technology Research Group

Using semantic causality graphs to validate MAS models

TOWARDS AUTOMATED VERIFICATION OF WEB SERVICES

An Abstract State Machine Interpreter for S-BPM

The Compositional C++ Language. Denition. Abstract. This document gives a concise denition of the syntax and semantics

2 nd UML 2 Semantics Symposium: Formal Semantics for UML

B2 if cs < cs_max then cs := cs + 1 cs := 1 ra

Automatic Generation of Graph Models for Model Checking

Synchronization Expressions: Characterization Results and. Implementation. Kai Salomaa y Sheng Yu y. Abstract

Reconciling Dierent Semantics for Concept Denition (Extended Abstract) Giuseppe De Giacomo Dipartimento di Informatica e Sistemistica Universita di Ro

Software Component Relationships. Stephen H. Edwards. Department of Computer Science. Virginia Polytechnic Institute and State University

Refinement and Formalization of Semi-Formal Use Case Descriptions

Coral: A Metamodel Kernel for Transformation Engines

A Formalization of Transition P Systems

Checking consistency between architectural models using SPIN

Managing test suites for services

Specifying Precise Use Cases with Use Case Charts

Towards Design Verification and Validation at Multiple Levels of Abstraction * Correct Design of Distributed Production Control Systems

Lecture 09. Spring 2018 Borough of Manhattan Community College

Thunks (continued) Olivier Danvy, John Hatcli. Department of Computing and Information Sciences. Kansas State University. Manhattan, Kansas 66506, USA

Server 1 Server 2 CPU. mem I/O. allocate rec n read elem. n*47.0. n*20.0. select. n*1.0. write elem. n*26.5 send. n*

Attribute Algebra for N-layer Metamodeling

SPARK-PL: Introduction

Model Checking Dynamic and Hierarchical UML State Machines

Outline. 1 About the course

UNIT-4 Behavioral Diagrams

Chapter 2 Entity-Relationship Data Modeling: Tools and Techniques. Fundamentals, Design, and Implementation, 9/e

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Unication or integration? The Challenge of Semantics in Heterogeneous Modeling Languages

Software Engineering using Formal Methods

Introduction to Model Checking

PragmaDev. change request. Emmanuel Gaudin. PragmaDev ITU-T SG17 change request Grimstad June 24,

Using the Metamodel Mechanism To Support Class Refinement

The language should have few implementation dependencies and should be simple, so that interactions between language features do not give unexpected b

Electrical Engineering and Computer Science Department. Ann Arbor, MI , USA. Fall 1992

2.2 Syntax Definition

Model-based Testing Using Scenarios and Event-B Refinements

Concurrent Abstract State Machines and + CAL Programs

Software Language Engineering of Architectural Viewpoints

Maciej Sobieraj. Lecture 1

1 A Tale of Two Lovers

Configuration Management for Component-based Systems

AN AGENT MODEL FOR DISTRIBUTED PART-SELECTION

Experiences with OWL-S, Directions for Service Composition:

Exercise Unit 2: Modeling Paradigms - RT-UML. UML: The Unified Modeling Language. Statecharts. RT-UML in AnyLogic

Lecture 2 - Graph Theory Fundamentals - Reachability and Exploration 1

Semantic Anchoring with Model Transformations

The Maude LTL Model Checker and Its Implementation

On the Diculty of Software Key Escrow. Abstract. At Eurocrypt'95, Desmedt suggested a scheme which allows individuals to encrypt

information is saved on a history stack, and Reverse, which runs back through a previous conservative execution and undoes its eect. We extend Forth's

the application rule M : x:a: B N : A M N : (x:a: B) N and the reduction rule (x: A: B) N! Bfx := Ng. Their algorithm is not fully satisfactory in the

these developments has been in the field of formal methods. Such methods, typically given by a

Object-Oriented Design

Shared variables in CSP

where is a constant, 0 < <. In other words, the ratio between the shortest and longest paths from a node to a leaf is at least. An BB-tree allows ecie

USING TRANSFORMATIONS TO INTEGRATE TASK MODELS IN

OpenVera Assertions. March Synopsys, Inc.

Simulation-Based Analysis of UML Statechart Diagrams: Methods and Case Studies 1

Universal Plug and Play Machine Models Modeling with Distributed Abstract State Machines

A Formal Approach to Program Modification. Lindsay Groves

SCR*: A Toolset for Specifying and. Analyzing Software Requirements? Constance Heitmeyer, James Kirby, Bruce Labaw and Ramesh Bharadwaj

JOURNAL OF OBJECT TECHNOLOGY

Towards Design Verification and Validation at Multiple Levels of Abstraction Correct Design of Distributed Production Control Systems

Business Process Modeling. Version 25/10/2012

Transcription:

A Semantic Model for the State Machine in the Unied Modeling Language Kevin Compton 1, James Huggins 3, and Wuwei Shen 1? 1 EECS Department, University of Michigan 1301 Beal Avenue, Ann Arbor, MI 48109-2122 USA kjc, wwshen@eecs.umich.edu 2 Computer Science Program, Kettering University 1700 W. Third Avenue, Flint, MI 48504-4898 USA jhuggins@kettering.edu 1 Inoduction The Unied Modeling Language (UML) is becoming a standardized modeling notation for expressing object-oriented models and designs. UML is based on an intuitive and easy to understand diagrammatic notation. Since its birth, a lot of CASE tools for UML have been generated; but the specication of the language is \semi-formal", i.e. parts of it are specied with well-dened language while other parts have been described informally in English. It is commonly admitted that a language should have a formal semantics to be unambiguous. Furthermore, the semantics must be precise if tools are to verify some properties on a model expressed in this language. A lot of methods have been presented to represent the semantics for the state machine in UML. Here we are looking for a method which can not only represent the semantics for the state machine but also execute and verify the semantic model. There has been other work on verication tool for UML. The tool vuml [8], developed in Abo Akademi University in Finland, is used to verify a UML model by using the model checker SPIN. vuml anslates the UML model into the SPIN input language PROMELA and then veries the UML model. But the SPIN input language PROMELA is not a formal language which can be applied to give a semantic model. Therefore vuml deploys suctural operation semantics to give the semantic model. This seems to us that it separates the verication model and semantic model. Fortunately Absact State Machines can avoid this separation by unifying them into one model. 2 Absact State Machine Absact State Machines (abbreviated as ASM) [1] were rst presented by Prof. Y. Gurevich ten years ago. Since then, they have been successfully used in specifying and verifying a lot of software systems. For example, they have been used to give a semantic model for several dierent styles of programming languages, like C [7] etc.. We can use an ASM interpretor to execute these semantic model [2]. Additionally, Absact State Machines are used to specify? Partially supported by NSF grant CCR 95-04375.

and verify a lot of software application (e.g. [3]). As the rst step of an ongoing project, we present an Absact State Machine Model for the UML state machine in this paper. An ASM program consists of the rules of the following forms: 1 1. Update Rule: f(s) := t is a rule with function f. Here s is a tuple (s 1 ; : : : ; s n ) of terms. The meaning of this rule is that the value of the function f at the value of the tuple (s 1 ; : : : ; s n ) is set to the value of t. 2. Conditional Rule: If g is a boolean term and R 1 and R 2 are rules then if g then R 1 else R 2 is a rule. The meaning of this rule is that if the value of g is ue then R 1 is red; otherwise R 2 is red. 3. Block: If R 1 and R 2 are rules then do in-parallel R 1 R 2 enddo is a rule with component R 1 and R 2. R 1 and R 2 are red simultaneously if they are mutually consistent; otherwise do nothing. In a general ASM program like what we will give the rules in the following, we always omit the keyword do in-parallel and enddo. In order to model a composite state in the UML state machine, we use a set of agents, each executing a set of ASM rules. To distinguish itself from the other agents, an agent a can interpret Self as a. More details about the disibuted ASMs can be found in [6]. 3 An ASM Model Now we outline the idea about how to give an ASM model for a UML state machine diagram. The UML state machine we consider is based on [10]. All ASM rules given are general purpose. More details about this can be found in [5]. Because the interrupt caused by an event implicitly aects some nodes in the UML state machine, we extend it to an extended UML state machine diagram. In an extended UML state machine diagram, when an event occurs we just need to consider how to interrupt the activity associated with a node aected by that event; and we don't need to think about the other nodes. After obtaining an extended UML state machine diagram, we give a set of ansition rules for all kinds of states in the extended UML state machine diagram. Next we consider how to derive an extended UML state machine diagram. First we consider those ansitions outgoing from a node. 2 In a UML state machine if an event associated with a ansition occurs, then not only is the source node of that ansition aected but those nodes, which are either subnodes of that ansition's source node or the ones including the ansition's source node, are aected as well. To explicitly denote these nodes aected by that ansition, we add a ansition for every aected node which is a source node of the new generated ansition. In Figures 1 and 2 readers nd how these new ansitions are added. On the other hand, we also add some ansitions in an extended UML state machine diagram for those ansitions coming into a composite node. The purpose for this is to explicitly give the target node for every ansition coming into a composite node. 1 In fact, an ASM program can be dened in a more liberal way. Some suctures inoduced like let rules make ASM program more easy to write and read and they can be anslated to the basic rules. 2 Sictly speaking, state and ansition are used in a UML state machine. And node and arc are used in an extended UML state machine diagram. But sometimes we use these names interchangeably.

(a) UML state machine diagram (b) extended UML state machine diagram Fig. 1. An arc is generated in (b) according to the arc in (a). D2 D1 D1 D2 D1 D2 (a) UML state machine diagram (b) extended UML state machine diagram Fig. 2. Some arcs are generated in (b) according to the arc in (a).

If a ansition enters a concurrent composite node and does not explicitly terminates on some of its regions, then we add some new ansitions on these implicit regions, which is shown in Figure 3. 01 0 0 1 1 01 (a) (b) Fig. 3. (a) shows an ansition in a state machine diagram terminating on a substate within a concurrent composite state. (b) shows a new arc is generated in the other region. Having derived an extended UML state machine diagram, we consider how to give a dynamic model for a state machine in UML. To model a dynamic execution of a state machine in UML, two special function CurArc and CurNode are dened to denote the current active ansition and node. The current node refers to a node whose actions are being executed. And the incoming ansition is called an active ansition. Here we illusate a simple node as an example to show that an ASM model for a UML state machine is correct. More details about an ASM model for a UML state machine can be found in [10]. The execution for a state is divided into three steps, one of which executes the eny actions, internal actions and exit actions respectively. If the guard condition associated with the current arc CurArc is ue, the node is a leaf node and the node's phase is init, then the eny action associated with the node is executed and at the same time, the node enters the phase internal exe. The macro ISREACHABLE is used to check whether the guard condition associated with the current arc CurArc is ue or not. The macro EXE ENTRY ACTION is used to execute the eny actions. The ASM for this phase is shown in Fig 4. In order to save space we use let sucture to represent that all appearances of node are replaced by targetstate(curarc) in the ASM specication. let node =targetstate(curarc) in if ISREACHABLE(node,CurArc)=ue and IsSimple(node)=ue and Phase(node)=init then EXE ENTRY ACTION(node); CurNode(Self) := node; Phase = internal exe; Fig. 4. The initial phase for a simple state.

When an agent's conol reaches a node and the node's phase is internal exe, the internal actions and activity associated with the node are executed, which is denoted by macro CREATE ACT. The ASM model for this phase is shown in Fig 5. let node = targetstate(curarc) in if ISREACHABLE(CurArc(Self))=ue and IsSimple(node)=ue and Phase = internal exe then CREATE ACT(node); Phase(node) := wait for exit; Fig. 5. The internal phase for a simple state. If a simple node is in state wait for exit and an arc, which results in a normal exit from the current node, is eligible to re, the agent will execute the exit actions and eny actions along the arc. If there is more than one completion arc which is eligible to re, a function ChooseArc returns a highest priority arc, that is about to execute. The macro ELIGIBLE2EXE is used to denote whether a completion event is eligible to re or not. The following are the denitions for the function ChooseArc and macro ELIGIBLE2EXE. ELIGIBLE2EXE(arc)= IsTriggerless(arc)=ue and HasGenEvent(arc)=ue and guard(arc)=ue ChooseArc(node)= k i ELIGIBLE2EXE(outArc k (node))=ue and (8 i: ELIGIBLE2EXE(outArci(node))=ue ) HighPriority(ourArc k (node),ourarci(node))=ue) Fig. 6. The denitions for function ChooseArc and macro ELIGIBLE2EXE. In order to execute the exit actions along the arc, we need to set some functions and the phase for the agent is also set to arc. All these actions are dened in the macro EXIT FROM NODE. And function CurNode is set to undef in that the agent is about to leave from that node. The ASM model for the last phase is shown in Fig 7. The other interesting rule related to the UML state machine is how to implement the ansition from one state into anther state. There are two ways to exit from one state into another: completion event and interruption event. If one of them is eligible to re, then an agent needs to stop all the activities being executed and start executing all exit actions in the nodes from which the arc comes. If a node, whose exit action is to be executed next, is a concurrent node, then we need to distinguish two cases. One is the execution for the exit action caused by an event belonging

let node = targetstate(curarc) in if ISREACHABLE(node,CurArc) and IsSimple(node)=ue and Phase = waiting for exit then let j=choosearc(node) in if (j!= undef) then CurNode(Self) := undef; EXIT FROM NODE(outArcj,node); Fig. 7. The last Phase for a simple state. to that concurrent node and that concurrent node's exit action is to be rst executed during the (abnormal) exit. The other is the execution for the exit action caused by the pass from its immediate subnode. If the rst case occurs, the agent needs to wait for all its child agents' executions of their exit actions to nish. If all the child agents nish their exit executions, then the agent kills all of its child agents (if they exist) and executes the action dened in EXE EXIT OUTWARDS. If the second case occurs, the agent stops the execution for exit action and waits for its parent agent to kill itself. When an agent nishes the execution for all the exit actions associated with an arc, we set function CurMode back to node, meaning a target node of the arc is a candidate to be executed in the next. The ASM specication is shown in Fig 8. 4 Conclusion In this paper we outlined the ASM model for a UML state machine diagram. ASM specication uses simple syntax and its specication can be executed and veried as well. References 1. Absact State Machine Homepage: http://www.eecs.umich.edu/gasm. 2. Matthias Anlau, XASM- An Extensible, Component-Based Absact State Machines Language, Proceeding of Absact State Machine Workshop, 2000. 3. Egon Borger. Why Use Evolving Algebras for Hardware and Software Engineering?", in M. Bartosek, J. Staudek, J. Wiedermann, eds., SOFSEM '95: Theory and Practice of Informatics, Springer Lecture Notes in Computer Science 1012, 1995, 236{271. 4. Egon Borger, A. Cavarra, and E. Riccobene. "An ASM Semantics for UML Activity Diagrams", in Teodor Rus, ed., Algebraic Methodology and Software Technology, 8th International Conference, AMAST 2000, Iowa City, Iowa, USA, May 20-27, 2000, Proceedings, Springer LNCS 1816, 2000, 293{308. 5. K. Compton, Y. Gurevich, J. Huggins, W. Shen. An Automatic Verication Tool for UML, Technical report, CSE-TR-423-00, University of Michigan, 2000. 6. Y. Gurevich. Evolving Algebras 1993: Lipari Guide. In E.Borger, editor, Specication and Validation Methods, pages 9-36. Oxford University Press, 1995.

if CurMode(Self)=interrupt or CurMode(Self)=arc then if (head(nestsucture(self)=undef) then CurMode(Self):= node; Action2ASM(action(CurArc(Self)); else if (IsCompConcur(head(NestSucture(Self)))!=ue) then EXE EXIT OUTWARDS(NestSucture(Self)); else if CurNode!=head(NestSucture(Self)) then NestSucture(Self):=undef; # deals with the second case Mod(Agent2Act(Self,head(NestSucture(Self))):=undef; CurMode(Self):=suspended; else # deal with the rst case if 8a 2 ChildAgent(Self): CurMode(a)=suspended then EXE EXIT OUTWARDS(NestSucture(Self)); 8c 2 ChildAgent(Self): KILL(c); Fig. 8. The model for executing an arc. 7. James K. Huggins and Wuwei Shen, \The Static and Dynamic Semantics of C: Preliminary Version", Technical Report CPSC-1999-1, Computer Science Program, Kettering University, February 1999. 8. Johan Lilius and Ivn Porres Paltor, vuml: a Tool for Verifyng UML Models, TUCS Technical Report No. 272, May 1999. 9. J. Lilius, I. P. Paltor. Formalizing UML state machines for model checking, TUCS Technical Report No. 273, June 1999. 10. Rational Software Corporation, Unied Modeling Language (UML), version 1.3, http://www.rational.com, 1999.