A topic in the Open Knowledge Graph — a free, open map of 15,290 topics and the order to learn them in.

Pushdown Automata

College Depth 83 in the knowledge graph ☐ I know this ☆ Set as goal
173topics build on this
468prerequisites beneath it
See this on the map →
Nondeterministic Finite Automata→→Context-Free GrammarsLinear Bounded Automata
automata context-free-languages stack

Core Idea

A pushdown automaton (PDA) extends a finite automaton with an unbounded stack, enabling it to recognize context-free languages such as {an bn}. Transitions can push symbols onto or pop symbols from the stack, giving the machine a form of unbounded memory organized in last-in-first-out order. Nondeterministic PDAs (NPDAs) recognize exactly the context-free languages, but deterministic PDAs (DPDAs) recognize a strictly smaller class. Acceptance can be defined by final state or by empty stack; the two modes are equivalent for nondeterministic PDAs.

How It's Best Learned

Build a PDA for {an bn} by pushing a marker for each 'a' and popping for each 'b', then extend to more complex languages like balanced parentheses or {wwR}. Compare the DPDA and NPDA for specific languages to see where determinism falls short — e.g., palindromes require nondeterminism to guess the midpoint.

Common Misconceptions

Explainer

You already know that a nondeterministic finite automaton (NFA) processes input using only a finite internal state — its memory is exactly the state it is currently in. That severe restriction means NFAs cannot count: they cannot recognize {an bn} because they would need to remember the exact count of a's seen, which requires unbounded storage. A pushdown automaton (PDA) solves this by attaching an unbounded stack to a finite automaton. The stack gives the machine a memory that can grow without limit, but with one strict constraint: you can only push and pop at the top. This last-in-first-out discipline is precisely the right structure for counting matching pairs, parentheses, or nested structures.

The canonical example is {an bn | n ≥ 0}. The PDA pushes a marker onto the stack for every 'a' it reads, then pops one marker for every 'b'. If the stack is empty exactly when the input ends, the string is accepted. This is impossible for any NFA or DFA, but trivial for a PDA. The stack's power generalizes naturally: balanced parentheses, {wwR} (palindromes), and the syntax of most programming languages are all context-free and recognizable by PDAs. Indeed, nondeterministic PDAs recognize exactly the context-free languages — the correspondence between PDAs and context-free grammars is the central theorem of this topic.

Nondeterminism plays a bigger role for PDAs than it does for finite automata. For DFAs and NFAs, you learned that nondeterminism does not add power — every NFA has an equivalent DFA. For PDAs, determinism strictly reduces power. The language {wwR} requires a PDA to guess where the midpoint of the palindrome is, which it can do nondeterministically but not deterministically. Deterministic PDAs (DPDAs) define a proper subclass — the deterministic context-free languages — which includes most practical programming language grammars but excludes inherently ambiguous or center-guess-required languages.

Acceptance in a PDA can be defined in two ways: by final state (the machine enters an accepting state after consuming the full input) or by empty stack (the machine empties its stack after consuming the full input). For nondeterministic PDAs, these two modes are equivalent — any language accepted one way can be accepted the other. This equivalence does not hold for deterministic PDAs, which is another asymmetry compared to finite automata. Understanding which acceptance mode you are using matters when constructing PDAs or proving correctness, so always check the definition in use.

Practice Questions 5 questions

Prerequisite Chain

Understanding Zero → The Number Zero → Counting to Five → Counting to 10 → Counting to 20 → Counting a Set of Objects Up to 20 → Cardinality: The Last Number Counted → Matching Numerals to Quantities → Subitizing Small Quantities → Addition Within 10 → Number Bonds to 10 → Addition Within 20 → Doubles and Near Doubles → Doubles Facts Within 10 → Near Doubles Facts Within 20 → Mental Math Strategies for Addition → Mental Math: Adding and Subtracting Tens → Addition Within 100 → Repeated Addition as Multiplication → Multiplication as Equal Groups → Multiplication: Arrays → Basic Multiplication Facts (0s, 1s, 2s, 5s, 10s) → Multiplication Facts Within 100 → Division as Equal Sharing → Division as Grouping (Measurement Division) → Division: Grouping (Repeated Subtraction) Model → Division: Fair Sharing Model → Division as Equal Sharing → Division as Grouping → Basic Division Facts → Division Facts Within 100 → Multiplication and Division Fact Families → Relationship Between Multiplication and Division → Division Facts as Inverse of Multiplication → Remainders and Quotients in Division → Division Word Problems → Multi-Step Word Problems → Solving Multi-Step Word Problems → Multiplication Word Problems → Division Word Problems → Introduction to Long Division → Factors and Multiples → Prime and Composite Numbers → Equivalent Fractions → Relating Fractions and Decimals → Decimal Place Value → Integers and the Number Line → Comparing and Ordering Integers → Absolute Value → Adding Integers → Subtracting Integers → Multiplying Integers → Dividing Integers → Unit Rates → Proportions → Percent Concept → Converting Between Fractions, Decimals, and Percents → Operations with Rational Numbers → Two-Step Equations → Solving Multi-Step Equations → Equations with Variables on Both Sides → Literal Equations → Slope-Intercept Form → Point-Slope Form → Writing Linear Equations → Parallel and Perpendicular Line Slopes → Graphing Linear Equations → Piecewise Functions → Step Functions → Composition of Functions → Inverse Functions → Radical Functions and Graphs → Rational Exponents → Exponential Functions and Graphs → Logarithms Introduction → Big-O Notation and Asymptotic Analysis → Breadth-First Search (BFS) → Shortest Paths in Unweighted Graphs → Dijkstra's Shortest Path Algorithm → Algorithm Analysis and Big-O Notation → Turing Machines → Deterministic Finite Automata → Nondeterministic Finite Automata → Pushdown Automata

Longest path: 84 steps · 468 total prerequisite topics

Prerequisites (1)

Leads To (2)