closure under regular operations i
play

Closure under regular operations I Recall we define three - PowerPoint PPT Presentation

Closure under regular operations I Recall we define three operations: , , We will see that by using NFA, the proof is easier September 17, 2020 1 / 13 Union I Given two regular languages A 1 , A 2 under the same Is A 1 A 2


  1. Closure under regular operations I Recall we define three operations: ∪ , ◦ , ∗ We will see that by using NFA, the proof is easier September 17, 2020 1 / 13

  2. Union I Given two regular languages A 1 , A 2 under the same Σ Is A 1 ∪ A 2 regular? To prove that a language is regular, by definition, it should be accepted by one DFA (or an NFA) We will construct an NFA for A 1 ∪ A 2 Assume A 1 and A 2 are recognized by two NFAs N 1 and N 2 , respectively N 1 N 2 q 1 q 2 September 17, 2020 2 / 13

  3. Union II q 1 ǫ q 0 ǫ q 2 Formal definition September 17, 2020 3 / 13

  4. Union III Two NFAs: N 1 = ( Q 1 , Σ , δ 1 , q 1 , F 1 ) N 2 = ( Q 2 , Σ , δ 2 , q 2 , F 2 ) ∈ Σ Note for NFA, ǫ / September 17, 2020 4 / 13

  5. Union IV New NFA Q = Q 1 ∪ Q 2 ∪ { q 0 } q = q 0 F = F 1 ∪ F 2  δ 1 ( q , a ) q ∈ Q 1    q ∈ Q 2 δ 2 ( q , a )  δ ( q , a ) = { q 1 , q 2 } q = q 0 and a = ǫ    ∅ q = q 0 and a � = ǫ  September 17, 2020 5 / 13

  6. Union V The last case of δ is easily neglected September 17, 2020 6 / 13

  7. Closed Under Concatenation I Given two NFAs N 1 N 2 Idea: from any accept state of N 1 , add an ǫ link to q 2 (start state of N 2 ) The new machine: September 17, 2020 7 / 13

  8. Closed Under Concatenation II ǫ ǫ Formal definition. Given two automata ( Q 1 , Σ , δ 1 , q 1 , F 1 ) ( Q 2 , Σ , δ 2 , q 2 , F 2 ) September 17, 2020 8 / 13

  9. Closed Under Concatenation III New machine Q = Q 1 ∪ Q 2 q 0 = q 1 F = F 2 δ function:  δ 1 ( q , a ) q ∈ Q 1 \ F 1    δ 2 ( q , a ) q ∈ Q 2  δ ( q , a ) = δ 1 ( q , ǫ ) ∪ { q 2 } q ∈ F 1 , a = ǫ    q ∈ F 1 , a � = ǫ δ 1 ( q , a )  September 17, 2020 9 / 13

  10. Closed under star I Given the following machine Recall the star operation is defined as follows A ∗ = { x 1 · · · x k | k ≥ 0 , x i ∈ A } How about the following diagram September 17, 2020 10 / 13

  11. Closed under star II ǫ ǫ The problem is that ǫ may not be accepted How about making the start state an accepting one ǫ ǫ September 17, 2020 11 / 13

  12. Closed under star III This may make the machine to accept strings not in A A correct setting ǫ ǫ ǫ Formal definition Given the machine ( Q 1 , Σ , δ 1 , q 1 , F 1 ) September 17, 2020 12 / 13

  13. Closed under star IV New machine: Q = Q 1 ∪ { q 0 } q 0 : new start state F = F 1 ∪ { q 0 }  δ 1 ( q , a ) q ∈ Q 1 \ F 1    δ 1 ( q , a ) ∪ { q 1 } q ∈ F 1 , a = ǫ     δ ( q , a ) = q ∈ F 1 , a � = ǫ δ 1 ( q , a )  { q 1 } q = q 0 , a = ǫ     ∅ q = q 0 , a � = ǫ   September 17, 2020 13 / 13

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