Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Non-Regular Languages - Automata and Complexity Theory - Lecture Slides, Slides of Theory of Automata

Some concept of Automata and Complexity Theory are Administrivia, Closure Properties, Context-Free Grammars, Decision Properties, Deterministic Finite Automata, Intractable Problems, More Undecidable Problems. Main points of this lecture are: Non-Regular Languages, Right-Linear Grammar, Languages, Languages Non-Regular, Pumping, Proof Tool, Pumping, Pumping-Lemma Proofs, Strategies, Pumping and Finite Languages

Typology: Slides

2012/2013

Uploaded on 04/29/2013

shamir_69
shamir_69 🇮🇳

5

(4)

66 documents

1 / 51

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Chapter Eleven:
Non-Regular Languages
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e
pf2f
pf30
pf31
pf32
pf33

Partial preview of the text

Download Non-Regular Languages - Automata and Complexity Theory - Lecture Slides and more Slides Theory of Automata in PDF only on Docsity!

Chapter Eleven:

Non-Regular Languages

We have now encountered regular languages in several different places. They are the languages that can be recognized by a DFA. They are the languages that can be recognized by an NFA. They are the languages that can be denoted by a regular expression. They are the languages that can be generated by a right-linear grammar. You might begin to wonder: are there any languages that are not regular? In this chapter, we will see that there are. There is a proof tool that is often used to prove languages non-regular. It is called the pumping lemma, and it describes an important property that all regular languages have. If you can show that a given language does not have this property, you can conclude that it is not a regular language.

SaSb | ε

The Language { a n^ b n }

  • Any number of a s followed by the same number of b s
  • Easy to give a grammar for this language:
  • All derivations of a fully terminal string use the first production n =0 or more times, then the last production once: a nbn
  • Is it a regular language? For example, is there an NFA for it?

Trying To Build An NFA

  • We'll try working up to it
  • The subset { a n^ b n^ | n ≤ 0}:
  • The subset { a n^ b n^ | n ≤ 1}:

a

b

The Subset { a n^ b n^ | n ≤ 3}

a

b

b

a a

b

A Futile Effort

  • For each larger value of n we added two more states
  • We're using the states to count the a s, then to check that the same number of b s follow
  • That's not going to be a successful pattern on which to build an NFA for all of { a nbn } - NFA needs a fixed, finite number of states - No fixed, finite number will be enough to count the unbounded n in { a nb n }
  • This is not a proof that no NFA can be constructed
  • But it does contain the germ of an idea for a proof…

A Word About That Proof

  • Nothing was assumed about the DFA M ,

except its alphabet { a , b }

  • In spite of that, we were able to infer quite a

lot about its behavior

  • The basic insight: with a sufficiently long

string we can force any DFA to repeat a state

  • That's the basis of a wide variety of non-

regularity proofs

Outline

  • 11.1 The Language { a n^ b n }
  • 11.2 The Languages { xx R }
  • 11.3 Pumping
  • 11.4 Pumping-Lemma Proofs
  • 11.5 Strategies
  • 11.6 Pumping And Finite Languages

SaSa | bSb | ε

A Grammar For { xx R^ | x ∈ { a , b }*}

  • A derivation for abba :
    • SaSaabSbaabba
  • A derivation for abaaba :
    • SaSaabSbaabaSabaabaaba
  • Every time you use one of the first two productions, you add a symbol to the end of the first half, and the same symbol to the start of the second half
  • So the second half is always the reverse of the first half: L ( G ) = { xxR^ | x ∈ { a , b }*}
  • But is this language regular?

Intuition

  • After seeing the first example, you may

already have the feeling this can't be regular

  • A finite state machine would have to use states to keep track of x , then check that it is followed by a matching x R
  • But there is no bound on the length of x , so no fixed, finite number of states will suffice
  • The formal proof is very similar to the one we

used for { a n^ b n }…

Outline

  • 11.1 The Language { a n^ b n }
  • 11.2 The Languages { xx R }
  • 11.3 Pumping
  • 11.4 Pumping-Lemma Proofs
  • 11.5 Strategies
  • 11.6 Pumping And Finite Languages

Review

  • We've shown two languages non-regular:

{ a n^ b n } and { xx R }

  • In both cases, the key idea was to choose a

string long enough to make any given DFA

repeat a state

  • For both those proofs we just used strings of

a s, and showed that ∃ i and j with i < j such

that δ( q 0 , a i ) = δ( q 0 , a j )

Pumping

  • We say that the substring a ( j-i)^ can be pumped

any number of times, and the DFA always

ends up in the same state

  • All regular languages have an important

property involving pumping

  • Any sufficiently long string in a regular

language must contain a pumpable substring

  • Formally, the pumping lemma…

Lemma 11.3: The Pumping

Lemma for Regular Languages

  • Let M = ( Q , Σ, δ, q 0 , F ) be any DFA with L ( M ) = L
  • Choose k = | Q|
  • Consider any x , y , and z with xyzL and | y | ≥ k
  • Let r be a state that repeats during the y part of xyz
    • We know such a state exists because we have | y | ≥ |Q|…

For all regular languages L there exists some integer k such that for all xyzL with | y | ≥ k , there exist uvw = y with | v | >0, such that for all i ≥ 0, xuviwzL.

x y z

In state r here And again here