Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 6 of 14

Feasibility of formal model checking in the Vitatron environment: Chapter 2Model checking, pages 27 to 32

Pages 27 to 32 of 91, from Feasibility of formal model checking in the Vitatron environment

The original document is the PDF (6.4 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

Filed in the catalog under the Vitatron EE244

Page 27

nonnegative real number. The timed automata in a model and the way they interact with each other together define a timed transition system. Besides ordinary action transitions that can represent input, output and internal actions, a timed transition system has time passage transitions. Such time passage transitions result in synchronous progress of all clock variables in the model. This makes it possible to base decisions on the moment in time on which they are taken, which is done by so-called clock constraints. A clock constraint depends on one or more clock values and can either be an invariant of a component state (defining the time period(s) in which the component may reside in this state) or a guard on a transition (defining under which time conditions this transition may be taken). Figure 2.6 shows a timed transition system that consists of one process. We see that state A has an invariant, which is a clock constraint specifying that the clock variable c may be at most 10 in that state. Furthermore, the transition to state B has a guard, which is a clock constraint specifying that this transition may only be taken if c is at least 5. Because state A is the initial state of this process (indicated by the double circle) and c is initialized to 0 (clock variables are always initialized to 0), the system first performs a time passage action in state A through which time passes by any value between 5 and 10. After this time passage action the value of c has been increased to a value between 5 and 10, hence the system can perform the ordinary transition to state B.

Figure 2.6: Example of time passage action [5] contains a useful description of the formal semantics of timed automata and of algorithms and tools that are developed to analyze and verify timed automata.

2.2.2

Model specification

In Uppaal, timed automata are specified as graphs by putting locations, and edges between those locations, onto a worksheet and by editing the special properties of the locations and edges. Note that Uppaal depicts process states as locations and process transitions as edges to make clear the difference with the state of the complete system and a transition in the system. Besides clock variables, an Uppaal model can contain bounded discrete variables that are part of the system state. These variables are used as in programming languages: they are read, written, and are subject to common arithmetic operations. In the model, one can declare local constants, variables and functions for each process and global constants, variables and functions, which can be used by all processes. Uppaal provides predefined types for these constants and variables: integers, booleans and clocks and also custom types can be used, including (multidimensional) arrays, records, and structured types. The notational style of the declarations is based on that of C. A state of the system is defined by the locations of all automata, the clock constraints, and the values of the discrete variables. The system as a whole moves to another state in three cases: if a time passage action is performed in the complete system (which increases all clock values with the same value and possibly changes the truth value of the clock constraints), 26

Page 28

if an (ordinary) action is performed by one of the automata, and if two (or more) different automata synchronize over a channel, which means that transitions of these automata are performed in parallel. The behavior of each individual automaton is defined by the locations and the edges of the automaton and their (optional) properties. We first describe the properties of edges: • Selection: Selections non-deterministically bind a given identifier to a value in a given range. The other three properties of an edge are within the scope of this binding. It is also possible to bind multiple identifiers. This mechanism corresponds to quantifying over a data type. • Guard: An edge is enabled in a state if and only if the guard evaluates to true. A guard must be a conjunction of simple conditions on clocks, differences between clocks, and boolean expressions not involving clocks. The bound must be given by an integer expression. • Synchronization: Processes can synchronize over channels. The channel, on which there is communication, must be globally declared. The intuition is that two processes can synchronize on enabled edges annotated with complementary synchronization labels, i.e. two edges in different processes can synchronize if the guards of both edges are satisfied, and they have synchronization labels e1 ? and e2 ! respectively, where e1 and e2 evaluate to the same channel. When two processes synchronize, both edges are fired at the same time, i.e. the current location of both processes is changed. The update expression on an edge synchronizing on e1 ! is executed before the update expression on an edge synchronizing on e2 ?. It’s also possible to define a channel as a broadcast channel. On a broadcast channel there can be multiple receivers synchronizing with one sender. • Update: When executed, the update expression of the edge is evaluated. The side effect of this expression changes the state of the system. An update expression can consist of variable assignments and function calls. Locations can have the following (optional) properties: • Name: a unique name of the location. Necessary when a location must be referenced in a property (which is verified by model checking). • Invariant: constraint on clock variables that must always hold when the timed automaton is in this location. System states which violate the invariants of locations are undefined; by definition, such states do not exist. An invariant is an expression that satisfies the following conditions: it is side-effect free; only clock, integer variables, and constants are referenced; it is a conjunction of conditions of the form x < e or x ≤ e where x is a clock reference and e evaluates to an integer. • Initial: boolean property that indicates whether or not the location is the initial location of the process. • Urgent: boolean property that indicates whether or not a location is ‘urgent’. Urgent locations are semantically equivalent to adding an extra clock x, that is reset on all 27

Page 29

incoming edges, and having an invariant x ≤ 0 on the location. Hence, time is not allowed to pass when the system is in an urgent location. • Committed: boolean property that indicates whether or not a location is ‘committed’. Committed locations are even more restrictive on the execution than urgent locations. The system state is committed if any of the locations in the state is committed. A committed state cannot delay and the next transition must involve an outgoing edge of at least one of the committed locations. Note that a location can not be both urgent and committed. Figure 2.7 presents nearly all properties of edges and locations in an example model; comments are added to explain the elements of the model. The initial locations of the models are indicated by a double circle and all locations are labeled with their name. Note that the files in which the variables and functions are declared are included as rectangles in the figure.

Figure 2.7: example model containing most Uppaal constructs In figure 2.8 an Uppaal model specification of the coffee machine system is given. The left hand side shows a timed automaton that represents the state transition diagram of figure 2.2. To give an example of the use of clock variables, we have added a timeout feature: after choosing a drink, the user must insert enough money within 30 time units; if this does not happen, all inserted money is returned and the machine is reset. On the right hand side a timed automaton is included that models the user expectations of the system. Without this user model, verification is impossible since the purpose of the coffee machine model is reacting to ‘external’ inputs. Note that we have omitted the declaration files from the picture. The edges are labeled with their properties in the same order as described above (which is also the order in which they occur in figure 2.7). Some edges synchronize over a channel from an array. For example the loop transition of location wait synchronizes over one of the channels from array coin; selection is used to quantify over the possible index values, which indicate the value of the coin that is inserted by the user. The edge from location wait to 28

Page 30

Figure 2.8: Uppaal model of coffee machine (left) and user (right) location prepared calls a locally defined function prepare with argument choice, which is a local variable. Location served is made committed so that too much inserted money is immediately returned after serving the drink. An invariant is added to the location wait which specifies that the value of the clock variable timer must always be at most 30 in this location. Because the clock variable is reset on entering the location wait, this invariant specifies that the automaton can reside at most 30 time units in this location. The edge from wait to start that returns all inserted money is only enabled if the value of timer is at least 30; together the guard on this edge and the invariant of wait make sure that the system is reset when 30 time units are passed in location wait. Note that the combination of this coffee machine model and user model implies that the user only accepts serving of the chosen drink. Should the coffee machine (due to a modeling fault) try to serve the wrong drink, the system will end up in a deadlock situation, because on a certain moment the two models try to synchronize over two different channels from the array serve.

2.2.3

Simulation and verification

The built-in simulator of Uppaal can be used to examine the specified model by manually or automatically (and randomly) stepping through the model. It has already been noted that there are two types of transitions in a network of timed automata: time passage transitions which model the passing of time without changing the current location and action transitions which model changing of location in one or more (when synchronization is involved) processes. In the simulator only action transitions are stated explicitly, but delay transitions are combined with the possible action transitions when it does make sense when the action transition is performed. For example, when performing edge e before t = 5 has a different result than performing the same edge on or after t = 5 then the simulator will show two possible transitions: edge e in the time interval [0, 5i and edge e in the time interval [5, ∞i. The verifier can be used to perform the actual model checking of a desired property. The verifier uses a symbolic technique that reduces verification problems to that of efficient manipulation and solving of constraints, which are conditions on clock variables (see section 2.2.1). Furthermore the verifier uses “on-the-fly” exploration of the state-space of the specified model. For the verification, various options are available; these include possible state space 29

Page 31

reduction techniques, different search orders and the possibility to request a diagnostic trace. A diagnostic trace can be a counterexample or witnessing trace (depending on the kind of property), that is generated during verification. The trace is loaded into the simulator after verification, so that one can check why the property is (not) true. Properties are specified in Uppaal’s requirement specification language, which is a restricted temporal logic (see section 2.0.2) and has the following BNF-grammar: Prop ::= A[] Expression | E<> Expression | E[] Expression | A<> Expression | Expression --> Expression Expressions can contain all global and local variables and can be built up from all well-known boolean and arithmetic operators. All expressions must be side effect free. Furthermore it is possible to test whether a certain process is in a given location using expressions of the form process.location. The semantics of the property constructs are as follows: • Possibly E<>: The property E<> p evaluates to true for a timed transition system if and only if there is a sequence of alternating time passage transitions and action transitions s0-->s1-->...-->sn, where s0 is the initial state and sn satisfies p. • Invariantly A[]: The property A[] p evaluates to true if and only if every reachable state satisfies p. • Potentially always E[]: The property E[] p evaluates to true for a timed transition system if and only if there is a sequence of alternating time passage and action transitions s0-->s1-->...-->si-->... for which p holds in all states si and which either is infinite or ends in a state with no outgoing transition (and until infinity this state never gets an outgoing transition either). • Eventually A<>: The property A<> p evaluates to true if and only if all possible transition sequences eventually reach a state satisfying p. • Leads to -->: The syntax p --> q means that whenever p holds eventually q will hold as well. The special property A[] not deadlock can be verified to make sure that the model can’t get stuck in a deadlock state. After specifying a property the verifier can be started. Unfortunately, the graphical interface of Uppaal does not give any measure of progress during verification of the property. Although, when the command-line verifier is used, information about the throughput (number of processed states per second) and the load (number of explored states) is given during verification. When the verification has finished, a statement is returned about the validity of the property and possibly a trace is sent to the simulator which can be inspected. On the Uppaal model of the coffee machine system, we can for instance check the following properties:

30

Page 32

• “The user can choose for water” which is translated into Uppaal’s requirement specification language as follows: E<> User.chosen water. Literally this formula expresses that state chosen water in the user model is reachable. The result of the verifier on this formula will be Property is not satisfied because there is no transition in the machine model that synchronizes over the channel choose water. If we request a diagnostic trace for this property, we do not get one because such a trace does not exist. • “When a drink has been prepared, always at least 30 cents are inserted” is translated as: A[] Machine.prepared imply Machine.paid>=30. This expresses that the local variable paid is always at least 30 if the machine model is in state prepared. Verification will result in Property is satisfied because of the guard on the transition from state wait to state prepared and for this property again no diagnostic trace exists. • “After choosing coffee, the user always gets his/her coffee” is translated as: User.chosen coffee --> User.received drink, which is clearly not satisfied by the model. Requesting a diagnostic trace will give us a trace in which the user chooses a drink, does not insert any coins and after 30 time units the machine is reset without serving the coffee to the user. We have seen how to model a system in Uppaal and how to check some properties on this model. Also we have seen how simulation and diagnostic traces can provide us feedback on the model.

31