Example: Consider The Following TG
Example: Consider The Following TG
1- 3+
aa
a
a
2- 4+
bb
To have single initial and single final state the
above TG can be reduced to the following
Example continued …
b
b
1 3
Λ aa Λ
- a +
Λ a Λ
2 4
bb
To obtain single transition edge between 1 and
3; 2 and 4, the above can be reduced to the
following
Example continued …
b
b+aa 3
1 Λ
Λ
- a +
Λ Λ
2 a+bb 4
To eliminate states 1,2,3 and 4, the above TG
can be reduced to the following TG
Λ(b+aa)b*Λ
- +
Λ(a+bb)a*Λ
Example continued …
(b+aa)b*
- +
(a+bb)a*
To connect the initial state with the final state by single
transition edge, the above TG can be reduced to the
following
- (b+aa)b*+(a+bb)a* +
Hence the required RE is (b+aa)b*+(a+bb)a*
Example
aa,bb aa,bb
ab,ba
-+1 2
ab,ba
Example continued ...
aa+bb aa+bb
ab+ba
3- Λ 1 2
ab+ba
Λ
4+
To eliminate state 2, the above TG may be
reduced to the following
Example continued ...
aa+bb
3- Λ 1 (ab+ba)(aa+bb)*(ab+ba)
4+
(aa+bb)+(ab+ba)(aa+bb)*(ab+ba)
3- Λ 1
4+
Λ(aa+bb+(ab+ba)(aa+bb)*(ab+ba))*Λ
3- 4+
Statement:
If the language can be expressed by a RE then
there exists an FA accepting the language.
A) As the regular expression is obtained applying
addition, concatenation and closure on the
letters of an alphabet and the Null string, so
while building the RE, sometimes, the
corresponding FA may be built easily, as shown
in the following examples
Example
a b
1 - +
a, b
which shows that this FA helps in building an FA
accepting only one letter
Example
a, b
±
Kleene’s Theorem Part III
Continued …
X1 – +
X2
X1 – +
X2
b a a,b
a
y2 a
y1– y3+
b
New states after reading
Old states
a b
Z2
a a b
a
b
Z1- a b Z4 + Z5 +
b a
Z3+ b
RE corresponding to the above FA may be r1+r2
= (a+b)*b + (a+b )*aa(a+b )*
Task
Z2
a a b
a
b
Z1- a b Z4 + Z5 +
b a
Z3+ b
X1– X2+
b
also r2 = (a+b)((a+b)(a+b))* or
((a+b)(a+b))*(a+b) and FA2 be
a,b
y1- y2+
a,b
Example continued …
b a a
a,b
z1- z2+
b
b b a a
z3+ z4+
b
Example
also r2 = (a+b)((a+b)(a+b))* or
((a+b)(a+b))*(a+b) and FA2 be
a,b
y1- y2+
a,b
Example continued …
a,b
x1± x2
a,b
a,b
y1- y2+
a,b
a,b
z1 ± z2+
a,b
Task
x4 a,b
b a b
FA2 y1 - y2+
a
Kleene’s Theorem Part III
Continued …
X1 – +
X2
a
and r2 = (a+b )*aa (a+b )* defines L2 and FA2 be
b a,b
a
y2 a
y1- y3+
b
Concatenation of two FAs
Continued …
X1 – +
X2
b a a,b
a
y2 a
y1- y3+
b
New States after reading
Old States
a b
b
a
z2 z3
b
b a
a z4+
z1- a
a
b
b
z6+ z 5+ b
a
Assignment