1 / 19

COSC 3340: Introduction to Theory of Computation

Learn about the formal definitions of NFA, NFA acceptance, DFA equivalence, language operations like concatenation and Kleene star, with examples and constructions. Understand closure properties and complement operations of regular languages.

donaldkelly
Download Presentation

COSC 3340: Introduction to Theory of Computation

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. COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 4 UofH - COSC 3340 - Dr. Verma

  2. Formal definition of NFA acceptance • Define *(q, w) as a set of states: p ε*(q, w) if there is a directed path from q to p labeled w • Example: consider NFA of Lecture 3 • *(q0, 1) = ? • Ans: {q0, q1} • *(q0, 11) = ? • Ans: {q0, q1, q2} UofH - COSC 3340 - Dr. Verma

  3. NFA acceptance (contd.) • w is accepted by NFA M iff *(q0, w)  F isnonempty. • L(M) = {w in * | w is accepted by M}. UofH - COSC 3340 - Dr. Verma

  4. NFA vs. DFA • Is NFA more powerful than DFA? • Ans: No. • Theorem: • For every NFA M there is an equivalent DFA M' • Proof Idea: • NFA is in a set of states at any point during reading a string. • DFA will use a lot of states to keep track of this. • Important Assumption: • No transition labeled by epsilon. (Will get rid of this assumption later.) UofH - COSC 3340 - Dr. Verma

  5. Equivalent DFA construction. • NFA M = (Q, , , s, F) • DFA M' = (Q', , , s', F') where: • Q' = 2Q • s' = {s} • F' = {P ε Q' | P  F is nonempty} • ({p1, p2, …, pm}, ) = *(p1, ) *(p2, )  ... *(pm, ) i.e. find all the states that can be reached on  from all the NFA states in a DFA state. UofH - COSC 3340 - Dr. Verma

  6. Example: Equivalent DFA construction NFA UofH - COSC 3340 - Dr. Verma

  7. Equivalent DFA construction (contd.) UofH - COSC 3340 - Dr. Verma

  8. How to handle epsilon transitions? • Define e-closure of state q as *(q, ). • notation: e-closure(q). • Example: UofH - COSC 3340 - Dr. Verma

  9. Handling epsilon transitions (contd.) • Extend e-closure to sets of states by: • e-closure({s1, ... , sm}) = e-closure(s1)  ...  e-closure(sm) Now let s' = e-closure({s}). and, ({p1,..., pm}, ) = e-closure(*(p1, ))  ...  e-closure(*(pm, )) to complete construction of DFA. UofH - COSC 3340 - Dr. Verma

  10. Example: Handling epsilon transitions. UofH - COSC 3340 - Dr. Verma

  11. DFA = ? UofH - COSC 3340 - Dr. Verma

  12. Language Operations • Concatenation. Notation: LL' or just LL' • L  L' = {uv | u in L, v in L'}. • Kleene Star. Notation: L* • L* = { w in * | w = w1...wk for some k >= 0 and each wi in L}. • Examples: if L = {a(2n+1) | n >= 0}. L' = {b(2n) | n > = 0}. • LL' = ? • Ans: LL' = {a(2n+1) b(2m)| n, m > = 0} • L* = ? • Ans: {an | n >= 0} • U, ., * are called regular operations. UofH - COSC 3340 - Dr. Verma

  13. Closure properties of regular languages. • Previously we saw closure under  and . • New: Regular languages are closed under • Concatenation • Kleene star • Complement. UofH - COSC 3340 - Dr. Verma

  14. Examples L = {w in {a,b}* | w has even a’s } UofH - COSC 3340 - Dr. Verma

  15. Examples L' = {w in {a,b}* | w has at least one b} UofH - COSC 3340 - Dr. Verma

  16. Construction for LL' L’’ = (K,,,s,F)K = K1  K2s = s1F = F2 = 1  2  F1 X {e} X {s2} UofH - COSC 3340 - Dr. Verma

  17. L* and L'* L* M = (K, , , s, F)K = {s}  K1F = {s}  F1 = 1  F1 X {e} X {s1}  {(s, e, s1)} Given M1 = (K1, , 1, s1, F1) L’* UofH - COSC 3340 - Dr. Verma

  18. Complement of L and L' Complement of L Complement of L’ UofH - COSC 3340 - Dr. Verma

  19. General Construction for Complement DFA M = (K, , δ, s, F)K = K1s = s1F = K - F1δ = δ1 L(M) = Complement of L(M1) DFA M1 = (K1, , δ1, s1, F1) Exercise: Will this construction work for NFAs? Explain your answer. UofH - COSC 3340 - Dr. Verma

More Related