You are on page 1of 6

Individual Assignment of Automata and complexity theory

Wolaita sodo university

School of Informatics
Individual Assignment of Automata and complexity theory

Department: Computer Science


Section: 1
Name: Gemechis Gurmessa
ID Number: ugr/69416/14

Submitted to: instructor Sewunet S.

WSU
Individual Assignment of Automata and complexity theory

Instructions of the assignment


1.Explain about NFA and DFA

2. List and follow the rules to convert

3.Take one example of state diagram of NFA( similar diagram wz others is prohibited)

4. Convert it to DFA( Show the steps cleary)

Answers
Finite Automata (FA) is the most straightforward machine to recognize patterns and can be mainly
characterized into two types:

a. Deterministic Finite Automaton(DFA)


b. Non-deterministic Finite Automaton(DFA)

A. Deterministic Finite Automaton(DFA):- are finite


state machines that acceps or reject strings of characters by parsing
them through a sequence tha is uniquely determined by each string.
The term “deterministic” refers to the fact that each string, and thus each
state. DFA can contain multiple final states. It is used in Lexical Analysis in Compiler

DFA does not accept the null move, i.e., the DFA cannot change state without any input
character. A Deterministic Finite Automaton (DFA) is defined as a 5-
tuple (Q, Σ, δ, s, F) consisting of

 A finite set Q (the set of states)


 A finite set of symbols Σ (the input alphabet)
 A transition function δ: Q × Σ → Q mapping the current state q ∈ Q and input
symbol a ∈ Σ to a new state δ(q, a) ∈ Q
 An initial state s ∈ Q (the start state)
 A set of accepting states F (the final states)

WSU
Individual Assignment of Automata and complexity theory

B. Non-deterministic Finite Automaton(NFA) :- Similar to a


DFA, an NFA is a state machine consisting of states and transitions that
can either accept or reject a finite string. In a nondeterministic finite
automaton (NFA), for each state there can be zero, one, two, or more
transitions corresponding to a particular symbol.

NFA is defined in the same way as DFA but with the following two exceptions, it
contains multiple next states, and it contains ε transition.

 NFA also has five states same as DFA, but with different transition function, as shown
follows:δ: Q x ∑ →2Q

 A finite set Q (the set of states)


 A finite set of symbols Σ (the input alphabet)
 A transition function δ: Q × Σ → Q mapping the current state q ∈ Q and input
symbol a ∈ Σ to a new state δ(q, a) ∈ Q
 An initial state s ∈ Q (the start state)
 A set of accepting states F (the final states)

Steps for converting NFA to DFA:


1. Step 1: Convert the given NFA to its equivalent transition table.
2. Step 2: Create the DFA's start state.
3. Step 3: Create the DFA's transition table.
4. Step 4: Create the DFA's final states.
5. Step 5: Simplify the DFA.
6. Step 6: Repeat steps 3-5 until no further simplification is possible.

WSU
Individual Assignment of Automata and complexity theory

Example: Convert the following Non-Deterministic Finite Automata (NFA) to


Deterministic Finite Automata (DFA)

Solution:-
Transition table for the given Non-Deterministic Finite Automata (NFA) is-

state Input 0 Input 1


qo q0 q1,*q2
q1 q1, *q2 *q2
q2 q0, q1 q1

Step 1:- Let Q’ be a new set of states of the Deterministic Finite Automata (DFA).
Let T’ be a new transition table of the DF

Step 2:- Add transitions of start state q0 to the transition table T’.

state Input 0 Input 1

q0 q0 {q1, q2}

WSU
Individual Assignment of Automata and complexity theory

Step 3:- New state present in state Q’ is {q1, q2}.


Add transitions for set of states {q1, q2} to the transition table T’.

state Input 0 Input 1

q0 q0 {q1, q2}

{q1,q2} {q0, q1, q2} {q1, q2}

Step 4:- New state present in state Q’ is {q0, q1, q2}.


Add transitions for set of states {q0, q1, q2} to the transition table T’.

state Input 0 Input 1

q0 qo {q1, q2}

{q1, q2} {qo, q1, q2} {q1, q2}

{qo, q1, q2} {qo, q1, q2} {q1, q2}

Step 5:- Since no new states are left to be added in the transition table T’, so we
stop.
States containing q2 as its component are treated as final states of the DFA.

Finally, Transition table for Deterministic Finite Automata (DFA) is:-

WSU
Individual Assignment of Automata and complexity theory

state Input 0 Input 1

q0 qo *{q1, q2}

*{q1, q2} *{qo, q1, q2} *{q1, q2}

*{qo, q1, q2} *{qo, q1, q2} *{q1, q2}

Now, Deterministic Finite Automata (DFA) may be drawn as:

Deterministic Finite Automaton(DFA)

WSU

You might also like