Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Presentation: Kleene Theorem Automata Theory

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 21

Presentation

Kleene theorem
Automata theory

Presented by

Junaid Khan
University of Peshawar Pakistan
Junaid_upesh@yahoo.com
Kleene theorem
• A language can be defined by there
separate ways .
• 1 Regular expression or
• 2 Finite automaton or
• 3 Transition Garaph.
• An 1956 kleene proved a theorem called
kleene theorem.
Vision of kleene theorem
• The vision of kleene theorem is that if a
language can be defined one of the above
ways then at can also be defined by the
other two.
• Means these are three deferent ways that
equally define a language.
Proof
• The proof of this theorem contain three parts.
• Part1: every language that can be defined
by a finite automaton can also be
defined by a transition Graph.
part2: every language that can be defined
by a transition graph can also be
defined by a regular expressions.
Proof (cont…..)
• Part3: every language that can be defined
by a regular expression can also
be defined by a finite automaton.
Proof of part1
• The proof of this part is very easy. That is
every finite automaton is itself already a
transition graph. Therefore any language
that has been defined by a finite
automation has already been defined by a
transition graph.
Proof of part2
• The proof of this part will be by
constructive algorithm. This mean that we
present a procedure that starts out with a
transition graph and ends up with a regular
expression that define the same language.
Algorithm
Step1: create a unique, unenterable minus state and a unique
unleavealble plus state.

Step2: one by one, in any order, bypass and eliminate all the non - or +
states in the TG. A state is bypassed by connecting each incoming
edge With each outgoing edge. The label of each resultant edge is
the concatenation of the label on the incoming edge with the label on
the loop edge if there is one and the label on the outgoing edge.
Step3: when two states are joined by more than one edge going in the same
direction unify them by adding their edge.
Step4: finally, the only one edge from – to + the label on that edge is regular
expression.
Example

+
a,b aa

– aa,bb

bb
+

– +
(aa+bb)(a+b)*(aa+bb)
Part 3.

Part 3: Every language that can be defined by a regular


expression can also be defined by a finite automaton.
Proof: By constructive algorithm starting from the recursive definition of regular
expressions
1. There is an FA that accepts only the empty word (Λ) and an FA that accepts
only a single letter.
2. If there is an FA that accepts the language defined by r1 and an FA that
accepts the language defined by r2, then there is an FA that accepts the
language r1+r2.
3. If there is an FA that accepts the language defined by r1 and an FA that
accepts the language defined by r2, then there is an FA that accepts the
language defined by their concatenation r1r2.
4. If there is an FA that accepts the language defined by r then there is an FA
that accepts the language defined by r*.
Thus for every regular expression, we can construct a FA.
Part 3(cont….)
Build a finite automaton that accepts the language: (a+b)*(aa+bb)(a+b)*
Rule:
1. The letter a 1
2. The letter b 1
3. The word aa (using 1) 3
4. The word bb (using 2) 3
5. The expression aa+bb (using 3 and 4) 2
6. The expression a+b (using 1 and 2) 2
7. The expression (a+b)* (using 6) 4
8. The expression (a+b)*(aa+bb) (using 7 and 5) 3
9. The expression (a+b)*(aa+bb)(a+b)* (using 8 and 7) 3
Part 3(Rule 1)
Rule 1 all 
all 
+ The language Λ

all  Only the letter x

all  except x –
x
+

all 
Part 3(Rule 2)
Rule 2: r1+r2, Example 1 All word containing
b a,b
a b aa
– a a +x
x2 –x1 x2 x1
x1 3
b
b x2 x3 x1
+x3 x3 x3
+y1 y2
b a b
+y1 y3 y2
a a a a y2 y4 y1 EVEN-EVEN
b y3 y1 y4
y3 y4 y4 y2 y3
b
Combine two
tables into one
New state name a b
x1 or y1 -+ z1 z2= x2 or y3 z3= x1 or y2

x2 or y3 z2 z4 z5
x1 or y2 z3 z6 z1
x3 or y1 + z4 z7 z8
x1 or y4 z5 z9 z10
x2 or y4 z6 z8 z10
x3 or y3 + z7 z4 z11
x3 or y2 + z8 z11 z4
x2 or y2 z9 z11 z1
x1 or y3 z10 z12 z5
x3 or y4 + z11 z8 z7
x2 or y1 + z12 z7 z3
The New FA are as.
11 a
+ 8+
a a a
b b a
9 1+ 3 6
b b a b b b b
Result: r1+r2
b
a
b
12 a 10 5
b
+ 2
a b a
a 4+
7+
a
Algorithm Rule 2
Algorithm 1: r1+r2
Input:
FA 1: alphabet:  states: x1, x2, x3,… start state: x1
FA 2: alphabet:  states: y1, y2, y3,… start state: y1
plus final states and transitions
The new FA:
alphabet:  states: z1, z2, z3,… start state: x1 or y1
transitions: if zi= xj or yk and xj  xnew and yk  ynew
(for input p) then znew= (xnew or ynew) for input p.
If xnew or ynew is a final state, then znew is a final state.
Part3 Rule 3
b Example 2
a,b
a r1: all with aa
x1
x2 a x3
– +
b
a b
y1 b
y2+ r2: words ending in b

a
b a b
a a b
z1– z2 z3 z 4+
b r1r2 a
Part 3 Rul3
b a b
a a b
z1– z2 z3 z4 +
b a
We start by creating the states z1=x1and z2=x2
(z2, a)= x3 “we continue on FA1” OR
y1 ”we move to FA2, since x3 is a final state in AF1”
(z2, a) = x3 or y1= z3 -running FA1
(z3, a) = x3 or y1= z3
-beginning FA2
(z3, b) = x3 or y1 or y2 = z4 +
(z4, a)= x3 or y1=z3 (y1 added to x3)
(z4, b)= x3 or y1 or y2 = z4 +
-running FA2
Part3 Rule 4

Rule 4: r*, Example 1 a

a x2 b
x1+ x3+
+

b a,b

x4
a,b
r: a* + aa*b
r*: words without double b, and that do not start with b.
Part 3 Rule 3
z1=x1 ± (z1, a) = x1 or x2= z2 + (z1,b) = x4= z4
(z2,a)= x1 or x2 =z2 (z2, b)= x1 or x3 or x4= z3 +
(z3, a)=z4 (z3,b) = z4
(z3,a)= x1 or x2 or x4= z5 + (z3, b)= x4 = z4
(z5,a)= x1 or x2 or x4= z5 (z5, b)= x1 or x3 or x4= z3
a

r* z2 + a
a b a
z1
a,b z3+ z5+
+
b b
b
z4
Any Questions?
Massage
if the path is Beautiful first confirm where
does it lead?
But ,if the destination is Beautiful, Don’t
check How the path is, keep walking.

You might also like