✖

Redundant states

A finite automaton may have states from which it is impossible to reach an accepting state, so they serve no purpose. We call such states redundant states. We usually want to remove them, because they only complicate the automaton unnecessarily.

Example of redundant states

Let us take this finite automaton:

We can see that once we get into state q4 or q5, we can never reach one of the accepting states q1 or q2. Such states are redundant and we can simply remove them, which gives us a new automaton that is equivalent; it accepts the same language. After deleting the redundant states, the automaton would look like this:

It accepts the same language. However, there are times when it is useful to keep some redundant states, for example when we construct a complete automaton.

Definition of a redundant state

Let A = ⟨Q, Σ, δ, q0, F⟩ be a finite automaton. We say that a state q ∈ Q is redundant if there is no string w ∈ Σ∗ and no state qf ∈ F such that

⟨q,w⟩↦∗⟨qf,ε⟩.

How to remove redundant states

We assume that the input is an automaton A = ⟨Q, Σ, δ, q0, F⟩ that already has no unreachable states. We gradually find the states that lead to accepting states, then the states that lead to states that lead to accepting states, and so on. This gives us the set of all states that are not redundant. At the start we put S0 = F. We then construct further sets Si for i ∈ ℤ+ by this rule:

Si={q∈Q|∃a∈Σ:δ(q,a)∈Si−1}∪Si−1

The resulting set of all states that are not redundant can be expressed like this:

⋃i=1∞Si.

And the set of redundant states as

Q∖⋃i=1∞Si.

In other words: if Si = Si + 1, then the set Q ∖ Si contains the redundant states. We will illustrate the procedure on this automaton:

First we set S0 = {q1, q2}. Next we build the set S1 by adding to S0 all states that lead to one of the states in S0. So we add the states q0 and q3, because there is a transition from q0 to q1 and from q3 to q2. We get S1 = {q0, q1, q2, q3}. Since S0 ≠ S1, we carry on.

We build the set S2. So we look for all states from which we can get into S1 and which are not in S1 yet. There is only one, q6, from which we can get into the state q3. We get S2 = {q0, q1, q2, q3, q6}. Since S1 ≠ S2, we carry on.

We build the set S3. Is there a new state from which we can get into some state in S2? There is not: from the states q4 and q5 we cannot get into any of the states in S2, and all the other states are already in S2. So S3 = {q0, q1, q2, q3, q6}. Since S2 = S3, the algorithm stops and the set S2 is the set of states that are not redundant. The set {q4, q5} is the set of redundant states.

Formally, we construct a new equivalent automaton without redundant states as follows. We have an automaton A = ⟨Q, Σ, δ, q0, F⟩ and we build from it an equivalent automaton A′ = ⟨Q′, Σ, δ′, q0, F⟩ without redundant states.

  • Q′=⋃i=1∞Si
  • ∀q ∈ Q′, a ∈ Σ:  δ′(q, a) = δ(q, a) if δ(q, a) ∈ Q′, otherwise δ′(q, a) is not defined

Sources

Chapters: Unreachable states, Redundant states, DFA minimisation