Separating Non-Determinisic Finite State Machines with Time-Outs

— In this paper we consider one of the classical finite state machine (FSM) model modifications - FSM with time-outs (or timed FSM). In this model in addition to the ordinary transitions under inputs there are transitions under time-outs when no input is applying. The behavior of many modern systems includes time-outs, for example, mobile phones, etc. In the past few years some work have been carried out on studying different relations between timed FSMs. Non-separability relation is very attractive for non-deterministic classical FSMs and FSMs with time-outs course for this relation we don’t need «all weather conditions» while testing. In this paper we present and compare two approaches for building a separating sequence for two separable FSMs with time-outs. One of them is using a conversion to classical FSMs, while another one is dealing directly with timed FSMs.


INTRODUCTION
Most of the modern discrete systems, such as digital circuits, telecommunication protocols, logical games, etc., can be described as Finite State Machines (FSM).The entry of FSM receives one of the enabled inputs and returns an output.On condition it is necessary to take into account time aspects of discrete system, time function is interposed [1][2][3][4].FSMs with introduced time function are called FSMs with time-outs or timed FSM (TFSM).Provided that input is being handled uniquely, TFSM is named deterministic, otherwise -nondeterministic.To distinguish correct and invalid TFSMs distinguishing sequences are generated.They claim exhaustive search of all TFSM's reactions to the input sequence, i.e. it is necessary to input every sequence from test suite enough times to observe all outputs of the system.Practical implementation of this assumption is almost impossible, and it's mostly used to check non-separability relation [5,6].FSMs are separable [5], if there is an input sequence (called separating sequence), such that the sets of output sequences to this sequence doesn't intersect.In this paper two different approaches for building separating sequence for FSMs with time-outs are suggested.As usual, the TFSM S is connected if for each state s there exists a timed trace that can take the machine from the initial state to state s.
State s' is called 〈i, t〉 -successor of state s, if there exists o∈O such that (s, 〈i, t〉, s', o) ∈ λ S .The set of all 〈i, t〉-successors of state s will be denoted by suc S (s, 〈i, t〉), in case of t = 0 we denote it as suc S (s, i).
An example of TFSM that describes mp3-player behavior is given below: The machine consists of the following states: Play -the music is playing, player isn't in energy-saving mode (display's on); Play\Energy Saving -the music is playing, but player is in energy-saving mode (display's off); Pause -the music is stopped, display's on; Hold -the music isn't playing, player's off (hold mode).Inputs and outputs: i 1 -player's controller is used; i 2 -play/pause button; i 3 -hold button; o 1 -display's on; o 2 -display's off.Let us observe TFSM's behavior on timed input sequence α = <i 1 ,5><i 2 ,3><i 1 ,4>.In that case the output sequence is A TFSM S = <S, I, O, s 0 , λ S > is a submachine of TFSM P = <P, I, O, p 0 , λ P > if S ⊆ P, s 0 = p 0 and each timed transition (s, <i, t>, o, s′) of S is a timed transition of P.

III. INTERSECTION OF TWO TIMED FSMS
Intersection S ∩ P of two TFSMs S = 〈S, I, O, s 0 , λ S , ∆ S 〉 and P = 〈P, I, O, p 0 , λ P , 2. T i me f u nc tio n i s d e f i ne d as Step 1: add initial state q 0 = (s 0 , 0, p 0 , 0) into Q.
Step 2: while set of states of TFSM Q has non-considered states, consider next in turn non-considered state q, step 3. Otherwise, End.
Step 3: for each input i find state q'=(s', 0, p', 0) that is isuccessor of state q.If the set Q doesn't include q' -add q' into the set St e p 4 : if there is a finite delay for state q = (s, k 1 , p, k 2 ), then: then q' := (s, k 1 + k, ∆ P (p) ↓P , 0); Extend function ∆ Q : ∆ Q (q) = (q', k); If the set Q doesn't include q', then add q' into Q.Step 2. The intersection of two TFSMs S and P (Figures 2,3) is presented in Figure 4. Step 1: construct the intersection of S and P with the help of Algorithm 1.If TFSM S ∩ P is complete, S and P couldn't be separated.End.
Step 2: Derive a truncated successor tree of S ∩ P. The root of the tree is the pair 〈q 0 , 0〉, other nodes -sets of the pairs 〈q, t〉, where q is the state of S ∩ P. k: = 0; Edge: = ∅; Q k 0 : = {〈q 0 , 0〉}; , add M to Q k + 1 and add triple (Q kj , i, M) to the set Edge.
If there exists q, 〈q, t〉 ∈ Q k j , s uc h t ha t (∆ Q (q)) ↓( N ∪ {∞}) = ∞, define minimum time-out T and set of successors R for the set Add R to Q k+1 and add triple (Q kj , T, R) to the set Edge.
Step 3: If the tree was terminated according to the Rule 1, then construct the sequence of edges (Q 0 0 , g 1 , Collect the separating sequence α = <i 1 , t 1 > … <i m , t m >: j := 0; T j := 0; r := 0; While (j ≤ k) execute: If g j ∈ I, Then i r := g j , t r := T j , r := r+1, T j := 0; Else T j := T j + g j ; j := j+1; m := r; i r := i-sep , t r := T j .If all branches of the tree were terminated according to the Rule 2, then TFSMs S and P are unseparable.

End.
The truncated tree for TFSMs S and P is presented in Figure 5: Algorithm 2 is the modification of the algorithm from [6], of deriving a separating sequence for two untimed FSMs.The modifications are associated with time-outs, because the only way to reach some states is to wait for a while.Thus in Algorithm 2 each node of the tree is not the set of states of the intersection, but the set of pairs <state, time>.For the set in the node we determine the minimal delay and the set of successors under this delay is derived in the same way as when deriving the intersection.We need the edges labeled by delay because for the timed FSMs the separating sequence is timed input sequence, so we need to wait some time before applying another input.
Rule 2 is inherited from [6] and in this case we can't separate given timed FSMs.
Since Rule 1 is also inherited from algorithm [6], and transitions under time-outs are derived according to the rules that specify the common behavior of timed systems, the sequence α = <i 1 , t 1 > … <i m , t m > derived according to Algorithm 2 will be a separating sequence for two timed separable FSMs.
It is known [6], that for given two complete separable untimed FSMs S and P, |S | = n and |P |= m, the length of a shortest separating sequence of S and P is at most 2 mn−1 , and this estimation is reachable.Since untimed FSM is a particular case of timed FSM the estimation will be the same.
Thus, in order to derive a separating sequence for two TFSMs, we transformed TFSMs into FSMs.Intersection of two FSMs could be constructed with the help of Algorithm 1 without taking into account time-outs.To construct truncated successor tree we use Algorithm 2 without time-outs [6], and then collect the sequence (if exists) with the help of step 3 (Algorithm 2).One can assure that the separating sequence for A S and A P (Figures 6 and 7) will be the same, i.e., α = <i 1 , 0><i 2 , 2>.

CONCLUSIONS
In this paper we suggested two approaches to separate TFSMs.The idea of the first approach is that we construct an intersection of two TFSMs and then find separating sequence.The main advantage of this approach is comparative simplicity due to small amount of states in intersection.Disadvantageweak theoretical basis of complete test suites derivation for TFSMs.The second approach is based on "TFSM to FSM" transformation.As a result of this transformation we have enormous increasing of states in intersection.Thus this way is hardly applicable to TFSMs with great time delays.But theoretical basis for complete test suites derivation is much more stronger for classical FSMs.In the future we're planning to compare program implementations of these two approaches in order to find out the range of applicability of each one.

FSM with time-outs is
Finite State Machine (FSM) is a quintuple S = 〈S, I, O, s 0 , λ S 〉, where S is a finite nonempty set of states with initial state s 0 , I and O -finite non-intersecting sets of inputs and outputs, λ S ⊆ S × I × S × O -transition relation.If for each pair (s, i) ∈ S×I there is at least one pair (o, s′) ∈ O×S such that (s, i, o, s′) ∈ λ S , FSM is called comlete.a sextuple S = 〈S, I, O, s 0 , λ S , ∆ S 〉, where S is a finite nonempty set of states with initial state s 0 , I and Ofinite non-intersecting sets of inputs and outputs, λ S ⊆ S × I × S × O -transition relation and ∆ S : S → S × (N ∪{∞}) -time-outs function, that defines time-out for every state.The time reset operation resets the value of the TFSM's clock to zero at the execution of the transition.If TFSM, being in certain state s 1 , doesn't receive input for a certain time t such that (s 1 , t, s 2 ) ∈ ∆ S , it transfers to the state s 2 .FSM is called observable, if for each triple (s, i, o) ∈ S×I×O there is not more, than one state s' such