Midterm 3 Study Guide

The test covers all the material discussed in sections 9.4-9.7, the CFG handout (sections 5.1 and 5.2.1), and the pushdown-automata and parsing notes, and homeworks 9 through 12. The following set of questions is meant to help guide your study and is not meant to be exhaustive of all the possibilities.

  1. (review from midterm 2) Suppose that problem A Turing reduces to problem B. Which of the following are necessarily true?

  2. (review from midterm 2) Prove the following reductions, using explicit Python code where needed.

  3. Define what we mean by a (pure) regular expression.

  4. Provide regular expressions for the following languages on the alphabet \(\{a,b\}\):

  5. State what the pumping lemma for regular languages says and give a brief sketch of the proof idea.

  6. Describe how a pushdown automaton differs from a finite automaton, and what its (non-deterministic) state transitions look like. Explain in simple terms why the PDAs have more computational power than NFAs/DFAs.

  7. For the following non-regular languages: prove that they are not regular, build PDAs for them, build context-free grammars for them, and demonstrate the PDA execution as well as a CFG derivation for the provided input strings, and a parse tree for the derivation:

  8. For each of the following, prove or disprove:

  9. Describe the two different PDAs corresponding to a given CFG. Follow the derivation of a particular string on the PDAs, showing the evolution of the stack and the process of the input. Recall that one of the PDAs builds a leftmost derivation while the other builds a rightmost derivation.

  10. Build the item-set DFAs for the following grammars:

    S -> epsilon | a | b | aSa | bSb

    and:

    E -> a | (A)
    A -> E | E A
  11. Find first and follow sets for the two grammars in the previous question, as well as the polish notation grammar, the basic arithmetic grammar as well as the rewrite of that grammar to avoid left-recursive rules.