## 1 Introduction

A partial deterministic finite automaton (which we further simply call a partial automaton) is a triple , where is the set of its states, is a finite alphabet and is a partial transition function. Note that by default our definition of automata does not include initial and accepting states. If is defined for all pairs of , is called a complete automaton. A state in an automaton is a sink state if all letters map this state to itself or is undefined for this state. A partial automaton is called strongly connected

if for any ordered pair of states

there exists a word mapping to .Given a partial automaton , the rank of a word with respect to a set (respectively, to the entire automaton ) is the size of the image of (respectively, ) under the mapping defined by in , i.e. the number (). The rank of a subset of states is the minimum nonzero integer among the ranks of all words with respect to . The rank of a partial automaton is the rank of the whole set of its states. We call a word of rank with respect to a partial automaton a synchronizing word for this automaton. A partial automaton having a synchronizing word is called synchronizing (this definition differs from the definition of a carefully synchronizing partial automaton [Mar14], as well as from any of the -, -, or -directing NFAs [Mar10]). This is a natural generalization of synchronizing complete automata to partial automata. Indeed, if the input sequence containing an error contains also a synchronizing word not affected by the error, after reading this word we can resynchronize, since we know the only possible active state for the correct sequence. The rank of a complete automaton can be found in polynomial time [Rys92]. Checking whether there exists a word of rank precisely with respect to a complete automaton is PSPACE-complete for any fixed [GK95].

A set of words is birecurrent if the minimal partial automaton recognizing this set and the minimal partial automaton recognizing the reversal of this set are both strongly connected. This notion was introduced by Perrin in [Per13]. We study minimal partial automata (with initial and accepting states) recognizing birecurrent sets. This is equivalent to saying that the automaton and the determinization of the reversal of the automaton are both strongly connected [DPR17]. A set in a partial automaton is said to be saturated by a word if is a pre-image of a subset of under the mapping defined by . In other words, is saturated by , if under mapping defined by no state in is mapped to the set , and each state in is mapped to some state. In [DPR17] it is proved that a minimal strongly connected partial automaton (with initial and accepting states) recognizes a birecurrent set if and only if the set of its accepting states is saturated by a word such that the rank of with respect to is equal to the rank of (i.e., is a word of minimum rank with respect to ).

The examples of automata recognizing birecurrent sets include trim permutation automata (an automaton is called permutation if each its letter defines a bijection on the set of states) and automata recognizing a submonoid generated by a bifix code, see [DPR17] for more examples.

In this note, we answer an open question stated in [DPR17] by showing that checking whether a binary partial automaton recognizes a birecurrent set is PSPACE-complete, even in the cases where all states are accepting or the automaton is complete. We also investigate a related problem of computing the rank of a partial automaton.

## 2 Rank of Partial Automata

First, we prove a lemma that will be used to show that some problems about partial automata recognizing birecurrent sets are in PSPACE.

###### Lemma 1.

Computing the rank of a partial automaton can be done in polynomial space.

###### Proof.

First, note that checking whether there exists a word of rank can be done in polynomial space. Indeed, we can non-deterministically guess such a word (by applying it letter by letter) and check whether the size of the image of the set of states equals . Then we use Savitch theorem stating that PSPACE = NPSPACE [Sip12]. Now it remains to find such that there exists a word of rank , and either or there exists no word of rank less than . This can be done by checking all possible values of . ∎

In fact, computing the rank of a partial automaton is PSPACE-complete, and it is PSPACE-complete even to check that a partial automaton has rank . To show that, we provide a reduction from the following PSPACE-complete problem [Koz77].

Finite Automata Intersection |

Input: Complete automata (with input and accepting states); |

Output: Yes if there is a word which is accepted by all automata, No otherwise. |

###### Theorem 1.

Checking whether a partial automaton is synchronizing is PSPACE-complete.

###### Proof.

It follows from Lemma 1 that the problem is in PSPACE.

We reduce the Finite Automata Intersection to prove the hardness. Provided , , construct a partial automaton as follows. The set is the union of the sets of states of together with two new states . We can assume that one of the automata in the input accepts all words in , since adding such an automaton to the input does not change the answer. We define for , . We also define for all , where is the initial state in . We set if is an accepting state in and if is not an accepting state in . Finally, we define all letters in to act on as self-loops. Thus, we leave undefined only the transitions for the letter from the states .

We claim that is synchronizing if and ony if all accept a common word. Indeed, if is a word accepted by all automata, then is a word synchronizing . Conversely, assume that is synchronizing and is a word synchronizing . If the letter does not occur in , then the rank of is at least . Thus, contains at least one occurence of . After the first application of , the set of reached states is a subset of containing (recall that we assume one of the input automata to accept all words in ). After applying another letter, the set of the reached states will become empty or unchanged, thus we can assume that and does not contain . The image of under the mapping defined by is a subset of the set of accepting states of . Let be the suffix of after the last occurence of (or itself if does not contain ). Then the word is accepted by all the automata . ∎

However, for strongly connected partial automata the situation is different. In fact, the rank of strongly connected partial automata behaves in the way similar to the rank of complete automata.

###### Theorem 2.

A word of minimum nonzero rank with respect to a strongly connected partial automaton can be found in polynomial time.

###### Proof.

Observe that in a strongly connected partial automaton any word of nonzero rank is a prefix of a word of minimum rank. Indeed, let be a strongly connected partial automaton. Let be a word of nonzero rank and be a word of minimum nonero rank with respect to . Let be an image of some state of under the mapping defined by . Since the rank of is nonzero, there exists a state in such that is defined. Let be a word mapping to (since is strongly connected, such word exists). Then is a word of minimum nonzero rank with respect to .

Now we describe a polynomial algorithm to find a word of minimum nonzero rank with resprect to . We start with the whole set of states and an empty word , and at each step we try to to find a pair of states and a word such that either exactly one of and is defined, or they both are defined and . To find it, we solve a reachability problem in the subautomaton of the power automaton of induced by the subsets of size at most two [Vol08]. If we find such pair of states, we add as a suffix to and proceed recursively with the set of states obtained by applying the mapping defined by to each state in .

Observe that such pair of states exists if and only if the size of is more than the rank of . Indeed, since each word of nonzero rank is a prefix of some word of minimum nonzero rank, we can always reduce the size of by applying a word of minimum nonzero rank if and only if is greater that the rank of . Hence, the word thus constructed is a word of minimum nonzero rank with respect to . ∎

Observe that to merge two states in the described algorithm, we need a word of length at most , since it is the number of different two-element subsets of the set of states. To map a state to another state we need a word of length at most . Thus, we obtain the following.

###### Corollary 1.

The length of a shortest word of minimum nonzero rank in a -state strongly connected partial automaton is at most .

## 3 Automata Recognizing Birecurrent Sets

###### Corollary 2.

Checking whether a set of states of a partial automaton can be saturated by a word of minimum rank with respect to can be done in polynomial space.

###### Proof.

According to Lemma 1, computing the rank of a partial automaton can be done in polynomial space. Thus, the problem of checking whether a set of states is saturated by a word of minimum rank is in NPSPACE, since we can non-deterministically guess a word saturating and having minimum nonzero rank with respect to . All this conditions can be checked with polynomial space. Since NPSPACE = PSPACE [Sip12], the problem is in PSPACE. ∎

Now we are going to show that checking whether the whole set of states is saturated by a word of minimum rank is PSPACE-hard for strongly connected partial automata.

The following proof uses the idea of the proof from [Mar14] that careful synchronization of partial automata is PSPACE-complete.

###### Theorem 3.

Checking whether the whole set of states of a partial automaton is saturated by a word of minimum nonzero rank with respect to is PSPACE-complete.

###### Proof.

We reduce the Finite Automata Intersection problem. Given the automata , , we construct a partial automaton as follows. We set , and define for , . Next, we set for , where is the initial state of , and . Finally, we define if is accepting in , if , and leave undefined otherwise.

Let be a word mapping the initial state of to some its accepting state (we can assume that such word exists without loss of generality). Then the word has rank with respect to . Thus, the automaton has rank .

We shall prove that the set is saturated by a word of rank if and only if all accept a common word. Assume that the set is saturated by a word of rank . Then since is a sink state, and moreover we can assume that the last letter of is . Let . If does not contain , then it is a word accepted by all automata . Otherwise, consider the last occurrence of in and let be the suffix of after this occurrence. Then is a word accepted by all automata .

In the other direction, assume that the word is accepted by . Then the word is of rank and saturates the set . ∎

###### Theorem 4.

Checking whether the whole set of states of a binary strongly connected partial automaton is saturated by a word of minimum nonzero rank with respect to is PSPACE-complete.

###### Proof.

We modify the reduction in Theorem 3 to make the automaton strongly connected first. We can assume that in each automaton all states are reachable from the initial state, and at least one accepting state is reachable from each state. Let be the states in such that adding the transitions from to each makes strongly connected. Define new letters to map to and undefined for all other states. Denote the automaton thus constructed as . The rank of is by the same argument as in Theorem 3. Moreover, if is saturated by a word of rank , then each element of is first mapped to , because no letter among can be applied before that. Thus, the proof of Theorem 3 works also for , and is saturated by a word of minimum rank if and only if all accept a common word.

To make the automaton binary, we use the reduction described, for example, in Lemma 6 of [Vor16]. Define the automaton as follows. Let . Let , where . Define for , and . Set . Informally, the letter emulates choosing a letter of , and the letter emulates applying the chosen letter. Moreover, applying the word maps the set to the set . Because of this correspondence, the automaton is strongly connected, has rank , and satisfies all necessary conditions of the reduction. ∎

###### Corollary 3.

Checking whether a binary partial automaton where all states are accepting recognizes a birecurrent set is PSPACE-complete.

By using the reduction described in the proof, the following corollary of Theorem 1 can be proved. The only difference is that should be an additional letter acting as a self-loop on each state.

###### Corollary 4.

Checking whether a partial binary automaton is synchronizing is PSPACE-complete.

The next theorem uses the idea of the proof in [Vor16] that checking whether a subset of states is synchronizing is PSPACE-complete in strongly connected complete automata.

###### Theorem 5.

Checking whether a subset of states of a binary strongly connected complete automaton is saturated by a word of minimum rank with respect to is PSPACE-complete.

###### Proof.

We modify the reduction from the proof of Theorem 3. Let be a copy of . For each denote by its copy in . Define the automaton as follows. Set .

We can assume that in each automaton all states are reachable from the initial state and at least one accepting state is reachable from each state, each automaton accepts at least one word, and none of the automata accepts the whole . Let be the states in such that adding the transitions from to each makes strongly connected. Define to be together with new letters and .

For each which is not an accepting state of , define , . Define , for each . For each , , define , . Next, for define and . Define and for each and . The automaton thus constructed is complete and strongly connected.

Note that no pair of states can be synchronized. Thus, has rank , since the word has rank with respect to . We shall prove that the set is saturated by a word of rank if and only if all automata accept a common word.

If the word is accepted by all automata , then the word saturates the set . Assume now that the set is saturated by a word of rank . Let , where does not contain any of the letters , and is the first letter equal to or . If the image of under the mapping defined by has size at least two, then the state will be mapped to the image of some state of , and thus is not saturated by . Thus, maps to one state, which means that the suffix of after the last occurrence of is accepted by all automata .

To make the automaton binary, we again use the reduction described in the proof of Theorem 4. ∎

###### Corollary 5.

Checking whether a binary complete automaton recognizes a birecurrent set is PSPACE-complete.

### Acknowledgments

The author would like to thank Dominique Perrin for communicating the problem of finding the complexity of checking whether an automaton recognizes a birecurrent set to him, as well as for useful suggestions on the content and presentation of the paper.

## References

- [DPR17] Francesco Dolce, Dominique Perrin, Antonio Restivo, Christophe Reutenauer, and Giuseppina Rindone. Recurrent and birecurrent sets. CoRR, abs/1703.10081, 2017.
- [GK95] Pavel Goralčík and Václav Koubek. Rank problems for composite transformations. International Journal of Algebra and Computation, 05(03):309–316, 1995.
- [Koz77] Dexter Kozen. Lower bounds for natural proof systems. In Proceedings of the 18th Annual Symposium on Foundations of Computer Science, pages 254–266. IEEE Computer Society, 1977.
- [Mar10] Pavel V. Martyugin. Complexity of problems concerning carefully synchronizing words for PFA and directing words for NFA. In CSR 2010. LNCS, vol. 6072, pages 288–302. Springer, Heidelberg, 2010.
- [Mar14] Pavel Martyugin. Computational complexity of certain problems related to carefully synchronizing words for partial automata and directing words for nondeterministic automata. Theory of Computing Systems, 54(2):293–304, 2014.
- [Per13] Dominique Perrin. Completely reducible sets. International Journal of Algebra and Computation, 23(4):915–941, 2013.
- [Rys92] Igor K. Rystsov. Rank of a finite automaton. Cybern Syst Anal, 28(3):323–328, 1992.
- [Sip12] Michael Sipser. Introduction to the Theory of Computation. Cengage Learning, 3rd edition, 2012.
- [Vol08] Mikhail V. Volkov. Synchronizing automata and the Černý conjecture. In Carlos Martín-Vide, Friedrich Otto, and Henning Fernau, editors, LATA 2008. LNCS, vol. 5196, pages 11–27. Springer, Heidelberg, 2008.
- [Vor16] Vojtěch Vorel. Subset synchronization and careful synchronization of binary finite automata. Int. J. Found. Comput. Sci., 27(5):557–578, 2016.

Comments

There are no comments yet.