ToA - Lecture 09 10 - Kleenes Theorem
ToA - Lecture 09 10 - Kleenes Theorem
Kleene’s Theorem
Kleene’s Theorem
• Any language that can be defined by
• regular expression, or
• finite automaton, or
• transition graph
• can be defined by all three methods.
Proof
• The three sections of our proof will be :
• Every language that can be defined by a finite automaton can also be defined by a transition graph.
• Every language that can be defined by a transition graph can also be defined by a regular expression.
• Every language that can be defined by a regular expression can also be defined by a finite automaton.
• When we have proven these three parts, we have finished our theorem.
TGs into REs
• Constructive algorithm
• We present a procedure that starts out with a transition graph and ends up with a regular expression
that defines the same language.
• To be acceptable as a method of proof, any algorithm must satisfy two criteria
• It must work for every conceivable TG
• It must guarantee to finish its job in a finite time (a finite number of steps).
• For the purposes of theorem-proving alone, it does not have to be a good algorithm (quick,
least storage used, etc.). It just has to work in every case.
TGs into REs
• We already studied that a transition graph (T) may have multiple start states.
• We first want to simplify T so that it has only one start state that has no incoming edges.
TGs into REs
• We do this by introducing a new state that we label with a minus sign and that we connect
to all the previous start states by edges labeled with .
• Then we drop the minus signs from the previous start states.
TGs into REs
• Another simplification we can make in T is that it can be modified to have a unique
unexcitable final state without changing the language it accepts.
becomes
TGs into REs
• 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, where and are all regular expressions or simple
strings. In this case, we can replace the three loops by one loop labeled with a regular
expression
becomes
TGs into REs
• Similarly, suppose two states are connected by more than one edge going in the same
direction, where the labels and are each regular expressions or simple strings. We can
replace this with a single edge that is labeled with a regular expression:
becomes
TGs into REs
• We can now define the bypass and state elimination operation.
• In some cases, if we have three states in a row connected by edges labeled with regular expressions (or
simple strings), we can eliminate the middleman and go directly from one outer state to the other by a
new edge labeled with a regular expression that is the concatenation of the two previous labels.
becomes
TGs into REs
• We can do this trick only as long as state 2 does not have a loop going back to itself. If state 2
does have a loop, we must use this model:
becomes
TGs into REs
• 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)
• 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.
becomes
TGs into REs
• What have we done to transition graph T?
• Without changing the set of words that it accepts; we have eliminated one of its states.
• We can 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.
becomes
TGs into REs – Example
TGs into REs – Example
TGs into REs – Example
TGs into REs – Example
TGs into REs – Example
TGs into REs – Example
TGs into REs – Example
• Current Regular Expression
• If in state , we read
• In , we are back to
• In , we are in
• Call this new state = state or
Proof – Rule 2
• State and read
• In , we move to
• In , we move to
• Call it state .
• State and read
• In , we move to
• In , we move to
• This means that if we are in and we read , we return to state
Proof – Rule 2
• State and read
• In , we move to
• In , we move to
• Call it state .
• State and read
• In , we move to
• In , we move to
• Call it state
• Both of these are final states because
• is a final state for
Proof – Rule 2
• In , if we read , we go to or , which we shall call
• In , if we read , we go to or , which we shall call
• Because there are only finitely many x's and y's, there can be only finitely many possible z’s.
• Not all of them will necessarily be used in if no input string beginning at – can get to them.
Thank You
Any Questions?