Second midterm solutions
Second midterm solutions
This is a 50-minute in class closed book exam. All questions are straightforward and you
should have no trouble doing them. Please show all work and write legibly. Thank you.
3. Describe in English how to convert a many state pushdown automaton to a one state
pushdown automaton.
Solution: The pushdown store alphabet of the one state machine will be Q × Γ × Q where
Q is the set of states of the multi-state machine and Γ is its pushdown store alphabet.
The one state pda will store the current state of the multi-state pda in the first component
of the top stack symbol. When the pda grows its store by writing a new symbol on the
store it places the state in the first component of the top symbol and guesses the state it
will be in when it erases the top symbol exposing the symbol just below. The guess is
stored in the symbol just below the top. To verify that the guess is correct it will also
store the guess as the third component of the symbol on the top of the store. Whenever a
symbol is erased from the store a check is made that the third component is the new state
since that is the state that is in the first component of the symbol below which will
become the new top symbol.