- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# What is Non-Deterministic Finite Automata (NFA)?

Non-Deterministic means that there can be several possible transitions on the same input symbol from some state. The output is non-deterministic for a given input. NFA can be represented as a nondeterministic finite state machine.

NFA can be represented by 5 tuples (Q,$\sum$,$\delta$,q_{0},F)

Q is a finite non-empty set of states.

$\sum$ is a finite set of input symbols.

$\delta$ is the transition function to move from the current state to the next state.

∴ $\delta$:Q x $\sum$ → 2^{Q}

q

_{0}∈ Q is the initial state.F \subseteq Q is the set of final states.

**Example1** − Draw NFA for the Regular Expression a(a+b)*ab

**Solution**

**Example2** − Draw NFA for a + b + ab

**Solution**

**Example3** − Let M=(Q,∑,$\delta$,q_{0},F) be an NFA. Show that for any qϵQ and a ϵ Σ,$\delta$′(q,a)= $\delta$(q,a)

**Solution**

Let M=(Q,∑,$\delta$,q_{0},F) be NFA that recognizes the language L. Then the DFA, M′=(Q_{1},∑,$\delta$′,q′_{0},F′) that satisfies the following conditions recognizes L:Q_{1}=2^{Q}, that is the set of all subset of Q.

q′_{0}={q_{0}}

$\delta$(q,a)=∪_{pϵq}$\delta$(p,a) for each state q in Q_{1} and each symbol a in Σand

F={qϵQ_{1}|q∩F_{2}≠ф}

To obtain DFA M′=(Q_{1},Σ,$\delta$′,q′0,F′) which accepts the same language, as given NFA, M=(Q,∑,$\delta$,q_{0},F) does. It can proceed as follows −

**Step1** − Initially Q_{1}=ф

**Step2** − Put {q_{0}} into Q_{1}.{q_{0}} is the initial state of the DFA M′.

**Step3** − Then for each state q in Q_{1} do the following: add this new state, add δ(q,a)=∪_{pϵq}δ(p,a) to δ, where δ on the right-hand side is that of NFA M’.

**Step4** − Repeat step3 till new states are there to add in Q_{1}, if there is a new state create to add in Q_{1}, the process eliminates.

**Example4** − Prove that if L is accepted by an NFA with ∈−transitions, then L is accepted by an NFA without ∈−transitions.

**Solution**

Suppose L = L (D) for some DFA or NFA without ∈−transitions. It can turn D into a ∈−DFA (E) by adding transitions δ(q,∈)=ф for all states q of D. It can also move the transitions of D on input symbols, for example, δD(q,a)=D into an NFA transition to the set including the only P that is δ_{E}(q,a)={P}. Therefore, the transitions of E and D are equal, but E explicitly states that there are no transitions out of any state of E.

Let E=(Q_{E},Σ,δ_{E},q_{0},F_{E}) be a ∈−NFA. It can use the modified subset construction represented above to make the DFA.

D=(Q_{E},∑,δ_{E},q_{D},F_{D})

L(D)=L(E), because the extended transition functions of E and D are equal. The extended transition function is the function that takes a state q and a string w and returns a state P, the state that automation reaches when starting in state q and processing the sequence of inputs w.

δ_{E}(q_{0},w)=δ_{D}(q_{D},w)by induction on the length of w.

- Related Questions & Answers
- What is Non deterministic finite automata?
- Can we convert a non-deterministic finite automata into a deterministic finite Automata?
- What is Deterministic Finite Automata (DFA)?
- Explain Non-Deterministic Finite Automata in TOC.
- Explain Deterministic Finite Automata in TOC.
- What is finite automata?
- What is the conversion of a regular expression to finite Automata (NFA)?
- C program to simulate Nondeterministic Finite Automata (NFA)
- Explain non-deterministic push down automata in TOC?
- What is Finite Automata in Compiler Design?
- Explain if the CFG is recognized by Non-deterministic push down automata
- What are different types of finite automata?
- Difference between Deterministic and Non-deterministic Algorithms
- Efficient Construction of Finite Automata
- What are the regular expressions to finite automata?