NFA vs DFA DFA: For every state q in S and every character  in , one and only one transition of the following form occurs:  q q’ NFA: For every state.

Slides:



Advertisements
Similar presentations
Non-Deterministic Finite Automata
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.
Complexity and Computability Theory I Lecture #4 Rina Zviel-Girshin Leah Epstein Winter
Regular Expressions and DFAs COP 3402 (Summer 2014)
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 3 School of Innovation, Design and Engineering Mälardalen University 2012.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
Finite Automata Great Theoretical Ideas In Computer Science Anupam Gupta Danny Sleator CS Fall 2010 Lecture 20Oct 28, 2010Carnegie Mellon University.
1 Introduction to Computability Theory Lecture4: Regular Expressions Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture3: Regular Expressions Prof. Amos Israeli.
Introduction to Computability Theory
Courtesy Costas Busch - RPI1 Non Deterministic Automata.
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.
1 Single Final State for NFAs and DFAs. 2 Observation Any Finite Automaton (NFA or DFA) can be converted to an equivalent NFA with a single final state.
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.
Fall 2006Costas Busch - RPI1 Non-Deterministic Finite Automata.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
1 Non-Deterministic Automata Regular Expressions.
Fall 2004COMP 3351 Another NFA Example. Fall 2004COMP 3352 Language accepted (redundant state)
Costas Busch - LSU1 Non-Deterministic Finite Automata.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
1 A Single Final State for Finite Accepters. 2 Observation Any Finite Accepter (NFA or DFA) can be converted to an equivalent NFA with a single final.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
REGULAR LANGUAGES.
Equivalence of Pushdown Automata and Context-Free Grammars (1) Theorem. Given a context-free grammar CG = ( ,NT,R,S), then there is a pushdown automaton.
Prof. Busch - LSU1 NFAs accept the Regular Languages.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 3 Mälardalen University 2010.
Recap: Transformation NFA  DFA  s s1s1... snsn p1p1 p2p2... pmpm >...  p1p1  p2p2  pipi s e s1s1 e s2s2 e sisi >
Transparency No. 2-1 Formal Language and Automata Theory Homework 2.
Nondeterministic Finite Automata (NFAs). Reminder: Deterministic Finite Automata (DFA) q For every state q in Q and every character  in , one and only.
98 Nondeterministic Automata vs Deterministic Automata We learned that NFA is a convenient model for showing the relationships among regular grammars,
Finite Automata Great Theoretical Ideas In Computer Science Victor Adamchik Danny Sleator CS Spring 2010 Lecture 20Mar 30, 2010Carnegie Mellon.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
1 Introduction to the Theory of Computation Regular Expressions.
Regular Languages Chapter 1 Giorgi Japaridze Theory of Computability.
Complexity and Computability Theory I Lecture #5 Rina Zviel-Girshin Leah Epstein Winter
1/29/02CSE460 - MSU1 Nondeterminism-NFA Section 4.1 of Martin Textbook CSE460 – Computability & Formal Language Theory Comp. Science & Engineering Michigan.
Recap: Nondeterministic Finite Automaton (NFA) A deterministic finite automaton (NFA) is a 5-tuple (Q, , ,s,F) where: Q is a finite set of elements called.
6. Pushdown Automata CIS Automata and Formal Languages – Pei Wang.
Formal Language & Automata Theory
CIS Automata and Formal Languages – Pei Wang
Non Deterministic Automata
Chapter 2 Finite Automata
Nondeterministic Finite Automata
Single Final State for NFA
Chapter 2 FINITE AUTOMATA.
Language Recognition (12.4)
Solution Prove by induction the following statement:
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
REGULAR LANGUAGES AND REGULAR GRAMMARS
Hierarchy of languages
Non-Determinism 12CS45 Finite Automata.
Course 4 Finite Automata (part 2)
Lecture3 DFA vs. NFA, properties of RL
Non-Deterministic Finite Automata
CS 154, Lecture 3: DFANFA, Regular Expressions.
Non-Deterministic Finite Automata
Nondeterministic Finite Automata
Non Deterministic Automata
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
CS21 Decidability and Tractability
Chapter 1 Regular Language - 02
Language Recognition (12.4)
CS21 Decidability and Tractability
NFA to DFA conversion and regular expressions
CSC 4170 Theory of Computation Nondeterminism Section 1.2.
Chapter 1 Regular Language
Finite-State Machines with No Output
CSCI 2670 Introduction to Theory of Computing
CHAPTER 1 Regular Languages
CSCI 2670 Introduction to Theory of Computing
Presentation transcript:

NFA vs DFA DFA: For every state q in S and every character  in , one and only one transition of the following form occurs:  q q’ NFA: For every state q in S and every character  in   {e}, one (or both) of the following will happen: q q’  No transition: occurs One or more transitions: p …

NFA vs DFA (2) All deterministic automata are non deterministic Given a nondeterministic automaton, it is always possible to find a an equivalent deterministic automaton “doing the same”? That is, given an NFA M = (Q,, ,s,F) does there exists an equivalent DFA M’ = (Q’,, ’,s’,F’)? YES! : Q × (  {e}) × (Q) ’: Q’×   Q’ We are going to construct the DFA by using the given NFA

Equivalence of NFA and DFA Definition. Two automata A and A’ are equivalent if they recognize the same language. Theorem. Given any NFA A, then there exists a DFA A’ such that A’ is equivalent to A

Idea of the Transformation: NFA  DFA We would like: For every transition in NFA:  qj qi q There is a transition in the equivalent DFA: Qi  Qj where Qi (or Qj) is related to qi (or qj)

Idea (2): Remove Non Determinism DFA NFA q  q1 q2 . qn q1  q2  . q q  qn This is the set: The states in the DFA will be elements in (Q) (q, )

Step 1: Assign Arcs . . DFA: p1 q1 p2 q2  pm qn If in the original NFA: q qi  pj

Step 1 : Variation Let S be an state formed by {q1, q2, …, qn}, we denote the set (S, ) as the set of all states that are reachable from states in S by reading  DFA: q1 q2  (S, ) . qn

Step 2 : Eliminating e-Transitions … e  (S, )  (S, )  P’ P’’ … DFA:

Step 3: Handling Undetermined Transitions Suppose that  = { a, b} and we have only a transition for a: NFA: a qj qi q What should we do for b? q qi a qj b  DFA:

Step 4: Determining Favorable States We will make states favorable in the DFA only if they contain at least one state which is favorable in the NFA q1 q2 . qn DFA: NFA: qi

Examples a r r s q q > b b b a r r s q q > e b b

Proof Given an NFA M = (Q,,,s,F) suppose that we use the procedure discussed to obtain a DFA M’ = (Q’,, ,s’,F’). What needs to be shown to prove that M and M’ are equivalent? For each w accepted by M’, w is also accepted by the NFA For each w accepted by M, w is also accepted by the DFA We will show the first one for a “generic” word: w = 1 2 … n Where each i is in 

Proof (2) Proof by induction on the length n of the word w = 1 2 … n n = 1 n = k  n = k+1 Suppose that w is accepted by the DFA, what does this means? s’ 1 s1 2 … n sn Where s’ and each si and s’ are states in the DFA (i.e., elements in (Q); where Q are the states in the NFA) D:

Construction . D: q1 q2  (S, ) qm states in the NFA Where S = {q1, q2, …, qm}, Assume no e-transitions for the moment

DFA: 1 2 n We have: s s1 … sn We want: s 1 q1 2 … n qn NFA: Select state q1 in s1 such that: s q1 1 s1 = (s, 1) … Select state qn-1 in sn-1 such that: qn-1 qn n sn-1 = (sn-2, n-1) Select state qn in sn such that sn = (sn-1, n) qn is favorable in DFA

Dealing with e-transitions P’ P’’ e e … e  (S, )  (S, )  P’ P’’ … D: States in NFA …

. DFA: 1 2 n We have: s’ s1 … sn We want: s ’1 q1 ’2 … ’m qm NFA: m  n each ’i is either an j or e n qn-1 . P’ qm P n-1 sn qn-2 e … e …

Main Result The other direction is very simple (do it!): For each w accepted by N, w is also accepted by D Theorem. Given any NFA N, then there exists a DFA D such that N is equivalent to D

Homework for Friday Sep. 14 Write formally the NFA of Slide # 5 in NFA.ppt (class about nondeterministic automata) That is, write each of the elements of: (Q,, ,s,F). Use the procedure described in this class or the one in the book (they have some small differences) to obtain the DFA equivalent to the NFA that is on top of Slide # 12 Also explain in words why these two automata are equivalent Exercise 1.11 Problem 1.31 Problem 1.37 (so for example, C3 is the set of all binary numbers that are multiples of 3 including: 0, 11, 110, 1001, …)