Lecture 3
Lecture 3
State 0 1
State 0 1
→q0 {q0, q1} {q1}
*q1 ϕ {q0, q1}
Example 2
We obtain δ' transition for state q0.
δ'([q0], 0) = {q0, q1}
= [q0, q1] (new state generated)
δ'([q0], 1) = {q1} = [q1]
The δ' transition for state q1 is obtained as:
δ'([q1], 0) = ϕ
δ'([q1], 1) = [q0, q1]
As in the given NFA, q1 is a final state,
The δ' transition on [q0, q1].
then in DFA wherever, q1 exists that state
δ'([q0, q1], 0) = δ(q0, 0) ∪ δ(q1, 0) becomes a final state. Hence in the DFA,
= {q0, q1} ∪ ϕ
= {q0, q1} final states are [q1] and [q0, q1]. Hence,
= [q0, q1] set of final states F = {[q1], [q0, q1]}.
Similarly,
δ'([q0, q1], 1) = δ(q0, 1) ∪ δ(q1, 1)
= {q1} ∪ {q0, q1}
= {q0, q1}
= [q0, q1]
Example 2
The transition table for the constructed DFA will be:
State 0 1
→[q0] [q0, q1] [q1]
*[q1] ϕ [q0, q1]
*[q0, q1] [q0, q1] [q0, q1]
• RE = ab
From a Regular Expression to an NFA
RE = (ab)*
From a Regular Expression to an NFA
RE = (a | b)*a
Example 1
RE = a* (a | b)
Example 2
RE = a(a+b)*ab
Example 3
RE = a + b + ab
Converting Automaton to Regular Expression
State Elimination Method
1. If there are no incoming edges to the start state proceed further to check the
rest of the rules. If there are incoming transitions to the initial state, get rid of
incoming edges by making a new start state with no incoming edges and an
outgoing edge to the old start state with Ɛ-transition. the initial start state before
is now a normal state with added incoming Ɛ-transition.
Into
State Elimination Method
2. If there are no outgoing edges from final state proceed further to check
the last rule. If there are outgoing transitions from final state, to get rid of
outgoing edges make new final state with no outgoing edges and an
incoming edge from old final state of Ɛ-transition. Old final state is
transformed into a normal state with the added transition of Ɛ.
Into
State Elimination Method
3. If there are no multiple final states proceed to elimination (except final
and initial) of normal states. If the Automaton has multiple final states,
then strip their status of being final states and add outgoing Ɛ-transitions
to new and only final state with no outgoing transitions.
Into
Elimination of Normal States
• Assume we have the following DFA
Elimination of Normal States
• Applying rules 1 and 2 will lead to:
Elimination of Normal States
• Eliminating State B and C in any order, the answer will be the same in both
cases, now let’s eliminate B first.
• Eliminate B and imagine if there wouldn’t have been any State B then we reach
State C directly from Start state A with the input symbol of Ɛb*a we can neglect
Ɛ then input symbol will be b*a from A to C.
Elimination of Normal States
• Outgoing edge from State C to B is now become self Loop since State B is not
there. Edge from C is going to B, taking b* and returning to C with ‘a’ this can
happen infinite time hence self-loop of b(b)*a. We can write the two self-loops
‘a’ and ‘bb*a’ as (bb*a +a) meaning we can traverse one loop at a time.
Elimination of Normal States
• Now after eliminating C state, We would reach final State D directly from initial
state A, now we were reaching State C by input of ‘b*a’ on C state we are taking
infinite loops on (bb*a + a) and with Ɛ reaching final state D. hence Finally no
normal states remaining we got a stream of input symbols directly from initial to
final which is b*a(bb*a + a)*.
Questions and Discussions