c4 1 minimal automata
play

C4.1 Minimal Automata Regular NFAs Languages Automata & - PowerPoint PPT Presentation

Theory of Computer Science March 27, 2019 C4. Regular Languages: Minimal Automata, Closure Properties and Decidability Theory of Computer Science C4. Regular Languages: Minimal Automata, Closure Properties C4.1 Minimal Automata and


  1. Theory of Computer Science March 27, 2019 — C4. Regular Languages: Minimal Automata, Closure Properties and Decidability Theory of Computer Science C4. Regular Languages: Minimal Automata, Closure Properties C4.1 Minimal Automata and Decidability Gabriele R¨ oger C4.2 Closure Properties University of Basel C4.3 Decidability March 27, 2019 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 1 / 31 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 2 / 31 C4. Regular Languages: Minimal Automata, Closure Properties and Decidability Minimal Automata Overview Regular Languages Grammars & Grammars DFAs C4.1 Minimal Automata Regular NFAs Languages Automata & Regular Formal Languages Expressions Context-free Pumping Languages Lemma Minimal Automata Context-sensitive & Type-0 Languages Properties Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 3 / 31 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 4 / 31

  2. C4. Regular Languages: Minimal Automata, Closure Properties C4. Regular Languages: Minimal Automata, Closure Properties and Decidability Minimal Automata and Decidability Minimal Automata Example Minimal Automaton: Definition The following DFAs accept the same language: Definition 0 , 1 A minimal automaton for a regular language L is a DFA M = � Q , Σ , δ, q 0 , E � with L ( M ) = L 0 0 q 0 q 1 q 4 and a minimal number of states. This means there is no DFA M ′ = � Q ′ , Σ , δ ′ , q ′ 0 , E ′ � 1 1 with L ( M ) = L ( M ′ ) and | Q ′ | < | Q | . q 2 q 2 1 1 1 How to find a minimal automaton? 0 1 0 1 0 Idea: 0 0 ◮ Start with any DFA that accepts the language. q 0 q 1 q 3 q 3 0 , 1 ◮ Merge states from which exactly the same words Question: What is the smallest DFA that accepts this language? lead to an end state. Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 5 / 31 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 6 / 31 C4. Regular Languages: Minimal Automata, Closure Properties C4. Regular Languages: Minimal Automata, Closure Properties and Decidability Minimal Automata and Decidability Minimal Automata Minimal Automaton: Algorithm Minimal Automaton: Example 0 0 q 0 q 1 q 4 0 , 1 q 1 × Input: DFA M (without states that are unreachable from the start state) q 2 × 1 1 Output: list of states that have to be merged q 3 × × to obtain an equivalent minimal automaton q 2 q 4 × × × × 1 1 1 Create table of all pairs of states { q , q ′ } with q � = q ′ . 0 q 0 q 1 q 2 q 3 2 Mark all pairs { q , q ′ } with q ∈ E and q ′ / ∈ E . 0 States q 0 , q 2 and q 1 , q 3 can be 3 If there is an unmarked pair { q , q ′ } where { δ ( q , a ) , δ ( q ′ , a ) } merged into one state each. q 3 for some a ∈ Σ is already marked, then also mark { q , q ′ } . 4 Repeat the last step until there are no more changes. 1 5 All states in pairs that are still unmarked can be merged Result: 0 q 0 q 2 q 1 q 3 q 4 0 , 1 1 into one state. 0 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 7 / 31 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 8 / 31

  3. C4. Regular Languages: Minimal Automata, Closure Properties C4. Regular Languages: Minimal Automata, Closure Properties and Decidability Minimal Automata and Decidability Minimal Automata Computation and Uniqueness of Minimal Automata Overview Regular Languages Grammars & Grammars Theorem DFAs The algorithm described on the previous slides produces a minimal Regular automaton for the language accepted by the given input DFA. NFAs Languages Theorem Automata & Regular Formal Languages Expressions All minimal automata for a language L are unique Context-free up to isomorphism (i.e., renaming of states). Pumping Languages Lemma Without proof. Minimal Automata Context-sensitive & Type-0 Languages Properties Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 9 / 31 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 10 / 31 C4. Regular Languages: Minimal Automata, Closure Properties C4. Regular Languages: Minimal Automata, Closure Properties and Decidability Closure Properties and Decidability Closure Properties Closure Properties How can you combine regular languages in a way to get another regular language C4.2 Closure Properties as a result? Picture courtesy of stockimages / FreeDigitalPhotos.net Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 11 / 31 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 12 / 31

  4. C4. Regular Languages: Minimal Automata, Closure Properties C4. Regular Languages: Minimal Automata, Closure Properties and Decidability Closure Properties and Decidability Closure Properties Closure Properties: Operations Closure Properties Let L and L ′ be regular languages over Σ and Σ ′ , respectively. Definition (Closure) Let K be a class of languages. We consider the following operations: ◮ union L ∪ L ′ = { w | w ∈ L or w ∈ L ′ } over Σ ∪ Σ ′ Then K is closed. . . ◮ . . . under union if L , L ′ ∈ K implies L ∪ L ′ ∈ K ◮ intersection L ∩ L ′ = { w | w ∈ L and w ∈ L ′ } over Σ ∩ Σ ′ ◮ . . . under intersection if L , L ′ ∈ K implies L ∩ L ′ ∈ K L = { w ∈ Σ ∗ | w / ◮ complement ¯ ∈ L } over Σ ◮ product LL ′ = { uv | u ∈ L and v ∈ L ′ } over Σ ∪ Σ ′ ◮ . . . under complement if L ∈ K implies ¯ L ∈ K ◮ special case: L n = L n − 1 L , where L 0 = { ε } ◮ . . . under product if L , L ′ ∈ K implies LL ′ ∈ K ◮ star L ∗ = � k ≥ 0 L k over Σ ◮ . . . under star if L ∈ K implies L ∗ ∈ K German: Abgeschlossenheit, K ist abgeschlossen unter Vereinigung German: Abschlusseigenschaften, Vereinigung, Schnitt, Komplement, German: (Schnitt, Komplement, Produkt, Stern) German: Produkt, Stern Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 13 / 31 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 14 / 31 C4. Regular Languages: Minimal Automata, Closure Properties C4. Regular Languages: Minimal Automata, Closure Properties and Decidability Closure Properties and Decidability Closure Properties Clourse Properties of Regular Languages Closure Properties Proof. Closure under union, product, and star follows because for regular expressions α and β , the expressions ( α | β ), ( αβ ) and ( α ∗ ) describe the corresponding languages. Theorem The regular languages are closed under: Complement: Let M = � Q , Σ , δ, q 0 , E � be a DFA with L ( M ) = L . ◮ union Then M ′ = � Q , Σ , δ, q 0 , Q \ E � is a DFA with L ( M ′ ) = ¯ L . ◮ intersection Intersection: Let M 1 = � Q 1 , Σ 1 , δ 1 , q 01 , E 1 � and ◮ complement M 2 = � Q 2 , Σ 2 , δ 2 , q 02 , E 2 � be DFAs. The product automaton ◮ product M = � Q 1 × Q 2 , Σ 1 ∩ Σ 2 , δ, � q 01 , q 02 � , E 1 × E 2 � ◮ star with δ ( � q 1 , q 2 � , a ) = � δ 1 ( q 1 , a ) , δ 2 ( q 2 , a ) � accepts L ( M ) = L ( M 1 ) ∩ L ( M 2 ). German: Kreuzproduktautomat Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 15 / 31 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 16 / 31

  5. C4. Regular Languages: Minimal Automata, Closure Properties C4. Regular Languages: Minimal Automata, Closure Properties and Decidability Decidability and Decidability Decidability Decision Problems and Decidability (1) “Intuitive Definition:” Decision Problem, Decidability A decision problem is an algorithmic problem where ◮ for a given input C4.3 Decidability ◮ an algorithm determines if the input has a given property ◮ and then produces the output “yes” or “no” accordingly. A decision problem is decidable if an algorithm for it (that always gives the correct answer) exists. German: Entscheidungsproblem, Eingabe, Eigenschaft, Ausgabe, German: entscheidbar Note: “exists” � = “is known” Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 17 / 31 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 18 / 31 C4. Regular Languages: Minimal Automata, Closure Properties C4. Regular Languages: Minimal Automata, Closure Properties and Decidability Decidability and Decidability Decidability Decision Problems and Decidability (2) Decision Problems: Example For now we describe decision problems in a semi-formal “given”/“question” way: Notes: ◮ not a formal definition: we did not formally define Example (Emptiness Problem for Regular Languages) “algorithm”, “input”, “output” etc. (which is not trivial) The emptiness problem P ∅ for regular languages ◮ lack of a formal definition makes it difficult to prove is the following problem: that something is not decidable Given: regular grammar G � studied thoroughly in the next part of the course Question: Is L ( G ) = ∅ ? German: Leerheitsproblem Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 19 / 31 Gabriele R¨ oger (University of Basel) Theory of Computer Science March 27, 2019 20 / 31

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend