0% found this document useful (0 votes)
12 views

Lesson 13

The document outlines the process of building finite automata (FA) corresponding to regular expressions through union and concatenation methods. It provides examples of constructing FAs for given regular expressions and describes how to derive new states from old states during transitions. The document emphasizes the application of Kleene's Theorem in creating equivalent FAs for different regular expressions.

Uploaded by

kashafbutt72
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Lesson 13

The document outlines the process of building finite automata (FA) corresponding to regular expressions through union and concatenation methods. It provides examples of constructing FAs for given regular expressions and describes how to derive new states from old states during transitions. The document emphasizes the application of Kleene's Theorem in creating equivalent FAs for different regular expressions.

Uploaded by

kashafbutt72
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 17

Task

Z2
a a b
a
b
Z1- a b Z4 + Z5 +
b a

Z3+ b

Build an FA equivalent to the previous FA


1
Example

Let r1=(a+b)*a and the


b
corresponding FA1 be
a a

X1 – X2 +

b
also r2 = (a+b)((a+b)(a+b))* or
*
((a+b)(a+b))
a,b (a+b) and FA2 be
y1 - y2+

a,b 2
Example continued …

b a a
a,b

X1 – X2 + y1- y2+
a,b

New States after reading


Old States
a b

z1-(x1,y1) (x2,y2) z2 (x1,y2)  z3


3
Example continued …

New States after reading


Old States
a b

z2+(x2,y2) (x2,y1) z4 (x1,y1)  z1


z3+ (x1,y2) (x2,y1) z4 (x1,y1)  z1
z4+ (x2,y1) (x2,y2)  z2 (x1,y2)  z3

4
Example continued …

z 1- z2+
b

b b a a

z3+ z4 +
b

5
Example

Let r1=((a+b)(a+b))* and the


corresponding FA1 be
a,b

x1 ± x2
a,b

also r2 = (a+b)((a+b)(a+b))* or
*
((a+b)(a+b))
a,b (a+b) and FA2 be
y1 - y2+

a,b 6
Example continued …
a,b

x1 ± x2
a,b

a,b

y1 - y2+
a,b

New States after reading


Old States
a b

z1±(x1,y1) (x2,y2) z2 (x2,y2)  z2 7


Example continued …

New States after reading


Old States
a b

z2+(x2,y2) (x1,y1) z1 (x1,y1)  z1

8
Example continued …

a,b

z1 ± z2+
a,b

9
Task

Build an FA corresponding to the union of


these two FAs i.e. FA1 U FA2 where a,b
b
FA1 x1 -
a,b
x2 x3 +

x4 a,b

b a b

FA2 y1 - y2 +
a
10
Kleene’s Theorem Part III Continued

Method2 (Concatenation of two


FAs):
Using the FAs corresponding to r1
and r2, an FA can be built,
corresponding to r1r2. This method
can be developed considering the
following examples

11
Example

Let r1=(a+b)*b defines L1 and FA1 be


a b b

X1 – X2 +

a
and r2 = (a+b )*aa (a+b )* defines L2 and
FA2 be
b a,b
a

y2 a
y1 - y3 +

b 12
Concatenation of two FAs Continued

Let FA3 be an FA corresponding to r1r2, then the


initial state of FA3 must correspond to the initial
state of FA1 and the final state of FA3 must
correspond to the final state of FA2.Since the
language corresponding to r1r2 is the
concatenation of corresponding languages L1 and
L2, consists of the strings obtained, concatenating
the strings of L1 to those of L2 , therefore the
moment a final state of first FA is entered,
the possibility of the initial state of second
FA will be included as well.

13
Concatenation of two FAs Continued

Since, in general, FA3 will be different from both


FA1 and FA2, so the labels of the states of FA3
may be supposed to be z1,z2, z3, …, where z1
stands for the initial state. Since z1 corresponds
to the states x1, so there will be two transitions
separately for each letter read at z1. It will give
two possibilities of states which correspond to
either z1 or different from z1. This process may
be expressed in the following transition table
for all possible states of FA3

14
Example continued …
a b b

X1 – X2 +

b a a,b
a

y2 a
y1 - y3 +

New States after reading


Old States
a b

z1-x1 x1z1 (x2,y1) z2 15


Example continued …
New States after reading
Old States
a b

z2(x2,y1) (x1,y2)z3 (x2,y1) z2


z3(x1,y2) (x1,y3)z4 (x2,y1) z2
z4+(x1,y3) (x1,y3) z4 (x2,y1,y3) z5
z5+(x2,y1,y3) (x1,y2 ,y3) z6 (x2,y1,y3) z5
z6+(x1,y2,y3) (x1,y3) z4 (x2 ,y1,y3) z5

16
Example continued …
b
a
z2 z3
b

b a

a z1- z4 + a
a
b
b

z6 + z5 + b

a 17

You might also like