1
$\begingroup$

My idea is to (not formal) push an 'a' when we see an a, nondeterministically guess when n a's were seen from the input word, go to the next state. From there, when we see an a, push 2 'a's into the stack and again guess when n a's were seen (now there should be 3n 'a's in the stack) and go to the final state, where if we see a b, we pop from the stack. So the stack will be empty in the last state iff we saw 3n b's.
The problem that with this line of thought we can construct an automaton for$\{a^{n}b^{n}c^n|n\ge0\}$. So where am i wrong in this thinking?

$\endgroup$
1
$\begingroup$

Your PDA accepts the language $$ \{a^{i+j} b^{i+2j} : i,j \geq 0 \}, $$ which is different from the one you are interested in. In fact, you can show that it equals $$ \{a^kb^\ell : k \leq \ell \leq 2k \}. $$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.