Chapter 4
Chapter 4
1
Closure properties
• Concatenation (r = r1.r2)
• Union (r = r1 + r2)
• Intersection
• Complementation
3
A = A1.A2
with:
4
Concatenation
Add an empty transition from every final sates of A1 to the start state of A2
The start state will be the start state of A1 and the set final states will be the set of
final states of A2
5
Union
Let A1 and A2 be two nfa. The nfa obtained by the union A = A1 A2 is as
follows :
6
Union
The nfa obtained by the union A = A1 A2 is as follows :
Add a new state as a start state of A , and add an empty transition from this
7
Kleene Closure
A = A1*
8
Kleene Closure
• Add a new state as a start state of A
• Add an empty transition from this new start state to the start state of A1
• Add an empty transition from every final states of A1 to the start sate of A1
9
Intersection
• The initial state is {q0, q’0} where q0 and q’0 are respectively the initial state of
There is an edge labeled with the symbol a from the state {q1, q’1} to the
state {q2, q’2} if and only if there is in A1 an edge labeled by the symbol a
A final state {qf, q’f} where qf is a final state in A1 and q’f final state in A2 .
10
Complementation
with symbol a in case there is no other edge from q labeled with this
symbol a
The final states are all the states except the final states of A.
11
• Remark 1: If we have NFA rather than DFA, we must
first convert it to DFA before swapping states to get its
complement.
12
Reduction of the number of states in
finite Automata
• Any dfa defines a unique language, but the converse is
not true. For a given language, there are many dfa’s that
accept it
• Definition: In a dfa two states p and q are called
indistinguishable, if for every string w:
*(p, w) F *(q, w) F
and
*(p, w) F *(q, w) F
13
Minimization Algorithm
• Algorithm:
Step 1: Remove unreachable states
Step 2: Mark the distinguishable pairs of states.
to achieve this task, we first mark all pairs p, q where p F and q F as
distinguishable. Then we proceed as follows:
repeat
for all non-marked pairs p, q do
for each symbol a do
if the pair (p, a), (q, a) is marked
then mark p, q
14
Minimization Algorithm
15