Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

CSci 4011, Formal Languages and Automata Theory

Homework 4, Spring 2023

Posted: Feb 24, 2023         Due: March 13, 2023

Reminder:  Assignments are due  by 11:59 p .m.  on the due date .

Please make sure to consult the guidelines for homework submissions posted here before you start writing up your homework. In addition, make sure to read the part of the syllabus that discusses the requirements of homework submissions to understand the factors that will impact on the grading. Remember that communicating your approach to the solution of a problem—e.g.  the key ideas underlying a proof or a construction—is as important as laying out the details, and sometimes may be more important. For this reason, you should typically begin your answer to each problem with a brief discussion of these key ideas before you go into the specific details. This is not a hard-and-fast rule—sometimes the essential idea may be so apparent as to not need any further explanation—but it is a yardstick for you to consider when writing your solutions.  Remember that this is a math

course and in assessing math work we must look at precision as well as clarity of thought. Problem 1 (8 + 8 points)

1.  Give an informal English description for a pushdown automaton that will accept the following language:

{w e {a, b}*  l w has twice as many bs as as}.

2.  Translate the informal English description into an actual pushdown automaton. In presenting this automaton, use a state diagram like that in Figure 2.15 in the textbook. In other words, do not try to write down a mathematical description in the form of a 6-tuple, this could be quite tedious and unnecessary for communication between humans.  However, make sure to follow the informal English description you have provided in the rst part of this problem; how faithfully you have followed that description will be a criterion in grading.

Problem 2 (6 points)

Do Exercise 2.12 from the book.  Use the graphical state diagram notation discussed in the book and the class to present its transition function.  However, do not use the shorthand introduced in the proof of Lemma 2.21 for transitions. More specifically, limit the transitions you show to be of a form that writes at most one symbol onto the stack.

Problem 3 (6 +  6 points)

Suppose that L is a context-free language and that R is a regular language. Show then that

1.  L - R must be context free.  Note that  minus” between sets represents set difference, i.e. L - R is the set of all strings in L that are not in R. In doing this part, assume the result in Problem 2.18 part (a) in the textbook.

2.  R - L may not be context-free.  When I did this part, I found use for the observation that context-free languages are not closed under complementation, something that you will see in one of the discussion problems for Week 7; you may use this observation in anticipation of that result.

Problem 4 (8 + 8 + 8 points)

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

1.  The language of all palindromes over {0, 1} that contain equal number of 0s and 1s.

2.  The language described in Problem 2.30, part (d), in the book.  After you have done this problem, you should compare this language with that in Problem 1 in the discussion of week

5 and try to understand why one is context-free but the other is not.

3.  {0n #02n #03n  l n 2 0}.

Problem 5 (10 points)

Given two languages A and B, let A/B denote the language

{w l x w e A for some x e B}.

Show that if A is a context-free language and B is a regular language, then A/B is a context-free language.

Hint:  Think of constructing a PDA for A/B from a PDA for A and a DFA for B .  After initially behaving like both the DFA for B and the PDA for A but on phantom or imagined input, this PDA will have to switch to making transitions like the PDA for A but now consuming actual input. Note that the switch must happen only after the imagined input would have taken the DFA to one of its final states.  If you follow this suggestion, you should define the new PDA precisely based on the PDA for A and the DFA for B and you should explain how that PDA implements this intuition.