5
Tahir Naseem/Handout 18 -1- Theory of Automata and Formal Languages Lecture 18 Objectives More Example for Pumping Lemma o Pumping Lemma for Regular Expression o Pumping Lemma for FSA Example 1: Pumping lemma for ab* + b (a + ba)* is x = a x = b y = b OR y = a + ba z = ε z = ε In the above example we have two options in given regular expression due to plus sign. In both there is a repeated group, in first option repeated group is b and in second option repeated group is (a + ba). Therefore, we can write down possible two strings in the form of xy i z as given above. Explanation for 1 st Option x is a part which must occur before repeating group; in first option we need ‘a’ to reach at repeating group. Hence we have write x = a; y is a part which is repeated from zero to n time; in first option ‘b’ is repeated from zero to n time. Hence we have write y = b; z is a part which must occur after repeating group; in first option we don’t need any character to read. Hence we have write z = ε. Explanation for 2 nd Option x is a part which must occur before repeating group; in 2 nd option we need ‘b’ to reach at repeating group. Hence we have write x = b;

Handout 18.docx

  • Upload
    mano

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Handout 18.docx

Tahir Naseem/Handout 18 -1- Theory of Automata and Formal Languages

Lecture 18

Objectives

More Example for Pumping Lemmao Pumping Lemma for Regular Expressiono Pumping Lemma for FSA

Example 1:

Pumping lemma for ab* + b (a + ba)* is

x = a x = by = b OR y = a + baz = ε z = ε

In the above example we have two options in given regular expression due to plus sign. In both there is a repeated group, in first option repeated group is b and in second option repeated group is (a + ba). Therefore, we can write down possible two strings in the form of xyiz as given above.Explanation for 1st Optionx is a part which must occur before repeating group; in first option we need ‘a’ to reach at repeating group. Hence we have write x = a;y is a part which is repeated from zero to n time; in first option ‘b’ is repeated from zero to n time. Hence we have write y = b;z is a part which must occur after repeating group; in first option we don’t need any character to read. Hence we have write z = ε.

Explanation for 2nd Optionx is a part which must occur before repeating group; in 2nd option we need ‘b’ to reach at repeating group. Hence we have write x = b;y is a part which is repeated from zero to n time; in first option ‘a + ba’ is repeated from zero to n time. Hence we have write y = a+ ba;z is a part which must occur after repeating group; in first option we don’t need any character to read. Hence we have write z = ε.

Example 2:

Pumping lemma for (ab)*b + aa (b* + ba)* is

x = ε x = aa x = aay = ab OR y = b OR y = baz = b z = ε z = ε

Page 2: Handout 18.docx

Tahir Naseem/Handout 18 -2- Theory of Automata and Formal Languages

Example 3:

Pumping lemma for ab*(ba + b) is

x = a x = ay = b OR y = bz = ba z = b

Example 4:

Pumping lemma for (bab)* + ab* is

x = a x = εy = b OR y = babz = ε z = ε

Example 5

Pumping lemma for (abb + ba)*

x = ε x = εy = abb OR y = baz = ε z = ε

Example 6

Pumping lemma for ab(bba)* (b*a + b)

x = ab x = ab x = aby = bba OR y = bba OR y = bz = a z = b z = a

Example 7

Pumping lemma for (ab* + ba*) (ba + bb)

x = a x = a x = b x = by = b OR y = b OR y = a OR y = az = ba z = bb z = ba z = ba

Page 3: Handout 18.docx

Tahir Naseem/Handout 18 -3- Theory of Automata and Formal Languages

Pumping Lemma for FSAGiven an FSA

Pumping Lemma can bee written for given FSA for each loop (each loop is a repeating group).

Loop 3-3:x = a x =b ay = b OR y = bz = a z = a

Explanation for 1st Optionx is a part which must occur before repeating group; in first option we need ‘a’ to reach at repeating group (from state 1 to 3). Hence we have write x = a;y is a part which is repeated from zero to n time; in first option ‘b’ is repeated from zero to n time (loop state 3 to 3 with transition b). Hence we have write y = b;z is a part which must occur after repeating group to reach at acceptance state; in first option we need any character ‘a’ to read after loop to reach at acceptance state. Hence we have write z = a.

Explanation for 2nd Optionx is a part which must occur before repeating group; in 2nd option we need ‘ba’ to reach at repeating group (from state 1 to 2 with transition b and from state 2 to3 with transition a). Hence we have write x = a;y is a part which is repeated from zero to n time; in 2nd option ‘b’ is repeated from zero to n time (loop state 3 to 3 with transition b). Hence we have write y = b;z is a part which must occur after repeating group to reach at acceptance state; in 2nd option we need any character ‘a’ to read after loop to reach at acceptance state. Hence we have write z = a.

Loop 2-4-2:x = b x =by = ba OR y = baz = aa z = b

-1 2 3 +4

a

a a

a

b

b

b

b

Page 4: Handout 18.docx

Tahir Naseem/Handout 18 -4- Theory of Automata and Formal Languages

Loop 2-3-4-2:x = b x =by = aaaOR y = aaaz = aa z = b

Loop 1-2-3-4-1:x = ε x = εy = baab OR y = baabz = baa z = aa

Loop 4-2-4:x = baa x = aa/bby = ab OR y = abz = ε z = ε