CC lec 5
CC lec 5
CONSTRUCTIO
N
Lecture # 5
REGULAR LANGUAGES
The language generated by any regular expression.
Regular languages which can be accepted by some (Finite State Machine)
DFA, NFA.
DFA: FORMAL DEFINITION
A finite automaton is a 5-tuple (Q; ; ; qo ; F) where
Q is a finite set called the states,
is a finite set called the alphabet,
: Q Q is a total function called as the transition function,
qo Q is the start state, and
F Q is the set of accept states.
EXAMPLE 1
EXAMPLE 2
DFA FOR FINITE LANGUAGE
Consider the language L = {aa, bab, aabb, bbba}, defined over
0 1 ε
A BC A B
B - B C
C C C -
Ε - CLOSURE
Epsilon closure for a given state X is a set of states which can be reached
from the states X with only (null) or ε moves including the state X itself. In
other words, ε-closure for a state can be obtained by union operation of the
ε-closure of the states which can be reached from X with a single ε move in
recursive manner. For the above example ∈ closure are as follows :
∈ - closure(A) : {A, B, C}
∈ - closure(B) : {B, C}
∈ - closure(C) : {C}
STEPS TO CONVERT NFA
WITH Ε-MOVE TO DFA
1. Take ∈ closure for the beginning state of NFA as beginning state of DFA.
2. Find the states that can be traversed from the present for each input
symbol (union of transition value and their closures for each states of
NFA present in current state of DFA).
3. If any new state is found, take it as current state and repeat step 2.
4. Do repeat Step 2 and Step 3 until no new state present in DFA transition
table.
5. Mark the states of DFA which contains final state of NFA as final states of
DFA.
EXAMPLE 1
Transition State Table for DFA corresponding to above NFA
0 1
{A,B,C} {B,C} {A,B,C}
{B,C} {C} {B,C}
{C} {C} {C}
{1,2,3,4,5,6,7,8}
C {1,2,3,4,5,6,7,8} {
D{ {
E{ {1,2,3,4,5,6,7,8} {
RESULTING DFA
PRACTICE I
PRACTICE II