Question regarding the initial stack symbol in Push Down Automaton

571 Views Asked by At

Let $L = \{a^nb^n : n \geq 0\} \cup \{a\}$, where $\Gamma = x, \$, \Sigma = \{a, b\}$, we have the NPDA of $L$ in three states:

enter image description here

In the above state diagram, I can break the transtion $\lambda, \lambda \rightarrow \$$ by creating another initial state, but my question is if I put it in the loop together is it still ok? Since the notation of Peter Linz's book is so confusing, I have to borrow Micheal Sipser's book notations for this problem. The idea of PDA is as follows:

  • Read nothing, push $ onto stack - Read an $a$, push $x$ onto stack. - Read a $b$, pop $x$ out of stack. - Special case is when reading an $a$, push \$ onto stack and move to state $q_1$, then from $q_1$ read nothing, pop \$ out of stack and go to accepting state.

Does this PDA looks reasonable at all?
Thank you.

1

There are 1 best solutions below

1
On BEST ANSWER

Couldn’t your NDPA erroneously accept $aab$ by the following sequence?

  1. read $a$ and push $x$ onto the stack;
  2. read nothing and push $\$$;
  3. read $a$ and push $x$;
  4. read nothing and transfer to state $q_1$;
  5. read $b$ and pop $x$;
  6. read nothing, pop $\$$, and transfer to state $q_2$.

(By the way, shouldn’t the bottom label be $a,\lambda\to\$$, not $a,\lambda,\$$?)