10 10 votes There are two possible acceptance criteria: acceptance by empty stack and acceptance by final state. The two are not equivalent for the deterministic pushdown automaton (although they are for the non-deterministic pushdown automaton). The languages accepted by empty stack are those languages that are accepted by final state and are prefix-free: no word in the language is the prefix of another word in the language. This is the quote from Wikipedia....plz explain why acceptance by empty stack and acceptance by final state are not equivalent in case of DPDA but it is equivalent in case of NPDA Theory of Computation + – himgta 5.5k views answer comment Share Follow Print See all 7 Comments 7 7 Comments reply MiNiPanda commented Oct 6, 2018 reply Follow flag Prefix property : In simple words if a language has a string x then that language should not have any string xy where y≠∈. This means there can be no string in the language present which has it's prefix present as well in the language. If xy is a string present in L whose prefix x is also a part of L then such language is said to have no prefix property. Eg: L={∈,a,aa,aaa,aaaa,....} i.e. a* Here aa is a string those proper prefixes are ∈,a. ∈,a belong to L. So this language has no prefix property. Now as your statement says that DPDA with empty stack cannot accept languages which does not have prefix property. To prove this I assume that this statement is false and try to use proof by contradiction. So let L be a language containing x and xy ( y≠∈ ) and L is accepted by DPDA with empty stack. Let the start state be q0 and the DPDA is given string x. Then after some transitions when we finish taking all the characters in string x we will reach a state (say p) where the stack becomes empty and we know that x is accepted by DPDA. (q0,x,Z0) ------->* (p,∈,∈) Next we take xy into the DPDA. Since it contains x as a part of it then it's clear that it will follow the same initial transitions as before and ultimately will reach state p where it is left with "y" but the stack has become empty! (q0,xy,Z0) ------->* (p,y,∈) This means that without checking the whole string we have come to an empty stack situation from where we can't proceed further! DPDA cannot make any further transitions on empty stack but part of i/p is still left. When is a string accepted? When stack is empty and we reach the end of the string. So, xy is not accepted by DPDA with empty stack. Next question is how NPDA deals with such languages? This is because NDPA has more than 1 choice for a particular configuration. Even if it gets stuck in this situation with empty stack and input left ≠∈ it can have other routes to explore. I take the example of aa* and try to make NPDA that accepts by empty stack. I don't know whether this is a minimized state NPDA or not. 1.(q0,a,Z0) -> (q1, ∈ ) // pop Z0 on a and move to state q1 -->this accepts "a" 2.(q0,a,Z0) -> (q2, Z0) // Do nothing on a and move to state q2 3.(q2,a,Z0) -> (q2, Z0) // Do nothing on a and remain in state q2 4.(q2,a,Z0) -> (q1,∈) // pop Z0 on a and move to state q1 In case of DPDA we don't have any other choice after rule 1. Here in NPDA we can move to state q2 and remain there until we want to pop Z0. Take string a (q0,a,Z0) --> (q1,∈) //Stack is empty now Take string aa (q0,a,Z0) --> (q2,Z0) (q2,a,Z0) --> (q1,∈) Does this clear your doubt? 45 45 replyShare himgta commented Nov 12, 2018 reply Follow flag @MiNiPanda I skipped this one at that time & thought that I would by heart this... & today I again came across this type of question & I read urs explanation 2-3 times and got the concept...Thanks Sir! 0 0 replyShare MiNiPanda commented Nov 12, 2018 reply Follow flag Welcome @himgta :) 0 0 replyShare jaswanth431 commented Aug 12, 2021 reply Follow flag @minipanda nicely explained 0 0 replyShare hetgate22 commented Sep 11, 2021 i moved by Shaik Masthan Jan 9, 2022 reply Follow flag Thanks Brother, it helped alot. 0 0 replyShare gaurav_kumar commented Mar 12, 2022 reply Follow flag @MiNiPanda, what a nice explanation, grateful 0 0 replyShare Rish@bh_shukl@ commented Aug 23, 2025 reply Follow flag Thanks @MiNiPanda 0 0 replyShare Please log in or register to add a comment.