1 / 11

Lecture 3 Regular Epressions Pumping Lemma

Lecture 3 Regular Epressions Pumping Lemma. Jan Maluszynski , IDA, 200 7 http://www.ida.liu.se/~janma janma @ ida.liu.se. Outline. Motivating example RE Definition Equivalence with FA Pumping Lemma for RE. Motivating example. A language L over {a,b}: a string x is in L iff

lelandh
Download Presentation

Lecture 3 Regular Epressions Pumping Lemma

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 3Regular EpressionsPumping Lemma Jan Maluszynski, IDA, 2007 http://www.ida.liu.se/~janma janma @ ida.liu.se Jan Maluszynski - HT 2007

  2. Outline • Motivating example • RE Definition • Equivalence with FA • Pumping Lemma for RE Jan Maluszynski - HT 2007

  3. Motivating example A language L over {a,b}: a string x is in L iff x = waaz or x = wbbz For some strings w, z. Thus w, z are in{a,b}* Formal notation defining L: (a+b)*(aa+bb)(a+b)* Jan Maluszynski - HT 2007

  4. Regular Expressions over  Each expression R defines a language L(R). R is a regular expression over  if R is: • a in  L(R) = {a} •  L(R) = {} •  L(R) is the empty set • (R1+R2) L(R) = L(R1)  L(R2) • (R1 R2) L(R) = L(R1) L(R2) • R1* L(R) = L(R1)* Sometimes ”” is used instead of ”+” Jan Maluszynski - HT 2007

  5. Regular Expressions vs. Finite Automata A language is regular iff it is defined by a regular expression. • Given R construct NFA accepting L(R) pp.68-69 • Given FA M construct expression R s.that L(M)=L(R) pp. 69-73 Jan Maluszynski - HT 2007

  6. Regular Expressions to Finite Automata In the book: • Construct NFA´s for basic components in given RE • Combine them using standard construction steps JFLAP approach: • Start from a GNFA • Decompose it until NFA is reached Jan Maluszynski - HT 2007

  7. (D)FA to RE • Assume: • single initial state no incoming arrows • single final state no outgoing arrows • Apart of initial and final state the transition graph is complete • Construct GNFA by eliminating one state at a time • Two-state GNFA shows the result Jan Maluszynski - HT 2007

  8. Constructing RE for a FA Jan Maluszynski - HT 2007

  9. Pumping Lemma for regular languages FA M has a finite number p of states If |s| > p is accepted by M some state is visited at least twice, thus s = xyz where y moves M from q to q Hence xyiz is in L(M) for any i=0,1,… Jan Maluszynski - HT 2007

  10. Pumping Lemma for regular languages For any regular languge R there exists p such that If s is in R and |s|  p Then s = xyz, for some x,y,z satisfying the conditions: • For each i  0 xyiz is in R 2. |y| > 0 3. |xy|  p Jan Maluszynski - HT 2007

  11. Example of a non-regular language The infinite language {(),(()), ((())),…} is not regular Proof: Assume the contrary. Get the contradiction by pumping lemma: choose a string and show that it can’t be pumped. Jan Maluszynski - HT 2007

More Related