automaten und formale sprachen
play

Automaten und formale Sprachen Notizen zu den Folien Contents 1 - PDF document

Automaten und formale Sprachen Notizen zu den Folien Contents 1 Mathematical foundation and formal proofs 2 Venn diagrams (slide 29) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Examples to set operations (slide


  1. Automaten und formale Sprachen Notizen zu den Folien Contents 1 Mathematical foundation and formal proofs 2 Venn diagrams (slide 29) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Examples to set operations (slide 30) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Examples to the power set (slide 31) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Examples to the cross product (slide 33) . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Examples to the properties of relations (slides 35 and 37) . . . . . . . . . . . . . . . . . 3 Examples to functions (slide 38) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Truth and validity (slide 40) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Example of a proof (slide 47) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Example of a counter example (Slide 48) . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Example of a proof about sets (slide 51) . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Example of a proof by contradiction (slide 52) . . . . . . . . . . . . . . . . . . . . . . . . 6 Example of a proof by induction (slide 54) . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2 Languages and grammars 7 Example derivation in a grammar (slide 67) . . . . . . . . . . . . . . . . . . . . . . . . . 7 Comment on Chomsky Hierarchy for Grammars (Slide 78) . . . . . . . . . . . . . . . . . 7 Classifying grammars according to the Chomsky-Hierarchy (slides 78, 79 and 82) . . . . 7 Comment on Chomsky Hierarchy for Languages (Slide 82) . . . . . . . . . . . . . . . . . 8 Word Problem Algorithmus for Type-1-Grammars (slide 86) . . . . . . . . . . . . . . . . 9 3 Finite Automata 9 Transition function of DFAs (slides 92 and 93) . . . . . . . . . . . . . . . . . . . . . . . 9 Solution to exercises of slide 95 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 DFA → regular grammar (slide 96) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Transition function of NFAs (slides 100 and 101) . . . . . . . . . . . . . . . . . . . . . . 11 NFA Example (slide 103) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Subset construction (slide 106) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Regular grammar → NFA (slide 110) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 4 Regular Expressions 14 Precedence of the operations (slide 115) . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Examples of regular expressions (slide 117) . . . . . . . . . . . . . . . . . . . . . . . . . 14 Regular expression → NFA (slides 120–126) . . . . . . . . . . . . . . . . . . . . . . . . . 15 NFA → regular expression (slides 128–136) . . . . . . . . . . . . . . . . . . . . . . . . . 16 5 The Pumping Lemma 18 Pigeon Hole Principle (slide 144) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Pumping Lemma (slides 148 and 150) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Pumping Lemma examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 6 Minimal automata and Myhill-Nerode aquivalence 20 Equivalence classes (slides 155–159) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 Acceptance equivalence example (slide 160) . . . . . . . . . . . . . . . . . . . . . . . . . 21 Acceptance equivalence and Myhill–Nerode equivalence (slide 163) . . . . . . . . . . . . 22 Examples for Myhill-Nerode equivalence (slides 164, 168) . . . . . . . . . . . . . . . . . 22 Proving Non-Regularity with the Theorem of Myhill–Nerode (slide 170) . . . . . . . . . 23 1

  2. 7 Closure Properties and Decision Procedures 24 Construction of the Complement Automaton (slide 185) . . . . . . . . . . . . . . . . . . 24 Example Cross Product Construction (slide 188) . . . . . . . . . . . . . . . . . . . . . . 24 8 Program verification: Mutual Exclusion 25 Mutual Exclusion: First Attempt (slide 211) . . . . . . . . . . . . . . . . . . . . . . . . 25 Attempt 1: Test with Grail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 Attempt 2: Test with Grail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 9 Recapitulation of Regular Languages 26 Recapitulation: Three proofs of non-regularity . . . . . . . . . . . . . . . . . . . . . . . 26 10 Context Free Grammars 27 Examples for Context Free Languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Removing ǫ -productions (slides 229 and 230) . . . . . . . . . . . . . . . . . . . . . . . . 28 Ambiguous Grammar (slide 237) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Examples for Chomsky -Normal Form (slides 239–244) . . . . . . . . . . . . . . . . . . . 29 11 The CYK Algorithm 32 Notation example (slides 251/252) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 CYK Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 12 The Pumping Lemma for Context Free Languages 33 Example for the Pumping Mechanism (slide 264) . . . . . . . . . . . . . . . . . . . . . . 33 Pumping Lemma Examples (slide 269) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 13 Kellerautomaten 36 Why an Automaton Model for Context Free Languages? (slide 270) . . . . . . . . . . . 36 To slide 271 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Meaning of the Transition Function of a Push-Down Automaton (slides 277–278) . . . . 36 Notation of the Transition Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 Push-Down Automaton Example 1 (slide 287) . . . . . . . . . . . . . . . . . . . . . . . . 37 To slide 273 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Example Push-Down Automata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 Context Free Grammar → PDA (slide 295/296) . . . . . . . . . . . . . . . . . . . . . . . 41 PDA → Context Free Grammar (slides 298–307) . . . . . . . . . . . . . . . . . . . . . . 42 14 Closure Properties and Algorithms for Context Free Languages 43 Push-Down Automata with Final States (slide 272) . . . . . . . . . . . . . . . . . . . . . 43 Closure Under Union (slide 275) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Closure Under Product (slide 276) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 Closure Under the Star Operation (slide 277) . . . . . . . . . . . . . . . . . . . . . . . . 45 Closure Under Intersection (slide 278) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Example Cross Product Construction NFA/PDA (slide 279,280) . . . . . . . . . . . . . 45 To slide 283 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 15 Generating a Parser with JavaCC 47 EBNF-Form (slides 308–309) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Invoking ANTLR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 2

  3. 1 Mathematical foundation and formal proofs Venn diagrams (slide 29) In the top diagram of slide 29 to sets are shown: A and B . One element of A , which is not an element of B , is explicitly represented. Whether B has elements (and whether there are objects, which are both element of A and of B ) is not explicitly stated. In the second diagram A is a subset of B . Examples to set operations (slide 30) Let A = { 1 , 3 , 5 } und B = { 2 , 3 , 4 } . It holds that A ∪ B = { 1 , 2 , 3 , 4 , 5 } A ∩ B = { 3 } A \ B = { 1 , 5 } B \ A = { 2 , 4 } Examples to the power set (slide 31) � � P ( { a, b } ) = ∅ , { a } , { b } , { a, b } � � P ( { 1 , 2 , 3 } ) = ∅ , { 1 } , { 2 } , { 3 } , { 1 , 2 } , { 1 , 3 } , { 2 , 3 } , { 1 , 2 , 3 } P ( P ( ∅ )) = P ( { ∅ } ) = { ∅ , { ∅ }} Note: for all sets A it is the case, that ∅ ⊆ A and A ⊆ A . That means, that it is always the case, that ∅ ∈ P ( A ) and A ∈ P ( A ). Examples to the cross product (slide 33) { 1 , 3 } × { 2 , 4 } = { (1 , 2) , (1 , 4) , (3 , 2) , (3 , 4) } { a, b, c } × { 1 } = { ( a, 1) , ( b, 1) , ( c, 1) } A × ∅ = ∅ (f¨ ur alle Mengen A ) Examples to the properties of relations (slides 35 and 37) c c c c a a a a (a) (b) (c) (d) b b b b d d d d Relation (a) is reflexive , transitive and symmetric . It is therefore a quasi-order and an equivalence relation . The relation is not anti-symmetric and therefore not an order . Relation (b) is symmetric . (It has none of the other properties.) Relation (c) is transitive and antisymmetric . (It has none of the other properties.) Relation (d) is transitive and antisymmetric . (It has none of the other properties.) More examples for orders and equivalence relations: 3

Recommend


More recommend