closed under complementation
play

Closed under complementation Proposition: Let be some finite - PDF document

15-251 Great Ideas in Theoretical Computer Science Lecture 4: Deterministic Finite Automaton (DFA), Part 2 January 25th, 2018 Closure properties of regular languages Closed under complementation Proposition: Let be some finite


  1. 15-251 Great Ideas in Theoretical Computer Science Lecture 4: Deterministic Finite Automaton (DFA), Part 2 January 25th, 2018 Closure properties of regular languages Closed under complementation Proposition: Let be some finite alphabet. Σ If is regular, then so is . L ⊆ Σ ∗ L = Σ ∗ \ L Proof:

  2. Closed under union Theorem: Let be some finite alphabet. Σ If and are regular, then so is . L 1 ⊆ Σ ∗ L 2 ⊆ Σ ∗ L 1 ∪ L 2 Proof: The mindset Step 1 : Imagining ourselves as a DFA

  3. Closed under union M 1 Example 0 strings with even q even L 1 = number of 1’s 1 1 strings with length L 2 = divisible by 3. 0 q odd 0 , 1 M 2 p 0 p 1 p 2 0 , 1 0 , 1 Closed under union M 1 Input: 101001 0 q even 1 1 0 q odd 0 , 1 M 2 p 0 p 1 p 2 0 , 1 0 , 1 Closed under union M 1 Input: 101001 0 q even 1 1 Accept 0 q odd 0 , 1 M 2 p 0 p 1 p 2 0 , 1 0 , 1

  4. Closed under union Main idea: M 1 Construct a DFA that keeps track of both at once. 0 q even 1 1 0 q odd 0 , 1 M 2 p 0 p 1 p 2 0 , 1 0 , 1 Closed under union Main idea: Construct a DFA that keeps track of both at once. q even q even q even p 0 p 1 p 2 q odd q odd q odd p 0 p 1 p 2 Step 2 : Formally defining the DFA

  5. Closed under union Proof: Let be a DFA deciding L 1 M = ( Q, Σ , δ , q 0 , F ) M 0 = ( Q 0 , Σ , δ 0 , q 0 and be a DFA deciding . 0 , F 0 ) L 2 We construct a DFA M 00 = ( Q 00 , Σ , δ 00 , q 00 0 , F 00 ) that decides , as follows: L 1 ∪ L 2 More closure properties Closed under union: Closed under concatenation: Closed under star: super awesome vs regular What is the relationship between super awesome and regular ?

  6. super awesome vs regular Theorem: Can define regular languages recursively as follows: Closed under concatenation Theorem: Let be some finite alphabet. Σ If and are regular, then so is . L 1 ⊆ Σ ∗ L 2 ⊆ Σ ∗ L 1 L 2 The mindset Imagine yourself as a DFA. Rules: 1) Can only scan the input once, from left to right. 2) Can only remember “constant” amount of information. should not change based on input length

  7. Step 1 : Imagining ourselves as a DFA M 1 0 1 M 2 q 0 0 0 q 3 q 1 1 0 1 1 0 1 q 0 q 0 0 0 1 1 0 q 0 0 q 2 q 4 2 1 1 Given , we need to decide if w ∈ Σ ∗ for u ∈ L 1 , v ∈ L 2 . w = uv Problem: Don’t know where ends, begins. u v When do you stop simulating and start simulating ? M 1 M 2 M 1 0 1 M 2 q 0 0 0 q 3 q 1 1 0 1 1 0 1 q 0 q 0 0 0 1 1 0 q 0 0 q 2 q 4 2 1 1 Suppose God tells you ends at . u w 3 0 0 1 1 0 0 1 0 0 1 w 1 w 2 w 3 w 4 w 5 w 6 w 7 w 8 w 9 w 10 q 0 q 1 q 1 q 3 q 0 q 0 q 0 q 0 q 0 q 0 q 0 q 0 0 2 2 2 1 2 2 1 thread :

  8. M 1 0 1 automatic M 2 teleportation q 0 0 0 q 3 q 1 1 0 1 1 0 1 q 0 q 0 0 0 1 1 0 q 0 0 q 2 q 4 2 1 1 0 0 1 1 0 0 1 0 0 1 1 w 1 w 2 w 3 w 4 w 5 w 6 w 7 w 8 w 9 w 10 w 11 q 0 q 1 q 1 q 3 q 2 q 4 q 1 q 3 q 1 q 1 q 3 q 2 thread1 q 0 q 0 q 0 q 0 q 0 q 0 q 0 q 0 q 0 2 2 1 0 0 2 2 1 2 thread2 q 0 q 0 q 0 q 0 q 0 q 0 q 0 1 0 0 1 0 1 2 thread3 q 0 q 0 q 0 q 0 q 0 1 2 1 0 0 q 0 q 0 thread4 0 2 M 1 0 1 automatic M 2 teleportation q 0 0 0 q 3 q 1 1 0 1 1 0 1 q 0 q 0 0 0 1 1 0 q 0 0 q 2 q 4 2 1 1 0 0 1 1 0 0 1 0 0 1 1 w 1 w 2 w 3 w 4 w 5 w 6 w 7 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