Introduction 1
1 Sets,Relations,and Languages 5
1.1 Sets 5
1.2 Relations and functions 9
1.3 Special types of binary relations 13
1.4 Finite and infinite sets 20
1.5 Three fundamental proof techniques 23
1.6 Closures and algorithms 30
1.7 Alphabets and languages 42
1.8 Finite representations of languages 47
References 52
2 Finite Automata 55
2.1 Deterministic finite automata 55
2.2 Nondeterministic finite automata 63
2.3 Finite automata and regular expressions 75
2.4 Languages that are and are not regular 86
2.5 State minimization 92
2.6 Algorithmic aspects of finite automata 102
References 110
3 Context-free Languages 113
3.1 Context-free grammars 113
3.2 Parse trees 122
3.3 Pushdown automata 130
3.4 Pushdown automata and context-free grammars 136
3.5 Languages that are and are not context-free 143
3.6 Algorithms for context-free grammars 150
3.7 Determinism and parsing 158
References 175
4.1 The definition of a Turing machine 179
4 Turing machines 179
4.2 Computing with Turing machines 194
4.3 Extensions of Turing machines 200
4.4 Random access Turing machines 210
4.5 Nondeterministic Turing machines 221
4.6 Grammars 227
4.7 Numerical functions 233
References 243
5 Undecidability 245
5.1 The Church-Turing thesis 245
5.2 Universal Turing machines 247
5.3 The halting problem 251
5.4 Unsolvable problems about Turing machines 254
5.5 Unsolvable problems about grammars 258
5.6 An unsolvable tiling problem 262
5.7 Properties of recursive languages 267
References 272
6 Computational Complexity 275
6.1 The class P 275
6.2 Problems,problems... 278
6.3 Boolean satisfiability 288
6.4 The class NP 292
References 299
7 NP-completeness 301
7.1 Polynomial-time reductions 301
7.2 Cook's Theorem 309
7.3 More NP-complete problems 317
7.4 Coping with NP-completeness 333
References 350
Index 353