Chapter 2 DFA and NFA
Chapter 2 DFA and NFA
FINITE AUTOMATA
Automata Theory
Study
of abstract computing devices, or “machines”
Automaton
= an abstract computing device
An
automaton with a finite number of states is called a Finite Automaton.
The finite automaton is a mathematical model of a system, with discrete inputs and
outputs.
The system can be in any one of a finite number of internal configurations or
“states”.
The state of the system summarizes the information concerning past inputs that is
needed to determine the behavior of the system on subsequent inputs.
Formal language (L(m))- is a set of strings, each string composed of symbols
from a finite symbol set called alphabet
For example, the alphabet for the sheep language is the set ∑ = {a,b,!}
L(m) = {baa!, baaa!......}
Definition (DFA)
𝛿 ∶ 𝑄 × Σ → 𝑄: A transition function
𝑞0 ∈ 𝑄: A start state
The input mechanism can move only from left to right and reads exactly one
symbol on each step.
The transition from one internal state to another are governed by the transition
function δ.
If δ(q0 , a)=q1 , then if the DFA is in state q0 and the current input symbol is a,
Q={q0,q1,q2},
Σ={0,1},
q0=q0,
F={q2},
• δ(q0,0)=q1,
• δ(q0,1)=q0,
•…
• δ(q2,1)=q2
Transition diagram
Transition table
Detailed description
the states.
transition.
12 Formal language and Automata Theory 06/03/2021
Transition diagram
If any state q in Q is the starting state then it is represented by
the circle with arrow as
Nodes corresponding to accepting states are marked by a
double circle
Example
The following transition diagram represents a DFA
that accepts the language 𝐿 = {𝑥01𝑦 ∣ 𝑥, 𝑦 ∈ {0, 1}∗}.
States description:
𝑞0: The automaton has never seen 01, but its last input was either
nonexistent or it last saw a 1.
𝑞1: The automaton has never seen 01, but its most recent input was
0.
Example
For any input symbol, nondeterministic one can transit to more than one
states.
δ = Q × (Σ ∪ {λ} ) → 2Q
- NFA differs from DFA in that, the range of δ in NFA is in the power set 2Q.
A string is accepted by an NFA if there is some sequence of possible
moves that will put the machine in the final state at the end of the string.
Solution
Solutions
Solution
1
27 Formal language and Automata Theory 06/03/2021
EQUIVALENCE OF NFA AND DFA
Two finite accepters M1 and M2 are equivalent iff
L(M1) =L(M2) i.e., if both accept the same language.
Both DFA and NFA recognize the same class of languages.
It is important to note that every NFA has an equivalent DFA.
Let us illustrate the conversion of NFA to DFA through an example.
Answer:
DFA NFA
For every symbol of the alphabet, there is We donot need to specify how does the
only one state transition in dfa nfa react according to some symbol.
DFA can not use empty string transitions NFA can use empty string transition
DFA can be understood as one machine NFA can be understood as multiple little
machines computing at the same time
Backtracking is allowed in DFA Backtracking is not always allowed in
NFA.
DFA is more difficult to construct NFA is easier to construct.