Document Sample

Formal Methods in Computer Science CS1502 Equivalence of NFAs and DFAs Patchrawat Uthaisombut University of Pittsburgh 1 Goals • Equivalence of NFAs and DFAs • Closure properties of regular languages. • General idea of closure property • Closure of regular languages under regular operations. 2 and P(Q) • = { } • If = {a, b} • Then = { a, b, } • P(Q) = power set of Q • If Q = {A,B,C} • Then P(Q) = { {}, {A}, {B}, {C}, {A,B}, {A,C}, {B,C}, {A,B,C} } • Note, if Q has n members, then P(Q) has 2^n members. 3 Definition of DFA • A (Deterministic) Finite Automaton (FA, DFA) is a 5-tuple (Q,,,q0,F) where • Q is a finite set of states • is a finite alphabet • :QQ is the transition function • q0Q is the start state • FQ is the set of accept states 4 Definition of NFA • A Nondeterministic Finite Automaton (NFA) is a 5-tuple (Q,,,q0,F) where • Q is a finite set of states • is a finite alphabet • :QP(Q) is the transition function • q0Q is the start state • FQ is the set of accept states 5 1 q2 q3 0,1 q1 0 q4 q5 • M = (Q,,,q1,F) where 0 1 • Q = {q1,q2,q3,q4,q5} q1 {} { } {q2,q4} • = { 0, 1 } q2 {} {q3} { } • is given as the table q3 {q3} {q3} { } • q1 is the start state • F={ q3, q5 }. q4 {q5} {} {} q5 {} {} {} :QP(Q) 6 0,1 p 0 1, 0 p q r p q r 1 0100 p r 0 p q r 0 p q r 7 DFAs vs. NFAs • Are DFAs more powerful than NFAs? • Is there a language L that is recognized by some DFA but is not recognized by any NFA? • No. DFAs are special cases of NFAs. • Are NFAs more powerful than DFAs? • Unclear. • We will show that they are not. 8 0,1 p 0 1, 0 p q r p q r 1 0100 p r 0 p q r 0 p q r 9 E(R) • E(R) = { q | q can be reached from R by traveling along zero or more transitions} q2 q3 1 q1 0 q4 q5 • E( {q1} ) = ? • { q1, q2, q3, q4 } • E( {q2, q4} ) = ? • { q2, q3, q4 } 10 Equivalence of NFAs and DFAs • Let N=(Q,,,q0,F) be an NFA • Construct a DFA M=(Q’,,’, q0’,F’) as follows 1. Q’ = P(Q) 2. for RQ’ and a, let ’(R,a) = { q Q | q E(’(r,a)) for some r R }. 3. q0’ = E( {q0} ) 4. F’ = { RQ’ | R contains an accept state of N } • We claim that L(M) = L(N). 11 Implications • Are NFAs more powerful than DFAs? • Is there a language L that is recognized by some NFA but is not recognized by any DFA? • We can use NFAs to study the question • “If A and B are regular, is A . B regular?” 12 Union: revisit • If A and B are regular, is A B regular? • Yes. We proved that by simulating 2 machines in parallel. • A new proof • Make use of the equivalence of DFAs and NFAs. 13 Closure property • A set X and an operation y. • X is said to be closed under y if when we apply operation y to any member of X, the result is still a member of X. • Examples • The set of integers is closed under addition • The set of integers is not closed under division • The set of regular languages is closed under union. • Take any union of two regular languages and the result is still a regular language. 14 Closure under regular operations • The class of regular languages is closed under union. • The class of regular languages is closed under concatenation. • The class of regular languages is closed under star. • Proofs 15

DOCUMENT INFO

Shared By:

Categories:

Tags:

Stats:

views: | 0 |

posted: | 2/14/2012 |

language: | |

pages: | 15 |

OTHER DOCS BY wuzhengqin

How are you planning on using Docstoc?
BUSINESS
PERSONAL

By registering with docstoc.com you agree to our
privacy policy and
terms of service, and to receive content and offer notifications.

Docstoc is the premier online destination to start and grow small businesses. It hosts the best quality and widest selection of professional documents (over 20 million) and resources including expert videos, articles and productivity tools to make every small business better.

Search or Browse for any specific document or resource you need for your business. Or explore our curated resources for Starting a Business, Growing a Business or for Professional Development.

Feel free to Contact Us with any questions you might have.