lecture 8 sept 29 2011
Download
Skip this Video
Download Presentation
Lecture 8 Sept 29, 2011

Loading in 2 Seconds...

play fullscreen
1 / 20

Lecture 8 Sept 29, 2011 - PowerPoint PPT Presentation


  • 121 Views
  • Uploaded on

Lecture 8 Sept 29, 2011. Regular expressions – examples Converting DFA to regular expression. (same works for NFA to r.e. conversion.) Converting R.E. to NFA Pumping lemma. Theorem: A language is regular if and only if it is accepted by a regular expression.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Lecture 8 Sept 29, 2011' - arlen


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
lecture 8 sept 29 2011
Lecture 8 Sept 29, 2011
  • Regular expressions – examples
  • Converting DFA to regular expression. (same works for NFA to r.e. conversion.)
  • Converting R.E. to NFA
  • Pumping lemma
slide3

Theorem: A language is regular if and only if it is accepted by a regular expression.

  • Proof: Show how to convert from regular expression to NFA and vice-versa.
  • Let L be accepted by a regular expression. We prove that it is regular, i.e., there is a NFA for L.
  • Cases to consider:
  • empty-set (2) single symbol {a} (3) {e}
  • (a) R1 + R2
  • (b) R1 . R2
  • (c) R1*
  • (1), (2) and (3) are easy base cases. For (4), inductively construct NFA’s for R1 and R2, and from it construct an NFA for R.
slide7

Converse is shown as follows:

Given a DFA (or NFA), we remove states one by one until we have one state left. At this point, we can write down the regular expression.

The idea is to use generalized NFA, one in which the transitions are labeled not by a single symbol, but by a regular expression.

Example of GNFA:

slide8

Conversion from DFA to regular expression

Key step: how to remove a state of a GNFA

slide9

So far, we have seen how to design DFA, NFA or regular expressions for various languages.

  • We also learned how to convert:
    • NFA  DFA
    • DFA  regular expression
    • Regular expression  NFA
  • But there are many languages for which we can never build a DFA or an NFA or a regular expression.
  • Can you think of such a language?
slide10

Two fundamental examples

  • L = { anbn | n > 0}
  • This contains strings e, ab, aabb, aaabbb, … etc.
  • Why is it not possible to create a DFA for L?
  • L’ = { w | w is a balanced parentheses string over [, ] }
  • This includes strings such as [ ], [ ][ ], [ [ ] ], etc.
  • How can we show that it is impossible to build DFA for these languages?
a tool known as pumping lemma is used to show that certain languages are not regular
A tool known as pumping lemma is used to show that certain languages are not regular.

Characteristics of Regular Languages

Idea: Because a DFA D has a finite number of states, say nD, before reading nD + 1 input characters, D must enter some state q for a second time.

the pumping lemma
The Pumping Lemma
  • If L is a regular language, then:
  •  a value n such that:
  •  w in L such that |w| > n,
  •  x,y,z such that w = xyz
  • where |y| > 0, |xy| < n
  •  i > 0, xyiz  L
proof let l l d
Proof: let L = L(D)

Given w = w1 w2 … wk,

let s1s2 … sk+1 be the consecutive states reached

by DFA D on w (where s1= s the start state)

If k>nD, then by the pigeon hole principle, we know  i,j, (i<j), i, j{1 … k+1} such that si = sj

Then x = w1 w2 … wi-1 puts D in state si

and so does xy = w1 w2 … wi-1 wi … wj-1

… and so does xyt = w1 w2 … wi-1 (wi … wj-1)t

proof visualization
Proof … visualization

x = w1 w2 … wi-1

s1

si

y = wi … wj-1

sk+1

z = wj … wk

accept

proof continued
Proof … continued

z = wj … wk takes D from state si to sk+1, an accept state

So xytz = w1 w2 … wi-1 (wi … wj-1)t wj … wk takes D from the start state to the same accept state

crucial use of the pumping lemma to show that l is not regular
Crucial use of the Pumping Lemma:to show that L is not regular!

Using the contrapositive

A implies B B implies A

slide17

the Pumping Lemma in contrapositive form

If

 n in Z

 w such that |w| > n

 x,y,z such that w = xyz

and |y|>0 and |xy|<n

 i>0 s.t. xyiz is NOT in L

then

L is NOT a regular language

slide18

Applications of pumping lemma

Therefore L is not regular.

slide20

A technique for showing lower-bound on the number of states in a DFA

Example: Consider the regular language L = { x | the 5-th symbol from the right-end of x is 1} over the alphabet S = {0, 1}.

We will show that any DFA for this language requires at least 32 states. Let w0 = 00000, w1 = 00001, …, w31 = 11111 be the list of all strings of length 5 over S.

Let M be any DFA accepting L. Let qj = d(s, wj) be the state reached from the starting state on input wj. We will argue that all qj’s must be distinct.

(The proof will be completed in lecture.)

Note: Problem 4 of HW 4 requires you to use this technique.

ad