The effect of partiality and adaptivity on the complexity of FSM state identification problems

. State identification is a long standing problem in the area of Finite State Machine (FSM) based modeling and testing of discrete event systems. For the identification of the current state of the system, so-called homing and synchronizing experiments with FSMs are used whereas for the initial state identification one can perform a distinguishing experiment. The homing, synchronizing, and distinguishing experiments are known as “gedanken” experiments, and the sequences for these experiments can be derived for deterministic and nondeterministic, partial and complete specification FSMs that are used to formally represent the required behavior of systems under investigation. The problems of checking the existence and derivation of homing, synchronizing, and distinguishing sequences are known to become harder as a specification FSM turns to be nondeterministic and partial. It is also known that in some cases the complexity can be reduced through a ‘switch’ from preset to adaptive experiment derivation. In this paper, we study how the partiality and adaptivity affect the complexity of checking the existence of homing/synchronizing/distinguishing sequences for deterministic and nondeterministic FSMs and visualize the complexity issues via appropriate figures. We also mention that the existing solutions to state identification problems are widely used for verification and testing of finite state transition systems.


Introduction
The state identification problem using gedanken experiments with Finite State Machines (FSMs) is a long standing problem. The first results were obtained by Moore [1] and have been then improved by many researchers. For the identification of the current state of the system, so-called homing and synchronizing experiments are used whereas for the initial state identification one can perform a distinguishing experiment. The first results on the state identification problem were obtained for complete deterministic FSMs [1][2][3][4] while nowadays the homing, synchronizing, and distinguishing sequences are derived for deterministic and nondeterministic, observable and non-observable, partial and complete specification FSMs that are used to formally model the required behavior of systems under investigation. References [1][2][3][4][5][6][7][8][9][10][11][12][13][14][15][16] present only a short list of existing papers on this topic. An FSM is a 4-tuple with finite non-empty sets of states, inputs and outputs; it moves to the next state producing an output when an input is applied. An FSM is complete and deterministic if at each state for each input, there is exactly one transition.
FSM state identification experiments include homing/synchronizing/distinguishing experiments (and corresponding input sequences), which are known to be either preset or adaptive. A sequence is adaptive if the next input to be applied to an IUT is chosen based on the previously observed outputs; otherwise, the sequence is preset. Homing and synchronizing sequences are used for identifying the current state of the machine under experiment while distinguishing sequences identify its initial state. The methods for deriving homing/synchronizing/distinguishing sequences are well elaborated for complete and deterministic FSMs. In this case, the length of most such sequences is polynomial with respect to the number of FSM states but it is nearly to impossible to derive a complete specification for modern interactive digital systems due to their complexity. Moreover, current specifications often include various options for output responses under the same input. That is the reason why nowadays nondeterministic and partial FSM models attract a lot of attention [17,18]. The problems of checking the existence and derivation of homing, synchronizing, and distinguishing sequences are known to become harder as the specification FSM turns to be nondeterministic and partial. It is also known that in some cases the complexity can be reduced through a 'switch' from preset to adaptive experiment derivation [6]. Partiality and adaptivity can be considered like two forces working in the opposite directions. Partiality tends to make the problems more complex, and adaptivity tends to make the problem solutions simpler. Correspondingly, it is interesting to study the dynamics here. Why in some cases partiality beats adaptivity, and why in some cases adaptivity beats partiality? Thus, one of the contributions of the paper is to pose this question as a new problem in this area.
In this paper, we also collect the results of how the partiality and adaptivity affect the complexity of checking the existence of homing/synchronizing/distinguishing sequences for deterministic and nondeterministic FSMs. Given a complete deterministic strongly connected reduced FSM, the problem of checking the existence of preset homing and synchronizing sequences is in P [5] while for distinguishing sequences it is PSPACE-complete [6]; the latter means that there exists a complete deterministic FSM such that the length of a shortest distinguishing sequence is exponential with respect to the FSM size. The polynomial complexity is preserved for adaptive homing/synchronizing sequences and the problem of checking the existence of an adaptive distinguishing sequence also 'falls into' P, i.e., in the latter case, the adaptivity reduces the problem complexity. For partial deterministic FSMs, the complexity of checking the existence of an adaptive distinguishing sequence is also in P, i.e., for distinguishing sequences the partiality does not destroy the polynomial complexity. That is not the case for homing and synchronizing sequences, since given a partial deterministic reduced strongly connected FSM, the problem of checking the existence of an adaptive homing or synchronizing sequence is PSPACE-complete [14]. For nondeterministic complete observable FSMs, checking the existence of a preset homing/synchronizing/distinguishing sequence is PSPACE-complete [5,6,15] and in this paper, we show that it is the same for partial machines. For nondeterministic complete FSMs the adaptivity reduces the complexity of the problem of checking the existence of a homing/synchronizing sequence as the problem 'falls into' P [8,13]. For distinguishing sequences, it is proven that there exists a class of FSMs where the length of a shortest adaptive distinguishing sequence is exponential with respect to the number of FSM states [16]. Moreover, in this paper, we strengthen this result by proving the same result for 2-input FSMs. For partial nondeterministic observable FSMs, the problem of checking the existence of an adaptive homing/synchronizing sequence is shown to be PSPACE-hard and in this paper, we show that it is PSPACE-complete. We also show that the problem of checking the existence of an adaptive distinguishing sequence for complete nondeterministic FSMs is out of P. Finally, all the results on the complexity of the existence check of homing/synchronizing/distinguishing sequences for deterministic and nondeterministic, complete and partial FSMs are collected together and the complexity issues are visualized via appropriate figures. Therefore, the main contributions of the paper are as follows. First, we identify the phenomenon of the dependency between partiality and adaptivity, and their influence on the complexity of "gedanken" experiments for FSMs. Second, we collect and visualize the known results in the area. Third, we close some gaps in the area, in particular, we show that differently from deterministic machines the adaptivity does not help to reduce the complexity of adaptive distinguishing experiments for nondeterministic 2-input FSMs. The structure of the paper is as follows. Section 2 contains the preliminaries. Section 3 is devoted to exhibit how partiality and adaptivity affect the FSM state identification problems for deterministic FSMs while nondeterministic FSMs are considered in Section 4. Section 5 concludes the paper. otherwise, the machine is non-observable. In this paper, we consider only observable FSMs. In usual way, the FSM behavior is extended to sequences of inputs and outputs, i.e., input/output sequences /β,   I*, β  O*. Given a state s and an input sequence .i, the input sequence .i is a defined input sequence at state s if  is a defined input sequence at state s and i is a defined input at each state of the -successor of s. The set out(s, ) includes all possible output responses for the defined sequence  at state s. A trace of S at state s is a sequence of input/output pairs of sequential transitions starting from state s. As usual, for state s and a sequence   (IO)* of input-output pairs, the -successor of state s is the set of all states that are reached from s by trace . If  is not a trace at state s then the -successor of state s is empty or we simply say that the -successor of state s does not exist. As usual, the input (output) sequence of  is the input (output) projection of . For an observable FSM S, for any sequence   (IO)*, the cardinality of the -successor of state s is at most one. In this paper, an FSM under experiment is considered to be strongly connected, i.e., we assume that for every two states s 1 and s 2 there is a trace that can take the machine from state s 1 to state s 2 , i.e., state s 2 is reachable from state s 1 via some trace.

Preliminaries
If an FSM has the assigned initial state s 0 then it is an initialized FSM (S, s 0 , I, O, h). An initialized FSM S is acyclic if the set of traces at the initial state is finite, i.e., the FSM transition diagram has no cycles. An initialized, single-input, output-complete, and observable FSM P such that each state is reachable from the initial state, over input alphabet I and output alphabet O with an acyclic transition graph is a test case (over alphabets I and O). A test case P over alphabets I and O is a test case for FSM S that can be partial and nondeterministic if for each trace γ(io) of FSM P at the initial state, it holds that if γ is a trace at a state s of S then i is a defined input at all states in the -successor of s. A state p of P without any transitions is a deadlock state. A trace from the initial state to a deadlock state is a complete trace of P. Note that when S is complete, any test case P over input alphabet I and output alphabet O is a test case for S and if |I| > 1 then a test case P is a partial FSM. According to [8], a test case P for S specifies an adaptive experiment with S. The length or the height of a test case is the length of a longest trace from the initial state to a deadlock state. A test case P for an FSM S is a distinguishing test case (DTC) for S if for each complete trace  of P, the trace  is a trace of at most one state of the FSM S. A test case P for an FSM S is a homing test case (HTC) for S if for each complete trace  of P, the -successor of the set S has at most one state. An FSM S is adaptively distinguishing (adaptively homing) [8] if there exists a DTC (HTC) for S. Given a possibly nondeterministic observable partial FSM S, an input sequence  is a distinguishing sequence if  is a defined input sequence at each state and for every two different states s 1 and s 2 , out(s 1 , ) and out(s 2 , ) do not intersect. An input sequence  is a homing sequence if it is a defined input sequence at each state and for each input/output sequence /, the non-empty /-successors of two initial states coincide. The sequence  is a synchronizing sequence if it is a defined input sequence at each state and for every two states s 1 and s 2 , the -successors of s 1 and s 2 are singletons and coincide. As synchronizing sequences are usually constructed for finite automata, researchers also use the notion of a finite automaton (FA, without empty messages, initial and final states) [19]. The sequence  is a synchronizing sequence for an FA [20] if  is a defined sequence of actions at each state of the automaton and for every two states s 1 and s 2 , the -successors of s 1 and s 2 are singletons and coincide. If such a sequence exists, the automaton is called synchronizing.

How adaptivity and partiality affect the complexity of distinguishing/homing/synchronizing experiments for deterministic FSMs
In this section, we consider possibly partial deterministic FSMs, which are reduced and strongly connected. Given a possibly partial deterministic FSM S, S is reduced if for each two different states s 1 and s 2 there exists an input sequence  that is a defined input sequence at both states such that output responses to  at states s 1 and s 2 are different. For other kinds of deterministic FSMs more results on homing/synchronizing sequences can be found in [5,14].

Distinguishing experiments
It is known [6] that the problem of checking the existence of a distinguishing sequence for deterministic complete FSMs is PSPACE-complete and the length of such a sequence can be exponential with respect to the number of FSM states. A distinguishing sequence for a possibly partial deterministic FSM can be derived by the following procedure.
labeled with a set P  S 2 is a leaf if one of the following conditions holds. Rule 1: The set P has only singletons. Rule 2: There exists a node at the j th level, j, j < k, labeled with a set R such that P contains each pair of R that is not a singleton. Rule 3: There does not exist an input defined at every state of each pair in P. Rule 4: For each input i, states of some pair of P have the same io-successor.
Step 2. If all the tree paths are terminated using Rules 2, 3 and 4 then return reply «There is no distinguishing sequence for the FSM S». If there exists a path terminated using Rule 1, then the sequence  labeling this path is a distinguishing sequence for the FSM S. Due to the above procedure, for each input the set of pairs of states of the given FSM is considered. On the other hand, the problem is known to be PSPACEcomplete for deterministic complete FSMs and thus the following statement holds. Proposition 1. The problem of checking the existence of a distinguishing sequence for a possibly partial deterministic FSM is PSPACE-complete. In [6], the authors show that the existence check and the derivation of a DTC 1 for a complete deterministic FSM is in P. In [10], Hierons and Türker presented a method 1 In [10], a DTC is called as an Adaptive Distinguishing Sequence (ADS) q p s s , to check the existence of a DTC for a partial deterministic FSM by augmenting the partial FSM up to a complete FSM and show that the upper bound on the height of the DTC is polynomial with respect to the number of FSM states. The upper bound on the length of a shortest adaptive distinguishing sequence was improved in [11]. Correspondingly, the conclusion can be drawn that the problem of checking the existence of a DTC for a possibly partial deterministic FSM is in P, i.e., the FSM partiality does not destroy the polynomial complexity for DTCs. To illustrate the effects of adaptivity and partiality on checking the existence of a distinguishing sequence for a deterministic FSM we present these results in Fig. 1. We hereafter notice that when the upper bound of the shortest distinguishing/homing/synchronizing sequence is known to be exponential but the tight upper bound is unknown, we denote this fact by putting O(2 n ) for the sequence length.

Homing experiments
It is known [4,5] that a homing sequence always exists for deterministic complete strongly connected reduced FSMs, and the length of a shortest homing sequence is polynomial, O(n 2 ), with respect to the number n of FSM states. The upper bound of the length of the homing experiment remains the same for the adaptive case [21]. An algorithm that is very similar to Algorithm 1 can be used when deriving a preset homing sequence for a possibly partial deterministic FSM. The condition "states of any pair of P do not have the same io-successor (for any output o  O)" at Step 1 and Rule 4 should be deleted. Proposition 2. The problem of checking the existence of a homing sequence for possibly partial deterministic FSM is in PSPACE.
In [14], the authors also show the hardness of this problem. In fact, they prove that the problem of checking the non-emptiness of the language of the product of k finite automata can be reduced to the problem of checking the existence of a homing sequence for partial reduced strongly connected deterministic FSM and thus, the following statement holds. Proposition 3 [14]. 1) The problem of checking the existence of a homing sequence for deterministic reduced strongly connected partial FSMs is PSPACE-complete.
2) The problem of checking the existence of an adaptive homing sequence for (unreduced and reduced) deterministic strongly connected partial FSMs is PSPACEcomplete. Correspondingly, the conclusion can be drawn that the problem of checking the existence of a homing sequence for possibly partial deterministic FSM is PSPACEcomplete even for the class of reduced strongly connected FSMs, i.e., the FSM partiality destroys the polynomial complexity for preset and adaptive homing sequences. We present the impact of adaptivity and partiality on checking the existence of a homing sequence in Fig. 2.

Synchronizing experiments
Given an FSM, the problem of deriving a synchronizing sequence can be reduced to deriving such a sequence for an automaton that is obtained by erasing transition outputs. Correspondingly, the problem of checking the existence of a synchronizing sequence for complete deterministic FSMs is known to have the polynomial complexity [5]. However, for the automaton that is obtained from a partial FSM by erasing the output action at each transition, the problem is PSPACE-complete [22]. Using a bit modified termination rules in Algorithm 1 for getting a synchronizing sequence one can conclude the problem of checking the existence of a synchronizing sequence for deterministic partial FSMs is PSPACE-complete. Once a homing sequence is constructed for a deterministic strongly connected possibly partial FSM, an adaptive synchronizing sequence can be constructed similar to that for complete machines [5], i.e., by prolonging a homing sequence with a corresponding transfer sequence that takes a machine under investigation to a given state s. Therefore, the following statement can be established. Proposition 4. The problem of checking the existence of a synchronizing test case for deterministic strongly connected partial FSMs is PSPACE-complete. Correspondingly, the conclusion can be drawn that the problem of checking the existence of a synchronizing sequence for possibly partial deterministic FSM is PSPACE-complete even for the class of reduced strongly connected FSMs, i.e., the FSM partiality destroys the polynomial complexity for adaptive synchronizing sequences. The impact of adaptivity and partiality on checking the existence of a synchronizing sequence for a deterministic FSM is presented in Fig. 3.

How adaptivity and partiality affect the complexity of distinguishing/homing/synchronizing experiments for nondeterministic FSMs
In this section, we study how adaptivity and partiality affect the complexity of distinguishing/homing/synchronizing experiments for nondeterministic FSMs.

Distinguishing experiments
In order to describe the set of all distinguishing sequences for a nondeterministic possibly partial FSM we use the procedure for deriving an appropriate automaton proposed in [23] with slight modifications. For a nondeterministic FSM S = (S, I, O, h), S = {s 1 , s 2 , …, s n }, we derive an automaton S 2 dist such that the set of (all) synchronizing sequences of this automaton coincides with the set of (all) distinguishing sequences of FSM S, i.e., L dist (S) = L synch (S 2 dist ). Based on the construction of S 2 dist , similar to [23], the following result can be established. Proposition 5. An input sequence α is a distinguishing sequence for the FSM S if and only if α is a synchronizing sequence for S 2 dist . This result means that the set of all distinguishing sequences of the possibly partial and nondeterministic FSM S coincides with the set of all synchronizing sequences of the automaton S 2 dist , i.e., L dist (S) = L synch (S 2 dist ). Given a partial observable nondeterministic FSM S, the automaton S 2 dist derived by Algorithm 2 can be nondeterministic and partial, since for some pair (s j , s k ), j < k, of states of FSM S, there can be no transition to different pairs under an input i if states s j and s k have the same non-empty io-successor for some output o or the input i is an undefined input for some state of the pair. Therefore, taking into account the complexity of the existence check for the synchronizing experiments and the fact that the problem of deriving a distinguishing sequence for complete deterministic FSMs is PSPACE-complete, we conclude the following. Proposition 6. The problem of checking the existence of a distinguishing sequence is PSPACE-complete for observable complete and partial nondeterministic FSMs. The length of a shortest distinguishing sequence for complete observable machines with n states is known to be O( ) and cannot be more for partial observable nondeterministic FSMs according to Algorithm 1 that can be applied for nondeterministic observable FSMs. We now show that the problem of checking the existence of an adaptive distinguishing test case for a complete observable FSM is PSPACE-hard. In order to prove this, we will show that for any integer n, one can construct a 2-input FSM S such that the size of FSM S is polynomial in n, but the minimal length of an adaptive test case for a subset of n states of S is exponential in n. In fact, this strengthens the previous result [16] where the exponential height of a DTC was proven for an FSM with the exponential number of inputs. Let n  2 be an integer and p 1 , p 2 , …, p n be the first n different primes considered in increasing order. Furthermore, let  n = p 1 + p 2 + … + p n be the sum of the first n primes, and let  n = p 1  p 2  …  p n be the product of the first n primes. For n  2, we show that there exists an FSM S n with  n states such that the minimal length of an adaptive test case for a subset with n states equals  n . Note that  n is polynomial in n and  n is exponential in n. The state set of the FSM is S = {1, 2, …,  n }. We consider the set of states partitioned into n subsets S 1 , S 2 , …, S n , where S j = {  jp j + 1,  jp j + 2, …,  j }, for 1  j  n. An FSM has two inputs i 1 and i 2 and the set of outputs is {0,  1 ,  2 , …,  n }. The transitions under i 1 constitute a cycle of length p j for the states in S j , for 1  j  n, with the same output 0. Formally, for a state k  S j , for 1  j  n, we have the transition (k, i 1 , 0, K) where K = k + 1 if k <  j and K =  jp j + 1 if k =  j . For a state  j , for 1  j  n, we have the transition ( j , i 2 ,  j ,  j ). Finally, for a state k  S j \{ j }, for 1  j  n, we have the transitions (k, i 2 ,  1 ,  1 ), (k, i 2 ,  2 ,  2 ), …, (k, i 2 ,  n ,  n ). Transitions under i 2 distinguish only states of the subset b = { 1 ,  2 , …,  n }. An example of such an FSM for n = 3 is shown below inTab. 1. The number of states is  3 = 2 + 3 + 5=10.  By definition, only states  1 ,  2 , …,  n can be distinguished by i 2 ; therefore, until this subset is reached states of any other subset of cardinality more than two cannot be distinguished. Moreover, input i 2 cannot be applied when analyzing such a subset due to merging reasons. Given the initial subset c = {1,  1 +1,  2 +1, …,  n-1 +1} of n states, the subset b can be reached from c only when input i 1 is applied  n times, that is known to be exponential in n. Proposition 7. The length of a shortest DTC for S n is at least  n . The height of a shortest adaptive distinguishing test case for a complete observable FSM with n states is known to reach 2 nn -1 [8,16]. However, the machines of the proposed class have exponential number of inputs with respect to the number of states. On the other hand, given an arbitrary observable FSM, we still have no procedure for deriving an adaptive distinguishing experiment by using a memory of polynomial size. For this reason, Fig. 4 has only the upper bound on the length of an adaptive distinguishing experiment.

Homing experiments
For complete reduced deterministic FSMs a homing sequence always exists. For complete nondeterministic but observable FSMs the problem becomes PSPACEcomplete. In order to describe the set of all homing sequences for a nondeterministic possibly partial FSM we again use the procedure (with slight modifications) for deriving an appropriate automaton in [23]. For a nondeterministic FSM S = (S, I, O, h), S = {s 1 , s 2 , …, s n }, we derive an automaton S 2 home such that the set of (all) synchronizing sequences of this automaton coincides with the set of (all) homing sequences of FSM S, i.e., L home (S) = L synch (S 2 home ). The derivation of this automaton is very close to S 2 dist : we do not care if for some o  O, the io-successors of states s j and s k coincide. Differently from complete nondeterministic FSMs, the automaton S 2 home can be partial and nondeterministic. Similar to [32], it can be shown that the set of synchronizing sequences of the automaton S 2 home coincides with the set of all homing sequences of the FSM S. Proposition 8. An input sequence α is a homing sequence for the FSM S if and only if α is a synchronizing sequence for S 2 home . The length of a shortest homing sequence for a complete observable FSM with n states is known to reach 2 n-1 -1 [8]. This means that the complexity of checking the existence of a homing sequence for nondeterministic observable FSMs cannot be in NP. Therefore, taking into account the complexity of the existence check for the synchronizing sequences, we conclude the following. Proposition 9. The problem of checking the existence of a homing sequence is PSPACE-complete for observable complete and partial nondeterministic FSMs. For complete FSMs the complexity of checking the existence of a homing test case is in P [8]. For partial deterministic FSMs it was shown that the problem is PSPACE-complete [14], i.e., the partiality destroys the polynomial complexity for adaptive homing sequences. The impact of adaptivity and partiality on homing experiments for nondeterministic FSMs is shown in Fig. 5.

Synchronizing experiments
As the problem of checking the existence of a homing sequence for complete and partial nondeterministic FSMs is PSPACE-complete, the problem of checking the existence of a synchronizing sequence for complete and partial nondeterministic FSMs is not easier, but it is known to have the same complexity.
For adaptive experiments, it was shown that for complete nondeterministic FSMs the existence check of an adaptive synchronizing sequence/test case is in P [12].

Fig. 6. How partiality and adaptivity affect the complexity of synchronizing experiments for nondeterministic FSMs
The problem of checking the existence of an adaptive homing sequence for deterministic partial FSMs is PSPACE-complete, and thus, the existence check of an adaptive synchronizing sequence for nondeterministic observable partial FSMs is PSPACE-hard. The impact of adaptivity and partiality on synchronizing experiments for nondeterministic FSMs is shown in Fig. 6.