1. Finite Automata
Abhineet Anand
Assistant Professor
Dept. of Computer Science And Engineering,
College of Engineering Studies.
University of Petroleum and Energy Studies, Dehradun.
March 1, 2013
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 1 / 19
2. Outline
1 Introduction
2 Definition
3 Processing of String by DFA
4 Preferred Notation for FA
Transition Diagram
Transition Table
5 Facts in Designing procedure of DFA
6 Question from FA
7 Why Nondeterminism
8 Definition
9 Transformation of NFA to DFA
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 2 / 19
3. Introduction
Finite Automata
Finite - Finite Number of states and Alphabet, and
Automata - change of state govern by input symbol.
P0 , P1 , P2 , P3 , are the states.
x,y are the symbols on input tape.
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 3 / 19
4. Definition of Finite Automata
A deterministic finite automata is a quintuple
M=(Q, Σ, δ , q0 , F)
1 Q : Is a non-empty finite set of states presents in the finite control.
(q0 , q1 , q2 , q3 , ...)
2 Σ : Is a non-empty finite set of input symbols which can be passed to
the finite state machine. (a, b, c, d, ....)
3 q0 : Is a Starting state, One of the state in Q.
4 F : Is a non-empty set of final states or accepting states, set of final
states belongs to Q.
5 δ : Is a Function called transition function that takes two argument : a
state and input symbol, and it return a single state.
that is Q x (Σ) → Q
Let ’q’ is the state and ’a’ be input symbol passed to the transition function
as : δ (q,a)=q
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 4 / 19
5. Finite Automata
Let ’q’ is the state and ’a’ be input symbol passed to the transition function
as : δ (q,a)=q .
q is the output of the function. Like
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 5 / 19
6. Processing of String by DFA
Suppose a1 , a2 , a3 , a4 , ........ an is a sequence of input symbols.
DFA is having q0 , q1 , q2 , q3 , q4 , ........ qn states where q0 is the initial
state and qn is the final state and transition function processed as
δ (q0 , a1 ) = q1
δ (q1 , a2 ) = q2
δ (q2 , a3 ) = q3
.
.
.
.
δ (qn−1 , an ) = qn
Input a1 , a2 , a3 , a4 , ........ an is said to be ”accepted”
”So a string is said to be accepted by the given DFA only when it
is processed by transition function δ in such a manner that it
ends at the final state”.
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 6 / 19
7. Preferred Notation for FA
There are two Preferred Notation for describing auotmata:
Transition Diagram
Transition Table
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 7 / 19
8. Transition Diagram
A Transition diagram for a DFA M=(Q , Σ, δ, q0 , F ) is a graph defined as :
For each state in Q there is a node.
For each state q in Q and each input Symbol a in Σ, let δ (q, a )=p.
There is an arrow into the start state q0 . This arrow does not originate
at any node.
Final State(s) will be marked by a double circle.
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 8 / 19
9. Transition Table
A Transition table is a conventional, tabular representation of a
function like δ that takes two arguments and return a state.
The rows of the table correspond to the states, and the columns
correspond to the input.
The entry for one row corresponding to state q and the column
corresponding to input a is the state δ (q, a ). For Example:
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 9 / 19
10. Facts/observation for DFA
1 In the designing of the FA, first of all it is to find the language or
strings which is accepted by the FA.
2 Make sure that no state must have two different output state for a
signal input symbol.
3 Make sure, that there is one initial state and at least one final state in
transition diagram of FA.
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 10 / 19
11. Question from FA
1 Design a FA that accept a word LION.
2 Design a FA that accept set of string such that every string ends in
00, over alphabet {0, 1}.
3 Design a FA that accept a substring aab over alphabet {a , b }.
4 Design a FA, which ends with b if it start with a and ends with a if start
with b, over alphabet {a , b }.
5 Construct a FA that accepts set of strings where the number of 0’s in
every string is multiple of three over alphabet Σ = {0, 1}.
6 Design a FA which accepts the set of string either start with 01 or end
with 01.
7 Design a FA which accepts the language L = {w/w has both an even
numbers of 0’s and an even number of 1’s over alphabet Σ = {0, 1}}.
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 11 / 19
12. Nondeterministic
Nondeterministic means a choice of moves for an auotmaton.
Set of possible moves is given rather than unique move.
Formally, it is achieved by defining the transition function so that its
range is a set of possible states.
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 12 / 19
13. Why Nondeterministic
A ”nondeterministic” finite automation(NFA) has the power to be in
several states at once.
Each NFA accepts a language that is also accepted by some DFA.
NFA can be converted to DFA.
Though nondeterministic is a feature which is normally not associated
with real computers, it is an extension of the behaviour of DFA.
Moreover, nondeterministic is an essential feature of FA, every NFA is
equivalent to FA.
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 13 / 19
14. Definition
A non deterministic finite automata is a quintuple
M=(Q, Σ, δ , q0 , F)
1 Q : Is a non-empty finite set of states presents in the finite control.
(q0 , q1 , q2 , q3 , ...)
2 Σ : Is a non-empty finite set of input symbols which can be passed to
the finite state machine. (a, b, c, d, ....)
3 q0 : Is a Starting state, One of the state in Q.
4 F : Is a non-empty set of final states or accepting states, set of final
states belongs to Q.
5 δ : Is a Function called transition function that takes two argument : a
state and input symbol, and it return a a sub set of state Q.
that is Q x (ΣU {ϸ }) → 2Q
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 14 / 19
15. Non Deterministic Finite Automata
The transition function is : Q x (ΣU {ϸ }) → 2Q .
Transition Table for this automata:
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 15 / 19
16. Transformation of NFA to DFA
For every NFA there exist an equivalent DFA.
NFA is finite automata in which zero, one or more transition on an
input symbol is permitted.
It is possible to create a FA which will simulate all moves of NFA on a
particular input symbol in parallel and get the FA which will have only
one move for an input symbol.
Transition of NFA to DFA is called subset construction.
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 16 / 19
17. NFA with ϸ −Transition
If a FA is modified to permit transition without input symbols, along
with zero, one or more transition on input symbols, then we get a NFA
with ϸ −transition.
The transition made without symbols are called as ϸ − transition.
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 17 / 19
18. Acceptance of a string by NFA with ϸ −Transition
A string w will be accepted by NFA with ϸ − transition, if there exist at
least one path corresponding w, which start in an initial state, and
ends in one of the final states.
The function ϸ − transition(q) is defiind is
ϸ −closure(q) = set of all those states of the automata (NFA with
ϸ −transition) which can be reached from q on a path labeled byϸ − i.e.
without consuming any input symbol.
ϸ −closure(q0 ) = {q0 , q1 , q2 }
ϸ −closure(q1 ) = {q1 , q2 }
ϸ −closure(q2 ) = {q2 }
Abhineet Anand (UPES, Dehradun) Finite Automata March 1, 2013 18 / 19