0% found this document useful (0 votes)
155 views28 pages

Kleenes Theorem 1

Kleene's Theorem states that any language that can be defined using a regular expression, finite automaton, or transition graph can also be defined using the other two methods. The proof involves showing: 1) Any language defined by a finite automaton can be defined by a transition graph 2) Any language defined by a transition graph can be defined by a regular expression 3) Any language defined by a regular expression can be defined by a finite automaton. The document then provides details on the algorithm for constructing a regular expression from a transition graph by eliminating states until only the start and end states remain, with edges labeled by regular expressions.

Uploaded by

Video Tech
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
155 views28 pages

Kleenes Theorem 1

Kleene's Theorem states that any language that can be defined using a regular expression, finite automaton, or transition graph can also be defined using the other two methods. The proof involves showing: 1) Any language defined by a finite automaton can be defined by a transition graph 2) Any language defined by a transition graph can be defined by a regular expression 3) Any language defined by a regular expression can be defined by a finite automaton. The document then provides details on the algorithm for constructing a regular expression from a transition graph by eliminating states until only the start and end states remain, with edges labeled by regular expressions.

Uploaded by

Video Tech
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

SOFTWARE

CONSTRUCTION
Lecture 8
Kleene’s Theorem
Kleene’s Theorem

• If a language can be- defined by any one of


these three ways(generation by regular
expression, acceptance by finite automaton,
and acceptance by transition graph), then it
can also be defined by the other two. i,e
• Any language that can be defined by
1. Regular expression
2. Finite automaton
3. Transition graph
can be defined by all three methods
PROOF

• Part 1 Every language that can be defined


by a finite automaton can also be defined
by a transition graph.
• Part 2 Every language that can be defined
by a transition graph can also be defined
by a regular expression.
• Part 3 Every language that can be defined
by a regular expression can also be
defined by a finite automaton.
Proof of Part 1

• Every finite automaton is itself a transition


graph.
• Therefore, any language that has been
defined by a finite automaton has already
been defined by a transition graph.
Proof of Part 2(Turning T.Gs
into Regular Expressions)
• The proof of this part will be by
constructive algorithm.
• This means that we present a procedure
that starts out with a transition graph and
ends up with a regular expression that
defines the same language.
Algorithm
• Let us start by considering an abstract
transition graph T.
• T may have many start states. Simplify T
so that it has only one start state.
• Now all words must begin at the new
unique start state.
Algorithm….. Cont’d
Algorithm….. Cont’d
• If T has several final states, introduce a
new unique final state
Algorithm….. Cont’d
• unique final state should be a different
state from the unique start state.
Algorithm….. Cont’d
• Let us suppose that T has some state (called state x) inside it (not the -or + state) that has more than one loop
circling back to itself e.g,

(where rl, r 2, and r3 are all regular expressions or simple strings).


• Replace the three loops by one loop labelled with a regular expression.,
Algorithm….. Cont’d
• suppose two states are connected by more than one edge going in the same direction e.g,

(where the labels r, and r2 are each regular expressions or simple strings.)
• We can replace this with a single edge that is labelled with a regular expression.
Algorithm….. Cont’d
• Bypass operation: if we have three states
in a row connected by edges labelled with
regular expressions (or simple strings), we
can eliminate the middleman
Algorithm….. Cont’d
• If state 2 does have a loop, we must use
this model:
Algorithm….. Cont’d
• If state 1 is connected to state 2 and state 2 is connected to more than one other
state (say to states 3, 4, and 5), then when we eliminate the edge from state 1 to
state 2 we have to add edges that show how to go from state 1 to states 3, 4, and 5.
Algorithm….. Cont’d
• Every state that leads into state 2 can be
made to bypass state 2.
• If state 9 leads into state 2, we can eliminate
the edge from state 9 to state 2 by adding
edges from state 9 to states 3, 4, and 5
directly.
• Repeat this process until nothing leads into
state 2. When this happens, we can eliminate
state 2 entirely, since it then cannot be in a
path that accepts a word.
Algorithm….. Cont’d
• We have eliminated one of T’s states
without changing the set of words that it
accepts
• Repeat this process again and again until
we have eliminated all the states from T
except for the unique start state and the
unique final state.
Algorithm….. Cont’d
• What we come down to is a picture that looks like this:

• with each edge labeled by a regular expression.


• We can then combine this once more to produce:
Algorithm….. Cont’d
• The resultant regular expression, is then
the regular expression that defines the
same language as T did originally.
Special Cases

• becomes
• Note: Whenever we remove an edge or a
state we must be sure that we have not
destroyed any paths through T that may
previously have existed. Destroying paths
could change the language of words
accepted, which we do not want to do.
e.g
Example
Source of Lecture
• Book: Introduction to Computer Theory by
Daniel. I. A Cohen, chapter 7, “Kleene’s
Theorem”.

You might also like