1 / 11

CS310

CS310. Converting NFA to DFA Sections:1.2 Page 54 September 15, 2006. Quick Review. 5 tuple ( Q, Σ , δ , q 0 ,F) Σ ε = Σ U { ε } δ : Q x Σ ε -> P (Q) Every NFA has an equivalent DFA (Th 1.39) We can convert from NFA to DFA NFAs are often easier to build

alaura
Download Presentation

CS310

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS310 Converting NFA to DFA Sections:1.2 Page 54 September 15, 2006

  2. Quick Review • 5 tuple ( Q, Σ, δ , q0,F) Σε = Σ U {ε} δ : Q x Σε-> P(Q) Every NFA has an equivalent DFA (Th 1.39) We can convert from NFA to DFA NFAs are often easier to build DFAs are easier to code

  3. Let’s define the δ` δ : Q x ∑ -> P(Q) in NFA δ` : Q` x ∑ -> Q` in DFA R є Q` , a є ∑ δ`(R, a) = { q є Q| q єδ(r, a) some r є R } Union of all sets that can be reached from a state in set R using the δ with input a δ`(R, a) = U r є Rδ(r, a)

  4. Converting NFA to DFA - ε Transitions • Define start state and δ` to include all states that can be reached from a given state by 0 or more ε transitions E(R) = { q | q can be reached from R by using 0 or more ε transitions } δ`(R, a) = { q є Q | q єE(δ(r, a)) for some r є R } δ`(R, a) = { q є Q | q єδ(r, a) for some r є R }

  5. Conversion Example (with δ) NFA DFA Q`={Ø, ∑`={a,b} Q0`= F` = { Q={1,2,3} ∑={a,b} Q0 = 1 F = {1} 1 ε b a 2 3 a,b a

  6. NFA-DFA equivalence • Th 1.25: Every NFA has an equivalent DFA Corollary: A language is regular if and only if there exists an NFA that recognizes it Proof: If the language is regular, there exists a DFA that recognizes it. Each DFA is an NFA. Conversely, if there exists an NFA that recognizes the language, convert the NFA to a DFA.

  7. Proof with NFAs • Theorem 1.25: The class of regular languages is closed under the union operation. • We proved this using DFAs • What was the computation the new DFA simulated? • Is it any easier to prove using NFAs?

  8. Proof with NFAs • Regular languages are closed under concatenation this is where we stopped using DFAs what made this hard for DFAs?

  9. Practice • Construct an NFA to recognize concatenation of DFAs A = { w | w contains at least three1s} B = { ε }

  10. Proof with NFAs • Regular languages are closed under Kleene star What is Kleene star?

  11. Practice • Construct an NFA to recognize Kleene star of A if A= { w | w contains at least two 0s and at most one 1}

More Related