CS 290C: Formal Models for Web Software Lecture 4: Implementing and Verifying Statecharts Specifications Using the Spin Model Checker Instructor: Tevfik.

Slides:



Advertisements
Similar presentations
UML Statechart semantics Speaker: Fei Mo Tutor: Priv.-Doz. Dr. Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen SS 07.
Advertisements

CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Partial Order Reduction: Main Idea
Models of Concurrency Manna, Pnueli.
CS 290C: Formal Models for Web Software Lecture 3: Verification of Navigation Models with the Spin Model Checker Instructor: Tevfik Bultan.
Vered Gafni – Formal Development of Real Time Systems 1 Statecharts Semantics.
CS 267: Automated Verification Lecture 10: Nested Depth First Search, Counter- Example Generation Revisited, Bit-State Hashing, On-The-Fly Model Checking.
 Control structures  Algorithm & flowchart  If statements  While statements.
Background information Formal verification methods based on theorem proving techniques and model­checking –to prove the absence of errors (in the formal.
1 Spin Model Checker Samaneh Navabpour Electrical and Computer Engineering Department University of Waterloo SE-464 Summer 2011.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
ECE 331 – Digital System Design
Temporal Specification Chris Patel Vinay Viswanathan.
CS 290C: Formal Models for Web Software Lecture 10: Language Based Modeling and Analysis of Navigation Errors Instructor: Tevfik Bultan.
IBM WebSphere survey Kristian Bisgaard Lassen. University of AarhusIBM WebSphere survey2 Tools  WebSphere Application Server Portal Studio Business Integration.
CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.
Software Engineering, COMP201 Slide 1 Protocol Engineering Protocol Specification using CFSM model Lecture 30.
CS 290C: Formal Models for Web Software Lecture 2: Modeling States with Statecharts Instructor: Tevfik Bultan.
Describing Syntax and Semantics
Advanced Behavioral Modeling
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.
The Model Checker SPIN Written by Gerard J. Holzmann Presented by Chris Jensen.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
Lecture 6 Template Semantics CS6133 Fall 2011 Software Specification and Verification.
Presenter : Cheng-Ta Wu Vijay D’silva, S. Ramesh Indian Institute of Technology Bombay Arcot Sowmya University of New South Wales, Sydney.
Ch.2 Part A: Requirements, State Charts EECE **** Embedded System Design.
Lecture 4 Finite State Machine CS6133 Software Specification and Verification.
IAY 0600 Digitaalsüsteemide disain Event-Driven Simulation Alexander Sudnitson Tallinn University of Technology.
Selection (if-then-else) Programming Has 3 Types of Control: Sequential (normal): Control of Execution Proceeds One after the Other Selection (if-then-else):
Compiler Chapter# 5 Intermediate code generation.
Software Engineering Research paper presentation Ali Ahmad Formal Approaches to Software Testing Hierarchal GUI Test Case Generation Using Automated Planning.
CS 3850 Lecture 3 The Verilog Language. 3.1 Lexical Conventions The lexical conventions are close to the programming language C++. Comments are designated.
CS6133 Software Specification and Verification
Lecture 05: Theory of Automata:08 Kleene’s Theorem and NFA.
Language Concepts Ver 1.1, Copyright 1997 TS, Inc. VHDL L a n g u a g e C o n c e p t s Page 1.
9-1 © Prentice Hall, 2007 Chapter 9: Analysis Classes Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
CS 290C: Formal Models for Web Software Lecture 2: Navigation Modeling with Statecharts Instructor: Tevfik Bultan.
© 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 1 UML State Diagrams.
CS3773 Software Engineering Lecture 06 UML State Machines.
7-1 © Prentice Hall, 2007 Topic 7: Analysis Classes Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey.
VHDL Discussion Subprograms IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
Digital System Design using VHDL
Essentials of Counter-Controlled Repetition Counter-controlled repetition requires: Control variable (loop counter) Initial value of the control variable.
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.
PROGRAMMING TESTING B MODULE 2: SOFTWARE SYSTEMS 22 NOVEMBER 2013.
Formal Verification. Background Information Formal verification methods based on theorem proving techniques and model­checking –To prove the absence of.
IAY 0600 Digital Systems Design Event-Driven Simulation VHDL Discussion Alexander Sudnitson Tallinn University of Technology.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 4: Introduction to C: Control Flow.
Today’s Agenda  Quiz 4  Temporal Logic Formal Methods in Software Engineering1.
CSC-305 Design and Analysis of AlgorithmsBS(CS) -6 Fall-2014CSC-305 Design and Analysis of AlgorithmsBS(CS) -6 Fall-2014 Design and Analysis of Algorithms.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Tevfik Bultan Lecture 6: Stepwise refinement revisited, Midterm review.
1 Advanced Embedded Systems Lecture 3 Specification Languages.
CSCI1600: Embedded and Real Time Software Lecture 10: Modeling IV: Compositions of State Machines Steven Reiss, Fall 2015.
Identifying & Creating Use Cases – Part 2
Analysis Classes Unit 5.
Adapted from Krste Asanovic
4.
State Machine Diagrams
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
Logical architecture refinement
Peter J. Ashenden The University of Adelaide
Advanced State Chart diagrams
CSCI1600: Embedded and Real Time Software
VHDL Discussion Subprograms
VHDL Discussion Subprograms
An explicit state model checker
CS 240 – Lecture 7 Boolean Operations, Increment and Decrement Operators, Constant Types, enum Types, Precedence.
Identifying & Creating Use Cases - Part 3
UML State Diagrams.
CSCI1600: Embedded and Real Time Software
Presentation transcript:

CS 290C: Formal Models for Web Software Lecture 4: Implementing and Verifying Statecharts Specifications Using the Spin Model Checker Instructor: Tevfik Bultan

How to model statecharts in Spin? Statecharts can be converted to flat-state machines So we can do the following: –Flatten the statecharts specification, which generates at regular state machine –Then, use the approach described in the previous slides However this approach will result in a very large and ugly state machine

How to model statecharts in Spin? Instead of flattening the statecharts, we can keep the hierarchy Declare an mtype that lists the sub-states of all OR-states in the statecharts specification Create one state variable of type mtype for each OR-state in the statecharts specification Use the same type of modeling we used for basic state machines where there is one loop and there is a switch statement in the loop with multiple selections –However, this time each selection can correspond to multiple transitions –In case of AND-states we have to do the transitions together for each sub-state

How to model statecharts in Spin? We can model the events using boolean variables –At each iteration of the loop select one event variable and set it to true –At the end of each transition set the event variable to false Following paper discusses how Statecharts models can be translated to Promela (the input language of Spin) in detail: ``Implementing Statecharts in Promela/Spin,’’ Erich Mikk, Yassine Laknech, Michael Siegel, Gerard J. Holzmann, Proceedings of the WIFT’98 Workshop

Implementing Statecharts in Promela First, the authors formally define a model called Extended Hierarchical Automata (EHA) EHA are very much like statecharts but they are simpler in a couple of ways –The transitions only happen between states that are at the same hierarchy level –Effects of a transition at the lower levels of the hierarchy is specified explicitly as part of the transition –Some advanced features of statecharts (such as history states) are not covered by EHA

Extended Hierarchical Automata (EHA) An EHA consists of a set of sequential automata (these are like regular state machines) –A sequential automaton consists of a set of states, and initial state, a set of transition labels and a transition relation There is a unique root sequential automaton Composite states are modeled by mapping states of a sequential automata to a set of sequential automata –An OR-state is mapped to a single sequential automaton representing its sub-states –An AND-state is mapped to multiple sequential automata (one for each sub-state), corresponding to concurrent execution

Transitions in a EHA Transitions in a EHA can only have their source and destination states in the same sequential automata In addition to source and destination states, the transitions also specify –Source restriction, that restricts the enabledness of the transition in sub-states of the source state –The transition guard that consists of events and assertions in the form In(state) combined with logical connectives –A set of generated events –Target determinator, that identifies which sub-states of the destination state will be entered when the transition is taken

Translation of EHAs to Promela Translation of EHAs to Promela is done as follows: For each sequential automata in EHA with n states, a variable with n+1-values is created –n-values to model the states of the sequential automata, and an extra state to model the case where the automaton does not have an active state in the current configuration Each event is modeled by one boolean variable

Translation of EHAs to Promela In order to model transitions from one configuration of the EHA to another configuration, two copies of state and event variables are needed: –pre- variables denote the state before the transition is taken –post- variables denote the state after the transition is taken

Translation of EHAs to Promela In order to do verification, it is necessary to model the system as a closed system This means that external events are converted to internal events by adding state machines with self-loops that generate such events

Translation of sequential automata to Promela This is done using switch statements as we discussed earlier in translation of basic transition systems to Promela First a switch statement is used to determine which state is active, then another switch statement is used to figure out which transition will be taken, and, finally the effect of the transition is implemented by updating the post- variables Since each state of a sequential automata in an EHA can have other sub-automata denoting its sub-states, if no transition is enabled in the current automaton, then the control is passed to its sub-automata to figure out if the current events will trigger a transition in its sub-states

Translation of sequential automata to Promela Execution of a transition must be enclosed within a atomic block to indicate that execution of a transition is done atomically (i.e., there are no intermediate states during execution of a transition) There is an initialization phase where the states of the automata are initialized by traversing the state-hierarchy in a depth-first-manner –the state of the root sequential automaton is set to its default state and all sub-automata of that default state are similarly activated, the variables implementing control states of all other automata are set to the respective non-active states and event variables are set to false – this must also be done within an atomic block

Translation of sequential automata to Promela At the end of the execution of each step –The resulting post-state is copied to the pre-state for the calculation of the next-step. –Post-state variables are reset (as in the initialization phase variables implementing control states of automata are set to the respective non-active states and event variables are set to false).