Homework 6: Pushdown Automata (12 Points)

Chris Tralie

Overview / Logistics

The purpose of this problem set is to get you experience designing pushdown automata, which will serve as a warmup to our ultimate destination in this course: Turing machines. What's neat about all of the languages in these problems is that they aren't regular (you could prove this with the pumping lemma), but they're still simple enough that just having a rudimentary stack for memory is enough to recognize them.

In all of the problems below, you should design and submit a JFLAP file. Be sure to only push or pop one character at a time.

Problem 1 (3 Points)

Design a pushdown automaton that recognizes the following language

\[ L = \{ a^{2n}b^{5n} | n \geq 0 \} \]

Below are some tests you can try in JFLAP (Click here to download them)

InputResult
aabbbbb Accept
aabbbbbb Reject
aaabbb Reject
aaaaaabbbbbbbbbbbbbbb Accept
aaaaaaaabbbbbbbbbbbbbbbbbbbb Accept
aabb Reject
aaaaaaaabbbbbbbbbbbbbbbbbbbbbb Reject
aabbbbbbbbbb Reject
aaabbbbb Reject

Problem 2 (3 Points)

Design a pushdown automaton that recognizes the following language

\[ L = \{ a^nb^mc^md^n | m, n \geq 0 \} \]

Below are some tests you can try in JFLAP (Click here to download them)

InputResult
aabbbbb Reject
aaaddd Accept
aaabcddd Accept
abbbbccccd Accept
abbbbccccdd Reject
bbbbcccc Accept
bbbbccccc Reject
aabbbbccccdd Accept
dcba Reject

Problem 3 (3 Points)

Design a pushdown automaton that recognizes the following language

\[ L = \{w\#x | w^R \text{ is a substring of } x \text{ for } w, x \in \{0,1\}^* \}\]

Below are some tests you can try in JFLAP that should all accept (Click here to download them). I'm showing w in red and wR, the reverse of w, in blue. The entire substring after the red portion is x. I'm separating these tests out because with nondeterminism, it's possible that JFLAP will warn you that a ton of configurations are being generated, so it's nice to do these ones separately.

InputResult
10110#1111011011 Accept
00101#01010100 Accept
1110100#01000101110 Accept
01010#10100101001 Accept
01011100#0000001110100 Accept
#0101Accept (Empty w)

Below are some inputs that should be rejected (Click here to download them). These tests will run faster

InputResult
00#111Reject
01010#11001100Reject
101100#10110Reject
01010#10100101Reject
01011100#01110100Reject

Problem 4 (3 Points)

The following context free grammar generates the language of binary strings with the same number of 1s as 0s

  • S → λ
  • S → 0S1S
  • S → 1S0S

Devise a pushdown automaton that recognizes the same language. Below are some tests you can apply in JFLAP (Click here to download them)

InputResult
01011011Reject
11001100Accept
0111001100Accept
0101110010Accept
001111Reject
000000110Reject
10001Reject
11001000Reject
0101101001Accept
00100111Accept