×

Close

Type:
**Note**Offline Downloads:
**15**Views:
**267**Uploaded:
**5 months ago**Add to Favourite

I Session by Prof.A.M.Padmareddy : 21.3.05
Definition: A DFA is 5-tuple or quintuple M = (Q, ∑, δ, q0, A) where
Q is non-empty, finite set of states.
∑ is non-empty, finite set of input alphabets.
δ is transition function, which is a mapping from Q x ∑ to Q.
q0 ∈ Q is the start state.
A ⊆ Q is set of accepting or final states.
Note: For each input symbol a, from a given state there is exactly one transition (there can be
no transitions from a state also) and we are sure (or can determine) to which state the
machine enters. So, the machine is called Deterministic machine. Since it has finite number
of states the machine is called Deterministic finite machine or Deterministic Finite
Automaton or Finite State Machine (FSM).
The language accepted by DFA is
L(M) = { w | w ∈ ∑* and δ*(q0, w) ∈ A }
The non-acceptance of the string w by an FA or DFA can be defined in formal notation as:
L(M) = { w | w ∈ ∑* and δ*(q0, w) ∉ A }
Obtain a DFA to accept strings of a’s and b’s starting with the string ab
a,b
q
a
b
q
b
q2
a
q
a,b
Fig.2.7 Transition diagram to accept string ab(a+b)*
← States →
So, the DFA which accepts strings of a’s and b’s starting with the string ab is given by M =
(Q, ∑ , δ, q0, A) where
Q = {q0, q1, q2, q3}
∑ = {a, b}
q0 is the start state
A = {q2}.
δ is shown the transition table 2.4.
δ
←Σ→
a b
→q0
q1 q3
q1
q3 q2
q2
q 2 q2
q3
q3 q3

Downloaded from www.pencilji.com
Draw a DFA to accept string of 0’s and 1’s ending with the string 011.
1
0
0
q0
1
q1
1
q2
0
q3
0
1
Obtain a DFA to accept strings of a’s and b’s having a sub string aa
b
a,b
a
q0
a
q1
q2
b
Obtain a DFA to accept strings of a’s and b’s except those containing the substring aab.
b
a
a
q0
a
q1
a,b
b
q2
q3
b
Obtain DFAs to accept strings of a’s and b’s having exactly one a,
b
b
a
q0
a,b
a
q1
q2
b
a, b
a
q0
b
q0
b
a
q1
b
a
q1
q2
a, b
b
a
q3
a
q4
Obtain a DFA to accept strings of a’s and b’s having even number of a’s and b’s
The machine to accept even number of a’s and b’s is shown in fig.2.22.
a
q
q
a
b
b
b
b
a
q
q
a
2
Downloaded from www.pencilji.com

Downloaded from www.pencilji.com
Fig.2.22 DFA to accept even no. of a’s and b’s
a
q0
q1
a
b
b
b
b
a
q2
q3
a
a
q0
q1
a
b
b
b
b
a
q2
q3
a
a
q0
q1
a
b
b
b
b
a
q2
q3
a
Regular language
Definition: Let M = (Q, ∑, δ, q0, A) be a DFA. The language L is regular if there exists a
machine M such that L = L(M).
* Applications of Finite Automata *
String matching/processing
Compiler Construction
The various compilers such as C/C++, Pascal, Fortran or any other compiler is designed
using the finite automata. The DFAs are extensively used in the building the various phases
of compiler such as
•
Lexical analysis (To identify the tokens, identifiers, to strip of the comments etc.)
•
Syntax analysis (To check the syntax of each statement or control statement used in
the program)
•
Code optimization (To remove the un wanted code)
3
Downloaded from www.pencilji.com

Downloaded from www.pencilji.com
•
Code generation (To generate the machine code)
Other applications
The concept of finite automata is used in wide applications. It is not possible to list all the
applications as there are infinite number of applications. This section lists some applications:
1. Large natural vocabularies can be described using finite automaton which includes
the applications such as spelling checkers and advisers, multi-language dictionaries,
to indent the documents, in calculators to evaluate complex expressions based on the
priority of an operator etc. to name a few. Any editor that we use uses finite
automaton for implementation.
2. Finite automaton is very useful in recognizing difficult problems i.e., sometimes it is
very essential to solve an un-decidable problem. Even though there is no general
solution exists for the specified problem, using theory of computation, we can find
the approximate solutions.
3. Finite automaton is very useful in hardware design such as circuit verification, in
design of the hardware board (mother board or any other hardware unit), automatic
traffic signals, radio controlled toys, elevators, automatic sensors, remote sensing or
controller etc.
4. In game theory and games wherein we use some control characters to fight against a
monster, economics, computer graphics, linguistics etc., finite automaton plays a very
important role.
Non deterministic finite automata(NFA)
Definition: An NFA is a 5-tuple or quintuple M = (Q, ∑, δ, q0, A) where
Q is non empty, finite set of states.
∑ is non empty, finite set of input alphabets.
δ is transition function which is a mapping from
Q x {∑ U ε} to subsets of 2Q. This function shows
the change of state from one state to a set of states
based on the input symbol.
q0 ∈ Q is the start state.
A ⊆ Q is set of final states.
Acceptance of language
Definition: Let M = (Q, ∑, δ, q0, A) be a DFA where Q is set of finite states, ∑ is set of input
alphabets (from which a string can be formed), δ is transition function from Q x {∑Uε} to
2Q, q0 is the start state and A is the final or accepting state. The string (also called language)
w accepted by an NFA can be defined in formal notation as:
L(M) = { w | w ∈ ∑*and δ*(q0, w) = Q with atleast one
4
Downloaded from www.pencilji.com

## Leave your Comments