You are on page 1of 24

Chapter 7

Kleene’s Theorem
Lecture 11
22/10/2014
Convert TG to RE
Do it for this TG
Step 1 & 2:
 Create single initial and final states
Step 4: State Elimination & By Pass
Proof of Kleene’s Theorem Part III
REFA
 To show: every language that can be defined by a regular
expression can also be defined by a FA.
 We will do this by using a recursive definition and a
constructive algorithm.
 Recall
 every regular expression can be built up from the letters of the
alphabet and ^ and Ø;.
 Also, given some existing regular expressions, we can build
new regular expressions by applying the following operations:
 1. union (+)
 2. concatenation
 3. closure (Kleene star)
 Recall that we had the following recursive definition for
regular expressions:
 Rule 1: If x € ∑ , then x is a regular expression. ^ is a regular
expression. ; Ø is a regular expression.
 Rule 2: If r1 and r2 are regular expressions, then r1 + r2 is a
regular expression.
 Rule 3: If r1 and r2 are regular expressions, then r1r2 is a regular
expression.
 Rule 4: If r1 is a regular expression, then r1* is a regular
expression.
 Based on the above recursive definition for regular
expressions, we have the following recursive definition for
FA’s associated with regular expressions:
Rule 1: Example
Union of two FAs: Let FA 1 and FA2 accept languages
defined by r1 and r2 then there is an FA3 which accepts
(r1+r2)
Another Example
Union of two FAs: Let FA 1 and FA2 accept languages
defined by r1 and r2 then there is an FA3 which accepts
(r1+r2)
 Suppose we have the machine FA1, which accepts the
language of all words over the alphabet ∑= {a, b} that end
in ‘b’.
and the familiar machine FA2 , which accepts
EVEN-EVEN language .
Task…
 If r1 = ((a+b)(a+b))* &
 r2 = ((a+b)(a+b))* (a+b)
 r3 = r1 + r2
 Find FA3 for r3?

CSE-402 Virtual University Pakistan


Kleene’s theorem part III
(method 2: Concatenation of FAs)
 Using the FAs corresponding to r1 and r2, an FA can be
built, corresponding to r1r2. This method can be developed
considering the following examples:

CSE-402 Virtual University Pakistan


 Let FA3 be an FA corresponding to r1r2,
 initial state of FA3 = initial state of FA1
 and the final state of FA3 = final state of FA2.
 Since the language corresponding to r1r2 is the
concatenation of corresponding languages L1 and L2,
consists of the strings obtained, concatenating the strings
of L1 to those of L2 , therefore the moment a final state of
first FA is entered, the possibility of the initial state of
second FA will be included as well.

CSE-402 Virtual University Pakistan


For example

CSE-402 Virtual University Pakistan


Transition table for fa3

CSE-402 Virtual University Pakistan


CSE-402 Virtual University Pakistan
CSE-402 Virtual University Pakistan
CSE-402 Virtual University Pakistan

You might also like