Push-down automata (or PDAs) are acceptors of Context-Free languages. Informally, a push-down automata is equipped with a simplistic type of memory - a stack. Thus, a PDA is able to push or pop symbols, however it is unable to directly index the memory - once a symbol is popped (to reach the inner stack values) it is lost from the memory.
Definition (PDA):
A push-down automaton is a tuple $ M=(K,\Sigma,\Gamma,\Delta,q_0,Z_0,F)$ where:
$ K$ is a finite set of states $ \Sigma$ is the input alphabet $ \Gamma$ is the stack alphabet (which may contain symbols from $ \Sigma$ ) $ \Delta\subseteq K\times \Sigma^*\times \Gamma^*\times K\times\Gamma^*$ is a transition relation. If $ (q,c,\gamma,q',\gamma')\in\Delta$ , then from state $ q$ , if symbol $ c$ has been read, and the top of the stack corresponds to $ \gamma$ , then the PDA goes to state $ q'$ , and executes the stack operation $ \gamma'$ :
if $ \gamma=a$ (the top of the stack is $ a$ ) and $ \gamma'=a$ , then the stack is left unmodified if $ \gamma=a$ and $ \gamma'=ba$ , then symbol $ b$ is pushed on the stack (over $ a$ ) if $ \gamma=a$ and $ \gamma'=\epsilon$ , then symbol $ a$ is popped from the stack. more generally, if $ \gamma=c_1\ldots c_n$ and $ \gamma'=d_1\ldots d_m$ , then symbols $ c_1$ to $ c_n$ from the top of the stack are popped, and replaced by $ d_1$ to $ d_m$ . Note that some $ c_i$ may coincide to some $ d_j$ . $ q_0\in K$ is the initial state $ Z_0\in\Gamma$ is the empty-stack symbol $ F\subseteq K$ is the set of final states
Remarks
Definition (Configuration):
A configuration of a PDA is a triple $ (q,w,\gamma)\in K\times\Sigma^*\times\Gamma^*$ . $ q$ is the current state, $ w$ is the rest of the input to be processed, and $ \gamma$ is the contents of the stack.
Definition (Zero or more steps):
The relation $ \vdash_M$ , as well as $ \vdash_M^*$ over PDA configurations is defined similarly to those for NFAs and DFAs. We remark that, for a transition $ (q,u,\gamma,q',\gamma')$ , we have the one-step relation $ (q,uv,\gamma\xi)\vdash_M(q',v,\gamma'\xi)$
Definition (Acceptance):
A word $ w$ is accepted by a PDA $ M$ iff $ (q_0,w,Z_0)\vdash_M^*(p,\epsilon,Z_0)$ where $ p\in F$ .
An alternative definition is acceptance by empty stack: a PDA accepts a word when its stack becomes empty. This definition no longer requires the concept of final state. In this lecture, we shall not rely on acceptance by empty stack.
Consider $ L=\{ ww^R \mid w\in\{a,b\}^*\}$ where $ w^R$ denotes the reversal of word $ w$ .
The PDA has two states $ q_0,q_1$ and the latter is a final (accepting) state. The input alphabet is $ \{a,b\}$ , however, the stack alphabet is $ \{X,Y,Z_0\}$ . The PDA transitions are illustrated below:
Current state | Input | Stack top | Next state | Stack op |
---|---|---|---|---|
$ q_0$ | $ a$ | $ \epsilon$ | $ q_0$ | $ X$ |
$ q_0$ | $ b$ | $ \epsilon$ | $ q_0$ | $ Y$ |
$ q_0$ | $ a$ | $ X$ | $ q_1$ | $ \epsilon$ |
$ q_0$ | $ b$ | $ Y$ | $ q_1$ | $ \epsilon$ |
$ q_1$ | $ a$ | $ X$ | $ q_1$ | $ \epsilon$ |
$ q_1$ | $ b$ | $ Y$ | $ q_1$ | $ \epsilon$ |
Key ideas: