Preface |
|
xi | |
|
|
1 | (392) |
|
1 Introduction to the Theory of Computation |
|
|
3 | (36) |
|
1.1 Mathematical Preliminaries and Notation |
|
|
5 | (14) |
|
|
5 | (3) |
|
|
8 | (2) |
|
|
10 | (1) |
|
|
11 | (8) |
|
|
19 | (13) |
|
|
19 | (3) |
|
|
22 | (6) |
|
|
28 | (4) |
|
|
32 | (7) |
|
|
39 | (38) |
|
2.1 Deterministic Finite Accepters |
|
|
40 | (13) |
|
Deterministic Accepters and Transition Graphs |
|
|
41 | (2) |
|
|
43 | (5) |
|
|
48 | (5) |
|
2.2 Nondeterministic Finite Accepters |
|
|
53 | (8) |
|
Definition of a Nondeterministic Accepter |
|
|
54 | (4) |
|
|
58 | (3) |
|
2.3 Equivalence of Deterministic and Nondeterministic Finite Accepters |
|
|
61 | (8) |
|
2.4 Reduction of the Number of States in Finite Automata* |
|
|
69 | (8) |
|
3 Regular Languages and Regular Grammars |
|
|
77 | (30) |
|
|
78 | (6) |
|
Formal Definition of a Regular Expression |
|
|
78 | (1) |
|
Languages Associated with Regular Expressions |
|
|
79 | (5) |
|
3.2 Connection Between Regular Expressions and Regular Languages |
|
|
84 | (13) |
|
Regular Expressions Denote Regular Languages |
|
|
84 | (3) |
|
Regular Expressions for Regular Languages |
|
|
87 | (6) |
|
Regular Expressions for Describing Simple Patterns |
|
|
93 | (4) |
|
|
97 | (10) |
|
Right- and Left-Linear Grammars |
|
|
97 | (2) |
|
Right-Linear Grammars Generate Regular Languages |
|
|
99 | (2) |
|
Right-Linear Grammars for Regular Languages |
|
|
101 | (2) |
|
Equivalence of Regular Languages and Regular Grammars |
|
|
103 | (4) |
|
4 Properties of Regular Languages |
|
|
107 | (30) |
|
4.1 Closure Properties of Regular Languages |
|
|
108 | (12) |
|
Closure under Simple Set Operations |
|
|
108 | (3) |
|
Closure under Other Operations |
|
|
111 | (9) |
|
4.2 Elementary Questions about Regular Languages |
|
|
120 | (3) |
|
4.3 Identifying Nonregular Languages |
|
|
123 | (14) |
|
Using the Pigeonhole Principle |
|
|
124 | (1) |
|
|
125 | (12) |
|
|
137 | (28) |
|
5.1 Context-Free Grammars |
|
|
138 | (11) |
|
Examples of Context-Free Languages |
|
|
139 | (2) |
|
Leftmost and Rightmost Derivations |
|
|
141 | (1) |
|
|
142 | (3) |
|
Relation Between Sentential Forms and Derivation Trees |
|
|
145 | (4) |
|
5.2 Parsing and Ambiguity |
|
|
149 | (11) |
|
|
149 | (5) |
|
Ambiguity in Grammars and Languages |
|
|
154 | (6) |
|
5.3 Context-Free Grammars and Programming Languages |
|
|
160 | (5) |
|
6 Simplification of Context-Free Grammars and Normal Forms |
|
|
165 | (28) |
|
6.1 Methods for Transforming Grammars |
|
|
166 | (16) |
|
A Useful Substitution Rule |
|
|
167 | (2) |
|
Removing Useless Productions |
|
|
169 | (4) |
|
|
173 | (2) |
|
Removing Unit-Productions |
|
|
175 | (7) |
|
6.2 Two Important Normal Forms |
|
|
182 | (7) |
|
|
182 | (3) |
|
|
185 | (4) |
|
6.3 A Membership Algorithm for Context-Free Grammars* |
|
|
189 | (4) |
|
|
193 | (34) |
|
7.1 Nondeterministic Pushdown Automata |
|
|
194 | (10) |
|
Definition of a Pushdown Automaton |
|
|
195 | (3) |
|
The Language Accepted by a Pushdown Automaton |
|
|
198 | (6) |
|
7.2 Pushdown Automata and Context-Free Languages |
|
|
204 | (12) |
|
Pushdown Automata for Context-Free Languages |
|
|
204 | (5) |
|
Context-Free Grammars for Pushdown Automata |
|
|
209 | (7) |
|
7.3 Deterministic Pushdown Automata and Deterministic Context-Free Languages |
|
|
216 | (5) |
|
7.4 Grammars for Deterministic Context-Free Languages* |
|
|
221 | (6) |
|
8 Properties of Context-Free Languages |
|
|
227 | (20) |
|
|
228 | (9) |
|
A Pumping Lemma for Context-Free Languages |
|
|
228 | (5) |
|
A Pumping Lemma for Linear Languages |
|
|
233 | (4) |
|
8.2 Closure Properties and Decision Algorithms for Context-Free Languages |
|
|
237 | (10) |
|
Closure of Context-Free Languages |
|
|
238 | (4) |
|
Some Decidable Properties of Context-Free Languages |
|
|
242 | (5) |
|
|
247 | (28) |
|
9.1 The Standard Turing Machine |
|
|
248 | (18) |
|
Definition of a Turing Machine |
|
|
248 | (7) |
|
Turing Machines as Language Accepters |
|
|
255 | (3) |
|
Turing Machines as Transducers |
|
|
258 | (8) |
|
9.2 Combining Turing Machines for Complicated Tasks |
|
|
266 | (5) |
|
|
271 | (4) |
|
10 Other Models of Turing Machines |
|
|
275 | (26) |
|
10.1 Minor Variations on the Turing Machine Theme |
|
|
276 | (8) |
|
Equivalence of Classes of Automata |
|
|
276 | (1) |
|
Turing Machines with a Stay-Option |
|
|
277 | (2) |
|
Turing Machines with Semi-Infinite Tape |
|
|
279 | (2) |
|
The Off-Line Turing Machine |
|
|
281 | (3) |
|
10.2 Turing Machines with More Complex Storage |
|
|
284 | (5) |
|
Multitape Turing Machines |
|
|
284 | (3) |
|
Multidimensional Turing Machines |
|
|
287 | (2) |
|
10.3 Nondeterministic Turing Machines |
|
|
289 | (3) |
|
10.4 A Universal Turing Machine |
|
|
292 | (5) |
|
10.5 Linear Bounded Automata |
|
|
297 | (4) |
|
11 A Hierarchy of Formal Languages and Automata |
|
|
301 | (24) |
|
11.1 Recursive and Recursively Enumerable Languages |
|
|
302 | (7) |
|
Languages That Are Not Recursively Enumerable |
|
|
304 | (1) |
|
A Language That Is Not Recursively Enumerable |
|
|
305 | (2) |
|
A Language That Is Recursively Enumerable but Not Recursive |
|
|
307 | (2) |
|
11.2 Unrestricted Grammars |
|
|
309 | (6) |
|
11.3 Context-Sensitive Grammars and Languages |
|
|
315 | (6) |
|
Context-Sensitive Languages and Linear Bounded Automata |
|
|
316 | (2) |
|
Relation Between Recursive and Context-Sensitive Languages |
|
|
318 | (3) |
|
11.4 The Chomsky Hierarchy |
|
|
321 | (4) |
|
12 Limits of Algorithmic Computation |
|
|
325 | (26) |
|
12.1 Some Problems That Cannot Be Solved by Turing Machines |
|
|
326 | (9) |
|
Computability and Decidability |
|
|
326 | (1) |
|
The Turing Machine Halting Problem |
|
|
327 | (4) |
|
Reducing One Undecidable Problem to Another |
|
|
331 | (4) |
|
12.2 Undecidable Problems for Recursively Enumerable Languages |
|
|
335 | (4) |
|
12.3 The Post Correspondence Problem |
|
|
339 | (6) |
|
12.4 Undecidable Problems for Context-Free Languages |
|
|
345 | (3) |
|
12.5 A Question of Efficiency |
|
|
348 | (3) |
|
13 Other Models of Computation |
|
|
351 | (20) |
|
|
353 | (9) |
|
Primitive Recursive Functions |
|
|
354 | (4) |
|
|
358 | (1) |
|
|
359 | (3) |
|
|
362 | (4) |
|
|
366 | (5) |
|
|
366 | (1) |
|
|
367 | (2) |
|
|
369 | (2) |
|
14 An Overview of Computational Complexity |
|
|
371 | (22) |
|
14.1 Efficiency of Computation |
|
|
372 | (2) |
|
14.2 Turing Machine Models and Complexity |
|
|
374 | (4) |
|
14.3 Language Families and Complexity Classes |
|
|
378 | (3) |
|
14.4 The Complexity Classes P and NP |
|
|
381 | (2) |
|
|
383 | (3) |
|
14.6 Polynomial-Time Reduction |
|
|
386 | (3) |
|
14.7 NP-Completeness and an Open Question |
|
|
389 | (4) |
|
|
393 | (106) |
|
|
395 | (28) |
|
|
396 | (8) |
|
15.2 Top-Down vs. Bottom-Up Parsing |
|
|
404 | (5) |
|
|
409 | (7) |
|
|
416 | (7) |
|
|
423 | (18) |
|
16.1 Context-Free Grammar Conversion to Nondeterministic Pushdown Automaton |
|
|
424 | (5) |
|
Pushdown Automata for LL Parsing |
|
|
424 | (1) |
|
Algorithm to Convert Context-Free Grammar to NPDA for LL Parsing |
|
|
424 | (5) |
|
|
429 | (2) |
|
|
429 | (2) |
|
16.3 LL(1) Parsing Algorithm |
|
|
431 | (4) |
|
|
432 | (3) |
|
|
435 | (6) |
|
|
441 | (58) |
|
17.1 Context-Free Grammar Conversion to NPDA |
|
|
443 | (6) |
|
Algorithm to Convert Context-Free Grammar to NPDA for LR Parsing |
|
|
443 | (6) |
|
|
449 | (4) |
|
17.3 DFA Models the LR Parsing Stack |
|
|
453 | (14) |
|
Algorithm to Build DFA Modeling LR Parsing |
|
|
454 | (13) |
|
|
467 | (8) |
|
|
468 | (1) |
|
LR(1) Parse Table Algorithm |
|
|
468 | (7) |
|
17.5 LR{1) Parsing Algorithm |
|
|
475 | (6) |
|
|
476 | (5) |
|
17.6 LR(1) Parsing with A-Productions |
|
|
481 | (11) |
|
17.7 LR(1) Parsing Conflicts |
|
|
492 | (7) |
|
APPENDIX A FINITE-STATE TRANSDUCERS |
|
|
499 | (18) |
|
|
499 | (1) |
|
|
500 | (2) |
|
|
502 | (2) |
|
A.4 Moore and Mealy Machine Equivalence |
|
|
504 | (4) |
|
A.5 Mealy Machine Minimization |
|
|
508 | (5) |
|
A.6 Moore Machine Minimization |
|
|
513 | (1) |
|
A.7 Limitations of Finite-State Transducers |
|
|
514 | (3) |
|
APPENDIX B JFLAP: A USEFUL TOOL |
|
|
517 | (58) |
|
Answers: Solutions and Hints for Selected Exercises |
|
|
519 | (54) |
|
References for Further Reading |
|
|
573 | (2) |
Index |
|
575 | |