Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What type of languages are accepted by a PDA in which stack size is limited?

What type(s) of languages are accepted by a PDA in which stack size is limited to, say 20 items?

In my view it should still be CFL, because there is a temporary memory to store.

like image 727
Prashant Bhardwaj Avatar asked Feb 21 '23 22:02

Prashant Bhardwaj


1 Answers

A PDA with a stack limited to containing 20 items is equivalent to a DFA. Here's the proof.

  1. Take any PDA-20, and you can make it into an equivalent DFA. Let's say the stack alphabet S where |S| = N. You also have the bottom-of-stack symbol Z. We imagine an additional symbol, -, which we can also have on the stack, which stands for "unused". The stack is now equivalent to a string of the form x = -* S* Z where |x| = 20, in all cases. Pushing onto the stack consists in replacing occurrences of -, whereas popping consists in replacing other symbols with -, in a LIFO manner. There are now (N+2)^20 possible configurations of the stack for any PDA-20. To construct the DFA, simply replicate each state of the DFA by this factor, and have transitions to states of the DFA reflect the new configuration of the stack. This way, the information contained in the configuration of the stack in the PDA-20 is contained in the current state of the DFA.

  2. Take any DFA, and you can make it into an equivalent PDA-20. Simply don't use the stack, and you have a PDA-20 which accepts the same language as the DFA.

Just to illustrate the first part of the proof, consider a PDA-5 with states A, B, C, ..., Z, and a lot of transitions. Let's say the input alphabet is {0, 1}. Then there are 2^5 = 32 different stack configurations, say. The DFA equivalent to this PDA-5 might have states A1, B1, ..., Z1, A2, B2, ..., Z2, ..., A32, B32, ..., Z32, though it will have the same number of transitions as the original. If a transition in the original PDA-5 would have taken the stack from configuration #2 in state R to configuration #17 and the machine to state F, the DFA will go from state R2 to state F17.

like image 152
Patrick87 Avatar answered May 10 '23 21:05

Patrick87