CS-273 Theory of Automata: WEEK-3) Lecture-5 & 6 Finite Automata
CS-273 Theory of Automata: WEEK-3) Lecture-5 & 6 Finite Automata
THEORY OF
AUTOMATA
(WEEK-3)
LECTURE-5 & 6
FINITE AUTOMATA
Lecturer
Hira Faisal
[email protected]
Note
a, b
2
Example
Σ = {a,b}
States: x, y, where x is both initial and final
state.
Transitions:
1.At state x reading a or b go to state y.
2.At state y reading a or b go to state x.
3
Example Continued …
y x x
4
Example Continued …
a, b
x y
a, b
5
Example Continued …
((a+ b) (a + b))*
6
TASK
7
Solution of Task
a,b
– +
a,b
8
Example: Consider the language L of strings,
defined over Σ={a, b}, starting with b.
9
The language L may be expressed by RE
b(a + b)* , may be accepted by the following FA
a,b
––
b +
a,b
a
1
10
Example:
Consider the language L of strings, defined
over Σ={a, b}, ending in a. The language L
may be expressed by RE
(a+b)*a
This language may be accepted by the following
FA
11
Example Continued …
b a a
– +
a
a
–– +
a b
b
13
Note
14
Note
15
FA 1 Corresponding to L1
a,b
––
a +
b a,b
16
FA 2 Corresponding to L2
a,b
a
+
a,b
b
18
Example Continued …
b a a
+
a b
–
a b b
b
+
a
19
Task
20
TASK
21
Solution continued …
a,b
1 – 2+
a,b
22
Task
Build an FA accepting the Language L of Strings,
defined over Σ = {a, b}, beginning with and
ending in same letters.
Solution:The language L may be expressed by
the following regular expression
(a+b)+a(a + b)*a + b(a + b)*b
This language L may be accepted by the
following FA
23
Solution continued …
a b a
a
b
a
2+ 4 6+
b
1– b a b
b
b
a
3+ 5 7+
a
24
Example
25
Example Continued …
a b b
2 4+
a a
1–
b a
a
b
3 5+
b
26
Example
a,b
1 2+
27
Example Continued …
a,b
(a + b)*
28
Example
a,b
a,b
– +
29
Example
30
Equivalent FAs
31
Equivalent FAs Continued …
a,b
FA1 –
a,b
+
a,b
FA2 a,b
1 – 2
a,b a,b
a,b
FA3 1– 2 3
+
32
Note (Equivalent FAs)
33
Example
34
Example Continued …
b a,b
a
a
1- 2 3+
b
35
Example
Consider the language L of strings, defined over
Σ={0, 1}, having double 0’s or double 1’s, The
language L may be expressed by the regular
expression (0+1)* (00
+ 11) (0+1)*
This language may be accepted by the following FA
36
Example Continued …
0 0
0,1
- 0 1 +
1
1
y
37
Example
38
Example Continued …
2 a
4
a
a
b a,b
1–– a b 6+
b a
b
3 b 5
39
Example
40
Example Continued …
1 3
b
a a a a
2 4
b
41
Summing Up
42