- Automata Theory Tutorial
- Automata Theory - Home
- Automata Theory Introduction
- Deterministic Finite Automaton
- Non-deterministic Finite Automaton
- NDFA to DFA Conversion
- DFA Minimization
- Moore & Mealy Machines

- Classification of Grammars
- Introduction to Grammars
- Language Generated by Grammars
- Chomsky Grammar Classification

- Regular Grammar
- Regular Expressions
- Regular Sets
- Arden's Theorem
- Constructing FA from RE
- Pumping Lemma for Regular Grammar
- DFA Complement

- Context-Free Grammars
- Context-Free Grammar Introduction
- Ambiguity in Grammar
- CFL Closure Properties
- CFG Simplification
- Chomsky Normal Form
- Greibach Normal Form
- Pumping Lemma for CFG

- Pushdown Automata
- Pushdown Automata Introduction
- Pushdown Automata Acceptance
- PDA & Context Free Grammar
- PDA & Parsing

- Turing Machine
- Turing Machine Introduction
- Accepted & Decided Language
- Multi-tape Turing Machine
- Multi-Track Turing Machine
- Non-Deterministic Turing Machine
- Semi-Infinite Tape Turing Machine
- Linear Bounded Automata

- Decidability
- Language Decidability
- Undecidable Language
- Turing Machine Halting Problem
- Rice Theorem
- Post Correspondence Problem

- Automata Theory Useful Resources
- Automata Theory - Quick Guide
- Automata Theory - Useful Resources
- Automata Theory - Discussion

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Pushdown Automata Acceptance

There are two different ways to define PDA acceptability.

## Final State Acceptability

In final state acceptability, a PDA accepts a string when, after reading the entire string, the PDA is in a final state. From the starting state, we can make moves that end up in a final state with any stack values. The stack values are irrelevant as long as we end up in a final state.

For a PDA (Q, ∑, S, δ, q_{0}, I, F), the language accepted by the set of final states F is −

L(PDA) = {w | (q_{0}, w, I) ⊢* (q, ε, x), q ∈ F}

for any input stack string **x**.

## Empty Stack Acceptability

Here a PDA accepts a string when, after reading the entire string, the PDA has emptied its stack.

For a PDA (Q, ∑, S, δ, q_{0}, I, F), the language accepted by the empty stack is −

L(PDA) = {w | (q_{0}, w, I) ⊢* (q, ε, ε), q ∈ Q}

### Example

Construct a PDA that accepts **L = {0 ^{n} 1^{n} | n ≥ 0}**

### Solution

This language accepts L = {ε, 01, 0011, 000111, ............................. }

Here, in this example, the number of **‘a’** and **‘b’** have to be same.

Initially we put a special symbol

**‘$’**into the empty stack.Then at state

**q**, if we encounter input 0 and top is Null, we push 0 into stack. This may iterate. And if we encounter input 1 and top is 0, we pop this 0._{2}Then at state

**q**, if we encounter input 1 and top is 0, we pop this 0. This may also iterate. And if we encounter input 1 and top is 0, we pop the top element._{3}If the special symbol ‘$’ is encountered at top of the stack, it is popped out and it finally goes to the accepting state q

_{4}.

### Example

Construct a PDA that accepts L = { ww^{R} | w = (a+b)* }

**Solution**

Initially we put a special symbol ‘$’ into the empty stack. At state **q _{2}**, the

**w**is being read. In state

**q**, each 0 or 1 is popped when it matches the input. If any other input is given, the PDA will go to a dead state. When we reach that special symbol ‘$’, we go to the accepting state

_{3}**q**.

_{4}