/*! 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} Free solutions & answers for Introduction to Theory of Computation Chapter 2 - (Page 2) [step by step] 9781133187790 | 91Ó°ÊÓ

91Ó°ÊÓ

Q23P

Page 163

Let D={xy|x,y∈{0,1}*and|x|=|y|butx≠y}.X1,…,XnShow thatD is a context-free language.

Q24P

Page 163

Let E={aibj|i≠jand2i≠j}. Show thatE is context-free language.

Q25P

Page 163

For any language, let SUFFIX() ={v|uv∈Aforsomestringu}. Show that the class of context-free languages is closed under the SUFFIX operation

Q27P

Page 157

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

Q28P

Page 157

Give unambiguous CFGs for the following languages.

a. {w | in every prefix of w the number of a’s is at least the number of b’s}

b. {w | the number of a’s and the number of b’s in w are equal}

c. { w| the number of a’s is at least the number of b’s in w}?

Q29P

Page 157

Show that the language A is inherently ambiguous.

A={aibjck|i=j or â¶ÄŠj=k â¶ÄŠwhere â¶ÄŠi,j,k≥0}

Q2E

Page 154
  1. Use the languages A={ambncnm,n≥0}and B={anbncmm,n≥0}together with Example 2.36 to show that the class of context-free languages is not closed under intersection.
  2. Use part (a) and DeMorgan’s law (Theorem 0.20) to show that the class of context-free languages is not closed under complementation.

Q30P

Page 157

Use the pumping lemma to show that the following languages are not context free.

a. {0n1n0n1n|n≥0}

b.{0n#02n#03n|n≥0}

c. role="math" localid="1659701399563" {w#t|w â¶ÄŠis â¶ÄŠa â¶ÄŠsubstring â¶ÄŠâ€Šof â¶ÄŠt,where â¶ÄŠw,t∈(a,b)*}

d. (t1#2#......#tk|k≥2,each â¶Ä‰ti∈{a,b}*and â¶ÄŠt=t â¶ÄŠfor â¶ÄŠsome â¶ÄŠi≠j)

Q32P

Page 157

Let ∑={1,2,3,4}andC={w∈Σ*|inw, the number of 1s equals the number of 2s, and the number of 3s equals the number of 4s} Show thatCis not context free.

Q33P

Page 157

Show that F = { aibj|i=kjfor some positive integerk } is not context free

Access millions of textbook solutions in one place

  • Access over 3 million high quality textbook solutions
  • Access our popular flashcard, quiz, mock-exam and notes features
  • Access our smart AI features to upgrade your learning
Access millions of textbook solutions in one place

Recommended explanations on Computer Science Textbooks