Theory of Computation: Making Connections Study Guide and Chapter Summaries – Jim Hefferon (Second Edition) BSCS

BSCS students can use this guide to study “Theory of Computation: Making Connections” (Second Edition) by Jim Hefferon of the University of Vermont. It is written for the Theory of Computation and Theory of Automata courses, and it covers the standard syllabus: Turing machines, computable functions, the Halting problem, languages and grammars, finite automata, regular expressions, pushdown machines, and the complexity classes P and NP.

The order is different from many textbooks. Hefferon starts by asking what can be computed at all, then moves to automata, and finishes with what can be computed efficiently. Each chapter ends with optional Extra sections on topics such as the Game of Life, regexes, RSA and SAT solvers. It works as a main text for a semester course and as a source of clear proofs when you revise for a theory paper.

Book Overview

CourseTheory of Computation / Theory of Automata
Degree ProgramsBSCS
LevelUniversity / Undergraduate
EditionSecond Edition (PDF version 1.99, compiled 26 April 2025)
AuthorJim Hefferon, University of Vermont
Structure5 chapters in 3 parts, 30 sections, 19 Extra sections and 3 appendices
ExercisesExercises at the end of every section; a selection is marked for independent readers, and an answers file is linked from the official page
PrerequisitesIntroduction to programming and Discrete Mathematics; examples use the Racket language
LanguageEnglish
LicenseFree to use. The author’s licence page offers the GNU Free Documentation License or Creative Commons Attribution-ShareAlike 3.0 United States, at your choice
FormatPDF, 448 pages — free from the author’s page

Chapter List

Chapter I: Mechanical Computation

Part 1: Classical Computability · Difficulty: Medium · Key topics: Turing machine, configuration, computable function, Church’s Thesis, primitive recursion, Ackermann function, μ recursion

The book opens by asking what can be computed at all. Section 1 follows Turing’s picture of a clerk with paper and a finite set of states, and turns it into a formal machine made of four-tuple instructions, with configurations, halting, partial functions, deciding and recognizing. Section 2 explains why Church’s Thesis is accepted, what it does not say, and why algorithms may then be described in outline or in Racket code. Sections 3 and 4 give a second route to computability through primitive recursion, show that the Ackermann-style hyperoperation escapes it, and add unbounded minimization to reach general recursive functions. Extras cover a simulator, circuits, the Game of Life and LOOP programs.

Key Points:

  • A Turing machine is a finite set of four-tuple instructions: present state, current symbol, action (write a symbol or move left or right), next state.
  • No two instructions may begin with the same state and symbol, so the machine is deterministic; if no instruction matches, it halts.
  • A configuration is a snapshot of the state, the symbol under the head and the tape on both sides; a computation is a sequence of configurations.
  • A computable function is one computed by some Turing machine and may be partial, meaning it can diverge on some inputs.
  • A machine decides a set if it halts with yes or no on every input; it only recognizes the set if it halts on members and may loop on the rest.
  • Church’s Thesis says that what a discrete, deterministic mechanism can compute is exactly what a Turing machine can compute; it cannot be proved and rests on coverage, convergence, consistency and clarity.
  • Primitive recursive functions start from simple initial functions and use composition and primitive recursion; the Ackermann hyperoperation is computable but not primitive recursive.

Memory Tip: Picture the Turing machine as a clerk with a pencil, an eraser and an endless sheet of paper. The only thing the clerk carries in their head is the current state, and that is exactly what the finite set of states stands for.

Common Mistake: Calling Church’s Thesis a theorem. It links an informal idea (“intuitively mechanically computable”) to a formal one, so it is evidence-backed but cannot be proved.

Important Questions:

  • Why is Church’s Thesis a thesis and not a theorem? One side of it, “intuitively computable”, is not a formal notion, so no mathematical proof is possible; it is supported by coverage, convergence, consistency and clarity.
  • Is every computable function primitive recursive? No. The hyperoperation (and Ackermann’s function) is computable by a mechanical procedure but is not primitive recursive; unbounded minimization is needed to get all computable functions.

Chapter II: Background

Part 1: Classical Computability · Difficulty: Hard · Key topics: countability, Cantor’s pairing function, diagonalization, universal Turing machine, Halting problem, Rice’s Theorem, computably enumerable sets, oracles, fixed point theorem

This chapter proves that some problems have no mechanical solution. It starts with Galileo’s and Aristotle’s paradoxes to build the idea of cardinality, shows with Cantor’s pairing that N times N is countable, and uses diagonalization to show the reals and the set of functions are uncountable, so some functions have no Turing machine. A universal machine and the s-m-n theorem lead to the Halting problem, Rice’s Theorem, computably enumerable sets and dovetailing, oracles with Turing reducibility, and Kleene’s fixed point theorem. Extras cover Hilbert’s Hotel, unsolvability in intellectual culture, self-reproduction, Busy Beaver and Cantor in code.

Key Points:

  • A set is countable if it can be matched one-to-one with the natural numbers; Cantor’s pairing function shows N times N is countable.
  • Diagonalization shows the reals are uncountable, and Cantor’s Theorem says a set always has smaller cardinality than its power set.
  • There are only countably many Turing machines but uncountably many functions from N to N, so uncomputable functions exist.
  • A universal Turing machine takes an index e and an input x and behaves like machine number e on x; the s-m-n theorem lets us fix some inputs in advance.
  • The Halting problem set K is the set of e where machine e halts on input e; no Turing machine decides it.
  • Rice’s Theorem: any property of a program’s behavior that some programs have and others do not is undecidable.
  • A set is computably enumerable if some computable function lists it; K is c.e. but its complement is not, and a set is computable exactly when it and its complement are both c.e.

Memory Tip: Diagonalization in one line: write the list of all rows, walk down the diagonal, change every entry, and the new row cannot be any row in the list.

Common Mistake: Using Rice’s Theorem for a property of the machine’s code, such as “has an instruction starting with state q10”. That is easy to check; Rice’s Theorem is only about what the machine does.

Important Questions:

  • Why is the Halting problem unsolvable? If a machine could decide K, we could build a machine that does the opposite of every machine on its own index, and that machine would differ from every machine on the list, which is a contradiction.
  • What does Rice’s Theorem say? Every index set that is nontrivial, meaning not empty and not all of N, is not computable; in programming terms, no program can decide a non-trivial question about what another program computes.

Chapter III: Languages, Grammars, and Graphs

Part 2: Automata · Difficulty: Easy · Key topics: alphabet, string, language, palindrome, context-free grammar, derivation, ambiguity, BNF, graph, path, isomorphism, graph traversal

This short chapter prepares the vocabulary for the automata chapter. Section 1 defines a language as a set of strings over an alphabet and works through examples such as palindromes and Pythagorean triples. Section 2 introduces grammars as rule sets for forming strings, defines a context-free grammar as a four-tuple of alphabet, nonterminals, start symbol and productions, shows derivations and parse trees, and explains ambiguity using an arithmetic expression grammar. Section 3 reviews simple graphs, paths, matrix representation, colorings and isomorphism, with König’s lemma. The Extras cover BNF notation and depth-first and breadth-first traversal in Racket.

Key Points:

  • An alphabet is a nonempty finite set of symbols, and the set of all strings over it is written Σ*.
  • A language is any subset of Σ*; for example, the palindromes are the strings equal to their own reversal.
  • A context-free grammar is a four-tuple of alphabet, nonterminals, start symbol and production rules, and each rule has a single nonterminal on its left side.
  • A grammar is ambiguous if some string has more than one leftmost derivation; the string a+b*c shows how an expression grammar can be fixed to be unambiguous.
  • A simple graph is a pair of a vertex set and an edge set, and a graph is not its picture: different drawings can show the same graph.
  • König’s lemma: a connected graph with infinitely many vertices, each with finitely many neighbors, has an infinite path.
  • The i,j entry of the n-th power of a graph’s matrix counts the paths of length n from vertex i to vertex j.

Memory Tip: A language is only a set of strings; a grammar is the rulebook that tells you which strings belong to it.

Common Mistake: Treating a drawing as the graph itself. Two pictures with the same vertices and the same edges are the same graph, however differently they are laid out.

Important Questions:

  • What is a context-free grammar? A set of rewriting rules in which each rule replaces a single nonterminal by a string of terminals and nonterminals, together with a start symbol; the book writes it as a four-tuple.
  • When is a grammar ambiguous? When at least one string in its language has two different leftmost derivations, as a+b*c does in the first expression grammar of Section 2.

Chapter IV: Automata

Part 2: Automata · Difficulty: Medium · Key topics: Finite State machine, nondeterminism, powerset construction, regular expressions, Kleene’s theorem, closure properties, Pumping Lemma, pushdown machine, Myhill-Nerode, minimization

Starting from the Turing machine, this chapter removes the ability to write and studies what states alone can do. Section 1 defines Finite State machines with accepting states, and Section 2 introduces nondeterminism, epsilon transitions and the powerset construction showing both kinds accept the same languages. Section 3 defines regular expressions and proves Kleene’s Theorem. Sections 4 and 5 show closure properties and use the Pumping Lemma to prove languages are not regular. Section 6 adds a stack to get pushdown machines. Extras cover regexes in practice, the Myhill-Nerode theorem and Moore’s minimization algorithm.

Key Points:

  • A Finite State machine reads its input without writing, and accepts if it ends in an accepting state; its states are its only memory.
  • Nondeterministic machines, including those with epsilon transitions, accept exactly the languages that deterministic ones do; the powerset construction turns each state into a set of states.
  • Kleene’s Theorem: a language is recognized by a Finite State machine if and only if some regular expression describes it.
  • Regular languages are closed under union, concatenation, Kleene star, intersection, difference and complement.
  • Pumping Lemma: every long enough string in a regular language splits into three parts so that repeating the middle part any number of times stays in the language.
  • A pushdown machine is a Finite State machine plus a stack; nondeterministic ones accept exactly the context-free languages, and deterministic ones are strictly weaker.
  • Myhill-Nerode: a language is regular if and only if it has finitely many classes of indistinguishable strings; Moore’s algorithm uses this idea to minimize a machine.

Memory Tip: The book’s design rule for Finite State machines: let each state mean “this is what I still expect to see”. A state describes the future of the input, not its past.

Common Mistake: Using the Pumping Lemma to show that a language is regular. It only gives a property that every regular language has, so it can prove non-regularity but never regularity.

Important Questions:

  • Why can no Finite State machine recognize balanced parentheses? Nesting can be arbitrarily deep, and a machine with a fixed number of states cannot count that depth; a stack, as in the pushdown machine, solves this.
  • What does Kleene’s Theorem state? Finite State machines and regular expressions describe exactly the same class of languages; one direction builds a machine from an expression and the other eliminates states to get an expression.

Chapter V: Computational Complexity

Part 3: Computational Complexity · Difficulty: Hard · Key topics: Big O, tractable vs intractable, problem miscellany, P, NP, verifier and witness, polytime reduction, NP completeness, Cook-Levin Theorem, EXP, space classes

The last chapter moves from what can be computed to what can be computed efficiently. Section 1 reviews Big O, Theta and limit tests, and the Karatsuba story. Section 2 is a catalogue of well-known problems such as Hamiltonian Circuit, Traveling Salesman, SAT, Vertex Cover, Clique, Knapsack and Primality. Sections 3 and 4 separate problems, algorithms and programs and define P with Cobham’s Thesis. Sections 5 to 7 define NP through nondeterministic machines and polytime verifiers, reductions, the Cook-Levin Theorem, NP completeness and P versus NP. Section 8 looks ahead to EXP and space classes. Extras cover RSA, SAT solvers, and Bounded Halting.

Key Points:

  • Big O ignores constant factors and small inputs; two functions have the same order of growth, written Theta, when each is Big O of the other.
  • P is the class of decision problems solved by a deterministic Turing machine in polynomial time; Cobham’s Thesis treats it as the class of tractable problems.
  • NP is the class decided by a nondeterministic machine in polynomial time, equivalently the languages with a polytime verifier that checks a witness (certificate).
  • P is contained in NP, and nobody knows whether P equals NP; every problem in NP can be solved in exponential time.
  • Language L1 polytime reduces to L0 if a polytime function maps instances of L1 to instances of L0 with the same yes or no answer.
  • Cook-Levin Theorem: SAT is in NP and every problem in NP reduces to it, so SAT is NP complete; 3-SAT, Clique, Vertex Cover and Hamiltonian Circuit follow by reductions.
  • The chapter ends with P ⊆ NP ⊆ EXP, space classes such as L and PSPACE, and Savitch’s Theorem.

Memory Tip: P means fast to solve, NP means fast to check. Think of a jigsaw puzzle: confirming a finished puzzle is mechanical, while finding the arrangement feels creative.

Common Mistake: Reading NP as “not polynomial”. It stands for nondeterministic polynomial time, P sits inside NP, and the open question is whether the two are equal.

Important Questions:

  • What is an NP complete problem? A problem that is in NP and to which every problem in NP polytime reduces; if any one of them had a polytime algorithm then P would equal NP.
  • What does the Cook-Levin Theorem say? The Satisfiability problem (SAT) is NP complete: it is in NP, and any NP language can be translated in polynomial time into a Boolean formula that is satisfiable exactly when the answer is yes.

Appendices: Strings, Functions, Propositional Logic

Appendix · Difficulty: Easy · Key topics: alphabet, string, concatenation, Kleene star, function, domain and codomain, one-to-one, onto, proposition, truth table, DNF and CNF

The three appendices fix the notation the main chapters rely on, so that students without a full discrete mathematics course can still follow. Appendix A defines alphabets and strings, string length, substrings, concatenation, reversal and the Kleene star, and explains the bitstring alphabet. Appendix B treats a function as a set of input-output pairs rather than a rule, with domain, codomain, arity, restriction, partial and total functions, and one-to-one and onto maps. Appendix C covers propositions, the connectives not, and and or, truth tables, De Morgan’s laws, and Disjunctive and Conjunctive Normal Form, which return later in SAT. After them come endnotes with many clickable links and a bibliography.

Key Points:

  • A string is a finite sequence of symbols from an alphabet, the empty string is written ε and has length zero.
  • A symbol can be longer than one letter; for example a programming language can treat if as one indivisible symbol.
  • A function is a set of pairs in which each input appears in exactly one pair; it does not have to be given by a rule.
  • Not, and, and or are enough to express any truth table; Disjunctive Normal Form joins clauses with or and Conjunctive Normal Form joins clauses with and.

Memory Tip: Read Appendix A before Chapter III and Appendix C before the hardware Extra in Chapter I; both take only a few minutes.

Common Mistake: Confusing the empty string with nothing at all. The symbol ε exists so that the empty string can be written and counted as a real string of length zero.

Important Questions:

  • What is the Kleene star of an alphabet? The set of all finite-length strings over that alphabet, including the empty string, written Σ*.
  • When is a relation a function? When every element of the domain appears as the first entry in one and only one pair, which is called being well-defined.

How to Study This Book

The book has five chapters, numbered with Roman numerals I to V, grouped by the author into Part One (Chapters I and II), Part Two (Chapters III and IV) and Part Three (Chapter V). Each chapter is a run of Sections followed by optional Extra sections, and the Extras are not required for the core path. Note the order: the book starts with Turing machines and unsolvability and only reaches Finite State machines in Chapter IV. Many university courses go the other way, so decide which route your syllabus follows before you open Chapter I.

If your course is Theory of Automata, read Appendix A first, then Sections III.1 and III.2 on languages and grammars, and jump straight to Chapter IV. Chapter IV mentions the Turing machine only as the model it started from, so Section I.1 is enough background. Read IV.1 to IV.5 in order, treat IV.6 on pushdown machines as the finish, and pick up Extra IV.B (Myhill-Nerode) and IV.C (minimization) if your teacher covers DFA minimization.

If your course is Theory of Computation, read in the book’s order. Chapter I is the foundation, and Section I.2 is the one to read slowly because it explains how the book justifies working with outlines and Racket code instead of Turing machine tables. In Chapter II, Sections II.1 to II.3 prepare the diagonal argument that Sections II.4 and II.5 reuse for the Halting problem, so do not skip them. Sections II.7 to II.9 on c.e. sets, oracles and the fixed point theorem are the hardest in the book and are often optional.

Chapter V depends on Chapter II and Chapter IV. Reductions in V.6 build on the oracle idea from II.8, and nondeterminism in V.5 builds on IV.2. Read V.1 and V.2 first for Big O and the problem catalogue, then V.4 to V.7 in order, because P, NP, reductions and NP completeness each use the one before. Section V.8 is a short look forward, and the four Extras (RSA, good-enoughness, SAT solvers and Bounded Halting) are good one-day readings.

Prerequisites are stated honestly in the preface: an introduction to programming and Discrete Mathematics, including propositional logic, induction, graphs, basic number theory, sets, functions and relations. Section V.1 on Big O uses derivatives. Algorithms and examples appear in the Racket language, so you will read Racket code even if you have never written any; a short Racket tutorial is enough. The preface says a selection of exercises is marked with a check for independent readers, and the official page offers an answers-to-exercises file.

What the book does not cover is also worth knowing. It states, without proof, that nondeterministic pushdown machines accept exactly the context-free languages, and it does not give a pumping lemma for context-free languages, Chomsky normal form or parsing algorithms. If your syllabus lists those topics, pair this book with lecture notes or a second text.


Used In These Programs

This book is used for the Theory of Automata and Theory of Computation courses in: BS Computer Science. Browse all Theory of Computation books or all Computer Science books.

Who Should Read This

This book is written for BSCS students taking Theory of Computation, Theory of Automata or Formal Languages, usually in the middle or later semesters after Discrete Mathematics and a programming course. It suits students who want to understand why results such as the Halting problem and NP completeness are true, since the proofs are laid out in full with worked examples and a lot of motivation. It is also a good fit for self-learners who want to see where the theory shows up in practice, because the Extras explore regexes, RSA and SAT solvers. It is not the right choice if you need a compact exam-guide list of constructions, or topics such as context-free parsing and context-free pumping lemmas, which the book mentions only briefly. To strengthen the Discrete Mathematics background the preface asks for, read Discrete Mathematics: An Open Introduction, and for the algorithm side of Chapter V see Algorithms (DPV).


Applicable Universities

This book is useful for students at Pakistani universities offering BS Computer Science with a Theory of Automata or Theory of Computation course, including Punjab University, Virtual University, COMSATS, FAST, UET, NUST, and other HEC-recognized institutions.

Official Copy of Theory of Computation: Making Connections

Jim Hefferon offers the complete Second Edition as a free PDF on his own page, together with an answers-to-exercises file. Click below to open the official page and download the PDF.

→ Visit Official Page

FAQs

Is Theory of Computation: Making Connections free?

Yes. The preface says that the book is Free and can be downloaded and used without cost, and teachers may post it on their course site. The author’s licence page lets you use the material under either the GNU Free Documentation License or the Creative Commons Attribution-ShareAlike 3.0 United States License. The PDF itself does not print a licence version, so use the official page for the download.

Which edition is this?

This is the Second Edition. The title page says Second edition, the preface is signed Version 1.99 dated 17 March 2025, and the PDF was compiled on 26 April 2025. The author’s page describes the book as ready to be used and keeps its source in a public repository, so it is a current and maintained text.

How many chapters and exercises does it have?

There are five chapters numbered I to V, split into 30 main sections and 19 Extra sections, plus three appendices on strings, functions and propositional logic. The PDF runs to 448 pages including notes and bibliography. Every section ends with exercises, and a selection is marked for readers studying alone.

Is it good for complete beginners?

It is aimed at undergraduates who have finished an introduction to programming and a Discrete Mathematics course, because proofs use induction, sets, functions and graphs. The writing is friendly and the appendices refresh strings, functions and logic. The Big O section needs derivatives, and algorithms are shown in Racket, so expect to learn a little of that language.

Does it cover finite automata, regular expressions, Turing machines and NP completeness?

Yes. Chapter I defines Turing machines and computable functions, Chapter II covers the Halting problem and Rice’s Theorem, Chapter IV covers Finite State machines, nondeterminism, regular expressions, the Pumping Lemma and pushdown machines, and Chapter V covers P, NP, reductions and the Cook-Levin Theorem. It states without proof that pushdown machines match context-free grammars, and it does not teach Chomsky normal form or parsing algorithms.

Can I use it for a Theory of Automata course that starts with finite automata?

Yes. Read Appendix A, then Sections III.1 and III.2 on languages and grammars, and go straight to Chapter IV. The book itself starts with Turing machines, so Chapters I and II are not needed first, but they are worth reading afterwards if your course goes on to computability.

Related Books

Theory of Computation: Making Connections takes you from Turing machines to NP completeness in one free, carefully argued book. Browse more Computer Science books for the rest of your semester.

Theory of Computation: Making Connections (Second Edition, PDF version 1.99, compiled 26 April 2025) by Jim Hefferon, University of Vermont. The author’s licence page (hefferon.net/source.html) states that the material may be used under the GNU Free Documentation License or the Creative Commons Attribution-ShareAlike 3.0 United States License, at your discretion; the PDF itself says only that the book is Free. Official source: https://hefferon.net/computation/. This page links to the official site and does not host or copy the book.

Leave a Comment