Could anyone tell the reason for popping the top of stack(dollar symbol) as said in this lecture(p.54) when there's already dollar symbol in the stack.I would like to know if we could replace the transition given here(p.54) of the formA,$ $\to$ 0$withA,$\epsilon \to$ 0. 
Why do we pop the dollar symbol when it's already present in the stack in PDA?
automata;pushdown automata
The end-of-stack symbol (often $\$$) is necessary for the automaton to know when there are no more stack symbols. Therefore, when we reach $\$$ we have two options:Remove the $\$$ and terminate.Put it back there for later, maybe adding additional symbols.Ergo, as long as you do not want to terminate you have to keep putting $\$$ back when you find it.Why does it have ot be like that, you ask? In the definition I know, PDAs always take out the top-most symbol. So the creator of the PDA has no choice but to deal with the $\$$ once it is on the top of the stack.But why define it like that, you ask? If PDAs were allowed to not consume the topmost stack symbol they'd be inherently nondeterministic. And since you gain nothing by this choice -- doing nothing with the stack is trivial to simulate by just putting the symbol you read back -- there is no reason to introduce this source of nondeterminism.Depending on the definition, termination is defined by empty stack or you have to switch into a final state. The definitions are equivalent. Remember that it's an declarative, not an algorithmic definition!