bu cs 332 theory of computation
play

BU CS 332 Theory of Computation Lecture 3: Reading: Nondeterminism - PowerPoint PPT Presentation

BU CS 332 Theory of Computation Lecture 3: Reading: Nondeterminism Sipser Ch 1.1 1.2 Equivalence of NFAs and DFAs More on closure properties Mark Bun January 29, 2020 Non Nondeterminism 1 0,1 0 0 0 1 1 A


  1. BU CS 332 – Theory of Computation Lecture 3: Reading: • Nondeterminism Sipser Ch 1.1 ‐ 1.2 • Equivalence of NFAs and DFAs • More on closure properties Mark Bun January 29, 2020

  2. Non Nondeterminism 1 0,1 0 0 0 1 1 A Nondeterministic Finite Automaton (NFA) accepts if there is a way to make it reach an accept state. 1/29/2020 CS332 ‐ Theory of Computation 2

  3. Non Nondeterminism 1 0,1 0 0 0 1 1 Example: Does this NFA accept the string 1100? 1/29/2020 CS332 ‐ Theory of Computation 3

  4. Some special transitions 0 0, 1 1 1/29/2020 CS332 ‐ Theory of Computation 4

  5. Example 1 0 0 1/29/2020 CS332 ‐ Theory of Computation 5

  6. Example 0,1 0,1 0, 1 1 1/29/2020 CS332 ‐ Theory of Computation 6

  7. Formal Definition of a NFA  An NFA is a 5 ‐ tuple 0 is the set of states is the alphabet  is the transition function � 0  is the start state is the set of accept states accepts a string if there exists a path from 0 to an accept state that can be followed by reading . 1/29/2020 CS332 ‐ Theory of Computation 7

  8. Example 1 𝟓 𝟑 0  𝟏 𝟏 𝟒 𝟏 , 𝟐 𝟑 𝟒 𝟓 0 𝟓 𝟐  𝟑  𝟒 1/29/2020 CS332 ‐ Theory of Computation 8

  9. Example 0,1 0,1 0, 1 1 𝟐 𝟒 𝟏 𝟑   𝟏 𝟏  𝟏 , 𝟐 𝟑 𝟒 𝟏  𝟐  𝟑 𝟒 1/29/2020 CS332 ‐ Theory of Computation 9

  10. Nondeterminism Deterministic Nondeterministic Computation Computation Ways to think about nondeterminism • (restricted) parallel computation reject • tree of possible computations • guessing and verifying the “right” choice accept accept or reject 1/29/2020 CS332 ‐ Theory of Computation 10

  11. Why study NFAs? • Not really a realistic model of computation: Real computing devices can’t really try many possibilities in parallel But: • Useful tool for understanding power of DFAs/regular languages • NFAs can be simpler than DFAs • Lets us study “nondeterminism” as a resource (cf. P vs. NP) 1/29/2020 CS332 ‐ Theory of Computation 11

  12. NFAs can be simpler than DFAs A DFA that recognizes the 0,1 language : 0 1 0,1 An NFA that recognizes the language : 1 1/29/2020 CS332 ‐ Theory of Computation 12

  13. Sometimes DFAs mu must st be larger Theorem. Every DFA for the language must have at least 3 states. Proof: 1/29/2020 CS332 ‐ Theory of Computation 13

  14. Equivalence of NFAs and DFAs 1/29/2020 CS332 ‐ Theory of Computation 14

  15. Equivalence of NFAs and DFAs Every DFA is an NFA, so NFAs are at least as powerful as DFAs Theorem: For every NFA , there is a DFA such that Corollary: A language is regular if and only if it is recognized by an NFA 1/29/2020 CS332 ‐ Theory of Computation 15

  16. Equivalence of NFAs and DFAs (Proof)  Let be an NFA 0   0   recognizing Goal: Construct DFA Intuition: Run all threads of in parallel, maintaining the set of states where all threads are. reject Formally: “The Subset Construction” accept 1/29/2020 CS332 ‐ Theory of Computation 16

  17. NFA ‐ > DFA Example 1 a b 1/29/2020 CS332 ‐ Theory of Computation 17

  18. Subset Construction (Formally) Input: NFA 0   0   Output: DFA        for all and . 0   1/29/2020 CS332 ‐ Theory of Computation 18

  19. 0,1 NFA ‐ > DFA Example ε 0 3 1 2 1 1/29/2020 CS332 ‐ Theory of Computation 19

  20. Subset Construction (Formally) Input: NFA 0   0   Output: DFA        for all and . �∈� 0  0    contains some accept state of 1/29/2020 CS332 ‐ Theory of Computation 20

  21. Proving the Construction Works Claim: For every string , running on leads to state There exists a computation of on input ending at Proof idea: By induction on 1/29/2020 CS332 ‐ Theory of Computation 21

  22. Historical Note Subset Construction introduced in Rabin & Scott’s 1959 paper “Finite Automata and their Decision Problems” 1976 ACM Turing Award citation For their joint paper "Finite Automata and Their Decision Problem," which introduced the idea of nondeterministic machines, which has proved to be an enormously valuable concept. Their (Scott & Rabin) classic paper has been a continuous source of inspiration for subsequent work in this field. 1/29/2020 CS332 ‐ Theory of Computation 22

  23. Is this construction the best we can do? state NFA into a � ‐ state Subset construction converts an DFA Could there be a construction that always produces, say, an � ‐ state DFA? Theorem: For every , there is a language � such that 1. There is an ‐ state NFA recognizing � . 2. There is no DFA recognizing � with fewer than � states. Conclusion: For finite automata, nondeterminism provides an exponential savings over determinism (in the worst case). 1/29/2020 CS332 ‐ Theory of Computation 23

Recommend


More recommend