[LAC] Equivalence of DFA and NFA

It is a surprising fact that every language that can be described by some NFA can also be described by some DFA. Moreover, the DFA has more states than NFA. The smallest DFA can have 2^n states while the smallest NFA for the same language has only n states.

We can thus convert an NFA into a DFA by considering each possible set of NFA states as a single DFA state!

subset construction

The subset construction starts from an NFA N = (Qn, Σ, δn, q0, Fn). Its goal is the description of a DFA D = (Qd, Σ, δd, {q0}, Fd} such that L(D) = L(N).
where
δD(A)(P,x) = U{δ(q,x) | q ∈ P}
FD(A) = {P∈P(Q)|P∩F≠∅}

It might be confused if we just say its definition, i’ll show how the NFA converted to DFA.

Example

The language is same as before–accpets all strings that end in “01”
We have figured out its NFA:
enter image description here

So first, we want to write a complete subset construction of it.
So how many possible states are there in the DFA?
2^3 = 8 states, we use a transition table and write down all the states.
(notice the final or accepting states now are not just one, may be a lot)
It is a ongoing version of transition table.
enter image description here
Then we fill in the table about the result after input a symbol.
enter image description here

ok, by now, what we write is a compelete subset construction including all states

If you write these sets(notice, states are sets now) into a alphabet, we can make a new and more clear transition table:
enter image description here
Of the eight states in the above image, starting in the start state B, we can only reach state B, E and F. The other five states are inaccessible from the start state and may as well not be there. We often can avoid the exponential-time step of construction transition table entries for every subset of states if we perform “lazy evaluation” on the subsets, as follows.

  • Basis: We know for certain that the singleton set consisting only of N’s start state is accessible.
  • Induction: Suppose we have determined that set S of states is accessible; then fro each input symbol a, compute the set of states δd(S, a); we know that these sets of states will also be accessible.

In this way, we can converge the subset construction. We can draw a transition diagram by this converged transition table:
enter image description here

Example question

enter image description here

We can write out the following transition table:
enter image description here

If we simplify it:
enter image description here

评论

此博客中的热门博文

[MLE] W2 Multivariate linear regression

[MLE] W1 Introduction

[AIM] MetaHeuristics