/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} Q35P Let G be a CFG in Chomsky normal... [FREE SOLUTION] | 91Ó°ÊÓ

91Ó°ÊÓ

Let G be a CFG in Chomsky normal form that contains b variables.

Show that if G generates some string with a derivation having at least 2b

steps, L(G)is infinite.

Short Answer

Expert verified

The grammar G, be a context free grammar in Chomsky normal form that contains

b variables. Show that if G, generates some string with a derivation having at least

2bsteps, L(G) is infinite is proved.

Step by step solution

01

Chomsky normal form

A context-free grammar, G, is said to be in Chomsky normal form (first described by

Noam Chomsky) if all of its production rules are of the form,

A→BC, or

A→a

02

Show that L(G) if infinite

The grammar G, be a context free grammar in Chomsky normal form that contains

b variables. Show that if G, generates some string with a derivation having at least

2bsteps, L(G) is infinite,

Because the grammar G, is a context free grammar in Chomsky normal form, any

derivation can only produce two non-terminals,

Hence an internal node in any parse tree using G, can only have two children.

This means that every parse tree of height k has a maximum of 2k -1.

If G, generates some string with a derivation having at least 2bsteps, the parse tree

of that string will have at least 2binternal nodes.

Based on the above argument, this parse tree has height is at least b+1 , so that

there exists a path from root to leaf containing b+1 variables.

By pigeonhole principle, there is one variable occurring at least twice.

So, here use the technique in the proof of the pumping lemma to construct infinitely

many strings which all are in L(G).

Hence, the grammar G, be a context free grammar in Chomsky normal form that

contains b variables. Show that if G, generates some string with a derivation having

at least 2bsteps, L(G) is infinite is proved.

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 91Ó°ÊÓ!

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

Convert the following CFG into an equivalent CFG in Chomsky normal form, using the procedure given in Theorem 2.9.

A→BAB|B|εB→00|ε

Let G=(V,Σ,R,⟨STMT⟩)be the following grammar.

⟨STMT⟩→⟨ASSIGN⟩|⟨IF-THEN⟩|⟨IF-THEN-ELSE⟩⟨IF-THEN⟩→ifconditionthen⟨STMT⟩⟨IF-THEN-ELSE⟩→ifconditionthen⟨STMT⟩else⟨STMT⟩⟨ASSIGN⟩→a:=1

Σ={if,condition,then,else,a:=1}V={⟨STMT⟩,⟨IF-THEN⟩,⟨IF-THEN-ELSE⟩,⟨ASSIGN⟩}

G is a natural-looking grammar for a fragment of a programming language, but G is ambiguous.

a. Show that G is ambiguous.

b. Give a new unambiguous grammar for the same language

Recall the CFG G4 that we gave in Example 2.4. For convenience, let’s rename its variables with single letters as follows.
E→E+TTT→T×FFF→(E)a

Give parse trees and derivations for each string.

a. a

b. a+a

c. a+a+a

d. ((a))

Answer each part for the following context-free grammar G

R→XRX|SS→aTb|bTaT→XTX|X|εX→a|b

  1. What are the variables of G?
  2. What are the terminals of G?
  3. Which is the start variable of G?
  4. Give three strings in L(G).
  5. Give three strings not inL(G) .
  6. True or False: T⇒aba.
  7. True or False: T⇒∗aba.
  8. True or False:T⇒T .
  9. True or False: T⇒∗T.
  10. True or False:XXX⇒∗aba .
  11. True or False: X⇒∗aba
  12. True or False:role="math" localid="1660812124187" T⇒∗XX.
  13. True or False: T⇒∗XXX.
  14. True or False: S⇒∗ε.
  15. Give a description in English of L(G) .

We defined the CUT of language A to be CUT(A)={yxz|xyz∈A}. Show that the class of CFLs is not closed under CUT.

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.