Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

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

Short Answer

Expert verified

a.It can be shown that C1is a CFL.

b. It can be shown that C2is not a CFL

Step by step solution

01

Explain Context-free language

Context-free grammar generates context-free grammar. The regular languages are the subset of the context-free languages that are an identical set of languages accepted by pushdown automata.

02

Step 2:Show that C1is a CFL.

a.

Consider the given,C1={xyz|x,z*andy*1*,where|x|=|z||y|}where ={0,1}.

Construct the pushdown automata p to determine the language C1. The p can be defined as(Q,,Γ,δ,q0,F), where .Q={q0,q1,q2},={0,1},Γ={x},F={q2}

The PDA is as follows,

Thus, the PDA accepts the given language C1.

Therefore, C1is a Context-free Language and it has been proved.

03

Step 3:Show that C2 is not a CFL.

b.

Consider the given languageC2, C2={xyz|x,z*andy*1*1*,  where|x|=|z||y|}accepts all the string that has two 1’s in the middle of the string.

Consider the pumping lemma to show that C2is not a context-free language. Assume that C2is a CFL and prove its contradiction by the pumping lemma l.Consider the string ,S that is divided into pieces asS=abcde.

  • For each i0,abicdieC2
  • |bd|>0
  • |bcd|l

Where, a=0l+2,b=1,c=0l,d=1,e=0l+2. Let i=1, after pumping S=0l+210210l+2. The new string |10l1|lfails, and thus it is not a CFL.

Therefore, the languageC2 is not a Context-free language.

One App. One Place for Learning.

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

Get started for free

Study anywhere. Anytime. Across all devices.

Sign-up for free