Tài liệu Bài giảng Theory Of Automata - Lecture 15: 1Recap Lecture 14
• Kleene’s theorem part III (method 2:
Concatenation of FAs) continued, Kleene’s
theorem part III (method 3:closure of an FA),
Examples
2Task
Build FA corresponding to the concatenation
of these two FAs i.e. FA1FA2 where
FA1
FA2
a,b
x1- x2 x3 +
x4
b
a,b
a,b
a
a
y1- y2+
a
bb
3Task solution
• RE corresponding to FA1 may be
(a+b)b(a+b)* with b as second letter
• RE corresponding to FA2 may be
(a+b)b(a+b)* b*a(b+ab*a)* with odd
number of a’s
4Solution continued
Old States
New States after reading
a b
z1-x1 x2z2 x2 z2
a,b
x1- x2 x3 +
x4
b
a,b
a,b
a
a
y1- y2+
a
bb
5Solution continued
Old States
New States after reading
a b
z2x2 x4z3 (x3,y1)z4
z3 x4 x4z3 x4z3
z4(x3,y1) (x3 ,y1,y2) z5 (x3,y1) z4
z5+(x3,y1 ,y2) (x3 ,y1 ,y2) z5 (x3,y1 ,y2) z5
6Solution continued
b
a
a,b
b
z2
z3
z4 z5a
a,b
z1
a,b •-
•+
7Note
• It is to be noted that as observed in the
previous examples, if at the initia...
21 trang |
Chia sẻ: honghanh66 | Lượt xem: 1045 | Lượt tải: 0
Bạn đang xem trước 20 trang mẫu tài liệu Bài giảng Theory Of Automata - Lecture 15, để tải tài liệu gốc về máy bạn click vào nút DOWNLOAD ở trên
1Recap Lecture 14
• Kleene’s theorem part III (method 2:
Concatenation of FAs) continued, Kleene’s
theorem part III (method 3:closure of an FA),
Examples
2Task
Build FA corresponding to the concatenation
of these two FAs i.e. FA1FA2 where
FA1
FA2
a,b
x1- x2 x3 +
x4
b
a,b
a,b
a
a
y1- y2+
a
bb
3Task solution
• RE corresponding to FA1 may be
(a+b)b(a+b)* with b as second letter
• RE corresponding to FA2 may be
(a+b)b(a+b)* b*a(b+ab*a)* with odd
number of a’s
4Solution continued
Old States
New States after reading
a b
z1-x1 x2z2 x2 z2
a,b
x1- x2 x3 +
x4
b
a,b
a,b
a
a
y1- y2+
a
bb
5Solution continued
Old States
New States after reading
a b
z2x2 x4z3 (x3,y1)z4
z3 x4 x4z3 x4z3
z4(x3,y1) (x3 ,y1,y2) z5 (x3,y1) z4
z5+(x3,y1 ,y2) (x3 ,y1 ,y2) z5 (x3,y1 ,y2) z5
6Solution continued
b
a
a,b
b
z2
z3
z4 z5a
a,b
z1
a,b •-
•+
7Note
• It is to be noted that as observed in the
previous examples, if at the initial state of the
given FA, there is either a loop or an
incoming transition edge, the initial state
corresponds to the final state and a non-final
state as well, of the required FA, otherwise
the initial state of given FA will only
correspond to a single state of the required
FA (i.e. the initial state which is final as well).
8Task
• Build an FA corresponding to the closure
of the following FA
a
y1± y2a
b
b
9Nondeterministic Finite
Automaton (NFA)
Definition: An NFA is a TG with a unique start
state and a property of having single letter as
label of transitions. An NFA is a collection of
three things
1) Finite many states with one initial and some
final states
2) Finite set of input letters, say, ={a, b, c}
3) Finite set of transitions, showing where to
move if a letter is input at certain state ( is
not a valid transition), there may be more than
one transition for certain letters and there may
not be any transition for certain letters.
10
Observations
It may be observed, from the definition of NFA,
that the string is supposed to be accepted, if there
exists at least one successful path, otherwise
rejected.
It is to be noted that an NFA can be considered to
be an intermediate structure between FA and TG.
The examples of NFAs can be found in the
following
11
Example
b
a
1- a
a
5+
2+
3
4
It is to be noted that the above NFA accepts
the language consisting of a and ab.
12
Example
a,b
a
a, b
a1- 3+2
It is to be noted that the above NFA accepts
the language of strings, defined over
Σ = {a, b}, containing aa.
13
Note
• It is to be noted that NFA helps to eliminate a
loop at certain state of an FA. This process is
done converting the loop into a circuit. But
during this process the FA remains no longer
FA and is converted to a corresponding NFA,
which is shown in the following example.
14
Example
• Consider a part of the following FA with an
alphabet Σ={a,b,c,d}
To eliminate the loop at state 7, the
corresponding NFA may be as follows
7
a
10
9
8
6
5
4
b
c
d
a
b
c
15
Example continued ...
11
10
9
8
6
5
4
7
aa
a
b
c
b
c
d
c
d
b
16
Converting an FA to an
equivalent NFA
• It is to be noted that according to the Kleene’s
theorem, if a language can be accepted by an FA,
then there exists a TG accepting that language.
Since, an NFA is a TG as well, therefore there
exists an NFA accepting the language accepted
by the given FA. In this case these FA and NFA
are said to be equivalent to each others.
Following are the examples of FAs to be
converted to the equivalent NFAs
17
Example
• Consider the following FA corresponding to
(a+b)*b
• The above FA may be equivalent to the following
NFA
Can the structure of above NFA be compared
with the corresponding RE ?
b
a
ba
- +
- b +
a, b
18
Example
• Consider the following FA
• The above FA may be equivalent to the
following NFA
• Can the structure of above NFA be compared
with the corresponding RE ?
a
a, b
a- +
a,b
ab
a
b
- +1
1
a,b
19
Task
Build an NFA equivalent to the following
FA
2
a
1–
3
6+
4
5
a
a
a,b
b
b
b
a b
b
a
20
Application of an NFA
• There is an important application of an NFA
in artificial intelligence, which is discussed in
the following example of a maze
- 1 2 3
4 L 5 O
6 M 7 P
8 N 9 +
21
Summing Up
• Examples of Kleene’s theorem part III
(method 3), NFA, examples, avoiding loop
using NFA, example, converting FA to
NFA, examples, applying an NFA on an
example of maze
Các file đính kèm theo tài liệu này:
- theory_of_automata_cs402_power_point_slides_lecture_15_6181.pdf