Formal Languages and Automata Theory Géza Horváth, Benedek Nagy Szerzői Jog © 2014 Géza Horváth, Benedek Nagy, University of Debrecen
Total Page:16
File Type:pdf, Size:1020Kb
Formal Languages and Automata Theory Géza Horváth, Benedek Nagy Created by XMLmind XSL-FO Converter. Formal Languages and Automata Theory Géza Horváth, Benedek Nagy Szerzői jog © 2014 Géza Horváth, Benedek Nagy, University of Debrecen Created by XMLmind XSL-FO Converter. Tartalom Formal Languages and Automata Theory .......................................................................................... vi Introduction ...................................................................................................................................... vii 1. Elements of Formal Languages ...................................................................................................... 1 1. 1.1. Basic Terms .................................................................................................................... 1 2. 1.2. Formal Systems .............................................................................................................. 2 3. 1.3. Generative Grammars .................................................................................................... 5 4. 1.4. Chomsky Hierarchy ....................................................................................................... 6 2. Regular Languages and Finite Automata ...................................................................................... 12 1. 2.1. Regular Grammars ....................................................................................................... 12 2. 2.2. Regular Expressions ..................................................................................................... 16 3. 2.3. Finite Automata as Language Recognizers .................................................................. 19 3.1. 2.3.1. Synthesis and Analysis of Finite Automata .................................................. 27 3.2. 2.3.2. The Word Problem ....................................................................................... 31 4. 2.4. Properties of Regular Languages ................................................................................. 33 4.1. 2.4.1. Closure Properties ......................................................................................... 33 4.2. 2.4.2. Myhill-Nerode theorem ................................................................................ 35 5. 2.5. Finite Transducers ........................................................................................................ 36 5.1. 2.5.1. Mealy Automata ........................................................................................... 36 5.2. 2.5.2. Moore Automata ........................................................................................... 39 5.3. 2.5.3. Automata Mappings ...................................................................................... 42 3. Linear Languages ......................................................................................................................... 44 1. 3.1. Linear Grammars ......................................................................................................... 44 2. 3.2. One-Turn Pushdown Automata .................................................................................... 49 3. 3.3. Closure Properties ........................................................................................................ 49 4. Context-free Languages ................................................................................................................ 51 1. 4.1. Notation Techniques for Programming Languages ...................................................... 51 1.1. 4.1.1. Backus-Naur Form ........................................................................................ 51 1.2. 4.1.2. Syntax Diagram ............................................................................................ 51 2. 4.2. Chomsky Normal Form ................................................................................................ 52 3. 4.3. Pumping Lemma for Context-free Languages ............................................................. 56 4. 4.4. Closure Properties ........................................................................................................ 57 5. 4.5. Parsing .......................................................................................................................... 58 5.1. 4.5.1. The CYK Algorithm ..................................................................................... 58 5.2. 4.5.2. The Earley Algorithm ................................................................................... 60 5.2.1. Earley Algorithm ........................................................................................ 60 6. 4.6. Pushdown Automata .................................................................................................... 62 6.1. 4.6.1. Acceptance by Empty Stack ......................................................................... 64 6.2. 4.6.2. Equivalence of PDAs and Context-free Grammars ...................................... 67 6.3. 4.6.3. Deterministic PDA ........................................................................................ 68 6.4. 4.6.4. One-turn Pushdown Automata ...................................................................... 68 5. Context-Sensitive Languages ....................................................................................................... 71 1. 5.1. Context-Sensitive and Monotone Grammars ............................................................... 71 1.1. 5.1.1. Normal Forms ............................................................................................... 72 2. 5.2. Linear Bounded automata ............................................................................................ 77 3. 5.3. Properties of Context-Sensitive Languages .................................................................. 78 3.1. 5.3.1. Closure Properties ......................................................................................... 78 3.2. 5.3.2. About the Word Problem .............................................................................. 80 6. Recursively Enumerable Languages and Turing Machines .......................................................... 82 1. 6.1. Recursive and Recursively Enumerable Languages ..................................................... 82 1.1. 6.1.1. Closure Properties ......................................................................................... 83 1.2. 6.1.2. Normal Forms ............................................................................................... 84 2. 6.2. Turing Machine, the Universal Language Acceptor .................................................... 86 2.1. 6.2.1. Equivalent Definitions .................................................................................. 88 3. 6.3. Turing Machine, the Universal Computing Device ...................................................... 89 4. 6.4. Linear Bounded Automata ........................................................................................... 91 7. Literature ...................................................................................................................................... 94 iii Created by XMLmind XSL-FO Converter. Az ábrák listája 2.1. In derivations the rules with long right hand side are replaced by chains of shorter rules, resulting binary derivation trees in the new grammar. .................................................................................... 13 2.2. The graph of the automaton of Example 21. .............................................................................. 21 2.3. The graph of the automaton of Exercise 19. .............................................................................. 26 2.4. The graph of the automaton of Exercise 22. .............................................................................. 26 2.5. The graph of the automaton of Exercise 25. .............................................................................. 27 2.6. The graph of the automaton of Example 26. .............................................................................. 28 2.7. The equivalence of the three types of descriptions (type-3 grammars, regular expressions and finite automata) of the regular languages. .................................................................................................. 30 2.8. The graph of the automaton of Exercise 31. .............................................................................. 31 2.9. The graph of the automaton of Exercise 32. .............................................................................. 32 2.10. The graph of the automaton of Exercise 37. ............................................................................ 35 2.11. The graph of the Mealy automaton of Example 30. ................................................................ 36 2.12. The graph of the Mealy automaton of Exercise 42. ................................................................. 39 2.13. The graph of the Mealy automaton of Exercise 33. ................................................................. 39 2.14. The graph of the Mealy automaton of Exercise 46. ................................................................. 42 3.1. In derivations the rules with long right hand side (left) are replaced by chains of shorter rules in two steps, causing a binary derivation tree in the resulting grammar (right). .........................................