Give a counter example to show that the following construction fails to prove that the class of context-free languages is closed under star. Let A be a CFL that is generated by the CFG G=(V,,R,S). Add the new ruleSSS and call the resulting grammar. This grammar is supposed to generate A*.

Short Answer

Expert verified

Answer.

The construction fails for L={a}.

Step by step solution

01

Define Context Free Language

The context free language is generated by context free grammar.These languages are accepted by Pushdown Automata. These are the superset of regular languages.

Consider context-free languages L1described as G1=(V1,S,R1,S1).

Consider context-free language L2described as G2=(V2,S,R2,S2).

02

Determine the counter example

Consider the languageL={a}.

The given grammar and the language is in context free grammar in the form of .G=(V,,R,S).

Note that L*={ε,a,aa,aaa,...}

A grammar of L is localid="1662050454885" G=({S},{a},{(Sa)},S).

The construction gives :G'=({S},{a},{(Sa),(SSS)},S).

However, L (G) does not contain ε so the construction doesn’t produce a grammar for L*.

Hence, the construction fails for L={a}.

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Use the procedure described in Lemma 1.55 to convert the following regular expressions to nondeterministic finite automata.


a.(01)*000(01)*b.((00*11)01)*c.*

Let. ={0,1}LetC1 be the language of all strings that contain a 1 in their middle third.

Let C2be the language of all strings that contain two 1s in their middle third. So C1={xyz|x,z*andy*1*,where|x|=|z||y|}and C2={xyz|x,z*andy*1*1*,  where|x|=|z||y|}.

a.Show that C1is a CFL.

b. Show thatC2 is not a CFL

Show that if G is a CFG in Chomsky normal form, then for any stringwL(G) of lengthn1, exactly2n-1 steps are required for any derivation of w.

Myhill–Nerode theorem. Refer to Problem 1.51 . Let L be a language and let X be a set of strings. Say that X is pairwise distinguishable by L if every two distinct strings in X are distinguishable by L. Define the index of L to be the maximum number of elements in any set that is pair wise distinguishable by L . The index of L may be finite or infinite.

a. Show that if L is recognized by a DFA with k states, L has index at most k.

b. Show that if the index of L is a finite number K , it is recognized by a DFA with k states.

c. Conclude that L is regular iff it has finite index. Moreover, its index is the size of the smallest DFA recognizing it.

Let F be the language of all strings over 0,1that do not contain a pair of 1s that are separated by an odd number of symbols. Give the state diagram of a DFA with five states that recognizes F . (You may find it helpful first to find a 4-state NFA for the complement of F).

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free