2110355 Formal languages and automata theory

Download Report

Transcript 2110355 Formal languages and automata theory

2110711
THEORY OF COMPUTATION
Athasit Surarerks
08 KLEENE’S THEOREM
IMPORTANT
2
All three methods of defining languages
regular expression, acceptance by finite automata
and acceptance by transition graph are equivalent
KLEENE’S THEOREM
3
Language accepted by a deterministic
finite automaton can be defined by a
transition graph.
Language accepted by a transition graph
can be defined by a regular expression.
Language generated by a regular
expression can be defined by a
deterministic finite automaton.

KLEENE’S THEOREM
4
Language accepted by a deterministic
finite automaton can be defined by a
transition graph.
Language accepted by a transition graph
can be defined by a regular expression.
Language generated by a regular
expression can be defined by a
deterministic finite automaton.

KLEENE’S THEOREM
5
Proof:
Language accepted by a transition graph
can be defined by a regular expression.
Given a transition graph TG.
Find a regular expression that defines the
same language.
Construct an algorithm that satisfies two
criteria.
Work for every conceivable transition graph
Guarantee to finish its job in a finite time.
KLEENE’S THEOREM
6
STATEGY
Only one initial state.
0
A
B
…
C
110
E
D
01
KLEENE’S THEOREM
7
STATEGY
Only one initial state.
A

S
0
B
…

C

110
E
D
01
KLEENE’S THEOREM
8
STATEGY
Only one final state.
0
A
…
C
010
B
110
E
D
01
KLEENE’S THEOREM
9
STATEGY
Only one final state.
0
A
…
C
010
B

F
110
E
D
01

KLEENE’S THEOREM
10
STATEGY
Eliminate all internal states.
Let A be any state in a transition graph.
r, s and t be any substrings.
r
…
s
A
t
R+S+T
…
…
A
…
R, S, T be regular expressi
KLEENE’S THEOREM
11
STATEGY
Eliminate all internal states.
Let A,B be states in a transition graph.
r, s, t and u be any substrings.
r
u
r
s
…
A
B
t
…
…
A
u
S+T
B
…
S, T be regular expressions.
KLEENE’S THEOREM
12
STATEGY
Eliminate all internal states.
Let A,B be states in a transition graph.
r, s, t and u be any substrings.
r
…
A
s
C
t
B
…
…
ST
A
S, T be regular expressions.
r
B
…
KLEENE’S THEOREM
13
STATEGY
Eliminate all internal states.
Let A,B be states in a transition graph.
r, s, t and u be any substrings.
r
u
…
A
s
C
t
B
…
…
SU*T
A
r
S, T, U be regular expressions.
B
…
KLEENE’S THEOREM
14
EXAMPLE
010
A
0
110
B
01
C
D
00
E
…
KLEENE’S THEOREM
15
EXAMPLE
010
A
0
110
B
01
C
D
0(010)*00
E
…
KLEENE’S THEOREM
16
EXAMPLE
010
A
0
110
B
0(010)*01
C
D
0(010)*00
E
…
KLEENE’S THEOREM
17
EXAMPLE
C
010
A
0
0(010)*110
B
0(010)*01
D
0(010)*00
E
…
KLEENE’S THEOREM
18
EXAMPLE
C
0(010)*110
A
0(010)*01
D
0(010)*00
E
…
KLEENE’S THEOREM
19
Eliminate B, by create AC = r1r2*r3
create AD = r1r2*r4
delete AB
erase B when B has no input.
r2
r3
A
r1
B
r4
C
D
…
KLEENE’S THEOREM
20
Determine the regular expression
corresponding to this transition graph.
r6
r3
r1
A
r2
r5
r4
B
r8
r7
r9
C
KLEENE’S THEOREM
21
Proof:
Language generated by a regular
expression can be defined by a deterministic finite
automaton.
Given a regular expression.
Find an automaton that defines the same
language.
Construct an algorithm that satisfies two
criteria.
Accepts any particular letter of the alphabet.
(or )
Close under +, concatenation and Kleene’s
CONCLUSION
22
Let FA1 accepts the language defined by
regular expression r1,
FA2 accepts the language defined by
regular expression r2.
Then there is a FA3 accepts the language
(r1+r2).
Then there is a FA4 accepts the language
r1 r2 .
Then there is a FA5 accepts the language
r*.