Are DFAs and NFAs Equivalent

Slides:



Advertisements
Similar presentations
CSE 311 Foundations of Computing I
Advertisements

CSC 361NFA vs. DFA1. CSC 361NFA vs. DFA2 NFAs vs. DFAs NFAs can be constructed from DFAs using transitions: Called NFA- Suppose M 1 accepts L 1, M 2 accepts.
1 Module 20 NFA’s with -transitions –NFA- ’s Formal definition Simplifies construction –LNFA- –Showing LNFA  is a subset of LNFA (extra credit) and therefore.
Introduction to Computability Theory
1 Introduction to Computability Theory Discussion1: Non-Deterministic Finite Automatons Prof. Amos Israeli.
CS 310 – Fall 2006 Pacific University CS310 Converting NFA to DFA Sections:1.2 Page 54 September 15, 2006.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Regular.
Fall 2004COMP 3351 Single Final State for NFA. Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state.
Lecture 18 NFA’s with -transitions –NFA- ’s Formal definition Simplifies construction –LNFA- –Showing LNFA  is a subset of LNFA and therefore a subset.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Nondeterminism.
Lecture 3 Goals: Formal definition of NFA, acceptance of a string by an NFA, computation tree associated with a string. Algorithm to convert an NFA to.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
1 Non-Deterministic Automata Regular Expressions.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
NFA ε - NFA - DFA equivalence. What is an NFA An NFA is an automaton that its states might have none, one or more outgoing arrows under a specific symbol.
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
CSCI 2670 Introduction to Theory of Computing September 13.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
 2005 SDU Lecture11 Decidability.  2005 SDU 2 Topics Discuss the power of algorithms to solve problems. Demonstrate that some problems can be solved.
Lecture # 16. Applications of Incrementing and Complementing machines 1’s complementing and incrementing machines which are basically Mealy machines are.
Nondeterminism Subset Construction ε -Transitions.
Formal Language & Automata Theory
Standard Representations of Regular Languages
CSE322 PUMPING LEMMA FOR REGULAR SETS AND ITS APPLICATIONS
Properties of Regular Languages
Busch Complexity Lectures: Reductions
Reductions.
Reductions Costas Busch - LSU.
Chapter 2 Finite Automata
Nondeterministic Finite Automata
Single Final State for NFA
Chapter 2 FINITE AUTOMATA.
Jaya Krishna, M.Tech, Assistant Professor
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Course 4 Finite Automata (part 2)
Non-Deterministic Finite Automata
Properties of Regular Languages
Principles of Computing – UFCFA3-30-1
COSC 3340: Introduction to Theory of Computation
Non-Deterministic Finite Automata
Decidable Languages Costas Busch - LSU.
DFA Equivalence & Minimization
Introduction to Finite Automata
4b Lexical analysis Finite Automata
Chapter Two: Finite Automata
Discrete Math II Howon Kim
CSCI 2670 Introduction to Theory of Computing
Undecidable problems:
MA/CSSE 474 Theory of Computation
4b Lexical analysis Finite Automata
Instructor: Aaron Roth
MA/CSSE 474 Theory of Computation
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
CSE 311 Foundations of Computing I
Chapter 1 Regular Language
Regular Language Equivalence and DFA Minimization
NFA’s With ε-Transitions
CSCI 2670 Introduction to Theory of Computing
AUTOMATA THEORY.
Automata, Grammars and Languages
Teori Bahasa dan Automata Lecture 6: Regular Expression
CHAPTER 1 Regular Languages
NFAs accept the Regular Languages
CSCI 2670 Introduction to Theory of Computing
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

Are DFAs and NFAs Equivalent It turns out DFAs and NFAs accept exactly the same languages. To show this we must prove every DFA can be converted into an NFA which accepts the same language, and vice-versa

Power of a class of machines We can simulate DFA's by C programs: For every DFA A over (say) {0,1}, there exists a C program which takes binary strings w as inputs and returns a boolean value True iff wL(A). Thus, C programs are at least as powerful as DFAs (big surprise). We will see later that the converse is not true: there exist C programs whose languages of accepted strings are not the languages of any DFA.

Comparing DFA and NFA Here we will compare the powers of DFAs and NFAs. Since every DFA is at the same time an NFA, the latter are at least as powerful. Surprisingly, they are not more powerful. Theorem. For every NFA N, there exists a DFA D such that L(D)=L(N). Thus, a language L is accepted by some NFA if and only if it is accepted by some DFA. Given N, we can effectively construct the corresponding D.

Example Consider the NFA that accepts binary strings ending with 011. The key idea for building an equivalent DFA is to consider the set of all states this NFA can reach after reading any particular string. We'll examine all strings starting with the shortest. Q0 Q1 Q3 0,1 1 Q2

Q0 Q1 Q3 0,1 1 Q2 {q0} {q0,q1} {q0,q2} {q0,q3} 1 When processing if we see a set exactly the same as a set constructed earlier we mark it in red.

{q0} {q0,q1} {q0,q2} {q0,q3} 1 01 02 03 1 By “bending” the arrows to the red sets back to the first known set with those elements we construct a DFA. Each state of the DFA corresponds to a set of states of the NFA

General Construction N =(Q,S,s,F,) D =(P(Q),S,{s}, F’, d), Given an NFA: N =(Q,S,s,F,) The associated DFA is D =(P(Q),S,{s}, F’, d), Where In the DFA constructed each state is labeled with a set of states from the NFA. Thus the start state is just the singleton set {s} F' is the set of {subsets of Q} that contain an element of F. Thus F’ P(Q) d is defined by d(S,a) = {qÎ S} (q,a)

Example Let's compute two transitions of D, where N is as in the previous example. d({q0,q2},1) = D(q0,1)È D(q2,1) = {q0}È{q3} = {q0,q3} d({q0,q1,q3},0) = D(q0,0)È D(q1,0)È D(q3,0) = {q0,q1}ÈÆÈÆ = {q0,q1} Q0 Q1 Q3 0,1 1 Q2

Exponential Blowup Note that if the NFA N has n states, then the corresponding DFA D has 2n states. Many of those states can usually be discarded; we must keep only those states that are reachable from the initial state. There are cases, however, when there is no state to discard;  

Note, Original NFA has 4 states The computed DFA has 16 states Only some of the 16 are reachable from the start state {Q0}