1

While designing Push Down Automata consider my inputs are {a,b} Now can I push multiple a's or multiple b's while scanning them...and then while popping can I pop multiple number of a's or multiple number of b's... OR is it the case that I can push/pop only one element at a time i.e. pushing single 'a' or single 'b' and also while popping out only single 'a' or single 'b'?

Piyush Sawarkar
  • 156
  • 1
  • 11

1 Answers1

0

Suppose you have a PDA that relies on pushing multiple values onto the stack. Specifically, in state q with top-of-stack symbol x and input symbol y, you replace symbol x with the string s (which may or may not maintain x in its position on the stack) and change to state q'.

This PDA can be transformed into one which does not rely on pushing multiple symbols onto the stack simultaneously as follows:

  1. add states q1, q2, …, q|s| to the PDA
  2. change the transition (q, x, y) -> (q', s) to (q, x, y) -> (q1, s[1])
  3. add transitions (qk, x, e) -> (qk+1, s[2]x) for 1 <= k < s
  4. add a transition (q|s|, x, e) -> (q', x)

Note that if we started with a DPDA, we still have a DPDA after this transformation: we have transitions which do not consume input, however, this is fine for DPDAs as long as only one transition can be taken at any given time.

Popping is a little harder but the idea is the same:

  1. introduce some new states
  2. start popping the symbols in the right order
  3. if you pop everything you needed, great, continue on as in the original PDA
  4. if you find you're missing something you wanted to pop, you should basically just crash (a DPDA cannot possibly have accepted the input since it only came down this path because it had to, while an NPDA can still accept along some other path)
Patrick87
  • 27,682
  • 3
  • 38
  • 73
  • So do you mean to say that power in case of both the kinds i.e at time of pushing/popping multiple and single elements is same...?? Thus both the things are equivalent and valid...?? – Piyush Sawarkar Feb 12 '20 at 17:31
  • @PiyushSawarkar You're right. This shows it doesn't really matter what convention you use because both end up being precisely equivalent in terms of computational power. – Patrick87 Mar 11 '20 at 12:36